~ubuntu-branches/ubuntu/maverick/uim/maverick

« back to all changes in this revision

Viewing changes to scm/plugin.scm

  • Committer: Bazaar Package Importer
  • Author(s): Masahito Omote
  • Date: 2008-06-25 19:56:33 UTC
  • mfrom: (3.1.18 intrepid)
  • Revision ID: james.westby@ubuntu.com-20080625195633-8jljph4rfq00l8o7
Tags: 1:1.5.1-2
* uim-tcode: provide tutcode-custom.scm, tutcode-bushudic.scm
  and tutcode-rule.scm (Closes: #482659)
* Fix FTBFS: segv during compile (Closes: #483078).
  I personally think this bug is not specific for uim but is a optimization
  problem on gcc-4.3.1. (https://bugs.freedesktop.org/show_bug.cgi?id=16477)

Show diffs side-by-side

added added

removed removed

Lines of Context:
3
3
;;;
4
4
;;; plugin.scm: Plugin for uim.
5
5
;;;
6
 
;;; Copyright (c) 2005-2006 uim Project http://uim.freedesktop.org/
 
6
;;; Copyright (c) 2005-2008 uim Project http://code.google.com/p/uim/
7
7
;;;
8
8
;;; All rights reserved.
9
9
;;;
35
35
(require "util.scm")
36
36
 
37
37
(define uim-plugin-lib-load-path
38
 
   (if (setugid?)
39
 
       (list (string-append (sys-pkglibdir) "/plugin"))
40
 
       (filter string?
41
 
              (append (list (getenv "LIBUIM_PLUGIN_LIB_DIR")
42
 
                            (string-append (getenv "HOME") "/.uim.d/plugin")
43
 
                            (string-append (sys-pkglibdir) "/plugin"))
44
 
                      ;; XXX
45
 
                      (if (getenv "LD_LIBRARY_PATH")
46
 
                          (string-split (getenv "LD_LIBRARY_PATH") ":")
47
 
                          ())))))
 
38
  (if (setugid?)
 
39
      (list (string-append (sys-pkglibdir) "/plugin"))
 
40
      (let ((home-dir (or (home-directory (user-name)) ""))
 
41
            (ld-library-path (getenv "LD_LIBRARY_PATH")))
 
42
        (filter string?
 
43
                (append (list (getenv "LIBUIM_PLUGIN_LIB_DIR")
 
44
                              (if home-dir
 
45
                                  (string-append home-dir "/.uim.d/plugin")
 
46
                                  '())
 
47
                              (string-append (sys-pkglibdir) "/plugin"))
 
48
                        ;; XXX
 
49
                        (if ld-library-path
 
50
                            (string-split ld-library-path ":")
 
51
                            '()))))))
48
52
 
49
53
(define uim-plugin-scm-load-path
50
54
  (if (setugid?)
51
55
      (list (sys-pkgdatadir))
52
 
      (filter string?
53
 
              (list (getenv "LIBUIM_SCM_FILES")
54
 
                    (string-append (getenv "HOME") "/.uim.d/plugin")
55
 
                    (sys-pkgdatadir)))))
 
56
      (let ((home-dir (or (home-directory (user-name)) "")))
 
57
        (filter string?
 
58
                (list (getenv "LIBUIM_SCM_FILES")
 
59
                      (if home-dir
 
60
                          (string-append home-dir "/.uim.d/plugin")
 
61
                          '())
 
62
                      (sys-pkgdatadir))))))
56
63
 
57
64
(define plugin-alist ())
58
65
(define plugin-func-alist ())
121
128
;; TODO: write test
122
129
(define load-module-conf
123
130
  (lambda ()
124
 
    (let* ((user-module-dir (string-append (getenv "HOME") "/.uim.d/plugin/"))
 
131
    (let* ((home-dir (or (home-directory (user-name)) ""))
 
132
           (user-module-dir (if home-dir
 
133
                                (string-append home-dir "/.uim.d/plugin/")
 
134
                                #f))
125
135
           (conf-file "installed-modules.scm")
126
 
           (user-conf-file (string-append user-module-dir conf-file)))
 
136
           (user-conf-file (if user-module-dir
 
137
                               (string-append user-module-dir conf-file)
 
138
                               #f)))
127
139
      (try-load conf-file)
128
 
      (if (setugid?)
 
140
      (if (or
 
141
           (setugid?)
 
142
           (not user-conf-file))
129
143
          #f
130
144
          (if (not (getenv "LIBUIM_VANILLA"))
131
145
              (let ((orig-module-list installed-im-module-list)
141
155
;; TODO: write test
142
156
(define load-enabled-modules
143
157
  (lambda ()
144
 
    (let* ((user-module-dir (string-append (getenv "HOME") "/.uim.d/plugin/"))
 
158
    (let* ((home-dir (or (home-directory (user-name)) ""))
 
159
           (user-module-dir (if home-dir
 
160
                                (string-append home-dir "/.uim.d/plugin/")
 
161
                                #f))
145
162
           (file "loader.scm")
146
 
           (user-file (string-append user-module-dir file)))
 
163
           (user-file (if user-module-dir
 
164
                          (string-append user-module-dir file)
 
165
                          #f)))
147
166
      (and (try-load file)
148
167
           (or (and (not (setugid?))
 
168
                    user-file
149
169
                    (try-load user-file))
150
170
               #t)))))