home *** CD-ROM | disk | FTP | other *** search
/ OS/2 Shareware BBS: 22 gnu / 22-gnu.zip / fweb140x.zip / fweb.info-3 (.txt) < prev    next >
GNU Info File  |  1996-02-27  |  51KB  |  1,073 lines

  1. This is Info file fweb.info, produced by Makeinfo-1.55 from the input
  2. file fweb.texinfo.
  3.    This file documents FWEB...
  4.    Copyright 1993 John A. Krommes
  5.    Permission is granted to make and distribute verbatim      copies of
  6. this manual provided the copyright notice and      this permission
  7. notice are preserved on all copies.
  8.    Permission is granted to process this file through TeX      and
  9. print the results, provided the printed document      carries a copying
  10. permission notice identical to this      one except for the removal of
  11. this paragraph (this      paragraph not being relevant to the printed
  12. manual).
  13.    Permission is granted to copy and distribute modified      versions
  14. of this manual under the conditions for      verbatim copying, provided
  15. also that the section      entitled "Copying" is included exactly as in
  16. the original, and provided      that the entire resulting derived work
  17. is distributed      under the terms of a permission notice identical to
  18. this      one.
  19.    Permission is granted to copy and distribute      translations of
  20. this manual into another language,      under the above conditions for
  21. modified versions,      except that this permission notice may be
  22. stated in a      translation approved by the author.
  23. File: fweb.info,  Node: AT~,  Next: AT&,  Prev: AT#,  Up: AT commands
  24. `@~':  Cancel line break.
  25. -------------------------
  26.    For example,
  27.      printf("Working..."); @~ fflush(stdout);
  28. File: fweb.info,  Node: AT&,  Next: ATe,  Prev: AT~,  Up: AT commands
  29. `@&':  Join items.
  30. ------------------
  31.    During FWEAVE's output, `@&' joins the items to either side with no
  32. spaces or line breaks inbetween.
  33.    This command must be distinguished from the preprocessor construction
  34. `##' (paste tokens together).  In a macro definition, `a##bc' creates
  35. the single identifier `abc'.  If one said `a@&bc', two identifiers
  36. would be output with no spaces separating them.  In simple cases, the
  37. results may look identical, but consider how things would differ if
  38. `abc' were itself a WEB macro.
  39. File: fweb.info,  Node: ATe,  Next: AT;,  Prev: AT&,  Up: AT commands
  40. Pseudo (invisible) operators
  41. ============================
  42. `@e':  Pseudo-expression.
  43. -------------------------
  44.    `@e' is an invisible expression.  *Note Pseudo-operators::.
  45. File: fweb.info,  Node: AT;,  Next: ATcolon,  Prev: ATe,  Up: AT commands
  46. `@;':  Pseudo-semicolon.
  47. ------------------------
  48.    `@;' is an invisible semicolon.  These are often used in C
  49. programming to terminate a module name that expands to a compound
  50. statement.  For example,
  51.      @c
  52.      @a
  53.      if(flag)
  54.              @<Compound statement@>@;
  55.      else
  56.              @<Simple statement@>;
  57.      
  58.      @
  59.      @<Com...@>=
  60.      {
  61.      x;
  62.      y;
  63.      }
  64.      
  65.      @
  66.      @<Sim...@>=
  67.      z
  68.    *Note Pseudo-operators::.
  69. File: fweb.info,  Node: ATcolon,  Next: AT!,  Prev: AT;,  Up: AT commands
  70. `@:':  Pseudo-colon.
  71. --------------------
  72.    `@:' is an invisible colon.  *Note Pseudo-operators::.  It can be
  73. helpful in formatting certain C constructions correctly.  For example,
  74.      @<Cases@>=
  75.      case 1:
  76.      case 2:
  77.      case 3@:
  78. File: fweb.info,  Node: AT!,  Prev: ATcolon,  Up: AT commands
  79. Miscellaneous commands
  80. ======================
  81. `@!':  Inhibit macro expansion
  82. ------------------------------
  83.    FWEB macros and built-in functions are always expanded by default.
  84. This may not be desirable, particularly in the N mode.  To inhibit
  85. expansion of an individual identifier, preface it by `@!'.
  86. File: fweb.info,  Node: Comments,  Next: Languages,  Prev: AT commands,  Up: Top
  87. COMMENTING STYLES
  88. *****************
  89.    FWEB allows a variety of commenting styles. The visible comments are
  90. in the font `\cmntfont', which defaults to `\tenrm'.
  91. * Menu:
  92. * Invisible comments::          Skipping input material.
  93. * Visible comments::            Comments in code mode.
  94. File: fweb.info,  Node: Invisible comments,  Next: Visible comments,  Prev: Comments,  Up: Comments
  95. Invisible comments
  96. ==================
  97.      @z...@x --- If a source or include file begins with `@z', then all
  98.                  material is skipped until and including a line beginning in
  99.                  column 1 with `@x'.
  100.      
  101.      @%       --- All material until and including the next newline is
  102.                  completely ignored.
  103.      
  104.      @%%      --- As `@%', but also skip blank lines that immediately
  105.                   follow the current line.
  106.    For example,
  107.      @z
  108.      Author:  J. A. Krommes
  109.      @x
  110.      @c @% This sets the global language to C.
  111.      @* EXAMPLE.
  112. File: fweb.info,  Node: Visible comments,  Prev: Invisible comments,  Up: Comments
  113. Visible comments
  114. ================
  115.    `/* ... */' is a long comment (may extend over several lines).
  116.    `// ...' is a short comment (terminated by next newline).
  117.    `@(...@)' is a meta-comment.  Meta-comments are a localized form of
  118. the N mode.  Tangled meta-comments are begun by the contents of the
  119. style-file entry `meta.top' and terminated by `meta.bottom'.  Each line
  120. of the meta-comment is begun by `meta.prefix'.  Woven meta-comments are
  121. begun by `meta_code.begin' and ended by `meta_code.end'.  *Note
  122. Miscellaneous params::.
  123.      @n
  124.      @a
  125.              program main
  126.      /* Get input. */
  127.              call get_input // Read the parameter file.
  128.      /* Process information.  Comments like this
  129.         can be split over several lines. */
  130.      @(
  131.      Meta-comments provide a poor-man's alignment feature
  132.       i --- counter
  133.       x --- data value
  134.      @)
  135.              i = 1
  136.              x = 2.0
  137.              call exec(i,x)
  138.              end
  139.    The use of meta-comments is not recommended.  Use ordinary long
  140. comments instead.  Inside of them, use the various powerful features of
  141. TeX or LaTeX (such as `\halign') to format your comment appropriately.
  142. File: fweb.info,  Node: Macros,  Next: Ratfor,  Prev: Languages,  Up: Top
  143. MACROS and PREPROCESSING
  144. ************************
  145. * Menu:
  146. * Outer macros::        Macros copied to beginning of output file (@d).
  147. * WEB macros::          Macros expanded by FWEB (@m).
  148. * Preprocessing::       FWEB's preprocessing language (@#if etc.)
  149. File: fweb.info,  Node: Outer macros,  Next: WEB macros,  Prev: Macros,  Up: Macros
  150.    FWEB recognizes two kinds of macros:  "outer macros", and "WEB
  151. macros" or "inner macros".  Control codes associated with either of
  152. these kinds normally begin the definition part.  However, WEB macros
  153. are sometimes allowed in the code part as well; *Note WEB macros::.
  154. Outer macros
  155. ============
  156.    Outer macros are defined by `@d'.  These may be placed in any
  157. definition part.  They are collected during phase 1; during phase 2,
  158. they are simply copied in order of their appearance to the beginning of
  159. the output file.  This is most useful for C or C++ codes; it's a
  160. shorthand way of typing `#define' when the positioning of the `#define'
  161. is unimportant.
  162.    As an example,
  163.      @c
  164.      @
  165.      @d YES 1
  166.      @d NO 0
  167.      @a
  168.      main()
  169.      {}
  170.      
  171.      @
  172.      @d BUF_LEN 100
  173.      @a
  174.      ...
  175.    The keyword into which the `@d' is translated is language-dependent;
  176. it is controlled by the style-file parameter `outer_def'. *Note
  177. Miscellaneous params::.
  178.    Outer macros can be undefined by `@u'.  The translation is
  179. controlled by the style-file parameter `outer_undef'.  *Note
  180. Miscellaneous params::.
  181. File: fweb.info,  Node: WEB macros,  Next: Preprocessing,  Prev: Outer macros,  Up: Macros
  182. WEB macros
  183. ==========
  184.    WEB macros are defined by `@m'.  These should normally be placed in
  185. the definition section.  They are collected during FTANGLE's phase 1 and
  186. placed at the top of the unnamed section, so they are all known during
  187. the output in phase 2.
  188.    In unusual situations when macros are being conditionally defined
  189. and/or undefined, the order of processing a macro definition becomes
  190. significant.  If the command-line option `-TD' is used, then WEB macros
  191. may be used in the code part as well; they are then called deferred
  192. macros.  These definitions will be processed during phase 2 in the
  193. order that the code sections are processed, which may not be the same
  194. as the physical order in the source file.
  195.    WEB macros are often used in conjunction with the WEB preprocessor
  196. commands.  Preprocessor commands are always processed during phase 1,
  197. so they do not interact properly with deferred macros.  It is for this
  198. reason that deferred macros are normally prohibited from appearing in
  199. the code part.
  200. * Menu:
  201. * Macro features::      Various points about WEB macros.
  202. * Tokens::              Special tokens used in WEB macros.
  203. * Built-in functions::  Macro functions built into FWEB.
  204. File: fweb.info,  Node: Macro features,  Next: Tokens,  Prev: WEB macros,  Up: WEB macros
  205. Various features of WEB macros
  206. ------------------------------
  207.    * WEB macros with a variable number of arguments are indicated by an
  208.      ellipsis, as in
  209.           @m VAR(x,y,z,...) text
  210.    * Adjacent strings in macro text are automatically concatenated.
  211. File: fweb.info,  Node: Tokens,  Next: Built-in functions,  Prev: Macro features,  Up: WEB macros
  212. Special tokens
  213. --------------
  214.    The following special tokens may be used in the text of WEB macro
  215. definitions:
  216. ANSI C-compatible tokens
  217. ........................
  218.       ##          --- Paste tokens on either side to form a new identifier.
  219.       #parameter  --- Convert parameter to string (without expansion).
  220. Extensions to ANSI C macro syntax
  221. .................................
  222.    (In the following list, the forms `#{n}' and `#[n]' may not work
  223. correctly in complicated situations.  This is a design deficiency that
  224. will be corrected someday.)
  225.       #*parameter --- Like #parameter, but pass a quoted string through unchanged.
  226.       #!parameter --- Don't expand argument.
  227.       #'parameter --- Convert parameter to a single-quoted string (no expansion).
  228.       #"parameter --- Convert parameter to a double-quoted string (no expansion).
  229.       #0          --- Number of variable arguments.
  230.       #n          --- n-th variable argument, counting from 1.
  231.       #{0}        --- Like #0, but the argument may be a macro expression
  232.                       known at run time.
  233.       #{n}        --- Like #n, but the argument may be a macro expression.
  234.       #[0]        --- The total number of arguments (fixed + variable).  (The
  235.                       argument inside the brackets may be a macro expression.)
  236.       #[n]        --- The n-th argument (including the fixed ones), counting
  237.                       from 1.  (The argument inside teh brackets may be a
  238.                       macro expressions.)
  239.       #.          --- Comma-separated list of all variable arguments.
  240.       #:0         --- Unique statement number (expanded in phase 1).
  241.       #:nnn       --- Unique statement number for each invocation of this
  242.                       macro (expanded in phase 2).
  243.       #<          --- Begin a module name.
  244.       #,          --- Internal comma; doesn't delimit macro argument.
  245. File: fweb.info,  Node: Built-in functions,  Next: $A,  Prev: Tokens,  Up: WEB macros
  246. Built-in functions
  247. ------------------
  248.    Built-in functions are essentially macros, but they sometimes
  249. implement functions that a user could not define.  They all begin with
  250. a dollar sign and are in upper case.
  251.    In the original FWEB design, built-in functions began with an
  252. underscore.  This usage conflicts with the conventions for reserved
  253. words in ANSI C.  In fact, FWEB understands built-in function names
  254. that begin with either a dollar sign or an underscore.  If you don't
  255. like the underscore convention for some name, you can undefine it, as in
  256.      @#undef _A
  257.    *No user-defined macro should begin with an underscore or a dollar
  258. sign!*  It might interfere with the functioning of some internal
  259. built-in function.
  260. * Menu:
  261. * $A::                  Convert to ASCII.
  262. * $ABS::                Absolute value.
  263. * $ASSERT::             Assert a condition.
  264. * $COMMENT::            Generate a comment.
  265. * $DATE::               Today's date.
  266. * $DAY::                Today.
  267. * $DECR::               Decrement a macro.
  268. * $DEFINE::             Define a macro.
  269. * $DO::                 Macro `DO' loop.
  270. * $DUMPDEF::            Dump macro definitions to the terminal.
  271. * $E::                  2.71828...
  272. * $ERROR::              Send error message to output.
  273. * $EVAL::               Evaluate an expression.
  274. * $EXP::                Exponential function.
  275. * $GETENV::             Get value of environment variable.
  276. * $HOME::               The user's home directory.
  277. * $IF::                 Two-way conditional:  "If expression is true"
  278. * $IFCASE::             n-way conditional.
  279. * $IFDEF::              Two-way conditional:  "If macro is defined"
  280. * $IFNDEF::             Two-way conditional:  "If macro is not defined"
  281. * $IFELSE::             Two-way conditional:  "If macro1 equals macro2"
  282. * $INCR::               Increment a macro.
  283. * $INPUT_LINE::         Line number that begins current section.
  284. * $L::                  Change string to lower case.
  285. * $LANGUAGE::           Identifier for current language.
  286. * $LANGUAGE_NUM::       Number of current language.
  287. * $LEN::                Length of string.
  288. * $LOG::                Natural logarithm.
  289. * $LOG10::              Logarithm to the base 10.
  290. * $M::                  Define a macro.
  291. * $MAX::                Maximum of one or more elements.
  292. * $MIN::                Minimum of one or more elements.
  293. * $MODULE_NAME::        Name of present WEB module.
  294. * $MODULES::            Total number of independent modules.
  295. * $OUTPUT_LINE::        Current line number of tangled output.
  296. * $P::                  The C preprocessor symbol `'#''.
  297. * $PI::                 3.14159...
  298. * $POW::                Raise to a power.
  299. * $ROUTINE::            Current RATFOR program, function, or subroutine.
  300. * $SECTION_NUM::        Number of current section.
  301. * $SECTIONS::           Maximum number of sections.
  302. * $SQRT::               Square root.
  303. * $STRING::             Expand argument, then stringize.
  304. * $STUB::
  305. * $TIME::               The local time.
  306. * $TRANSLIT::           Transliterate a string.
  307. * $U::                  Change string to upper case.
  308. * $UNDEF::              Undefine a WEB macro.
  309. * $UNQUOTE::            Remove quotes from string.
  310. * $VERBATIM::           (Obsolete.)
  311. * $VERSION::            FWEB version number.
  312. File: fweb.info,  Node: $A,  Next: $ABS,  Prev: Built-in functions,  Up: Built-in functions
  313. `$A':  Convert to ASCII.
  314. ........................
  315.    `$A'(string) is the built-in equivalent of `@'...'' or `@"..."'.
  316. (See *note ATquote::. and *note AT"::..) Note the extra parentheses
  317. required by the built-in.
  318. File: fweb.info,  Node: $ABS,  Next: $ASSERT,  Prev: $A,  Up: Built-in functions
  319. `$ABS':  Absolute value.
  320. ........................
  321.    `$ABS'(expression) returns the absolute value of the macro
  322. expression.
  323. File: fweb.info,  Node: $ASSERT,  Next: $COMMENT,  Prev: $ABS,  Up: Built-in functions
  324. `$ASSERT':  Assert a condition.
  325. ...............................
  326.    `$ASSERT'(expression) evaluates the macro expression.  If the
  327. expression is false, an error message is printed and the run aborts.
  328.    This built-in is useful for ensuring that WEB macros required by the
  329. code are properly initialized.  It must appear in the *code part* (not
  330. the definition part).
  331. File: fweb.info,  Node: $COMMENT,  Next: $DATE,  Prev: $ASSERT,  Up: Built-in functions
  332. `$COMMENT':  Generate a comment.
  333. ................................
  334.    `$COMMENT'(string) generates a comment in the output file.
  335.    This built-in is sometimes useful in conjunction with the processing
  336. of WEB macros, since ordinary comments are removed when macros are
  337. processed.
  338. File: fweb.info,  Node: $DATE,  Next: $DAY,  Prev: $COMMENT,  Up: Built-in functions
  339. `$DATE':  Today's date.
  340. .......................
  341.    `$DATE' generates a string consisting of the date in the form
  342. `"August 16, 2001"'.
  343. File: fweb.info,  Node: $DAY,  Next: $DECR,  Prev: $DATE,  Up: Built-in functions
  344. `$DAY':  The day.
  345. .................
  346.    `$DAY' generates a string consisting of the day of the week, such as
  347. `"Monday"'.
  348. File: fweb.info,  Node: $DECR,  Next: $DEFINE,  Prev: $DAY,  Up: Built-in functions
  349. `$DECR':  Decrement a macro.
  350. ............................
  351.    `$DECR'(N) redefines the numeric macro N to be one less than its
  352. previous value.  (If N does not simplify to a number, an error
  353. results.)  In other words, in the language of C the effect is to say
  354. `N--'.
  355.    The two-argument form `$DECR'(N,M) executes the equivalent of `N -=
  356. File: fweb.info,  Node: $DEFINE,  Next: $DO,  Prev: $DECR,  Up: Built-in functions
  357. `$DEFINE':  Deferred macro definition.
  358. ......................................
  359.    `$DEFINE' (to be finished).
  360. File: fweb.info,  Node: $DO,  Next: $DUMPDEF,  Prev: $DEFINE,  Up: Built-in functions
  361. `$DO':  Macro do loop.
  362. ......................
  363.    `$DO'(macro,imin,imax[,di]){...} repetitively defines macro as would
  364. the FORTRAN statement `do macro = imin,imax,di'.  For example,
  365.      $DO(I,0,2)
  366.        {
  367.        a[I] = I;
  368.        }
  369. generates the three statements
  370.        a[0] = 0;
  371.        a[1] = 1;
  372.        a[2] = 2;
  373.    Do not assume that the macro remains defined after the end of the
  374. iteration.
  375.    Instead of the delimiting braces, parentheses may be used.  These
  376. may be useful to help FWEAVE format certain constructions correctly.
  377.    Nested delimiters are handled correctly.  The delimiters are required
  378. even only a single statement is to expanded.
  379. File: fweb.info,  Node: $DUMPDEF,  Next: $E,  Prev: $DO,  Up: Built-in functions
  380. `$DUMPDEF':  Dump macro definitions to the terminal.
  381. ....................................................
  382.    In the call `$DUMPDEF'(m1,m2,...), m1, m2, and so on are macro calls
  383. (with arguments if appropriate).  Two lines of output are generated for
  384. each argument.  Line 1 is the macro definition; line 2 is its expansion
  385. using the provided arguments.
  386.    You can use this built-in to debug your own macros, or to find out
  387. the secrets of FWEB's built-ins.
  388. File: fweb.info,  Node: $E,  Next: $ERROR,  Prev: $DUMPDEF,  Up: Built-in functions
  389. `$E': Base of natural logarithms.
  390. .................................
  391.    The expression `$E' returns E to the default machine precision.  The
  392. expression `$E(iprec)' returns E to the decimal precision IPREC (which
  393. must be less than 50).
  394. File: fweb.info,  Node: $ERROR,  Next: $EVAL,  Prev: $E,  Up: Built-in functions
  395. `$ERROR':  Send error message to output.
  396. ........................................
  397.    `$ERROR'(string) prints an error message in FWEB's standard form.
  398. File: fweb.info,  Node: $EVAL,  Next: $EXP,  Prev: $ERROR,  Up: Built-in functions
  399. `$EVAL':  Evaluate a macro expression.
  400. ......................................
  401.    `$EVAL'(expression) used FWEB's expression evaluator to reduce the
  402. macro expression to its simplest form.  An attempt to perform
  403. arithmetic on combinations of non-macro identifiers and numbers
  404. generates a warning message.
  405. File: fweb.info,  Node: $EXP,  Next: $GETENV,  Prev: $EVAL,  Up: Built-in functions
  406. `$EXP':  Exponential function.
  407. ..............................
  408.    `$EXP(x)' returns E to the power X.
  409. File: fweb.info,  Node: $GETENV,  Next: $HOME,  Prev: $EXP,  Up: Built-in functions
  410. `$GETENV':  Get value of environment variable.
  411. ..............................................
  412.    `$GETENV'(name) returns a string consisting of the current value of
  413. the environment variable name.  (Under VMS, logical names behave like
  414. environment variables.)
  415. File: fweb.info,  Node: $HOME,  Next: $IF,  Prev: $GETENV,  Up: Built-in functions
  416. `$HOME':  The user's home directory.
  417. ....................................
  418.    `$HOME' is equivalent to `$GETENV(HOME)'.
  419. File: fweb.info,  Node: $IF,  Next: $IFCASE,  Prev: $HOME,  Up: Built-in functions
  420. `$IF':  Two-way conditional.
  421. ............................
  422.    (To be finished.)
  423. File: fweb.info,  Node: $IFCASE,  Next: $IFDEF,  Prev: $IF,  Up: Built-in functions
  424. `$IFCASE':  n-way conditional.
  425. ..............................
  426. File: fweb.info,  Node: $IFDEF,  Next: $IFNDEF,  Prev: $IFCASE,  Up: Built-in functions
  427. `$IFDEF':  Two-way conditional.
  428. ...............................
  429. File: fweb.info,  Node: $IFNDEF,  Next: $IFELSE,  Prev: $IFDEF,  Up: Built-in functions
  430. `$IFNDEF':  Two-way conditional.
  431. ................................
  432. File: fweb.info,  Node: $IFELSE,  Next: $INCR,  Prev: $IFNDEF,  Up: Built-in functions
  433. `$IFELSE':  Two-way conditional.
  434. ................................
  435. File: fweb.info,  Node: $INCR,  Next: $INPUT_LINE,  Prev: $IFELSE,  Up: Built-in functions
  436. `$INCR':  Increment a macro.
  437. ............................
  438.    `$INCR'(N) redefines the numeric macro N to be one greater than its
  439. previous value.  (If N does not simplify to a number, an error
  440. results.)  In other words, in the language of C the effect is to say
  441. `N++'.
  442.    The two-argument form `$INCR'(N,M) executes the equivalent of `N +=
  443. File: fweb.info,  Node: $INPUT_LINE,  Next: $L,  Prev: $INCR,  Up: Built-in functions
  444. `$INPUT_LINE':  Line number that begins current section.
  445. ........................................................
  446.    `$INPUT_LINE' is the number of the line in the WEB source file that
  447. begins the current section.
  448. File: fweb.info,  Node: $L,  Next: $LANGUAGE,  Prev: $INPUT_LINE,  Up: Built-in functions
  449. `$L':  Change to lower case.
  450. ............................
  451.    `$L'(string) changes string to lower case.
  452. File: fweb.info,  Node: $LANGUAGE,  Next: $LANGUAGE_NUM,  Prev: $L,  Up: Built-in functions
  453. `$LANGUAGE':  Identifier for current language.
  454. ..............................................
  455.    This expands to an identifier that denotes the current language, as
  456. follows:
  457.      Language    $LANGUAGE
  458.       C             $C
  459.       C++           $CPP
  460.       Fortran       $N
  461.       Fortran-90    $N90
  462.       Ratfor        $R
  463.       Ratfor-90     $R90
  464.       TeX           $X
  465.       VERBATIM      $V
  466. Note that these are identifiers, not WEB macros.  They are intended to
  467. be used in `$IF' or `$IFELSE' statements such as
  468.      $IF($LANGUAGE==$C, C-text, other-text)
  469.    For multiway switches, the `$LANGUAGE_NUM' built-in is more useful;
  470. *Note $LANGUAGE_NUM::.
  471. File: fweb.info,  Node: $LANGUAGE_NUM,  Next: $LEN,  Prev: $LANGUAGE,  Up: Built-in functions
  472. `$LANGUAGE_NUM':  Number of current language.
  473. .............................................
  474.    `$LANGUAGE_NUM' expands to an integer that uniquely defines the
  475. current language, as follows:
  476.      Language  $LANGUAGE_NUM
  477.       C             0
  478.       C++           1
  479.       Fortran       2
  480.       Fortran-90    3
  481.       Ratfor        4
  482.       Ratfor-90     5
  483.       TeX           6
  484.       VERBATIM      7
  485. This built-in is useful in conjunction with an `$IFCASE' construction;
  486. *Note $IFCASE::.
  487. File: fweb.info,  Node: $LEN,  Next: $LOG,  Prev: $LANGUAGE_NUM,  Up: Built-in functions
  488. `$LEN':  Length of string.
  489. ..........................
  490.    `$LEN'(string) returns the length of string in bytes.  If string is
  491. not surrounded by quotes, it is interpreted as if it were quoted (so it
  492. is not expanded if it is a macro).  Thus, in the example
  493.      @m SS string
  494.      $LEN(SS)
  495. the value returned is 2, not 5.
  496. File: fweb.info,  Node: $LOG,  Next: $LOG10,  Prev: $LEN,  Up: Built-in functions
  497. `$LOG':  Natural logarithm.
  498. ...........................
  499.    `$LOG(x)' returns the natural logarithm of X.
  500. File: fweb.info,  Node: $LOG10,  Next: $M,  Prev: $LOG,  Up: Built-in functions
  501. `$LOG10':  Logarithm to the base 10.
  502. ....................................
  503.    `$LOG10(x)' returns the logarithm to the base 10 of X.
  504. File: fweb.info,  Node: $M,  Next: $MAX,  Prev: $LOG10,  Up: Built-in functions
  505. `$M':  Define a macro.
  506. ......................
  507.    `$M' is equivalent to `$DEFINE'.  *Note $DEFINE::.
  508. File: fweb.info,  Node: $MAX,  Next: $MIN,  Prev: $M,  Up: Built-in functions
  509. `$MAX':  Maximum of a list.
  510. ...........................
  511.    `$MAX(x1,x2,...)' returns the minimum of the list of arguments.
  512. (There must be at least one argument.)
  513. File: fweb.info,  Node: $MIN,  Next: $MODULE_NAME,  Prev: $MAX,  Up: Built-in functions
  514.    (To be finished.)
  515. `$MIN':  Minimum.
  516. .................
  517.    `$MIN(x1,x2,...)' returns the minimum of the list of arguments.
  518. (There must be at least one argument.)
  519. File: fweb.info,  Node: $MODULE_NAME,  Next: $MODULES,  Prev: $MIN,  Up: Built-in functions
  520. `$MODULE_NAME':  Name of present WEB module.
  521. ............................................
  522. File: fweb.info,  Node: $MODULES,  Next: $OUTPUT_LINE,  Prev: $MODULE_NAME,  Up: Built-in functions
  523. `$MODULES':  Total number of independent modules.
  524. .................................................
  525.    `$MODULES' gives the total number of independent modules--that is,
  526. the number of independent module names, plus 1 for the unnamed module.
  527. File: fweb.info,  Node: $OUTPUT_LINE,  Next: $P,  Prev: $MODULES,  Up: Built-in functions
  528. `$OUTPUT_LINE':  Current line number of tangled output.
  529. .......................................................
  530. File: fweb.info,  Node: $P,  Next: $PI,  Prev: $OUTPUT_LINE,  Up: Built-in functions
  531. `$P':  The C preprocessor symbol '#'.
  532. .....................................
  533.    `$P' is a synonym for `$UNQUOTE("#")'.  *Note $UNQUOTE::.  It is
  534. useful for constructing WEB macro definitions that expand to C
  535. preprocessor statements.  For example,
  536.      @m CHECK(flag)
  537.              $P if(flag)
  538.                      special code;
  539.              $P endif
  540. File: fweb.info,  Node: $PI,  Next: $POW,  Prev: $P,  Up: Built-in functions
  541. `$PI': Pi.
  542. ..........
  543.    The expression `$PI' returns PI to the default machine precision.
  544. The expression `$PI(iprec)' returns PI to the decimal precision IPREC
  545. (which must be less than 50).
  546. File: fweb.info,  Node: $POW,  Next: $ROUTINE,  Prev: $PI,  Up: Built-in functions
  547. `$POW':  Exponentiation.
  548. ........................
  549.    `$POW'(x,y) generates x raised to the power y.
  550. File: fweb.info,  Node: $ROUTINE,  Next: $SECTION_NUM,  Prev: $POW,  Up: Built-in functions
  551. `$ROUTINE':  Current function (RATFOR only).
  552. ............................................
  553.    When RATFOR is the current language, `$ROUTINE' expands to a string
  554. built of the name of the current program, function, or subroutine.
  555. This function is not useful for other languages, for which it expands
  556. to the null string.
  557. File: fweb.info,  Node: $SECTION_NUM,  Next: $SECTIONS,  Prev: $ROUTINE,  Up: Built-in functions
  558. `$SECTION_NUM':  Number of current WEB section.
  559. ...............................................
  560.    `$SECTION_NUM' returns an integer greater than 0 that is the number
  561. of the current WEB section.  (This is not the LaTeX section number such
  562. as 3.4.)
  563. File: fweb.info,  Node: $SECTIONS,  Next: $SQRT,  Prev: $SECTION_NUM,  Up: Built-in functions
  564. `$SECTIONS':  Maximum section number.
  565. .....................................
  566.    `$SECTIONS' is the maximum section number as understood by FWEAVE.
  567. File: fweb.info,  Node: $SQRT,  Next: $STRING,  Prev: $SECTIONS,  Up: Built-in functions
  568. `$SQRT':  Square root.
  569. ......................
  570.    `$SQRT(x)' return the square root of x.
  571. File: fweb.info,  Node: $STRING,  Next: $STUB,  Prev: $SQRT,  Up: Built-in functions
  572. `$STRING':  Expand, then stringize.
  573. ...................................
  574.    `$STRING'(s) expands its argument if it is a macro, then makes the
  575. expansion into a quoted string.  If the argument is already a quoted
  576. string, it is returned unchanged.
  577. File: fweb.info,  Node: $STUB,  Next: $TIME,  Prev: $STRING,  Up: Built-in functions
  578. `$STUB':
  579. ........
  580.    (To be finished.)
  581. File: fweb.info,  Node: $TIME,  Next: $TRANSLIT,  Prev: $STUB,  Up: Built-in functions
  582. `$TIME':  The time.
  583. ...................
  584.    `$TIME' returns a string consisting of the local time in the form
  585. `"19:59"'.
  586. File: fweb.info,  Node: $TRANSLIT,  Next: $U,  Prev: $TIME,  Up: Built-in functions
  587. `$TRANSLIT':  Transliteration.
  588. ..............................
  589.    (To be finished.)
  590. File: fweb.info,  Node: $U,  Next: $UNDEF,  Prev: $TRANSLIT,  Up: Built-in functions
  591. `$U':  Change to upper case.
  592. ............................
  593.    `$U'(string) changes string to upper case.
  594. File: fweb.info,  Node: $UNDEF,  Next: $UNQUOTE,  Prev: $U,  Up: Built-in functions
  595. `$UNDEF':  Undefine a macro.
  596. ............................
  597.    `$UNDEF'(macro) undefines a WEB macro.
  598. File: fweb.info,  Node: $UNQUOTE,  Next: $VERBATIM,  Prev: $UNDEF,  Up: Built-in functions
  599. `$UNQUOTE':  Remove quotes from string.
  600. .......................................
  601.    `$UNQUOTE'(string) returns string without its surrounded quotes.
  602. File: fweb.info,  Node: $VERBATIM,  Next: $VERSION,  Prev: $UNQUOTE,  Up: Built-in functions
  603. `$VERBATIM':  (Obsolete)
  604. ........................
  605.    This was an old name for `$UNQUOTE'.  *Note $UNQUOTE::.
  606. File: fweb.info,  Node: $VERSION,  Prev: $VERBATIM,  Up: Built-in functions
  607. `$VERSION':  Present FWEB version number.
  608. .........................................
  609.    `$VERSION' returns a string built out of the FWEB version number,
  610. such as `"1.32"'.
  611. File: fweb.info,  Node: Preprocessing,  Prev: WEB macros,  Up: Macros
  612. Preprocessing
  613. =============
  614.    FWEB preprocessor commands may appear in either the definition or the
  615. code parts.  But BEWARE:  No matter where they appear, they are expanded
  616. during INPUT, not output.  (This is probably a design flaw.)  For more
  617. discussion, *Note WEB macros::.
  618.      @#define identifier --- Define a WEB macro; equivalent to `@m'.
  619.      @#undef identifier  --- Undefine a WEB macro.
  620.      
  621.      @#ifdef identifier  --- Is WEB macro defined?  Equivalent to
  622.                               `@#if defined identifier'.
  623.      @#ifndef identifier --- Is WEB macro not defined?  Equivalent to
  624.                               `@#if !defined identifier'.
  625.      
  626.      @#if expression
  627.      @#elif expression
  628.      @#else
  629.      @#endif
  630.    In the `@#if' statement, the expression may contain WEB macros, but
  631. must ultimately evaluate to a number.  If that number is zero, the
  632. expression is false; otherwise, it is true.
  633.    The expression following constructions such as `@#if' is evaluated
  634. by a built-in expression evaluator that can also be used for other
  635. purposes, such as in macro expansion.  Its behavior is again motivated
  636. by expression evaluation in ANSI C; it is not quite as general, but
  637. should be more than adequate.  (One design flaw that will be fixed
  638. someday is that the order of expression evaluation is not necessarily
  639. left-to-right, as it is in C.) It supports both integer and
  640. floating-point arithmetic (with type promotion from integer to
  641. floating-point if necessary), and the ANSI `defined' operator.
  642. Operators with the highest precedence (see table below) are evaluated
  643. first; as usual, parentheses override the natural order of evaluation.
  644. The unary operator `defined' has the highest precedence; all the other
  645. unary operators have the next highest (and equal) precedence; then come
  646. the binary operators. When the operator exists in C, the action taken
  647. by FWEB is precisely that that the C compiler would take.  Arithmetic
  648. is done in either long or double variables, as implemented by the C
  649. compiler that compiled FTANGLE.  (This was the easy choice, not
  650. necessarily the most desirable one.)
  651.    The operators, listed from  highest precedence  to lowest, are as
  652. follows (printed documentation only):
  653. File: fweb.info,  Node: Languages,  Next: Macros,  Prev: Comments,  Up: Top
  654. LANGUAGES
  655. *********
  656.    FWEB has the ability to work with more than one language during a
  657. single run.  The language in effect at the beginning of the first
  658. section defines the *global language*.  Further language changes within
  659. a section have scope local to that section.
  660.    Usually, `language' means a compiler language like Fortran or C.
  661. These languages will be "pretty-printed" by FWEAVE.  Pretty-printing
  662. can be inhibited by turning on the N mode (globally, with the
  663. command-line option `-N'; locally, with `@N') or by selecting the
  664. VERBATIM `language'; in both of these cases, the input text is echoed
  665. literally to the output of both FTANGLE and FWEAVE.
  666.    `Language' is a stronger concept than `mode'.  For example, when a
  667. language is selected, the extension of the tangled output file is
  668. changed appropriately--for example, if `test.web' contains C code (that
  669. is, contains the command `@c'), `test.web' tangles into `test.c'
  670. (compressing blanks and otherwise making the tangled output relatively
  671. unreadable) and FWEAVE pretty-prints using the C syntax.  Turning on
  672. the N mode does not affect the language; FTANGLE copies the source code
  673. literally into `test.c' (no blank compression or other modifications),
  674. and FWEAVE typesets the source code within a verbatim environment (no
  675. pretty-printing).  When the VERBATIM language is selected, the N mode
  676. is turned on automatically, but FTANGLE writes its output to a file
  677. with a special default extension that can be customized in the style
  678. file.  *Note Miscellaneous params::.
  679. * Menu:
  680. * Setting::             Setting the language.
  681. Special hints and considerations for each language.
  682. * C::                   C
  683. * C++: Cpp.             C++.
  684. * Fortran::             Fortran-77 and Fortran-90.
  685. * Ratfor: Ratfor_.      RATional FORtran.
  686. * TeX::                 TeX.
  687. * Verbatim::            Literal mode.
  688. File: fweb.info,  Node: Setting,  Next: C,  Prev: Languages,  Up: Languages
  689. Setting the language
  690. ====================
  691.    The most general form of a language command is
  692.    @[L]ltext[options]
  693. where l is a language symbol, text is converted into a hyphenated
  694. option, and options have the same syntax as on the command line.  The
  695. language symbols must be in lower case; they are
  696.      C          --- c
  697.      C++        --- c++
  698.      Fortran-77 --- n
  699.      Fortran-90 --- n9
  700.      Ratfor-77  --- r
  701.      Ratfor-90  --- r9
  702.      TeX        --- x
  703.      VERBATIM   --- v
  704. Thus, for example,
  705.      @n9[-n&]
  706. means set the language to Fortran-90 and use free-form syntax with the
  707. ampersand as the continuation character.
  708.    A language command should appear somewhere in limbo, before the
  709. start of the first section.  The language in effect at the beginning of
  710. the first section defines the global language.
  711.    Language commands may be used within sections, but the new language
  712. remains in force only for that section.  The language of a named module
  713. is inherited from the language in effect at the time the name is first
  714. used.  Thus, in the following example, the global language is
  715. Fortran-77, but an arbitrary number of C functions can be placed into a
  716. C-language module with just one `@c' language-changing command.
  717.      @n
  718.      @
  719.      @a
  720.              program main
  721.              end
  722.      
  723.      @c
  724.      @<C@>@;
  725.      
  726.      @
  727.      @<C@>=
  728.      int fcn()
  729.      {}
  730. FTANGLE will write two output files for this example.
  731. File: fweb.info,  Node: C,  Next: Cpp,  Prev: Setting,  Up: Languages
  732. Special hints and considerations for each language
  733. ==================================================
  734.    Special remarks.  (To be completed.)
  735. File: fweb.info,  Node: Cpp,  Next: Fortran,  Prev: C,  Up: Languages
  736.    Special remarks.  (To be completed.)
  737. File: fweb.info,  Node: Fortran,  Next: Ratfor_,  Prev: Cpp,  Up: Languages
  738. Fortran
  739. -------
  740.    Special remarks.  (To be completed.)
  741. File: fweb.info,  Node: Ratfor_,  Next: TeX,  Prev: Fortran,  Up: Languages
  742. Ratfor
  743. ------
  744.    Special remarks.  (To be completed.)
  745. File: fweb.info,  Node: TeX,  Next: Verbatim,  Prev: Ratfor_,  Up: Languages
  746.    Special remarks.  (To be completed.)
  747. File: fweb.info,  Node: Verbatim,  Prev: TeX,  Up: Languages
  748. Verbatim
  749. --------
  750.    Special remarks.
  751. File: fweb.info,  Node: Ratfor,  Next: Formatting,  Prev: Macros,  Up: Top
  752. RATFOR
  753. ******
  754.    "Ratfor" stands for "RATional FORtran".  More...
  755. * Menu:
  756. * Commands::            Ratfor commands.
  757. * Caviats::             Nuances about FWEB Ratfor.
  758. File: fweb.info,  Node: Commands,  Next: Caviats,  Prev: Ratfor,  Up: Ratfor
  759. Ratfor commands
  760. ===============
  761. Ratfor-77 commands
  762. ------------------
  763.       break;
  764.       case i:
  765.       default:
  766.       do ...; {...}
  767.       else {...}
  768.       for(a;b;c) {...}
  769.       if(condition) {...}
  770.       next;
  771.       repeat {...} until(condition);
  772.       return expression;
  773.       switch(expression) {...}
  774.       while(condition) {...}
  775. Additional Ratfor-90 commands
  776. -----------------------------
  777.       contains:
  778.       interface name {...}
  779.       interface operator(op) {...}
  780.       interface assignment(assgnmnt) {...}
  781.       module name {...}
  782.       private:
  783.       sequence:
  784.       type name {...}
  785.       where(expression) {...}
  786. File: fweb.info,  Node: Caviats,  Prev: Commands,  Up: Ratfor
  787. Caviats about Ratfor
  788. ====================
  789.    The version of Ratfor built into FWEB differs slightly from its Unix
  790. counterpart:
  791.   1. Numeric statement labels must be followed by a colon; they should
  792.      be first on their line.
  793.   2. The quoting convention for characters and strings follows that of
  794.      C:  Single-quote single characters, double-quote strings.
  795.   3. In a switch, cases fall through to the next case unless terminated
  796.      by break (just as in C).
  797.   4. The do statement must be terminated by a semicolon if followed by
  798.      a simple statement.  (It's unnecessary if followed by a left brace
  799.      that begins a compound statement.)
  800.   5. Use && and || for the logical AND and OR.
  801.   6. Do not use an end statement at the very end of a program unit; it
  802.      is added automatically when the closing brace is sensed.
  803. File: fweb.info,  Node: Formatting,  Next: Customization,  Prev: Ratfor,  Up: Top
  804. FORMATTING
  805. **********
  806.    FWEB uses TeX to format its documentation.  Either Plain TeX or
  807. LaTeX may be used.  FWEB's "new look" beginning with Version 1.40 is
  808. very flexible, but works only with LaTeX.
  809. * Menu:
  810. * Typesetting::         Woven output; TeX vs. LaTeX, etc.
  811. * Pretty-printing::     Turning ugly input into beautiful output.
  812. File: fweb.info,  Node: Typesetting,  Next: Pretty-printing,  Prev: Formatting,  Up: Formatting
  813. Typesetting
  814. ===========
  815.    FWEAVE works in conjunction with either TeX or LaTeX.  It is always
  816. possible to create an adequately typeset document by processing with
  817. TeX.  However, FWEB's "new look" (beginning with version 1.40) is
  818. designed to work with LaTeX; it probably will not be retrofitted to TeX
  819. unless days become longer than 24 hours.  The new look is more
  820. book-like, following ideas from Briggs' `nuweb'.
  821.    To inform FWEAVE you will be using TeX as the formatter, just say
  822. `FWEAVE test' or `FWEAVE -PT test'.  To inform it you will be using
  823. LaTeX, say `FWEAVE -PL test'.
  824.    If you will always be using a particular processor, you should
  825. probably put `+PL' into your `.FWEB' file (*note Initialization::.).
  826. * Menu:
  827. * Output::    Structure of the TeX output from FWEAVE.
  828. * LaTeX::    Specifics of the LaTeX support.
  829. File: fweb.info,  Node: Output,  Next: LaTeX,  Prev: Typesetting,  Up: Typesetting
  830. FWEAVE's OUTPUT
  831. ---------------
  832.    When one says `FWEAVE test', the file `test.tex' is created.  The
  833. TeX commands contained in this file are organized into several
  834. sequential groups.
  835.   1. `\input' command to read in FWEAVE's macro package.
  836.      By default, the initial input command is `\input fwebmac.sty'.  The
  837.      name of the macro package can be changed with the `-w' command-line
  838.      option.  *Note -w::.
  839.   2. `\Wbegin' command (sets up the environment for TeX or LaTeX).
  840.      The `\Wbegin' macro sets up certain defaults.  These can be
  841.      overridden in the limbo section.
  842.   3. Limbo text from the style-file parameter `limbo'.  *Note limbo::.
  843.   4. Beginning of user's limbo section.
  844.   5. TeX commands for individual WEB sections.
  845.   6. `\input' command to read in the index data file.
  846.   7. `\input' command to read in the module-list data file.
  847.   8. `\Winfo' command (summarizes some status information).
  848.   9. `\Wcon' command (generates the table of contents, and ends the
  849.      run).
  850. File: fweb.info,  Node: LaTeX,  Prev: Output,  Up: Typesetting
  851. LaTeX support
  852. -------------
  853.    Original LaTeX support (through version 1.30) was substantially
  854. incomplete in that LaTeX's `\output' routine was usurped by the
  855. relatively simple one used for FWEB's TeX support.  However, beginning
  856. with version 1.40, full LaTeX support is provided.  LaTeX's `\output'
  857. routine is used, as are its sectioning commands (with minor changes),
  858. table-of-contents facilities, etc.
  859. * Menu:
  860. * Document style::    LaTeX's document style, options, etc.
  861. * Sections::            Section numbering, spacing, etc.
  862. * Table of contents::   The table of contents.
  863. * Customizing LaTeX::   Conditional flags, etc.
  864. File: fweb.info,  Node: Document style,  Next: Sections,  Prev: LaTeX,  Up: LaTeX
  865. LaTeX's document style
  866. ......................
  867.    FWEAVE uses `\documentstyle{article}'.  The document style can be
  868. changed by the style-file option `LaTeX.style'.  *Note Fwebmac params::.
  869. However, FWEAVE has not been tested with other document styles.
  870.    To incorporate style options--i.e., to obtain the effect of
  871. `\documentstyle[myoptions]{article}', use the style-file option
  872. `LaTeX.options', as in
  873.      LaTeX.options "myoptions"
  874.    TeX commands in the user's limbo section will appear after the
  875. `\documentstyle' and `\begin{document}' commands, so may be used to
  876. redefine macro definitions in the style file.
  877. File: fweb.info,  Node: Sections,  Next: Table of contents,  Prev: Document style,  Up: LaTeX
  878. Sections in LaTeX
  879. .................
  880.    FWEB's sectioning commands (`@*', `@*'n, and `@ ') are converted into
  881. LaTeX's section commands such as `\section' (n=0), `\subsection' (n=1),
  882. and `\subsubsection' (n=2).  During LaTeX's processing of the tex file,
  883. it keeps track of the maximum depth achieved by `@*n'.  This number is
  884. written as the last item in the `.aux' file.  During the next LaTeX run,
  885. that number is used to map the `@ ' commands to the next most
  886. insignificant sectioning command.  That level of sectioning command is
  887. slightly redefined from LaTeX's default, so don't try to redefine it.
  888.    The `.aux' file is also used by both processors to generate
  889. appropriate error messages that refer to the LaTeX section number
  890. instead of the internal one.
  891. File: fweb.info,  Node: Table of contents,  Next: Customizing LaTeX,  Prev: Sections,  Up: LaTeX
  892. LaTeX's table of contents
  893. .........................
  894.    In essence, the table of contents is produced by the LaTeX commands
  895.      \pagenumbering{roman}
  896.      \topofcontents
  897.      \maketitle
  898.      \tableofcontents
  899.      \botofcontents
  900.      \newpage
  901. By default, the FWEB hooks `\topofcontents' and `\botofcontents' are
  902. empty, but they may be used in special circumstances to override the
  903. usual behavior.  One can set the parameters for \maketitle in the limbo
  904. section in the usual LaTeX way, except that one is encouraged to use
  905. FWEB's \Title macro instead of `\title':
  906.      \Title{MYCODE.WEB}
  907.      \author{My name}
  908.      \date{January 1, 2001}
  909.    By default, FWEAVE uses
  910.      \title{}%
  911.      \author{}%
  912.      \date{\today\\[3pt]\Time}%
  913. File: fweb.info,  Node: Customizing LaTeX,  Prev: Table of contents,  Up: LaTeX
  914. Customizing LaTeX's output
  915. ..........................
  916.    Several flags are provided to change the appearance of the final
  917. LaTeX document.  These are
  918.    * \ifpagerefs (index references by pages or section numbers).
  919.    * \numberTeX (number the beginning of the TeX part).
  920.    * \numberdefs (number the beginning of the definition part).
  921.    * \numbercode (number the beginning of the code part).
  922. The defaults for these flags are
  923.      \pagerefsfalse
  924.      \numberTeXfalse
  925.      \numberdefstrue
  926.      \numbercodetrue
  927. * Menu:
  928. * Page references::     Indexing by page numbers.
  929. * Numbering::           Various section numbering schemes.
  930. File: fweb.info,  Node: Page references,  Next: Numbering,  Prev: Customizing LaTeX,  Up: Customizing LaTeX
  931. Page references
  932. ---------------
  933.    When one says `\pagerefstrue' (LaTeX only), index references are
  934. made by page numbers rather than module numbers or LaTeX section
  935. numbers.  If there is more than one section per page, they are
  936. identified by `a', `b', `c', etc., such as `section 17b'.
  937.    The information necessary to process page references in this way is
  938. written into the `.aux' file.  As usual with LaTeX, several runs may be
  939. required for the references to be fully consistent with the source file.
  940. File: fweb.info,  Node: Numbering,  Prev: Page references,  Up: Customizing LaTeX
  941.    (To be finished.)
  942. File: fweb.info,  Node: Pretty-printing,  Prev: Typesetting,  Up: Formatting
  943. Pretty-printing
  944. ===============
  945.    "Pretty-printing" refers to FWEAVE's attempt to typeset and
  946. highlight the code in a readable way.  This is usually done
  947. automatically for all of the compiler-like languages such as C.
  948. However, it can be inhibited by turning on the N mode with `@N' or by
  949. using the VERBATIM language (selected with `@Lv').
  950.    (More...)
  951. * Menu:
  952. * Alternatives::        Alternatives for various input tokens.
  953. * Pseudo-operators::    Invisible parts of speech.
  954. * Overloading::         Changing the appearance of various quantities.
  955. File: fweb.info,  Node: Pseudo-operators,  Next: Overloading,  Prev: Alternatives,  Up: Pretty-printing
  956. Pseudo-operators
  957. ----------------
  958.    Pseudo-operators behave like a particular part of speech for the
  959. purposes of FWEAVE's formatting, but are invisible on output.  The
  960. pseudo-operators are
  961.      @e --- pseudo-expression.  *Note ATe::.
  962.      @; --- pseudo-semicolon.  *Note AT;::.
  963.      @: --- pseudo-colon.  *Note ATcolon::.
  964. File: fweb.info,  Node: Alternatives,  Next: Pseudo-operators,  Prev: Pretty-printing,  Up: Pretty-printing
  965. Alternatives for various input tokens
  966. -------------------------------------
  967.    FWEAVE translates various input constructions into allegedly more
  968. readable symbols--for example, in FORTRAN it translates `.LT.' into `<'.
  969. The printed documentation contains a table of what you can type on
  970. input, and what FWEAVE will output.
  971. File: fweb.info,  Node: Overloading,  Prev: Pseudo-operators,  Up: Pretty-printing
  972. Overloading operators and identifiers
  973. -------------------------------------
  974.    For special effects in the woven output, there are commands to help
  975. one change the appearance of operators and identifiers.
  976. Overloading operators
  977. .....................
  978.    A feature common to both C++ and FORTRAN-90 is operator overloading,
  979. the ability to extend or redefine the definition of an operator such as
  980. `.FALSE.' or `='.  FORTRAN-90 even allows one to define new `dot'
  981. operators--for example, one might define the operator `.IN.' to test
  982. for inclusion in a set.  In a nontrivial extension of the original
  983. design, FWEAVE allows one to define how overloaded operators should
  984. appear on output.  Indeed, this feature can be used even when the
  985. language does not permit overloading in order to customize the
  986. appearance of the woven output.
  987.    The `@v' control code is used to change the appearance of an
  988. operator.  The format is
  989.      @v new_operator_symbol_or_name "TeX material" old_operator
  990. This means "Display the new operator according to the TeX material, but
  991. treat it like the old operator--e.g., unary or binary--for formatting
  992. purposes.  The quoted TeX material is treated just like a C string, so
  993. for example if you want to include a backslash you must escape it with
  994. another backslash.  For example, we can make an equals sign display on
  995. output as a large left arrow by saying
  996.      @v = "\\Leftarrow" =
  997. Two \Fortran\ examples are
  998.      @v .FALSE. "\.{.FALSE.}" .FALSE.
  999.      @v .IN. "\\in" +
  1000.    This feature can go a long way toward enhancing readability of the
  1001. woven output, particularly when operators are actually being
  1002. overloaded.  It can also lead to arbitrarily bizarre output that no-one
  1003. else will understand.  As usual, restraint is advised.
  1004. Overloading identifiers
  1005. .......................
  1006.    Although operator overloading is quite useful, it does not allow one
  1007. to change the appearance of identifiers.  In its most general form,
  1008. such a facility becomes quite complicated; one must endow FWEAVE with a
  1009. macro-processing facility analogous to that of FTANGLE.  This has not
  1010. been done yet (probably it will be someday).  In the meantime, one has
  1011. the command `@W', which provides a restricted form of such a facility.
  1012. *This command, new with version~1.30, is experimental, and not firmly
  1013. established.  Changes in usage and/or syntax may be made in future
  1014. versions.*
  1015.    The most general form of the `@W' command is
  1016.      @W identifier "replacement text"
  1017. This means:  Replace any references to identifier in the woven output
  1018. with the replacement text.
  1019.    A more restrictive form is
  1020.      @W identifier \newmacro
  1021. which replaces references to identifier with a call to `\newmacro'.
  1022. (Note that there are no quotes in this form.)
  1023.    The shortest form is
  1024.      @W identifier .
  1025. which replaces references to identifier with a call to `\identifier'.
  1026. For example, the identifier x normally appears in woven output as
  1027. `\.{\Wshort\{x\}}'.  If one says
  1028.      @W x .
  1029. one will instead get the macro reference `\x', which could be defined
  1030. to give a variety of special effects.
  1031.    One of the important uses of this facility is to expedite special
  1032. formatting of array references.  This subject is discussed separately
  1033. below in the section on "Special array formatting," where an example is
  1034. given.
  1035. File: fweb.info,  Node: Info options,  Prev: -!,  Up: Options
  1036. Information options
  1037. -------------------
  1038.    Several of the command-line options can be used to elicit information
  1039. about the initial state of FWEB.
  1040.    `-@' displays information about the control codes. *Note -AT::.
  1041.    `-D' displays information about reserved words.  *Note -D_::.
  1042.    `-y' displays default dynamic memory allocations.  *Note -y::.
  1043.    `-Z' displays default values of style-file parameters.  *Note -Z_::.
  1044. File: fweb.info,  Node: Customization,  Next: Hints,  Prev: Formatting,  Up: Top
  1045. CUSTOMIZATION
  1046. *************
  1047.    The default behavior of FWEB can be changed in a variety of ways.
  1048.   1. Unix environment variables (logical variables in VMS) affect path
  1049.      or file names.
  1050.   2. An initialization file resides in the home directory.
  1051.   3. A style file resides in the current directory.
  1052.    The initialization file (usually called `.fweb') is intended to
  1053. contain command-line options (one per line) that are to be used in
  1054. every run.
  1055.    The style file is intended to provide more local customization,
  1056. perhaps differing for each run.  The style file does not contain
  1057. command-line options; rather, it contains parameter settings that
  1058. override FWEB's defaults.  The `-p' option (*note -p::.) provides a
  1059. means of incorporating style-file entries into `.fweb'.
  1060.    The order of processing is:
  1061.   1. Evaluate environment variables.
  1062.   2. Read `.fweb'.
  1063.   3. Process `.fweb' options beginning with `+'.
  1064.   4. Read and process command-line options (except for `-p').
  1065.   5. Process remaining `.fweb' options.
  1066.   6. Process any `-p' options.
  1067.   7. Read and process the style file.
  1068. * Menu:
  1069. * Environment variables::       Environment or logical variables.
  1070. * Initialization::              Initialization file.
  1071. * Memory allocation::           Dynamic memory allocation.
  1072. * Style::                       Style file.
  1073.