previous up next     contents index
Next: Threads Up: Objects Previous: Objects

Library Functions

 
Scheme_Object *  scheme_make_class(char *name, Scheme_Object *sup, 
                         Scheme_Method_Prim *init) 

Creates a new primitive class. If an intializer method init is provided, then objects of this class can be created from Scheme. The class sup specifies a superclass for the primitive class; it can be NULL.

 
void   scheme_add_method_w_arity(Scheme_Object *cl, char *name, Scheme_Method_Prim *f, 
               short mina, short maxa) 

Adds a primitive method to a primitive class. The form of the method f is defined by:

Scheme_Object *Scheme_Method_Prim(Scheme_Object *obj, int argc, Scheme_Object *argv[]);

 
void   scheme_add_method(Scheme_Object *cl, char *name, Scheme_Method_Prim *f) 

Like scheme_add_method_w_arity, but mina and maxa are defaulted to 0 and -1, respectively.

 
Scheme_Object *  scheme_make_object(Scheme_Object *sclass, int argc, 
                        Scheme_Object *argv[]) 

Creates an instance of the class sclass. The arguments to the object's intialization function are speicified by argc and argv.

 
Scheme_Object *  scheme_make_uninited_object(Scheme_Object *sclass) 

Creates a Scheme object instance of sclass without intitializing the object. This is useful for creating a Scheme representation of an existing primitive object.

 
Scheme_Object *  scheme_find_ivar(Scheme_Object *obj, Scheme_Object *sclass, 
                        Scheme_Object *sym) 

Finds an instance variable by name (as a symbol). If sclass is not NULL, then a class-specific instance variable is found. Returns NULL if the instance variable is not found.

 
Scheme_Object *  scheme_get_generic_data( Scheme_Object *class, 
                        Scheme_Object *name) 

Creates a Scheme value that contains the essential information of a generic procedure. This information can be applied to an object using scheme_apply_generic_data. If the named field is not found in the specified class, then the NULL pointer is returned.

 
Scheme_Object *  scheme_apply_generic_data( Scheme_Object *gdata, 
                        Scheme_Object *sobj) 

Given the result of a call to scheme_get_generic_data, extracts a value from the specified Scheme object. If the object is not in the appropriate class, and error is raised.

 
int   scheme_is_subclass(Scheme_Object *sub, Scheme_Object *parent) 

Returns 1 if the class sub is derived from the class parent, or 0 otherwise.

 
int   scheme_is_a(Scheme_Object *obj, Scheme_Object *sclass) 

Returns 1 if obj is an instance of the class sclass or of a class derived from sclass, or 0 otherwise.

 
char *  scheme_get_class_name(Scheme_Object *sclass) 

Returns the name of the class sclass if it is a primitive class, or NULL otherwise.


previous up next     contents index
Next: Threads Up: Objects Previous: Objects

PLT