StrongForth.f Object Oriented Programming Glossary


! ( SINGLE BADDRESS -> 1ST -- )

Store SINGLE in the bit field specified by BADDRESS. Only the number of low-order bits corresponding to the length of the bit field are transferred.


(@SIZE) ( BADDRESS -> SINGLE -- LOGICAL UNSIGNED )

LOGICAL is the content of the bit field stored at address BADDRESS -> SINGLE. If the length of the bit field is lower than the size of a cell, its value is extended with leading zero bits. UNSIGNED is the length of the bit field.

(@SIZE) is an internal definition used by @.


(BIND) ( DATA-TYPE "<spaces>name" -- )

Skip leading space delimiters. Parse name delimited by a space. Find virtual member name. Statically bind name to class DATA-TYPE and compile it. An exception is thrown if the system is in interpretation state, if DATA-TYPE is not a class, or if no virtual member with name name is found. An ambiguous condition exists if name is not a virtual member of class DATA-TYPE.


(BVARIABLE) ( STACK-DIAGRAM -- 1ST )

Compile the stack diagram of a bit field variable into the dictionary. Modify STACK-DIAGRAM. The compiler data heap pointer is assumed to point to the compound data type of the variable.


(CVARIABLE) ( STACK-DIAGRAM -- 1ST )

Compile the stack diagram of a character size variable into the dictionary. Modify STACK-DIAGRAM. The compiler data heap pointer is assumed to point to the compound data type of the variable.


(DELETE) ( OBJECT -- )

Return the chunk of contiguous memory space occupied by the object OBJECT to the system for later allocation. An ambiguous condition exists if OBJECT was not previously created by (NEW). An exception is thrown if the memory space canot be returned.


(MEMBER) ( STRUCT-SIZE UNSIGNED "<spaces>name" -- 1ST )

Perform the semantics of AUTOTHIS if THIS-CLASS is a class.

Skip leading space delimiters. Parse name delimited by a space. Create a new definition for name with the execution semantics defined below, and make it the latest definition. 1ST is equal to STRUCT-SIZE aligned to cell size, plus UNSIGNED times the number of bits in one address unit.

name is referred to as a data member.

Execution: ( x -- ADDRESS -> y )
ADDRESS -> y is the address of the data member of the structure or object x, whose offset is equal to STRUCT-SIZE divided by the number of bits in one address unit. x is a structure or object of the data type THIS-CLASS at the time name was created. y is the data type of the data member, which is obtained from the data type heap at the time name was created.


(NEW) ( ADDRESS ADDRESS -> STRUCTURE -- 3RD )

3RD is the structure that starts at address DATA.


(NEW) ( CADDRESS ADDRESS -> STRUCTURE -- 3RD )

3RD is the structure that starts at address CDATA.


(NEW) ( ADDRESS -> STRUCTURE -- 2ND )

Allocate a chunk of contiguous memory space for a structure STRUCTURE, and return the allocated structure as 2ND. The initial contents of the allocated structure's members are undefined. An exception is thrown if memory allocation fails. An ambiguous condition exists if ADDRESS -> STRUCTURE is not the address of a cell that contains the size in address units of the structure STRUCTURE.

Note: ADDRESS -> STRUCTURE is not the address of an item of data type STRUCTURE.


(NEW) ( ADDRESS ADDRESS -> OBJECT -- 3RD )

Initialize the virtual member table pointer of an object with data type OBJECT starting at address DATA with ADDRESS -> OBJECT, and return the object as 3RD. An ambiguous condition exists if ADDRESS -> OBJECT is not the address of the virtual member table of the class OBJECT.

Note: ADDRESS -> OBJECT is not the address of an item of data type OBJECT.


(NEW) ( CADDRESS ADDRESS -> OBJECT -- 3RD )

Initialize the virtual member table pointer of an object with data type OBJECT starting at address CDATA with ADDRESS -> OBJECT, and return the object as 3RD. An ambiguous condition exists if ADDRESS -> OBJECT is not the address of the virtual member table of the class OBJECT.

Note: ADDRESS -> OBJECT is not the address of an item of data type OBJECT.


(NEW) ( ADDRESS -> OBJECT -- 2ND )

Allocate a chunk of contiguous memory space for an object OBJECT. Initialize the virtual member table pointer of the object with ADDRESS -> OBJECT, and return the object as 2ND. The initial contents of the allocated object's members are undefined. An exception is thrown if memory allocation fails. An ambiguous condition exists if ADDRESS -> OBJECT is not the address of the virtual member table of the object OBJECT.

