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

yamaken at freedesktop.org yamaken at freedesktop.org
Sat Oct 29 23:20:17 PDT 2005


Author: yamaken
Date: 2005-10-29 23:20:13 -0700 (Sat, 29 Oct 2005)
New Revision: 1891

Modified:
   branches/r5rs/sigscheme/baseport.h
   branches/r5rs/sigscheme/fileport.c
Log:
* sigscheme/baseport.h
  - (SCM_BYTEPORT_ERROR_INVALID_TYPE,
    SCM_BYTEPORT_ERROR_INVALID_OPERATION): New macro
* sigscheme/fileport.c
  - (fileport_dyn_cast): Simplify with the macro


Modified: branches/r5rs/sigscheme/baseport.h
===================================================================
--- branches/r5rs/sigscheme/baseport.h	2005-10-30 06:03:01 UTC (rev 1890)
+++ branches/r5rs/sigscheme/baseport.h	2005-10-30 06:20:13 UTC (rev 1891)
@@ -61,6 +61,11 @@
 #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, "invalid object is passed to a " #type " method")
+#define SCM_BYTEPORT_ERROR_INVALID_OPERATION(bport, type)                    \
+    SCM_BYTEPORT_ERROR(bport, "invalid operation for " #type)
+
 /*
  * To allow safe method invocation (contains from subclasses), all non-standard
  * method must call SCM_PORT_DYNAMIC_CAST() explicitly.

Modified: branches/r5rs/sigscheme/fileport.c
===================================================================
--- branches/r5rs/sigscheme/fileport.c	2005-10-30 06:03:01 UTC (rev 1890)
+++ branches/r5rs/sigscheme/fileport.c	2005-10-30 06:20:13 UTC (rev 1891)
@@ -121,7 +121,7 @@
 fileport_dyn_cast(ScmBytePort *bport, const ScmBytePortVTbl *dst_vptr)
 {
     if (dst_vptr != ScmFilePort_vptr)
-        SCM_BYTEPORT_ERROR(bport, "invalid object is passed to a ScmFilePort method");
+        SCM_BYTEPORT_ERROR_INVALID_TYPE(bport, ScmBytePort);
 
     return bport;
 }



More information about the uim-commit mailing list