mirror of
https://git.savannah.gnu.org/git/guile.git
synced 2025-06-10 14:00:21 +02:00
Added a set of low level macros for accessing cell entries.
This commit is contained in:
parent
d87d36506d
commit
0cbaaf0b15
4 changed files with 48 additions and 16 deletions
|
@ -1,3 +1,14 @@
|
|||
2000-03-24 Dirk Herrmann <D.Herrmann@tu-bs.de>
|
||||
|
||||
* 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 <mdj@mdj.nada.kth.se>
|
||||
|
||||
* tags.h: Disabled definition of SCM_VOIDP_TEST.
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -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;
|
||||
|
|
|
@ -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;
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue