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

yamaken at freedesktop.org yamaken at freedesktop.org
Fri Dec 16 16:10:51 PST 2005


Author: yamaken
Date: 2005-12-16 16:10:46 -0800 (Fri, 16 Dec 2005)
New Revision: 2618

Modified:
   branches/r5rs/sigscheme/error.c
   branches/r5rs/sigscheme/io.c
   branches/r5rs/sigscheme/main.c
   branches/r5rs/sigscheme/operations-nonstd.c
   branches/r5rs/sigscheme/operations-srfi34.c
   branches/r5rs/sigscheme/operations-srfi6.c
   branches/r5rs/sigscheme/operations.c
   branches/r5rs/sigscheme/read.c
   branches/r5rs/sigscheme/sigscheme.c
   branches/r5rs/sigscheme/sigscheme.h
   branches/r5rs/sigscheme/sigschemetype-compact.h
   branches/r5rs/sigscheme/sigschemetype.h
   branches/r5rs/sigscheme/storage-fatty.h
   branches/r5rs/sigscheme/storage.c
Log:
* This commit reorganizes string creators. Each invocation are
  replaced as below

  scm_make_mutable_string           -> MAKE_STRING
  scm_make_mutable_string_copying   -> MAKE_STRING_COPYING
  scm_make_immutable_string         -> MAKE_IMMUTABLE_STRING
  scm_make_immutable_string_copying -> MAKE_IMMUTABLE_STRING_COPYING

* sigscheme/sigscheme.h
  - (scm_make_string): Removed decl
  - (scm_make_mutable_string, scm_make_string): Rename
    scm_make_mutable_string() with scm_make_string()
  - (scm_make_mutable_string_copying, scm_make_string_copying): Rename
    scm_make_mutable_string_copying() with scm_make_string_copying()
* sigscheme/storage.c
  - (scm_make_string_internal):
    * Renamed from scm_make_string()
    * Make static
  - (scm_make_mutable_string, scm_make_string): Rename
    scm_make_mutable_string() with scm_make_string()
  - (scm_make_mutable_string_copying, scm_make_string_copying): Rename
    scm_make_mutable_string_copying() with scm_make_string_copying()
* sigscheme/storage-fatty.h
  - (SCM_SAL_MAKE_STRING, SCM_SAL_MAKE_STRING_COPYING): Follow the
    renaming
* sigscheme/sigschemetype.h
  - (SCM_MAKE_STRING, SCM_MAKE_STRING_COPYING): Ditto
* sigscheme/sigschemetype-compact.h
  - (SCM_MAKE_STRING, SCM_MAKE_STRING_COPYING): Ditto
* sigscheme/read.c
  - (read_string): Ditto
* sigscheme/error.c
  - (scm_init_error, scm_die, scm_error, scm_error_obj): Ditto
* sigscheme/operations-srfi6.c
  - (scm_p_srfi6_get_output_string): Ditto
* sigscheme/io.c
  - (scm_load_internal): Ditto
* sigscheme/operations.c
  - (scm_p_number2string, scm_p_symbol2string, scm_p_make_string,
    scm_p_substring, scm_p_string_append, scm_p_list2string,
    scm_p_string_copy, scm_p_string_filld): Ditto
* sigscheme/operations-nonstd.c
  - (scm_p_load_path, create_loaded_str): Ditto
* sigscheme/sigscheme.c
  - (scm_initialize_internal, scm_interpret_argv): Ditto
* sigscheme/main.c
  - (main): Ditto
* sigscheme/operations-srfi34.c
  - (MAKE_STR_COPYING): Removed
  - (scm_initialize_srfi34): Replace MAKE_STR_COPYING() with
    MAKE_IMMUTABLE_STRING_COPYING()


Modified: branches/r5rs/sigscheme/error.c
===================================================================
--- branches/r5rs/sigscheme/error.c	2005-12-16 23:59:09 UTC (rev 2617)
+++ branches/r5rs/sigscheme/error.c	2005-12-17 00:10:46 UTC (rev 2618)
@@ -83,7 +83,7 @@
     /* allocate a cons cell as unique ID */
     err_obj_tag = CONS(SCM_UNDEF, SCM_UNDEF);
 
-    str_srfi34 = scm_make_immutable_string_copying("srfi-34");
+    str_srfi34 = MAKE_IMMUTABLE_STRING_COPYING("srfi-34");
     srfi34_is_provided = FALSE;
 
     cb_fatal_error = NULL;
