home *** CD-ROM | disk | FTP | other *** search
/ OS/2 Shareware BBS: 22 gnu / 22-gnu.zip / fweb153.zip / fweb-1.53 / web / fweave.c < prev    next >
Text File  |  1995-09-23  |  171KB  |  9,657 lines

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