diff options
author | Greg J. Badros <gjb@cs.washington.edu> | 2000-03-09 18:58:58 +0000 |
---|---|---|
committer | Greg J. Badros <gjb@cs.washington.edu> | 2000-03-09 18:58:58 +0000 |
commit | c209c88e54d08a557a297836200e16e20355df02 (patch) | |
tree | dce0d672bc0a63be5f658c65269c9a4144da1c67 /libguile/arbiters.c | |
parent | df8bb2dc3988d24c0f64bd2cc5fa01a31825d11a (diff) | |
download | guile-c209c88e54d08a557a297836200e16e20355df02.tar.gz |
*.[ch]: make a distinction between SCM as a generic
name for a Scheme object (now a void*), and SCM as 32 bit word for
storing tags and immediates (now a long int). Introduced
SCM_ASWORD and SCM_ASSCM for conversion. Fixed various dubious
code in the process: arbiter.c (use macros), unif.c (scm_array_p),
Diffstat (limited to 'libguile/arbiters.c')
-rw-r--r-- | libguile/arbiters.c | 14 |
1 files changed, 9 insertions, 5 deletions
diff --git a/libguile/arbiters.c b/libguile/arbiters.c index a121950c1..b3eeb1f30 100644 --- a/libguile/arbiters.c +++ b/libguile/arbiters.c @@ -63,11 +63,15 @@ static long scm_tc16_arbiter; +#define SCM_ARB_LOCKED(arb) (((SCMWORD) SCM_CAR(arb)) & (1L << 16)) +#define SCM_LOCK_ARB(arb) SCM_SETCAR (arb, (SCM) (scm_tc16_arbiter | (1L << 16))); +#define SCM_UNLOCK_ARB(arb) SCM_SETCAR (arb, (SCM) scm_tc16_arbiter); + static int prinarb (SCM exp, SCM port, scm_print_state *pstate) { scm_puts ("#<arbiter ", port); - if (SCM_CAR (exp) & (1L << 16)) + if (SCM_ARB_LOCKED (exp)) scm_puts ("locked ", port); scm_iprin1 (SCM_CDR (exp), port, pstate); scm_putc ('>', port); @@ -91,11 +95,11 @@ SCM_DEFINE (scm_try_arbiter, "try-arbiter", 1, 0, 0, { SCM_VALIDATE_SMOB (1,arb,arbiter); SCM_DEFER_INTS; - if (SCM_CAR (arb) & (1L << 16)) + if (SCM_ARB_LOCKED(arb)) arb = SCM_BOOL_F; else { - SCM_SETCAR (arb, scm_tc16_arbiter | (1L << 16)); + SCM_LOCK_ARB(arb); arb = SCM_BOOL_T; } SCM_ALLOW_INTS; @@ -110,9 +114,9 @@ SCM_DEFINE (scm_release_arbiter, "release-arbiter", 1, 0, 0, #define FUNC_NAME s_scm_release_arbiter { SCM_VALIDATE_SMOB (1,arb,arbiter); - if (!(SCM_CAR (arb) & (1L << 16))) + if (! SCM_ARB_LOCKED(arb)) return SCM_BOOL_F; - SCM_SETCAR (arb, scm_tc16_arbiter); + SCM_UNLOCK_ARB (arb); return SCM_BOOL_T; } #undef FUNC_NAME |