User defined functions - Forward declare functions to be used: (function|func) [file.]name([dim|var] var1, [dim|var] var2, ...) e.g. function fplib.showlock(var pid) function fplib.log(file, line, what) function somefunc(dim myarray) Call a function: [x=][file.]name(var1, var2, ...) Return a value from a function: return(value) Can pass fields: real, dummy, longvar Can pass arrays: Alias and system arrays are copied to a non-aliased array. Non-aliased arrays are passed by reference. Function names must be at least 3 characters in length. Functions cannot modify values outside of its scope. Functions do not call automatic processing. Functions cannot modify real fields. Functions cannot be called unless they are declared. Functions can pass values by reference (changes made to the value will carry back out of the function, only to arrays). Functions can optionally return a value. Parameter names must be at least 3 characters in length. Parameters will be passed to the function using the name they were defined with in the declaration statement. Environment variables: PFFUNCDBG=(ON|OFF), default OFF. If ON the debugger will be allowed to continue into the function call. If OFF the debugger will skip over user defined functions. NOTE: Debug statements inside of functions will still be able to be activated. If debug is set inside of a function, it will continue even after the function is left. Example: Processing table for fibonacci: If: ' Declare for future use Then: function fibonacci(nval) If: ' Get the parameter Then: declare extern nval If: nval le "1" ' Return the result Then: return(nval) If: ' Return the result Then: return(fibonacci(nval-"1")+fibonacci(nval-"2")) Usage: If: ' Declare for future use Then: function fibonacci(nval) If: ' Call the function Then: n=fibonacci("9") If: ' Display the result Then: msgbox ""{n ' Prints "34"