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

yamaken at freedesktop.org yamaken at freedesktop.org
Mon Jan 2 07:14:34 PST 2006


Author: yamaken
Date: 2006-01-02 07:14:29 -0800 (Mon, 02 Jan 2006)
New Revision: 2727

Modified:
   branches/r5rs/sigscheme/sigschemeinternal.h
   branches/r5rs/sigscheme/storage-fatty.h
Log:
* sigscheme/storage-fatty.h
  - (enum ScmStrMutationType, enum ScmStrMutability): Rename
    ScmStrMutationType to ScmStrMutability
  - (SCM_STRING_MUTATION_TYPE_MASK, SCM_STRING_MUTABILITY_MASK):
    Rename SCM_STRING_MUTATION_TYPE_MASK to SCM_STRING_MUTABILITY_MASK
  - (SCM_STRING_MUTATION_TYPE, SCM_STRING_MUTABILITY): Rename
    SCM_STRING_MUTATION_TYPE to SCM_STRING_MUTABILITY
  - (SCM_STRING_STR_VALUE_MASK, SCM_SAL_STRING_SET_STR,
    SCM_SAL_STRING_MUTABLEP): Follow the renaming
* sigscheme/sigschemeinternal.h
  - (ASSERT_MUTABLEP): Fix invalid reference to non-SAL API


Modified: branches/r5rs/sigscheme/sigschemeinternal.h
===================================================================
--- branches/r5rs/sigscheme/sigschemeinternal.h	2006-01-02 14:57:10 UTC (rev 2726)
+++ branches/r5rs/sigscheme/sigschemeinternal.h	2006-01-02 15:14:29 UTC (rev 2727)
@@ -372,11 +372,9 @@
    String Mutation Assertion
 =======================================*/
 /* FIXME: Rename to ENSURE_MUTABLE() */
-#define ASSERT_MUTABLEP(str)                                            \
-    do {                                                                \
-        if (SCM_STRING_MUTATION_TYPE(str) == SCM_STR_IMMUTABLE)         \
-            ERR_OBJ("attempted to modify immutable string", str);       \
-    } while (/* CONSTCOND */ 0)
+#define ASSERT_MUTABLEP(str)                                                 \
+    (SCM_STRING_MUTABLEP(str)                                                \
+     || (ERR_OBJ("attempted to modify immutable string", str), 1))
 
 /*=======================================
    List Constructor

Modified: branches/r5rs/sigscheme/storage-fatty.h
===================================================================
--- branches/r5rs/sigscheme/storage-fatty.h	2006-01-02 14:57:10 UTC (rev 2726)
+++ branches/r5rs/sigscheme/storage-fatty.h	2006-01-02 15:14:29 UTC (rev 2727)
@@ -60,9 +60,9 @@
 /*=======================================
    Struct Declarations
 =======================================*/
-enum ScmStrMutationType {
-    SCM_STR_IMMUTABLE           = 0,
-    SCM_STR_MUTABLE             = 1
+enum ScmStrMutability {
+    SCM_STR_IMMUTABLE = 0,
+    SCM_STR_MUTABLE   = 1
 };
 
 /* Scheme Object */
@@ -223,11 +223,10 @@
 #define SCM_SAL_CHAR_VALUE(a) (SCM_AS_CHAR(a)->obj.ch.value)
 #define SCM_SAL_CHAR_SET_VALUE(a, val) (SCM_CHAR_VALUE(a) = (val))
 
-/* String Object uses tagged pointer for packing mutation type.
- * LSB of ScmCell.obj.string.str is used to represent mutation type
- * (mutable or immutable). */
-#define SCM_STRING_MUTATION_TYPE_MASK  0x1UL
-#define SCM_STRING_STR_VALUE_MASK      ~SCM_STRING_MUTATION_TYPE_MASK
+/* String object uses a tagged pointer to multiplex its mutability.
+ * LSB of ScmCell.obj.string.str represents the value. */
+#define SCM_STRING_MUTABILITY_MASK     0x1UL
+#define SCM_STRING_STR_VALUE_MASK      ~SCM_STRING_MUTABILITY_MASK
 #define SCM_SAL_STRINGP(o)             (SCM_TYPE(o) == ScmString)
 #define SCM_SAL_ENTYPE_STRING(o)       (SCM_ENTYPE((o), ScmString))
 #define SCM_SAL_STRING_STR(o)                                                \
@@ -235,14 +234,14 @@
               & SCM_STRING_STR_VALUE_MASK))
 #define SCM_SAL_STRING_SET_STR(o, val)                                       \
     (SCM_AS_STRING(o)->obj.string.str =                                      \
-     (char *)((unsigned long)(val) | (unsigned)SCM_STRING_MUTATION_TYPE(o)))
+     (char *)((unsigned long)(val) | (unsigned)SCM_STRING_MUTABILITY(o)))
 #define SCM_SAL_STRING_LEN(o)          (SCM_AS_STRING(o)->obj.string.len)
 #define SCM_SAL_STRING_SET_LEN(o, len) (SCM_STRING_LEN(o) = (len))
-#define SCM_STRING_MUTATION_TYPE(o)                                          \
-  ((enum ScmStrMutationType)((unsigned long)SCM_AS_STRING(o)->obj.string.str \
-                             & SCM_STRING_MUTATION_TYPE_MASK))
+#define SCM_STRING_MUTABILITY(o)                                             \
+  ((enum ScmStrMutability)((unsigned long)SCM_AS_STRING(o)->obj.string.str   \
+                           & SCM_STRING_MUTABILITY_MASK))
 #define SCM_SAL_STRING_MUTABLEP(o)                                           \
-    (SCM_STRING_MUTATION_TYPE(o) == SCM_STR_MUTABLE)
+    (SCM_STRING_MUTABILITY(o) == SCM_STR_MUTABLE)
 #define SCM_SAL_STRING_SET_MUTABLE(o)                                        \
     (SCM_AS_STRING(o)->obj.string.str =                                      \
      (char *)((unsigned long)SCM_AS_STRING(o)->obj.string.str                \



More information about the uim-commit mailing list