Note: ADDRESS -> OBJECT is not the address of an item of data type OBJECT.


+ ( BADDRESS INTEGER -- 1ST )

Add INTEGER to the bit field address BADDRESS, giving the new bit field address 1ST. INTEGER is automatically multiplied with the length of the bit field before the actual addition takes place. The result typically specifies a bit field that starts at a different bit position.


+! ( INTEGER BADDRESS -> INTEGER -- )

Add INTEGER to the content of the bit field specified by BADDRESS -> INTEGER. Only the number of low-order bits corresponding to the length of the bit field are transferred.


+! ( INTEGER ADDRESS -> BADDRESS -- )

Add INTEGER to the bit field address stored at address ADDRESS -> BADDRESS. INTEGER is automatically multiplied with the length of the bit field before the actual addition takes place. The result typically specifies a bit field that starts at a different bit position.


- ( BADDRESS INTEGER -- 1ST )

Subtract INTEGER from the bit field address BADDRESS, giving the new bit field address 1ST. INTEGER is automatically multiplied with the length of the bit field before the actual subtraction takes place. The result typically specifies a bit field that starts at a different bit position.


1+ ( BADDRESS -- 1ST )

1ST is the address of a bit field that starts one bit after the most significant bit of the bit field specified by BADDRESS. Both bit fields have the same length.


1- ( BADDRESS -- 1ST )

1ST is the address of a bit field that ends one bit before the least significant bit of the bit field specified by BADDRESS. Both bit fields have the same length


:MEMBER ( OBJ-SIZE "<spaces>name" -- 1ST COLON-SYS )

Skip leading space delimiters. Parse name delimited by a space. Find name in the AUTOTHIS word list. If name is not found, create an immediate definition with this name and the semantics given below in the AUTOTHIS word list. Create another definition for name in the current compilation word list, called a colon definition. Enter compilation state and initialize the compiler data type heap and the local dictionary. Start the current definition, producing COLON-SYS. Append the initiation semantics given below to the current definition. The execution semantics of name will be determined by the words compiled into the body of the definition. The current definition can not be found in the dictionary until it is finished or until the execution of DOES>.

Initiation: ( -- ) ( R: -- nest-sys )
Save information nest-sys about the calling definition.

name Execution (current compilation word list): ( -- )
Execute the definition name.

name Execution (AUTOTHIS word list): ( -- )
Evaluate THIS. Remove the AUTOTHIS word list from the search order, evaluate name and reappend the AUTOTHIS word list to the search order.

Note that the new definition does have no stack effects by default. Stack effects have to be specified separately if they are intended. By using a stack diagram phrase ( ... -- ... ) immediately following : and the definition name, the new definition is modified to incorporate stack effects. An ambiguous condition exists if no input parameters are specified, or if the last input parameter does not have the data type of the current class.


>LAST ( DATA-TYPE -- ADDRESS -> ADDRESS )

ADDRESS -> ADDRESS is the address of the first of two cells. The first cell contains the address offset of the latest definition of the AUTOTHIS word list that belongs to the class DATA-TYPE. The second cell contains the address offset of the latest definition of the PROTECTED word list that belongs to the class DATA-TYPE. An exception is thrown if DATA-TYPE is not a class.


>THIS ( -- )

Interpretation:
An exception is thrown if >THIS is interpreted.

Compilation:
Create a local with name THIS. Append the runtime semantics given below to the current definition.

Runtime: ( SINGLE -- )
Store SINGLE into the local THIS.

>THIS is an immediate word.


>VTABLE ( DATA-TYPE -- ADDRESS -> ADDRESS )

ADDRESS -> ADDRESS is the address of the first of two cells. The first cell contains the address of the virtual member table of the class DATA-TYPE. The second cell contains the address of the friends table of the class DATA-TYPE. An exception is thrown if DATA-TYPE is not a class.


?AUTOTHIS ( "<spaces>name" -- "<spaces>name" )

Perform the semantics of AUTOTHIS if THIS-CLASS is equal to OBJECT or a direct or indirect subtype of OBJECT.


?OBJECT ( DATA-TYPE -- ADDRESS )

ADDRESS is the address of the data field of the definition that is associated with DATA-TYPE. An exception is thrown if DATA-TYPE is not a class.


