[uim-commit] r357 - in trunk: examples/uim-custom helper qt/uim-kdehelper/src/pref uim

yamaken@freedesktop.org yamaken@freedesktop.org
Wed Jan 26 08:48:28 PST 2005


Author: yamaken
Date: 2005-01-26 08:48:25 -0800 (Wed, 26 Jan 2005)
New Revision: 357

Added:
   trunk/uim/uim-custom-enabler.c
Modified:
   trunk/examples/uim-custom/Makefile.am
   trunk/helper/Makefile.am
   trunk/qt/uim-kdehelper/src/pref/Makefile.am
   trunk/uim/Makefile.am
   trunk/uim/plugin.c
   trunk/uim/uim-custom.c
   trunk/uim/uim.c
Log:
* This commit splits libuim-custom off from libuim as optional part of
  libuim. Users of uim-custom must link libuim-custom explicitly

* uim/uim.c
  - (uim_quit): Remove comment outed uim_custom_quit()
* uim/uim-custom.c
  - (uim_custom_enable):
    * Replace with (load-plugin "custom-enabler")
    * Modify the comment
  - (uim_custom_init):
    * Add prototype declaration
    * New function (reverted to previous implementation)
    * Modify the comment
  - (uim_custom_quit):
    * Add prototype declaration
    * Modify the comment
* uim/uim-custom-enabler.c
  - New file
  - This plugin is only used for managing initialization and
    finalization of uim-custom API by using plugin facility. Users of
    uim-custom API must also link libuim-custom at
    compile-time. uim_custom_init() and uim_custom_quit() provides the
    initialization and finalization function itself, and this file and
    uim_custom_enable() provides an interface for how to invoke
    them. The two parts are responsible for orthogonal issues and
    should be kept separated
  - (uim_plugin_instance_init, uim_plugin_instance_quit): New function
* uim/plugin.c
  - (plugin_load): Accept plugin without corresponding scm file

* uim/Makefile.am
  - Add build rule for libuim-custom
  - Add build rule for libuim-custom-enabler.so

* qt/uim-kdehelper/src/pref/Makefile.am
* helper/Makefile.am
* examples/uim-custom/Makefile.am
  - Add -luim-custom


Modified: trunk/examples/uim-custom/Makefile.am
===================================================================
--- trunk/examples/uim-custom/Makefile.am	2005-01-26 13:33:05 UTC (rev 356)
+++ trunk/examples/uim-custom/Makefile.am	2005-01-26 16:48:25 UTC (rev 357)
@@ -1,4 +1,4 @@
-uim_libs   = $(top_builddir)/uim/libuim.la
+uim_libs   = $(top_builddir)/uim/libuim.la $(top_builddir)/uim/libuim-custom.la
 
 noinst_PROGRAMS = uim-custom-variable uim-custom-dump uim-custom-update
 

Modified: trunk/helper/Makefile.am
===================================================================
--- trunk/helper/Makefile.am	2005-01-26 13:33:05 UTC (rev 356)
+++ trunk/helper/Makefile.am	2005-01-26 16:48:25 UTC (rev 357)
@@ -74,7 +74,8 @@
 
 if GTK2_4
 uim_pref_gtk_SOURCES  = pref-gtk.c
-uim_pref_gtk_LDADD    = @GTK2_LIBS@ $(top_builddir)/uim/libuim.la
+uim_pref_gtk_LDADD    = @GTK2_LIBS@ $(top_builddir)/uim/libuim.la \
+			$(top_builddir)/uim/libuim-custom.la
 uim_pref_gtk_CPPFLAGS = -I$(top_srcdir) -I$(top_builddir)
 uim_pref_gtk_CFLAGS   = @GTK2_CFLAGS@ -Wall
 endif

Modified: trunk/qt/uim-kdehelper/src/pref/Makefile.am
===================================================================
--- trunk/qt/uim-kdehelper/src/pref/Makefile.am	2005-01-26 13:33:05 UTC (rev 356)
+++ trunk/qt/uim-kdehelper/src/pref/Makefile.am	2005-01-26 16:48:25 UTC (rev 357)
@@ -5,6 +5,6 @@
 
 bin_PROGRAMS = uim-pref-qt
 uim_pref_qt_SOURCES = uim-pref-qt.cpp
