aboutsummaryrefslogtreecommitdiff
path: root/pkg/language/doc/defpac.hlp
diff options
context:
space:
mode:
authorJoseph Hunkeler <jhunkeler@gmail.com>2015-07-08 20:46:52 -0400
committerJoseph Hunkeler <jhunkeler@gmail.com>2015-07-08 20:46:52 -0400
commitfa080de7afc95aa1c19a6e6fc0e0708ced2eadc4 (patch)
treebdda434976bc09c864f2e4fa6f16ba1952b1e555 /pkg/language/doc/defpac.hlp
downloadiraf-linux-fa080de7afc95aa1c19a6e6fc0e0708ced2eadc4.tar.gz
Initial commit
Diffstat (limited to 'pkg/language/doc/defpac.hlp')
-rw-r--r--pkg/language/doc/defpac.hlp83
1 files changed, 83 insertions, 0 deletions
diff --git a/pkg/language/doc/defpac.hlp b/pkg/language/doc/defpac.hlp
new file mode 100644
index 00000000..bc262347
--- /dev/null
+++ b/pkg/language/doc/defpac.hlp
@@ -0,0 +1,83 @@
+.help "defpac,defpar,deftask,defvar" Feb86 language
+.ih
+NAME
+.nf
+defpac -- test if the named package is defined
+deftask -- test if the named task is defined
+defpar -- test if the named parameter is defined
+defvar -- test if the named environment variable is defined
+.fi
+.ih
+USAGE
+.nf
+defpac (pacname)
+deftask (taskname)
+defpar (param)
+defvar (variable)
+.fi
+.ih
+PARAMETERS
+.ls pacname
+An IRAF package name.
+.le
+.ls taskname
+An IRAF taskname. It may be specified as "taskname" or as
+"packagename.taskname".
+.le
+.ls param
+An IRAF parameter name. It may be specified as "paramname",
+"taskname.paramname" or "packagename.taskname.paramname".
+.le
+.ls variable
+An environment variable name. It may be specified as "varname".
+.le
+.ih
+DESCRIPTION
+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 \fItask\fR
+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 \fIbye\fR command, all the task and parameter
+declarations for the package are discarded. Environment variables may
+be either in the host environment, or in the CL environment as a result
+of a \fIset\fR or \fIreset\fR statement.
+.ih
+EXAMPLES
+1. Test if a task exists.
+
+.nf
+ cl> if (deftask ("system.page"))
+ >>> print ("task page exists")
+ >>> else
+ >>> print ("task page not found")
+ task page exists
+ cl>
+.fi
+
+2. Add the value of the named parameter into a sum, but only if the parameter
+exists (the example is for a script).
+
+.nf
+ sum = 0
+ for (i=0; i <= 10; i+=1) {
+ parname = "data" // i
+ if (defpar (parname)
+ sum += parname
+ }
+.fi
+
+3. Checked whether the 'IRAFARCH' environment variable is defined.
+
+.nf
+ cl> if (defvar("IRAFARCH")) {
+ >>> print ("IRAFARCH is " // envget("IRAFARCH")
+ >>> }
+ >>> ;
+.fi
+.ih
+SEE ALSO
+package, task, redefine, lparam
+.endhelp