[uim-commit] r2715 - branches/r5rs/sigscheme
yamaken at freedesktop.org
yamaken at freedesktop.org
Mon Jan 2 00:34:41 PST 2006
Author: yamaken
Date: 2006-01-02 00:34:38 -0800 (Mon, 02 Jan 2006)
New Revision: 2715
Modified:
branches/r5rs/sigscheme/basecport.c
branches/r5rs/sigscheme/baseport.h
branches/r5rs/sigscheme/mbcport.c
branches/r5rs/sigscheme/sbcport.c
Log:
* sigscheme/baseport.h
- (SCM_CHARPORT_ENCODING): Removed
- (SCM_CHARPORT_CODEC, SCM_CHARPORT_CCS): New macro
- (SCM_CHARPORT_ENCODING): Follow the API change
- (ScmCharPortMethod_encoding): Removed
- (ScmCharPortMethod_codec): New type
- (struct ScmCharPortVTbl_):
* Remove member 'encoding'
* Add new member 'codec'
* sigscheme/basecport.c
- (basecport_encoding): Removed
- (basecport_codec): New function
- (ScmBaseCharPort_vtbl): Follow the specification change of struct
ScmCharPortVTbl_
* sigscheme/sbcport.c
- (codec): New static variable
- (sbcport_encoding): Removed
- (sbcport_codec): New function
- (scm_sbcport_init): Follow the API change
* sigscheme/mbcport.c
- (mbcport_encoding): Removed
- (mbcport_codec): New function
- (scm_mbcport_init): Follow the API change
Modified: branches/r5rs/sigscheme/basecport.c
===================================================================
--- branches/r5rs/sigscheme/basecport.c 2006-01-02 07:36:30 UTC (rev 2714)
+++ branches/r5rs/sigscheme/basecport.c 2006-01-02 08:34:38 UTC (rev 2715)
@@ -65,7 +65,7 @@
static ScmCharPort *basecport_dyn_cast(ScmCharPort *cport,
const ScmCharPortVTbl *dst_vptr);
static int basecport_close(ScmBaseCharPort *port);
-static const char *basecport_encoding(ScmBaseCharPort *port);
+static ScmCharCodec *basecport_codec(ScmBaseCharPort *port);
static char *basecport_inspect(ScmBaseCharPort *port);
static int basecport_get_char(ScmBaseCharPort *port);
static int basecport_peek_char(ScmBaseCharPort *port);
@@ -82,7 +82,7 @@
static const ScmCharPortVTbl ScmBaseCharPort_vtbl = {
(ScmCharPortMethod_dyn_cast) &basecport_dyn_cast,
(ScmCharPortMethod_close) &basecport_close,
- (ScmCharPortMethod_encoding) &basecport_encoding,
+ (ScmCharPortMethod_codec) &basecport_codec,
(ScmCharPortMethod_inspect) &basecport_inspect,
(ScmCharPortMethod_get_char) &basecport_get_char,
(ScmCharPortMethod_peek_char) &basecport_peek_char,
@@ -151,8 +151,8 @@
return err;
}
-static const char *
-basecport_encoding(ScmBaseCharPort *port)
+static ScmCharCodec *
+basecport_codec(ScmBaseCharPort *port)
{
SCM_PORT_ERROR_INVALID_OPERATION(CHAR, port, ScmBaseCharPort);
/* NOTREACHED */
Modified: branches/r5rs/sigscheme/baseport.h
===================================================================
--- branches/r5rs/sigscheme/baseport.h 2006-01-02 07:36:30 UTC (rev 2714)
+++ branches/r5rs/sigscheme/baseport.h 2006-01-02 08:34:38 UTC (rev 2715)
@@ -49,6 +49,7 @@
/*=======================================
Local Include
=======================================*/
+#include "encoding.h"
/*=======================================
Macro Definitions
@@ -102,7 +103,11 @@
((type *)(*(obj)->vptr->dyn_cast)((obj), type##_vptr))
#define SCM_CHARPORT_CLOSE(cport) ((*(cport)->vptr->close)(cport))
-#define SCM_CHARPORT_ENCODING(cport) ((*(cport)->vptr->encoding)(cport))
+#define SCM_CHARPORT_CODEC(cport) ((*(cport)->vptr->codec)(cport))
+#define SCM_CHARPORT_ENCODING(cport) \
+ (SCM_CHARCODEC_ENCODING(SCM_CHARPORT_CODEC(cport)))
+#define SCM_CHARPORT_CCS(cport) \
+ (SCM_CHARCODEC_CCS(SCM_CHARPORT_CODEC(cport)))
#define SCM_CHARPORT_INSPECT(cport) ((*(cport)->vptr->inspect)(cport))
#define SCM_CHARPORT_GET_CHAR(cport) ((*(cport)->vptr->get_char)(cport))
#define SCM_CHARPORT_PEEK_CHAR(cport) ((*(cport)->vptr->peek_char)(cport))
@@ -142,8 +147,7 @@
*/
typedef ScmCharPort *(*ScmCharPortMethod_dyn_cast)(ScmCharPort *cport, const ScmCharPortVTbl *dst_vptr);
typedef int (*ScmCharPortMethod_close)(ScmCharPort *cport);
-/* returns "UTF-8", "eucJP" and so on */
-typedef const char *(*ScmCharPortMethod_encoding)(ScmCharPort *cport);
+typedef ScmCharCodec *(*ScmCharPortMethod_codec)(ScmCharPort *cport);
/* returns brief information */
typedef char *(*ScmCharPortMethod_inspect)(ScmCharPort *cport);
@@ -162,7 +166,7 @@
struct ScmCharPortVTbl_ {
ScmCharPortMethod_dyn_cast dyn_cast;
ScmCharPortMethod_close close;
- ScmCharPortMethod_encoding encoding;
+ ScmCharPortMethod_codec codec;
ScmCharPortMethod_inspect inspect;
ScmCharPortMethod_get_char get_char;
ScmCharPortMethod_peek_char peek_char;
Modified: branches/r5rs/sigscheme/mbcport.c
===================================================================
--- branches/r5rs/sigscheme/mbcport.c 2006-01-02 07:36:30 UTC (rev 2714)
+++ branches/r5rs/sigscheme/mbcport.c 2006-01-02 08:34:38 UTC (rev 2715)
@@ -82,7 +82,7 @@
=======================================*/
static ScmCharPort *mbcport_dyn_cast(ScmCharPort *cport,
const ScmCharPortVTbl *dst_vptr);
-static const char *mbcport_encoding(ScmMultiByteCharPort *port);
+static ScmCharCodec *mbcport_codec(ScmMultiByteCharPort *port);
static char *mbcport_inspect(ScmMultiByteCharPort *port);
static int mbcport_get_char(ScmMultiByteCharPort *port);
static int mbcport_peek_char(ScmMultiByteCharPort *port);
@@ -110,7 +110,7 @@
vptr = &ScmMultiByteCharPort_vtbl;
vptr->dyn_cast = (ScmCharPortMethod_dyn_cast)&mbcport_dyn_cast;
- vptr->encoding = (ScmCharPortMethod_encoding)&mbcport_encoding;
+ vptr->codec = (ScmCharPortMethod_codec)&mbcport_codec;
vptr->inspect = (ScmCharPortMethod_inspect)&mbcport_inspect;
vptr->get_char = (ScmCharPortMethod_get_char)&mbcport_get_char;
vptr->peek_char = (ScmCharPortMethod_peek_char)&mbcport_peek_char;
@@ -162,10 +162,10 @@
|| dst_vptr == ScmMultiByteCharPort_vptr) ? cport : NULL;
}
-static const char *
-mbcport_encoding(ScmMultiByteCharPort *port)
+static ScmCharCodec *
+mbcport_codec(ScmMultiByteCharPort *port)
{
- return SCM_CHARCODEC_ENCODING(port->codec);
+ return port->codec;
}
static char *
Modified: branches/r5rs/sigscheme/sbcport.c
===================================================================
--- branches/r5rs/sigscheme/sbcport.c 2006-01-02 07:36:30 UTC (rev 2714)
+++ branches/r5rs/sigscheme/sbcport.c 2006-01-02 08:34:38 UTC (rev 2715)
@@ -68,7 +68,7 @@
=======================================*/
static ScmCharPort *sbcport_dyn_cast(ScmCharPort *cport,
const ScmCharPortVTbl *dst_vptr);
-static const char *sbcport_encoding(ScmSingleByteCharPort *port);
+static ScmCharCodec *sbcport_codec(ScmSingleByteCharPort *port);
static char *sbcport_inspect(ScmSingleByteCharPort *port);
static int sbcport_put_char(ScmSingleByteCharPort *port, int ch);
@@ -78,6 +78,8 @@
static ScmCharPortVTbl ScmSingleByteCharPort_vtbl;
const ScmCharPortVTbl *ScmSingleByteCharPort_vptr = &ScmSingleByteCharPort_vtbl;
+static ScmCharCodec *codec;
+
/*=======================================
Function Implementations
=======================================*/
@@ -90,9 +92,11 @@
vptr = &ScmSingleByteCharPort_vtbl;
vptr->dyn_cast = (ScmCharPortMethod_dyn_cast)&sbcport_dyn_cast;
- vptr->encoding = (ScmCharPortMethod_encoding)&sbcport_encoding;
+ vptr->codec = (ScmCharPortMethod_codec)&sbcport_codec;
vptr->inspect = (ScmCharPortMethod_inspect)&sbcport_inspect;
vptr->put_char = (ScmCharPortMethod_put_char)&sbcport_put_char;
+
+ codec = scm_mb_find_codec("ISO-8859-1");
}
void
@@ -121,10 +125,10 @@
|| dst_vptr == ScmSingleByteCharPort_vptr) ? cport : NULL;
}
-static const char *
-sbcport_encoding(ScmSingleByteCharPort *port)
+static ScmCharCodec *
+sbcport_codec(ScmSingleByteCharPort *port)
{
- return "US-ASCII";
+ return codec;
}
static char *
More information about the uim-commit
mailing list