[uim-commit] r2883 - branches/r5rs/sigscheme
yamaken at freedesktop.org
yamaken at freedesktop.org
Tue Jan 10 06:31:11 PST 2006
Author: yamaken
Date: 2006-01-10 06:31:06 -0800 (Tue, 10 Jan 2006)
New Revision: 2883
Modified:
branches/r5rs/sigscheme/basecport.c
branches/r5rs/sigscheme/config.h
branches/r5rs/sigscheme/fileport.c
branches/r5rs/sigscheme/main.c
branches/r5rs/sigscheme/mbcport.c
branches/r5rs/sigscheme/nullport.c
branches/r5rs/sigscheme/sbcport.c
branches/r5rs/sigscheme/strport.c
Log:
* sigscheme/main.c
- (repl_loop): Add parse error handling
* sigscheme/fileport.c
- (fileport_byte_readyp): Cause error if the port is based on a pipe
or socket
- Include sigscheme.h
* sigscheme/config.h
- (HAVE_FILENO): New macro
* sigscheme/basecport.c
* sigscheme/strport.c
* sigscheme/nullport.c
* sigscheme/mbcport.c
* sigscheme/sbcport.c
- Include sigscheme.h
Modified: branches/r5rs/sigscheme/basecport.c
===================================================================
--- branches/r5rs/sigscheme/basecport.c 2006-01-10 12:46:23 UTC (rev 2882)
+++ branches/r5rs/sigscheme/basecport.c 2006-01-10 14:31:06 UTC (rev 2883)
@@ -49,6 +49,10 @@
/*=======================================
Local Include
=======================================*/
+/* To override SCM_{CHAR,BYTE}PORT_ERROR() and SCM_PORT_*ALLOC(). Don't depend
+ * on SigScheme-specific things */
+#include "sigscheme.h"
+
#include "baseport.h"
/*=======================================
Modified: branches/r5rs/sigscheme/config.h
===================================================================
--- branches/r5rs/sigscheme/config.h 2006-01-10 12:46:23 UTC (rev 2882)
+++ branches/r5rs/sigscheme/config.h 2006-01-10 14:31:06 UTC (rev 2883)
@@ -123,6 +123,7 @@
* FIXME: detect with configure and link against a replace function if not
* found
*/
+#define HAVE_FILENO 1
#define HAVE_ASPRINTF 1
#define HAVE_VASPRINTF 1
/* FIXME */
Modified: branches/r5rs/sigscheme/fileport.c
===================================================================
--- branches/r5rs/sigscheme/fileport.c 2006-01-10 12:46:23 UTC (rev 2882)
+++ branches/r5rs/sigscheme/fileport.c 2006-01-10 14:31:06 UTC (rev 2883)
@@ -50,6 +50,10 @@
/*=======================================
Local Include
=======================================*/
+/* To override SCM_{CHAR,BYTE}PORT_ERROR() and SCM_PORT_*ALLOC(). Don't depend
+ * on SigScheme-specific things */
+#include "sigscheme.h"
+
#include "baseport.h"
#include "fileport.h"
@@ -217,8 +221,12 @@
static scm_bool
fileport_byte_readyp(ScmFilePort *port)
{
- /* does not support a FILE based on a pipe, or opened by fdopen(3) */
- /* FIXME: support stdin properly */
+ /* FIXME: does not support a FILE based on a pipe, or opened by
+ * fdopen(3) */
+#if HAVE_FILENO
+ if (fileno(port->file) >= 0)
+ SCM_BYTEPORT_ERROR(port, "Bug: ready? operation is not supported on this port");
+#endif
return scm_true;
}
Modified: branches/r5rs/sigscheme/main.c
===================================================================
--- branches/r5rs/sigscheme/main.c 2006-01-10 12:46:23 UTC (rev 2882)
+++ branches/r5rs/sigscheme/main.c 2006-01-10 14:31:06 UTC (rev 2883)
@@ -41,6 +41,7 @@
=======================================*/
#include "sigscheme.h"
#include "sigschemeinternal.h"
+#include "baseport.h"
/*=======================================
File Local Macro Declarations
@@ -93,6 +94,8 @@
static void
repl_loop(void)
{
+ ScmBaseCharPort *cport;
+ ScmBytePort *bport;
ScmObj sexp, result;
#if SCM_USE_SRFI34
ScmObj sym_guard, cond_catch, proc_read, err;
@@ -120,9 +123,21 @@
SCM_INTERACTION_ENV);
if (EOFP(sexp))
break;
- if (EQ(sexp, err))
- continue;
+ /* parse error */
+ if (EQ(sexp, err)) {
+ cport = SCM_CHARPORT_DYNAMIC_CAST(ScmBaseCharPort,
+ SCM_PORT_IMPL(scm_in));
+ if (cport) {
+ bport = cport->bport;
+ /* discard all available input */
+ while (SCM_BYTEPORT_BYTE_READYP(bport))
+ SCM_BYTEPORT_GET_BYTE(bport);
+ continue;
+ }
+ ERR("unrecoverable parse error");
+ }
+
/*
* Error-proof evaluation
*
Modified: branches/r5rs/sigscheme/mbcport.c
===================================================================
--- branches/r5rs/sigscheme/mbcport.c 2006-01-10 12:46:23 UTC (rev 2882)
+++ branches/r5rs/sigscheme/mbcport.c 2006-01-10 14:31:06 UTC (rev 2883)
@@ -48,6 +48,10 @@
/*=======================================
Local Include
=======================================*/
+/* To override SCM_{CHAR,BYTE}PORT_ERROR() and SCM_PORT_*ALLOC(). Don't depend
+ * on SigScheme-specific things */
+#include "sigscheme.h"
+
#include "baseport.h"
#include "encoding.h"
#include "mbcport.h"
Modified: branches/r5rs/sigscheme/nullport.c
===================================================================
--- branches/r5rs/sigscheme/nullport.c 2006-01-10 12:46:23 UTC (rev 2882)
+++ branches/r5rs/sigscheme/nullport.c 2006-01-10 14:31:06 UTC (rev 2883)
@@ -49,6 +49,10 @@
/*=======================================
Local Include
=======================================*/
+/* To override SCM_{CHAR,BYTE}PORT_ERROR() and SCM_PORT_*ALLOC(). Don't depend
+ * on SigScheme-specific things */
+#include "sigscheme.h"
+
#include "baseport.h"
#include "nullport.h"
Modified: branches/r5rs/sigscheme/sbcport.c
===================================================================
--- branches/r5rs/sigscheme/sbcport.c 2006-01-10 12:46:23 UTC (rev 2882)
+++ branches/r5rs/sigscheme/sbcport.c 2006-01-10 14:31:06 UTC (rev 2883)
@@ -47,6 +47,10 @@
/*=======================================
Local Include
=======================================*/
+/* To override SCM_{CHAR,BYTE}PORT_ERROR() and SCM_PORT_*ALLOC(). Don't depend
+ * on SigScheme-specific things */
+#include "sigscheme.h"
+
#include "baseport.h"
#include "sbcport.h"
Modified: branches/r5rs/sigscheme/strport.c
===================================================================
--- branches/r5rs/sigscheme/strport.c 2006-01-10 12:46:23 UTC (rev 2882)
+++ branches/r5rs/sigscheme/strport.c 2006-01-10 14:31:06 UTC (rev 2883)
@@ -49,6 +49,10 @@
/*=======================================
Local Include
=======================================*/
+/* To override SCM_{CHAR,BYTE}PORT_ERROR() and SCM_PORT_*ALLOC(). Don't depend
+ * on SigScheme-specific things */
+#include "sigscheme.h"
+
#include "baseport.h"
#include "strport.h"
More information about the uim-commit
mailing list