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

yamaken at freedesktop.org yamaken at freedesktop.org
Wed Jan 4 17:31:59 PST 2006


Author: yamaken
Date: 2006-01-04 17:31:55 -0800 (Wed, 04 Jan 2006)
New Revision: 2793

Modified:
   branches/r5rs/sigscheme/storage-fatty.h
Log:
* sigscheme/storage-fatty.h
  - (struct ScmCell_): Add comment about obj.string.len
  - Cosmetic changes


Modified: branches/r5rs/sigscheme/storage-fatty.h
===================================================================
--- branches/r5rs/sigscheme/storage-fatty.h	2006-01-05 01:10:59 UTC (rev 2792)
+++ branches/r5rs/sigscheme/storage-fatty.h	2006-01-05 01:31:55 UTC (rev 2793)
@@ -91,7 +91,7 @@
 
         struct {
             char *str;
-            int len;
+            int len;  /* number of (multibyte) chars */
         } string;
 
         struct {
@@ -160,8 +160,8 @@
 #define SCM_SAL_MAKE_C_FUNCPOINTER            scm_make_cfunc_pointer
 #endif /* SCM_USE_NONSTD_FEATURES */
 #if SCM_USE_VALUECONS
-#define SCM_SAL_MAKE_VALUEPACKET(vals) (NULLP(vals) ? scm_null_values :       \
-                                    (SCM_ENTYPE_VALUEPACKET(vals), (vals)))
+#define SCM_SAL_MAKE_VALUEPACKET(vals)                                       \
+    (NULLP(vals) ? scm_null_values : (SCM_ENTYPE_VALUEPACKET(vals), (vals)))
 #else /* SCM_USE_VALUECONS */
 #define SCM_SAL_MAKE_VALUEPACKET(vals) (scm_make_value_packet(vals))
 #endif /* SCM_USE_VALUECONS */
@@ -193,38 +193,38 @@
    Accessors For Scheme Objects
 =======================================*/
 /* ScmObj Global Attribute */
-#define SCM_SAL_TYPE(o) ((o)->type)
+#define SCM_SAL_TYPE(o)        ((o)->type)
 #define SCM_ENTYPE(a, objtype) ((a)->type = (objtype))
 
 /* Real Accessors */
-#define SCM_SAL_INTP(a)  (SCM_TYPE(a) == ScmInt)
-#define SCM_SAL_ENTYPE_INT(a)    (SCM_ENTYPE((a), ScmInt))
-#define SCM_SAL_INT_VALUE(a) (SCM_AS_INT(a)->obj.integer.value)
-#define SCM_SAL_INT_SET_VALUE(a, val) (SCM_INT_VALUE(a) = (val))
+#define SCM_SAL_INTP(a)                (SCM_TYPE(a) == ScmInt)
+#define SCM_SAL_ENTYPE_INT(a)          (SCM_ENTYPE((a), ScmInt))
+#define SCM_SAL_INT_VALUE(a)           (SCM_AS_INT(a)->obj.integer.value)
+#define SCM_SAL_INT_SET_VALUE(a, val)  (SCM_INT_VALUE(a) = (val))
 
-#define SCM_SAL_CONSP(a) (SCM_TYPE(a) == ScmCons)
-#define SCM_SAL_ENTYPE_CONS(a) (SCM_ENTYPE((a), ScmCons))
+#define SCM_SAL_CONSP(a)               (SCM_TYPE(a) == ScmCons)
+#define SCM_SAL_ENTYPE_CONS(a)         (SCM_ENTYPE((a), ScmCons))
 #if SCM_DEBUG
 /* don't use as lvalue */
-#define SCM_SAL_CONS_CAR(a)               (SCM_AS_CONS(a)->obj.cons.car + 0)
-#define SCM_SAL_CONS_CDR(a)               (SCM_AS_CONS(a)->obj.cons.cdr + 0)
+#define SCM_SAL_CONS_CAR(a)            (SCM_AS_CONS(a)->obj.cons.car + 0)
+#define SCM_SAL_CONS_CDR(a)            (SCM_AS_CONS(a)->obj.cons.cdr + 0)
 #else /* SCM_DEBUG */
