Revision: 7184
Author:   ek.kato
Date:     Tue Jul  5 08:15:13 2011
Log:      - Fix uim functional even when --disable-notify is set.

* configure.ac
  - (UIM_USE_NOTIFY) : Rename to UIM_USE_NOTIFY_PLUGINS.
  - (UIM_USE_NOTIFY_PLUGINS) : Renamed.
* uim/dynlib.c : Follow the change.
* uim/uim-error.c : Ditto.
* uim/uim.c : Ditto.
  - (uim_init_internal) : Call uim_init_notify_subrs() even
    when --disable-notify is set.
  - (notify_get_plugins) : Implementation for
    !UIM_USE_NOTIFY_PLUGINS.
  - (notify_info) : Ditto.
  - (notify_fatal) : Ditto.
  - (uim_init_notify_subrs) : Ditto.
* uim/uim-internal.h : Follow the changes.

http://code.google.com/p/uim/source/detail?r=7184

Modified:
 /trunk/uim/dynlib.c
 /trunk/uim/uim-error.c
 /trunk/uim/uim-internal.h
 /trunk/uim/uim.c

=======================================
--- /trunk/uim/dynlib.c Thu Jan  6 18:09:56 2011
+++ /trunk/uim/dynlib.c Tue Jul  5 08:15:13 2011
@@ -42,7 +42,7 @@
 #include "uim-internal.h"
 #include "uim-scm.h"
 #include "uim-scm-abbrev.h"
-#if UIM_USE_NOTIFY
+#if UIM_USE_NOTIFY_PLUGINS
 #include "uim-notify.h"
 #endif
 #include "gettext.h"
=======================================
--- /trunk/uim/uim-error.c      Thu Jan  6 18:09:56 2011
+++ /trunk/uim/uim-error.c      Tue Jul  5 08:15:13 2011
@@ -44,7 +44,7 @@

 #include "uim.h"
 #include "uim-internal.h"
-#if UIM_USE_NOTIFY && !UIM_NON_LIBUIM_PROG
+#if UIM_USE_NOTIFY_PLUGINS && !UIM_NON_LIBUIM_PROG
 #include "uim-notify.h"
 #endif
 #include "gettext.h"
@@ -95,7 +95,7 @@
     }

/* And notify user of it via uim-notify in addition to the stderr msg. */
-#if UIM_USE_NOTIFY && !UIM_NON_LIBUIM_PROG
+#if UIM_USE_NOTIFY_PLUGINS && !UIM_NON_LIBUIM_PROG
     /* Since this function will also be called on hard situations such
      * as memory exhaustion, these uim_notify_*() calls may be failed
      * to notify user of the error, due to the memory shortage.
@@ -108,7 +108,7 @@
     } else {
       uim_notify_info(err_msg);
     }
-#endif  /* UIM_USE_NOTIFY */
+#endif  /* UIM_USE_NOTIFY_PLUGINS */
   }
 }

=======================================
--- /trunk/uim/uim-internal.h   Thu Jan  6 18:09:56 2011
+++ /trunk/uim/uim-internal.h   Tue Jul  5 08:15:13 2011
@@ -156,14 +156,12 @@
 void uim_init_im_subrs(void);
 void uim_init_key_subrs(void);
 void uim_init_util_subrs(void);
-#if UIM_USE_NOTIFY
 void uim_init_notify_subrs(void);
-#endif

 void uim_init_rk_subrs(void);
 void uim_init_intl_subrs(void);

-#if UIM_USE_NOTIFY
+#if UIM_USE_NOTIFY_PLUGINS
 uim_bool uim_notify_fatal_raw(const char *msg);
 #else
 uim_bool uim_notify_info(const char *msg_fmt, ...);
=======================================
--- /trunk/uim/uim.c    Sat May  7 07:55:59 2011
+++ /trunk/uim/uim.c    Tue Jul  5 08:15:13 2011
@@ -36,7 +36,7 @@
 #include <stdlib.h>
 #include <string.h>
 #include <assert.h>
-#if !UIM_USE_NOTIFY
+#if !UIM_USE_NOTIFY_PLUGINS
 #include <stdarg.h>
 #endif

@@ -48,7 +48,7 @@
 #include "uim-im-switcher.h"
 #include "uim-scm.h"
 #include "uim-scm-abbrev.h"
-#if UIM_USE_NOTIFY
+#if UIM_USE_NOTIFY_PLUGINS
 #include "uim-notify.h"
 #endif

@@ -136,10 +136,10 @@
   uim_init_iconv_subrs();
   uim_init_posix_subrs();
   uim_init_util_subrs();
-#if UIM_USE_NOTIFY
+#if UIM_USE_NOTIFY_PLUGINS
   uim_notify_init();  /* init uim-notify facility */
-  uim_init_notify_subrs();  /* init Scheme interface of uim-notify */
 #endif
+  uim_init_notify_subrs();  /* init Scheme interface of uim-notify */
   uim_init_key_subrs();
   uim_init_rk_subrs();
   uim_init_dynlib();
@@ -182,7 +182,7 @@
 #ifdef ENABLE_ANTHY_UTF8_STATIC
   uim_anthy_utf8_plugin_instance_quit();
 #endif
-#if UIM_USE_NOTIFY
+#if UIM_USE_NOTIFY_PLUGINS
   uim_notify_quit();
 #endif
   uim_scm_callf("annotation-unload", "");
@@ -723,7 +723,7 @@
   return name;
 }

-#if !UIM_USE_NOTIFY
+#if !UIM_USE_NOTIFY_PLUGINS
 uim_bool
 uim_notify_info(const char *msg_fmt, ...)
 {
@@ -753,7 +753,37 @@

   return (ret >= 0);
 }
-#endif  /* !UIM_USE_NOTIFY */
+
+static uim_lisp
+notify_get_plugins(void)
+{
+ return CONS(LIST3(MAKE_SYM("builtin"), MAKE_STR(N_("builtin")), MAKE_STR(N_("libuim builtin"))), uim_scm_null());
+}
+
+static uim_lisp
+notify_info(uim_lisp msg_)
+{
+  const char *msg = REFER_C_STR(msg_);
+
+  return MAKE_BOOL(uim_notify_info("%s", msg));
+}
+
+static uim_lisp
+notify_fatal(uim_lisp msg_)
+{
+  const char *msg = REFER_C_STR(msg_);
+
+  return MAKE_BOOL(uim_notify_fatal("%s", msg));
+}
+
+void
+uim_init_notify_subrs(void)
+{
+  uim_scm_init_proc0("uim-notify-get-plugins", notify_get_plugins);
+  uim_scm_init_proc1("uim-notify-info", notify_info);
+  uim_scm_init_proc1("uim-notify-fatal", notify_fatal);
+}
+#endif  /* !UIM_USE_NOTIFY_PLUGINS */

 /****************************************************************
  * Legacy 'mode' API                                            *

Reply via email to