Elmo HARSFEN0602, HARmonica software manual Built-in Function Calls

Models: HARmonica HARSFEN0602

1 220
Download 220 pages 51.63 Kb
Page 35
Image 35

 

 

 

 

 

 

 

 

 

HARSFEN0602ElmoHARmonicaSoftwareManual

PRELIMINARYDRAFT

 

 

 

 

 

Consider some examples using system commands.

 

 

33

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

Example

Explanation

 

 

 

 

 

 

a = AC

This expression assigns value of the system command AC to the variable ‘a’.

 

 

 

 

This expression is valid if the AC command is allowed to ‘get value’, i.e. it has PreProcess flag

 

 

 

AC =

This expression assigns value of the variable ‘a’ to the system command AC.

 

 

 

 

This expression is valid if the AC command is allowed to ‘set value’, i.e. it has PostProcess flag

 

 

 

BG

This is executable command. It cannot be assigned, i.e. it has neither PreProcess nor PostProcess

 

 

 

 

nor Assign flags

 

 

 

 

 

 

 

For example, the following expressions

 

 

 

 

 

 

 

BG = 1

 

 

 

 

 

 

 

or

 

 

 

 

 

 

 

a = BG

 

 

 

 

 

 

 

are not legal

 

 

 

 

 

 

LS

This expression is not legal, because it uses command that has NotProgram flag. The

 

 

 

 

‘NotProgram’ commands are not allowed in user program, while they are available for the

 

 

 

 

Interpreter language.

 

 

 

 

 

5.3.6.5Built-in Function Calls

The description and syntax is the same as in the Interpreter Language. See Built-in function call of the Interpreter Language

5.3.6.6User Function Calls

Functions perform a pre-written and compiled code. Functions get a list of arguments from their caller, and return a list of return values.

Functions get their list of input argument by value – they do not directly modify them. The general syntax of a function call is [OUT1,OUT2,…OUTN]=FUNC(IN1,IN2,…IN_N)

If only one value is returned, the square parentheses are not required and the syntax is following: OUT=FUNC(IN_1,…,IN_N)

Not all the output variables need be assigned.

For example, if the function FUNC returns two values, [IA[1],IA[2]]=FUNC()

assigns the two returned values to IA[1] and IA[2]. IA[1]=FUNC()

Returns the first return value to IA[1], and the other returned values remain unused.

If the returned value has another type than variable that receives it, the result shall be type cast to the type of the variable.

Numbers of input arguments during function call are strict according to its definition.

If function call is a part of expression, then multiple output of the function is illegal. For example,

[a, b] = 5 + foo(c) or

[a, b] = foo(c) + 5

Both these expressions are not legal: function call is a part of expression and must be evaluated in a single value.

5.4Comments

Page 35
Image 35
Elmo HARSFEN0602, HARmonica software manual Built-in Function Calls