-#define SCM_SAL_CONS_CAR(a)               (SCM_AS_CONS(a)->obj.cons.car)
-#define SCM_SAL_CONS_CDR(a)               (SCM_AS_CONS(a)->obj.cons.cdr)
+#define SCM_SAL_CONS_CAR(a)            (SCM_AS_CONS(a)->obj.cons.car)
+#define SCM_SAL_CONS_CDR(a)            (SCM_AS_CONS(a)->obj.cons.cdr)
 #endif /* SCM_DEBUG */
-#define SCM_SAL_CONS_SET_CAR(a, kar) (SCM_AS_CONS(a)->obj.cons.car = (kar))
-#define SCM_SAL_CONS_SET_CDR(a, kdr) (SCM_AS_CONS(a)->obj.cons.cdr = (kdr))
+#define SCM_SAL_CONS_SET_CAR(a, kar)   (SCM_AS_CONS(a)->obj.cons.car = (kar))
+#define SCM_SAL_CONS_SET_CDR(a, kdr)   (SCM_AS_CONS(a)->obj.cons.cdr = (kdr))
 
-#define SCM_SAL_SYMBOLP(a)      (SCM_TYPE(a) == ScmSymbol)
-#define SCM_SAL_ENTYPE_SYMBOL(a)    (SCM_ENTYPE((a), ScmSymbol))
-#define SCM_SAL_SYMBOL_NAME(a)  (SCM_AS_SYMBOL(a)->obj.symbol.name)
-#define SCM_SAL_SYMBOL_SET_NAME(a, _name)   (SCM_SYMBOL_NAME(a) = (_name))
-#define SCM_SAL_SYMBOL_VCELL(a) (SCM_AS_SYMBOL(a)->obj.symbol.value)
+#define SCM_SAL_SYMBOLP(a)             (SCM_TYPE(a) == ScmSymbol)
+#define SCM_SAL_ENTYPE_SYMBOL(a)       (SCM_ENTYPE((a), ScmSymbol))
+#define SCM_SAL_SYMBOL_NAME(a)         (SCM_AS_SYMBOL(a)->obj.symbol.name)
+#define SCM_SAL_SYMBOL_SET_NAME(a, _name)  (SCM_SYMBOL_NAME(a) = (_name))
+#define SCM_SAL_SYMBOL_VCELL(a)        (SCM_AS_SYMBOL(a)->obj.symbol.value)
 #define SCM_SAL_SYMBOL_SET_VCELL(a, vcell) (SCM_SYMBOL_VCELL(a) = (vcell))
 
