ElmoHARSFEN0602HARmonicaSoftwareManual PRELIMINARYDRAFT

wait : Iterate (suspend the execution of the program) until a specified time is elapsed.

for - end : Iterate counted times

break : Break an iteration or switch expression (for, while, switch)

if else elseif end: Conditional expression.

switch-case-otherwise-end: Case selection goto – Go to some point in the program

reset – Kill the state the executing program and jump to some point in the program. function-return– Declare a function and its return point

##: Declare a label or an auto routine

#@: Declare a label or an auto routine

#@ - return: Declare an auto routine and its return point exit – Terminate program execution.

35

5.5.1Labels (Entry points)

Labels denote that program execution can start from that place, or that program execution can be branched to that place.

Label definition has the following syntax: ##<LABEL_NAME>

or

#@<LABEL_NAME>

A maximum of 12 characters (letter and/or digit (not leading) and underscore (not leading) only) may be used for label. A name of label must be distinct.

Labels can reside inside or outside function bodies, but not within a program flow structure, such as a for iteration.

Labels inside function bodies regard as local of the function and serve as targets for goto instructions within the same function.

Labels in the global text scope serve as possible execution starting points, and also as targets for reset and global scope goto.

The XQ and the XC program launching commands use labels to specify where to start program execution and were to terminate. For example, if user wants to start execution at ##LOOP2, he can do it by sending the command

XQ ##LOOP2

Example:

##START;

The program start

##LOOP1;

A label

….

The body code A

goto##LOOP1;

 

##LOOP2;

 

…..

The body code B

##LOOP3;

 

 

 

 

According to above example, if the program runs from label ##START, the body code A will be performed forever. The ##LOOP2 will never be reached.

5.5.2For iteration

Page 37
Image 37
Elmo HARSFEN0602, HARmonica software manual Labels Entry points, For iteration, #@Labelname, XQ ##LOOP2, ##Start