[uim-commit] r1851 - branches/r5rs/sigscheme

kzk at freedesktop.org kzk at freedesktop.org
Mon Oct 17 01:35:47 PDT 2005


Author: kzk
Date: 2005-10-17 01:35:37 -0700 (Mon, 17 Oct 2005)
New Revision: 1851

Modified:
   branches/r5rs/sigscheme/sigschemetype-compact.h
Log:
* sigscheme/sigschemetype-compact.h
  - implement real accessors for CONS, CLOSURE, SYMBOL, STRING,
    VECTOR and INT. Please check the implementation strategy.


Modified: branches/r5rs/sigscheme/sigschemetype-compact.h
===================================================================
--- branches/r5rs/sigscheme/sigschemetype-compact.h	2005-10-17 07:43:19 UTC (rev 1850)
+++ branches/r5rs/sigscheme/sigschemetype-compact.h	2005-10-17 08:35:37 UTC (rev 1851)
@@ -44,17 +44,17 @@
  *
  * (1) if S == "...00G", S is ConsCell. G-bit of S->X is used as
  *     S->Y's G bit is always set to 0, which helps determine the
- *     finalization semantics without a pointer. 
+ *     finalization semantics without a pointer.
  *
  * (2) if S == "...01G", S is Closure. G-bit of S->X is used as
  *     marking bit of GC.
  *     S->Y's G bit is always set to 0, which helps determine the
- *     finalization semantics without a pointer. 
+ *     finalization semantics without a pointer.
  *
  * (4) if S == "...10G", S is other types. Type is separated by the
  *     value of least n bits of S->Y.
  *     S->Y's G bit is always set to 1, which helps determine the
- *     finalization semantics without a pointer. 
+ *     finalization semantics without a pointer.
  *
  *        S->Y              Type                content of S->Y
  *     .....|00|1 : Symbol              : symbol name
@@ -181,43 +181,45 @@
 #define SCM_TAG_IMM_CONST   0x1e
 #define SCM_TAG_IMM_INVALID 0x1e
 #define SCM_TAG_IMM_UNBOUND 0x3e
-#define SCM_TAG_IMM_TRUE    0x5e
+#define SCM_TAG_IMM_FALSE   0x5e
 #define SCM_TAG_IMM_TRUE    0x7e
 
 /*=======================================
-   Accessors For Scheme Objects
+   GC bit Accessor
 =======================================*/
-/* GC bit Accessor */
-#define SCM_GC_BIT(a)       ((unsigned int)(a) & SCM_GCBIT_MASK)
-#define SCM_DO_MARK(a)      ((a) = (ScmObj)((unsigned int)(a) | SCM_GCBIT_MASK))
-#define SCM_DO_UNMARK(a)    ((a) = (ScmObj)((unsigned int)(a) & ~SCM_GCBIT_MASK))
+#define SCM_GC_BIT(a)       (((unsigned int)(a)) & SCM_GCBIT_MASK)
+#define SCM_DO_MARK(a)      ((a) = (ScmObj)(((unsigned int)(a)) | SCM_GCBIT_MASK))
+#define SCM_DO_UNMARK(a)    ((a) = (ScmObj)(((unsigned int)(a)) & ~SCM_GCBIT_MASK))
 
+/*=======================================
+   Type Predicates
+=======================================*/
 /* Tag Accessor */
-#define SCM_TAG_CONSP(a)      (((unsigned int)(a) & SCM_TAG_MASK) == SCM_TAG_CONS)
-#define SCM_TAG_CLOSUREP(a)   (((unsigned int)(a) & SCM_TAG_MASK) == SCM_TAG_CLOSURE)
-#define SCM_TAG_OTHERSP(a)    (((unsigned int)(a) & SCM_TAG_MASK) == SCM_TAG_OTHERS)
-#define SCM_TAG_IMMEDIATEP(a) (((unsigned int)(a) & SCM_TAG_MASK) == SCM_TAG_IMM)
+#define SCM_TAG_CONSP(a)      ((((unsigned int)(a)) & SCM_TAG_MASK) == SCM_TAG_CONS)
+#define SCM_TAG_CLOSUREP(a)   ((((unsigned int)(a)) & SCM_TAG_MASK) == SCM_TAG_CLOSURE)
+#define SCM_TAG_OTHERSP(a)    ((((unsigned int)(a)) & SCM_TAG_MASK) == SCM_TAG_OTHERS)
+#define SCM_TAG_IMMEDIATEP(a) ((((unsigned int)(a)) & SCM_TAG_MASK) == SCM_TAG_IMM)
 
 /* Tag -> Others */