-#define SCM_SAL_CHARP(a) (SCM_TYPE(a) == ScmChar)
-#define SCM_SAL_ENTYPE_CHAR(a) (SCM_ENTYPE((a), ScmChar))
-#define SCM_SAL_CHAR_VALUE(a) (SCM_AS_CHAR(a)->obj.character.value)
+#define SCM_SAL_CHARP(a)               (SCM_TYPE(a) == ScmChar)
+#define SCM_SAL_ENTYPE_CHAR(a)         (SCM_ENTYPE((a), ScmChar))
+#define SCM_SAL_CHAR_VALUE(a)          (SCM_AS_CHAR(a)->obj.character.value)
 #define SCM_SAL_CHAR_SET_VALUE(a, val) (SCM_CHAR_VALUE(a) = (val))
 
 /* String object uses a tagged pointer to multiplex its mutability.
@@ -253,85 +253,94 @@
     (SCM_AS_STRING(o)->obj.string.str =                                      \
      (char *)((unsigned long)SCM_AS_STRING(o)->obj.string.str | SCM_IMMUTABLE))
 
-#define SCM_SAL_FUNCP(a) (SCM_TYPE(a) == ScmFunc)
-#define SCM_SAL_ENTYPE_FUNC(a)     (SCM_ENTYPE((a), ScmFunc))
-#define SCM_SAL_FUNC_TYPECODE(a) (SCM_AS_FUNC(a)->obj.function.type)
+#define SCM_SAL_FUNCP(a)                   (SCM_TYPE(a) == ScmFunc)
+#define SCM_SAL_ENTYPE_FUNC(a)             (SCM_ENTYPE((a), ScmFunc))
+#define SCM_SAL_FUNC_TYPECODE(a)           (SCM_AS_FUNC(a)->obj.function.type)
 #define SCM_SAL_FUNC_SET_TYPECODE(a, type) (SCM_FUNC_TYPECODE(a) = (type))
-#define SCM_SAL_FUNC_CFUNC(a)   (SCM_AS_FUNC(a)->obj.function.ptr)
-#define SCM_SAL_FUNC_SET_CFUNC(a, func)     (SCM_FUNC_CFUNC(a) = (ScmFuncType)(func))
+#define SCM_SAL_FUNC_CFUNC(a)              (SCM_AS_FUNC(a)->obj.function.ptr)
+#define SCM_SAL_FUNC_SET_CFUNC(a, func)                                      \
+    (SCM_FUNC_CFUNC(a) = (ScmFuncType)(func))
 
-#define SCM_SAL_CLOSUREP(a) (SCM_TYPE(a) == ScmClosure)
-#define SCM_SAL_ENTYPE_CLOSURE(a) (SCM_ENTYPE((a), ScmClosure))
-#define SCM_SAL_CLOSURE_EXP(a) (SCM_AS_CLOSURE(a)->obj.closure.exp)
-#define SCM_SAL_CLOSURE_SET_EXP(a, exp) (SCM_CLOSURE_EXP(a) = (exp))
-#define SCM_SAL_CLOSURE_ENV(a) (SCM_AS_CLOSURE(a)->obj.closure.env)
-#define SCM_SAL_CLOSURE_SET_ENV(a, env) (SCM_CLOSURE_ENV(a) = (env))
+#define SCM_SAL_CLOSUREP(a)               (SCM_TYPE(a) == ScmClosure)
+#define SCM_SAL_ENTYPE_CLOSURE(a)         (SCM_ENTYPE((a), ScmClosure))
+#define SCM_SAL_CLOSURE_EXP(a)            (SCM_AS_CLOSURE(a)->obj.closure.exp)
+#define SCM_SAL_CLOSURE_SET_EXP(a, exp)   (SCM_CLOSURE_EXP(a) = (exp))
+#define SCM_SAL_CLOSURE_ENV(a)            (SCM_AS_CLOSURE(a)->obj.closure.env)
+#define SCM_SAL_CLOSURE_SET_ENV(a, env)   (SCM_CLOSURE_ENV(a) = (env))
 
-#define SCM_SAL_VECTORP(a) (SCM_TYPE(a) == ScmVector)
-#define SCM_SAL_ENTYPE_VECTOR(a) (SCM_ENTYPE((a), ScmVector))
-#define SCM_SAL_VECTOR_VEC(a) (SCM_AS_VECTOR(a)->obj.vector.vec)
-#define SCM_SAL_VECTOR_SET_VEC(a, vec) (SCM_VECTOR_VEC(a) = (vec))
-#define SCM_SAL_VECTOR_LEN(a) (SCM_AS_VECTOR(a)->obj.vector.len)
-#define SCM_SAL_VECTOR_SET_LEN(a, len) (SCM_VECTOR_LEN(a) = (len))
+#define SCM_SAL_VECTORP(a)                (SCM_TYPE(a) == ScmVector)
+#define SCM_SAL_ENTYPE_VECTOR(a)          (SCM_ENTYPE((a), ScmVector))
+#define SCM_SAL_VECTOR_VEC(a)             (SCM_AS_VECTOR(a)->obj.vector.vec)
+#define SCM_SAL_VECTOR_SET_VEC(a, vec)    (SCM_VECTOR_VEC(a) = (vec))
+#define SCM_SAL_VECTOR_LEN(a)             (SCM_AS_VECTOR(a)->obj.vector.len)
+#define SCM_SAL_VECTOR_SET_LEN(a, len)    (SCM_VECTOR_LEN(a) = (len))
 #define SCM_SAL_VECTOR_VALID_INDEXP(o, i) (0 <= (i) && (i) < SCM_VECTOR_LEN(o))
 
-#define SCM_SAL_PORTP(a) (SCM_TYPE(a) == ScmPort)
-#define SCM_SAL_ENTYPE_PORT(a) (SCM_ENTYPE((a), ScmPort))
+#define SCM_SAL_PORTP(a)               (SCM_TYPE(a) == ScmPort)
+#define SCM_SAL_ENTYPE_PORT(a)         (SCM_ENTYPE((a), ScmPort))
 #define SCM_SAL_PORT_FLAG(a)           (SCM_AS_PORT(a)->obj.port.flag)
 #define SCM_SAL_PORT_SET_FLAG(a, flag) (SCM_PORT_FLAG(a) = (flag))
 #define SCM_SAL_PORT_IMPL(a)           (SCM_AS_PORT(a)->obj.port.impl)
 #define SCM_SAL_PORT_SET_IMPL(a, impl) (SCM_PORT_IMPL(a) = (impl))
 
-#define SCM_SAL_CONTINUATIONP(a) (SCM_TYPE(a) == ScmContinuation)
+#define SCM_SAL_CONTINUATIONP(a)       (SCM_TYPE(a) == ScmContinuation)
 #define SCM_SAL_ENTYPE_CONTINUATION(a) (SCM_ENTYPE((a), ScmContinuation))
-#define SCM_SAL_CONTINUATION_OPAQUE(a) (SCM_AS_CONTINUATION(a)->obj.continuation.opaque)
-#define SCM_SAL_CONTINUATION_SET_OPAQUE(a, val) (SCM_CONTINUATION_OPAQUE(a) = (val))
-#define SCM_SAL_CONTINUATION_TAG(a) (SCM_AS_CONTINUATION(a)->obj.continuation.tag)
-#define SCM_SAL_CONTINUATION_SET_TAG(a, val) (SCM_CONTINUATION_TAG(a) = (val))
+#define SCM_SAL_CONTINUATION_OPAQUE(a)                                       \
+    (SCM_AS_CONTINUATION(a)->obj.continuation.opaque)
+#define SCM_SAL_CONTINUATION_SET_OPAQUE(a, val)                              \
+    (SCM_CONTINUATION_OPAQUE(a) = (val))
+#define SCM_SAL_CONTINUATION_TAG(a)                                          \
+    (SCM_AS_CONTINUATION(a)->obj.continuation.tag)
+#define SCM_SAL_CONTINUATION_SET_TAG(a, val)                                 \
+    (SCM_CONTINUATION_TAG(a) = (val))
 
 #if SCM_USE_VALUECONS
 /* to modify a VALUECONS, rewrite its type to cons by SCM_ENTYPE_CONS(vcons) */
