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"\
12
#define FWEAVE_HDR "% FWEAVE" \
17
#define typewriter 3 \
19
#define is_reserved(a)(a->ilk>typewriter) \
21
#define append_xref(c)if(xref_ptr==xmem_end) \
22
OVERFLW("cross-references","r"); \
25
(++xref_ptr)->num= c; \
26
xref_ptr->Language= (boolean)language; \
29
#define def_flag ID_FLAG \
31
#define xref equiv_or_xref \
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)) \
81
#define implicit_hd 34
84
#define ignore_scrap 37
87
#define language_scrap 40 \
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 \
102
#define entry_like 66
103
#define implicit_like 67
104
#define assign_like 68
105
#define built_in 69 \
108
#define endif_like 71
113
#define until_like 76
128
#define program_like 91
131
#define class_like 94
134
#define private_like 98
135
#define slash_like 99
138
#define huge_like 102
139
#define imp_reserved 103
140
#define extern_like 104
147
#define namespace 111
149
#define reference 113
150
#define kill_newlines 114 \
153
#define verbatim (eight_bits)02
154
#define force_line (eight_bits)03 \
156
#define begin_comment0 (eight_bits)0376
157
#define begin_comment1 (eight_bits)0375
158
#define begin_comment (eight_bits)011 \
160
#define compound_assignment (eight_bits)017 \
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 \
170
#define begin_nuweb (eight_bits)0206 \
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 \
186
#define switch_math_flag (eight_bits)0175
187
#define underline (eight_bits)0176 \
189
#define next_expr (eight_bits)0226
190
#define next_reserved (eight_bits)0227 \
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 \
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 \
208
#define begin_meta (eight_bits)0251
209
#define end_meta (eight_bits)0252 \
211
#define macro_space (eight_bits)0253
212
#define copy_mode (eight_bits)0254 \
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 \
220
#define left_preproc (eight_bits)0261
221
#define right_preproc (eight_bits)0262 \
223
#define Cont_Char (eight_bits)0263 \
225
#define Compiler_Directive (eight_bits)0264
226
#define new_output_file (eight_bits)0265 \
228
#define implicit_reserved (eight_bits)0266 \
230
#define trace (eight_bits)0267 \
234
#define invisible_cmnt (eight_bits)0272 \
236
#define pseudo_expr (eight_bits)0273
237
#define pseudo_colon (eight_bits)0274 \
239
#define begin_bp (eight_bits)0275
240
#define insert_bp (eight_bits)0276 \
242
#define no_index (eight_bits)0277
243
#define yes_index (eight_bits)0300 \
245
#define no_mac_expand (eight_bits)0301
246
#define protect_code (eight_bits)0302
247
#define set_line_info (eight_bits)0303 \
249
#define short_fcn (eight_bits)0304
250
#define keyword_name (eight_bits)0305 \
253
#define formatt (eight_bits)0310 \
255
#define limbo_text (eight_bits)0313
256
#define op_def (eight_bits)0314
257
#define macro_def (eight_bits)0315 \
259
#define definition (eight_bits)0320
260
#define undefinition (eight_bits)0321
261
#define WEB_definition (eight_bits)0322 \
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 \
276
#define begin_code (eight_bits)0350
277
#define module_name (eight_bits)0351 \
280
#define new_module (eight_bits)0352 \
284
#define constant (eight_bits)0230
285
#define stringg (eight_bits)0231
286
#define identifier (eight_bits)0232 \
288
#define ordinary_space 01 \
291
#define compress(c)if(loc++<=limit)return(eight_bits)c \
293
#define COMPOUND(c,n)if(loc<=limit){loc+= n;assignment_token= c; \
294
return(eight_bits)compound_assignment;} \
296
#define CA_START (eight_bits)0100 \
309
#define or_or_or 012 \
311
#define BINARY_CODE 046
312
#define OCTAL_CODE 0176
313
#define HEX_CODE 0140 \
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 \
321
#define EXP_CODE 0136
322
#define HOLLERITH_CODE 045 \
324
#define discretionary_break (eight_bits)0177
327
#define change_params prms[incl_depth].input_params \
329
#define CANT_DO(part)cant_do(OC(#part)) \
331
#define KILL_XREFS(name)no_xref|= !defn_mask.name
332
#define INDEX_SHORT index_short= index_flag= YES \
334
#define QUICK_FORMAT 056 \
336
#define IS_ON(flag,bits)((flag)&(bits)) \
339
#define MULTIPLE_USES 2 \
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) \
354
if(out_ptr>=out_end) \
356
*(++out_ptr)= (ASCII)(c); \
359
#define OUT_STR(s)out_str(OC(s)) \
361
#define IDENTIFIER YES
362
#define INDEX_ENTRY NO \
364
#define app_tok(c){if(tok_ptr+2>tok_m_end) \
365
OVERFLW("tokens","tw"); \
368
#define trans trans_plus.Trans
371
#define maybe_math 0 \
373
#define id_flag ID_FLAG
374
#define res_flag 2*id_flag
375
#define mod_flag ((sixteen_bits)(3*(sixteen_bits)id_flag)) \
377
#define tok_flag ((sixteen_bits)(4*(sixteen_bits)id_flag))
378
#define inner_tok_flag ((sixteen_bits)(5*(sixteen_bits)id_flag)) \
382
#define freeze_text *(++text_ptr)= tok_ptr \
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)); \
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) \
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) \
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) \
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) \
409
#define ONLY_N_like ((int)FORTRAN|(int)FORTRAN_90|(int)RATFOR|(int)(RATFOR_90))
410
#define ALL_BUT_N_like (~ONLY_N_like) \
412
#define ALL_LANGUAGES (ONLY_C_like|ONLY_N_like|(int)LITERAL) \
415
#define math_bin (eight_bits)0345
416
#define math_rel (eight_bits)0346 \
418
#define toggle_meta (eight_bits)0347 \
421
#define big_cancel (eight_bits)0360
422
#define cancel (eight_bits)0361 \
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 \
433
#define out_force (eight_bits)0371 \
435
#define end_translation (eight_bits)0377
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 \
444
#define res_word (eight_bits)0201
445
#define mod_name (eight_bits)0200 \
447
#define ALL_UC (all_uc&&length(cur_name)>1) \
450
#define XLANGUAGE_NAME_PTR(l)Xlanguages[lan_num(l)] \
453
#define LANGUAGE_SYMBOL(l) \
454
(l!=global_language?LANGUAGE_CODE(l):(CONST outer_char*)"") \
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) \
464
#define SUPPRESS(name)if(!defn_mask.name)suppress_defn= YES \
466
#define APP_TEMP(letter,arg)app_temp(OC(letter),OC(arg)) \
468
#define IMPROPER(m_type,msg)improper(OC(m_type),OC(msg)) \
470
#define APP_LANG(suffix)app_lang(OC(suffix)) \
472
#define NEW_TeX(file_name) \
473
if(tex_file!=stdout) \
476
if((tex_file= FOPEN(file_name,"w"))==NULL) \
478
fatal(ERR_W,OC("ABORTING: "),OC("Can't open output file %s."),file_name); \
483
#define TO_TEMP(val) \
487
OVERFLW("Esc_buf:temp","") \
490
#define head trans_plus.Head
491
#define sort_pointer scrap_pointer
492
#define sort_ptr scrp_ptr
493
#define max_sorts max_scraps \
497
#define NON_TEX_MACRO '\1' \
500
#define NO_ENCAP NO \
508
#if(part != 1 && part != 2 && part != 3)
516
#if(part == 0 || part == 1)
517
#define part1_or_extern
518
#define SET1(stuff) = stuff
519
#define TSET1(stuff) = stuff
521
#define part1_or_extern extern
530
#include "typedefs.h"
542
typedef struct xref_info0
545
struct xref_info0 HUGE*xlink;
550
typedef xref_info HUGE*xref_pointer;
551
typedef ASCII HUGE*XREF_POINTER;
557
typedef sixteen_bits Token;
558
typedef Token HUGE*token_pointer;
559
typedef token_pointer HUGE*text_pointer;
580
typedef scrap HUGE*scrap_pointer;
587
token_pointer end_field;
588
token_pointer tok_field;
592
typedef output_state HUGE*stack_pointer;
607
#define N_MSGBUF 2000
609
#define N_MSGBUF 10000
616
EXTERN boolean change_exists;
621
IN_COMMON BUF_SIZE max_modules;
624
EXTERN BUF_SIZE max_refs;
625
EXTERN xref_info HUGE*xmem;
626
EXTERN xref_pointer xmem_end;
628
EXTERN xref_pointer xref_ptr;
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;
638
EXTERN long max_toks;
640
EXTERN Token HUGE*tok_mem;
641
EXTERN token_pointer tok_m_end;
643
EXTERN long max_texts;
645
EXTERN token_pointer HUGE*tok_start;
646
EXTERN text_pointer tok_end;
648
EXTERN token_pointer tok_ptr;
649
EXTERN text_pointer text_ptr;
651
EXTERN token_pointer mx_tok_ptr;
652
EXTERN text_pointer mx_text_ptr;
656
IN_STYLE eight_bits ccode[128];
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);
666
EXTERN boolean lst_ampersand SET(NO);
668
EXTERN boolean eat_blank_lines SET(NO);
669
EXTERN boolean just_inserted SET(NO);
670
EXTERN boolean empty_line SET(NO);
676
EXTERN eight_bits assignment_token;
681
EXTERN boolean insert_breaks SET(YES);
686
EXTERN boolean doing_cdir SET(NO);
690
EXTERN eight_bits next_control;
694
IN_COMMON outer_char wbprefix[MAX_FILE_NAME_LENGTH];
696
EXTERN boolean do_inside;
697
EXTERN boolean qtd_file;
703
EXTERN outer_char temp_in[L_tmpnam],temp_out[L_tmpnam];
708
EXTERN name_pointer lhs,rhs;
713
EXTERN boolean unnamed_section SET(NO);
717
EXTERN xref_pointer cur_xref;
718
IN_COMMON boolean mod_warning_flag;
722
EXTERN BUF_SIZE line_length;
723
EXTERN ASCII HUGE*out_buf;
724
EXTERN ASCII HUGE*out_end;
726
EXTERN ASCII HUGE*out_ptr;
727
EXTERN LINE_NUMBER out_line;
731
EXTERN boolean output_on SET(YES);
735
EXTERN boolean strt_off SET(NO),ending_off SET(NO);
739
EXTERN boolean in_comment;
743
EXTERN long max_scraps;
744
EXTERN scrap HUGE*scrp_info;
745
EXTERN scrap_pointer scrp_end;
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;
753
EXTERN scrap_pointer mx_scr_ptr;
757
EXTERN boolean scanning_meta SET(NO);
761
EXTERN boolean overloaded[NUM_LANGUAGES];
763
EXTERN BUF_SIZE op_entries;
764
EXTERN OPERATOR HUGE*op,HUGE*op_end;
766
EXTERN OPERATOR HUGE*op_ptr;
770
EXTERN eight_bits last_control;
774
EXTERN boolean did_arg;
778
EXTERN boolean the_type SET(NO_TYPE);
782
EXTERN output_state cur_state;
784
EXTERN BUF_SIZE stck_size;
785
EXTERN output_state HUGE*stack;
787
EXTERN stack_pointer stck_end;
789
EXTERN stack_pointer stck_ptr;
791
EXTERN stack_pointer mx_stck_ptr;
795
EXTERN name_pointer cur_name;
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);
806
IN_COMMON outer_char last_include_file[],this_include_file[];
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);
817
EXTERN name_pointer this_module;
818
EXTERN name_pointer the_module;
823
EXTERN xref_pointer next_xref,this_xref,first_xref,mid_xref;
828
EXTERN sixteen_bits k_module;
832
EXTERN name_pointer bucket[128];
833
EXTERN name_pointer next_name;
834
IN_COMMON hash_pointer h;
836
IN_COMMON BUF_SIZE max_names;
838
EXTERN name_pointer HUGE*blink;
839
EXTERN ASCII last_letter SET('\0');
844
EXTERN eight_bits cur_depth;
845
EXTERN ASCII HUGE*cur_byte;
846
EXTERN sixteen_bits cur_val;
848
EXTERN sort_pointer mx_sort_ptr;
852
EXTERN ASCII collate[128];
853
EXTERN int max_collate;
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[];
868
#if(part == 0 || part == 1)
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.")
889
ALLOC(xref_info,xmem,"r",max_refs,0);
890
xmem_end= xmem+max_refs-1;
894
ALLOC(Token,tok_mem,"tw",max_toks,1);
897
tok_m_end= tok_mem+max_toks-1;
899
ALLOC(token_pointer,tok_start,"x",max_texts,0);
900
tok_end= tok_start+max_texts-1;
904
ALLOC(ASCII,out_buf,"ll",line_length,1);
906
out_end= out_buf+line_length;
910
ALLOC(scrap,scrp_info,"s",max_scraps,0);
911
scrp_end= scrp_info+max_scraps-1;
917
for(l= 0;l<NUM_LANGUAGES;l++)
920
ALLOC(OPERATOR,op,"op",op_entries,0);
921
op_end= op+op_entries;
926
INIT_OP(041,"NOT",ALL_LANGUAGES,"\\WR",unop);
927
INIT_DOT("NOT",ALL_BUT_C_like,"\\WR",unop);
930
INIT_OP(045,"MOD",ALL_LANGUAGES,"\\WMOD",binop);
933
INIT_OP(046,"LAND",C,"\\amp",unorbinop);
934
INIT_OP(046,"LAND",C_PLUS_PLUS,"\\amp",reference);
936
INIT_OP(046,"LAND",ALL_BUT_C_like,"\\WAND",binop);
939
INIT_OP(053,"PLUS",ALL_LANGUAGES,"+",unorbinop);
940
INIT_OP(055,"MINUS",ALL_LANGUAGES,"-",unorbinop);
942
INIT_OP(052,"STAR",ALL_LANGUAGES,"\\ast",unorbinop);
948
INIT_OP(057,"SLASH",ALL_BUT_N_like,"\\WSl",binop);
949
INIT_OP(057,"SLASH",ONLY_N_like,"/",binop);
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);
956
INIT_OP(075,"EQUALS",ALL_LANGUAGES,"=",binop);
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);
963
INIT_OP(077,"QUESTION",ONLY_C_like,"\\?",question);
965
INIT_OP(0136,"CARET",ALL_LANGUAGES,"\\Caret",binop);
968
INIT_OP(0174,"OR",ALL_LANGUAGES,"\\WOR",binop);
970
INIT_OP(0176,"TILDE",ONLY_C_like,"\\TLD",unop);
973
INIT_OP(not_eq,"NE",ALL_LANGUAGES,"\\WI",binop);
974
INIT_DOT("NE",ALL_BUT_C_like,"\\WI",binop);
977
INIT_OP(lt_eq,"LE",ALL_LANGUAGES,"\\WL",binop);
978
INIT_DOT("LE",ALL_BUT_C_like,"\\WL",binop);
981
INIT_OP(gt_eq,"GE",ALL_LANGUAGES,"\\WG",binop);
982
INIT_DOT("GE",ALL_BUT_C_like,"\\WG",binop);
985
INIT_OP(eq_eq,"EQ",ALL_LANGUAGES,"\\WS",binop);
986
INIT_DOT("EQ",ALL_BUT_C_like,"\\WS",binop);
989
INIT_OP(and_and,"AND",ALL_LANGUAGES,"\\WW",binop);
990
INIT_DOT("AND",ALL_BUT_C_like,"\\WW",binop);
993
INIT_OP(or_or,"OR",ALL_LANGUAGES,"\\WV",binop);
994
INIT_DOT("OR",ALL_BUT_C_like,"\\WOR",binop);
997
INIT_OP(plus_plus,"PP",ALL_LANGUAGES,"\\WPP",unop);
999
INIT_OP(minus_minus,"MM",ALL_LANGUAGES,"\\WMM",unop);
1002
INIT_OP(minus_gt,"EQV",ONLY_C_like,"\\WMG",binop);
1004
INIT_OP(minus_gt,"EQV",ALL_BUT_C_like,"\\WEQV",binop);
1005
INIT_DOT("EQV",ALL_BUT_C_like,"\\WEQV",binop);
1008
INIT_OP(gt_gt,"RSHIFT",ONLY_C_like,"\\WGG",binop);
1010
INIT_OP(lt_lt,"LSHIFT",ONLY_C_like,"\\WLL",binop);
1012
INIT_OP(star_star,"EE",ALL_LANGUAGES,"\\WEE",exp_op);
1014
INIT_OP(slash_slash,"SlSl",ALL_BUT_C_like,"\\WSlSl",binop);
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);
1022
INIT_DOT("FALSE",ALL_BUT_C_like,"\\WFALSE",expr);
1024
INIT_DOT("TRUE",ALL_BUT_C_like,"\\WTRUE",expr)
1030
INIT_CA(plus_eq,"Wcp",ALL_LANGUAGES,"\\Wcp",binop);
1032
INIT_CA(minus_eq,"Wcm",ALL_LANGUAGES,"\\Wcm",binop);
1034
INIT_CA(star_eq,"Wcs",ALL_LANGUAGES,"\\Wcs",binop);
1036
INIT_CA(slash_eq,"Wcv",ALL_LANGUAGES,"\\Wcv",binop);
1038
INIT_CA(mod_eq,"Wcd",ONLY_C_like,"\\Wcd",binop);
1040
INIT_CA(xor_eq,"Wcx",ONLY_C_like,"\\Wcx",binop);
1042
INIT_CA(and_eq,"Wca",ONLY_C_like,"\\Wca",binop);
1044
INIT_CA(or_eq,"Wco",ONLY_C_like,"\\Wco",binop);
1046
INIT_CA(gt_gt_eq,"Wcg",ONLY_C_like,"\\Wcg",binop);
1048
INIT_CA(lt_lt_eq,"Wcl",ONLY_C_like,"\\Wcl",binop)
1056
ALLOC(output_state,stack,"kw",stck_size,0);
1057
stck_end= stack+stck_size-1;
1061
ALLOC(name_pointer,blink,"n",max_names,0);
1067
name_dir->xref= (XREF_POINTER)(xref_ptr= xmem);
1068
xref_switch= mod_xref_switch= defd_switch= index_short= NO;
1076
tok_start[0]= tok_start[1]= tok_ptr;
1077
text_ptr= tok_start+1;
1081
mx_tok_ptr= tok_ptr;mx_text_ptr= text_ptr;
1086
ccode[057]= line_break;
1092
ini_ccode((outer_char*)"new_module",(outer_char*)" \t*",new_module);
1095
ini_ccode((outer_char*)"begin_code",(outer_char*)"aA",begin_code);
1097
ini_ccode((outer_char*)"module_name",(outer_char*)"<",module_name);
1100
ini_ccode((outer_char*)"definition",(outer_char*)"dD",definition);
1102
ini_ccode((outer_char*)"undefinition",(outer_char*)"uU",undefinition);
1104
ini_ccode((outer_char*)"WEB_definition",(outer_char*)"mM",WEB_definition);
1106
ini_ccode((outer_char*)"formatt",(outer_char*)"fF",formatt);
1109
ini_ccode((outer_char*)"toggle_output",(outer_char*)"\001",toggle_output);
1112
ini_ccode((outer_char*)"ascii_constant",(outer_char*)"'\"",ascii_constant);
1114
ini_ccode((outer_char*)"verbatim",(outer_char*)"=",verbatim);
1116
ini_ccode((outer_char*)"ln_break_outdent",(outer_char*)"\\",ln_break_outdent);
1119
ini_ccode((outer_char*)"TeX_string",(outer_char*)"tT",TeX_string);
1122
ini_ccode((outer_char*)"L_switch",(outer_char*)"L",L_switch);
1124
ini_ccode((outer_char*)"begin_C",(outer_char*)"c",begin_C);
1126
ini_ccode((outer_char*)"begin_RATFOR",(outer_char*)"r",begin_RATFOR);
1128
ini_ccode((outer_char*)"begin_FORTRAN",(outer_char*)"n",begin_FORTRAN);
1130
ini_ccode((outer_char*)"begin_nuweb",(outer_char*)"N",begin_nuweb);
1132
ini_ccode((outer_char*)"begin_TEX",(outer_char*)"x",begin_TEX);
1135
ini_ccode((outer_char*)"join",(outer_char*)"&",join);
1137
ini_ccode((outer_char*)"underline",(outer_char*)"_",underline);
1139
ini_ccode((outer_char*)"defd_at",(outer_char*)"[",defd_at);
1141
ini_ccode((outer_char*)"implicit_reserved",(outer_char*)"`]",implicit_reserved);
1144
ini_ccode((outer_char*)"invisible_cmnt",(outer_char*)"%",invisible_cmnt);
1146
ini_ccode((outer_char*)"Compiler_Directive",(outer_char*)"?",Compiler_Directive);
1148
ini_ccode((outer_char*)"short_fcn",(outer_char*)"{",short_fcn);
1150
ini_ccode((outer_char*)"keyword_name",(outer_char*)"kK",keyword_name);
1153
ini_ccode((outer_char*)"switch_math_flag",(outer_char*)"$",switch_math_flag);
1156
ini_ccode((outer_char*)"next_expr",(outer_char*)"E",next_expr);
1158
ini_ccode((outer_char*)"next_reserved",(outer_char*)"R",next_reserved);
1161
ini_ccode((outer_char*)"xref_roman",(outer_char*)"^",xref_roman);
1163
ini_ccode((outer_char*)"xref_typewriter",(outer_char*)".",xref_typewriter);
1165
ini_ccode((outer_char*)"xref_wildcard",(outer_char*)"9",xref_wildcard);
1170
sprintf(temp,";%c",XCHR(interior_semi));
1172
ini_ccode((outer_char*)"pseudo_semi",(outer_char*)temp,pseudo_semi);
1176
ini_ccode((outer_char*)"pseudo_expr",(outer_char*)"e",pseudo_expr);
1178
ini_ccode((outer_char*)"pseudo_colon",(outer_char*)":",pseudo_colon);
1181
ini_ccode((outer_char*)"limbo_text",(outer_char*)"l",limbo_text);
1183
ini_ccode((outer_char*)"op_def",(outer_char*)"vV",op_def);
1185
ini_ccode((outer_char*)"macro_def",(outer_char*)"wW",macro_def);
1188
ini_ccode((outer_char*)"thin_space",(outer_char*)",",thin_space);
1190
ini_ccode((outer_char*)"math_break",(outer_char*)"|",math_break);
1192
ini_ccode((outer_char*)"big_line_break",(outer_char*)"#",big_line_break);
1194
ini_ccode((outer_char*)"no_line_break",(outer_char*)"~",no_line_break);
1197
ini_ccode((outer_char*)"begin_meta",(outer_char*)"(",begin_meta);
1199
ini_ccode((outer_char*)"end_meta",(outer_char*)")",end_meta);
1202
ini_ccode((outer_char*)"new_output_file",(outer_char*)"oO",new_output_file);
1205
ini_ccode((outer_char*)"begin_bp",(outer_char*)"B",begin_bp);
1207
ini_ccode((outer_char*)"USED_BY_OTHER",(outer_char*)"}b",USED_BY_OTHER);
1209
ini_ccode((outer_char*)"no_mac_expand",(outer_char*)"!",no_mac_expand);
1211
ini_ccode((outer_char*)"USED_BY_OTHER",(outer_char*)"q",USED_BY_OTHER);
1214
ini_ccode((outer_char*)"no_index",(outer_char*)"-",no_index);
1216
ini_ccode((outer_char*)"yes_index",(outer_char*)"+",yes_index);
1219
ini_ccode((outer_char*)"protect_code",(outer_char*)"p",protect_code);
1225
ini_ccode((outer_char*)"trace",(outer_char*)"012",trace);
1240
out_ptr= out_buf;out_line= 1;
1245
TEX_PRINTF("%% --- FWEB's macro package ---\n\\input ");
1246
OUT_STR(*fwebmac?fwebmac:w_style.misc.macros);
1257
scrp_base= scrp_info+1;
1259
mx_scr_ptr= scrp_ptr= scrp_info;
1267
mx_sort_ptr= scrp_info;
1292
if(STRCMP(tex_fname,"stdout")==0)
1298
if(tex_file= FOPEN(tex_fname,"r"))
1302
fgets((char*)buf,STRLEN(FWEAVE_HDR)+1,tex_file);
1304
if(STRCMP(buf,FWEAVE_HDR))
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"),
1309
SSET_COLOR(out_file),
1311
SSET_COLOR(warning)))
1313
fatal(ERR_W,OC("ABORTING: "),OC("Didn't overwrite %s%s%s."),SSET_COLOR(out_file),tex_fname,SSET_COLOR(fatal));
1325
if((tex_file= FOPEN(tex_fname,"w"))==NULL)
1328
fatal(ERR_W,OC("ABORTING: "),OC("Can't open output file %s."),tex_fname);
1333
fprintf(tex_file,"%s v%s (%s)\n\n",
1334
FWEAVE_HDR,(char*)version,(char*)release_date);
1345
new_xref FCN((part0,p))
1347
name_pointer p C1("")
1354
SET_TYPE(p,DEFINED_TYPE(p)|0x80);
1355
index_flag= BOOLEAN(!(language==LITERAL));
1360
if(!index_flag||!(output_on||index_hidden)||in_format
1361
||(unnamed_section&&!xref_unnamed))
1365
index_flag= BOOLEAN(!(language==LITERAL));
1368
if(defd_switch&&(part0==DEFINITION
1370
||is_reserved(p)||is_intrinsic(p)||is_keyword(p))))
1372
sixteen_bits mod_defined= p->defined_in(language);
1374
if(mod_defined&&mod_defined!=module_count&&language!=C_PLUS_PLUS)
1377
err0_print(ERR_W,OC("Identifier in %s was already explicitly \
1379
marked via @[ as defined in %s"),2,MOD_TRANS(module_count),MOD_TRANS(mod_defined));
1383
p->defined_in(language)= module_count;
1387
if(defd_type!=NEVER_DEFINED)
1388
SET_TYPE(p,defd_type);
1390
defd_type= NEVER_DEFINED;
1394
||((!(index_short||index_one))&&(length(p)==1))))
1410
m= module_count+xref_switch;
1412
q= (xref_pointer)p->xref;
1414
if(!(do_inside||all_includes||(quoted_includes&&qtd_file)))
1415
goto check_implicit;
1421
if(n==m||n==m+def_flag)
1422
goto check_implicit;
1424
else if(m==n+def_flag)
1428
goto check_implicit;
1436
xref_ptr->xlink= q;p->xref= (XREF_POINTER)xref_ptr;
1443
name_pointer lhs= p,rhs= &rs_wd;
1446
rhs->reserved_word= rhs->Language= BOOLEAN(language);
1447
rhs->intrinsic_word= rhs->keyword= NO;
1455
#define RST_BIT(field) lhs->field = BOOLEAN(lhs->field & ~(boolean)language)\
1456
| (rhs->field & (boolean)language)
1458
RST_BIT(reserved_word);
1460
RST_BIT(intrinsic_word);
1470
for(q= (xref_pointer)p->xref;q>xmem;q= q->xlink)
1471
if(q->num<def_flag)q->num+= def_flag;
1482
new_mod_xref FCN((p))
1483
name_pointer p C1("")
1488
q= (xref_pointer)p->xref;r= xmem;
1492
if(mod_xref_switch==NO)
1494
while(q->num>=def_flag)
1502
if(q->num>=def_flag)
1510
if(mod_xref_switch==NO)
1512
p->mod_info->params.uses++;
1514
if(q->num==module_count)
1518
append_xref(module_count+mod_xref_switch);
1519
xref_ptr->xlink= q;mod_xref_switch= NO;
1522
p->xref= (XREF_POINTER)xref_ptr;
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.")
1537
if(length(p)!=l)return NO;
1539
if((p->Language&(boolean)language)&&(p->ilk!=t)&&!(t==normal&&
1543
return(boolean)(!STRNCMP(first,p->byte_start,l));
1550
name_pointer p C0("")
1555
p->ilk= t;p->xref= (XREF_POINTER)xmem;
1558
p->info.upper_case= NO;
1560
for(k= p->byte_start;k<byte_ptr;k++)
1561
if(isAlpha(*k)&&!isAupper(*k))
1564
p->info.upper_case= YES;
1567
SRTN ini_node FCN((node))
1568
CONST name_pointer node C1("")
1570
node->xref= (XREF_POINTER)xmem;
1576
node->mod_info= GET_MEM("mod_info",1,MOD_INFO);
1578
node->mod_info->Ilk= expr;
1579
node->mod_info->params= params;
1580
node->mod_info->params.uses= 0;
1582
node->Language= (boolean)language;
1597
if(loc>limit&&!get_line())
1608
switch(ccode[*loc++])
1639
Cpp= BOOLEAN(*loc==053);
1650
Fortran88= BOOLEAN(*loc==071);
1667
err0_print(ERR_C,OC("! Invalid language command `@L%c' ignored"),1,XCHR(l));
1679
global_params= params;
1684
if(Fortran88&&(auto_semi&&!free_Fortran))
1698
nuweb_mode= !NUWEB_MODE;
1701
global_params= params;
1706
case invisible_cmnt:
1724
if(loc>limit&&!get_line())
1729
while(*loc!=0100&&*loc!=0174)
1738
return ccode[*(loc++)];
1750
boolean terminate= NO;
1758
if(preprocessing&&at_beginning)
1764
for(;loc<limit;loc++)
1765
if(!(*loc==040||*loc==tab_mark))
1771
return(eight_bits)prs_regular_code(GOTO_GET_IDENTIFIER);
1783
while(*loc==cont_char&&loc==limit-1&&(preprocessing||free_Fortran))
1786
else if(preprocessing)
1794
chk_end= preprocessing= sharp_include_line= sharp_pragma_line= NO;
1795
return right_preproc;
1798
&&parsing_mode==OUTER
1799
&&(auto_semi&&!free_Fortran)&&(limit>cur_buffer)
1800
&&!(limit[0]==0100&&limit[1]==0155))
1814
err0_print(ERR_W,OC("Section ended in middle of Fortran-90 continuation"),0);
1817
APP_STR("\\indent");
1835
terminator[0]= *limit;terminator[1]= *(limit+1);
1844
if(free_Fortran&&auto_semi&&!empty_line&&the_part==CODE)
1847
return auto_pseudo_semis?ccode[073]:073;
1867
eat_blank_lines= NO;
1873
eat_blank_lines= NO;
1876
if(parsing_mode==OUTER)
1881
*limit= terminator[0];*(limit+1)= terminator[1];
1885
else if(parsing_mode==OUTER)
1897
if((c= *loc++)!=040||c!=tab_mark)
1902
if(c==040||c==tab_mark)
1914
ASCII HUGE*loc0= loc;
1920
while(loc<=limit&&(c==040||c==tab_mark));
1924
if(!(c==0100&&*loc==043))
1928
if(phase==1&&c==tab_mark)
1938
if(c==cont_char&&loc==limit)
1940
if(preprocessing||free_Fortran)
1952
if(limit==cur_buffer||(at_beginning&&loc>limit))
1955
return big_line_break;
1961
if((pcode= prs_TeX_code())==MORE_PARSE)
1963
else if((int)pcode<0)
1965
confusion(OC("prs_TEX_code"),OC("Negative pcode %i"),pcode);
1967
goto found_something;
1970
if((pcode= prs_regular_code(MORE_PARSE))==MORE_PARSE)
1972
else if((int)pcode<0)
1974
confusion(OC("prs_regular_code"),OC("Negative pcode %i"),pcode);
1976
goto found_something;
1985
switch((eight_bits)pcode)
1987
case begin_language:
1995
return(eight_bits)pcode;
2009
if((icode= get_control_code())==GOTO_MISTAKE)
2010
return prs_regular_code(GOTO_MISTAKE);
2014
else if(TeX[c]==TeX_comment)
2017
return begin_comment;
2019
else if(c==0174&&parsing_mode==INNER)
2024
if(TeX[c]==TeX_escape)
2027
id_first= id_loc= mod_text+1;
2029
*id_loc++= *(loc-1);
2031
if(TeX[*loc]!=TeX_letter)
2036
err0_print(ERR_W,OC("You should say `\\@@'"),0);
2041
else while(TeX[*loc]==TeX_letter)
2046
err0_print(ERR_W,OC("You should say `@@'"),0);
2063
id_first= id_loc= mod_text+1;
2068
if(*(loc+1)==0100)*id_loc++= *loc++;
2071
if(TeX[*loc]==TeX_comment)break;
2072
if(*loc==0174&&parsing_mode==INNER)break;
2074
if(TeX[*loc]==TeX_escape)
2076
if(TeX[*(loc+1)]!=TeX_letter)
2081
err0_print(ERR_W,OC("You should say \\@@"),0);
2082
else*id_loc++= *loc++;
2090
while(TeX[*loc]==TeX_letter);
2094
if(TeX[*loc]!=TeX_space)break;
2096
*id_loc++= ordinary_space;
2117
prs_regular_code FCN((iswitch))
2118
GOTO_CODE iswitch C1("")
2124
case GOTO_MISTAKE:goto mistake;
2125
case GOTO_GET_IDENTIFIER:goto get_identifier;
2130
if(c==056&&*loc==056&&*(loc+1)==056)
2137
else if(FORTRAN_LIKE(language)&&dot_constants&&
2138
(c==wt_style.dot_delimiter.begin)&&!isDigit(*loc))
2144
ASCII dot_end= wt_style.dot_delimiter.end;
2148
for(p0= loc,n= 0;n<MAX_DOT_LENGTH;n++,loc++)
2149
if(*loc==dot_end||!isAlpha(*loc))
2158
if((dcode= dot_code(dots,uppercase(p0,n),loc,dot_const))!=0)
2161
upcoming_kind= BOOLEAN(loc[1]==0137);
2174
else if(isDigit(c)||c==0134||c==056||(upcoming_kind&&c==0137))
2177
boolean decimal_point= NO;
2181
id_first= id_loc= mod_text+1;
2204
*id_loc++= OCTAL_CODE;
2207
while(isOdigit(*loc))
2211
return(eight_bits)c;
2216
if(*loc==0170||*loc==0130)
2218
*id_loc++= HEX_CODE;
2220
while(isXdigit(*loc))
2223
else if(*loc==0142||*loc==0102)
2225
*id_loc++= BINARY_CODE;
2227
while(isBdigit(*loc))
2230
else if(isOdigit(*loc))
2232
*id_loc++= OCTAL_CODE;
2233
while(isOdigit(*loc))
2244
if(c==056&&!isDigit(*loc))
2249
while(isDigit(*loc)||*loc==056)
2255
decimal_point= BOOLEAN(*(loc-1)==056);
2257
if(FORTRAN_LIKE(language))
2268
else if(*loc==0150||*loc==0110)
2276
*id_loc++= HOLLERITH_CODE;
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)))
2297
*id_loc++= EXP_CODE;
2298
*id_loc++= A_TO_UPPER(prec_char);
2302
if(*loc==053||*loc==055)
2305
while(isDigit(*loc))
2316
if(C_LIKE(language))
2322
*id_loc++= CONSTANT_CODE;
2324
if(*loc==0165||*loc==0125)
2326
*id_loc++= ULONG_CODE;
2330
*id_loc++= LONG_CODE;
2335
*id_loc++= CONSTANT_CODE;
2337
if(*loc==0154||*loc==0114)
2339
*id_loc++= ULONG_CODE;
2342
else*id_loc++= UNSIGNED_CODE;
2347
*id_loc++= CONSTANT_CODE;
2348
*id_loc++= FLOAT_CODE;
2363
while(is_kind(*loc))
2374
if(!decimal_point&&at_beginning&&
2375
((is_FORTRAN_(language)&&!last_was_continued)||
2376
(is_RATFOR_(language)&&*loc==072)))
2385
else if(in_data&&Fortran88&&(*loc==042||*loc==047)&&
2386
(c==0102||c==0117||c==0132))
2387
return get_string(*loc++,c);
2390
else if(is_identifier(c))
2393
IN_COMMON ASCII HUGE*pformat,HUGE*pdata;
2401
for(++loc;isAlpha(*loc)||isDigit(*loc)
2402
||*loc==0137||*loc==044||(in_format&&*loc==056);loc++)
2405
upcoming_kind= BOOLEAN(Fortran88&&(*loc=='"'||*loc=='\'')
2408
id_loc= loc-upcoming_kind;
2415
if(FORTRAN_LIKE(language))
2417
if(web_strcmp(pformat,pformat+6,id_first,id_loc)==EQUAL)
2421
return begin_format_stmt;
2423
else if(program==weave)
2425
if(web_strcmp(pdata,pdata+4,id_first,id_loc)==EQUAL)
2430
else if(at_beginning&&*loc==':'&&
2431
!is_in(non_labels,id_first,id_loc))
2436
if(is_include_like())
2437
sharp_include_line= YES;
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');
2454
if((icode= get_control_code())==GOTO_MISTAKE)
2462
else if(c==040||c==tab_mark)
2468
if(c==043&&at_beginning&&C_LIKE(language))
2471
IN_COMMON ASCII HUGE*pinclude,HUGE*ppragma;
2479
while(*loc==040||*loc==011)
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;
2489
return left_preproc;
2496
else if(in_format&&c==073)
2499
return end_format_stmt;
2507
case(ASCII)begin_comment0:
2509
return begin_comment;
2511
case(ASCII)begin_comment1:
2513
return begin_comment;
2516
if(*loc==057&&!in_format&&FORTRAN_LIKE(language))
2518
compress(slash_slash);
2528
compress(begin_comment);
2532
if(C_LIKE(language)||language==TEX||(Cpp_comments&&
2533
!in_format&&FORTRAN_LIKE(language)))
2537
compress(begin_comment);
2541
compress(slash_slash);
2546
else if(*loc==051&&!in_format)
2547
{compress(right_array);
2550
{COMPOUND(slash_eq,1);
2557
if(*loc==057&&!in_format)compress(left_array);
2561
if(*loc==053){compress(plus_plus);
2563
else if(*loc==075){COMPOUND(plus_eq,1);
2569
if(*loc==055){compress(minus_minus);
2571
else if(*loc==076){compress(minus_gt);
2574
else if(*loc==075){COMPOUND(minus_eq,1);
2580
if(*loc==075){compress(eq_eq);
2582
else if(*loc==076){compress(eq_gt);
2588
if(*loc==075){compress(gt_eq);
2591
if(*(loc+1)==075){COMPOUND(gt_gt_eq,2);
2594
else{compress(gt_gt);
2599
if(*loc==075){compress(lt_eq);
2603
{COMPOUND(lt_lt_eq,2);
2606
else{compress(lt_lt);
2608
else if(*loc==076){compress(not_eq);
2614
if(*loc==075){COMPOUND(mod_eq,1);
2619
if(*loc==046){compress(and_and);
2632
COMPOUND(or_or_or,2);
2634
else compress(or_or);
2636
else if(*loc==075&&!FORTRAN_LIKE(language))
2643
if(!in_format&&(point_comments||*loc==041))
2647
compress(begin_comment);
2649
else if(*loc==075){compress(not_eq);
2654
if(FORTRAN_LIKE(language)&&(*loc==052))
2655
{compress(star_star);
2657
else if(*loc==075){COMPOUND(star_eq,1);
2662
if(*loc==0136){compress(star_star);}
2663
else if(FORTRAN_LIKE(language)&&(loc<limit))
2665
else if(*loc==075){COMPOUND(xor_eq,1);
2670
if(*loc==072)compress(colon_colon);
2683
compress(dont_expand);
2687
compress(auto_label);
2691
compress(all_variable_args);
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";
2712
if(loc>limit&&!get_line())
2715
err0_print(ERR_W,OC("Input ended in section name"),0);
2717
loc= cur_buffer+1;break;
2734
else if(c==074)mod_level++;
2736
if(ccode[c]==new_module)
2739
err0_print(ERR_W,OC("Section name didn't end"),0);break;
2756
c= 040;if(*(k-1)==040)k--;
2770
printf("\n! Section name too long: ");
2772
ASCII_write(mod_text+1,25);
2777
if(*k==040&&k>mod_text)
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);
2788
cur_module= mod_lookup(bad_mod_name,bad_mod_name+STRLEN(bad_mod_name)-1);
2792
params= cur_module->mod_info->params;
2804
return macro_module_name;
2818
return(eight_bits)c;
2824
get_string FCN((c,boz))
2825
ASCII c C0("What started the string")
2826
ASCII boz C1("The boz character, or 0.")
2829
ASCII right_delim= c;
2831
boolean equal_delims;
2833
id_first= mod_text+1;
2837
if(delim==047&&*(loc-2)==0100){*++id_loc= 0100;*++id_loc= 0100;}
2850
sharp_include_line= NO;
2860
equal_delims= BOOLEAN(right_delim==delim);
2871
if((equal_delims||chk_ifelse)&&*(limit-1)!=cont_char)
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));
2882
err0_print(ERR_W,OC("Input ended in middle of string beginning with \
2883
'\\%c'"),1,XCHR(delim));
2892
if(bslash_continued_strings)
2894
for(;loc<limit;loc++)
2895
if(*loc!=040&&*loc!=tab_mark)break;
2897
if(*loc==cont_char)loc++;
2899
err0_print(ERR_W,OC("Inserted '\\%c' at beginning of continued \
2900
string"),1,XCHR(cont_char));
2907
if((c= *loc++)==delim)
2911
if(++id_loc<=mod_end)*id_loc= c;
2913
if(!equal_delims)continue;
2915
if(FORTRAN_LIKE(language)&&(*loc==delim))
2925
if(++id_loc<=mod_end)*id_loc= c;
2931
(C_LIKE(language)||(is_FORTRAN_(language)&&free_form_input)))
2932
if(loc>=limit)continue;
2933
else if(++id_loc<=mod_end)
2935
*id_loc= c;c= *loc++;
2939
if(++id_loc<=mod_end)*id_loc= c;
2945
else if(++kount>=NBREAK&&c!=0100&&++id_loc<=mod_end)
2948
*id_loc= discretionary_break;
2957
printf("\n! String too long: ");
2959
ASCII_write(mod_text+1,25);
2968
if(FORTRAN_LIKE(language))
2975
*id_first= BINARY_CODE;
2979
*id_first= OCTAL_CODE;
2983
*id_first= HEX_CODE;
2995
if(*loc==0130||*loc==0170)
2997
*id_first= HEX_CODE;
3006
else if(*loc==0117||*loc==0157)
3008
*id_first= OCTAL_CODE;
3030
get_control_code(VOID)
3039
if((c==057&&(*loc==052||*loc==057))||
3040
c==(ASCII)begin_comment0||c==(ASCII)begin_comment1)
3041
return GOTO_MISTAKE;
3043
if(c==076&&mod_level==0)
3046
err0_print(ERR_W,OC("Unmatched `@>' ignored"),0);
3050
switch(cc= ccode[c])
3061
if(mark_defined.generic_name)
3064
defd_type= GENERIC_NAME;
3068
xref_switch= def_flag;
3071
case implicit_reserved:
3072
if(mark_defined.imp_reserved_name)
3074
typd_switch= defd_switch= YES;
3075
defd_type= IMPLICIT_RESERVED;
3076
xref_switch= def_flag;
3080
case switch_math_flag:math_flag= !math_flag;
3084
case trace:tracing= c-060;
3118
Cpp= BOOLEAN(*loc==053);
3129
Fortran88= BOOLEAN(*loc==071);
3146
err0_print(ERR_C,OC("! Invalid language command `@L%c' ignored"),1,XCHR(l));
3158
global_params= params;
3163
if(Fortran88&&(auto_semi&&!free_Fortran))
3174
return begin_language;
3179
err0_print(ERR_W,OC("@N ignored; must appear before beginning of code part"),0);
3182
case xref_roman:case xref_wildcard:case xref_typewriter:
3183
case TeX_string:case keyword_name:
3186
cc= ccode[*(loc-1)];
3187
id_first= loc;*(limit+1)= 0100;
3197
err0_print(ERR_W,OC("Control text didn't end"),0);
3205
err0_print(ERR_W,OC("Control codes are forbidden in control text"),0);
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";
3232
if(loc>limit&&!get_line())
3235
err0_print(ERR_W,OC("Input ended in section name"),0);
3237
loc= cur_buffer+1;break;
3254
else if(c==074)mod_level++;
3256
if(ccode[c]==new_module)
3259
err0_print(ERR_W,OC("Section name didn't end"),0);break;
3276
c= 040;if(*(k-1)==040)k--;
3290
printf("\n! Section name too long: ");
3292
ASCII_write(mod_text+1,25);
3297
if(*k==040&&k>mod_text)
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);
3308
cur_module= mod_lookup(bad_mod_name,bad_mod_name+STRLEN(bad_mod_name)-1);
3312
params= cur_module->mod_info->params;
3326
case new_output_file:
3329
while(*loc==' '||*loc==tab_mark)
3332
if(loc>limit)return ignore;
3336
while(*loc!=' '&&*loc!=tab_mark)loc++;
3338
if(*id_first=='"')id_first++;
3339
if(*(id_loc-1)=='"')id_loc--;
3340
if(id_loc-id_first>=MAX_FILE_NAME_LENGTH)
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;
3352
case invisible_cmnt:
3354
eat_blank_lines= YES;
3358
case Compiler_Directive:
3361
return begin_comment;
3367
*(limit+1)= 0100;*(limit+2)= 076;
3369
while(*loc!=0100||*(loc+1)!=076)loc++;
3372
err0_print(ERR_W,OC("Verbatim string didn't end"),0);
3375
id_loc= loc;loc+= 2;
3382
case ascii_constant:return get_string(c,'\0');
3384
case big_line_break:
3395
while(isAlpha(*loc))
3398
if((mcode= is_mcmd(mcmds,id_first,loc))!=0)
3400
while(loc<limit&&(*loc==040||*loc==tab_mark))
3420
case USED_BY_NEITHER:
3423
err0_print(ERR_W,OC("Invalid `@%c' ignored"),1,XCHR(c));
3442
LANGUAGE language0= language;
3448
reading(web_file_name,(boolean)(tex_file==stdout));
3457
chk_override(language0);
3459
global_params= params;
3461
while(!input_has_ended)
3466
if(++module_count==(sixteen_bits)max_modules)
3467
OVERFLW("section numbers","m");
3469
chngd_module[module_count]= NO;
3474
params= global_params;
3485
switch(next_control= skip_TeX())
3513
Cpp= BOOLEAN(*loc==053);
3524
Fortran88= BOOLEAN(*loc==071);
3541
err0_print(ERR_C,OC("! Invalid language command `@L%c' ignored"),1,XCHR(l));
3553
global_params= params;
3558
if(Fortran88&&(auto_semi&&!free_Fortran))
3573
nuweb_mode= !NUWEB_MODE;
3579
static int outer_include_depth;
3585
flush_buffer(out_ptr,NO);
3587
outer_include_depth= incl_depth;
3590
else if(incl_depth<=outer_include_depth)
3600
xref_switch= def_flag;
3604
case trace:tracing= next_control-060;continue;
3608
while(next_control<=module_name)
3612
if(next_control==0174||next_control==new_module)
3615
next_control= get_next();
3617
if(next_control==0174)
3623
case xref_roman:case xref_wildcard:case xref_typewriter:
3624
case macro_module_name:case module_name:
3626
loc-= 2;next_control= get_next();
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)));
3634
case invisible_cmnt:
3639
if(next_control>=formatt)
3647
boolean no_xref0= no_xref;
3649
the_part= DEFINITION;
3651
while(next_control<begin_code)
3654
switch(next_control)
3656
case WEB_definition:
3657
if(mark_defined.WEB_macro&&lower_case_code)
3660
xref_switch= def_flag;
3673
if(mark_defined.outer_macro&&mark_defined.outer_macro)
3676
xref_switch= def_flag;
3679
KILL_XREFS(outer_macros);
3684
KILL_XREFS(outer_macros);
3694
switch(next_control)
3703
LANGUAGE language0= language;
3712
if((next_control= get_next())!=stringg)
3714
err0_print(ERR_W,OC("String must follow @l"),0);
3717
for(id_first++,id_loc--;id_first<id_loc;)
3721
if(*(id_first+1)==0100)
3725
err0_print(ERR_W,OC("Double @ should be used in strings"),0);
3735
(CONST ASCII HUGE*HUGE*)&id_first))
3738
app_tok(*id_first++);
3747
language= language0;
3756
OPERATOR HUGE*p,HUGE*p1;
3761
next_control= get_next();
3763
if(next_control==identifier)
3765
err0_print(ERR_W,OC("For future compatibility, please use syntax `.NAME.' for \
3766
overloading dot operators"),0);
3768
if(!(p= valid_op(next_control)))
3770
err0_print(ERR_W,OC("Operator after @v is invalid"),0);
3773
if(get_next()!=stringg)
3775
err0_print(ERR_W,OC("Second argument (replacement text) \
3776
of @v must be a quoted string"),0);
3779
int k= language_num;
3780
OP_INFO HUGE*q= p->info+k;
3781
int n= PTR_DIFF(int,id_loc,id_first)-2;
3785
if(q->defn)FREE_MEM(q->defn,"q->defn",STRLEN(q->defn)+1,
3787
q->defn= GET_MEM("q->defn",n+1,outer_char);
3791
for(s= q->defn,id_first++;*id_first;s++)
3795
*s= XCHR(esc_achar((CONST ASCII HUGE
3798
else*s= XCHR(*id_first++);
3800
overloaded[k]= q->overloaded= YES;
3803
for(p1= op;p1<op_ptr;p1++)
3805
if(p1==p||!p1->op_name)continue;
3807
if(STRCMP(p1->op_name,p->op_name)==0)
3809
OP_INFO HUGE*q1= p1->info+k;
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;
3821
p= valid_op(next_control= get_next());
3823
q->cat= (p?p->info[k].cat:(eight_bits)expr);
3834
if((next_control= get_next())!=identifier)
3836
err0_print(ERR_W,OC("Identifier must follow @w"),0);
3839
name_pointer p= id_lookup(id_first,id_loc,normal);
3843
ASCII HUGE*id_first0,HUGE*id_loc0;
3849
new_xref(DEFINITION,p);
3852
id_first0= id_first;
3855
switch(next_control= get_next())
3858
if((next_control= get_next())!=identifier)
3861
err0_print(ERR_W,OC("Identifier must follow '\\'"),0);
3865
next_control= ignore;
3871
id_first= id_first0;
3876
n= PTR_DIFF(int,id_loc,id_first)+1;
3878
goto fmt_like_string;
3883
n= PTR_DIFF(int,id_loc,id_first)-2;
3888
p->wv_macro= w= GET_MEM("wv_macro",1,WV_MACRO);
3889
w->text= GET_MEM("w->text",n+1,outer_char);
3891
if(offset)*w->text= 0134;
3893
for(s= w->text+offset;*id_first;s++)
3897
*s= esc_achar((CONST ASCII HUGE
3900
else*s= *id_first++;
3902
w->len= PTR_DIFF(unsigned,s,w->text);
3904
w->cat= (eight_bits)(upper_case_code?0:expr);
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);
3920
case invisible_cmnt:
3924
next_control= get_next();
3928
outr_xref(DEFINITION);
3938
if(next_control<=module_name)
3940
boolean beginning_module= YES;
3942
if(next_control==begin_code)
3944
boolean nuweb_mode0= nuweb_mode;
3946
unnamed_section= YES;
3948
params= global_params;
3949
nuweb_mode= nuweb_mode0;
3952
mod_xref_switch= NO;
3954
if(mark_defined.fcn_name&&lower_case_code)
3957
defd_type= FUNCTION_NAME;
3962
unnamed_section= NO;
3963
mod_xref_switch= def_flag;
3969
if(next_control==module_name&&cur_module)
3970
new_mod_xref(cur_module);
3972
if(beginning_module)
3975
next_control= get_next();
3979
if(next_control==075)
3980
if(!nuweb_mode&&((FORTRAN_LIKE(language)&&!free_form_input)
3991
beginning_module= NO;
3993
else next_control= get_next();
3997
while(next_control<=module_name)
4001
unnamed_section= NO;
4007
if(chngd_module[module_count])
4010
typd_switch= defd_switch= NO;
4015
chngd_module[module_count]= change_exists;
4020
if(mod_check(root)&&msg_level<SHORT_INFO)
4032
C_xref FCN((part0,mode0))
4034
PARSING_MODE mode0 C1("")
4036
PARAMS outer_params;
4037
PARSE_PARAMS parse_params0;
4040
parsing_mode= mode0;
4042
if(parsing_mode==INNER)
4044
outer_params= params;
4045
parse_params0= parse_params;
4048
if(language==LITERAL)
4049
if(next_control==0174)
4059
next_control= *loc++;
4065
else if(!get_line())
4068
err0_print(ERR_W,OC("Missing '|'. File ended while skipping a \
4069
verbatim scrap"),0);
4080
next_control= begin_meta;
4084
while(next_control<formatt)
4086
switch(next_control)
4088
case begin_language:
4095
confusion(OC("handle possible language switch"),OC("A language hasn't been defined yet"));
4101
if(mode0==OUTER&&!free_form_input)
4132
confusion(OC("handle possible language switch"),OC("Langage %i is invalid"),language);
4142
static int outer_include_depth;
4148
flush_buffer(out_ptr,NO);
4150
outer_include_depth= incl_depth;
4153
else if(incl_depth<=outer_include_depth)
4163
if(language==LITERAL)
4168
if(loc>limit&&!get_line())
4170
next_control= new_module;
4204
err0_print(ERR_W,OC("Input ended during meta-comment"),0);
4208
if(loc[0]==0100&&loc[1]==051)
4221
case xref_typewriter:
4222
p= id_lookup(id_first,id_loc,
4223
(eight_bits)(next_control-identifier));
4227
boolean defd0= defd_switch;
4238
p= id_lookup(id_first,id_loc,
4239
(eight_bits)(next_control-identifier));
4243
if(part0==DEFINITION)
4247
if(C_LIKE(language)&&parsing_mode==OUTER)
4249
if(p->ilk==typedef_like)
4253
boolean typedefd_it= NO;
4256
while((next_control= get_next())==identifier)
4257
if((p= id_lookup(id_first,id_loc,0))->ilk!=struct_like)
4260
next_control= get_next();
4264
while(next_control<=module_name)
4266
switch(next_control)
4275
if(brace_level--==0)
4278
err0_print(ERR_W,OC("Extra '%c' in typedef"),1,XCHR(next_control));
4284
p= id_lookup(id_first,id_loc,0);
4286
if(brace_level==0&&!typedefd_it)
4291
defd_switch= BOOLEAN(mark_defined.typedef_name);
4292
defd_type= TYPEDEF_NAME;
4300
if(brace_level==0&&!typedefd_it)
4311
case WEB_definition:
4313
case new_output_file:
4320
if(cur_module)new_mod_xref(cur_module);
4321
next_control= get_next();
4322
if(next_control==075)
4325
err0_print(ERR_W,OC("'=' not allowed after @<...@> \
4326
inside typedef; check typedef syntax. Inserted ';'"),0);
4332
if(brace_level==0)goto done;
4340
bal= copy_comment(1);next_control= 0174;
4347
C_xref(part0,INNER);
4349
if(next_control==0174)
4350
bal= copy_comment(bal);
4360
next_control= get_next();
4364
defd_switch= typd_switch= NO;
4366
if(next_control==new_module)
4369
err0_print(ERR_W,OC("Module ended during typedef"),0);
4375
else if(p->ilk==class_like)
4378
if((next_control= get_next())==identifier)
4380
p= id_lookup(id_first,id_loc,0);
4382
defd_switch= BOOLEAN(mark_defined.typedef_name);
4383
defd_type= TYPEDEF_NAME;
4397
if(sharp_include_line&&phase==1&&read_iformats
4404
next_control= get_next();
4406
if(next_control==0174||next_control==begin_comment)
4411
if(parsing_mode==INNER)
4413
params= outer_params;
4415
parse_params= parse_params0;
4416
parsing_mode= OUTER;
4426
outer_char file_name[256];
4432
language==C?wt_style.output_ext.C_:wt_style.output_ext.Cpp_);
4434
if((ftemp_in= FOPEN(temp_in,"w"))==NULL)
4436
printf("\n! Can't open temporary file `%s'",temp_in);
4443
mktmp(temp_out,(outer_char*)"");
4447
preprocessing= sharp_include_line= NO;
4450
STRNCPY(file_name,id_first,n= PTR_DIFF(int,id_loc,id_first));
4452
to_outer((ASCII HUGE*)file_name);
4454
qtd_file= BOOLEAN(file_name[0]=='"');
4459
fprintf(ftemp_in,"#include %s\n",file_name);
4464
outer_char*temp,*temp_I;
4465
BUF_SIZE temp_len,ntemp;
4466
IN_COMMON outer_char*extra_args;
4470
IN_COMMON INCL_PATHS hdr_incl;
4473
temp_len= STRLEN(wbprefix)+hdr_incl.size+3*(hdr_incl.num+2)+1;
4476
temp_I= GET_MEM("temp_I",temp_len,outer_char);
4479
sprintf((char*)temp_I," -I%s",wbprefix);
4482
for(p= hdr_incl.list;(p1= (outer_char*)STRCHR(p,':'))!=NULL;
4486
STRCAT(temp_I," -I");
4491
STRCAT(temp_I," -I.");
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);
4499
sprintf((char*)temp,"\n%s -P%s %s -o %s %s",
4501
language==C?"gcc":"g++",
4505
extra_args?(char*)extra_args:"",
4512
system((CONST char*)temp);
4514
FREE_MEM(temp_I,"temp_I",temp_len,outer_char);
4515
FREE_MEM(temp,"temp",ntemp,outer_char);
4522
if(++incl_depth>=(int)max_include_depth)
4526
err0_print(ERR_C,OC("Too many nested includes; %d allowed. \
4527
Increase with `-yid'."),1,max_include_depth);
4533
INPUT_PRMS*p_lower= &prms[incl_depth-1];
4534
INPUT_PRMS0*p0_lower= &p_lower->change;
4536
STRCPY(change_file_name,p0_lower->File_name);
4537
change_file= p0_lower->File;
4538
change_params= p_lower->input_params;
4541
STRCPY(cur_file_name,temp_out);
4542
new_depth= incl_depth;
4545
IN_COMMON INCL_PATHS incl;
4548
if(ini_input_prms(CUR_FILE,incl.list,NO))
4550
if(cur_prms.change->File!=prms[incl_depth-1].change.File)
4552
else*cur_prms.change= prms[incl_depth-1].change;
4559
CLR_PRINTF(SHORT_INFO,include_file,(" (%s",file_name));
4571
if(new_depth!=incl_depth||!get_line())
4577
next_control= get_next();
4581
while(new_depth==incl_depth)
4585
switch(next_control)
4588
p= id_lookup(id_first,id_loc,
4589
(eight_bits)(next_control-identifier));
4591
if(p->ilk==typedef_like)
4595
boolean typedefd_it= NO;
4598
while((next_control= get_next())==identifier)
4599
if((p= id_lookup(id_first,id_loc,0))->ilk!=struct_like)
4602
next_control= get_next();
4606
while(next_control<=module_name)
4608
switch(next_control)
4617
if(brace_level--==0)
4620
err0_print(ERR_W,OC("Extra '%c' in typedef"),1,XCHR(next_control));
4626
p= id_lookup(id_first,id_loc,0);
4628
if(brace_level==0&&!typedefd_it)
4633
defd_switch= BOOLEAN(mark_defined.typedef_name);
4634
defd_type= TYPEDEF_NAME;
4642
if(brace_level==0&&!typedefd_it)
4653
case WEB_definition:
4655
case new_output_file:
4662
if(cur_module)new_mod_xref(cur_module);
4663
next_control= get_next();
4664
if(next_control==075)
4667
err0_print(ERR_W,OC("'=' not allowed after @<...@> \
4668
inside typedef; check typedef syntax. Inserted ';'"),0);
4674
if(brace_level==0)goto done;
4682
bal= copy_comment(1);next_control= 0174;
4689
C_xref(part0,INNER);
4691
if(next_control==0174)
4692
bal= copy_comment(bal);
4702
next_control= get_next();
4706
defd_switch= typd_switch= NO;
4708
if(next_control==new_module)
4711
err0_print(ERR_W,OC("Module ended during typedef"),0);
4717
else if(p->ilk==class_like)
4720
if((next_control= get_next())==identifier)
4722
p= id_lookup(id_first,id_loc,0);
4724
defd_switch= BOOLEAN(mark_defined.typedef_name);
4725
defd_type= TYPEDEF_NAME;
4739
next_control= get_next();
4744
preprocessing= sharp_include_line= YES;
4752
if(read_iformats&&rmv_files)
4754
remove((CONST char*)temp_in);
4755
remove((CONST char*)temp_out);
4762
mktmp FCN((file_name,ext))
4763
outer_char*file_name C0("")
4764
outer_char*ext C1("")
4769
extern char*tempnam();
4772
STRCPY(wbprefix,"./");
4774
buffer= (outer_char*)tempnam((char*)wbprefix,"FTMP");
4777
buffer= (outer_char*)tmpnam(NULL);
4780
STRCPY(file_name,buffer);
4784
STRCAT(file_name,".");
4785
STRCAT(file_name,ext);
4794
cant_do FCN((the_part))
4795
outer_char*the_part C1("")
4798
err0_print(ERR_W,OC("You can't do that inside %s text"),1,the_part);
4804
outr_xref FCN((part0))
4807
while(next_control<formatt)
4808
if(next_control!=begin_comment)
4809
C_xref(part0,OUTER);
4815
bal= copy_comment(1);next_control= 0174;
4822
C_xref(part0,INNER);
4824
if(next_control==0174)
4825
bal= copy_comment(bal);
4837
pr_format FCN((xref_lhs,xref_rhs))
4838
boolean xref_lhs C0("")
4839
boolean xref_rhs C1("")
4841
eight_bits last_control,rhs_ilk;
4842
LANGUAGE saved_language= language;
4845
KILL_XREFS(Formats);
4847
KILL_XREFS(formats);
4854
last_control= next_control= get_next();
4857
if(next_control==identifier||next_control==module_name)
4860
if(next_control==identifier)
4862
lhs= id_lookup(id_first,id_loc,normal);
4866
new_xref(DEFINITION,lhs);
4871
next_control= get_next();
4873
if(next_control==identifier)
4875
rhs= id_lookup(id_first,id_loc,normal);
4879
if(last_control==identifier)
4886
#define RST_BIT(field) lhs->field = BOOLEAN(lhs->field & ~(boolean)language)\
4887
| (rhs->field & (boolean)language)
4889
RST_BIT(reserved_word);
4891
RST_BIT(intrinsic_word);
4899
lhs->mod_ilk= rhs->ilk;
4910
new_xref(DEFINITION,rhs);
4915
next_control= get_next();
4920
else if(next_control==0140)
4923
if((next_control= get_TeX())!=constant)
4925
err0_print(ERR_W,OC("Invalid @f command: \
4926
One of the representations `a, `\\a, or `^^M is required"),0);
4931
next_control= get_next();
4933
if(next_control!=constant)
4934
err0_print(ERR_W,OC("Invalid category code"),0);
4939
TERMINATE(id_loc,0);
4940
cat= (TeX_CATEGORY)ATOI(id_first);
4943
if((int)cat<0||(int)cat>15)
4945
err0_print(ERR_W,OC("Category code must be between 0 and 15"),0);
4948
next_control= get_next();
4955
if(saved_language==TEX)
4956
language= saved_language;
4967
err0_print(ERR_W,OC("@f line ends prematurely"),0);
4971
id_first= id_loc= mod_text+1;
4973
if(*loc==0134)*id_loc++= *loc++;
4974
else if(*loc==0136&&*(loc+1)==0136)
4976
*id_loc++= *loc++;*id_loc++= *loc++;
4980
if(*(loc+1)==0100)loc++;
4982
err0_print(ERR_W,OC("You should say `@@"),0);
4987
id_first= esc_buf(id_loc+1,mod_end,id_first,YES);
5000
while(*id_first==0134)id_first++;
5002
if(*id_first==0136&&*(id_first+1)==0136)
5017
name_pointer p C1("Print anomalies in subtree |p|.")
5023
int never_defined:1,never_used:1,multiple_uses:1;
5026
anomalies.never_defined= anomalies.never_used= anomalies.multiple_uses= NO;
5032
status|= mod_check(p->llink);
5034
cur_xref= (xref_pointer)p->xref;
5036
if(cur_xref->num<def_flag)
5037
anomalies.never_defined= YES;
5039
while(cur_xref->num>=def_flag)
5040
cur_xref= cur_xref->xlink;
5043
anomalies.never_used= YES;
5045
n_uses= p->mod_info->params.uses;
5048
anomalies.multiple_uses= YES;
5050
if(anomalies.never_defined||anomalies.never_used
5051
||anomalies.multiple_uses)
5053
boolean warning_printed= NO;
5057
if(anomalies.never_defined)
5060
warning_printed= mod_warn(p,OC("never defined"));
5065
if(anomalies.never_used&&IS_ON(mod_warning_flag,NEVER_USED))
5070
warning_printed= mod_warn(p,OC("never used"));
5074
if(anomalies.multiple_uses
5075
&&IS_ON(mod_warning_flag,MULTIPLE_USES))
5082
= mod_warn(p,OC("multiple uses"));
5084
printf(" (%i)",n_uses);
5091
printf("."),fflush(stdout);
5092
status= warning_printed;
5096
status|= mod_check(p->rlink);
5104
mod_warn FCN((p,msg))
5105
name_pointer p C0("")
5106
outer_char*msg C1("")
5108
printf("\n%c! ",beep(1));
5113
set_color(color0.last);
5123
flush_buffer FCN((b,per_cent))
5125
boolean per_cent C1("Outputs from |out_buf+1| to |b|, \
5126
where |b<=out_ptr|.")
5129
ASCII HUGE*out_start;
5133
out_start= out_buf+1;
5138
while(j>out_buf&&*j==040)
5141
ASCII_LINE_WRITE(j-out_buf);
5156
STRNCPY(out_start,b+1,PTR_DIFF(size_t,out_ptr,b));
5159
out_ptr-= b-out_start+1;
5173
flush_buffer(out_ptr,NO);
5177
for(k= cur_buffer;k<=limit;k++)
5178
if(*k!=040&&*k!=tab_mark)
5181
flush_buffer(out_buf,NO);
5188
out_del_tokens FCN((s,t))
5189
token_pointer s C0("")
5190
token_pointer t C1("")
5200
out_del_str FCN((s,t))
5213
CONST outer_char HUGE*s C1("")
5226
CONST outer_char HUGE*s C1("File name to be written.")
5240
case 0134:case 0173:case 0175
5244
case 040:case 043:case 045:case 044:case 0136:case 0140:
5245
case 0176:case 046:case 0137
5261
CONST ASCII HUGE*s C1("ASCII text to be written.")
5271
case 0134:case 0173:case 0175
5275
case 040:case 043:case 045:case 044:case 0136:case 0140:
5276
case 0176:case 046:case 0137
5293
ASCII HUGE*k= out_ptr;
5294
boolean is_tex_comment= BOOLEAN(*(out_buf+1)==045);
5303
printf("\n! Line had to be broken (output l. %u):\n",out_line);
5305
ASCII_write(out_buf+1,out_ptr-out_buf-1);
5308
flush_buffer(out_ptr-1,YES);
5314
if(STRNCMP(k,"\\WEM ",4)==0)
5316
flush_buffer(k+= 4,NO);
5322
flush_buffer(++k,NO);
5333
printf("\n! Line had to be broken (output l. %u):\n",out_line);
5335
ASCII_write(out_buf+1,out_ptr-out_buf-1);
5338
flush_buffer(out_ptr-1,YES);
5350
if(*k==012&&k[-1]!=012)
5357
if(*(k--)==0134&&*k!=0134&&*k!=012)
5359
flush_buffer(k,YES);
5371
out_mod FCN((n,encap))
5372
sixteen_bits n C0("Module number.")
5373
boolean encap C1("Encapsulate?")
5378
sprintf(s,"%s%s%u%s",
5379
(char*)w_style.indx.encap_prefix,
5380
(char*)w_style.indx.encap_infix
5382
,(char*)w_style.indx.encap_suffix);
5391
if(makeindex&&phase==3)
5394
fprintf(mx_file,"%c%u%c",
5395
(char)w_style.indx.m_arg_open
5397
,(char)w_style.indx.m_arg_close);
5399
fprintf(mx_file,"%u",n);
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.")
5412
ASCII HUGE*k,HUGE*k_end= (p+1)->byte_start;
5413
boolean multi_char,non_TeX_macro;
5414
sixteen_bits mod_defined;
5419
multi_char= BOOLEAN(k_end-p->byte_start>1);
5421
if(multi_char&&surround)
5424
non_TeX_macro= BOOLEAN(is_id&&*p->byte_start==0134&&language!=TEX);
5430
for(k= p->byte_start;k<k_end;k++)
5436
case 0173:case 0175:
5445
case 040:case 043:case 045:case 044:case 0136:case 0140:
5446
case 0176:case 046:case 0137
5458
if(multi_char&&surround)
5461
if(m_temp&&makeindex)
5463
int n= out_ptr+1-m_start;
5465
STRNCPY(m_temp,m_start,n);
5472
WV_MACRO HUGE*w= p->wv_macro;
5473
ASCII HUGE*s= w->text;
5486
if(subscript_fcns&&(mod_defined= p->defined_in(language)))
5491
OUT_STR("\\protect");
5493
sprintf(temp,"\\WIN%d{%d}",DEFINED_TYPE(p),
5494
mod_defined==module_count?0:mod_defined);
5502
#if(part == 0 || part == 2)
5516
for(k= 0;k<NUM_LANGUAGES;k++)
5519
flush_buffer(out_ptr,NO);
5523
for(k= 0;k<NUM_LANGUAGES;k++)
5526
flush_buffer(out_ptr,NO);
5528
OUT_STR("% --- Overloaded operator definitions from @v for '");
5529
OUT_STR(lang_codes[k]);
5531
flush_buffer(out_ptr,NO);
5533
for(p= op;p<op_ptr;p++)
5535
OP_INFO HUGE*q= p->info+k;
5540
#define TEMP_LEN 1000
5542
outer_char temp[TEMP_LEN],outer_op_name[100];
5550
OUT_STR("binop");break;
5553
OUT_STR("unop");break;
5556
OUT_STR("op");break;
5559
STRCPY(outer_op_name,p->op_name);to_outer((ASCII*)outer_op_name);
5562
nsprintf(temp,OC("{%s}{%s}{%s} "),3,outer_op_name,lang_codes[k],q->defn)>=(int)(TEMP_LEN))OVERFLW("temp","");
5571
flush_buffer(out_ptr,NO);
5578
text_pointer t= tok_start+1;
5581
if(*w_style.misc.limbo_begin)
5583
flush_buffer(out_ptr,NO);
5584
OUT_STR("% --- Limbo text from style-file parameter `limbo.begin' ---");
5586
OUT_STR(w_style.misc.limbo_begin);
5587
flush_buffer(out_ptr,NO);
5594
flush_buffer(out_ptr,NO);
5595
OUT_STR("% --- Limbo text from @l ---");
5600
for(;t<text_ptr;t++)
5602
out_del_tokens(*t,*(t+1));
5603
flush_buffer(out_ptr,NO);
5609
tok_start[0]= tok_start[1]= tok_ptr;
5610
text_ptr= tok_start+1;
5618
OUT_STR("\n% --- Beginning of user's limbo section ---");
5619
flush_buffer(out_ptr,NO);
5623
if(loc>limit&&(fin_line(),!get_line()))
5635
if(ccode[c]==new_module)
5638
if(c!=0172&&c!=0132)
5669
Cpp= BOOLEAN(*loc==053);
5680
Fortran88= BOOLEAN(*loc==071);
5697
err0_print(ERR_C,OC("! Invalid language command `@L%c' ignored"),1,XCHR(l));
5709
global_params= params;
5714
if(Fortran88&&(auto_semi&&!free_Fortran))
5728
nuweb_mode= !NUWEB_MODE;
5731
global_params= params;
5740
case invisible_cmnt:
5752
ASCII*id_start,*id_end;
5756
while(IS_WHITE(*id_first))
5759
while(IS_WHITE(id_loc[-1]))
5765
id_start= id_end= mod_text+1;
5767
x_keyword(&id_end,mod_end,id_first,id_loc,NO,NO,
5768
upper_case_code?WEB_FILE:CUR_FILE);
5770
out_del_str(id_start,id_end);
5778
err0_print(ERR_W,OC("Double @ required \
5779
outside of sections"),0);
5787
if(*w_style.misc.limbo_end)
5789
flush_buffer(out_ptr,NO);
5790
OUT_STR("% --- Limbo text from style-file parameter `limbo.end' ---");
5792
OUT_STR(w_style.misc.limbo_end);
5793
flush_buffer(out_ptr,NO);
5814
for(b= out_buf+1;b<=out_ptr;b++)
5832
while((c= *(loc++))!=0174&&c!=0100)
5834
if(c==interior_semi)
5839
if(out_ptr==out_buf+1&&(c==040
5863
for(b= out_buf+1;b<=out_ptr;b++)
5875
if((cc= ccode[*(loc++)])!=big_line_break)
5888
while(isAlpha(*loc))
5891
if((mcode= is_mcmd(mcmds,id_first,loc))!=0)
5893
while(loc<limit&&(*loc==040||*loc==tab_mark))
5912
DUMMY_RETURN(ignore);
5918
copy_comment FCN((bal))
5919
int bal C1("Brace balance.")
5923
token_pointer tok_ptr0= tok_ptr;
5927
terminator[0]= *limit;terminator[1]= *(limit+1);
5946
if(!(long_comment||language==TEX))
5948
if((auto_semi&&!free_Fortran)&&*(tok_ptr-2)==073
5949
&&*(tok_ptr-1)==040)
5953
while(*(tok_ptr-1)==040)
5957
if(*(tok_ptr-1)==0134&&*(tok_ptr-2)!=0134)
5961
if(*(tok_ptr-2)==052&&*(tok_ptr-1)==057)
5974
for(t= tok_ptr-1;t>tok_ptr0;t--)
5977
if(t==tok_ptr0&&*(t-4)==0134&&*(t-3)==0127&&*(t-2)==0103&&
5979
*(tok_ptr0-2)= 0170;
5992
err0_print(ERR_W,OC("Braces don't balance in comment"),0);
5998
while(bal-->0)app_tok(0175);
6014
err0_print(ERR_W,OC("Input ended in mid-comment"),0);
6020
while(bal-->0)app_tok(0175);
6043
for(t= tok_ptr-1;t>tok_ptr0;t--)
6046
if(t==tok_ptr0&&*(t-4)==0134&&*(t-3)==0127&&*(t-2)==0103&&
6048
*(tok_ptr0-2)= 0170;
6061
err0_print(ERR_W,OC("Braces don't balance in comment"),0);
6067
while(bal-->0)app_tok(0175);
6078
for(;loc<=limit;loc++)
6079
if(*loc!=040&&*loc!=tab_mark)break;
6081
if(loc>limit)continue;
6083
if(TeX[*loc]==TeX_comment)loc++;
6097
for(t= tok_ptr-1;t>tok_ptr0;t--)
6100
if(t==tok_ptr0&&*(t-4)==0134&&*(t-3)==0127&&*(t-2)==0103&&
6102
*(tok_ptr0-2)= 0170;
6115
err0_print(ERR_W,OC("Braces don't balance in comment"),0);
6121
while(bal-->0)app_tok(0175);
6146
if(c==052&&*loc==057&&long_comment)
6160
for(t= tok_ptr-1;t>tok_ptr0;t--)
6163
if(t==tok_ptr0&&*(t-4)==0134&&*(t-3)==0127&&*(t-2)==0103&&
6165
*(tok_ptr0-2)= 0170;
6178
err0_print(ERR_W,OC("Braces don't balance in comment"),0);
6184
while(bal-->0)app_tok(0175);
6231
case 0134:case 0173:case 0175
6235
case 040:case 043:case 045:case 044:case 0136:case 0140:
6236
case 0176:case 046:case 0137
6257
err0_print(ERR_W,OC("Illegal use of @ in comment"),0);
6268
while(bal-->0)app_tok(0175);
6277
else if(c==0134&&*loc!=0100&&phase==2)
6290
*limit= terminator[0];*(limit+1)= terminator[1];
6292
if(!long_comment&&*limit==0100&&loc>limit)
6302
C_parse FCN((mode0))
6303
PARSING_MODE mode0 C1("")
6306
LANGUAGE language0= language;
6307
PARSE_PARAMS parse_params0;
6309
parse_params0= parse_params;
6311
parsing_mode= mode0;
6314
if(parsing_mode==INNER)
6320
while(next_control<formatt)
6322
if(nuweb_mode&&parsing_mode==INNER)
6327
if(tok_ptr==tok_m_end)
6328
OVERFLW("tokens","tw");
6334
next_control= *loc++;
6340
else if(!get_line())
6343
err0_print(ERR_W,OC("Missing '|'. File ended while appending a \
6344
verbatim scrap"),0);
6352
if(scrp_ptr==scrp_end)
6353
OVERFLW("scraps","s");
6355
app_scrap(ignore_scrap,no_math);
6368
switch(next_control)
6371
case macro_module_name:
6375
app(mod_flag+PTR_DIFF(sixteen_bits,cur_module,name_dir));
6378
app_scrap(cur_module!=NULL?cur_module->mod_ilk:expr,maybe_math);
6384
case stringg:case constant:case verbatim:
6386
if(next_control==stmt_label&&!isDigit(*id_first))
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);
6394
if(next_control==constant||next_control==stmt_label)
6397
else if(next_control==stringg)
6400
APP_STR(pfrmt->typewritr);
6406
else APP_STR("\\={");
6414
while(id_first<id_loc)
6418
case 054:*id_first= 061;app(0134);break;
6420
case ordinary_space:
6421
*id_first= 062;app(0134);break;
6424
*id_first= 063;app(0134);break;
6426
case discretionary_break:*id_first= 060;
6432
case 0134:case 0173:case 0175
6436
case 040:case 043:case 045:case 044:case 0136:case 0140:
6437
case 0176:case 046:case 0137
6444
case 0100:if(*(id_first+1)==0100)id_first++;
6446
err0_print(ERR_W,OC("Double %s@%s should be used in strings"),2,SSET_COLOR(character),SSET_COLOR(error));
6450
app_tok(*id_first++);
6461
if(next_control==stmt_label)
6462
{app_scrap(label,no_math);}
6464
{app_scrap(expr,yes_math);}
6470
case begin_format_stmt:in_format= YES;
6473
p= id_lookup(id_first,id_loc,normal);
6478
WV_MACRO HUGE*w= p->wv_macro;
6479
ASCII HUGE*s= w->text;
6493
app_scrap(p->ilk?p->ilk:expr,w->cat?maybe_math:yes_math);
6495
else if((p->reserved_word&(boolean)language)&&the_type!=ORDINARY_ID
6496
||the_type==RESERVED_WD)
6500
app(res_flag+PTR_DIFF(sixteen_bits,p,name_dir));
6502
the_ilk= (the_type==RESERVED_WD)?int_like:p->ilk;
6504
app_scrap(the_ilk==normal?expr:the_ilk,
6505
the_ilk<max_math?yes_math:maybe_math);
6513
APP_STR("\\WKINDCHAR");
6516
app(id_flag+PTR_DIFF(sixteen_bits,p,name_dir));
6517
app_scrap(expr,upcoming_kind?yes_math:maybe_math);
6529
APP_STR("\\hbox{");while(id_first<id_loc)app_tok(*id_first++);
6530
app(0175);app_scrap(expr,maybe_math);
6533
case begin_language:
6539
confusion(OC("append scraps for begin_language"),OC("A language hasn't been defined yet"));
6544
column_mode= NO;break;
6550
if(mode0==OUTER&&!free_form_input)
6574
confusion(OC("append scraps for begin_language"),OC("Language %i is invalid"),language);
6577
set_language(language);
6582
case new_output_file:
6584
APP_STR(upper_case_code?"\\WOut{":"\\Wout{");
6590
was_opened(id_first,upper_case_code,¶ms.OUTPUT_FILE_NAME,NULL);
6593
was_opened(id_first,upper_case_code,
6594
&global_params.OUTPUT_FILE_NAME,NULL);
6597
id_first= esc_buf(mod_text+1,mod_end,id_first,YES);
6600
app_tok(*id_first++);
6606
app_scrap(ignore_scrap,no_math);
6610
next_control= begin_meta;
6620
static int outer_include_depth;
6626
flush_buffer(out_ptr,NO);
6628
outer_include_depth= incl_depth;
6631
else if(incl_depth<=outer_include_depth)
6640
if(output_on)app(Turn_output_on);
6644
app(Turn_output_off);
6647
app_scrap(ignore_scrap,no_math);
6654
case macro_space:app(040);app_scrap(space,maybe_math);break;
6656
case macro_space:app_scrap(ignore_scrap,maybe_math);break;
6662
app_scrap(ignore_scrap,no_math);
6668
app_scrap(ignore_scrap,no_math);
6673
app_scrap(newline,maybe_math);
6680
app_scrap(expr,no_math);
6684
app(0173);app(next_control);app(0175);
6685
app_scrap(slash_like,maybe_math);
6694
app(next_control);app_scrap(binop,yes_math);break;
6708
app_overload();break;
6712
app_overload();break;
6732
app_scrap(expr,maybe_math);
6735
case ignore:case xref_roman:case xref_wildcard:
6736
case xref_typewriter:break;
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)
6744
app_scrap(ignore_scrap,no_math);
6749
case 0133:app(next_control);app_scrap(lbracket,yes_math);break;
6750
case 0135:app(next_control);app_scrap(rbracket,yes_math);break;
6752
case 0173:APP_STR("\\{");app_scrap(lbrace,yes_math);break;
6753
case 0175:APP_STR("\\}");app_scrap(rbrace,yes_math);break;
6755
case 054:app(054);app_scrap(comma,yes_math);break;
6760
app_scrap(semi,maybe_math);
6763
case end_format_stmt:
6770
if(!is_FORTRAN_(language)||prn_semis)
6773
app_scrap(semi,maybe_math);
6778
app_scrap(colon,maybe_math);
6782
APP_STR("\\WLQx");app_scrap(expr,maybe_math);
6793
next_control= identifier;
6794
id_first= dot_op.name+1;
6795
id_loc= id_first+STRLEN(id_first);
6799
case eq_gt:APP_STR("\\WPtr");app_scrap(binop,yes_math);
6804
if(C_LIKE(language))
6808
app_scrap(int_like,maybe_math);
6810
else app_overload();
6827
case compound_assignment:
6828
app_overload();break;
6830
case paste:APP_STR("\\WNN");app_scrap(ignore_scrap,maybe_math);
6834
case dont_expand:APP_STR("\\WNP");
6835
app_scrap(ignore_scrap,maybe_math);
6839
case auto_label:APP_STR("\\WNC");
6840
app_scrap(ignore_scrap,maybe_math);
6844
case all_variable_args:
6846
app_scrap(expr,maybe_math);
6851
if(C_LIKE(language))
6855
app_scrap(unop,yes_math);
6861
app_scrap(binop,yes_math);
6868
app_scrap(lpar,yes_math);
6874
app_scrap(rpar,yes_math);
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;
6884
app(opt);APP_STR("0");
6885
app_scrap(ignore_scrap,yes_math);
6890
app_scrap(ignore_scrap,no_math);
6893
case ln_break_outdent:
6900
app_scrap(ignore_scrap,no_math);
6905
if(parsing_mode==OUTER)
6907
app_scrap(lproc,no_math);
6913
app_scrap(rproc,no_math);
6918
APP_STR("\\WTLD");app_scrap(expr,maybe_math);break;
6927
APP_STR(w_style.misc.meta.code.begin);
6946
switch(ccode[*(loc+1)])
6953
if(!nuweb_mode&&((FORTRAN_LIKE(language)&&!free_form_input)
6967
case invisible_cmnt:
6969
eat_blank_lines= YES;
6976
eat_blank_lines= NO;
6989
if(loc[2]==052||loc[2]==057)
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:
7006
case big_line_break:
7023
APP_STR(w_style.misc.meta.code.end);
7029
app_scrap(ignore_scrap,no_math);
7037
if(!nuweb_mode&&((FORTRAN_LIKE(language)&&!free_form_input)
7049
APP_STR(w_style.misc.meta.code.end);
7051
app_scrap(ignore_scrap,no_math);
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;
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;
7066
case join:APP_STR("\\WJ");app_scrap(ignore_scrap,no_math);break;
7076
app_scrap(kill_newlines,yes_math);
7081
app(060+upper_case_code);
7086
while(IS_WHITE(*id_first))
7089
while(IS_WHITE(id_loc[-1]))
7095
app_ASCII_str(id_first);
7099
app_scrap(expr,yes_math);
7103
the_type= ORDINARY_ID;
7107
the_type= RESERVED_WD;
7112
default:app(next_control);app_scrap(ignore_scrap,maybe_math);break;
7117
next_control= get_next();
7120
if(next_control==0174||next_control==begin_comment)
7124
if(next_control==begin_language&&!ok_to_define
7125
&&parsing_mode==OUTER)
7130
if(language!=language0)
7132
app_tok(begin_language);
7133
app(lan_num(language0));
7134
app_scrap(ignore_scrap,no_math);
7137
if(parsing_mode==INNER)
7138
parse_params= parse_params0;
7144
set_language FCN((language0))
7145
LANGUAGE language0 C1("")
7147
char language_line[50];
7149
language= language0;
7151
app_tok(begin_language);
7152
app(lan_num(language));
7154
if(parsing_mode==OUTER)
7156
sprintf(language_line,"\\LANGUAGE{%s}",
7157
(char*)LANGUAGE_CODE(language));
7158
APP_STR(language_line);
7162
app_scrap(language_scrap,no_math);
7171
scrap_pointer save_base;
7172
PARAMS outer_params;
7173
PARSE_PARAMS parse_params0;
7175
outer_params= params;
7176
parse_params0= parse_params;
7178
save_base= scrp_base;
7179
scrp_base= scrp_ptr+1;
7183
APP_STR("\\protect");
7185
APP_STR("\\WCD{");app_scrap(ignore_scrap,no_math);
7190
app_scrap(ignore_scrap,no_math);
7193
while(next_control<=module_name)
7197
if(next_control==0174)
7202
if(next_control<module_name)
7204
switch(next_control)
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:
7211
case WEB_definition:
7212
pre_scrap(next_control);
7220
next_control= get_next();
7222
else if(next_control==module_name)
7228
app(mod_flag+PTR_DIFF(sixteen_bits,cur_module,name_dir));
7231
app_scrap(cur_module!=NULL?cur_module->mod_ilk:expr,maybe_math);
7235
next_control= (nuweb_mode?begin_meta:get_next());
7240
if(next_control==0174)
7244
app_tok(cancel);app_scrap(ignore_scrap,maybe_math);
7251
app_scrap(semi,maybe_math);
7258
app_scrap(ignore_scrap,no_math);
7261
app(0175);app_scrap(ignore_scrap,no_math);
7263
if(next_control!=0174)
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);
7270
p= translate(INNER);
7272
if(scrp_ptr>mx_scr_ptr)
7273
mx_scr_ptr= scrp_ptr;
7275
scrp_ptr= scrp_base-1;
7276
scrp_base= save_base;
7278
params= outer_params;
7281
parse_params= parse_params0;
7294
while(next_control<formatt)
7296
if(next_control!=begin_comment)
7304
outer_char HUGE*s= t_style.cdir_start[language_num];
7305
int n= 2*STRLEN(s)+1;
7307
ASCII HUGE*temp= GET_MEM("temp_cdir",n,ASCII);
7308
ASCII HUGE*start= GET_MEM("start_cdir",n,ASCII);
7311
to_ASCII((outer_char HUGE*)start);
7316
APP_STR("\\WCDIR{");
7317
esc_buf(temp,temp+n,start,YES);APP_STR(to_outer(temp));
7319
FREE_MEM(temp,"temp_cdir",n,ASCII);
7320
FREE_MEM(start,"start_cdir",n,ASCII);
7331
if(free_Fortran&&lst_ampersand)
7335
else if(!at_beginning&&(auto_semi&&!free_Fortran))
7343
APP_STR(long_comment?"\\WC{":"\\Wc{");
7349
bal= copy_comment(1);
7350
next_control= ignore;
7352
if(doing_cdir&&bal>0)
7354
err0_print(ERR_W,OC("Can't have vertical bars in @! compiler directives"),0);
7362
p= text_ptr;freeze_text;
7366
app(tok_flag+PTR_DIFF(sixteen_bits,p,tok_start));app(inner_tok_flag+PTR_DIFF(sixteen_bits,q,tok_start));
7368
if(next_control==0174)
7370
bal= copy_comment(bal);
7371
next_control= ignore;
7377
app(force);app_scrap(ignore_scrap,no_math);
7389
text_pointer p C1("")
7391
if(stck_ptr==stck_end)OVERFLW("stack levels","kw");
7394
stck_ptr->end_field= cur_end;
7395
stck_ptr->tok_field= cur_tok;
7396
stck_ptr->mode_field= cur_mode;
7401
if(stck_ptr>mx_stck_ptr)mx_stck_ptr= stck_ptr;
7403
cur_tok= *p;cur_end= *(p+1);
7411
cur_end= (--stck_ptr)->end_field;
7412
cur_tok= stck_ptr->tok_field;cur_mode= stck_ptr->mode_field;
7421
restart:while(cur_tok==cur_end)pop_level();
7428
cur_name= a%id_flag+name_dir;
7432
case 2:return res_word;
7433
case 3:return mod_name;
7434
case 4:push_level(a%id_flag+tok_start);goto restart;
7436
case 5:push_level(a%id_flag+tok_start);cur_mode= inner;
7439
default:return identifier;
7444
return(eight_bits)a;
7452
token_pointer save_tok_ptr;
7453
text_pointer save_text_ptr;
7454
eight_bits save_next_control;
7457
save_tok_ptr= tok_ptr;save_text_ptr= text_ptr;
7458
save_next_control= next_control;
7460
next_control= ignore;p= C_translate();
7461
app(inner_tok_flag+PTR_DIFF(sixteen_bits,p,tok_start));
7466
if(text_ptr>mx_text_ptr)mx_text_ptr= text_ptr;
7467
if(tok_ptr>mx_tok_ptr)mx_tok_ptr= tok_ptr;
7469
text_ptr= save_text_ptr;tok_ptr= save_tok_ptr;
7470
next_control= save_next_control;
7479
extern outer_char wbflnm0[];
7480
IN_COMMON int num_ifiles;
7485
params= global_params;
7489
strt_off= ending_off= NO;
7490
writing(YES,tex_fname);if(tex_file==stdout)putchar('\n');
7496
IN_COMMON outer_char style_file_name[];
7498
OUT_STR("\n% --- Initialization parameters from FWEB's style file `");
7499
OUT_STR(style_file_name);
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);
7505
out_prm(OC("{%s;%s}"),2,OC("{LaTeX.class;LaTeX.package}"),w_style.misc.LaTeX.class.file,w_style.misc.LaTeX.package.file);
7507
out_prm(OC("{%s}"),3,OC("{indent.TeX}"),w_style.misc.TeXindent);
7509
out_prm(OC("{%s}"),4,OC("{indent.code}"),w_style.misc.codeindent);
7511
out_prm(OC("{%s}"),5,OC("{contents.TeX}"),w_style.contents.tex);
7513
out_prm(OC("{ %% ##6 ---\n {%s%s}"),1,OC("{{format.reserved}{format.RESERVED}}"),pfrmt->reserved,pfrmt->RESERVED);
7515
out_prm(OC(" {%s}"),2,OC("{format.short_id}"),pfrmt->short_id);
7517
out_prm(OC(" {%s%s}"),3,OC("{{format.id}{format.ID}}"),pfrmt->id,pfrmt->ID);
7519
out_prm(OC(" {%s%s}"),4,OC("{{format.outer_macro}{format.OUTER_MACRO}}"),pfrmt->id_outer,pfrmt->ID_OUTER);
7521
out_prm(OC(" {%s%s}"),5,OC("{{format.WEB_macro}{format.WEB_MACRO}}"),pfrmt->id_inner,pfrmt->ID_INNER);
7523
out_prm(OC(" {%s}"),6,OC("{format.intrinsic}"),pfrmt->intrinsic);
7525
out_prm(OC(" {%s%s}"),7,OC("{{format.keyword}{format.KEYWORD}}"),pfrmt->keyword,pfrmt->KEYWORD);
7527
out_prm(OC(" {%s}"),8,OC("{format.typewriter}"),pfrmt->typewritr);
7529
out_prm(OC(" {}"),9,OC("(For future use)"));
7531
out_prm(OC("}\n{%s}"),7,OC("{encap.prefix}"),w_style.indx.encap_prefix);
7533
out_prm(OC("{%s;%s}"),8,OC("{doc.preamble;doc.postamble}"),w_style.misc.doc_preamble,w_style.misc.doc_postamble);
7535
out_prm(OC("{%s}"),9,OC("{index.name}"),prn_index?w_style.indx.name:OC("NoIndex"));
7546
flush_buffer(out_buf,NO);
7550
while(!input_has_ended)
7556
params= global_params;
7566
if(STRCMP(last_include_file,this_include_file)!=0)
7568
STRCPY(last_include_file,this_include_file);
7569
OUT_STR("\\WIF{");out_fname(this_include_file);
7576
if(!in_module&&output_on)
7578
OUT_STR(*(loc-1)==052?"\\WN":"\\WM");
7583
out_mod(module_count,NO_ENCAP);OUT_STR(". ");
7602
if(this_module>name_dir&&output_on)
7606
first_xref= (xref_pointer)this_module->xref;
7607
this_xref= first_xref->xlink;
7609
if(this_xref->num>def_flag)
7611
mid_xref= this_xref;cur_xref= 0;
7615
next_xref= this_xref->xlink;this_xref->xlink= cur_xref;
7616
cur_xref= this_xref;this_xref= next_xref;
7618
while(this_xref->num>def_flag);
7620
first_xref->xlink= cur_xref;
7622
else mid_xref= xmem;
7626
while(this_xref!=xmem)
7628
next_xref= this_xref->xlink;this_xref->xlink= cur_xref;
7629
cur_xref= this_xref;this_xref= next_xref;
7632
if(mid_xref>xmem)mid_xref->xlink= cur_xref;
7633
else first_xref->xlink= cur_xref;
7635
cur_xref= first_xref->xlink;
7638
footnote(def_flag);footnote(0);
7644
if(in_module&&output_on)
7646
outer_char temp[500];
7650
nsprintf(temp,OC("\\fi %% End of %s"),1,MOD_TRANS(module_count))>=(int)(500))OVERFLW("temp","");
7652
OUT_STR(temp);fin_line();
7657
flush_buffer(out_buf,NO);
7670
out_prm FCN(VA_ALIST((fmt,n,cmt VA_ARGS)))
7672
CONST outer_char*fmt C0("")
7673
int n C0("Arg number")
7674
CONST outer_char*cmt C2(""))
7676
#define TEMP_LEN (MAX_FILE_NAME_LENGTH + 100)
7679
outer_char temp0[TEMP_LEN];
7680
outer_char HUGE*temp1= GET_MEM("temp1",TEMP_LEN,outer_char);
7682
#if(NUM_VA_ARGS == 1)
7683
CONST outer_char*fmt;
7684
CONST outer_char*cmt;
7687
VA_START(arg_ptr,cmt);
7689
#if(NUM_VA_ARGS == 1)
7690
fmt= va_arg(arg_ptr,outer_char*);
7691
cmt= va_arg(arg_ptr,outer_char*);
7698
vsprintf((char*)temp0,(CONST char*)fmt,arg_ptr);
7701
num_char= (int)STRLEN(temp0);
7704
if(num_char>=TEMP_LEN)
7705
OVERFLW("out_prm:temp0","");
7707
OUT_STR(xpn_name(&temp1,TEMP_LEN,temp0,wbflnm0));
7710
sprintf((char*)temp1," %% #%i --- ",n);
7711
OUT_STR(temp1);OUT_STR(cmt);
7714
FREE_MEM(temp1,"temp1",TEMP_LEN,outer_char);
7725
parsing_mode= OUTER;
7729
next_control= copy_TeX();
7731
switch(next_control)
7761
Cpp= BOOLEAN(*loc==053);
7772
Fortran88= BOOLEAN(*loc==071);
7789
err0_print(ERR_C,OC("! Invalid language command `@L%c' ignored"),1,XCHR(l));
7801
global_params= params;
7806
if(Fortran88&&(auto_semi&&!free_Fortran))
7820
nuweb_mode= !NUWEB_MODE;
7823
global_params= params;
7832
case 0174:ini_stack;output_C();break;
7842
case invisible_cmnt:loc= limit+1;break;
7845
OUT_STR(w_style.misc.meta.TeX.begin);
7849
OUT_STR(w_style.misc.meta.TeX.end);
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();
7857
if(next_control==TeX_string)
7859
err0_print(ERR_W,OC("@t (TeX string) should be in code text only"),0);
7865
loc-= 2;next_control= get_next();
7868
ASCII*id_start,*id_end;
7872
while(IS_WHITE(*id_first))
7875
while(IS_WHITE(id_loc[-1]))
7881
id_start= id_end= mod_text+1;
7883
x_keyword(&id_end,mod_end,id_first,id_loc,NO,NO,
7884
upper_case_code?WEB_FILE:CUR_FILE);
7886
out_del_str(id_start,id_end);
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:
7898
case begin_bp:case insert_bp:
7906
err0_print(ERR_W,OC("@p should be immediately followed by '|'"),0);
7908
output_protect= YES;
7911
case USED_BY_NEITHER:
7913
err0_print(ERR_W,OC("Invalid `@%c' ignored"),1,XCHR(*(loc-1)));
7917
while(next_control<formatt);
7927
boolean overload_ops0= overload_ops;
7929
the_part= DEFINITION;
7930
parsing_mode= OUTER;
7932
if(next_control<begin_code)
7934
emit_space_if_needed;save_position;
7937
if(output_on)app(Turn_output_on);
7942
app(turn_output_off);
7945
app_scrap(ignore_scrap,no_math);
7951
while(next_control<begin_code)
7954
eight_bits last_control= next_control;
7955
boolean nuweb_mode0;
7959
switch(next_control)
7962
case invisible_cmnt:
7968
if(output_on)app(Turn_output_on);
7973
app(turn_output_off);
7976
app_scrap(ignore_scrap,no_math);
7983
nuweb_mode0= nuweb_mode;
7986
switch(next_control)
7991
LANGUAGE saved_language= language;
7992
scrap_pointer scrp_ptr0;
8004
app_proc(next_control);
8005
scrp_ptr0= scrp_ptr;
8006
app_scrap(expr,maybe_math);
8013
next_control= get_next();
8015
if(next_control==identifier||next_control==module_name)
8018
if(next_control==identifier)
8021
app(mod_flag+PTR_DIFF(sixteen_bits,cur_module,name_dir));
8025
next_control= get_next();
8027
if(next_control==identifier)
8032
app_scrap(expr,maybe_math);
8033
app_scrap(semi,maybe_math);
8035
sharp_include_line= NO;
8037
next_control= get_next();
8045
else if(next_control==0140)
8050
APP_STR(pfrmt->typewritr);
8056
if((next_control= get_TeX())==constant)
8057
APP_STR((outer_char*)id_first);
8062
next_control= get_next();
8064
if(next_control==constant)
8068
while(id_first<id_loc)
8069
app_tok(*id_first++);
8075
app_scrap(expr,maybe_math);
8076
app_scrap(semi,maybe_math);
8078
sharp_include_line= NO;
8080
next_control= get_next();
8089
if(scrp_ptr!=scrp_ptr0+3)
8091
err0_print(ERR_W,OC("Improper format definition"),0);
8096
if(saved_language==TEX)
8097
language= saved_language;
8108
app_proc(next_control);
8109
app_scrap(expr,maybe_math);
8112
if((next_control= get_next())!=stringg)
8114
err0_print(ERR_W,OC("A string must follow @l"),0);
8127
app_proc(next_control);
8128
app_scrap(expr,maybe_math);
8131
if(valid_op(next_control= get_next()))
8135
switch(next_control)
8139
err0_print(ERR_W,OC("For future compatibility, please use syntax .NAME. for \
8140
overloading dot operators"),0);
8148
APP_STR(pfrmt->typewritr);
8153
app(wt_style.dot_delimiter.begin);
8154
app_ASCII_str(dot_op.name+1);
8155
app(wt_style.dot_delimiter.end);
8166
app_scrap(expr,yes_math);
8171
app(040);app_scrap(expr,no_math);
8174
if((next_control= get_next())==stringg)
8178
APP_STR(pfrmt->typewritr);
8188
while(id_first<id_loc)
8192
case 054:*id_first= 061;app(0134);break;
8194
case ordinary_space:
8195
*id_first= 062;app(0134);break;
8198
*id_first= 063;app(0134);break;
8200
case discretionary_break:*id_first= 060;
8206
case 0134:case 0173:case 0175
8210
case 040:case 043:case 045:case 044:case 0136:case 0140:
8211
case 0176:case 046:case 0137
8218
case 0100:if(*(id_first+1)==0100)id_first++;
8220
err0_print(ERR_W,OC("Double %s@%s should be used in strings"),2,SSET_COLOR(character),SSET_COLOR(error));
8224
app_tok(*id_first++);
8234
app_scrap(expr,yes_math);
8237
if(valid_op(next_control= get_next()))
8239
app(040);app_scrap(expr,no_math);
8243
switch(next_control)
8247
err0_print(ERR_W,OC("For future compatibility, please use syntax .NAME. for \
8248
overloading dot operators"),0);
8256
APP_STR(pfrmt->typewritr);
8261
app(wt_style.dot_delimiter.begin);
8262
app_ASCII_str(dot_op.name+1);
8263
app(wt_style.dot_delimiter.end);
8274
app_scrap(expr,yes_math);
8279
next_control= get_next();
8293
app_proc(next_control);
8294
app_scrap(expr,maybe_math);
8297
if((next_control= get_next())==identifier)
8299
ASCII HUGE*id_first0,HUGE*id_loc0;
8302
id_first0= id_first;
8307
app(040);app_scrap(expr,no_math);
8310
switch(next_control= get_next())
8313
if((next_control= get_next())!=identifier)break;
8317
id_first= id_first0;
8323
APP_STR(pfrmt->typewritr);
8330
app_ASCII_str(id_first);
8332
app_scrap(expr,yes_math);
8333
next_control= get_next();
8339
APP_STR(pfrmt->typewritr);
8349
while(id_first<id_loc)
8353
case 054:*id_first= 061;app(0134);break;
8355
case ordinary_space:
8356
*id_first= 062;app(0134);break;
8359
*id_first= 063;app(0134);break;
8361
case discretionary_break:*id_first= 060;
8367
case 0134:case 0173:case 0175
8371
case 040:case 043:case 045:case 044:case 0136:case 0140:
8372
case 0176:case 046:case 0137
8379
case 0100:if(*(id_first+1)==0100)id_first++;
8381
err0_print(ERR_W,OC("Double %s@%s should be used in strings"),2,SSET_COLOR(character),SSET_COLOR(error));
8385
app_tok(*id_first++);
8395
app_scrap(expr,yes_math);
8396
next_control= get_next();
8409
case invisible_cmnt:
8413
while((next_control= get_next())<formatt
8414
&&next_control!=begin_comment);
8420
LANGUAGE saved_language= language;
8422
if(next_control==definition)
8423
SUPPRESS(outer_macros);
8425
if(next_control==WEB_definition)
8428
app_proc(next_control);
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)
8439
next_control= get_next();
8441
if(!(next_control==identifier||next_control==AUTO_INSERT
8442
||next_control==MAKE_RECURSIVE
8443
||next_control==PROTECTED))
8445
IMPROPER("macro","'[', '*', '!', or identifier");
8450
if(next_control==MAKE_RECURSIVE||next_control==PROTECTED)
8453
next_control= get_next();
8459
if(next_control==0133)
8463
get_string(0133,'\0');
8465
app_ASCII_str(id_first);
8466
next_control= get_next();
8472
if(next_control!=identifier)
8473
IMPROPER("macro","identifier");
8489
next_control= get_next();
8492
switch(next_control)
8496
next_control= get_next();
8498
if(next_control==051)
8507
app(next_control);goto reswitch;
8516
if((next_control= get_next())!=051)
8519
err0_print(ERR_M,OC("Improper macro \
8520
definition: expected ')' after ellipsis"),0);
8527
next_control= get_next();break;
8531
err0_print(ERR_M,OC("Improper macro definition: \
8532
unrecognized token in argument list"),0);
8546
next_control= get_next();
8550
app_scrap(ignore_scrap,no_math);
8556
next_control= get_next();
8558
if(saved_language==TEX)
8559
language= saved_language;
8567
nuweb_mode= nuweb_mode0;
8571
if(auto_app_semi&&last_control==WEB_definition)
8572
{app_scrap(semi,maybe_math);}
8574
overload_ops= overload_ops0;
8588
boolean current_output_state= output_on;
8595
app_scrap(ignore_scrap,no_math);
8600
p= translate(OUTER);
8602
app(tok_flag+PTR_DIFF(sixteen_bits,p,tok_start));
8605
if(out_ptr>out_buf+1)
8608
if(*(out_ptr-1)==0134)
8615
else if(*out_ptr==067)
8626
OUT_STR(the_part==CODE?"\\Wendc":"\\Wendd");
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;
8642
tok_ptr= tok_mem+1;text_ptr= tok_start+1;scrp_ptr= scrp_info;
8645
if(strt_off)output_on= strt_off= ending_off= NO;
8648
strt_off= ending_off= NO;
8653
output_on= current_output_state;
8659
app_temp FCN((letter,arg))
8660
CONST outer_char letter[]C0("")
8661
CONST outer_char arg[]C1("")
8665
sprintf(temp,"\\W%s{%s}",(char*)letter,(char*)arg);
8672
app_proc FCN((next_control))
8673
eight_bits next_control C1("")
8675
if(the_part==DEFINITION)
8697
switch(next_control)
8699
case WEB_definition:
8700
APP_STR(upper_case_code?"\\WMD":"\\WMd");break;
8703
APP_LANG("Ud");break;
8706
APP_LANG(upper_case_code?"D":"d");break;
8709
APP_LANG(upper_case_code?"F":"f");break;
8712
APP_LANG("l");break;
8715
APP_LANG("v");break;
8718
APP_LANG(upper_case_code?"WW":"w");break;
8721
APP_TEMP("E","ifdef");break;
8724
APP_TEMP("E","ifndef");break;
8727
APP_TEMP("E","line");break;
8730
APP_TEMP("E","undef");break;
8733
APP_TEMP("E","if");break;
8736
APP_TEMP("E","elif");break;
8739
APP_TEMP("E","else");
8740
app_scrap(ignore_scrap,no_math);
8744
APP_TEMP("E","for");break;
8747
APP_TEMP("E","endfor");
8748
app_scrap(ignore_scrap,no_math);
8752
APP_TEMP("E","endif");
8753
app_scrap(ignore_scrap,no_math);
8763
improper FCN((m_type,msg))
8764
outer_char*m_type C0("")
8765
outer_char*msg C1("")
8768
err0_print(ERR_W,OC("Improper %s definition: expected %s"),2,m_type,msg);
8774
app_lang FCN((suffix))
8775
CONST outer_char*suffix C1("")
8777
APP_TEMP(suffix,(CONST outer_char*)(LANGUAGE_SYMBOL(language)));
8786
this_module= name_dir;
8787
parsing_mode= OUTER;
8789
if(next_control<=module_name)
8795
if(output_on)app(Turn_output_on);
8800
app(turn_output_off);
8803
app_scrap(ignore_scrap,no_math);
8815
if(next_control==begin_code)
8817
boolean nuweb_mode0= nuweb_mode;
8819
unnamed_section= YES;
8820
params= global_params;
8821
nuweb_mode= nuweb_mode0;
8826
if(!nuweb_mode&&((FORTRAN_LIKE(language)&&!free_form_input)
8837
next_control= ignore;
8843
if(Fortran88&&(auto_semi&&!free_Fortran))
8851
next_control= (nuweb_mode?begin_meta:get_next());
8866
unnamed_section= NO;
8868
if(cur_module!=NULL)
8870
params= cur_module->mod_info->params;
8873
this_module= cur_module;
8875
the_module= cur_module;
8878
LANGUAGE saved_language= language;
8885
next_control= get_next();
8886
while(next_control==053);
8888
language= saved_language;
8890
switch(next_control)
8892
case compound_assignment:
8893
if(assignment_token!=plus_eq)
8896
err0_print(ERR_W,OC("Invalid compound assignment after section \
8897
name; please use one of `=', `==', or `+='"),0);
8908
if(!nuweb_mode&&((FORTRAN_LIKE(language)&&!free_form_input)
8919
next_control= ignore;
8925
if(Fortran88&&(auto_semi&&!free_Fortran))
8933
next_control= (nuweb_mode?begin_meta:get_next());
8942
err0_print(ERR_W,OC("You need an = sign after the section name"),0);
8948
if(out_ptr>out_buf+2&&STRNCMP(out_ptr-2,"\\WY",3)==0)
8956
app(mod_flag+PTR_DIFF(sixteen_bits,this_module,name_dir));
8957
cur_xref= (xref_pointer)this_module->xref;
8960
if(cur_xref->num!=module_count+def_flag)
8964
this_module= name_dir;
8971
app_misc(w_style.misc.named_preamble);
8973
app_scrap(ignore_scrap,no_math);
8980
while(next_control<=module_name)
8985
if(next_control<module_name)
8987
switch(next_control)
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:
8994
case WEB_definition:
8995
pre_scrap(next_control);
9003
next_control= get_next();
9005
else if(next_control==module_name)
9011
app(mod_flag+PTR_DIFF(sixteen_bits,cur_module,name_dir));
9014
app_scrap(cur_module!=NULL?cur_module->mod_ilk:expr,maybe_math);
9018
next_control= (nuweb_mode?begin_meta:get_next());
9026
boolean nuweb_mode0= nuweb_mode;
9028
params= (the_module==NULL?global_params:the_module->mod_info->params);
9029
nuweb_mode= nuweb_mode0;
9035
unnamed_section= NO;
9042
app_hdr FCN((section_part))
9043
CONST char*section_part C1("Either \"code\" or \"defs\"")
9045
outer_char temp[1000],*temp_end= temp+1000,*t_first,*t_loc;
9048
STRCPY(t_first,params.OUT_FILE_NAME);
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);
9057
app_scrap(ignore_scrap,no_math);
9071
if(isdigit(*s)&&*s!='0'&&*s!='8'&&*s!='9')
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;
9097
pre_scrap FCN((last_control))
9098
eight_bits last_control C1("")
9100
scrap_pointer save_base;
9102
LANGUAGE saved_language= language;
9105
app_proc(last_control);
9107
switch(last_control)
9109
case WEB_definition:
9112
if((next_control= get_next())!=identifier)
9114
err0_print(ERR_M,OC("Improper deferred macro definition: \
9115
expected identifier"),0);
9123
reswitch:switch(next_control= get_next())
9126
app(next_control);goto reswitch;
9132
if((next_control= get_next())!=051)
9135
err0_print(ERR_M,OC("Improper deferred macro \
9136
definition: expected ')' after ellipsis"),0);
9139
case 051:app(next_control);app(040);
9142
err0_print(ERR_M,OC("Improper deferred macro definition: \
9143
unrecognized token within argument list"),0);break;
9147
app(044);app(break_space);
9148
app_scrap(ignore_scrap,no_math);
9157
p= text_ptr;freeze_text;
9159
save_base= scrp_base;
9160
scrp_base= scrp_ptr+1;
9162
*limit= 0100;*(limit+1)= 0155;
9163
next_control= ignore;
9165
if(language==TEX)language= C;
9167
language= saved_language;
9169
if(last_control==WEB_definition){app_scrap(semi,maybe_math);}
9171
q= translate(OUTER);
9172
scrp_ptr= scrp_base-1;
9173
scrp_base= save_base;
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);
9184
#if(part == 0 || part == 3)
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")
9201
if(op_code==identifier)p= op_ptr++;
9202
else if(!(p= valid_op(op_code)))
9205
err0_print(ERR_W,OC("Invalid op code %d"),1,op_code);
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);
9214
for(k= 0,l= 1;k<NUM_LANGUAGES;k++,l<<= 1)
9217
OP_INFO HUGE*q= p->info+k;
9219
q->op_macro= op_macro;
9220
overloaded[k]|= (q->overloaded= overload);
9222
if(defn)q->defn= (outer_char HUGE*)defn;
9229
room_for FCN((ntokens,ntexts,nscraps))
9234
if(tok_ptr+ntokens>tok_m_end)
9236
if(tok_ptr>mx_tok_ptr)mx_tok_ptr= tok_ptr;
9237
OVERFLW("tokens","tw");
9240
if(text_ptr+ntexts>tok_end)
9242
if(text_ptr>mx_text_ptr)mx_text_ptr= text_ptr;
9243
OVERFLW("texts","x");
9246
if(scrp_ptr+nscraps>scrp_end)
9248
if(scrp_ptr>mx_scr_ptr)mx_scr_ptr= scrp_ptr;
9249
OVERFLW("scraps","s");
9256
valid_op FCN((op_code))
9257
eight_bits op_code C1("")
9294
confusion(OC("valid_op"),OC("Operator 0x%x is out of range"),op_code);
9297
case compound_assignment:
9298
if(assignment_token==or_or_or)
9301
p= op+CA_START+assignment_token;
9303
confusion(OC("valid_op"),OC("Compound assignment operator 0x%x is out of range"),op+assignment_token);
9307
if(!FORTRAN_LIKE(language))return NULL;
9308
id_first= dot_op.name+1;
9309
id_loc= id_first+STRLEN(id_first);
9312
if(!FORTRAN_LIKE(language))return NULL;
9318
STRNCPY(id,id_first,n= PTR_DIFF(int,id_loc,id_first));
9321
for(p= op+128;p<op_ptr;p++)
9322
if(STRCMP(p->op_name,id)==0)return p;
9324
if(op_ptr>=op_end)OVERFLW("op table","op");
9326
p->op_name= GET_MEM("op name",n+1,ASCII);
9327
STRCPY(p->op_name,id);
9343
int ln= language_num;
9344
OPERATOR HUGE*p= valid_op(next_control);
9345
OP_INFO HUGE*q= p->info+ln;
9348
if(overload_ops&&q->overloaded)
9354
APP_STR("\\Wb{");break;
9357
APP_STR("\\Wu{");break;
9360
APP_STR(" \\Wop{");break;
9363
app_ASCII_str(p->op_name);
9364
sprintf(temp,"}{%s}",lang_codes[ln]);
9367
else if(q->op_macro)
9368
APP_STR(q->op_macro);
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);
9379
app_scrap(binop,yes_math);
9383
app_scrap(q->cat,yes_math);
9394
boolean copying= NO;
9396
app(end_translation);
9397
freeze_text;push_level(text_ptr-1);
9405
case ignore:continue;
9408
while((a= get_output())!=verbatim)
9412
case begin_language:
9413
language= lan_enum(get_output());
9420
output_protect= BOOLEAN(!output_protect);break;
9423
copying= BOOLEAN(!copying);break;
9425
case turn_output_off:
9429
case turn_output_on:
9433
case Turn_output_off:
9439
case Turn_output_on:
9450
case end_translation:
9453
case identifier:case res_word:
9461
for(k= cur_name->byte_start;k<(cur_name+1)->byte_start;k++)
9469
boolean all_uc= cur_name->info.upper_case;
9472
OUT_STR("\\protect");
9476
if(is_intrinsic(cur_name))
9477
OUT_STR(pfrmt->intrinsic);
9480
else if(is_keyword(cur_name))
9481
OUT_STR(ALL_UC?pfrmt->KEYWORD:pfrmt->keyword);
9484
else if(length(cur_name)==1)
9485
OUT_STR(pfrmt->short_id);
9490
switch(DEFINED_TYPE(cur_name))
9493
OUT_STR(ALL_UC?pfrmt->ID_OUTER:pfrmt->id_outer);
9498
OUT_STR(ALL_UC?pfrmt->ID_INNER:pfrmt->id_inner);
9502
OUT_STR(ALL_UC?pfrmt->ID:pfrmt->id);
9511
OUT_STR(ALL_UC?pfrmt->RESERVED:pfrmt->reserved);
9515
out_name(NULL,YES,IDENTIFIER,cur_name);
9533
name_pointer cur_mod_name;
9537
cur_xref= (xref_pointer)cur_name->xref;
9540
if(cur_xref->num>=def_flag)
9542
out_mod(cur_xref->num-def_flag,ENCAP);
9546
cur_xref= cur_xref->xlink;
9548
while(cur_xref->num>=def_flag)
9551
out_mod(cur_xref->num-def_flag,ENCAP);
9552
cur_xref= cur_xref->xlink;
9561
ASCII HUGE*k,HUGE*k_limit;
9563
ASCII HUGE*save_loc,HUGE*save_limit;
9566
k= cur_name->byte_start;k_limit= (cur_name+1)->byte_start;
9567
cur_mod_name= cur_name;
9578
printf("\n! Illegal control code in section name: <");
9580
prn_id(cur_mod_name);printf("> ");
9593
j= limit+1;*j= 0174;delim= 0;
9600
printf("\n! C text in section name didn't end: <");
9602
prn_id(cur_mod_name);printf("> ");
9612
if(j>cur_buffer+buf_size-3)OVERFLW("buffer","");
9614
*(++j)= 0100;*(++j)= *(k++);
9621
if(delim==0)delim= b;
9622
else if((eight_bits)delim==b)delim= 0;
9624
if(b!=0174||delim!=0)
9626
if(j>cur_buffer+buf_size-2)OVERFLW("buffer","");
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;
9646
OUT_STR(cur_xref->num>=def_flag?
9647
LANGUAGE_SYMBOL((LANGUAGE)cur_mod_name->mod_info->language):
9648
(CONST outer_char*)"");
9657
case math_bin:case math_rel:
9660
OUT_STR(a==math_bin?"\\mathbin{":"\\mathrel{");
9667
scanning_meta= BOOLEAN(!scanning_meta);
9671
c= 0;while((a= get_output())>=indent&&a<=big_force)
9673
if(a==indent)c++;if(a==outdent)c--;
9677
for(;c>0;c--)OUT_STR("\\1");
9679
for(;c<0;c++)OUT_STR("\\2");
9686
while(((a= get_output())>=indent||a==040)&&a<=big_force)
9688
if(a==indent)c++;if(a==outdent)c--;
9692
for(;c>0;c--)OUT_STR("\\1");
9694
for(;c<0;c++)OUT_STR("\\2");
9699
case indent:case outdent:case opt:case backup:case break_space:
9700
case force:case big_force:
9709
out(0134);out(a-cancel+060);
9730
b= a;save_mode= cur_mode;c= 0;
9736
if(a==cancel||a==big_cancel)
9740
for(;c>0;c--)OUT_STR("\\1");
9742
for(;c<0;c++)OUT_STR("\\2");
9748
if((a!=040&&a<indent)||a==backup||a>big_force)
9751
if(save_mode==outer)
9753
if(out_ptr>out_buf+5&&STRNCMP(out_ptr-5,"\\WY\\WP",6)==0)
9758
for(;c>0;c--)OUT_STR("\\1");
9760
for(;c<0;c++)OUT_STR("\\2");
9767
if(STRNCMP(out_ptr-2,"\\WP",3)==0)
9775
out(0134);out(b-cancel+060);
9777
if(a!=end_translation)
9780
else if(a!=end_translation&&cur_mode==inner)
9810
if(output_on)out(';');
9814
if(!(copying||nuweb_mode))
9827
if(scanning_meta&&a=='\n')
9828
flush_buffer(out_ptr,NO);
9838
#define TEMP_LEN (MAX_FILE_NAME_LENGTH + 11)
9840
outer_char temp[TEMP_LEN],temp1[TEMP_LEN];
9842
esc_file_name(temp1,TEMP_LEN,prms[1].web.File_name);
9845
nsprintf(temp,OC("\\Wskipped{%s}"),1,temp1)>=(int)(TEMP_LEN))OVERFLW("temp","");
9858
static int outer_include_depth;
9864
flush_buffer(out_ptr,NO);
9866
outer_include_depth= incl_depth;
9869
else if(incl_depth<=outer_include_depth)
9880
OUT_STR("\\WY\\WP");
9895
name_pointer cur_mod_name;
9899
cur_xref= (xref_pointer)cur_name->xref;
9902
if(cur_xref->num>=def_flag)
9904
out_mod(cur_xref->num-def_flag,ENCAP);
9908
cur_xref= cur_xref->xlink;
9910
while(cur_xref->num>=def_flag)
9913
out_mod(cur_xref->num-def_flag,ENCAP);
9914
cur_xref= cur_xref->xlink;
9923
ASCII HUGE*k,HUGE*k_limit;
9925
ASCII HUGE*save_loc,HUGE*save_limit;
9928
k= cur_name->byte_start;k_limit= (cur_name+1)->byte_start;
9929
cur_mod_name= cur_name;
9940
printf("\n! Illegal control code in section name: <");
9942
prn_id(cur_mod_name);printf("> ");
9955
j= limit+1;*j= 0174;delim= 0;
9962
printf("\n! C text in section name didn't end: <");
9964
prn_id(cur_mod_name);printf("> ");
9974
if(j>cur_buffer+buf_size-3)OVERFLW("buffer","");
9976
*(++j)= 0100;*(++j)= *(k++);
9983
if(delim==0)delim= b;
9984
else if((eight_bits)delim==b)delim= 0;
9986
if(b!=0174||delim!=0)
9988
if(j>cur_buffer+buf_size-2)OVERFLW("buffer","");
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;
10008
OUT_STR(cur_xref->num>=def_flag?
10009
LANGUAGE_SYMBOL((LANGUAGE)cur_mod_name->mod_info->language):
10010
(CONST outer_char*)"");
10021
footnote FCN((flag))
10022
sixteen_bits flag C1("")
10026
if(cur_xref->num<=flag)return;
10028
fin_line();OUT_STR("\\W");
10032
out(flag==0?0125:0101);
10034
OUT_STR(" section");
10037
q= cur_xref;if(q->xlink->num>flag)out(0163);
10042
out_mod(cur_xref->num-flag,ENCAP);
10043
cur_xref= cur_xref->xlink;
10045
if(cur_xref->num<=flag)break;
10047
if(cur_xref->xlink->num>flag||cur_xref!=q->xlink)out(054);
10052
if(cur_xref->xlink->num<=flag)
10066
language= global_language;
10068
if(no_xref&&!prn_contents)
10073
OUT_STR("\\vfill");fin_line();
10074
OUT_STR("\\FWEBend");fin_line();
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);
10089
OUT_STR("\\input ");
10090
OUT_STR(xpn_name(&temp_ndx,MAX_FILE_NAME_LENGTH,
10091
w_style.indx.tex,wbflnm0));
10097
OUT_STR("\\input ");
10098
OUT_STR(xpn_name(&temp_mds,MAX_FILE_NAME_LENGTH,
10099
w_style.modules.tex,wbflnm0));
10106
outer_char HUGE*temp;
10109
temp= GET_MEM("temp",N_CMD,outer_char);
10111
OUT_STR(w_style.modules.info);
10112
OUT_STR(cmd_ln_buf);fin_line();
10117
nsprintf(temp,OC(" {%s}"),1,XLANGUAGE_NAME_PTR(global_language))>=(int)(N_CMD))OVERFLW("temp","");
10118
OUT_STR(temp);fin_line();
10124
IN_COMMON unsigned num_keywords;
10126
RCS HUGE*rcs_ptrs[1000];
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;
10133
QSORT(rcs_ptrs,num_keywords,sizeof(RCS*),cmpr_rcs);
10139
out_str(w_style.modules.kwd);
10144
for(k= 0;k<num_keywords;k++)
10148
out_str(w_style.modules.kwd);
10150
out_atext(prcs->keyword);
10153
out_atext(prcs->txt);
10161
FREE_MEM(temp,"temp",N_CMD,outer_char);
10170
outer_char temp[20];
10172
OUT_STR(w_style.contents.preamble);
10176
nsprintf(temp,OC("{%i}"),1,module_count)>=(int)(20))OVERFLW("temp","");
10179
OUT_STR(w_style.contents.postamble);
10182
OUT_STR("\\FWEBend");fin_line();
10187
OUT_STR("\\vfill");fin_line();
10188
OUT_STR("\\FWEBend");fin_line();
10196
writing(YES,temp_ndx);
10198
if(tex_file==stdout)
10207
mx_open(w_style.indx.m_sty);
10210
if(makeindex)fprintf(mx_file,"%s","% Produced automatically by fweave.\n\n");
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,"");
10216
fprintf(mx_file,"%s \"%s\\\n%s\"\n",
10218
dbl_bslash(m_temp,w_style.indx.m_preamble),
10219
dbl_bslash(m_temp1,m_temp0));
10222
fprintf(mx_file,"%s \"%s\"\n","postamble",
10223
dbl_bslash(m_temp0,w_style.indx.m_postamble));
10225
fprintf(mx_file,"%s \"%s\"\n","keyword",
10226
dbl_bslash(m_temp0,w_style.indx.m_keyword));
10228
fprintf(mx_file,"%s '%s'\n","arg_open",
10229
dbl_cslash(m_temp0,w_style.indx.m_arg_open));
10231
fprintf(mx_file,"%s '%s'\n","arg_close",
10232
dbl_cslash(m_temp0,w_style.indx.m_arg_close));
10234
fprintf(mx_file,"%s '%s'\n","range_open",
10235
dbl_cslash(m_temp0,w_style.indx.m_range_open));
10237
fprintf(mx_file,"%s '%s'\n","range_close",
10238
dbl_cslash(m_temp0,w_style.indx.m_range_close));
10240
fprintf(mx_file,"%s '%s'\n","level",
10241
dbl_cslash(m_temp0,w_style.indx.m_level));
10243
fprintf(mx_file,"%s '%s'\n","actual",
10244
dbl_cslash(m_temp0,w_style.indx.m_actual));
10246
fprintf(mx_file,"%s '%s'\n","encap",
10247
dbl_cslash(m_temp0,w_style.indx.m_encap));
10249
fprintf(mx_file,"%s '%s'\n","quote",
10250
dbl_cslash(m_temp0,w_style.indx.m_quote));
10252
fprintf(mx_file,"%s '%s'\n","escape",
10253
dbl_cslash(m_temp0,w_style.indx.m_escape));
10255
fprintf(mx_file,"%s \"%s\"\n","setpage_prefix",
10256
dbl_bslash(m_temp0,w_style.indx.m_setpage_prefix));
10258
fprintf(mx_file,"%s \"%s\"\n","setpage_suffix",
10259
dbl_bslash(m_temp0,w_style.indx.m_setpage_suffix));
10261
fprintf(mx_file,"%s \"%s\"\n","group_skip",
10262
dbl_bslash(m_temp0,w_style.indx.m_group_skip));
10264
fprintf(mx_file,"%s %i\n","headings_flag",w_style.indx.m_headings_flag);
10266
fprintf(mx_file,"%s \"%s\"\n","heading_prefix",
10267
dbl_bslash(m_temp0,w_style.indx.m_heading_prefix));
10269
fprintf(mx_file,"%s \"%s\"\n","symhead_positive",
10270
dbl_bslash(m_temp0,w_style.indx.m_symhead_positive));
10272
fprintf(mx_file,"%s \"%s\"\n","symhead_negative",
10273
dbl_bslash(m_temp0,w_style.indx.m_symhead_negative));
10275
fprintf(mx_file,"%s \"%s\"\n","numhead_positive",
10276
dbl_bslash(m_temp0,w_style.indx.m_numhead_positive));
10278
fprintf(mx_file,"%s \"%s\"\n","numhead_negative",
10279
dbl_bslash(m_temp0,w_style.indx.m_numhead_negative));
10281
fprintf(mx_file,"%s \"%s\"\n","item_0",
10282
dbl_bslash(m_temp0,w_style.indx.m_item_0));
10284
fprintf(mx_file,"%s \"%s\"\n","item_1",
10285
dbl_bslash(m_temp0,w_style.indx.m_item_1));
10287
fprintf(mx_file,"%s \"%s\"\n","item_2",
10288
dbl_bslash(m_temp0,w_style.indx.m_item_2));
10290
fprintf(mx_file,"%s \"%s\"\n","item_01",
10291
dbl_bslash(m_temp0,w_style.indx.m_item_01));
10293
fprintf(mx_file,"%s \"%s\"\n","item_x1",
10294
dbl_bslash(m_temp0,w_style.indx.m_item_x1));
10296
fprintf(mx_file,"%s \"%s\"\n","item_12",
10297
dbl_bslash(m_temp0,w_style.indx.m_item_12));
10299
fprintf(mx_file,"%s \"%s\"\n","item_x2",
10300
dbl_bslash(m_temp0,w_style.indx.m_item_x2));
10302
fprintf(mx_file,"%s \"%s\"\n","delim_0",
10303
dbl_bslash(m_temp0,w_style.indx.m_delim_0));
10305
fprintf(mx_file,"%s \"%s\"\n","delim_1",
10306
dbl_bslash(m_temp0,w_style.indx.m_delim_1));
10308
fprintf(mx_file,"%s \"%s\"\n","delim_2",
10309
dbl_bslash(m_temp0,w_style.indx.m_delim_2));
10311
fprintf(mx_file,"%s \"%s\"\n","delim_n",
10312
dbl_bslash(m_temp0,w_style.indx.m_delim_n));
10314
fprintf(mx_file,"%s \"%s\"\n","delim_r",
10315
dbl_bslash(m_temp0,w_style.indx.m_delim_r));
10317
fprintf(mx_file,"%s \"%s\"\n","delim_t",
10318
dbl_bslash(m_temp0,w_style.indx.m_delim_t));
10320
fprintf(mx_file,"%s \"%s\"\n","encap_prefix",
10321
dbl_bslash(m_temp0,w_style.indx.m_encap_prefix));
10323
fprintf(mx_file,"%s \"%s\"\n","encap_infix",
10324
dbl_bslash(m_temp0,w_style.indx.m_encap_infix));
10326
fprintf(mx_file,"%s \"%s\"\n","encap_suffix",
10327
dbl_bslash(m_temp0,w_style.indx.m_encap_suffix));
10329
fprintf(mx_file,"%s %i\n","line_max",w_style.indx.m_line_max);
10331
fprintf(mx_file,"%s \"%s\"\n","indent_space",
10332
dbl_bslash(m_temp0,w_style.indx.m_indent_space));
10334
fprintf(mx_file,"%s %i\n","indent_length",w_style.indx.m_indent_length);
10341
mx_open(w_style.indx.m_out);
10342
fprintf(mx_file,"%% %s\n\n",wbflnm0);
10352
while(!chngd_module[++k_module]);
10356
out_mod(k_module,ENCAP);
10358
while(k_module<module_count)
10360
while(!chngd_module[++k_module]);
10363
OUT_STR(", ");out_mod(k_module,ENCAP);
10374
OUT_STR(w_style.indx.preamble);fin_line();
10382
for(c= 0;c<=127;c++)bucket[c]= NULL;
10384
for(h= hash;h<=hash_end;h++)
10390
cur_name= next_name;next_name= cur_name->link;
10392
if((xref_pointer)cur_name->xref!=xmem)
10394
c= (cur_name->byte_start)[0];
10398
blink[cur_name-name_dir]= bucket[c];
10399
bucket[c]= cur_name;
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);
10412
sort_ptr= scrp_info;unbucket(1);
10414
while(sort_ptr>scrp_info)
10416
cur_depth= sort_ptr->depth;
10418
if(blink[sort_ptr->head-name_dir]==0||cur_depth==INFTY)
10421
cur_name= sort_ptr->head;
10425
ASCII letter= *cur_name->byte_start;
10430
if(letter==0134&&cur_name->ilk==normal&&language!=TEX)
10431
letter= NON_TEX_MACRO;
10433
letter= A_TO_LOWER(letter);
10435
if(letter!=last_letter)
10439
OUT_STR(w_style.indx.group_skip);
10442
if(w_style.indx.lethead_flag&&letter!=NON_TEX_MACRO)
10444
OUT_STR(w_style.indx.lethead_prefix);
10452
case 0134:case 0173:case 0175
10456
case 040:case 043:case 045:case 044:case 0136:case 0140:
10457
case 0176:case 046:case 0137
10463
out((w_style.indx.lethead_flag>0?A_TO_UPPER(letter):
10464
A_TO_LOWER(letter)));
10466
if(w_style.indx.m_headings_flag)
10469
OUT_STR(w_style.indx.lethead_suffix);
10473
last_letter= letter;
10480
if(cur_name->defined_type(language)<0x80)
10482
OUT_STR(w_style.indx.item_0);
10486
boolean all_uc= cur_name->info.upper_case;
10490
m_start= out_ptr+1;
10492
switch(cur_name->ilk)
10495
output_type= IDENTIFIER;
10497
if(is_intrinsic(cur_name))
10498
OUT_STR(pfrmt->intrinsic);
10500
else if(is_keyword(cur_name))
10501
OUT_STR(ALL_UC?pfrmt->KEYWORD:pfrmt->keyword);
10505
OUT_STR(pfrmt->typewritr);
10507
else if(length(cur_name)==1)
10508
OUT_STR(pfrmt->short_id);
10511
switch(DEFINED_TYPE(cur_name))
10514
OUT_STR(ALL_UC?pfrmt->ID_OUTER:pfrmt->id_outer);
10519
OUT_STR(ALL_UC?pfrmt->ID_INNER:pfrmt->id_inner);
10523
OUT_STR(ALL_UC?pfrmt->ID:pfrmt->id);
10534
case roman:output_type= INDEX_ENTRY;break;
10535
case wildcard:OUT_STR(pfrmt->wildcrd);output_type= INDEX_ENTRY;break;
10537
case typewriter:OUT_STR(pfrmt->typewritr);
10538
output_type= INDEX_ENTRY;break;
10541
OUT_STR(ALL_UC?pfrmt->RESERVED:pfrmt->reserved);
10542
output_type= IDENTIFIER;break;
10546
out_name(m_temp1,YES,output_type,cur_name);
10554
this_xref= (xref_pointer)cur_name->xref;cur_xref= xmem;
10558
next_xref= this_xref->xlink;this_xref->xlink= cur_xref;
10559
cur_xref= this_xref;this_xref= next_xref;
10561
while(this_xref!=xmem);
10565
OUT_STR(w_style.indx.delim_0);
10571
if(makeindex)fprintf(mx_file,"%s",w_style.indx.m_keyword);
10574
if(makeindex)fprintf(mx_file,"%c",w_style.indx.m_arg_open);
10575
m_start= out_ptr+1;
10578
out_name(m_temp0,NO,output_type,cur_name);
10581
if(makeindex)fprintf(mx_file,"%s",mx_quote(m_temp,m_temp0));
10584
if(makeindex)fprintf(mx_file,"%c",w_style.indx.m_actual);
10586
if(makeindex)fprintf(mx_file,"%s",mx_quote(m_temp,m_temp1));
10588
cur_val= cur_xref->num;
10592
if(makeindex)fprintf(mx_file,"%c",w_style.indx.m_encap);
10597
if(makeindex)fprintf(mx_file,"%s",w_style.indx.m_page);
10600
if(makeindex)fprintf(mx_file,"%c",w_style.indx.m_arg_open);
10603
if(makeindex)fprintf(mx_file,"%c",w_style.indx.m_arg_close);
10605
if(cur_val<def_flag)
10609
if(makeindex)fprintf(mx_file,"%c",w_style.indx.m_arg_open);
10612
if(makeindex)fprintf(mx_file,"%c",w_style.indx.m_arg_close);
10616
if(makeindex)fprintf(mx_file,"%c",w_style.indx.m_arg_close);
10617
out_mod(cur_val,ENCAP);
10621
OUT_STR(w_style.indx.underline_prefix);
10626
if(makeindex)fprintf(mx_file,"%c",w_style.indx.m_escape);
10629
if(makeindex)fprintf(mx_file,"%s",w_style.indx.m_underline);
10632
if(makeindex)fprintf(mx_file,"%c",w_style.indx.m_arg_close);
10634
out_mod(cur_val-def_flag,ENCAP);
10635
OUT_STR(w_style.indx.underline_suffix);
10641
if((LANGUAGE)cur_xref->Language!=global_language)
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);
10653
if(makeindex)fprintf(mx_file,"%c",'\n');
10655
cur_xref= cur_xref->xlink;
10660
OUT_STR(w_style.indx.delim_n);
10663
out(056);fin_line();
10669
cur_name= blink[cur_name-name_dir];
10682
next_name= sort_ptr->head;
10686
cur_name= next_name;next_name= blink[cur_name-name_dir];
10687
cur_byte= cur_name->byte_start+cur_depth;
10689
if(cur_byte==(cur_name+1)->byte_start)c= 0;
10696
blink[PTR_DIFF(size_t,cur_name,name_dir)]= bucket[c];
10697
bucket[c]= cur_name;
10701
--sort_ptr;unbucket((eight_bits)(cur_depth+(eight_bits)1));
10709
OUT_STR(w_style.indx.postamble);fin_line();
10718
writing(BOOLEAN(!prn_index),temp_mds);
10721
OUT_STR(w_style.modules.preamble);fin_line();
10726
OUT_STR(w_style.modules.postamble);fin_line();
10732
if(tex_file!=stdout)
10735
CLR_PRINTF(SHORT_INFO,info,("\nDone."));
10742
cmpr_rcs FCN((pp0,pp1))
10743
RCS HUGE**pp0 C0("")
10744
RCS HUGE**pp1 C1("")
10746
return STRCMP((*pp0)->keyword,(*pp1)->keyword);
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("")
10758
ASCII HUGE*temp0= temp;
10766
case 0134:case 0173:case 0175
10769
if(!all_cases)break;
10772
case 040:case 043:case 045:case 044:case 0136:case 0140:
10773
case 0176:case 046:case 0137
10791
eight_bits d C1("")
10795
for(c= max_collate;c>=0;c--)if(bucket[collate[c]]){
10796
if(sort_ptr>=scrp_end)OVERFLW("sort levels","s");
10800
if(sort_ptr>mx_sort_ptr)mx_sort_ptr= sort_ptr;
10802
sort_ptr->depth= (eight_bits)(c==0?INFTY:d);
10803
sort_ptr->head= bucket[collate[c]];
10804
bucket[collate[c]]= NULL;
10812
name_pointer p C1("")
10816
mod_print(p->llink);OUT_STR("\\:");
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));
10824
mod_print(p->rlink);
10831
see_statistics(VOID)
10833
CLR_PRINTF(ALWAYS,info,("\n\nMEMORY USAGE STATISTICS:\n"));
10835
STAT0("names",sizeof(*name_ptr),
10836
SUB_PTRS(name_ptr,name_dir),max_names,smin0(MAX_VAL("n")),"n",",");
10838
STAT0("cross-references",sizeof(*xref_ptr),
10839
SUB_PTRS(xref_ptr,xmem),max_refs,smin0(MAX_VAL("r")),"r",",");
10841
STAT0("bytes",sizeof(*byte_ptr),
10842
SUB_PTRS(byte_ptr,byte_mem),max_bytes,smin0(MAX_VAL("b")),"b",";");
10844
CLR_PRINTF(ALWAYS,info,(" parsing required\n"));
10846
STAT0("scraps",sizeof(*mx_scr_ptr),
10847
SUB_PTRS(mx_scr_ptr,scrp_base),max_scraps,smin0(MAX_VAL("s")),"s",",");
10849
STAT0("texts",sizeof(*mx_text_ptr),
10850
SUB_PTRS(mx_text_ptr,tok_start),max_texts,smin0(MAX_VAL("x")),"x",",");
10852
STAT0("tokens",sizeof(*mx_tok_ptr),
10853
SUB_PTRS(mx_tok_ptr,tok_mem),max_toks,smin0(MAX_VAL("tw")),"tw",",");
10855
STAT0("stack levels",sizeof(*mx_stck_ptr),
10856
SUB_PTRS(mx_stck_ptr,stack),stck_size,smin0(MAX_VAL("kw")),"kw",";");
10858
CLR_PRINTF(ALWAYS,info,(" sorting required"));
10860
printf(" %lu level(s).\n",SUB_PTRS(mx_sort_ptr,scrp_info));
10868
predefine_macros(VOID)
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("")
10882
*pname= GET_MEM("*pname",STRLEN(name)+1,outer_char);
10883
STRCPY(*pname,name);
10888
SRTN ini_tokens FCN((language0))
10889
LANGUAGE language0 C1("")
10900
mx_quote FCN((m_out,s))
10901
outer_char*m_out C0("Escape into here")
10902
outer_char*s C1("Input")
10908
INDEX HUGE*q= &w_style.indx;
10929
dbl_bslash FCN((m_temp,s))
10930
outer_char*m_temp C0("Buffer")
10931
outer_char*s C1("String to expand")
10939
if(iscntrl(c)||c=='\\')
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;
10974
dbl_cslash FCN((m_temp,c))
10975
outer_char*m_temp C0("Buffer")
10976
outer_char c C1("Char to expand")
10978
outer_char*p= m_temp;
10980
if(iscntrl(c)||c=='\\')
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;
11011
SRTN mx_open FCN((ext))
11012
outer_char*ext C1("File extension")
11014
xpn_name(&temp_ndx,MAX_FILE_NAME_LENGTH,ext,wbflnm0);
11015
mx_file= FOPEN(temp_ndx,"w");
11018
writing(NO,temp_ndx);
11021
CLR_PRINTF(WARNINGS,info,
11022
("\n! Can't open makeindex file %s\n",temp_ndx));