Home Page   We Generate Your Software.
Products Services Company Technology Demo Contact Site Map Search
The Somusar/SoProTech[tm] Booklet Series
Volume VI

"somusar/Tefigel: Reference Guide"

Printer friendly


Contents
1. Introduction
2. File Sections
3. Commands and Instructions
4. Markers
5. Comments
6. Special Characters
7. Variables
8. Arithmetic Computation
9. Boolean Computation
10. Control Flow
10.1 Purpose
10.2 Usage
10.3 Description
11. Subroutines and Functions
12. Built-in Functions
13. Input and Output
14. Packages and Libraries
15. Tag File Processing
16. CSV File Processing
17. Filters
18. Links and Traps
19. Name Spaces
20. Miscellaneous
21. Further Reading

Chapter 10 - Control Flow

10.1 - Purpose        top

Specify the order in which the processing of input lines must be performed by Tefigel.

10.2 - Usage        top

Terminate processing:

   exit <exit-code>
Perform a conditional statement:
   if <boolean-comparison>
   <input-block>
   else
   <alternative-input-block>
   endif
Perform a multiblock conditional statement:
   case <case-variable>
   when <case-evaluator>
   <input-block>
   when <case-evaluator>
   <input-block>
   otherwise
   <alternative-input-block>
   endcase
Perform a while loop:
   while <boolean-comparison>
   <input-block>
   endwhile
Perform a for each loop, with automatic <counter-variable>'s and automatic <total-loops-variable>'s:
   for <loop-variable>=<for-each-list>
   <input-block>
   endfor
Perform a numeric loop:
   loop <loop-variable>=<range-definition>
   <input-block>
   endloop
Perform an unconditional transfer of control:
   jump <target-label>
   <input-block>
   label <target-label>
Perform a conditional transfer of control:
   jumpcond <target-label> <boolean-comparison>
   <input-block>
   label <target-label>

10.3 - Description        top

An <exit-code> is an integer number to be returned to the operating system process that started Tefigel.

An <input-block>, or an <alternative-input-block>, is a sequence of logical input lines, that may contain none, one, or more Tefigel command lines.

A <case-evaluator> is defined as follows:

   <comparison-operator><comparison-value>
A <case-variable> is a <variable> that gets automatically initialized and evaluated by Tefigel while performing the corresponding multiblock conditional statement.

A <for-each-list> is a list of strings separated by the current argdelim <special-function>.

A <counter-variable> is a numeric variable that gets automatically initialized to 0 or 1 and incremented at each iteration of the for loop. There are four such variables: the name of these variables are the same as the corresponding <loop-variable> with the following suffixes:

  • _counter, starting from 1;

  • _COUNTER, starting from 1;

  • _counter0, starting from 0.

  • _COUNTER0, starting from 0;

A <total-loops-variable> is a numeric variable that gets automatically initialized with the for loop. There are two such variables: the name of these variables are the same as the corresponding <loop-variable> with suffixes _loops and _LOOPS respectively.

All <counter-variable>'s and <total-loops-variable>'s get automatically unset after the corresponding endfor instruction.

A <range-definition> is a list of two or three numbers separated by the current argdelim <special-function>. The first number specifies the initialization value for the <loop-variable>; the second number specifies the loop termination value; the third optional number specifies the loop increment or decrement step, which defaults to 1 if not otherwise specified.

A <loop-variable> is a <variable> that gets automatically initialized and updated by Tefigel while performing the corresponding loop.

A <target-label> is a sequence of non-blank characters, that is a sequence of letters, digits and underscore ('_').

When performing a conditional statement, the <input-block> is processed if the value of <boolean-comparison> is true, whereas the <alternative-input-block> is processed if the value of <boolean-comparison> is false. The else instruction and the <alternative-input-block> may be omitted.

When performing a multiblock conditional statement, each <input-block> is processed if the value of the related <case-evaluator> applied to the <case-variable> yields true, whereas the <alternative-input-block>, if present, is processed only if all <case-evaluator>'s evaluate to false.

When performing a loop, depending on the type of loop, the <input-block> is repeatedly processed as long as:

When performing an unconditional transfer of control, on processing the jump instruction file generation control is transferred to the input line immediately following the label instruction, so that the <input-block> is not processed. Both forward and backward transfer of control are allowed.

When performing a conditional transfer of control, on processing the jumpcond instruction, if the <boolean-comparison> yields true, file generation control is transferred to the input line immediately following the label instruction, so that the <input-block> is not processed. Both forward and backward conditional transfer of control are allowed.

[Previous chapter]    [Next chapter]    [Back to top]

http:// www.somusar.com  / doc  / booklets  / tefigel_ref  - Powered by SoProMach
Copyright © 2003-2012 Somusar - Trademarks - Legal - Privacy - Webmaster