SPLLOAD

Purpose:

Compiles and reads an external SPL file into the Worksheet.

Syntax:

SPLLOAD("filename", overwrite, expand, verbose)

"filename"

-

String. The filename of the SPL file. Function form.

overwrite

-

Optional. An integer, replace macro flag.

 

0:

do not replace macro of same name

 

1:

replace macro if it exists (default)

expand

-

Optional. An integer, include source code.

 

0:

do not include source code in OPL file

 

1:

include source code (default)

verbose

-

Optional. An integer, message flag.

 

0:

do not provide error messages

 

1:

display compile errors (default)

Command Syntax:

 

SPLLOAD filename

 

filename    -   The name of the external SPL file without quotes. Command form.

Example:

splload(".\splfiles\testdata.spl")

 

compiles and reads the testdata.spl file from the splfiles subdirectory. The OPL file contains the source code and a macro by the same name is replaced if it exists.

Example:

splload .\splfiles\testdata.spl

 

Same as above but expressed in the easier to type command form.

Remarks:

An SPL file is a simple ASCII text file you can create with any text editor. The file contains SPL functions which you can use in a Worksheet. Any errors detected during the compile and read are written to an ASCII file, filename.err. To automatically read in function files at start up time, include the filenames in the dadisp.spl file.

 

If you specify a filename with an SPL extension, SPLLOAD will compile and load the SPL file.

 

If you specify a filename with an OPL extension, SPLLOAD will read the compiled OPL file.

 

If you do not specify an extension for the filename, SPLLOAD will look first for filename.OPL (a compiled version) and try to load it into the Worksheet. If there is no OPL file, SPLLOAD will look for filename.SPL, and compile and read the functions into the Worksheet. The compiled functions will be placed in filename.OPL.

 

If both OPL and SPL files exist for the specified filename, SPLLOAD will check the dates on the files; if the SPL file is more recent than the OPL file, it will recompile the SPL file (creating a new OPL file), and then load it into the Worksheet.

 

The command form does not accept optional arguments.

 

In general, when a function name is encountered, the following steps are automatically performed to load the function:

 

1.

Check if the function is already loaded into memory

2.

If not loaded, search for a file of the same name with extension .OPL

3.

Load if the .OPL is found and the file date is newer than the .SPL file

4.

If not loaded, search for a file of the same name with extension .SPL

5.

Compile and load the .SPL file

 

See CLEAR to remove an SPL function from memory.

See CLEAROPL to delete .OPL files.

See SPLLOADALL to compile and read one or more SPL files in a folder.

See Also:

#INCLUDE

CLEAR

CLEAROPL

FUNCTIONS

ITERATE

SPLCOMPILE

SPLCOMPILEALL

SPLLOADALL

SPLREAD

SPLWRITE