This is the mail archive of the guile@cygnus.com mailing list for the guile project.
Index Nav: | [Date Index] [Subject Index] [Author Index] [Thread Index] | |
---|---|---|
Message Nav: | [Date Prev] [Date Next] | [Thread Prev] [Thread Next] |
> This is probably a basic question but I haven't been able to find an > answer by myself, so I'm now seeking for some help here. It sounds like what you want to do is create Guile procedure objects for your C functions, but you don't want to associate a name with them --- you just want the procedures. To make a procedure object without binding it to any variable, call scm_make_subr_opt: SCM scm_make_subr_opt (char *NAME, int TYPE, SCM (*FCN) (), int SET) Create a Scheme procedure P implemented by the C procedure FCN. TYPE describes the number of arguments that P accepts; it can be one of the following constants, declared by #including <libguile.h>: scm_tc7_subr_0 --- P takes no arguments scm_tc7_subr_1 --- P takes one argument scm_tc7_subr_1o --- P takes no required and one optional argument. scm_tc7_subr_2o --- P takes one required and one optional argument. scm_tc7_subr_2 --- P takes two required arguments. scm_tc7_subr_3 --- P takes three required arguments. scm_tc7_lsubr --- P takes one ``rest'' argument. scm_tc7_lsubr_2 --- P takes two required arguments, and a ``rest'' argument. If P accepts N required arguments and M optional arguments, then the C function FCN must take N + M arguments; it will receive omitted optional arguments as SCM_UNDEFINED values. If P accepts a ``rest'' argument, then FCN will receive the rest list as one additional, final argument. If SET is non-zero, then the global variable whose name is NAME is bound to P. Regardless of the value of SET, Guile will use NAME when printing the procedure P.