User Tools

Site Tools

Navigation:  Templates > Template Language Reference > Introduction > Template Structure >====== Template Source Format C6H0068.jpg ====== Previous pageReturn to chapter overviewNext page

The structure of the ASCII template source file is different than the structure of a Clarion source file. To read the ASCII source for a template, start out with the following guidelines:

·Any statement beginning with a pound symbol (#) identifies a template language statement.

·A percent sign (%) before an item within any statement (template or “target” language) identifies a template symbol (variable), which the Application Generator processes at code generation time.

·Any statement that begins without the pound (#) or percent (%) is a “target” language statement which is written directly into a source code file.

The template files are organized by code sections that terminate with the beginning of the next section or the end of the file. The template code generally divides into ten sections.

·#TEMPLATE begins a template set (template class). This is the first statement in the template set (required) which identifies the template set for the registry.

·#APPLICATION begins the source generation control section. This is the section of the template that controls the “target” language code output to source files, ready to compile. One registered template set must have a #APPLICATION section.

·#PROGRAM begins the global section of the generated source code, the main program module. One registered template set must have a #PROGRAM section.

·#MODULE begins a template section that generates the beginning code for a source code module other than the global (program) file. One registered template set must have a #MODULE section.

·#PROCEDURE begins a procedure template. This is the fundamental “target” language procedure generation template.

·#GROUP begins a reusable statement group containing code which may be #INSERTed into any other section of the template. This is the equivalent of a template language procedure.

·#CODE begins a code template section which generates executable code into a specific embed point. The developer can only insert them at an embed point within a procedure. A list of the available code templates appears from which to choose.

·#CONTROL begins a control template. Control templates place a related set (one or more) of controls on a procedure's window and generate the executable source code into embed points that provides the controls' standard functionality.

·#EXTENSION begins an extension template. Extension templates generate executable source code into one or more embed points of a procedure to add specific functionality to the procedure that is not “tied” to any window control.

·#UTILITY begins a utility execution section.This is an optional section of the template that performs a utility function, such as cross-reference or documentation generation. This is similar to #APPLICATION in that it generates output to ASCII files.

A template set must have a #TEMPLATE section to name the set for registration in the TemplateRegistry.TRF template registry file. At least one registered template set must have #APPLICATION, #PROGRAM, and #MODULE sections.

template_source_format.htm.txt · Last modified: 2021/04/15 15:57 (external edit)