Revision: 7187
Author: ek.kato
Date: Tue Jul 5 09:04:53 2011
Log: * Merge r7184, r7185, r7186 from trunk.
http://code.google.com/p/uim/source/detail?r=7187
Modified:
/branches/1.7/configure.ac
/branches/1.7/uim/dynlib.c
/branches/1.7/uim/uim-error.c
/branches/1.7/uim/uim-internal.h
/branches/1.7/uim/uim.c
=======================================
--- /branches/1.7/configure.ac Tue May 17 02:23:43 2011
+++ /branches/1.7/configure.ac Tue Jul 5 09:04:53 2011
@@ -1638,7 +1638,7 @@
have_notify_opt=no ])
if test "x$enable_notify" != xno; then
- AC_DEFINE(UIM_USE_NOTIFY, 1, [Define to 1 if you want to use uim-notify])
+ AC_DEFINE(UIM_USE_NOTIFY_PLUGINS, 1, [Define to 1 if you want to use
uim-notify plugins])
use_notify="${use_notify}stderr "
for i in `echo $enable_notify | ${SED} 's/,/ /g'`; do
=======================================
--- /branches/1.7/uim/dynlib.c Thu Jan 6 18:09:56 2011
+++ /branches/1.7/uim/dynlib.c Tue Jul 5 09:04:53 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"
=======================================
--- /branches/1.7/uim/uim-error.c Thu Jan 6 18:09:56 2011
+++ /branches/1.7/uim/uim-error.c Tue Jul 5 09:04:53 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 */
}
}
=======================================
--- /branches/1.7/uim/uim-internal.h Thu Jan 6 18:09:56 2011
+++ /branches/1.7/uim/uim-internal.h Tue Jul 5 09:04:53 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, ...);
=======================================
--- /branches/1.7/uim/uim.c Sat May 7 07:55:59 2011
+++ /branches/1.7/uim/uim.c Tue Jul 5 09:04:53 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,8 +48,10 @@
#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"
+#else
+#include "gettext.h"
#endif
@@ -136,10 +138,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 +184,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 +725,7 @@
return name;
}
-#if !UIM_USE_NOTIFY
+#if !UIM_USE_NOTIFY_PLUGINS
uim_bool
uim_notify_info(const char *msg_fmt, ...)
{
@@ -753,7 +755,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 *