defpac -- test if the named package is defined deftask -- test if the named task is defined defpar -- test if the named parameter is defined
USAGE
defpac (pacname) deftask (taskname) defpar (param)
PARAMETERS
pacname
An IRAF package name.
taskname
An IRAF taskname. It may be specified as "taskname" or as
"packagename.taskname".
param
An IRAF parameter name. It may be specified as "paramname",
"taskname.paramname" or "packagename.taskname.paramname".
These routines return a boolean value indicating whether the relevant parameter, task or package has been defined. A task becomes defined when the package to which it belongs is "loaded" by entering the name of the package as a command, or whenever a task declaration is input to the CL. A parameter becomes defined when the task to which it belongs is defined; the task need not be currently executing for its parameters to be defined. When a package is exited, e.g., after entry of the bye command, all the task and parameter declarations for the package are discarded.
1. Test if a task exists.
cl> if (deftask ("system.page")) >>> print ("task page exists") >>> else >>> print ("task page not found") task page exists cl>
2. Add the value of the named parameter into a sum, but only if the parameter exists (the example is for a script).
sum = 0 for (i=0; i <= 10; i+=1) { parname = "data" // i if (defpar (parname) sum += parname }
SEE ALSO, package, task, redefine, lparam,