What Templates Are

Top  Previous  Next

A template is a complete set of instructions, both Template and "target" language statements, which the Application Generator uses to process the programmer's input for application customizations then generate "target" language (usually, but not limited to, Clarion language) source code.

Clarion's templates are completely reusable. They generate only the exact code required for each specific instance of its use; they do not inherit unused methods. The templates are also polymorphic, since the programmer specifies the features and functions of each template that are required for the procedure. This means one template can generate different functionality based upon the programmer's desires.

Some of the most important aspects of template functionality supported by the Template Language include:

 

·

Support for controls (#PROMPT) that gather input from the developer, storing that input in user-defined template variables (symbols).

·

Pre-defined template variables (Built-in Symbols) containing information from the data dictionary and Clarion for Windows' application development environment.

·

Specialized #PROMPT entry types, which give the programmer a list of appropriate choices for such things as data file or key selection.

·

Unconditional and conditional control structures (#FOR, #LOOP, #IF, #CASE) which branch source generation execution based on an expression or the contents of a symbol (variable). This allows the Application Generator to generate only the exact source code needed to produce the programmer's desired functionality in their application.

·

Statements (#EMBED) that define specific points where the developer can insert (embed) or not insert their own source code to further customize their application.

·

Support for code templates (#CODE), control templates (#CONTROL), and extension templates (#EXTENSION) that add their specific (extended) functionality to any procedure template. This makes any procedure type polymorphic, in that, the procedure can include functionality normally performed by other types of procedures.

Template code is contained in one or more ASCII files (*.TPL or *.TPW) which the Application Generator pre-compiles and incorporates into the TemplateRegistry.TRF file. It is this template registry file that the Application Generator uses during application design.

Once in the registry, the template code is completely reusable from application to application. It generates custom source code for each application based upon the application's data dictionary and the options selected by the programmer while working with the Application Generator.

The programmer can customize the templates in the registry (or in the *.TP* files) to fit their own specific standard design requirements. This means that each procedure template can be designed to appear exactly as the programmer requires as a starting point for their applications. Multiple "default" starting points can be created, so the programmer can have a choice of starting point designs for each procedure type.

When the programmer has customized the template source (*.TP* file), the Application Generator automatically updates the registry. When the programmer has customized the registry, the template source files can be re-generated from the registry, if necessary.

The Application Generator always makes a copy of the template, as stored in the registry, when creating a procedure or first populating a procedure with a code, control, or extension template. Once this copy is made, the programmer further customizes it to produce exactly the functionality required by the application for that procedure.

The template language can generate more than source code: it can even be used to create add-in utilities (see #UTILITY).