Tutorial Developer Reference 1 Introduction 2 Interface 3 Scanner 4 Parser 5 Analyser 6 Tangle 7 Weave 8 Shell 9 Commands 10 Glossary 11 References SEARCH

9.3 Codify

The `codify` command takes two arguments: an input file and an output file. It reads each line of the input file and writes a corresponding line to the output file. The corresponding line consists of a C macro call containing a string containing the input line. The command converts all backslashes in input lines to double backslashes so as to avoid unwanted interpretations by the C compiler. It also converts double quotes in the line to backslashed double quotes.

    Syntax : codify = "codify" s filename s filename
    Example: codify header.tex header.c

The following example demonstrates the transformation.

    Input  Line:
     \def\par{\leavevmode\endgraf}% A "hack".
    Output Line:
     WX("\\def\\par{\\leavevmode\\endgraf}% A \"hack\".");

The `codify` command was introduced to assist in the development of FunnelWeb. It is used to convert longish text files into C code to write them out. The C code is then included within the FunnelWeb C program. For example, the set of TeX definitions that appears at the top of every documentation file was `codif`ied and inserted into the FunnelWeb code so that FunnelWeb would not have to look for a file containing the definitions at run time.

Webmaster Copyright © Ross N. Williams 1992,1999. All rights reserved.