diff options
author | Marius Vollmer <mvo@zagadka.de> | 2004-05-06 16:43:14 +0000 |
---|---|---|
committer | Marius Vollmer <mvo@zagadka.de> | 2004-05-06 16:43:14 +0000 |
commit | f5710d53b1a67d7b965701b4b34004b9db1a6813 (patch) | |
tree | e6e4e2a562a827adba4f3c374c1152016dd6b68c | |
parent | 41a2f6fc0c62afeb09bd7fbae4e9eca794c26bbe (diff) |
Use SCM_SMOB_* instead of SCM_CELL_* as appropriate. Use
SCM_SMOB_FLAGS and SCM_SET_SMOB_FLAGS instead of accessing the
zeroth word directly. Use SCM_SMOB_PREDICATE as appropriate.
-rw-r--r-- | libguile/dynl.c | 6 | ||||
-rw-r--r-- | libguile/dynwind.c | 43 | ||||
-rw-r--r-- | libguile/eval.h | 14 | ||||
-rw-r--r-- | libguile/fluids.h | 2 | ||||
-rw-r--r-- | libguile/futures.h | 8 | ||||
-rw-r--r-- | libguile/hashtab.h | 14 | ||||
-rw-r--r-- | libguile/hooks.h | 8 | ||||
-rw-r--r-- | libguile/keywords.h | 4 | ||||
-rw-r--r-- | libguile/macros.c | 20 | ||||
-rw-r--r-- | libguile/macros.h | 6 | ||||
-rw-r--r-- | libguile/mallocs.c | 2 | ||||
-rw-r--r-- | libguile/mallocs.h | 6 | ||||
-rw-r--r-- | libguile/random.h | 4 | ||||
-rw-r--r-- | libguile/regex-posix.h | 4 | ||||
-rw-r--r-- | libguile/root.h | 4 | ||||
-rw-r--r-- | libguile/srcprop.c | 4 | ||||
-rw-r--r-- | libguile/srcprop.h | 22 | ||||
-rw-r--r-- | libguile/threads.h | 16 |
18 files changed, 99 insertions, 88 deletions
diff --git a/libguile/dynl.c b/libguile/dynl.c index f027c20f8..dbb7ae905 100644 --- a/libguile/dynl.c +++ b/libguile/dynl.c @@ -111,9 +111,9 @@ sysdep_dynl_init () scm_t_bits scm_tc16_dynamic_obj; -#define DYNL_FILENAME(x) (SCM_CELL_OBJECT_1 (x)) -#define DYNL_HANDLE(x) ((void *) SCM_CELL_WORD_2 (x)) -#define SET_DYNL_HANDLE(x, v) (SCM_SET_CELL_WORD_2 ((x), (v))) +#define DYNL_FILENAME SCM_SMOB_OBJECT +#define DYNL_HANDLE(x) ((void *) SCM_SMOB_DATA_2 (x)) +#define SET_DYNL_HANDLE(x, v) (SCM_SET_SMOB_DATA_2 ((x), (v))) static SCM diff --git a/libguile/dynwind.c b/libguile/dynwind.c index 28dbb0d45..a4f7c3de5 100644 --- a/libguile/dynwind.c +++ b/libguile/dynwind.c @@ -132,27 +132,28 @@ scm_internal_dynamic_wind (scm_t_guard before, static scm_t_bits tc16_frame; #define FRAME_P(f) SCM_SMOB_PREDICATE (tc16_frame, (f)) -#define FRAME_F_REWINDABLE (1 << 16) -#define FRAME_REWINDABLE_P(f) (SCM_CELL_WORD_0(f) & FRAME_F_REWINDABLE) +#define FRAME_F_REWINDABLE (1 << 0) +#define FRAME_REWINDABLE_P(f) (SCM_SMOB_FLAGS(f) & FRAME_F_REWINDABLE) static scm_t_bits tc16_winder; #define WINDER_P(w) SCM_SMOB_PREDICATE (tc16_winder, (w)) -#define WINDER_PROC(w) ((void (*)(void *))SCM_CELL_WORD_1 (w)) -#define WINDER_DATA(w) ((void *)SCM_CELL_WORD_2 (w)) +#define WINDER_PROC(w) ((void (*)(void *))SCM_SMOB_DATA (w)) +#define WINDER_DATA(w) ((void *)SCM_SMOB_DATA_2 (w)) -#define WINDER_F_EXPLICIT (1 << 16) -#define WINDER_F_REWIND (1 << 17) -#define WINDER_F_MARK (1 << 18) -#define WINDER_EXPLICIT_P(w) (SCM_CELL_WORD_0(w) & WINDER_F_EXPLICIT) -#define WINDER_REWIND_P(w) (SCM_CELL_WORD_0(w) & WINDER_F_REWIND) -#define WINDER_MARK_P(w) (SCM_CELL_WORD_0(w) & WINDER_F_MARK) +#define WINDER_F_EXPLICIT (1 << 0) +#define WINDER_F_REWIND (1 << 1) +#define WINDER_F_MARK (1 << 2) +#define WINDER_EXPLICIT_P(w) (SCM_SMOB_FLAGS(w) & WINDER_F_EXPLICIT) +#define WINDER_REWIND_P(w) (SCM_SMOB_FLAGS(w) & WINDER_F_REWIND) +#define WINDER_MARK_P(w) (SCM_SMOB_FLAGS(w) & WINDER_F_MARK) void scm_frame_begin (scm_t_frame_flags flags) { SCM f; - scm_t_bits fl = ((flags&SCM_F_FRAME_REWINDABLE)? FRAME_F_REWINDABLE : 0); - SCM_NEWSMOB (f, tc16_frame | fl, 0); + SCM_NEWSMOB (f, tc16_frame, 0); + if (flags & SCM_F_FRAME_REWINDABLE) + SCM_SET_SMOB_FLAGS (f, FRAME_F_REWINDABLE); scm_dynwinds = scm_cons (f, scm_dynwinds); } @@ -192,9 +193,9 @@ scm_frame_unwind_handler (void (*proc) (void *), void *data, scm_t_wind_flags flags) { SCM w; - scm_t_bits fl = ((flags&SCM_F_WIND_EXPLICITLY)? WINDER_F_EXPLICIT : 0); - SCM_NEWSMOB2 (w, tc16_winder | fl, - (scm_t_bits) proc, (scm_t_bits) data); + SCM_NEWSMOB2 (w, tc16_winder, (scm_t_bits) proc, (scm_t_bits) data); + if (flags & SCM_F_WIND_EXPLICITLY) + SCM_SET_SMOB_FLAGS (w, WINDER_F_EXPLICIT); scm_dynwinds = scm_cons (w, scm_dynwinds); } @@ -203,8 +204,8 @@ scm_frame_rewind_handler (void (*proc) (void *), void *data, scm_t_wind_flags flags) { SCM w; - SCM_NEWSMOB2 (w, tc16_winder | WINDER_F_REWIND, - (scm_t_bits) proc, (scm_t_bits) data); + SCM_NEWSMOB2 (w, tc16_winder, (scm_t_bits) proc, (scm_t_bits) data); + SCM_SET_SMOB_FLAGS (w, WINDER_F_REWIND); scm_dynwinds = scm_cons (w, scm_dynwinds); if (flags & SCM_F_WIND_EXPLICITLY) proc (data); @@ -216,8 +217,8 @@ scm_frame_unwind_handler_with_scm (void (*proc) (SCM), SCM data, { SCM w; scm_t_bits fl = ((flags&SCM_F_WIND_EXPLICITLY)? WINDER_F_EXPLICIT : 0); - SCM_NEWSMOB2 (w, tc16_winder | fl | WINDER_F_MARK, - (scm_t_bits) proc, SCM_UNPACK (data)); + SCM_NEWSMOB2 (w, tc16_winder, (scm_t_bits) proc, SCM_UNPACK (data)); + SCM_SET_SMOB_FLAGS (w, fl | WINDER_F_MARK); scm_dynwinds = scm_cons (w, scm_dynwinds); } @@ -226,8 +227,8 @@ scm_frame_rewind_handler_with_scm (void (*proc) (SCM), SCM data, scm_t_wind_flags flags) { SCM w; - SCM_NEWSMOB2 (w, tc16_winder | WINDER_F_REWIND | WINDER_F_MARK, - (scm_t_bits) proc, SCM_UNPACK (data)); + SCM_NEWSMOB2 (w, tc16_winder, (scm_t_bits) proc, SCM_UNPACK (data)); + SCM_SET_SMOB_FLAGS (w, WINDER_F_REWIND | WINDER_F_MARK); scm_dynwinds = scm_cons (w, scm_dynwinds); if (flags & SCM_F_WIND_EXPLICITLY) proc (data); diff --git a/libguile/eval.h b/libguile/eval.h index 4269c5a71..5ea3b8fd7 100644 --- a/libguile/eval.h +++ b/libguile/eval.h @@ -66,15 +66,17 @@ SCM_API SCM scm_eval_options_interface (SCM setting); /* {Promises} */ -#define SCM_F_PROMISE_COMPUTED (1L << 16) +#define SCM_F_PROMISE_COMPUTED (1L << 0) #define SCM_PROMISE_COMPUTED_P(promise) \ - (SCM_F_PROMISE_COMPUTED & SCM_CELL_WORD_0 (promise)) + (SCM_F_PROMISE_COMPUTED & SCM_SMOB_FLAGS (promise)) #define SCM_SET_PROMISE_COMPUTED(promise) \ - SCM_SET_CELL_WORD_0 (promise, scm_tc16_promise | SCM_F_PROMISE_COMPUTED) + SCM_SET_SMOB_FLAGS ((promise), SCM_F_PROMISE_COMPUTED) #define SCM_PROMISE_MUTEX(promise) \ - ((scm_t_rec_mutex *) SCM_CELL_WORD_2 (promise)) -#define SCM_PROMISE_DATA SCM_CELL_OBJECT_1 -#define SCM_SET_PROMISE_DATA SCM_SET_CELL_OBJECT_1 + ((scm_t_rec_mutex *) SCM_SMOB_DATA_2 (promise)) +#define SCM_PROMISE_DATA SCM_SMOB_OBJECT +#define SCM_SET_PROMISE_DATA SCM_SET_SMOB_OBJECT + + SCM_API scm_t_bits scm_tc16_promise; diff --git a/libguile/fluids.h b/libguile/fluids.h index cb4fba4bd..0a60bac9e 100644 --- a/libguile/fluids.h +++ b/libguile/fluids.h @@ -50,7 +50,7 @@ SCM_API scm_t_bits scm_tc16_fluid; -#define SCM_FLUIDP(x) (!SCM_IMP (x) && (SCM_CELL_TYPE (x) == scm_tc16_fluid)) +#define SCM_FLUIDP(x) (SCM_SMOB_PREDICATE (scm_tc16_fluid, (x))) #define SCM_FLUID_NUM(x) (SCM_CELL_WORD_1 (x)) /* The fastest way to acces/modify the value of a fluid. These macros diff --git a/libguile/futures.h b/libguile/futures.h index 681b5deec..2654be10e 100644 --- a/libguile/futures.h +++ b/libguile/futures.h @@ -43,7 +43,7 @@ typedef struct scm_t_future { #define SCM_VALIDATE_FUTURE(pos, obj) \ SCM_ASSERT_TYPE (SCM_TYP16_PREDICATE (scm_tc16_future, obj), \ obj, pos, FUNC_NAME, "future"); -#define SCM_FUTURE(future) ((scm_t_future *) SCM_CELL_WORD_2 (future)) +#define SCM_FUTURE(future) ((scm_t_future *) SCM_SMOB_DATA_2 (future)) #define SCM_FUTURE_MUTEX(future) (&SCM_FUTURE (future)->mutex) #define SCM_FUTURE_COND(future) (&SCM_FUTURE (future)->cond) #define SCM_FUTURE_STATUS(future) (SCM_FUTURE (future)->status) @@ -53,9 +53,9 @@ typedef struct scm_t_future { #define SCM_FUTURE_DATA(future) (SCM_FUTURE (future)->data) #define SCM_SET_FUTURE_DATA(future, x) \ do { SCM_FUTURE (future)->data = (x); } while (0) -#define SCM_FUTURE_NEXT SCM_CELL_OBJECT_1 -#define SCM_FUTURE_NEXTLOC(x) ((SCM *) SCM_CELL_WORD_LOC ((x), 1)) -#define SCM_SET_FUTURE_NEXT SCM_SET_CELL_OBJECT_1 +#define SCM_FUTURE_NEXT SCM_SMOB_OBJECT +#define SCM_FUTURE_NEXTLOC SCM_SMOB_OBJECT_LOC +#define SCM_SET_FUTURE_NEXT SCM_SET_SMOB_OBJECT SCM_API scm_t_bits scm_tc16_future; diff --git a/libguile/hashtab.h b/libguile/hashtab.h index 3afc6b29f..2e2c1a4d0 100644 --- a/libguile/hashtab.h +++ b/libguile/hashtab.h @@ -33,15 +33,15 @@ extern scm_t_bits scm_tc16_hashtable; -#define SCM_HASHTABLE_P(x) SCM_TYP16_PREDICATE (scm_tc16_hashtable, x) +#define SCM_HASHTABLE_P(x) SCM_SMOB_PREDICATE (scm_tc16_hashtable, x) #define SCM_VALIDATE_HASHTABLE(pos, arg) \ SCM_MAKE_VALIDATE_MSG (pos, arg, HASHTABLE_P, "hash-table") -#define SCM_HASHTABLE_VECTOR(h) SCM_CELL_OBJECT_1 (h) -#define SCM_SET_HASHTABLE_VECTOR(x, v) SCM_SET_CELL_OBJECT_1 (x, v) -#define SCM_HASHTABLE(x) ((scm_t_hashtable *) SCM_CELL_WORD_2 (x)) -#define SCM_HASHTABLE_NEXT(x) SCM_CELL_OBJECT_3 (x) -#define SCM_HASHTABLE_NEXTLOC(x) ((SCM *) SCM_CELL_WORD_LOC (x, 3)) -#define SCM_SET_HASHTABLE_NEXT(x, n) SCM_SET_CELL_OBJECT_3 (x, n) +#define SCM_HASHTABLE_VECTOR(h) SCM_SMOB_OBJECT (h) +#define SCM_SET_HASHTABLE_VECTOR(x, v) SCM_SET_SMOB_OBJECT ((x), (v)) +#define SCM_HASHTABLE(x) ((scm_t_hashtable *) SCM_SMOB_DATA_2 (x)) +#define SCM_HASHTABLE_NEXT(x) SCM_SMOB_OBJECT_3 (x) +#define SCM_HASHTABLE_NEXTLOC(x) SCM_SMOB_OBJECT_3_LOC (x) +#define SCM_SET_HASHTABLE_NEXT(x, n) SCM_SET_SMOB_OBJECT_3 ((x), (n)) #define SCM_HASHTABLE_FLAGS(x) (SCM_HASHTABLE (x)->flags) #define SCM_HASHTABLE_WEAK_KEY_P(x) \ (SCM_HASHTABLE_FLAGS (x) & SCM_HASHTABLEF_WEAK_CAR) diff --git a/libguile/hooks.h b/libguile/hooks.h index 1b27faa50..25567fe3d 100644 --- a/libguile/hooks.h +++ b/libguile/hooks.h @@ -73,10 +73,10 @@ SCM_API void *scm_c_hook_run (scm_t_c_hook *hook, void *data); SCM_API scm_t_bits scm_tc16_hook; -#define SCM_HOOKP(x) SCM_TYP16_PREDICATE (scm_tc16_hook, x) -#define SCM_HOOK_ARITY(hook) (SCM_CELL_WORD_0 (hook) >> 16) -#define SCM_HOOK_PROCEDURES(hook) SCM_CELL_OBJECT_1 (hook) -#define SCM_SET_HOOK_PROCEDURES(hook, procs) SCM_SET_CELL_OBJECT_1 ((hook), (procs)) +#define SCM_HOOKP(x) SCM_SMOB_PREDICATE (scm_tc16_hook, x) +#define SCM_HOOK_ARITY(hook) SCM_SMOB_FLAGS (hook) +#define SCM_HOOK_PROCEDURES(hook) SCM_SMOB_OBJECT (hook) +#define SCM_SET_HOOK_PROCEDURES(hook, procs) SCM_SET_SMOB_OBJECT ((hook), (procs)) SCM_API SCM scm_make_hook (SCM n_args); SCM_API SCM scm_hook_p (SCM x); diff --git a/libguile/keywords.h b/libguile/keywords.h index ffde0f0a4..b182b5df8 100644 --- a/libguile/keywords.h +++ b/libguile/keywords.h @@ -28,8 +28,8 @@ SCM_API scm_t_bits scm_tc16_keyword; -#define SCM_KEYWORDP(X) (!SCM_IMP (X) && (SCM_CELL_TYPE (X) == scm_tc16_keyword)) -#define SCM_KEYWORDSYM(X) (SCM_CELL_OBJECT_1 (X)) +#define SCM_KEYWORDP(X) (SCM_SMOB_PREDICATE (scm_tc16_keyword, (X))) +#define SCM_KEYWORDSYM(X) (SCM_SMOB_OBJECT (X)) diff --git a/libguile/macros.c b/libguile/macros.c index 32282f19c..bc14784e7 100644 --- a/libguile/macros.c +++ b/libguile/macros.c @@ -77,6 +77,14 @@ macro_print (SCM macro, SCM port, scm_print_state *pstate) return 1; } +static SCM +makmac (SCM code, scm_t_bits flags) +{ + SCM z; + SCM_NEWSMOB (z, scm_tc16_macro, SCM_UNPACK (code)); + SCM_SET_SMOB_FLAGS (z, flags); + return z; +} /* Return a mmacro that is known to be one of guile's built in macros. */ SCM @@ -84,7 +92,7 @@ scm_i_makbimacro (SCM code) #define FUNC_NAME "scm_i_makbimacro" { SCM_VALIDATE_PROC (1, code); - SCM_RETURN_NEWSMOB (scm_tc16_macro | (3L << 16), SCM_UNPACK (code)); + return makmac (code, 3); } #undef FUNC_NAME @@ -102,7 +110,7 @@ SCM_DEFINE (scm_makmmacro, "procedure->memoizing-macro", 1, 0, 0, #define FUNC_NAME s_scm_makmmacro { SCM_VALIDATE_PROC (1, code); - SCM_RETURN_NEWSMOB (scm_tc16_macro | (2L << 16), SCM_UNPACK (code)); + return makmac (code, 2); } #undef FUNC_NAME @@ -116,7 +124,7 @@ SCM_DEFINE (scm_makacro, "procedure->syntax", 1, 0, 0, #define FUNC_NAME s_scm_makacro { SCM_VALIDATE_PROC (1, code); - SCM_RETURN_NEWSMOB (scm_tc16_macro, SCM_UNPACK (code)); + return makmac (code, 0); } #undef FUNC_NAME @@ -144,7 +152,7 @@ SCM_DEFINE (scm_makmacro, "procedure->macro", 1, 0, 0, " or r5rs macros instead."); SCM_VALIDATE_PROC (1, code); - SCM_RETURN_NEWSMOB (scm_tc16_macro | (1L << 16), SCM_UNPACK (code)); + return makmac (code, 1); } #undef FUNC_NAME @@ -157,7 +165,7 @@ SCM_DEFINE (scm_macro_p, "macro?", 1, 0, 0, "syntax transformer.") #define FUNC_NAME s_scm_macro_p { - return SCM_BOOL (SCM_TYP16_PREDICATE (scm_tc16_macro, obj)); + return SCM_BOOL (SCM_SMOB_PREDICATE (scm_tc16_macro, obj)); } #undef FUNC_NAME @@ -178,7 +186,7 @@ SCM_DEFINE (scm_macro_type, "macro-type", 1, 0, 0, "returned.") #define FUNC_NAME s_scm_macro_type { - if (!SCM_TYP16_PREDICATE (scm_tc16_macro, m)) + if (!SCM_SMOB_PREDICATE (scm_tc16_macro, m)) return SCM_BOOL_F; switch (SCM_MACRO_TYPE (m)) { diff --git a/libguile/macros.h b/libguile/macros.h index c53f21038..2ce1f48a0 100644 --- a/libguile/macros.h +++ b/libguile/macros.h @@ -29,10 +29,10 @@ #define SCM_ASSYNT(_cond, _msg, _subr) \ if (!(_cond)) scm_misc_error (_subr, _msg, SCM_EOL); -#define SCM_MACROP(x) SCM_TYP16_PREDICATE (scm_tc16_macro, (x)) -#define SCM_MACRO_TYPE(m) (SCM_CELL_WORD_0 (m) >> 16) +#define SCM_MACROP(x) SCM_SMOB_PREDICATE (scm_tc16_macro, (x)) +#define SCM_MACRO_TYPE(m) SCM_SMOB_FLAGS (m) #define SCM_BUILTIN_MACRO_P(x) (SCM_MACROP (x) && SCM_MACRO_TYPE (x) == 3) -#define SCM_MACRO_CODE(m) SCM_CELL_OBJECT_1 (m) +#define SCM_MACRO_CODE(m) SCM_SMOB_OBJECT (m) SCM_API scm_t_bits scm_tc16_macro; diff --git a/libguile/mallocs.c b/libguile/mallocs.c index a0a1eaedc..c1fe4c9f4 100644 --- a/libguile/mallocs.c +++ b/libguile/mallocs.c @@ -54,7 +54,7 @@ static int malloc_print (SCM exp, SCM port, scm_print_state *pstate SCM_UNUSED) { scm_puts("#<malloc ", port); - scm_intprint (SCM_CELL_WORD_1 (exp), 16, port); + scm_intprint (SCM_SMOB_DATA (exp), 16, port); scm_putc('>', port); return 1; } diff --git a/libguile/mallocs.h b/libguile/mallocs.h index 448c6e109..6e60a155e 100644 --- a/libguile/mallocs.h +++ b/libguile/mallocs.h @@ -27,9 +27,9 @@ SCM_API scm_t_bits scm_tc16_malloc; -#define SCM_MALLOCP(X) (SCM_TYP16 (X) == scm_tc16_malloc) -#define SCM_MALLOCDATA(obj) ((char *) SCM_CELL_WORD_1 (obj)) -#define SCM_SETMALLOCDATA(obj, val) (SCM_SET_CELL_WORD_1 (obj, val)) +#define SCM_MALLOCP(X) (SCM_SMOB_PREDICATE (scm_tc16_malloc, (X))) +#define SCM_MALLOCDATA(obj) ((char *) SCM_SMOB_DATA (obj)) +#define SCM_SETMALLOCDATA(obj, val) (SCM_SET_SMOB_DATA ((obj), (val))) diff --git a/libguile/random.h b/libguile/random.h index f56b493fb..8620c3738 100644 --- a/libguile/random.h +++ b/libguile/random.h @@ -84,8 +84,8 @@ SCM_API SCM scm_c_random_bignum (scm_t_rstate *, SCM m); * Scheme level interface */ SCM_API scm_t_bits scm_tc16_rstate; -#define SCM_RSTATEP(obj) SCM_TYP16_PREDICATE (scm_tc16_rstate, obj) -#define SCM_RSTATE(obj) ((scm_t_rstate *) SCM_CELL_WORD_1 (obj)) +#define SCM_RSTATEP(obj) SCM_SMOB_PREDICATE (scm_tc16_rstate, obj) +#define SCM_RSTATE(obj) ((scm_t_rstate *) SCM_SMOB_DATA (obj)) SCM_API unsigned char scm_masktab[256]; diff --git a/libguile/regex-posix.h b/libguile/regex-posix.h index 213e51aeb..37207503b 100644 --- a/libguile/regex-posix.h +++ b/libguile/regex-posix.h @@ -25,8 +25,8 @@ #include "libguile/__scm.h" SCM_API scm_t_bits scm_tc16_regex; -#define SCM_RGX(X) ((regex_t *) SCM_CELL_WORD_1 (X)) -#define SCM_RGXP(X) (!SCM_IMP (X) && (SCM_CELL_TYPE (X) == scm_tc16_regex)) +#define SCM_RGX(X) ((regex_t *) SCM_SMOB_DATA (X)) +#define SCM_RGXP(X) (SCM_SMOB_PREDICATE (scm_tc16_regex, (X))) SCM_API SCM scm_make_regexp (SCM pat, SCM flags); SCM_API SCM scm_regexp_p (SCM x); diff --git a/libguile/root.h b/libguile/root.h index 6d0e5d38f..a97cf7536 100644 --- a/libguile/root.h +++ b/libguile/root.h @@ -49,8 +49,8 @@ SCM_API SCM scm_sys_protects[]; SCM_API scm_t_bits scm_tc16_root; -#define SCM_ROOTP(obj) SCM_TYP16_PREDICATE (scm_tc16_root, obj) -#define SCM_ROOT_STATE(root) ((scm_root_state *) SCM_CELL_WORD_1 (root)) +#define SCM_ROOTP(obj) SCM_SMOB_PREDICATE (scm_tc16_root, (obj)) +#define SCM_ROOT_STATE(root) ((scm_root_state *) SCM_SMOB_DATA (root)) typedef struct scm_root_state { diff --git a/libguile/srcprop.c b/libguile/srcprop.c index 94b0daedf..7eee11f1c 100644 --- a/libguile/srcprop.c +++ b/libguile/srcprop.c @@ -71,8 +71,8 @@ srcprops_mark (SCM obj) static size_t srcprops_free (SCM obj) { - *((scm_t_srcprops **) SCM_CELL_WORD_1 (obj)) = srcprops_freelist; - srcprops_freelist = (scm_t_srcprops *) SCM_CELL_WORD_1 (obj); + *((scm_t_srcprops **) SCM_SMOB_DATA (obj)) = srcprops_freelist; + srcprops_freelist = (scm_t_srcprops *) SCM_SMOB_DATA (obj); return 0; /* srcprops_chunks are not freed until leaving guile */ } diff --git a/libguile/srcprop.h b/libguile/srcprop.h index 2b9f08fda..bd6918bf4 100644 --- a/libguile/srcprop.h +++ b/libguile/srcprop.h @@ -67,22 +67,22 @@ typedef struct scm_t_srcprops_chunk scm_t_srcprops srcprops[1]; } scm_t_srcprops_chunk; -#define SCM_SOURCE_PROPERTY_FLAG_BREAK (1L << 16) +#define SCM_SOURCE_PROPERTY_FLAG_BREAK 1 -#define SRCPROPSP(p) (SCM_TYP16_PREDICATE (scm_tc16_srcprops, p)) -#define SRCPROPBRK(p) (SCM_CELL_WORD_0 (p) & SCM_SOURCE_PROPERTY_FLAG_BREAK) -#define SRCPROPPOS(p) ((scm_t_srcprops *) SCM_CELL_WORD_1 (p))->pos +#define SRCPROPSP(p) (SCM_SMOB_PREDICATE (scm_tc16_srcprops, (p))) +#define SRCPROPBRK(p) (SCM_SMOB_FLAGS (p) & SCM_SOURCE_PROPERTY_FLAG_BREAK) +#define SRCPROPPOS(p) ((scm_t_srcprops *) SCM_SMOB_DATA (p))->pos #define SRCPROPLINE(p) (SRCPROPPOS(p) >> 12) #define SRCPROPCOL(p) (SRCPROPPOS(p) & 0x0fffL) -#define SRCPROPFNAME(p) ((scm_t_srcprops *) SCM_CELL_WORD_1 (p))->fname -#define SRCPROPCOPY(p) ((scm_t_srcprops *) SCM_CELL_WORD_1 (p))->copy -#define SRCPROPPLIST(p) ((scm_t_srcprops *) SCM_CELL_WORD_1 (p))->plist +#define SRCPROPFNAME(p) ((scm_t_srcprops *) SCM_SMOB_DATA (p))->fname +#define SRCPROPCOPY(p) ((scm_t_srcprops *) SCM_SMOB_DATA (p))->copy +#define SRCPROPPLIST(p) ((scm_t_srcprops *) SCM_SMOB_DATA (p))->plist #define SETSRCPROPBRK(p) \ - (SCM_SET_CELL_WORD_0 ((p), SCM_CELL_WORD_0 (p) \ - | SCM_SOURCE_PROPERTY_FLAG_BREAK)) + (SCM_SET_SMOB_FLAGS ((p), \ + SCM_SMOB_FLAGS (p) | SCM_SOURCE_PROPERTY_FLAG_BREAK)) #define CLEARSRCPROPBRK(p) \ - (SCM_SET_CELL_WORD_0 ((p), SCM_CELL_WORD_0 (p) \ - & ~SCM_SOURCE_PROPERTY_FLAG_BREAK)) + (SCM_SET_SMOB_FLAGS ((p), \ + SCM_SMOB_FLAGS (p) & ~SCM_SOURCE_PROPERTY_FLAG_BREAK)) #define SRCPROPMAKPOS(l, c) (((l) << 12) + (c)) #define SETSRCPROPPOS(p, l, c) (SRCPROPPOS (p) = SRCPROPMAKPOS (l, c)) #define SETSRCPROPLINE(p, l) SETSRCPROPPOS (p, l, SRCPROPCOL (p)) diff --git a/libguile/threads.h b/libguile/threads.h index a1ed5fda0..d81f70335 100644 --- a/libguile/threads.h +++ b/libguile/threads.h @@ -37,16 +37,16 @@ SCM_API scm_t_bits scm_tc16_fair_mutex; SCM_API scm_t_bits scm_tc16_condvar; SCM_API scm_t_bits scm_tc16_fair_condvar; -#define SCM_THREADP(x) SCM_TYP16_PREDICATE (scm_tc16_thread, x) -#define SCM_THREAD_DATA(x) ((scm_thread *) SCM_CELL_WORD_1 (x)) +#define SCM_THREADP(x) SCM_SMOB_PREDICATE (scm_tc16_thread, x) +#define SCM_THREAD_DATA(x) ((scm_thread *) SCM_SMOB_DATA (x)) -#define SCM_MUTEXP(x) SCM_TYP16_PREDICATE (scm_tc16_mutex, x) -#define SCM_FAIR_MUTEX_P(x) SCM_TYP16_PREDICATE (scm_tc16_fair_mutex, x) -#define SCM_MUTEX_DATA(x) ((void *) SCM_CELL_WORD_1 (x)) +#define SCM_MUTEXP(x) SCM_SMOB_PREDICATE (scm_tc16_mutex, x) +#define SCM_FAIR_MUTEX_P(x) SCM_SMOB_PREDICATE (scm_tc16_fair_mutex, x) +#define SCM_MUTEX_DATA(x) ((void *) SCM_SMOB_DATA (x)) -#define SCM_CONDVARP(x) SCM_TYP16_PREDICATE (scm_tc16_condvar, x) -#define SCM_FAIR_CONDVAR_P(x) SCM_TYP16_PREDICATE (scm_tc16_fair_condvar, x) -#define SCM_CONDVAR_DATA(x) ((void *) SCM_CELL_WORD_1 (x)) +#define SCM_CONDVARP(x) SCM_SMOB_PREDICATE (scm_tc16_condvar, x) +#define SCM_FAIR_CONDVAR_P(x) SCM_SMOB_PREDICATE (scm_tc16_fair_condvar, x) +#define SCM_CONDVAR_DATA(x) ((void *) SCM_SMOB_DATA (x)) #define SCM_VALIDATE_THREAD(pos, a) \ SCM_MAKE_VALIDATE_MSG (pos, a, THREADP, "thread") |