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

yamaken at freedesktop.org yamaken at freedesktop.org
Wed Oct 5 20:37:32 PDT 2005


Author: yamaken
Date: 2005-10-05 20:37:28 -0700 (Wed, 05 Oct 2005)
New Revision: 1817

Modified:
   branches/r5rs/sigscheme/error.c
   branches/r5rs/sigscheme/io.c
   branches/r5rs/sigscheme/main.c
   branches/r5rs/sigscheme/operations-siod.c
   branches/r5rs/sigscheme/sigscheme.c
   branches/r5rs/sigscheme/sigschemeinternal.h
Log:
* This commit removes scm_std_error_port, scm_std_input_port,
  scm_std_output_port only SIOD-compatibility code is using

* sigscheme/sigschemeinternal.h
  - (scm_std_error_port, scm_std_input_port, scm_std_output_port):
    Removed
* sigscheme/io.c
  - (scm_std_input_port, scm_std_output_port): Removed
* sigscheme/error.c
  - (scm_std_error_port): Removed
* sigscheme/sigscheme.c
  - (SigScm_Initialize_internal): Remove initialization of
    scm_std_error_port, scm_std_input_port, scm_std_output_port
* sigscheme/operations-siod.c
  - (saved_output_port, saved_error_port): New static variable
  - (SigScm_Initialize_SIOD): Add initialization of saved_output_port,
    saved_error_port
  - (SigScm_SetVerboseLevel): Rewrite printing suppression code with
    the new static ports
* sigscheme/main.c
  - (repl): Replace scm_std_*_port with scm_current_input_port


Modified: branches/r5rs/sigscheme/error.c
===================================================================
--- branches/r5rs/sigscheme/error.c	2005-10-06 01:30:09 UTC (rev 1816)
+++ branches/r5rs/sigscheme/error.c	2005-10-06 03:37:28 UTC (rev 1817)
@@ -58,7 +58,6 @@
 /*=======================================
   Variable Declarations
 =======================================*/
-ScmObj scm_std_error_port  = NULL;
 ScmObj scm_current_error_port  = NULL;
 
 /*=======================================

Modified: branches/r5rs/sigscheme/io.c
===================================================================
--- branches/r5rs/sigscheme/io.c	2005-10-06 01:30:09 UTC (rev 1816)
+++ branches/r5rs/sigscheme/io.c	2005-10-06 03:37:28 UTC (rev 1817)
@@ -53,8 +53,6 @@
 /*=======================================
   Variable Declarations
 =======================================*/
-ScmObj scm_std_input_port   = NULL;
-ScmObj scm_std_output_port  = NULL;
 ScmObj scm_current_input_port   = NULL;
 ScmObj scm_current_output_port  = NULL;
 

Modified: branches/r5rs/sigscheme/main.c
===================================================================
--- branches/r5rs/sigscheme/main.c	2005-10-06 01:30:09 UTC (rev 1816)
+++ branches/r5rs/sigscheme/main.c	2005-10-06 03:37:28 UTC (rev 1817)
@@ -87,7 +87,7 @@
 #endif
         printf("sscm> ");
 
