[previous] [up] [next]     [contents] [index]
Next: Evaluation Up: Procedures Previous: Procedures

Library Functions

Scheme_Object *scheme_make_prim_w_arity(Scheme_Prim *prim, char *name, 
               short mina, short maxa) 

Creates a primitive procedure value, given the C function pointer prim. The form of prim is defined by:

typedef Scheme_Object *(*Scheme_Prim)(int argc, Scheme_Object **argv);

The value mina should be the minimum number of arguments that must be supplied to the procedure. The value maxa should be the maximum number of arguments that can be suplied to the procedure, or -1 if the procedure can take arbitrarily many arguments. The mina and maxa values are used for automatically checking the argument count before the primitive is invoked, and also for the Scheme arity procedure. The name argument is used to report application arity errors at run-time.

Scheme_Object *scheme_make_folding_prim(Scheme_Prim *prim, char *name, 
               short mina, short maxa, short folding) 

Like scheme_make_prim_w_arity, but if folding is non-zero, the compiler assumes that an application of the procedure to constant values can be folded to a constant. For example, +, zero?, and string-length are folding primitives, but display, cons, and string-ref are not. (Constant strings are currently mutable in MzScheme.)

Scheme_Object *scheme_make_prim(Scheme_Prim *prim) 

Same as scheme_make_prim_w_arity, but the arity (0, -1) and the name ``UNKNOWN'' is assumed. This function is provided for backward compatibility only.

Scheme_Object *scheme_make_noneternal_prim_w_arity( Scheme_Prim *prim, 
               char *name, short mina, short maxa) 

Same as scheme_make_prim_w_arity. This function is provided for backward compatibility only.

Scheme_Object *scheme_make_noneternal_prim(Scheme_Prim *prim) 

Same as scheme_make_prim. This function is provided for backward compatibility only.

Scheme_Object *scheme_make_closed_prim_w_arity(Scheme_Closed_Prim *prim, void *data, 
               char *name, short mina, short maxa) 

Creates a primitive procedure value; when the C function prim is invoked, data is passed as the first parameter. The form of prim is defined by:

typedef Scheme_Object *(*Scheme_Closed_Prim)(void *data, int argc, Scheme_Object **argv);

Scheme_Object *scheme_make_closed_prim(Scheme_Closed_Prim *prim, void *data) 

Creates a closed primitive procedure value. This function is provided for backward compatibility only.


[previous] [up] [next]     [contents] [index]
Next: Evaluation Up: Procedures Previous: Procedures

PLT