Passing a record as parameter
You can pass a
RECORD
structure as a function parameter with
the dot star (.*
) notation.
In this case, the record is expanded and each member of the structure is pushed
on the stack. The receiving local variables in the function can then be defined
individually or with the same record structure as the caller.
The next example illustrates this:MAIN
DEFINE rec RECORD
a INT,
b VARCHAR(50)
END RECORD
CALL func_r(rec.*)
CALL func_ab(rec.*)
END MAIN
-- Function defining a record like that in the caller
FUNCTION func_r(r)
DEFINE r RECORD
a INT,
b VARCHAR(50)
END RECORD
...
END FUNCTION
-- Function defining two individual variables
FUNCTION func_ab(a, b)
DEFINE a INT, b VARCHAR(50)
...
END FUNCTION