-#define SCM_TAG_OTHERS_SYMBOLP(a)         (((unsigned int)(a->Y) & SCM_TAG_OTHERS_MASK_SYMBOL) == SCM_TAG_OTHERS_SYMBOL)
-#define SCM_TAG_OTHERS_STRINGP(a)         (((unsigned int)(a->Y) & SCM_TAG_OTHERS_MASK_STRING) == SCM_TAG_OTHERS_STRING)
-#define SCM_TAG_OTHERS_VECTORP(a)         (((unsigned int)(a->Y) & SCM_TAG_OTHERS_MASK_VECTOR) == SCM_TAG_OTHERS_VECTOR))
-#define SCM_TAG_OTHERS_VALUESP(a)         (((unsigned int)(a->Y) & SCM_TAG_OTHERS_MASK_VALUES) == SCM_TAG_OTHERS_VALUES))
-#define SCM_TAG_OTHERS_FUNCP(a)           (((unsigned int)(a->Y) & SCM_TAG_OTHERS_MASK_FUNC) == SCM_TAG_OTHERS_FUNC))
-#define SCM_TAG_OTHERS_PORTP(a)           (((unsigned int)(a->Y) & SCM_TAG_OTHERS_MASK_PORT) == SCM_TAG_OTHERS_PORT))
-#define SCM_TAG_OTHERS_CONTINUATIONP(a)   (((unsigned int)(a->Y) & SCM_TAG_OTHERS_MASK_CONTINUATION) == SCM_TAG_OTHERS_CONTINUATION))
-#define SCM_TAG_OTHERS_C_POINTERP(a)      (((unsigned int)(a->Y) & SCM_TAG_OTHERS_MASK_C_POINTER) == SCM_TAG_OTHERS_C_POINTER))
-#define SCM_TAG_OTHERS_C_FUNC_POINTERP(a) (((unsigned int)(a->Y) & SCM_TAG_OTHERS_MASK_C_POINTER) == SCM_TAG_OTHERS_C_FUNC_POINTER))
-#define SCM_TAG_OTHERS_EOFP(a)            (((unsigned int)(a->Y) & SCM_TAG_OTHERS_MASK_SPECIALCONST) == SCM_TAG_OTHERS_EOF))
-#define SCM_TAG_OTHERS_UNDEFP(a)          (((unsigned int)(a->Y) & SCM_TAG_OTHERS_MASK_SPECIALCONST) == SCM_TAG_OTHERS_UNDEF))
-#define SCM_TAG_OTHERS_FREECELLP(a)       (((unsigned int)(a->Y) & SCM_TAG_OTHERS_MASK_FREECELL) == SCM_TAG_OTHERS_FREECELL))
-                                        
+#define SCM_TAG_OTHERS_SYMBOLP(a)         ((((unsigned int)(a->Y)) & SCM_TAG_OTHERS_MASK_SYMBOL) == SCM_TAG_OTHERS_SYMBOL)
+#define SCM_TAG_OTHERS_STRINGP(a)         ((((unsigned int)(a->Y)) & SCM_TAG_OTHERS_MASK_STRING) == SCM_TAG_OTHERS_STRING)
+#define SCM_TAG_OTHERS_VECTORP(a)         ((((unsigned int)(a->Y)) & SCM_TAG_OTHERS_MASK_VECTOR) == SCM_TAG_OTHERS_VECTOR)
+#define SCM_TAG_OTHERS_VALUESP(a)         ((((unsigned int)(a->Y)) & SCM_TAG_OTHERS_MASK_VALUES) == SCM_TAG_OTHERS_VALUES)
+#define SCM_TAG_OTHERS_FUNCP(a)           ((((unsigned int)(a->Y)) & SCM_TAG_OTHERS_MASK_FUNC) == SCM_TAG_OTHERS_FUNC)
+#define SCM_TAG_OTHERS_PORTP(a)           ((((unsigned int)(a->Y)) & SCM_TAG_OTHERS_MASK_PORT) == SCM_TAG_OTHERS_PORT)
+#define SCM_TAG_OTHERS_CONTINUATIONP(a)   ((((unsigned int)(a->Y)) & SCM_TAG_OTHERS_MASK_CONTINUATION) == SCM_TAG_OTHERS_CONTINUATION)
+#define SCM_TAG_OTHERS_C_POINTERP(a)      ((((unsigned int)(a->Y)) & SCM_TAG_OTHERS_MASK_C_POINTER) == SCM_TAG_OTHERS_C_POINTER)
+#define SCM_TAG_OTHERS_C_FUNC_POINTERP(a) ((((unsigned int)(a->Y)) & SCM_TAG_OTHERS_MASK_C_POINTER) == SCM_TAG_OTHERS_C_FUNC_POINTER)
+#define SCM_TAG_OTHERS_EOFP(a)            ((((unsigned int)(a->Y)) & SCM_TAG_OTHERS_MASK_SPECIALCONST) == SCM_TAG_OTHERS_EOF)
+#define SCM_TAG_OTHERS_UNDEFP(a)          ((((unsigned int)(a->Y)) & SCM_TAG_OTHERS_MASK_SPECIALCONST) == SCM_TAG_OTHERS_UNDEF)
+#define SCM_TAG_OTHERS_FREECELLP(a)       ((((unsigned int)(a->Y)) & SCM_TAG_OTHERS_MASK_FREECELL) == SCM_TAG_OTHERS_FREECELL)
+
 /* Tag -> Imm */
