The Yodl program has three built-in macros to send literal text to the output file. The macros are listed in the above section ?? and are furthermore described here. To illustrate the need for the distinction between NOTRANS and NOEXPAND, consider the following. The HTML converter (described in chapter ??) must be able to send HTML commands to the output file, but must also be able to send literal text (e.g., a source file listing). The HTML commands of course must be neither translated with any character table, nor must they be expanded in regard to macros. In contrast, a source file listing must be subject to character translations: the &, < and > characters can cause difficulties. Two possible macros for a HTML converter are:
COMMENT(--- htmlcommand(cmd) sends its argument as a HTML command 
            to the output ---)
DEFINEMACRO(htmlcommand)(1)(NOTRANS(ARG1))
    
COMMENT(--- verb(listing) sends the listing to the output ---)
DEFINECHARTABLE(list)(
    '&'     =   "&amp;"
    '<'     =   "&lt;"
    '>'     =   "&gt;"
)

DEFINEMACRO(verb)(1)( \ 
    USECHARTABLE(list) \ 
    NOTRANS(<listing>) \ 
    NOEXPAND(ARG1) \ 
    NOTRANS(</listing>) \ 
    USECHARTABLE(standard))

In this example it is assumed that a character translation table standard exists, defining the `normal' translations. This table is re-activated in the verb macro.


Go back to index of Yodl.

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.


This page was built from Yodl-1.31.18 by

<(address unknown)>, Thu Jan 19 00:17:16 2006 MSK.