Programming Guide |
Starts a JPL procedure definition
[returnType
] procprocName
[ ([param
[,param
]...] ) ]
returnType
- Specifies the data type of the procedure's return value. An unqualified
proc
command returns an integer value. You can specify to return a string or double precision value by qualifying theproc
command with the keywordsstring
ordouble
, respectively.procName
- A character string that specifies the JPL procedure name. Procedure names can be up to 31 characters long and contain any keyboard character except a blank space. When naming procedures in screen and public modules, be sure to avoid name conflicts, especially with any external modules that you wish to call by name.
param
- A parameter to receive the corresponding argument passed by this procedure's caller. You specify parameters as a comma- or space-delimited argument list within parentheses. Panther passes arguments by value–that is, the called procedure gets its own private copies of the values in the calling procedure's arguments. This means that the called procedure cannot directly alter a variable in its caller; it can only alter its own copies.
The
proc
command names a procedure and optionally specifies its parameters and return value's data type. If a module contains multiple procedures, eachproc
statement serves to end the previous procedure. Only named procedures can be called from other procedures, and from application hooks such as control strings and Focus properties.In the following example, the call to procedure
process_input
passes data from variablesdata1
anddata2
to the procedure's corresponding parameters. The procedure is defined to return a double value. This return value is used to determine whether the if statement evaluates to true or false:
if process_input(data1, data2) > 0.16667
...
double proc process_input(d1, d2)
vars retval
//process d1 and d2 values
return retvalBecause a
proc
statement marks the end of one procedure and the start of another, you cannot embed one procedure definition inside another. Refer to Chapter 19, "Programming in JPL," in Application Development Guide for more information on procedure structure and execution.
call