[uim-commit] r1896 - branches/r5rs/sigscheme
yamaken at freedesktop.org
yamaken at freedesktop.org
Sun Oct 30 01:56:59 PDT 2005
Author: yamaken
Date: 2005-10-30 01:56:55 -0700 (Sun, 30 Oct 2005)
New Revision: 1896
Modified:
branches/r5rs/sigscheme/baseport.h
branches/r5rs/sigscheme/fileport.c
branches/r5rs/sigscheme/strport.c
Log:
* sigscheme/baseport.h
- (SCM_BYTEPORT_ERROR_INVALID_TYPE,
SCM_BYTEPORT_ERROR_INVALID_OPERATION, SCM_BYTEPORT_ERROR_NOMEM):
Removed
- (SCM_PORT_ERROR_INVALID_TYPE, SCM_PORT_ERROR_INVALID_OPERATION,
SCM_PORT_ERROR_NOMEM): New macro as parametric version of above
one
* sigscheme/strport.c
- (ScmInputStrPort_new, ScmInputStrPort_ref_opaque,
istrport_dyn_cast, istrport_vprintf, istrport_puts,
istrport_write, istrport_flush, ScmOutputStrPort_new,
ScmOutputStrPort_str, ScmOutputStrPort_ref_opaque,
ostrport_dyn_cast, ostrport_get_byte, ostrport_peek_byte,
ostrport_byte_readyp, ostrport_vprintf): Follow the change of the
macro
* sigscheme/fileport.c
- (ScmFilePort_new, fileport_dyn_cast): Ditto
Modified: branches/r5rs/sigscheme/baseport.h
===================================================================
--- branches/r5rs/sigscheme/baseport.h 2005-10-30 08:33:51 UTC (rev 1895)
+++ branches/r5rs/sigscheme/baseport.h 2005-10-30 08:56:55 UTC (rev 1896)
@@ -61,12 +61,12 @@
#define SCM_BYTEPORT_ERROR(bport, msg) (exit(EXIT_FAILURE))
#endif /* SCM_BYTEPORT_ERROR */
-#define SCM_BYTEPORT_ERROR_INVALID_TYPE(bport, type) \
- SCM_BYTEPORT_ERROR(bport, #type ": invalid object is passed to")
-#define SCM_BYTEPORT_ERROR_INVALID_OPERATION(bport, type) \
- SCM_BYTEPORT_ERROR(bport, #type ": invalid operation")
-#define SCM_BYTEPORT_ERROR_NOMEM(bport, type) \
- SCM_BYTEPORT_ERROR(bport, #type ": Out of memory")
+#define SCM_PORT_ERROR_INVALID_TYPE(klass, port, type) \
+ SCM_##klass##PORT_ERROR(port, #type ": invalid object is passed to")
+#define SCM_PORT_ERROR_INVALID_OPERATION(klass, port, type) \
+ SCM_##klass##PORT_ERROR(port, #type ": invalid operation")
+#define SCM_PORT_ERROR_NOMEM(klass, port, type) \
+ SCM_##klass##PORT_ERROR(port, #type ": Out of memory")
/*
* To allow safe method invocation (contains from subclasses), all non-standard
Modified: branches/r5rs/sigscheme/fileport.c
===================================================================
--- branches/r5rs/sigscheme/fileport.c 2005-10-30 08:33:51 UTC (rev 1895)
+++ branches/r5rs/sigscheme/fileport.c 2005-10-30 08:56:55 UTC (rev 1896)
@@ -119,7 +119,7 @@
port = malloc(sizeof(ScmFilePort));
if (!port)
- SCM_BYTEPORT_ERROR_NOMEM(NULL, ScmFilePort);
+ SCM_PORT_ERROR_NOMEM(BYTE, NULL, ScmFilePort);
port->vptr = ScmFilePort_vptr;
port->file = file;
@@ -131,7 +131,7 @@
fileport_dyn_cast(ScmBytePort *bport, const ScmBytePortVTbl *dst_vptr)
{
if (dst_vptr != ScmFilePort_vptr)
- SCM_BYTEPORT_ERROR_INVALID_TYPE(bport, ScmBytePort);
+ SCM_PORT_ERROR_INVALID_TYPE(BYTE, bport, ScmBytePort);
return bport;
}
Modified: branches/r5rs/sigscheme/strport.c
===================================================================
--- branches/r5rs/sigscheme/strport.c 2005-10-30 08:33:51 UTC (rev 1895)
+++ branches/r5rs/sigscheme/strport.c 2005-10-30 08:56:55 UTC (rev 1896)
@@ -164,7 +164,7 @@
port = malloc(sizeof(ScmInputStrPort));
if (!port)
- SCM_BYTEPORT_ERROR_NOMEM(NULL, ScmInputStrPort);
+ SCM_PORT_ERROR_NOMEM(BYTE, NULL, ScmInputStrPort);
port->vptr = ScmInputStrPort_vptr;
port->cur = port->str = str;
@@ -187,7 +187,7 @@
port = SCM_PORT_DYNAMIC_CAST(ScmInputStrPort, bport);
if (!port)
- SCM_BYTEPORT_ERROR_INVALID_TYPE(bport, ScmInputStrPort);
+ SCM_PORT_ERROR_INVALID_TYPE(BYTE, bport, ScmInputStrPort);
return &port->opaque;
}
@@ -196,7 +196,7 @@
istrport_dyn_cast(ScmBytePort *bport, const ScmBytePortVTbl *dst_vptr)
{
if (dst_vptr != ScmInputStrPort_vptr)
- SCM_BYTEPORT_ERROR_INVALID_TYPE(bport, ScmInputStrPort);
+ SCM_PORT_ERROR_INVALID_TYPE(BYTE, bport, ScmInputStrPort);
return bport;
}
@@ -232,25 +232,25 @@
static int
istrport_vprintf(ScmInputStrPort *port, const char *str, va_list args)
{
- SCM_BYTEPORT_ERROR_INVALID_OPERATION(port, ScmInputStrPort);
+ SCM_PORT_ERROR_INVALID_OPERATION(BYTE, port, ScmInputStrPort);
}
static int
istrport_puts(ScmInputStrPort *port, const char *str)
{
- SCM_BYTEPORT_ERROR_INVALID_OPERATION(port, ScmInputStrPort);
+ SCM_PORT_ERROR_INVALID_OPERATION(BYTE, port, ScmInputStrPort);
}
static size_t
istrport_write(ScmInputStrPort *port, size_t nbytes, const char *buf)
{
- SCM_BYTEPORT_ERROR_INVALID_OPERATION(port, ScmInputStrPort);
+ SCM_PORT_ERROR_INVALID_OPERATION(BYTE, port, ScmInputStrPort);
}
static int
istrport_flush(ScmInputStrPort *port)
{
- SCM_BYTEPORT_ERROR_INVALID_OPERATION(port, ScmInputStrPort);
+ SCM_PORT_ERROR_INVALID_OPERATION(BYTE, port, ScmInputStrPort);
}
@@ -261,7 +261,7 @@
port = malloc(sizeof(ScmOutputStrPort));
if (!port)
- SCM_BYTEPORT_ERROR_NOMEM(NULL, ScmOutputStrPort);
+ SCM_PORT_ERROR_NOMEM(BYTE, NULL, ScmOutputStrPort);
port->vptr = ScmOutputStrPort_vptr;
port->str = NULL;
@@ -280,7 +280,7 @@
port = SCM_PORT_DYNAMIC_CAST(ScmOutputStrPort, bport);
if (!port)
- SCM_BYTEPORT_ERROR_INVALID_TYPE(bport, ScmOutputStrPort);
+ SCM_PORT_ERROR_INVALID_TYPE(BYTE, bport, ScmOutputStrPort);
return port->str;
}
@@ -292,7 +292,7 @@
port = SCM_PORT_DYNAMIC_CAST(ScmOutputStrPort, bport);
if (!port)
- SCM_BYTEPORT_ERROR_INVALID_TYPE(bport, ScmOutputStrPort);
+ SCM_PORT_ERROR_INVALID_TYPE(BYTE, bport, ScmOutputStrPort);
return &port->opaque;
}
@@ -301,7 +301,7 @@
ostrport_dyn_cast(ScmBytePort *bport, const ScmBytePortVTbl *dst_vptr)
{
if (dst_vptr != ScmOutputStrPort_vptr)
- SCM_BYTEPORT_ERROR_INVALID_TYPE(bport, ScmOutputStrPort);
+ SCM_PORT_ERROR_INVALID_TYPE(BYTE, bport, ScmOutputStrPort);
return bport;
}
@@ -318,19 +318,19 @@
static int
ostrport_get_byte(ScmOutputStrPort *port)
{
- SCM_BYTEPORT_ERROR_INVALID_OPERATION(port, ScmOutputStrPort);
+ SCM_PORT_ERROR_INVALID_OPERATION(BYTE, port, ScmOutputStrPort);
}
static int
ostrport_peek_byte(ScmOutputStrPort *port)
{
- SCM_BYTEPORT_ERROR_INVALID_OPERATION(port, ScmOutputStrPort);
+ SCM_PORT_ERROR_INVALID_OPERATION(BYTE, port, ScmOutputStrPort);
}
static int
ostrport_byte_readyp(ScmOutputStrPort *port)
{
- SCM_BYTEPORT_ERROR_INVALID_OPERATION(port, ScmOutputStrPort);
+ SCM_PORT_ERROR_INVALID_OPERATION(BYTE, port, ScmOutputStrPort);
}
static int
@@ -342,7 +342,7 @@
len = vasprintf(&appendix, str, args);
if (!appendix)
- SCM_BYTEPORT_ERROR_NOMEM(port, ScmOutputStrPort);
+ SCM_PORT_ERROR_NOMEM(BYTE, port, ScmOutputStrPort);
if (0 < len)
ostrport_append(port, len, appendix);
free(appendix);
@@ -384,7 +384,7 @@
port->buf_size += len;
new_str = realloc(port->str, port->buf_size);
if (!new_str)
- SCM_BYTEPORT_ERROR_NOMEM(NULL, ScmOutputStrPort);
+ SCM_PORT_ERROR_NOMEM(BYTE, NULL, ScmOutputStrPort);
port->str = new_str;
}
More information about the uim-commit
mailing list