Writing Procedures and Functions
A
New procedures and functions may be written in PV-WAVE and called in the same manner as the system-defined procedures or functions (i.e., from the keyboard or from other programs). When a procedure or function is finished, it executes a RETURN statement which returns control to its caller.
The following directory contains procedures and functions that can be accessed by all PV-WAVE users:
<wavedir>/lib/user
<wavedir>\lib\user
Where <wavedir>
is the main PV-WAVE directory.
WAVE_PATH
by the PV-WAVE initialization routine, and is also automatically placed in the system variable !Path. The user
subdirectory is placed at the end of the search path and is thus searched last. For more information on the search path, see Modifying Your Environment.PV-WAVE automatically compiles and executes a user-written function or procedure when it is first referenced if:
The name of the file containing the routine is the same as the routine name suffixed by .pro
.
A procedure is called by a procedure call statement, while a function is called via a function reference. A function always returns an explicit result. For example, if ABC
is a procedure and XYZ
is a function:
ABC, A, 12
; Calls procedure ABC with two parameters.
A = XYZ(C/D)
; Calls function XYZ with one parameter. The result of XYZ is
; stored in variable A.