[uim-commit] r3050 - branches/r5rs/sigscheme/src

yamaken at freedesktop.org yamaken at freedesktop.org
Tue Jan 31 15:24:29 PST 2006


Author: yamaken
Date: 2006-01-31 15:24:25 -0800 (Tue, 31 Jan 2006)
New Revision: 3050

Modified:
   branches/r5rs/sigscheme/src/error.c
   branches/r5rs/sigscheme/src/main.c
   branches/r5rs/sigscheme/src/module-srfi38.c
   branches/r5rs/sigscheme/src/read.c
   branches/r5rs/sigscheme/src/sigscheme.h
   branches/r5rs/sigscheme/src/sigschemeinternal.h
   branches/r5rs/sigscheme/src/write.c
Log:
* sigscheme/src/sigscheme.h
  - (scm_write_to_port, scm_write): Rename scm_write_to_port to
    scm_write
  - (scm_display_to_port, scm_display): Rename scm_display_to_port to
    scm_display
  - (scm_write_to_port_with_shared_structure, scm_write_ss): Rename
    scm_write_to_port_with_shared_structure to scm_write_ss
  - (SCM_WRITESS_TO_PORT, SCM_WRITE_SS): Rename SCM_WRITESS_TO_PORT to
    SCM_WRITE_SS
* sigscheme/src/sigschemeinternal.h 
  - (scm_writess_func, scm_write_ss_func): Rename scm_writess_func to
    scm_write_ss_func
* sigscheme/src/write.c
  - (scm_writess_func, scm_write_ss_func): Rename scm_writess_func to
    scm_write_ss_func
  - (scm_writess_func, write_obj, write_errobj, get_shared_index,
    scm_p_write, scm_p_display): Follow the renamings
  - (write_internal): New static function
  - (scm_write_to_port): Rename to scm_write
  - (scm_display_to_port): Rename to scm_display
  - (scm_write):
    * Renamed from scm_write_to_port
    * Simplify with write_internal()
  - (scm_display):
    * Renamed from scm_display_to_port
    * Simplify with write_internal()
  - (scm_write_to_port_with_shared_structure): Rename to scm_write_ss
  - (scm_write_ss):
    * Renamed from scm_write_to_port_with_shared_structure
    * Follow the renaming
* sigscheme/src/module-srfi38.c
  - (scm_initialize_srfi38, scm_p_srfi38_write_with_shared_structure):
    Follow the renamings
* sigscheme/src/error.c
  - (scm_p_inspect_error, show_arg, scm_show_backtrace): Ditto
* sigscheme/src/read.c
  - (scm_read): Ditto
* sigscheme/src/main.c
  - (repl_loop): Ditto


Modified: branches/r5rs/sigscheme/src/error.c
===================================================================
--- branches/r5rs/sigscheme/src/error.c	2006-01-31 22:51:49 UTC (rev 3049)
+++ branches/r5rs/sigscheme/src/error.c	2006-01-31 23:24:25 UTC (rev 3050)
@@ -275,11 +275,11 @@
     if (scm_debug_categories() & SCM_DBG_ERRMSG) {
         scm_port_printf(scm_err, SCM_ERR_HEADER);
         if (ERROBJP(err_obj)) {
-            scm_display_to_port(scm_err, err_obj);
+            scm_display(scm_err, err_obj);
         } else {
             scm_port_puts(scm_err, SCM_ERRMSG_UNHANDLED_EXCEPTION);
             scm_port_puts(scm_err, ": ");
-            scm_write_to_port(scm_err, err_obj);
+            scm_write(scm_err, err_obj);
         }
         scm_port_newline(scm_err);
     }
@@ -393,7 +393,7 @@
 
     if (SYMBOLP(arg) && !UNBOUNDP(arg, env)) {
         scm_port_printf(scm_err, "  - [%s]: ", SCM_SYMBOL_NAME(arg));
-        SCM_WRITESS_TO_PORT(scm_err, scm_symbol_value(arg, env));
+        SCM_WRITE_SS(scm_err, scm_symbol_value(arg, env));
         scm_port_newline(scm_err);
     }
 
@@ -424,7 +424,7 @@
         env = TRACE_FRAME_ENV(frame);
         obj = TRACE_FRAME_OBJ(frame);
 
-        SCM_WRITESS_TO_PORT(scm_err, obj);
+        SCM_WRITE_SS(scm_err, obj);
         scm_port_newline(scm_err);
 
 #if SCM_DEBUG_BACKTRACE_VAL

