[uim-commit] r145 - trunk/uim

omote@freedesktop.org omote@freedesktop.org
Thu Jan 6 10:13:45 PST 2005


Author: omote
Date: 2005-01-06 10:13:42 -0800 (Thu, 06 Jan 2005)
New Revision: 145

Modified:
   trunk/uim/anthy.c
   trunk/uim/m17nlib.c
   trunk/uim/plugin.c
   trunk/uim/plugin.h
Log:
* Old plugin implementation is dropped.
  - uim/m17nlib.c, uim/anthy.c: Remove #ifndef NEW_UIM_PLUGIN sections.
  - plugin.c: Remove #ifndef sections.
  - plugin.h: Remove #ifndef NEW_UIM_PLUGIN sections and remove NEW_UIM_PLUGIN.


Modified: trunk/uim/anthy.c
===================================================================
--- trunk/uim/anthy.c	2005-01-06 15:43:22 UTC (rev 144)
+++ trunk/uim/anthy.c	2005-01-06 18:13:42 UTC (rev 145)
@@ -278,11 +278,7 @@
 }
 
 void
-#ifndef NEW_UIM_PLUGIN
-plugin_init(void)
-#else
 uim_plugin_instance_init(void)
-#endif
 {
   uim_scm_init_subr_0("anthy-lib-init", init_anthy_lib);
   uim_scm_init_subr_0("anthy-lib-alloc-context", create_context);
@@ -296,11 +292,7 @@
 }
 
 void
-#ifndef NEW_UIM_PLUGIN
-plugin_quit(void)
-#else
 uim_plugin_instance_quit(void)
