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] |
I think I asked this ages ago, but I'll ask again. And perhaps this feature is available in a different guise. Are there any plans to add a "tag" argument to gh_new_procedureX_Y() / gh_new_procedure() / scm_make_gsubr() ? The motivation is, as was designed in X-Windows, to pass a "data tag" which can be passed to the procedure (a "callback" in X-Windows jargon). This mechanism allows me to avoid the use of global variables -- the relevant data can be passed along to the procedure. This is probably a gigantic change because the C interface procedures might have to be defined as: SCM (*fn)(void* tag, SCM* arg1, SCM* arg2, ...); Perhaps to avoid any lack-of-backward-compatibility, a new set of C functions could be devised?: SCM gh_new_tag_procedure(char *proc_name, SCM (*fn)(), void* tag, int n_required_args, int n_optional_args, int varp); SCM gh_new_tag_procedure0_0(char *proc_name, SCM (*fn)(void*), void* tag); SCM gh_new_tag_procedure0_1(char *proc_name, SCM (*fn)(void*, SCM), void* tag); SCM gh_new_tag_procedure0_2(char *proc_name, SCM (*fn)(void*, SCM, SCM), void* tag); SCM gh_new_tag_procedure1_0(char *proc_name, SCM (*fn)(void*, SCM), void* tag); SCM gh_new_tag_procedure1_1(char *proc_name, SCM (*fn)(void*, SCM, SCM), void* tag); SCM gh_new_tag_procedure1_2(char *proc_name, SCM (*fn)(void*, SCM, SCM, SCM), void* tag); SCM gh_new_tag_procedure2_0(char *proc_name, SCM (*fn)(void*, SCM, SCM), void* tag); SCM gh_new_tag_procedure2_1(char *proc_name, SCM (*fn)(void*, SCM, SCM, SCM), void* tag); SCM gh_new_tag_procedure2_2(char *proc_name, SCM (*fn)(void*, SCM, SCM, SCM, SCM), void* tag); SCM gh_new_tag_procedure3_0(char *proc_name, SCM (*fn)(void*, SCM, SCM, SCM), void* tag); SCM gh_new_tag_procedure4_0(char *proc_name, SCM (*fn)(void*, SCM, SCM, SCM, SCM), void* tag); SCM gh_new_tag_procedure5_0(char *proc_name, SCM (*fn)(void*, SCM, SCM, SCM, SCM, SCM), void* tag); Although I am a simple user, it seems that implementing this should be easy: just add a "void*" item to where there's only currently a function pointer. Thanks. -- Robert Brown | Continuum Software, Inc. email:robertb@continuumsi.com | 800 West Cummings Park, Ste 4950 http://www.continuumsi.com/~robertb | Woburn, MA 01801-6504 voice: 781-932-8400 x100 | fax: 781-932-2558