-#define SCM_SAL_VALUEPACKETP(a)       (SCM_TYPE(a) == ScmValuePacket)
-#define SCM_SAL_NULLVALUESP(a)        (EQ((a), scm_null_values))
-#define SCM_SAL_ENTYPE_VALUEPACKET(a) (SCM_ENTYPE((a), ScmValuePacket))
-#define SCM_SAL_VALUEPACKET_VALUES(a) ((SCM_NULLVALUESP(a)) ? SCM_NULL :         \
-                                   (SCM_ENTYPE_CONS(a), (a)))
-#define SCM_SAL_VALUECONS_CAR(a)      (SCM_AS_VALUEPACKET(a)->obj.cons.car)
-#define SCM_SAL_VALUECONS_CDR(a)      (SCM_AS_VALUEPACKET(a)->obj.cons.cdr)
+#define SCM_SAL_VALUEPACKETP(a)        (SCM_TYPE(a) == ScmValuePacket)
+#define SCM_SAL_NULLVALUESP(a)         (EQ((a), scm_null_values))
+#define SCM_SAL_ENTYPE_VALUEPACKET(a)  (SCM_ENTYPE((a), ScmValuePacket))
+#define SCM_SAL_VALUEPACKET_VALUES(a)                                        \
+    ((SCM_NULLVALUESP(a)) ? SCM_NULL : (SCM_ENTYPE_CONS(a), (a)))
+#define SCM_SAL_VALUECONS_CAR(a)       (SCM_AS_VALUEPACKET(a)->obj.cons.car)
+#define SCM_SAL_VALUECONS_CDR(a)       (SCM_AS_VALUEPACKET(a)->obj.cons.cdr)
 #else /* SCM_USE_VALUECONS */
