CPL() Function - Compile Program Text

Syntax

CPL(stringA{,stringB}{,ERR=lineref})

Description

For BBj-specific information, see the CPL() Function - BBj.

The CPL() function returns a string containing the internal compiled format of the supplied command line.

Parameter

Description

stringA

A valid PRO/5 command line.

stringB

Variable table to be supplied to the compiler. If this parameter is not included, PRO/5 defaults to the variable table of the current workspace program.

ERR=lineref

Branch to be taken if an error occurs during execution.

All variables used in the program refer to the variable table. Therefore, to compile a PRO/5 statement, a variable table must also be present to provide context. The optional stringB supplies the variable table to the compiler. Any variables compiled from stringA that already exist in stringB will contain the necessary pointers to stringB. If new variables exist in stringA, CPL() returns a new variable table appended to the compiled string result. If a utility were building a PRO/5 program, it would separate the variable table data from the compiled line (if it exists) and make it the new variable table string (see the example below).

CPL() is the complementary function to LST().

NOTE: The CPL() function is designed for utility use and should not be used in an application program.

Examples

1000 REM - get a line of PRO/5 code
1010 READ (1)SOURCE$
1020 REM - compile the line
1030 LET C$=CPL(SOURCE$,VAR$)
1040 REM - determine length of compiled line
1050 LET LINE_LEN=DEC(C$(3,2))+4
1060 REM - check for new variable table
1070 IF LEN(C$)>LINE_LEN THEN LET VAR$=C$(LINE_LEN+1)
1080 REM - remove variable data from C$
1090 LET C$=C$(1,LINE_LEN)

See Also

Functions - Alphabetical Listing