Next: , Up: Application Interface Types


3.3.2.1 struct x1f4_datatype_type

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

The x1f4_datatype_type record describes an application defined type.

name
The name is the type name, i.e. the string that introduces declarations of variable of this application defined type.
flat
The flat field is the address of the routine finalizing data (variables that is) when such data comes out of use (when data declaration scope expires for an instance). If no such finalizing routine is required flat should be set to NULL. When called, the routine is supplied the application defined types context (some pointer provided by the application to the executable program representation contructor for exactly this purpose), this very type context (the context field in this very record) and the address at which data (the variable) is stored (in turn, a pointer (void *) itself).

See struct x1f4_c1_type.

The method needs to set the data to pre-initialized value before completion (for the pre-initializing routine will not be called again).

The flat method is used for finalizing data only in normal program execution, not after a program execution interruption. The shut method finalizes data after program execution interruptions.

line
The line field is the address of the routine initializing data (variables that is) when such data comes into use (when declaration scope is entered for an instance). If no such initializing routine is required line should be set to NULL. When called, the routine is supplied the application defined types context (some pointer provided by the application to the executable program representation contructor for exactly this purpose), this very type context (the context field in this very record) and the address at which data (the variable) is stored (in turn, a pointer (void *) itself).

See struct x1f4_c1_type.

link
The link field is the address of the routine pre-initializing 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 shut routine) for all data. The link may set data to some value (like NULL for pointers) to indicate that data has never been (successfully) initialized. The flat and shut routines may like to set thenselves data to such pre-initialized value once they finalize data, since link will not be called again, not if the data is reallocated. If no such pre-initializing routine is required link should be set to NULL. When called, the routine is supplied the application defined types context (some pointer provided by the application to the executable program representation contructor for exactly this purpose), this very type context (the context field in this very record) and the address at which data (the variable) is stored (in turn, a pointer (void *) itself).

See struct x1f4_c1_type.

See Execution Completion Cleanup.

shut
The shut field is the address of the routine finalizing data (variables that is) after a program execution interrupt. If no such finalizing routine is required shut should be set to NULL. When called, the routine is supplied the application defined types context (some pointer provided by the application to the executable program representation contructor for exactly this purpose), this very type context (the context field in this very record) and the address at which data (the variable) is stored (in turn, a pointer (void *) itself).

See struct x1f4_c1_type.

See Execution Completion Cleanup.

The method needs to set the data to pre-initialized value before completion (for the pre-initializing routine will not be called again).

The shut method does not finalize data during normal program execution. The flat method does.

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, link and shut in this very definition) and not used otherwise.