Please note : This help page is for an older version of Enteprise Archtiect. The latest help can be found here.

The Processing Instruction (PI) Macro

The PI (Processing Instruction) macro provides a means of defining the separator text to be inserted between the code pieces (which represent entities) that are generated using a template.

The structure for setting the Processing Instruction is:

%PI=<value>%

 

where <value> is a literal string enclosed by double quotes, with the following options:

·"\n" - New line (the default)
·" " - Space
·"\t" - Tab
·""      - Null
 

By default, the PI is set to generate a new line (\n) for each non-empty substitution, which behavior can be changed by resetting the PI macro. For instance, a Class�s Attribute declaration in simple VB code would be generated to a single line statement (with no new lines). These properties are derived from the Class-Attribute Properties in the model to generate, for example:

 

Private Const PrintFormat As String = "Portrait"

 

The template for generating this starts with the PI being set to a space rather than a new line:

%PI=" "%

%CONVERT_SCOPE(attScope)%

%endIf%

%if attConst == "T"%

Const

%endIf%

 

 

On transforming this, attscope returns the VB keyword �Private� and attConst returns �Const� on the same line spaced by a single space (fitting the VB Class.Attribute definition example above).

Alternatively, when generating a Class you might want the Class declaration, the notes and Class body all separated by double lines. In this case the %PI is set to "/n/n" to return double line spacing:

%PI="\n\n"%

%ClassDeclaration%

%ClassNotes%

%ClassBody%

 

PI Characteristics

·Blank lines have no effect on the output
·Any line that has a macro that produces an empty result does not result in a PI separator (space/new line)
·The last entry does not return a PI; for example, %Classbody% (above) does not have a double line added after the body

 

Learn more