diff options
author | Andy Wingo <wingo@pobox.com> | 2010-02-19 11:39:44 +0100 |
---|---|---|
committer | Andy Wingo <wingo@pobox.com> | 2010-02-19 12:10:11 +0100 |
commit | 5ef71027e49ba870556be194e177fa09b2ff306a (patch) | |
tree | 6f6a69265b3679c18ba0e828e3929aa425a2ec4a | |
parent | 26e6f99fc3543cd4aa24d2d96126ae025f61ab28 (diff) | |
download | guile-5ef71027e49ba870556be194e177fa09b2ff306a.tar.gz |
fluids.h exposes more of its interface, internally at least
* libguile/fluids.h (SCM_I_FLUID_P, SCM_I_FLUID_NUM)
(SCM_I_DYNAMIC_STATE_P, SCM_I_DYNAMIC_STATE_FLUIDS): Expose these
predicates and accessors, internally at least.
* libguile/fluids.c (IS_FLUID, FLUID_NUM, IS_DYNAMIC_STATE)
(DYNAMIC_STATE_FLUIDS): Implement in terms of the exposed macros.
-rw-r--r-- | libguile/fluids.c | 8 | ||||
-rw-r--r-- | libguile/fluids.h | 12 |
2 files changed, 9 insertions, 11 deletions
diff --git a/libguile/fluids.c b/libguile/fluids.c index c9ea68b8f..d49305397 100644 --- a/libguile/fluids.c +++ b/libguile/fluids.c @@ -65,11 +65,11 @@ static size_t allocated_fluids_len = 0; static size_t allocated_fluids_num = 0; static char *allocated_fluids = NULL; -#define IS_FLUID(x) (!SCM_IMP (x) && SCM_TYP7 (x) == scm_tc7_fluid) -#define FLUID_NUM(x) ((size_t)SCM_CELL_WORD_1(x)) +#define IS_FLUID(x) SCM_I_FLUID_P (x) +#define FLUID_NUM(x) SCM_I_FLUID_NUM (x) -#define IS_DYNAMIC_STATE(x) (!SCM_IMP (x) && SCM_TYP7 (x) == scm_tc7_dynamic_state) -#define DYNAMIC_STATE_FLUIDS(x) SCM_PACK (SCM_CELL_WORD_1 (x)) +#define IS_DYNAMIC_STATE(x) SCM_I_DYNAMIC_STATE_P (x) +#define DYNAMIC_STATE_FLUIDS(x) SCM_I_DYNAMIC_STATE_FLUIDS (x) #define SET_DYNAMIC_STATE_FLUIDS(x, y) SCM_SET_CELL_WORD_1 ((x), (SCM_UNPACK (y))) diff --git a/libguile/fluids.h b/libguile/fluids.h index 7aefd478f..0d61fd2e4 100644 --- a/libguile/fluids.h +++ b/libguile/fluids.h @@ -54,13 +54,8 @@ grow. */ -/* The fastest way to acces/modify the value of a fluid. These macros - do no error checking at all. The first argument is the index - number of the fluid, obtained via SCM_FLUID_NUM, not the fluid - itself. You must make sure that the fluid remains protected as - long you use its number since numbers of unused fluids are reused - eventually. -*/ +#define SCM_I_FLUID_P(x) (!SCM_IMP (x) && SCM_TYP7 (x) == scm_tc7_fluid) +#define SCM_I_FLUID_NUM(x) ((size_t)SCM_CELL_WORD_1(x)) SCM_API SCM scm_make_fluid (void); SCM_API int scm_is_fluid (SCM obj); @@ -80,6 +75,9 @@ SCM_API SCM scm_with_fluid (SCM fluid, SCM val, SCM thunk); SCM_API void scm_dynwind_fluid (SCM fluid, SCM value); +#define SCM_I_DYNAMIC_STATE_P(x) (!SCM_IMP (x) && SCM_TYP7 (x) == scm_tc7_dynamic_state) +#define SCM_I_DYNAMIC_STATE_FLUIDS(x) SCM_PACK (SCM_CELL_WORD_1 (x)) + SCM_API SCM scm_make_dynamic_state (SCM parent); SCM_API SCM scm_dynamic_state_p (SCM obj); SCM_API int scm_is_dynamic_state (SCM obj); |