Index | PAL Intro | Commands | Registers | Indices | Stack | Macros | Classes | Attributes | Errors
class/load - Load class definitions or assignments
Synopsis
Description
Indirect Addressing
Error Handling
Examples
See Also
Author
class/load write, class <, write, class ... >
class/load write, (![object])
class/load write, (readclass)
In the first synopsis form, loads class definitions into the named registers. The arguments are grouped in pairs of write and read.
write Register to store the next pointer in. The pointer will be taken from the next read argument. class Register or index containing the text name of the class. A pointer to the class definition will be stored in the register named in the previous write argument. This will set the data type of the register to PSUNIT_TYPE_CLASSDEF.
In the second and third synopsis forms, the class/load instruction can be used with indirect addressing to read the classes assigned to an object.
First a read structure is initialised when the second argument is the object to read. The write register will now hold a class read structure (type PSUNIT_TYPE_READCLASS). A list of classes assigned to the object will be copied into the read structure at this time.
The read structure is then given as the readclass argument in successive calls. Each call to class/load with readclass will return the next class in the write register, as a pointer to a class definition identified by the PSUNIT_TYPE_CLASSDEF type.
Finally use reg/clr to clear the read structure and release memory associated with it.
If an attempt is made to read beyond the end of the class list, a NULL value is returned in the write argument.
Note that because the read structure holds a copy of the classes assigned to the object, if the object is updated after the read structure has been initialised it will no longer reflect the true status of the object.
A runtime error is generated if a named class does not exist in the schema, a referenced object does not exist in the nexus or if an argument provided is the wrong type.
The following demonstrates loading multiple class definitions:
.main class/load P0, [psContainer], P1, [psModule], P2, [psFunction]
reg/dump P0, P1, P2The following code demonstrates iterating classes:
.main % Initialise the read structure class/load P0, (PCTX)
.loop % Read the next class definition class/load P1, (P0)
% Exit loop if no classes remain reg/jmpeq &[.loop_end], P1, NULL
% Dump the register reg/dump P1
% Continue next iteration local/jmp &[.loop]
.loop_end % Release the read structure and return reg/clr P0 func/rtn
pal_commands(5), pal_registers(5), pal_indices(5), ps_classes(5), class_add(5), class_del(5), attr_load(5), reg_clr(5),
PROSE Assembly Language at prose.sourceforge.net.
Copyright (c) 2002-2009 Mark R. Bannister <cambridge@users.sourceforge.net>.
This is free software and can be downloaded from prose.sourceforge.net; see the source for copying conditions. There is NO warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
PAL 1.0 | class_load (5) | 10 January 2009 |