~ubuntu-branches/ubuntu/karmic/fweb/karmic

« back to all changes in this revision

Viewing changes to Web/fweave.c

  • Committer: Bazaar Package Importer
  • Author(s): Yann Dirson
  • Date: 2002-01-04 23:20:22 UTC
  • Revision ID: james.westby@ubuntu.com-20020104232022-330ad4iyzpvb5bm4
Tags: upstream-1.62
ImportĀ upstreamĀ versionĀ 1.62

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
#if(0)
 
2
  FTANGLE v1.60,\
 
3
 created with UNIX on "Thursday, September 24, 1998 at 16:12." \
 
4
  COMMAND LINE: "Web/ftangle Web/fweave -A -# --F -= 1.62/Web/fweave.c"\
 
5
  RUN TIME:     "Friday, September 25, 1998 at 8:02."\
 
6
  WEB FILE:     "Web/fweave.web"\
 
7
  CHANGE FILE:  (none)
 
8
#endif
 
9
#define _FWEAVE_h  
 
10
#define _FWEB_h   \
 
11
 
 
12
#define FWEAVE_HDR  "% FWEAVE" \
 
13
 
 
14
#define normal  0
 
15
#define roman  1
 
16
#define wildcard  2
 
17
#define typewriter  3 \
 
18
 
 
19
#define is_reserved(a)(a->ilk>typewriter) \
 
20
 
 
21
#define append_xref(c)if(xref_ptr==xmem_end) \
 
22
OVERFLW("cross-references","r"); \
 
23
else \
 
24
{ \
 
25
(++xref_ptr)->num= c; \
 
26
xref_ptr->Language= (boolean)language; \
 
27
} \
 
28
 
 
29
#define def_flag  ID_FLAG \
 
30
 
 
31
#define xref  equiv_or_xref \
 
32
 \
 
33
 \
 
34
 \
 
35
 
 
36
#define app(a)*(tok_ptr++)= a
 
37
#define APP_ID  app(id_flag+PTR_DIFF(sixteen_bits,id_lookup(id_first,id_loc,normal),name_dir))
 
38
#define app1(a)app(tok_flag+PTR_DIFF(sixteen_bits,(a)->trans,tok_start)) \
 
39
 
 
40
#undef expr  
 
41
#define expr  1 \
 
42
 
 
43
#undef unop  
 
44
#define unop  2 \
 
45
 
 
46
#undef binop  
 
47
#define binop  3 \
 
48
 
 
49
#define unorbinop  4 \
 
50
 
 
51
#define cast  5
 
52
#define question  6
 
53
#define lbrace  7
 
54
#define rbrace  8
 
55
#define decl_hd  9
 
56
#define comma  10
 
57
#define lpar  11
 
58
#define rpar  12
 
59
#define lbracket  13
 
60
#define rbracket  14
 
61
#define new_like  17
 
62
#define exp_op  18 \
 
63
 
 
64
#define max_math  19 \
 
65
 \
 
66
 
 
67
#define struct_hd  21
 
68
#define decl  20
 
69
#define label  22
 
70
#define stmt  23
 
71
#define functn  24
 
72
#define fn_decl  25
 
73
#define else_like  26
 
74
#define semi  27
 
75
#define colon  28
 
76
#define tag  29
 
77
#define if_hd  30
 
78
#define common_hd  31
 
79
#define read_hd  32
 
80
#define slashes  33
 
81
#define implicit_hd  34
 
82
#define lproc  35
 
83
#define rproc  36
 
84
#define ignore_scrap  37
 
85
#define for_hd  38
 
86
#define newline  39
 
87
#define language_scrap  40 \
 
88
 
 
89
#define do_like  55
 
90
#define for_like  56
 
91
#define if_like  57
 
92
#define int_like  58
 
93
#define case_like  59
 
94
#define sizeof_like  60
 
95
#define struct_like  61
 
96
#define typedef_like  62
 
97
#define define_like  63
 
98
#define common_like  64
 
99
#define read_like  65 \
 
100
 \
 
101
 
 
102
#define entry_like  66
 
103
#define implicit_like  67
 
104
#define assign_like  68
 
105
#define built_in  69 \
 
106
 
 
107
#define Rdo_like  70
 
108
#define endif_like  71
 
109
#define end_like  72
 
110
#define END_like  73
 
111
#define go_like  74
 
112
#define no_order  75
 
113
#define until_like  76
 
114
#define IF_like  77
 
115
#define IF_top  78
 
116
#define else_hd  79
 
117
#define ELSE_like  80
 
118
#define space  81
 
119
#define LPROC  82
 
120
#define UNOP  83
 
121
#define BINOP  84
 
122
#define COMMA  85
 
123
#define _EXPR  86
 
124
#define _EXPR_  87
 
125
#define EXPR_  88
 
126
#define Decl_hd  89
 
127
#define key_wd  90
 
128
#define program_like  91
 
129
#define CASE_like  92
 
130
#define modifier  93
 
131
#define class_like  94
 
132
#define op_like  95
 
133
#define proc_like  97
 
134
#define private_like  98
 
135
#define slash_like  99
 
136
#define fcn_hd  100
 
137
#define END_stmt  101
 
138
#define huge_like  102
 
139
#define imp_reserved  103
 
140
#define extern_like  104
 
141
#define while_do  105
 
142
#define template  106
 
143
#define langle  107
 
144
#define tstart  108
 
145
#define tlist  109
 
146
#define rangle  110
 
147
#define namespace  111
 
148
#define virtual  112
 
149
#define reference  113
 
150
#define kill_newlines  114 \
 
151
 
 
152
#define ignore  0
 
153
#define verbatim  (eight_bits)02
 
154
#define force_line  (eight_bits)03 \
 
155
 
 
156
#define begin_comment0  (eight_bits)0376
 
157
#define begin_comment1  (eight_bits)0375
 
158
#define begin_comment  (eight_bits)011 \
 
159
 
 
160
#define compound_assignment  (eight_bits)017 \
 
161
 \
 
162
 
 
163
#define L_switch  (eight_bits)0200
 
164
#define begin_C  (eight_bits)0201
 
165
#define begin_RATFOR  (eight_bits)0202
 
166
#define begin_FORTRAN  (eight_bits)0203
 
167
#define begin_LITERAL  (eight_bits)0204
 
168
#define begin_TEX  (eight_bits)0205 \
 
169
 
 
170
#define begin_nuweb  (eight_bits)0206 \
 
171
 \
 
172
 \
 
173
 
 
174
#define dont_expand  (eight_bits)0210
 
175
#define auto_label  (eight_bits)0211
 
176
#define all_variable_args  (eight_bits)0212
 
177
#define macro_module_name  (eight_bits)0213
 
178
#define eq_gt  (eight_bits)0214
 
179
#define colon_colon  (eight_bits)0215 \
 
180
 \
 
181
 \
 
182
 \
 
183
 \
 
184
 \
 
185
 
 
186
#define switch_math_flag  (eight_bits)0175
 
187
#define underline  (eight_bits)0176 \
 
188
 
 
189
#define next_expr  (eight_bits)0226
 
190
#define next_reserved  (eight_bits)0227 \
 
191
 
 
192
#define xref_roman  (eight_bits)0233
 
193
#define xref_wildcard  (eight_bits)0234
 
194
#define xref_typewriter  (eight_bits)0235
 
195
#define TeX_string  (eight_bits)0236
 
196
#define ascii_constant  (eight_bits)0237
 
197
#define join  (eight_bits)0240
 
198
#define thin_space  (eight_bits)0241
 
199
#define math_break  (eight_bits)0242
 
200
#define line_break  (eight_bits)0243
 
201
#define ln_break_outdent  (eight_bits)0244 \
 
202
 
 
203
#define big_line_break  (eight_bits)0245
 
204
#define no_line_break  (eight_bits)0246
 
205
#define pseudo_semi  (eight_bits)0247
 
206
#define defd_at  (eight_bits)0250 \
 
207
 
 
208
#define begin_meta  (eight_bits)0251
 
209
#define end_meta  (eight_bits)0252 \
 
210
 
 
211
#define macro_space  (eight_bits)0253
 
212
#define copy_mode  (eight_bits)0254 \
 
213
 
 
214
#define toggle_output  (eight_bits)0255
 
215
#define turn_output_on  (eight_bits)0255
 
216
#define turn_output_off  (eight_bits)0256
 
217
#define Turn_output_on  (eight_bits)0257
 
218
#define Turn_output_off  (eight_bits)0260 \
 
219
 
 
220
#define left_preproc  (eight_bits)0261
 
221
#define right_preproc  (eight_bits)0262 \
 
222
 
 
223
#define Cont_Char  (eight_bits)0263 \
 
224
 
 
225
#define Compiler_Directive  (eight_bits)0264
 
226
#define new_output_file  (eight_bits)0265 \
 
227
 
 
228
#define implicit_reserved  (eight_bits)0266 \
 
229
 
 
230
#define trace  (eight_bits)0267 \
 
231
 \
 
232
 \
 
233
 
 
234
#define invisible_cmnt  (eight_bits)0272 \
 
235
 
 
236
#define pseudo_expr  (eight_bits)0273
 
237
#define pseudo_colon  (eight_bits)0274 \
 
238
 
 
239
#define begin_bp  (eight_bits)0275
 
240
#define insert_bp  (eight_bits)0276 \
 
241
 
 
242
#define no_index  (eight_bits)0277
 
243
#define yes_index  (eight_bits)0300 \
 
244
 
 
245
#define no_mac_expand  (eight_bits)0301
 
246
#define protect_code  (eight_bits)0302
 
247
#define set_line_info  (eight_bits)0303 \
 
248
 
 
249
#define short_fcn  (eight_bits)0304
 
250
#define keyword_name  (eight_bits)0305 \
 
251
 \
 
252
 
 
253
#define formatt  (eight_bits)0310 \
 
254
 
 
255
#define limbo_text  (eight_bits)0313
 
256
#define op_def  (eight_bits)0314
 
257
#define macro_def  (eight_bits)0315 \
 
258
 
 
259
#define definition  (eight_bits)0320
 
260
#define undefinition  (eight_bits)0321
 
261
#define WEB_definition  (eight_bits)0322 \
 
262
 \
 
263
 
 
264
#define m_ifdef  (eight_bits)0330
 
265
#define m_ifndef  (eight_bits)0331
 
266
#define m_if  (eight_bits)0332
 
267
#define m_else  (eight_bits)0333
 
268
#define m_elif  (eight_bits)0334
 
269
#define m_endif  (eight_bits)0335
 
270
#define m_for  (eight_bits)0336
 
271
#define m_endfor  (eight_bits)0337
 
272
#define m_line  (eight_bits)0340
 
273
#define m_undef  (eight_bits)0341 \
 
274
 \
 
275
 
 
276
#define begin_code  (eight_bits)0350
 
277
#define module_name  (eight_bits)0351 \
 
278
 \
 
279
 
 
280
#define new_module  (eight_bits)0352 \
 
281
 \
 
282
 \
 
283
 
 
284
#define constant  (eight_bits)0230
 
285
#define stringg  (eight_bits)0231
 
286
#define identifier  (eight_bits)0232 \
 
287
 
 
288
#define ordinary_space  01 \
 
289
 \
 
290
 
 
291
#define compress(c)if(loc++<=limit)return(eight_bits)c \
 
292
 
 
293
#define COMPOUND(c,n)if(loc<=limit){loc+= n;assignment_token= c; \
 
294
return(eight_bits)compound_assignment;} \
 
295
 
 
296
#define CA_START  (eight_bits)0100 \
 
297
 \
 
298
 
 
299
#define plus_eq  0
 
300
#define minus_eq  01
 
301
#define star_eq  02
 
302
#define slash_eq  03
 
303
#define mod_eq  04
 
304
#define xor_eq  05
 
305
#define and_eq  06
 
306
#define or_eq  07
 
307
#define gt_gt_eq  010
 
308
#define lt_lt_eq  011
 
309
#define or_or_or  012 \
 
310
 
 
311
#define BINARY_CODE  046
 
312
#define OCTAL_CODE  0176
 
313
#define HEX_CODE  0140 \
 
314
 
 
315
#define CONSTANT_CODE  043
 
316
#define FLOAT_CODE  060
 
317
#define LONG_CODE  061
 
318
#define UNSIGNED_CODE  062
 
319
#define ULONG_CODE  063 \
 
320
 
 
321
#define EXP_CODE  0136
 
322
#define HOLLERITH_CODE  045 \
 
323
 
 
324
#define discretionary_break  (eight_bits)0177
 
325
#define NBREAK  25 \
 
326
 
 
327
#define change_params  prms[incl_depth].input_params \
 
328
 
 
329
#define CANT_DO(part)cant_do(OC(#part)) \
 
330
 
 
331
#define KILL_XREFS(name)no_xref|= !defn_mask.name
 
332
#define INDEX_SHORT  index_short= index_flag= YES \
 
333
 
 
334
#define QUICK_FORMAT  056 \
 
335
 
 
336
#define IS_ON(flag,bits)((flag)&(bits)) \
 
337
 
 
338
#define NEVER_USED  1
 
339
#define MULTIPLE_USES  2 \
 
340
 
 
341
#define CHECK_OPEN   \
 
342
 
 
343
#define OUT_FILE  tex_file
 
344
#define C_LINE_WRITE(n) \
 
345
fflush(tex_file),FWRITE(out_buf+1,n,tex_file)
 
346
#define ASCII_LINE_WRITE(n) \
 
347
fflush(tex_file),ASCII_file_write(tex_file,out_buf+1,(size_t)(n))
 
348
#define TEX_PUTXCHAR(c)PUTC(c)
 
349
#define TEX_NEW_LINE  PUTC('\n')
 
350
#define TEX_PRINTF(s)fprintf(tex_file,s) \
 
351
 
 
352
#define out(c) \
 
353
{ \
 
354
if(out_ptr>=out_end) \
 
355
break_out(); \
 
356
*(++out_ptr)= (ASCII)(c); \
 
357
} \
 
358
 
 
359
#define OUT_STR(s)out_str(OC(s)) \
 
360
 
 
361
#define IDENTIFIER  YES
 
362
#define INDEX_ENTRY  NO \
 
363
 
 
364
#define app_tok(c){if(tok_ptr+2>tok_m_end) \
 
365
OVERFLW("tokens","tw"); \
 
366
app(c);} \
 
367
 
 
368
#define trans  trans_plus.Trans
 
369
#define no_math  2
 
370
#define yes_math  1
 
371
#define maybe_math  0 \
 
372
 
 
373
#define id_flag  ID_FLAG
 
374
#define res_flag  2*id_flag
 
375
#define mod_flag  ((sixteen_bits)(3*(sixteen_bits)id_flag)) \
 
376
 
 
377
#define tok_flag  ((sixteen_bits)(4*(sixteen_bits)id_flag))
 
378
#define inner_tok_flag  ((sixteen_bits)(5*(sixteen_bits)id_flag)) \
 
379
 \
 
380
 \
 
381
 
 
382
#define freeze_text  *(++text_ptr)= tok_ptr \
 
383
 
 
384
#define app_scrap(c,b) \
 
385
(++scrp_ptr)->cat= (eight_bits)(c); \
 
386
scrp_ptr->trans= text_ptr; \
 
387
scrp_ptr->mathness= (eight_bits)(5*(b)); \
 
388
 \
 
389
freeze_text \
 
390
 
 
391
#define INIT_OP(op_code,op_name,lang,op_macro,cat) \
 
392
init_op((eight_bits)(op_code),OC(op_name),(int)(lang),OC(op_macro), \
 
393
NO,cat,(CONST outer_char*)NULL) \
 
394
 \
 
395
 
 
396
#define INIT_CA(ca_index,op_name,lang,op_macro,cat) \
 
397
assignment_token= ca_index; \
 
398
INIT_OP(compound_assignment,OC(op_name),(int)(lang),OC(op_macro),cat) \
 
399
 \
 
400
 
 
401
#define INIT_DOT(op_name,lang,op_macro,cat) \
 
402
init_op((eight_bits)identifier,OC(op_name),(int)(lang),OC(op_macro), \
 
403
NO,cat,(CONST outer_char*)NULL) \
 
404
 
 
405
#define ONLY_C_like  ((int)C|(int)C_PLUS_PLUS)
 
406
#define ALL_BUT_C_like  (~ONLY_C_like)
 
407
#define ALL_BUT_Cpp  ((int)C|ONLY_N_like|(int)LITERAL) \
 
408
 
 
409
#define ONLY_N_like  ((int)FORTRAN|(int)FORTRAN_90|(int)RATFOR|(int)(RATFOR_90))
 
410
#define ALL_BUT_N_like  (~ONLY_N_like) \
 
411
 
 
412
#define ALL_LANGUAGES  (ONLY_C_like|ONLY_N_like|(int)LITERAL) \
 
413
 \
 
414
 
 
415
#define math_bin  (eight_bits)0345
 
416
#define math_rel  (eight_bits)0346 \
 
417
 
 
418
#define toggle_meta  (eight_bits)0347 \
 
419
 \
 
420
 
 
421
#define big_cancel  (eight_bits)0360
 
422
#define cancel  (eight_bits)0361 \
 
423
 \
 
424
 
 
425
#define indent  (eight_bits)0362
 
426
#define outdent  (eight_bits)0363
 
427
#define opt  (eight_bits)0364
 
428
#define backup  (eight_bits)0365
 
429
#define break_space  (eight_bits)0366
 
430
#define force  (eight_bits)0367
 
431
#define big_force  (eight_bits)0370 \
 
432
 
 
433
#define out_force  (eight_bits)0371 \
 
434
 
 
435
#define end_translation  (eight_bits)0377
 
436
#define inner  0
 
437
#define outer  1 \
 
438
 
 
439
#define cur_end  cur_state.end_field
 
440
#define cur_tok  cur_state.tok_field
 
441
#define cur_mode  cur_state.mode_field
 
442
#define ini_stack  stck_ptr= stack;cur_mode= outer \
 
443
 
 
444
#define res_word  (eight_bits)0201
 
445
#define mod_name  (eight_bits)0200 \
 
446
 
 
447
#define ALL_UC  (all_uc&&length(cur_name)>1) \
 
448
 \
 
449
 
 
450
#define XLANGUAGE_NAME_PTR(l)Xlanguages[lan_num(l)] \
 
451
 \
 
452
 
 
453
#define LANGUAGE_SYMBOL(l) \
 
454
(l!=global_language?LANGUAGE_CODE(l):(CONST outer_char*)"") \
 
455
 
 
456
#define save_position  save_line= out_line;save_place= out_ptr
 
457
#define emit_space_if_needed  if(save_line!=out_line||save_place!=out_ptr) \
 
458
{ \
 
459
OUT_STR("\\WY"); \
 
460
 \
 
461
yskipped= YES; \
 
462
} \
 
463
 
 
464
#define SUPPRESS(name)if(!defn_mask.name)suppress_defn= YES \
 
465
 
 
466
#define APP_TEMP(letter,arg)app_temp(OC(letter),OC(arg)) \
 
467
 
 
468
#define IMPROPER(m_type,msg)improper(OC(m_type),OC(msg)) \
 
469
 
 
470
#define APP_LANG(suffix)app_lang(OC(suffix)) \
 
471
 
 
472
#define NEW_TeX(file_name) \
 
473
if(tex_file!=stdout) \
 
474
{ \
 
475
fclose(tex_file); \
 
476
if((tex_file= FOPEN(file_name,"w"))==NULL) \
 
477
 \
 
478
fatal(ERR_W,OC("ABORTING:  "),OC("Can't open output file %s."),file_name); \
 
479
} \
 
480
 
 
481
#define N_CMD  1000 \
 
482
 
 
483
#define TO_TEMP(val) \
 
484
if(temp<temp_end) \
 
485
*temp++= val; \
 
486
else \
 
487
OVERFLW("Esc_buf:temp","") \
 
488
 
 
489
#define depth  cat
 
490
#define head  trans_plus.Head
 
491
#define sort_pointer  scrap_pointer
 
492
#define sort_ptr  scrp_ptr
 
493
#define max_sorts  max_scraps \
 
494
 
 
495
#define INFTY  255 \
 
496
 
 
497
#define NON_TEX_MACRO  '\1' \
 
498
 
 
499
#define ENCAP  YES
 
500
#define NO_ENCAP  NO \
 
501
 
 
502
 
 
503
 
 
504
 
 
505
#ifndef part
 
506
#define part 0 
 
507
#else
 
508
#if(part != 1 && part != 2 && part != 3)
 
509
#define part 1 
 
510
#endif
 
511
#endif 
 
512
 
 
513
 
 
514
 
 
515
 
 
516
#if(part == 0 || part == 1)
 
517
#define part1_or_extern
 
518
#define SET1(stuff)  =  stuff
 
519
#define TSET1(stuff)  =  stuff
 
520
#else
 
521
#define part1_or_extern extern
 
522
#define SET1(stuff)
 
523
#define TSET1(stuff)
 
524
#endif
 
525
 
 
526
 
 
527
 
 
528
 
 
529
 
 
530
#include "typedefs.h"
 
531
 
 
532
 
 
533
 
 
534
 
 
535
 
 
536
 
 
537
#include "map.h" 
 
538
 
 
539
 
 
540
 
 
541
 
 
542
typedef struct xref_info0
 
543
{
 
544
sixteen_bits num;
 
545
struct xref_info0 HUGE*xlink;
 
546
 
 
547
boolean Language;
 
548
}xref_info;
 
549
 
 
550
typedef xref_info HUGE*xref_pointer;
 
551
typedef ASCII HUGE*XREF_POINTER;
 
552
 
 
553
 
 
554
 
 
555
 
 
556
 
 
557
typedef sixteen_bits Token;
 
558
typedef Token HUGE*token_pointer;
 
559
typedef token_pointer HUGE*text_pointer;
 
560
 
 
561
 
 
562
 
 
563
typedef struct
 
564
{
 
565
eight_bits cat;
 
566
 
 
567
 
 
568
eight_bits mathness;
 
569
union
 
570
{
 
571
text_pointer Trans;
 
572
 
 
573
 
 
574
name_pointer Head;
 
575
 
 
576
 
 
577
}trans_plus;
 
578
}scrap;
 
579
 
 
580
typedef scrap HUGE*scrap_pointer;
 
581
 
 
582
 
 
583
 
 
584
typedef int mode;
 
585
 
 
586
typedef struct{
 
587
token_pointer end_field;
 
588
token_pointer tok_field;
 
589
boolean mode_field;
 
590
}output_state;
 
591
 
 
592
typedef output_state HUGE*stack_pointer;
 
593
 
 
594
 
 
595
 
 
596
 
 
597
#include "w_type.h" 
 
598
 
 
599
 
 
600
 
 
601
 
 
602
 
 
603
 
 
604
 
 
605
 
 
606
#ifdef SMALL_MEMORY
 
607
#define N_MSGBUF 2000
 
608
#else
 
609
#define N_MSGBUF 10000
 
610
#endif
 
611
 
 
612
 
 
613
 
 
614
 
 
615
 
 
616
EXTERN boolean change_exists;
 
617
 
 
618
 
 
619
 
 
620
#ifndef COMMON_FCNS_
 
621
IN_COMMON BUF_SIZE max_modules;
 
622
#endif
 
623
 
 
624
EXTERN BUF_SIZE max_refs;
 
625
EXTERN xref_info HUGE*xmem;
 
626
EXTERN xref_pointer xmem_end;
 
627
 
 
628
EXTERN xref_pointer xref_ptr;
 
629
 
 
630
EXTERN sixteen_bits xref_switch,mod_xref_switch;
 
631
EXTERN boolean defd_switch;
 
632
EXTERN NAME_TYPE defd_type SET(NEVER_DEFINED);
 
633
EXTERN boolean typd_switch;
 
634
EXTERN boolean index_short;
 
635
 
 
636
 
 
637
 
 
638
EXTERN long max_toks;
 
639
 
 
640
EXTERN Token HUGE*tok_mem;
 
641
EXTERN token_pointer tok_m_end;
 
642
 
 
643
EXTERN long max_texts;
 
644
 
 
645
EXTERN token_pointer HUGE*tok_start;
 
646
EXTERN text_pointer tok_end;
 
647
 
 
648
EXTERN token_pointer tok_ptr;
 
649
EXTERN text_pointer text_ptr;
 
650
 
 
651
EXTERN token_pointer mx_tok_ptr;
 
652
EXTERN text_pointer mx_text_ptr;
 
653
 
 
654
 
 
655
 
 
656
IN_STYLE eight_bits ccode[128];
 
657
 
 
658
 
 
659
 
 
660
 
 
661
EXTERN name_pointer cur_module;
 
662
EXTERN int math_flag SET(NO);
 
663
EXTERN boolean chk_end SET(YES);
 
664
EXTERN boolean last_was_cmnt SET(NO);
 
665
 
 
666
EXTERN boolean lst_ampersand SET(NO);
 
667
 
 
668
EXTERN boolean eat_blank_lines SET(NO);
 
669
EXTERN boolean just_inserted SET(NO);
 
670
EXTERN boolean empty_line SET(NO);
 
671
 
 
672
EXTERN ASCII c;
 
673
 
 
674
 
 
675
 
 
676
EXTERN eight_bits assignment_token;
 
677
 
 
678
 
 
679
 
 
680
 
 
681
EXTERN boolean insert_breaks SET(YES);
 
682
 
 
683
 
 
684
 
 
685
 
 
686
EXTERN boolean doing_cdir SET(NO);
 
687
 
 
688
 
 
689
 
 
690
EXTERN eight_bits next_control;
 
691
 
 
692
 
 
693
 
 
694
IN_COMMON outer_char wbprefix[MAX_FILE_NAME_LENGTH];
 
695
 
 
696
EXTERN boolean do_inside;
 
697
EXTERN boolean qtd_file;
 
698
 
 
699
#ifndef L_tmpnam
 
700
#define L_tmpnam 25
 
701
#endif
 
702
 
 
703
EXTERN outer_char temp_in[L_tmpnam],temp_out[L_tmpnam];
 
704
 
 
705
 
 
706
 
 
707
 
 
708
EXTERN name_pointer lhs,rhs;
 
709
 
 
710
 
 
711
 
 
712
 
 
713
EXTERN boolean unnamed_section SET(NO);
 
714
 
 
715
 
 
716
 
 
717
EXTERN xref_pointer cur_xref;
 
718
IN_COMMON boolean mod_warning_flag;
 
719
 
 
720
 
 
721
 
 
722
EXTERN BUF_SIZE line_length;
 
723
EXTERN ASCII HUGE*out_buf;
 
724
EXTERN ASCII HUGE*out_end;
 
725
 
 
726
EXTERN ASCII HUGE*out_ptr;
 
727
EXTERN LINE_NUMBER out_line;
 
728
 
 
729
 
 
730
 
 
731
EXTERN boolean output_on SET(YES);
 
732
 
 
733
 
 
734
 
 
735
EXTERN boolean strt_off SET(NO),ending_off SET(NO);
 
736
 
 
737
 
 
738
 
 
739
EXTERN boolean in_comment;
 
740
 
 
741
 
 
742
 
 
743
EXTERN long max_scraps;
 
744
EXTERN scrap HUGE*scrp_info;
 
745
EXTERN scrap_pointer scrp_end;
 
746
 
 
747
EXTERN scrap_pointer pp;
 
748
EXTERN scrap_pointer scrp_base;
 
749
EXTERN scrap_pointer scrp_ptr;
 
750
EXTERN scrap_pointer lo_ptr;
 
751
EXTERN scrap_pointer hi_ptr;
 
752
 
 
753
EXTERN scrap_pointer mx_scr_ptr;
 
754
 
 
755
 
 
756
 
 
757
EXTERN boolean scanning_meta SET(NO);
 
758
 
 
759
 
 
760
 
 
761
EXTERN boolean overloaded[NUM_LANGUAGES];
 
762
 
 
763
EXTERN BUF_SIZE op_entries;
 
764
EXTERN OPERATOR HUGE*op,HUGE*op_end;
 
765
 
 
766
EXTERN OPERATOR HUGE*op_ptr;
 
767
 
 
768
 
 
769
 
 
770
EXTERN eight_bits last_control;
 
771
 
 
772
 
 
773
 
 
774
EXTERN boolean did_arg;
 
775
 
 
776
 
 
777
 
 
778
EXTERN boolean the_type SET(NO_TYPE);
 
779
 
 
780
 
 
781
 
 
782
EXTERN output_state cur_state;
 
783
 
 
784
EXTERN BUF_SIZE stck_size;
 
785
EXTERN output_state HUGE*stack;
 
786
 
 
787
EXTERN stack_pointer stck_end;
 
788
 
 
789
EXTERN stack_pointer stck_ptr;
 
790
 
 
791
EXTERN stack_pointer mx_stck_ptr;
 
792
 
 
793
 
 
794
 
 
795
EXTERN name_pointer cur_name;
 
796
 
 
797
 
 
798
 
 
799
EXTERN LINE_NUMBER save_line;
 
800
EXTERN ASCII HUGE*save_place;
 
801
EXTERN boolean in_module SET(NO);
 
802
EXTERN boolean yskipped SET(NO);
 
803
 
 
804
 
 
805
 
 
806
IN_COMMON outer_char last_include_file[],this_include_file[];
 
807
 
 
808
 
 
809
 
 
810
EXTERN boolean ok_to_define SET(YES);
 
811
EXTERN boolean q_protected SET(NO);
 
812
EXTERN boolean suppress_defn SET(NO);
 
813
EXTERN boolean output_protect SET(NO);
 
814
 
 
815
 
 
816
 
 
817
EXTERN name_pointer this_module;
 
818
EXTERN name_pointer the_module;
 
819
 
 
820
 
 
821
 
 
822
 
 
823
EXTERN xref_pointer next_xref,this_xref,first_xref,mid_xref;
 
824
 
 
825
 
 
826
 
 
827
 
 
828
EXTERN sixteen_bits k_module;
 
829
 
 
830
 
 
831
 
 
832
EXTERN name_pointer bucket[128];
 
833
EXTERN name_pointer next_name;
 
834
IN_COMMON hash_pointer h;
 
835
 
 
836
IN_COMMON BUF_SIZE max_names;
 
837
 
 
838
EXTERN name_pointer HUGE*blink;
 
839
EXTERN ASCII last_letter SET('\0');
 
840
 
 
841
 
 
842
 
 
843
 
 
844
EXTERN eight_bits cur_depth;
 
845
EXTERN ASCII HUGE*cur_byte;
 
846
EXTERN sixteen_bits cur_val;
 
847
 
 
848
EXTERN sort_pointer mx_sort_ptr;
 
849
 
 
850
 
 
851
 
 
852
EXTERN ASCII collate[128];
 
853
EXTERN int max_collate;
 
854
 
 
855
 
 
856
 
 
857
EXTERN FILE*mx_file;
 
858
EXTERN outer_char HUGE*m_start;
 
859
EXTERN outer_char m_temp[100],m_temp0[100],m_temp1[100];
 
860
EXTERN boolean output_type;
 
861
EXTERN outer_char HUGE*temp_ndx,HUGE*temp_mds;
 
862
IN_COMMON outer_char wbflnm0[];
 
863
 
 
864
 
 
865
 
 
866
 
 
867
 
 
868
#if(part == 0 || part == 1)
 
869
 
 
870
 
 
871
int main FCN((ac,av))
 
872
int ac C0("Number of command-line arguments.")
 
873
outer_char**av C1("Array of pointers to command-line arguments.")
 
874
{
 
875
 
 
876
#if TIMING
 
877
ini_timer();
 
878
#endif 
 
879
 
 
880
argc= ac;argv= av;
 
881
 
 
882
ini_program(weave);
 
883
 
 
884
common_init();
 
885
 
 
886
 
 
887
 
 
888
 
 
889
ALLOC(xref_info,xmem,"r",max_refs,0);
 
890
xmem_end= xmem+max_refs-1;
 
891
 
 
892
 
 
893
 
 
894
ALLOC(Token,tok_mem,"tw",max_toks,1);
 
895
tok_mem++;
 
896
 
 
897
tok_m_end= tok_mem+max_toks-1;
 
898
 
 
899
ALLOC(token_pointer,tok_start,"x",max_texts,0);
 
900
tok_end= tok_start+max_texts-1;
 
901
 
 
902
 
 
903
 
 
904
ALLOC(ASCII,out_buf,"ll",line_length,1);
 
905
 
 
906
out_end= out_buf+line_length;
 
907
 
 
908
 
 
909
 
 
910
ALLOC(scrap,scrp_info,"s",max_scraps,0);
 
911
scrp_end= scrp_info+max_scraps-1;
 
912
 
 
913
 
 
914
{
 
915
int l;
 
916
 
 
917
for(l= 0;l<NUM_LANGUAGES;l++)
 
918
overloaded[l]= NO;
 
919
 
 
920
ALLOC(OPERATOR,op,"op",op_entries,0);
 
921
op_end= op+op_entries;
 
922
op_ptr= op+128;
 
923
 
 
924
 
 
925
 
 
926
INIT_OP(041,"NOT",ALL_LANGUAGES,"\\WR",unop);
 
927
INIT_DOT("NOT",ALL_BUT_C_like,"\\WR",unop);
 
928
 
 
929
 
 
930
INIT_OP(045,"MOD",ALL_LANGUAGES,"\\WMOD",binop);
 
931
 
 
932
 
 
933
INIT_OP(046,"LAND",C,"\\amp",unorbinop);
 
934
INIT_OP(046,"LAND",C_PLUS_PLUS,"\\amp",reference);
 
935
 
 
936
INIT_OP(046,"LAND",ALL_BUT_C_like,"\\WAND",binop);
 
937
 
 
938
 
 
939
INIT_OP(053,"PLUS",ALL_LANGUAGES,"+",unorbinop);
 
940
INIT_OP(055,"MINUS",ALL_LANGUAGES,"-",unorbinop);
 
941
 
 
942
INIT_OP(052,"STAR",ALL_LANGUAGES,"\\ast",unorbinop);
 
943
 
 
944
 
 
945
 
 
946
 
 
947
 
 
948
INIT_OP(057,"SLASH",ALL_BUT_N_like,"\\WSl",binop);
 
949
INIT_OP(057,"SLASH",ONLY_N_like,"/",binop);
 
950
 
 
951
INIT_OP(074,"LT",ALL_BUT_Cpp,"<",binop);
 
952
INIT_OP(074,"LT",C_PLUS_PLUS,"<",langle);
 
953
INIT_DOT("LT",ALL_BUT_C_like,"<",binop);
 
954
 
 
955
 
 
956
INIT_OP(075,"EQUALS",ALL_LANGUAGES,"=",binop);
 
957
 
 
958
INIT_OP(076,"GT",ALL_BUT_Cpp,">",binop);
 
959
INIT_OP(076,"GT",C_PLUS_PLUS,">",rangle);
 
960
INIT_DOT("GT",ALL_BUT_C_like,">",binop);
 
961
 
 
962
 
 
963
INIT_OP(077,"QUESTION",ONLY_C_like,"\\?",question);
 
964
 
 
965
INIT_OP(0136,"CARET",ALL_LANGUAGES,"\\Caret",binop);
 
966
 
 
967
 
 
968
INIT_OP(0174,"OR",ALL_LANGUAGES,"\\WOR",binop);
 
969
 
 
970
INIT_OP(0176,"TILDE",ONLY_C_like,"\\TLD",unop);
 
971
 
 
972
 
 
973
INIT_OP(not_eq,"NE",ALL_LANGUAGES,"\\WI",binop);
 
974
INIT_DOT("NE",ALL_BUT_C_like,"\\WI",binop);
 
975
 
 
976
 
 
977
INIT_OP(lt_eq,"LE",ALL_LANGUAGES,"\\WL",binop);
 
978
INIT_DOT("LE",ALL_BUT_C_like,"\\WL",binop);
 
979
 
 
980
 
 
981
INIT_OP(gt_eq,"GE",ALL_LANGUAGES,"\\WG",binop);
 
982
INIT_DOT("GE",ALL_BUT_C_like,"\\WG",binop);
 
983
 
 
984
 
 
985
INIT_OP(eq_eq,"EQ",ALL_LANGUAGES,"\\WS",binop);
 
986
INIT_DOT("EQ",ALL_BUT_C_like,"\\WS",binop);
 
987
 
 
988
 
 
989
INIT_OP(and_and,"AND",ALL_LANGUAGES,"\\WW",binop);
 
990
INIT_DOT("AND",ALL_BUT_C_like,"\\WW",binop);
 
991
 
 
992
 
 
993
INIT_OP(or_or,"OR",ALL_LANGUAGES,"\\WV",binop);
 
994
INIT_DOT("OR",ALL_BUT_C_like,"\\WOR",binop);
 
995
 
 
996
 
 
997
INIT_OP(plus_plus,"PP",ALL_LANGUAGES,"\\WPP",unop);
 
998
 
 
999
INIT_OP(minus_minus,"MM",ALL_LANGUAGES,"\\WMM",unop);
 
1000
 
 
1001
 
 
1002
INIT_OP(minus_gt,"EQV",ONLY_C_like,"\\WMG",binop);
 
1003
 
 
1004
INIT_OP(minus_gt,"EQV",ALL_BUT_C_like,"\\WEQV",binop);
 
1005
INIT_DOT("EQV",ALL_BUT_C_like,"\\WEQV",binop);
 
1006
 
 
1007
 
 
1008
INIT_OP(gt_gt,"RSHIFT",ONLY_C_like,"\\WGG",binop);
 
1009
 
 
1010
INIT_OP(lt_lt,"LSHIFT",ONLY_C_like,"\\WLL",binop);
 
1011
 
 
1012
INIT_OP(star_star,"EE",ALL_LANGUAGES,"\\WEE",exp_op);
 
1013
 
 
1014
INIT_OP(slash_slash,"SlSl",ALL_BUT_C_like,"\\WSlSl",binop);
 
1015
 
 
1016
 
 
1017
INIT_OP(ellipsis,"NEQV",ALL_BUT_C_like,"\\WNEQV",binop);
 
1018
INIT_DOT("NEQV",ALL_BUT_C_like,"\\WNEQV",binop);
 
1019
INIT_DOT("XOR",ALL_BUT_C_like,"\\WNEQV",binop);
 
1020
 
 
1021
 
 
1022
INIT_DOT("FALSE",ALL_BUT_C_like,"\\WFALSE",expr);
 
1023
 
 
1024
INIT_DOT("TRUE",ALL_BUT_C_like,"\\WTRUE",expr)
 
1025
 
 
1026
 
 
1027
;
 
1028
 
 
1029
 
 
1030
INIT_CA(plus_eq,"Wcp",ALL_LANGUAGES,"\\Wcp",binop);
 
1031
 
 
1032
INIT_CA(minus_eq,"Wcm",ALL_LANGUAGES,"\\Wcm",binop);
 
1033
 
 
1034
INIT_CA(star_eq,"Wcs",ALL_LANGUAGES,"\\Wcs",binop);
 
1035
 
 
1036
INIT_CA(slash_eq,"Wcv",ALL_LANGUAGES,"\\Wcv",binop);
 
1037
 
 
1038
INIT_CA(mod_eq,"Wcd",ONLY_C_like,"\\Wcd",binop);
 
1039
 
 
1040
INIT_CA(xor_eq,"Wcx",ONLY_C_like,"\\Wcx",binop);
 
1041
 
 
1042
INIT_CA(and_eq,"Wca",ONLY_C_like,"\\Wca",binop);
 
1043
 
 
1044
INIT_CA(or_eq,"Wco",ONLY_C_like,"\\Wco",binop);
 
1045
 
 
1046
INIT_CA(gt_gt_eq,"Wcg",ONLY_C_like,"\\Wcg",binop);
 
1047
 
 
1048
INIT_CA(lt_lt_eq,"Wcl",ONLY_C_like,"\\Wcl",binop)
 
1049
 
 
1050
 
 
1051
;
 
1052
}
 
1053
 
 
1054
 
 
1055
 
 
1056
ALLOC(output_state,stack,"kw",stck_size,0);
 
1057
stck_end= stack+stck_size-1;
 
1058
 
 
1059
 
 
1060
 
 
1061
ALLOC(name_pointer,blink,"n",max_names,0);
 
1062
 
 
1063
 
 
1064
 
 
1065
 
 
1066
 
 
1067
name_dir->xref= (XREF_POINTER)(xref_ptr= xmem);
 
1068
xref_switch= mod_xref_switch= defd_switch= index_short= NO;
 
1069
xmem->num= 0;
 
1070
 
 
1071
 
 
1072
 
 
1073
 
 
1074
{
 
1075
tok_ptr= tok_mem+1;
 
1076
tok_start[0]= tok_start[1]= tok_ptr;
 
1077
text_ptr= tok_start+1;
 
1078
}
 
1079
 
 
1080
 
 
1081
mx_tok_ptr= tok_ptr;mx_text_ptr= text_ptr;
 
1082
 
 
1083
 
 
1084
 
 
1085
zero_ccodes();
 
1086
ccode[057]= line_break;
 
1087
 
 
1088
 
 
1089
 
 
1090
{
 
1091
 
 
1092
ini_ccode((outer_char*)"new_module",(outer_char*)" \t*",new_module);
 
1093
 
 
1094
 
 
1095
ini_ccode((outer_char*)"begin_code",(outer_char*)"aA",begin_code);
 
1096
 
 
1097
ini_ccode((outer_char*)"module_name",(outer_char*)"<",module_name);
 
1098
 
 
1099
 
 
1100
ini_ccode((outer_char*)"definition",(outer_char*)"dD",definition);
 
1101
 
 
1102
ini_ccode((outer_char*)"undefinition",(outer_char*)"uU",undefinition);
 
1103
 
 
1104
ini_ccode((outer_char*)"WEB_definition",(outer_char*)"mM",WEB_definition);
 
1105
 
 
1106
ini_ccode((outer_char*)"formatt",(outer_char*)"fF",formatt);
 
1107
 
 
1108
 
 
1109
ini_ccode((outer_char*)"toggle_output",(outer_char*)"\001",toggle_output);
 
1110
 
 
1111
 
 
1112
ini_ccode((outer_char*)"ascii_constant",(outer_char*)"'\"",ascii_constant);
 
1113
 
 
1114
ini_ccode((outer_char*)"verbatim",(outer_char*)"=",verbatim);
 
1115
 
 
1116
ini_ccode((outer_char*)"ln_break_outdent",(outer_char*)"\\",ln_break_outdent);
 
1117
 
 
1118
 
 
1119
ini_ccode((outer_char*)"TeX_string",(outer_char*)"tT",TeX_string);
 
1120
 
 
1121
 
 
1122
ini_ccode((outer_char*)"L_switch",(outer_char*)"L",L_switch);
 
1123
 
 
1124
ini_ccode((outer_char*)"begin_C",(outer_char*)"c",begin_C);
 
1125
 
 
1126
ini_ccode((outer_char*)"begin_RATFOR",(outer_char*)"r",begin_RATFOR);
 
1127
 
 
1128
ini_ccode((outer_char*)"begin_FORTRAN",(outer_char*)"n",begin_FORTRAN);
 
1129
 
 
1130
ini_ccode((outer_char*)"begin_nuweb",(outer_char*)"N",begin_nuweb);
 
1131
 
 
1132
ini_ccode((outer_char*)"begin_TEX",(outer_char*)"x",begin_TEX);
 
1133
 
 
1134
 
 
1135
ini_ccode((outer_char*)"join",(outer_char*)"&",join);
 
1136
 
 
1137
ini_ccode((outer_char*)"underline",(outer_char*)"_",underline);
 
1138
 
 
1139
ini_ccode((outer_char*)"defd_at",(outer_char*)"[",defd_at);
 
1140
 
 
1141
ini_ccode((outer_char*)"implicit_reserved",(outer_char*)"`]",implicit_reserved);
 
1142
 
 
1143
 
 
1144
ini_ccode((outer_char*)"invisible_cmnt",(outer_char*)"%",invisible_cmnt);
 
1145
 
 
1146
ini_ccode((outer_char*)"Compiler_Directive",(outer_char*)"?",Compiler_Directive);
 
1147
 
 
1148
ini_ccode((outer_char*)"short_fcn",(outer_char*)"{",short_fcn);
 
1149
 
 
1150
ini_ccode((outer_char*)"keyword_name",(outer_char*)"kK",keyword_name);
 
1151
 
 
1152
 
 
1153
ini_ccode((outer_char*)"switch_math_flag",(outer_char*)"$",switch_math_flag);
 
1154
 
 
1155
 
 
1156
ini_ccode((outer_char*)"next_expr",(outer_char*)"E",next_expr);
 
1157
 
 
1158
ini_ccode((outer_char*)"next_reserved",(outer_char*)"R",next_reserved);
 
1159
 
 
1160
 
 
1161
ini_ccode((outer_char*)"xref_roman",(outer_char*)"^",xref_roman);
 
1162
 
 
1163
ini_ccode((outer_char*)"xref_typewriter",(outer_char*)".",xref_typewriter);
 
1164
 
 
1165
ini_ccode((outer_char*)"xref_wildcard",(outer_char*)"9",xref_wildcard);
 
1166
 
 
1167
{
 
1168
char temp[3];
 
1169
 
 
1170
sprintf(temp,";%c",XCHR(interior_semi));
 
1171
 
 
1172
ini_ccode((outer_char*)"pseudo_semi",(outer_char*)temp,pseudo_semi);
 
1173
}
 
1174
 
 
1175
 
 
1176
ini_ccode((outer_char*)"pseudo_expr",(outer_char*)"e",pseudo_expr);
 
1177
 
 
1178
ini_ccode((outer_char*)"pseudo_colon",(outer_char*)":",pseudo_colon);
 
1179
 
 
1180
 
 
1181
ini_ccode((outer_char*)"limbo_text",(outer_char*)"l",limbo_text);
 
1182
 
 
1183
ini_ccode((outer_char*)"op_def",(outer_char*)"vV",op_def);
 
1184
 
 
1185
ini_ccode((outer_char*)"macro_def",(outer_char*)"wW",macro_def);
 
1186
 
 
1187
 
 
1188
ini_ccode((outer_char*)"thin_space",(outer_char*)",",thin_space);
 
1189
 
 
1190
ini_ccode((outer_char*)"math_break",(outer_char*)"|",math_break);
 
1191
 
 
1192
ini_ccode((outer_char*)"big_line_break",(outer_char*)"#",big_line_break);
 
1193
 
 
1194
ini_ccode((outer_char*)"no_line_break",(outer_char*)"~",no_line_break);
 
1195
 
 
1196
 
 
1197
ini_ccode((outer_char*)"begin_meta",(outer_char*)"(",begin_meta);
 
1198
 
 
1199
ini_ccode((outer_char*)"end_meta",(outer_char*)")",end_meta);
 
1200
 
 
1201
 
 
1202
ini_ccode((outer_char*)"new_output_file",(outer_char*)"oO",new_output_file);
 
1203
 
 
1204
 
 
1205
ini_ccode((outer_char*)"begin_bp",(outer_char*)"B",begin_bp);
 
1206
 
 
1207
ini_ccode((outer_char*)"USED_BY_OTHER",(outer_char*)"}b",USED_BY_OTHER);
 
1208
 
 
1209
ini_ccode((outer_char*)"no_mac_expand",(outer_char*)"!",no_mac_expand);
 
1210
 
 
1211
ini_ccode((outer_char*)"USED_BY_OTHER",(outer_char*)"q",USED_BY_OTHER);
 
1212
 
 
1213
 
 
1214
ini_ccode((outer_char*)"no_index",(outer_char*)"-",no_index);
 
1215
 
 
1216
ini_ccode((outer_char*)"yes_index",(outer_char*)"+",yes_index);
 
1217
 
 
1218
 
 
1219
ini_ccode((outer_char*)"protect_code",(outer_char*)"p",protect_code);
 
1220
 
 
1221
 
 
1222
 
 
1223
#if(DEBUG)
 
1224
 
 
1225
ini_ccode((outer_char*)"trace",(outer_char*)"012",trace);
 
1226
#endif 
 
1227
 
 
1228
 
 
1229
}
 
1230
 
 
1231
 
 
1232
prn_codes();
 
1233
 
 
1234
 
 
1235
 
 
1236
mod_text[0]= 040;
 
1237
 
 
1238
 
 
1239
{
 
1240
out_ptr= out_buf;out_line= 1;
 
1241
 
 
1242
if(input_macros)
 
1243
{
 
1244
 
 
1245
TEX_PRINTF("%% --- FWEB's macro package ---\n\\input ");
 
1246
OUT_STR(*fwebmac?fwebmac:w_style.misc.macros);
 
1247
 
 
1248
}
 
1249
}
 
1250
 
 
1251
 
 
1252
 
 
1253
out_buf[0]= 0134;
 
1254
 
 
1255
 
 
1256
 
 
1257
scrp_base= scrp_info+1;
 
1258
 
 
1259
mx_scr_ptr= scrp_ptr= scrp_info;
 
1260
 
 
1261
 
 
1262
 
 
1263
mx_stck_ptr= stack;
 
1264
 
 
1265
 
 
1266
 
 
1267
mx_sort_ptr= scrp_info;
 
1268
 
 
1269
 
 
1270
 
 
1271
 
 
1272
collate[0]= 0;
 
1273
 
 
1274
;
 
1275
 
 
1276
 
 
1277
phase1();
 
1278
phase2();
 
1279
phase3();
 
1280
 
 
1281
return wrap_up();
 
1282
}
 
1283
 
 
1284
 
 
1285
 
 
1286
 
 
1287
 
 
1288
 
 
1289
SRTN
 
1290
open_tex_file(VOID)
 
1291
{
 
1292
if(STRCMP(tex_fname,"stdout")==0)
 
1293
tex_file= stdout;
 
1294
else
 
1295
{
 
1296
 
 
1297
{
 
1298
if(tex_file= FOPEN(tex_fname,"r"))
 
1299
{
 
1300
outer_char buf[80];
 
1301
 
 
1302
fgets((char*)buf,STRLEN(FWEAVE_HDR)+1,tex_file);
 
1303
 
 
1304
if(STRCMP(buf,FWEAVE_HDR))
 
1305
{
 
1306
if(!verify(OC("\n%c!!! Attempting to write FWEAVE's output \
 
1307
into %s%s%s, a file apparently not created by FWEAVE.  Continue"),
 
1308
beep(1),
 
1309
SSET_COLOR(out_file),
 
1310
tex_fname,
 
1311
SSET_COLOR(warning)))
 
1312
 
 
1313
fatal(ERR_W,OC("ABORTING:  "),OC("Didn't overwrite %s%s%s."),SSET_COLOR(out_file),tex_fname,SSET_COLOR(fatal));
 
1314
 
 
1315
puts("");
 
1316
}
 
1317
 
 
1318
fclose(tex_file);
 
1319
}
 
1320
}
 
1321
 
 
1322
 
 
1323
 
 
1324
 
 
1325
if((tex_file= FOPEN(tex_fname,"w"))==NULL)
 
1326
{
 
1327
 
 
1328
fatal(ERR_W,OC("ABORTING:  "),OC("Can't open output file %s."),tex_fname);
 
1329
}
 
1330
else
 
1331
 
 
1332
{
 
1333
fprintf(tex_file,"%s v%s (%s)\n\n",
 
1334
FWEAVE_HDR,(char*)version,(char*)release_date);
 
1335
}
 
1336
 
 
1337
 
 
1338
 
 
1339
}
 
1340
}
 
1341
 
 
1342
 
 
1343
 
 
1344
SRTN
 
1345
new_xref FCN((part0,p))
 
1346
PART part0 C0("")
 
1347
name_pointer p C1("")
 
1348
{
 
1349
xref_pointer q;
 
1350
sixteen_bits m,n;
 
1351
 
 
1352
if(index_flag==NO)
 
1353
{
 
1354
SET_TYPE(p,DEFINED_TYPE(p)|0x80);
 
1355
index_flag= BOOLEAN(!(language==LITERAL));
 
1356
}
 
1357
 
 
1358
 
 
1359
 
 
1360
if(!index_flag||!(output_on||index_hidden)||in_format
 
1361
||(unnamed_section&&!xref_unnamed))
 
1362
return;
 
1363
 
 
1364
 
 
1365
index_flag= BOOLEAN(!(language==LITERAL));
 
1366
 
 
1367
 
 
1368
if(defd_switch&&(part0==DEFINITION
 
1369
||!(preprocessing
 
1370
||is_reserved(p)||is_intrinsic(p)||is_keyword(p))))
 
1371
{
 
1372
sixteen_bits mod_defined= p->defined_in(language);
 
1373
 
 
1374
if(mod_defined&&mod_defined!=module_count&&language!=C_PLUS_PLUS)
 
1375
{
 
1376
 
 
1377
err0_print(ERR_W,OC("Identifier in %s was already explicitly \
 
1378
or implicitly\n\
 
1379
marked via @[ as defined in %s"),2,MOD_TRANS(module_count),MOD_TRANS(mod_defined));
 
1380
mark_harmless;
 
1381
}
 
1382
 
 
1383
p->defined_in(language)= module_count;
 
1384
defd_switch= NO;
 
1385
}
 
1386
 
 
1387
if(defd_type!=NEVER_DEFINED)
 
1388
SET_TYPE(p,defd_type);
 
1389
 
 
1390
defd_type= NEVER_DEFINED;
 
1391
 
 
1392
if(xref_switch==NO
 
1393
&&(is_reserved(p)
 
1394
||((!(index_short||index_one))&&(length(p)==1))))
 
1395
return;
 
1396
 
 
1397
 
 
1398
#if 0
 
1399
if(xref_switch==NO
 
1400
&&(is_reserved(p)))
 
1401
return;
 
1402
#endif
 
1403
 
 
1404
if(index_short)
 
1405
index_short= NO;
 
1406
 
 
1407
if(no_xref)
 
1408
return;
 
1409
 
 
1410
m= module_count+xref_switch;
 
1411
xref_switch= NO;
 
1412
q= (xref_pointer)p->xref;
 
1413
 
 
1414
if(!(do_inside||all_includes||(quoted_includes&&qtd_file)))
 
1415
goto check_implicit;
 
1416
 
 
1417
if(q!=xmem)
 
1418
{
 
1419
n= q->num;
 
1420
 
 
1421
if(n==m||n==m+def_flag)
 
1422
goto check_implicit;
 
1423
 
 
1424
else if(m==n+def_flag)
 
1425
{
 
1426
q->num= m;
 
1427
 
 
1428
goto check_implicit;
 
1429
}
 
1430
}
 
1431
 
 
1432
 
 
1433
append_xref(m);
 
1434
 
 
1435
 
 
1436
xref_ptr->xlink= q;p->xref= (XREF_POINTER)xref_ptr;
 
1437
 
 
1438
check_implicit:
 
1439
if(typd_switch)
 
1440
 
 
1441
{
 
1442
NAME_INFO rs_wd;
 
1443
name_pointer lhs= p,rhs= &rs_wd;
 
1444
 
 
1445
rhs->ilk= int_like;
 
1446
rhs->reserved_word= rhs->Language= BOOLEAN(language);
 
1447
rhs->intrinsic_word= rhs->keyword= NO;
 
1448
 
 
1449
 
 
1450
{
 
1451
lhs->ilk= rhs->ilk;
 
1452
 
 
1453
 
 
1454
 
 
1455
#define RST_BIT(field) lhs->field =  BOOLEAN(lhs->field & ~(boolean)language)\
 
1456
  | (rhs->field & (boolean)language)
 
1457
 
 
1458
RST_BIT(reserved_word);
 
1459
RST_BIT(Language);
 
1460
RST_BIT(intrinsic_word);
 
1461
RST_BIT(keyword);
 
1462
 
 
1463
#undef RST_BIT
 
1464
}
 
1465
 
 
1466
 
 
1467
 
 
1468
 
 
1469
 
 
1470
for(q= (xref_pointer)p->xref;q>xmem;q= q->xlink)
 
1471
if(q->num<def_flag)q->num+= def_flag;
 
1472
 
 
1473
typd_switch= NO;
 
1474
}
 
1475
 
 
1476
 
 
1477
}
 
1478
 
 
1479
 
 
1480
 
 
1481
SRTN
 
1482
new_mod_xref FCN((p))
 
1483
name_pointer p C1("")
 
1484
{
 
1485
xref_pointer q,r;
 
1486
 
 
1487
 
 
1488
q= (xref_pointer)p->xref;r= xmem;
 
1489
 
 
1490
if(q>xmem)
 
1491
{
 
1492
if(mod_xref_switch==NO)
 
1493
{
 
1494
while(q->num>=def_flag)
 
1495
{
 
1496
r= q;
 
1497
q= q->xlink;
 
1498
}
 
1499
}
 
1500
else
 
1501
{
 
1502
if(q->num>=def_flag)
 
1503
{
 
1504
r= q;
 
1505
q= q->xlink;
 
1506
}
 
1507
}
 
1508
}
 
1509
 
 
1510
if(mod_xref_switch==NO)
 
1511
{
 
1512
p->mod_info->params.uses++;
 
1513
 
 
1514
if(q->num==module_count)
 
1515
return;
 
1516
}
 
1517
 
 
1518
append_xref(module_count+mod_xref_switch);
 
1519
xref_ptr->xlink= q;mod_xref_switch= NO;
 
1520
 
 
1521
if(r==xmem)
 
1522
p->xref= (XREF_POINTER)xref_ptr;
 
1523
else
 
1524
r->xlink= xref_ptr;
 
1525
}
 
1526
 
 
1527
 
 
1528
 
 
1529
 
 
1530
boolean
 
1531
names_match FCN((p,first,l,t))
 
1532
name_pointer p C0("Points to the proposed match.")
 
1533
CONST ASCII HUGE*first C0("Position of first character of string.")
 
1534
int l C0("Length of identifier.")
 
1535
eight_bits t C1("Desired ilk.")
 
1536
{
 
1537
if(length(p)!=l)return NO;
 
1538
 
 
1539
if((p->Language&(boolean)language)&&(p->ilk!=t)&&!(t==normal&&
 
1540
is_reserved(p)))
 
1541
return NO;
 
1542
 
 
1543
return(boolean)(!STRNCMP(first,p->byte_start,l));
 
1544
}
 
1545
 
 
1546
 
 
1547
 
 
1548
SRTN
 
1549
ini_p FCN((p,t))
 
1550
name_pointer p C0("")
 
1551
eight_bits t C1("")
 
1552
{
 
1553
CONST ASCII HUGE*k;
 
1554
 
 
1555
p->ilk= t;p->xref= (XREF_POINTER)xmem;
 
1556
 
 
1557
 
 
1558
p->info.upper_case= NO;
 
1559
 
 
1560
for(k= p->byte_start;k<byte_ptr;k++)
 
1561
if(isAlpha(*k)&&!isAupper(*k))
 
1562
return;
 
1563
 
 
1564
p->info.upper_case= YES;
 
1565
}
 
1566
 
 
1567
SRTN ini_node FCN((node))
 
1568
CONST name_pointer node C1("")
 
1569
{
 
1570
node->xref= (XREF_POINTER)xmem;
 
1571
 
 
1572
 
 
1573
{
 
1574
 
 
1575
 
 
1576
node->mod_info= GET_MEM("mod_info",1,MOD_INFO);
 
1577
 
 
1578
node->mod_info->Ilk= expr;
 
1579
node->mod_info->params= params;
 
1580
node->mod_info->params.uses= 0;
 
1581
 
 
1582
node->Language= (boolean)language;
 
1583
}
 
1584
 
 
1585
 
 
1586
 
 
1587
}
 
1588
 
 
1589
 
 
1590
 
 
1591
 
 
1592
SRTN
 
1593
skip_limbo(VOID)
 
1594
{
 
1595
WHILE()
 
1596
{
 
1597
if(loc>limit&&!get_line())
 
1598
return;
 
1599
 
 
1600
*(limit+1)= 0100;
 
1601
 
 
1602
 
 
1603
while(*loc!=0100)
 
1604
loc++;
 
1605
 
 
1606
 
 
1607
if(loc++<=limit)
 
1608
switch(ccode[*loc++])
 
1609
{
 
1610
 
 
1611
 
 
1612
 
 
1613
 
 
1614
 
 
1615
case begin_C:
 
1616
case begin_RATFOR:
 
1617
case begin_FORTRAN:
 
1618
case begin_LITERAL
 
1619
 
 
1620
 
 
1621
 
 
1622
:
 
1623
loc--;
 
1624
 
 
1625
 
 
1626
case L_switch:
 
1627
 
 
1628
{
 
1629
 
 
1630
{
 
1631
ASCII l= *loc++;
 
1632
 
 
1633
switch(l)
 
1634
{
 
1635
 
 
1636
case 0143
 
1637
 
 
1638
:
 
1639
Cpp= BOOLEAN(*loc==053);
 
1640
break;
 
1641
 
 
1642
 
 
1643
case 0162
 
1644
 
 
1645
:
 
1646
 
 
1647
case 0156
 
1648
 
 
1649
:
 
1650
Fortran88= BOOLEAN(*loc==071);
 
1651
break;
 
1652
 
 
1653
 
 
1654
case 0166
 
1655
 
 
1656
 
 
1657
 
 
1658
:
 
1659
 
 
1660
case 0170
 
1661
 
 
1662
:
 
1663
break;
 
1664
 
 
1665
default:
 
1666
 
 
1667
err0_print(ERR_C,OC("! Invalid language command `@L%c' ignored"),1,XCHR(l));
 
1668
break;
 
1669
}
 
1670
 
 
1671
opt_args(l);
 
1672
 
 
1673
}
 
1674
 
 
1675
 
 
1676
 
 
1677
 
 
1678
if(module_count==0)
 
1679
global_params= params;
 
1680
 
 
1681
ini0_language();
 
1682
 
 
1683
 
 
1684
if(Fortran88&&(auto_semi&&!free_Fortran))
 
1685
{
 
1686
loc= limit+1;
 
1687
chk_end= NO;
 
1688
}
 
1689
 
 
1690
 
 
1691
 
 
1692
}
 
1693
 
 
1694
 
 
1695
break;
 
1696
 
 
1697
case begin_nuweb:
 
1698
nuweb_mode= !NUWEB_MODE;
 
1699
 
 
1700
if(module_count==0)
 
1701
global_params= params;
 
1702
break;
 
1703
 
 
1704
 
 
1705
 
 
1706
case invisible_cmnt:
 
1707
loc= limit+1;
 
1708
break;
 
1709
 
 
1710
case new_module:
 
1711
return;
 
1712
}
 
1713
 
 
1714
}
 
1715
}
 
1716
 
 
1717
 
 
1718
 
 
1719
eight_bits
 
1720
skip_TeX(VOID)
 
1721
{
 
1722
WHILE()
 
1723
{
 
1724
if(loc>limit&&!get_line())
 
1725
return new_module;
 
1726
 
 
1727
*(limit+1)= 0100;
 
1728
 
 
1729
while(*loc!=0100&&*loc!=0174)
 
1730
loc++;
 
1731
 
 
1732
if(*loc++==0174)
 
1733
return 0174;
 
1734
 
 
1735
if(loc<=limit)
 
1736
{
 
1737
SET_CASE(*loc);
 
1738
return ccode[*(loc++)];
 
1739
}
 
1740
}
 
1741
 
 
1742
DUMMY_RETURN(0);
 
1743
}
 
1744
 
 
1745
 
 
1746
 
 
1747
eight_bits
 
1748
get_next(VOID)
 
1749
{
 
1750
boolean terminate= NO;
 
1751
char terminator[2];
 
1752
GOTO_CODE pcode;
 
1753
 
 
1754
WHILE()
 
1755
{
 
1756
 
 
1757
{
 
1758
if(preprocessing&&at_beginning)
 
1759
{
 
1760
at_beginning= NO;
 
1761
 
 
1762
 
 
1763
 
 
1764
for(;loc<limit;loc++)
 
1765
if(!(*loc==040||*loc==tab_mark))
 
1766
break;
 
1767
 
 
1768
*(loc-1)= 043;
 
1769
 
 
1770
 
 
1771
return(eight_bits)prs_regular_code(GOTO_GET_IDENTIFIER);
 
1772
}
 
1773
}
 
1774
 
 
1775
;
 
1776
 
 
1777
 
 
1778
chk_the_end:
 
1779
if(chk_end)
 
1780
{
 
1781
 
 
1782
 
 
1783
while(*loc==cont_char&&loc==limit-1&&(preprocessing||free_Fortran))
 
1784
if(!get_line())
 
1785
return new_module;
 
1786
else if(preprocessing)
 
1787
return Cont_Char;
 
1788
 
 
1789
 
 
1790
 
 
1791
if(loc>=limit)
 
1792
if(preprocessing)
 
1793
{
 
1794
chk_end= preprocessing= sharp_include_line= sharp_pragma_line= NO;
 
1795
return right_preproc;
 
1796
}
 
1797
else if(Fortran88
 
1798
&&parsing_mode==OUTER
 
1799
&&(auto_semi&&!free_Fortran)&&(limit>cur_buffer)
 
1800
&&!(limit[0]==0100&&limit[1]==0155))
 
1801
{
 
1802
loc= limit+1;
 
1803
chk_end= NO;
 
1804
if(last_was_cmnt)
 
1805
{
 
1806
last_was_cmnt= NO;
 
1807
if(lst_ampersand)
 
1808
{
 
1809
lst_ampersand= NO;
 
1810
chk_end= YES;
 
1811
if(!get_line())
 
1812
{
 
1813
 
 
1814
err0_print(ERR_W,OC("Section ended in middle of Fortran-90 continuation"),0);
 
1815
return new_module;
 
1816
}
 
1817
APP_STR("\\indent");
 
1818
goto chk_the_end;
 
1819
}
 
1820
continue;
 
1821
}
 
1822
}
 
1823
}
 
1824
 
 
1825
;
 
1826
 
 
1827
chk_end= YES;
 
1828
 
 
1829
 
 
1830
{
 
1831
if(loc>limit)
 
1832
{
 
1833
if(terminate)
 
1834
{
 
1835
terminator[0]= *limit;terminator[1]= *(limit+1);
 
1836
}
 
1837
 
 
1838
 
 
1839
{
 
1840
if(just_inserted)
 
1841
just_inserted= NO;
 
1842
else
 
1843
{
 
1844
if(free_Fortran&&auto_semi&&!empty_line&&the_part==CODE)
 
1845
{
 
1846
just_inserted= YES;
 
1847
return auto_pseudo_semis?ccode[073]:073;
 
1848
 
 
1849
}
 
1850
}
 
1851
}
 
1852
 
 
1853
 
 
1854
 
 
1855
empty_line= NO;
 
1856
 
 
1857
if(!get_line())
 
1858
return new_module;
 
1859
 
 
1860
if(eat_blank_lines)
 
1861
{
 
1862
 
 
1863
{
 
1864
while(loc>=limit)
 
1865
if(!get_line())
 
1866
{
 
1867
eat_blank_lines= NO;
 
1868
return new_module;
 
1869
}
 
1870
}
 
1871
 
 
1872
 
 
1873
eat_blank_lines= NO;
 
1874
}
 
1875
 
 
1876
if(parsing_mode==OUTER)
 
1877
at_beginning= YES;
 
1878
 
 
1879
if(terminate)
 
1880
{
 
1881
*limit= terminator[0];*(limit+1)= terminator[1];
 
1882
terminate= NO;
 
1883
}
 
1884
}
 
1885
else if(parsing_mode==OUTER)
 
1886
at_beginning= NO;
 
1887
}
 
1888
 
 
1889
 
 
1890
 
 
1891
 
 
1892
if(preprocessing)
 
1893
 
 
1894
{
 
1895
do
 
1896
{
 
1897
if((c= *loc++)!=040||c!=tab_mark)
 
1898
break;
 
1899
}
 
1900
while(loc<limit);
 
1901
 
 
1902
if(c==040||c==tab_mark)
 
1903
return macro_space;
 
1904
}
 
1905
 
 
1906
 
 
1907
else
 
1908
 
 
1909
{
 
1910
if(language==TEX)
 
1911
c= *loc++;
 
1912
else
 
1913
{
 
1914
ASCII HUGE*loc0= loc;
 
1915
 
 
1916
do
 
1917
{
 
1918
c= *loc++;
 
1919
}
 
1920
while(loc<=limit&&(c==040||c==tab_mark));
 
1921
 
 
1922
if(nuweb_mode)
 
1923
{
 
1924
if(!(c==0100&&*loc==043))
 
1925
{
 
1926
loc= loc0;
 
1927
c= *loc++;
 
1928
if(phase==1&&c==tab_mark)
 
1929
c= 040;
 
1930
}
 
1931
}
 
1932
}
 
1933
}
 
1934
 
 
1935
 
 
1936
 
 
1937
 
 
1938
if(c==cont_char&&loc==limit)
 
1939
{
 
1940
if(preprocessing||free_Fortran)
 
1941
loc--;
 
1942
else
 
1943
loc++;
 
1944
 
 
1945
terminate= YES;
 
1946
continue;
 
1947
}
 
1948
 
 
1949
 
 
1950
 
 
1951
 
 
1952
if(limit==cur_buffer||(at_beginning&&loc>limit))
 
1953
{
 
1954
empty_line= YES;
 
1955
return big_line_break;
 
1956
}
 
1957
 
 
1958
switch(language)
 
1959
{
 
1960
case TEX:
 
1961
if((pcode= prs_TeX_code())==MORE_PARSE)
 
1962
break;
 
1963
else if((int)pcode<0)
 
1964
 
 
1965
confusion(OC("prs_TEX_code"),OC("Negative pcode %i"),pcode);
 
1966
else
 
1967
goto found_something;
 
1968
 
 
1969
default:
 
1970
if((pcode= prs_regular_code(MORE_PARSE))==MORE_PARSE)
 
1971
break;
 
1972
else if((int)pcode<0)
 
1973
 
 
1974
confusion(OC("prs_regular_code"),OC("Negative pcode %i"),pcode);
 
1975
else
 
1976
goto found_something;
 
1977
}
 
1978
}
 
1979
 
 
1980
found_something:
 
1981
 
 
1982
 
 
1983
 
 
1984
if(!preprocessing)
 
1985
switch((eight_bits)pcode)
 
1986
{
 
1987
case begin_language:
 
1988
break;
 
1989
 
 
1990
default:
 
1991
at_beginning= NO;
 
1992
break;
 
1993
}
 
1994
 
 
1995
return(eight_bits)pcode;
 
1996
}
 
1997
 
 
1998
 
 
1999
GOTO_CODE
 
2000
prs_TeX_code(VOID)
 
2001
{
 
2002
GOTO_CODE icode;
 
2003
 
 
2004
if(loc>limit)
 
2005
return 073;
 
2006
 
 
2007
if(c==0100)
 
2008
{
 
2009
if((icode= get_control_code())==GOTO_MISTAKE)
 
2010
return prs_regular_code(GOTO_MISTAKE);
 
2011
else
 
2012
return icode;
 
2013
}
 
2014
else if(TeX[c]==TeX_comment)
 
2015
{
 
2016
long_comment= YES;
 
2017
return begin_comment;
 
2018
}
 
2019
else if(c==0174&&parsing_mode==INNER)
 
2020
return 0174;
 
2021
else
 
2022
if(phase==1)
 
2023
{
 
2024
if(TeX[c]==TeX_escape)
 
2025
 
 
2026
{
 
2027
id_first= id_loc= mod_text+1;
 
2028
 
 
2029
*id_loc++= *(loc-1);
 
2030
 
 
2031
if(TeX[*loc]!=TeX_letter)
 
2032
{
 
2033
if(*loc==0100)
 
2034
{
 
2035
if(*(loc+1)!=0100)
 
2036
err0_print(ERR_W,OC("You should say `\\@@'"),0);
 
2037
else loc++;
 
2038
}
 
2039
*id_loc++= *loc++;
 
2040
}
 
2041
else while(TeX[*loc]==TeX_letter)
 
2042
{
 
2043
if(*loc==0100)
 
2044
{
 
2045
if(*(loc+1)!=0100)
 
2046
err0_print(ERR_W,OC("You should say `@@'"),0);
 
2047
else loc++;
 
2048
}
 
2049
*id_loc++= *loc++;
 
2050
}
 
2051
 
 
2052
return identifier;
 
2053
}
 
2054
 
 
2055
 
 
2056
else
 
2057
return MORE_PARSE;
 
2058
}
 
2059
else
 
2060
 
 
2061
{
 
2062
loc--;
 
2063
id_first= id_loc= mod_text+1;
 
2064
 
 
2065
while(loc<limit)
 
2066
{
 
2067
if(*loc==0100)
 
2068
if(*(loc+1)==0100)*id_loc++= *loc++;
 
2069
else break;
 
2070
 
 
2071
if(TeX[*loc]==TeX_comment)break;
 
2072
if(*loc==0174&&parsing_mode==INNER)break;
 
2073
 
 
2074
if(TeX[*loc]==TeX_escape)
 
2075
{
 
2076
if(TeX[*(loc+1)]!=TeX_letter)
 
2077
{
 
2078
if(*(loc+1)==0100)
 
2079
if(*(loc+2)!=0100)
 
2080
 
 
2081
err0_print(ERR_W,OC("You should say \\@@"),0);
 
2082
else*id_loc++= *loc++;
 
2083
 
 
2084
*id_loc++= *loc++;
 
2085
}
 
2086
else
 
2087
{
 
2088
do
 
2089
*id_loc++= *loc++;
 
2090
while(TeX[*loc]==TeX_letter);
 
2091
 
 
2092
while(loc<limit)
 
2093
{
 
2094
if(TeX[*loc]!=TeX_space)break;
 
2095
 
 
2096
*id_loc++= ordinary_space;
 
2097
loc++;
 
2098
}
 
2099
 
 
2100
continue;
 
2101
}
 
2102
}
 
2103
 
 
2104
*id_loc++= *loc++;
 
2105
}
 
2106
 
 
2107
return stringg;
 
2108
}
 
2109
 
 
2110
 
 
2111
 
 
2112
}
 
2113
 
 
2114
 
 
2115
 
 
2116
GOTO_CODE
 
2117
prs_regular_code FCN((iswitch))
 
2118
GOTO_CODE iswitch C1("")
 
2119
{
 
2120
GOTO_CODE icode;
 
2121
 
 
2122
switch(iswitch)
 
2123
{
 
2124
case GOTO_MISTAKE:goto mistake;
 
2125
case GOTO_GET_IDENTIFIER:goto get_identifier;
 
2126
default:break;
 
2127
}
 
2128
 
 
2129
 
 
2130
if(c==056&&*loc==056&&*(loc+1)==056)
 
2131
{
 
2132
++loc;
 
2133
compress(ellipsis);
 
2134
}
 
2135
 
 
2136
 
 
2137
else if(FORTRAN_LIKE(language)&&dot_constants&&
 
2138
(c==wt_style.dot_delimiter.begin)&&!isDigit(*loc))
 
2139
 
 
2140
{
 
2141
ASCII HUGE*p0;
 
2142
int n;
 
2143
int dcode;
 
2144
ASCII dot_end= wt_style.dot_delimiter.end;
 
2145
 
 
2146
 
 
2147
 
 
2148
for(p0= loc,n= 0;n<MAX_DOT_LENGTH;n++,loc++)
 
2149
if(*loc==dot_end||!isAlpha(*loc))
 
2150
break;
 
2151
 
 
2152
if(*loc!=dot_end)
 
2153
{
 
2154
loc= p0;
 
2155
goto mistake;
 
2156
}
 
2157
 
 
2158
if((dcode= dot_code(dots,uppercase(p0,n),loc,dot_const))!=0)
 
2159
{
 
2160
if(Fortran88)
 
2161
upcoming_kind= BOOLEAN(loc[1]==0137);
 
2162
 
 
2163
compress(dcode);
 
2164
}
 
2165
 
 
2166
 
 
2167
loc= p0;
 
2168
goto mistake;
 
2169
}
 
2170
 
 
2171
 
 
2172
 
 
2173
 
 
2174
else if(isDigit(c)||c==0134||c==056||(upcoming_kind&&c==0137))
 
2175
 
 
2176
{
 
2177
boolean decimal_point= NO;
 
2178
ASCII prec_char;
 
2179
 
 
2180
 
 
2181
id_first= id_loc= mod_text+1;
 
2182
 
 
2183
if(Fortran88)
 
2184
{
 
2185
*id_loc++= 040;
 
2186
 
 
2187
 
 
2188
if(upcoming_kind)
 
2189
{
 
2190
loc--;
 
2191
upcoming_kind= NO;
 
2192
 
 
2193
}
 
2194
}
 
2195
 
 
2196
if(c!=0137)
 
2197
if(c==0134)
 
2198
{
 
2199
ASCII*loc0;
 
2200
 
 
2201
if(*loc==057)
 
2202
goto mistake;
 
2203
 
 
2204
*id_loc++= OCTAL_CODE;
 
2205
loc0= loc;
 
2206
 
 
2207
while(isOdigit(*loc))
 
2208
*id_loc++= *loc++;
 
2209
 
 
2210
if(loc==loc0)
 
2211
return(eight_bits)c;
 
2212
}
 
2213
else if(c==060)
 
2214
 
 
2215
{
 
2216
if(*loc==0170||*loc==0130)
 
2217
{
 
2218
*id_loc++= HEX_CODE;
 
2219
loc++;
 
2220
while(isXdigit(*loc))
 
2221
*id_loc++= *loc++;
 
2222
}
 
2223
else if(*loc==0142||*loc==0102)
 
2224
{
 
2225
*id_loc++= BINARY_CODE;
 
2226
loc++;
 
2227
while(isBdigit(*loc))
 
2228
*id_loc++= *loc++;
 
2229
}
 
2230
else if(isOdigit(*loc))
 
2231
{
 
2232
*id_loc++= OCTAL_CODE;
 
2233
while(isOdigit(*loc))
 
2234
*id_loc++= *loc++;
 
2235
}
 
2236
else
 
2237
goto dec;
 
2238
}
 
2239
 
 
2240
 
 
2241
else
 
2242
 
 
2243
{
 
2244
if(c==056&&!isDigit(*loc))
 
2245
goto mistake;
 
2246
 
 
2247
dec:
 
2248
*id_loc++= c;
 
2249
while(isDigit(*loc)||*loc==056)
 
2250
*id_loc++= *loc++;
 
2251
 
 
2252
 
 
2253
 
 
2254
 
 
2255
decimal_point= BOOLEAN(*(loc-1)==056);
 
2256
 
 
2257
if(FORTRAN_LIKE(language))
 
2258
if(decimal_point)
 
2259
{
 
2260
if(is_dot())
 
2261
 
 
2262
{
 
2263
id_loc--;
 
2264
loc--;
 
2265
return constant;
 
2266
}
 
2267
}
 
2268
else if(*loc==0150||*loc==0110)
 
2269
 
 
2270
{
 
2271
int k,n;
 
2272
 
 
2273
 
 
2274
*id_loc= '\0';
 
2275
n= ATOI(id_first);
 
2276
*id_loc++= HOLLERITH_CODE;
 
2277
++loc;
 
2278
 
 
2279
for(k= 0;k<n;++k)
 
2280
*id_loc++= *loc++;
 
2281
 
 
2282
return constant;
 
2283
}
 
2284
 
 
2285
;
 
2286
 
 
2287
if(in_format)
 
2288
return constant;
 
2289
 
 
2290
prec_char= *loc;
 
2291
 
 
2292
if(prec_char==0145||prec_char==0105||(FORTRAN_LIKE(language)&&
 
2293
(prec_char==0144||prec_char==0104||
 
2294
prec_char==0161||prec_char==0121)))
 
2295
 
 
2296
{
 
2297
*id_loc++= EXP_CODE;
 
2298
*id_loc++= A_TO_UPPER(prec_char);
 
2299
 
 
2300
loc++;
 
2301
 
 
2302
if(*loc==053||*loc==055)
 
2303
*id_loc++= *loc++;
 
2304
 
 
2305
while(isDigit(*loc))
 
2306
*id_loc++= *loc++;
 
2307
}
 
2308
 
 
2309
 
 
2310
}
 
2311
 
 
2312
 
 
2313
 
 
2314
 
 
2315
 
 
2316
if(C_LIKE(language))
 
2317
{
 
2318
switch(*loc)
 
2319
{
 
2320
case 0154:
 
2321
case 0114:
 
2322
*id_loc++= CONSTANT_CODE;
 
2323
loc++;
 
2324
if(*loc==0165||*loc==0125)
 
2325
{
 
2326
*id_loc++= ULONG_CODE;
 
2327
loc++;
 
2328
}
 
2329
else
 
2330
*id_loc++= LONG_CODE;
 
2331
break;
 
2332
 
 
2333
case 0165:
 
2334
case 0125:
 
2335
*id_loc++= CONSTANT_CODE;
 
2336
loc++;
 
2337
if(*loc==0154||*loc==0114)
 
2338
{
 
2339
*id_loc++= ULONG_CODE;
 
2340
loc++;
 
2341
}
 
2342
else*id_loc++= UNSIGNED_CODE;
 
2343
break;
 
2344
 
 
2345
case 0146:
 
2346
case 0106:
 
2347
*id_loc++= CONSTANT_CODE;
 
2348
*id_loc++= FLOAT_CODE;
 
2349
loc++;
 
2350
break;
 
2351
}
 
2352
}
 
2353
else if(Fortran88)
 
2354
 
 
2355
{
 
2356
if(*loc==0137)
 
2357
{
 
2358
*id_first= 0173;
 
2359
 
 
2360
 
 
2361
*id_loc++= 0175;
 
2362
 
 
2363
while(is_kind(*loc))
 
2364
*id_loc++= *loc++;
 
2365
}
 
2366
else
 
2367
id_first++;
 
2368
}
 
2369
 
 
2370
 
 
2371
 
 
2372
 
 
2373
 
 
2374
if(!decimal_point&&at_beginning&&
 
2375
((is_FORTRAN_(language)&&!last_was_continued)||
 
2376
(is_RATFOR_(language)&&*loc==072)))
 
2377
return stmt_label;
 
2378
 
 
2379
return constant;
 
2380
}
 
2381
 
 
2382
 
 
2383
 
 
2384
 
 
2385
else if(in_data&&Fortran88&&(*loc==042||*loc==047)&&
 
2386
(c==0102||c==0117||c==0132))
 
2387
return get_string(*loc++,c);
 
2388
 
 
2389
 
 
2390
else if(is_identifier(c))
 
2391
 
 
2392
{
 
2393
IN_COMMON ASCII HUGE*pformat,HUGE*pdata;
 
2394
 
 
2395
get_identifier:
 
2396
 
 
2397
{
 
2398
id_first= --loc;
 
2399
 
 
2400
 
 
2401
for(++loc;isAlpha(*loc)||isDigit(*loc)
 
2402
||*loc==0137||*loc==044||(in_format&&*loc==056);loc++)
 
2403
;
 
2404
 
 
2405
upcoming_kind= BOOLEAN(Fortran88&&(*loc=='"'||*loc=='\'')
 
2406
&&loc[-1]=='_');
 
2407
 
 
2408
id_loc= loc-upcoming_kind;
 
2409
 
 
2410
}
 
2411
 
 
2412
 
 
2413
 
 
2414
 
 
2415
if(FORTRAN_LIKE(language))
 
2416
{
 
2417
if(web_strcmp(pformat,pformat+6,id_first,id_loc)==EQUAL)
 
2418
{
 
2419
 
 
2420
in_format= YES;
 
2421
return begin_format_stmt;
 
2422
}
 
2423
else if(program==weave)
 
2424
{
 
2425
if(web_strcmp(pdata,pdata+4,id_first,id_loc)==EQUAL)
 
2426
{
 
2427
in_data= YES;
 
2428
return identifier;
 
2429
}
 
2430
else if(at_beginning&&*loc==':'&&
 
2431
!is_in(non_labels,id_first,id_loc))
 
2432
return stmt_label;
 
2433
}
 
2434
}
 
2435
 
 
2436
if(is_include_like())
 
2437
sharp_include_line= YES;
 
2438
 
 
2439
return identifier;
 
2440
}
 
2441
 
 
2442
 
 
2443
 
 
2444
 
 
2445
 
 
2446
else if(c==047||c==042
 
2447
||(sharp_include_line&&!in_comment&&
 
2448
(c==050||(C_LIKE(language)&&c==074))))
 
2449
return get_string(c,'\0');
 
2450
 
 
2451
 
 
2452
else if(c==0100)
 
2453
{
 
2454
if((icode= get_control_code())==GOTO_MISTAKE)
 
2455
goto mistake;
 
2456
else
 
2457
return icode;
 
2458
}
 
2459
 
 
2460
 
 
2461
 
 
2462
else if(c==040||c==tab_mark)
 
2463
if(nuweb_mode)
 
2464
return c;else
 
2465
return MORE_PARSE;
 
2466
 
 
2467
 
 
2468
if(c==043&&at_beginning&&C_LIKE(language))
 
2469
 
 
2470
{
 
2471
IN_COMMON ASCII HUGE*pinclude,HUGE*ppragma;
 
2472
 
 
2473
 
 
2474
 
 
2475
preprocessing= YES;
 
2476
 
 
2477
{
 
2478
 
 
2479
while(*loc==040||*loc==011)
 
2480
loc++;
 
2481
 
 
2482
if(STRNCMP(loc,pinclude,7)==0)
 
2483
sharp_include_line= YES;
 
2484
else if(STRNCMP(loc,ppragma,7)==0)
 
2485
sharp_pragma_line= YES;
 
2486
}
 
2487
 
 
2488
;
 
2489
return left_preproc;
 
2490
}
 
2491
 
 
2492
 
 
2493
 
 
2494
 
 
2495
 
 
2496
else if(in_format&&c==073)
 
2497
{
 
2498
in_format= NO;
 
2499
return end_format_stmt;
 
2500
}
 
2501
 
 
2502
 
 
2503
mistake:
 
2504
 
 
2505
switch(c)
 
2506
{
 
2507
case(ASCII)begin_comment0:
 
2508
long_comment= YES;
 
2509
return begin_comment;
 
2510
 
 
2511
case(ASCII)begin_comment1:
 
2512
long_comment= NO;
 
2513
return begin_comment;
 
2514
 
 
2515
case 0134:
 
2516
if(*loc==057&&!in_format&&FORTRAN_LIKE(language))
 
2517
{
 
2518
compress(slash_slash);
 
2519
}
 
2520
break;
 
2521
 
 
2522
case 057:
 
2523
 
 
2524
 
 
2525
if(*loc==052)
 
2526
{
 
2527
long_comment= YES;
 
2528
compress(begin_comment);
 
2529
}
 
2530
else if(*loc==057)
 
2531
{
 
2532
if(C_LIKE(language)||language==TEX||(Cpp_comments&&
 
2533
!in_format&&FORTRAN_LIKE(language)))
 
2534
{
 
2535
 
 
2536
long_comment= NO;
 
2537
compress(begin_comment);
 
2538
}
 
2539
else if(!in_format)
 
2540
{
 
2541
compress(slash_slash);
 
2542
 
 
2543
 
 
2544
}
 
2545
}
 
2546
else if(*loc==051&&!in_format)
 
2547
{compress(right_array);
 
2548
}
 
2549
else if(*loc==075)
 
2550
{COMPOUND(slash_eq,1);
 
2551
}
 
2552
 
 
2553
 
 
2554
break;
 
2555
 
 
2556
case 050:
 
2557
if(*loc==057&&!in_format)compress(left_array);
 
2558
break;
 
2559
 
 
2560
case 053:
 
2561
if(*loc==053){compress(plus_plus);
 
2562
}
 
2563
else if(*loc==075){COMPOUND(plus_eq,1);
 
2564
 
 
2565
}
 
2566
break;
 
2567
 
 
2568
case 055:
 
2569
if(*loc==055){compress(minus_minus);
 
2570
}
 
2571
else if(*loc==076){compress(minus_gt);
 
2572
 
 
2573
}
 
2574
else if(*loc==075){COMPOUND(minus_eq,1);
 
2575
 
 
2576
}
 
2577
break;
 
2578
 
 
2579
case 075:
 
2580
if(*loc==075){compress(eq_eq);
 
2581
}
 
2582
else if(*loc==076){compress(eq_gt);
 
2583
 
 
2584
}
 
2585
break;
 
2586
 
 
2587
case 076:
 
2588
if(*loc==075){compress(gt_eq);
 
2589
}
 
2590
else if(*loc==076)
 
2591
if(*(loc+1)==075){COMPOUND(gt_gt_eq,2);
 
2592
 
 
2593
}
 
2594
else{compress(gt_gt);
 
2595
}
 
2596
break;
 
2597
 
 
2598
case 074:
 
2599
if(*loc==075){compress(lt_eq);
 
2600
}
 
2601
else if(*loc==074)
 
2602
if(*(loc+1)==075)
 
2603
{COMPOUND(lt_lt_eq,2);
 
2604
 
 
2605
}
 
2606
else{compress(lt_lt);
 
2607
}
 
2608
else if(*loc==076){compress(not_eq);
 
2609
 
 
2610
}
 
2611
break;
 
2612
 
 
2613
case 045:
 
2614
if(*loc==075){COMPOUND(mod_eq,1);
 
2615
}
 
2616
break;
 
2617
 
 
2618
case 046:
 
2619
if(*loc==046){compress(and_and);
 
2620
}
 
2621
else if(*loc==075)
 
2622
{
 
2623
COMPOUND(and_eq,1);
 
2624
}
 
2625
break;
 
2626
 
 
2627
case 0174:
 
2628
if(*loc==0174)
 
2629
{
 
2630
if(*(loc+1)==0174)
 
2631
{
 
2632
COMPOUND(or_or_or,2);
 
2633
}
 
2634
else compress(or_or);
 
2635
}
 
2636
else if(*loc==075&&!FORTRAN_LIKE(language))
 
2637
{
 
2638
COMPOUND(or_eq,1);
 
2639
}
 
2640
break;
 
2641
 
 
2642
case 041:
 
2643
if(!in_format&&(point_comments||*loc==041))
 
2644
{
 
2645
if(*loc!=041)loc--;
 
2646
long_comment= NO;
 
2647
compress(begin_comment);
 
2648
}
 
2649
else if(*loc==075){compress(not_eq);
 
2650
}
 
2651
break;
 
2652
 
 
2653
case 052:
 
2654
if(FORTRAN_LIKE(language)&&(*loc==052))
 
2655
{compress(star_star);
 
2656
}
 
2657
else if(*loc==075){COMPOUND(star_eq,1);
 
2658
}
 
2659
break;
 
2660
 
 
2661
case 0136:
 
2662
if(*loc==0136){compress(star_star);}
 
2663
else if(FORTRAN_LIKE(language)&&(loc<limit))
 
2664
return star_star;
 
2665
else if(*loc==075){COMPOUND(xor_eq,1);
 
2666
}
 
2667
break;
 
2668
 
 
2669
case 072:
 
2670
if(*loc==072)compress(colon_colon);
 
2671
break;
 
2672
 
 
2673
case 043:
 
2674
 
 
2675
 
 
2676
switch(*loc)
 
2677
{
 
2678
case 043:
 
2679
compress(paste);
 
2680
break;
 
2681
 
 
2682
case 041:
 
2683
compress(dont_expand);
 
2684
break;
 
2685
 
 
2686
case 072:
 
2687
compress(auto_label);
 
2688
break;
 
2689
 
 
2690
case 056:
 
2691
compress(all_variable_args);
 
2692
break;
 
2693
 
 
2694
case 074:
 
2695
loc++;
 
2696
mac_mod_name= YES;
 
2697
 
 
2698
{
 
2699
ASCII HUGE*k;
 
2700
static ASCII ell[]= "\56\56\56";
 
2701
static ASCII bad_mod_name[]= "\41\41\41\40\173\134\151\164\40\111\156\143\157\155\160\141\164\151\142\154\145\175\40\41\41\41";
 
2702
 
 
2703
 
 
2704
 
 
2705
{
 
2706
mod_level= 1;
 
2707
 
 
2708
k= mod_text;
 
2709
 
 
2710
WHILE()
 
2711
{
 
2712
if(loc>limit&&!get_line())
 
2713
{
 
2714
 
 
2715
err0_print(ERR_W,OC("Input ended in section name"),0);
 
2716
 
 
2717
loc= cur_buffer+1;break;
 
2718
}
 
2719
 
 
2720
c= *loc;
 
2721
 
 
2722
 
 
2723
if(c==0100)
 
2724
{
 
2725
c= *(loc+1);
 
2726
 
 
2727
if(c==076)
 
2728
{
 
2729
if(--mod_level==0)
 
2730
{
 
2731
loc+= 2;break;
 
2732
}
 
2733
}
 
2734
else if(c==074)mod_level++;
 
2735
 
 
2736
if(ccode[c]==new_module)
 
2737
{
 
2738
 
 
2739
err0_print(ERR_W,OC("Section name didn't end"),0);break;
 
2740
 
 
2741
}
 
2742
 
 
2743
*(++k)= 0100;loc++;
 
2744
}
 
2745
 
 
2746
 
 
2747
;
 
2748
loc++;
 
2749
 
 
2750
if(k<mod_end)k++;
 
2751
 
 
2752
switch(c)
 
2753
{
 
2754
case 040:
 
2755
case tab_mark:
 
2756
c= 040;if(*(k-1)==040)k--;
 
2757
break;
 
2758
 
 
2759
case 073:
 
2760
c= interior_semi;
 
2761
break;
 
2762
}
 
2763
 
 
2764
*k= c;
 
2765
}
 
2766
 
 
2767
if(k>=mod_end)
 
2768
{
 
2769
SET_COLOR(warning);
 
2770
printf("\n! Section name too long: ");
 
2771
 
 
2772
ASCII_write(mod_text+1,25);
 
2773
printf("...");
 
2774
mark_harmless;
 
2775
}
 
2776
 
 
2777
if(*k==040&&k>mod_text)
 
2778
k--;
 
2779
}
 
2780
 
 
2781
 
 
2782
 
 
2783
if(k-mod_text>3&&STRNCMP(k-2,ell,3)==0)
 
2784
cur_module= prefix_lookup(mod_text+1,k-3);
 
2785
else cur_module= mod_lookup(mod_text+1,k);
 
2786
 
 
2787
if(!cur_module)
 
2788
cur_module= mod_lookup(bad_mod_name,bad_mod_name+STRLEN(bad_mod_name)-1);
 
2789
 
 
2790
if(cur_module)
 
2791
{
 
2792
params= cur_module->mod_info->params;
 
2793
frz_params();
 
2794
}
 
2795
 
 
2796
xref_switch= NO;
 
2797
 
 
2798
 
 
2799
 
 
2800
 
 
2801
}
 
2802
 
 
2803
;
 
2804
return macro_module_name;
 
2805
 
 
2806
case 047:
 
2807
case 042:
 
2808
if(phase==1)loc++;
 
2809
break;
 
2810
}
 
2811
 
 
2812
 
 
2813
break;
 
2814
}
 
2815
 
 
2816
 
 
2817
 
 
2818
return(eight_bits)c;
 
2819
}
 
2820
 
 
2821
 
 
2822
 
 
2823
eight_bits
 
2824
get_string FCN((c,boz))
 
2825
ASCII c C0("What started the string")
 
2826
ASCII boz C1("The boz character, or 0.")
 
2827
{
 
2828
ASCII delim= c;
 
2829
ASCII right_delim= c;
 
2830
int level,kount;
 
2831
boolean equal_delims;
 
2832
 
 
2833
id_first= mod_text+1;
 
2834
id_loc= mod_text;
 
2835
 
 
2836
 
 
2837
if(delim==047&&*(loc-2)==0100){*++id_loc= 0100;*++id_loc= 0100;}
 
2838
*++id_loc= delim;
 
2839
 
 
2840
 
 
2841
{
 
2842
switch(delim)
 
2843
{
 
2844
case 074:
 
2845
right_delim= 076;
 
2846
break;
 
2847
 
 
2848
case 050:
 
2849
right_delim= 051;
 
2850
sharp_include_line= NO;
 
2851
break;
 
2852
 
 
2853
case 0133:
 
2854
right_delim= 0135;
 
2855
break;
 
2856
}
 
2857
 
 
2858
level= 1;
 
2859
 
 
2860
equal_delims= BOOLEAN(right_delim==delim);
 
2861
}
 
2862
 
 
2863
 
 
2864
 
 
2865
kount= 0;
 
2866
 
 
2867
WHILE()
 
2868
{
 
2869
if(loc>=limit)
 
2870
{
 
2871
if((equal_delims||chk_ifelse)&&*(limit-1)!=cont_char)
 
2872
{
 
2873
 
 
2874
err0_print(ERR_W,OC("String %s with %s'%s%c'%s didn't end"),5,BTRANS,SSET_COLOR(character),delim==047?"\\":"",XCHR(delim),SSET_COLOR(error));
 
2875
loc= limit;break;
 
2876
 
 
2877
}
 
2878
 
 
2879
if(!get_line())
 
2880
{
 
2881
 
 
2882
err0_print(ERR_W,OC("Input ended in middle of string beginning with \
 
2883
'\\%c'"),1,XCHR(delim));
 
2884
loc= cur_buffer;
 
2885
break;
 
2886
 
 
2887
}
 
2888
else
 
2889
{
 
2890
 
 
2891
 
 
2892
if(bslash_continued_strings)
 
2893
{
 
2894
for(;loc<limit;loc++)
 
2895
if(*loc!=040&&*loc!=tab_mark)break;
 
2896
 
 
2897
if(*loc==cont_char)loc++;
 
2898
else
 
2899
err0_print(ERR_W,OC("Inserted '\\%c' at beginning of continued \
 
2900
string"),1,XCHR(cont_char));
 
2901
}
 
2902
}
 
2903
}
 
2904
 
 
2905
 
 
2906
 
 
2907
if((c= *loc++)==delim)
 
2908
{
 
2909
level++;
 
2910
 
 
2911
if(++id_loc<=mod_end)*id_loc= c;
 
2912
 
 
2913
if(!equal_delims)continue;
 
2914
 
 
2915
if(FORTRAN_LIKE(language)&&(*loc==delim))
 
2916
++loc;
 
2917
else break;
 
2918
}
 
2919
 
 
2920
 
 
2921
 
 
2922
if(c==right_delim)
 
2923
if(--level==0)
 
2924
{
 
2925
if(++id_loc<=mod_end)*id_loc= c;
 
2926
break;
 
2927
}
 
2928
 
 
2929
 
 
2930
if((c==cont_char)&&
 
2931
(C_LIKE(language)||(is_FORTRAN_(language)&&free_form_input)))
 
2932
if(loc>=limit)continue;
 
2933
else if(++id_loc<=mod_end)
 
2934
{
 
2935
*id_loc= c;c= *loc++;
 
2936
}
 
2937
 
 
2938
 
 
2939
if(++id_loc<=mod_end)*id_loc= c;
 
2940
 
 
2941
 
 
2942
 
 
2943
if(insert_breaks)
 
2944
if(c==054)kount= 0;
 
2945
else if(++kount>=NBREAK&&c!=0100&&++id_loc<=mod_end)
 
2946
{
 
2947
kount= 0;
 
2948
*id_loc= discretionary_break;
 
2949
}
 
2950
 
 
2951
 
 
2952
}
 
2953
 
 
2954
if(id_loc>=mod_end)
 
2955
{
 
2956
SET_COLOR(error);
 
2957
printf("\n! String too long: ");
 
2958
 
 
2959
ASCII_write(mod_text+1,25);
 
2960
printf("...");
 
2961
mark_error;
 
2962
}
 
2963
 
 
2964
id_loc++;
 
2965
 
 
2966
 
 
2967
{
 
2968
if(FORTRAN_LIKE(language))
 
2969
if(boz)
 
2970
 
 
2971
{
 
2972
switch(boz)
 
2973
{
 
2974
case 0102:
 
2975
*id_first= BINARY_CODE;
 
2976
break;
 
2977
 
 
2978
case 0117:
 
2979
*id_first= OCTAL_CODE;
 
2980
break;
 
2981
 
 
2982
case 0132:
 
2983
*id_first= HEX_CODE;
 
2984
break;
 
2985
}
 
2986
 
 
2987
id_loc--;
 
2988
return constant;
 
2989
}
 
2990
 
 
2991
 
 
2992
else
 
2993
 
 
2994
{
 
2995
if(*loc==0130||*loc==0170)
 
2996
{
 
2997
*id_first= HEX_CODE;
 
2998
 
 
2999
 
 
3000
loc++;
 
3001
id_loc--;
 
3002
return constant;
 
3003
 
 
3004
 
 
3005
}
 
3006
else if(*loc==0117||*loc==0157)
 
3007
{
 
3008
*id_first= OCTAL_CODE;
 
3009
 
 
3010
 
 
3011
loc++;
 
3012
id_loc--;
 
3013
return constant;
 
3014
 
 
3015
 
 
3016
}
 
3017
}
 
3018
 
 
3019
 
 
3020
}
 
3021
 
 
3022
 
 
3023
 
 
3024
return stringg;
 
3025
}
 
3026
 
 
3027
 
 
3028
 
 
3029
GOTO_CODE
 
3030
get_control_code(VOID)
 
3031
{
 
3032
eight_bits cc;
 
3033
 
 
3034
 
 
3035
c= *loc++;
 
3036
SET_CASE(c);
 
3037
 
 
3038
 
 
3039
if((c==057&&(*loc==052||*loc==057))||
 
3040
c==(ASCII)begin_comment0||c==(ASCII)begin_comment1)
 
3041
return GOTO_MISTAKE;
 
3042
 
 
3043
if(c==076&&mod_level==0)
 
3044
{
 
3045
 
 
3046
err0_print(ERR_W,OC("Unmatched `@>' ignored"),0);
 
3047
return MORE_PARSE;
 
3048
}
 
3049
 
 
3050
switch(cc= ccode[c])
 
3051
{
 
3052
case no_index:
 
3053
index_flag= NO;
 
3054
return MORE_PARSE;
 
3055
 
 
3056
case yes_index:
 
3057
INDEX_SHORT;
 
3058
return MORE_PARSE;
 
3059
 
 
3060
case defd_at:
 
3061
if(mark_defined.generic_name)
 
3062
{
 
3063
defd_switch= YES;
 
3064
defd_type= GENERIC_NAME;
 
3065
}
 
3066
 
 
3067
case underline:
 
3068
xref_switch= def_flag;
 
3069
return MORE_PARSE;
 
3070
 
 
3071
case implicit_reserved:
 
3072
if(mark_defined.imp_reserved_name)
 
3073
{
 
3074
typd_switch= defd_switch= YES;
 
3075
defd_type= IMPLICIT_RESERVED;
 
3076
xref_switch= def_flag;
 
3077
}
 
3078
return MORE_PARSE;
 
3079
 
 
3080
case switch_math_flag:math_flag= !math_flag;
 
3081
return MORE_PARSE;
 
3082
 
 
3083
#ifdef DEBUG
 
3084
case trace:tracing= c-060;
 
3085
return MORE_PARSE;
 
3086
#endif 
 
3087
 
 
3088
 
 
3089
 
 
3090
 
 
3091
 
 
3092
 
 
3093
 
 
3094
case begin_C:
 
3095
case begin_RATFOR:
 
3096
case begin_FORTRAN:
 
3097
case begin_LITERAL
 
3098
 
 
3099
 
 
3100
 
 
3101
:
 
3102
loc--;
 
3103
 
 
3104
case L_switch:
 
3105
{
 
3106
 
 
3107
{
 
3108
 
 
3109
{
 
3110
ASCII l= *loc++;
 
3111
 
 
3112
switch(l)
 
3113
{
 
3114
 
 
3115
case 0143
 
3116
 
 
3117
:
 
3118
Cpp= BOOLEAN(*loc==053);
 
3119
break;
 
3120
 
 
3121
 
 
3122
case 0162
 
3123
 
 
3124
:
 
3125
 
 
3126
case 0156
 
3127
 
 
3128
:
 
3129
Fortran88= BOOLEAN(*loc==071);
 
3130
break;
 
3131
 
 
3132
 
 
3133
case 0166
 
3134
 
 
3135
 
 
3136
 
 
3137
:
 
3138
 
 
3139
case 0170
 
3140
 
 
3141
:
 
3142
break;
 
3143
 
 
3144
default:
 
3145
 
 
3146
err0_print(ERR_C,OC("! Invalid language command `@L%c' ignored"),1,XCHR(l));
 
3147
break;
 
3148
}
 
3149
 
 
3150
opt_args(l);
 
3151
 
 
3152
}
 
3153
 
 
3154
 
 
3155
 
 
3156
 
 
3157
if(module_count==0)
 
3158
global_params= params;
 
3159
 
 
3160
ini0_language();
 
3161
 
 
3162
 
 
3163
if(Fortran88&&(auto_semi&&!free_Fortran))
 
3164
{
 
3165
loc= limit+1;
 
3166
chk_end= NO;
 
3167
}
 
3168
 
 
3169
 
 
3170
 
 
3171
}
 
3172
 
 
3173
 
 
3174
return begin_language;
 
3175
}
 
3176
 
 
3177
case begin_nuweb:
 
3178
 
 
3179
err0_print(ERR_W,OC("@N ignored; must appear before beginning of code part"),0);
 
3180
return MORE_PARSE;
 
3181
 
 
3182
case xref_roman:case xref_wildcard:case xref_typewriter:
 
3183
case TeX_string:case keyword_name:
 
3184
 
 
3185
{
 
3186
cc= ccode[*(loc-1)];
 
3187
id_first= loc;*(limit+1)= 0100;
 
3188
 
 
3189
while(*loc!=0100)
 
3190
loc++;
 
3191
 
 
3192
id_loc= loc;
 
3193
 
 
3194
if(loc++>limit)
 
3195
{
 
3196
 
 
3197
err0_print(ERR_W,OC("Control text didn't end"),0);
 
3198
loc= limit;
 
3199
return cc;
 
3200
 
 
3201
}
 
3202
 
 
3203
if(*loc++!=076)
 
3204
 
 
3205
err0_print(ERR_W,OC("Control codes are forbidden in control text"),0);
 
3206
 
 
3207
 
 
3208
return cc;
 
3209
}
 
3210
 
 
3211
 
 
3212
 
 
3213
 
 
3214
 
 
3215
case module_name:
 
3216
mac_mod_name= NO;
 
3217
 
 
3218
{
 
3219
ASCII HUGE*k;
 
3220
static ASCII ell[]= "\56\56\56";
 
3221
static ASCII bad_mod_name[]= "\41\41\41\40\173\134\151\164\40\111\156\143\157\155\160\141\164\151\142\154\145\175\40\41\41\41";
 
3222
 
 
3223
 
 
3224
 
 
3225
{
 
3226
mod_level= 1;
 
3227
 
 
3228
k= mod_text;
 
3229
 
 
3230
WHILE()
 
3231
{
 
3232
if(loc>limit&&!get_line())
 
3233
{
 
3234
 
 
3235
err0_print(ERR_W,OC("Input ended in section name"),0);
 
3236
 
 
3237
loc= cur_buffer+1;break;
 
3238
}
 
3239
 
 
3240
c= *loc;
 
3241
 
 
3242
 
 
3243
if(c==0100)
 
3244
{
 
3245
c= *(loc+1);
 
3246
 
 
3247
if(c==076)
 
3248
{
 
3249
if(--mod_level==0)
 
3250
{
 
3251
loc+= 2;break;
 
3252
}
 
3253
}
 
3254
else if(c==074)mod_level++;
 
3255
 
 
3256
if(ccode[c]==new_module)
 
3257
{
 
3258
 
 
3259
err0_print(ERR_W,OC("Section name didn't end"),0);break;
 
3260
 
 
3261
}
 
3262
 
 
3263
*(++k)= 0100;loc++;
 
3264
}
 
3265
 
 
3266
 
 
3267
;
 
3268
loc++;
 
3269
 
 
3270
if(k<mod_end)k++;
 
3271
 
 
3272
switch(c)
 
3273
{
 
3274
case 040:
 
3275
case tab_mark:
 
3276
c= 040;if(*(k-1)==040)k--;
 
3277
break;
 
3278
 
 
3279
case 073:
 
3280
c= interior_semi;
 
3281
break;
 
3282
}
 
3283
 
 
3284
*k= c;
 
3285
}
 
3286
 
 
3287
if(k>=mod_end)
 
3288
{
 
3289
SET_COLOR(warning);
 
3290
printf("\n! Section name too long: ");
 
3291
 
 
3292
ASCII_write(mod_text+1,25);
 
3293
printf("...");
 
3294
mark_harmless;
 
3295
}
 
3296
 
 
3297
if(*k==040&&k>mod_text)
 
3298
k--;
 
3299
}
 
3300
 
 
3301
 
 
3302
 
 
3303
if(k-mod_text>3&&STRNCMP(k-2,ell,3)==0)
 
3304
cur_module= prefix_lookup(mod_text+1,k-3);
 
3305
else cur_module= mod_lookup(mod_text+1,k);
 
3306
 
 
3307
if(!cur_module)
 
3308
cur_module= mod_lookup(bad_mod_name,bad_mod_name+STRLEN(bad_mod_name)-1);
 
3309
 
 
3310
if(cur_module)
 
3311
{
 
3312
params= cur_module->mod_info->params;
 
3313
frz_params();
 
3314
}
 
3315
 
 
3316
xref_switch= NO;
 
3317
 
 
3318
 
 
3319
 
 
3320
 
 
3321
}
 
3322
 
 
3323
 
 
3324
return module_name;
 
3325
 
 
3326
case new_output_file:
 
3327
 
 
3328
{
 
3329
while(*loc==' '||*loc==tab_mark)
 
3330
{
 
3331
loc++;
 
3332
if(loc>limit)return ignore;
 
3333
}
 
3334
 
 
3335
id_first= loc;
 
3336
while(*loc!=' '&&*loc!=tab_mark)loc++;
 
3337
id_loc= loc;
 
3338
if(*id_first=='"')id_first++;
 
3339
if(*(id_loc-1)=='"')id_loc--;
 
3340
if(id_loc-id_first>=MAX_FILE_NAME_LENGTH)
 
3341
{
 
3342
 
 
3343
err0_print(ERR_T,OC("Output file name too long; allowed only %d characters"),1,MAX_FILE_NAME_LENGTH-1);
 
3344
id_loc= id_first+MAX_FILE_NAME_LENGTH-1;
 
3345
}
 
3346
}
 
3347
 
 
3348
 
 
3349
 
 
3350
return cc;
 
3351
 
 
3352
case invisible_cmnt:
 
3353
if(*loc==045)
 
3354
eat_blank_lines= YES;
 
3355
loc= limit+1;
 
3356
return MORE_PARSE;
 
3357
 
 
3358
case Compiler_Directive:
 
3359
long_comment= NO;
 
3360
doing_cdir= YES;
 
3361
return begin_comment;
 
3362
 
 
3363
case verbatim:
 
3364
{
 
3365
id_first= loc++;
 
3366
 
 
3367
*(limit+1)= 0100;*(limit+2)= 076;
 
3368
 
 
3369
while(*loc!=0100||*(loc+1)!=076)loc++;
 
3370
 
 
3371
if(loc>=limit)
 
3372
err0_print(ERR_W,OC("Verbatim string didn't end"),0);
 
3373
 
 
3374
 
 
3375
id_loc= loc;loc+= 2;
 
3376
 
 
3377
return(verbatim);
 
3378
}
 
3379
 
 
3380
 
 
3381
 
 
3382
case ascii_constant:return get_string(c,'\0');
 
3383
 
 
3384
case big_line_break:
 
3385
if(loc>=limit)
 
3386
return cc;
 
3387
 
 
3388
 
 
3389
{
 
3390
boolean mcode;
 
3391
 
 
3392
*limit= ' ';
 
3393
id_first= loc;
 
3394
 
 
3395
while(isAlpha(*loc))
 
3396
loc++;
 
3397
 
 
3398
if((mcode= is_mcmd(mcmds,id_first,loc))!=0)
 
3399
{
 
3400
while(loc<limit&&(*loc==040||*loc==tab_mark))
 
3401
loc++;
 
3402
 
 
3403
#ifdef _FWEAVE_h
 
3404
defd_switch= NO;
 
3405
#endif
 
3406
 
 
3407
return mcode;
 
3408
}
 
3409
 
 
3410
loc= id_first;
 
3411
}
 
3412
 
 
3413
 
 
3414
;
 
3415
return cc;
 
3416
 
 
3417
case begin_bp:
 
3418
return 0173;
 
3419
 
 
3420
case USED_BY_NEITHER:
 
3421
if(phase==1)
 
3422
 
 
3423
err0_print(ERR_W,OC("Invalid `@%c' ignored"),1,XCHR(c));
 
3424
 
 
3425
return ignore;
 
3426
 
 
3427
case USED_BY_OTHER:
 
3428
if(c==0161)
 
3429
loc++;
 
3430
 
 
3431
return cc;
 
3432
 
 
3433
default:return cc;
 
3434
}
 
3435
}
 
3436
 
 
3437
 
 
3438
 
 
3439
SRTN
 
3440
phase1(VOID)
 
3441
{
 
3442
LANGUAGE language0= language;
 
3443
 
 
3444
phase= 1;
 
3445
the_part= LIMBO;
 
3446
 
 
3447
rst_input();
 
3448
reading(web_file_name,(boolean)(tex_file==stdout));
 
3449
module_count= 0;
 
3450
skip_limbo();
 
3451
change_exists= NO;
 
3452
 
 
3453
 
 
3454
 
 
3455
 
 
3456
 
 
3457
chk_override(language0);
 
3458
fin_language();
 
3459
global_params= params;
 
3460
 
 
3461
while(!input_has_ended)
 
3462
 
 
3463
{
 
3464
the_part= TEX_;
 
3465
 
 
3466
if(++module_count==(sixteen_bits)max_modules)
 
3467
OVERFLW("section numbers","m");
 
3468
 
 
3469
chngd_module[module_count]= NO;
 
3470
 
 
3471
progress();
 
3472
 
 
3473
 
 
3474
params= global_params;
 
3475
frz_params();
 
3476
 
 
3477
 
 
3478
{
 
3479
the_part= TEX_;
 
3480
 
 
3481
do_inside= YES;
 
3482
 
 
3483
WHILE()
 
3484
{
 
3485
switch(next_control= skip_TeX())
 
3486
{
 
3487
 
 
3488
 
 
3489
case begin_C:
 
3490
case begin_RATFOR:
 
3491
case begin_FORTRAN:
 
3492
case begin_LITERAL
 
3493
 
 
3494
 
 
3495
 
 
3496
:
 
3497
loc--;
 
3498
 
 
3499
case L_switch:
 
3500
{
 
3501
 
 
3502
{
 
3503
 
 
3504
{
 
3505
ASCII l= *loc++;
 
3506
 
 
3507
switch(l)
 
3508
{
 
3509
 
 
3510
case 0143
 
3511
 
 
3512
:
 
3513
Cpp= BOOLEAN(*loc==053);
 
3514
break;
 
3515
 
 
3516
 
 
3517
case 0162
 
3518
 
 
3519
:
 
3520
 
 
3521
case 0156
 
3522
 
 
3523
:
 
3524
Fortran88= BOOLEAN(*loc==071);
 
3525
break;
 
3526
 
 
3527
 
 
3528
case 0166
 
3529
 
 
3530
 
 
3531
 
 
3532
:
 
3533
 
 
3534
case 0170
 
3535
 
 
3536
:
 
3537
break;
 
3538
 
 
3539
default:
 
3540
 
 
3541
err0_print(ERR_C,OC("! Invalid language command `@L%c' ignored"),1,XCHR(l));
 
3542
break;
 
3543
}
 
3544
 
 
3545
opt_args(l);
 
3546
 
 
3547
}
 
3548
 
 
3549
 
 
3550
 
 
3551
 
 
3552
if(module_count==0)
 
3553
global_params= params;
 
3554
 
 
3555
ini0_language();
 
3556
 
 
3557
 
 
3558
if(Fortran88&&(auto_semi&&!free_Fortran))
 
3559
{
 
3560
loc= limit+1;
 
3561
chk_end= NO;
 
3562
}
 
3563
 
 
3564
 
 
3565
 
 
3566
}
 
3567
 
 
3568
;
 
3569
continue;
 
3570
}
 
3571
 
 
3572
case begin_nuweb:
 
3573
nuweb_mode= !NUWEB_MODE;
 
3574
continue;
 
3575
 
 
3576
case toggle_output:
 
3577
 
 
3578
{
 
3579
static int outer_include_depth;
 
3580
 
 
3581
if(output_on)
 
3582
{
 
3583
if(phase==2)
 
3584
{
 
3585
flush_buffer(out_ptr,NO);
 
3586
}
 
3587
outer_include_depth= incl_depth;
 
3588
output_on= NO;
 
3589
}
 
3590
else if(incl_depth<=outer_include_depth)
 
3591
{
 
3592
output_on= YES;
 
3593
}
 
3594
}
 
3595
 
 
3596
 
 
3597
continue;
 
3598
 
 
3599
case underline:
 
3600
xref_switch= def_flag;
 
3601
continue;
 
3602
 
 
3603
#ifdef DEBUG
 
3604
case trace:tracing= next_control-060;continue;
 
3605
#endif 
 
3606
 
 
3607
case 0174:
 
3608
while(next_control<=module_name)
 
3609
{
 
3610
C_xref(TEX_,INNER);
 
3611
 
 
3612
if(next_control==0174||next_control==new_module)
 
3613
break;
 
3614
 
 
3615
next_control= get_next();
 
3616
 
 
3617
if(next_control==0174)
 
3618
break;
 
3619
}
 
3620
 
 
3621
break;
 
3622
 
 
3623
case xref_roman:case xref_wildcard:case xref_typewriter:
 
3624
case macro_module_name:case module_name:
 
3625
case keyword_name:
 
3626
loc-= 2;next_control= get_next();
 
3627
 
 
3628
if(!(next_control==module_name||
 
3629
next_control==macro_module_name))
 
3630
new_xref(TEX_,id_lookup(id_first,id_loc,
 
3631
(eight_bits)(next_control-identifier)));
 
3632
break;
 
3633
 
 
3634
case invisible_cmnt:
 
3635
loc= limit+1;
 
3636
break;
 
3637
}
 
3638
 
 
3639
if(next_control>=formatt)
 
3640
break;
 
3641
}
 
3642
}
 
3643
 
 
3644
;
 
3645
 
 
3646
{
 
3647
boolean no_xref0= no_xref;
 
3648
 
 
3649
the_part= DEFINITION;
 
3650
 
 
3651
while(next_control<begin_code)
 
3652
{
 
3653
 
 
3654
switch(next_control)
 
3655
{
 
3656
case WEB_definition:
 
3657
if(mark_defined.WEB_macro&&lower_case_code)
 
3658
defd_switch= YES;
 
3659
 
 
3660
xref_switch= def_flag;
 
3661
defd_type= M_MACRO;
 
3662
 
 
3663
KILL_XREFS(macros);
 
3664
INDEX_SHORT;
 
3665
break;
 
3666
 
 
3667
case m_undef:
 
3668
KILL_XREFS(macros);
 
3669
INDEX_SHORT;
 
3670
break;
 
3671
 
 
3672
case definition:
 
3673
if(mark_defined.outer_macro&&mark_defined.outer_macro)
 
3674
defd_switch= YES;
 
3675
 
 
3676
xref_switch= def_flag;
 
3677
defd_type= D_MACRO;
 
3678
 
 
3679
KILL_XREFS(outer_macros);
 
3680
INDEX_SHORT;
 
3681
break;
 
3682
 
 
3683
case undefinition:
 
3684
KILL_XREFS(outer_macros);
 
3685
INDEX_SHORT;
 
3686
break;
 
3687
 
 
3688
case m_ifdef:
 
3689
case m_ifndef:
 
3690
INDEX_SHORT;
 
3691
break;
 
3692
}
 
3693
 
 
3694
switch(next_control)
 
3695
{
 
3696
case formatt:
 
3697
pr_format(YES,YES);
 
3698
break;
 
3699
 
 
3700
case limbo_text:
 
3701
 
 
3702
{
 
3703
LANGUAGE language0= language;
 
3704
 
 
3705
KILL_XREFS(limbo);
 
3706
 
 
3707
if(language==TEX)
 
3708
language= C;
 
3709
 
 
3710
insert_breaks= NO;
 
3711
 
 
3712
if((next_control= get_next())!=stringg)
 
3713
 
 
3714
err0_print(ERR_W,OC("String must follow @l"),0);
 
3715
else
 
3716
{
 
3717
for(id_first++,id_loc--;id_first<id_loc;)
 
3718
{
 
3719
if(*id_first==0100)
 
3720
{
 
3721
if(*(id_first+1)==0100)
 
3722
id_first++;
 
3723
else
 
3724
 
 
3725
err0_print(ERR_W,OC("Double @ should be used in strings"),0);
 
3726
}
 
3727
 
 
3728
 
 
3729
if(*id_first==0134)
 
3730
{
 
3731
id_first++;
 
3732
 
 
3733
 
 
3734
app_tok(esc_achar(
 
3735
(CONST ASCII HUGE*HUGE*)&id_first))
 
3736
}
 
3737
else
 
3738
app_tok(*id_first++);
 
3739
}
 
3740
 
 
3741
freeze_text;
 
3742
 
 
3743
}
 
3744
 
 
3745
insert_breaks= YES;
 
3746
 
 
3747
language= language0;
 
3748
}
 
3749
 
 
3750
 
 
3751
break;
 
3752
 
 
3753
case op_def:
 
3754
 
 
3755
{
 
3756
OPERATOR HUGE*p,HUGE*p1;
 
3757
 
 
3758
KILL_XREFS(v);
 
3759
 
 
3760
 
 
3761
next_control= get_next();
 
3762
 
 
3763
if(next_control==identifier)
 
3764
 
 
3765
err0_print(ERR_W,OC("For future compatibility, please use syntax `.NAME.' for \
 
3766
overloading dot operators"),0);
 
3767
 
 
3768
if(!(p= valid_op(next_control)))
 
3769
 
 
3770
err0_print(ERR_W,OC("Operator after @v is invalid"),0);
 
3771
else
 
3772
{
 
3773
if(get_next()!=stringg)
 
3774
 
 
3775
err0_print(ERR_W,OC("Second argument (replacement text) \
 
3776
of @v must be a quoted string"),0);
 
3777
else
 
3778
{
 
3779
int k= language_num;
 
3780
OP_INFO HUGE*q= p->info+k;
 
3781
int n= PTR_DIFF(int,id_loc,id_first)-2;
 
3782
 
 
3783
outer_char HUGE*s;
 
3784
 
 
3785
if(q->defn)FREE_MEM(q->defn,"q->defn",STRLEN(q->defn)+1,
 
3786
outer_char);
 
3787
q->defn= GET_MEM("q->defn",n+1,outer_char);
 
3788
 
 
3789
*(id_loc-1)= '\0';
 
3790
 
 
3791
for(s= q->defn,id_first++;*id_first;s++)
 
3792
if(*id_first==0134)
 
3793
{
 
3794
id_first++;
 
3795
*s= XCHR(esc_achar((CONST ASCII HUGE
 
3796
*HUGE*)&id_first));
 
3797
}
 
3798
else*s= XCHR(*id_first++);
 
3799
 
 
3800
overloaded[k]= q->overloaded= YES;
 
3801
 
 
3802
 
 
3803
for(p1= op;p1<op_ptr;p1++)
 
3804
{
 
3805
if(p1==p||!p1->op_name)continue;
 
3806
 
 
3807
if(STRCMP(p1->op_name,p->op_name)==0)
 
3808
{
 
3809
OP_INFO HUGE*q1= p1->info+k;
 
3810
 
 
3811
if(q1->defn)FREE_MEM(q1->defn,"q1->defn",
 
3812
STRLEN(q1->defn)+1,outer_char);
 
3813
q1->defn= GET_MEM("q1->defn",n+1,outer_char);
 
3814
STRCPY(q1->defn,q->defn);
 
3815
q1->overloaded= YES;
 
3816
}
 
3817
}
 
3818
 
 
3819
 
 
3820
 
 
3821
p= valid_op(next_control= get_next());
 
3822
 
 
3823
q->cat= (p?p->info[k].cat:(eight_bits)expr);
 
3824
}
 
3825
}
 
3826
}
 
3827
 
 
3828
 
 
3829
break;
 
3830
 
 
3831
case macro_def:
 
3832
 
 
3833
{
 
3834
if((next_control= get_next())!=identifier)
 
3835
 
 
3836
err0_print(ERR_W,OC("Identifier must follow @w"),0);
 
3837
else
 
3838
{
 
3839
name_pointer p= id_lookup(id_first,id_loc,normal);
 
3840
int n,offset;
 
3841
WV_MACRO HUGE*w;
 
3842
ASCII HUGE*s;
 
3843
ASCII HUGE*id_first0,HUGE*id_loc0;
 
3844
 
 
3845
 
 
3846
 
 
3847
KILL_XREFS(w);
 
3848
INDEX_SHORT;
 
3849
new_xref(DEFINITION,p);
 
3850
 
 
3851
 
 
3852
id_first0= id_first;
 
3853
id_loc0= id_loc;
 
3854
 
 
3855
switch(next_control= get_next())
 
3856
{
 
3857
case 0134:
 
3858
if((next_control= get_next())!=identifier)
 
3859
{
 
3860
 
 
3861
err0_print(ERR_W,OC("Identifier must follow '\\'"),0);
 
3862
break;
 
3863
}
 
3864
 
 
3865
next_control= ignore;
 
3866
 
 
3867
goto quick_code;
 
3868
 
 
3869
 
 
3870
case QUICK_FORMAT:
 
3871
id_first= id_first0;
 
3872
id_loc= id_loc0;
 
3873
 
 
3874
quick_code:
 
3875
offset= 1;
 
3876
n= PTR_DIFF(int,id_loc,id_first)+1;
 
3877
*id_loc= '\0';
 
3878
goto fmt_like_string;
 
3879
 
 
3880
case stringg:
 
3881
{
 
3882
offset= 0;
 
3883
n= PTR_DIFF(int,id_loc,id_first)-2;
 
3884
*(id_loc-1)= '\0';
 
3885
id_first++;
 
3886
 
 
3887
fmt_like_string:
 
3888
p->wv_macro= w= GET_MEM("wv_macro",1,WV_MACRO);
 
3889
w->text= GET_MEM("w->text",n+1,outer_char);
 
3890
 
 
3891
if(offset)*w->text= 0134;
 
3892
 
 
3893
for(s= w->text+offset;*id_first;s++)
 
3894
if(*id_first==0134)
 
3895
{
 
3896
id_first++;
 
3897
*s= esc_achar((CONST ASCII HUGE
 
3898
*HUGE*)&id_first);
 
3899
}
 
3900
else*s= *id_first++;
 
3901
 
 
3902
w->len= PTR_DIFF(unsigned,s,w->text);
 
3903
 
 
3904
w->cat= (eight_bits)(upper_case_code?0:expr);
 
3905
}
 
3906
break;
 
3907
 
 
3908
default:
 
3909
 
 
3910
err0_print(ERR_W,OC("Second argument (replacement text) \
 
3911
of @w must be either a quoted string or '.' or have the form \\name"),0);
 
3912
break;
 
3913
}
 
3914
}
 
3915
}
 
3916
 
 
3917
 
 
3918
break;
 
3919
 
 
3920
case invisible_cmnt:
 
3921
loc= limit+1;
 
3922
 
 
3923
default:
 
3924
next_control= get_next();
 
3925
break;
 
3926
}
 
3927
 
 
3928
outr_xref(DEFINITION);
 
3929
no_xref= no_xref0;
 
3930
}
 
3931
}
 
3932
 
 
3933
;
 
3934
 
 
3935
{
 
3936
the_part= CODE;
 
3937
 
 
3938
if(next_control<=module_name)
 
3939
{
 
3940
boolean beginning_module= YES;
 
3941
 
 
3942
if(next_control==begin_code)
 
3943
{
 
3944
boolean nuweb_mode0= nuweb_mode;
 
3945
 
 
3946
unnamed_section= YES;
 
3947
 
 
3948
params= global_params;
 
3949
nuweb_mode= nuweb_mode0;
 
3950
frz_params();
 
3951
 
 
3952
mod_xref_switch= NO;
 
3953
 
 
3954
if(mark_defined.fcn_name&&lower_case_code)
 
3955
{
 
3956
defd_switch= YES;
 
3957
defd_type= FUNCTION_NAME;
 
3958
}
 
3959
}
 
3960
else
 
3961
{
 
3962
unnamed_section= NO;
 
3963
mod_xref_switch= def_flag;
 
3964
}
 
3965
 
 
3966
 
 
3967
do
 
3968
{
 
3969
if(next_control==module_name&&cur_module)
 
3970
new_mod_xref(cur_module);
 
3971
 
 
3972
if(beginning_module)
 
3973
{
 
3974
if(mod_xref_switch)
 
3975
next_control= get_next();
 
3976
else
 
3977
next_control= 075;
 
3978
 
 
3979
if(next_control==075)
 
3980
if(!nuweb_mode&&((FORTRAN_LIKE(language)&&!free_form_input)
 
3981
||(language==TEX)))
 
3982
 
 
3983
{
 
3984
loc= limit+1;
 
3985
chk_end= NO;
 
3986
column_mode= YES;
 
3987
}
 
3988
 
 
3989
 
 
3990
 
 
3991
beginning_module= NO;
 
3992
}
 
3993
else next_control= get_next();
 
3994
 
 
3995
outr_xref(CODE);
 
3996
}
 
3997
while(next_control<=module_name)
 
3998
;
 
3999
 
 
4000
column_mode= NO;
 
4001
unnamed_section= NO;
 
4002
}
 
4003
}
 
4004
 
 
4005
;
 
4006
 
 
4007
if(chngd_module[module_count])
 
4008
change_exists= YES;
 
4009
 
 
4010
typd_switch= defd_switch= NO;
 
4011
}
 
4012
 
 
4013
;
 
4014
 
 
4015
chngd_module[module_count]= change_exists;
 
4016
 
 
4017
 
 
4018
 
 
4019
{
 
4020
if(mod_check(root)&&msg_level<SHORT_INFO)
 
4021
new_line;
 
4022
else
 
4023
fflush(stdout);
 
4024
}
 
4025
 
 
4026
 
 
4027
}
 
4028
 
 
4029
 
 
4030
 
 
4031
SRTN
 
4032
C_xref FCN((part0,mode0))
 
4033
PART part0 C0("")
 
4034
PARSING_MODE mode0 C1("")
 
4035
{
 
4036
PARAMS outer_params;
 
4037
PARSE_PARAMS parse_params0;
 
4038
name_pointer p;
 
4039
 
 
4040
parsing_mode= mode0;
 
4041
 
 
4042
if(parsing_mode==INNER)
 
4043
{
 
4044
outer_params= params;
 
4045
parse_params0= parse_params;
 
4046
}
 
4047
 
 
4048
if(language==LITERAL)
 
4049
if(next_control==0174)
 
4050
{
 
4051
 
 
4052
{
 
4053
WHILE()
 
4054
{
 
4055
if(loc<limit)
 
4056
{
 
4057
if(*loc==0174)
 
4058
{
 
4059
next_control= *loc++;
 
4060
break;
 
4061
}
 
4062
 
 
4063
loc++;
 
4064
}
 
4065
else if(!get_line())
 
4066
{
 
4067
 
 
4068
err0_print(ERR_W,OC("Missing '|'.  File ended while skipping a \
 
4069
verbatim scrap"),0);
 
4070
next_control= 0174;
 
4071
break;
 
4072
}
 
4073
}
 
4074
}
 
4075
 
 
4076
 
 
4077
goto end_xref;
 
4078
}
 
4079
else
 
4080
next_control= begin_meta;
 
4081
 
 
4082
do_inside= YES;
 
4083
 
 
4084
while(next_control<formatt)
 
4085
{
 
4086
switch(next_control)
 
4087
{
 
4088
case begin_language:
 
4089
 
 
4090
 
 
4091
switch(language)
 
4092
{
 
4093
case NO_LANGUAGE:
 
4094
 
 
4095
confusion(OC("handle possible language switch"),OC("A language hasn't been defined yet"));
 
4096
 
 
4097
case FORTRAN:
 
4098
case FORTRAN_90:
 
4099
case RATFOR:
 
4100
case RATFOR_90:
 
4101
if(mode0==OUTER&&!free_form_input)
 
4102
 
 
4103
{
 
4104
loc= limit+1;
 
4105
chk_end= NO;
 
4106
column_mode= YES;
 
4107
}
 
4108
 
 
4109
 
 
4110
break;
 
4111
 
 
4112
case TEX:
 
4113
if(mode0==OUTER)
 
4114
{
 
4115
loc= limit+1;
 
4116
chk_end= NO;
 
4117
column_mode= YES;
 
4118
}
 
4119
 
 
4120
 
 
4121
break;
 
4122
 
 
4123
case C:
 
4124
case C_PLUS_PLUS:
 
4125
case LITERAL:
 
4126
column_mode= NO;
 
4127
break;
 
4128
 
 
4129
case NUWEB_OFF:
 
4130
case NUWEB_ON:
 
4131
 
 
4132
confusion(OC("handle possible language switch"),OC("Langage %i is invalid"),language);
 
4133
}
 
4134
 
 
4135
 
 
4136
 
 
4137
break;
 
4138
 
 
4139
case toggle_output:
 
4140
 
 
4141
{
 
4142
static int outer_include_depth;
 
4143
 
 
4144
if(output_on)
 
4145
{
 
4146
if(phase==2)
 
4147
{
 
4148
flush_buffer(out_ptr,NO);
 
4149
}
 
4150
outer_include_depth= incl_depth;
 
4151
output_on= NO;
 
4152
}
 
4153
else if(incl_depth<=outer_include_depth)
 
4154
{
 
4155
output_on= YES;
 
4156
}
 
4157
}
 
4158
 
 
4159
 
 
4160
break;
 
4161
 
 
4162
case begin_meta:
 
4163
if(language==LITERAL)
 
4164
 
 
4165
{
 
4166
WHILE()
 
4167
{
 
4168
if(loc>limit&&!get_line())
 
4169
{
 
4170
next_control= new_module;
 
4171
break;
 
4172
}
 
4173
 
 
4174
if(loc[0]==0100)
 
4175
switch(loc[1])
 
4176
{
 
4177
case 056:
 
4178
case 0136:
 
4179
case 071:
 
4180
case 052:
 
4181
case 040:
 
4182
case 074:
 
4183
goto done_meta;
 
4184
 
 
4185
case 0100:
 
4186
loc+= 2;
 
4187
}
 
4188
else
 
4189
loc++;
 
4190
}
 
4191
 
 
4192
done_meta:;
 
4193
}
 
4194
 
 
4195
 
 
4196
else
 
4197
 
 
4198
{
 
4199
WHILE()
 
4200
{
 
4201
if(!get_line())
 
4202
{
 
4203
 
 
4204
err0_print(ERR_W,OC("Input ended during meta-comment"),0);
 
4205
break;
 
4206
}
 
4207
 
 
4208
if(loc[0]==0100&&loc[1]==051)
 
4209
{
 
4210
get_line();
 
4211
break;
 
4212
}
 
4213
}
 
4214
}
 
4215
 
 
4216
 
 
4217
break;
 
4218
 
 
4219
case xref_roman:
 
4220
case xref_wildcard:
 
4221
case xref_typewriter:
 
4222
p= id_lookup(id_first,id_loc,
 
4223
(eight_bits)(next_control-identifier));
 
4224
 
 
4225
{
 
4226
 
 
4227
boolean defd0= defd_switch;
 
4228
 
 
4229
defd_switch= NO;
 
4230
index_flag= YES;
 
4231
new_xref(part0,p);
 
4232
defd_switch= defd0;
 
4233
}
 
4234
 
 
4235
break;
 
4236
 
 
4237
case identifier:
 
4238
p= id_lookup(id_first,id_loc,
 
4239
(eight_bits)(next_control-identifier));
 
4240
 
 
4241
new_xref(part0,p);
 
4242
 
 
4243
if(part0==DEFINITION)
 
4244
defd_switch= NO;
 
4245
 
 
4246
 
 
4247
if(C_LIKE(language)&&parsing_mode==OUTER)
 
4248
{
 
4249
if(p->ilk==typedef_like)
 
4250
 
 
4251
{
 
4252
int brace_level= 0;
 
4253
boolean typedefd_it= NO;
 
4254
 
 
4255
 
 
4256
while((next_control= get_next())==identifier)
 
4257
if((p= id_lookup(id_first,id_loc,0))->ilk!=struct_like)
 
4258
{
 
4259
new_xref(part0,p);
 
4260
next_control= get_next();
 
4261
break;
 
4262
}
 
4263
 
 
4264
while(next_control<=module_name)
 
4265
{
 
4266
switch(next_control)
 
4267
{
 
4268
case 0173:
 
4269
case 074:
 
4270
brace_level++;
 
4271
break;
 
4272
 
 
4273
case 0175:
 
4274
case 076:
 
4275
if(brace_level--==0)
 
4276
{
 
4277
 
 
4278
err0_print(ERR_W,OC("Extra '%c' in typedef"),1,XCHR(next_control));
 
4279
goto done;
 
4280
}
 
4281
break;
 
4282
 
 
4283
case identifier:
 
4284
p= id_lookup(id_first,id_loc,0);
 
4285
 
 
4286
if(brace_level==0&&!typedefd_it)
 
4287
{
 
4288
if(is_reserved(p))
 
4289
break;
 
4290
 
 
4291
defd_switch= BOOLEAN(mark_defined.typedef_name);
 
4292
defd_type= TYPEDEF_NAME;
 
4293
typd_switch= YES;
 
4294
INDEX_SHORT;
 
4295
new_xref(part0,p);
 
4296
}
 
4297
else if(do_inside)
 
4298
new_xref(part0,p);
 
4299
 
 
4300
if(brace_level==0&&!typedefd_it)
 
4301
typedefd_it= YES;
 
4302
 
 
4303
break;
 
4304
 
 
4305
case formatt:
 
4306
case limbo_text:
 
4307
case op_def:
 
4308
case macro_def:
 
4309
case definition:
 
4310
case undefinition:
 
4311
case WEB_definition:
 
4312
case begin_code:
 
4313
case new_output_file:
 
4314
case protect_code:
 
4315
case keyword_name:
 
4316
CANT_DO(typedef);
 
4317
break;
 
4318
 
 
4319
case module_name:
 
4320
if(cur_module)new_mod_xref(cur_module);
 
4321
next_control= get_next();
 
4322
if(next_control==075)
 
4323
{
 
4324
 
 
4325
err0_print(ERR_W,OC("'=' not allowed after @<...@> \
 
4326
inside typedef; check typedef syntax.  Inserted ';'"),0);
 
4327
next_control= 073;
 
4328
}
 
4329
continue;
 
4330
 
 
4331
case 073:
 
4332
if(brace_level==0)goto done;
 
4333
break;
 
4334
 
 
4335
case begin_comment:
 
4336
 
 
4337
{
 
4338
int bal;
 
4339
 
 
4340
bal= copy_comment(1);next_control= 0174;
 
4341
 
 
4342
doing_cdir= NO;
 
4343
 
 
4344
while(bal>0)
 
4345
{
 
4346
in_comment= YES;
 
4347
C_xref(part0,INNER);
 
4348
 
 
4349
if(next_control==0174)
 
4350
bal= copy_comment(bal);
 
4351
else
 
4352
bal= 0;
 
4353
}
 
4354
}
 
4355
 
 
4356
 
 
4357
break;
 
4358
}
 
4359
 
 
4360
next_control= get_next();
 
4361
}
 
4362
 
 
4363
done:
 
4364
defd_switch= typd_switch= NO;
 
4365
 
 
4366
if(next_control==new_module)
 
4367
{
 
4368
 
 
4369
err0_print(ERR_W,OC("Module ended during typedef"),0);
 
4370
goto end_xref;
 
4371
}
 
4372
}
 
4373
 
 
4374
 
 
4375
else if(p->ilk==class_like)
 
4376
 
 
4377
{
 
4378
if((next_control= get_next())==identifier)
 
4379
{
 
4380
p= id_lookup(id_first,id_loc,0);
 
4381
 
 
4382
defd_switch= BOOLEAN(mark_defined.typedef_name);
 
4383
defd_type= TYPEDEF_NAME;
 
4384
typd_switch= YES;
 
4385
INDEX_SHORT;
 
4386
 
 
4387
new_xref(part0,p);
 
4388
typd_switch= NO;
 
4389
}
 
4390
}
 
4391
 
 
4392
 
 
4393
}
 
4394
break;
 
4395
 
 
4396
case stringg:
 
4397
if(sharp_include_line&&phase==1&&read_iformats
 
4398
&&C_LIKE(language))
 
4399
get_iformats();
 
4400
 
 
4401
break;
 
4402
}
 
4403
 
 
4404
next_control= get_next();
 
4405
 
 
4406
if(next_control==0174||next_control==begin_comment)
 
4407
break;
 
4408
}
 
4409
 
 
4410
end_xref:
 
4411
if(parsing_mode==INNER)
 
4412
{
 
4413
params= outer_params;
 
4414
frz_params();
 
4415
parse_params= parse_params0;
 
4416
parsing_mode= OUTER;
 
4417
}
 
4418
}
 
4419
 
 
4420
 
 
4421
 
 
4422
SRTN
 
4423
get_iformats(VOID)
 
4424
{
 
4425
int n,new_depth;
 
4426
outer_char file_name[256];
 
4427
FILE*ftemp_in;
 
4428
PART part0= CODE;
 
4429
 
 
4430
if(!temp_in[0])
 
4431
mktmp(temp_in,
 
4432
language==C?wt_style.output_ext.C_:wt_style.output_ext.Cpp_);
 
4433
 
 
4434
if((ftemp_in= FOPEN(temp_in,"w"))==NULL)
 
4435
{
 
4436
printf("\n! Can't open temporary file `%s'",temp_in);
 
4437
mark_harmless;
 
4438
read_iformats= NO;
 
4439
return;
 
4440
}
 
4441
 
 
4442
if(!temp_out[0])
 
4443
mktmp(temp_out,(outer_char*)"");
 
4444
 
 
4445
 
 
4446
 
 
4447
preprocessing= sharp_include_line= NO;
 
4448
 
 
4449
 
 
4450
STRNCPY(file_name,id_first,n= PTR_DIFF(int,id_loc,id_first));
 
4451
file_name[n]= '\0';
 
4452
to_outer((ASCII HUGE*)file_name);
 
4453
 
 
4454
qtd_file= BOOLEAN(file_name[0]=='"');
 
4455
 
 
4456
 
 
4457
 
 
4458
 
 
4459
fprintf(ftemp_in,"#include %s\n",file_name);
 
4460
fclose(ftemp_in);
 
4461
 
 
4462
 
 
4463
{
 
4464
outer_char*temp,*temp_I;
 
4465
BUF_SIZE temp_len,ntemp;
 
4466
IN_COMMON outer_char*extra_args;
 
4467
 
 
4468
 
 
4469
{
 
4470
IN_COMMON INCL_PATHS hdr_incl;
 
4471
outer_char*p,*p1;
 
4472
 
 
4473
temp_len= STRLEN(wbprefix)+hdr_incl.size+3*(hdr_incl.num+2)+1;
 
4474
 
 
4475
 
 
4476
temp_I= GET_MEM("temp_I",temp_len,outer_char);
 
4477
 
 
4478
if(*wbprefix)
 
4479
sprintf((char*)temp_I," -I%s",wbprefix);
 
4480
 
 
4481
if(hdr_incl.list)
 
4482
for(p= hdr_incl.list;(p1= (outer_char*)STRCHR(p,':'))!=NULL;
 
4483
p= p1+1)
 
4484
{
 
4485
*p1= '\0';
 
4486
STRCAT(temp_I," -I");
 
4487
STRCAT(temp_I,p);
 
4488
*p1= ':';
 
4489
}
 
4490
 
 
4491
STRCAT(temp_I," -I.");
 
4492
}
 
4493
 
 
4494
 
 
4495
 
 
4496
temp= GET_MEM("temp",ntemp= temp_len+STRLEN(RUN_CPP)+4+3*3+temp_len
 
4497
+sizeof(temp_out)+sizeof(temp_in)+3,outer_char);
 
4498
 
 
4499
sprintf((char*)temp,"\n%s -P%s %s -o %s %s",
 
4500
#if 0
 
4501
language==C?"gcc":"g++",
 
4502
#endif
 
4503
RUN_CPP,
 
4504
temp_I,
 
4505
extra_args?(char*)extra_args:"",
 
4506
temp_out,temp_in);
 
4507
 
 
4508
if(!rmv_files)
 
4509
puts((char*)temp);
 
4510
 
 
4511
 
 
4512
system((CONST char*)temp);
 
4513
 
 
4514
FREE_MEM(temp_I,"temp_I",temp_len,outer_char);
 
4515
FREE_MEM(temp,"temp",ntemp,outer_char);
 
4516
}
 
4517
 
 
4518
 
 
4519
 
 
4520
 
 
4521
{
 
4522
if(++incl_depth>=(int)max_include_depth)
 
4523
{
 
4524
incl_depth--;
 
4525
 
 
4526
err0_print(ERR_C,OC("Too many nested includes; %d allowed.  \
 
4527
Increase with `-yid'."),1,max_include_depth);
 
4528
 
 
4529
goto restore;
 
4530
}
 
4531
 
 
4532
{
 
4533
INPUT_PRMS*p_lower= &prms[incl_depth-1];
 
4534
INPUT_PRMS0*p0_lower= &p_lower->change;
 
4535
 
 
4536
STRCPY(change_file_name,p0_lower->File_name);
 
4537
change_file= p0_lower->File;
 
4538
change_params= p_lower->input_params;
 
4539
}
 
4540
 
 
4541
STRCPY(cur_file_name,temp_out);
 
4542
new_depth= incl_depth;
 
4543
 
 
4544
{
 
4545
IN_COMMON INCL_PATHS incl;
 
4546
 
 
4547
 
 
4548
if(ini_input_prms(CUR_FILE,incl.list,NO))
 
4549
{
 
4550
if(cur_prms.change->File!=prms[incl_depth-1].change.File)
 
4551
{}
 
4552
else*cur_prms.change= prms[incl_depth-1].change;
 
4553
 
 
4554
 
 
4555
cur_line= 0;
 
4556
prn_where= YES;
 
4557
 
 
4558
 
 
4559
CLR_PRINTF(SHORT_INFO,include_file,(" (%s",file_name));
 
4560
 
 
4561
}
 
4562
else
 
4563
{
 
4564
incl_depth--;
 
4565
}
 
4566
}
 
4567
}
 
4568
 
 
4569
 
 
4570
 
 
4571
if(new_depth!=incl_depth||!get_line())
 
4572
goto restore;
 
4573
 
 
4574
do_inside= NO;
 
4575
 
 
4576
 
 
4577
next_control= get_next();
 
4578
 
 
4579
 
 
4580
 
 
4581
while(new_depth==incl_depth)
 
4582
{
 
4583
name_pointer p;
 
4584
 
 
4585
switch(next_control)
 
4586
{
 
4587
case identifier:
 
4588
p= id_lookup(id_first,id_loc,
 
4589
(eight_bits)(next_control-identifier));
 
4590
 
 
4591
if(p->ilk==typedef_like)
 
4592
 
 
4593
{
 
4594
int brace_level= 0;
 
4595
boolean typedefd_it= NO;
 
4596
 
 
4597
 
 
4598
while((next_control= get_next())==identifier)
 
4599
if((p= id_lookup(id_first,id_loc,0))->ilk!=struct_like)
 
4600
{
 
4601
new_xref(part0,p);
 
4602
next_control= get_next();
 
4603
break;
 
4604
}
 
4605
 
 
4606
while(next_control<=module_name)
 
4607
{
 
4608
switch(next_control)
 
4609
{
 
4610
case 0173:
 
4611
case 074:
 
4612
brace_level++;
 
4613
break;
 
4614
 
 
4615
case 0175:
 
4616
case 076:
 
4617
if(brace_level--==0)
 
4618
{
 
4619
 
 
4620
err0_print(ERR_W,OC("Extra '%c' in typedef"),1,XCHR(next_control));
 
4621
goto done;
 
4622
}
 
4623
break;
 
4624
 
 
4625
case identifier:
 
4626
p= id_lookup(id_first,id_loc,0);
 
4627
 
 
4628
if(brace_level==0&&!typedefd_it)
 
4629
{
 
4630
if(is_reserved(p))
 
4631
break;
 
4632
 
 
4633
defd_switch= BOOLEAN(mark_defined.typedef_name);
 
4634
defd_type= TYPEDEF_NAME;
 
4635
typd_switch= YES;
 
4636
INDEX_SHORT;
 
4637
new_xref(part0,p);
 
4638
}
 
4639
else if(do_inside)
 
4640
new_xref(part0,p);
 
4641
 
 
4642
if(brace_level==0&&!typedefd_it)
 
4643
typedefd_it= YES;
 
4644
 
 
4645
break;
 
4646
 
 
4647
case formatt:
 
4648
case limbo_text:
 
4649
case op_def:
 
4650
case macro_def:
 
4651
case definition:
 
4652
case undefinition:
 
4653
case WEB_definition:
 
4654
case begin_code:
 
4655
case new_output_file:
 
4656
case protect_code:
 
4657
case keyword_name:
 
4658
CANT_DO(typedef);
 
4659
break;
 
4660
 
 
4661
case module_name:
 
4662
if(cur_module)new_mod_xref(cur_module);
 
4663
next_control= get_next();
 
4664
if(next_control==075)
 
4665
{
 
4666
 
 
4667
err0_print(ERR_W,OC("'=' not allowed after @<...@> \
 
4668
inside typedef; check typedef syntax.  Inserted ';'"),0);
 
4669
next_control= 073;
 
4670
}
 
4671
continue;
 
4672
 
 
4673
case 073:
 
4674
if(brace_level==0)goto done;
 
4675
break;
 
4676
 
 
4677
case begin_comment:
 
4678
 
 
4679
{
 
4680
int bal;
 
4681
 
 
4682
bal= copy_comment(1);next_control= 0174;
 
4683
 
 
4684
doing_cdir= NO;
 
4685
 
 
4686
while(bal>0)
 
4687
{
 
4688
in_comment= YES;
 
4689
C_xref(part0,INNER);
 
4690
 
 
4691
if(next_control==0174)
 
4692
bal= copy_comment(bal);
 
4693
else
 
4694
bal= 0;
 
4695
}
 
4696
}
 
4697
 
 
4698
 
 
4699
break;
 
4700
}
 
4701
 
 
4702
next_control= get_next();
 
4703
}
 
4704
 
 
4705
done:
 
4706
defd_switch= typd_switch= NO;
 
4707
 
 
4708
if(next_control==new_module)
 
4709
{
 
4710
 
 
4711
err0_print(ERR_W,OC("Module ended during typedef"),0);
 
4712
goto end_xref;
 
4713
}
 
4714
}
 
4715
 
 
4716
 
 
4717
else if(p->ilk==class_like)
 
4718
 
 
4719
{
 
4720
if((next_control= get_next())==identifier)
 
4721
{
 
4722
p= id_lookup(id_first,id_loc,0);
 
4723
 
 
4724
defd_switch= BOOLEAN(mark_defined.typedef_name);
 
4725
defd_type= TYPEDEF_NAME;
 
4726
typd_switch= YES;
 
4727
INDEX_SHORT;
 
4728
 
 
4729
new_xref(part0,p);
 
4730
typd_switch= NO;
 
4731
}
 
4732
}
 
4733
 
 
4734
 
 
4735
 
 
4736
break;
 
4737
}
 
4738
 
 
4739
next_control= get_next();
 
4740
}
 
4741
 
 
4742
end_xref:
 
4743
restore:
 
4744
preprocessing= sharp_include_line= YES;
 
4745
}
 
4746
 
 
4747
 
 
4748
 
 
4749
SRTN
 
4750
cls_files(VOID)
 
4751
{
 
4752
if(read_iformats&&rmv_files)
 
4753
{
 
4754
remove((CONST char*)temp_in);
 
4755
remove((CONST char*)temp_out);
 
4756
}
 
4757
}
 
4758
 
 
4759
 
 
4760
 
 
4761
outer_char*
 
4762
mktmp FCN((file_name,ext))
 
4763
outer_char*file_name C0("")
 
4764
outer_char*ext C1("")
 
4765
{
 
4766
outer_char*buffer;
 
4767
 
 
4768
#if(HAVE_TEMPNAM)
 
4769
extern char*tempnam();
 
4770
 
 
4771
if(!*wbprefix)
 
4772
STRCPY(wbprefix,"./");
 
4773
 
 
4774
buffer= (outer_char*)tempnam((char*)wbprefix,"FTMP");
 
4775
 
 
4776
#else
 
4777
buffer= (outer_char*)tmpnam(NULL);
 
4778
#endif
 
4779
 
 
4780
STRCPY(file_name,buffer);
 
4781
 
 
4782
if(*ext)
 
4783
{
 
4784
STRCAT(file_name,".");
 
4785
STRCAT(file_name,ext);
 
4786
}
 
4787
 
 
4788
return file_name;
 
4789
}
 
4790
 
 
4791
 
 
4792
 
 
4793
SRTN
 
4794
cant_do FCN((the_part))
 
4795
outer_char*the_part C1("")
 
4796
{
 
4797
 
 
4798
err0_print(ERR_W,OC("You can't do that inside %s text"),1,the_part);
 
4799
}
 
4800
 
 
4801
 
 
4802
 
 
4803
SRTN
 
4804
outr_xref FCN((part0))
 
4805
PART part0 C1("")
 
4806
{
 
4807
while(next_control<formatt)
 
4808
if(next_control!=begin_comment)
 
4809
C_xref(part0,OUTER);
 
4810
else
 
4811
 
 
4812
{
 
4813
int bal;
 
4814
 
 
4815
bal= copy_comment(1);next_control= 0174;
 
4816
 
 
4817
doing_cdir= NO;
 
4818
 
 
4819
while(bal>0)
 
4820
{
 
4821
in_comment= YES;
 
4822
C_xref(part0,INNER);
 
4823
 
 
4824
if(next_control==0174)
 
4825
bal= copy_comment(bal);
 
4826
else
 
4827
bal= 0;
 
4828
}
 
4829
}
 
4830
 
 
4831
 
 
4832
}
 
4833
 
 
4834
 
 
4835
 
 
4836
SRTN
 
4837
pr_format FCN((xref_lhs,xref_rhs))
 
4838
boolean xref_lhs C0("")
 
4839
boolean xref_rhs C1("")
 
4840
{
 
4841
eight_bits last_control,rhs_ilk;
 
4842
LANGUAGE saved_language= language;
 
4843
 
 
4844
if(upper_case_code)
 
4845
KILL_XREFS(Formats);
 
4846
else
 
4847
KILL_XREFS(formats);
 
4848
 
 
4849
INDEX_SHORT;
 
4850
 
 
4851
if(language==TEX)
 
4852
language= C;
 
4853
 
 
4854
last_control= next_control= get_next();
 
4855
 
 
4856
 
 
4857
if(next_control==identifier||next_control==module_name)
 
4858
 
 
4859
{
 
4860
if(next_control==identifier)
 
4861
{
 
4862
lhs= id_lookup(id_first,id_loc,normal);
 
4863
lhs->ilk= normal;
 
4864
 
 
4865
if(xref_lhs)
 
4866
new_xref(DEFINITION,lhs);
 
4867
}
 
4868
else
 
4869
lhs= cur_module;
 
4870
 
 
4871
next_control= get_next();
 
4872
 
 
4873
if(next_control==identifier)
 
4874
{
 
4875
rhs= id_lookup(id_first,id_loc,normal);
 
4876
 
 
4877
if(lhs!=NULL)
 
4878
{
 
4879
if(last_control==identifier)
 
4880
 
 
4881
{
 
4882
lhs->ilk= rhs->ilk;
 
4883
 
 
4884
 
 
4885
 
 
4886
#define RST_BIT(field) lhs->field =  BOOLEAN(lhs->field & ~(boolean)language)\
 
4887
  | (rhs->field & (boolean)language)
 
4888
 
 
4889
RST_BIT(reserved_word);
 
4890
RST_BIT(Language);
 
4891
RST_BIT(intrinsic_word);
 
4892
RST_BIT(keyword);
 
4893
 
 
4894
#undef RST_BIT
 
4895
}
 
4896
 
 
4897
 
 
4898
else
 
4899
lhs->mod_ilk= rhs->ilk;
 
4900
 
 
4901
}
 
4902
 
 
4903
 
 
4904
 
 
4905
if(xref_rhs)
 
4906
{
 
4907
rhs_ilk= rhs->ilk;
 
4908
rhs->ilk= normal;
 
4909
 
 
4910
new_xref(DEFINITION,rhs);
 
4911
 
 
4912
rhs->ilk= rhs_ilk;
 
4913
}
 
4914
 
 
4915
next_control= get_next();
 
4916
}
 
4917
}
 
4918
 
 
4919
 
 
4920
else if(next_control==0140)
 
4921
 
 
4922
{
 
4923
if((next_control= get_TeX())!=constant)
 
4924
 
 
4925
err0_print(ERR_W,OC("Invalid @f command:  \
 
4926
One of the representations `a, `\\a, or `^^M is required"),0);
 
4927
else
 
4928
{
 
4929
int c= TeX_char();
 
4930
 
 
4931
next_control= get_next();
 
4932
 
 
4933
if(next_control!=constant)
 
4934
err0_print(ERR_W,OC("Invalid category code"),0);
 
4935
else
 
4936
{
 
4937
TeX_CATEGORY cat;
 
4938
 
 
4939
TERMINATE(id_loc,0);
 
4940
cat= (TeX_CATEGORY)ATOI(id_first);
 
4941
 
 
4942
 
 
4943
if((int)cat<0||(int)cat>15)
 
4944
 
 
4945
err0_print(ERR_W,OC("Category code must be between 0 and 15"),0);
 
4946
else TeX[c]= cat;
 
4947
 
 
4948
next_control= get_next();
 
4949
}
 
4950
}
 
4951
}
 
4952
 
 
4953
 
 
4954
 
 
4955
if(saved_language==TEX)
 
4956
language= saved_language;
 
4957
}
 
4958
 
 
4959
 
 
4960
 
 
4961
eight_bits
 
4962
get_TeX(VOID)
 
4963
{
 
4964
if(loc>=limit)
 
4965
{
 
4966
 
 
4967
err0_print(ERR_W,OC("@f line ends prematurely"),0);
 
4968
return ignore;
 
4969
}
 
4970
 
 
4971
id_first= id_loc= mod_text+1;
 
4972
 
 
4973
if(*loc==0134)*id_loc++= *loc++;
 
4974
else if(*loc==0136&&*(loc+1)==0136)
 
4975
{
 
4976
*id_loc++= *loc++;*id_loc++= *loc++;
 
4977
}
 
4978
 
 
4979
if(*loc==0100)
 
4980
if(*(loc+1)==0100)loc++;
 
4981
else
 
4982
err0_print(ERR_W,OC("You should say `@@"),0);
 
4983
 
 
4984
*id_loc++= *loc++;
 
4985
*id_loc= '\0';
 
4986
 
 
4987
id_first= esc_buf(id_loc+1,mod_end,id_first,YES);
 
4988
to_outer(id_first);
 
4989
 
 
4990
return constant;
 
4991
}
 
4992
 
 
4993
 
 
4994
 
 
4995
int
 
4996
TeX_char(VOID)
 
4997
{
 
4998
int c;
 
4999
 
 
5000
while(*id_first==0134)id_first++;
 
5001
 
 
5002
if(*id_first==0136&&*(id_first+1)==0136)
 
5003
{
 
5004
c= *(id_first+2);
 
5005
if(c>=64)c-= 64;
 
5006
else c+= 64;
 
5007
}
 
5008
else c= *id_first;
 
5009
 
 
5010
return c;
 
5011
}
 
5012
 
 
5013
 
 
5014
 
 
5015
int
 
5016
mod_check FCN((p))
 
5017
name_pointer p C1("Print anomalies in subtree |p|.")
 
5018
{
 
5019
int status= 0;
 
5020
 
 
5021
struct
 
5022
{
 
5023
int never_defined:1,never_used:1,multiple_uses:1;
 
5024
}anomalies;
 
5025
 
 
5026
anomalies.never_defined= anomalies.never_used= anomalies.multiple_uses= NO;
 
5027
 
 
5028
if(p)
 
5029
{
 
5030
short n_uses;
 
5031
 
 
5032
status|= mod_check(p->llink);
 
5033
 
 
5034
cur_xref= (xref_pointer)p->xref;
 
5035
 
 
5036
if(cur_xref->num<def_flag)
 
5037
anomalies.never_defined= YES;
 
5038
 
 
5039
while(cur_xref->num>=def_flag)
 
5040
cur_xref= cur_xref->xlink;
 
5041
 
 
5042
if(cur_xref==xmem)
 
5043
anomalies.never_used= YES;
 
5044
 
 
5045
n_uses= p->mod_info->params.uses;
 
5046
 
 
5047
if(n_uses>1)
 
5048
anomalies.multiple_uses= YES;
 
5049
 
 
5050
if(anomalies.never_defined||anomalies.never_used
 
5051
||anomalies.multiple_uses)
 
5052
{
 
5053
boolean warning_printed= NO;
 
5054
 
 
5055
SET_COLOR(warning);
 
5056
 
 
5057
if(anomalies.never_defined)
 
5058
{
 
5059
SET_COLOR(error);
 
5060
warning_printed= mod_warn(p,OC("never defined"));
 
5061
 
 
5062
mark_error;
 
5063
}
 
5064
 
 
5065
if(anomalies.never_used&&IS_ON(mod_warning_flag,NEVER_USED))
 
5066
{
 
5067
if(warning_printed)
 
5068
printf("; ");
 
5069
else
 
5070
warning_printed= mod_warn(p,OC("never used"));
 
5071
}
 
5072
 
 
5073
 
 
5074
if(anomalies.multiple_uses
 
5075
&&IS_ON(mod_warning_flag,MULTIPLE_USES))
 
5076
{
 
5077
if(warning_printed)
 
5078
printf("; ");
 
5079
else
 
5080
{
 
5081
warning_printed
 
5082
= mod_warn(p,OC("multiple uses"));
 
5083
 
 
5084
printf(" (%i)",n_uses);
 
5085
}
 
5086
}
 
5087
 
 
5088
 
 
5089
if(warning_printed)
 
5090
{
 
5091
printf("."),fflush(stdout);
 
5092
status= warning_printed;
 
5093
}
 
5094
}
 
5095
 
 
5096
status|= mod_check(p->rlink);
 
5097
}
 
5098
 
 
5099
return status;
 
5100
}
 
5101
 
 
5102
 
 
5103
int
 
5104
mod_warn FCN((p,msg))
 
5105
name_pointer p C0("")
 
5106
outer_char*msg C1("")
 
5107
{
 
5108
printf("\n%c! ",beep(1));
 
5109
SET_COLOR(md_name);
 
5110
printf("<");
 
5111
prn_id(p);
 
5112
printf(">");;
 
5113
set_color(color0.last);
 
5114
printf(":  ");
 
5115
printf((char*)msg);
 
5116
mark_harmless;
 
5117
return YES;
 
5118
}
 
5119
 
 
5120
 
 
5121
 
 
5122
SRTN
 
5123
flush_buffer FCN((b,per_cent))
 
5124
ASCII HUGE*b C0("")
 
5125
boolean per_cent C1("Outputs from |out_buf+1| to |b|, \
 
5126
where |b<=out_ptr|.")
 
5127
{
 
5128
ASCII HUGE*j;
 
5129
ASCII HUGE*out_start;
 
5130
 
 
5131
if(output_on)
 
5132
{
 
5133
out_start= out_buf+1;
 
5134
j= b;
 
5135
 
 
5136
 
 
5137
if(!per_cent)
 
5138
while(j>out_buf&&*j==040)
 
5139
j--;
 
5140
 
 
5141
ASCII_LINE_WRITE(j-out_buf);
 
5142
 
 
5143
if(per_cent)
 
5144
TEX_PUTXCHAR('%');
 
5145
 
 
5146
if(*b!=012)
 
5147
TEX_NEW_LINE;
 
5148
 
 
5149
out_line++;
 
5150
 
 
5151
if(b<out_ptr)
 
5152
{
 
5153
if(*out_start==045)
 
5154
out_start++;
 
5155
 
 
5156
STRNCPY(out_start,b+1,PTR_DIFF(size_t,out_ptr,b));
 
5157
}
 
5158
 
 
5159
out_ptr-= b-out_start+1;
 
5160
}
 
5161
else
 
5162
out_ptr= out_buf;
 
5163
}
 
5164
 
 
5165
 
 
5166
 
 
5167
SRTN
 
5168
fin_line(VOID)
 
5169
{
 
5170
ASCII HUGE*k;
 
5171
 
 
5172
if(out_ptr>out_buf)
 
5173
flush_buffer(out_ptr,NO);
 
5174
else
 
5175
{
 
5176
 
 
5177
for(k= cur_buffer;k<=limit;k++)
 
5178
if(*k!=040&&*k!=tab_mark)
 
5179
return;
 
5180
 
 
5181
flush_buffer(out_buf,NO);
 
5182
}
 
5183
}
 
5184
 
 
5185
 
 
5186
 
 
5187
SRTN
 
5188
out_del_tokens FCN((s,t))
 
5189
token_pointer s C0("")
 
5190
token_pointer t C1("")
 
5191
{
 
5192
if(!output_on)
 
5193
return;
 
5194
 
 
5195
while(s<t)
 
5196
out(*s++);
 
5197
}
 
5198
 
 
5199
SRTN
 
5200
out_del_str FCN((s,t))
 
5201
ASCII HUGE*s C0("")
 
5202
ASCII HUGE*t C1("")
 
5203
{
 
5204
if(!output_on)
 
5205
return;
 
5206
 
 
5207
while(s<t)
 
5208
out(*s++);
 
5209
}
 
5210
 
 
5211
SRTN
 
5212
out_str FCN((s))
 
5213
CONST outer_char HUGE*s C1("")
 
5214
{
 
5215
if(!output_on)
 
5216
return;
 
5217
 
 
5218
while(*s)
 
5219
out(XORD(*s++));
 
5220
}
 
5221
 
 
5222
 
 
5223
 
 
5224
SRTN
 
5225
out_fname FCN((s))
 
5226
CONST outer_char HUGE*s C1("File name to be written.")
 
5227
{
 
5228
ASCII a;
 
5229
 
 
5230
while(*s)
 
5231
{
 
5232
a= XORD(*s++);
 
5233
 
 
5234
switch(a)
 
5235
{
 
5236
 
 
5237
 
 
5238
 
 
5239
 
 
5240
case 0134:case 0173:case 0175
 
5241
 
 
5242
:
 
5243
 
 
5244
case 040:case 043:case 045:case 044:case 0136:case 0140:
 
5245
case 0176:case 046:case 0137
 
5246
 
 
5247
 
 
5248
 
 
5249
:
 
5250
out(0134);
 
5251
break;
 
5252
}
 
5253
out(a);
 
5254
}
 
5255
}
 
5256
 
 
5257
 
 
5258
 
 
5259
SRTN
 
5260
out_atext FCN((s))
 
5261
CONST ASCII HUGE*s C1("ASCII text to be written.")
 
5262
{
 
5263
while(*s)
 
5264
{
 
5265
switch(*s)
 
5266
{
 
5267
 
 
5268
 
 
5269
 
 
5270
 
 
5271
case 0134:case 0173:case 0175
 
5272
 
 
5273
:
 
5274
 
 
5275
case 040:case 043:case 045:case 044:case 0136:case 0140:
 
5276
case 0176:case 046:case 0137
 
5277
 
 
5278
 
 
5279
 
 
5280
:
 
5281
out(0134);
 
5282
break;
 
5283
}
 
5284
out(*s++);
 
5285
}
 
5286
}
 
5287
 
 
5288
 
 
5289
 
 
5290
SRTN
 
5291
break_out(VOID)
 
5292
{
 
5293
ASCII HUGE*k= out_ptr;
 
5294
boolean is_tex_comment= BOOLEAN(*(out_buf+1)==045);
 
5295
 
 
5296
if(nuweb_mode)
 
5297
WHILE()
 
5298
{
 
5299
if(k==out_buf)
 
5300
 
 
5301
{
 
5302
SET_COLOR(warning);
 
5303
printf("\n! Line had to be broken (output l. %u):\n",out_line);
 
5304
 
 
5305
ASCII_write(out_buf+1,out_ptr-out_buf-1);
 
5306
new_line;
 
5307
mark_harmless;
 
5308
flush_buffer(out_ptr-1,YES);
 
5309
return;
 
5310
}
 
5311
 
 
5312
;
 
5313
 
 
5314
if(STRNCMP(k,"\\WEM ",4)==0)
 
5315
{
 
5316
flush_buffer(k+= 4,NO);
 
5317
break;
 
5318
}
 
5319
 
 
5320
if(*(k--)==012)
 
5321
{
 
5322
flush_buffer(++k,NO);
 
5323
break;
 
5324
}
 
5325
}
 
5326
else
 
5327
WHILE()
 
5328
{
 
5329
if(k==out_buf)
 
5330
 
 
5331
{
 
5332
SET_COLOR(warning);
 
5333
printf("\n! Line had to be broken (output l. %u):\n",out_line);
 
5334
 
 
5335
ASCII_write(out_buf+1,out_ptr-out_buf-1);
 
5336
new_line;
 
5337
mark_harmless;
 
5338
flush_buffer(out_ptr-1,YES);
 
5339
return;
 
5340
}
 
5341
 
 
5342
;
 
5343
 
 
5344
if(*k==040)
 
5345
{
 
5346
flush_buffer(k,NO);
 
5347
break;
 
5348
}
 
5349
 
 
5350
if(*k==012&&k[-1]!=012)
 
5351
{
 
5352
*k= 045;
 
5353
flush_buffer(k,NO);
 
5354
break;
 
5355
}
 
5356
 
 
5357
if(*(k--)==0134&&*k!=0134&&*k!=012)
 
5358
{
 
5359
flush_buffer(k,YES);
 
5360
break;
 
5361
}
 
5362
}
 
5363
 
 
5364
if(is_tex_comment)
 
5365
*(++out_ptr)= 045;
 
5366
}
 
5367
 
 
5368
 
 
5369
 
 
5370
SRTN
 
5371
out_mod FCN((n,encap))
 
5372
sixteen_bits n C0("Module number.")
 
5373
boolean encap C1("Encapsulate?")
 
5374
{
 
5375
char s[100];
 
5376
 
 
5377
if(encap)
 
5378
sprintf(s,"%s%s%u%s",
 
5379
(char*)w_style.indx.encap_prefix,
 
5380
(char*)w_style.indx.encap_infix
 
5381
,n
 
5382
,(char*)w_style.indx.encap_suffix);
 
5383
else
 
5384
sprintf(s,"%u",n);
 
5385
 
 
5386
OUT_STR(s);
 
5387
 
 
5388
if(chngd_module[n])
 
5389
OUT_STR("\\*");
 
5390
 
 
5391
if(makeindex&&phase==3)
 
5392
{
 
5393
if(encap)
 
5394
fprintf(mx_file,"%c%u%c",
 
5395
(char)w_style.indx.m_arg_open
 
5396
,n
 
5397
,(char)w_style.indx.m_arg_close);
 
5398
else
 
5399
fprintf(mx_file,"%u",n);
 
5400
}
 
5401
}
 
5402
 
 
5403
 
 
5404
 
 
5405
SRTN
 
5406
out_name FCN((m_temp,surround,nis_id,p))
 
5407
outer_char*m_temp C0("Buffer")
 
5408
boolean surround C0("Surround with braces?")
 
5409
boolean is_id C0("Flag to distinguish identifier/index entry.")
 
5410
name_pointer p C1("The name to be output.")
 
5411
{
 
5412
ASCII HUGE*k,HUGE*k_end= (p+1)->byte_start;
 
5413
boolean multi_char,non_TeX_macro;
 
5414
sixteen_bits mod_defined;
 
5415
 
 
5416
if(!output_on)
 
5417
return;
 
5418
 
 
5419
multi_char= BOOLEAN(k_end-p->byte_start>1);
 
5420
 
 
5421
if(multi_char&&surround)
 
5422
out(0173);
 
5423
 
 
5424
non_TeX_macro= BOOLEAN(is_id&&*p->byte_start==0134&&language!=TEX);
 
5425
 
 
5426
if(non_TeX_macro)
 
5427
out(044);
 
5428
 
 
5429
 
 
5430
for(k= p->byte_start;k<k_end;k++)
 
5431
{
 
5432
if(is_id)
 
5433
switch(*k)
 
5434
{
 
5435
case 0134:
 
5436
case 0173:case 0175:
 
5437
 
 
5438
 
 
5439
 
 
5440
 
 
5441
if(non_TeX_macro)
 
5442
break;
 
5443
 
 
5444
 
 
5445
case 040:case 043:case 045:case 044:case 0136:case 0140:
 
5446
case 0176:case 046:case 0137
 
5447
 
 
5448
:
 
5449
out(0134);
 
5450
}
 
5451
 
 
5452
out(*k);
 
5453
}
 
5454
 
 
5455
if(non_TeX_macro)
 
5456
out(044);
 
5457
 
 
5458
if(multi_char&&surround)
 
5459
out(0175);
 
5460
 
 
5461
if(m_temp&&makeindex)
 
5462
{
 
5463
int n= out_ptr+1-m_start;
 
5464
 
 
5465
STRNCPY(m_temp,m_start,n);
 
5466
m_temp[n]= '\0';
 
5467
}
 
5468
 
 
5469
if(p->wv_macro)
 
5470
 
 
5471
{
 
5472
WV_MACRO HUGE*w= p->wv_macro;
 
5473
ASCII HUGE*s= w->text;
 
5474
 
 
5475
OUT_STR("\\WTeX{");
 
5476
 
 
5477
while(*s)
 
5478
out(*s++);
 
5479
 
 
5480
out(0175);
 
5481
}
 
5482
 
 
5483
 
 
5484
 
 
5485
 
 
5486
if(subscript_fcns&&(mod_defined= p->defined_in(language)))
 
5487
{
 
5488
char temp[100];
 
5489
 
 
5490
if(output_protect)
 
5491
OUT_STR("\\protect");
 
5492
 
 
5493
sprintf(temp,"\\WIN%d{%d}",DEFINED_TYPE(p),
 
5494
mod_defined==module_count?0:mod_defined);
 
5495
OUT_STR(temp);
 
5496
}
 
5497
}
 
5498
 
 
5499
 
 
5500
#endif 
 
5501
 
 
5502
#if(part == 0 || part == 2)
 
5503
 
 
5504
 
 
5505
SRTN
 
5506
copy_limbo(VOID)
 
5507
{
 
5508
ASCII c;
 
5509
 
 
5510
 
 
5511
{
 
5512
int k;
 
5513
OPERATOR*p;
 
5514
 
 
5515
 
 
5516
for(k= 0;k<NUM_LANGUAGES;k++)
 
5517
if(overloaded[k])
 
5518
{
 
5519
flush_buffer(out_ptr,NO);
 
5520
break;
 
5521
}
 
5522
 
 
5523
for(k= 0;k<NUM_LANGUAGES;k++)
 
5524
if(overloaded[k])
 
5525
{
 
5526
flush_buffer(out_ptr,NO);
 
5527
 
 
5528
OUT_STR("% --- Overloaded operator definitions from @v for '");
 
5529
OUT_STR(lang_codes[k]);
 
5530
OUT_STR("' ---");
 
5531
flush_buffer(out_ptr,NO);
 
5532
 
 
5533
for(p= op;p<op_ptr;p++)
 
5534
{
 
5535
OP_INFO HUGE*q= p->info+k;
 
5536
 
 
5537
if(q->overloaded)
 
5538
 
 
5539
{
 
5540
#define TEMP_LEN 1000
 
5541
 
 
5542
outer_char temp[TEMP_LEN],outer_op_name[100];
 
5543
 
 
5544
OUT_STR("\\new");
 
5545
 
 
5546
switch(q->cat)
 
5547
{
 
5548
case unorbinop:
 
5549
case binop:
 
5550
OUT_STR("binop");break;
 
5551
 
 
5552
case unop:
 
5553
OUT_STR("unop");break;
 
5554
 
 
5555
default:
 
5556
OUT_STR("op");break;
 
5557
}
 
5558
 
 
5559
STRCPY(outer_op_name,p->op_name);to_outer((ASCII*)outer_op_name);
 
5560
 
 
5561
if(
 
5562
nsprintf(temp,OC("{%s}{%s}{%s} "),3,outer_op_name,lang_codes[k],q->defn)>=(int)(TEMP_LEN))OVERFLW("temp","");
 
5563
OUT_STR(temp);
 
5564
 
 
5565
#undef TEMP_LEN
 
5566
}
 
5567
 
 
5568
 
 
5569
}
 
5570
 
 
5571
flush_buffer(out_ptr,NO);
 
5572
}
 
5573
}
 
5574
 
 
5575
 
 
5576
 
 
5577
{
 
5578
text_pointer t= tok_start+1;
 
5579
 
 
5580
 
 
5581
if(*w_style.misc.limbo_begin)
 
5582
{
 
5583
flush_buffer(out_ptr,NO);
 
5584
OUT_STR("% --- Limbo text from style-file parameter `limbo.begin' ---");
 
5585
fin_line();
 
5586
OUT_STR(w_style.misc.limbo_begin);
 
5587
flush_buffer(out_ptr,NO);
 
5588
}
 
5589
 
 
5590
 
 
5591
 
 
5592
if(text_ptr>t)
 
5593
{
 
5594
flush_buffer(out_ptr,NO);
 
5595
OUT_STR("% --- Limbo text from @l ---");
 
5596
fin_line();
 
5597
}
 
5598
 
 
5599
 
 
5600
for(;t<text_ptr;t++)
 
5601
{
 
5602
out_del_tokens(*t,*(t+1));
 
5603
flush_buffer(out_ptr,NO);
 
5604
}
 
5605
 
 
5606
 
 
5607
{
 
5608
tok_ptr= tok_mem+1;
 
5609
tok_start[0]= tok_start[1]= tok_ptr;
 
5610
text_ptr= tok_start+1;
 
5611
}
 
5612
 
 
5613
 
 
5614
}
 
5615
 
 
5616
 
 
5617
 
 
5618
OUT_STR("\n% --- Beginning of user's limbo section ---");
 
5619
flush_buffer(out_ptr,NO);
 
5620
 
 
5621
WHILE()
 
5622
{
 
5623
if(loc>limit&&(fin_line(),!get_line()))
 
5624
break;
 
5625
 
 
5626
*(limit+1)= 0100;
 
5627
 
 
5628
while(*loc!=0100)
 
5629
out(*(loc++));
 
5630
 
 
5631
if(loc++<=limit)
 
5632
{
 
5633
c= *loc++;
 
5634
 
 
5635
if(ccode[c]==new_module)
 
5636
break;
 
5637
 
 
5638
if(c!=0172&&c!=0132)
 
5639
switch(ccode[c])
 
5640
{
 
5641
 
 
5642
 
 
5643
 
 
5644
 
 
5645
case begin_C:
 
5646
case begin_RATFOR:
 
5647
case begin_FORTRAN:
 
5648
case begin_LITERAL
 
5649
 
 
5650
 
 
5651
 
 
5652
:
 
5653
loc--;
 
5654
 
 
5655
 
 
5656
case L_switch:
 
5657
 
 
5658
{
 
5659
 
 
5660
{
 
5661
ASCII l= *loc++;
 
5662
 
 
5663
switch(l)
 
5664
{
 
5665
 
 
5666
case 0143
 
5667
 
 
5668
:
 
5669
Cpp= BOOLEAN(*loc==053);
 
5670
break;
 
5671
 
 
5672
 
 
5673
case 0162
 
5674
 
 
5675
:
 
5676
 
 
5677
case 0156
 
5678
 
 
5679
:
 
5680
Fortran88= BOOLEAN(*loc==071);
 
5681
break;
 
5682
 
 
5683
 
 
5684
case 0166
 
5685
 
 
5686
 
 
5687
 
 
5688
:
 
5689
 
 
5690
case 0170
 
5691
 
 
5692
:
 
5693
break;
 
5694
 
 
5695
default:
 
5696
 
 
5697
err0_print(ERR_C,OC("! Invalid language command `@L%c' ignored"),1,XCHR(l));
 
5698
break;
 
5699
}
 
5700
 
 
5701
opt_args(l);
 
5702
 
 
5703
}
 
5704
 
 
5705
 
 
5706
 
 
5707
 
 
5708
if(module_count==0)
 
5709
global_params= params;
 
5710
 
 
5711
ini0_language();
 
5712
 
 
5713
 
 
5714
if(Fortran88&&(auto_semi&&!free_Fortran))
 
5715
{
 
5716
loc= limit+1;
 
5717
chk_end= NO;
 
5718
}
 
5719
 
 
5720
 
 
5721
 
 
5722
}
 
5723
 
 
5724
 
 
5725
break;
 
5726
 
 
5727
case begin_nuweb:
 
5728
nuweb_mode= !NUWEB_MODE;
 
5729
 
 
5730
if(module_count==0)
 
5731
global_params= params;
 
5732
break;
 
5733
 
 
5734
 
 
5735
 
 
5736
case toggle_output:
 
5737
out_skip();
 
5738
break;
 
5739
 
 
5740
case invisible_cmnt:
 
5741
loc= limit+1;
 
5742
break;
 
5743
 
 
5744
case 0100:
 
5745
out(0100);
 
5746
break;
 
5747
 
 
5748
case keyword_name:
 
5749
loc-= 2;get_next();
 
5750
 
 
5751
{
 
5752
ASCII*id_start,*id_end;
 
5753
 
 
5754
 
 
5755
{
 
5756
while(IS_WHITE(*id_first))
 
5757
id_first++;
 
5758
 
 
5759
while(IS_WHITE(id_loc[-1]))
 
5760
id_loc--;
 
5761
}
 
5762
 
 
5763
 
 
5764
 
 
5765
id_start= id_end= mod_text+1;
 
5766
 
 
5767
x_keyword(&id_end,mod_end,id_first,id_loc,NO,NO,
 
5768
upper_case_code?WEB_FILE:CUR_FILE);
 
5769
 
 
5770
out_del_str(id_start,id_end);
 
5771
}
 
5772
 
 
5773
 
 
5774
break;
 
5775
 
 
5776
default:
 
5777
 
 
5778
err0_print(ERR_W,OC("Double @ required \
 
5779
outside of sections"),0);
 
5780
 
 
5781
}
 
5782
}
 
5783
}
 
5784
 
 
5785
 
 
5786
{
 
5787
if(*w_style.misc.limbo_end)
 
5788
{
 
5789
flush_buffer(out_ptr,NO);
 
5790
OUT_STR("% --- Limbo text from style-file parameter `limbo.end' ---");
 
5791
fin_line();
 
5792
OUT_STR(w_style.misc.limbo_end);
 
5793
flush_buffer(out_ptr,NO);
 
5794
}
 
5795
}
 
5796
 
 
5797
 
 
5798
}
 
5799
 
 
5800
 
 
5801
eight_bits
 
5802
copy_TeX(VOID)
 
5803
{
 
5804
ASCII c;
 
5805
 
 
5806
WHILE()
 
5807
{
 
5808
if(loc>limit)
 
5809
{
 
5810
 
 
5811
{
 
5812
ASCII HUGE*b;
 
5813
 
 
5814
for(b= out_buf+1;b<=out_ptr;b++)
 
5815
if(*b!=040)
 
5816
break;
 
5817
 
 
5818
if(b>out_ptr)
 
5819
out_ptr= out_buf;
 
5820
}
 
5821
 
 
5822
 
 
5823
fin_line();
 
5824
 
 
5825
if(!get_line())
 
5826
return new_module;
 
5827
}
 
5828
 
 
5829
*(limit+1)= 0100;
 
5830
 
 
5831
scan:
 
5832
while((c= *(loc++))!=0174&&c!=0100)
 
5833
{
 
5834
if(c==interior_semi)
 
5835
c= 073;
 
5836
out(c);
 
5837
 
 
5838
#if(0)
 
5839
if(out_ptr==out_buf+1&&(c==040
 
5840
||c==tab_mark
 
5841
))out_ptr--;
 
5842
#endif
 
5843
}
 
5844
 
 
5845
if(c==0174)
 
5846
return 0174;
 
5847
 
 
5848
if(loc<=limit)
 
5849
{
 
5850
eight_bits cc;
 
5851
 
 
5852
if(*loc==0100)
 
5853
{
 
5854
out(0100);
 
5855
loc++;
 
5856
goto scan;
 
5857
}
 
5858
 
 
5859
 
 
5860
{
 
5861
ASCII HUGE*b;
 
5862
 
 
5863
for(b= out_buf+1;b<=out_ptr;b++)
 
5864
if(*b!=040)
 
5865
break;
 
5866
 
 
5867
if(b>out_ptr)
 
5868
out_ptr= out_buf;
 
5869
}
 
5870
 
 
5871
 
 
5872
 
 
5873
SET_CASE(*loc);
 
5874
 
 
5875
if((cc= ccode[*(loc++)])!=big_line_break)
 
5876
return cc;
 
5877
 
 
5878
if(loc>=limit)
 
5879
return cc;
 
5880
 
 
5881
 
 
5882
{
 
5883
boolean mcode;
 
5884
 
 
5885
*limit= ' ';
 
5886
id_first= loc;
 
5887
 
 
5888
while(isAlpha(*loc))
 
5889
loc++;
 
5890
 
 
5891
if((mcode= is_mcmd(mcmds,id_first,loc))!=0)
 
5892
{
 
5893
while(loc<limit&&(*loc==040||*loc==tab_mark))
 
5894
loc++;
 
5895
 
 
5896
#ifdef _FWEAVE_h
 
5897
defd_switch= NO;
 
5898
#endif
 
5899
 
 
5900
return mcode;
 
5901
}
 
5902
 
 
5903
loc= id_first;
 
5904
}
 
5905
 
 
5906
 
 
5907
;
 
5908
return cc;
 
5909
}
 
5910
}
 
5911
 
 
5912
DUMMY_RETURN(ignore);
 
5913
}
 
5914
 
 
5915
 
 
5916
 
 
5917
int
 
5918
copy_comment FCN((bal))
 
5919
int bal C1("Brace balance.")
 
5920
{
 
5921
ASCII c;
 
5922
char terminator[2];
 
5923
token_pointer tok_ptr0= tok_ptr;
 
5924
 
 
5925
in_comment= YES;
 
5926
 
 
5927
terminator[0]= *limit;terminator[1]= *(limit+1);
 
5928
 
 
5929
*limit= 040;
 
5930
 
 
5931
 
 
5932
 
 
5933
 
 
5934
 
 
5935
 
 
5936
 
 
5937
 
 
5938
if(phase==2)
 
5939
app_tok(copy_mode);
 
5940
 
 
5941
WHILE()
 
5942
{
 
5943
if(loc>limit)
 
5944
 
 
5945
{
 
5946
if(!(long_comment||language==TEX))
 
5947
{
 
5948
if((auto_semi&&!free_Fortran)&&*(tok_ptr-2)==073
 
5949
&&*(tok_ptr-1)==040)
 
5950
tok_ptr-= 2;
 
5951
 
 
5952
 
 
5953
while(*(tok_ptr-1)==040)
 
5954
tok_ptr--;
 
5955
 
 
5956
 
 
5957
if(*(tok_ptr-1)==0134&&*(tok_ptr-2)!=0134)
 
5958
tok_ptr--;
 
5959
 
 
5960
 
 
5961
if(*(tok_ptr-2)==052&&*(tok_ptr-1)==057)
 
5962
tok_ptr-= 2;
 
5963
 
 
5964
 
 
5965
 
 
5966
if(bal==1)
 
5967
{
 
5968
if(phase==2)
 
5969
{
 
5970
if(language==TEX)
 
5971
{
 
5972
token_pointer t;
 
5973
 
 
5974
for(t= tok_ptr-1;t>tok_ptr0;t--)
 
5975
if(*t!=040)break;
 
5976
 
 
5977
if(t==tok_ptr0&&*(t-4)==0134&&*(t-3)==0127&&*(t-2)==0103&&
 
5978
*(t-1)==0173)
 
5979
*(tok_ptr0-2)= 0170;
 
5980
}
 
5981
 
 
5982
 
 
5983
 
 
5984
app_tok(0175);
 
5985
}
 
5986
bal= 0;
 
5987
break;
 
5988
}
 
5989
else
 
5990
{
 
5991
 
 
5992
err0_print(ERR_W,OC("Braces don't balance in comment"),0);
 
5993
 
 
5994
 
 
5995
 
 
5996
app_tok(040);
 
5997
 
 
5998
while(bal-->0)app_tok(0175);
 
5999
 
 
6000
bal= 0;
 
6001
break;
 
6002
 
 
6003
 
 
6004
;
 
6005
}
 
6006
 
 
6007
 
 
6008
}
 
6009
 
 
6010
if(!get_line())
 
6011
{
 
6012
if(language!=TEX)
 
6013
 
 
6014
err0_print(ERR_W,OC("Input ended in mid-comment"),0);
 
6015
 
 
6016
loc= cur_buffer+1;
 
6017
 
 
6018
app_tok(040);
 
6019
 
 
6020
while(bal-->0)app_tok(0175);
 
6021
 
 
6022
bal= 0;
 
6023
break;
 
6024
 
 
6025
 
 
6026
;
 
6027
}
 
6028
 
 
6029
 
 
6030
 
 
6031
if(language==TEX)
 
6032
{
 
6033
if(loc==limit)
 
6034
 
 
6035
if(bal==1)
 
6036
{
 
6037
if(phase==2)
 
6038
{
 
6039
if(language==TEX)
 
6040
{
 
6041
token_pointer t;
 
6042
 
 
6043
for(t= tok_ptr-1;t>tok_ptr0;t--)
 
6044
if(*t!=040)break;
 
6045
 
 
6046
if(t==tok_ptr0&&*(t-4)==0134&&*(t-3)==0127&&*(t-2)==0103&&
 
6047
*(t-1)==0173)
 
6048
*(tok_ptr0-2)= 0170;
 
6049
}
 
6050
 
 
6051
 
 
6052
 
 
6053
app_tok(0175);
 
6054
}
 
6055
bal= 0;
 
6056
break;
 
6057
}
 
6058
else
 
6059
{
 
6060
 
 
6061
err0_print(ERR_W,OC("Braces don't balance in comment"),0);
 
6062
 
 
6063
 
 
6064
 
 
6065
app_tok(040);
 
6066
 
 
6067
while(bal-->0)app_tok(0175);
 
6068
 
 
6069
bal= 0;
 
6070
break;
 
6071
 
 
6072
 
 
6073
;
 
6074
}
 
6075
 
 
6076
 
 
6077
 
 
6078
for(;loc<=limit;loc++)
 
6079
if(*loc!=040&&*loc!=tab_mark)break;
 
6080
 
 
6081
if(loc>limit)continue;
 
6082
 
 
6083
if(TeX[*loc]==TeX_comment)loc++;
 
6084
else
 
6085
{
 
6086
loc= cur_buffer;
 
6087
 
 
6088
 
 
6089
if(bal==1)
 
6090
{
 
6091
if(phase==2)
 
6092
{
 
6093
if(language==TEX)
 
6094
{
 
6095
token_pointer t;
 
6096
 
 
6097
for(t= tok_ptr-1;t>tok_ptr0;t--)
 
6098
if(*t!=040)break;
 
6099
 
 
6100
if(t==tok_ptr0&&*(t-4)==0134&&*(t-3)==0127&&*(t-2)==0103&&
 
6101
*(t-1)==0173)
 
6102
*(tok_ptr0-2)= 0170;
 
6103
}
 
6104
 
 
6105
 
 
6106
 
 
6107
app_tok(0175);
 
6108
}
 
6109
bal= 0;
 
6110
break;
 
6111
}
 
6112
else
 
6113
{
 
6114
 
 
6115
err0_print(ERR_W,OC("Braces don't balance in comment"),0);
 
6116
 
 
6117
 
 
6118
 
 
6119
app_tok(040);
 
6120
 
 
6121
while(bal-->0)app_tok(0175);
 
6122
 
 
6123
bal= 0;
 
6124
break;
 
6125
 
 
6126
 
 
6127
;
 
6128
}
 
6129
 
 
6130
 
 
6131
}
 
6132
}
 
6133
}
 
6134
 
 
6135
 
 
6136
 
 
6137
 
 
6138
if(language==TEX)
 
6139
c= *loc++;
 
6140
else do
 
6141
c= *(loc++);
 
6142
while(c==tab_mark);
 
6143
 
 
6144
if(c==0174)break;
 
6145
 
 
6146
if(c==052&&*loc==057&&long_comment)
 
6147
{
 
6148
loc++;
 
6149
 
 
6150
 
 
6151
 
 
6152
if(bal==1)
 
6153
{
 
6154
if(phase==2)
 
6155
{
 
6156
if(language==TEX)
 
6157
{
 
6158
token_pointer t;
 
6159
 
 
6160
for(t= tok_ptr-1;t>tok_ptr0;t--)
 
6161
if(*t!=040)break;
 
6162
 
 
6163
if(t==tok_ptr0&&*(t-4)==0134&&*(t-3)==0127&&*(t-2)==0103&&
 
6164
*(t-1)==0173)
 
6165
*(tok_ptr0-2)= 0170;
 
6166
}
 
6167
 
 
6168
 
 
6169
 
 
6170
app_tok(0175);
 
6171
}
 
6172
bal= 0;
 
6173
break;
 
6174
}
 
6175
else
 
6176
{
 
6177
 
 
6178
err0_print(ERR_W,OC("Braces don't balance in comment"),0);
 
6179
 
 
6180
 
 
6181
 
 
6182
app_tok(040);
 
6183
 
 
6184
while(bal-->0)app_tok(0175);
 
6185
 
 
6186
bal= 0;
 
6187
break;
 
6188
 
 
6189
 
 
6190
;
 
6191
}
 
6192
 
 
6193
;
 
6194
}
 
6195
 
 
6196
 
 
6197
 
 
6198
if(phase==2)
 
6199
 
 
6200
switch(c)
 
6201
{
 
6202
case tab_mark:
 
6203
if(language==TEX)
 
6204
APP_STR("\\quad ");
 
6205
else
 
6206
app_tok(040);
 
6207
 
 
6208
break;
 
6209
 
 
6210
case interior_semi:
 
6211
app_tok(073);
 
6212
break;
 
6213
 
 
6214
case 045:
 
6215
if(language==TEX)
 
6216
app_tok(0134);
 
6217
 
 
6218
app_tok(c);
 
6219
break;
 
6220
 
 
6221
default:
 
6222
 
 
6223
 
 
6224
if(doing_cdir)
 
6225
switch(c)
 
6226
{
 
6227
 
 
6228
 
 
6229
 
 
6230
 
 
6231
case 0134:case 0173:case 0175
 
6232
 
 
6233
:
 
6234
 
 
6235
case 040:case 043:case 045:case 044:case 0136:case 0140:
 
6236
case 0176:case 046:case 0137
 
6237
 
 
6238
 
 
6239
 
 
6240
:
 
6241
app_tok(0134);
 
6242
}
 
6243
 
 
6244
app_tok(c);
 
6245
break;
 
6246
}
 
6247
 
 
6248
 
 
6249
 
 
6250
 
 
6251
 
 
6252
if(c==0100)
 
6253
{
 
6254
if(*(loc++)!=0100)
 
6255
{
 
6256
 
 
6257
err0_print(ERR_W,OC("Illegal use of @ in comment"),0);
 
6258
 
 
6259
loc-= 2;
 
6260
 
 
6261
if(phase==2)
 
6262
tok_ptr--;
 
6263
 
 
6264
 
 
6265
 
 
6266
app_tok(040);
 
6267
 
 
6268
while(bal-->0)app_tok(0175);
 
6269
 
 
6270
bal= 0;
 
6271
break;
 
6272
 
 
6273
 
 
6274
;
 
6275
}
 
6276
}
 
6277
else if(c==0134&&*loc!=0100&&phase==2)
 
6278
app_tok(*(loc++))
 
6279
else if(c==0173)
 
6280
bal++;
 
6281
else if(c==0175)
 
6282
bal--;
 
6283
 
 
6284
;
 
6285
}
 
6286
 
 
6287
if(phase==2)
 
6288
app_tok(copy_mode);
 
6289
 
 
6290
*limit= terminator[0];*(limit+1)= terminator[1];
 
6291
 
 
6292
if(!long_comment&&*limit==0100&&loc>limit)
 
6293
loc= limit;
 
6294
 
 
6295
in_comment= NO;
 
6296
return bal;
 
6297
}
 
6298
 
 
6299
 
 
6300
 
 
6301
SRTN
 
6302
C_parse FCN((mode0))
 
6303
PARSING_MODE mode0 C1("")
 
6304
{
 
6305
name_pointer p;
 
6306
LANGUAGE language0= language;
 
6307
PARSE_PARAMS parse_params0;
 
6308
 
 
6309
parse_params0= parse_params;
 
6310
 
 
6311
parsing_mode= mode0;
 
6312
 
 
6313
 
 
6314
if(parsing_mode==INNER)
 
6315
{
 
6316
at_beginning= YES;
 
6317
preprocessing= NO;
 
6318
}
 
6319
 
 
6320
while(next_control<formatt)
 
6321
{
 
6322
if(nuweb_mode&&parsing_mode==INNER)
 
6323
 
 
6324
{
 
6325
WHILE()
 
6326
{
 
6327
if(tok_ptr==tok_m_end)
 
6328
OVERFLW("tokens","tw");
 
6329
 
 
6330
if(loc<limit)
 
6331
{
 
6332
if(*loc==0174)
 
6333
{
 
6334
next_control= *loc++;
 
6335
break;
 
6336
}
 
6337
 
 
6338
app(*loc++);
 
6339
}
 
6340
else if(!get_line())
 
6341
{
 
6342
 
 
6343
err0_print(ERR_W,OC("Missing '|'.  File ended while appending a \
 
6344
verbatim scrap"),0);
 
6345
next_control= 0174;
 
6346
break;
 
6347
}
 
6348
else
 
6349
app(040);
 
6350
}
 
6351
 
 
6352
if(scrp_ptr==scrp_end)
 
6353
OVERFLW("scraps","s");
 
6354
 
 
6355
app_scrap(ignore_scrap,no_math);
 
6356
}
 
6357
 
 
6358
 
 
6359
else
 
6360
{
 
6361
 
 
6362
{
 
6363
room_for(6,4,4);
 
6364
 
 
6365
if(next_control)
 
6366
lst_ampersand= NO;
 
6367
 
 
6368
switch(next_control)
 
6369
 
 
6370
{
 
6371
case macro_module_name:
 
6372
{
 
6373
if(cur_module)
 
6374
{
 
6375
app(mod_flag+PTR_DIFF(sixteen_bits,cur_module,name_dir));
 
6376
}
 
6377
 
 
6378
app_scrap(cur_module!=NULL?cur_module->mod_ilk:expr,maybe_math);
 
6379
}
 
6380
 
 
6381
break;
 
6382
 
 
6383
case stmt_label:
 
6384
case stringg:case constant:case verbatim:
 
6385
 
 
6386
if(next_control==stmt_label&&!isDigit(*id_first))
 
6387
{
 
6388
p= id_lookup(id_first,id_loc,normal);
 
6389
app(id_flag+PTR_DIFF(sixteen_bits,p,name_dir));
 
6390
app_scrap(label,no_math);
 
6391
}
 
6392
else
 
6393
{
 
6394
if(next_control==constant||next_control==stmt_label)
 
6395
APP_STR("\\WO{");
 
6396
 
 
6397
else if(next_control==stringg)
 
6398
 
 
6399
{
 
6400
APP_STR(pfrmt->typewritr);
 
6401
app_tok(0173);
 
6402
}
 
6403
 
 
6404
 
 
6405
 
 
6406
else APP_STR("\\={");
 
6407
 
 
6408
 
 
6409
 
 
6410
{
 
6411
app_tok(verbatim);
 
6412
 
 
6413
 
 
6414
while(id_first<id_loc)
 
6415
{
 
6416
switch(*id_first)
 
6417
{
 
6418
case 054:*id_first= 061;app(0134);break;
 
6419
 
 
6420
case ordinary_space:
 
6421
*id_first= 062;app(0134);break;
 
6422
 
 
6423
case tab_mark:
 
6424
*id_first= 063;app(0134);break;
 
6425
 
 
6426
case discretionary_break:*id_first= 060;
 
6427
 
 
6428
 
 
6429
 
 
6430
 
 
6431
 
 
6432
case 0134:case 0173:case 0175
 
6433
 
 
6434
:
 
6435
 
 
6436
case 040:case 043:case 045:case 044:case 0136:case 0140:
 
6437
case 0176:case 046:case 0137
 
6438
 
 
6439
 
 
6440
 
 
6441
:
 
6442
app(0134);break;
 
6443
 
 
6444
case 0100:if(*(id_first+1)==0100)id_first++;
 
6445
else
 
6446
err0_print(ERR_W,OC("Double %s@%s should be used in strings"),2,SSET_COLOR(character),SSET_COLOR(error));
 
6447
 
 
6448
}
 
6449
 
 
6450
app_tok(*id_first++);
 
6451
}
 
6452
 
 
6453
 
 
6454
app_tok(verbatim);
 
6455
 
 
6456
app(0175);
 
6457
}
 
6458
 
 
6459
 
 
6460
 
 
6461
if(next_control==stmt_label)
 
6462
{app_scrap(label,no_math);}
 
6463
else
 
6464
{app_scrap(expr,yes_math);}
 
6465
}
 
6466
 
 
6467
;
 
6468
break;
 
6469
 
 
6470
case begin_format_stmt:in_format= YES;
 
6471
case identifier:
 
6472
{
 
6473
p= id_lookup(id_first,id_loc,normal);
 
6474
 
 
6475
 
 
6476
if(p->wv_macro)
 
6477
{
 
6478
WV_MACRO HUGE*w= p->wv_macro;
 
6479
ASCII HUGE*s= w->text;
 
6480
 
 
6481
if(w->cat)
 
6482
{
 
6483
APP_STR(pfrmt->id);
 
6484
app(0173);
 
6485
}
 
6486
 
 
6487
while(*s)
 
6488
app_tok(*s++);
 
6489
 
 
6490
if(w->cat)
 
6491
app(0175);
 
6492
 
 
6493
app_scrap(p->ilk?p->ilk:expr,w->cat?maybe_math:yes_math);
 
6494
}
 
6495
else if((p->reserved_word&(boolean)language)&&the_type!=ORDINARY_ID
 
6496
||the_type==RESERVED_WD)
 
6497
{
 
6498
eight_bits the_ilk;
 
6499
 
 
6500
app(res_flag+PTR_DIFF(sixteen_bits,p,name_dir));
 
6501
 
 
6502
the_ilk= (the_type==RESERVED_WD)?int_like:p->ilk;
 
6503
 
 
6504
app_scrap(the_ilk==normal?expr:the_ilk,
 
6505
the_ilk<max_math?yes_math:maybe_math);
 
6506
 
 
6507
 
 
6508
}
 
6509
else
 
6510
{
 
6511
if(upcoming_kind)
 
6512
{
 
6513
APP_STR("\\WKINDCHAR");
 
6514
}
 
6515
 
 
6516
app(id_flag+PTR_DIFF(sixteen_bits,p,name_dir));
 
6517
app_scrap(expr,upcoming_kind?yes_math:maybe_math);
 
6518
 
 
6519
 
 
6520
upcoming_kind= NO;
 
6521
}
 
6522
 
 
6523
the_type= NO_TYPE;
 
6524
}
 
6525
 
 
6526
;break;
 
6527
case TeX_string:
 
6528
 
 
6529
APP_STR("\\hbox{");while(id_first<id_loc)app_tok(*id_first++);
 
6530
app(0175);app_scrap(expr,maybe_math);
 
6531
 
 
6532
;break;
 
6533
case begin_language:
 
6534
 
 
6535
switch(language)
 
6536
{
 
6537
case NO_LANGUAGE:
 
6538
 
 
6539
confusion(OC("append scraps for begin_language"),OC("A language hasn't been defined yet"));
 
6540
 
 
6541
case C:
 
6542
case C_PLUS_PLUS:
 
6543
case LITERAL:
 
6544
column_mode= NO;break;
 
6545
 
 
6546
case FORTRAN:
 
6547
case FORTRAN_90:
 
6548
case RATFOR:
 
6549
case RATFOR_90:
 
6550
if(mode0==OUTER&&!free_form_input)
 
6551
{
 
6552
loc= limit+1;
 
6553
chk_end= NO;
 
6554
column_mode= YES;
 
6555
}
 
6556
 
 
6557
 
 
6558
break;
 
6559
 
 
6560
case TEX:
 
6561
if(mode0==OUTER)
 
6562
{
 
6563
loc= limit+1;
 
6564
chk_end= NO;
 
6565
column_mode= YES;
 
6566
}
 
6567
 
 
6568
 
 
6569
break;
 
6570
 
 
6571
case NUWEB_OFF:
 
6572
case NUWEB_ON:
 
6573
 
 
6574
confusion(OC("append scraps for begin_language"),OC("Language %i is invalid"),language);
 
6575
}
 
6576
 
 
6577
set_language(language);
 
6578
break
 
6579
 
 
6580
;break;
 
6581
 
 
6582
case new_output_file:
 
6583
{
 
6584
APP_STR(upper_case_code?"\\WOut{":"\\Wout{");
 
6585
 
 
6586
*id_loc= '\0';
 
6587
 
 
6588
 
 
6589
 
 
6590
was_opened(id_first,upper_case_code,&params.OUTPUT_FILE_NAME,NULL);
 
6591
 
 
6592
if(upper_case_code)
 
6593
was_opened(id_first,upper_case_code,
 
6594
&global_params.OUTPUT_FILE_NAME,NULL);
 
6595
 
 
6596
 
 
6597
id_first= esc_buf(mod_text+1,mod_end,id_first,YES);
 
6598
 
 
6599
while(*id_first)
 
6600
app_tok(*id_first++);
 
6601
 
 
6602
app(0175);
 
6603
 
 
6604
app(force);
 
6605
 
 
6606
app_scrap(ignore_scrap,no_math);
 
6607
 
 
6608
if(nuweb_mode)
 
6609
{
 
6610
next_control= begin_meta;
 
6611
continue;
 
6612
}
 
6613
}
 
6614
 
 
6615
break;
 
6616
 
 
6617
case toggle_output:
 
6618
 
 
6619
{
 
6620
static int outer_include_depth;
 
6621
 
 
6622
if(output_on)
 
6623
{
 
6624
if(phase==2)
 
6625
{
 
6626
flush_buffer(out_ptr,NO);
 
6627
}
 
6628
outer_include_depth= incl_depth;
 
6629
output_on= NO;
 
6630
}
 
6631
else if(incl_depth<=outer_include_depth)
 
6632
{
 
6633
output_on= YES;
 
6634
}
 
6635
}
 
6636
 
 
6637
 
 
6638
 
 
6639
{
 
6640
if(output_on)app(Turn_output_on);
 
6641
else
 
6642
{
 
6643
app(force);
 
6644
app(Turn_output_off);
 
6645
}
 
6646
 
 
6647
app_scrap(ignore_scrap,no_math);
 
6648
}
 
6649
 
 
6650
 
 
6651
break;
 
6652
 
 
6653
#if 0
 
6654
case macro_space:app(040);app_scrap(space,maybe_math);break;
 
6655
#endif
 
6656
case macro_space:app_scrap(ignore_scrap,maybe_math);break;
 
6657
 
 
6658
 
 
6659
 
 
6660
case 0134:
 
6661
APP_STR("\\WttBS");
 
6662
app_scrap(ignore_scrap,no_math);
 
6663
break;
 
6664
 
 
6665
case Cont_Char:
 
6666
APP_STR("\\WttBS");
 
6667
app(force);
 
6668
app_scrap(ignore_scrap,no_math);
 
6669
break;
 
6670
 
 
6671
case 012:
 
6672
app(040);
 
6673
app_scrap(newline,maybe_math);
 
6674
break;
 
6675
 
 
6676
case 057:
 
6677
if(in_format)
 
6678
{
 
6679
app(next_control);
 
6680
app_scrap(expr,no_math);
 
6681
}
 
6682
else if(in_data)
 
6683
{
 
6684
app(0173);app(next_control);app(0175);
 
6685
app_scrap(slash_like,maybe_math);
 
6686
}
 
6687
else
 
6688
{
 
6689
app_overload();
 
6690
}
 
6691
break;
 
6692
 
 
6693
case 056:
 
6694
app(next_control);app_scrap(binop,yes_math);break;
 
6695
 
 
6696
case 053:
 
6697
case 074:
 
6698
case 076:
 
6699
case 075:
 
6700
case 045:
 
6701
case 041:
 
6702
case 0176:
 
6703
case 055:
 
6704
case 052:
 
6705
case 0174:
 
6706
case 077:
 
6707
case 0136:
 
6708
app_overload();break;
 
6709
 
 
6710
case 046:
 
6711
lst_ampersand= YES;
 
6712
app_overload();break;
 
6713
 
 
6714
case 043:
 
6715
switch(*loc)
 
6716
{
 
6717
case 047:
 
6718
APP_STR("\\WNq");
 
6719
loc++;
 
6720
break;
 
6721
 
 
6722
case 042:
 
6723
APP_STR("\\WNQ");
 
6724
loc++;
 
6725
break;
 
6726
 
 
6727
default:
 
6728
APP_STR("\\#");
 
6729
break;
 
6730
}
 
6731
 
 
6732
app_scrap(expr,maybe_math);
 
6733
break;
 
6734
 
 
6735
case ignore:case xref_roman:case xref_wildcard:
 
6736
case xref_typewriter:break;
 
6737
 
 
6738
case 050:app(next_control);app_scrap(lpar,yes_math);break;
 
6739
case 051:app(next_control);
 
6740
app_scrap(rpar,yes_math);
 
6741
if(preprocessing&&!did_arg)
 
6742
{
 
6743
app(040);
 
6744
app_scrap(ignore_scrap,no_math);
 
6745
did_arg= YES;
 
6746
}
 
6747
break;
 
6748
 
 
6749
case 0133:app(next_control);app_scrap(lbracket,yes_math);break;
 
6750
case 0135:app(next_control);app_scrap(rbracket,yes_math);break;
 
6751
 
 
6752
case 0173:APP_STR("\\{");app_scrap(lbrace,yes_math);break;
 
6753
case 0175:APP_STR("\\}");app_scrap(rbrace,yes_math);break;
 
6754
 
 
6755
case 054:app(054);app_scrap(comma,yes_math);break;
 
6756
 
 
6757
case interior_semi:
 
6758
in_data= NO;
 
6759
app(073);
 
6760
app_scrap(semi,maybe_math);
 
6761
break;
 
6762
 
 
6763
case end_format_stmt:
 
6764
in_format= NO;
 
6765
 
 
6766
 
 
6767
case 073:
 
6768
in_data= NO;
 
6769
 
 
6770
if(!is_FORTRAN_(language)||prn_semis)
 
6771
app(073);
 
6772
 
 
6773
app_scrap(semi,maybe_math);
 
6774
break;
 
6775
 
 
6776
case 072:
 
6777
app(072);
 
6778
app_scrap(colon,maybe_math);
 
6779
break;
 
6780
 
 
6781
case 0140:
 
6782
APP_STR("\\WLQx");app_scrap(expr,maybe_math);
 
6783
break;
 
6784
 
 
6785
 
 
6786
 
 
6787
 
 
6788
 
 
6789
 
 
6790
 
 
6791
 
 
6792
case dot_const:
 
6793
next_control= identifier;
 
6794
id_first= dot_op.name+1;
 
6795
id_loc= id_first+STRLEN(id_first);
 
6796
app_overload();
 
6797
break;
 
6798
 
 
6799
case eq_gt:APP_STR("\\WPtr");app_scrap(binop,yes_math);
 
6800
break;
 
6801
 
 
6802
 
 
6803
case ellipsis:
 
6804
if(C_LIKE(language))
 
6805
{
 
6806
APP_STR("\\dots");
 
6807
 
 
6808
app_scrap(int_like,maybe_math);
 
6809
}
 
6810
else app_overload();
 
6811
 
 
6812
break;
 
6813
 
 
6814
case not_eq:
 
6815
case lt_eq:
 
6816
case gt_eq:
 
6817
case eq_eq:
 
6818
case and_and:
 
6819
case or_or:
 
6820
case plus_plus:
 
6821
case minus_minus:
 
6822
case minus_gt:
 
6823
case gt_gt:
 
6824
case lt_lt:
 
6825
case star_star:
 
6826
case slash_slash:
 
6827
case compound_assignment:
 
6828
app_overload();break;
 
6829
 
 
6830
case paste:APP_STR("\\WNN");app_scrap(ignore_scrap,maybe_math);
 
6831
break;
 
6832
 
 
6833
 
 
6834
case dont_expand:APP_STR("\\WNP");
 
6835
app_scrap(ignore_scrap,maybe_math);
 
6836
break;
 
6837
 
 
6838
 
 
6839
case auto_label:APP_STR("\\WNC");
 
6840
app_scrap(ignore_scrap,maybe_math);
 
6841
break;
 
6842
 
 
6843
 
 
6844
case all_variable_args:
 
6845
APP_STR("\\WND");
 
6846
app_scrap(expr,maybe_math);
 
6847
break;
 
6848
 
 
6849
 
 
6850
case colon_colon:
 
6851
if(C_LIKE(language))
 
6852
{
 
6853
 
 
6854
APP_STR("\\WCC");
 
6855
app_scrap(unop,yes_math);
 
6856
}
 
6857
else
 
6858
{
 
6859
APP_STR("\\WCF");
 
6860
 
 
6861
app_scrap(binop,yes_math);
 
6862
}
 
6863
break;
 
6864
 
 
6865
case left_array:
 
6866
APP_STR("\\WLS");
 
6867
 
 
6868
app_scrap(lpar,yes_math);
 
6869
break;
 
6870
 
 
6871
case right_array:
 
6872
APP_STR("\\WSR");
 
6873
 
 
6874
app_scrap(rpar,yes_math);
 
6875
break;
 
6876
 
 
6877
 
 
6878
 
 
6879
 
 
6880
case force_line:APP_STR("\\]");app_scrap(ignore_scrap,yes_math);break;
 
6881
case thin_space:APP_STR("\\,");app_scrap(ignore_scrap,yes_math);break;
 
6882
 
 
6883
case math_break:
 
6884
app(opt);APP_STR("0");
 
6885
app_scrap(ignore_scrap,yes_math);
 
6886
break;
 
6887
 
 
6888
case line_break:
 
6889
APP_STR("\\WBK");
 
6890
app_scrap(ignore_scrap,no_math);
 
6891
break;
 
6892
 
 
6893
case ln_break_outdent:
 
6894
app(force);
 
6895
#if 0
 
6896
app(out_force);
 
6897
 
 
6898
#endif
 
6899
APP_STR("\\WBKo");
 
6900
app_scrap(ignore_scrap,no_math);
 
6901
break;
 
6902
 
 
6903
case left_preproc:
 
6904
app(force);
 
6905
if(parsing_mode==OUTER)
 
6906
APP_STR("\\4");
 
6907
app_scrap(lproc,no_math);
 
6908
did_arg= NO;
 
6909
break;
 
6910
 
 
6911
case right_preproc:
 
6912
app(force);
 
6913
app_scrap(rproc,no_math);
 
6914
did_arg= YES;
 
6915
break;
 
6916
 
 
6917
case no_mac_expand:
 
6918
APP_STR("\\WTLD");app_scrap(expr,maybe_math);break;
 
6919
 
 
6920
case begin_meta:
 
6921
 
 
6922
{
 
6923
if(!nuweb_mode)
 
6924
app(force);
 
6925
 
 
6926
app(toggle_meta);
 
6927
APP_STR(w_style.misc.meta.code.begin);
 
6928
 
 
6929
column_mode= NO;
 
6930
scanning_meta= YES;
 
6931
 
 
6932
WHILE()
 
6933
{
 
6934
if(loc>=limit)
 
6935
{
 
6936
app(012);
 
6937
if(!get_line())
 
6938
break;
 
6939
}
 
6940
 
 
6941
while(loc<limit)
 
6942
{
 
6943
if(*loc==0100)
 
6944
 
 
6945
{
 
6946
switch(ccode[*(loc+1)])
 
6947
{
 
6948
case 0100:
 
6949
loc++;
 
6950
break;
 
6951
 
 
6952
case end_meta:
 
6953
if(!nuweb_mode&&((FORTRAN_LIKE(language)&&!free_form_input)
 
6954
||(language==TEX)))
 
6955
 
 
6956
{
 
6957
loc= limit+1;
 
6958
chk_end= NO;
 
6959
column_mode= YES;
 
6960
}
 
6961
 
 
6962
 
 
6963
 
 
6964
get_line();
 
6965
goto done_meta;
 
6966
 
 
6967
case invisible_cmnt:
 
6968
if(*(loc+2)==045)
 
6969
eat_blank_lines= YES;
 
6970
 
 
6971
app(012);
 
6972
get_line();
 
6973
 
 
6974
if(eat_blank_lines)
 
6975
{
 
6976
eat_blank_lines= NO;
 
6977
 
 
6978
while(loc>=limit)
 
6979
if(!get_line())
 
6980
goto done_meta;
 
6981
}
 
6982
 
 
6983
continue;
 
6984
 
 
6985
case new_module:
 
6986
goto done_meta;
 
6987
 
 
6988
case line_break:
 
6989
if(loc[2]==052||loc[2]==057)
 
6990
{
 
6991
loc++;
 
6992
break;
 
6993
}
 
6994
 
 
6995
 
 
6996
 
 
6997
case thin_space:
 
6998
case no_line_break:case join:
 
6999
case pseudo_semi:case pseudo_expr:case pseudo_colon:
 
7000
case Compiler_Directive:
 
7001
case no_index:case yes_index:
 
7002
case begin_bp:case insert_bp:
 
7003
loc+= 2;
 
7004
continue;
 
7005
 
 
7006
case big_line_break:
 
7007
break;
 
7008
 
 
7009
default:
 
7010
if(nuweb_mode)
 
7011
goto done_meta;
 
7012
 
 
7013
break;
 
7014
}
 
7015
}
 
7016
 
 
7017
 
 
7018
app(*loc++);
 
7019
}
 
7020
}
 
7021
 
 
7022
done_meta:
 
7023
APP_STR(w_style.misc.meta.code.end);
 
7024
app(toggle_meta);
 
7025
 
 
7026
if(!nuweb_mode)
 
7027
app(force);
 
7028
 
 
7029
app_scrap(ignore_scrap,no_math);
 
7030
scanning_meta= NO;
 
7031
}
 
7032
 
 
7033
 
 
7034
break;
 
7035
 
 
7036
case end_meta:
 
7037
if(!nuweb_mode&&((FORTRAN_LIKE(language)&&!free_form_input)
 
7038
||(language==TEX)))
 
7039
 
 
7040
{
 
7041
loc= limit+1;
 
7042
chk_end= NO;
 
7043
column_mode= YES;
 
7044
}
 
7045
 
 
7046
 
 
7047
 
 
7048
get_line();
 
7049
APP_STR(w_style.misc.meta.code.end);
 
7050
app(force);
 
7051
app_scrap(ignore_scrap,no_math);
 
7052
scanning_meta= NO;
 
7053
break;
 
7054
 
 
7055
 
 
7056
 
 
7057
 
 
7058
case big_line_break:app(big_force);app_scrap(ignore_scrap,no_math);break;
 
7059
case no_line_break:app(big_cancel);APP_STR("\\ ");app(big_cancel);
 
7060
app_scrap(ignore_scrap,no_math);break;
 
7061
 
 
7062
case pseudo_expr:app_scrap(expr,maybe_math);break;
 
7063
case pseudo_semi:app_scrap(semi,maybe_math);break;
 
7064
case pseudo_colon:app_scrap(colon,maybe_math);break;
 
7065
 
 
7066
case join:APP_STR("\\WJ");app_scrap(ignore_scrap,no_math);break;
 
7067
 
 
7068
 
 
7069
case protect_code:
 
7070
CANT_DO(code);
 
7071
 
 
7072
break;
 
7073
 
 
7074
case short_fcn:
 
7075
APP_STR("\\{");
 
7076
app_scrap(kill_newlines,yes_math);
 
7077
break;
 
7078
 
 
7079
case keyword_name:
 
7080
APP_STR("\\WRCS");
 
7081
app(060+upper_case_code);
 
7082
app(0173);
 
7083
 
 
7084
 
 
7085
{
 
7086
while(IS_WHITE(*id_first))
 
7087
id_first++;
 
7088
 
 
7089
while(IS_WHITE(id_loc[-1]))
 
7090
id_loc--;
 
7091
}
 
7092
 
 
7093
 
 
7094
*id_loc= '\0';
 
7095
app_ASCII_str(id_first);
 
7096
 
 
7097
app(0175);
 
7098
 
 
7099
app_scrap(expr,yes_math);
 
7100
break;
 
7101
 
 
7102
case next_expr:
 
7103
the_type= ORDINARY_ID;
 
7104
break;
 
7105
 
 
7106
case next_reserved:
 
7107
the_type= RESERVED_WD;
 
7108
break;
 
7109
 
 
7110
 
 
7111
 
 
7112
default:app(next_control);app_scrap(ignore_scrap,maybe_math);break;
 
7113
}
 
7114
}
 
7115
 
 
7116
;
 
7117
next_control= get_next();
 
7118
}
 
7119
 
 
7120
if(next_control==0174||next_control==begin_comment)
 
7121
break;
 
7122
 
 
7123
 
 
7124
if(next_control==begin_language&&!ok_to_define
 
7125
&&parsing_mode==OUTER)
 
7126
return;
 
7127
}
 
7128
 
 
7129
 
 
7130
if(language!=language0)
 
7131
{
 
7132
app_tok(begin_language);
 
7133
app(lan_num(language0));
 
7134
app_scrap(ignore_scrap,no_math);
 
7135
}
 
7136
 
 
7137
if(parsing_mode==INNER)
 
7138
parse_params= parse_params0;
 
7139
}
 
7140
 
 
7141
 
 
7142
 
 
7143
SRTN
 
7144
set_language FCN((language0))
 
7145
LANGUAGE language0 C1("")
 
7146
{
 
7147
char language_line[50];
 
7148
 
 
7149
language= language0;
 
7150
 
 
7151
app_tok(begin_language);
 
7152
app(lan_num(language));
 
7153
 
 
7154
if(parsing_mode==OUTER)
 
7155
{
 
7156
sprintf(language_line,"\\LANGUAGE{%s}",
 
7157
(char*)LANGUAGE_CODE(language));
 
7158
APP_STR(language_line);
 
7159
 
 
7160
}
 
7161
 
 
7162
app_scrap(language_scrap,no_math);
 
7163
}
 
7164
 
 
7165
 
 
7166
 
 
7167
text_pointer
 
7168
C_translate(VOID)
 
7169
{
 
7170
text_pointer p;
 
7171
scrap_pointer save_base;
 
7172
PARAMS outer_params;
 
7173
PARSE_PARAMS parse_params0;
 
7174
 
 
7175
outer_params= params;
 
7176
parse_params0= parse_params;
 
7177
 
 
7178
save_base= scrp_base;
 
7179
scrp_base= scrp_ptr+1;
 
7180
 
 
7181
 
 
7182
if(output_protect)
 
7183
APP_STR("\\protect");
 
7184
 
 
7185
APP_STR("\\WCD{");app_scrap(ignore_scrap,no_math);
 
7186
 
 
7187
if(nuweb_mode)
 
7188
{
 
7189
APP_STR("{\\tt ");
 
7190
app_scrap(ignore_scrap,no_math);
 
7191
}
 
7192
 
 
7193
while(next_control<=module_name)
 
7194
{
 
7195
C_parse(INNER);
 
7196
 
 
7197
if(next_control==0174)
 
7198
break;
 
7199
 
 
7200
 
 
7201
 
 
7202
if(next_control<module_name)
 
7203
{
 
7204
switch(next_control)
 
7205
{
 
7206
case m_if:case m_ifdef:case m_ifndef:
 
7207
case m_undef:case m_else:
 
7208
case m_elif:case m_endif:
 
7209
case m_for:case m_endfor:
 
7210
case m_line:
 
7211
case WEB_definition:
 
7212
pre_scrap(next_control);
 
7213
break;
 
7214
 
 
7215
default:
 
7216
CANT_DO(code);
 
7217
 
 
7218
break;
 
7219
}
 
7220
next_control= get_next();
 
7221
}
 
7222
else if(next_control==module_name)
 
7223
{
 
7224
 
 
7225
{
 
7226
if(cur_module)
 
7227
{
 
7228
app(mod_flag+PTR_DIFF(sixteen_bits,cur_module,name_dir));
 
7229
}
 
7230
 
 
7231
app_scrap(cur_module!=NULL?cur_module->mod_ilk:expr,maybe_math);
 
7232
}
 
7233
 
 
7234
 
 
7235
next_control= (nuweb_mode?begin_meta:get_next());
 
7236
}
 
7237
 
 
7238
;
 
7239
 
 
7240
if(next_control==0174)
 
7241
break;
 
7242
}
 
7243
 
 
7244
app_tok(cancel);app_scrap(ignore_scrap,maybe_math);
 
7245
 
 
7246
 
 
7247
if(nuweb_mode)
 
7248
app(0175);
 
7249
#if 0
 
7250
else
 
7251
app_scrap(semi,maybe_math);
 
7252
 
 
7253
#endif
 
7254
 
 
7255
if(output_protect)
 
7256
{
 
7257
app(protect_code);
 
7258
app_scrap(ignore_scrap,no_math);
 
7259
}
 
7260
 
 
7261
app(0175);app_scrap(ignore_scrap,no_math);
 
7262
 
 
7263
if(next_control!=0174)
 
7264
 
 
7265
err0_print(ERR_W,OC("Missing '|' after code text.  \
 
7266
(@ commands that begin definition part, code part, or new module are not \
 
7267
allowed within |...|.)"),0);
 
7268
 
 
7269
 
 
7270
p= translate(INNER);
 
7271
 
 
7272
if(scrp_ptr>mx_scr_ptr)
 
7273
mx_scr_ptr= scrp_ptr;
 
7274
 
 
7275
scrp_ptr= scrp_base-1;
 
7276
scrp_base= save_base;
 
7277
 
 
7278
params= outer_params;
 
7279
frz_params();
 
7280
 
 
7281
parse_params= parse_params0;
 
7282
 
 
7283
return p;
 
7284
}
 
7285
 
 
7286
 
 
7287
 
 
7288
SRTN
 
7289
outr_parse(VOID)
 
7290
{
 
7291
int bal;
 
7292
text_pointer p,q;
 
7293
 
 
7294
while(next_control<formatt)
 
7295
{
 
7296
if(next_control!=begin_comment)
 
7297
C_parse(OUTER);
 
7298
else
 
7299
 
 
7300
{
 
7301
if(doing_cdir)
 
7302
 
 
7303
{
 
7304
outer_char HUGE*s= t_style.cdir_start[language_num];
 
7305
int n= 2*STRLEN(s)+1;
 
7306
 
 
7307
ASCII HUGE*temp= GET_MEM("temp_cdir",n,ASCII);
 
7308
ASCII HUGE*start= GET_MEM("start_cdir",n,ASCII);
 
7309
 
 
7310
STRCPY(start,s);
 
7311
to_ASCII((outer_char HUGE*)start);
 
7312
 
 
7313
room_for(9+n,3,1);
 
7314
 
 
7315
app(force);
 
7316
APP_STR("\\WCDIR{");
 
7317
esc_buf(temp,temp+n,start,YES);APP_STR(to_outer(temp));
 
7318
 
 
7319
FREE_MEM(temp,"temp_cdir",n,ASCII);
 
7320
FREE_MEM(start,"start_cdir",n,ASCII);
 
7321
}
 
7322
 
 
7323
 
 
7324
else
 
7325
 
 
7326
{
 
7327
room_for(8,3,1);
 
7328
 
 
7329
if(Fortran88)
 
7330
{
 
7331
if(free_Fortran&&lst_ampersand)
 
7332
{
 
7333
scrp_ptr--;
 
7334
}
 
7335
else if(!at_beginning&&(auto_semi&&!free_Fortran))
 
7336
{
 
7337
app(073);
 
7338
}
 
7339
last_was_cmnt= YES;
 
7340
}
 
7341
 
 
7342
app(break_space);
 
7343
APP_STR(long_comment?"\\WC{":"\\Wc{");
 
7344
 
 
7345
}
 
7346
 
 
7347
 
 
7348
 
 
7349
bal= copy_comment(1);
 
7350
next_control= ignore;
 
7351
 
 
7352
if(doing_cdir&&bal>0)
 
7353
 
 
7354
err0_print(ERR_W,OC("Can't have vertical bars in @! compiler directives"),0);
 
7355
 
 
7356
doing_cdir= NO;
 
7357
 
 
7358
 
 
7359
while(bal>0)
 
7360
{
 
7361
in_comment= YES;
 
7362
p= text_ptr;freeze_text;
 
7363
 
 
7364
q= C_translate();
 
7365
 
 
7366
app(tok_flag+PTR_DIFF(sixteen_bits,p,tok_start));app(inner_tok_flag+PTR_DIFF(sixteen_bits,q,tok_start));
 
7367
 
 
7368
if(next_control==0174)
 
7369
{
 
7370
bal= copy_comment(bal);
 
7371
next_control= ignore;
 
7372
}
 
7373
else
 
7374
bal= 0;
 
7375
}
 
7376
 
 
7377
app(force);app_scrap(ignore_scrap,no_math);
 
7378
 
 
7379
}
 
7380
 
 
7381
 
 
7382
}
 
7383
}
 
7384
 
 
7385
 
 
7386
 
 
7387
SRTN
 
7388
push_level FCN((p))
 
7389
text_pointer p C1("")
 
7390
{
 
7391
if(stck_ptr==stck_end)OVERFLW("stack levels","kw");
 
7392
 
 
7393
if(stck_ptr>stack){
 
7394
stck_ptr->end_field= cur_end;
 
7395
stck_ptr->tok_field= cur_tok;
 
7396
stck_ptr->mode_field= cur_mode;
 
7397
}
 
7398
 
 
7399
stck_ptr++;
 
7400
 
 
7401
if(stck_ptr>mx_stck_ptr)mx_stck_ptr= stck_ptr;
 
7402
 
 
7403
cur_tok= *p;cur_end= *(p+1);
 
7404
}
 
7405
 
 
7406
 
 
7407
 
 
7408
SRTN
 
7409
pop_level(VOID)
 
7410
{
 
7411
cur_end= (--stck_ptr)->end_field;
 
7412
cur_tok= stck_ptr->tok_field;cur_mode= stck_ptr->mode_field;
 
7413
}
 
7414
 
 
7415
 
 
7416
eight_bits
 
7417
get_output(VOID)
 
7418
{
 
7419
sixteen_bits a;
 
7420
 
 
7421
restart:while(cur_tok==cur_end)pop_level();
 
7422
 
 
7423
 
 
7424
a= *(cur_tok++);
 
7425
 
 
7426
if(a>=0400)
 
7427
{
 
7428
cur_name= a%id_flag+name_dir;
 
7429
 
 
7430
switch(a/id_flag)
 
7431
{
 
7432
case 2:return res_word;
 
7433
case 3:return mod_name;
 
7434
case 4:push_level(a%id_flag+tok_start);goto restart;
 
7435
 
 
7436
case 5:push_level(a%id_flag+tok_start);cur_mode= inner;
 
7437
goto restart;
 
7438
 
 
7439
default:return identifier;
 
7440
}
 
7441
}
 
7442
 
 
7443
 
 
7444
return(eight_bits)a;
 
7445
}
 
7446
 
 
7447
 
 
7448
 
 
7449
SRTN
 
7450
output_C(VOID)
 
7451
{
 
7452
token_pointer save_tok_ptr;
 
7453
text_pointer save_text_ptr;
 
7454
eight_bits save_next_control;
 
7455
text_pointer p;
 
7456
 
 
7457
save_tok_ptr= tok_ptr;save_text_ptr= text_ptr;
 
7458
save_next_control= next_control;
 
7459
 
 
7460
next_control= ignore;p= C_translate();
 
7461
app(inner_tok_flag+PTR_DIFF(sixteen_bits,p,tok_start));
 
7462
scanning_meta= NO;
 
7463
 
 
7464
make_output();
 
7465
 
 
7466
if(text_ptr>mx_text_ptr)mx_text_ptr= text_ptr;
 
7467
if(tok_ptr>mx_tok_ptr)mx_tok_ptr= tok_ptr;
 
7468
 
 
7469
text_ptr= save_text_ptr;tok_ptr= save_tok_ptr;
 
7470
next_control= save_next_control;
 
7471
 
 
7472
}
 
7473
 
 
7474
 
 
7475
 
 
7476
SRTN
 
7477
phase2(VOID)
 
7478
{
 
7479
extern outer_char wbflnm0[];
 
7480
IN_COMMON int num_ifiles;
 
7481
 
 
7482
phase= 2;
 
7483
the_part= LIMBO;
 
7484
 
 
7485
params= global_params;
 
7486
frz_params();
 
7487
 
 
7488
rst_input();
 
7489
strt_off= ending_off= NO;
 
7490
writing(YES,tex_fname);if(tex_file==stdout)putchar('\n');
 
7491
 
 
7492
fin_line();
 
7493
 
 
7494
 
 
7495
{
 
7496
IN_COMMON outer_char style_file_name[];
 
7497
 
 
7498
OUT_STR("\n% --- Initialization parameters from FWEB's style file `");
 
7499
OUT_STR(style_file_name);
 
7500
OUT_STR("' ---");
 
7501
fin_line();
 
7502
 
 
7503
out_prm(OC("\\Wbegin[%s;%s]"),1,OC("[LaTeX.class.options;LaTeX.package.options]"),w_style.misc.LaTeX.class.options,w_style.misc.LaTeX.package.options);
 
7504
 
 
7505
out_prm(OC("{%s;%s}"),2,OC("{LaTeX.class;LaTeX.package}"),w_style.misc.LaTeX.class.file,w_style.misc.LaTeX.package.file);
 
7506
 
 
7507
out_prm(OC("{%s}"),3,OC("{indent.TeX}"),w_style.misc.TeXindent);
 
7508
 
 
7509
out_prm(OC("{%s}"),4,OC("{indent.code}"),w_style.misc.codeindent);
 
7510
 
 
7511
out_prm(OC("{%s}"),5,OC("{contents.TeX}"),w_style.contents.tex);
 
7512
 
 
7513
out_prm(OC("{ %% ##6 ---\n {%s%s}"),1,OC("{{format.reserved}{format.RESERVED}}"),pfrmt->reserved,pfrmt->RESERVED);
 
7514
 
 
7515
out_prm(OC(" {%s}"),2,OC("{format.short_id}"),pfrmt->short_id);
 
7516
 
 
7517
out_prm(OC(" {%s%s}"),3,OC("{{format.id}{format.ID}}"),pfrmt->id,pfrmt->ID);
 
7518
 
 
7519
out_prm(OC(" {%s%s}"),4,OC("{{format.outer_macro}{format.OUTER_MACRO}}"),pfrmt->id_outer,pfrmt->ID_OUTER);
 
7520
 
 
7521
out_prm(OC(" {%s%s}"),5,OC("{{format.WEB_macro}{format.WEB_MACRO}}"),pfrmt->id_inner,pfrmt->ID_INNER);
 
7522
 
 
7523
out_prm(OC(" {%s}"),6,OC("{format.intrinsic}"),pfrmt->intrinsic);
 
7524
 
 
7525
out_prm(OC(" {%s%s}"),7,OC("{{format.keyword}{format.KEYWORD}}"),pfrmt->keyword,pfrmt->KEYWORD);
 
7526
 
 
7527
out_prm(OC(" {%s}"),8,OC("{format.typewriter}"),pfrmt->typewritr);
 
7528
 
 
7529
out_prm(OC(" {}"),9,OC("(For future use)"));
 
7530
 
 
7531
out_prm(OC("}\n{%s}"),7,OC("{encap.prefix}"),w_style.indx.encap_prefix);
 
7532
 
 
7533
out_prm(OC("{%s;%s}"),8,OC("{doc.preamble;doc.postamble}"),w_style.misc.doc_preamble,w_style.misc.doc_postamble);
 
7534
 
 
7535
out_prm(OC("{%s}"),9,OC("{index.name}"),prn_index?w_style.indx.name:OC("NoIndex"));
 
7536
 
 
7537
fin_line();
 
7538
}
 
7539
 
 
7540
 
 
7541
 
 
7542
module_count= 0;
 
7543
num_ifiles= 0;
 
7544
 
 
7545
copy_limbo();
 
7546
flush_buffer(out_buf,NO);
 
7547
 
 
7548
math_flag= NO;
 
7549
 
 
7550
while(!input_has_ended)
 
7551
 
 
7552
{
 
7553
the_part= TEX_;
 
7554
 
 
7555
 
 
7556
params= global_params;
 
7557
frz_params();
 
7558
scanning_meta= NO;
 
7559
 
 
7560
module_count++;
 
7561
 
 
7562
 
 
7563
{
 
7564
 
 
7565
 
 
7566
if(STRCMP(last_include_file,this_include_file)!=0)
 
7567
{
 
7568
STRCPY(last_include_file,this_include_file);
 
7569
OUT_STR("\\WIF{");out_fname(this_include_file);
 
7570
OUT_STR("}%");
 
7571
fin_line();
 
7572
}
 
7573
 
 
7574
;
 
7575
 
 
7576
if(!in_module&&output_on)
 
7577
{
 
7578
OUT_STR(*(loc-1)==052?"\\WN":"\\WM");
 
7579
 
 
7580
 
 
7581
in_module= YES;
 
7582
 
 
7583
out_mod(module_count,NO_ENCAP);OUT_STR(". ");
 
7584
}
 
7585
 
 
7586
progress();
 
7587
}
 
7588
 
 
7589
;
 
7590
save_position;
 
7591
 
 
7592
the_type= NO_TYPE;
 
7593
 
 
7594
trns_TeX();
 
7595
trns_defn();
 
7596
trns_code();
 
7597
 
 
7598
the_type= NO_TYPE;
 
7599
 
 
7600
 
 
7601
 
 
7602
if(this_module>name_dir&&output_on)
 
7603
{
 
7604
 
 
7605
 
 
7606
first_xref= (xref_pointer)this_module->xref;
 
7607
this_xref= first_xref->xlink;
 
7608
 
 
7609
if(this_xref->num>def_flag)
 
7610
{
 
7611
mid_xref= this_xref;cur_xref= 0;
 
7612
 
 
7613
do
 
7614
{
 
7615
next_xref= this_xref->xlink;this_xref->xlink= cur_xref;
 
7616
cur_xref= this_xref;this_xref= next_xref;
 
7617
}
 
7618
while(this_xref->num>def_flag);
 
7619
 
 
7620
first_xref->xlink= cur_xref;
 
7621
}
 
7622
else mid_xref= xmem;
 
7623
 
 
7624
cur_xref= xmem;
 
7625
 
 
7626
while(this_xref!=xmem)
 
7627
{
 
7628
next_xref= this_xref->xlink;this_xref->xlink= cur_xref;
 
7629
cur_xref= this_xref;this_xref= next_xref;
 
7630
}
 
7631
 
 
7632
if(mid_xref>xmem)mid_xref->xlink= cur_xref;
 
7633
else first_xref->xlink= cur_xref;
 
7634
 
 
7635
cur_xref= first_xref->xlink;
 
7636
 
 
7637
;
 
7638
footnote(def_flag);footnote(0);
 
7639
}
 
7640
 
 
7641
;
 
7642
 
 
7643
{
 
7644
if(in_module&&output_on)
 
7645
{
 
7646
outer_char temp[500];
 
7647
 
 
7648
 
 
7649
if(
 
7650
nsprintf(temp,OC("\\fi %% End of %s"),1,MOD_TRANS(module_count))>=(int)(500))OVERFLW("temp","");
 
7651
 
 
7652
OUT_STR(temp);fin_line();
 
7653
 
 
7654
mfree();
 
7655
in_module= NO;
 
7656
 
 
7657
flush_buffer(out_buf,NO);
 
7658
}
 
7659
}
 
7660
 
 
7661
;
 
7662
}
 
7663
 
 
7664
 
 
7665
}
 
7666
 
 
7667
 
 
7668
 
 
7669
SRTN
 
7670
out_prm FCN(VA_ALIST((fmt,n,cmt VA_ARGS)))
 
7671
VA_DCL(
 
7672
CONST outer_char*fmt C0("")
 
7673
int n C0("Arg number")
 
7674
CONST outer_char*cmt C2(""))
 
7675
{
 
7676
#define TEMP_LEN (MAX_FILE_NAME_LENGTH + 100)
 
7677
 
 
7678
int num_char;
 
7679
outer_char temp0[TEMP_LEN];
 
7680
outer_char HUGE*temp1= GET_MEM("temp1",TEMP_LEN,outer_char);
 
7681
VA_LIST(arg_ptr)
 
7682
#if(NUM_VA_ARGS == 1)
 
7683
CONST outer_char*fmt;
 
7684
CONST outer_char*cmt;
 
7685
#endif
 
7686
 
 
7687
VA_START(arg_ptr,cmt);
 
7688
 
 
7689
#if(NUM_VA_ARGS == 1)
 
7690
fmt= va_arg(arg_ptr,outer_char*);
 
7691
cmt= va_arg(arg_ptr,outer_char*);
 
7692
#endif
 
7693
 
 
7694
#if ANSI_SPRINTF
 
7695
num_char= 
 
7696
#endif
 
7697
 
 
7698
vsprintf((char*)temp0,(CONST char*)fmt,arg_ptr);
 
7699
 
 
7700
#if !ANSI_SPRINTF
 
7701
num_char= (int)STRLEN(temp0);
 
7702
#endif
 
7703
 
 
7704
if(num_char>=TEMP_LEN)
 
7705
OVERFLW("out_prm:temp0","");
 
7706
 
 
7707
OUT_STR(xpn_name(&temp1,TEMP_LEN,temp0,wbflnm0));
 
7708
fin_line();
 
7709
 
 
7710
sprintf((char*)temp1,"  %% #%i --- ",n);
 
7711
OUT_STR(temp1);OUT_STR(cmt);
 
7712
fin_line();
 
7713
 
 
7714
FREE_MEM(temp1,"temp1",TEMP_LEN,outer_char);
 
7715
 
 
7716
#undef TEMP_LEN
 
7717
}
 
7718
 
 
7719
 
 
7720
 
 
7721
SRTN
 
7722
trns_TeX(VOID)
 
7723
{
 
7724
the_part= TEX_;
 
7725
parsing_mode= OUTER;
 
7726
 
 
7727
do
 
7728
{
 
7729
next_control= copy_TeX();
 
7730
 
 
7731
switch(next_control)
 
7732
{
 
7733
 
 
7734
 
 
7735
 
 
7736
 
 
7737
case begin_C:
 
7738
case begin_RATFOR:
 
7739
case begin_FORTRAN:
 
7740
case begin_LITERAL
 
7741
 
 
7742
 
 
7743
 
 
7744
:
 
7745
loc--;
 
7746
 
 
7747
 
 
7748
case L_switch:
 
7749
 
 
7750
{
 
7751
 
 
7752
{
 
7753
ASCII l= *loc++;
 
7754
 
 
7755
switch(l)
 
7756
{
 
7757
 
 
7758
case 0143
 
7759
 
 
7760
:
 
7761
Cpp= BOOLEAN(*loc==053);
 
7762
break;
 
7763
 
 
7764
 
 
7765
case 0162
 
7766
 
 
7767
:
 
7768
 
 
7769
case 0156
 
7770
 
 
7771
:
 
7772
Fortran88= BOOLEAN(*loc==071);
 
7773
break;
 
7774
 
 
7775
 
 
7776
case 0166
 
7777
 
 
7778
 
 
7779
 
 
7780
:
 
7781
 
 
7782
case 0170
 
7783
 
 
7784
:
 
7785
break;
 
7786
 
 
7787
default:
 
7788
 
 
7789
err0_print(ERR_C,OC("! Invalid language command `@L%c' ignored"),1,XCHR(l));
 
7790
break;
 
7791
}
 
7792
 
 
7793
opt_args(l);
 
7794
 
 
7795
}
 
7796
 
 
7797
 
 
7798
 
 
7799
 
 
7800
if(module_count==0)
 
7801
global_params= params;
 
7802
 
 
7803
ini0_language();
 
7804
 
 
7805
 
 
7806
if(Fortran88&&(auto_semi&&!free_Fortran))
 
7807
{
 
7808
loc= limit+1;
 
7809
chk_end= NO;
 
7810
}
 
7811
 
 
7812
 
 
7813
 
 
7814
}
 
7815
 
 
7816
 
 
7817
break;
 
7818
 
 
7819
case begin_nuweb:
 
7820
nuweb_mode= !NUWEB_MODE;
 
7821
 
 
7822
if(module_count==0)
 
7823
global_params= params;
 
7824
break;
 
7825
 
 
7826
 
 
7827
 
 
7828
case toggle_output:
 
7829
out_skip();
 
7830
break;
 
7831
 
 
7832
case 0174:ini_stack;output_C();break;
 
7833
 
 
7834
case math_break:
 
7835
out(0174);
 
7836
break;
 
7837
 
 
7838
case 0100:
 
7839
out(0100);
 
7840
break;
 
7841
 
 
7842
case invisible_cmnt:loc= limit+1;break;
 
7843
 
 
7844
case begin_meta:
 
7845
OUT_STR(w_style.misc.meta.TeX.begin);
 
7846
break;
 
7847
 
 
7848
case end_meta:
 
7849
OUT_STR(w_style.misc.meta.TeX.end);
 
7850
break;
 
7851
 
 
7852
case TeX_string:
 
7853
case xref_roman:case xref_wildcard:case xref_typewriter:
 
7854
case macro_module_name:case module_name:
 
7855
loc-= 2;next_control= get_next();
 
7856
 
 
7857
if(next_control==TeX_string)
 
7858
 
 
7859
err0_print(ERR_W,OC("@t (TeX string) should be in code text only"),0);
 
7860
 
 
7861
 
 
7862
break;
 
7863
 
 
7864
case keyword_name:
 
7865
loc-= 2;next_control= get_next();
 
7866
 
 
7867
{
 
7868
ASCII*id_start,*id_end;
 
7869
 
 
7870
 
 
7871
{
 
7872
while(IS_WHITE(*id_first))
 
7873
id_first++;
 
7874
 
 
7875
while(IS_WHITE(id_loc[-1]))
 
7876
id_loc--;
 
7877
}
 
7878
 
 
7879
 
 
7880
 
 
7881
id_start= id_end= mod_text+1;
 
7882
 
 
7883
x_keyword(&id_end,mod_end,id_first,id_loc,NO,NO,
 
7884
upper_case_code?WEB_FILE:CUR_FILE);
 
7885
 
 
7886
out_del_str(id_start,id_end);
 
7887
}
 
7888
 
 
7889
 
 
7890
break;
 
7891
 
 
7892
case thin_space:
 
7893
case line_break:case ln_break_outdent:
 
7894
case big_line_break:case no_line_break:case join:
 
7895
case pseudo_semi:case pseudo_expr:case pseudo_colon:
 
7896
case Compiler_Directive:
 
7897
case no_index:
 
7898
case begin_bp:case insert_bp:
 
7899
CANT_DO(TeX);
 
7900
 
 
7901
break;
 
7902
 
 
7903
case protect_code:
 
7904
if(*loc!=0174)
 
7905
 
 
7906
err0_print(ERR_W,OC("@p should be immediately followed by '|'"),0);
 
7907
 
 
7908
output_protect= YES;
 
7909
break;
 
7910
 
 
7911
case USED_BY_NEITHER:
 
7912
 
 
7913
err0_print(ERR_W,OC("Invalid `@%c' ignored"),1,XCHR(*(loc-1)));
 
7914
break;
 
7915
}
 
7916
}
 
7917
while(next_control<formatt);
 
7918
 
 
7919
output_protect= NO;
 
7920
}
 
7921
 
 
7922
 
 
7923
 
 
7924
SRTN
 
7925
trns_defn(VOID)
 
7926
{
 
7927
boolean overload_ops0= overload_ops;
 
7928
 
 
7929
the_part= DEFINITION;
 
7930
parsing_mode= OUTER;
 
7931
 
 
7932
if(next_control<begin_code)
 
7933
{
 
7934
emit_space_if_needed;save_position;
 
7935
 
 
7936
{
 
7937
if(output_on)app(Turn_output_on);
 
7938
else
 
7939
{
 
7940
app(force);
 
7941
 
 
7942
app(turn_output_off);
 
7943
}
 
7944
 
 
7945
app_scrap(ignore_scrap,no_math);
 
7946
}
 
7947
 
 
7948
 
 
7949
}
 
7950
 
 
7951
while(next_control<begin_code)
 
7952
 
 
7953
{
 
7954
eight_bits last_control= next_control;
 
7955
boolean nuweb_mode0;
 
7956
 
 
7957
ini_stack;
 
7958
 
 
7959
switch(next_control)
 
7960
{
 
7961
case begin_comment:
 
7962
case invisible_cmnt:
 
7963
break;
 
7964
 
 
7965
default:
 
7966
 
 
7967
{
 
7968
if(output_on)app(Turn_output_on);
 
7969
else
 
7970
{
 
7971
app(force);
 
7972
 
 
7973
app(turn_output_off);
 
7974
}
 
7975
 
 
7976
app_scrap(ignore_scrap,no_math);
 
7977
}
 
7978
 
 
7979
 
 
7980
break;
 
7981
}
 
7982
 
 
7983
nuweb_mode0= nuweb_mode;
 
7984
nuweb_mode= NO;
 
7985
 
 
7986
switch(next_control)
 
7987
{
 
7988
case formatt:
 
7989
 
 
7990
{
 
7991
LANGUAGE saved_language= language;
 
7992
scrap_pointer scrp_ptr0;
 
7993
 
 
7994
if(upper_case_code)
 
7995
{
 
7996
SUPPRESS(Formats);
 
7997
}
 
7998
else
 
7999
{
 
8000
SUPPRESS(formats);
 
8001
}
 
8002
 
 
8003
 
 
8004
app_proc(next_control);
 
8005
scrp_ptr0= scrp_ptr;
 
8006
app_scrap(expr,maybe_math);
 
8007
 
 
8008
 
 
8009
 
 
8010
if(language==TEX)
 
8011
language= C;
 
8012
 
 
8013
next_control= get_next();
 
8014
 
 
8015
if(next_control==identifier||next_control==module_name)
 
8016
 
 
8017
{
 
8018
if(next_control==identifier)
 
8019
APP_ID;
 
8020
else
 
8021
app(mod_flag+PTR_DIFF(sixteen_bits,cur_module,name_dir));
 
8022
 
 
8023
APP_STR("\\ ");
 
8024
 
 
8025
next_control= get_next();
 
8026
 
 
8027
if(next_control==identifier)
 
8028
{
 
8029
APP_ID;
 
8030
 
 
8031
{
 
8032
app_scrap(expr,maybe_math);
 
8033
app_scrap(semi,maybe_math);
 
8034
 
 
8035
sharp_include_line= NO;
 
8036
 
 
8037
next_control= get_next();
 
8038
}
 
8039
 
 
8040
 
 
8041
}
 
8042
}
 
8043
 
 
8044
 
 
8045
else if(next_control==0140)
 
8046
 
 
8047
{
 
8048
 
 
8049
{
 
8050
APP_STR(pfrmt->typewritr);
 
8051
app_tok(0173);
 
8052
}
 
8053
 
 
8054
 
 
8055
app(0140);
 
8056
if((next_control= get_TeX())==constant)
 
8057
APP_STR((outer_char*)id_first);
 
8058
app(0175);
 
8059
 
 
8060
APP_STR("\\ ");
 
8061
 
 
8062
next_control= get_next();
 
8063
 
 
8064
if(next_control==constant)
 
8065
{
 
8066
APP_STR("\\WO{");
 
8067
 
 
8068
while(id_first<id_loc)
 
8069
app_tok(*id_first++);
 
8070
 
 
8071
app(0175);
 
8072
 
 
8073
 
 
8074
{
 
8075
app_scrap(expr,maybe_math);
 
8076
app_scrap(semi,maybe_math);
 
8077
 
 
8078
sharp_include_line= NO;
 
8079
 
 
8080
next_control= get_next();
 
8081
}
 
8082
 
 
8083
 
 
8084
}
 
8085
}
 
8086
 
 
8087
 
 
8088
 
 
8089
if(scrp_ptr!=scrp_ptr0+3)
 
8090
 
 
8091
err0_print(ERR_W,OC("Improper format definition"),0);
 
8092
 
 
8093
 
 
8094
 
 
8095
 
 
8096
if(saved_language==TEX)
 
8097
language= saved_language;
 
8098
}
 
8099
 
 
8100
 
 
8101
break;
 
8102
 
 
8103
case limbo_text:
 
8104
 
 
8105
{
 
8106
SUPPRESS(limbo);
 
8107
 
 
8108
app_proc(next_control);
 
8109
app_scrap(expr,maybe_math);
 
8110
 
 
8111
 
 
8112
if((next_control= get_next())!=stringg)
 
8113
 
 
8114
err0_print(ERR_W,OC("A string must follow @l"),0);
 
8115
}
 
8116
 
 
8117
 
 
8118
break;
 
8119
 
 
8120
case op_def:
 
8121
 
 
8122
{
 
8123
SUPPRESS(v);
 
8124
 
 
8125
overload_ops= NO;
 
8126
 
 
8127
app_proc(next_control);
 
8128
app_scrap(expr,maybe_math);
 
8129
 
 
8130
 
 
8131
if(valid_op(next_control= get_next()))
 
8132
{
 
8133
 
 
8134
{
 
8135
switch(next_control)
 
8136
{
 
8137
case identifier:
 
8138
 
 
8139
err0_print(ERR_W,OC("For future compatibility, please use syntax .NAME. for \
 
8140
overloading dot operators"),0);
 
8141
 
 
8142
APP_ID;
 
8143
break;
 
8144
 
 
8145
case dot_const:
 
8146
 
 
8147
{
 
8148
APP_STR(pfrmt->typewritr);
 
8149
app_tok(0173);
 
8150
}
 
8151
 
 
8152
 
 
8153
app(wt_style.dot_delimiter.begin);
 
8154
app_ASCII_str(dot_op.name+1);
 
8155
app(wt_style.dot_delimiter.end);
 
8156
app(0175);
 
8157
break;
 
8158
 
 
8159
default:
 
8160
app(0173);
 
8161
app_overload();
 
8162
app(0175);
 
8163
break;
 
8164
}
 
8165
 
 
8166
app_scrap(expr,yes_math);
 
8167
}
 
8168
 
 
8169
 
 
8170
 
 
8171
app(040);app_scrap(expr,no_math);
 
8172
 
 
8173
 
 
8174
if((next_control= get_next())==stringg)
 
8175
{
 
8176
 
 
8177
{
 
8178
APP_STR(pfrmt->typewritr);
 
8179
app_tok(0173);
 
8180
}
 
8181
 
 
8182
 
 
8183
 
 
8184
{
 
8185
app_tok(verbatim);
 
8186
 
 
8187
 
 
8188
while(id_first<id_loc)
 
8189
{
 
8190
switch(*id_first)
 
8191
{
 
8192
case 054:*id_first= 061;app(0134);break;
 
8193
 
 
8194
case ordinary_space:
 
8195
*id_first= 062;app(0134);break;
 
8196
 
 
8197
case tab_mark:
 
8198
*id_first= 063;app(0134);break;
 
8199
 
 
8200
case discretionary_break:*id_first= 060;
 
8201
 
 
8202
 
 
8203
 
 
8204
 
 
8205
 
 
8206
case 0134:case 0173:case 0175
 
8207
 
 
8208
:
 
8209
 
 
8210
case 040:case 043:case 045:case 044:case 0136:case 0140:
 
8211
case 0176:case 046:case 0137
 
8212
 
 
8213
 
 
8214
 
 
8215
:
 
8216
app(0134);break;
 
8217
 
 
8218
case 0100:if(*(id_first+1)==0100)id_first++;
 
8219
else
 
8220
err0_print(ERR_W,OC("Double %s@%s should be used in strings"),2,SSET_COLOR(character),SSET_COLOR(error));
 
8221
 
 
8222
}
 
8223
 
 
8224
app_tok(*id_first++);
 
8225
}
 
8226
 
 
8227
 
 
8228
app_tok(verbatim);
 
8229
 
 
8230
app(0175);
 
8231
}
 
8232
 
 
8233
 
 
8234
app_scrap(expr,yes_math);
 
8235
 
 
8236
 
 
8237
if(valid_op(next_control= get_next()))
 
8238
{
 
8239
app(040);app_scrap(expr,no_math);
 
8240
 
 
8241
 
 
8242
{
 
8243
switch(next_control)
 
8244
{
 
8245
case identifier:
 
8246
 
 
8247
err0_print(ERR_W,OC("For future compatibility, please use syntax .NAME. for \
 
8248
overloading dot operators"),0);
 
8249
 
 
8250
APP_ID;
 
8251
break;
 
8252
 
 
8253
case dot_const:
 
8254
 
 
8255
{
 
8256
APP_STR(pfrmt->typewritr);
 
8257
app_tok(0173);
 
8258
}
 
8259
 
 
8260
 
 
8261
app(wt_style.dot_delimiter.begin);
 
8262
app_ASCII_str(dot_op.name+1);
 
8263
app(wt_style.dot_delimiter.end);
 
8264
app(0175);
 
8265
break;
 
8266
 
 
8267
default:
 
8268
app(0173);
 
8269
app_overload();
 
8270
app(0175);
 
8271
break;
 
8272
}
 
8273
 
 
8274
app_scrap(expr,yes_math);
 
8275
}
 
8276
 
 
8277
 
 
8278
 
 
8279
next_control= get_next();
 
8280
}
 
8281
}
 
8282
}
 
8283
}
 
8284
 
 
8285
 
 
8286
break;
 
8287
 
 
8288
case macro_def:
 
8289
 
 
8290
{
 
8291
SUPPRESS(w);
 
8292
 
 
8293
app_proc(next_control);
 
8294
app_scrap(expr,maybe_math);
 
8295
 
 
8296
 
 
8297
if((next_control= get_next())==identifier)
 
8298
{
 
8299
ASCII HUGE*id_first0,HUGE*id_loc0;
 
8300
 
 
8301
 
 
8302
id_first0= id_first;
 
8303
id_loc0= id_loc;
 
8304
 
 
8305
APP_ID;
 
8306
 
 
8307
app(040);app_scrap(expr,no_math);
 
8308
 
 
8309
 
 
8310
switch(next_control= get_next())
 
8311
{
 
8312
case 0134:
 
8313
if((next_control= get_next())!=identifier)break;
 
8314
goto quick_code1;
 
8315
 
 
8316
case QUICK_FORMAT:
 
8317
id_first= id_first0;
 
8318
id_loc= id_loc0;
 
8319
 
 
8320
quick_code1:
 
8321
 
 
8322
{
 
8323
APP_STR(pfrmt->typewritr);
 
8324
app_tok(0173);
 
8325
}
 
8326
 
 
8327
 
 
8328
APP_STR("\\\\");
 
8329
*id_loc= '\0';
 
8330
app_ASCII_str(id_first);
 
8331
app(0175);
 
8332
app_scrap(expr,yes_math);
 
8333
next_control= get_next();
 
8334
break;
 
8335
 
 
8336
case stringg:
 
8337
 
 
8338
{
 
8339
APP_STR(pfrmt->typewritr);
 
8340
app_tok(0173);
 
8341
}
 
8342
 
 
8343
 
 
8344
 
 
8345
{
 
8346
app_tok(verbatim);
 
8347
 
 
8348
 
 
8349
while(id_first<id_loc)
 
8350
{
 
8351
switch(*id_first)
 
8352
{
 
8353
case 054:*id_first= 061;app(0134);break;
 
8354
 
 
8355
case ordinary_space:
 
8356
*id_first= 062;app(0134);break;
 
8357
 
 
8358
case tab_mark:
 
8359
*id_first= 063;app(0134);break;
 
8360
 
 
8361
case discretionary_break:*id_first= 060;
 
8362
 
 
8363
 
 
8364
 
 
8365
 
 
8366
 
 
8367
case 0134:case 0173:case 0175
 
8368
 
 
8369
:
 
8370
 
 
8371
case 040:case 043:case 045:case 044:case 0136:case 0140:
 
8372
case 0176:case 046:case 0137
 
8373
 
 
8374
 
 
8375
 
 
8376
:
 
8377
app(0134);break;
 
8378
 
 
8379
case 0100:if(*(id_first+1)==0100)id_first++;
 
8380
else
 
8381
err0_print(ERR_W,OC("Double %s@%s should be used in strings"),2,SSET_COLOR(character),SSET_COLOR(error));
 
8382
 
 
8383
}
 
8384
 
 
8385
app_tok(*id_first++);
 
8386
}
 
8387
 
 
8388
 
 
8389
app_tok(verbatim);
 
8390
 
 
8391
app(0175);
 
8392
}
 
8393
 
 
8394
 
 
8395
app_scrap(expr,yes_math);
 
8396
next_control= get_next();
 
8397
break;
 
8398
}
 
8399
}
 
8400
}
 
8401
 
 
8402
 
 
8403
break;
 
8404
 
 
8405
case begin_comment:
 
8406
doing_cdir= NO;
 
8407
break;
 
8408
 
 
8409
case invisible_cmnt:
 
8410
loc= limit+1;
 
8411
 
 
8412
 
 
8413
while((next_control= get_next())<formatt
 
8414
&&next_control!=begin_comment);
 
8415
continue;
 
8416
 
 
8417
default:
 
8418
 
 
8419
{
 
8420
LANGUAGE saved_language= language;
 
8421
 
 
8422
if(next_control==definition)
 
8423
SUPPRESS(outer_macros);
 
8424
 
 
8425
if(next_control==WEB_definition)
 
8426
SUPPRESS(macros);
 
8427
 
 
8428
app_proc(next_control);
 
8429
 
 
8430
if(language==TEX)
 
8431
language= C;
 
8432
 
 
8433
if(((C_LIKE(language)||language==LITERAL)&&
 
8434
next_control<=WEB_definition)||
 
8435
next_control==WEB_definition||
 
8436
next_control==m_ifdef||
 
8437
next_control==m_ifndef||next_control==m_undef)
 
8438
{
 
8439
next_control= get_next();
 
8440
 
 
8441
if(!(next_control==identifier||next_control==AUTO_INSERT
 
8442
||next_control==MAKE_RECURSIVE
 
8443
||next_control==PROTECTED))
 
8444
{
 
8445
IMPROPER("macro","'[', '*', '!', or identifier");
 
8446
 
 
8447
}
 
8448
else
 
8449
{
 
8450
if(next_control==MAKE_RECURSIVE||next_control==PROTECTED)
 
8451
{
 
8452
app(next_control);
 
8453
next_control= get_next();
 
8454
}
 
8455
else
 
8456
{
 
8457
APP_STR("{}");
 
8458
 
 
8459
if(next_control==0133)
 
8460
 
 
8461
{
 
8462
APP_STR("\\Wauto");
 
8463
get_string(0133,'\0');
 
8464
*id_loc= '\0';
 
8465
app_ASCII_str(id_first);
 
8466
next_control= get_next();
 
8467
}
 
8468
 
 
8469
 
 
8470
}
 
8471
 
 
8472
if(next_control!=identifier)
 
8473
IMPROPER("macro","identifier");
 
8474
else
 
8475
{
 
8476
APP_ID;
 
8477
 
 
8478
 
 
8479
if(*loc==050)
 
8480
 
 
8481
{
 
8482
app(044);
 
8483
 
 
8484
#ifdef DBGM 
 
8485
app(065);
 
8486
#endif
 
8487
 
 
8488
reswitch:
 
8489
next_control= get_next();
 
8490
 
 
8491
the_switch:
 
8492
switch(next_control)
 
8493
{
 
8494
case 050:
 
8495
app(next_control);
 
8496
next_control= get_next();
 
8497
 
 
8498
if(next_control==051)
 
8499
{
 
8500
APP_STR("\\;");
 
8501
goto done_arg;
 
8502
}
 
8503
else
 
8504
goto the_switch;
 
8505
 
 
8506
case 054:
 
8507
app(next_control);goto reswitch;
 
8508
 
 
8509
case identifier:
 
8510
APP_ID;
 
8511
goto reswitch;
 
8512
 
 
8513
case ellipsis:
 
8514
APP_STR("\\dots");
 
8515
 
 
8516
if((next_control= get_next())!=051)
 
8517
{
 
8518
 
 
8519
err0_print(ERR_M,OC("Improper macro \
 
8520
definition: expected ')' after ellipsis"),0);
 
8521
break;
 
8522
}
 
8523
 
 
8524
case 051:
 
8525
done_arg:
 
8526
app(next_control);
 
8527
next_control= get_next();break;
 
8528
 
 
8529
default:
 
8530
 
 
8531
err0_print(ERR_M,OC("Improper macro definition: \
 
8532
unrecognized token in argument list"),0);
 
8533
break;
 
8534
}
 
8535
 
 
8536
#ifdef DBGM
 
8537
app(066);
 
8538
#endif
 
8539
 
 
8540
app(044);
 
8541
}
 
8542
 
 
8543
 
 
8544
else
 
8545
{
 
8546
next_control= get_next();
 
8547
}
 
8548
 
 
8549
app(break_space);
 
8550
app_scrap(ignore_scrap,no_math);
 
8551
 
 
8552
}
 
8553
}
 
8554
}
 
8555
else
 
8556
next_control= get_next();
 
8557
 
 
8558
if(saved_language==TEX)
 
8559
language= saved_language;
 
8560
}
 
8561
 
 
8562
 
 
8563
break;
 
8564
}
 
8565
 
 
8566
ok_to_define= NO;
 
8567
nuweb_mode= nuweb_mode0;
 
8568
 
 
8569
outr_parse();
 
8570
 
 
8571
if(auto_app_semi&&last_control==WEB_definition)
 
8572
{app_scrap(semi,maybe_math);}
 
8573
 
 
8574
overload_ops= overload_ops0;
 
8575
fin_C();
 
8576
ok_to_define= YES;
 
8577
}
 
8578
 
 
8579
 
 
8580
}
 
8581
 
 
8582
 
 
8583
 
 
8584
SRTN
 
8585
fin_C(VOID)
 
8586
{
 
8587
text_pointer p;
 
8588
boolean current_output_state= output_on;
 
8589
 
 
8590
if(!suppress_defn)
 
8591
{
 
8592
column_mode= NO;
 
8593
 
 
8594
app_tok(force);
 
8595
app_scrap(ignore_scrap,no_math);
 
8596
 
 
8597
 
 
8598
 
 
8599
 
 
8600
p= translate(OUTER);
 
8601
 
 
8602
app(tok_flag+PTR_DIFF(sixteen_bits,p,tok_start));
 
8603
make_output();
 
8604
 
 
8605
if(out_ptr>out_buf+1)
 
8606
 
 
8607
{
 
8608
if(*(out_ptr-1)==0134)
 
8609
{
 
8610
 
 
8611
 
 
8612
 
 
8613
if(*out_ptr==066)
 
8614
out_ptr-= 2;
 
8615
else if(*out_ptr==067)
 
8616
{
 
8617
out_ptr-= 2;
 
8618
OUT_STR("\\WY");
 
8619
 
 
8620
}
 
8621
}
 
8622
}
 
8623
 
 
8624
 
 
8625
 
 
8626
OUT_STR(the_part==CODE?"\\Wendc":"\\Wendd");
 
8627
 
 
8628
fin_line();
 
8629
 
 
8630
 
 
8631
if(text_ptr>mx_text_ptr)
 
8632
mx_text_ptr= text_ptr;
 
8633
if(tok_ptr>mx_tok_ptr)
 
8634
mx_tok_ptr= tok_ptr;
 
8635
if(scrp_ptr>mx_scr_ptr)
 
8636
mx_scr_ptr= scrp_ptr;
 
8637
}
 
8638
else
 
8639
suppress_defn= NO;
 
8640
 
 
8641
 
 
8642
tok_ptr= tok_mem+1;text_ptr= tok_start+1;scrp_ptr= scrp_info;
 
8643
 
 
8644
#if(0)
 
8645
if(strt_off)output_on= strt_off= ending_off= NO;
 
8646
if(ending_off)
 
8647
{
 
8648
strt_off= ending_off= NO;
 
8649
output_on= YES;
 
8650
}
 
8651
#endif
 
8652
 
 
8653
output_on= current_output_state;
 
8654
}
 
8655
 
 
8656
 
 
8657
 
 
8658
SRTN
 
8659
app_temp FCN((letter,arg))
 
8660
CONST outer_char letter[]C0("")
 
8661
CONST outer_char arg[]C1("")
 
8662
{
 
8663
char temp[50];
 
8664
 
 
8665
sprintf(temp,"\\W%s{%s}",(char*)letter,(char*)arg);
 
8666
APP_STR(temp);
 
8667
}
 
8668
 
 
8669
 
 
8670
 
 
8671
SRTN
 
8672
app_proc FCN((next_control))
 
8673
eight_bits next_control C1("")
 
8674
{
 
8675
if(the_part==DEFINITION)
 
8676
{
 
8677
 
 
8678
{
 
8679
APP_STR("\\WP");
 
8680
 
 
8681
}
 
8682
 
 
8683
 
 
8684
 
 
8685
if(yskipped)
 
8686
{
 
8687
 
 
8688
{
 
8689
app_hdr("defs");
 
8690
}
 
8691
 
 
8692
 
 
8693
yskipped= NO;
 
8694
}
 
8695
}
 
8696
 
 
8697
switch(next_control)
 
8698
{
 
8699
case WEB_definition:
 
8700
APP_STR(upper_case_code?"\\WMD":"\\WMd");break;
 
8701
 
 
8702
case undefinition:
 
8703
APP_LANG("Ud");break;
 
8704
 
 
8705
case definition:
 
8706
APP_LANG(upper_case_code?"D":"d");break;
 
8707
 
 
8708
case formatt:
 
8709
APP_LANG(upper_case_code?"F":"f");break;
 
8710
 
 
8711
case limbo_text:
 
8712
APP_LANG("l");break;
 
8713
 
 
8714
case op_def:
 
8715
APP_LANG("v");break;
 
8716
 
 
8717
case macro_def:
 
8718
APP_LANG(upper_case_code?"WW":"w");break;
 
8719
 
 
8720
case m_ifdef:
 
8721
APP_TEMP("E","ifdef");break;
 
8722
 
 
8723
case m_ifndef:
 
8724
APP_TEMP("E","ifndef");break;
 
8725
 
 
8726
case m_line:
 
8727
APP_TEMP("E","line");break;
 
8728
 
 
8729
case m_undef:
 
8730
APP_TEMP("E","undef");break;
 
8731
 
 
8732
case m_if:
 
8733
APP_TEMP("E","if");break;
 
8734
 
 
8735
case m_elif:
 
8736
APP_TEMP("E","elif");break;
 
8737
 
 
8738
case m_else:
 
8739
APP_TEMP("E","else");
 
8740
app_scrap(ignore_scrap,no_math);
 
8741
break;
 
8742
 
 
8743
case m_for:
 
8744
APP_TEMP("E","for");break;
 
8745
 
 
8746
case m_endfor:
 
8747
APP_TEMP("E","endfor");
 
8748
app_scrap(ignore_scrap,no_math);
 
8749
break;
 
8750
 
 
8751
case m_endif:
 
8752
APP_TEMP("E","endif");
 
8753
app_scrap(ignore_scrap,no_math);
 
8754
break;
 
8755
}
 
8756
 
 
8757
 
 
8758
 
 
8759
}
 
8760
 
 
8761
 
 
8762
SRTN
 
8763
improper FCN((m_type,msg))
 
8764
outer_char*m_type C0("")
 
8765
outer_char*msg C1("")
 
8766
{
 
8767
 
 
8768
err0_print(ERR_W,OC("Improper %s definition:  expected %s"),2,m_type,msg);
 
8769
}
 
8770
 
 
8771
 
 
8772
 
 
8773
SRTN
 
8774
app_lang FCN((suffix))
 
8775
CONST outer_char*suffix C1("")
 
8776
{
 
8777
APP_TEMP(suffix,(CONST outer_char*)(LANGUAGE_SYMBOL(language)));
 
8778
}
 
8779
 
 
8780
 
 
8781
 
 
8782
SRTN
 
8783
trns_code(VOID)
 
8784
{
 
8785
the_part= CODE;
 
8786
this_module= name_dir;
 
8787
parsing_mode= OUTER;
 
8788
 
 
8789
if(next_control<=module_name)
 
8790
{
 
8791
OUT_STR("\\WY");
 
8792
ini_stack;
 
8793
 
 
8794
{
 
8795
if(output_on)app(Turn_output_on);
 
8796
else
 
8797
{
 
8798
app(force);
 
8799
 
 
8800
app(turn_output_off);
 
8801
}
 
8802
 
 
8803
app_scrap(ignore_scrap,no_math);
 
8804
}
 
8805
 
 
8806
 
 
8807
 
 
8808
{
 
8809
APP_STR("\\WP");
 
8810
 
 
8811
}
 
8812
 
 
8813
 
 
8814
 
 
8815
if(next_control==begin_code)
 
8816
{
 
8817
boolean nuweb_mode0= nuweb_mode;
 
8818
 
 
8819
unnamed_section= YES;
 
8820
params= global_params;
 
8821
nuweb_mode= nuweb_mode0;
 
8822
frz_params();
 
8823
the_module= NULL;
 
8824
 
 
8825
{
 
8826
if(!nuweb_mode&&((FORTRAN_LIKE(language)&&!free_form_input)
 
8827
||(language==TEX)))
 
8828
{
 
8829
 
 
8830
{
 
8831
loc= limit+1;
 
8832
chk_end= NO;
 
8833
column_mode= YES;
 
8834
}
 
8835
 
 
8836
 
 
8837
next_control= ignore;
 
8838
}
 
8839
else
 
8840
{
 
8841
 
 
8842
 
 
8843
if(Fortran88&&(auto_semi&&!free_Fortran))
 
8844
{
 
8845
loc= limit+1;
 
8846
chk_end= NO;
 
8847
}
 
8848
 
 
8849
 
 
8850
 
 
8851
next_control= (nuweb_mode?begin_meta:get_next());
 
8852
}
 
8853
}
 
8854
 
 
8855
 
 
8856
 
 
8857
 
 
8858
{
 
8859
app_hdr("code");
 
8860
}
 
8861
 
 
8862
 
 
8863
}
 
8864
else
 
8865
{
 
8866
unnamed_section= NO;
 
8867
 
 
8868
if(cur_module!=NULL)
 
8869
{
 
8870
params= cur_module->mod_info->params;
 
8871
 
 
8872
frz_params();
 
8873
this_module= cur_module;
 
8874
}
 
8875
the_module= cur_module;
 
8876
 
 
8877
{
 
8878
LANGUAGE saved_language= language;
 
8879
 
 
8880
if(language==TEX)
 
8881
language= C;
 
8882
 
 
8883
 
 
8884
do
 
8885
next_control= get_next();
 
8886
while(next_control==053);
 
8887
 
 
8888
language= saved_language;
 
8889
 
 
8890
switch(next_control)
 
8891
{
 
8892
case compound_assignment:
 
8893
if(assignment_token!=plus_eq)
 
8894
{
 
8895
 
 
8896
err0_print(ERR_W,OC("Invalid compound assignment after section \
 
8897
name; please use one of `=', `==', or `+='"),0);
 
8898
 
 
8899
break;
 
8900
}
 
8901
 
 
8902
 
 
8903
 
 
8904
case 075:
 
8905
case eq_eq:
 
8906
 
 
8907
{
 
8908
if(!nuweb_mode&&((FORTRAN_LIKE(language)&&!free_form_input)
 
8909
||(language==TEX)))
 
8910
{
 
8911
 
 
8912
{
 
8913
loc= limit+1;
 
8914
chk_end= NO;
 
8915
column_mode= YES;
 
8916
}
 
8917
 
 
8918
 
 
8919
next_control= ignore;
 
8920
}
 
8921
else
 
8922
{
 
8923
 
 
8924
 
 
8925
if(Fortran88&&(auto_semi&&!free_Fortran))
 
8926
{
 
8927
loc= limit+1;
 
8928
chk_end= NO;
 
8929
}
 
8930
 
 
8931
 
 
8932
 
 
8933
next_control= (nuweb_mode?begin_meta:get_next());
 
8934
}
 
8935
}
 
8936
 
 
8937
 
 
8938
break;
 
8939
 
 
8940
default:
 
8941
 
 
8942
err0_print(ERR_W,OC("You need an = sign after the section name"),0);
 
8943
 
 
8944
break;
 
8945
}
 
8946
 
 
8947
#if(0)
 
8948
if(out_ptr>out_buf+2&&STRNCMP(out_ptr-2,"\\WY",3)==0)
 
8949
#endif
 
8950
{
 
8951
app(backup);
 
8952
app(backup);
 
8953
}
 
8954
 
 
8955
 
 
8956
app(mod_flag+PTR_DIFF(sixteen_bits,this_module,name_dir));
 
8957
cur_xref= (xref_pointer)this_module->xref;
 
8958
APP_STR("${}");
 
8959
 
 
8960
if(cur_xref->num!=module_count+def_flag)
 
8961
{
 
8962
APP_STR("\\WPQ");
 
8963
 
 
8964
this_module= name_dir;
 
8965
}
 
8966
else
 
8967
APP_STR("\\WSQ");
 
8968
 
 
8969
 
 
8970
APP_STR("{}$");
 
8971
app_misc(w_style.misc.named_preamble);
 
8972
app(force);
 
8973
app_scrap(ignore_scrap,no_math);
 
8974
}
 
8975
 
 
8976
;
 
8977
}
 
8978
 
 
8979
 
 
8980
while(next_control<=module_name)
 
8981
{
 
8982
outr_parse();
 
8983
 
 
8984
 
 
8985
if(next_control<module_name)
 
8986
{
 
8987
switch(next_control)
 
8988
{
 
8989
case m_if:case m_ifdef:case m_ifndef:
 
8990
case m_undef:case m_else:
 
8991
case m_elif:case m_endif:
 
8992
case m_for:case m_endfor:
 
8993
case m_line:
 
8994
case WEB_definition:
 
8995
pre_scrap(next_control);
 
8996
break;
 
8997
 
 
8998
default:
 
8999
CANT_DO(code);
 
9000
 
 
9001
break;
 
9002
}
 
9003
next_control= get_next();
 
9004
}
 
9005
else if(next_control==module_name)
 
9006
{
 
9007
 
 
9008
{
 
9009
if(cur_module)
 
9010
{
 
9011
app(mod_flag+PTR_DIFF(sixteen_bits,cur_module,name_dir));
 
9012
}
 
9013
 
 
9014
app_scrap(cur_module!=NULL?cur_module->mod_ilk:expr,maybe_math);
 
9015
}
 
9016
 
 
9017
 
 
9018
next_control= (nuweb_mode?begin_meta:get_next());
 
9019
}
 
9020
 
 
9021
;
 
9022
}
 
9023
 
 
9024
 
 
9025
{
 
9026
boolean nuweb_mode0= nuweb_mode;
 
9027
 
 
9028
params= (the_module==NULL?global_params:the_module->mod_info->params);
 
9029
nuweb_mode= nuweb_mode0;
 
9030
frz_params();
 
9031
}
 
9032
 
 
9033
 
 
9034
fin_C();
 
9035
unnamed_section= NO;
 
9036
}
 
9037
}
 
9038
 
 
9039
 
 
9040
 
 
9041
SRTN
 
9042
app_hdr FCN((section_part))
 
9043
CONST char*section_part C1("Either \"code\" or \"defs\"")
 
9044
{
 
9045
outer_char temp[1000],*temp_end= temp+1000,*t_first,*t_loc;
 
9046
 
 
9047
t_first= temp;
 
9048
STRCPY(t_first,params.OUT_FILE_NAME);
 
9049
to_ASCII(t_first);
 
9050
t_first= esc_buf((ASCII HUGE*)t_first+STRLEN(t_first)+1,
 
9051
(ASCII HUGE*)temp_end,(CONST ASCII HUGE*)t_first,YES);
 
9052
to_outer((ASCII HUGE*)t_first);
 
9053
t_loc= t_first+STRLEN(t_first)+1;
 
9054
sprintf((char*)t_loc," \\Wunnamed{%s}{%s}%%\n",
 
9055
section_part,(char*)t_first);
 
9056
APP_STR(t_loc);
 
9057
app_scrap(ignore_scrap,no_math);
 
9058
}
 
9059
 
 
9060
 
 
9061
 
 
9062
SRTN
 
9063
app_misc FCN((s))
 
9064
outer_char*s C1("")
 
9065
{
 
9066
outer_char*s0;
 
9067
 
 
9068
for(s0= s;*s;)
 
9069
if(*s++=='\\')
 
9070
{
 
9071
if(isdigit(*s)&&*s!='0'&&*s!='8'&&*s!='9')
 
9072
{
 
9073
*(s-1)= '\0';
 
9074
APP_STR(s0);
 
9075
 
 
9076
switch(*s)
 
9077
{
 
9078
case '1':app(indent);break;
 
9079
case '2':app(outdent);break;
 
9080
case '3':app(opt);break;
 
9081
case '4':app(backup);break;
 
9082
case '5':app(break_space);break;
 
9083
case '6':app(force);break;
 
9084
case '7':app(big_force);break;
 
9085
}
 
9086
*(s-1)= '\\';
 
9087
s0= ++s;
 
9088
}
 
9089
}
 
9090
 
 
9091
APP_STR(s0);
 
9092
}
 
9093
 
 
9094
 
 
9095
 
 
9096
SRTN
 
9097
pre_scrap FCN((last_control))
 
9098
eight_bits last_control C1("")
 
9099
{
 
9100
scrap_pointer save_base;
 
9101
text_pointer p,q;
 
9102
LANGUAGE saved_language= language;
 
9103
 
 
9104
app(force);
 
9105
app_proc(last_control);
 
9106
 
 
9107
switch(last_control)
 
9108
{
 
9109
case WEB_definition:
 
9110
 
 
9111
{
 
9112
if((next_control= get_next())!=identifier)
 
9113
 
 
9114
err0_print(ERR_M,OC("Improper deferred macro definition: \
 
9115
expected identifier"),0);
 
9116
 
 
9117
else
 
9118
{
 
9119
app(044);APP_ID;
 
9120
 
 
9121
if(*loc==050)
 
9122
{
 
9123
reswitch:switch(next_control= get_next())
 
9124
{
 
9125
case 050:case 054:
 
9126
app(next_control);goto reswitch;
 
9127
case identifier:
 
9128
APP_ID;
 
9129
goto reswitch;
 
9130
case ellipsis:
 
9131
APP_STR("\\dots");
 
9132
if((next_control= get_next())!=051)
 
9133
{
 
9134
 
 
9135
err0_print(ERR_M,OC("Improper deferred macro \
 
9136
definition: expected ')' after ellipsis"),0);
 
9137
break;
 
9138
}
 
9139
case 051:app(next_control);app(040);
 
9140
break;
 
9141
default:
 
9142
err0_print(ERR_M,OC("Improper deferred macro definition: \
 
9143
unrecognized token within argument list"),0);break;
 
9144
}
 
9145
}
 
9146
 
 
9147
app(044);app(break_space);
 
9148
app_scrap(ignore_scrap,no_math);
 
9149
 
 
9150
}
 
9151
}
 
9152
 
 
9153
;
 
9154
break;
 
9155
}
 
9156
 
 
9157
p= text_ptr;freeze_text;
 
9158
 
 
9159
save_base= scrp_base;
 
9160
scrp_base= scrp_ptr+1;
 
9161
 
 
9162
*limit= 0100;*(limit+1)= 0155;
 
9163
next_control= ignore;
 
9164
 
 
9165
if(language==TEX)language= C;
 
9166
outr_parse();
 
9167
language= saved_language;
 
9168
 
 
9169
if(last_control==WEB_definition){app_scrap(semi,maybe_math);}
 
9170
 
 
9171
q= translate(OUTER);
 
9172
scrp_ptr= scrp_base-1;
 
9173
scrp_base= save_base;
 
9174
 
 
9175
app(tok_flag+PTR_DIFF(sixteen_bits,p,tok_start));
 
9176
app(tok_flag+PTR_DIFF(sixteen_bits,q,tok_start));
 
9177
APP_STR("\\WPs");app(force);
 
9178
app_scrap(ignore_scrap,no_math);
 
9179
}
 
9180
 
 
9181
 
 
9182
#endif 
 
9183
 
 
9184
#if(part == 0 || part == 3)
 
9185
 
 
9186
 
 
9187
SRTN
 
9188
init_op FCN((op_code,op_name,lang,op_macro,overload,cat,defn))
 
9189
eight_bits op_code C0("The operator")
 
9190
CONST outer_char op_name[]C0("Fortran-like name of the operator")
 
9191
int lang C0("Union of all allowable languages for this def")
 
9192
CONST outer_char op_macro[]C0("Default macro expansion")
 
9193
boolean overload C0("Do we overload?")
 
9194
eight_bits cat C0("Category code")
 
9195
CONST outer_char defn[]C1("Replacement text for overloaded macro")
 
9196
{
 
9197
OPERATOR HUGE*p;
 
9198
int k,l;
 
9199
 
 
9200
 
 
9201
if(op_code==identifier)p= op_ptr++;
 
9202
else if(!(p= valid_op(op_code)))
 
9203
{
 
9204
 
 
9205
err0_print(ERR_W,OC("Invalid op code %d"),1,op_code);
 
9206
return;
 
9207
}
 
9208
 
 
9209
p->op_name= GET_MEM("op name",STRLEN(op_name)+1,ASCII);
 
9210
STRCPY(p->op_name,op_name);
 
9211
to_ASCII((outer_char*)p->op_name);
 
9212
 
 
9213
 
 
9214
for(k= 0,l= 1;k<NUM_LANGUAGES;k++,l<<= 1)
 
9215
if(lang&l)
 
9216
{
 
9217
OP_INFO HUGE*q= p->info+k;
 
9218
 
 
9219
q->op_macro= op_macro;
 
9220
overloaded[k]|= (q->overloaded= overload);
 
9221
q->cat= cat;
 
9222
if(defn)q->defn= (outer_char HUGE*)defn;
 
9223
}
 
9224
}
 
9225
 
 
9226
 
 
9227
 
 
9228
SRTN
 
9229
room_for FCN((ntokens,ntexts,nscraps))
 
9230
int ntokens C0("")
 
9231
int ntexts C0("")
 
9232
int nscraps C1("")
 
9233
{
 
9234
if(tok_ptr+ntokens>tok_m_end)
 
9235
{
 
9236
if(tok_ptr>mx_tok_ptr)mx_tok_ptr= tok_ptr;
 
9237
OVERFLW("tokens","tw");
 
9238
}
 
9239
 
 
9240
if(text_ptr+ntexts>tok_end)
 
9241
{
 
9242
if(text_ptr>mx_text_ptr)mx_text_ptr= text_ptr;
 
9243
OVERFLW("texts","x");
 
9244
}
 
9245
 
 
9246
if(scrp_ptr+nscraps>scrp_end)
 
9247
{
 
9248
if(scrp_ptr>mx_scr_ptr)mx_scr_ptr= scrp_ptr;
 
9249
OVERFLW("scraps","s");
 
9250
}
 
9251
}
 
9252
 
 
9253
 
 
9254
 
 
9255
OPERATOR HUGE*
 
9256
valid_op FCN((op_code))
 
9257
eight_bits op_code C1("")
 
9258
{
 
9259
int n= 0;
 
9260
OPERATOR HUGE*p;
 
9261
 
 
9262
switch(op_code)
 
9263
{
 
9264
case 057:
 
9265
case 053:
 
9266
case 074:
 
9267
case 076:
 
9268
case 075:
 
9269
case 045:
 
9270
case 041:
 
9271
case 0176:
 
9272
case 055:
 
9273
case 052:
 
9274
case 046:
 
9275
case 0174:
 
9276
case 077:
 
9277
case 0136:
 
9278
case ellipsis:
 
9279
case not_eq:
 
9280
case lt_eq:
 
9281
case gt_eq:
 
9282
case eq_eq:
 
9283
case and_and:
 
9284
case or_or:
 
9285
case plus_plus:
 
9286
case minus_minus:
 
9287
case minus_gt:
 
9288
case gt_gt:
 
9289
case lt_lt:
 
9290
case star_star:
 
9291
case slash_slash:
 
9292
p= op+op_code;
 
9293
if(p>=op+128)
 
9294
confusion(OC("valid_op"),OC("Operator 0x%x is out of range"),op_code);
 
9295
return p;
 
9296
 
 
9297
case compound_assignment:
 
9298
if(assignment_token==or_or_or)
 
9299
return op+0174;
 
9300
 
 
9301
p= op+CA_START+assignment_token;
 
9302
if(p>=op+128)
 
9303
confusion(OC("valid_op"),OC("Compound assignment operator 0x%x is out of range"),op+assignment_token);
 
9304
return p;
 
9305
 
 
9306
case dot_const:
 
9307
if(!FORTRAN_LIKE(language))return NULL;
 
9308
id_first= dot_op.name+1;
 
9309
id_loc= id_first+STRLEN(id_first);
 
9310
 
 
9311
case identifier:
 
9312
if(!FORTRAN_LIKE(language))return NULL;
 
9313
 
 
9314
 
 
9315
{
 
9316
ASCII id[255];
 
9317
 
 
9318
STRNCPY(id,id_first,n= PTR_DIFF(int,id_loc,id_first));
 
9319
id[n]= '\0';
 
9320
 
 
9321
for(p= op+128;p<op_ptr;p++)
 
9322
if(STRCMP(p->op_name,id)==0)return p;
 
9323
 
 
9324
if(op_ptr>=op_end)OVERFLW("op table","op");
 
9325
 
 
9326
p->op_name= GET_MEM("op name",n+1,ASCII);
 
9327
STRCPY(p->op_name,id);
 
9328
op_ptr++;
 
9329
return p;
 
9330
}
 
9331
 
 
9332
 
 
9333
}
 
9334
 
 
9335
return NULL;
 
9336
}
 
9337
 
 
9338
 
 
9339
 
 
9340
SRTN
 
9341
app_overload(VOID)
 
9342
{
 
9343
int ln= language_num;
 
9344
OPERATOR HUGE*p= valid_op(next_control);
 
9345
OP_INFO HUGE*q= p->info+ln;
 
9346
char temp[10];
 
9347
 
 
9348
if(overload_ops&&q->overloaded)
 
9349
{
 
9350
switch(q->cat)
 
9351
{
 
9352
case unorbinop:
 
9353
case binop:
 
9354
APP_STR("\\Wb{");break;
 
9355
 
 
9356
case unop:
 
9357
APP_STR("\\Wu{");break;
 
9358
 
 
9359
default:
 
9360
APP_STR(" \\Wop{");break;
 
9361
}
 
9362
 
 
9363
app_ASCII_str(p->op_name);
 
9364
sprintf(temp,"}{%s}",lang_codes[ln]);
 
9365
APP_STR(temp);
 
9366
}
 
9367
else if(q->op_macro)
 
9368
APP_STR(q->op_macro);
 
9369
else
 
9370
{
 
9371
 
 
9372
err0_print(ERR_W,OC("Unidentifiable operator or dot constant in language \
 
9373
%s.  Missing @v?"),1,languages[ln]);
 
9374
APP_STR("\\Wunknown{");
 
9375
app(wt_style.dot_delimiter.begin);
 
9376
app_ASCII_str(p->op_name);
 
9377
app(wt_style.dot_delimiter.end);
 
9378
app(0175);
 
9379
app_scrap(binop,yes_math);
 
9380
return;
 
9381
}
 
9382
 
 
9383
app_scrap(q->cat,yes_math);
 
9384
}
 
9385
 
 
9386
 
 
9387
 
 
9388
SRTN
 
9389
make_output(VOID)
 
9390
{
 
9391
eight_bits a;
 
9392
eight_bits b;
 
9393
int c;
 
9394
boolean copying= NO;
 
9395
 
 
9396
app(end_translation);
 
9397
freeze_text;push_level(text_ptr-1);
 
9398
 
 
9399
WHILE()
 
9400
{
 
9401
a= get_output();
 
9402
 
 
9403
reswitch:switch(a)
 
9404
{
 
9405
case ignore:continue;
 
9406
 
 
9407
case verbatim:
 
9408
while((a= get_output())!=verbatim)
 
9409
out(a);
 
9410
continue;
 
9411
 
 
9412
case begin_language:
 
9413
language= lan_enum(get_output());
 
9414
 
 
9415
continue;
 
9416
 
 
9417
 
 
9418
 
 
9419
case protect_code:
 
9420
output_protect= BOOLEAN(!output_protect);break;
 
9421
 
 
9422
case copy_mode:
 
9423
copying= BOOLEAN(!copying);break;
 
9424
 
 
9425
case turn_output_off:
 
9426
output_on= NO;
 
9427
break;
 
9428
 
 
9429
case turn_output_on:
 
9430
output_on= YES;
 
9431
break;
 
9432
 
 
9433
case Turn_output_off:
 
9434
skip_file();
 
9435
strt_off= YES;
 
9436
output_on= NO;
 
9437
break;
 
9438
 
 
9439
case Turn_output_on:
 
9440
strt_off= NO;
 
9441
output_on= YES;
 
9442
break;
 
9443
 
 
9444
 
 
9445
 
 
9446
 
 
9447
case out_force:
 
9448
continue;
 
9449
 
 
9450
case end_translation:
 
9451
return;
 
9452
 
 
9453
case identifier:case res_word:
 
9454
if(output_on)
 
9455
 
 
9456
{
 
9457
if(nuweb_mode)
 
9458
{
 
9459
ASCII HUGE*k;
 
9460
 
 
9461
for(k= cur_name->byte_start;k<(cur_name+1)->byte_start;k++)
 
9462
{
 
9463
out(*k);
 
9464
}
 
9465
}
 
9466
else
 
9467
 
 
9468
{
 
9469
boolean all_uc= cur_name->info.upper_case;
 
9470
 
 
9471
if(output_protect)
 
9472
OUT_STR("\\protect");
 
9473
 
 
9474
if(a==identifier)
 
9475
{
 
9476
if(is_intrinsic(cur_name))
 
9477
OUT_STR(pfrmt->intrinsic);
 
9478
 
 
9479
 
 
9480
else if(is_keyword(cur_name))
 
9481
OUT_STR(ALL_UC?pfrmt->KEYWORD:pfrmt->keyword);
 
9482
 
 
9483
 
 
9484
else if(length(cur_name)==1)
 
9485
OUT_STR(pfrmt->short_id);
 
9486
 
 
9487
 
 
9488
else
 
9489
 
 
9490
switch(DEFINED_TYPE(cur_name))
 
9491
{
 
9492
case D_MACRO:
 
9493
OUT_STR(ALL_UC?pfrmt->ID_OUTER:pfrmt->id_outer);
 
9494
 
 
9495
break;
 
9496
 
 
9497
case M_MACRO:
 
9498
OUT_STR(ALL_UC?pfrmt->ID_INNER:pfrmt->id_inner);
 
9499
break;
 
9500
 
 
9501
default:
 
9502
OUT_STR(ALL_UC?pfrmt->ID:pfrmt->id);
 
9503
 
 
9504
break;
 
9505
 
 
9506
}
 
9507
 
 
9508
 
 
9509
}
 
9510
else
 
9511
OUT_STR(ALL_UC?pfrmt->RESERVED:pfrmt->reserved);
 
9512
 
 
9513
 
 
9514
 
 
9515
out_name(NULL,YES,IDENTIFIER,cur_name);
 
9516
}
 
9517
 
 
9518
 
 
9519
}
 
9520
 
 
9521
 
 
9522
 
 
9523
break;
 
9524
 
 
9525
case mod_name:
 
9526
if(output_on)
 
9527
 
 
9528
#if FCN_CALLS
 
9529
out_md_name();
 
9530
#else
 
9531
 
 
9532
{
 
9533
name_pointer cur_mod_name;
 
9534
 
 
9535
OUT_STR("\\WX{");
 
9536
 
 
9537
cur_xref= (xref_pointer)cur_name->xref;
 
9538
 
 
9539
 
 
9540
if(cur_xref->num>=def_flag)
 
9541
{
 
9542
out_mod(cur_xref->num-def_flag,ENCAP);
 
9543
 
 
9544
if(phase==3)
 
9545
{
 
9546
cur_xref= cur_xref->xlink;
 
9547
 
 
9548
while(cur_xref->num>=def_flag)
 
9549
{
 
9550
OUT_STR(", ");
 
9551
out_mod(cur_xref->num-def_flag,ENCAP);
 
9552
cur_xref= cur_xref->xlink;
 
9553
}
 
9554
}
 
9555
}
 
9556
else out(060);
 
9557
 
 
9558
out(0175);
 
9559
 
 
9560
{
 
9561
ASCII HUGE*k,HUGE*k_limit;
 
9562
ASCII HUGE*j;
 
9563
ASCII HUGE*save_loc,HUGE*save_limit;
 
9564
eight_bits b;
 
9565
 
 
9566
k= cur_name->byte_start;k_limit= (cur_name+1)->byte_start;
 
9567
cur_mod_name= cur_name;
 
9568
 
 
9569
while(k<k_limit)
 
9570
{
 
9571
b= *(k++);
 
9572
 
 
9573
if(b==0100)
 
9574
 
 
9575
if(*k++!=0100)
 
9576
{
 
9577
SET_COLOR(error);
 
9578
printf("\n! Illegal control code in section name: <");
 
9579
 
 
9580
prn_id(cur_mod_name);printf("> ");
 
9581
mark_error;
 
9582
}
 
9583
 
 
9584
;
 
9585
 
 
9586
if(b!=0174)out(b)
 
9587
else
 
9588
{
 
9589
 
 
9590
{
 
9591
ASCII delim;
 
9592
 
 
9593
j= limit+1;*j= 0174;delim= 0;
 
9594
 
 
9595
WHILE()
 
9596
{
 
9597
if(k>=k_limit)
 
9598
{
 
9599
SET_COLOR(error);
 
9600
printf("\n! C text in section name didn't end: <");
 
9601
 
 
9602
prn_id(cur_mod_name);printf("> ");
 
9603
mark_error;
 
9604
break;
 
9605
}
 
9606
 
 
9607
b= *(k++);
 
9608
 
 
9609
if(b==0100)
 
9610
 
 
9611
{
 
9612
if(j>cur_buffer+buf_size-3)OVERFLW("buffer","");
 
9613
 
 
9614
*(++j)= 0100;*(++j)= *(k++);
 
9615
}
 
9616
 
 
9617
 
 
9618
else
 
9619
{
 
9620
if(b==047||b==042)
 
9621
if(delim==0)delim= b;
 
9622
else if((eight_bits)delim==b)delim= 0;
 
9623
 
 
9624
if(b!=0174||delim!=0)
 
9625
{
 
9626
if(j>cur_buffer+buf_size-2)OVERFLW("buffer","");
 
9627
 
 
9628
*(++j)= b;
 
9629
}
 
9630
else break;
 
9631
}
 
9632
}
 
9633
}
 
9634
 
 
9635
;
 
9636
save_loc= loc;save_limit= limit;loc= limit+2;limit= j+1;
 
9637
*limit= 0174;output_C();
 
9638
loc= save_loc;limit= save_limit;
 
9639
}
 
9640
}
 
9641
}
 
9642
 
 
9643
;
 
9644
OUT_STR("\\X ");
 
9645
 
 
9646
OUT_STR(cur_xref->num>=def_flag?
 
9647
LANGUAGE_SYMBOL((LANGUAGE)cur_mod_name->mod_info->language):
 
9648
(CONST outer_char*)"");
 
9649
OUT_STR("\\X");
 
9650
}
 
9651
 
 
9652
 
 
9653
#endif
 
9654
 
 
9655
break;
 
9656
 
 
9657
case math_bin:case math_rel:
 
9658
 
 
9659
 
 
9660
OUT_STR(a==math_bin?"\\mathbin{":"\\mathrel{");
 
9661
 
 
9662
 
 
9663
 
 
9664
;break;
 
9665
 
 
9666
case toggle_meta:
 
9667
scanning_meta= BOOLEAN(!scanning_meta);
 
9668
break;
 
9669
 
 
9670
case cancel:
 
9671
c= 0;while((a= get_output())>=indent&&a<=big_force)
 
9672
{
 
9673
if(a==indent)c++;if(a==outdent)c--;
 
9674
}
 
9675
 
 
9676
 
 
9677
for(;c>0;c--)OUT_STR("\\1");
 
9678
 
 
9679
for(;c<0;c++)OUT_STR("\\2");
 
9680
 
 
9681
;
 
9682
goto reswitch;
 
9683
 
 
9684
case big_cancel:
 
9685
c= 0;
 
9686
while(((a= get_output())>=indent||a==040)&&a<=big_force)
 
9687
{
 
9688
if(a==indent)c++;if(a==outdent)c--;
 
9689
}
 
9690
 
 
9691
 
 
9692
for(;c>0;c--)OUT_STR("\\1");
 
9693
 
 
9694
for(;c<0;c++)OUT_STR("\\2");
 
9695
 
 
9696
;
 
9697
goto reswitch;
 
9698
 
 
9699
case indent:case outdent:case opt:case backup:case break_space:
 
9700
case force:case big_force:
 
9701
 
 
9702
 
 
9703
if(a<break_space)
 
9704
{
 
9705
if(cur_mode==outer)
 
9706
{
 
9707
if(output_on)
 
9708
{
 
9709
out(0134);out(a-cancel+060);
 
9710
 
 
9711
}
 
9712
if(a==opt)
 
9713
{
 
9714
if(output_on)
 
9715
{
 
9716
out(get_output());
 
9717
}
 
9718
else
 
9719
get_output();
 
9720
}
 
9721
}
 
9722
else if(a==opt)
 
9723
b= get_output();
 
9724
}
 
9725
else
 
9726
 
 
9727
{
 
9728
boolean save_mode;
 
9729
 
 
9730
b= a;save_mode= cur_mode;c= 0;
 
9731
 
 
9732
WHILE()
 
9733
{
 
9734
a= get_output();
 
9735
 
 
9736
if(a==cancel||a==big_cancel)
 
9737
{
 
9738
 
 
9739
 
 
9740
for(;c>0;c--)OUT_STR("\\1");
 
9741
 
 
9742
for(;c<0;c++)OUT_STR("\\2");
 
9743
 
 
9744
;
 
9745
goto reswitch;
 
9746
}
 
9747
 
 
9748
if((a!=040&&a<indent)||a==backup||a>big_force)
 
9749
 
 
9750
{
 
9751
if(save_mode==outer)
 
9752
{
 
9753
if(out_ptr>out_buf+5&&STRNCMP(out_ptr-5,"\\WY\\WP",6)==0)
 
9754
goto reswitch;
 
9755
 
 
9756
 
 
9757
 
 
9758
for(;c>0;c--)OUT_STR("\\1");
 
9759
 
 
9760
for(;c<0;c++)OUT_STR("\\2");
 
9761
 
 
9762
;
 
9763
 
 
9764
if(output_on)
 
9765
if(strt_off)
 
9766
{
 
9767
if(STRNCMP(out_ptr-2,"\\WP",3)==0)
 
9768
{
 
9769
out_ptr= out_buf;
 
9770
goto reswitch;
 
9771
}
 
9772
}
 
9773
else
 
9774
{
 
9775
out(0134);out(b-cancel+060);
 
9776
}
 
9777
if(a!=end_translation)
 
9778
fin_line();
 
9779
}
 
9780
else if(a!=end_translation&&cur_mode==inner)
 
9781
if(output_on)
 
9782
out(040);
 
9783
 
 
9784
 
 
9785
goto reswitch;
 
9786
}
 
9787
 
 
9788
 
 
9789
 
 
9790
if(a==indent)
 
9791
c++;
 
9792
else if(a==outdent)
 
9793
c--;
 
9794
else
 
9795
{
 
9796
if(a>b)
 
9797
b= a;
 
9798
else if(a==opt)
 
9799
get_output();
 
9800
}
 
9801
}
 
9802
}
 
9803
 
 
9804
;
 
9805
 
 
9806
 
 
9807
;break;
 
9808
 
 
9809
case interior_semi:
 
9810
if(output_on)out(';');
 
9811
break;
 
9812
 
 
9813
case 052:
 
9814
if(!(copying||nuweb_mode))
 
9815
{
 
9816
OUT_STR("\\ast ");
 
9817
 
 
9818
break;
 
9819
}
 
9820
 
 
9821
 
 
9822
default:
 
9823
if(output_on)
 
9824
{
 
9825
out(a);
 
9826
 
 
9827
if(scanning_meta&&a=='\n')
 
9828
flush_buffer(out_ptr,NO);
 
9829
}
 
9830
}
 
9831
}
 
9832
}
 
9833
 
 
9834
 
 
9835
SRTN
 
9836
skip_file(VOID)
 
9837
{
 
9838
#define TEMP_LEN (MAX_FILE_NAME_LENGTH + 11)
 
9839
 
 
9840
outer_char temp[TEMP_LEN],temp1[TEMP_LEN];
 
9841
 
 
9842
esc_file_name(temp1,TEMP_LEN,prms[1].web.File_name);
 
9843
 
 
9844
if(
 
9845
nsprintf(temp,OC("\\Wskipped{%s}"),1,temp1)>=(int)(TEMP_LEN))OVERFLW("temp","");
 
9846
OUT_STR(temp);
 
9847
fin_line();
 
9848
 
 
9849
#undef TEMP_LEN
 
9850
}
 
9851
 
 
9852
 
 
9853
SRTN
 
9854
out_skip(VOID)
 
9855
{
 
9856
 
 
9857
{
 
9858
static int outer_include_depth;
 
9859
 
 
9860
if(output_on)
 
9861
{
 
9862
if(phase==2)
 
9863
{
 
9864
flush_buffer(out_ptr,NO);
 
9865
}
 
9866
outer_include_depth= incl_depth;
 
9867
output_on= NO;
 
9868
}
 
9869
else if(incl_depth<=outer_include_depth)
 
9870
{
 
9871
output_on= YES;
 
9872
}
 
9873
}
 
9874
 
 
9875
;
 
9876
 
 
9877
if(!output_on)
 
9878
{
 
9879
output_on= YES;
 
9880
OUT_STR("\\WY\\WP");
 
9881
skip_file();
 
9882
output_on= NO;
 
9883
}
 
9884
}
 
9885
 
 
9886
 
 
9887
 
 
9888
#if FCN_CALLS
 
9889
 
 
9890
SRTN
 
9891
out_md_name(VOID)
 
9892
{
 
9893
 
 
9894
{
 
9895
name_pointer cur_mod_name;
 
9896
 
 
9897
OUT_STR("\\WX{");
 
9898
 
 
9899
cur_xref= (xref_pointer)cur_name->xref;
 
9900
 
 
9901
 
 
9902
if(cur_xref->num>=def_flag)
 
9903
{
 
9904
out_mod(cur_xref->num-def_flag,ENCAP);
 
9905
 
 
9906
if(phase==3)
 
9907
{
 
9908
cur_xref= cur_xref->xlink;
 
9909
 
 
9910
while(cur_xref->num>=def_flag)
 
9911
{
 
9912
OUT_STR(", ");
 
9913
out_mod(cur_xref->num-def_flag,ENCAP);
 
9914
cur_xref= cur_xref->xlink;
 
9915
}
 
9916
}
 
9917
}
 
9918
else out(060);
 
9919
 
 
9920
out(0175);
 
9921
 
 
9922
{
 
9923
ASCII HUGE*k,HUGE*k_limit;
 
9924
ASCII HUGE*j;
 
9925
ASCII HUGE*save_loc,HUGE*save_limit;
 
9926
eight_bits b;
 
9927
 
 
9928
k= cur_name->byte_start;k_limit= (cur_name+1)->byte_start;
 
9929
cur_mod_name= cur_name;
 
9930
 
 
9931
while(k<k_limit)
 
9932
{
 
9933
b= *(k++);
 
9934
 
 
9935
if(b==0100)
 
9936
 
 
9937
if(*k++!=0100)
 
9938
{
 
9939
SET_COLOR(error);
 
9940
printf("\n! Illegal control code in section name: <");
 
9941
 
 
9942
prn_id(cur_mod_name);printf("> ");
 
9943
mark_error;
 
9944
}
 
9945
 
 
9946
;
 
9947
 
 
9948
if(b!=0174)out(b)
 
9949
else
 
9950
{
 
9951
 
 
9952
{
 
9953
ASCII delim;
 
9954
 
 
9955
j= limit+1;*j= 0174;delim= 0;
 
9956
 
 
9957
WHILE()
 
9958
{
 
9959
if(k>=k_limit)
 
9960
{
 
9961
SET_COLOR(error);
 
9962
printf("\n! C text in section name didn't end: <");
 
9963
 
 
9964
prn_id(cur_mod_name);printf("> ");
 
9965
mark_error;
 
9966
break;
 
9967
}
 
9968
 
 
9969
b= *(k++);
 
9970
 
 
9971
if(b==0100)
 
9972
 
 
9973
{
 
9974
if(j>cur_buffer+buf_size-3)OVERFLW("buffer","");
 
9975
 
 
9976
*(++j)= 0100;*(++j)= *(k++);
 
9977
}
 
9978
 
 
9979
 
 
9980
else
 
9981
{
 
9982
if(b==047||b==042)
 
9983
if(delim==0)delim= b;
 
9984
else if((eight_bits)delim==b)delim= 0;
 
9985
 
 
9986
if(b!=0174||delim!=0)
 
9987
{
 
9988
if(j>cur_buffer+buf_size-2)OVERFLW("buffer","");
 
9989
 
 
9990
*(++j)= b;
 
9991
}
 
9992
else break;
 
9993
}
 
9994
}
 
9995
}
 
9996
 
 
9997
;
 
9998
save_loc= loc;save_limit= limit;loc= limit+2;limit= j+1;
 
9999
*limit= 0174;output_C();
 
10000
loc= save_loc;limit= save_limit;
 
10001
}
 
10002
}
 
10003
}
 
10004
 
 
10005
;
 
10006
OUT_STR("\\X ");
 
10007
 
 
10008
OUT_STR(cur_xref->num>=def_flag?
 
10009
LANGUAGE_SYMBOL((LANGUAGE)cur_mod_name->mod_info->language):
 
10010
(CONST outer_char*)"");
 
10011
OUT_STR("\\X");
 
10012
}
 
10013
 
 
10014
 
 
10015
}
 
10016
#endif
 
10017
 
 
10018
 
 
10019
 
 
10020
SRTN
 
10021
footnote FCN((flag))
 
10022
sixteen_bits flag C1("")
 
10023
{
 
10024
xref_pointer q;
 
10025
 
 
10026
if(cur_xref->num<=flag)return;
 
10027
 
 
10028
fin_line();OUT_STR("\\W");
 
10029
 
 
10030
 
 
10031
 
 
10032
out(flag==0?0125:0101);
 
10033
 
 
10034
OUT_STR(" section");
 
10035
 
 
10036
 
 
10037
q= cur_xref;if(q->xlink->num>flag)out(0163);
 
10038
out(0176);
 
10039
 
 
10040
WHILE()
 
10041
{
 
10042
out_mod(cur_xref->num-flag,ENCAP);
 
10043
cur_xref= cur_xref->xlink;
 
10044
 
 
10045
if(cur_xref->num<=flag)break;
 
10046
 
 
10047
if(cur_xref->xlink->num>flag||cur_xref!=q->xlink)out(054);
 
10048
 
 
10049
 
 
10050
out(040);
 
10051
 
 
10052
if(cur_xref->xlink->num<=flag)
 
10053
OUT_STR("and~");
 
10054
}
 
10055
 
 
10056
;
 
10057
out(056);
 
10058
fin_line();
 
10059
}
 
10060
 
 
10061
 
 
10062
 
 
10063
SRTN
 
10064
phase3(VOID)
 
10065
{
 
10066
language= global_language;
 
10067
 
 
10068
if(no_xref&&!prn_contents)
 
10069
{
 
10070
fin_line();
 
10071
 
 
10072
{
 
10073
OUT_STR("\\vfill");fin_line();
 
10074
OUT_STR("\\FWEBend");fin_line();
 
10075
}
 
10076
 
 
10077
 
 
10078
}
 
10079
else
 
10080
{
 
10081
temp_ndx= GET_MEM("temp_ndx",MAX_FILE_NAME_LENGTH,outer_char);
 
10082
temp_mds= GET_MEM("temp_mds",MAX_FILE_NAME_LENGTH,outer_char);
 
10083
 
 
10084
phase= 3;
 
10085
nuweb_mode= NO;
 
10086
 
 
10087
if(prn_index)
 
10088
{
 
10089
OUT_STR("\\input ");
 
10090
OUT_STR(xpn_name(&temp_ndx,MAX_FILE_NAME_LENGTH,
 
10091
w_style.indx.tex,wbflnm0));
 
10092
fin_line();
 
10093
}
 
10094
 
 
10095
if(prn_modules)
 
10096
{
 
10097
OUT_STR("\\input ");
 
10098
OUT_STR(xpn_name(&temp_mds,MAX_FILE_NAME_LENGTH,
 
10099
w_style.modules.tex,wbflnm0));
 
10100
fin_line();
 
10101
 
 
10102
fin_line();
 
10103
 
 
10104
 
 
10105
{
 
10106
outer_char HUGE*temp;
 
10107
 
 
10108
 
 
10109
temp= GET_MEM("temp",N_CMD,outer_char);
 
10110
 
 
10111
OUT_STR(w_style.modules.info);
 
10112
OUT_STR(cmd_ln_buf);fin_line();
 
10113
 
 
10114
 
 
10115
 
 
10116
if(
 
10117
nsprintf(temp,OC(" {%s}"),1,XLANGUAGE_NAME_PTR(global_language))>=(int)(N_CMD))OVERFLW("temp","");
 
10118
OUT_STR(temp);fin_line();
 
10119
 
 
10120
 
 
10121
{
 
10122
RCS HUGE*prcs;
 
10123
 
 
10124
IN_COMMON unsigned num_keywords;
 
10125
unsigned k;
 
10126
RCS HUGE*rcs_ptrs[1000];
 
10127
 
 
10128
 
 
10129
for(prcs= prms[WEB_FILE].rcs_list.start,num_keywords= 0;prcs;
 
10130
prcs= prcs->next,num_keywords++)
 
10131
rcs_ptrs[num_keywords]= prcs;
 
10132
 
 
10133
QSORT(rcs_ptrs,num_keywords,sizeof(RCS*),cmpr_rcs);
 
10134
 
 
10135
fin_line();
 
10136
 
 
10137
if(num_keywords>0)
 
10138
{
 
10139
out_str(w_style.modules.kwd);
 
10140
out(0163);
 
10141
fin_line();
 
10142
}
 
10143
 
 
10144
for(k= 0;k<num_keywords;k++)
 
10145
{
 
10146
prcs= rcs_ptrs[k];
 
10147
 
 
10148
out_str(w_style.modules.kwd);
 
10149
out(0173);
 
10150
out_atext(prcs->keyword);
 
10151
out(0175);
 
10152
out(0173);
 
10153
out_atext(prcs->txt);
 
10154
out(0175);
 
10155
fin_line();
 
10156
}
 
10157
}
 
10158
 
 
10159
 
 
10160
 
 
10161
FREE_MEM(temp,"temp",N_CMD,outer_char);
 
10162
}
 
10163
 
 
10164
 
 
10165
 
 
10166
}
 
10167
 
 
10168
if(prn_contents)
 
10169
{
 
10170
outer_char temp[20];
 
10171
 
 
10172
OUT_STR(w_style.contents.preamble);
 
10173
 
 
10174
 
 
10175
if(
 
10176
nsprintf(temp,OC("{%i}"),1,module_count)>=(int)(20))OVERFLW("temp","");
 
10177
OUT_STR(temp);
 
10178
 
 
10179
OUT_STR(w_style.contents.postamble);
 
10180
fin_line();
 
10181
 
 
10182
OUT_STR("\\FWEBend");fin_line();
 
10183
}
 
10184
else
 
10185
 
 
10186
{
 
10187
OUT_STR("\\vfill");fin_line();
 
10188
OUT_STR("\\FWEBend");fin_line();
 
10189
}
 
10190
 
 
10191
 
 
10192
 
 
10193
if(prn_index)
 
10194
 
 
10195
{
 
10196
writing(YES,temp_ndx);
 
10197
 
 
10198
if(tex_file==stdout)
 
10199
puts("");
 
10200
 
 
10201
NEW_TeX(temp_ndx);
 
10202
 
 
10203
if(makeindex)
 
10204
{
 
10205
 
 
10206
{
 
10207
mx_open(w_style.indx.m_sty);
 
10208
 
 
10209
 
 
10210
if(makeindex)fprintf(mx_file,"%s","% Produced automatically by fweave.\n\n");
 
10211
 
 
10212
sprintf((char*)m_temp0,
 
10213
"  \\Wequate{%s%s} {%s} {%s%s} {%s%s} {%s%s} {%s} {%s%s} {%s} {%s}\n\n",
 
10214
pfrmt->reserved,pfrmt->RESERVED,pfrmt->short_id,pfrmt->id,pfrmt->ID,pfrmt->id_outer,pfrmt->ID_OUTER,pfrmt->id_inner,pfrmt->ID_INNER,pfrmt->intrinsic,pfrmt->keyword,pfrmt->KEYWORD,pfrmt->typewritr,"");
 
10215
 
 
10216
fprintf(mx_file,"%s \"%s\\\n%s\"\n",
 
10217
"preamble",
 
10218
dbl_bslash(m_temp,w_style.indx.m_preamble),
 
10219
dbl_bslash(m_temp1,m_temp0));
 
10220
 
 
10221
 
 
10222
fprintf(mx_file,"%s \"%s\"\n","postamble",
 
10223
dbl_bslash(m_temp0,w_style.indx.m_postamble));
 
10224
 
 
10225
fprintf(mx_file,"%s \"%s\"\n","keyword",
 
10226
dbl_bslash(m_temp0,w_style.indx.m_keyword));
 
10227
 
 
10228
fprintf(mx_file,"%s '%s'\n","arg_open",
 
10229
dbl_cslash(m_temp0,w_style.indx.m_arg_open));
 
10230
 
 
10231
fprintf(mx_file,"%s '%s'\n","arg_close",
 
10232
dbl_cslash(m_temp0,w_style.indx.m_arg_close));
 
10233
 
 
10234
fprintf(mx_file,"%s '%s'\n","range_open",
 
10235
dbl_cslash(m_temp0,w_style.indx.m_range_open));
 
10236
 
 
10237
fprintf(mx_file,"%s '%s'\n","range_close",
 
10238
dbl_cslash(m_temp0,w_style.indx.m_range_close));
 
10239
 
 
10240
fprintf(mx_file,"%s '%s'\n","level",
 
10241
dbl_cslash(m_temp0,w_style.indx.m_level));
 
10242
 
 
10243
fprintf(mx_file,"%s '%s'\n","actual",
 
10244
dbl_cslash(m_temp0,w_style.indx.m_actual));
 
10245
 
 
10246
fprintf(mx_file,"%s '%s'\n","encap",
 
10247
dbl_cslash(m_temp0,w_style.indx.m_encap));
 
10248
 
 
10249
fprintf(mx_file,"%s '%s'\n","quote",
 
10250
dbl_cslash(m_temp0,w_style.indx.m_quote));
 
10251
 
 
10252
fprintf(mx_file,"%s '%s'\n","escape",
 
10253
dbl_cslash(m_temp0,w_style.indx.m_escape));
 
10254
 
 
10255
fprintf(mx_file,"%s \"%s\"\n","setpage_prefix",
 
10256
dbl_bslash(m_temp0,w_style.indx.m_setpage_prefix));
 
10257
 
 
10258
fprintf(mx_file,"%s \"%s\"\n","setpage_suffix",
 
10259
dbl_bslash(m_temp0,w_style.indx.m_setpage_suffix));
 
10260
 
 
10261
fprintf(mx_file,"%s \"%s\"\n","group_skip",
 
10262
dbl_bslash(m_temp0,w_style.indx.m_group_skip));
 
10263
 
 
10264
fprintf(mx_file,"%s %i\n","headings_flag",w_style.indx.m_headings_flag);
 
10265
 
 
10266
fprintf(mx_file,"%s \"%s\"\n","heading_prefix",
 
10267
dbl_bslash(m_temp0,w_style.indx.m_heading_prefix));
 
10268
 
 
10269
fprintf(mx_file,"%s \"%s\"\n","symhead_positive",
 
10270
dbl_bslash(m_temp0,w_style.indx.m_symhead_positive));
 
10271
 
 
10272
fprintf(mx_file,"%s \"%s\"\n","symhead_negative",
 
10273
dbl_bslash(m_temp0,w_style.indx.m_symhead_negative));
 
10274
 
 
10275
fprintf(mx_file,"%s \"%s\"\n","numhead_positive",
 
10276
dbl_bslash(m_temp0,w_style.indx.m_numhead_positive));
 
10277
 
 
10278
fprintf(mx_file,"%s \"%s\"\n","numhead_negative",
 
10279
dbl_bslash(m_temp0,w_style.indx.m_numhead_negative));
 
10280
 
 
10281
fprintf(mx_file,"%s \"%s\"\n","item_0",
 
10282
dbl_bslash(m_temp0,w_style.indx.m_item_0));
 
10283
 
 
10284
fprintf(mx_file,"%s \"%s\"\n","item_1",
 
10285
dbl_bslash(m_temp0,w_style.indx.m_item_1));
 
10286
 
 
10287
fprintf(mx_file,"%s \"%s\"\n","item_2",
 
10288
dbl_bslash(m_temp0,w_style.indx.m_item_2));
 
10289
 
 
10290
fprintf(mx_file,"%s \"%s\"\n","item_01",
 
10291
dbl_bslash(m_temp0,w_style.indx.m_item_01));
 
10292
 
 
10293
fprintf(mx_file,"%s \"%s\"\n","item_x1",
 
10294
dbl_bslash(m_temp0,w_style.indx.m_item_x1));
 
10295
 
 
10296
fprintf(mx_file,"%s \"%s\"\n","item_12",
 
10297
dbl_bslash(m_temp0,w_style.indx.m_item_12));
 
10298
 
 
10299
fprintf(mx_file,"%s \"%s\"\n","item_x2",
 
10300
dbl_bslash(m_temp0,w_style.indx.m_item_x2));
 
10301
 
 
10302
fprintf(mx_file,"%s \"%s\"\n","delim_0",
 
10303
dbl_bslash(m_temp0,w_style.indx.m_delim_0));
 
10304
 
 
10305
fprintf(mx_file,"%s \"%s\"\n","delim_1",
 
10306
dbl_bslash(m_temp0,w_style.indx.m_delim_1));
 
10307
 
 
10308
fprintf(mx_file,"%s \"%s\"\n","delim_2",
 
10309
dbl_bslash(m_temp0,w_style.indx.m_delim_2));
 
10310
 
 
10311
fprintf(mx_file,"%s \"%s\"\n","delim_n",
 
10312
dbl_bslash(m_temp0,w_style.indx.m_delim_n));
 
10313
 
 
10314
fprintf(mx_file,"%s \"%s\"\n","delim_r",
 
10315
dbl_bslash(m_temp0,w_style.indx.m_delim_r));
 
10316
 
 
10317
fprintf(mx_file,"%s \"%s\"\n","delim_t",
 
10318
dbl_bslash(m_temp0,w_style.indx.m_delim_t));
 
10319
 
 
10320
fprintf(mx_file,"%s \"%s\"\n","encap_prefix",
 
10321
dbl_bslash(m_temp0,w_style.indx.m_encap_prefix));
 
10322
 
 
10323
fprintf(mx_file,"%s \"%s\"\n","encap_infix",
 
10324
dbl_bslash(m_temp0,w_style.indx.m_encap_infix));
 
10325
 
 
10326
fprintf(mx_file,"%s \"%s\"\n","encap_suffix",
 
10327
dbl_bslash(m_temp0,w_style.indx.m_encap_suffix));
 
10328
 
 
10329
fprintf(mx_file,"%s %i\n","line_max",w_style.indx.m_line_max);
 
10330
 
 
10331
fprintf(mx_file,"%s \"%s\"\n","indent_space",
 
10332
dbl_bslash(m_temp0,w_style.indx.m_indent_space));
 
10333
 
 
10334
fprintf(mx_file,"%s %i\n","indent_length",w_style.indx.m_indent_length);
 
10335
 
 
10336
fclose(mx_file);
 
10337
}
 
10338
 
 
10339
 
 
10340
 
 
10341
mx_open(w_style.indx.m_out);
 
10342
fprintf(mx_file,"%% %s\n\n",wbflnm0);
 
10343
}
 
10344
 
 
10345
if(change_exists)
 
10346
{
 
10347
 
 
10348
{
 
10349
 
 
10350
k_module= 0;
 
10351
 
 
10352
while(!chngd_module[++k_module]);
 
10353
 
 
10354
OUT_STR("\\Wch ");
 
10355
 
 
10356
out_mod(k_module,ENCAP);
 
10357
 
 
10358
while(k_module<module_count)
 
10359
{
 
10360
while(!chngd_module[++k_module]);
 
10361
 
 
10362
 
 
10363
OUT_STR(", ");out_mod(k_module,ENCAP);
 
10364
}
 
10365
 
 
10366
out(056);
 
10367
}
 
10368
 
 
10369
;
 
10370
fin_line();
 
10371
fin_line();
 
10372
}
 
10373
 
 
10374
OUT_STR(w_style.indx.preamble);fin_line();
 
10375
 
 
10376
 
 
10377
 
 
10378
{
 
10379
int c;
 
10380
 
 
10381
 
 
10382
for(c= 0;c<=127;c++)bucket[c]= NULL;
 
10383
 
 
10384
for(h= hash;h<=hash_end;h++)
 
10385
{
 
10386
next_name= *h;
 
10387
 
 
10388
while(next_name)
 
10389
{
 
10390
cur_name= next_name;next_name= cur_name->link;
 
10391
 
 
10392
if((xref_pointer)cur_name->xref!=xmem)
 
10393
{
 
10394
c= (cur_name->byte_start)[0];
 
10395
 
 
10396
c= A_TO_LOWER(c);
 
10397
 
 
10398
blink[cur_name-name_dir]= bucket[c];
 
10399
bucket[c]= cur_name;
 
10400
}
 
10401
}
 
10402
}
 
10403
}
 
10404
 
 
10405
;
 
10406
 
 
10407
 
 
10408
w_style.indx.collate= x__to_ASCII((outer_char*)w_style.indx.collate);
 
10409
max_collate= STRLEN(w_style.indx.collate);
 
10410
STRNCPY(collate+1,w_style.indx.collate,max_collate);
 
10411
 
 
10412
sort_ptr= scrp_info;unbucket(1);
 
10413
 
 
10414
while(sort_ptr>scrp_info)
 
10415
{
 
10416
cur_depth= sort_ptr->depth;
 
10417
 
 
10418
if(blink[sort_ptr->head-name_dir]==0||cur_depth==INFTY)
 
10419
 
 
10420
{
 
10421
cur_name= sort_ptr->head;
 
10422
 
 
10423
 
 
10424
{
 
10425
ASCII letter= *cur_name->byte_start;
 
10426
 
 
10427
 
 
10428
 
 
10429
 
 
10430
if(letter==0134&&cur_name->ilk==normal&&language!=TEX)
 
10431
letter= NON_TEX_MACRO;
 
10432
else
 
10433
letter= A_TO_LOWER(letter);
 
10434
 
 
10435
if(letter!=last_letter)
 
10436
{
 
10437
if(last_letter)
 
10438
{
 
10439
OUT_STR(w_style.indx.group_skip);
 
10440
}
 
10441
 
 
10442
if(w_style.indx.lethead_flag&&letter!=NON_TEX_MACRO)
 
10443
{
 
10444
OUT_STR(w_style.indx.lethead_prefix);
 
10445
 
 
10446
switch(letter)
 
10447
{
 
10448
 
 
10449
 
 
10450
 
 
10451
 
 
10452
case 0134:case 0173:case 0175
 
10453
 
 
10454
:
 
10455
 
 
10456
case 040:case 043:case 045:case 044:case 0136:case 0140:
 
10457
case 0176:case 046:case 0137
 
10458
 
 
10459
 
 
10460
 
 
10461
:out(0134);
 
10462
}
 
10463
out((w_style.indx.lethead_flag>0?A_TO_UPPER(letter):
 
10464
A_TO_LOWER(letter)));
 
10465
 
 
10466
if(w_style.indx.m_headings_flag)
 
10467
{}
 
10468
 
 
10469
OUT_STR(w_style.indx.lethead_suffix);
 
10470
}
 
10471
}
 
10472
 
 
10473
last_letter= letter;
 
10474
}
 
10475
 
 
10476
 
 
10477
 
 
10478
do
 
10479
{
 
10480
if(cur_name->defined_type(language)<0x80)
 
10481
{
 
10482
OUT_STR(w_style.indx.item_0);
 
10483
 
 
10484
 
 
10485
{
 
10486
boolean all_uc= cur_name->info.upper_case;
 
10487
 
 
10488
 
 
10489
if(makeindex)
 
10490
m_start= out_ptr+1;
 
10491
 
 
10492
switch(cur_name->ilk)
 
10493
{
 
10494
case normal:
 
10495
output_type= IDENTIFIER;
 
10496
 
 
10497
if(is_intrinsic(cur_name))
 
10498
OUT_STR(pfrmt->intrinsic);
 
10499
 
 
10500
else if(is_keyword(cur_name))
 
10501
OUT_STR(ALL_UC?pfrmt->KEYWORD:pfrmt->keyword);
 
10502
 
 
10503
else
 
10504
if(language==TEX)
 
10505
OUT_STR(pfrmt->typewritr);
 
10506
 
 
10507
else if(length(cur_name)==1)
 
10508
OUT_STR(pfrmt->short_id);
 
10509
else
 
10510
 
 
10511
switch(DEFINED_TYPE(cur_name))
 
10512
{
 
10513
case D_MACRO:
 
10514
OUT_STR(ALL_UC?pfrmt->ID_OUTER:pfrmt->id_outer);
 
10515
 
 
10516
break;
 
10517
 
 
10518
case M_MACRO:
 
10519
OUT_STR(ALL_UC?pfrmt->ID_INNER:pfrmt->id_inner);
 
10520
break;
 
10521
 
 
10522
default:
 
10523
OUT_STR(ALL_UC?pfrmt->ID:pfrmt->id);
 
10524
 
 
10525
break;
 
10526
 
 
10527
}
 
10528
 
 
10529
 
 
10530
break;
 
10531
 
 
10532
 
 
10533
 
 
10534
case roman:output_type= INDEX_ENTRY;break;
 
10535
case wildcard:OUT_STR(pfrmt->wildcrd);output_type= INDEX_ENTRY;break;
 
10536
 
 
10537
case typewriter:OUT_STR(pfrmt->typewritr);
 
10538
output_type= INDEX_ENTRY;break;
 
10539
 
 
10540
default:
 
10541
OUT_STR(ALL_UC?pfrmt->RESERVED:pfrmt->reserved);
 
10542
output_type= IDENTIFIER;break;
 
10543
 
 
10544
}
 
10545
 
 
10546
out_name(m_temp1,YES,output_type,cur_name);
 
10547
}
 
10548
 
 
10549
;
 
10550
 
 
10551
{
 
10552
 
 
10553
 
 
10554
this_xref= (xref_pointer)cur_name->xref;cur_xref= xmem;
 
10555
 
 
10556
do
 
10557
{
 
10558
next_xref= this_xref->xlink;this_xref->xlink= cur_xref;
 
10559
cur_xref= this_xref;this_xref= next_xref;
 
10560
}
 
10561
while(this_xref!=xmem);
 
10562
 
 
10563
;
 
10564
 
 
10565
OUT_STR(w_style.indx.delim_0);
 
10566
 
 
10567
WHILE()
 
10568
{
 
10569
 
 
10570
 
 
10571
if(makeindex)fprintf(mx_file,"%s",w_style.indx.m_keyword);
 
10572
 
 
10573
 
 
10574
if(makeindex)fprintf(mx_file,"%c",w_style.indx.m_arg_open);
 
10575
m_start= out_ptr+1;
 
10576
 
 
10577
if(makeindex)
 
10578
out_name(m_temp0,NO,output_type,cur_name);
 
10579
 
 
10580
 
 
10581
if(makeindex)fprintf(mx_file,"%s",mx_quote(m_temp,m_temp0));
 
10582
 
 
10583
 
 
10584
if(makeindex)fprintf(mx_file,"%c",w_style.indx.m_actual);
 
10585
 
 
10586
if(makeindex)fprintf(mx_file,"%s",mx_quote(m_temp,m_temp1));
 
10587
 
 
10588
cur_val= cur_xref->num;
 
10589
 
 
10590
 
 
10591
 
 
10592
if(makeindex)fprintf(mx_file,"%c",w_style.indx.m_encap);
 
10593
 
 
10594
 
 
10595
 
 
10596
 
 
10597
if(makeindex)fprintf(mx_file,"%s",w_style.indx.m_page);
 
10598
 
 
10599
 
 
10600
if(makeindex)fprintf(mx_file,"%c",w_style.indx.m_arg_open);
 
10601
 
 
10602
 
 
10603
if(makeindex)fprintf(mx_file,"%c",w_style.indx.m_arg_close);
 
10604
 
 
10605
if(cur_val<def_flag)
 
10606
{
 
10607
 
 
10608
 
 
10609
if(makeindex)fprintf(mx_file,"%c",w_style.indx.m_arg_open);
 
10610
 
 
10611
 
 
10612
if(makeindex)fprintf(mx_file,"%c",w_style.indx.m_arg_close);
 
10613
 
 
10614
 
 
10615
 
 
10616
if(makeindex)fprintf(mx_file,"%c",w_style.indx.m_arg_close);
 
10617
out_mod(cur_val,ENCAP);
 
10618
}
 
10619
else
 
10620
{
 
10621
OUT_STR(w_style.indx.underline_prefix);
 
10622
 
 
10623
 
 
10624
 
 
10625
 
 
10626
if(makeindex)fprintf(mx_file,"%c",w_style.indx.m_escape);
 
10627
 
 
10628
 
 
10629
if(makeindex)fprintf(mx_file,"%s",w_style.indx.m_underline);
 
10630
 
 
10631
 
 
10632
if(makeindex)fprintf(mx_file,"%c",w_style.indx.m_arg_close);
 
10633
 
 
10634
out_mod(cur_val-def_flag,ENCAP);
 
10635
OUT_STR(w_style.indx.underline_suffix);
 
10636
}
 
10637
 
 
10638
 
 
10639
 
 
10640
 
 
10641
if((LANGUAGE)cur_xref->Language!=global_language)
 
10642
{
 
10643
char temp[50];
 
10644
 
 
10645
sprintf(temp,"%s%s%s",
 
10646
(char*)w_style.indx.language_prefix,
 
10647
(char*)LANGUAGE_SYMBOL((LANGUAGE)cur_xref->Language),
 
10648
(char*)w_style.indx.language_suffix);
 
10649
OUT_STR(temp);
 
10650
}
 
10651
 
 
10652
 
 
10653
if(makeindex)fprintf(mx_file,"%c",'\n');
 
10654
 
 
10655
cur_xref= cur_xref->xlink;
 
10656
 
 
10657
if(cur_xref==xmem)
 
10658
break;
 
10659
 
 
10660
OUT_STR(w_style.indx.delim_n);
 
10661
}
 
10662
 
 
10663
out(056);fin_line();
 
10664
}
 
10665
 
 
10666
;
 
10667
}
 
10668
 
 
10669
cur_name= blink[cur_name-name_dir];
 
10670
}
 
10671
while(cur_name);
 
10672
 
 
10673
--sort_ptr;
 
10674
}
 
10675
 
 
10676
 
 
10677
else
 
10678
{
 
10679
ASCII c;
 
10680
 
 
10681
 
 
10682
next_name= sort_ptr->head;
 
10683
 
 
10684
do
 
10685
{
 
10686
cur_name= next_name;next_name= blink[cur_name-name_dir];
 
10687
cur_byte= cur_name->byte_start+cur_depth;
 
10688
 
 
10689
if(cur_byte==(cur_name+1)->byte_start)c= 0;
 
10690
else
 
10691
{
 
10692
c= *cur_byte;
 
10693
c= A_TO_LOWER(c);
 
10694
}
 
10695
 
 
10696
blink[PTR_DIFF(size_t,cur_name,name_dir)]= bucket[c];
 
10697
bucket[c]= cur_name;
 
10698
}
 
10699
while(next_name);
 
10700
 
 
10701
--sort_ptr;unbucket((eight_bits)(cur_depth+(eight_bits)1));
 
10702
}
 
10703
 
 
10704
;
 
10705
}
 
10706
 
 
10707
;
 
10708
 
 
10709
OUT_STR(w_style.indx.postamble);fin_line();
 
10710
 
 
10711
}
 
10712
 
 
10713
 
 
10714
 
 
10715
if(prn_modules)
 
10716
 
 
10717
{
 
10718
writing(BOOLEAN(!prn_index),temp_mds);
 
10719
NEW_TeX(temp_mds);
 
10720
 
 
10721
OUT_STR(w_style.modules.preamble);fin_line();
 
10722
 
 
10723
 
 
10724
mod_print(root);
 
10725
 
 
10726
OUT_STR(w_style.modules.postamble);fin_line();
 
10727
}
 
10728
 
 
10729
 
 
10730
}
 
10731
 
 
10732
if(tex_file!=stdout)
 
10733
fclose(tex_file);
 
10734
 
 
10735
CLR_PRINTF(SHORT_INFO,info,("\nDone."));
 
10736
chk_complete();
 
10737
}
 
10738
 
 
10739
 
 
10740
 
 
10741
int
 
10742
cmpr_rcs FCN((pp0,pp1))
 
10743
RCS HUGE**pp0 C0("")
 
10744
RCS HUGE**pp1 C1("")
 
10745
{
 
10746
return STRCMP((*pp0)->keyword,(*pp1)->keyword);
 
10747
}
 
10748
 
 
10749
 
 
10750
 
 
10751
ASCII HUGE*
 
10752
esc_buf FCN((temp,temp_end,buf,all_cases))
 
10753
ASCII HUGE*temp C0("Put it into here.")
 
10754
CONST ASCII HUGE*temp_end C0("End of |temp|.")
 
10755
CONST ASCII HUGE*buf C0("Translate from here.")
 
10756
boolean all_cases C1("")
 
10757
{
 
10758
ASCII HUGE*temp0= temp;
 
10759
 
 
10760
while(*buf!='\0')
 
10761
{
 
10762
switch(*buf)
 
10763
{
 
10764
 
 
10765
 
 
10766
case 0134:case 0173:case 0175
 
10767
 
 
10768
:
 
10769
if(!all_cases)break;
 
10770
 
 
10771
 
 
10772
case 040:case 043:case 045:case 044:case 0136:case 0140:
 
10773
case 0176:case 046:case 0137
 
10774
 
 
10775
:
 
10776
TO_TEMP(0134);
 
10777
break;
 
10778
}
 
10779
 
 
10780
TO_TEMP(*buf++);
 
10781
}
 
10782
 
 
10783
TO_TEMP('\0');
 
10784
return temp0;
 
10785
}
 
10786
 
 
10787
 
 
10788
 
 
10789
SRTN
 
10790
unbucket FCN((d))
 
10791
eight_bits d C1("")
 
10792
{
 
10793
int c;
 
10794
 
 
10795
for(c= max_collate;c>=0;c--)if(bucket[collate[c]]){
 
10796
if(sort_ptr>=scrp_end)OVERFLW("sort levels","s");
 
10797
 
 
10798
sort_ptr++;
 
10799
 
 
10800
if(sort_ptr>mx_sort_ptr)mx_sort_ptr= sort_ptr;
 
10801
 
 
10802
sort_ptr->depth= (eight_bits)(c==0?INFTY:d);
 
10803
sort_ptr->head= bucket[collate[c]];
 
10804
bucket[collate[c]]= NULL;
 
10805
}
 
10806
}
 
10807
 
 
10808
 
 
10809
 
 
10810
SRTN
 
10811
mod_print FCN((p))
 
10812
name_pointer p C1("")
 
10813
{
 
10814
if(p)
 
10815
{
 
10816
mod_print(p->llink);OUT_STR("\\:");
 
10817
 
 
10818
tok_ptr= tok_mem+1;text_ptr= tok_start+1;scrp_ptr= scrp_info;ini_stack;
 
10819
app(mod_flag+PTR_DIFF(sixteen_bits,p,name_dir));
 
10820
make_output();
 
10821
footnote(0);
 
10822
fin_line();
 
10823
 
 
10824
mod_print(p->rlink);
 
10825
}
 
10826
}
 
10827
 
 
10828
 
 
10829
 
 
10830
SRTN
 
10831
see_statistics(VOID)
 
10832
{
 
10833
CLR_PRINTF(ALWAYS,info,("\n\nMEMORY USAGE STATISTICS:\n"));
 
10834
 
 
10835
STAT0("names",sizeof(*name_ptr),
 
10836
SUB_PTRS(name_ptr,name_dir),max_names,smin0(MAX_VAL("n")),"n",",");
 
10837
 
 
10838
STAT0("cross-references",sizeof(*xref_ptr),
 
10839
SUB_PTRS(xref_ptr,xmem),max_refs,smin0(MAX_VAL("r")),"r",",");
 
10840
 
 
10841
STAT0("bytes",sizeof(*byte_ptr),
 
10842
SUB_PTRS(byte_ptr,byte_mem),max_bytes,smin0(MAX_VAL("b")),"b",";");
 
10843
 
 
10844
CLR_PRINTF(ALWAYS,info,(" parsing required\n"));
 
10845
 
 
10846
STAT0("scraps",sizeof(*mx_scr_ptr),
 
10847
SUB_PTRS(mx_scr_ptr,scrp_base),max_scraps,smin0(MAX_VAL("s")),"s",",");
 
10848
 
 
10849
STAT0("texts",sizeof(*mx_text_ptr),
 
10850
SUB_PTRS(mx_text_ptr,tok_start),max_texts,smin0(MAX_VAL("x")),"x",",");
 
10851
 
 
10852
STAT0("tokens",sizeof(*mx_tok_ptr),
 
10853
SUB_PTRS(mx_tok_ptr,tok_mem),max_toks,smin0(MAX_VAL("tw")),"tw",",");
 
10854
 
 
10855
STAT0("stack levels",sizeof(*mx_stck_ptr),
 
10856
SUB_PTRS(mx_stck_ptr,stack),stck_size,smin0(MAX_VAL("kw")),"kw",";");
 
10857
 
 
10858
CLR_PRINTF(ALWAYS,info,(" sorting required"));
 
10859
 
 
10860
printf(" %lu level(s).\n",SUB_PTRS(mx_sort_ptr,scrp_info));
 
10861
 
 
10862
mem_avail(1);
 
10863
}
 
10864
 
 
10865
 
 
10866
 
 
10867
SRTN
 
10868
predefine_macros(VOID)
 
10869
{}
 
10870
 
 
10871
SRTN
 
10872
open_out(VOID)
 
10873
{}
 
10874
 
 
10875
boolean
 
10876
was_opened FCN((name,global_scope,pname,pptr))
 
10877
CONST outer_char HUGE*name C0("")
 
10878
boolean global_scope C0("")
 
10879
outer_char HUGE*HUGE*pname C0("")
 
10880
FILE**pptr C1("")
 
10881
{
 
10882
*pname= GET_MEM("*pname",STRLEN(name)+1,outer_char);
 
10883
STRCPY(*pname,name);
 
10884
 
 
10885
return NO;
 
10886
}
 
10887
 
 
10888
SRTN ini_tokens FCN((language0))
 
10889
LANGUAGE language0 C1("")
 
10890
{}
 
10891
 
 
10892
 
 
10893
#endif 
 
10894
 
 
10895
 
 
10896
 
 
10897
 
 
10898
 
 
10899
outer_char*
 
10900
mx_quote FCN((m_out,s))
 
10901
outer_char*m_out C0("Escape into here")
 
10902
outer_char*s C1("Input")
 
10903
{
 
10904
outer_char*p;
 
10905
 
 
10906
for(p= m_out;*s;)
 
10907
{
 
10908
INDEX HUGE*q= &w_style.indx;
 
10909
 
 
10910
char c= *s++;
 
10911
 
 
10912
if(c==q->m_escape
 
10913
||c==q->m_encap
 
10914
||c==q->m_quote
 
10915
||c==q->m_level
 
10916
||c==q->m_actual)
 
10917
*p++= q->m_quote;
 
10918
 
 
10919
*p++= c;
 
10920
}
 
10921
 
 
10922
*p= '\0';
 
10923
 
 
10924
return m_out;
 
10925
}
 
10926
 
 
10927
 
 
10928
outer_char*
 
10929
dbl_bslash FCN((m_temp,s))
 
10930
outer_char*m_temp C0("Buffer")
 
10931
outer_char*s C1("String to expand")
 
10932
{
 
10933
outer_char*p;
 
10934
 
 
10935
for(p= m_temp;*s;)
 
10936
{
 
10937
c= *s++;
 
10938
 
 
10939
if(iscntrl(c)||c=='\\')
 
10940
 
 
10941
{
 
10942
*p++= '\\';
 
10943
 
 
10944
switch(c)
 
10945
{
 
10946
case '\a':c= 'a';break;
 
10947
case '\b':c= 'b';break;
 
10948
case '\f':c= 'f';break;
 
10949
case '\n':c= 'n';break;
 
10950
case '\r':c= 'r';break;
 
10951
case '\t':c= 't';break;
 
10952
case '\v':c= 'v';break;
 
10953
 
 
10954
case '\\':
 
10955
default:
 
10956
break;
 
10957
}
 
10958
}
 
10959
 
 
10960
 
 
10961
 
 
10962
 
 
10963
*p++= c;
 
10964
}
 
10965
 
 
10966
*p= '\0';
 
10967
 
 
10968
return m_temp;
 
10969
}
 
10970
 
 
10971
 
 
10972
 
 
10973
outer_char*
 
10974
dbl_cslash FCN((m_temp,c))
 
10975
outer_char*m_temp C0("Buffer")
 
10976
outer_char c C1("Char to expand")
 
10977
{
 
10978
outer_char*p= m_temp;
 
10979
 
 
10980
if(iscntrl(c)||c=='\\')
 
10981
 
 
10982
{
 
10983
*p++= '\\';
 
10984
 
 
10985
switch(c)
 
10986
{
 
10987
case '\a':c= 'a';break;
 
10988
case '\b':c= 'b';break;
 
10989
case '\f':c= 'f';break;
 
10990
case '\n':c= 'n';break;
 
10991
case '\r':c= 'r';break;
 
10992
case '\t':c= 't';break;
 
10993
case '\v':c= 'v';break;
 
10994
 
 
10995
case '\\':
 
10996
default:
 
10997
break;
 
10998
}
 
10999
}
 
11000
 
 
11001
 
 
11002
 
 
11003
 
 
11004
*p++= c;
 
11005
*p= '\0';
 
11006
 
 
11007
return m_temp;
 
11008
}
 
11009
 
 
11010
 
 
11011
SRTN mx_open FCN((ext))
 
11012
outer_char*ext C1("File extension")
 
11013
{
 
11014
xpn_name(&temp_ndx,MAX_FILE_NAME_LENGTH,ext,wbflnm0);
 
11015
mx_file= FOPEN(temp_ndx,"w");
 
11016
 
 
11017
if(mx_file)
 
11018
writing(NO,temp_ndx);
 
11019
else
 
11020
{
 
11021
CLR_PRINTF(WARNINGS,info,
 
11022
("\n! Can't open makeindex file %s\n",temp_ndx));
 
11023
mark_harmless;
 
11024
makeindex= NO;
 
11025
}
 
11026
}
 
11027
 
 
11028