@@ -300,7 +300,7 @@
     asprintf(&reason, "%s: (file : %s, line : %d)", msg, filename, line);
     ASSERT_ALLOCATED(reason);
     /* reason will implicitly be freed via the object on GC */
-    reason_holder = scm_make_immutable_string(reason);
+    reason_holder = MAKE_IMMUTABLE_STRING(reason);
 
     scm_fatal_error(reason);
     /* NOTREACHED */
@@ -319,7 +319,7 @@
     va_end(va);
     ASSERT_ALLOCATED(reason);
 
-    err_obj = scm_make_error_obj(scm_make_immutable_string(reason), SCM_NULL);
+    err_obj = scm_make_error_obj(MAKE_IMMUTABLE_STRING(reason), SCM_NULL);
     scm_raise_error(err_obj);
     /* NOTREACHED */
 }
@@ -334,7 +334,7 @@
     asprintf(&reason, "in %s: %s", func_name, msg);
     ASSERT_ALLOCATED(reason);
 
-    err_obj = scm_make_error_obj(scm_make_immutable_string(reason), LIST_1(obj));
+    err_obj = scm_make_error_obj(MAKE_IMMUTABLE_STRING(reason), LIST_1(obj));
     scm_raise_error(err_obj);
     /* NOTREACHED */
 }

Modified: branches/r5rs/sigscheme/io.c
===================================================================
--- branches/r5rs/sigscheme/io.c	2005-12-16 23:59:09 UTC (rev 2617)
+++ branches/r5rs/sigscheme/io.c	2005-12-17 00:10:46 UTC (rev 2618)
@@ -522,7 +522,7 @@
     if (!c_path)
         ERR("scm_load_internal: file \"%s\" not found", c_filename);
 
-    path = scm_make_immutable_string(c_path);
+    path = MAKE_IMMUTABLE_STRING(c_path);
     port = scm_p_open_input_file(path);
 
     saved_codec = scm_current_char_codec;

Modified: branches/r5rs/sigscheme/main.c
===================================================================
--- branches/r5rs/sigscheme/main.c	2005-12-16 23:59:09 UTC (rev 2617)
+++ branches/r5rs/sigscheme/main.c	2005-12-17 00:10:46 UTC (rev 2618)
@@ -180,7 +180,7 @@
 
 #if SCM_COMPAT_SIOD
     scm_gc_protect(&feature_id_siod);
