VI/NROFF symbolics question

Leo de Wit leo at philmds.UUCP
Thu Jan 26 03:48:25 AEST 1989


In article <108 at mdiva1.uucp> fontana at mdiva1.uucp writes:
|I am a IBM SCRIPT and GGML user.  I need to know how to
|do a symbolic reference in VI and NROFF. (i.e. I want to
|be able to define a table of symbolic strings and their
|expanded names or string.  Then I want to only type the
|symbolics in the text and have the system input the expanded
|names when I run off the text.)
|
|Any helpful hints would be appreciated.

You might consider using a preprocessor, like cpp (directly via
/lib/cpp or indirectly via cc -E), or m4. This way you can enter your
symbol definitions either directly in the file (#define symbol value),
in an include file (#include "inc_file") so it is easier to share
definitions, or on the commandline (cc -E -Dsymbol=value) so you can
add flexibility, or any combinations of the three. You can also use the
conditionals of cpp (#if, #ifdef, #ifndef, #else, #endif) to select a
whole set of symbol/value pairs at once. You will have to filter out
the # line "file" lines that cpp generates (e.g. with sed).
So this would become something like

cc -E yourfile|sed '/^# [0-9]* ".*"$/d'|nroff

Hope this helps,
                  Leo.



More information about the Comp.unix.questions mailing list