Pluggable module support in uim(was Re: [Uim] Will you upload daily snapshots of UIM?)

Masahito Omote omote at t-base.ne.jp
Tue Dec 14 19:18:34 EET 2004


Hi,

On Tue, 14 Dec 2004 17:36:54 +0900
TOKUNAGA Hiroyuki <tkng at xem.jp> wrote:

> BTW, I think 'module' is better word than 'plugin', how do you think,
> Masahito?

I have no preference between them. But we have to discuss the detail of
the implementation. (In this mail, I use 'plugin' for now.)

0) Basic design
 As you know, opnions about the treatment of Scheme and C is divided between 
 comitters. That is whether Scheme and C should be tightly bounded or not in
 uim. So which way we choose, plugin's approach is drastically changed. 
 (In svn repository, I take the latter design.)

 If we take the former, shared library only prepare simple scheme binding from C/C++ or
 fully implement by Scheme and only implement dlfcn functions by C.
  a) Prepare the simple binding to the libraries.
   RkBgnBun in libcanna for example.
   static LISP canna_rk_bgnbun(LISP _cxnum, LISP _yomi, LISP _maxyomi, LISP _mode)
   {
      int cxnum = uim_scm_c_int(_cxnum)
      ...
      ret = RkBgnBun(cxnum, yomi, maxyomi, mode);
      return uim_scm_intern_c_int(ret);
   }
  b) Prepare the binding to dlopen, dlsym, dlclose and dlerror only. All operations
     are written in Scheme.

     (load-plugin "libcanna.so")
     (dlsym 'canna-rk-bgnbun "RkBgnBun")
     ...
     (canna-rk-bgnbun '(cxnum yomi maxyomi mode))

 If we take the latter, we simplify Scheme codes and operate to some extent in C.

But I have already implemented in the latter. So following sections are expected to
the latter.

1) Loading plugin
 o Only load shared library or load .scm at the same time
   Current code only load shraed library but I think uim have to load
   Scheme code at the same time.

 o Plugin's path and loading order prioriy
   I'm implementing them as follows:
     a) 'LIBUIM_PLUGIN_DIR' for all users but mainly for developers.
     b) ~/.uim.d/plugins/ for each users.
     c) $libexecdir/plugins/ for all users.

2) Unloding plugin
 o Unloding plugins is not supported at all. If we implement it, we have to take
   more care of unbounding symbols. If not completed, segv may happen.

   Of couse, not to support plugins unloading is one of the choise.
 o Implement plugins unloding dialog in uim-pref.

Thanks,
-- 
Masahito Omote(omote at utyuuzin.net, omote at sapmed.ac.jp, omote at debian.org)



More information about the uim mailing list