-    feature_id_siod = scm_make_immutable_string_copying(FEATURE_ID_SIOD);
+    feature_id_siod = MAKE_IMMUTABLE_STRING_COPYING(FEATURE_ID_SIOD);
 #endif
 
     if (filename) {

Modified: branches/r5rs/sigscheme/operations-nonstd.c
===================================================================
--- branches/r5rs/sigscheme/operations-nonstd.c	2005-12-16 23:59:09 UTC (rev 2617)
+++ branches/r5rs/sigscheme/operations-nonstd.c	2005-12-17 00:10:46 UTC (rev 2618)
@@ -101,7 +101,7 @@
 scm_p_load_path(void)
 {
     DECLARE_FUNCTION("load-path", procedure_fixed_0);
-    return scm_make_immutable_string_copying(scm_lib_path);
+    return MAKE_IMMUTABLE_STRING_COPYING(scm_lib_path);
 }
 
 /* FIXME: add ScmObj scm_require(const char *c_filename) */
@@ -143,7 +143,7 @@
     loaded_str = scm_malloc(size);
     snprintf(loaded_str, size, "*%s-loaded*", SCM_STRING_STR(filename));
 
-    return scm_make_immutable_string(loaded_str);
+    return MAKE_IMMUTABLE_STRING(loaded_str);
 }
 
 /*

Modified: branches/r5rs/sigscheme/operations-srfi34.c
===================================================================
--- branches/r5rs/sigscheme/operations-srfi34.c	2005-12-16 23:59:09 UTC (rev 2617)
+++ branches/r5rs/sigscheme/operations-srfi34.c	2005-12-17 00:10:46 UTC (rev 2618)
@@ -61,7 +61,6 @@
 #define ERRMSG_HANDLER_RETURNED    "handler returned"
 #define ERRMSG_FALLBACK_EXHAUSTED  "fallback handler exhausted"
 
-#define MAKE_STR_COPYING scm_make_immutable_string_copying
 #define DECLARE_PRIVATE_FUNCTION(func_name, type)                            \
     DECLARE_INTERNAL_FUNCTION(func_name)
 
@@ -132,9 +131,12 @@
         scm_gc_protect(*var);
     }
 
-    errmsg_unhandled_exception = MAKE_STR_COPYING(ERRMSG_UNHANDLED_EXCEPTION);
-    errmsg_handler_returned    = MAKE_STR_COPYING(ERRMSG_HANDLER_RETURNED);
-    errmsg_fallback_exhausted  = MAKE_STR_COPYING(ERRMSG_FALLBACK_EXHAUSTED);
+    errmsg_unhandled_exception
+        = MAKE_IMMUTABLE_STRING_COPYING(ERRMSG_UNHANDLED_EXCEPTION);
+    errmsg_handler_returned
+        = MAKE_IMMUTABLE_STRING_COPYING(ERRMSG_HANDLER_RETURNED);
+    errmsg_fallback_exhausted
+        = MAKE_IMMUTABLE_STRING_COPYING(ERRMSG_FALLBACK_EXHAUSTED);
 
     sym_error      = scm_intern("error");
     sym_raise      = scm_intern("raise");

Modified: branches/r5rs/sigscheme/operations-srfi6.c
===================================================================
--- branches/r5rs/sigscheme/operations-srfi6.c	2005-12-16 23:59:09 UTC (rev 2617)
+++ branches/r5rs/sigscheme/operations-srfi6.c	2005-12-17 00:10:46 UTC (rev 2618)
@@ -118,7 +118,7 @@
     SCM_ASSERT_LIVE_PORT(port);
     cport = SCM_CHARPORT_DYNAMIC_CAST(ScmBaseCharPort, SCM_PORT_IMPL(port));
 
-    return scm_make_mutable_string_copying(ScmOutputStrPort_str(cport->bport));
+    return MAKE_STRING_COPYING(ScmOutputStrPort_str(cport->bport));
 }
 
 

Modified: branches/r5rs/sigscheme/operations.c
===================================================================
--- branches/r5rs/sigscheme/operations.c	2005-12-16 23:59:09 UTC (rev 2617)
+++ branches/r5rs/sigscheme/operations.c	2005-12-17 00:10:46 UTC (rev 2618)
@@ -559,7 +559,7 @@
   if (r == 10 && SCM_INT_VALUE (num) < 0)
     *--p = '-';
 
-  return scm_make_mutable_string_copying(p);
+  return MAKE_STRING_COPYING(p);
 }
 
 ScmObj
@@ -1033,7 +1033,7 @@
 {
     DECLARE_FUNCTION("symbol->string", procedure_fixed_1);
     ASSERT_SYMBOLP(obj);
-    return scm_make_immutable_string_copying(SCM_SYMBOL_NAME(obj));
+    return MAKE_IMMUTABLE_STRING_COPYING(SCM_SYMBOL_NAME(obj));
 }
 
 ScmObj
@@ -1206,7 +1206,7 @@
     ASSERT_INTP(length);
     len = SCM_INT_VALUE(length);
     if (len == 0)
-        return scm_make_mutable_string_copying("");
+        return MAKE_STRING_COPYING("");
     if (len < 0)
         ERR_OBJ("length must be a positive integer", length);
 
@@ -1386,7 +1386,7 @@
     memcpy(new_str, SCM_MBS_GET_STR(mbs), SCM_MBS_GET_SIZE(mbs));
     new_str[SCM_MBS_GET_SIZE(mbs)] = 0;
 
-    return scm_make_mutable_string(new_str);
+    return MAKE_STRING(new_str);
 }
 
 ScmObj
@@ -1402,7 +1402,7 @@
     DECLARE_FUNCTION("string-append", procedure_variadic_0);
 
     if (NO_MORE_ARG(args))
-        return scm_make_mutable_string_copying("");
+        return MAKE_STRING_COPYING("");
 
     /* count total size of the new string */
     for (strlst = args; !NULLP(strlst); strlst = CDR(strlst)) {
@@ -1424,7 +1424,7 @@
         p += strlen(SCM_STRING_STR(obj));
     }
 
-    return scm_make_mutable_string(new_str);
+    return MAKE_STRING(new_str);
 }
 
 ScmObj
@@ -1474,7 +1474,7 @@
     ASSERT_LISTP(lst);
 
     if (NULLP(lst))
-        return scm_make_mutable_string_copying("");
+        return MAKE_STRING_COPYING("");
 
     /* TODO: make efficient */
     sport = scm_p_srfi6_open_output_string();
@@ -1494,7 +1494,7 @@
 {
     DECLARE_FUNCTION("string-copy", procedure_fixed_1);
     ASSERT_STRINGP(str);
-    return scm_make_mutable_string_copying(SCM_STRING_STR(str));
+    return MAKE_STRING_COPYING(SCM_STRING_STR(str));
 }
 
 ScmObj
