[uim-commit] r1932 - branches/r5rs/sigscheme
yamaken at freedesktop.org
yamaken at freedesktop.org
Tue Nov 1 04:31:28 PST 2005
Author: yamaken
Date: 2005-11-01 04:31:24 -0800 (Tue, 01 Nov 2005)
New Revision: 1932
Modified:
branches/r5rs/sigscheme/io.c
branches/r5rs/sigscheme/sigscheme.c
branches/r5rs/sigscheme/sigscheme.h
Log:
* sigscheme/sigscheme.h
- (Scm_MakeSharedFilePort): New function decl
* sigscheme/io.c
- (Scm_MakeSharedFilePort): New function
* sigscheme/sigscheme.c
- (SigScm_Initialize_internal): Simplify with Scm_MakeSharedFilePort()
Modified: branches/r5rs/sigscheme/io.c
===================================================================
--- branches/r5rs/sigscheme/io.c 2005-11-01 11:53:33 UTC (rev 1931)
+++ branches/r5rs/sigscheme/io.c 2005-11-01 12:31:24 UTC (rev 1932)
@@ -120,6 +120,18 @@
}
#endif
+#if SCM_USE_NEWPORT
+ScmObj Scm_MakeSharedFilePort(FILE *file, const char *aux_info,
+ enum ScmPortFlag flag)
+{
+ ScmBytePort *bport;
+
+ /* GC safe */
+ bport = ScmFilePort_new_shared(file, aux_info);
+ return Scm_NewPort(ScmSingleByteCharPort_new(bport), flag);
+}
+#endif
+
/*=======================================
R5RS : 6.6 Input and Output
=======================================*/
Modified: branches/r5rs/sigscheme/sigscheme.c
===================================================================
--- branches/r5rs/sigscheme/sigscheme.c 2005-11-01 11:53:33 UTC (rev 1931)
+++ branches/r5rs/sigscheme/sigscheme.c 2005-11-01 12:31:24 UTC (rev 1932)
@@ -128,10 +128,6 @@
static void SigScm_Initialize_internal(void)
{
-#if SCM_USE_NEWPORT
- ScmBytePort *bport;
-#endif
-
/*=======================================================================
Core
=======================================================================*/
@@ -168,15 +164,12 @@
Scm_fileport_init();
Scm_sbcport_init();
- bport = ScmFilePort_new_shared(stdin, "stdin");
- scm_current_input_port = Scm_NewPort(ScmSingleByteCharPort_new(bport),
- SCM_PORTFLAG_INPUT);
- bport = ScmFilePort_new_shared(stdout, "stdout");
- scm_current_output_port = Scm_NewPort(ScmSingleByteCharPort_new(bport),
- SCM_PORTFLAG_OUTPUT);
- bport = ScmFilePort_new_shared(stderr, "stderr");
- scm_current_error_port = Scm_NewPort(ScmSingleByteCharPort_new(bport),
- SCM_PORTFLAG_OUTPUT);
+ scm_current_input_port = Scm_MakeSharedFilePort(stdin, "stdin",
+ SCM_PORTFLAG_INPUT);
+ scm_current_output_port = Scm_MakeSharedFilePort(stdout, "stdout",
+ SCM_PORTFLAG_OUTPUT);
+ scm_current_error_port = Scm_MakeSharedFilePort(stderr, "stderr",
+ SCM_PORTFLAG_OUTPUT);
#else /* SCM_USE_NEWPORT */
scm_current_input_port = Scm_NewFilePort(stdin, "stdin", PORT_INPUT);
scm_current_output_port = Scm_NewFilePort(stdout, "stdout", PORT_OUTPUT);
Modified: branches/r5rs/sigscheme/sigscheme.h
===================================================================
--- branches/r5rs/sigscheme/sigscheme.h 2005-11-01 11:53:33 UTC (rev 1931)
+++ branches/r5rs/sigscheme/sigscheme.h 2005-11-01 12:31:24 UTC (rev 1932)
@@ -580,6 +580,10 @@
/* io.c */
void SigScm_set_lib_path(const char *path);
+#if SCM_USE_NEWPORT
+ScmObj Scm_MakeSharedFilePort(FILE *file, const char *aux_info,
+ enum ScmPortFlag flag);
+#endif
ScmObj ScmOp_call_with_input_file(ScmObj filepath, ScmObj proc);
ScmObj ScmOp_call_with_output_file(ScmObj filepath, ScmObj proc);
More information about the uim-commit
mailing list