-#define SCM_TAG_IMM_INTP(a)               (((unsigned int)(a) & SCM_TAG_IMM_MASK_INT)   == SCM_TAG_IMM_INT)
-#define SCM_TAG_IMM_CHARP(a)              (((unsigned int)(a) & SCM_TAG_IMM_MASK_CHAR)  == SCM_TAG_IMM_CHAR)
-#define SCM_TAG_IMM_INVALIDP(a)           (((unsigned int)(a) & SCM_TAG_IMM_MASK_CONST) == SCM_TAG_IMM_INVALID)
-#define SCM_TAG_IMM_TRUEP(a)              (((unsigned int)(a) & SCM_TAG_IMM_MASK_CONST) == SCM_TAG_IMM_TRUE)
-#define SCM_TAG_IMM_FALSEP(a)             (((unsigned int)(a) & SCM_TAG_IMM_MASK_CONST) == SCM_TAG_IMM_FALSE)
+#define SCM_TAG_IMM_INTP(a)               ((((unsigned int)(a)) & SCM_TAG_IMM_MASK_INT)   == SCM_TAG_IMM_INT)
+#define SCM_TAG_IMM_CHARP(a)              ((((unsigned int)(a)) & SCM_TAG_IMM_MASK_CHAR)  == SCM_TAG_IMM_CHAR)
+#define SCM_TAG_IMM_INVALIDP(a)           ((((unsigned int)(a)) & SCM_TAG_IMM_MASK_CONST) == SCM_TAG_IMM_INVALID)
+#define SCM_TAG_IMM_FALSEP(a)             ((((unsigned int)(a)) & SCM_TAG_IMM_MASK_CONST) == SCM_TAG_IMM_FALSE)
+#define SCM_TAG_IMM_TRUEP(a)              ((((unsigned int)(a)) & SCM_TAG_IMM_MASK_CONST) == SCM_TAG_IMM_TRUE)
 
 /* Type Predicates */
 #define SCM_CONSP(a)             (SCM_TAG_CONSP(a))