?STRUCTURE ( DATA-TYPE -- ADDRESS )

ADDRESS is the address of a cell that contains the size in address units of structures with data type DATA-TYPE. An exception is thrown if DATA-TYPE is not a structure.


@ ( BADDRESS -> SINGLE -- 2ND )

2ND is the content of the bit field stored at address BADDRESS -> SINGLE. If the length of the bit field is lower than the size of a cell, its value is extended with leading zero bits.


@ ( BADDRESS -> SIGNED -- 2ND )

2ND is the content of the bit field stored at address BADDRESS -> SIGNED. If the length of the bit field is lower than the size of a cell, its value is sign extended.


@ ( BADDRESS -> FLAG -- 2ND )

2ND is the content of the bit field stored at address BADDRESS -> FLAG. If the length of the bit field is lower than the size of a cell, its value is extended to either FALSE or TRUE.


ACCESS ( OBJ-SIZE "<spaces>name" -- 1ST )

Skip leading space delimiters. Parse name delimited by a space. Find name. Replace the first word list in the search order with the word list that combines the PRIVATE and PROTECTED word lists of the class name. An exception is thrown if name is not the name of a class THIS-CLASS is a friend to.


ALIGNED ( STRUCT-SIZE -- 1ST )

1ST is the lowest value greater than or equal to STRUCT-SIZE that can be divided by the number of bits in a single cell.

Using ALIGNED in a class or structure definition causes the next data member to be cell aligned.


APPEND-WORDLIST ( WID -- )

Append the word list identified by WID to the end of the search order. An exception is thrown if there are too many word lists in the search order.


AND ( STRUCT-SIZE STRUCT-SIZE STRUCT-SIZE -- 1ST 2ND 3RD )

Terminate a block of a union of data members within a structure or class definition, and start a new one. 1ST and 3RD are equal to the first STRUCT-SIZE. 2ND is the maximum of the second and the third STRUCT-SIZE.


AUTOTHIS ( "<spaces>name" -- "<spaces>name" )

Save the input source specification. Skip leading space delimiters. Parse name delimited by a space. Find name in the AUTOTHIS word list. Restore the input source specification. If name is not found, create a definition with this name and the semantics given below in the AUTOTHIS word list.

name Execution: ( -- )
Evaluate THIS. Remove the AUTOTHIS word list from the search order, evaluate name and reappend the AUTOTHIS word list to the search order.


AUTOTHIS ( -- )

Replace the first word list in the search order with the AUTOTHIS word list. An ambiguous condition exists if the AUTOTHIS word list is used outside of a class definition.

AUTOTHIS is a vocabulary.

Note: AUTOTHIS cannot be found by an ordinary dictionary search, because it is hidden by a word with the same name and stack diagram.


AUTOTHIS-LAST ( -- ADDRESS -> ADDRESS )

ADDRESS -> ADDRESS is the address of a cell that contains the name field address of the most recent definition in the AUTOTHIS word list.


AUTOTHIS-WORDLIST ( -- WID )

WID is the identifier of the word list that contains the AUTOTHIS definitions of all classes.


BADDRESS ( STACK-DIAGRAM -- 1ST )

When used in a stack diagram, specifies an input or output parameter with data type BADDRESS.


BIT-FIELD ( ADDRESS -> SINGLE UNSIGNED UNSIGNED -- BADDRESS -> 2ND )

BADDRESS -> 2ND is the address of a bit field starting at the bit position specified by the first UNSIGNED, of memory address ADDRESS -> SINGLE. The length of the bit field is specified by the second UNSIGNED.


BITS/AU ( -- UNSIGNED )

UNSIGNED is the number of bits in one address unit.


BMEMBER ( STRUCT-SIZE SINGLE UNSIGNED "<spaces>name" -- 1ST )

Perform the semantics of AUTOTHIS if THIS-CLASS is a class.

Skip leading space delimiters. Parse name delimited by a space. Create a new definition for name with the execution semantics defined below, and make it the latest definition. 1ST is equal to STRUCT-SIZE plus UNSIGNED.

name is referred to as a data member. BMEMBER allocates a bit field of data type SINGLE with UNSIGNED bits in the structure or class THIS-CLASS.

Execution: ( x -- BADDRESS -> SINGLE )
BADDRESS -> SINGLE is the address of the bit field of the structure or object x, that was allocated at the time name was created.


BMEMBERS ( STRUCT-SIZE SINGLE UNSIGNED UNSIGNED "<spaces>name" -- 1ST )

