1
@z --- typedefs.web ---
3
FWEB version 1.62 (September 25, 1998)
5
Based on version 0.5 of S. Levy's CWEB [copyright (C) 1987 Princeton University]
7
@x-----------------------------------------------------------------------------
9
@Lv[-Tv] @% This file can't be processed by \FWEAVE\ in it's present form!
11
@* COMMON DEFINITIONS and TYPEDEFS. Here are definitions and typedefs
12
common to all of \.{common.web}, \.{tangle.web}, and \.{weave.web}.
16
@<Macro definitions@>@;
18
@ Write a header at the top of \.{typedefs.h}.
20
/* Created automatically from typedefs.web. */
23
@ The debug mode includes some extra code, but it probably doesn't slow
31
@@ The actual names of the processors.
38
@@ Some compilers can't handle files as large as \.{ftangle} or \.{fweave}.
39
Therefore, if the C~preprocessor macros |part| are defined from the
40
compiler's command line to have the value~1, 2, or~3, the other parts of
41
those files are commented out.
43
@@<Possibly split into parts@@>=
46
#define part 0 /* Standard value, when the files aren't split. */
48
#if(part != 1 && part != 2 && part != 3)
49
#define part 1 /* Should issue error message here. */
53
@ Now we have macros that ensure that stuff needed for \FTANGLE\ or \FWEAVE\
54
is defined and allocated in only one place.
64
#define EXTERN part1_or_extern /* This is further redefined below,
65
depending on the setting of |part|. */
89
@@<Possibly split...@@>=
91
#if(part == 0 || part == 1)
92
#define part1_or_extern
93
#define SET1(stuff) @@e = stuff
94
#define TSET1(stuff) @@e = stuff
96
#define part1_or_extern extern
101
@ Next, we have some macros to help us allocate and define stuff in just one
102
place. The philosophy here is that there should be no explicit |extern|
103
statements; they should be replaced by something like |IN_COMMON| to remind
104
one exactly where that variable is defined.
120
#define IN_TANGLE part1_or_extern
123
#define IN_TANGLE extern
125
#endif /* |_TANGLE_h| */
128
#define IN_COMMON part1_or_extern
131
#define IN_COMMON extern
133
#endif /* |_COMMON_h| */
136
#define IN_PROD part1_or_extern
139
#define IN_PROD extern
141
#endif /* |_PROD_h| */
144
#define IN_RATFOR part1_or_extern
147
#define IN_RATFOR extern
149
#endif /* |_RATFOR_h| */
153
#define ESET(stuff) = stuff
155
#define IN_EVAL extern
157
#endif /* |_EVAL_h| */
162
#define IN_MACS extern
163
#endif /* |_MACS_h| */
167
#define SSET(stuff) = stuff
169
#define IN_STYLE extern
171
#endif /* |_STYLE_h| */
173
@ We have an enumerated type for the kind of machine.
178
typedef enum{Unknown,Apollo,Dsu,IBMPc,Mac,Misc,Sgi,Sun,Vax} MACHINE;
180
IN_COMMON MACHINE Machine
184
Apollo /* Apollo/UNIX */
186
Dsu /* DECstation/ULTRIX */
188
IBMPc /* IBM-PC/DOS */
194
Sgi /* Silicon Graphics/IRIX */
201
@#endif /* |APOLLO| */
202
@#endif /* |_COMMON_| */
206
@ Various miscellaneous definitions, and the fundamental typedefs.
208
/* True and false. */
213
@D WHILE() for(;;) /* Use ``|for(;;)|'' instead of ``|while(1)|'' to avoid
214
warnings from Microsoft compiler. */
217
/* Minima and maxima. */
218
@D MAX(a,b) ((a)>(b) ? (a) : (b))
219
@D MIN(a,b) ((a)<(b) ? (a) : (b))
221
@d SAVE_MACRO(text) save_macro(OC("m!"),(outer_char *)text)
222
/* Note that this protects the macros against redefinition. */
223
@d CHK_ARGS(name,num) chk_args(OC(name),num,n,pargs)
224
/* Right \# of arguments? */
226
@D tab_mark @'\t' /* The |ASCII| tab. */
228
/* Subtraction of huge pointers; needed for pc's. We first cast to |long|,
229
then to the final target type. */
230
@d PTR_DIFF(type,p,q) ((type)(long)((p) - (q)))
231
@d SUB_PTRS(p,q) PTR_DIFF(unsigned long,p,q) /* Used in the statistics
234
/* Here are some macros to determine the identifier number in the name
236
@d ID_NUM_ptr(ptr,start,end) ID_NUM0(ptr = @e,start,end) /* Set a
237
pointer as well as the number. */
238
@d ID_NUM(start,end) ID_NUM0(DUMMY,start,end) /* Just the number. */
239
@d DUMMY /* This kludge for an empty argument shouldn't be necessary, but
240
Microsoft didn't like the construction |ID_NUM0(,start,end)|. */
242
/* Set both a pointer and the number. */
244
@d ID_NUM0(ptr_equals,start,end) PTR_DIFF(sixteen_bits,
245
(ptr_equals id_lookup(start,end,0)),name_dir)
247
/* Terminate a string. */
248
@d TERMINATE(p,offset) *(p+offset) = '\0'
250
@d BOOLEAN(b) ((boolean)(b)) /* Explicit cast to make some compilers happy. */
252
@d CHOICE(flag,yes,no) (((int)(flag)) ? yes : no)
256
@m OCTAL0(n)$ASCII(#'n)
257
@m OCTAL(n)(eight_bits)OCTAL0(\@&n) /* Make octal constant. */
260
@@ Here's a somewhat sophisticated use of \WEB\ macros.
262
@@f ptr_equals $EXPR_
263
@@m @!OCTAL0(n) @!$ASCII(#'n) /* Single-quote the argument and send to
265
@@m @!OCTAL(n) (eight_bits)@!OCTAL0(\@@&n) /* Make octal constant. */
266
@@m @!HEX(n) (eight_bits)@!OCTAL0(\@@&x##n) /* Make hex constant. */
271
typedef unsigned char eight_bits; /* The fundamental single-byte token. If
272
your machine does not support |unsigned char| you should change
273
the definition of |eight_bits| to |unsigned short|. */
274
@^system dependencies@>
276
typedef unsigned short sixteen_bits; /* Identifiers and similar things take
279
typedef unsigned char outer_char; /* Type of characters outside \.{WEB}. */
281
typedef eight_bits boolean; /* The logical type. (\CWEB\ had |short| here.
282
Indeed, some compilers give warnings about type conversions because the
283
result of logical operations is an |int|, not a |char|.) */
285
typedef unsigned long BUF_SIZE; /* Size of dynamic arrays. */
287
typedef long STMT_LBL; /* \Fortran\ statement label. (Negative is allowed.) */
289
typedef unsigned short LINE_NUMBER; /* Line number of \WEB\ source or output.*/
291
typedef long CASE_TYPE; /* The type for |case| values in \Ratfor. */
293
/* For |web_strcmp|. {\bfit Web's convention differs from C's}!
294
If you don't pay attention to this, you'll get bugs that are
295
hard to track down. */
296
typedef enum {LESS=0, /* first name is lexicographically less than the second*/
297
EQUAL=1, /* the first name is equal to the second */
298
GREATER=2, /* first name is lexicographically greater than the
300
PREFIX=3, /* the first name is a proper prefix of the second */
301
EXTENSION=4} LEXI; /* first name is a proper extension of the
304
@ In certain cases \.{TANGLE} and \.{WEAVE} should do almost, but not
305
quite, the same thing. In these case we've written common code for
306
both, differentiating between the two by means of the global variable
310
typedef enum {tangle=0,weave=1} PROGRAM; /* The two processors. */
312
IN_COMMON PROGRAM program;
314
@ The \FWEB\ version number, and the system name.
318
IN_COMMON outer_char version[] CSET(VERSION); /* \FWEB\ version number. */
319
IN_COMMON outer_char release_date[] CSET(RELEASE_DATE);
320
/* Release date for this version. */
321
IN_COMMON outer_char *the_system, *local_banner; /* Name of the
322
machine/operating system; and a possible additional local banner. */
324
@ \.{WEAVE} operates in three phases: first it inputs the source file and
325
stores cross-reference data, then it inputs the source once again and
326
produces the \TeX\ output file, and finally it sorts and outputs the index.
327
Similarly, \.{TANGLE} operates in two phases. The global variable |phase|
328
tells which phase we are in.
332
IN_COMMON short phase CSET(0); /* Which phase are we in? */
334
@ Especially in \RATFOR, we distinguish between warning and error messages.
336
@d EAT_AUTO_SEMI {if(auto_semi && next_byte() != @';') BACK_UP@;}
337
@d BACK_UP {saved_token = NO; cur_byte -= last_bytes;}
339
@d NOT_BEFORE OCTAL(177)
340
@d NOT_AFTER NOT_BEFORE
342
@d SAVE_BEFORE(pp,nmax,r_before) save_out(pp,nmax,r_before,NOT_AFTER)
343
@d SAVE_AFTER(pp,nmax,r_after) save_out(pp,nmax,NOT_BEFORE,r_after)
347
@@m IS_NEXT(c0,keyword)
351
if((c=next_byte()) != c0)
353
didnt_expand(c0,c,#*keyword);
358
@@m IS_NEXT_PAREN(keyword) IS_NEXT(@'(',keyword)
362
typedef enum {OK,WARNING,ERROR} ERR_TYPE;
364
@ A major extension to \.{CWEB} is support for the syntaxes of several
365
languages. We need to know what language we're dealing with at the moment.
367
@d NUM_LANGUAGES 8 /* |C|, |RATFOR|, |FORTRAN|, |TEX|, |LITERAL|,
368
|C_PLUS_PLUS|, |RATFOR_90|, |FORTRAN_90| */
369
@d NUM_DISTINCT_LANGUAGES (NUM_LANGUAGES-2)
371
@d GLOBAL_LANGUAGE FORTRAN
372
@d global_language global_params.Language /* The language in force at the
373
beginning of each module. */
375
@d is_C_(Language) (Language==C)
376
@d is_RATFOR_(Language) (Language==RATFOR || Language==RATFOR_90)
377
@d is_FORTRAN_(Language) (Language==FORTRAN || Language==FORTRAN_90)
379
@d FORTRAN_LIKE(Language) (is_RATFOR_(Language) || is_FORTRAN_(Language))
380
@d FORTRAN90_LIKE(Language) (Language==FORTRAN_90 || Language==RATFOR_90)
381
@d C_LIKE(Language) (Language==C || Language==C_PLUS_PLUS)
383
@d R66 (is_RATFOR_(language) && !Ratfor77) /* Non-expandable \Ratfor;
385
@d R77 (Ratfor77 && is_RATFOR_(language) && xpn_Ratfor) /* Expandable
387
@d R77_or_F (R77 || is_FORTRAN_(language)) /* Expandable \Ratfor\ or
390
@d IS_WHITE(a) ((a) == @' ' || (a) == tab_mark)
392
@d LANGUAGE_CODE(l) OC(lang_codes[lan_num(l)]) /* String
393
abbreviation for the language name. */
397
/* The highest bit sets the basic language. */
412
NUWEB_OFF = 0xF0, /* Not a language, but used in |send_single|. */
416
IN_COMMON LANGUAGE cmd_language CSET(NO_LANGUAGE);/* To check against
418
IN_COMMON boolean column_mode CSET(NO);
420
/* These names are used for error messages from the processors. */
421
IN_COMMON CONST char HUGE *languages[NUM_LANGUAGES]
423
#if(part == 0 || part == 1)
424
= {"C","RATFOR","FORTRAN","TEX","VERBATIM",
425
"C++","RATFOR--90","FORTRAN--90"}
426
#endif /* |part == 1| */
427
#endif /* |defined _COMMON_h| */
430
/* The following are used with \.{\\Winfo}. */
431
IN_COMMON CONST char HUGE *Xlanguages[NUM_LANGUAGES]
433
#if(part == 0 || part == 1)
434
= {"C","\\Ratfor","\\Fortran","\\TeX","VERBATIM",
435
"\\Cpp","\\Ratfor--90","\\Fortran--90"}
436
#endif /* |part == 1| */
437
#endif /* |defined _COMMON_h| */
440
/* These abbreviations are short-hands for the language---they are used,
441
for example, in the index. */
442
IN_COMMON CONST char HUGE *lang_codes[NUM_LANGUAGES]
444
#if(part == 0 || part == 1)
445
= {"C","R","N","X","V","C++","R90","N90"}
450
@ The following sets the delimiters for the module number stuff in the
455
IN_COMMON outer_char begin_comment_char[NUM_LANGUAGES]
457
#if(part == 0 || part == 1)
458
= {'/','#','C','%','/', '/','#','C'}
461
; /* |C|, |RATFOR|, |FORTRAN|, |TEX|, |LITERAL|, \dots. */
463
IN_COMMON CONST outer_char end_comment_char[NUM_LANGUAGES]
465
#if(part == 0 || part == 1)
466
= {'/',' ',' ',' ','/', '/',' ',' '}
474
@@<Specific language cases@@>=
479
case begin_LITERAL@@: @@;
481
@ The following readably abbreviate the control letters for language
482
switches. These are just the basic languages; dialects are set by the
483
optional arguments. We need to worry about the distinction between |ASCII|
489
@@f @@<|ASCII| cases for |C|@@> case
490
@@f @@<|ASCII| cases for |RATFOR|@@> case
491
@@f @@<|ASCII| cases for |FORTRAN|@@> case
492
@@f @@<|ASCII| cases for |TEX|@@> case
493
@@f @@<|ASCII| cases for |LITERAL|@@> case
494
@@<|ASCII| cases for |C|@@>=
497
@@ @@<|ASCII| cases for |RATFOR|@@>=
500
@@ @@<|ASCII| cases for |FORTRAN|@@>=
503
@@ @@<|ASCII| cases for |TEX|@@>=
506
@@ @@<|ASCII| cases for |LITERAL|@@>=
509
@ Same stuff for |outer_char|.
514
@@f @@<|outer_char| cases for |C|@@> case
515
@@f @@<|outer_char| cases for |RATFOR|@@> case
516
@@f @@<|outer_char| cases for |FORTRAN|@@> case
517
@@f @@<|outer_char| cases for |TEX|@@> case
518
@@f @@<|outer_char| cases for |LITERAL|@@> case
519
@@<|outer_char| cases for |C|@@>=
522
@@ @@<|outer_char| cases for |RATFOR|@@>=
525
@@ @@<|outer_char| cases for |FORTRAN|@@>=
528
@@ @@<|outer_char| cases for |TEX|@@>=
531
@@ @@<|outer_char| cases for |LITERAL|@@>=
538
@@ Read the basic language letter and set the language. We must check for
539
dialects before we call |opt_args| because the first thing that does is
540
to set the language based on the values of the dialect flags.
542
@@<Set |language|@@>=
544
ASCII l = *loc++; /* The basic language letter. */
548
@@<|ASCII| cases for |C|@@>:
549
Cpp = BOOLEAN(*loc == @@'+');
552
@@<|ASCII| cases for |RATFOR|@@>:
553
@@<|ASCII| cases for |FORTRAN|@@>:
554
Fortran88 = BOOLEAN(*loc == @@'9');
557
@@<|ASCII| cases for |LITERAL|@@>:
558
@@<|ASCII| cases for |TEX|@@>:
562
err_print(C,"! Invalid language command `@@@@L%c' ignored",XCHR(l));
566
opt_args(l); /* Set the language, and parse optional arguments after
570
@ Dynamic memory allocation.
572
@d SET_VAL(val,abbrev) val = find_abbrev((outer_char *)abbrev)->nunits
573
@d MAX_VAL(abbrev) find_abbrev((outer_char *)abbrev)->max
578
@@m UPPER(var) smin0(MAX_VAL(ABBREV(var))),ABBREV(var)
585
outer_char abbrev[3]; /* Two-character abbreviation for the
587
short bytes; /* Number of bytes in one unit. */
588
BUF_SIZE min, /* Minimum possible value. */
589
nunits, /* How many units to allocate, or the default
591
max; /* Maximum possible value. */
594
@ Masks for \FWEAVE\ stuff that may not want to be printed.
601
formats:1, Formats:1, /* Print \.{@@f}, \.{@@F}. */
602
limbo:1, /* Print \.{@@l}. */
603
macros:1, /* Print \.{@@m}. */
604
outer_macros:1, /* Print \.{@@d}. */
605
v:1, /* Print \.{@@v}. */
606
w:1 /* Print \.{@@w}. */
610
@ A number of unrelated parameters need to be saved simultaneously at
611
various points. Thus, we collect them into a structure, |params|. Since we
612
also need to be able to refer to them effectively, we use macro definitions
617
@D language params.Language
618
@D language_index params.Language_index
619
@D language_num params.Language_num
621
@D in_format params.In_format
622
@D in_data params.In_data
623
@D intermingle params.Intermingle
624
@%@D sharp_include_line params.Include_line
626
@D active_brackets params.Active_brackets
627
@D all_cmnts_verbatim params.All_cmnts_verbatim
628
@D all_includes params.All_includes
629
@D auto_app_semi params.Auto_app_semi
630
@D auto_semi params.Auto_semi[language_num]
631
@D auto_line params.Auto_line
632
@D auto_pseudo_semis params.Auto_pseudo_semis[language_num]
633
@D beeps params.Beeps
634
@D block_nums params.Block_nums[language_num]
635
@D bslash_continued_strings params.Bslash_continued_strings
636
@D color_mode params.Color_mode
637
@D chk_ifelse params.Chk_ifelse
638
@D chk_stmts params.Chk_stmts
639
@D compare_outfiles params.Compare_outfiles
640
@D compound_assignments params.Compound_assignments
642
@D Cpp_comments params.CPP_comments[language_num]
643
@D dbg_output params.Dbg_output
644
@D deferred_macros params.Deferred_macros
645
@D defn_mask params.Defn_mask
646
@D dot_constants params.Dot_constants
647
@D Fortran88 params.ForTran88
648
@D Fortran_label params.Fortran_Label
649
@D free_form_input params.Free_form_input[language_num]
650
@D ignore_C params.Ignore_C
651
@D in_escape params.In_escape[language_num]
652
@D index_hidden params.Index_hidden
653
@D index_one params.Index_one
654
@D input_macros params.Input_macros
655
@D keep_trailing_comments params.Keep_trailing_comments
656
@D lc_keywords params.Lc_keywords
657
@D line_info params.Line_info
658
@D lowercase_tokens params.Lowercase_tokens
660
@D makeindex params.Makeindex
661
@D no_xref params.No_xref
662
@D number_dos params.Number_dos
663
@D nuweb_mode params.Nuweb_mode
664
@D overload_ops params.Overload_ops
665
@D point_comments params.Point_comments[language_num]
666
@D prn_input_lines params.Prn_input_lines
667
@D prn_input_addresses params.Prn_input_addresses
668
@D prn_contents params.Prn_contents
669
@D prn_index params.Prn_index
670
@D prn_modules params.Prn_modules
671
@D prn_semis params.Prn_semis
672
@D prn_version params.Prn_version
673
@D quoted_includes params.Quoted_includes
674
@D Ratfor77 params.RatFor77
675
@D read_iformats params.Read_iformats
676
@D redefine_builtins params.Redefine_builtins
677
@D redefine_macros params.Redefine_macros
678
@D reverse_indices params.Reverse_indices[language_num]
679
@D rmv_files params.Rmv_files
680
@D skip_ifiles params.Skip_ifiles
681
@D skip_includes params.Skip_includes
682
@D statistics params.Statistics
683
@D subscript_fcns params.Subscript_fcns
684
@D suppress_cmds params.Suppress_cmds
685
@D TeX_processor params.TeX_Processor
686
@D toggle_includes params.Toggle_includes
687
@D top_version params.Top_version
688
@D translate_ASCII params.Translate_ASCII
689
@D translate_brackets params.Translate_brackets
690
@D truncate_ids params.Truncate_ids
691
@D try_extensions params.Try_extensions
692
@D xref_unnamed params.Xref_unnamed
696
typedef enum {TeX_p,LaTeX_p} TeX_PROCESSOR; /* What to use with \FWEAVE. */
700
NO_COLOR, ANSI_COLOR, BILEVEL, TRILEVEL, USER_COLORS
705
LANGUAGE Language; /* The current language. May be set by encountering
706
a module name, or by explicit \.{@@n}, \.{@@r}, or \.{@@c} commands. */
707
short Language_num,Language_index; /* These are set by
709
short uses; /* Number of times module is used. Incremented by
710
\FWEAVE\ in \.{@@<Append a module name@@>}. */
713
/* Flags for really current state. */
714
In_format, /* Inside a |@@r format| statement. */
715
In_data, /* Inside a |@@r data| statement. */
716
Intermingle, /* Inside something like a |@@r data|
718
Include_line, /* Inside an \&{include} line. */
719
/* Options flags. Some of these apply to all languages, others differ from
720
language to language and are thus arrays. */
721
Active_brackets, /* Special array handling? */
722
All_cmnts_verbatim, /* Should \.{TANGLE} copy all comments? . */
723
All_includes, /* Cross-reference all include files? */
724
Auto_app_semi, /* For \.{WEAVE}, automatically
725
append a pseudo-semi to the end of \.{WEB} macro definitions? */
726
Auto_semi[NUM_LANGUAGES], /* Fill in semicolon at end of source line? */
727
Auto_line, /* Auto-insert line number after \.{@@\%}? */
728
Auto_pseudo_semis[NUM_LANGUAGES],
729
/* F90 code: append pseudo-semis, not semis. */
730
Beeps, /* Do we beep the terminal for certain errors? */
731
Block_nums[NUM_LANGUAGES], /* */
732
Bslash_continued_strings, /* Do the continuations of
733
strings require a starting backslash? */
734
Chk_ifelse, /* Protect parenthesized strings? */
735
Chk_stmts, /* Check statement syntax in \Ratfor? */
736
Compare_outfiles, /* Check new (temporary) vs.\ old output? */
737
Compound_assignments, /* Do we allow things like \.{+=}? */
738
CPP, /* Do we recognize \.{C++}? */
739
CPP_comments[NUM_LANGUAGES], /* Allow short comments? */
740
Dbg_output, /* Print each character fired at output? */
741
Deferred_macros, /* Allow deferred macros? */
742
Dot_constants, /* Recognize dot constants like `\.{.eq.}'? */
743
ForTran88, /* Turn on stuff for Fortran-88? */
744
Fortran_Label, /* Label on same line? */
745
Free_form_input[NUM_LANGUAGES], /* Free-form syntax. */
746
Ignore_C, /* Throw away single \Fortran\ comment lines. */
747
In_escape[NUM_LANGUAGES], /* (|outer_char|) continuation character
749
Index_hidden, /* Index skipped include files. */
750
Index_one, /* Index single-character identifiers? */
751
Input_macros, /* Generate the default ``\.{\\input fwebmac}'' line? */
752
Keep_trailing_comments, /* For \TeX, retain comments that don't
754
Lc_keywords, /* Lower-case \Fortran\ and \Ratfor\ I/O keywords? */
755
Line_info, /* Should \FTANGLE\ print out line information? */
756
Lowercase_tokens, /* Output lower-case tokens (\Ratfor). */
757
M4, /* Recognize \.{M4} preprocessor commands? */
758
Makeindex, /* Output \.{makeindex} file? */
759
No_xref, /* Should \.{WEAVE} print an index? */
761
Nuweb_mode, /* Emulate \.{nuweb}? */
762
Overload_ops, /* Is operator overloading allowed? */
763
Point_comments[NUM_LANGUAGES], /* Does \.! signify a \Fortran\ or
765
Prn_contents, /* Print table of contents? */
766
Prn_index, /* Print index? */
767
Prn_input_lines, /* Used in |input_ln| to print out the lines sent
769
Prn_input_addresses, /* Print out the buffer addresses. */
770
Prn_modules, /* Print module list? */
771
Prn_semis, /* Print semicolons in \Fortran\ output. */
772
Prn_version, /* Print the \FWEB\ version? */
773
Quoted_includes, /* Cross-reference quoted include files? */
774
RatFor77, /* Expand \Ratfor\ code directly to \Fortran-77? */
775
Read_iformats, /* Read include files for formats. */
776
Redefine_builtins, /* Permit built-in functions to be redefined. */
777
Redefine_macros, /* Permit user macros to be redefined. */
778
Reverse_indices[NUM_LANGUAGES], /* C-style indexing in \Fortran? */
779
Rmv_files, /* Remove temporary files related to \.{-H}? */
780
Skip_ifiles, /* \.{-j} --- skip files already included. */
781
Skip_includes, /* For \.{WEAVE}, don't read in \.{@@I} commands.
782
(Uppercase '\.{I}' only.) */
783
Statistics, /* Print statistics about memory usage? */
784
Subscript_fcns, /* Put module references on functions? */
785
Suppress_cmds, /* ??? */
786
Toggle_includes, /* For \.{WEAVE}, read in \.{@@I} commands, but
787
don't print them out. */
788
Top_version, /* Header info at top of output? */
789
Translate_ASCII, /* Do we bother with the |xchr|--|xord|
791
Translate_brackets, /* Brackets to parentheses in \Fortran? */
792
Truncate_ids, /* Shorten identifiers? */
793
Try_extensions, /* Search through list of possible file names? */
794
Xref_unnamed; /* Cross-reference unnamed references? */
796
COLOR_MODE Color_mode; /* The color setting. */
797
DEFN_MASK Defn_mask; /* What defn's to print by \FWEAVE. */
798
TeX_PROCESSOR TeX_Processor; /* Processor to be used with \FWEAVE. */
800
outer_char HUGE*outp_nm[NUM_LANGUAGES]; /* Current output file names. */
801
FILE *outp_file[NUM_LANGUAGES]; /* File ptrs associated with above. */
804
IN_COMMON PARAMS params,global_params;
805
IN_COMMON boolean stop_the_scan;
807
@ We need to know what kind of construction is being parsed, so the
808
|get_line| routine can distinguish various input formats (for \FORTRAN).
812
typedef enum {OUTER,INNER} PARSING_MODE;
814
IN_COMMON PARSING_MODE parsing_mode CSET(OUTER);
816
@ More stuff related to parsing the input line.
818
@d preprocessing parse_params.Preprocessing
819
@d at_beginning parse_params.At_beginning
820
@d sharp_include_line parse_params.Sharp_include_line
821
@d sharp_pragma_line parse_params.Sharp_pragma_line
827
boolean Preprocessing; /* Are we scanning a preprocessor command? */
828
boolean At_beginning; /* Are we at logical beginning of line? */
829
boolean Sharp_include_line; /* Does line start with ``|#include|''? */
830
boolean Sharp_pragma_line; /* Starts with ``|#pragma|''? */
833
IN_COMMON PARSE_PARAMS parse_params
835
#if(part == 0 || part == 1)
841
@ On an |ASCII| machine, we can speed things up by not bothering with the
842
translations. (The flag |TRANSLATE_ASCII| is set in \.{os.hweb}.)
844
/* |ASCII| case changes. */
845
@d isAupper(c) (c<=@'Z' && c>=@'A')
846
@d isAlower(c) (c<=@'z' && c>=@'a')
848
@d SET_CASE(c) upper_case_code = BOOLEAN(isAupper(c))
849
/* Watch out for side effects. */
850
@d lower_case_code BOOLEAN(!upper_case_code)
852
@d A_TO_LOWER(c) (ASCII)(isAupper(c) ? (int)c+040 : c)
853
@d A_TO_UPPER(c) (ASCII)(isAlower(c) ? (int)c-040 : c)
855
/* Handle the difference between |ASCII| and |outer_char|. */
856
@d isAlpha(c) isalpha(XCHR(c))
857
@d isDigit(c) isdigit(XCHR(c)) /* We're working on |ASCII| input. */
858
@d isBdigit(c) ((c)==@'0' || (c)==@'1') /* Is it a binary numeral? */
859
@d isOdigit(c) (isDigit(c) && c!=@'8' && c!=@'9') /* Octal numeral? */
860
@d isXdigit(c) isxdigit(XCHR(c)) /* Hex numeral? */
864
EXTERN boolean upper_case_code SET(NO);
866
/* For debugging of target machines with a different character set than
867
that of the present machine, use the |DEBUG_XCHR| flag to force the
868
internal representation to be ``scrambled |ASCII|'', which replaces the
869
array~|xchr| with |wt_style.xchr|. */
871
#define XCHR_ wt_style.xchr /* Scrambled mapping. */
873
#define XCHR_ xchr /* The mapping for this machine. */
874
#endif /* |DEBUG_XCHR| */
877
#define XORD(outer) xord[outer]
878
#define XCHR(inner) XCHR_[inner]
879
#else /* Don't bother with the translations. */
880
#define XORD(outr) (outr) /* Funny spelling from Dethier's changes. */
881
#define XCHR(innr) (innr)
882
#endif /* |TRANSLATE_ASCII| */
884
typedef unsigned char ASCII; /* Type of characters inside \.{WEB}. */
886
@ Here is how reserved words are stored.
892
CONST char HUGE *reserved_word;
896
@ A global variable called |history| will contain one of four values
897
at the end of every run:
901
|SPOTLESS| means that no unusual messages were printed;
904
|HARMLESS_MESSAGE| means that a message of possible interest
905
was printed but no serious errors were detected;
908
|ERROR_MESSAGE| means that at least one error was found;
911
|FATAL_MESSAGE| means that the program terminated abnormally.
915
The value of |history| does not influence the behavior of the program; it
916
is simply computed for the convenience of systems that might want to use
922
if (history==SPOTLESS)
923
history = HARMLESS_MESSAGE;
929
history = ERROR_MESSAGE;
937
SPOTLESS, /* Normal jobs */
938
HARMLESS_MESSAGE, /* Non-serious info was printed */
939
ERROR_MESSAGE, /* An error was noted */
940
FATAL_MESSAGE /* We had to stop prematurely */
943
IN_COMMON HISTORY history CSET(SPOTLESS); /* indicates how bad this run was */
955
IN_COMMON MSG_LEVEL msg_level CSET(EVERYTHING); /* When to print. */
964
IN_COMMON TRACING_LEVEL tracing CSET(NONE); /* For debugging \.{WEAVE}. */
969
@@ A simple error message with no arguments is used frequently. Error
970
messages now carry an indication of their origin.
972
@@m err_print(origin,msg,...)
973
err0_print(ERR_##origin,OC(msg),#0,#.)
974
@@m err_print_(origin,msg,...)
975
err0_print(ERR_##origin,OC(msg),-1-#0,#.)
976
@@m ERR_PRINT(origin,msg) err_print(origin,msg)
978
@@m MACRO_ERR(msg,trail,...)
979
macro_err(OC(msg),trail,#.)
984
typedef enum {ERR_NULL,ERR_C,ERR_T,ERR_W,ERR_R,ERR_M,ERR_S,ERR_F} ERR_ORIGIN;
985
IN_COMMON boolean err_happened CSET(NO);
988
@ Code related to file handling. The open input files are maintained on a
989
stack, with the |WEB_FILE| at the top~(0). For every input file, there is
990
an associated change file.
992
@f line x /* Make |line| an unreserved word. */
994
@d OUTPUT_LINE outp_line[lan_num(language)]
995
@d OUTPUT_FILE_NAME outp_nm[lan_num(out_language)]
996
@d OUT_LANGUAGE(language)
997
(R77_or_F ? (Fortran88 ? FORTRAN_90 : FORTRAN) : language)
998
@d OUT_FILE_NAME outp_nm[lan_num(OUT_LANGUAGE(language))]
1003
if(putc((int)(c),out_file) == EOF)
1004
out_error(OC("putc"));
1007
@d MAX_FILE_NAME_LENGTH 200
1010
@D web_file_name prms[WEB_FILE].web.File_name /* Main source file name. */
1011
@D web_file prms[WEB_FILE].web.File /* Main source file. */
1013
@D CUR_FILE incl_depth
1014
@D cur_file_name prms[CUR_FILE].web.File_name /* Current input file name. */
1015
@D cur_file prms[CUR_FILE].web.File /* Current input file. */
1017
@D cur_line cur0_prms->Line /* Number of current line in current file. */
1019
@D change_file_name prms[CUR_FILE].change.File_name
1020
@D change_file prms[CUR_FILE].change.File
1021
@D change_line prms[CUR_FILE].change.Line
1023
/* --- Stuff used mostly within |input_ln| --- */
1024
@D num_in_buffer cur0_prms->Num_in_buffer
1025
@D comment_in_buffer cur0_prms->Comment_in_buffer
1026
@D scanning_C_cmnt cur0_prms->Scanning_C_cmnt
1027
@D start_C cur0_prms->Start_C
1028
@D last_was_empty cur0_prms->Last_was_empty
1029
@D continuing_line cur0_prms->Continuing_line
1030
@D last_was_continued cur0_prms->Last_was_continued
1032
/* The following are used as arguments to |input_ln|. */
1033
@D INPUT_FILE &prms[CUR_FILE].web
1034
@D CHANGE_FILE &prms[CUR_FILE].change
1036
/* --- Buffers --- */
1037
@D cur_buffer cur0_prms->Buffer
1038
@D buffer_end cur0_prms->Buffer_end
1039
@D limit cur0_prms->Limit /* points to the last character in the buffer. */
1041
@D change_buffer (cur_prms.change)->Buffer
1042
@D change_buffer_end (cur_prms.change)->Buffer_end
1043
@D change_limit (cur_prms.change)->Limit
1047
IN_COMMON LANGUAGE out_language; /* Current language for output file. */
1048
IN_COMMON FILE *out_file; /* Current output file pointer. */
1049
IN_COMMON int incl_depth; /* Current level of file nesting. */
1053
FILE *File; /* Pointer to file. */
1054
LINE_NUMBER Line; /* Line number. */
1055
ASCII HUGE *Buffer; /* Input buffer. */
1056
ASCII HUGE *Buffer_end;
1058
ASCII HUGE *Limit; /* Next unfilled position. */
1059
int Num_in_buffer; /* Number remaining to be read. */
1060
boolean Comment_in_buffer;
1061
boolean Found_at,At_line;
1062
boolean Scanning_C_cmnt,Start_C,Last_was_empty;
1063
boolean Continuing_line,Last_was_continued;
1064
outer_char File_name[MAX_FILE_NAME_LENGTH];
1067
IN_COMMON INPUT_PRMS0 HUGE *cur0_prms; /* Pointer to current parameters. */
1071
INPUT_PRMS0 HUGE *web, HUGE *change;
1074
IN_COMMON CUR_PRMS cur_prms; /* Address of current input parameters. */
1079
PARSING_MODE Parsing_mode;
1080
boolean Column_mode;
1085
ASCII HUGE *keyword, HUGE *txt;
1086
struct Rcs HUGE *next;
1091
RCS HUGE *start, HUGE *end;
1096
INPUT_PRMS0 web, change;
1097
INPUT_PARAMS input_params;
1098
RCS_LIST rcs_list; /* RCS keywords. */
1101
IN_COMMON BUF_SIZE max_include_depth;
1102
IN_COMMON INPUT_PRMS *prms; /* Stack of |max_include_depth+1| open files. */
1104
IN_COMMON outer_char HUGE *tex_fname; /* Name of |tex_file|. */
1105
#define tex_file out_file /* Where output of \.{WEAVE} goes. */
1107
IN_COMMON outer_char HUGE *fwebmac; /* The default macro package. */
1109
IN_COMMON boolean input_has_ended; /* If there is no more input. */
1110
IN_COMMON boolean changing; /* If the current line is from |change_file|. */
1114
outer_char HUGE *name; /* The ultimate output file name. */
1115
outer_char HUGE *tmp_name; /* Temporary file name, so new results
1116
can be compared with old ones. */
1117
FILE *ptr; /* A pointer to |tmp_name|. */
1118
eight_bits previously_opened; /* Possibly opened, but now closed. */
1119
eight_bits global_scope; /* To control closing at end of each sectn. */
1120
} OPEN_FILE; /* Info about previously opened files. */
1122
@ Short-hand for arguments to built-in functions.
1125
typedef eight_bits HUGE *PARGS[];
1128
To recognize the various built-in functions, we must search through
1131
@d MAX_DOT_LENGTH 31 /* Don't have to scan farther than this to see if it's
1132
a dot constant. The~31 is a \FORTRAN-90 limit. */
1136
IN_COMMON ASCII HUGE *id_first; /* Where the current identifier begins in
1138
IN_COMMON ASCII HUGE *id_loc; /* Just after the current identifier in the
1147
IN_COMMON BUILT_IN incl_likes[]
1149
#if(part == 0 || part == 1)
1151
{(ASCII *)"changequote",11},
1152
{(ASCII *)"ifelse",6},
1153
{(ASCII *)"include",7},
1154
{(ASCII *)"index",5},
1156
{(ASCII *)"maketemp",8},
1157
{(ASCII *)"sinclude",8},
1158
{(ASCII *)"substr",6},
1159
{(ASCII *)"syscmd",6},
1160
{(ASCII *)"translit",8},
1167
IN_COMMON BUILT_IN WEB_incl_likes[]
1169
#if(part == 0 || part == 1)
1171
{(ASCII *)"@!$COMMENT",8},
1172
{(ASCII *)"@!$DEFINE",7},
1173
{(ASCII *)"@!$ERROR",6},
1174
{(ASCII *)"@!$IF",3},
1175
{(ASCII *)"@!$IFCASE",7},
1176
{(ASCII *)"@!$IFELSE",7},
1177
{(ASCII *)"@!$LEN",4},
1178
{(ASCII *)"@!$M",2},
1179
{(ASCII *)"@!_COMMENT",8},
1180
{(ASCII *)"@!_DEFINE",7},
1181
{(ASCII *)"@!_ERROR",6},
1182
{(ASCII *)"@!_IF",3},
1183
{(ASCII *)"@!_IFCASE",7},
1184
{(ASCII *)"@!_IFELSE",7},
1185
{(ASCII *)"@!_LEN",4},
1186
{(ASCII *)"@!_M",2},
1193
@ A similar list takes care of \Ratfor-90 statements that mustn't be
1194
considered as statement labels.
1198
IN_COMMON BUILT_IN non_labels[]
1200
#if(part == 0 || part == 1)
1202
{(ASCII *)"contains",8},
1203
{(ASCII *)"default",7},
1204
{(ASCII *)"private",7},
1205
{(ASCII *)"protected",9},
1206
{(ASCII *)"public",6},
1207
{(ASCII *)"sequence",8},
1216
@D dot_const OCTAL(23)
1219
@@ FORTRAN uses constructions such as~|@@r .true.| or~|@@r .and.|, which we
1220
have to parse separately.
1222
@@m PREDEFINED_DOTS 14 /* \# of pre-initialized entries in the |dots| table. */
1231
eight_bits code; /* Something like |dot_const|. */
1232
eight_bits cat; /* Category code for special constants and
1234
eight_bits token; /* The tokenized meaning of this operator. */
1239
ASCII name[MAX_DOT_LENGTH+3]; /* Holds the macro name to be
1241
eight_bits cat; /* Category of the operator. */
1242
eight_bits num; /* Position in the table. */
1245
IN_COMMON DOT_OP dot_op
1247
#if(part == 0 || part == 1)
1253
@ The |macrobuf| is a character buffer used for expanding macros, or for
1254
holding macros defined from the input line. The present position in the
1255
|macrobuf| is~|mp|. For |macrobuf|, see \.{stacks.hweb} (\FTANGLE) or \FWEAVE.
1257
@d MAKE_RECURSIVE @'*' /* To allow a WEB macro to be recursive, preface its
1258
definition by this symbol, as in `\.{@@m *R R}'. (Recursive macros
1259
are not presently implemented.) */
1262
@d END_AUTO_INSERT @']'
1264
@d PROTECTED @'!' /* A protected macro ---`\.{@@m!}'---may not be redefined. */
1268
IN_COMMON boolean in_macro CSET(NO);
1270
IN_COMMON BUF_SIZE mbuf_size; /* Set dynamically. */
1271
IN_COMMON eight_bits HUGE *mp; /* Next available position in |macrobuf|. */
1273
IN_COMMON boolean from_buffer CSET(NO); /* Are we reading from a buffer? */
1275
@ Stuff related to command-line arguments.
1279
IN_COMMON int argc; /* copy of |ac| parameter to |main| */
1280
IN_COMMON outer_char **argv; /* copy of |av| parameter to |main| */
1281
IN_COMMON outer_char HUGE *pa, *pa_begin; /* Current/init value of |*argv|. */
1283
@ Defaults for |boolean| flags, etc.
1286
@d ACTIVE_BRACKETS NO
1287
@d ALL_CMNTS_VERBATIM NO
1291
@d AUTO_PSEUDO_SEMIS YES
1294
@d BSLASH_CONTINUED_STRINGS NO
1297
@d COLOR_MODE0 NO_COLOR
1298
@d COMPARE_OUTFILES NO
1299
@d COMPOUND_ASSIGNMENTS YES
1302
@d DEFERRED_MACROS NO
1303
@d DOT_CONSTANTS YES
1304
@d FORTRAN88 NO /* By default, it's \FORTRAN-77. */
1305
@d FORTRAN_LABEL YES
1306
@d FREE_FORM_INPUT YES
1313
@d KEEP_TRAILING_COMMENTS YES
1314
@d LC_KEYWORDS YES /* Changed 1/11/98 */
1316
@d LOWERCASE_TOKENS NO
1323
@d POINT_COMMENTS NO
1325
@d PRN_OUTER_MACROS YES
1336
@d QUOTED_INCLUDES NO
1339
@d REDEFINE_BUILTINS NO
1340
@d REDEFINE_MACROS NO
1341
@d REVERSE_INDICES NO
1346
@d SUBSCRIPT_FCNS YES
1347
@d TOGGLE_INCLUDES NO
1349
@d TRANSLATE_ASCII0 NO
1350
@d TRANSLATE_BRACKETS YES
1351
@d TRY_EXTENSIONS NO
1352
@d TEX_PROCESSOR LaTeX_p
1355
@d CCHAR '&' /* Default \FORTRAN\ continuation character. */
1357
@d NUM_RATFOR_CMDS 20 /* The total number of reserved \RATFOR\ keywords.
1358
This is used for an array size later on. */
1360
@ A structure used for |see_reserved| and |id_info|.
1365
outer_char HUGE *args;
1366
boolean intrinsics, keywords, reserveds;
1372
IN_COMMON outer_char cchar CSET(CCHAR); /* Fortran's continuation
1375
IN_COMMON ASCII cont_char CSET(@'\\'); /* Current continuation char for eol. */
1376
IN_COMMON boolean free_Fortran CSET(NO); /* Free-form syntax in \Fortran. */
1377
IN_COMMON boolean free_90 CSET(NO); /* \Fortran/\Ratfor-90 and free-form syntax. */
1379
IN_COMMON unsigned short tr_max[NUM_LANGUAGES]
1381
#if(part == 0 || part == 1)
1387
IN_COMMON CONST char HUGE *filter_char[NUM_LANGUAGES]
1389
#if(part == 0 || part == 1)
1390
= {"","_","_","","", "","_","_"}
1395
IN_COMMON outer_char abbrev_cmds[NUM_RATFOR_CMDS+1] CSET(""); /* Nothing
1396
suppressed by default. */
1398
@ Holds the command-line arguments, after expansion from the ini file.
1401
IN_COMMON outer_char HUGE *cmd_ln_buf;
1403
@ The global variable |word_type| holds the type of identifier that
1404
|id_lookup| will work on next. This comes into play when the |last|
1405
argument to |id_lookup| is |NULL|. In this case, |id_lookup| finds its own
1406
end of the identifier.
1408
@D mod_info info.mod
1409
@D mod_ilk mod_info->Ilk
1410
@D macro_type info.Macro_type
1412
@D defined_in(languag) dummy.defined_info[lan_num(languag)].section
1413
@D defined_type(languag) dummy.defined_info[lan_num(languag)].type
1414
@D ilk Ilk[language_num]
1415
@D expandable dummy.RX.Expandable
1416
@D rlink dummy.RX.Rlink
1417
@D x_translate dummy.RX.Expand
1419
@f HUGE_FCN_PTR huge
1423
typedef enum {NO_TYPE,ORDINARY_ID,RESERVED_WD,INTRINSIC_FCN,KEYWD} WORD_TYPE;
1425
IN_COMMON WORD_TYPE word_type CSET(ORDINARY_ID);
1427
#define X_FCN SRTN /* |typedef| didn't work on the VAX. */
1429
typedef struct RX_link
1431
struct name_info HUGE *Rlink; /* right link in binary search tree for
1433
X_FCN (HUGE_FCN_PTR * HUGE *Expand)(VOID); /* Array of functions
1434
for keyword expansion (one for each language). */
1435
boolean Expandable; /* For which language is this expandable? */
1444
IN_COMMON boolean index_flag; /* Print identifier in index? */
1446
typedef boolean NAME_TYPE; /* Type of identifier, enumerated below. */
1448
enum {NEVER_DEFINED=0,
1449
GENERIC_NAME,FUNCTION_NAME,M_MACRO,D_MACRO,IMPLICIT_RESERVED,
1451
NEVER_DEFINED0=0x80,
1452
GENERIC_NAME0,FUNCTION_NAME0,M_MACRO0,D_MACRO0,IMPLICIT_RESERVED0,
1455
/* Maybe the |defined_type| is already marked to not appear in the index.
1456
(It's $> 128$.) To properly set a new type, we use a macro to keep the
1457
flag and attach it to the new type. */
1458
#define SET_TYPE(p,type) p->defined_type(language) =\
1459
((boolean)(type) | (boolean)((p->defined_type(language) & 0x80)))
1461
/* To recover the base type, use the following, which strips off the flag: */
1462
#define DEFINED_TYPE(p) (p->defined_type(language) & 0x7F)
1466
sixteen_bits section; /* Section number where identifier defined. */
1467
NAME_TYPE type; /* Kind of identifier, such as function name. */
1472
ASCII HUGE *text; /* The replacement text for the macro. */
1473
unsigned int len; /* Length of replacement text. */
1474
eight_bits cat; /* Category code. */
1477
typedef struct name_info
1479
ASCII HUGE *byte_start; /* Beginning of the name in |byte_mem|. */
1480
struct name_info HUGE *link; /* Used for hashing. */
1483
struct RX_link RX; /* For \FTANGLE. */
1484
DEFINED_INFO defined_info[NUM_LANGUAGES]; /* For \FWEAVE. */
1486
boolean reserved_word,intrinsic_word,keyword;
1490
char Macro_type; /* For \FTANGLE. */
1491
boolean upper_case; /* For \FWEAVE\ identifiers. */
1492
MOD_INFO HUGE *mod; /* For \FWEAVE\ module names */
1494
eight_bits Ilk[NUM_LANGUAGES];/* Used by ident.'s in \WEAVE\ only. */
1495
ASCII HUGE *equiv_or_xref; /* Info corresponding to names. */
1496
WV_MACRO HUGE *wv_macro; /* For fancy identifiers. */
1497
} NAME_INFO; /* Contains information about an identifier or mod
1500
typedef NAME_INFO HUGE *name_pointer; /* pointer into array of |name_info|s. */
1505
@@f HUGE_FCN_PTR huge
1506
@@<Initialize |mod_info| and |Language|@@>=
1508
/* We allocate |MOD_INFO| structures only for module names, not for
1510
node->mod_info = GET_MEM("mod_info",1,MOD_INFO);
1512
node->mod_info->Ilk = expr;
1513
node->mod_info->params = params; /* Freeze parameters at this point in time. */
1514
node->mod_info->params.uses = 0; /* Uses are counted in |new_mod_xref|. */
1516
node->Language = (boolean)language; /* Redundant. */
1522
IN_COMMON BUF_SIZE max_bytes;
1523
IN_COMMON ASCII HUGE *byte_mem; /* Dynamic array: characters of names. */
1524
IN_COMMON ASCII HUGE *byte_end; /* End of |byte_mem|. */
1526
IN_COMMON BUF_SIZE max_names;
1527
IN_COMMON NAME_INFO HUGE *name_dir; /* Dynamic array: information about
1529
IN_COMMON name_pointer name_end; /* End of |name_dir|. */
1530
IN_COMMON name_pointer npmax; /* |name_ptr - 1|. */
1532
IN_COMMON BUF_SIZE longest_name;
1533
IN_COMMON ASCII HUGE *mod_text; /* Dynamic array: name being sought for. */
1534
IN_COMMON ASCII HUGE *mod_end; /* End of |mod_text|. */
1539
@d USED_BY_NEITHER ((eight_bits)0xFF)
1540
@d USED_BY_OTHER ignore
1543
@@ For initializing |ccodes|.
1545
@@m INI_CCODE(defaults,code)
1546
ini_ccode((outer_char *)#code,(outer_char *)defaults,code)
1547
/* We use the same keyword name as the \FWEB\ code. */
1549
@@m REASSIGNABLE(d,c) INI_CCODE(d,c) /* For stuff that must later be
1550
reassigned for \FTANGLE. */
1552
@@m SAME_CCODE(d,c) INI_CCODE(d,c)
1557
@@ Macros to guard against overflow during |sprintf| or |vprintf|. The function
1558
|nsprintf| is defined in \.{common.web} to handle non-ANSI return values from
1561
@@m NSPRINTF(buf_name,fmt,...)
1562
nsprintf(buf_name,OC(fmt),#0,#.)
1563
@@m NVSPRINTF(buf_name,fmt,...)
1564
nvsprintf(buf_name,OC(fmt),#0,#.)
1566
@@m SPRINTF(nmax,buf_name,args)
1567
if(NSPRINTF(buf_name,args) >= (int)(nmax)) OVERFLW(#buf_name,"")@@;
1569
@@m VSPRINTF(nmax,buf_name,args)
1570
if(NVSPRINTF(buf_name,args) >= (int)(nmax)) OVERFLW(#buf_name,"")@@;
1572
@@m vsprintf_(out,fmt,arg_ptr)
1573
@!$P if(NUM_VA_ARGS == 1)
1575
char *fmt0 = va_arg(arg_ptr,char *);
1577
va_arg(arg_ptr,int); /* Skip over~$n$. */
1578
vsprintf((char *)out,fmt0,arg_ptr);
1581
vsprintf(out,fmt,arg_ptr);
1584
@@m vprintf_(fmt,arg_ptr)
1585
@!$P if(NUM_VA_ARGS == 1)
1587
char *fmt0 = va_arg(arg_ptr,char *);
1589
va_arg(arg_ptr,int);
1590
vprintf(out,fmt0,arg_ptr);
1593
vprintf(fmt,arg_ptr);
1603
@@ Abbreviations for buffer allocations.
1605
@@m ABBREV(name) V_##name
1608
@@m V_C_buf_size "cb"
1609
@@m V_cmd_fsize "cf"
1611
@@m V_delta_dots "d"
1612
@@m V_line_length "ll"
1613
@@m V_longest_name "ln"
1615
@@m V_dtexts_max "dx"
1616
@@m V_max_dtoks "dt"
1617
@@m V_max_expr_chars "lx"
1619
@@m V_max_margs "ma"
1620
@@m V_max_ifiles "if"
1621
@@m V_max_include_depth "id"
1622
@@m V_max_keywords "rk"
1623
@@m V_max_modules "m"
1626
@@m V_max_scraps "s"
1628
@@m V_max_toks_t "tt"
1629
@@m V_max_toks_w "tw"
1630
@@m V_mbuf_size "mb"
1631
@@m V_op_entries "op"
1632
@@m V_num_files "nf"
1634
@@m V_stck_size_t "kt"
1635
@@m V_stck_size_w "kw"
1636
@@m V_X_buf_size "xb"
1638
@ Operator overloading.
1641
/* Information for each language. */
1644
CONST outer_char *op_macro; /* The default \FWEB\ macro. */
1645
boolean overloaded; /* Has it been overloaded? */
1646
eight_bits cat; /* Category code for this operator. */
1647
outer_char HUGE *defn; /* Replacement text for the \Fortran\ macro. */
1650
/* The description of an operator. */
1653
ASCII HUGE *op_name; /* \Fortran-like name of operator. Not |const|
1654
because it's converted to |ASCII|. */
1655
OP_INFO info[NUM_LANGUAGES];
1661
@D MD "[1m" /* High intensity */
1662
@D US "[4m" /* Underline */
1663
@D MR "[7m" /* Reverse video */
1664
@D MO "[m" /* Revert to normal */
1666
/* In the following, the |ordinary| setting is necessary to kill off
1667
underlining. Should do this for |sset_color| as well. */
1669
set_color(wt_style.color.ordinary.value),
1670
set_color(wt_style.color.field.value)
1672
@d SSET_COLOR(field) sset_color(wt_style.color.field.value)
1674
@d CLR_PRINTF(when, field, args)
1676
if(msg_level >= when)
1679
printf args; fflush(stdout);
1680
set_color(color0.last);
1689
BLACK,RED,GREEN,YELLOW,BLUE,MAGENTA,CYAN,WHITE,NORMAL,HIGHEST_COLOR
1692
IN_STYLE CONST char *clr_name[]
1695
"black","red","green","yellow","blue","magenta","cyan", "white",
1705
IN_COMMON COLOR0 color0
1707
#if(part == 0 || part == 1)
1715
short n; /* Number of escape sequences attached to this color. */
1716
outer_char **string; /* Array of pointers to those sequences. */
1719
/* A buffer for an array of strings. */
1729
IN_STYLE outer_char HUGE *termcap; /* Name of termcap file. */
1730
IN_STYLE BUF sput_buf; /* For temporary color strings. */
1731
IN_COMMON BUF c_buf; /* For commas. */
1739
TeX_escape,TeX_bgroup,TeX_egroup,TeX_math_shift,TeX_alignment_tab,
1740
TeX_eol,TeX_parameter,TeX_superscript,TeX_subscript,TeX_ignored,
1741
TeX_space,TeX_letter,TeX_other,TeX_active,TeX_comment,TeX_invalid
1744
IN_COMMON TeX_CATEGORY TeX[128];
1746
@ Because we must compare tokens to see if they're the special ones, and we
1747
don't know where they are in the table, we'll initialize individual
1748
variables with the appropriate values returned from |id_lookup|.
1754
EXTERN sixteen_bits id_defined;
1758
CONST char HUGE *name; /* Identifier. */
1759
int len; /* Length of identifier. */
1760
X_FCN (HUGE_FCN_PTR *expand)(VOID); /* Function that expands this
1762
sixteen_bits HUGE *pid; /* Address of the |sixteen_bits| that is to be
1766
@ Here we define the text that may be inserted automatically after a
1767
\Ratfor\ program unit.
1773
eight_bits *start; /* Macro to be inserted. */
1774
eight_bits *end; /* End of |start|. */
1779
INSERT_TEXT program,module,subroutine,function,blockdata,interface;
1785
boolean Rat_OK PROTO((outer_char *msg));
1786
IN_COMMON boolean Rat_is_loaded; /* Set by call to |is_Rat_present|. */
1787
IN_COMMON boolean xpn_Ratfor CSET(YES);
1789
IN_TANGLE int spcs_after_cmnt TSET(0);/* Turned on for Ratfor error
1791
IN_TANGLE int brace_level TSET(0);
1792
IN_TANGLE boolean checking_label TSET(NO);
1793
IN_TANGLE INSERT_MATERIAL insert; /* For automatic insertions. */
1795
@ The following structure is used to remember where loops etc.\ began.
1797
When we encounter the beginning of a program, module, subroutine, or
1798
function, we store the identifier token of the program unit's name in
1799
|cur_fcn|. This can be used by the built-in |$ROUTINE|, or in various error
1802
@D cur_fcn begun[rlevel-1].name
1803
@D NO_FCN (sixteen_bits)0
1804
/* Value of |cur_fcn| when function name is unknown. */
1806
@D cur_struct begun[rlevel-1].name
1807
@D is_function begun[rlevel-1].function
1808
@D symbolic_label begun[rlevel-1].symbolic
1815
block_CMD,blockdata_CMD,
1816
break_CMD,case_CMD,contains_CMD,
1817
default_CMD,do_CMD,for_CMD,function_CMD,
1818
if_CMD,interface_CMD,module_CMD,next_CMD,program_CMD,
1819
repeat_CMD,return_CMD,type_CMD,subroutine_CMD,switch_CMD,until_CMD,
1825
CMD cmd; /* Type of keyword being expanded. */
1826
sixteen_bits name; /* Identifier for this program unit. */
1827
sixteen_bits symbolic; /* Symbolic loop label. */
1828
boolean function; /* Is this a function? */
1829
LINE_NUMBER line; /* Line number at which expansion started. */
1830
int level; /* Expansion level. */
1833
IN_TANGLE BEGUN HUGE *begun; /* Dynamic array. */
1834
IN_TANGLE int rlevel TSET(0); /* Current level of \Ratfor\ expansion. This is
1835
incremented for each expandable \Ratfor\ keyword. */
1837
@ The routine |prsw_regular_code| has various nifty branches that the
1838
outside world needs to access.
1842
/* The C370 compiler will do strange integer promotions, if we
1843
don't force it to do better. (Thorsten Ohl.) */
1845
{MORE_PARSE=-1,GOTO_MISTAKE=-2,GOTO_GET_IDENTIFIER=-3,
1846
GOTO_GET_A_STRING=-4,GOTO_SKIP_A_COMMENT=-5,GOTO_MVS_KLUDGE=32000}
1848
@#else /* Not |MVS|. */
1850
{MORE_PARSE=-1,GOTO_MISTAKE=-2,GOTO_GET_IDENTIFIER=-3,
1851
GOTO_GET_A_STRING=-4,GOTO_SKIP_A_COMMENT=-5} @[GOTO_CODE;
1852
@#endif /* Not |MVS|. */
1855
@ Here we identify which part of the code we're dealing with.
1857
@d mark_defined w_style.misc.mark
1861
typedef enum {LIMBO,TEX_,DEFINITION,CODE} PART;
1863
IN_COMMON PART the_part CSET(LIMBO);
1867
int generic_name,fcn_name,WEB_macro,outer_macro,imp_reserved_name,
1871
@ What macros to use to format identifiers.
1877
outer_char *reserved, *RESERVED;
1878
outer_char *short_id;
1879
outer_char *id, *ID;
1880
outer_char *id_outer, *ID_OUTER;
1881
outer_char *id_inner, *ID_INNER;
1882
outer_char *intrinsic;
1883
outer_char *keyword, *KEYWORD;
1884
outer_char *typewritr;
1885
outer_char *wildcrd;
1888
@ Options for \LaTeX.
1894
outer_char *options;
1900
OPTIONS_FILE class, package;
1903
@ Stuff for the style file.
1906
typedef char CC_BUF[2][40]; /* One line of output for the control codes. */
1911
IN_STYLE outer_char HUGE *sbuf, HUGE *sbuf_end;/* One line of style file. */
1912
IN_STYLE CONST outer_char HUGE *sloc; /* Position in |sbuffer|. */
1913
IN_STYLE outer_char HUGE *slimit; /* Next available position in buffer. */
1914
IN_STYLE LINE_NUMBER s_line SSET(0); /* Input line number. */
1916
@ Additional macros for compatibility between |char| and |outer_char|.
1917
@d OC(s) ((outer_char HUGE *)(s))
1919
@d STAT0(name,size,num,max_num,abs_max_num,abbrev,ctrl_chars)
1920
stat0(OC(name),size,num,max_num,abs_max_num,
1921
OC(abbrev),OC(ctrl_chars))
1923
@d OVERFLW(msg,abbrev) overflow(OC(msg),OC(abbrev))
1924
@d NEW_SPRM(name, value) new_sprm(OC(name), value)
1927
@d RAT_OK(msg) Rat_OK(OC(msg))
1931
@d APP_STR(s) app_str(OC(s))
1936
@@m RAT_ERROR(err_type, msg, n, ...)
1937
RAT_error(err_type, OC(msg), n, #.)
1938
@@m CONFUSION(where, fmt0, ...)
1939
confusion(OC(where), OC(fmt0), #.)
1940
@@m FATAL(origin, msg1, fmt, ...)
1941
fatal(ERR_##origin, OC(msg1), OC(fmt), #.)
1943
@* DEFINITIONS for TANGLE and WEAVE. Here's stuff required for
1944
\.{tangle.web} and \.{weave.web}.
1946
@ As much as possible, we adhere to ANSI conventions. However, to support
1947
pre-ANSI compilers such as \.{gcc}, we must make some modifications. It is
1948
assumed that the compilers predefine macros such as |vax|, |sun|, or |mac|,
1949
in \It{lower case}; if they do not, then these macros must be defined from
1950
the command line. In addition, the \WEB\ files must be tangled with
1951
\It{upper case} macros such as |VAX|, |SUN|, or |MAC| defined from the
1952
command line, as in \.{ftangle tangle -m"SUN"}. It is conventional to put
1953
the machine macro command into the ini file \.{.fweb}, as in ``\.{+mSUN}''.
1955
@ The following flag is used for \Cpp. (??)
1958
EXTERN boolean long_comment;
1960
@ Code related to the character set. \It{Mess around here only at your own
1963
@D and_and OCTAL(4) /* `|&&|'.*/
1964
@D star_star OCTAL(5) /* `|@@r x**y|' .*/
1966
/* The next two only occur in different languages, so they can have the same
1968
@D neqv OCTAL(10) /* `|@@r .neqv.|'.*/
1969
@D ellipsis neqv /* `|...|'.*/
1971
@D stmt_label OCTAL(30)
1973
@D slash_slash OCTAL(26) /* Concatenation `|@@r \/|' .*/
1975
@D bell OCTAL(7) /* |ASCII| code for ringing the bell.*/
1976
@D tab_mark @'\t' /* |ASCII| code used as tab-skip.*/
1977
@D line_feed OCTAL(12) /* |ASCII| code thrown away at end of line; $\equiv$
1979
@D form_feed OCTAL(14) /* |ASCII| code used at end of page.*/
1980
@D carriage_return OCTAL(15) /* |ASCII| code used at end of line.*/
1982
@D gt_gt OCTAL(20) /* `|>>|'; this doesn't exist in MIT.*/
1983
@D lt_lt OCTAL(22) /* `|<<|'; this doesn't exist in MIT.*/
1985
@D plus_plus OCTAL(13) /* `|++|'; this corresponds to MIT's up-arrow.*/
1986
@D minus_minus OCTAL(1) /* `|--|'; this corresponds to MIT's down-arrow.*/
1988
@D minus_gt OCTAL(31) /* `|->|'.*/
1989
@D eqv minus_gt /* `|@@r .eqv.|'.*/
1991
@D not_eq OCTAL(32) /* `|!=|'.*/
1993
@D paste OCTAL(33) /* `|##|'.*/
1995
@D lt_eq OCTAL(34) /* `|<=|'.*/
1996
@D gt_eq OCTAL(35) /* `|>=|'.*/
1998
@D eq_eq OCTAL(36) /* `|==|'.*/
2000
@D or_or OCTAL(37) /* `||| |'.*/
2002
@D begin_language OCTAL(16) /* Mark a language switch.*/
2004
@D left_array OCTAL(21) /* `$\LS$'.*/
2005
@D right_array OCTAL(25) /* `$\SR$'.*/
2007
@D interior_semi OCTAL(24) /* `\.;'. In \Fortran, a semicolon that's already
2008
present in the input line, as opposed to one that's inserted by
2014
IN_COMMON ASCII xord[]; /* specifies conversion of input characters. */
2015
#ifdef scramble_ASCII
2016
IN_COMMON ASCII xxord[];
2018
IN_COMMON outer_char xchr[]; /* specifies conversion of output characters. */
2020
@ Code related to input routines:
2024
IN_COMMON BUF_SIZE buf_size; /* Used for \FWEAVE; see \.{common.web}. */
2025
IN_COMMON ASCII HUGE *loc; /* points to the next character to be read from the
2030
unsigned size; /* Length of |list|. */
2031
unsigned num; /* Number of entries (e.g., number of colons). */
2032
outer_char HUGE *list; /* Colon-delimited List of include files. */
2035
@ Code related to identifier and module name storage:
2037
@d ID_FLAG 10240 /* \bf DON'T MONKEY WITH THIS NUMBER!. */
2039
@d length(c) ((c+1)->byte_start-(c)->byte_start) /* the length of a name. */
2041
@d llink link /* left link in binary search tree for module names. */
2042
@d root CAST(name_pointer,name_dir)->rlink /* the root of the binary search
2043
tree for module names */
2045
@d is_intrinsic(n) (n->intrinsic_word & (boolean)language)
2046
@d is_keyword(n) (n->keyword & (boolean)language)
2050
IN_COMMON name_pointer name_ptr; /* first unused position in |byte_start|. */
2051
IN_COMMON ASCII HUGE *byte_ptr; /* first unused position in |byte_mem|. */
2053
typedef name_pointer HUGE *hash_pointer;
2054
IN_COMMON hash_pointer hash, /* heads of hash lists */
2055
hash_end, /* end of |hash| */
2056
h; /* index into hash-head array */
2059
@ To distinguish between the constructions \.{@@<\dots@@>} and
2060
\.{\#<\dots@@>}, both of which return |module_name|, we introduce the flag
2065
EXTERN boolean mac_mod_name;
2067
@ Module-name level:
2071
IN_COMMON int mod_level CSET(0);
2073
@ Code related to module numbers:
2075
@d BTRANS mod_trans(OC("beginning in section"),module_count) /* English! */
2076
@d MTRANS mod_trans(OC("section"),module_count) /* String including section and
2077
page info. English! */
2078
@d MTRANS0 mod_trans(OC(""),module_count)
2079
@d MOD_TRANS(mnum) mod_trans(OC("section"), mnum) /* English! */
2083
IN_COMMON sixteen_bits module_count; /* The current module number. */
2084
IN_COMMON boolean HUGE *chngd_module; /* Dynamic array: Is the module/
2086
IN_COMMON boolean prn_where; /* Tells \.{TANGLE} to print line and file
2089
@ Code relating to output:
2091
@d UPDATE_TERMINAL fflush(stdout) /* Empty the terminal output buffer. */
2092
@d new_line putchar('\n') @d putxchar putchar
2093
@d ASCII_write(p0,n) fflush(stdout),
2094
ASCII_file_write(stdout,p0,(int)(n))@;
2095
/* Write on the standard output, converting from |ASCII|. */
2097
@ For FORTRAN, \&{format} commands are annoying, because the use of slashes
2098
doesn't fit with the rest of the \Fortran\ syntax. Thus, we'll deal with the
2099
|format| statement something like a preprocessor statement, in that we'll
2100
raise a special flag when we're inside it, and issue special tokens to
2101
indicate the start and the end of the statement.
2103
@D begin_format_stmt OCTAL(171)
2104
@D end_format_stmt OCTAL(172)
2108
@d is_identifier(c) (isAlpha(c) || c==@'_' || c==@'$' ||
2109
(c==@'%' && !C_LIKE(language) && !Fortran88) )
2110
/* This defines the starting character of an identifier. */
2112
@d is_kind(c) (isDigit(c) || isAlpha(c) || c==@'_' || c==@'$')
2113
/* \Fortran-90 kind parameter. */
2116
@@ For~C, getting an identifier is simple. For FORTRAN, we treat \&{format}
2117
statements much like C's preprocessor statement. However, there's no
2118
special character to start a \&{format} line; we have to actually check the
2119
identifier. Furthermore, it looks nicer if constructions such as \\{f6.2}
2120
are treated as one identifier, so when we're inside a \&{format} statement
2121
we allow the period to be an acceptable (internal) character for an
2124
@@<Get an identifier@@>=
2126
IN_COMMON ASCII HUGE *pformat, HUGE *pdata;
2129
@@<Make |id_first| and |id_loc| point to the identifier@@>@@;
2131
if(FORTRAN_LIKE(language))
2133
if(web_strcmp(pformat,pformat+6,id_first,id_loc) == EQUAL)
2134
{ /* Raise special flag to say we're inside a |@@r format|
2137
return begin_format_stmt;
2139
else if(program==weave)
2141
if(web_strcmp(pdata,pdata+4,id_first,id_loc) == EQUAL)
2142
{ /* Inside a |@@r data| statement. */
2146
else if(at_beginning && *loc==@':' &&
2147
!is_in(non_labels,id_first,id_loc))
2152
if(is_include_like())
2153
sharp_include_line = YES;
2161
@@<Make |id_first|...@@>=
2165
/* Scan over subsequent elements of an identifier. */
2166
for(++loc; isAlpha(*loc) || isDigit(*loc)
2167
|| *loc==@@'_' || *loc==@@'$' || (in_format && *loc==@@'.'); loc++)
2170
upcoming_kind = BOOLEAN(Fortran88 && (*loc == @'"' || *loc == @'\'')
2171
&& loc[-1] == @'_');
2173
id_loc = loc - upcoming_kind; /* End plus one of the identifier. If a
2174
kind subscript is coming up, don't include the underscore. */
2179
@@ Here we obtain the file name after an \.{@@@@o}~command.
2180
@@<Scan the output file name@@>=
2182
while(*loc == @' ' || *loc == tab_mark)
2185
if(loc > limit) return ignore;
2189
while(*loc != @' ' && *loc != tab_mark) loc++; /* Absorb file name. */
2191
if(*id_first == @'"') id_first++;
2192
if(*(id_loc-1) == @'"') id_loc--;
2193
if(id_loc - id_first >= MAX_FILE_NAME_LENGTH)
2195
err_print(T,"Output file name too long; allowed only %d characters",
2196
MAX_FILE_NAME_LENGTH - 1);
2197
id_loc = id_first + MAX_FILE_NAME_LENGTH - 1;
2201
@ These tables are initialized during |common_init|.
2214
extern DOTS HUGE *dots; /* The dynamic table; see \.{common.web}. */
2219
#if(part == 0 || part == 1)
2221
{(ASCII *)"@@@@@@",3,dot_const,expr,0}, /* Dummy */
2222
{(ASCII *)"AND",3,dot_const,binop,and_and}, /* |and_and| */
2223
{(ASCII *)"EQ",2,dot_const,binop,eq_eq}, /* |eq_eq| */
2224
{(ASCII *)"EQV",3,dot_const,binop,eqv}, /* |eqv| */
2225
{(ASCII *)"FALSE",5,dot_const,expr,0},
2226
{(ASCII *)"GE",2,dot_const,binop,gt_eq}, /* |gt_eq| */
2227
{(ASCII *)"GT",2,dot_const,binop,@'>'}, /* |@'>'| */
2228
{(ASCII *)"LE",2,dot_const,binop,lt_eq}, /* |lt_eq| */
2229
{(ASCII *)"LT",2,dot_const,binop,@'<'}, /* |@'<'| */
2230
{(ASCII *)"NE",2,dot_const,binop,not_eq}, /* |not_eq| */
2231
{(ASCII *)"NEQV",4,dot_const,binop,neqv}, /* |neqv| */
2232
{(ASCII *)"NOT",3,dot_const,unop,@'!'}, /* |@'!'| */
2233
{(ASCII *)"OR",2,dot_const,binop,or_or}, /* |or_or| */
2234
{(ASCII *)"TRUE",4,dot_const,expr,1},
2235
{(ASCII *)"XOR",3,dot_const,binop,neqv}, /* |neqv| */
2236
{(ASCII *)"",0,0,0,0}
2238
#endif /* |part == 1| */
2240
#endif /* |_FWEB_h| */
2242
@ The preprocessor commands have a similar format.
2248
#if(part ==0 || part == 1)
2250
{(ASCII *)"define",6,WEB_definition},
2251
{(ASCII *)"elif",4,m_elif},
2252
{(ASCII *)"elseif",6,m_elif},
2253
{(ASCII *)"else",4,m_else},
2254
{(ASCII *)"endfor",6,m_endfor},
2255
{(ASCII *)"endif",5,m_endif},
2256
{(ASCII *)"for",3,m_for},
2257
{(ASCII *)"if",2,m_if},
2258
{(ASCII *)"ifdef",5,m_ifdef},
2259
{(ASCII *)"ifndef",6,m_ifndef},
2260
{(ASCII *)"line",4,m_line},
2261
{(ASCII *)"undef",5,m_undef},
2264
#endif /* |part == 1| */
2266
#endif /* |_FWEB_h| */
2270
@@ The preprocessor commands are piggy-backed on the \.{@@@@\#} command. If
2271
there's text after that command, then we hunt through the above table.
2272
If we find a processor command, any subsequent white space is skipped.
2273
(This was added for nuweb mode, which otherwise takes each blank one at a
2274
time.) Otherwise, it's a |big_line_break|.
2276
@@<Process possible preprocessor command@@>=
2280
*limit = @' '; /* Terminator for identifier search. */
2283
while(isAlpha(*loc))
2284
loc++; /* Find end of identifier. */
2286
if((mcode=is_mcmd(mcmds,id_first,loc)) != 0)
2288
while(loc < limit && (*loc == @@' ' || *loc == tab_mark))
2292
defd_switch = NO; /* Don't let \.{@@@@[} propagate. */
2298
loc = id_first; /* Failed to recognize preprocessor command. */
2301
@ Here are macros for use with memory allocation.
2303
@d GET_MEM(why,nunits,type)
2304
(type HUGE *)get_mem0((outer_char *)why,(unsigned long)(nunits),
2307
@d FREE_MEM(p,why,nunits,type)
2308
free_mem0((void HUGE *)p,(outer_char *)why,(unsigned long)(nunits),
2311
@d ALLOC(type,ptr,abbrev,nunits,dn)
2312
ptr = (type HUGE *)alloc((outer_char *)abbrev,(BUF_SIZE HUGE *)&nunits,
2318
IN_COMMON sixteen_bits HUGE *args; /* For macro processing. */
2319
IN_COMMON BUF_SIZE max_margs;
2321
IN_COMMON boolean upcoming_kind CSET(NO);
2322
/* For use after dot constant or character kind. */
2324
@ Miscellaneous definitions.
2326
@D MCHECK0(n,reason) mcheck0((unsigned long)(n),(outer_char *)reason)
2328
@d EVALUATE(val,p0,p1)
2329
{unsigned long nbytes;
2330
val_ptr = val_heap =
2331
GET_MEM("val_heap",nbytes=2*((p1)-(p0)),VAL);
2332
evaluate(&val,p0,p1);
2333
if(val_heap) FREE_MEM(val_heap,"val_heap",nbytes,VAL);
2336
@d DONE_LEVEL (cur_byte >= cur_end) /* Do we need to pop? */
2342
/* The shorter length here is primarily to keep the stack under control.
2343
Now that |N_MSGBUF| is used dynamically, maybe this statement isn't
2346
#define N_MSGBUF 2000
2348
#define N_MSGBUF 10000
2352
@ The following helps insert spaces in the output.
2357
MISCELLANEOUS, /* ``normal'' state */
2358
NUM_OR_ID, /* state associated with numbers and identifiers */
2359
UNBREAKABLE, /* state associated with \.{@@\&} */
2360
VERBATIM /* state in the middle of a string */
2363
@ For debugging and error messages, we need a routine that gives the name
2368
#if(part == 0 || part == 1)
2370
@[outer_char *ccode_name FCN((code))
2371
eight_bits code C1("")@;
2375
case begin_FORTRAN: return (outer_char *)"begin_FORTRAN";
2376
case begin_RATFOR: return (outer_char *)"begin_RATFOR";
2377
case begin_C: return (outer_char *)"begin_C";
2378
case ascii_constant: return (outer_char *)"ascii_constant";
2379
case big_line_break: return (outer_char *)"big_line_break";
2380
case begin_meta: return (outer_char *)"begin_meta";
2381
case end_meta: return (outer_char *)"end_meta";
2382
case TeX_string: return (outer_char *)"TeX_string";
2383
case xref_roman: return (outer_char *)"xref_roman";
2384
case xref_typewriter: return (outer_char *)"xref_typewriter";
2385
case xref_wildcard: return (outer_char *)"xref_wildcard";
2386
case formatt: return (outer_char *)"formatt";
2387
case definition: return (outer_char *)"definition";
2388
case WEB_definition: return (outer_char *)"WEB_definition";
2389
case begin_code: return (outer_char *)"begin_code";
2390
case module_name: return (outer_char *)"module_name";
2391
case new_module: return (outer_char *)"new_module";
2392
case m_ifdef: return (outer_char *)"m_ifdef";
2393
case m_ifndef: return (outer_char *)"m_ifndef";
2394
case m_if: return (outer_char *)"m_if";
2395
case m_else: return (outer_char *)"m_else";
2396
case m_elif: return (outer_char *)"m_elif";
2397
case m_endif: return (outer_char *)"m_endif";
2398
case m_undef: return (outer_char *)"m_undef";
2399
case m_line: return (outer_char *)"m_line";
2402
case begin_vcmnt: return (outer_char *)"begin_vcmnt";
2403
case begin_bp: return (outer_char *)"begin_bp";
2404
case insert_bp: return (outer_char *)"insert_bp";
2405
case control_text: return (outer_char *)"control_text";
2406
#endif /* |_FTANGLE_h| */
2409
case dont_expand: return (outer_char *)"dont_expand";
2410
case auto_label: return (outer_char *)"auto_label";
2411
case macro_module_name: return (outer_char *)"macro_module_name";
2412
case switch_math_flag: return (outer_char *)"switch_math_flag";
2413
case underline: return (outer_char *)"underline";
2414
case thin_space: return (outer_char *)"thin_space";
2415
case math_break: return (outer_char *)"math_break";
2416
case line_break: return (outer_char *)"line_break";
2417
case no_line_break: return (outer_char *)"no_line_break";
2418
case pseudo_semi: return (outer_char *)"pseudo_semi";
2419
case macro_space: return (outer_char *)"macro_space";
2420
case copy_mode: return (outer_char *)"copy_mode";
2421
case toggle_output: return (outer_char *)"toggle_output";
2422
case pseudo_expr: return (outer_char *)"pseudo_expr";
2423
case pseudo_colon: return (outer_char *)"pseudo_colon";
2424
case trace: return (outer_char *)"trace";
2425
#endif /* |_FWEAVE_h| */
2426
default: return OC("UNKNOWN");
2429
#endif /* |part == 1| */
2430
#endif /* |_FWEB_h| */
2441
#include "typedefs.h"