[uim-commit] r403 - trunk/uim
yamaken at freedesktop.org
yamaken at freedesktop.org
Sun Jan 30 15:22:55 PST 2005
Author: yamaken
Date: 2005-01-30 15:22:33 -0800 (Sun, 30 Jan 2005)
New Revision: 403
Modified:
trunk/uim/intl.c
trunk/uim/uim.c
Log:
* uim/intl.c
- (intl_bind_textdomain_codeset):
* Add validity check for args
* Add proper NULL handlings
- (intl_dgettext): Add validity check for args
* uim/uim.c
- Move config.h to top
- (uim_init_scm): Add default encoding configuration as commented
out code
Modified: trunk/uim/intl.c
===================================================================
--- trunk/uim/intl.c 2005-01-30 23:05:35 UTC (rev 402)
+++ trunk/uim/intl.c 2005-01-30 23:22:33 UTC (rev 403)
@@ -92,8 +92,23 @@
static uim_lisp
intl_bind_textdomain_codeset(uim_lisp domainname, uim_lisp codeset)
{
- return uim_scm_make_str(bind_textdomain_codeset(uim_scm_refer_c_str(domainname),
- uim_scm_refer_c_str(codeset)));
+ const char *c_current_codeset, *c_codeset;
+ uim_lisp current_codeset;
+
+ if (!uim_scm_stringp(domainname)
+ || !(uim_scm_stringp(codeset) || FALSEP(codeset)))
+ return uim_scm_f();
+
+ c_codeset = (FALSEP(codeset)) ? NULL : uim_scm_refer_c_str(codeset);
+ c_current_codeset = bind_textdomain_codeset(uim_scm_refer_c_str(domainname),
+ c_codeset);
+ if (c_current_codeset) {
+ current_codeset = uim_scm_make_str(c_current_codeset);
+ } else {
+ current_codeset = uim_scm_f();
+ }
+
+ return current_codeset;
}
static uim_lisp
@@ -105,8 +120,15 @@
static uim_lisp
intl_dgettext(uim_lisp domainname, uim_lisp msgid)
{
- return uim_scm_make_str(dgettext(uim_scm_refer_c_str(domainname),
- uim_scm_refer_c_str(msgid)));
+ const char *translated;
+
+ if (!uim_scm_stringp(domainname) || !uim_scm_stringp(msgid))
+ return uim_scm_f();
+
+ translated = dgettext(uim_scm_refer_c_str(domainname),
+ uim_scm_refer_c_str(msgid));
+
+ return uim_scm_make_str(translated);
}
static uim_lisp
Modified: trunk/uim/uim.c
===================================================================
--- trunk/uim/uim.c 2005-01-30 23:05:35 UTC (rev 402)
+++ trunk/uim/uim.c 2005-01-30 23:22:33 UTC (rev 403)
@@ -31,13 +31,13 @@
*/
+#include "config.h"
#include <pwd.h>
#include <unistd.h>
#include <sys/types.h>
#include <sys/stat.h>
#include <stdlib.h>
#include <string.h>
-#include "config.h"
#include "uim.h"
#include "uim-im-switcher.h"
#include "uim-scm.h"
@@ -632,6 +632,25 @@
for (i = 0; i < (int)UIM_RETURN_STR_LIST_SIZE; i++){
uim_return_str_list[i] = NULL;
}
+
+#if 0
+ /*
+ Current libuim implementation has the gettext encoding problem. It
+ requires library-wide default encoding configurability rather than
+ per context encoding. -- YamaKen 2005-01-31
+ */
+#ifdef ENABLE_NLS
+ {
+ const char *client_enc;
+
+ /* portable equivalent of nl_langinfo(CODESET) */
+ UIM_EVAL_FSTRING1(NULL, "(locale-lang (locale-new \"%s\"))",
+ setlocale(LC_CTYPE, NULL));
+ client_enc = uim_scm_refer_c_str(uim_scm_return_value());
+ uim_last_client_encoding = strdup(client_enc);
+ }
+#endif
+#endif
}
int
More information about the Uim-commit
mailing list