[previous] [up] [next]     [contents] [index]
Next: Units Up: Structures Previous: Structures

Library Functions

Scheme_Object *scheme_make_struct_type(Scheme_Object *base_name, Scheme_Object *super_type, 
               int num_fields) 

Creates and returns a new structure type. The base_name argument is used as the name of the new structure type; it must be a symbol. The super_type argument should be NULL or an existing structure type to use as the super-type. The num_fields argument specifies the number of fields for instances of this structure type. (If a super-type is used, this is the number of additional fields, rather than the total number.)

Scheme_Object **scheme_make_struct_names(Scheme_Object *base_name, Scheme_Object *field_names, 
                int flags, int *count_out) 

Creates and returns an array of standard structure value name symbols. The base_name argument is used as the name of the structure type; it should be the same symbol passed to the associated call to scheme_make_struct_type. The field_names argument is a (Scheme) list of field name symbols. The flags argument specifies which names should be generated, and if count_out is not NULL, *count_out is filled with the number of names returned in the array.

Scheme_Object **scheme_make_struct_values(Scheme_Object *struct_type, Scheme_Object **names, 
                int count, int flags) 

Creates and returns an array of the standard structure value and procedure values for struct_type. The struct_type argument must be a structure type value created by scheme_make_struct_type. The names procedure must be an array of name symbols, generally the array returned by scheme_make_struct_names. The count argument specifies the length of the names array (and therefore the number of expected return values) and the flags argument specifies which values should be generated.

Scheme_Object *scheme_make_struct_instance(Scheme_Object *struct_type, int argc, 
               Scheme_Object **argv) 

Creates an instance of the structure type struct_type. The argc and argv arguments provide the field values for the new instance.

int scheme_is_struct_instance(Scheme_Object *struct_type, Scheme_Object **v) 

Returns 1 if v is an instance of struct_type or 0 otherwise.


[previous] [up] [next]     [contents] [index]
Next: Units Up: Structures Previous: Structures

PLT