-uim_pref_qt_LDFLAGS = $(all_libraries) $(KDE_RPATH) -luim
+uim_pref_qt_LDFLAGS = $(all_libraries) $(KDE_RPATH) -luim -luim-custom
 uim_pref_qt_LDADD = $(LIB_QT) $(LIB_KUTILS)
 

Modified: trunk/uim/Makefile.am
===================================================================
--- trunk/uim/Makefile.am	2005-01-26 13:33:05 UTC (rev 356)
+++ trunk/uim/Makefile.am	2005-01-26 16:48:25 UTC (rev 357)
@@ -4,7 +4,7 @@
 
 uim_defs = -DSCM_FILES=\"$(datadir)/uim\"
 
-lib_LTLIBRARIES = libuim.la
+lib_LTLIBRARIES = libuim.la libuim-custom.la
 
 uim_plugin_LTLIBRARIES = 
 uim_plugindir = $(pkglibdir)/plugin
@@ -15,7 +15,6 @@
 libuim_la_SOURCES = uim.c uim-scm.c uim-util.c uim-func.c uim-key.c \
 		siod.h context.h gettext.h \
 		uim-helper.c uim-helper-client.c \
-		uim-custom.c \
 		intl.c \
 		uim-ipc.c \
 		getpeereid.c \
@@ -36,6 +35,8 @@
   pkginclude_HEADERS += uim-compat-scm.h
 endif
 
+libuim_custom_la_SOURCES = uim-custom.c
+
 if M17NLIB
   uim_plugin_LTLIBRARIES += libuim-m17nlib.la
   libuim_m17nlib_la_SOURCES = m17nlib.c
@@ -91,6 +92,17 @@
 libuim_la_CPPFLAGS += -DDEBUG -DDEBUG_SCM=1
 endif
 
+libuim_custom_la_LDFLAGS = -version-info 0:1:0 -export-symbols-regex uim.\*
+libuim_custom_la_LIBADD = 
+libuim_custom_la_CPPFLAGS = $(uim_defs) -I$(top_srcdir)
+
+uim_plugin_LTLIBRARIES += libuim-custom-enabler.la
+libuim_custom_enabler_la_SOURCES = uim-custom-enabler.c
+libuim_custom_enabler_la_LIBADD = libuim.la libuim-custom.la
+libuim_custom_enabler_la_LDFLAGS = -rpath $(uim_plugindir) -avoid-version -module
+libuim_custom_enabler_la_CPPFLAGS = -I$(top_srcdir)
+
+
 bin_PROGRAMS = uim-helper-server uim-sh
 
 uim_helper_server_LIBS =  

Modified: trunk/uim/plugin.c
===================================================================
--- trunk/uim/plugin.c	2005-01-26 13:33:05 UTC (rev 356)
+++ trunk/uim/plugin.c	2005-01-26 16:48:25 UTC (rev 357)
@@ -125,7 +125,7 @@
     plugin_scm_filename = NULL;
   }
   
-  if(plugin_lib_filename == NULL || plugin_scm_filename == NULL) {
+  if(plugin_lib_filename == NULL) {
     return uim_scm_f();
   }
   
@@ -151,7 +151,8 @@
   }
 
   (plugin_instance_init)();
