[uim-commit] r510 - in trunk: scm test uim
yamaken at freedesktop.org
yamaken at freedesktop.org
Thu Feb 3 17:08:19 PST 2005
Author: yamaken
Date: 2005-02-03 17:08:16 -0800 (Thu, 03 Feb 2005)
New Revision: 510
Modified:
trunk/scm/lazy-load.scm
trunk/test/test-im.scm
trunk/test/test-lazy-load.scm
trunk/uim/plugin.c
Log:
* uim/plugin.c
- (plugin_load):
* Fix invalid list iterations
* Simplify string handling
* scm/lazy-load.scm
- (stub-im-generate-init-handler): Support absense of stub-im
* test/test-im.scm
- (test custom-im-list-as-choice-rec): Follow recent change of
messages
* test/test-lazy-load.scm
- (test stub-im-generate-stub-im-list): Ditto
Modified: trunk/scm/lazy-load.scm
===================================================================
--- trunk/scm/lazy-load.scm 2005-02-03 23:26:39 UTC (rev 509)
+++ trunk/scm/lazy-load.scm 2005-02-04 01:08:16 UTC (rev 510)
@@ -34,7 +34,9 @@
(define stub-im-generate-init-handler
(lambda (name module-name)
(lambda (id fake-im fake-arg)
- (let ((stub-im-init-handler (im-init-handler (retrieve-im name))))
+ (let* ((stub-im (retrieve-im name))
+ (stub-im-init-handler (and stub-im
+ (im-init-handler stub-im))))
(and (require-module module-name)
(let* ((im (retrieve-im name))
(init-handler (im-init-handler im))
Modified: trunk/test/test-im.scm
===================================================================
--- trunk/test/test-im.scm 2005-02-03 23:26:39 UTC (rev 509)
+++ trunk/test/test-im.scm 2005-02-04 01:08:16 UTC (rev 510)
@@ -857,12 +857,14 @@
(require-module "tcode")))))
("test custom-im-list-as-choice-rec"
- (assert-equal '((canna "Canna" "Japanese Kana Kanji Conversion Engine, Canna")
- (skk "SKK" "uim's SKK like input method")
- (anthy "Anthy" "Japanese Kana Kanji Conversion Engine, Anthy"))
+ (assert-equal '((canna "Canna" "A multi-segment kana-kanji conversion engine")
+ (skk "SKK" "uim version of SKK input method")
+ (anthy "Anthy" "A multi-segment kana-kanji conversion engine"))
(uim '(custom-im-list-as-choice-rec
(map retrieve-im '(canna skk anthy)))))
- (assert-equal '((tcode "T-Code" "T-Code"))
+ (assert-equal '((tcode
+ "T-Code"
+ "A kanji direct input method"))
(uim '(custom-im-list-as-choice-rec
(map retrieve-im '(tcode)))))
(assert-equal ()
Modified: trunk/test/test-lazy-load.scm
===================================================================
--- trunk/test/test-lazy-load.scm 2005-02-03 23:26:39 UTC (rev 509)
+++ trunk/test/test-lazy-load.scm 2005-02-04 01:08:16 UTC (rev 510)
@@ -165,7 +165,7 @@
" \"ja\"\n"
" \"EUC-JP\"\n"
" \"T-Code\"\n"
- " \"T-Code\"\n"
+ " \"A kanji direct input method\"\n"
" \"tcode\")\n"
" (require-module \"tcode\")))\n"))
(uim '(stub-im-generate-stub-im-list '(tcode))))
@@ -190,7 +190,7 @@
" \"ja\"\n"
" \"EUC-JP\"\n"
" \"T-Code\"\n"
- " \"T-Code\"\n"
+ " \"A kanji direct input method\"\n"
" \"tcode\")\n"
" (require-module \"tcode\")))\n")
(string-append
@@ -218,7 +218,7 @@
" \"ja\"\n"
" \"EUC-JP\"\n"
" \"T-Code\"\n"
- " \"T-Code\"\n"
+ " \"A kanji direct input method\"\n"
" \"tcode\")\n"
" (require-module \"tcode\")))\n")
(string-append
Modified: trunk/uim/plugin.c
===================================================================
--- trunk/uim/plugin.c 2005-02-03 23:26:39 UTC (rev 509)
+++ trunk/uim/plugin.c 2005-02-04 01:08:16 UTC (rev 510)
@@ -65,7 +65,7 @@
static uim_lisp
plugin_load(uim_lisp _name)
{
- char *plugin_name;
+ const char *plugin_name;
char *plugin_lib_filename, *plugin_scm_filename;
#ifdef UIM_SCM_NESTED_EVAL
uim_lisp lib_path = uim_scm_eval_c_string("uim-plugin-lib-load-path");
@@ -81,57 +81,55 @@
size_t len;
- plugin_name = uim_scm_c_str(_name);
+ plugin_name = uim_scm_refer_c_str(_name);
if(plugin_name == NULL) {
return uim_scm_f();
}
-/* fprintf(stderr, "uim-plugin-lib-load-path\n"); */
- for(path_car = uim_scm_car(lib_path), path_cdr = uim_scm_cdr(lib_path);
- path_car != uim_scm_f();
- path_car = uim_scm_car(path_cdr), path_cdr = uim_scm_cdr(path_cdr))
+ for (path_cdr = lib_path;
+ !uim_scm_nullp(path_cdr);
+ path_cdr = uim_scm_cdr(path_cdr))
{
int fd;
- char *path = uim_scm_c_str(path_car);
+ const char *path;
+ path_car = uim_scm_car(path_cdr);
+ path = uim_scm_refer_c_str(path_car);
len = strlen(path) + 1 + strlen(PLUGIN_PREFIX) + strlen(plugin_name)+ strlen(PLUGIN_SUFFIX) + 1;
plugin_lib_filename = malloc(sizeof(char) * len);
snprintf(plugin_lib_filename, len, "%s/%s%s%s",
path, PLUGIN_PREFIX, plugin_name, PLUGIN_SUFFIX);
fd = open(plugin_lib_filename, O_RDONLY);
if(fd >= 0) {
- free(path);
close(fd);
break;
}
- free(path);
free(plugin_lib_filename);
plugin_lib_filename = NULL;
}
- for(path_car = uim_scm_car(scm_path), path_cdr = uim_scm_cdr(scm_path);
- path_car != uim_scm_f();
- path_car = uim_scm_car(path_cdr), path_cdr = uim_scm_cdr(path_cdr))
+ for (path_cdr = scm_path;
+ !uim_scm_nullp(path_cdr);
+ path_cdr = uim_scm_cdr(path_cdr))
{
int fd;
- char *path = uim_scm_c_str(path_car);
+ const char *path;
+ path_car = uim_scm_car(path_cdr);
+ path = uim_scm_refer_c_str(path_car);
len = strlen(path) + 1 + strlen(plugin_name)+ strlen(".scm") + 1;
plugin_scm_filename = malloc(sizeof(char) * len);
snprintf(plugin_scm_filename, len, "%s/%s.scm", path, plugin_name);
fd = open(plugin_scm_filename, O_RDONLY);
if(fd >= 0) {
- free(path);
close(fd);
break;
}
- free(path);
free(plugin_scm_filename);
plugin_scm_filename = NULL;
}
if(plugin_lib_filename == NULL) {
free(plugin_scm_filename);
- free(plugin_name);
return uim_scm_f();
}
@@ -141,7 +139,6 @@
if(library == NULL) {
fprintf(stderr, "load failed %s\n", dlerror());
free(plugin_scm_filename);
- free(plugin_name);
return uim_scm_f();
}
@@ -152,7 +149,6 @@
if(!plugin_instance_init) {
fprintf(stderr, "%s plugin init failed\n", plugin_name);
free(plugin_scm_filename);
- free(plugin_name);
return uim_scm_f();
}
@@ -165,7 +161,6 @@
fprintf(stderr, "%s plugin subsequent %s loading failed\n",
plugin_name, plugin_scm_filename);
free(plugin_scm_filename);
- free(plugin_name);
return uim_scm_f();
}
}
@@ -180,7 +175,6 @@
uim_scm_eval(form);
}
free(plugin_scm_filename);
- free(plugin_name);
return uim_scm_t();
}
More information about the Uim-commit
mailing list