home *** CD-ROM | disk | FTP | other *** search
/ OS/2 Shareware BBS: 22 gnu / 22-gnu.zip / fweb153.zip / fweb-1.53 / web / map.web < prev    next >
Text File  |  1995-09-23  |  30KB  |  884 lines

  1. @z --- map.hweb ---
  2.  
  3. FWEB version 1.53 (September 23, 1995)
  4.  
  5. Based on version 0.5 of S. Levy's CWEB [copyright (C) 1987 Princeton University]
  6.  
  7. @x-----------------------------------------------------------------------------
  8.  
  9. @c
  10.  
  11. @ Here is the layout of the style file map structure that relates the
  12. keyword in the style file to the argument that it sets.
  13.  
  14. @a
  15. #ifdef _STYLE_h
  16.     #define YSET(stuff) = stuff
  17. #else
  18.     #define YSET(stuff)
  19. #endif
  20.  
  21. @<Typedefs@>@;
  22. #include "c_type.h"
  23. #include "s_type.h"
  24. @<Globals@>@;
  25.  
  26. @ We need a flag to say whether to print the defaults style-file
  27. parameters.  This is set to |YES| with ``\.{-Z}''m, to |NO| with ``\.{--Z}''.
  28.  
  29. @a
  30. IN_STYLE boolean prn_style_defaults;
  31.  
  32. @
  33.  
  34. @f S_MAP int
  35. @f STY_TYPE int
  36.  
  37. @<Typedef...@>=
  38.  
  39. typedef enum {S_DONE,S_CMNT,S_KEYWORD,S_STRING,S_CHAR,S_INT,S_LONG,
  40.     S_MODIFIED = 128,
  41.     S_CMNT_MOD,S_KEYWORD_MOD,S_STRING_MOD,
  42.     S_CHAR_MOD,S_INT_MOD,S_LONG_MOD} STY_TYPE;
  43.  
  44. typedef struct s_map
  45.     { 
  46.     outer_char *keyword; /* Style keyword. */
  47.     STY_TYPE type; /* Type of argument. */
  48.     void *ptr; /* Where to put the argument. This is a generic pointer,
  49. so it can be explicitly cast depending on the argument type. */
  50.     SRTN (*init)PROTO((struct s_map HUGE *)); /* Initialization
  51. routine. */
  52.     } S_MAP;
  53.     
  54. @ Here are the addresses of any control code characters that have been
  55. overridden by the style file.
  56.  
  57. @<Typedef...@>=
  58.  
  59. typedef char *CODES;
  60.  
  61. typedef struct
  62.     {
  63.     CODES Ascii_constant,
  64.         Begin_bp,
  65.         Begin_C,
  66.         Begin_FORTRAN,
  67.         Begin_meta,
  68.         Begin_RATFOR,
  69.         Begin_code,
  70.         Begin_nuweb,
  71.         Big_line_break,
  72.         Compiler_directive,
  73.         Defd_at,
  74.         Definition,
  75.         End_meta,
  76.         Force_line,
  77.         Formatt,
  78.         Implicit_reserved,
  79.         Insert_bp,
  80.         Invisible_cmnt,
  81.         Join,
  82.         Limbo_text,
  83.         Macro_def,
  84.         Math_break,
  85.         Module_name,
  86.         New_module,
  87.         New_output_file,
  88.         No_index,
  89.         No_line_break,
  90.         No_mac_expand,
  91.         Op_def,
  92.         Pseudo_colon,
  93.         Pseudo_expr,
  94.         Pseudo_semi,
  95.         Set_line_info,
  96.         Switch_math_flag,
  97.         TeX_String,
  98.         Thin_space,
  99.         Trace,
  100.         Undefinition,
  101.         Underline,
  102.         Verbatim,
  103.         WEB_Definition,
  104.         Xref_roman,
  105.         Xref_typewriter,
  106.         Xref_wildcard,
  107.         Yes_index;
  108.     } C_STYLE;
  109.  
  110. IN_STYLE C_STYLE c_style;
  111.  
  112. @ Here are the mappings for the control-code keywords. These are shared by
  113. both \FTANGLE\ and \FWEAVE.
  114.  
  115. @m CMAP(code,Code) {OC(#code),S_STRING,(void *)&c_style.Code,set_str}
  116.  
  117. @<Mappings for the \FWEB\ control codes@>=
  118.  
  119. CMAP(ascii_constant,Ascii_constant),
  120. CMAP(begin_bp,Begin_bp),
  121. CMAP(begin_C,Begin_C),
  122. CMAP(begin_FORTRAN,Begin_FORTRAN),
  123. CMAP(begin_meta,Begin_meta),
  124. CMAP(begin_RATFOR,Begin_RATFOR),
  125. CMAP(begin_code,Begin_code),
  126. CMAP(begin_nweb,Begin_nuweb),
  127. CMAP(big_line_break,Big_line_break),
  128. CMAP(compiler_directive,Compiler_directive),
  129. CMAP(defd_at,Defd_at),
  130. CMAP(definition,Definition),
  131. CMAP(end_meta,End_meta),
  132. CMAP(force_line,Force_line),
  133. CMAP(format,Formatt),
  134. CMAP(explicit_reserved,Implicit_reserved),
  135. CMAP(insert_bp,Insert_bp),
  136. CMAP(invisible_cmnt,Invisible_cmnt),
  137. CMAP(join,Join),
  138. CMAP(limbo_text,Limbo_text),
  139. CMAP(math_break,Math_break),
  140. CMAP(module_name,Module_name),
  141. CMAP(new_module,New_module),
  142. CMAP(new_output_file,New_output_file),
  143. CMAP(no_index,No_index),
  144. CMAP(no_line_break,No_line_break),
  145. CMAP(no_mac_expand,No_mac_expand),
  146. CMAP(pseudo_colon,Pseudo_colon),
  147. CMAP(pseudo_expr,Pseudo_expr),
  148. CMAP(pseudo_semi,Pseudo_semi),
  149. CMAP(set_line_info,Set_line_info),
  150. CMAP(switch_math_flag,Switch_math_flag),
  151. CMAP(TeX_string,TeX_String),
  152. CMAP(thin_space,Thin_space),
  153. CMAP(trace,Trace),
  154. CMAP(undefinition,Undefinition),
  155. CMAP(underline,Underline),
  156. CMAP(verbatim,Verbatim),
  157. CMAP(WEB_definition,WEB_Definition),
  158. CMAP(xref_roman,Xref_roman),
  159. CMAP(xref_typewriter,Xref_typewriter),
  160. CMAP(xref_wildcard,Xref_wildcard),
  161. CMAP(yes_index,Yes_index)
  162.  
  163. @ The style file layout for \.{FWEAVE}.  These are the actual value fields,
  164. and are initialized to default values.  They are linked to vocabulary
  165. intries via |S_MAP| entries below.
  166.  
  167. @<Typedef...@>=
  168.  
  169. typedef struct
  170.     {
  171.    outer_char *name; /* Title for index. */
  172.    outer_char *preamble; /* \TeX\ string to start the index.
  173. (``\.{\\Winx}'') */
  174.    outer_char *postamble; /* \TeX\ string to end the index.
  175. (``\.{\\Wfin}'') */
  176.    outer_char *group_skip; /* \TeX\ string to insert between letter groups. */
  177.    outer_char *lethead_prefix; /* \TeX\ string to begin identifying letter
  178. at start of group. */
  179.    outer_char *lethead_suffix; /* \TeX\ string to insert after identifying
  180. letter. */
  181.    int lethead_flag; /* If~0, insert no letter. If~$> 0$, insert
  182. uppercase letter. If~$< 0$, insert lowercase letter. */
  183.    outer_char *item_0; /* \TeX\ command to begin an index entry.
  184. (``\.{\\:}'') */
  185.    outer_char *delim_0; /* String to insert after identifier. */
  186.    outer_char *delim_n; /* String to insert between two module numbers. */
  187.    outer_char *encap_prefix; /* TeX command to begin a page number. */
  188.    outer_char *encap_infix; /* Left delimiter for encapsulation. */
  189.    outer_char *encap_suffix; /* Right delimiter for encapsulation. */
  190.    outer_char *underline_prefix,*underline_suffix; /* Bracket underlined entry
  191. with these. (``\.{\\[}''), (``\.]'') */
  192.    outer_char *language_prefix,*language_suffix; /* Bracket language entry
  193. with these. (``\.{\\(}''), (``\.)'') */
  194.    outer_char *tex; /* Name of \TeX\ output file for index.
  195. (``\.{INDEX.tex}'') */
  196.    ASCII *collate; /* Collation order. */
  197.     } INDEX;
  198.  
  199. typedef struct
  200.     {
  201.    outer_char *preamble; /* \TeX\ string to start the module list.
  202. (``\.{\\Wmods}'') */ 
  203.    outer_char *postamble; /* \TeX\ string to end the module list. (empty) */
  204.    outer_char *tex; /* Name of \TeX\ output file for module names.
  205. (``\.{MODULES.tex}'') */
  206.    outer_char *info; /* The \.{\\Winfo} macro. */
  207.     } MODULES;
  208.  
  209. typedef struct
  210.     {
  211.    outer_char *tex; /* Name of \TeX\ output file for table of contents.
  212. (``\.{CONTENTS.tex}'') */
  213.    outer_char *preamble;  /* Start the table of contents.
  214. (``\.{\\n\\Wcon}''). */
  215.    outer_char *postamble; /* Optional string after above. (\It{Empty}). */
  216.     } CONTENTS;
  217.  
  218. typedef struct
  219.     {
  220.     outer_char *begin,*end;
  221.     } STR_INSERT;
  222.  
  223. typedef struct
  224.     {
  225.     STR_INSERT TeX,code;
  226.     } W_META;  /* For \FWEAVE. */
  227.  
  228. typedef struct
  229.     {
  230.     outer_char *def; /* Begin an \.{@@d}. */
  231.     outer_char *undef; /* Begin an \.{@@u}. */
  232.     } T_OUTER;
  233.  
  234. typedef struct
  235.     {
  236.     outer_char *top; /* Start the meta-comment. */
  237.     outer_char *prefx; /* Generalization of comment char. */
  238.     outer_char *bottom; /* Finish the meta-comment. */
  239.     } T_META0;
  240.  
  241. typedef struct
  242.     {
  243.     T_META0 hdr; /* For bracketing the header info at top of file. */
  244.     T_META0 msg; /* For everything else. */
  245.     } T_META; /* For \FTANGLE. */
  246.  
  247. typedef struct
  248.     {
  249.     size_t num, nest, len; /* Is the |size_t| approriate? */
  250.     } PAREN;
  251.  
  252. typedef struct
  253.     {
  254.    outer_char *macros; /* Name of the macro package. (``\.{fwebmac.sty}'') */
  255.    FORMAT format;
  256.    outer_char *doc_preamble; /* Precedes \.{\\begin\{\\document\}} or limbo
  257. section. */
  258.    outer_char *doc_postamble; /* Precedes \.{\\end\{\\document\}} */
  259.    outer_char *limbo_begin, *limbo_end; /* Default limbo material. */
  260.    outer_char *unnamed_preamble,*named_preamble; /* Default stuff at mod
  261. start. */
  262.    MARK_DEFINED mark;
  263.    outer_char *TeXindent,*codeindent;
  264.    W_META meta;
  265.    LATEX LaTeX;
  266.    outer_char *include_ext;
  267.     } W_MISC;
  268.  
  269. typedef union
  270.     {
  271.     outer_char *name;
  272.     COLOR value;
  273.     } ACOLOR;
  274.  
  275. typedef struct
  276.     {
  277. /* The following fields are initially set to a default value like |RED|.
  278. Later, these are changed into actual escape sequences. */
  279.     ACOLOR ordinary;
  280.     ACOLOR program_name;
  281.     ACOLOR info,warning,error,fatal;
  282.     ACOLOR module_num,line_num;
  283.     ACOLOR in_file,out_file,include_file;
  284.     ACOLOR timing;
  285. /* These are set to abbreviations strings for escape sequences. */
  286.     outer_char HUGE *_NORMAL;
  287.     outer_char HUGE *_RED,HUGE *_GREEN,HUGE *_BLUE,
  288.         HUGE *_YELLOW,HUGE *_ORANGE;
  289.     } COLORS;
  290.  
  291. typedef enum
  292.     {
  293.     NO_COLOR,BILEVEL,TRUE_COLOR
  294.     } COLOR_MODE;
  295.  
  296. /* Parameters common to both \FTANGLE\ and \FWEAVE. */
  297. typedef struct
  298.     { /* Allowable input file extensions. */
  299.    outer_char HUGE *web,HUGE *change,HUGE *hweb,HUGE *hchange; 
  300.     } INPUT_EXT;
  301.  
  302. typedef struct
  303.     { /* Default output file extensions. */
  304.    outer_char HUGE *C_,HUGE *Cpp_,HUGE *V_,HUGE *N_,HUGE *N90_,
  305.         HUGE *R_,HUGE *R90_,HUGE *X_;
  306.     } OUTPUT_EXT;
  307.  
  308. typedef struct
  309.     { /* Delimiters for dot constants. */
  310.     ASCII begin,end;
  311.     } DOT_DELIMITER;
  312.  
  313. typedef struct
  314.     {
  315.     outer_char *xchr; /* Translation table for scrambling |ASCII|. */
  316.     outer_char ext_delimiter; /* Delimiter for file extensions. */
  317.     INPUT_EXT input_ext; /* Default input file extensions. */
  318.     OUTPUT_EXT output_ext; /* Default output file extensions.     */
  319.     outer_char *null_file_name; /* Name of the null file. */
  320.     outer_char *Idir; /* Standard directory to search after \.{-I}. */
  321.     DOT_DELIMITER dot_delimiter; /* Delimiters for dot constants. */
  322.     COLOR_MODE color_mode;    /* Do we allow color? */
  323.     COLORS color;    /* Output colors. */
  324.     } COMMON_PRMS;
  325.  
  326. typedef struct
  327.     {
  328.     INDEX indx;         /* Index-related parameters. */
  329.     MODULES modules;     /* Stuff for module name printout. */
  330.     CONTENTS contents;     /* Stuff for table of contents. */
  331.     W_MISC misc;         /* Miscellaneous parameters. */
  332.     } W_STYLE;
  333.  
  334. typedef struct
  335.     {
  336.    outer_char cchar; /* Continuation character for \Fortran. */
  337.    int output_line_length; /* Length of \Fortran's output line. */
  338.    outer_char *cdir_start[NUM_LANGUAGES]; /* Insert at the beginning of
  339. compiler directive. */
  340.    ASCII *ASCII_fcn; /* \.{@@"\dots"} is replaced by ``|ASCII_fcn|(\dots)''.
  341. (``\.{ASCIIstr}'') */
  342.    T_OUTER outer_start[NUM_LANGUAGES]; /* Start an outer definition. */
  343.    T_META meta[NUM_LANGUAGES]; /* Handle meta-comments. */
  344.    outer_char *protect_chars[NUM_LANGUAGES]; /* When |protect == YES|. */
  345.    outer_char line_char[NUM_LANGUAGES]; /* Begin \.{line} command. */
  346.    PAREN paren;
  347.     } T_STYLE;
  348.  
  349. @ The default definitions.
  350.  
  351. @f YSET $_EXPR
  352.  
  353. @d MAX_OUTPUT_LINE_LENGTH 100
  354. @d LONG_OUTPUT_LINE_LENGTH 80
  355. @d STANDARD_OUTPUT_LINE_LENGTH 72
  356. @d MIN_OUTPUT_LINE_LENGTH 60
  357.  
  358. @d DEFAULT_PAREN_NEST 10
  359. @d DEFAULT_PAREN_NUM 10
  360. @d DEFAULT_PAREN_LEN 100
  361.  
  362. @<Glob...@>=
  363.  
  364. IN_STYLE W_STYLE w_style
  365. #ifdef _STYLE_h
  366.     = {
  367.     {OC("INDEX"),OC("\\Winx"),OC("\n\\Wfin"),OC("\n\\Windexspace\n"),
  368.     OC(""),OC(""),0,     /* Let-heads */
  369.     OC("\\:"),         /* Begin index entry */
  370.     OC(", "),OC(", "),     /* Delimiters. */
  371.     OC(""),OC(""),OC(""),    /* Encapsulation. */
  372.     OC("\\["),OC("]"),     /* Underlining. */
  373.     OC("\\("),OC(")"),     /* Language entries. */
  374.     OC("INDEX.tex"),    /* |INDEX|. */
  375.     (ASCII *)" \1\2\3\4\5\6\7\10\11\12\13\14\15\16\17\
  376. \20\21\22\23\24\25\26\27\30\31\32\33\34\35\36\37\
  377. !\42#$%&'()*+,-./:;<=>?@@[\\]^`{|}~_\
  378. abcdefghijklmnopqrstuvwxyz0123456789"}, /* Collation order. */
  379.     {OC("\\Wmods"),OC(""),OC("MODULES.tex"),OC("\\Winfo")}, /*
  380. |MODULES|. */
  381.     {OC("CONTENTS.tex"),OC("\n\\Wcon"),OC("")}, /* |CONTENTS|. */
  382.     {OC("fwebmac.sty"), /* Macro package */
  383.     {OC("\\&"), OC("\\&"), /* |reserved| */
  384.         OC("\\|"), /* |short_id| */
  385.         OC("\\\\"),OC("\\\\"), /* |id| */
  386.         OC("\\\\"), OC("\\\\"), /* |id_outer| */
  387.         OC("\\\\"), OC("\\\\"), /* |id_inner| */
  388.         OC("\\@@"), /* |intrinsic| */
  389.         OC("\\."), OC("\\."), /* |keyword| */
  390.         OC("\\."), /* |typewritr| */
  391.         OC("\\9") /* |wildcrd| */
  392.         },
  393.     OC(""), OC(""), /* |doc_preamble|, |doc_postamble| */
  394.     OC(""), OC(""), /* |limbo_begin|, |limbo_end| */
  395.     OC(""), OC(""), /* |unnamed_preamble|, |named_preamble| */
  396.     {YES,NO,NO,NO,YES,NO}, /* |MARK_DEFINED| */
  397.     OC("1em"),OC("1em"),    /* |TeXindent|, |codeindent| */
  398.     {{OC("\\Begintt"),OC("\\Endtt")},
  399.      {OC("\\WBM\\Begintt\n"),OC("\\Endtt\\WEM")}}, /* |W_META| */
  400.     {{OC(""),OC("article")}, {OC(""),OC("")}},    /* |LaTeX| */
  401.     OC("H")    /* |include_ext| */
  402.     } /* |W_MISC|. */
  403.     }
  404. #endif
  405. ;
  406.  
  407. IN_STYLE FORMAT *pfmt YSET(&w_style.misc.format);
  408.  
  409. /* --- Parameters common to both \FWEAVE\ and \FTANGLE. --- */
  410.  
  411. @#if 0 /* The identity map; a template for filling in scrambled character
  412. set. */
  413. "\000\001\002\003\004\005\006\007\
  414. \010\011\012\013\014\015\016\017\
  415. \020\021\022\023\024\025\026\027\
  416. \030\031\032\033\034\035\036\037\
  417. \040\041\042\043\044\045\046\047\
  418. \050\051\052\053\054\055\056\057\
  419. \060\061\062\063\064\065\066\067\
  420. \070\071\072\073\074\075\076\077\
  421. \100\101\102\103\104\105\106\107\
  422. \110\111\112\113\114\115\116\117\
  423. \120\121\122\123\124\125\126\127\
  424. \130\131\132\133\134\135\136\137\
  425. \140\141\142\143\144\145\146\147\
  426. \150\151\152\153\154\155\156\157\
  427. \160\161\162\163\164\165\166\167\
  428. \170\171\172\173\174\175\176\177\
  429. \200\201\202\203\204\205\206\207\
  430. \210\211\212\213\214\215\216\217\
  431. \220\221\222\223\224\225\226\227\
  432. \230\231\232\233\234\235\236\237\
  433. \240\241\242\243\244\245\246\247\
  434. \250\251\252\253\254\255\256\257\
  435. \260\261\262\263\264\265\266\267\
  436. \270\271\272\273\274\275\276\277\
  437. \300\301\302\303\304\305\306\307\
  438. \310\311\312\313\314\315\316\317\
  439. \320\321\322\323\324\325\326\327\
  440. \330\331\332\333\334\335\336\337\
  441. \340\341\342\343\344\345\346\347\
  442. \350\351\352\353\354\355\356\357\
  443. \360\361\362\363\364\365\366\367\
  444. \370\371\372\373\374\375\376\377"
  445. @#endif
  446.  
  447. @#if 0
  448. "\000\001\003\004\005\006\007\
  449. \010\011\012\013\014\015\016\017\
  450. \020\021\022\023\024\025\026\027\
  451. \030\031\032\033\034\035\036\037\
  452. \040\041\042\043\044\045\046\047\
  453. \050\051\052\053\054\055\056\057\
  454. \060\061\062\063\064\065\066\067\
  455. \070\071\072\073\074\075\076\077\
  456. \100\101\102\103\104\105\106\107\
  457. \110\111\112\113\114\115\116\117\
  458. \120\121\122\123\124\125\126\127\
  459. \130\131\132\133\134\135\136\137\
  460. \140\141\142\143\144\145\146\147\
  461. \150\151\152\153\154\155\156\157\
  462. \160\161\162\163\164\165\166\167\
  463. \170\171\172\173\174\175\176\002\177\
  464. \200\201\202\203\204\205\206\207\
  465. \210\211\212\213\214\215\216\217\
  466. \220\221\222\223\224\225\226\227\
  467. \230\231\232\233\234\235\236\237\
  468. \240\241\242\243\244\245\246\247\
  469. \250\251\252\253\254\255\256\257\
  470. \260\261\262\263\264\265\266\267\
  471. \270\271\272\273\274\275\276\277\
  472. \300\301\302\303\304\305\306\307\
  473. \310\311\312\313\314\315\316\317\
  474. \320\321\322\323\324\325\326\327\
  475. \330\331\332\333\334\335\336\337\
  476. \340\341\342\343\344\345\346\347\
  477. \350\351\352\353\354\355\356\357\
  478. \360\361\362\363\364\365\366\367\
  479. \370\371\372\373\374\375\376\377"
  480. @#endif
  481.  
  482. IN_STYLE COMMON_PRMS wt_style 
  483. #ifdef _STYLE_h
  484. = {
  485. OC("\000\001\003\004\005\006\007\
  486. \010\011\012\013\014\015\016\017\
  487. \020\021\022\023\024\025\026\027\
  488. \030\031\032\033\034\035\036\037\
  489. \040\041\042\043\044\045\046\047\
  490. \050\051\052\053\054\055\056\057\
  491. \060\061\062\063\064\065\066\067\
  492. \070\071\072\073\074\075\076\077\
  493. \100\101\102\103\104\105\106\107\
  494. \110\111\112\113\114\115\116\117\
  495. \120\121\122\123\124\125\126\127\
  496. \130\131\132\133\134\135\136\137\
  497. \140\141\142\143\144\145\146\147\
  498. \150\151\152\153\154\155\156\157\
  499. \160\161\162\163\164\165\166\167\
  500. \170\171\172\173\174\175\176\002\177\
  501. \200\201\202\203\204\205\206\207\
  502. \210\211\212\213\214\215\216\217\
  503. \220\221\222\223\224\225\226\227\
  504. \230\231\232\233\234\235\236\237\
  505. \240\241\242\243\244\245\246\247\
  506. \250\251\252\253\254\255\256\257\
  507. \260\261\262\263\264\265\266\267\
  508. \270\271\272\273\274\275\276\277\
  509. \300\301\302\303\304\305\306\307\
  510. \310\311\312\313\314\315\316\317\
  511. \320\321\322\323\324\325\326\327\
  512. \330\331\332\333\334\335\336\337\
  513. \340\341\342\343\344\345\346\347\
  514. \350\351\352\353\354\355\356\357\
  515. \360\361\362\363\364\365\366\367\
  516. \370\371\372\373\374\375\376\377"
  517. ), /* Scrambled |xchr|. */
  518.     '.',    /* Usual delimiter for file extensions. */
  519.     {OC("web"),OC("ch"),OC("hweb"),OC("hch")}, /* Input file
  520. extensions. */
  521.     {OC(C_EXT),OC(Cpp_EXT),OC(M_EXT),OC(N_EXT),OC(N90_EXT),OC(R_EXT),
  522.         OC(R90_EXT),OC(X_EXT)}, /* Output file extensions. */
  523.     OC(NULL_FILE_NAME), /* Name of the null file. */
  524.     OC(""),        /* |Idir|. */
  525.     {'.','.'},    /* Delimiters for dot constants. */
  526.     NO_COLOR    /* |color_mode|. */
  527.     }
  528. #endif
  529. ;
  530.  
  531. IN_STYLE T_STYLE t_style 
  532. #ifdef _STYLE_h
  533.     = {
  534.     CCHAR,        /* Continuation character for \Fortran. */
  535.     STANDARD_OUTPUT_LINE_LENGTH, /* Length of \Fortran's output line. */
  536.     {OC("#pragma "),OC("C"),OC("C"),OC(""),OC(""),
  537.      OC("#pragma "),OC("C"),OC("C")}, 
  538.         /* Compiler directive prefixes.  */
  539.     (ASCII *)"ASCIIstr",    /* For \.{@@"\dots"} in \Fortran\ or
  540. \Ratfor. */
  541. /* |outer_start| */
  542.     {{OC("#define "),OC("#undef ")},    /* |C| */
  543.      {OC("define"),OC("undef")},    /* |RATFOR| */
  544.      {OC("define"),OC("undef")},    /* |FORTRAN| */
  545.      {OC("\\def"),OC("\\undef")},    /* |TEX| */
  546.      {OC("#define"),OC("#undef")},    /* |LITERAL| */
  547.      {OC("#define "),OC("#undef ")},    /* |C_PLUS_PLUS| */
  548.      {OC("define"),OC("undef")},    /* |RATFOR_90| */
  549.      {OC("define"),OC("undef")}},    /* |FORTRAN_90| */
  550. /*  |T_META| */
  551.     {{{OC("#if(0)"),OC(""),OC("\n#endif")},
  552.         {OC("/*"),OC(""),OC("*/")}},     /* |C| */
  553.      {{OC(""),OC("C"),OC("\n")},
  554.         {OC(""),OC("C"),OC("")}},    /* |RATFOR| */
  555.      {{OC(""),OC("C"),OC("\n")},
  556.         {OC(""),OC("C"),OC("")}},    /* |FORTRAN| */
  557.      {{OC(""),OC("%"),OC("\n")},
  558.         {OC(""),OC("%"),OC("")}},    /* |TEX| */
  559.      {{OC("#if(0)"),OC(""),OC("\n#endif")},
  560.         {OC("/*"),OC("  "),OC("\n*/")}},/* |LITERAL| */
  561.      {{OC("#if(0)"),OC(""),OC("\n#endif")},
  562.         {OC("/*"),OC(""),OC("*/")}},    /* |C_PLUS_PLUS| */
  563.      {{OC(""),OC("C"),OC("\n")},
  564.         {OC(""),OC("C"),OC("")}},    /* |RATFOR_90| */
  565.      {{OC(""),OC("C"),OC("\n")},
  566.         {OC(""),OC("C"),OC("")}}},     /* |FORTRAN_90| */
  567.     {OC("\\"),OC(""),OC(""),OC(""),OC("\\"),OC("\\"),OC(""),OC("")},
  568.         /* |protect_chars| */
  569.     {'#', '*', '*', '%', '%', '#', '*', '*'}, /* |line_char| */
  570.     {DEFAULT_PAREN_NUM, DEFAULT_PAREN_NEST, DEFAULT_PAREN_LEN}
  571.          /* |paren| */
  572.     }
  573. #endif
  574. ;
  575.  
  576. @ It's convenient to use a macro to relate the keywords to the parameters
  577. by creating |S_MAP| entries.  For example, the first entry associates
  578. |w_style.indx.preamble| with the keyword ``\.{index\_preamble}'', so one
  579. can say in the style file ``\.{index.preamble = "..."}''.  (Dots in a
  580. keyword are replaced by underscores by the style-file parser.)
  581.  
  582. @m WMAP(keyword,type,var,field,init) 
  583.     {OC(#keyword),S_##type,(void *)&w_style.var.field,init}
  584.  
  585. @m IMAP(keyword,type,field,init) WMAP(keyword,type,indx,field,init)
  586.  
  587. @<Mappings for \FWEAVE's index@>=
  588.  
  589. IMAP(index_name,STRING,name,set_str),
  590. IMAP(index_preamble,STRING,preamble,set_str),
  591. IMAP(index_postamble,STRING,postamble,set_str),
  592. IMAP(group_skip,STRING,group_skip,set_str),
  593. IMAP(lethead_prefix,STRING,lethead_prefix,set_str),
  594. IMAP(lethead_suffix,STRING,lethead_suffix,set_str),
  595. IMAP(lethead_flag,INT,lethead_flag,set_int),
  596. IMAP(item_0,STRING,item_0,set_str),
  597. IMAP(delim_0,STRING,delim_0,set_str),
  598. IMAP(delim_n,STRING,delim_n,set_str),
  599. IMAP(encap_prefix,STRING,encap_prefix,set_str),
  600. IMAP(encap_infix,STRING,encap_infix,set_str),
  601. IMAP(encap_suffix,STRING,encap_suffix,set_str),
  602. IMAP(underline_prefix,STRING,underline_prefix,set_str),
  603. IMAP(underline_suffix,STRING,underline_suffix,set_str),
  604. IMAP(language_prefix,STRING,language_prefix,set_str),
  605. IMAP(language_suffix,STRING,language_suffix,set_str),
  606. IMAP(index_tex,STRING,tex,set_str),
  607. IMAP(collate,STRING,collate,set_str)
  608.  
  609. @
  610. @m DMAP(keyword,type,field,init) WMAP(keyword,type,modules,field,init)
  611.  
  612. @<Mappings for \FWEAVE's module list@>=
  613.  
  614. DMAP(modules_preamble,STRING,preamble,set_str),
  615. DMAP(modules_postamble,STRING,postamble,set_str),
  616. DMAP(modules_tex,STRING,tex,set_str),
  617. DMAP(info,STRING,info,set_str)
  618.  
  619. @
  620. @m OMAP(keyword,type,field,init) WMAP(keyword,type,contents,field,init)
  621.  
  622. @<Mappings for \FWEAVE's table of contents@>=
  623.  
  624. OMAP(contents_tex,STRING,tex,set_str),
  625. OMAP(contents_TeX,STRING,tex,set_str),
  626. OMAP(contents_preamble,STRING,preamble,set_str),
  627. OMAP(contents_postamble,STRING,postamble,set_str)
  628.  
  629. @
  630.  
  631. @m MMAP(keyword,type,field,init) WMAP(keyword,type,misc,field,init)
  632.  
  633. @<Mappings for miscellaneous \FWEAVE\ parameters@>=
  634.  
  635. MMAP(macros,STRING,macros,set_str),
  636.  
  637. MMAP(format_reserved,STRING,format.reserved,set_str),
  638. MMAP(format_RESERVED,STRING,format.RESERVED,set_str),
  639. MMAP(format_identifier,STRING,format.id,set_str),
  640. MMAP(format_id,STRING,format.id,set_str),
  641. MMAP(format_IDENTIFIER,STRING,format.ID,set_str),
  642. MMAP(format_ID,STRING,format.ID,set_str),
  643. MMAP(format_short_identifier,STRING,format.short_id,set_str),
  644. MMAP(format_short_id,STRING,format.short_id,set_str),
  645. MMAP(format_outer_macro,STRING,format.id_outer,set_str),
  646. MMAP(format_OUTER_MACRO,STRING,format.ID_OUTER,set_str),
  647. MMAP(format_WEB_macro,STRING,format.id_inner,set_str),
  648. MMAP(format_WEB_MACRO,STRING,format.ID_INNER,set_str),
  649. MMAP(format_intrinsic,STRING,format.intrinsic,set_str),
  650. MMAP(format_keyword,STRING,format.keyword,set_str),
  651. MMAP(format_KEYWORD,STRING,format.KEYWORD,set_str),
  652. MMAP(format_typewriter,STRING,format.typewritr,set_str),
  653. MMAP(format_wildcard,STRING,format.wildcrd,set_str),
  654.  
  655. MMAP(doc_preamble,STRING,doc_preamble,set_str),
  656. MMAP(doc_postamble,STRING,doc_postamble,set_str),
  657. MMAP(preamble_doc,STRING,doc_preamble,set_str),
  658. MMAP(postamble_doc,STRING,doc_postamble,set_str),
  659.  
  660. MMAP(unnamed_preamble,STRING,unnamed_preamble,set_str),
  661. MMAP(preamble_unnamed,STRING,unnamed_preamble,set_str),
  662. MMAP(named_preamble,STRING,named_preamble,set_str),
  663. MMAP(preamble_named,STRING,named_preamble,set_str),
  664.  
  665. MMAP(limbo,STRING,limbo_begin,add_str),
  666. MMAP(limbo_begin,STRING,limbo_begin,add_str),
  667. MMAP(limbo_end,STRING,limbo_end,add_str),
  668.  
  669. MMAP(mark_defined_generic_name,INT,mark.generic_name,set_int),
  670. MMAP(mark_defined_fcn_name,INT,mark.fcn_name,set_int),
  671. MMAP(mark_defined_WEB_macro,INT,mark.WEB_macro,set_int),
  672. MMAP(mark_defined_outer_macro,INT,mark.outer_macro,set_int),
  673. MMAP(mark_defined_exp_type,INT,mark.imp_reserved_name,set_int),
  674. MMAP(mark_defined_typedef_name,INT,mark.typedef_name,set_int),
  675.  
  676. MMAP(indent_TeX,STRING,TeXindent,set_str),
  677. MMAP(indent_code,STRING,codeindent,set_str),
  678.  
  679. MMAP(meta_TeX_begin,STRING,meta.TeX.begin,set_str),
  680. MMAP(meta_TeX_end,STRING,meta.TeX.end,set_str),
  681. MMAP(meta_code_begin,STRING,meta.code.begin,set_str),
  682. MMAP(meta_code_end,STRING,meta.code.end,set_str),
  683.  
  684. MMAP(LaTeX_options,STRING,LaTeX.class.options,set_str),
  685. MMAP(LaTeX_class_options,STRING,LaTeX.class.options,set_str),
  686.  
  687. MMAP(LaTeX_style,STRING,LaTeX.class.file,set_str),
  688. MMAP(LaTeX_class,STRING,LaTeX.class.file,set_str),
  689.  
  690. MMAP(LaTeX_package_options,STRING,LaTeX.package.options,set_str),
  691. MMAP(LaTeX_package,STRING,LaTeX.package.file,set_str),
  692.  
  693. MMAP(include_ext, STRING, include_ext, set_str)@/
  694.  
  695. @ Some parameters apply exclusively to \FTANGLE.
  696.  
  697. @m TMAP(keyword,type,field,init) 
  698.     {OC(#keyword),S_##type,(void *)&t_style.field,init} 
  699.  
  700. @<Mappings for miscellaneous \FTANGLE\ parameters@>=
  701.  
  702. TMAP(cchar,CHAR,cchar,ini_cchar),
  703. TMAP(line_length_N,INT,output_line_length,ini_output_line_length),@/
  704. TMAP(ASCII_fcn,STRING,ASCII_fcn,set_str),
  705.  
  706. TMAP(cdir_start_C,STRING,cdir_start[0],set_str),
  707. TMAP(cdir_start_R,STRING,cdir_start[1],set_str),
  708. TMAP(cdir_start_N,STRING,cdir_start[2],set_str),
  709. TMAP(cdir_start_X,STRING,cdir_start[3],set_str),
  710. TMAP(cdir_start_V,STRING,cdir_start[4],set_str),
  711. TMAP(cdir_start_Cpp,STRING,cdir_start[5],set_str),
  712. TMAP(cdir_start_R90,STRING,cdir_start[6],set_str),
  713. TMAP(cdir_start_N90,STRING,cdir_start[7],set_str),
  714.  
  715. TMAP(outer_def_C,STRING,outer_start[0].def,set_str),
  716. TMAP(outer_def_R,STRING,outer_start[1].def,set_str),
  717. TMAP(outer_def_N,STRING,outer_start[2].def,set_str),
  718. TMAP(outer_def_X,STRING,outer_start[3].def,set_str),
  719. TMAP(outer_def_V,STRING,outer_start[4].def,set_str),
  720. TMAP(outer_def_Cpp,STRING,outer_start[5].def,set_str),
  721. TMAP(outer_def_R90,STRING,outer_start[6].def,set_str),
  722. TMAP(outer_def_N90,STRING,outer_start[7].def,set_str),
  723.  
  724. TMAP(outer_undef_C,STRING,outer_start[0].undef,set_str),
  725. TMAP(outer_undef_R,STRING,outer_start[1].undef,set_str),
  726. TMAP(outer_undef_N,STRING,outer_start[2].undef,set_str),
  727. TMAP(outer_undef_X,STRING,outer_start[3].undef,set_str),
  728. TMAP(outer_undef_V,STRING,outer_start[4].undef,set_str),
  729. TMAP(outer_undef_Cpp,STRING,outer_start[5].undef,set_str),
  730. TMAP(outer_undef_R90,STRING,outer_start[6].undef,set_str),
  731. TMAP(outer_undef_N90,STRING,outer_start[7].undef,set_str),
  732.  
  733. TMAP(meta_top_C,STRING,meta[0].msg.top,set_str),
  734. TMAP(meta_top_R,STRING,meta[1].msg.top,set_str),
  735. TMAP(meta_top_N,STRING,meta[2].msg.top,set_str),
  736. TMAP(meta_top_X,STRING,meta[3].msg.top,set_str),
  737. TMAP(meta_top_V,STRING,meta[4].msg.top,set_str),
  738. TMAP(meta_top_Cpp,STRING,meta[5].msg.top,set_str),
  739. TMAP(meta_top_R90,STRING,meta[6].msg.top,set_str),
  740. TMAP(meta_top_N90,STRING,meta[7].msg.top,set_str),
  741.  
  742. TMAP(meta_prefix_C,STRING,meta[0].msg.prefx,set_str),
  743. TMAP(meta_prefix_R,STRING,meta[1].msg.prefx,set_str),
  744. TMAP(meta_prefix_N,STRING,meta[2].msg.prefx,set_str),
  745. TMAP(meta_prefix_X,STRING,meta[3].msg.prefx,set_str),
  746. TMAP(meta_prefix_V,STRING,meta[4].msg.prefx,set_str),
  747. TMAP(meta_prefix_Cpp,STRING,meta[5].msg.prefx,set_str),
  748. TMAP(meta_prefix_R90,STRING,meta[6].msg.prefx,set_str),
  749. TMAP(meta_prefix_N90,STRING,meta[7].msg.prefx,set_str),
  750.  
  751. TMAP(meta_bottom_C,STRING,meta[0].msg.bottom,set_str),
  752. TMAP(meta_bottom_R,STRING,meta[1].msg.bottom,set_str),
  753. TMAP(meta_bottom_N,STRING,meta[2].msg.bottom,set_str),
  754. TMAP(meta_bottom_X,STRING,meta[3].msg.bottom,set_str),
  755. TMAP(meta_bottom_V,STRING,meta[4].msg.bottom,set_str),
  756. TMAP(meta_bottom_Cpp,STRING,meta[5].msg.bottom,set_str),
  757. TMAP(meta_bottom_R90,STRING,meta[6].msg.bottom,set_str),
  758. TMAP(meta_bottom_N90,STRING,meta[7].msg.bottom,set_str),
  759.  
  760. TMAP(meta_top_hdr_C,STRING,meta[0].hdr.top,set_str),
  761. TMAP(meta_top_hdr_R,STRING,meta[1].hdr.top,set_str),
  762. TMAP(meta_top_hdr_N,STRING,meta[2].hdr.top,set_str),
  763. TMAP(meta_top_hdr_X,STRING,meta[3].hdr.top,set_str),
  764. TMAP(meta_top_hdr_V,STRING,meta[4].hdr.top,set_str),
  765. TMAP(meta_top_hdr_Cpp,STRING,meta[5].hdr.top,set_str),
  766. TMAP(meta_top_hdr_R90,STRING,meta[6].hdr.top,set_str),
  767. TMAP(meta_top_hdr_N90,STRING,meta[7].hdr.top,set_str),
  768.  
  769. TMAP(meta_prefix_hdr_C,STRING,meta[0].hdr.prefx,set_str),
  770. TMAP(meta_prefix_hdr_R,STRING,meta[1].hdr.prefx,set_str),
  771. TMAP(meta_prefix_hdr_N,STRING,meta[2].hdr.prefx,set_str),
  772. TMAP(meta_prefix_hdr_X,STRING,meta[3].hdr.prefx,set_str),
  773. TMAP(meta_prefix_hdr_V,STRING,meta[4].hdr.prefx,set_str),
  774. TMAP(meta_prefix_hdr_Cpp,STRING,meta[5].hdr.prefx,set_str),
  775. TMAP(meta_prefix_hdr_R90,STRING,meta[6].hdr.prefx,set_str),
  776. TMAP(meta_prefix_hdr_N90,STRING,meta[7].hdr.prefx,set_str),
  777.  
  778. TMAP(meta_bottom_hdr_C,STRING,meta[0].hdr.bottom,set_str),
  779. TMAP(meta_bottom_hdr_R,STRING,meta[1].hdr.bottom,set_str),
  780. TMAP(meta_bottom_hdr_N,STRING,meta[2].hdr.bottom,set_str),
  781. TMAP(meta_bottom_hdr_X,STRING,meta[3].hdr.bottom,set_str),
  782. TMAP(meta_bottom_hdr_V,STRING,meta[4].hdr.bottom,set_str),
  783. TMAP(meta_bottom_hdr_Cpp,STRING,meta[5].hdr.bottom,set_str),
  784. TMAP(meta_bottom_hdr_R90,STRING,meta[6].hdr.bottom,set_str),
  785. TMAP(meta_bottom_hdr_N90,STRING,meta[7].hdr.bottom,set_str),
  786.  
  787. TMAP(protect_C,STRING,protect_chars[0],set_str),
  788. TMAP(protect_R,STRING,protect_chars[1],set_str),
  789. TMAP(protect_N,STRING,protect_chars[2],set_str),
  790. TMAP(protect_X,STRING,protect_chars[3],set_str),
  791. TMAP(protect_V,STRING,protect_chars[4],set_str),
  792. TMAP(protect_Cpp,STRING,protect_chars[5],set_str),
  793. TMAP(protect_R90,STRING,protect_chars[6],set_str),
  794. TMAP(protect_N90,STRING,protect_chars[7],set_str),
  795.  
  796. TMAP(line_char_C,CHAR,line_char[0],set_char),
  797. TMAP(line_char_R,CHAR,line_char[1],set_char),
  798. TMAP(line_char_N,CHAR,line_char[2],set_char),
  799. TMAP(line_char_X,CHAR,line_char[3],set_char),
  800. TMAP(line_char_V,CHAR,line_char[4],set_char),
  801. TMAP(line_char_Cpp,CHAR,line_char[5],set_char),
  802. TMAP(line_char_R90,CHAR,line_char[6],set_char),
  803. TMAP(line_char_N90,CHAR,line_char[7],set_char),
  804.  
  805. TMAP(paren_num, INT, paren.num, set_int),
  806. TMAP(paren_nest, INT, paren.nest, set_int),
  807. TMAP(paren_len, INT, paren.len, set_int)@/
  808.  
  809. @ When a field such as |program_name| is set via ``\.{program.name =
  810. "red"}'', the initialization routine |ini_aclr| is run to convert the
  811. string the value~|RED|.
  812.  
  813. @m PMAP(keyword,type,field,init) 
  814.     {OC(#keyword),S_##type,(void *)&wt_style.field,init}
  815.  
  816. @m CLR_MAP(keyword,field) PMAP(keyword,STRING,color.field.name,ini_aclr)
  817.  
  818. @m CLINK(keyword,field) PMAP(keyword,STRING,color._##field,ini_bilevel)
  819.  
  820. @<Mappings for parameters common to \FWEAVE\ and \FTANGLE@>=
  821.  
  822. PMAP(xchr,STRING,xchr,set_str),
  823. PMAP(ext_delimiter,CHAR,ext_delimiter,set_char),
  824. PMAP(ext_web,STRING,input_ext.web,ini_ext),
  825. PMAP(ext_change,STRING,input_ext.change,ini_ext),
  826. PMAP(ext_hweb,STRING,input_ext.hweb,ini_ext),
  827. PMAP(ext_hchange,STRING,input_ext.hchange,ini_ext),@/
  828. PMAP(suffix_C,STRING,output_ext.C_,set_str),
  829. PMAP(suffix_Cpp,STRING,output_ext.Cpp_,set_str),
  830. PMAP(suffix_V,STRING,output_ext.V_,set_str),
  831. PMAP(suffix_FORTRAN,STRING,output_ext.N_,set_str),
  832. PMAP(suffix_N,STRING,output_ext.N_,set_str),
  833. PMAP(suffix_FORTRAN90,STRING,output_ext.N90_,set_str),
  834. PMAP(suffix_N90,STRING,output_ext.N90_,set_str),
  835. PMAP(suffix_RATFOR,STRING,output_ext.R_,set_str),
  836. PMAP(suffix_R,STRING,output_ext.R_,set_str),
  837. PMAP(suffix_RATFOR90,STRING,output_ext.R90_,set_str),
  838. PMAP(suffix_R90,STRING,output_ext.R90_,set_str),
  839. PMAP(suffix_TEX,STRING,output_ext.X_,set_str),
  840. PMAP(suffix_X,STRING,output_ext.X_,set_str),
  841. PMAP(null_file,STRING,null_file_name,set_str),
  842. PMAP(Idir, STRING, Idir, set_str),
  843. PMAP(dot_constant_begin,CHAR,dot_delimiter.begin,ini_dot),
  844. PMAP(dot_constant_end,CHAR,dot_delimiter.end,ini_dot),
  845. PMAP(color_mode,INT,color_mode,ini_clr),@/
  846. CLR_MAP(color_ordinary,ordinary),
  847. CLR_MAP(color_program,program_name),
  848. CLR_MAP(color_info,info),
  849. CLR_MAP(color_warning,warning),
  850. CLR_MAP(color_error,error),
  851. CLR_MAP(color_fatal,fatal),
  852. CLR_MAP(color_module_num,module_num),
  853. CLR_MAP(color_line_num,line_num),
  854. CLR_MAP(color_input_file,in_file),
  855. CLR_MAP(color_include_file,include_file),
  856. CLR_MAP(color_output_file,out_file),
  857. CLR_MAP(color_timing,timing),@/
  858. CLINK(color_default,NORMAL),
  859. CLINK(color_red,RED),
  860. CLINK(color_green,GREEN),
  861. CLINK(color_blue,BLUE),
  862. CLINK(color_yellow,YELLOW),
  863. CLINK(color_orange,ORANGE)
  864.  
  865. @ Here are the actual mappings that relate the keywords to the parameter
  866. structures. 
  867. @<Glob...@>=
  868.  
  869. IN_STYLE S_MAP fweb_map[] 
  870. #ifdef _STYLE_h
  871.  = {
  872.     @<Mappings for \FWEAVE's index@>,@/
  873.     @<Mappings for \FWEAVE's module list@>,@/
  874.     @<Mappings for \FWEAVE's table of contents@>,@/
  875.     @<Mappings for miscellaneous \FWEAVE\ parameters@>,@/
  876.     @<Mappings for miscellaneous \FTANGLE\ parameters@>,@/
  877.     @<Mappings for parameters common to \FWEAVE\ and \FTANGLE@>,@/
  878.     @<Mappings for the \FWEB\ control codes@>,@/
  879.     {OC("")}
  880.    }
  881. #endif /* |_STYLE_h| */
  882. ;
  883.  
  884.