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.
  • The CHAR macro takes one argument: the ASCII number of a character or the character itself. The character is sent to the output file without being translated with the currently active character translation table.
  • The NOTRANS macro takes one argument: the text in question. The text is neither parsed (i.e., macros in it are not expanded), nor translated with the current character translation table. The NOTRANS macro is conceptually like a series of CHAR macros.
  • The NOEXPAND macro takes one argument: the text in question. The text is not parsed, but it is translated with the current character translation table.
  • 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 Jun 19 14:03:17 2008 EDT.