diff --git a/libguile/ChangeLog b/libguile/ChangeLog index 95eb81396..261ffb4bb 100644 --- a/libguile/ChangeLog +++ b/libguile/ChangeLog @@ -1,3 +1,14 @@ +2000-03-24 Dirk Herrmann + + * pairs.h (SCM_CELL_OBJECT, SCM_CELL_OBJECT_[0-3], + SCM_SET_CELL_OBJECT, SCM_SET_CELL_OBJECT_[0-3], SCM_CELL_TYPE, + SCM_SET_CELL_TYPE): Added a set of low level macros for accessing + cell entries. + (SCM_CELL_WORD_[0-3]): Renamed from the SCM_CELL_WORD[0-3]. + + * procs.h, procs.c: Instead of SCM_{SET_}?CELL_WORD[12], use the + newly introduced SCM_{SET_}?CELL_OBJECT_[12] macros. + 2000-03-23 Mikael Djurfeldt * tags.h: Disabled definition of SCM_VOIDP_TEST. diff --git a/libguile/pairs.h b/libguile/pairs.h index 8c36a2804..b14532b0d 100644 --- a/libguile/pairs.h +++ b/libguile/pairs.h @@ -58,6 +58,39 @@ typedef struct scm_cell SCM cdr; } scm_cell; + +/* Low level cell data accessing macros: + */ + +#define SCM_CELL_WORD(x, n) (SCM_UNPACK (((SCM *) SCM2PTR (x))[n])) +#define SCM_CELL_WORD_0(x) SCM_CELL_WORD (x, 0) +#define SCM_CELL_WORD_1(x) SCM_CELL_WORD (x, 1) +#define SCM_CELL_WORD_2(x) SCM_CELL_WORD (x, 2) +#define SCM_CELL_WORD_3(x) SCM_CELL_WORD (x, 3) + +#define SCM_CELL_OBJECT(x, n) (((SCM *) SCM2PTR (x))[n]) +#define SCM_CELL_OBJECT_0(x) SCM_CELL_OBJECT (x, 0) +#define SCM_CELL_OBJECT_1(x) SCM_CELL_OBJECT (x, 1) +#define SCM_CELL_OBJECT_2(x) SCM_CELL_OBJECT (x, 2) +#define SCM_CELL_OBJECT_3(x) SCM_CELL_OBJECT (x, 3) + +#define SCM_SET_CELL_WORD(x, n, v) ((((SCM *) SCM2PTR (x))[n]) = SCM_PACK (v)) +#define SCM_SET_CELL_WORD_0(x, v) SCM_SET_CELL_WORD (x, 0, v) +#define SCM_SET_CELL_WORD_1(x, v) SCM_SET_CELL_WORD (x, 1, v) +#define SCM_SET_CELL_WORD_2(x, v) SCM_SET_CELL_WORD (x, 2, v) +#define SCM_SET_CELL_WORD_3(x, v) SCM_SET_CELL_WORD (x, 3, v) + +#define SCM_SET_CELL_OBJECT(x, n, v) ((((SCM *) SCM2PTR (x))[n]) = v) +#define SCM_SET_CELL_OBJECT_0(x, v) SCM_SET_CELL_OBJECT (x, 0, v) +#define SCM_SET_CELL_OBJECT_1(x, v) SCM_SET_CELL_OBJECT (x, 1, v) +#define SCM_SET_CELL_OBJECT_2(x, v) SCM_SET_CELL_OBJECT (x, 2, v) +#define SCM_SET_CELL_OBJECT_3(x, v) SCM_SET_CELL_OBJECT (x, 3, v) + + +#define SCM_CELL_TYPE(x) SCM_CELL_WORD_0 (x) +#define SCM_SET_CELL_TYPE(x, t) SCM_SET_CELL_WORD_0 (x, t) + + /* SCM_PTR_LT defines how to compare two SCM_CELLPTRs (which may not be in the * same scm_array). SCM_CELLPTR is a pointer to a cons cell which may be * compared or differenced. SCMPTR is used for stack bounds. @@ -155,20 +188,8 @@ typedef SCM huge *SCMPTR; /* Multi-cells */ -#define SCM_CELL_WORD(x, n) (((SCM *) (SCM2PTR (x)))[n]) -#define SCM_SET_CELL_WORD(x, n, v) (SCM_CELL_WORD (x, n) = (SCM) (v)) #define SCM_CELL_WORD_LOC(x, n) (&SCM_CELL_WORD (x, n)) -#define SCM_CELL_WORD0(x) SCM_CELL_WORD (x, 0) -#define SCM_CELL_WORD1(x) SCM_CELL_WORD (x, 1) -#define SCM_CELL_WORD2(x) SCM_CELL_WORD (x, 2) -#define SCM_CELL_WORD3(x) SCM_CELL_WORD (x, 3) - -#define SCM_SET_CELL_WORD0(x, v) SCM_SET_CELL_WORD(x, 0, v) -#define SCM_SET_CELL_WORD1(x, v) SCM_SET_CELL_WORD(x, 1, v) -#define SCM_SET_CELL_WORD2(x, v) SCM_SET_CELL_WORD(x, 2, v) -#define SCM_SET_CELL_WORD3(x, v) SCM_SET_CELL_WORD(x, 3, v) - /* the allocated thing: The car of newcells are set to scm_tc16_allocated to avoid the fragile state of newcells wrt the gc. If it stays as a freecell, any allocation afterwards could diff --git a/libguile/procs.c b/libguile/procs.c index b90eace0a..a42756b09 100644 --- a/libguile/procs.c +++ b/libguile/procs.c @@ -319,8 +319,8 @@ SCM_DEFINE (scm_make_procedure_with_setter, "make-procedure-with-setter", 2, 0, SCM_VALIDATE_PROC (2, setter); SCM_NEWCELL2 (z); SCM_ENTER_A_SECTION; - SCM_SET_CELL_WORD1 (z, procedure); - SCM_SET_CELL_WORD2 (z, setter); + SCM_SET_CELL_OBJECT_1 (z, procedure); + SCM_SET_CELL_OBJECT_2 (z, setter); SCM_SETCAR (z, scm_tc7_pws); SCM_EXIT_A_SECTION; return z; diff --git a/libguile/procs.h b/libguile/procs.h index 8fe7fa1c6..78324e57c 100644 --- a/libguile/procs.h +++ b/libguile/procs.h @@ -159,8 +159,8 @@ typedef struct new four-word cells. */ #define SCM_PROCEDURE_WITH_SETTER_P(obj) (SCM_NIMP(obj) && (SCM_TYP7 (obj) == scm_tc7_pws)) -#define SCM_PROCEDURE(obj) SCM_CELL_WORD1 (obj) -#define SCM_SETTER(obj) SCM_CELL_WORD2 (obj) +#define SCM_PROCEDURE(obj) SCM_CELL_OBJECT_1 (obj) +#define SCM_SETTER(obj) SCM_CELL_OBJECT_2 (obj) extern scm_subr_entry *scm_subr_table; extern int scm_subr_table_size;