@@ -1514,7 +1514,7 @@
 
     str_len = SCM_STRING_LEN(str);
     if (str_len == 0)
-        return scm_make_mutable_string_copying("");
+        return MAKE_STRING_COPYING("");
 
     /* FIXME: support stateful encoding */
     next = SCM_CHARCODEC_INT2STR(scm_current_char_codec, ch_str,

Modified: branches/r5rs/sigscheme/read.c
===================================================================
--- branches/r5rs/sigscheme/read.c	2005-12-16 23:59:09 UTC (rev 2617)
+++ branches/r5rs/sigscheme/read.c	2005-12-17 00:10:46 UTC (rev 2618)
@@ -546,7 +546,7 @@
         case '\"':
             LBUF_EXTEND(lbuf, SCM_LBUF_F_STRING, offset + 1);
             *p = '\0';
-            obj = scm_make_immutable_string_copying(LBUF_BUF(lbuf));
+            obj = MAKE_IMMUTABLE_STRING_COPYING(LBUF_BUF(lbuf));
             LBUF_FREE(lbuf);
             return obj;
 

Modified: branches/r5rs/sigscheme/sigscheme.c
===================================================================
--- branches/r5rs/sigscheme/sigscheme.c	2005-12-16 23:59:09 UTC (rev 2617)
+++ branches/r5rs/sigscheme/sigscheme.c	2005-12-17 00:10:46 UTC (rev 2618)
@@ -174,12 +174,12 @@
       Fixing up
     =======================================================================*/
     /* to evaluate SigScheme-dependent codes conditionally */
-    scm_provide(scm_make_immutable_string_copying("sigscheme"));
+    scm_provide(MAKE_IMMUTABLE_STRING_COPYING("sigscheme"));
 #if SCM_STRICT_R5RS
-    scm_provide(scm_make_immutable_string_copying("strict-r5rs"));
+    scm_provide(MAKE_IMMUTABLE_STRING_COPYING("strict-r5rs"));
 #endif
 #if SCM_COMPAT_SIOD_BUGS
-    scm_provide(scm_make_immutable_string_copying("siod-bugs"));
+    scm_provide(MAKE_IMMUTABLE_STRING_COPYING("siod-bugs"));
 #endif
     scm_initialized = TRUE;
 }
