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

yamaken at freedesktop.org yamaken at freedesktop.org
Mon Jan 2 01:21:04 PST 2006


Author: yamaken
Date: 2006-01-02 01:21:00 -0800 (Mon, 02 Jan 2006)
New Revision: 2716

Modified:
   branches/r5rs/sigscheme/encoding.c
   branches/r5rs/sigscheme/encoding.h
Log:
* sigscheme/encoding.h
  - (SCM_CHARCODEC_STATEFULP): New macro
  - (ScmCharCodecMethod_statefulp): New type
  - (struct ScmCharCodecVTbl_): Add new member 'statefulp'
* sigscheme/encoding.c
  - (pred_always_true, pred_always_false): New static function
  - (utf8_codec, eucjp_codec, euccn_codec, euckr_codec, sjis_codec,
    unibyte_codec): Add pred_always_false as statefulp


Modified: branches/r5rs/sigscheme/encoding.c
===================================================================
--- branches/r5rs/sigscheme/encoding.c	2006-01-02 08:34:38 UTC (rev 2715)
+++ branches/r5rs/sigscheme/encoding.c	2006-01-02 09:21:00 UTC (rev 2716)
@@ -65,6 +65,9 @@
 /*=======================================
   File Local Functions
 =======================================*/
+static int pred_always_true(void);
+static int pred_always_false(void);
+
 #if SCM_USE_EUCJP
 static const char *eucjp_encoding(void);
 static enum ScmCodedCharSet eucjp_ccs(void);
@@ -138,6 +141,7 @@
 =======================================*/
 #if SCM_USE_UTF8
 static const ScmCharCodecVTbl utf8_codec_vtbl = {
+    &pred_always_false,
     &utf8_encoding,
     &utf8_ccs,
     &utf8_char_len,
@@ -150,6 +154,7 @@
 
 #if SCM_USE_EUCCN
 static const ScmCharCodecVTbl euccn_codec_vtbl = {
+    &pred_always_false,
     &euccn_encoding,
     &euccn_ccs,
     &euc_char_len,
@@ -162,6 +167,7 @@
 
 #if SCM_USE_EUCJP
 static const ScmCharCodecVTbl eucjp_codec_vtbl = {
+    &pred_always_false,
     &eucjp_encoding,
     &eucjp_ccs,
     &eucjp_char_len,
@@ -174,6 +180,7 @@
 
 #if SCM_USE_EUCKR
 static const ScmCharCodecVTbl euckr_codec_vtbl = {
+    &pred_always_false,
     &euckr_encoding,
     &euckr_ccs,
     &euc_char_len,
@@ -186,6 +193,7 @@
 
 #if SCM_USE_SJIS
 static const ScmCharCodecVTbl sjis_codec_vtbl = {
+    &pred_always_false,
     &sjis_encoding,
     &sjis_ccs,
     &sjis_char_len,
@@ -197,6 +205,7 @@
 #endif
 
 static const ScmCharCodecVTbl unibyte_codec_vtbl = {
+    &pred_always_false,
     &unibyte_encoding,
     &unibyte_ccs,
     &unibyte_char_len,
@@ -323,6 +332,18 @@
   Encoding-specific functions
 =======================================*/
 
+static int
+pred_always_true(void)
+{
+    return 1;
+}
+
+static int
+pred_always_false(void)
+{
+    return 0;
+}
+
 /* Every encoding implements the <encoding name>_scan_char()
  * primitive.  Its job is to determine the length of the first
  * character in the given string.  Stateful encodings should save

Modified: branches/r5rs/sigscheme/encoding.h
===================================================================
--- branches/r5rs/sigscheme/encoding.h	2006-01-02 08:34:38 UTC (rev 2715)
+++ branches/r5rs/sigscheme/encoding.h	2006-01-02 09:21:00 UTC (rev 2716)
@@ -90,6 +90,7 @@
                       SCM_MBS_GET_SIZE(mbs) - SCM_MBCINFO_GET_SIZE(inf)),     \
      SCM_MBS_SET_STATE((mbs), SCM_MBCINFO_GET_STATE(inf)))
 
+#define SCM_CHARCODEC_STATEFULP(codec)          ((*(codec)->statefulp)())
 #define SCM_CHARCODEC_ENCODING(codec)           ((*(codec)->encoding)())
 #define SCM_CHARCODEC_CCS(codec)                ((*(codec)->ccs)())
 #define SCM_CHARCODEC_CHAR_LEN(codec, ch)       ((*(codec)->char_len)(ch))
@@ -143,6 +144,7 @@
 typedef struct ScmCharCodecVTbl_ ScmCharCodecVTbl;
 typedef const ScmCharCodecVTbl ScmCharCodec;
 
+typedef int (*ScmCharCodecMethod_statefulp)(void);
 /* FIXME: replace (char *) with (uchar *) once C99-independent stdint is
    introduced */
 typedef const char *(*ScmCharCodecMethod_encoding)(void);
@@ -155,6 +157,7 @@
                                             ScmMultibyteState state);
 
 struct ScmCharCodecVTbl_ {
+    ScmCharCodecMethod_statefulp statefulp;
     ScmCharCodecMethod_encoding  encoding;
     ScmCharCodecMethod_ccs       ccs;
     ScmCharCodecMethod_char_len  char_len;



More information about the uim-commit mailing list