-#define SCM_SAL_VALUEPACKETP(a)          (SCM_TYPE(a) == ScmValuePacket)
-#define SCM_SAL_ENTYPE_VALUEPACKET(a)        (SCM_ENTYPE((a), ScmValuePacket))
-#define SCM_SAL_VALUEPACKET_VALUES(a)    (SCM_AS_VALUEPACKET(a)->obj.value_packet.lst)
+#define SCM_SAL_VALUEPACKETP(a)        (SCM_TYPE(a) == ScmValuePacket)
+#define SCM_SAL_ENTYPE_VALUEPACKET(a)  (SCM_ENTYPE((a), ScmValuePacket))
+#define SCM_SAL_VALUEPACKET_VALUES(a)                                        \
+    (SCM_AS_VALUEPACKET(a)->obj.value_packet.lst)
 #define SCM_SAL_VALUEPACKET_SET_VALUES(a, v) (SCM_VALUEPACKET_VALUES(a) = (v))
 #endif /* SCM_USE_VALUECONS */
 
 /*============================================================================
   Special Constants (such as SCM_NULL)
 ============================================================================*/
-#define SCM_SAL_CONSTANTP(a) (SCM_TYPE(a) == ScmConstant)
+#define SCM_SAL_CONSTANTP(a)           (SCM_TYPE(a) == ScmConstant)
 
 /*============================================================================
   C Pointer Object
 ============================================================================*/
-#define SCM_SAL_C_POINTERP(a) (SCM_TYPE(a) == ScmCPointer)
-#define SCM_SAL_ENTYPE_C_POINTER(a) (SCM_ENTYPE((a), ScmCPointer))
-#define SCM_SAL_C_POINTER_VALUE(a) (SCM_AS_C_POINTER(a)->obj.c_pointer.value)
-#define SCM_SAL_C_POINTER_SET_VALUE(a, ptr) (SCM_C_POINTER_VALUE(a) = (ptr))
-
-#define SCM_SAL_C_FUNCPOINTERP(a) (SCM_TYPE(a) == ScmCFuncPointer)
+#define SCM_SAL_C_POINTERP(a)           (SCM_TYPE(a) == ScmCPointer)
+#define SCM_SAL_ENTYPE_C_POINTER(a)     (SCM_ENTYPE((a), ScmCPointer))
+#define SCM_SAL_C_POINTER_VALUE(a)                                           \
+    (SCM_AS_C_POINTER(a)->obj.c_pointer.value)
+#define SCM_SAL_C_POINTER_SET_VALUE(a, ptr)                                  \
+    (SCM_C_POINTER_VALUE(a) = (ptr))
+#define SCM_SAL_C_FUNCPOINTERP(a)       (SCM_TYPE(a) == ScmCFuncPointer)
 #define SCM_SAL_ENTYPE_C_FUNCPOINTER(a) (SCM_ENTYPE((a), ScmCFuncPointer))
