Download FWEB manual - (La)TeX Navigator
Transcript
— Numerical constants — 85 octal digits (0–7), and iii stands for a sequence of binary digits (0 or 1). Of course, C already recognizes hexadecimal and octal constants, so for C these are just passed through to the output unchanged. In the other cases, the constants are converted (during tokenization in phase one) to the appropriate integer. For example, in Ratfor or Fortran each of 0xF, 017, and 0b1111 is replaced by 15. 12.4 Special assignment and increment operators In Fortran and Ratfor, the post-increment operators ‘++’ and ‘−−’ and the compound assignment operators ‘+=’, ‘−=’, ‘*=’, and ‘/=’ are allowed in restricted contexts—namely, in simple assignment statements. These operators translate as follows, where x is anything allowed on the left-hand side of an equals sign—for example, a subscripted expression: x++; x--; x += x -= x *= x /= // -> // -> expr; expr; expr; expr; ‘x ‘x // // // // = x + = x -> ‘x -> ‘x -> ‘x -> ‘x 1;’ 1;’ = x + (expr);’ = x - (expr);’ = x*(expr);’ = x/(expr);’ They are very useful at increasing the readability of your code. They can also be used in the Ratfor for statement. For example, for(i++; i<100; i*= 5) They cannot, however, be used in ways such as ‘a(k++) = b(i++);’, even though the analogous construction in C is both legitimate and often highly valuable. Furthermore, one must say ‘i++’, not ‘++i’, even though these would be identical in C when used stand-alone. If one does not want these constructions to be recognized, he may turn them off by the command-line option ‘−+’. 12.5 Strings Strings are delimited by single quotes (Fortran), double quotes (C and Ratfor), or (in the case of certain built-in functions), by parentheses. In order to continue quoted strings to another line, all lines but the last must end with a backslash (just as one would define a lengthy C macro). Parenthesized strings should not be explicitly continued, unless the command-line option ‘−(’ is used. By default, the continuation of the string begins in column 1 of the next line. Fortran–90 introduces a different convention, in which the continuation of the string may begin in an arbitrary column, but must be preceded by the same continuation character (an ampersand in Fortran–90) that was used at the end of the previous line. This is neither required nor allowed in FWEB’s default continuation mode. However, if the Fortran–90 convention is desired, it may be turned on by the command-line option ‘−\’. When turned on, it operates for all languages, not just Fortran–90. As an example, the following two lines of code are equivalent, both dealing with the string "12345". @n9[-n&] @ The global language is Fortran--90, with free-form syntax. FWEB’s default continuation convention is used. @A x = "123& 45" // Now tell \FWEB\to use Fortran--90’s continuation convention. @n9[-n& -\] x = "123& &45"