Author: yamakenz
Date: Mon Feb 11 05:52:14 2008
New Revision: 5159
Modified:
trunk/uim/uim-internal.h
trunk/uim/uim.c
Log:
* uim/uim-internal.h
- (uim_notify_info, uim_notify_fatal): Replace temporary macro
definition with prototype decl
* uim/uim.c
- (uim_notify_info, uim_notify_fatal): New function for !UIM_USE_NOTIFY
Modified: trunk/uim/uim-internal.h
==============================================================================
--- trunk/uim/uim-internal.h (original)
+++ trunk/uim/uim-internal.h Mon Feb 11 05:52:14 2008
@@ -166,9 +166,8 @@
#if UIM_USE_NOTIFY
uim_bool uim_notify_fatal_raw(const char *msg);
#else
-/* FIXME: Output to stderr */
-#define uim_notify_info printf
-#define uim_notify_fatal printf
+uim_bool uim_notify_info(const char *msg_fmt, ...);
+uim_bool uim_notify_fatal(const char *msg_fmt, ...);
#endif
void uim_set_encoding(uim_context uc, const char *enc);
Modified: trunk/uim/uim.c
==============================================================================
--- trunk/uim/uim.c (original)
+++ trunk/uim/uim.c Mon Feb 11 05:52:14 2008
@@ -36,6 +36,9 @@
#include <stdlib.h>
#include <string.h>
#include <assert.h>
+#if !UIM_USE_NOTIFY
+#include <stdarg.h>
+#endif
#include "uim.h"
#include "uim-internal.h"
@@ -708,6 +711,38 @@
return name;
}
+
+#if !UIM_USE_NOTIFY
+uim_bool
+uim_notify_info(const char *msg_fmt, ...)
+{
+ va_list args;
+ int ret;
+
+ va_start(args, msg_fmt);
+ fputs("libuim: [info] ", stderr);
+ ret = vfprintf(stderr, msg_fmt, args);
+ fputs("\n", stderr);
+ va_end(args);
+
+ return (ret >= 0);
+}
+
+uim_bool
+uim_notify_fatal(const char *msg_fmt, ...)
+{
+ va_list args;
+ int ret;
+
+ va_start(args, msg_fmt);
+ fputs("libuim: [fatal] ", stderr);
+ ret = vfprintf(stderr, msg_fmt, args);
+ fputs("\n", stderr);
+ va_end(args);
+
+ return (ret >= 0);
+}
+#endif /* !UIM_USE_NOTIFY */
/****************************************************************
* Legacy 'mode' API *