[uim-commit] r1239 - branches/r5rs/uim

kzk at freedesktop.org kzk at freedesktop.org
Sat Aug 20 04:13:03 EST 2005


Author: kzk
Date: 2005-08-19 11:12:58 -0700 (Fri, 19 Aug 2005)
New Revision: 1239

Modified:
   branches/r5rs/uim/plugin.c
   branches/r5rs/uim/uim-compat-scm.c
   branches/r5rs/uim/uim-key.c
   branches/r5rs/uim/uim-scm.c
Log:
* Avoid to use Scm_eval_c_string, because it behaves weird now...
  Anyway, using eval_c_string to get symbol value is a bit slow
  because it needs parsing. So, this change is basically good, I
  think.

* uim/uim-compat-scm.c
  - (uim_scm_symbol_value_bool): use uim_scm_symbol_value instead of
    Scm_eval_c_string
  - (uim_scm_symbol_value): reimplement by using ScmOp_symbol_value
* uim/plugin.c
  - (plugin_load): use uim_scm_symbol_value to get symbol value
    instead of using uim_scm_eval_c_string

* uim/uim-scm.c
  - (uim_scm_eval_c_string): fix memory leak
* uim/uim-scm.c
  - (define_valid_key_symbols): protect stack because this function
    is called at top-level.


Modified: branches/r5rs/uim/plugin.c
===================================================================
--- branches/r5rs/uim/plugin.c	2005-08-19 18:04:31 UTC (rev 1238)
+++ branches/r5rs/uim/plugin.c	2005-08-19 18:12:58 UTC (rev 1239)
@@ -65,15 +65,15 @@
 {
   const char *plugin_name;
   char *plugin_lib_filename, *plugin_scm_filename;
-  uim_lisp lib_path = uim_scm_eval_c_string("uim-plugin-lib-load-path");
-  uim_lisp scm_path = uim_scm_eval_c_string("uim-plugin-scm-load-path");
+  uim_lisp lib_path = uim_scm_symbol_value("uim-plugin-lib-load-path");
+  uim_lisp scm_path = uim_scm_symbol_value("uim-plugin-scm-load-path");
   uim_lisp path_car, path_cdr;
   void *library;
   void (*plugin_instance_init)(void);
   void (*plugin_instance_quit)(void);
 
   size_t len;
-  
+
   plugin_name = uim_scm_refer_c_str(_name);
   
   if (plugin_name == NULL) {
@@ -220,7 +220,7 @@
   uim_lisp alist, rest, entry, name;
 
   uim_scm_gc_protect_stack(&stack_start);
-  alist = uim_scm_eval_c_string("plugin-alist");
+  alist = uim_scm_symbol_value("plugin-alist");
   for (rest = alist; !uim_scm_nullp(rest); rest = uim_scm_cdr(rest)) {
     entry = uim_scm_car(rest);
     name = uim_scm_car(entry);

Modified: branches/r5rs/uim/uim-compat-scm.c
===================================================================
--- branches/r5rs/uim/uim-compat-scm.c	2005-08-19 18:04:31 UTC (rev 1238)
+++ branches/r5rs/uim/uim-compat-scm.c	2005-08-19 18:12:58 UTC (rev 1239)
@@ -124,7 +124,7 @@
   if (!symbol_str)
     return UIM_FALSE;
 
-  val = uim_scm_c_bool((uim_lisp)Scm_eval_c_string(symbol_str));
+  val = uim_scm_c_bool(uim_scm_symbol_value(symbol_str));
 
   return val;
 }
@@ -155,7 +155,9 @@
 uim_lisp
 uim_scm_symbol_value(const char *symbol_str)
 {
-  return (uim_lisp)Scm_eval_c_string(symbol_str);
+  return (uim_lisp)ScmOp_symbol_value(Scm_NewCons(Scm_Intern(symbol_str),
+						  SigScm_nil),
+				      SigScm_nil);
 }
 
 uim_lisp

Modified: branches/r5rs/uim/uim-key.c
===================================================================
--- branches/r5rs/uim/uim-key.c	2005-08-19 18:04:31 UTC (rev 1238)
+++ branches/r5rs/uim/uim-key.c	2005-08-19 18:12:58 UTC (rev 1239)
@@ -161,14 +161,19 @@
 static void
 define_valid_key_symbols(void)
 {
+  uim_lisp stack_start;
   int i;
 
+  uim_scm_gc_protect_stack(&stack_start);
+
   UIM_EVAL_STRING(NULL, "(define valid-key-symbols ())");
   for (i = 0; key_tab[i].key; i++) {
     UIM_EVAL_FSTRING1(NULL,
 		      "(set! valid-key-symbols (cons '%s valid-key-symbols))",
 		      key_tab[i].str);
   }
+
+  uim_scm_gc_unprotect_stack(&stack_start);
 }
 
 static const char *

Modified: branches/r5rs/uim/uim-scm.c
===================================================================
--- branches/r5rs/uim/uim-scm.c	2005-08-19 18:04:31 UTC (rev 1238)
+++ branches/r5rs/uim/uim-scm.c	2005-08-19 18:12:58 UTC (rev 1239)
@@ -332,7 +332,7 @@
 uim_lisp
 uim_scm_eval_c_string(const char *str)
 {
-  return (uim_lisp)Scm_eval_c_string(strdup(str));
+  return (uim_lisp)Scm_eval_c_string(str);
 }
 
 uim_lisp



More information about the uim-commit mailing list