diff options
author | Ludovic Courtès <ludo@gnu.org> | 2009-11-01 18:17:31 +0100 |
---|---|---|
committer | Ludovic Courtès <ludo@gnu.org> | 2009-11-01 18:17:31 +0100 |
commit | 731dd0ce191bf4f3ba8fedfe0e08c0e67a966ce4 (patch) | |
tree | dd1ad47fdceebb013c42dc9b87c03c2fa5d79c0a /libguile/procs.h | |
parent | b4246e5b2235bd01a24a5069ed683fc3c0f6f18c (diff) | |
parent | 5f236208d0d864546e59afa0f5a11c9b3ba14b10 (diff) | |
download | guile-731dd0ce191bf4f3ba8fedfe0e08c0e67a966ce4.tar.gz |
Merge branch 'bdw-gc-static-alloc'
Conflicts:
acinclude.m4
libguile/__scm.h
libguile/bdw-gc.h
libguile/eval.c
Diffstat (limited to 'libguile/procs.h')
-rw-r--r-- | libguile/procs.h | 43 |
1 files changed, 43 insertions, 0 deletions
diff --git a/libguile/procs.h b/libguile/procs.h index 469b735d9..7e445ad11 100644 --- a/libguile/procs.h +++ b/libguile/procs.h @@ -40,6 +40,46 @@ #define SCM_SET_SUBR_GENERIC(x, g) (*((SCM *) SCM_CELL_WORD_2 (x)) = (g)) #define SCM_SET_SUBR_GENERIC_LOC(x, g) (SCM_SET_CELL_WORD_2 (x, (scm_t_bits) g)) +/* Return the most suitable subr type for a subr with REQ required arguments, + OPT optional arguments, and REST (0 or 1) arguments. This has to be in + sync with `create_gsubr ()'. */ +#define SCM_SUBR_ARITY_TO_TYPE(req, opt, rest) \ + ((rest) == 0 \ + ? ((opt) == 0 \ + ? ((req) == 0 \ + ? scm_tc7_subr_0 \ + : ((req) == 1 \ + ? scm_tc7_subr_1 \ + : ((req) == 2 \ + ? scm_tc7_subr_2 \ + : ((req) == 3 \ + ? scm_tc7_subr_3 \ + : scm_tc7_gsubr \ + | (SCM_GSUBR_MAKTYPE (req, opt, rest) << 8U))))) \ + : ((opt) == 1 \ + ? ((req) == 0 \ + ? scm_tc7_subr_1o \ + : ((req) == 1 \ + ? scm_tc7_subr_2o \ + : scm_tc7_gsubr | \ + (SCM_GSUBR_MAKTYPE (req, opt, rest) << 8U))) \ + : scm_tc7_gsubr | \ + (SCM_GSUBR_MAKTYPE (req, opt, rest) << 8U))) \ + : ((rest) == 1 \ + ? ((opt) == 0 \ + ? ((req) == 0 \ + ? scm_tc7_lsubr \ + : ((req) == 2 \ + ? scm_tc7_lsubr_2 \ + : scm_tc7_gsubr \ + | (SCM_GSUBR_MAKTYPE (req, opt, rest) << 8U))) \ + : scm_tc7_gsubr \ + | (SCM_GSUBR_MAKTYPE (req, opt, rest) << 8U)) \ + : scm_tc7_gsubr \ + | (SCM_GSUBR_MAKTYPE (req, opt, rest) << 8U))) + + + /* Closures */ @@ -104,6 +144,9 @@ #define SCM_PROCEDURE(obj) SCM_CELL_OBJECT_1 (obj) #define SCM_SETTER(obj) SCM_CELL_OBJECT_2 (obj) + + + SCM_API SCM scm_c_make_subr (const char *name, long type, SCM (*fcn)()); SCM_API SCM scm_c_make_subr_with_generic (const char *name, long type, SCM (*fcn)(), SCM *gf); |