Eli   Documents Get Eli: Translator Construction Made Easy at SourceForge.net.
    Fast, secure and Free Open Source software downloads

General Information

 o Eli: Translator Construction Made Easy
 o Global Index
 o Frequently Asked Questions
 o Typical Eli Usage Errors

Tutorials

 o Quick Reference Card
 o Guide For new Eli Users
 o Release Notes of Eli
 o Tutorial on Name Analysis
 o Tutorial on Type Analysis
 o Typical Eli Usage Errors

Reference Manuals

 o User Interface
 o Eli products and parameters
 o LIDO Reference Manual
 o Typical Eli Usage Errors

Libraries

 o Eli library routines
 o Specification Module Library

Translation Tasks

 o Lexical analysis specification
 o Syntactic Analysis Manual
 o Computation in Trees

Tools

 o LIGA Control Language
 o Debugging Information for LIDO
 o Graphical ORder TOol

 o FunnelWeb User's Manual

 o Pattern-based Text Generator
 o Property Definition Language
 o Operator Identification Language
 o Tree Grammar Specification Language
 o Command Line Processing
 o COLA Options Reference Manual

 o Generating Unparsing Code

 o Monitoring a Processor's Execution

Administration

 o System Administration Guide

Mail Home

Pattern-based Text Generator

Previous Chapter Next Chapter Table of Contents


Predefined Entities

PTG generates a C module consisting of an interface file ptg_gen.h and an implementation file ptg_gen.c. The interface file exports definitions for the following identifiers:

PTGNode
the pointer type for internal representations of pattern applications;
PTGNULL
a pointer of type PTGNode representing no text; Note: There are many ways to represent no text; comparing a PTGNode to PTGNULL is only a pointer comparison;
PTGNull()
a macro without parameters that yields PTGNULL, to be used where a function notation is needed, as in WITH clauses of LIDO's CONSTITUENTS construct;
void PTGFree (void)
a call of this function deallocates all data generated by pattern applications; to be used for reduction of dynamic memory usage in cases where output is produced in several phases.

The following functions can be used to process the contents of a PTGNode and it's insertions recursively into an output file. These functions are only available, under certain preconditions, See Influencing PTG Output.

PTGNode PTGOut (PTGNode root)
a function that outputs the text represented by the parameter root to standard output
PTGNode PTGOutFile (char *filename, PTGNode root)
a function that opens a file with the name given by the parameter filename, outputs the text represented by the parameter root, and closes the file
PTGNode PTGOutFPtr (FILE *output, PTGNode root)
a function that expects the parameter output to be a file which is open for writing, outputs the text represented by the parameter root to the file, and leaves the file open
PTGNode PTGProcess (PTG_OUTPUT_FILE file, PTGNode root)
a function that expects the parameter file to be of a type that is provided by the user, See Influencing PTG Output. If the default definition of PTG_OUTPUT_FILE is overriding, only PTGProcess can be used as output function; the other three output functions are not available in that case.

The user should ensure that these predefined identifiers do not clash with other definitions in the application importing the interface file. In particular, the pattern names should be chosen such that prefixing them with PTG does not yield a predefined name, e.g. a pattern name Free would be a bad choice.

The implementation file contains external references to any user defined function mentioned in the particular specification.


Previous Chapter Next Chapter Table of Contents