-    while (s_exp = SigScm_Read(scm_std_input_port), !EOFP(s_exp)) {
+    while (s_exp = SigScm_Read(scm_current_input_port), !EOFP(s_exp)) {
         result = EVAL(s_exp, SCM_INTERACTION_ENV);
 #if SCM_COMPAT_SIOD
         if (FALSEP(ScmOp_providedp(siod_str))
@@ -95,9 +95,9 @@
 #endif
         {
 #if SCM_USE_SRFI38
-            SigScm_WriteToPortWithSharedStructure(scm_std_output_port, result);
+            SigScm_WriteToPortWithSharedStructure(scm_current_output_port, result);
 #else
-            SigScm_WriteToPort(scm_std_output_port, result);
+            SigScm_WriteToPort(scm_current_output_port, result);
 #endif
             printf("\n");
         }

Modified: branches/r5rs/sigscheme/operations-siod.c
===================================================================
--- branches/r5rs/sigscheme/operations-siod.c	2005-10-06 01:30:09 UTC (rev 1816)
+++ branches/r5rs/sigscheme/operations-siod.c	2005-10-06 03:37:28 UTC (rev 1817)
@@ -77,6 +77,9 @@
 };
 static long sscm_verbose_level = 0;
 
+static ScmObj saved_output_port  = NULL;
+static ScmObj saved_error_port  = NULL;
+
 /*=======================================
   File Local Function Declarations
 =======================================*/
@@ -106,6 +109,11 @@
     Scm_RegisterProcedureFixed1("%%closure-code"       , ScmOp_closure_code);
     Scm_RegisterProcedureVariadic0("verbose" , ScmOp_verbose);
 
+    saved_output_port = NULL;
+    saved_error_port  = NULL;
+    SigScm_GC_Protect(&saved_output_port);
+    SigScm_GC_Protect(&saved_error_port);
+
     SigScm_SetVerboseLevel(2);
 }
 
@@ -213,12 +221,15 @@
                                   | SigScm_PredefinedDebugCategories());
 
     if (level == 0) {
+        saved_error_port = scm_current_error_port;
+        saved_output_port = scm_current_output_port;
+
         scm_current_error_port = NULL;
         scm_current_output_port = NULL;
     } else {
         if (!scm_current_error_port)
-            scm_current_error_port = scm_std_error_port;
+            scm_current_error_port = saved_error_port;
         if (!scm_current_output_port)
-            scm_current_output_port = scm_std_output_port;
+            scm_current_output_port = saved_output_port;
     }
 }

Modified: branches/r5rs/sigscheme/sigscheme.c
===================================================================
--- branches/r5rs/sigscheme/sigscheme.c	2005-10-06 01:30:09 UTC (rev 1816)
+++ branches/r5rs/sigscheme/sigscheme.c	2005-10-06 03:37:28 UTC (rev 1817)
@@ -161,15 +161,9 @@
     /*=======================================================================
       Preallocated Ports
     =======================================================================*/
-    scm_std_input_port  = Scm_NewFilePort(stdin,  "stdin",  PORT_INPUT);
-    scm_std_output_port = Scm_NewFilePort(stdout, "stdout", PORT_OUTPUT);
-    scm_std_error_port  = Scm_NewFilePort(stderr, "stderr", PORT_OUTPUT);
-    scm_current_input_port  = scm_std_input_port;
-    scm_current_output_port = scm_std_output_port;
-    scm_current_error_port  = scm_std_error_port;
-    SigScm_GC_Protect(&scm_std_input_port);
-    SigScm_GC_Protect(&scm_std_output_port);
-    SigScm_GC_Protect(&scm_std_error_port);
+    scm_current_input_port  = Scm_NewFilePort(stdin,  "stdin",  PORT_INPUT);
+    scm_current_output_port = Scm_NewFilePort(stdout, "stdout", PORT_OUTPUT);
+    scm_current_error_port  = Scm_NewFilePort(stderr, "stderr", PORT_OUTPUT);
     SigScm_GC_Protect(&scm_current_input_port);
     SigScm_GC_Protect(&scm_current_output_port);
     SigScm_GC_Protect(&scm_current_error_port);

Modified: branches/r5rs/sigscheme/sigschemeinternal.h
===================================================================
--- branches/r5rs/sigscheme/sigschemeinternal.h	2005-10-06 01:30:09 UTC (rev 1816)
+++ branches/r5rs/sigscheme/sigschemeinternal.h	2005-10-06 03:37:28 UTC (rev 1817)
@@ -64,12 +64,9 @@
 extern struct trace_frame *scm_trace_root;
 
 /* error.c*/
-extern ScmObj scm_std_error_port;
 extern ScmObj scm_current_error_port;
 
 /* io.c */
-extern ScmObj scm_std_input_port;
-extern ScmObj scm_std_output_port;
 extern ScmObj scm_current_input_port;
 extern ScmObj scm_current_output_port;
 extern ScmObj SigScm_features;



More information about the uim-commit mailing list