@@ -235,39 +237,44 @@
 #define SCM_INTP(a)              (SCM_TAG_IMM_INTP(a))
 #define SCM_CHARP(a)             (SCM_TAG_IMM_CHARP(a))
 
-/* Type Confirmation */
+/*=======================================
+   Type Confirmation
+=======================================*/
+#define SCM_GET_VALUE(a)         ((ScmObj)(((unsigned int)(a)) & SCM_VALUE_MASK))
 #if SCM_ACCESSOR_ASSERT
-#define SCM_ASSERT_TYPE(cond, x) (SCM_ASSERT(cond), (ScmObj)(((unsigned int)x) & SCM_VALUE_MASK))
+#define SCM_ASSERT_TYPE(cond, a) (SCM_ASSERT(cond), SCM_GET_VALUE((a)))
 #else
-#define SCM_ASSERT_TYPE(cond, x) ((ScmObj)(((unsigned int)x) & SCM_VALUE_MASK))
+#define SCM_ASSERT_TYPE(cond, a) (SCM_GET_VALUE((a)))
 #endif /* SCM_ACCESSOR_ASSERT */
-#define SCM_AS_INT(a)            (SCM_ASSERT_TYPE(SCM_INTP(a),           (a)))
-#define SCM_AS_CONS(a)           (SCM_ASSERT_TYPE(SCM_CONSP(a),          (a)))
-#define SCM_AS_SYMBOL(a)         (SCM_ASSERT_TYPE(SCM_SYMBOLP(a),        (a)))
-#define SCM_AS_CHAR(a)           (SCM_ASSERT_TYPE(SCM_CHARP(a),          (a)))
-#define SCM_AS_STRING(a)         (SCM_ASSERT_TYPE(SCM_STRINGP(a),        (a)))
-#define SCM_AS_FUNC(a)           (SCM_ASSERT_TYPE(SCM_FUNCP(a),          (a)))
-#define SCM_AS_CLOSURE(a)        (SCM_ASSERT_TYPE(SCM_CLOSUREP(a),       (a)))
-#define SCM_AS_VECTOR(a)         (SCM_ASSERT_TYPE(SCM_VECTORP(a),        (a)))
-#define SCM_AS_PORT(a)           (SCM_ASSERT_TYPE(SCM_PORTP(a),          (a)))
-#define SCM_AS_CONTINUATION(a)   (SCM_ASSERT_TYPE(SCM_CONTINUATIONP(a),  (a)))
-#define SCM_AS_VALUEPACKET(a)    (SCM_ASSERT_TYPE(SCM_VALUEPACKETP(a),   (a)))
-#define SCM_AS_C_POINTER(a)      (SCM_ASSERT_TYPE(SCM_C_POINTERP(a),     (a)))
-#define SCM_AS_C_FUNCPOINTER(a)  (SCM_ASSERT_TYPE(SCM_C_FUNCPOINTERP(a), (a)))
+#define SCM_AS_CONS(a)           (SCM_ASSERT_TYPE(SCM_CONSP(SCM_GET_VALUE((a))),          (a)))
+#define SCM_AS_CLOSURE(a)        (SCM_ASSERT_TYPE(SCM_CLOSUREP(SCM_GET_VALUE((a))),       (a)))
+#define SCM_AS_SYMBOL(a)         (SCM_ASSERT_TYPE(SCM_SYMBOLP(SCM_GET_VALUE((a))),        (a)))
+#define SCM_AS_STRING(a)         (SCM_ASSERT_TYPE(SCM_STRINGP(SCM_GET_VALUE((a))),        (a)))
+#define SCM_AS_VECTOR(a)         (SCM_ASSERT_TYPE(SCM_VECTORP(SCM_GET_VALUE((a))),        (a)))
+#define SCM_AS_VALUEPACKET(a)    (SCM_ASSERT_TYPE(SCM_VALUEPACKETP(SCM_GET_VALUE((a))),   (a)))
+#define SCM_AS_FUNC(a)           (SCM_ASSERT_TYPE(SCM_FUNCP(SCM_GET_VALUE((a))),          (a)))
+#define SCM_AS_PORT(a)           (SCM_ASSERT_TYPE(SCM_PORTP(SCM_GET_VALUE((a))),          (a)))
+#define SCM_AS_CONTINUATION(a)   (SCM_ASSERT_TYPE(SCM_CONTINUATIONP(SCM_GET_VALUE((a))),  (a)))
+#define SCM_AS_C_POINTER(a)      (SCM_ASSERT_TYPE(SCM_C_POINTERP(SCM_GET_VALUE((a))),     (a)))
+#define SCM_AS_C_FUNCPOINTER(a)  (SCM_ASSERT_TYPE(SCM_C_FUNCPOINTERP(SCM_GET_VALUE((a))), (a)))
+#define SCM_AS_INT(a)            (SCM_ASSERT_TYPE(SCM_INTP(SCM_GET_VALUE((a))),           (a)))
+#define SCM_AS_CHAR(a)           (SCM_ASSERT_TYPE(SCM_CHARP(SCM_GET_VALUE((a))),          (a)))
 
