TEMPLATE(3)

Table of Contents

Name

template specifies the template of product

Synopsis

%template
template-stuff

Description

The template section of a product description file contains a template description of a product. This section is the major section of a product description file, and every product description file must contain exactly one template section. ivy*meta SDTB converts the template section into the GEN_x routine in the file GEN_x.c, where x is the option character that selects the product. GEN_x is the C routine that actually generates the product when the SDTool is called.

The body of a template section is made up of text that is termed template-stuff. Template-stuff consists of verbatim text and template constructs. The verbatim text is copied directly to the product. The template constructs, which include control flow, formatting, and C code constructs, are used to generate the variable parts of the product. All template constructs begin with a percent character; all text that is not part of a template construct is verbatim text.

Here is a summary of the three types of template constructs:

control flow
Control flow constructs provide conditional product generation features. These constructs allow branching, looping, and procedure calling during product generation. The conditions that determine the branching and looping behavior are generally based on information in the specification parse tree. The control flow constructs are described in CALL(4) , CASE(4) , FOR(4) , FORALL(4) , IF(4) and WHILE(4) .
formatting
The formatting constructs provide control over the exact layout of the product. The formatting constructs are described in FORMAT(4) .
C code
The C code constructs provide a means for both sending the values of arbitrary C expressions to the product file, and executing arbitrary C code during product generation. The C code constructs are described in EXPRESSION(4) and STATEMENT(4) .

The translation that ivy*meta SDTB employs in converting a template section to a GEN_x C procedure is straightforward: verbatim text is converted to a printf-like form that writes the text to the product file; control flow constructs are converted to corresponding C control flow constructs; and formatting constructs are converted to statements that control white space in the product.

Part four of this reference manual describes the template constructs in detail (see INTRO(4) ).

Example

%template
static char *version = «%(getversion(top))"; static int count = 0;
%forall fname:Filename in LIST filename(x) %loop FILE *%(tok(fname));
%end-loop

See Also

PROC(3)
INTRO(4)
GEN_x(5)


© 1990 Lucent Technologies, Inc
© 1998 Harmony Software, Inc