SET PROCEDURE

From Lianjapedia
Jump to: navigation, search

Purpose

Open a procedure library file

Syntax

SET PROCEDURE TO [<.prg filename> | (<expC>) [ADDITIVE]]

See Also

COMPILE, DO, FUNCTION, FUNCTION_EXISTS(), PARAMETERS, PEXIST(), PROCEDURE, SET CLASSLIB

Description

The SET PROCEDURE TO <.prg filename> command opens the specified procedure library file, scans the contents of it, and records the names and positions of the procedures, functions and classes defined within it. The filename can be substituted with a <expC>, enclosed in round brackets, which returns a valid filename. You can place as many procedures as you want in a procedure library file.

The settings of SET COMPILE and SET DEVELOPMENT (and Operating System permissions and disk space) will determine whether procedure library files are automatically compiled when the SET PROCEDURE TO command is issued.

If the optional ADDITIVE keyword is specified then any procedures that are already open are left open and the new procedure library is added. You can open up to 100 procedure files at any one time. The SET PROCEDURE TO command, without any <.prg filename> specified, closes all active procedure library files. A closed library file discards any knowledge of where the procedures within reside.

Procedures are declared by the PROCEDURE or FUNCTION keyword followed by the procedure name. The RETURN, ENDPROC or ENDFUNC statement denotes the end of a procedure or function. RETURN statements can be used within the procedure provided they are used within DO WHILE...ENDDO, DO CASE...ENDCASE, or IF...ENDIF statements. No syntax checking is carried out while the procedure library file is being scanned. The syntax checking is only carried out when the procedure is executed.

Classes are declared using DEFINE CLASS...ENDCLASS.

Alternatives to SET PROCEDURE for loading libraries include:

SET CLASSLIB

LOADLIBRARY()

Lianja.loadLibrary()

REQUIRE()

REQUIRE_ONCE()

You can query what procedures and classes are loaded using:

LIST LIBRARY // Lianja 6

LIST PROCEDURE

LIST CLASSES

You can close a library using:

CLOSE PROCEDURE

CLOSE CLASSLIB

Example

set procedure to statistics
do std with "patrons", "seats"
set procedure to