-#endif
 {
   int i;
 

Modified: trunk/uim/m17nlib.c
===================================================================
--- trunk/uim/m17nlib.c	2005-01-06 15:43:22 UTC (rev 144)
+++ trunk/uim/m17nlib.c	2005-01-06 18:13:42 UTC (rev 145)
@@ -746,20 +746,14 @@
 
 
 void
-#ifndef NEW_UIM_PLUGIN
-plugin_init(void) {
-#else
 uim_plugin_instance_init(void)
 {
-#endif
   uim_init_m17nlib();
 }
 
-#ifndef NEW_UIM_PLUGIN
 void
 uim_plugin_instance_quit(void)
 {
   return;
 }
-#endif
 #endif /* HAVE_M17NLIB */

Modified: trunk/uim/plugin.c
===================================================================
--- trunk/uim/plugin.c	2005-01-06 15:43:22 UTC (rev 144)
+++ trunk/uim/plugin.c	2005-01-06 18:13:42 UTC (rev 145)
@@ -55,11 +55,6 @@
 #define dlfunc dlsym
 #endif
 
-#ifndef NEW_UIM_PLUGIN
-#define UIM_SYS_PLUGIN_LIB_DIR LIBDIR
-#define UIM_SYS_PLUGIN_SCM_DIR SCM_FILES
-#endif
-
 #define PLUGIN_PREFIX "libuim-"
 #ifdef __APPLE__
   #define PLUGIN_SUFFIX ".dylib"
@@ -70,26 +65,15 @@
 static uim_plugin_info_list *uim_plugin_list = NULL;
 static void plugin_list_append(uim_plugin_info_list *entry);
 
-#ifndef NEW_UIM_PLUGIN
-static char **plugin_lib_path = NULL;
-static char **plugin_scm_path = NULL;
-#endif
-
 static uim_lisp 
 plugin_load(uim_lisp _name) {
   uim_plugin_info *info;
   uim_plugin_info_list *info_list_entry;
   char *tmp;
-#ifndef NEW_UIM_PLUGIN
-  char *module_filename;
-  char *module_filename_fullpath;
-  char *module_scm_filename;
-#else
   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 path_car, path_cdr;
-#endif
 
   size_t len;
   
@@ -99,36 +83,6 @@
     return uim_scm_f();
   }
 
-#ifndef NEW_UIM_PLUGIN
-  len = strlen(PLUGIN_PREFIX) + strlen(tmp) + strlen(PLUGIN_SUFFIX) + 1;
-  module_filename = malloc(sizeof(char) * len);
-  snprintf(module_filename, len, "%s%s%s", PLUGIN_PREFIX, tmp, PLUGIN_SUFFIX);
-
-  libpath = plugin_lib_path;
-  scmpath = plugin_scm_path;
-
-  for(i = 2; i >= 0; i--, libpath--, scmpath--) {
-    int fd;
-
-    len = strlen(*libpath) + 1 + strlen(module_filename) + 1;
-    module_filename_fullpath = malloc(sizeof(char) * len);
-    snprintf(module_filename_fullpath, len, "%s/%s",
-       *libpath, module_filename);
-    fd = open(module_filename_fullpath, O_RDONLY);
-    if(fd >= 0) {
-	close(fd);
-	break;
-    }
-
-    free(module_filename_fullpath);
-    module_filename_fullpath = NULL;
-  }
-
-  if(module_filename_fullpath == NULL) {
-    free(tmp);
-    return uim_scm_f();
-  }
-#else
 /*  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();
@@ -172,40 +126,18 @@
     return uim_scm_f();
   }
   
-#endif
-  
-#ifndef NEW_UIM_PLUGIN
-  dlopen(module_filename_fullpath, RTLD_GLOBAL|RTLD_NOW);
-#endif
   info_list_entry = malloc(sizeof(uim_plugin_info_list));
   info = malloc(sizeof(uim_plugin_info));
   
-#ifndef NEW_UIM_PLUGIN
-  fprintf(stderr, "load %s\n",module_filename_fullpath);
-  info->library = dlopen(module_filename_fullpath, RTLD_NOW);
-#else
   fprintf(stderr, "load %s\n", plugin_lib_filename);
   info->library = dlopen(plugin_lib_filename, RTLD_NOW);
   free(plugin_lib_filename);
-#endif
 
   if(info->library == NULL) {
     fprintf(stderr, "load failed %s\n", dlerror());
     return uim_scm_f();
   }
 
-#ifndef NEW_UIM_PLUGIN
-  free(module_filename_fullpath);
-  free(module_filename);
-#endif
-
-#ifndef NEW_UIM_PLUGIN
-  info->plugin_init = (void (*)(void))dlfunc(info->library, "plugin_init");
-  if(info->plugin_init) {
-    fprintf(stderr, "plugin init\n");
-    (info->plugin_init)();
-  }
-#else
   info->plugin_instance_init = (void (*)(void))dlfunc(info->library,
 						      "uim_plugin_instance_init");
   info->plugin_instance_quit = (void (*)(void))dlfunc(info->library,
@@ -214,22 +146,12 @@
     fprintf(stderr, "plugin init\n");
     (info->plugin_instance_init)();
   }
-#endif
 
   /*	plugin_list_append(uim_plugin_entry); */
 
-#ifndef NEW_UIM_PLUGIN
-  len = strlen(*scmpath) + 1 + strlen(tmp) + strlen(".scm") + 1;
-  module_scm_filename = malloc(sizeof(char) * len);
-  snprintf(module_scm_filename, len, "%s/%s.scm", *scmpath, tmp);
-  uim_scm_require_file(module_scm_filename); 
-
-  free(module_scm_filename);
-#else
   fprintf(stderr, "plugin scm init\n");
   uim_scm_require_file(plugin_scm_filename);
   free(plugin_scm_filename);
-#endif
   return uim_scm_t();
 }
 
@@ -266,36 +188,7 @@
 
   uim_scm_init_subr_1("load-plugin", plugin_load);
   uim_scm_init_subr_1("unload-plugin", plugin_unload);
-#ifndef NEW_UIM_PLUGIN
-  if(plugin_scm_path != NULL && plugin_scm_path != NULL) {
-    return;
-  }
 
-  plugin_lib_dir_env = getenv("LIBUIM_PLUGIN_LIB_DIR");
-  plugin_scm_dir_env = getenv("LIBUIM_SCM_FILES");
-  if (plugin_lib_dir_env == NULL) 
-    plugin_lib_dir_env = "";
-  if (plugin_scm_dir_env == NULL)
-    plugin_scm_dir_env = "";
-
-  pw = getpwuid(getuid());
-
-  plugin_lib_path = malloc(sizeof(char *) * 3);
-  plugin_scm_path = malloc(sizeof(char *) * 3);
-  memset(plugin_lib_path, 0, sizeof(char *) * 3);
-  memset(plugin_scm_path, 0, sizeof(char *) * 3);
-
-  *plugin_lib_path++ = strdup(plugin_lib_dir_env);
-  *plugin_lib_path++ = strdup(UIM_SYS_PLUGIN_LIB_DIR);
-  *plugin_scm_path++ = strdup(plugin_scm_dir_env);
-  *plugin_scm_path++ = strdup(UIM_SYS_PLUGIN_SCM_DIR);
-
-  len = strlen(pw->pw_dir) + strlen("/.uim.d/plugin") + 1;
-  *plugin_lib_path = malloc(sizeof(char) * len);
-  *plugin_scm_path = malloc(sizeof(char) * len);
-  snprintf(*plugin_lib_path, len, "%s/.uim.d/plugin", pw->pw_dir);
-  snprintf(*plugin_scm_path, len, "%s/.uim.d/plugin", pw->pw_dir);
-#endif
   return;
 }
 
@@ -305,11 +198,7 @@
   uim_plugin_info_list *cur;
   for(cur = uim_plugin_list; cur != NULL; cur = cur->next)
     {
-#ifndef NEW_UIM_PLUGIN      
-      (*((cur->plugin)->plugin_quit))();
-#else
       (*((cur->plugin)->plugin_instance_quit))();
-#endif
       dlclose((cur->plugin)->library);
     }
 }

Modified: trunk/uim/plugin.h
===================================================================
--- trunk/uim/plugin.h	2005-01-06 15:43:22 UTC (rev 144)
+++ trunk/uim/plugin.h	2005-01-06 18:13:42 UTC (rev 145)
@@ -35,20 +35,15 @@
 #ifndef _uim_plugin_h_included_
 #define _uim_plugin_h_included_
 
-/* #define NEW_UIM_PLUGIN 1 */
+#define NEW_UIM_PLUGIN 1
 
 typedef struct _uim_plugin_info {
   char *name;        /* XXX: should have in scm? */
   char *description; /* XXX: should have in scm? */
   char *author;      /* XXX: should have in scm? */
   char *version;     /* XXX: should have in scm? */
-#ifndef NEW_UIM_PLUGIN
-  void (*plugin_init)(void);
-  void (*plugin_quit)(void);
-#else
   void (*plugin_instance_init)(void);
   void (*plugin_instance_quit)(void);
-#endif
   void *library;
   /*	void *plugin_unload; */
 /*	void *plugin_extra_funcs */



More information about the Uim-commit mailing list