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

yamaken at freedesktop.org yamaken at freedesktop.org
Mon Jan 2 04:10:38 PST 2006


Author: yamaken
Date: 2006-01-02 04:10:33 -0800 (Mon, 02 Jan 2006)
New Revision: 2721

Modified:
   branches/r5rs/sigscheme/TODO
   branches/r5rs/sigscheme/operations.c
   branches/r5rs/sigscheme/sigschemeinternal.h
Log:
* sigscheme/sigschemeinternal.h
  - (ENSURE_STATEFUL_CODEC, ENSURE_STATELESS_CODEC): Fix broken exp
* sigscheme/operations.c
  - (scm_p_string_ref): Support stateful encoding
  - (scm_p_string_append): Add FIXME comment about stateful encoding
  - (scm_p_string_setd, scm_p_string_filld): Reject stateful encoding
* sigscheme/TODO
  - Update


Modified: branches/r5rs/sigscheme/TODO
===================================================================
--- branches/r5rs/sigscheme/TODO	2006-01-02 12:00:57 UTC (rev 2720)
+++ branches/r5rs/sigscheme/TODO	2006-01-02 12:10:33 UTC (rev 2721)
@@ -99,9 +99,6 @@
 * Add charcodec_char_len() interface to codec and simplify string operations
   with it (also used for validation)
 
-* Remove stateful encoding support from most string operations (i.e. make such
-  encodings dedicated to stream operations)
-
 * Add codec retrieval interface to character port, and use it in port-related
   operations
 

Modified: branches/r5rs/sigscheme/operations.c
===================================================================
--- branches/r5rs/sigscheme/operations.c	2006-01-02 12:00:57 UTC (rev 2720)
+++ branches/r5rs/sigscheme/operations.c	2006-01-02 12:10:33 UTC (rev 2721)
@@ -1265,9 +1265,8 @@
     SCM_MBS_SET_SIZE(mbs, strlen(SCM_STRING_STR(str)));
     mbs = scm_mb_strref(mbs, c_index);
 
-    /* FIXME: support stateful encoding */
     ch = SCM_CHARCODEC_STR2INT(scm_current_char_codec, SCM_MBS_GET_STR(mbs),
-                               SCM_MBS_GET_SIZE(mbs), SCM_MB_STATELESS);
+                               SCM_MBS_GET_SIZE(mbs), SCM_MBS_GET_STATE(mbs));
     if (ch == EOF)
         ERR("string-ref: invalid char sequence");
 
@@ -1289,6 +1288,7 @@
     const char *next;
     DECLARE_FUNCTION("string-set!", procedure_fixed_3);
 
+    ENSURE_STATELESS_CODEC(scm_current_char_codec);
     ASSERT_STRINGP(str);
     ASSERT_MUTABLEP(str);
     ASSERT_INTP(k);
@@ -1307,7 +1307,6 @@
     SCM_MBS_SET_SIZE(mbs, strlen(string_str));
     mbs = scm_mb_strref(mbs, c_start_index);
 
-    /* FIXME: support stateful encoding */
     next = SCM_CHARCODEC_INT2STR(scm_current_char_codec, new_ch_str,
                                  SCM_CHAR_VALUE(ch), SCM_MB_STATELESS);
     if (!next)
@@ -1389,6 +1388,7 @@
     return MAKE_STRING(new_str);
 }
 
+/* FIXME: support stateful encoding */
 ScmObj
 scm_p_string_append(ScmObj args)
 {
@@ -1508,6 +1508,7 @@
     const char *next;
     DECLARE_FUNCTION("string-fill!", procedure_fixed_2);
 
+    ENSURE_STATELESS_CODEC(scm_current_char_codec);
     ASSERT_STRINGP(str);
     ASSERT_MUTABLEP(str);
     ASSERT_CHARP(ch);
@@ -1516,7 +1517,6 @@
     if (str_len == 0)
         return MAKE_STRING_COPYING("");
 
-    /* FIXME: support stateful encoding */
     next = SCM_CHARCODEC_INT2STR(scm_current_char_codec, ch_str,
                                  SCM_CHAR_VALUE(ch), SCM_MB_STATELESS);
     if (!next)

Modified: branches/r5rs/sigscheme/sigschemeinternal.h
===================================================================
--- branches/r5rs/sigscheme/sigschemeinternal.h	2006-01-02 12:00:57 UTC (rev 2720)
+++ branches/r5rs/sigscheme/sigschemeinternal.h	2006-01-02 12:10:33 UTC (rev 2721)
@@ -347,12 +347,12 @@
 
 #define ENSURE_STATEFUL_CODEC(codec)                                         \
     (SCM_CHARCODEC_STATEFULP(codec)                                          \
-     || ERR("%s: stateful character codec required but got: %s",             \
-            SCM_MANGLE(name), SCM_CHARCODEC_ENCODING(codec)))
+     || (ERR("%s: stateful character codec required but got: %s",            \
+             SCM_MANGLE(name), SCM_CHARCODEC_ENCODING(codec)), 0))
 #define ENSURE_STATELESS_CODEC(codec)                                        \
     (!SCM_CHARCODEC_STATEFULP(codec)                                         \
-     || ERR("%s: stateless character codec required but got: %s",            \
-            SCM_MANGLE(name), SCM_CHARCODEC_ENCODING(codec)))
+     || (ERR("%s: stateless character codec required but got: %s",           \
+             SCM_MANGLE(name), SCM_CHARCODEC_ENCODING(codec)), 0))
 
 /* Macros For Handling Continuation Object */
 #define INVALID_CONTINUATION_OPAQUE  NULL



More information about the uim-commit mailing list