[uim-commit] r386 - in trunk: scm uim
yamaken@freedesktop.org
yamaken@freedesktop.org
Fri Jan 28 14:56:11 PST 2005
Author: yamaken
Date: 2005-01-28 14:56:08 -0800 (Fri, 28 Jan 2005)
New Revision: 386
Modified:
trunk/scm/init.scm
trunk/uim/uim.c
Log:
* uim/uim.c
- (load_conf): Removed
- (uim_init_scm): Remove scm file loadings
* scm/init.scm
- (load-user-conf): New procedure. This is equivalent of load_conf()
- Add loading of fundamental part of uim as uim_init_scm() did
- This file initializes platform dependent execution
environment. The codes are written for ordinary UNIX desktop
system. Modify this file with careful investigation to change uim
configuration for special platforms such as embedded environments
Modified: trunk/scm/init.scm
===================================================================
--- trunk/scm/init.scm 2005-01-28 22:19:09 UTC (rev 385)
+++ trunk/scm/init.scm 2005-01-28 22:56:08 UTC (rev 386)
@@ -28,8 +28,30 @@
;;; SUCH DAMAGE.
;;;;
+;; This file initializes platform dependent execution
+;; environment. Following codes are written for ordinary UNIX desktop
+;; system. Modify this file with careful investigation to change uim
+;; configuration for special platforms such as embedded environments
+;; -- YamaKen 2005-01-29
+
+(require "plugin.scm");
+(require "custom-rt.scm");
+(require "im.scm");
(load "installed-modules.scm")
+(define load-user-conf
+ (lambda ()
+ (let ((orig-verbose (verbose))
+ (file (or (getenv "LIBUIM_USER_SCM_FILE")
+ (string-append (getenv "HOME") "/.uim"))))
+ (if (>= (verbose)
+ 1)
+ (verbose 1))
+ (let ((succeeded (try-load file)))
+ (verbose orig-verbose)
+ succeeded))))
+
+
(or (and (symbol-bound? 'per-user-enabled-im-list-loaded?)
per-user-enabled-im-list-loaded?)
(and (symbol-bound? 'im-lazy-loading-enabled?)
@@ -39,3 +61,10 @@
(for-each require-module installed-im-module-list)
(define enabled-im-list (reverse (cons 'direct
(map im-name im-list))))))
+
+;; must be loaded at last of IMs
+(require-module "direct")
+
+(or (getenv "LIBUIM_VANILLA")
+ (load-user-conf)
+ (load "default.scm"))
Modified: trunk/uim/uim.c
===================================================================
--- trunk/uim/uim.c 2005-01-28 22:19:09 UTC (rev 385)
+++ trunk/uim/uim.c 2005-01-28 22:56:08 UTC (rev 386)
@@ -508,40 +508,6 @@
return valid_im_name;
}
-
-static int
-load_conf()
-{
- struct passwd *pw;
- char *fn;
- long verbose, ret;
- struct stat st;
-
- verbose = uim_scm_get_verbose_level();
- fn = getenv("LIBUIM_USER_SCM_FILE");
-
- if (!fn) {
- pw = getpwuid(getuid());
- fn = malloc(strlen(pw->pw_dir) + sizeof("/.uim"));
- sprintf(fn, "%s/.uim", pw->pw_dir);
- } else {
- fn = strdup(fn);
- }
-
- if (stat(fn, &st) == -1) {
- free(fn);
- return -1;
- }
-
- if (verbose < 1) {
- uim_scm_set_verbose_level(1); /* to show error message */
- }
- ret = uim_scm_load_file(fn) ? 0 : -1;
- uim_scm_set_verbose_level(verbose);
- free(fn);
- return ret;
-}
-
int uim_set_candidate_selector_cb(uim_context uc,
void (*activate_cb)(void *ptr, int nr, int display_limit),
void (*select_cb)(void *ptr, int index),
@@ -660,18 +626,8 @@
scm_files = getenv("LIBUIM_SCM_FILES");
uim_scm_set_lib_path((scm_files) ? scm_files : SCM_FILES);
- uim_scm_require_file("plugin.scm");
- uim_scm_require_file("custom-rt.scm");
- uim_scm_require_file("im.scm");
- uim_scm_load_file("init.scm");
- /* must be loaded at last of IMs */
- UIM_EVAL_STRING(NULL, "(require-module \"direct\")");
+ uim_scm_require_file("init.scm");
- if (getenv("LIBUIM_VANILLA") ||
- load_conf() == -1) {
- uim_scm_load_file("default.scm");
- }
-
uim_return_str = NULL;
for (i = 0; i < (int)UIM_RETURN_STR_LIST_SIZE; i++){
uim_return_str_list[i] = NULL;
More information about the Uim-commit
mailing list