ramsdell@celebes.mitre.org (John D. Ramsdell) (02/27/91)
C2latex provides simple support for literate programming in C. Given a C source file in which the comments have been written in LaTeX, c2latex converts the C source file into a LaTeX source file. It can be used to produce typeset listings of C programs and/or documentation associated with the program. The C source given to c2latex usually has the following form. It starts with a large comment containing LaTeX commands that start a document along with any initial text. Then there is a sequence of comment and code pairs, with the comment explaining the code to follow. The source file is ended by a comment containing LaTeX commands that finish the document. C2latex produces LaTeX source by implementing a small number of rules. A C comment that starts at the beginning of a line is copied unmodified into the LaTeX source file. Otherwise, non-blank lines are surrounded by a pair of formatting commands (\begin{flushleft} and \end{flushleft}), and the lines are separated by \\*. Each non-blank line is formatted using LaTeX's \verb command, except comments within the line are formatted in an \mbox. The c2latex program is written in ANSI C and can be processed by c2latex to produce LaTeX source containing a typeset listing of itself. It has a copyright similar to those distributed with GNU software. c2latex is available from me as a shar file via electronic mail. If there is enough interest, I will request that the sources be placed on a public server. John