PicLan-IP Pre-compiler Usage
PicLan-IP parses mv/Basic source code through a parsing "pre-compiler".
This pre-compiler extends the mv/Basic language to include a number of elements
that make web development easier. These elements include:
- Pre-defining global EQUATES and COMMON
- Defining additional mv/Basic functions
- Defining additional mv/Basic statements
If you are writing mv/Basic application code as a part of
an HTML page, then the code that you write will be processed by the pre-compiler
and you need to be aware of it's behavior and limitations. If you are calling
external subroutines from within your HTML page, you may want to compile those
subroutines with the pre-compiler as well so that they may make use of PicLan-IP
mv/Basic extensions.
mv/Basic EQUATES
The PicLan-IP pre-compiler will define the following constants:
EQUATE AM TO CHAR(254)
EQUATE VM TO CHAR(253)
EQUATE SVM TO CHAR(252)
EQUATE SEPAR.CHAR TO CHAR(249)
EQUATE ESC TO CHAR(27)
EQUATE CR TO CHAR(13)
EQUATE FF TO CHAR(12)
EQUATE LF TO CHAR(10)
EQUATE BS TO CHAR(8)
EQUATE BELL TO CHAR(7)
EQUATE NUL TO CHAR(0)
*
EQUATE YES TO 1
EQUATE NO TO 0
*
EQUATE DAYS TO 'Sun]Mon]Tue]Wed]Thr]Fri]Sat'
mv/Basic COMMON
The pre-compiler itself does not define any COMMON variables,
but HTML documents use a number of common elements in their processing.
If you are writing mv/Basic subroutines that need to use PicLan-IP extensions,
then you must include a number of items with the mv/Basic source code. As of this
documentation, you need to include the following items:
INCLUDE PLIP.BP SYS.TYPE.INCLUDE
INCLUDE PLIP.BP PL.COMMON
INCLUDE PLIP.BP PL.COMMON.DEFS
INCLUDE PLIP.BP PL.DEFS
INCLUDE PLIP.BP PLIP.COMMON
INCLUDE PLIP.BP PLW.COMMON
Future releases of PicLan-IP may change these common areas,
so you should be careful when upgrading PicLan-IP. You can verify the current
PicLan-IP COMMON usage by looking at the generated source code in WWW.CTRL,PGBASIC.
Pre-compiler Usage
The PicLan-IP pre-compiler is designed to be an easy replacement
for the BASIC (or COMPILE) verb. The format of the pre-compiler TCL command
is:
PC filename item{ item ...} {=options}
You can also specify items with an active select list or
use an asterisk to indicate all items in the file.
options:
=A - compile the intermediate source with a (C) option
=B - do not compile the intermediate source code
=D - do not delete the intermediate source code
=E - edit the intermediate source code
=M - compile the intermediate source with an (M) option
=Q - squish the intermediate source code to conserve item length
=S - compile the intermediate source with an (S) option
There are also some options that are platform specific:
AP/Pro:
=V - use the COMPILE verb instead of the BASIC verb
D3:
=O - compile the intermediate source without the (O
option
=V - use the COMPILE verb instead of the BASIC verb
How the pre-compiler works
The pre-compile operates by translating your mv/Basic source
code into a second "intermediate source code". This intermediate source
code is then compiled with the system BASIC (or COMPILE) command.
The intermediate source code is temporarily stored in a second
data portion of the data file that contains the original source code. If you
have a basic program file named BP, then the intermediate source code will be
stored in BP,COMPILE.SOURCE. With normal usage the intermediate source
code is deleted by the pre-compile immediately after the system compiler completes.
The intermediate source code is carefully constructed to behave
as much like the original source code as possible:
- mv/Basic commands that do not use PicLan-IP extensions are
passed through without modifications.
- mv/Basic commands that include PicLan-ip extensions are
always built on a single line so that the original source code line numbering
will be valid for the system object code.
Limitations of the pre-compiler
The pre-compiler does have some limitations. In general,
the pre-compiler is very good at processing all legal mv/Basic code constructions
with the exception of:
Single-line THEN/ELSE clauses.
If you write mv/Basic code with the single-line format
of THEN/ELSE clauses, the pre-compile can get confused as to which ELSE goes
with which THEN. Try to avoid single-line THEN/ELSE clauses and use
the multi-line equivalent instead:
Instead of:
READ X FROM DATA.FILE , ID ELSE X = PL_AMTOCRLF(Z)
use:
READ X FROM DATA.FILE , ID ELSE
X = PL_AMTOCRLF(Z)
END
Delimiters in quoted strings.
Do not use system delimiters such as value or sub-value
marks directly within quoted strings if the string occur on the same line
as PicLan-IP extensions.