-/* Entyping Macros */
-#define SCM_ENTYPE_SYMBOL(a)          (a = (ScmObj)((unsigned int)a & (SCM_VALUE_MASK | SCM_TAG_OTHERS_SYMBOL)))
-#define SCM_ENTYPE_STRING(a)          (a = (ScmObj)((unsigned int)a & (SCM_VALUE_MASK | SCM_TAG_OTHERS_STRING)))
-#define SCM_ENTYPE_VECTOR(a)          (a = (ScmObj)((unsigned int)a & (SCM_VALUE_MASK | SCM_TAG_OTHERS_VECTOR)))
-#define SCM_ENTYPE_VALUES(a)          (a = (ScmObj)((unsigned int)a & (SCM_VALUE_MASK | SCM_TAG_OTHERS_VALUES)))
-#define SCM_ENTYPE_FUNC(a)            (a = (ScmObj)((unsigned int)a & (SCM_VALUE_MASK | SCM_TAG_OTHERS_FUNC)))
-#define SCM_ENTYPE_PORT(a)            (a = (ScmObj)((unsigned int)a & (SCM_VALUE_MASK | SCM_TAG_OTHERS_PORT)))
-#define SCM_ENTYPE_CONTINUATION(a)    (a = (ScmObj)((unsigned int)a & (SCM_VALUE_MASK | SCM_TAG_OTHERS_CONTINUATION)))
-#define SCM_ENTYPE_C_POINTER(a)       (a = (ScmObj)((unsigned int)a & (SCM_VALUE_MASK | SCM_TAG_OTHERS_C_POINTER)))
-#define SCM_ENTYPE_C_FUNC_POINTER(a)  (a = (ScmObj)((unsigned int)a & (SCM_VALUE_MASK | SCM_TAG_OTHERS_C_FUNC_POINTERP)))
-#define SCM_ENTYPE_EOF(a)             (a = (ScmObj)((unsigned int)a & (SCM_VALUE_MASK | SCM_TAG_OTHERS_EOF)))
-#define SCM_ENTYPE_UNDEF(a)           (a = (ScmObj)((unsigned int)a & (SCM_VALUE_MASK | SCM_TAG_OTHERS_UNDEF)))
-#define SCM_ENTYPE_FREECELL(a)        (a = (ScmObj)((unsigned int)a & (SCM_VALUE_MASK | SCM_TAG_OTHERS_FREECELL)))
+/*=======================================
+   Entyping Macros
+=======================================*/
+#define SCM_ENTYPE_SYMBOL(a)          (a = (ScmObj)(((unsigned int)(a)) & (SCM_VALUE_MASK | SCM_TAG_OTHERS_SYMBOL)))
+#define SCM_ENTYPE_STRING(a)          (a = (ScmObj)(((unsigned int)(a)) & (SCM_VALUE_MASK | SCM_TAG_OTHERS_STRING)))
+#define SCM_ENTYPE_VECTOR(a)          (a = (ScmObj)(((unsigned int)(a)) & (SCM_VALUE_MASK | SCM_TAG_OTHERS_VECTOR)))
+#define SCM_ENTYPE_VALUES(a)          (a = (ScmObj)(((unsigned int)(a)) & (SCM_VALUE_MASK | SCM_TAG_OTHERS_VALUES)))
+#define SCM_ENTYPE_FUNC(a)            (a = (ScmObj)(((unsigned int)(a)) & (SCM_VALUE_MASK | SCM_TAG_OTHERS_FUNC)))
+#define SCM_ENTYPE_PORT(a)            (a = (ScmObj)(((unsigned int)(a)) & (SCM_VALUE_MASK | SCM_TAG_OTHERS_PORT)))
+#define SCM_ENTYPE_CONTINUATION(a)    (a = (ScmObj)(((unsigned int)(a)) & (SCM_VALUE_MASK | SCM_TAG_OTHERS_CONTINUATION)))
+#define SCM_ENTYPE_C_POINTER(a)       (a = (ScmObj)(((unsigned int)(a)) & (SCM_VALUE_MASK | SCM_TAG_OTHERS_C_POINTER)))
+#define SCM_ENTYPE_C_FUNC_POINTER(a)  (a = (ScmObj)(((unsigned int)(a)) & (SCM_VALUE_MASK | SCM_TAG_OTHERS_C_FUNC_POINTERP)))
+#define SCM_ENTYPE_EOF(a)             (a = (ScmObj)(((unsigned int)(a)) & (SCM_VALUE_MASK | SCM_TAG_OTHERS_EOF)))
+#define SCM_ENTYPE_UNDEF(a)           (a = (ScmObj)(((unsigned int)(a)) & (SCM_VALUE_MASK | SCM_TAG_OTHERS_UNDEF)))
+#define SCM_ENTYPE_FREECELL(a)        (a = (ScmObj)(((unsigned int)(a)) & (SCM_VALUE_MASK | SCM_TAG_OTHERS_FREECELL)))
 #define SCM_ENTYPE_INT(a)             (a = (ScmObj)SCM_TAG_IMM_INT)
 #define SCM_ENTYPE_CHAR(a)            (a = (ScmObj)SCM_TAG_IMM_CHAR)
 #define SCM_ENTYPE_INVALID(a)         (a = (ScmObj)SCM_TAG_IMM_INVALID)