Perform the semantics of AUTOTHIS if THIS-CLASS is a class.

Skip leading space delimiters. Parse name delimited by a space. Create a new definition for name with the execution semantics defined below, and make it the latest definition. 1ST is equal to STRUCT-SIZE plus the product of the first UNSIGNED and the second UNSIGNED.

name is referred to as a data member. BMEMBERS allocates UNSIGNED (second UNSIGNED) bit fields of data type SINGLE with UNSIGNED (first UNSIGNED) bits in the structure or class THIS-CLASS.

Execution: ( x -- BADDRESS -> SINGLE )
BADDRESS -> SINGLE is the address of the first of UNSIGNED (second UNSIGNED) bit fields of the structure or object x, that were allocated at the time name was created.


BODY ( VTABLE-SIZE -- OBJ-SIZE )

Create a virtual member table with a size of VTABLE-SIZE address units for the class THIS-CLASS. Copy the tokens of the virtual members from the virtual member table of the parent of THIS-CLASS, and initialize all additional virtual members with the token of the dummy word PURE-VIRTUAL. OBJ-SIZE is the size in bits of objects of the parent of THIS-CLASS.

BODY is used in the form CLASS name ... BODY ... ENDCLASS to mark the beginning of the body of a class definition. The body of a class definition starts after the definition of the virtual members.


CALIGNED ( STRUCT-SIZE -- 1ST )

1ST is the lowest value greater than or equal to STRUCT-SIZE that can be divided by the number of bits in a character.

Using CALIGNED in a class or structure definition causes the next data member to be character aligned.


CLASS ( "<spaces>name" -- WID TUPLE -> WID VTABLE-SIZE )

Skip leading space delimiters. Parse name delimited by a space. Find name and assign the data type with the name name to THIS-CLASS. An exception is thrown if name is not a class, or if the parent of name has not yet been defined. Initialize the AUTOTHIS and the PROTECTED word lists to their status at the end of the class definition of the parent of name, and empty the PRIVATE word list. Append the AUTOTHIS word list to the end of the search order. WID is the identifier of the compilation word list. TUPLE -> WID is a tuple containing the identifiers of the word lists in the search order before AUTOTHIS was appended. VTABLE-SIZE is the size in address units of the virtual member table of the parent of name.

CLASS is used in the form CLASS name ... BODY ... ENDCLASS to start a class definition.


CMEMBER ( STRUCT-SIZE SINGLE "<spaces>name" -- 1ST )

Perform the semantics of AUTOTHIS if THIS-CLASS is a class.

Skip leading space delimiters. Parse name delimited by a space. Create a new definition for name with the execution semantics defined below, and make it the latest definition. 1ST is equal to STRUCT-SIZE aligned to cell size, plus the number of bits in one cell.

name is referred to as a data member. CMEMBER allocates one character for a data member of data type SINGLE in the structure or class THIS-CLASS.

Execution: ( x -- CADDRESS -> SINGLE )
CADDRESS -> SINGLE is the address of the character size data member of the structure or object x, that was allocated at the time name was created.


CMEMBERS ( STRUCT-SIZE SINGLE UNSIGNED "<spaces>name" -- 1ST )

Perform the semantics of AUTOTHIS if THIS-CLASS is a class.

Skip leading space delimiters. Parse name delimited by a space. Create a new definition for name with the execution semantics defined below, and make it the latest definition. 1ST is equal to STRUCT-SIZE aligned to character size, plus UNSIGNED times the number of bits in one character.

name is referred to as a data member. CMEMBERS allocates UNSIGNED consecutive characters for data members of data type SINGLE in the structure or class THIS-CLASS.

Execution: ( x -- CADDRESS -> SINGLE )
CADDRESS -> SINGLE is the address of the first of UNSIGNED character size data members of the structure or object x, that were allocated at the time name was created.


COPY ( OBJECT 1ST -- )

Copy the contents of all data members of OBJECT to the data members of 1ST.


DELETE ( -- )

Execution: ( OBJECT -- )
Execute the destructor of OBJECT. Return the chunk of contiguous memory space occupied by OBJECT to the system for later allocation. An ambiguous condition exists if OBJECT was not previously created by (NEW). An exception is thrown if the memory space canot be returned.

DELETE is an immediate word.


DELETE ( STRUCTURE -- )

