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

yamaken at freedesktop.org yamaken at freedesktop.org
Mon Jan 2 05:28:13 PST 2006


Author: yamaken
Date: 2006-01-02 05:28:08 -0800 (Mon, 02 Jan 2006)
New Revision: 2724

Modified:
   branches/r5rs/sigscheme/read.c
   branches/r5rs/sigscheme/sigscheme.c
   branches/r5rs/sigscheme/sigschemeinternal.h
Log:
* sigscheme/read.c
  - (read_token): Support multiple Unicode encodings
* sigscheme/sigschemeinternal.h
  - (scm_identifier_codec): New variable decl
* sigscheme/sigscheme.c
  - (scm_identifier_codec): New variable
  - (scm_initialize_internal): Add initialization for scm_identifier_codec


Modified: branches/r5rs/sigscheme/read.c
===================================================================
--- branches/r5rs/sigscheme/read.c	2006-01-02 13:12:56 UTC (rev 2723)
+++ branches/r5rs/sigscheme/read.c	2006-01-02 13:28:08 UTC (rev 2724)
@@ -247,7 +247,9 @@
             codec = scm_port_codec(port);
             if (SCM_CHARCODEC_CCS(codec) != SCM_CCS_UCS4)
                 ERR("non-ASCII char in token on a non-Unicode port: 0x%x", c);
-            p = SCM_CHARCODEC_INT2STR(codec, p, c, SCM_MB_STATELESS);
+            /* canonicalize internal Unicode encoding */
+            p = SCM_CHARCODEC_INT2STR(scm_identifier_codec, p, c,
+                                      SCM_MB_STATELESS);
 #else
             ERR("non-ASCII char in token: 0x%x", c);
 #endif

Modified: branches/r5rs/sigscheme/sigscheme.c
===================================================================
--- branches/r5rs/sigscheme/sigscheme.c	2006-01-02 13:12:56 UTC (rev 2723)
+++ branches/r5rs/sigscheme/sigscheme.c	2006-01-02 13:28:08 UTC (rev 2724)
@@ -42,6 +42,7 @@
 =======================================*/
 #include "sigscheme.h"
 #include "sigschemeinternal.h"
+#include "encoding.h"
 #include "baseport.h"
 #include "strport.h"
 
@@ -64,6 +65,9 @@
 ScmObj scm_sym_unquote, scm_sym_unquote_splicing;
 ScmObj scm_sym_else, scm_sym_yields;
 
+/* canonical internal encoding for identifiers */
+ScmCharCodec *scm_identifier_codec;
+
 static int scm_initialized;
 static ScmObj features;
 
@@ -142,6 +146,9 @@
     scm_init_error();
     scm_init_io();
 
+    /* fallback to unibyte */
+    scm_identifier_codec = scm_mb_find_codec("UTF-8");
+
     /*=======================================================================
       Predefined Symbols and Variables
     =======================================================================*/

Modified: branches/r5rs/sigscheme/sigschemeinternal.h
===================================================================
--- branches/r5rs/sigscheme/sigschemeinternal.h	2006-01-02 13:12:56 UTC (rev 2723)
+++ branches/r5rs/sigscheme/sigschemeinternal.h	2006-01-02 13:28:08 UTC (rev 2724)
@@ -44,6 +44,7 @@
 =======================================*/
 #include "sigscheme.h"
 #include "sigschemefunctable.h"
+#include "encoding.h"
 
 /*=======================================
    Type Definitions
@@ -60,6 +61,7 @@
 =======================================*/
 /* sigscheme.c */
 extern ScmObj scm_sym_else, scm_sym_yields;
+extern ScmCharCodec *scm_identifier_codec;
 
 /* io.c */
 extern ScmObj scm_in;



More information about the uim-commit mailing list