1
Fork 0
mirror of https://git.savannah.gnu.org/git/guile.git synced 2025-04-30 03:40:34 +02:00

* smob.h (SCM_SMOB_DATA_2, SCM_SMOB_DATA_3, SCM_SMOB_FLAGS,

SCM_SET_SMOB_DATA_2, SCM_SET_SMOB_DATA_3, SCM_SET_SMOB_FLAGS,
SCM_SMOB_OBJECT, SCM_SMOB_OBJECT_2, SCM_SMOB_OBJECT_3,
SCM_SET_SMOB_OBJECT, SCM_SET_SMOB_OBJECT_2, SCM_SET_SMOB_OBJECT_3,
SCM_SMOB_OBJECT_LOC, SCM_SMOB_OBJECT_2_LOC,
SCM_SMOB_OBJECT_3_LOC): New.
* smob.c (scm_i_set_smob_flags): New function.
This commit is contained in:
Marius Vollmer 2004-05-06 16:41:27 +00:00
parent 33c527ec83
commit 37fc18ae73
2 changed files with 27 additions and 0 deletions

View file

@ -47,6 +47,14 @@
long scm_numsmob; long scm_numsmob;
scm_smob_descriptor scm_smobs[MAX_SMOB_COUNT]; scm_smob_descriptor scm_smobs[MAX_SMOB_COUNT];
/* Lower 16 bit of data must be zero.
*/
void
scm_i_set_smob_flags (SCM x, scm_t_bits data)
{
SCM_SET_CELL_WORD_0 (x, (SCM_CELL_WORD_0 (x) & 0xFFFF) | data);
}
/* {Mark} /* {Mark}
*/ */

View file

@ -81,8 +81,25 @@ do { \
} while (0) } while (0)
#define SCM_SMOB_FLAGS(x) (SCM_CELL_WORD_0 (x) >> 16)
#define SCM_SMOB_DATA(x) (SCM_CELL_WORD_1 (x)) #define SCM_SMOB_DATA(x) (SCM_CELL_WORD_1 (x))
#define SCM_SMOB_DATA_2(x) (SCM_CELL_WORD_2 (x))
#define SCM_SMOB_DATA_3(x) (SCM_CELL_WORD_3 (x))
#define SCM_SET_SMOB_DATA(x, data) (SCM_SET_CELL_WORD_1 ((x), (data))) #define SCM_SET_SMOB_DATA(x, data) (SCM_SET_CELL_WORD_1 ((x), (data)))
#define SCM_SET_SMOB_DATA_2(x, data) (SCM_SET_CELL_WORD_2 ((x), (data)))
#define SCM_SET_SMOB_DATA_3(x, data) (SCM_SET_CELL_WORD_3 ((x), (data)))
#define SCM_SET_SMOB_FLAGS(x, data) (scm_i_set_smob_flags((x),(data)<<16))
#define SCM_SMOB_OBJECT(x) (SCM_CELL_OBJECT_1 (x))
#define SCM_SMOB_OBJECT_2(x) (SCM_CELL_OBJECT_2 (x))
#define SCM_SMOB_OBJECT_3(x) (SCM_CELL_OBJECT_3 (x))
#define SCM_SET_SMOB_OBJECT(x,obj) (SCM_SET_CELL_OBJECT_1 ((x), (obj)))
#define SCM_SET_SMOB_OBJECT_2(x,obj) (SCM_SET_CELL_OBJECT_2 ((x), (obj)))
#define SCM_SET_SMOB_OBJECT_3(x,obj) (SCM_SET_CELL_OBJECT_3 ((x), (obj)))
#define SCM_SMOB_OBJECT_LOC(x) (SCM_CELL_OBJECT_LOC ((x), 1))
#define SCM_SMOB_OBJECT_2_LOC(x) (SCM_CELL_OBJECT_LOC ((x), 2))
#define SCM_SMOB_OBJECT_3_LOC(x) (SCM_CELL_OBJECT_LOC ((x), 3))
#define SCM_TC2SMOBNUM(x) (0x0ff & ((x) >> 8)) #define SCM_TC2SMOBNUM(x) (0x0ff & ((x) >> 8))
#define SCM_SMOBNUM(x) (SCM_TC2SMOBNUM (SCM_CELL_TYPE (x))) #define SCM_SMOBNUM(x) (SCM_TC2SMOBNUM (SCM_CELL_TYPE (x)))
/* SCM_SMOBNAME can be 0 if name is missing */ /* SCM_SMOBNAME can be 0 if name is missing */
@ -98,6 +115,8 @@ do { \
SCM_API long scm_numsmob; SCM_API long scm_numsmob;
SCM_API scm_smob_descriptor scm_smobs[]; SCM_API scm_smob_descriptor scm_smobs[];
SCM_API void scm_i_set_smob_flags (SCM x, scm_t_bits data);
SCM_API SCM scm_mark0 (SCM ptr); SCM_API SCM scm_mark0 (SCM ptr);