Return the chunk of contiguous memory space occupied by the structure STRUCTURE to the system for later allocation. An ambiguous condition exists if STRUCTURE was not previously created by (NEW). An exception is thrown if the memory space canot be returned.


DESTRUCTOR ( OBJECT -- 1ST )

Do nothing.

DESTRUCTOR is the destructor of class OBJECT.


ENCLOSE-VTABLE ( ADDRESS -- VTABLE-SIZE ADDRESS -> TOKEN ADDRESS -> TOKEN )

VTABLE-SIZE is the size in address units of the virtual member table of the class identified by ADDRESS. An ambiguous condition exists if ADDRESS is not the address of the virtual member table of a class. The first ADDRESS -> TOKEN is the address of the first token in the virtual member table. The second ADDRESS -> TOKEN is the address of the cell after the last token in the virtual member table.


ENDCLASS ( WID TUPLE -> WID OBJ-SIZE -- )

With OBJ-SIZE being the number of bits occupied by the data members of the class THIS-CLASS, calculate the number of cells of the class and store the corresponding number of address units in its virtual member table. Restore the compilation word list to WID. Restore the search order to the one saved in TUPLE -> WID. If class THIS-CLASS has friends, make the PRIVATE and PROTECTED word lists available as one combined word list.

ENDCLASS is used in the form CLASS name ... BODY ... ENDCLASS to terminate the definition of a class.


ENDSTRUCT ( STRUCT-SIZE -- )

With STRUCT-SIZE being the number of bits occupied by the data members of the structure THIS-CLASS, calculate the number of cells of the structure and store the corresponding number of address units as an attribute of the structure.

ENDSTRUCT is used in the form STRUCT name ... ENDSTRUCT to terminate the definition of a structure.


ENDUNION ( STRUCT-SIZE STRUCT-SIZE STRUCT-SIZE -- 3RD )

Terminate a union of data members within a structure or class definition. 3RD is the maximum of the second and the third STRUCT-SIZE.


ERASE ( BADDRESS -> SINGLE UNSIGNED -- )

If UNSIGNED is not equal to zero, clear all bits in each of UNSIGNED consecutive bit fields beginning at BADDRESS -> SINGLE. Only the number of low-order bits corresponding to the length of the bit fields are transferred.


ERASE ( OBJECT -- )

Clear all bits in all data members of OBJECT.


FILL ( BADDRESS -> SINGLE UNSIGNED 2ND -- )

If UNSIGNED is not equal to zero, store 2ND in each of UNSIGNED consecutive bit fields beginning at BADDRESS -> SINGLE. Only the number of low-order bits corresponding to the length of the bit fields are transferred.


