Pattern-based Text Generator
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)
Each of the functions yields its
PTGOutFile ("f1", PTGModule ( PTGOutFile ("f2", PTGInterface ( ...... )), PTGBody ( .... )))In the above example a
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"