@@ -345,7 +345,7 @@
         specified_codec = scm_mb_find_codec(encoding);
         if (!specified_codec) {
             if (scm_initialized) {
-                err_obj = scm_make_immutable_string_copying(encoding);
+                err_obj = MAKE_IMMUTABLE_STRING_COPYING(encoding);
                 scm_free_argv(argv);
                 ERR_OBJ("unsupported encoding", err_obj);
             } else {

Modified: branches/r5rs/sigscheme/sigscheme.h
===================================================================
--- branches/r5rs/sigscheme/sigscheme.h	2005-12-16 23:59:09 UTC (rev 2617)
+++ branches/r5rs/sigscheme/sigscheme.h	2005-12-17 00:10:46 UTC (rev 2618)
@@ -707,11 +707,10 @@
 ScmObj scm_make_int(int val);
 ScmObj scm_make_symbol(char *name, ScmObj v_cell);
 ScmObj scm_make_char(int val);
-ScmObj scm_make_string(char *str, int is_immutable);
 ScmObj scm_make_immutable_string(char *str);
 ScmObj scm_make_immutable_string_copying(const char *str);
-ScmObj scm_make_mutable_string(char *str);
-ScmObj scm_make_mutable_string_copying(const char *str);
+ScmObj scm_make_string(char *str);
+ScmObj scm_make_string_copying(const char *str);
 ScmObj scm_make_func(enum ScmFuncTypeCode type, ScmFuncType func);
 ScmObj scm_make_closure(ScmObj exp, ScmObj env);
 ScmObj scm_make_vector(ScmObj *vec, int len);

Modified: branches/r5rs/sigscheme/sigschemetype-compact.h
===================================================================
--- branches/r5rs/sigscheme/sigschemetype-compact.h	2005-12-16 23:59:09 UTC (rev 2617)
+++ branches/r5rs/sigscheme/sigschemetype-compact.h	2005-12-17 00:10:46 UTC (rev 2618)
@@ -239,8 +239,8 @@
 #define SCM_MAKE_CONS                     scm_make_cons
 #define SCM_MAKE_SYMBOL                   scm_make_symbol
 #define SCM_MAKE_CHAR                     scm_make_char
-#define SCM_MAKE_STRING                   scm_make_mutable_string
-#define SCM_MAKE_STRING_COPYING           scm_make_mutable_string_copying
+#define SCM_MAKE_STRING                   scm_make_string
+#define SCM_MAKE_STRING_COPYING           scm_make_string_copying
 #define SCM_MAKE_IMMUTABLE_STRING         scm_make_immutable_string
 #define SCM_MAKE_IMMUTABLE_STRING_COPYING scm_make_immutable_string_copying
 #define SCM_MAKE_FUNC                     scm_make_func

Modified: branches/r5rs/sigscheme/sigschemetype.h
===================================================================
--- branches/r5rs/sigscheme/sigschemetype.h	2005-12-16 23:59:09 UTC (rev 2617)
+++ branches/r5rs/sigscheme/sigschemetype.h	2005-12-17 00:10:46 UTC (rev 2618)
@@ -238,8 +238,8 @@
 #define SCM_MAKE_CONS                     scm_make_cons
 #define SCM_MAKE_SYMBOL                   scm_make_symbol
 #define SCM_MAKE_CHAR                     scm_make_char
-#define SCM_MAKE_STRING                   scm_make_mutable_string
-#define SCM_MAKE_STRING_COPYING           scm_make_mutable_string_copying
+#define SCM_MAKE_STRING                   scm_make_string
+#define SCM_MAKE_STRING_COPYING           scm_make_string_copying
 #define SCM_MAKE_IMMUTABLE_STRING         scm_make_immutable_string
 #define SCM_MAKE_IMMUTABLE_STRING_COPYING scm_make_immutable_string_copying
 #define SCM_MAKE_FUNC                     scm_make_func

Modified: branches/r5rs/sigscheme/storage-fatty.h
===================================================================
--- branches/r5rs/sigscheme/storage-fatty.h	2005-12-16 23:59:09 UTC (rev 2617)
+++ branches/r5rs/sigscheme/storage-fatty.h	2005-12-17 00:10:46 UTC (rev 2618)
@@ -142,8 +142,8 @@
 #define SCM_SAL_MAKE_CONS                     scm_make_cons
 #define SCM_SAL_MAKE_SYMBOL                   scm_make_symbol
 #define SCM_SAL_MAKE_CHAR                     scm_make_char
-#define SCM_SAL_MAKE_STRING                   scm_make_mutable_string
-#define SCM_SAL_MAKE_STRING_COPYING           scm_make_mutable_string_copying
+#define SCM_SAL_MAKE_STRING                   scm_make_string
+#define SCM_SAL_MAKE_STRING_COPYING           scm_make_string_copying
 #define SCM_SAL_MAKE_IMMUTABLE_STRING         scm_make_immutable_string
 #define SCM_SAL_MAKE_IMMUTABLE_STRING_COPYING scm_make_immutable_string_copying
 #define SCM_SAL_MAKE_FUNC                     scm_make_func

Modified: branches/r5rs/sigscheme/storage.c
===================================================================
--- branches/r5rs/sigscheme/storage.c	2005-12-16 23:59:09 UTC (rev 2617)
+++ branches/r5rs/sigscheme/storage.c	2005-12-17 00:10:46 UTC (rev 2618)
@@ -83,6 +83,7 @@
   File Local Function Declarations
 =======================================*/
 static void initialize_special_constants(void);
+static ScmObj scm_make_string_internal(char *str, int is_immutable);
 
 /*=======================================
   Function Implementations
@@ -195,8 +196,8 @@
     return obj;
 }
 
-ScmObj
-scm_make_string(char *str, int is_immutable)
+static ScmObj
+scm_make_string_internal(char *str, int is_immutable)
 {
     ScmObj obj = scm_make_obj_from_heap();
 
@@ -215,25 +216,25 @@
 ScmObj
 scm_make_immutable_string(char *str)
 {
-    return scm_make_string(str, 1);
+    return scm_make_string_internal(str, 1);
 }
 
 ScmObj
 scm_make_immutable_string_copying(const char *str)
 {
-    return scm_make_string(strdup(str), 1);
+    return scm_make_string_internal(strdup(str), 1);
 }
 
 ScmObj
-scm_make_mutable_string(char *str)
+scm_make_string(char *str)
 {
-    return scm_make_string(str, 0);
+    return scm_make_string_internal(str, 0);
 }
 
 ScmObj
-scm_make_mutable_string_copying(const char *str)
+scm_make_string_copying(const char *str)
 {
-    return scm_make_string(strdup(str), 0);
+    return scm_make_string_internal(strdup(str), 0);
 }
 
 ScmObj



More information about the uim-commit mailing list