FRIENDS( ( OBJ-SIZE "<spaces>name1<spaces>name2 ... <spaces>namen )" -- 1ST )

Create a list of n friend classes of the class THIS-CLASS by repeatedly skipping leading spaces, parsing name, and adding the class identified by name to the list of friends of class THIS-CLASS. The list of friend classes is terminated by ). OBJ-SIZE is a dummy parameter that ensures that FRIENDS( is always used within the body of a class definition. 1ST is equal to OBJ-SIZE.

FRIENDS( may be used zero or one time within the body of a class definition. An exception is thrown if FRIENDS( is executed more than once within the body of a class definition, or if a name is parsed that does not identify a class.

The friend classes of class THIS-CLASS may be granted access to the PRIVATE and PROTECTED word lists of class THIS-CLASS by using ACCESS within the class definitions of the friend classes


IS ( OBJ-SIZE DEFINITION "<spaces>name" -- 1ST )

Skip leading space delimiters. Parse name delimited by a space. Find a virtual member name whose stack diagram is identical to the one of DEFINITION, except for the last input parameter, which may also be a direct or indirect parent type of the last input parameter of DEFINITION. In the virtual member table of class THIS-CLASS, assign the execution semantics of DEFINITION to name. An exception is thrown if no virtual member with name name exists whose stack diagram is identical to the one of DEFINITION, or if DEFINITION is unfinished.

Virtual members are words defined by VIRTUAL.

OBJ-SIZE is a dummy parameter that ensures that IS is always used within the body of a class definition. 1ST is equal to OBJ-SIZE.


ISVIRTUAL ( SIGNED DEFINITION SINGLE -- 1ST )

1ST is equal to SIGNED if and only if the following conditions are met:

  1. DEFINITION is a virtual member function.
  2. The stack diagram of DEFINITION is exactly the same as the stack diagram of the sample definition SINGLE; except for the last input parameter.
  3. The last input parameter of DEFINITION is either identical to the last input parameter of the sample definition SINGLE, or a direct or indirect parent of it.

If one condition is not met, 1ST is zero. ISVIRTUAL is used as a callback word that implements an additional matching criterion for SEARCH.


LSB ( BADDRESS -- UNSIGNED )

UNSIGNED is the bit position of the least significant bit of the bit field specified by BADDRESS.


MEMBER ( STRUCT-SIZE SINGLE "<spaces>name" -- 1ST )

Perform the semantics of AUTOTHIS if THIS-CLASS is a class.

Skip leading space delimiters. Parse name delimited by a space. Create a new definition for name with the execution semantics defined below, and make it the latest definition. 1ST is equal to STRUCT-SIZE aligned to cell size, plus the number of bits in one cell.

name is referred to as a data member. MEMBER allocates one cell for a data member of data type SINGLE in the structure or class THIS-CLASS.

Execution: ( x -- ADDRESS -> SINGLE )
ADDRESS -> SINGLE is the address of the data member of the structure or object x, that was allocated at the time name was created.


MEMBER ( STRUCT-SIZE DOUBLE "<spaces>name" -- 1ST )

Perform the semantics of AUTOTHIS if THIS-CLASS is a class.

Skip leading space delimiters. Parse name delimited by a space. Create a new definition for name with the execution semantics defined below, and make it the latest definition. 1ST is equal to STRUCT-SIZE aligned to cell size, plus the number of bits in two cells.

name is referred to as a data member. MEMBER allocates two cells for a data member of data type DOUBLE in the structure or class THIS-CLASS.

Execution: ( x -- ADDRESS -> DOUBLE )
ADDRESS -> DOUBLE is the address of the data member of the structure or object x, that was allocated at the time name was created.


MEMBERS ( STRUCT-SIZE SINGLE UNSIGNED "<spaces>name" -- 1ST )

Perform the semantics of AUTOTHIS if THIS-CLASS is a class.

Skip leading space delimiters. Parse name delimited by a space. Create a new definition for name with the execution semantics defined below, and make it the latest definition. 1ST is equal to STRUCT-SIZE aligned to cell size, plus UNSIGNED times the number of bits in one cell.

name is referred to as a data member. MEMBERS allocates UNSIGNED consecutive cells for data members of data type SINGLE in the structure or class THIS-CLASS.

Execution: ( x -- ADDRESS -> SINGLE )
ADDRESS -> SINGLE is the address of the first of UNSIGNED data members of the structure or object x, that were allocated at the time name was created.


MEMBERS ( STRUCT-SIZE DOUBLE UNSIGNED "<spaces>name" -- 1ST )

Perform the semantics of AUTOTHIS if THIS-CLASS is a class.

Skip leading space delimiters. Parse name delimited by a space. Create a new definition for name with the execution semantics defined below, and make it the latest definition. 1ST is equal to STRUCT-SIZE aligned to cell size, plus UNSIGNED times the number of bits in two cells.

name is referred to as a data member. MEMBERS allocates UNSIGNED consecutive double cells for data members of data type DOUBLE in the structure or class THIS-CLASS.

Execution: ( x -- ADDRESS -> DOUBLE )
ADDRESS -> DOUBLE is the address of the first of UNSIGNED data members of the structure or object x, that were allocated at the time name was created.


MSB ( BADDRESS -- UNSIGNED )

UNSIGNED is the bit position of the most significant bit of the bit field specified by BADDRESS. If the bit field crosses a cell boundary, the value of UNSIGNED is greater or equal to the number of bits in one cell.


NEW ( "<spaces>name" -- )

Execution: ( -- STRUCTUR ) or ( -- OBJECT )
Save the input source specification. Skip leading space delimiters. Parse name delimited by a space. Find name and determine the data type with the name name. If name is a structure, discard the saved input source specification and evaluate (NEW) together with a literal of data type ADDRESS -> name to create a new structure with data type name. If name is an object, restore the input source specification and evaluate (NEW) together with a literal of data type ADDRESS -> name to create a new object with data type name. An exception is thrown if the given data type is neither a structure nor an object.

NEW is an immediate word.


OBJ-SIZE ( STACK-DIAGRAM -- 1ST )

When used in a stack diagram, specifies an input or output parameter with data type OBJ-SIZE.


OBJECT ( STACK-DIAGRAM -- 1ST )

When used in a stack diagram, specifies an input or output parameter with data type OBJECT. All classes are direct or indirect subtypes of data type OBJECT.


OBJECT? ( DATA-TYPE -- ADDRESS )

If DATA-TYPE is a class, ADDRESS is the address of the data field of the definition that is associated with DATA-TYPE. Otherwise, ADDRESS is zero.


PARENT? ( DATA-TYPE DATA-TYPE -- ADDRESS )

If the first DATA-TYPE is a direct or indirect subtype of the second DATA-TYPE, or if the first DATA-TYPE is equal to the second DATA-TYPE, ADDRESS is the address of the code field of the definition that is associated with the first DATA-TYPE. Otherwise, ADDRESS is zero.


PRIVATE ( -- )

Replace the first word list in the search order with the PRIVATE word list. An ambiguous condition exists if the PRIVATE word list is used outside of a class definition.

PRIVATE is a vocabulary.


PRIVATE-LAST ( -- ADDRESS -> ADDRESS )

ADDRESS -> ADDRESS is the address of a cell that contains the name field address of the most recent definition in the PRIVATE word list.


PRIVATE-WORDLIST ( -- WID )

WID is the identifier of the PRIVATE word list.


PROCREATES ( DATA-TYPE "<spaces>name" -- )

Extend the semantics of PROCREATES as follows. If DATA-TYPE is a structure, allocate one additional cell in the data field of the definition that is associated with the new data type. If DATA-TYPE is a class, allocate four additional cells in the data field of the definition that is associated with the new data type.


PROTECTED ( -- )

Replace the first word list in the search order with the PROTECTED word list. An ambiguous condition exists if the PROTECTED word list is used outside of a class definition.

PROTECTED is a vocabulary.


PROTECTED-LAST ( -- ADDRESS -> ADDRESS )

ADDRESS -> ADDRESS is the address of a cell that contains the name field address of the most recent definition in the PROTECTED word list.


PROTECTED-WORDLIST ( -- WID )

WID is the identifier of the PROTECTED word list.


PURE-VIRTUAL ( OBJECT -- )

Drop OBJECT and throw an exception.

PURE-VIRTUAL is a dummy word to be executed in the place of pure virtual members.


SIZE ( BADDRESS -- UNSIGNED )

UNSIGNED is the length of the bit field specified by BADDRESS.


SIZE ( OBJECT -- UNSIGNED )

UNSIGNED is the size in cells of the data members of OBJECT.


SIZE-OBJECT ( ADDRESS -- UNSIGNED )

UNSIGNED is the size in address units of an object whose class is identified by ADDRESS. An ambiguous condition exists if ADDRESS is not the address of the virtual member table of a class.


SIZE-OBJECT ( DATA-TYPE -- UNSIGNED )

UNSIGNED is the size in address units of objects of class DATA-TYPE. An exception is thrown if DATA-TYPE is not a class.


SIZE-STRUCTURE ( ADDRESS -- UNSIGNED )

UNSIGNED is the size in address units of the structure identified by ADDRESS. An ambiguous condition exists if ADDRESS was not produced by STRUCTURE? or ?STRUCTURE.


SIZE-STRUCTURE ( DATA-TYPE -- UNSIGNED )

UNSIGNED is the size in address units of the structure DATA-TYPE. An exception is thrown if DATA-TYPE is not a structure.


STRIP-WORDLIST ( -- )

Transform the search order consisting of wid1, ... widn-1, widn (where wid1 is searched first) into wid1, ... widn-1. An exception is thrown if the search order was empty before STRIP-WORDLIST was executed.


STRUCT ( -- STRUCT-SIZE )

Skip leading space delimiters. Parse name delimited by a space. Find name and assign the data type with the name name to THIS-CLASS. An exception is thrown if name is not a structure, or if the parent of name has not yet been defined. STRUCT-SIZE is the size in bits of the parent of name.

STRUCT is used in the form STRUCT name ... ENDSTRUCT to define the data members of a structure name.


STRUCT-SIZE ( STACK-DIAGRAM -- 1ST )

When used in a stack diagram, specifies an input or output parameter with data type STRUCT-SIZE.


STRUCTURE ( STACK-DIAGRAM -- 1ST )

When used in a stack diagram, specifies an input or output parameter with data type STRUCTURE. All structures are direct or indirect subtypes of data type STRUCTURE.


STRUCTURE? ( DATA-TYPE -- ADDRESS )

If DATA-TYPE is a structure, ADDRESS is the address of a cell that contains the size in address units of structures with data type DATA-TYPE. Otherwise, ADDRESS is zero.


THIS-CLASS ( -- DATA-TYPE )

DATA-TYPE is the data type whose class definition is currently being compiled. If no class is currently being compiled, DATA-TYPE is undefined.


THIS-PARENT ( -- DATA-TYPE )

DATA-TYPE is the parent of the data type whose class definition is currently being compiled. An ambiguous condition exists if no class is currently being compiled.


THIS-VTABLE ( -- ADDRESS -> ADDRESS )

ADDRESS -> ADDRESS is the address of the first of two cells. The first cell contains the address of the virtual member table of the class THIS-CLASS. The second cell contains the address of the friends table of the class THIS-CLASS. An ambiguous condition exists if THIS-CLASS is not a class.


UNION ( STRUCT-SIZE -- 1ST 1ST 1ST )

Starts a union of data members within a structure or class definition. All parameters 1ST are equal to STRUCT-SIZE. The first 1ST marks the starting bit position of the union, the second 1ST marks the end bit position of the largest block so far, and the third 1ST is the current bit position of the current block.


VTABLE-SIZE ( STACK-DIAGRAM -- 1ST )

When used in a stack diagram, specifies an input or output parameter with data type VTABLE-SIZE.


VIRTUAL ( VTABLE-SIZE "<spaces>name" -- 1ST )

Skip leading space delimiters. Parse name delimited by a space. Create a new definition for name with the execution semantics defined below, and make it the latest definition. 1ST is equal to VTABLE-SIZE plus the size of a cell in address units. An exception is thrown if VIRTUAL is executed in compilation state.

If name is not yet in the AUTOTHIS word list, add a definition for name to the AUTOTHIS word list using AUTOTHIS.

Note that the new definition does have no stack effects by default. Stack effects have to be specified separately. By using a stack diagram phrase ( ... -- ... ) immediately following VIRTUAL and the definition name, the new definition is modified to incorporate stack effects. An ambiguous condition exists if the stack diagram does not contain at least one input parameter, or if the last input parameter is not a class.

name Execution: ( ... class -- ... )
Execute the definition whose token is stored in the virtual member table of class, the last input parameter of name. class is OBJECT or a direct or indirect subtype of OBJECT. The token is stored in the virtual member table by a succeeding execution of IS. name is called a virtual member. An ambiguous condition exists if name is executed before it is being assigned an execution semantics by IS.


VIRTUAL-MATCH ( SIGNED DEFINITION SINGLE -- 1ST )

1ST is equal to SIGNED if and only if DEFINITION is a virtual member definition and the stack diagram of DEFINITION matches the contents of the contents of data type heap. Otherwise, 1ST is zero. The matching algorithm depends on the value of SINGLE.

SINGLE = 0:
In interpretation state, only words whose input parameters match the data types on the interpreter data type heap can be found. In compilation state, only non-immediate words whose input parameters match the data types on the compiler data type heap, and immediate words whose input parameters match the data types on the interpreter data type heap can be found.

SINGLE = -1:
Only words whose input parameters match the data types on the compiler data type heap can be found. An ambiguous condition exists if executed in interpretation state.

SINGLE = address of a sample definition:
Only words whose input parameters match the data types on the compiler data type heap can be found. Additionally, the output parameter list, after resolving all data type references to the input parameters, has to be identical to the output parameter list of the definition whose address is passed in parameter SINGLE.


[BIND] ( "<spaces>name1" "<spaces>name2" -- )

Skip leading space delimiters. Parse name1 delimited by a space. Find name1 and determine the class with the name name1. Skip leading space delimiters. Parse name2 delimited by a space. Find name2. Statically bind name2 to the class with the name name1 and compile it. An exception is thrown if a class with the name name1 does not exist or if name2 is not a virtual member. An ambiguous condition exists if name2 is not a virtual member of the class with the name name1.


[PARENT] ( "<spaces>name" -- )

Skip leading space delimiters. Parse name delimited by a space. Find name. Statically bind name to the parent of class THIS-CLASS and compile it. An exception is thrown if the parent of THIS-CLASS is not a class or if name is not a virtual member. An ambiguous condition exists if name is not a virtual member of the parent of THIS-CLASS.


Dr. Stephan Becher - January 30th, 2009