Previous Next Contents

5.4 Extracting Source Code

NAME extract - filter the source code out of a "literate program"

SYNOPSIS

extract file[.sgml]

DESCRIPTION

Extracts the source code out of a literate program written using the qwertz SGML document type. The syntax of the document is checked while the source code is being extracted. If syntax errors are found, error messages are written to standard error and the program may terminate before all code has been extracted. The code being extracted is written to standard out, but this will usually be redirected to a file with some appropriate file name extension, depending on the programming language being used. The ".sgml" filename extension of the input file is optional.

For example, if the input file is named foo.sgml and contains the source code of a C program, you could extract and compile the program by typing:

extract foo > foo.c
cc foo

In this example, as standard error has not been redirected, error messages will appear on the terminal.

DIAGNOSTICS

SGML syntax errors are written to standard error. If the input file contains such errors, extract will terminate with exit status 1 before all the code has been extracted from the file.


Previous Next Contents