@@ -275,10 +282,47 @@
 #define SCM_ENTYPE_FALSE(a)           (a = (ScmObj)SCM_TAG_IMM_FALSE)
 #define SCM_ENTYPE_TRUE(a)            (a = (ScmObj)SCM_TAG_IMM_TRUE)
 
-/* Real Accessors */
-/*
-#define SCM_INT_VALUE(a)              (((int)SCM_AS_INT(a)) >> 5)
-#define SCM_INT_SET_VALUE(a, val)     ((a) = (ScmObj)(((unsigned int)a & 0x1f) | (val << 5)))
-*/
+/*=======================================
+   Real Accessors
+=======================================*/
+#define SCM_GET_AS_INT(a, offset)            ((int)(((unsigned int)(a)) >> offset))
+#define SCM_GET_AS_PTR(a, mask)              ((void*)(((unsigned int)(a)) & mask))
+#define SCM_GET_AS_STR(a, mask)              ((char*)SCM_GET_AS_PTR(a, mask))
+#define SCM_SET_AS_OBJ(a, b)                 (a = (ScmObj)(((unsigned int)(a)) & SCM_GCBIT_MASK) | (((unsigned int)b) & ~SCM_GCBIT_MASK))
+#define SCM_SET_AS_INT(a, val, offset, mask) (a = (ScmObj)((((unsigned int)(a)) & mask) | (val << offset)))
+#define SCM_SET_AS_PTR(a, val, mask)         (a = (ScmObj)((((unsigned int)(a)) & mask) | val))
+#define SCM_SET_AS_STR(a, val, mask)         (SCM_SET_AS_PTR(a, val, mask))
 
