|
|
|
General Information
Tutorials
Reference Manuals
Libraries
Translation Tasks
Tools
Administration
|
|
Pattern-based Text GeneratorOutput Functions
PTG separates the composition of a target text from outputting it:
A target text is composed by calls of pattern functions.
They yield results of type
There are three predefined PTG functions that can be applied to
PTGNode PTGOut(PTGNode r) PTGNode PTGOutFile(char *f, PTGNode r) PTGNode PTGOutFPtr(FILE *f, PTGNode r)
A call
The function
The function
Each of the functions yields its
PTGOutFile ("f1",
PTGModule (
PTGOutFile ("f2", PTGInterface ( ...... )),
PTGBody ( .... )))
In the above example a Module is composed by two text fragments
Interface
and Body. The whole text is written to the file f1. The
Interface fragment is also written to the file f2.
Of course nested calls like the
above can be decomposed by storing intermediate Note: Be aware that the output functions do not add a newline character to the end of an output text. It has to be explicitly specified by a pattern. This behavior has been changed compared to previous versions of PTG. Adding a newline character to a text is simply specified by a pattern like
NewLine: $ "\n"
|