The CALL op-code combines the calling of a function with the assignment of its return value to a variable. Note how the parameters are separated by a pipe symbol "|" instead of the comma used in source code (this is related to the dropping of the quotes around strings).
CALL sRESULT=EvalToken(@nTokenDate|@sTokenRoot)
There are two important differences between the way functions are called in macro code, and in compiled code.
1. The calls in compiled code are never nested
Each function call is made using variables or literals, which means that the compiler has done some work ahead of time to break the nested call into a series of simple ones, using temporary variables to hold the intermediate steps. For example, the source code line,
bAge = (Today() - nBirthdate) mod 365
once compiled, becomes 3 lines :
0003 CALL n002=Today()
0003 CALL n001=Difference(@n002|@nBirthdate)
0003 CALL bAge=Mod(@n001|365)
2. There are no operators in compiled code
Operators are replaced by compiler specific functions. So the instructions below :
bIsWeekend = (nWeekday >= 6)
bIsWeekend = bIsSaturday or bIsSunday
nDate = Today() + 5
sRESULT = sRESULT + '[d]'
would compile to
0007 CALL bIsWeekend=GreaterOrEqual(@nWeekday|6)
0008 CALL bIsWeekend=Or(@bIsSaturday|@bIsSunday)
0009 CALL n001=Today()
0009 CALL nDate=Add(@n001|5)
0010 CALL sRESULT=Concat(@sRESULT|[d])
So, although the CALL op-code looks similar to the source code calling of a function, it is actually a much more basic process, in keeping with the compiled code emphasis on small simple instructions.
Topic 108175, last updated on 18-Apr-2020