CLASSMODULE
10.6
The CLASSMODULE compiler directive is required when compiling a PL/B load module as a class to be used for a PL/B code object (PLBOBJECT). This directive must be the first instruction in the source for a load module. Otherwise, an appropriate compiler error is generated. This instruction uses the following format:
|
|
|
Flags Affected: NONE
Note the following:
The CLASSMODULE statement must be the first instruction in the load module source module.
The CLASSMODULE invokes specialize compiler behaviors when compiling a load module so it can be loaded and accessed using a PLBOBJECT code object. These behaviors include the following:
Plbcmp CLASSMODULE behaviors
1) No common data allowed.
2) ROUTINE, LROUTINE, and PROCEDURE instructions are not allowed.
3) CHAIN is not allowed.
4) TRAP is not allowed.
5) A CLASSMODULE instruction creates a SHUTDOWN as the first instruction in a load module. Therefore, the CLASSMODULE '.plc' program can not be executed as a standalone program.
6) The compiler flags the '.plc' of the load module so the PL/B runtimes can invoke specialized behaviors.
7) If PL/B instructions use a PLBOBJECT as a program is compiled, the compiler accesses the current CLASSMODULE FUNCTION labels to verify properties and methods being accessed. This feature can only be used if the CLASSMODULE '.plc' exists when a PLBOJBECT is being compiled into a PL/B program. Otherwise, the compiler gives appropriate warning messages.
When a CLASSMODULE load module is being loaded and used for a PLBOBJECT the following behaviors are expected:
A. All data declared in a CLASSMODULE load module is private.
B. The PL/B runtime ONLY allows a CLASSMODULE load module to be accessed by a PL/B instruction that is using a PLBOBJECT code object.
C. The PLBOBJECT can be used in the following instructions when accessing/using a CLASSMODULE.
D. There is a U70 error which can occur when a CLASSMODULE is being accessed/used.
E. A CLASSMODULE load module must include two special FUNCTIONS named as follows. If these functions do not exist when a PLBOBJECT is used in a CREATE or DESTROY instruction, an appropriate object error occurs.
F. The CLASSMODULE PL/B source includes properties and method FUNCTIONs which are accessed using GETPROP,
SETPROP,
and methods. See the sample CLASSMODULE skeleton found in the 'class_skeleton.pls' sample program.
The PL/B Label syntax identifies a FUNCTION to be used for a GETPROP, SETPROP
or a method as follows:
'Get_PROP' identifies a FUNCTION to be accessed using a GETPROP instruction where 'PROP' is the property name:
GETPROP PLBOBJECT, *PROP={var}
'Set_PROP' identifies a FUNCTION to be accessed using a SETPROP instruction where 'PROP' is the property name:
SETPROP PLBOBJECT, *PROP={var}"
A simple PL/B Label for a FUNCTION identifies a FUNCTION to be accessed using PL/B method syntax as follows:
GETPROP PLBOBJECT, *PROP={var}"
Examples:
See Also: Compiler Directives
![]() |