Modified: branches/r5rs/sigscheme/src/main.c
===================================================================
--- branches/r5rs/sigscheme/src/main.c	2006-01-31 22:51:49 UTC (rev 3049)
+++ branches/r5rs/sigscheme/src/main.c	2006-01-31 23:24:25 UTC (rev 3050)
@@ -165,7 +165,7 @@
             result = EVAL(result, eval_state.env);
 
         if (!EQ(result, err)) {
-            SCM_WRITESS_TO_PORT(scm_out, result);
+            SCM_WRITE_SS(scm_out, result);
             scm_port_newline(scm_out);
         }
 #else /* SCM_USE_SRFI34 */
@@ -174,7 +174,7 @@
             break;
 
         result = EVAL(sexp, SCM_INTERACTION_ENV);
-        SCM_WRITESS_TO_PORT(scm_out, result);
+        SCM_WRITE_SS(scm_out, result);
         scm_port_newline(scm_out);
 #endif /* SCM_USE_SRFI34 */
     }

Modified: branches/r5rs/sigscheme/src/module-srfi38.c
===================================================================
--- branches/r5rs/sigscheme/src/module-srfi38.c	2006-01-31 22:51:49 UTC (rev 3049)
+++ branches/r5rs/sigscheme/src/module-srfi38.c	2006-01-31 23:24:25 UTC (rev 3050)
@@ -70,7 +70,7 @@
     /* SRFI-38 allows providing (read/ss) and (write/ss) */
     scm_define_alias("write/ss", "write-with-shared-structure");
 
-    scm_writess_func = scm_write_to_port_with_shared_structure;
+    scm_write_ss_func = scm_write_ss;
 }
 
 /*===========================================================================
@@ -83,6 +83,6 @@
     DECLARE_FUNCTION("write-with-shared-structure", procedure_variadic_1);
 
     port = scm_prepare_port(args, scm_out);
-    scm_write_to_port_with_shared_structure(port, obj);
+    scm_write_ss(port, obj);
     return SCM_UNDEF;
 }

Modified: branches/r5rs/sigscheme/src/read.c
===================================================================
--- branches/r5rs/sigscheme/src/read.c	2006-01-31 22:51:49 UTC (rev 3049)
+++ branches/r5rs/sigscheme/src/read.c	2006-01-31 23:24:25 UTC (rev 3050)
@@ -116,7 +116,7 @@
     sexp = read_sexpression(port);
 #if SCM_DEBUG
     if ((scm_debug_categories() & SCM_DBG_READ) && !EOFP(sexp)) {
-        scm_write_to_port(scm_err, sexp);
+        scm_write(scm_err, sexp);
         scm_port_newline(scm_err);
     }
 #endif

Modified: branches/r5rs/sigscheme/src/sigscheme.h
===================================================================
--- branches/r5rs/sigscheme/src/sigscheme.h	2006-01-31 22:51:49 UTC (rev 3049)
+++ branches/r5rs/sigscheme/src/sigscheme.h	2006-01-31 23:24:25 UTC (rev 3050)
@@ -222,7 +222,7 @@
     (SCM_PORT_IMPL(port)                                                     \
      || (scm_error_obj("(unknown)", "operated on closed port", port), 1))
 
-#define SCM_WRITESS_TO_PORT(port, obj) ((*scm_writess_func)(port, obj))
+#define SCM_WRITE_SS(port, obj) ((*scm_write_ss_func)(port, obj))
 
 /*===========================================================================
   Type Definitions
@@ -1374,10 +1374,10 @@
 ScmObj scm_p_read(ScmObj args);
 
 /* write.c */
-void scm_write_to_port(ScmObj port, ScmObj obj);
-void scm_display_to_port(ScmObj port, ScmObj obj);
+void scm_write(ScmObj port, ScmObj obj);
+void scm_display(ScmObj port, ScmObj obj);
 #if SCM_USE_SRFI38
-void scm_write_to_port_with_shared_structure(ScmObj port, ScmObj obj);
+void scm_write_ss(ScmObj port, ScmObj obj);
 #endif
 ScmObj scm_p_write(ScmObj obj, ScmObj args);
 ScmObj scm_p_display(ScmObj obj, ScmObj args);

Modified: branches/r5rs/sigscheme/src/sigschemeinternal.h
===================================================================
--- branches/r5rs/sigscheme/src/sigschemeinternal.h	2006-01-31 22:51:49 UTC (rev 3049)
+++ branches/r5rs/sigscheme/src/sigschemeinternal.h	2006-01-31 23:24:25 UTC (rev 3050)
@@ -70,7 +70,7 @@
 extern const ScmSpecialCharInfo scm_special_char_table[];
 
 /* write.c */
-extern void (*scm_writess_func)(ScmObj port, ScmObj obj);
+extern void (*scm_write_ss_func)(ScmObj port, ScmObj obj);
 
 /* storage.c */
 #if SCM_USE_VALUECONS

