IRAF help page for package language, program proc

from NOAO procedure -- declare a new CL procedureSYNTAXELEMENTSDESCRIPTIONEXAMPLESBUGSSEE ALSO

procedure -- declare a new CL procedure


SYNTAX

procedure proc_name [( [req_par, ...] )]


begin
	
	
end

ELEMENTS

ELEMENTS

proc_name

The name of the procedure. In the case of a procedure script, the script file should have the same name.

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.

DESCRIPTION

The procedure 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 procedure 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". Paremeters 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.


EXAMPLES

1. Declare a no-op procedure.

procedure noop
begin
end

2. A more complex procedure (hlib$devstatus.cl).

# 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

BUGS

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.


SEE ALSO

declarations, task,


This page automatically generated from the iraf .hlp file. If you would like your local iraf package .hlp files converted into HTML please contact Dave Mills at NOAO.

dmills@noao.edu