1
Fork 0
mirror of https://git.savannah.gnu.org/git/guile.git synced 2025-05-20 11:40:18 +02:00

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.
This commit is contained in:
Andy Wingo 2010-02-19 11:39:44 +01:00
parent 26e6f99fc3
commit 5ef71027e4
2 changed files with 9 additions and 11 deletions

View file

@ -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)))

View file

@ -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);