From fa080de7afc95aa1c19a6e6fc0e0708ced2eadc4 Mon Sep 17 00:00:00 2001
From: Joseph Hunkeler <jhunkeler@gmail.com>
Date: Wed, 8 Jul 2015 20:46:52 -0400
Subject: Initial commit

---
 pkg/language/doc/defpac.hlp | 83 +++++++++++++++++++++++++++++++++++++++++++++
 1 file changed, 83 insertions(+)
 create mode 100644 pkg/language/doc/defpac.hlp

(limited to 'pkg/language/doc/defpac.hlp')

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
-- 
cgit 