+#define SCM_CAR(a)                     (SCM_AS_CONS(a)->X)
+#define SCM_CDR(a)                     (SCM_AS_CONS(a)->Y)
+#define SCM_CONS_SET_CAR(a, car)       (SCM_SET_AS_OBJ(SCM_CAR(a), car))
+#define SCM_CONS_SET_CDR(a, cdr)       (SCM_SET_AS_OBJ(SCM_CDR(a), cdr))
+#define SCM_CAAR(a)                    (SCM_CAR(SCM_CAR(a)))
+#define SCM_CADR(a)                    (SCM_CAR(SCM_CDR(a)))
+#define SCM_CDAR(a)                    (SCM_CDR(SCM_CAR(a)))
+#define SCM_CDDR(a)                    (SCM_CDR(SCM_CDR(a)))
+
+#define SCM_CLOSURE_EXP(a)             (SCM_AS_CLOSURE(a)->X)
+#define SCM_CLOSURE_ENV(a)             (SCM_AS_CLOSURE(a)->Y)
+#define SCM_CLOSURE_SET_EXP(a, exp)    (SCM_SET_AS_OBJ(SCM_CLOSURE_EXP(a), exp))
+#define SCM_CLOSURE_SET_ENV(a, exp)    (SCM_SET_AS_OBJ(SCM_CLOSURE_EXP(a), env))
+
+#define SCM_SYMBOL_VCELL(a)            (SCM_AS_SYMBOL(a)->X)
+#define SCM_SYMBOL_NAME(a)             (SCM_GET_AS_STR(SCM_AS_SYMBOL(a)->Y, ~SCM_TAG_OTHERS_MASK_SYMBOL))
+#define SCM_SYMBOL_SET_VCELL(a, vcell) (SCM_SET_AS_OBJ(SCM_SYMBOL_VCELL(a), vcell))
+#define SCM_SYMBOL_SET_NAME(a, name)   (SCM_SET_AS_STR(SCM_AS_SYMBOL(a)->Y, name, SCM_TAG_OTHERS_MASK_SYMBOL))
+
+#define SCM_STRING_LEN(a)              (SCM_GET_AS_INT(SCM_AS_STRING(a)->X, SCM_TAG_OTHERS_VALUE_OFFSET_STRING))
+#define SCM_STRING_STR(a)              (SCM_GET_AS_STR(SCM_AS_STRING(a)->Y, ~SCM_TAG_OTHERS_MASK_STRING))
+#define SCM_STRING_SET_LEN(a, len)     (SCM_SET_AS_INT(SCM_AS_STRING(a)->X, len, SCM_TAG_OTHERS_VALUE_OFFSET_STRING, SCM_TAG_OTHERS_MASK_STRING))
+#define SCM_STRING_SET_STR(a, str)     (SCM_SET_AS_STR(SCM_AS_STRING(a)->Y, str, SCM_TAG_OTHERS_MASK_STRING))
+
+#define SCM_VECTOR_VEC(a)              (SCM_GET_AS_PTR(SCM_AS_VECTOR(a)->X, ~SCM_TAG_OTHERS_MASK_VECTOR))
+#define SCM_VECTOR_LEN(a)              (SCM_GET_AS_INT(SCM_AS_VECTOR(a)->Y, SCM_TAG_OTHERS_VALUE_OFFSET_VECTOR))
+#define SCM_VECTOR_SET_VEC(a, vec)     (SCM_SET_AS_PTR(SCM_AS_VECTOR(a)->X, vec, SCM_TAG_OTHERS_MASK_VECTOR))
+#define SCM_VECTOR_SET_LEN(a, len)     (SCM_SET_AS_INT(a, len, SCM_TAG_OTHERS_VALUE_OFFSET_VECTOR, SCM_TAG_OTHERS_MASK_VECTOR))
+
+#define SCM_INT_VALUE(a)               (SCM_GET_AS_INT(a, SCM_TAG_IMM_VALUE_OFFSET_INT))
+#define SCM_INT_SET_VALUE(a, val)      (SCM_SET_AS_INT(a, val, SCM_TAG_IMM_VALUE_OFFSET_INT, SCM_TAG_IMM_MASK_INT))
+
 #endif /* __SIGSCMTYPE_COMPACT_H */



More information about the uim-commit mailing list