[uim-commit] r1956 - branches/r5rs/sigscheme
yamaken at freedesktop.org
yamaken at freedesktop.org
Thu Nov 3 02:37:23 PST 2005
Author: yamaken
Date: 2005-11-03 02:37:10 -0800 (Thu, 03 Nov 2005)
New Revision: 1956
Modified:
branches/r5rs/sigscheme/config.h
branches/r5rs/sigscheme/error.c
branches/r5rs/sigscheme/main.c
branches/r5rs/sigscheme/sbcport.c
branches/r5rs/sigscheme/sigschemeinternal.h
Log:
* sigscheme/config.h
- (SCM_NEWLINE_STR): New macro
* sigscheme/sigschemeinternal.h
- (SigScm_PortNewline): New function decl
* sigscheme/error.c
- (SigScm_PortNewline): New function
- (SigScm_ErrorNewline): Make platform-independent
* sigscheme/sbcport.c
- (basecport_get_char): Make line number counting
platform-independent
* sigscheme/main.c
- (repl_loop): Make newline printing platform-independent
Modified: branches/r5rs/sigscheme/config.h
===================================================================
--- branches/r5rs/sigscheme/config.h 2005-11-03 10:13:02 UTC (rev 1955)
+++ branches/r5rs/sigscheme/config.h 2005-11-03 10:37:10 UTC (rev 1956)
@@ -99,6 +99,12 @@
/*===========================================================================
Platform Dependency
===========================================================================*/
+#define SCM_NEWLINE_STR "\n" /* UNIX flavors */
+#if 0
+#define SCM_NEWLINE_STR "\r\n" /* Windows/DOS */
+#define SCM_NEWLINE_STR "\r" /* Mac OS */
+#endif
+
/*
* FIXME: detect with configure and link against a replace function if not
* found
Modified: branches/r5rs/sigscheme/error.c
===================================================================
--- branches/r5rs/sigscheme/error.c 2005-11-03 10:13:02 UTC (rev 1955)
+++ branches/r5rs/sigscheme/error.c 2005-11-03 10:37:10 UTC (rev 1956)
@@ -242,6 +242,13 @@
}
}
+void SigScm_PortNewline(ScmObj port)
+{
+ if (!FALSEP(port)) {
+ SCM_PORT_PUTS(port, SCM_NEWLINE_STR);
+ }
+}
+
void SigScm_ErrorPrintf(const char *fmt, ...)
{
va_list args;
@@ -258,5 +265,5 @@
void SigScm_ErrorNewline(void)
{
- SigScm_PortPrintf(scm_current_error_port, "\n");
+ SigScm_PortNewline(scm_current_error_port);
}
Modified: branches/r5rs/sigscheme/main.c
===================================================================
--- branches/r5rs/sigscheme/main.c 2005-11-03 10:13:02 UTC (rev 1955)
+++ branches/r5rs/sigscheme/main.c 2005-11-03 10:37:10 UTC (rev 1956)
@@ -124,8 +124,7 @@
#else
SigScm_WriteToPort(scm_current_output_port, result);
#endif
- /* FIXME: Make portable with SigScm_NewlineToPort() */
- SigScm_PortPrintf(scm_current_output_port, "\n");
+ SigScm_PortNewline(scm_current_output_port);
}
if (is_prompt)
Modified: branches/r5rs/sigscheme/sbcport.c
===================================================================
--- branches/r5rs/sigscheme/sbcport.c 2005-11-03 10:13:02 UTC (rev 1955)
+++ branches/r5rs/sigscheme/sbcport.c 2005-11-03 10:37:10 UTC (rev 1956)
@@ -179,7 +179,7 @@
ch = SCM_BYTEPORT_GET_BYTE(port->bport);
#if SCM_DEBUG
- if (ch == '\n')
+ if (ch == SCM_NEWLINE_STR[0])
port->linenum++;
#endif
Modified: branches/r5rs/sigscheme/sigschemeinternal.h
===================================================================
--- branches/r5rs/sigscheme/sigschemeinternal.h 2005-11-03 10:13:02 UTC (rev 1955)
+++ branches/r5rs/sigscheme/sigschemeinternal.h 2005-11-03 10:37:10 UTC (rev 1956)
@@ -351,6 +351,7 @@
/* TODO: Move these functions to io.c */
void SigScm_PortPrintf(ScmObj port, const char *fmt, ...);
void SigScm_VPortPrintf(ScmObj port, const char *fmt, va_list args);
+void SigScm_PortNewline(ScmObj port);
void SigScm_ErrorPrintf(const char *fmt, ...);
void SigScm_VErrorPrintf(const char *fmt, va_list args);
void SigScm_ErrorNewline(void);
More information about the uim-commit
mailing list