[uim-commit] r2800 - branches/r5rs/sigscheme
yamaken at freedesktop.org
yamaken at freedesktop.org
Wed Jan 4 20:23:31 PST 2006
Author: yamaken
Date: 2006-01-04 20:23:28 -0800 (Wed, 04 Jan 2006)
New Revision: 2800
Modified:
branches/r5rs/sigscheme/io.c
branches/r5rs/sigscheme/operations-srfi38.c
branches/r5rs/sigscheme/sigschemeinternal.h
Log:
* This change reduce about 800 bytes of object size
* sigscheme/sigschemeinternal.h
- (PREPARE_PORT): Removed
- (scm_prepare_port): New function decl
* sigscheme/io.c
- (scm_prepare_port): New function
- (scm_p_read, scm_p_read_char, scm_p_peek_char, scm_p_char_readyp,
scm_p_write, scm_p_display, scm_p_newline, scm_p_write_char):
Replace PREPARE_PORT() with scm_prepare_port()
* sigscheme/operations-srfi38.c
- (scm_p_srfi38_write_with_shared_structure): Ditto
Modified: branches/r5rs/sigscheme/io.c
===================================================================
--- branches/r5rs/sigscheme/io.c 2006-01-05 04:08:56 UTC (rev 2799)
+++ branches/r5rs/sigscheme/io.c 2006-01-05 04:23:28 UTC (rev 2800)
@@ -112,6 +112,21 @@
scm_lib_path = path;
}
+ScmObj
+scm_prepare_port(ScmObj args, ScmObj default_port)
+{
+ ScmObj port;
+ DECLARE_INTERNAL_FUNCTION("prepare_port");
+
+ port = POP_ARG(args);
+ if (!VALIDP(port))
+ port = default_port;
+ ENSURE_PORT(port);
+ ASSERT_NO_MORE_ARG(args);
+
+ return port;
+}
+
ScmCharPort *
scm_make_char_port(ScmBytePort *bport)
{
@@ -433,7 +448,7 @@
ScmObj port;
DECLARE_FUNCTION("read", procedure_variadic_0);
- PREPARE_PORT(port, args, scm_in);
+ port = scm_prepare_port(args, scm_in);
return scm_read(port);
}
@@ -444,7 +459,7 @@
int ch;
DECLARE_FUNCTION("read-char", procedure_variadic_0);
- PREPARE_PORT(port, args, scm_in);
+ port = scm_prepare_port(args, scm_in);
ch = scm_port_get_char(port);
if (ch == EOF)
@@ -460,7 +475,7 @@
int ch;
DECLARE_FUNCTION("peek-char", procedure_variadic_0);
- PREPARE_PORT(port, args, scm_in);
+ port = scm_prepare_port(args, scm_in);
ch = scm_port_peek_char(port);
if (ch == EOF)
@@ -484,7 +499,7 @@
scm_bool res;
DECLARE_FUNCTION("char-ready?", procedure_variadic_0);
- PREPARE_PORT(port, args, scm_in);
+ port = scm_prepare_port(args, scm_in);
res = scm_port_char_readyp(port);
return MAKE_BOOL(res);
@@ -499,7 +514,7 @@
ScmObj port;
DECLARE_FUNCTION("write", procedure_variadic_1);
- PREPARE_PORT(port, args, scm_out);
+ port = scm_prepare_port(args, scm_out);
scm_write_to_port(port, obj);
return SCM_UNDEF;
}
@@ -510,7 +525,7 @@
ScmObj port;
DECLARE_FUNCTION("display", procedure_variadic_1);
- PREPARE_PORT(port, args, scm_out);
+ port = scm_prepare_port(args, scm_out);
scm_display_to_port(port, obj);
return SCM_UNDEF;
}
@@ -521,7 +536,7 @@
ScmObj port;
DECLARE_FUNCTION("newline", procedure_variadic_0);
- PREPARE_PORT(port, args, scm_out);
+ port = scm_prepare_port(args, scm_out);
scm_port_newline(port);
return SCM_UNDEF;
}
@@ -534,7 +549,7 @@
ENSURE_CHAR(obj);
- PREPARE_PORT(port, args, scm_out);
+ port = scm_prepare_port(args, scm_out);
scm_display_to_port(port, obj);
return SCM_UNDEF;
}
Modified: branches/r5rs/sigscheme/operations-srfi38.c
===================================================================
--- branches/r5rs/sigscheme/operations-srfi38.c 2006-01-05 04:08:56 UTC (rev 2799)
+++ branches/r5rs/sigscheme/operations-srfi38.c 2006-01-05 04:23:28 UTC (rev 2800)
@@ -79,8 +79,7 @@
ScmObj port;
DECLARE_FUNCTION("write-with-shared-structure", procedure_variadic_1);
- PREPARE_PORT(port, args, scm_out);
-
+ port = scm_prepare_port(args, scm_out);
scm_write_to_port_with_shared_structure(port, obj);
return SCM_UNDEF;
}
Modified: branches/r5rs/sigscheme/sigschemeinternal.h
===================================================================
--- branches/r5rs/sigscheme/sigschemeinternal.h 2006-01-05 04:08:56 UTC (rev 2799)
+++ branches/r5rs/sigscheme/sigschemeinternal.h 2006-01-05 04:23:28 UTC (rev 2800)
@@ -336,15 +336,6 @@
#define ENSURE_ALLOCATED SCM_ENSURE_ALLOCATED
-#define PREPARE_PORT(port, args, default_port) \
- do { \
- (port) = POP_ARG(args); \
- if (!VALIDP(port)) \
- (port) = (default_port); \
- ENSURE_PORT(port); \
- ASSERT_NO_MORE_ARG(args); \
- } while (/* CONSTCOND */ 0)
-
/* Macros For Handling Continuation Object */
#define INVALID_CONTINUATION_OPAQUE NULL
@@ -501,6 +492,7 @@
/* io.c */
void scm_init_io(void);
+ScmObj scm_prepare_port(ScmObj args, ScmObj default_port);
ScmCharPort *scm_make_char_port(ScmBytePort *bport);
/* sigscheme.c */
More information about the uim-commit
mailing list