-#define SCM_SAL_C_FUNCPOINTER_VALUE(a) (SCM_AS_C_FUNCPOINTER(a)->obj.c_func_pointer.value)
-#define SCM_SAL_C_FUNCPOINTER_SET_VALUE(a, ptr) (SCM_C_FUNCPOINTER_VALUE(a) = (ptr))
+#define SCM_SAL_C_FUNCPOINTER_VALUE(a)                                       \
+    (SCM_AS_C_FUNCPOINTER(a)->obj.c_func_pointer.value)
+#define SCM_SAL_C_FUNCPOINTER_SET_VALUE(a, ptr)                              \
+    (SCM_C_FUNCPOINTER_VALUE(a) = (ptr))
 
 /*============================================================================
   GC Related Operations
 ============================================================================*/
-#define SCM_SAL_FREECELLP(a)            (SCM_TYPE(a) == ScmFreeCell)
-#define SCM_SAL_AS_FREECELL(a)          (SCM_ASSERT_TYPE(SCM_FREECELLP(a), (a)))
-#define SCM_SAL_FREECELL_NEXT(a)         (SCM_AS_FREECELL(a)->obj.cons.car)
-#define SCM_SAL_FREECELL_FREESLOT(a)         (SCM_AS_FREECELL(a)->obj.cons.cdr)
-#define SCM_SAL_ENTYPE_FREECELL(a)      (SCM_ENTYPE((a), ScmFreeCell))
-#define SCM_SAL_FREECELL_SET_NEXT(a, next) (SCM_FREECELL_NEXT(a) = (next))
+#define SCM_SAL_FREECELLP(a)           (SCM_TYPE(a) == ScmFreeCell)
+#define SCM_SAL_AS_FREECELL(a)         (SCM_ASSERT_TYPE(SCM_FREECELLP(a), (a)))
+#define SCM_SAL_FREECELL_NEXT(a)       (SCM_AS_FREECELL(a)->obj.cons.car)
+#define SCM_SAL_FREECELL_FREESLOT(a)   (SCM_AS_FREECELL(a)->obj.cons.cdr)
+#define SCM_SAL_ENTYPE_FREECELL(a)     (SCM_ENTYPE((a), ScmFreeCell))
+#define SCM_SAL_FREECELL_SET_NEXT(a, next)  (SCM_FREECELL_NEXT(a) = (next))
 #define SCM_SAL_FREECELL_SET_FREESLOT(a, v) (SCM_FREECELL_FREESLOT(a) = (v))
 #define SCM_SAL_FREECELL_CLEAR_FREESLOT(o)                                   \
     SCM_SAL_FREECELL_SET_FREESLOT((o), SCM_FALSE)
@@ -385,15 +394,15 @@
 /*============================================================================
   Special Constants and Predicates
 ============================================================================*/
-#define SCM_SAL_INVALID          NULL
-#define SCM_SAL_NULL             scm_const_null
-#define SCM_SAL_TRUE             scm_const_true
-#define SCM_SAL_FALSE            scm_const_false
-#define SCM_SAL_EOF              scm_const_eof
-#define SCM_SAL_UNBOUND          scm_const_unbound
-#define SCM_SAL_UNDEF            scm_const_undef
+#define SCM_SAL_INVALID  NULL
+#define SCM_SAL_NULL     scm_const_null
+#define SCM_SAL_TRUE     scm_const_true
+#define SCM_SAL_FALSE    scm_const_false
+#define SCM_SAL_EOF      scm_const_eof
+#define SCM_SAL_UNBOUND  scm_const_unbound
+#define SCM_SAL_UNDEF    scm_const_undef
 
-#define SCM_SAL_EQ(a, b)   ((a) == (b))
+#define SCM_SAL_EQ(a, b) ((a) == (b))
 
 /* storage.c */
 extern ScmObj scm_const_null, scm_const_true, scm_const_false, scm_const_eof;



More information about the uim-commit mailing list