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

* gc.h (SCM_VALIDATE_CELL): Rewritten.

(SCM_CELL_WORD, SCM_CELL_OBJECT, SCM_SET_CELL_WORD,
SCM_SET_CELL_OBJECT): Use new version of SCM_VALIDATE_CELL.
(Thanks to Han-Wen Nienhuys.)
This commit is contained in:
Mikael Djurfeldt 2000-06-11 19:50:09 +00:00
parent d1c50f737a
commit 708cb87c6e

View file

@ -85,37 +85,40 @@ typedef scm_cell * SCM_CELLPTR;
/* Low level cell data accessing macros: /* Low level cell data accessing macros:
*/ */
#define SCM_VALIDATE_CELL(x) \ #if SCM_DEBUG_CELL_ACCESSES == 1
((void) \ #define SCM_VALIDATE_CELL(cell, expr) \
(SCM_DEBUG_CELL_ACCESSES ? (!scm_cellp (x) ? (abort (), 0) : 1) : 1)) (!scm_cellp (cell) ? abort (), 0 : (expr))
#else
#define SCM_VALIDATE_CELL(cell, expr) expr
#endif
#define SCM_CELL_WORD(x, n) \ #define SCM_CELL_WORD(x, n) \
((SCM_VALIDATE_CELL (x)), \ SCM_VALIDATE_CELL ((x), \
(((scm_bits_t *) SCM2PTR (x)) [n])) ((scm_bits_t *) SCM2PTR (x)) [n])
#define SCM_CELL_WORD_0(x) SCM_CELL_WORD (x, 0) #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_1(x) SCM_CELL_WORD (x, 1)
#define SCM_CELL_WORD_2(x) SCM_CELL_WORD (x, 2) #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_WORD_3(x) SCM_CELL_WORD (x, 3)
#define SCM_CELL_OBJECT(x, n) \ #define SCM_CELL_OBJECT(x, n) \
((SCM_VALIDATE_CELL (x)), \ SCM_VALIDATE_CELL ((x), \
(SCM_PACK (((scm_bits_t *) SCM2PTR (x)) [n]))) SCM_PACK (((scm_bits_t *) SCM2PTR (x)) [n]))
#define SCM_CELL_OBJECT_0(x) SCM_CELL_OBJECT (x, 0) #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_1(x) SCM_CELL_OBJECT (x, 1)
#define SCM_CELL_OBJECT_2(x) SCM_CELL_OBJECT (x, 2) #define SCM_CELL_OBJECT_2(x) SCM_CELL_OBJECT (x, 2)
#define SCM_CELL_OBJECT_3(x) SCM_CELL_OBJECT (x, 3) #define SCM_CELL_OBJECT_3(x) SCM_CELL_OBJECT (x, 3)
#define SCM_SET_CELL_WORD(x, n, v) \ #define SCM_SET_CELL_WORD(x, n, v) \
((SCM_VALIDATE_CELL (x)), \ SCM_VALIDATE_CELL ((x), \
((((scm_bits_t *) SCM2PTR (x)) [n]) = (scm_bits_t) (v))) ((scm_bits_t *) SCM2PTR (x)) [n] = (scm_bits_t) (v))
#define SCM_SET_CELL_WORD_0(x, v) SCM_SET_CELL_WORD (x, 0, 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_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_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_WORD_3(x, v) SCM_SET_CELL_WORD (x, 3, v)
#define SCM_SET_CELL_OBJECT(x, n, v) \ #define SCM_SET_CELL_OBJECT(x, n, v) \
((SCM_VALIDATE_CELL (x)), \ SCM_VALIDATE_CELL ((x), \
((((scm_bits_t *) SCM2PTR (x)) [n]) = SCM_UNPACK (v))) ((scm_bits_t *) SCM2PTR (x)) [n] = SCM_UNPACK (v))
#define SCM_SET_CELL_OBJECT_0(x, v) SCM_SET_CELL_OBJECT (x, 0, 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_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_2(x, v) SCM_SET_CELL_OBJECT (x, 2, v)