compound <name> {
<data-block>
}
Define a compound graphic structure identifier.
<name>
The name of the compound structure being defined.
None
Multiple command lines, each of the form:
{<qual>} <type> { <element>{[<num>]} { = <value> } }
where:
<qual>
If included, may
be one or more of the qualifying words "static" or "heritage".
<type>
The identifier type.
<element>
The element name,
unique for the structure. This is optional, see Notes
below.
<num>
The array dimension
if the element is an array (may be omitted from variable-length arrays).
<value>
A class value for
the element. When an object of this structure class is created, its element
<element>
will be assigned the value <value>.
This will remain its value until changed by an object member assignment.
Only non-array elements can have a class value and only when <type>
is one of the following:
blob, channel, epointer, filter, group, layer, menupane, numeric, panel, point, projection, string, time, treenode, window, procedure/function
Values for members of type filter must be single-line definitions.
Once defined, the compound name may be used as a command to create an object of that compound type. When such an object is created, a compound graphic primitive with graphic primitive children is created. The origin of the new compound object is assumed to be the current position of graphic contorl (gc). These children are initially undefined.
<element> and <num> may be omitted when <type> is another class of structure, gstructure or compound. In such cases the members of <type> are copied into the new compound and given the same element names.
The compound definition must have application scope and objects of its type are given global scope.
The qualifying word "static" defines an element to be a class value with the same value for all instances of <name>. Defining elements as static can result in considerable savings of object storage.
The qualifying word "heritage" defines an element to be available to child structures. For example, if an element named t of a structure is declared heritage, then object.child.child.t is equivalent to object.t.
The class command may also be used to define a compound, by inheriting from entity.
Define a compound structure (with graphic members).
compound ~furn.chair_t { entity back entity seat entity legs[]; # Variable length array string style string paint }
Create an occurrence of a chair (compound).
~furn.chair_t my_chair, -p=(500,800,0)
The component parts may now be defined.
my_chair.back = prism { # user prism definition, e.g. prism { ... } }
The non-graphic attributes may now be defined.
my_chair.style = 'Decca Modern' my_chair.paint = 'Black'
Commands: |
class, entity, epointer, filter, gstructure, list, structure |
Identifiers: |
unique_compound_name (string) |
Structures: |