sysIndentLevel system variable (SDL script)
The sysIndentLevel system variable (a global numeric) is used to control indenting in the generated code. The sysIndentLevel specifies the number of tabs (or in the case of Ada, spaces) to generate before a new line of code. Typically the SDL scripts increment or decrement the sysIndentLevel system variable to achieve the required level of indentation.
Working with Ada
When working with Ada, by default spaces are generated instead of tabs. The options on the Launch ACS/TDK dialog control whether tabs or spaces are generated.
• The Insert Spaces entry specifies whether ACS generates tabs or spaces:
• The Tab Size entry specifies the number of spaces to generate for each tab (applies only when generating spaces). For example, Tab Size = 4.
The following examples are provided:
• Setting sysIndentLevel to 0, 1, 2 and 3
• Incrementing and decrementing the sysIndentLevel value
Setting sysIndentLevel to 0, 1, 2 and 3
In this example, text is generated with the sysIndentLevel system variable set to 0, 1, 2 and 3.
%setvar "sysIndentLevel" = 0
\n"text at sysIndentLevel 0"
%setvar "sysIndentLevel" = 1
\n"text at sysIndentLevel 1"
%setvar "sysIndentLevel" = 2
\n"text at sysIndentLevel 2"
%setvar "sysIndentLevel" = 3
\n"text at sysIndentLevel 3"
The generated code is as follows:
text at sysIndentLevel 0
text at sysIndentLevel 1
text at sysIndentLevel 2
text at sysIndentLevel 3/
Incrementing and decrementing the sysIndentLevel value
In this example, the sysIndentLevel system variable is used to indent generated stub code. Before loading the StubCode.sdl, the sysIndentLevel system variable is incremented so that the generated stub code is indented. After loading the StubCode.sdl generation template, the sysIndentLevel system variable is decremented.
$ Indent
%setvar "sysIndentLevel" = (%getvar "
sysIndentLevel") + (1)
\n
%load "StubCode.sdl"
$ Outdent
%setvar "sysIndentLevel" = (%getvar "sysIndentLevel") - (1)