From 40e5a5811c6ffce9b0974e93cdd927cbcf60c157 Mon Sep 17 00:00:00 2001 From: Joe Hunkeler Date: Tue, 11 Aug 2015 16:51:37 -0400 Subject: Repatch (from linux) of OSX IRAF --- pkg/language/doc/proc.hlp | 92 +++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 92 insertions(+) create mode 100644 pkg/language/doc/proc.hlp (limited to 'pkg/language/doc/proc.hlp') diff --git a/pkg/language/doc/proc.hlp b/pkg/language/doc/proc.hlp new file mode 100644 index 00000000..ed59196d --- /dev/null +++ b/pkg/language/doc/proc.hlp @@ -0,0 +1,92 @@ +.help procedure Feb86 language +.ih +NAME +procedure -- declare a new CL procedure +.ih +SYNTAX +.nf +\fBprocedure\fR proc_name [( [req_par, ...] )] + + + + +\fBbegin\fR + + +\fBend\fR +.fi +.ih +ELEMENTS +.ls proc_name +The name of the procedure. In the case of a procedure script, +the script file should have the same name. +.le +.ls req_par +A required (query mode) parameter for the procedure. +Hidden parameters must be declared in the declarations section but do +not appear in the argument list. +.le +.ih +DESCRIPTION +The \fIprocedure\fR statement is used to declare a new CL procedure. +In the current CL, procedures are permitted only in ".cl" script files, +and there may be only one procedure per file. The \fIprocedure\fR statement +must be the first non-comment statement in the script file. Any parameters +which appear in the procedure argument list must be declared in the parameter +declarations section as well and will default to mode "auto". Parameters not +in the required parameter list will default to mode "hidden". +The order of positional parameters is the order in which the parameters +appear in the argument list. +.ih +EXAMPLES +1. Declare a no-op procedure. + +.nf +procedure noop +begin +end +.fi + +2. A more complex procedure (hlib$devstatus.cl). + +.nf +# DEVSTATUS -- Print status info for the named device. + +procedure devstatus (device) + +string device { prompt = "device for which status is desired" } +bool verbose = no + +string logname, hostname +struct *devlist +string dev + +begin + dev = device + _devstatus (dev) + + if (verbose) { + # Print UNIX device status, too. + + devlist = "dev$devices" + while (fscan (devlist, logname, hostname) != EOF) { + if (logname == dev) { + print ("ls -l /dev/", hostname) | cl + break + } + } + devlist = "" + } +end +.fi +.ih +BUGS +CL procedures can only be placed in script files, they cannot currently +be typed in interactively. Procedures cannot be precompiled. A procedure +cannot return a function value. Arguments are passed only by value, not +by reference. Procedure interpretation (and expression evaluation) is +currently rather slow. +.ih +SEE ALSO +declarations, task +.endhelp -- cgit