Prev Next Title Contents

EVALUATED EXPRESSIONS


Expressions can be evaluated in the Gifa program. Expressions should be enclosed in parentheses. Expressions can use most of the entries found in the paragraph SYNTAX, at the exception of the special entries : %% ; <from_file and the pseudo variable $_ .

( 2*(5-1)) (cos($i)) are examples of expressions. Expressions can be used whenever a Gifa input is needed (command as well as parameters). Expressions must fit on one line (i.e. 256 characters long), continuation mark cannot be used within expressions.

Values can be numeric, string or logical. Strings should be enclosed within '..' or "..". Logicals are stored as 0 for false and 1 for true (or any non-zero value).

Liste of functions and operators

The following operators and functions are implemented :

if (exist("i")) set j = ($i+1)

j is computed only if $i exists as a variable.

The special syntax (exist("foo[]")) checks wheter the array foo exists with at least one index. It works both for regular and dbm arrays.

set $index = (nextlm('table',' '))

while ($index s! ' ')

print ($index // ' : ' // $table[$index])

set $index = (nextlm('table',$index))

endwhile

However the command FOREACH is much simpler to use for the same purpose.

Check also the macro tunset, which permits to remove all the entries of an array.

When evaluating expressions, all the internal computations are not typed and performed on strings. This permits to mix integer and string freely. Thus the following expressions are perfectly valid :

( cos(1) // 'a string' // ($i==1))

( toupper($file // ($i+1)) )

( log ('0.1') )


Prev Next Title Contents