-  uim_scm_require_file(plugin_scm_filename);
+  if (plugin_scm_filename)
+    uim_scm_require_file(plugin_scm_filename);
 
   {
     uim_lisp form;

Added: trunk/uim/uim-custom-enabler.c
===================================================================
--- trunk/uim/uim-custom-enabler.c	2005-01-26 13:33:05 UTC (rev 356)
+++ trunk/uim/uim-custom-enabler.c	2005-01-26 16:48:25 UTC (rev 357)
@@ -0,0 +1,62 @@
+/*
+
+  Copyright (c) 2005 uim Project http://uim.freedesktop.org/
+
+  All rights reserved.
+
+  Redistribution and use in source and binary forms, with or without
+  modification, are permitted provided that the following conditions
+  are met:
+
+  1. Redistributions of source code must retain the above copyright
+     notice, this list of conditions and the following disclaimer.
+  2. Redistributions in binary form must reproduce the above copyright
+     notice, this list of conditions and the following disclaimer in the
+     documentation and/or other materials provided with the distribution.
+  3. Neither the name of authors nor the names of its contributors
+     may be used to endorse or promote products derived from this software
+     without specific prior written permission.
+
+  THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
+  ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+  IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+  ARE DISCLAIMED.  IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
+  FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+  DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
+  OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+  HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+  LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
+  OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
+  SUCH DAMAGE.
+
+*/
+
+/*
+  This plugin is only used for managing initialization and finalization of
+  uim-custom API by using plugin facility. Users of uim-custom API must also
+  link libuim-custom at compile-time. uim_custom_init() and uim_custom_quit()
+  provides the initialization and finalization function itself, and this file
+  and uim_custom_enable() provides an interface for how to invoke them. The
+  two parts are responsible for orthogonal issues and should be kept
+  separated.  -- YamaKen 2005-01-27
+*/
+
+
+#include "plugin.h"
+#include "uim-custom.h"
+
+uim_bool uim_custom_init(void);
+uim_bool uim_custom_quit(void);
+
+
+void
+uim_plugin_instance_init(void)
+{
+  uim_custom_init();
+}
+
+void
+uim_plugin_instance_quit(void)
+{
+  uim_custom_quit();
+}

Modified: trunk/uim/uim-custom.c
===================================================================
--- trunk/uim/uim-custom.c	2005-01-26 13:33:05 UTC (rev 356)
+++ trunk/uim/uim-custom.c	2005-01-26 16:48:25 UTC (rev 357)
@@ -58,6 +58,10 @@
 typedef void (*uim_custom_cb_update_cb_t)(void *ptr, const char *custom_sym);
 typedef void (*uim_custom_global_cb_update_cb_t)(void *ptr);
 
+/* exported for internal use */
+uim_bool uim_custom_init(void);
+uim_bool uim_custom_quit(void);
+
 static char *c_list_to_str(const void *const *list, char *(*mapper)(const void *elem), const char *sep);
 
 static int uim_custom_type_eq(const char *custom_sym, const char *custom_type);
@@ -629,8 +633,9 @@
 }
 
 /**
- * Enable full of custom API. This function must be called before uim_custom_*()
- * functions are called. uim_init() must be called before this function.
+ * Enables use of custom API. This function must be called before
+ * uim_custom_*() functions are called. uim_init() must be called before this
+ * function.
  *
  * @see uim_init()
  * @retval UIM_TRUE succeeded
@@ -639,6 +644,23 @@
 uim_bool
 uim_custom_enable(void)
 {
+  UIM_EVAL_STRING(NULL, "(load-plugin \"custom-enabler\")");
+  return uim_scm_c_bool(uim_scm_return_value());
+}
+
+/*
+ * This function is exported as internal use. Intentionally disdocumented.
+ *
+ * Initializes custom API. This function must be called before uim_custom_*()
+ * functions are called. uim_init() must be called before this function.
+ *
+ * @see uim_init()
+ * @retval UIM_TRUE succeeded
+ * @retval UIM_FALSE failed
+ */
+uim_bool
+uim_custom_init(void)
+{
   return_val = uim_scm_f();
 
   uim_scm_gc_protect(&return_val);
@@ -655,9 +677,11 @@
   return UIM_TRUE;
 }
 
-/**
- * Finalizes custom API. This function called in uim_quit().
+/*
+ * This function is exported as internal use. Intentionally disdocumented.
  *
+ * Finalizes custom API. This function must be called before uim_quit().
+ *
  * @see uim_quit()
  * @retval UIM_TRUE succeeded
  * @retval UIM_FALSE failed

Modified: trunk/uim/uim.c
===================================================================
--- trunk/uim/uim.c	2005-01-26 13:33:05 UTC (rev 356)
+++ trunk/uim/uim.c	2005-01-26 16:48:25 UTC (rev 357)
@@ -708,9 +708,6 @@
     }
   }
   /**/
-#if 0
-  uim_custom_quit();
-#endif
   uim_quit_plugin();
   uim_scm_quit();
   uim_last_client_encoding = NULL;



More information about the Uim-commit mailing list