Modified: branches/r5rs/sigscheme/src/write.c
===================================================================
--- branches/r5rs/sigscheme/src/write.c	2006-01-31 22:51:49 UTC (rev 3049)
+++ branches/r5rs/sigscheme/src/write.c	2006-01-31 23:24:25 UTC (rev 3050)
@@ -96,15 +96,17 @@
 /*=======================================
   Variable Declarations
 =======================================*/
-void (*scm_writess_func)(ScmObj port, ScmObj obj) = &scm_write_to_port;
+void (*scm_write_ss_func)(ScmObj port, ScmObj obj) = &scm_write;
 
 #if SCM_USE_SRFI38
-static write_ss_context *write_ss_ctx; /* misc info in priting shared structures */
+/* misc info in priting shared structures */
+static write_ss_context *write_ss_ctx;
 #endif
 
 /*=======================================
   File Local Function Declarations
 =======================================*/
+static void write_internal(ScmObj port, ScmObj obj, enum OutputType otype);
 static void write_obj(ScmObj port, ScmObj obj, enum OutputType otype);
 static void write_char(ScmObj port, ScmObj obj, enum OutputType otype);
 static void write_string(ScmObj port, ScmObj obj, enum OutputType otype);
@@ -125,29 +127,28 @@
    Function Implementations
 =======================================*/
 void
-scm_write_to_port(ScmObj port, ScmObj obj)
+scm_write(ScmObj port, ScmObj obj)
 {
-    DECLARE_INTERNAL_FUNCTION("scm_write_to_port");
-
-    ENSURE_PORT(port);
-    SCM_ENSURE_LIVE_PORT(port);
-    if (!(SCM_PORT_FLAG(port) & SCM_PORTFLAG_OUTPUT))
-        ERR("output port is required");
-
-    write_obj(port, obj, AS_WRITE);
+    write_internal(port, obj, AS_WRITE);
 }
 
 void
-scm_display_to_port(ScmObj port, ScmObj obj)
+scm_display(ScmObj port, ScmObj obj)
 {
-    DECLARE_INTERNAL_FUNCTION("scm_display_to_port");
+    write_internal(port, obj, AS_DISPLAY);
+}
 
+static void
+write_internal(ScmObj port, ScmObj obj, enum OutputType otype)
+{
+    DECLARE_INTERNAL_FUNCTION("write");
+
     ENSURE_PORT(port);
     SCM_ENSURE_LIVE_PORT(port);
     if (!(SCM_PORT_FLAG(port) & SCM_PORTFLAG_OUTPUT))
         ERR("output port is required");
 
-    write_obj(port, obj, AS_DISPLAY);
+    write_obj(port, obj, otype);
 }
 
 static void
@@ -193,7 +194,7 @@
         scm_port_puts(port, (SCM_SYNTAXP(obj)) ? "#<syntax " : "#<subr ");
         sym = scm_symbol_bound_to(obj);
         if (NFALSEP(sym))
-            scm_display_to_port(port, sym);
+            scm_display(port, sym);
         else
             scm_port_printf(port, "%p", (void *)obj);
         scm_port_put_char(port, '>');
@@ -472,11 +473,11 @@
     switch (otype) {
     case AS_WRITE:
         scm_port_puts(port, "#<error ");
-        scm_write_to_port(port, reason);
+        scm_write(port, reason);
         break;
 
     case AS_DISPLAY:
-        scm_display_to_port(port, reason);
+        scm_display(port, reason);
         if (CONSP(objs))
             scm_port_put_char(port, ':');
         break;
@@ -487,7 +488,7 @@
 
     FOR_EACH (elm, objs) {
         scm_port_put_char(port, ' ');
-        scm_write_to_port(port, elm);
+        scm_write(port, elm);
     }
 
     if (otype == AS_WRITE)
@@ -646,8 +647,9 @@
     return 0;
 }
 
+/* write with shared structure */
 void
-scm_write_to_port_with_shared_structure(ScmObj port, ScmObj obj)
+scm_write_ss(ScmObj port, ScmObj obj)
 {
     write_ss_context ctx = {{0}};
     unsigned int i;
@@ -665,7 +667,7 @@
     if (!HASH_EMPTY(ctx.seen))
         write_ss_ctx = &ctx;
 
-    scm_write_to_port(port, obj);
+    scm_write(port, obj);
 
     write_ss_ctx = NULL;
     free(ctx.seen.ents);
@@ -682,7 +684,7 @@
     DECLARE_FUNCTION("write", procedure_variadic_1);
 
     port = scm_prepare_port(args, scm_out);
-    scm_write_to_port(port, obj);
+    scm_write(port, obj);
     return SCM_UNDEF;
 }
 
@@ -693,6 +695,6 @@
     DECLARE_FUNCTION("display", procedure_variadic_1);
 
     port = scm_prepare_port(args, scm_out);
-    scm_display_to_port(port, obj);
+    scm_display(port, obj);
     return SCM_UNDEF;
 }



More information about the uim-commit mailing list