Next: , Previous: , Up: Application Interface Types   [Index]


4.3.2.2 struct x1f4_datatype_type

typedef struct x1f4_datatype_type {
    const char *name;
    int (*flat)(void *, void **), (*lead)(void *, void **),
	(*line)(void *, void **), (*link)(void *, void **),
	(*slip)(void *, void **), type;
    unsigned size;
    void *context;
} x1f4_datatype_type;

The x1f4_datatype_type record describes an application defined type.

name

The name field is the type name, i.e. the string that introduces declarations of variables of this type.

flat

The flat field is the address of the routine finalizing variable value data when such data comes out of use (when data declaration scope expires for an instance). If no such finalizing routine is required flat may be set to NULL. When called, the routine is supplied the type context (the context field) and the address at which data (the variable value) is stored as arguments, in this order.

The method needs to set the data to preinitialized value before completion (for the preinitializing routine will not be called again).

The method is expected to return zero for success, non zero for failure.

lead

The lead field indicates the routine acknowledging the addition of a variable held reference. It should point a proper function for the data types allowing multiple references to same data or copying data and NULL for the rest. For reference counting data types the routine would tipically increment the count. For data types that do not allow multiple references, the routine would copy data. When called, the routine is supplied the type context (the context field in this very record) and the address at which data (the variable value) is stored (in turn, a pointer (void *) itself) as arguments, in this order.

See Referable Objects.

See Object Classes.

Here variable held refers to references not being stored with data structures and more generally, not being subject to regular data reference management. The variable held references (even when held by variable surrogates) do not form cycles.

See Detecting Cycles.

Same as the struct x1f4_nodetype_type lead method.

See struct x1f4_nodetype_type.

The method is expected to return zero for success, non zero for failure.

See Function Calling.

line

The line field is the address of the routine initializing variable data when data comes into use (when declaration scope is entered for an instance). If no such initializing routine is required line may be set to NULL. When called, the routine is supplied the type context (the context field in this very record) and the address where to store data (the variable value) as arguments, in this order.

The method will not observe the value stored at the address indicated by its second argument.

The method is expected to return zero for success, non zero for failure.

link

The link field is the address of the routine preinitializing variable data (variables that is) when memory is allocated for such data. The need for such routine comes from the emergency program execution cleaner inability to distinguish between proper initialized (via line routine) and uninitialized data. The emergency program execution cleaner is the part of the interpreters that is called when some interpreted program or part of program failed execution and the initialized data has to be finalized. The cleaner will not make distinction between data initialized and uninitialized and will call the finalizer (the flat routine) for all data. The link may set data to some value (like NULL for pointers) to indicate that data has not been (successfully) initialized. The flat routine may like to set itself data to such preinitialized value once they finalize data, since link will likely not be called again. If no such preinitializing routine is required link may be set to NULL. When called, the routine is supplied the type context (the context field in this very record) and the address where to store data (the variable preinitialized value) as arguments, in this order.

See Execution Completion Cleanup.

The method is expected to return zero for success, non zero for failure.

slip

The slip field indicates the routine acknowledging the removal of a variable held reference. It should point a proper function for the data types allowing multiple references to same data or copying data and NULL for the rest. For reference counting data types the routine would tipically decrement the count. For data types that do not allow multiple references, the routine would free data. When called, the routine is supplied the type context (the context field in this very record) and the address at which data (the variable value) is stored (in turn, a pointer (void *) itself) as arguments, in this order.

See Referable Objects.

See Object Classes.

Here variable held refers to references not being stored with data structures and more generally, not being subject to regular data reference management. The variable held references (even when held by variable surrogates) do not form cycles.

See Detecting Cycles.

The method should allow for uninitialized variables, and thus for no variable referred objects. No reference needs to be removed for uninitialized variables. The variables will store a data type specific value indicating the not yet initialized state (like NULL), value set by the link preinitializing method.

Same as the struct x1f4_nodetype_type slip method.

See struct x1f4_nodetype_type.

The method is expected to return zero for success, non zero for failure.

See Function Calling.

type

The type field is the type id, i.e. the number that will identify run time data as belonging to this application defined type.

See Application Defined Types.

size

The size field is the type name length, i.e. the number of characters (not including the terminal null) making up the type name.

context

The context field is the context of this very type definition. It is passed as argument to type specific methods (flat, line and link in this very definition) and not used otherwise.

See Referable String Data Type.


Next: struct x1f4_dxcast_type, Previous: struct x1f4_caselink_type, Up: Application Interface Types   [Index]