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

yamaken at freedesktop.org yamaken at freedesktop.org
Mon Oct 31 20:48:05 PST 2005


Author: yamaken
Date: 2005-10-31 20:48:02 -0800 (Mon, 31 Oct 2005)
New Revision: 1913

Modified:
   branches/r5rs/sigscheme/sigschemetype-compact.h
Log:
* This comit ports the new abstract port implementation from
  r1911. Completely not tested.

* sigscheme/sigschemetype.h
  - (struct _ScmPortInfo, ScmPortInfo, enum ScmPortDirection, enum
    ScmPortType): Disable when SCM_USE_NEWPORT
  - (enum ScmPortFlag): New type
  - (SCM_PORT_FLAG, SCM_PORT_SET_FLAG, SCM_PORT_IMPL,
    SCM_PORT_SET_IMPL): New macro
  - (SCM_PORT_LINE): Define as dummy when SCM_USE_NEWPORT
  - (SCM_PORT_PORTDIRECTION, SCM_PORT_SET_PORTDIRECTION,
    SCM_PORT_PORTINFO, SCM_PORT_SET_PORTINFO, SCM_PORT_PORTTYPE,
    SCM_PORT_SET_PORTTYPE, SCM_PORT_UNGOTTENCHAR,
    SCM_PORT_SET_UNGOTTENCHAR, SCM_PORT_GETC_FUNC,
    SCM_PORT_SET_GETC_FUNC, SCM_PORT_PRINT_FUNC,
    SCM_PORT_SET_PRINT_FUNC, SCM_PORT_FILE, SCM_PORT_SET_FILE,
    SCM_PORT_FILENAME, SCM_PORT_SET_FILENAME, SCM_PORT_SET_LINE,
    SCM_PORT_STR, SCM_PORT_SET_STR, SCM_PORT_STR_CURRENTPOS,
    SCM_PORT_SET_STR_CURRENTPOS): Disable when SCM_USE_NEWPORT


Modified: branches/r5rs/sigscheme/sigschemetype-compact.h
===================================================================
--- branches/r5rs/sigscheme/sigschemetype-compact.h	2005-11-01 04:34:15 UTC (rev 1912)
+++ branches/r5rs/sigscheme/sigschemetype-compact.h	2005-11-01 04:48:02 UTC (rev 1913)
@@ -104,7 +104,9 @@
 typedef struct ScmCell_ ScmCell;
 typedef ScmCell *ScmObj;
 typedef ScmObj *ScmRef;
+#if !SCM_USE_NEWPORT
 typedef struct _ScmPortInfo ScmPortInfo;
+#endif
 typedef struct ScmEvalState_ ScmEvalState;
 typedef ScmObj (*ScmFuncType)();
 
@@ -128,6 +130,21 @@
     ScmObj cdr;
 };
 
+#if SCM_USE_NEWPORT
+enum ScmPortFlag {
+    SCM_PORTFLAG_NONE        = 0,
+    SCM_PORTFLAG_OUTPUT      = 1 << 0,
+    SCM_PORTFLAG_INPUT       = 1 << 1,
+    SCM_PORTFLAG_LIVE_OUTPUT = 1 << 2,
+    SCM_PORTFLAG_LIVE_INPUT  = 1 << 3,
+
+    SCM_PORTFLAG_DIR_MASK = (SCM_PORTFLAG_OUTPUT | SCM_PORTFLAG_INPUT),
+    SCM_PORTFLAG_ALIVENESS_MASK = (SCM_PORTFLAG_LIVE_OUTPUT
+                                   | SCM_PORTFLAG_LIVE_INPUT)
+};
+
+#else /* SCM_USE_NEWPORT */
+
 /* ScmPort direction */
 enum ScmPortDirection {
     PORT_INPUT  = 0,
@@ -161,6 +178,7 @@
     void (*print_func) (ScmObj port, const char* str);    
     int ungottenchar;
 };
+#endif /* SCM_USE_NEWPORT */
 
 /*
  * Function types:
@@ -476,6 +494,13 @@
 #define SCM_FUNC_SET_CFUNC(a, fptr)    (SCM_SET_VALUE_AS_PTR(SCM_AS_FUNC(a)->car, fptr, SCM_TAG_OTHERS_FUNC))
 #define SCM_FUNC_SET_TYPECODE(a, code) (SCM_SET_VALUE_AS_INT(SCM_AS_FUNC(a)->cdr, code, SCM_TAG_OTHERS_VALUE_OFFSET_FUNC, SCM_TAG_OTHERS_FUNC))
 
+#if SCM_USE_NEWPORT
+#define SCM_PORT_IMPL(a)                    (SCM_GET_VALUE_AS_PTR(SCM_AS_PORT(a)->car, ~SCM_TAG_OTHERS_MASK_PORT))
+#define SCM_PORT_FLAG(a)                    (SCM_GET_VALUE_AS_INT(SCM_AS_PORT(a)->cdr, SCM_TAG_OTHERS_VALUE_OFFSET_PORT))
+#define SCM_PORT_SET_IMPL(a, impl)          (SCM_SET_VALUE_AS_PTR(SCM_AS_PORT(a)->car, impl, SCM_TAG_OTHERS_PORT))
+#define SCM_PORT_SET_FLAG(a, flag)          (SCM_SET_VALUE_AS_INT(SCM_AS_PORT(a)->cdr, flag, SCM_TAG_OTHERS_VALUE_OFFSET_PORT, SCM_TAG_OTHERS_PORT))
+#define SCM_PORT_LINE(a)           (0)
+#else /* SCM_USE_NEWPORT */
 #define SCM_PORT_PORTINFO(a)                (SCM_GET_VALUE_AS_PTR(SCM_AS_PORT(a)->car, ~SCM_TAG_OTHERS_MASK_PORT))
 #define SCM_PORT_PORTDIRECTION(a)           (SCM_GET_VALUE_AS_INT(SCM_AS_PORT(a)->cdr, SCM_TAG_OTHERS_VALUE_OFFSET_PORT))
 #define SCM_PORT_SET_PORTINFO(a, info)      (SCM_SET_VALUE_AS_PTR(SCM_AS_PORT(a)->car, info, SCM_TAG_OTHERS_PORT))
@@ -501,6 +526,7 @@
 #define SCM_PORT_SET_STR(a, str)            (SCM_PORT_STR(a) = str)
 #define SCM_PORT_STR_CURRENTPOS(a)          (SCM_PORT_PORTINFO(a)->info.str_port.str_currentpos)
 #define SCM_PORT_SET_STR_CURRENTPOS(a, pos) (SCM_PORT_STR_CURRENTPOS(a) = pos)
+#endif /* SCM_USE_NEWPORT */
 
 #define SCM_CONTINUATION_ENV(a)             (SCM_GET_VALUE_AS_PTR(a, ~SCM_TAG_OTHERS_MASK_CONTINUATION))
 #define SCM_CONTINUATION_JMPENV(a)          (SCM_CONTINUATION_ENV(a)->jmpenv)



More information about the uim-commit mailing list