The built-in macro DEFINECHARTABLE
defines a character translation table.
It takes two parameter lists: the name of the table and the character
translations. Hence, each table is defined by its own name.
As an example of a table, consider the following fragment. It defines a table
that translates the upper case characters A
to E
to their lower case
equivalents:
DEFINECHARTABLE(tolower)( 'A' = "a" 'B' = "b" 'C' = "c" 'D' = "d" 'E' = "e" )
Each DEFINECHARTABLE
statement must have a non-empty second
parameter. "Empty" character tables cannot be defined, though one
non-translation table is built-in.
The syntaxis of the second parameter list is as follows:
'c'
, c
being
any character. Escape-sequences from the C programming language can be
used in this specification; Yodl supports the sequences \a
(alert),
\b
(beep), \f
(formfeed), \n
(newline), \r
(carriage
return), \t
(tab), and \v
(vertical tab). Any other character
following a \ defines itself: \\
defines one backslash character.
=
must appear.
'\n' = "End of line\n"
Such a mapping adds the text End of line
to each line, since each
newline character in the input is replaced by the text End of line
,
followed by the newline itself.
Translations which are not specified in the table are left to the default, which is to output the character as-is.
Note that the character table translation is something that the yodl
program does as one of its last actions, just before sending text to the
output file. The expansion text is not further processed by yodl
, except
for the conversion of C-type escape sequences to ordinary characters. The
expansion text should therefore not be protected by, e.g., NOTRANS
(unless of course you want some character to generate the text NOTRANS
on the output).
Please send Yodl questions and comments to yodl@icce.rug.nl.
Please send comments on these web pages to (address unknown)
Copyright (c) 1997, 1998, 1999 Karel Kubat and Jan Nieuwenhuizen.
Verbatim copying and distribution of this entire article is permitted in any medium, provided this notice is preserved.