[uim-commit] r1536 - in branches/r5rs: . gtk qt replace uim xim

tkng at freedesktop.org tkng at freedesktop.org
Wed Sep 21 11:53:51 PDT 2005


Author: tkng
Date: 2005-09-21 11:53:48 -0700 (Wed, 21 Sep 2005)
New Revision: 1536

Added:
   branches/r5rs/replace/
   branches/r5rs/replace/Makefile.am
   branches/r5rs/replace/getpeereid.c
   branches/r5rs/replace/os_dep.h
   branches/r5rs/replace/setenv.c
   branches/r5rs/replace/strsep.c
   branches/r5rs/uim/uim-scm-gc.c
   branches/r5rs/uim/uimint.h
Removed:
   branches/r5rs/uim/context.h
   branches/r5rs/uim/getpeereid.c
   branches/r5rs/uim/setenv.c
   branches/r5rs/uim/strsep.c
Modified:
   branches/r5rs/
   branches/r5rs/Makefile.am
   branches/r5rs/configure.ac
   branches/r5rs/gtk/caret-state-indicator.c
   branches/r5rs/gtk/gtk-im-uim.c
   branches/r5rs/qt/Makefile.am
   branches/r5rs/uim/Makefile.am
   branches/r5rs/uim/anthy.c
   branches/r5rs/uim/canna.c
   branches/r5rs/uim/editline.c
   branches/r5rs/uim/intl.c
   branches/r5rs/uim/m17nlib.c
   branches/r5rs/uim/plugin.c
   branches/r5rs/uim/prime.c
   branches/r5rs/uim/skk.c
   branches/r5rs/uim/spellcheck.c
   branches/r5rs/uim/uim-compat-scm.c
   branches/r5rs/uim/uim-custom.c
   branches/r5rs/uim/uim-func.c
   branches/r5rs/uim/uim-helper-client.c
   branches/r5rs/uim/uim-helper.c
   branches/r5rs/uim/uim-im-switcher.h
   branches/r5rs/uim/uim-ipc.c
   branches/r5rs/uim/uim-key.c
   branches/r5rs/uim/uim-module-manager.c
   branches/r5rs/uim/uim-scm.c
   branches/r5rs/uim/uim-scm.h
   branches/r5rs/uim/uim-table.c
   branches/r5rs/uim/uim-util.c
   branches/r5rs/uim/uim.c
   branches/r5rs/xim/canddisp.cpp
   branches/r5rs/xim/util.h
Log:
 r3149 at t42 (orig r1498):  tkng | 2005-09-15 12:25:36 +0900
 This commit aims to fix segv bug. This bug appeared when caret_state_indicator_timeout was called
 after im_uim_finalize.
 
 * gtk/gtk-im-uim.c
  -(im_uim_finalize): Remove timeout function of caret-state-indicator.
 
 * gtk/caret-state-indicator.c
  -(caret_state_indicator_set_timeout): Store tag of g_timeout_add to caret-state-indicator.
 r3151 at t42 (orig r1500):  ekato | 2005-09-15 15:44:46 +0900
 * xim/canddisp.cpp : Define _GNU_SOURCE in order to use asprintf()
   with some buggy glibc version. Define DEFAULT_CANDWIN_PROG as
   NULL if no GUI frontend is available.
 
 r3156 at t42 (orig r1505):  yamamoto | 2005-09-17 01:31:57 +0900
 [bug fix]
 * uim/uim.c:
  -(uim_switch_im): Call uim_update_preedit_segments to clear preedit.
 
 r3157 at t42 (orig r1506):  omote | 2005-09-17 03:04:07 +0900
  r1514 at minamo:  omote | 2005-09-17 02:52:44 +0900
  * Sources in uim directory which come from outside of uim are put into
    'replace' directory. These sources are existing for the specific OSes
    that does not support certain functions such as setenv(), unsetenv(),
    getpeereid() and etc...
    .
    The purpose of this is to make it clear the origin of the sources - whether
    the source is created by uim originally or got from outside of uim, for
    example NetBSD.
  
  * Makefile.am, configure.ac: Add replace direcotry.
  * replace: New directory.
  * replace/setenv.c, replace/getpeereid.c, replace/strsep.c: moved from uim/.
  * uim/Makefile.am(libuim, uim-module-manager): Link against libreplace.la.
  * uim/uim-ipc.c: Move uim_helper_check_connection_fd from uim/getpeereid.c.
  
 
 r3158 at t42 (orig r1507):  ekato | 2005-09-17 10:18:01 +0900
 * replace/strsep.c : Put uim_setsep() only if
   !defined(HAVE_STRSEP) as previous versions.
 
 r3160 at t42 (orig r1509):  yamamoto | 2005-09-18 03:41:29 +0900
 [bug fix] Make fails when top_builddir is not identical to top_srcdir.
 * uim/Makefile.am:
  -(libuim_la_LIBADD): Replace top_srcdir with top_builddir.
  -(uim_module_manager_LDADD): Ditto.
 
 r3166 at t42 (orig r1515):  yamaken | 2005-09-18 20:52:12 +0900
 * This commit adds the experimental GCC4-ready stack
   protection. Although the codes are closely similar to the equivalent
   for SigScheme rescently implemented by me, I commit these codes
   under the copyright of uim as separately originated from me
 
 * uim/uim-scm.h
   - (UIM_SCM_GCC4_READY_GC): New macro. It will be removed once the
     stability of the feature is confirmed
   - (UIM_SCM_NOINLINE, UIM_SCM_GC_PROTECTED_FUNC_T,
     UIM_SCM_GC_PROTECTED_FUNC_DECL, UIM_SCM_GC_CALL_PROTECTED_FUNC,
     UIM_SCM_GC_CALL_PROTECTED_VOID_FUNC,
     UIM_SCM_GC_CALL_PROTECTED_FUNC_INTERNAL): New macro
   - (uim_scm_gc_protect_stack): Change type definition of the version
     for #if UIM_SCM_GCC4_READY_GC
   - (uim_scm_gc_ensure_uninlined_func): New function
 * uim/uim-scm.c
   - (uim_scm_gc_protect, uim_scm_gc_protect_stack,
     uim_scm_gc_unprotect_stack): Enclose by #if !UIM_SCM_GCC4_READY_GC
 * uim/uim-scm-gc.c
   - New file
   - (uim_scm_gc_protect, uim_scm_gc_unprotect_stack): Moved from
     uim-scm.c
   - (uim_scm_gc_protect_stack):
     * Moved from uim-scm.c
     * Change the type definition and implementation for
       UIM_SCM_GCC4_READY_GC
   - (uim_scm_gc_ensure_uninlined_func): New function
 * uim/Makefile.am
   - (libuim_la_SOURCES): Add uim-scm-gc.c
 
 r3167 at t42 (orig r1516):  yamaken | 2005-09-18 22:11:03 +0900
 * This commit fixes broken codes of r1515
 
 * uim/siod.h
   - (gc_protect): Define as alias of siod_gc_protect()
   - (siod_gc_protect): New prototype decl
   - (siod_gc_protect_stack, siod_gc_unprotect_stack): New prototype decl
 * uim/slib.c
   - (gc_protect): Rename to siod_gc_protect()
   - (siod_gc_protect):
     * Renamed from gc_protect()
     * Export as global function
   - (siod_gc_protect_stack, siod_gc_unprotect_stack): Export as global
     function
 * uim/uim-scm-gc.c
   - (uim_scm_gc_protect): Replace gc_protect() with siod_gc_protect()
   - (uim_scm_gc_protect_stack): Fix incorrect argument type of
     copy&pasted code
 
 r3168 at t42 (orig r1517):  yamaken | 2005-09-18 22:14:33 +0900
 * uim/siod.h
   - (gc_protect): Move to slib.c
 * uim/slib.c
   - (gc_protect): Moved from siod.h
 
 r3169 at t42 (orig r1518):  yamaken | 2005-09-18 23:18:18 +0900
 * This commit enables UIM_SCM_GCC4_READY_GC by default. Please let me
   know if something has been unstabilized. If no problems are
   reported, I'll port this into r5rs and stable branch
 
 * uim/uim-scm.h
   - (UIM_SCM_GCC4_READY_GC): Defaults to 1
 * uim/uim-scm.c
   - (uim_scm_c_int, uim_scm_refer_c_str, uim_scm_eval, siod_init_subr,
     uim_scm_eval_c_string): Add UIM_SCM_GCC4_READY_GC support
   - (uim_scm_c_int_internal, uim_scm_refer_c_str_internal,
     uim_scm_eval_internal, siod_init_subr_internal,
     uim_scm_eval_c_string_internal): New static function
 * uim/uim-compat-scm.c
   - (uim_scm_symbol_value_int, uim_scm_symbol_value_str): Add
     UIM_SCM_GCC4_READY_GC support
   - (uim_scm_symbol_value_int_internal,
     uim_scm_symbol_value_str_internal): New static function
 * uim/uim-custom.c
   - (literalize_string, custom_cb_add): Add UIM_SCM_GCC4_READY_GC support
   - (literalize_string_internal, custom_cb_add_internal): New static
     function
 * uim/plugin.c
   - (plugin_unload, uim_quit_plugin): Add UIM_SCM_GCC4_READY_GC support
   - (plugin_unload_internal, uim_quit_plugin_internal): New static
     function
 * uim/editline.c
   - (uim_editline_readline): Add UIM_SCM_GCC4_READY_GC support
   - (uim_editline_readline_internal): New static function
 
 r3174 at t42 (orig r1523):  ekato | 2005-09-19 13:39:50 +0900
 * configure.ac : Add #include "os_dep.h" in config.h.in and
   add replace and uim directories to INCLUDES.
 * replace/os_dep.h : New header file of function declarations of
   os dependent one.
 * replace/strsep.c : Remove uim_strsep as it is defined in
   os_dep.h.
 * replace/setenv.c : Move function declaration into os_dep.h.
 * replace/getpeereid.c : Don't include unused header files.
 * replace/Makefile.am : Add os_dep.h to libreplace_la_SOURCES.
   Remove redundant INCLUDES.
 * uim/uim-util.c : Remove function declaration of setenv().
 * xim/util.h : Remove function declaration of uim_strsep().
 * qt/Makefile.am : Remove redundant INCLUDES.
 
 r3175 at t42 (orig r1524):  ekato | 2005-09-19 14:29:40 +0900
 * configure.ac : Don't use MOC-QT3 and UIC-QT3 as in branches/0.4.
 * qt/Makefile.am : Ditto. Add $(top_srcdir) and $(top_builddir) as
   include path again.
 
 r3176 at t42 (orig r1525):  yamaken | 2005-09-20 01:12:47 +0900
 * This commit complements lacking change of r1484
 
 * uim/context.h
   - Complements lacking change for #ifndef HAVE_PTHREAD_H in r1484
   - (UIM_NEW_MUTEX, UIM_NEW_MUTEX_STATIC): Rename to UIM_DEFINE_MUTEX*
   - (UIM_DEFINE_MUTEX): Renamed from UIM_NEW_MUTEX
   - (UIM_DEFINE_MUTEX_STATIC): Renamed from UIM_NEW_MUTEX_STATIC
 
 r3179 at t42 (orig r1528):  ekato | 2005-09-20 23:24:04 +0900
 * uim-scm-gc.c (uim_scm_gc_unprotect_stack) : Bug fix.
 
 r3180 at t42 (orig r1529):  ekato | 2005-09-21 02:08:13 +0900
 * Modify stack protection code since previous code (r1528)
   works on Linux but not on Mac OS X.
 
 * uim/uim-scm-gc.c (uim_scm_gc_protect_stack) : Return local
   address.
 (uim_scm_gc_unprotect_stack) : Use proper address.
 
 r3182 at t42 (orig r1531):  tkng | 2005-09-21 19:17:06 +0900
 * uim/uimint.h: Renamed from context.h to reflect current condition correctly.
 
 
 r3183 at t42 (orig r1532):  tkng | 2005-09-21 20:10:13 +0900
 * uim/uim-custom.c, uim/uim-ipc.c, uim/uim-util.c, uim/m17nlib.c,
   uim/prime.c, uim/spellcheck.c, uim/uim-helper-client.c,
   uim/uim-im-switcher.h, uim/uim-compat-scm.c, uim/plugin.c,
   uim/intl.c, uim/uim-helper.c, uim/uimint.h, uim/uim-scm.c,
   uim/uim-scm.h, uim/uim-table.c, uim/canna.c, uim/uim-key.c,
   uim/uim-func.c, uim/anthy.c, uim/uim-module-manager.c,
   uim/skk.c, uim/uim.c: Replaced all context.h with uimint.h.
 
 
 r3184 at t42 (orig r1533):  tkng | 2005-09-21 20:16:49 +0900
 * uim/uimint.h: Fixed wrongly replaced context.h. That
   should be _uimint_h_included_, not _uimint.h_included.
  
 r3185 at t42 (orig r1534):  tkng | 2005-09-21 20:27:47 +0900
 * uim/uimint.h: Restored disappered mutex functionalities.
 
 r3186 at t42 (orig r1535):  tkng | 2005-09-21 21:32:54 +0900
 * uim/anthy.c, uim/skk.c, uim/m17nlib.c, uim/canna.c, uim/prime.c:
  - Removed a needless line '#include "uimint.h"'.



Property changes on: branches/r5rs
___________________________________________________________________
Name: svk:merge
   - fb73e508-85ea-0310-95c3-a85c473e0941:/trunk:1492
   + 2f05256a-0800-0410-85e3-84fe06922419:/local/uim/trunk:1514
fb73e508-85ea-0310-95c3-a85c473e0941:/trunk:1535

Modified: branches/r5rs/Makefile.am
===================================================================
--- branches/r5rs/Makefile.am	2005-09-21 12:32:54 UTC (rev 1535)
+++ branches/r5rs/Makefile.am	2005-09-21 18:53:48 UTC (rev 1536)
@@ -1,5 +1,5 @@
 AUTOMAKE_OPTIONS = foreign
-SUBDIRS = m4 doc sigscheme uim scm gtk qt xim helper po tables test fep examples pixmaps
+SUBDIRS = m4 doc replace uim scm gtk qt xim helper po tables test fep examples pixmaps
 EXTRA_DIST = README.ja INSTALL.ja test.sh.in uim.spec.in \
 	intltool-extract.in intltool-merge.in intltool-update.in \
 	uim.pc.in ChangeLog.old uim.desktop autogen.sh RELEASING

Modified: branches/r5rs/configure.ac
===================================================================
--- branches/r5rs/configure.ac	2005-09-21 12:32:54 UTC (rev 1535)
+++ branches/r5rs/configure.ac	2005-09-21 18:53:48 UTC (rev 1536)
@@ -189,7 +189,8 @@
 # Checks for function
 AC_CHECK_FUNCS([cfmakeraw])
 AC_CHECK_FUNCS([wcswidth])
-AC_CHECK_FUNCS(getpeereid asprintf vasprintf vsnprintf setenv unsetenv strsep)
+AC_CHECK_FUNCS(asprintf vasprintf vsnprintf)
+AC_REPLACE_FUNCS(getpeereid strsep setenv unsetenv)
 AC_CHECK_FUNCS(getpid stat mkdir chmod)
 AC_CACHE_CHECK([for C99 vsnprintf], uim_cv_HAVE_C99_VSNPRINTF,[
 AC_TRY_RUN([
@@ -618,46 +619,24 @@
     if test -x "$QTDIR/bin/moc"; then
       HOST_MOC="$QTDIR/bin/moc"
     else
-      AC_CHECK_PROGS(HOST_MOC, moc, "")
+      AC_CHECK_PROGS(HOST_MOC, moc-qt3 moc, "")
     fi
     if test -z "$HOST_MOC"; then
       AC_MSG_ERROR([no acceptable moc( meta object compiler ) found])
     fi
     MOC=$HOST_MOC
 
-    # Check For moc-qt3
-    if test -x "$QTDIR/bin/moc-qt3"; then
-      HOST_MOC_QT3="$QTDIR/bin/moc-qt3"
-    else
-      AC_CHECK_PROGS(HOST_MOC_QT3, moc-qt3, "")
-    fi
-    if test -z "$HOST_MOC_QT3"; then
-      AC_MSG_ERROR([No acceptable moc (meta object compiler) found])
-    fi
-    MOC_QT3=$HOST_MOC_QT3
-
     # Check For UIC
     if test -x "$QTDIR/bin/uic"; then
       HOST_UIC="$QTDIR/bin/uic"
     else
-      AC_CHECK_PROGS(HOST_UIC, uic, "")
+      AC_CHECK_PROGS(HOST_UIC, uic-qt3 uic, "")
     fi
     if test -z "$HOST_UIC"; then
       AC_MSG_ERROR([no acceptable uic( user interface compiler ) found])
     fi
     UIC=$HOST_UIC
 
-    # Check for uic-qt3
-    if test -x "$QTDIR/bin/uic-qt3"; then
-      HOST_UIC_QT3="$QTDIR/bin/uic-qt3"
-    else
-      AC_CHECK_PROGS(HOST_UIC_QT3, uic-qt3, "")
-    fi
-    if test -z "$HOST_UIC_QT3"; then
-      AC_MSG_ERROR([No acceptable uic-qt3 (user interface compiler) found])
-    fi
-    UIC_QT3=$HOST_UIC_QT3
-
     # GUESS plugins dir for immodule installation
     AC_MSG_CHECKING(for qt-immodule plugins dir)
     if test ! -d "$QTDIR/plugins"; then
@@ -717,9 +696,7 @@
     UIM_QT_CXXFLAGS=$QT_CXXFLAGS
 
     AC_SUBST(MOC)
-    AC_SUBST(MOC_QT3)
     AC_SUBST(UIC)
-    AC_SUBST(UIC_QT3)
     AC_SUBST(UIM_QT_CXXFLAGS)
     AC_SUBST(UIM_QT_LDFLAGS)
 fi
@@ -765,6 +742,13 @@
             [Enable obsolete table API for hk.scm (broken)])
 fi
 
+AH_BOTTOM([/* Include os specific header. */
+#include "os_dep.h"])
+
+# Add include path
+INCLUDES='-I$(top_srcdir)/replace -I$(top_srcdir)/uim'
+AC_SUBST(INCLUDES)
+
 # Checks for typedefs, structures, and compiler characteristics.
 AC_HEADER_STDBOOL
 AC_C_CONST
@@ -803,6 +787,7 @@
 		 examples/Makefile
 		 examples/uim-custom/Makefile
 		 pixmaps/Makefile
+		 replace/Makefile
 		 uim.pc
 		 uim.desktop
                  ])

Modified: branches/r5rs/gtk/caret-state-indicator.c
===================================================================
--- branches/r5rs/gtk/caret-state-indicator.c	2005-09-21 12:32:54 UTC (rev 1535)
+++ branches/r5rs/gtk/caret-state-indicator.c	2005-09-21 18:53:48 UTC (rev 1536)
@@ -144,8 +144,8 @@
 caret_state_indicator_set_timeout(GtkWidget *window, gint timeout)
 {
   gint current_time = get_current_time();
-
-  g_timeout_add(timeout, caret_state_indicator_timeout, (gpointer)window);
+  guint tag = g_timeout_add(timeout, caret_state_indicator_timeout, (gpointer)window);
+  g_object_set_data(G_OBJECT(window), "timeout-tag", GINT_TO_POINTER(tag));
   g_object_set_data(G_OBJECT(window), "timeout", GINT_TO_POINTER(timeout));
   g_object_set_data(G_OBJECT(window), "called_time", GINT_TO_POINTER(current_time));
   /* "called_time" stores the time of last calling of this function */

Modified: branches/r5rs/gtk/gtk-im-uim.c
===================================================================
--- branches/r5rs/gtk/gtk-im-uim.c	2005-09-21 12:32:54 UTC (rev 1535)
+++ branches/r5rs/gtk/gtk-im-uim.c	2005-09-21 18:53:48 UTC (rev 1536)
@@ -666,6 +666,8 @@
     uic->cwin = NULL;
   }
   if (uic->caret_state_indicator) {
+    guint tag = GPOINTER_TO_INT(g_object_get_data(G_OBJECT(uic->caret_state_indicator), "timeout-tag"));
+    g_source_remove(tag);
     gtk_widget_destroy(uic->caret_state_indicator);
     uic->caret_state_indicator = NULL;
   }

Modified: branches/r5rs/qt/Makefile.am
===================================================================
--- branches/r5rs/qt/Makefile.am	2005-09-21 12:32:54 UTC (rev 1535)
+++ branches/r5rs/qt/Makefile.am	2005-09-21 18:53:48 UTC (rev 1536)
@@ -1,9 +1,7 @@
 EXTRA_DIST = pref-keyeditformbase.ui  pref-olisteditformbase.ui bushu.t
 
 if QT
-
-INCLUDES    = -I$(top_srcdir) -I$(top_builddir) -I$(top_srcdir)/qt -I$(top_builddir)/qt
-
+INCLUDES += -I$(top_srcdir) -I$(top_builddir)
 QT_CXXFLAGS = $(UIM_QT_CXXFLAGS)
 QT_LDFLAGS  = $(UIM_QT_LDFLAGS)
 
@@ -25,7 +23,7 @@
 	chardict-chargridview.h \
 	chardict-kseparator.h \
 	chardict-qt.h
-MOC_QT3_FILES = \
+MOC_FILES = \
 	toolbar-common-quimhelpertoolbar.moc \
 	toolbar-common-uimstateindicator.moc \
 	toolbar-standalone-qt.moc \
@@ -66,7 +64,7 @@
 	immodule-candidatewindow.h immodule-qhelpermanager.h \
 	immodule-quiminputcontext.h immodule-quiminputcontext_with_slave.h \
 	immodule-subwindow.h
-MOC_QT3_FILES += \
+MOC_FILES += \
 	immodule-candidatewindow.moc immodule-qhelpermanager.moc \
 	immodule-quiminputcontext.moc immodule-quiminputcontext_with_slave.moc \
 	immodule-subwindow.moc
@@ -139,18 +137,18 @@
 pref-kseparator.cpp: pref-kseparator.moc
 
 pref-olisteditformbase.cpp: pref-olisteditformbase.h pref-olisteditformbase.moc
-	$(UIC_QT3) $(top_srcdir)/qt/pref-olisteditformbase.ui -i pref-olisteditformbase.h > pref-olisteditformbase.cpp.tmp
+	$(UIC) $(top_srcdir)/qt/pref-olisteditformbase.ui -i pref-olisteditformbase.h > pref-olisteditformbase.cpp.tmp
 	echo '#include "pref-olisteditformbase.moc"' >> pref-olisteditformbase.cpp.tmp
 	mv pref-olisteditformbase.cpp.tmp pref-olisteditformbase.cpp
 pref-olisteditformbase.h:
-	$(UIC_QT3) $(top_srcdir)/qt/pref-olisteditformbase.ui -o pref-olisteditformbase.h
+	$(UIC) $(top_srcdir)/qt/pref-olisteditformbase.ui -o pref-olisteditformbase.h
 
 pref-keyeditformbase.cpp: pref-keyeditformbase.h pref-keyeditformbase.moc
-	$(UIC_QT3) $(top_srcdir)/qt/pref-keyeditformbase.ui -i pref-keyeditformbase.h > pref-keyeditformbase.cpp.tmp
+	$(UIC) $(top_srcdir)/qt/pref-keyeditformbase.ui -i pref-keyeditformbase.h > pref-keyeditformbase.cpp.tmp
 	echo '#include "pref-keyeditformbase.moc"' >> pref-keyeditformbase.cpp.tmp
 	mv pref-keyeditformbase.cpp.tmp pref-keyeditformbase.cpp
 pref-keyeditformbase.h:
-	$(UIC_QT3) $(top_srcdir)/qt/pref-keyeditformbase.ui -o pref-keyeditformbase.h
+	$(UIC) $(top_srcdir)/qt/pref-keyeditformbase.ui -o pref-keyeditformbase.h
 
 uim_chardict_qt_SOURCES = \
 	chardict-qt.cpp chardict-qt.h \
@@ -173,12 +171,12 @@
 helperdata_DATA = bushu.t
 
 CLEANFILES = \
-	$(MOC_QT3_FILES) \
+	$(MOC_FILES) \
 	$(UI_TMP_FILES)
 
 .h.moc: 
-	$(MOC_QT3) $< -o $*.moc
+	$(MOC) $< -o $*.moc
 .ui.h: 
-	$(UIC_QT3) $< -o $*.h
+	$(UIC) $< -o $*.h
 endif
 

Added: branches/r5rs/replace/Makefile.am
===================================================================
--- branches/r5rs/replace/Makefile.am	2005-09-21 12:32:54 UTC (rev 1535)
+++ branches/r5rs/replace/Makefile.am	2005-09-21 18:53:48 UTC (rev 1536)
@@ -0,0 +1,2 @@
+noinst_LTLIBRARIES = libreplace.la
+libreplace_la_SOURCES = strsep.c getpeereid.c setenv.c os_dep.h

Added: branches/r5rs/replace/getpeereid.c
===================================================================
--- branches/r5rs/replace/getpeereid.c	2005-09-21 12:32:54 UTC (rev 1535)
+++ branches/r5rs/replace/getpeereid.c	2005-09-21 18:53:48 UTC (rev 1536)
@@ -0,0 +1,116 @@
+/*
+ * Copyright (c) 2002,2004 Damien Miller <djm at mindrot.org>
+ *
+ * Permission to use, copy, modify, and distribute this software for any
+ * purpose with or without fee is hereby granted, provided that the above
+ * copyright notice and this permission notice appear in all copies.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
+ * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
+ * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
+ * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
+ * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
+ * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
+ * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
+ */
+
+#include "config.h"
+#include <stdio.h>
+#include <unistd.h>
+#include <sys/types.h>
+#include <sys/socket.h>
+#include <sys/un.h>
+#include <sys/param.h>
+
+#if !defined(HAVE_GETPEEREID)
+
+#if defined(SO_PEERCRED)
+int
+getpeereid(int s, uid_t *euid, gid_t *gid)
+{
+	struct ucred cred;
+	socklen_t len = sizeof(cred);
+
+	if (getsockopt(s, SOL_SOCKET, SO_PEERCRED, &cred, &len) < 0)
+		return (-1);
+	*euid = cred.uid;
+	*gid = cred.gid;
+
+	return (0);
+}
+#elif defined(LOCAL_CREDS)	/* NetBSD */
+int
+getpeereid(int s, uid_t *euid, gid_t *gid)
+{
+/* Credentials structure */
+#ifdef __NetBSD__	/* XXX: should use autoconf */
+#define HAVE_STRUCT_SOCKCRED
+#endif
+#if defined(HAVE_STRUCT_CMSGCRED)
+        typedef struct cmsgcred Cred;
+
+#define cruid cmcred_euid
+#define crgid cmcred_groups[0]
+#elif defined(HAVE_STRUCT_FCRED)
+        typedef struct fcred Cred;
+
+#define cruid fc_uid
+#define crgid fc_gid
+#elif defined(HAVE_STRUCT_SOCKCRED)
+        typedef struct sockcred Cred;
+
+#define cruid sc_euid
+#define crgid sc_egid
+#endif
+        Cred *cred;
+
+        /* Compute size without padding */
+        char cmsgmem[CMSG_SPACE(sizeof(Cred))]; /* for NetBSD */
+
+        /* Point to start of first structure */
+        struct cmsghdr *cmsg = (struct cmsghdr *)cmsgmem;
+
+        struct iovec iov;
+        char buf;
+        struct msghdr msg;
+
+        memset(&msg, 0, sizeof(msg));
+        msg.msg_iov = &iov;
+        msg.msg_iovlen = 1;
+        msg.msg_control = (char *)cmsg;
+        msg.msg_controllen = sizeof(cmsgmem);
+        memset(cmsg, 0, sizeof(cmsgmem));
+
+        /*
+         * The one character which is received here is not meaningful; its
+         * purposes is only to make sure that recvmsg() blocks long enough for
+         * the other side to send its credentials.
+         */
+        iov.iov_base = &buf;
+        iov.iov_len = 1;
+
+        if (recvmsg(s, &msg, 0) < 0 ||
+                cmsg->cmsg_len < sizeof(cmsgmem) ||
+                cmsg->cmsg_type != SCM_CREDS)
+        {
+                return -1;
+        }
+
+        cred = (Cred *)CMSG_DATA(cmsg);
+	*euid = cred->cruid;
+	*gid = cred->crgid;
+
+	return 0;
+}
+#else
+int
+getpeereid(int s, uid_t *euid, gid_t *gid)
+{
+	*euid = geteuid();
+	*gid = getgid();
+
+	return (0);
+}
+#endif /* defined(SO_PEERCRED) */
+
+#endif /* !defined(HAVE_GETPEEREID) */

Added: branches/r5rs/replace/os_dep.h
===================================================================
--- branches/r5rs/replace/os_dep.h	2005-09-21 12:32:54 UTC (rev 1535)
+++ branches/r5rs/replace/os_dep.h	2005-09-21 18:53:48 UTC (rev 1536)
@@ -0,0 +1,74 @@
+/*
+
+  Copyright (c) 2003-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 COPYRIGHT HOLDERS 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 COPYRIGHT HOLDERS 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.
+
+*/
+
+#ifndef _os_dep_h_included_
+#define _os_dep_h_included_
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+#include <sys/types.h>
+
+#ifndef HAVE_GETPEEREID
+int getpeereid(int , uid_t *, gid_t *);
+#endif
+
+/*
+ * I doubt uim_setenv and uim_unsetenv are really needed. Only libuim and
+ * uim-module-manager uses setenv and unsetenv. I choose linking libreplace.la
+ * to both of them for OSes not having setenv and unsetenv. If setenv and
+ * unsetenv are used in out of the uim, please uncomment.
+ *
+ * In any cases, we have to upgrade minor version of libuim.
+ * -- omote 09/17/2005
+ */
+#ifndef HAVE_SETENV
+/* #define setenv	uim_setenv */
+int setenv(const char *, const char *, int);
+#endif
+
+#ifndef HAVE_UNSETENV
+/* #define unsetenv	uim_unsetenv */
+void unsetenv(const char *);
+#endif
+
+#ifndef HAVE_STRSEP
+#define strsep	uim_strsep
+char *strsep(char **stringp, const char *delim);
+#endif
+
+#ifdef __cplusplus
+}
+#endif
+#endif

Added: branches/r5rs/replace/setenv.c
===================================================================
--- branches/r5rs/replace/setenv.c	2005-09-21 12:32:54 UTC (rev 1535)
+++ branches/r5rs/replace/setenv.c	2005-09-21 18:53:48 UTC (rev 1536)
@@ -0,0 +1,157 @@
+/*
+ * Copyright (c) 1987 Regents of the University of California.
+ * 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 the University 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 COPYRIGHT HOLDERS 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 COPYRIGHT HOLDERS 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.
+ */
+
+#include <stdlib.h>
+#include <string.h>
+
+#include "config.h"
+#if !defined(HAVE_SETENV) || !defined(HAVE_UNSETENV)
+
+static char *__findenv(const char *name, int *offset);
+extern char **environ;
+
+/*
+ * __findenv --
+ *	Returns pointer to value associated with name, if any, else NULL.
+ *	Sets offset to be the offset of the name/value combination in the
+ *	environmental array, for use by setenv(3) and unsetenv(3).
+ *	Explicitly removes '=' in argument name.
+ *
+ *	This routine *should* be a static; don't use it.
+ */
+static char *
+__findenv(name, offset)
+	register const char *name;
+	int *offset;
+{
+	register int len, i;
+	register const char *np;
+	register char **p, *cp;
+
+	if (name == NULL || environ == NULL)
+		return (NULL);
+	for (np = name; *np && *np != '='; ++np)
+		;
+	len = np - name;
+	for (p = environ; (cp = *p) != NULL; ++p) {
+		for (np = name, i = len; i && *cp; i--)
+			if (*cp++ != *np++)
+				break;
+		if (i == 0 && *cp++ == '=') {
+			*offset = p - environ;
+			return (cp);
+		}
+	}
+	return (NULL);
+}
+
+#ifndef HAVE_SETENV
+/*
+ * setenv --
+ *	Set the value of the environmental variable "name" to be
+ *	"value".  If rewrite is set, replace any current value.
+ */
+int
+setenv(name, value, rewrite)
+	register const char *name;
+	register const char *value;
+	int rewrite;
+{
+	static int alloced;			/* if allocated space before */
+	register char *C;
+	int offset;
+	size_t l_value;
+
+	if (*value == '=')			/* no `=' in value */
+		++value;
+	l_value = strlen(value);
+	if ((C = __findenv(name, &offset))) {	/* find if already exists */
+		if (!rewrite)
+			return (0);
+		if (strlen(C) >= l_value) {	/* old larger; copy over */
+			while ((*C++ = *value++))
+				;
+			return (0);
+		}
+	} else {					/* create new slot */
+		register int	cnt;
+		register char	**P;
+
+		for (P = environ, cnt = 0; *P; ++P, ++cnt);
+		if (alloced) {			/* just increase size */
+			P = (char **)realloc((void *)environ,
+			    (size_t)(sizeof(char *) * (cnt + 2)));
+			if (!P)
+				return (-1);
+			environ = P;
+		}
+		else {				/* get new space */
+			alloced = 1;		/* copy old entries into it */
+			P = (char **)malloc((size_t)(sizeof(char *) *
+			    (cnt + 2)));
+			if (!P)
+				return (-1);
+			memmove(P, environ, cnt * sizeof(char *));
+			environ = P;
+		}
+		environ[cnt + 1] = NULL;
+		offset = cnt;
+	}
+	for (C = (char *)name; *C && *C != '='; ++C);	/* no `=' in name */
+	if (!(environ[offset] =			/* name + `=' + value */
+	    malloc((size_t)((int)(C - name) + l_value + 2))))
+		return (-1);
+	for (C = environ[offset]; (*C = *name++) && *C != '='; ++C)
+		;
+	for (*C++ = '='; (*C++ = *value++); )
+		;
+	return (0);
+}
+#endif /* HAVE_SETENV */
+
+#ifndef HAVE_UNSETENV
+/*
+ * unsetenv(name) --
+ *	Delete environmental variable "name".
+ */
+void
+unsetenv(name)
+	const char	*name;
+{
+	register char **P;
+	int offset;
+
+	while (__findenv(name, &offset))		/* if set multiple times */
+		for (P = &environ[offset];; ++P)
+			if (!(*P = *(P + 1)))
+				break;
+}
+#endif /* HAVE_UNSETENV */
+
+#endif /* !defined(HAVE_SETENV) || !defined(HAVE_UNSETENV) */

Added: branches/r5rs/replace/strsep.c
===================================================================
--- branches/r5rs/replace/strsep.c	2005-09-21 12:32:54 UTC (rev 1535)
+++ branches/r5rs/replace/strsep.c	2005-09-21 18:53:48 UTC (rev 1536)
@@ -0,0 +1,73 @@
+/*-
+ * Copyright (c) 1990, 1993
+ *	The Regents of the University of California.  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 the University 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 COPYRIGHT HOLDERS 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 COPYRIGHT HOLDERS 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.
+ */
+
+#include "config.h"
+#include <string.h>
+#include <stdio.h>
+
+#if !defined(HAVE_STRSEP)
+
+/*
+ * Get next token from string *stringp, where tokens are possibly-empty
+ * strings separated by characters from delim.  
+ *
+ * Writes NULs into the string at *stringp to end tokens.
+ * delim need not remain constant from call to call.
+ * On return, *stringp points past the last NUL written (if there might
+ * be further tokens), or is NULL (if there are definitely no more tokens).
+ *
+ * If *stringp is NULL, strsep returns NULL.
+ */
+char *
+strsep(char **stringp, const char *delim)
+{
+	char *s;
+	const char *spanp;
+	int c, sc;
+	char *tok;
+
+	if ((s = *stringp) == NULL)
+		return (NULL);
+	for (tok = s;;) {
+		c = *s++;
+		spanp = delim;
+		do {
+			if ((sc = *spanp++) == c) {
+				if (c == 0)
+					s = NULL;
+				else
+					s[-1] = 0;
+				*stringp = s;
+				return (tok);
+			}
+		} while (sc != 0);
+	}
+	/* NOTREACHED */
+}
+#endif /* !defined(HAVE_STRSEP) */

Modified: branches/r5rs/uim/Makefile.am
===================================================================
--- branches/r5rs/uim/Makefile.am	2005-09-21 12:32:54 UTC (rev 1535)
+++ branches/r5rs/uim/Makefile.am	2005-09-21 18:53:48 UTC (rev 1536)
@@ -12,20 +12,21 @@
 pkginclude_HEADERS = uim.h uim-util.h uim-helper.h uim-im-switcher.h \
 		uim-scm.h uim-custom.h plugin.h
 
-libuim_la_SOURCES = uim.c uim-scm.c uim-util.c uim-func.c uim-key.c \
+libuim_la_SOURCES = uim.c uim-util.c uim-func.c uim-key.c \
 		context.h gettext.h uim-encoding.h\
+		siod.h  uim-scm.c uim-scm-gc.c \
 		uim-helper.c uim-helper-client.c \
 		intl.c \
 		uim-ipc.c \
-		getpeereid.c \
 		plugin.c
+#		getpeereid.c
 
-if NEED_SETENV_C
-libuim_la_SOURCES += setenv.c
-endif
-if NEED_STRSEP_C
-libuim_la_SOURCES += strsep.c
-endif
+#if NEED_SETENV_C
+#libuim_la_SOURCES += setenv.c
+#endif
+#if NEED_STRSEP_C
+#libuim_la_SOURCES += strsep.c
+#endif
 
 if COMPAT_TABLE
 libuim_la_SOURCES += uim-table.c
@@ -85,8 +86,8 @@
 
 libuimincludedir =  $(includedir)/uim
 
-libuim_la_LDFLAGS = -version-info 0:1:0 -export-symbols-regex uim.\*
-libuim_la_LIBADD = @LTLIBINTL@ @LTLIBICONV@ $(top_builddir)/sigscheme/libsscm.la
+libuim_la_LDFLAGS = -version-info 0:2:0 -export-symbols-regex uim.\*
+libuim_la_LIBADD = @LTLIBINTL@ @LTLIBICONV@ $(top_builddir)/replace/libreplace.la
 libuim_la_CPPFLAGS = $(uim_defs) -I$(top_srcdir) -DPKGLIBDIR=\"$(pkglibdir)\" \
 		     -DPKGDATADIR=\"$(pkgdatadir)\"
 
@@ -127,11 +128,11 @@
 uim_module_manager_LIBS =
 uim_module_manager_CPPFLAGS = $(uim_defs) -I$(top_srcdir) -DUIM_DATADIR=\""$(datadir)/uim"\"
 uim_module_manager_CFLAGS =
-uim_module_manager_LDADD = libuim.la
+uim_module_manager_LDADD = libuim.la $(top_builddir)/replace/libreplace.la
 uim_module_manager_SOURCES = uim-module-manager.c
-if NEED_SETENV_C
-uim_module_manager_SOURCES += setenv.c
-endif
+#if NEED_SETENV_C
+#uim_module_manager_SOURCES += setenv.c
+#endif
 
 noinst_PROGRAMS = uim-agent
 

Modified: branches/r5rs/uim/anthy.c
===================================================================
--- branches/r5rs/uim/anthy.c	2005-09-21 12:32:54 UTC (rev 1535)
+++ branches/r5rs/uim/anthy.c	2005-09-21 18:53:48 UTC (rev 1536)
@@ -34,7 +34,6 @@
 #include <stdlib.h>
 #include "uim-scm.h"
 #include "uim-compat-scm.h"
-#include "context.h"
 #include "plugin.h"
 
 #define MAX_CONTEXT 256

Modified: branches/r5rs/uim/canna.c
===================================================================
--- branches/r5rs/uim/canna.c	2005-09-21 12:32:54 UTC (rev 1535)
+++ branches/r5rs/uim/canna.c	2005-09-21 18:53:48 UTC (rev 1536)
@@ -40,7 +40,6 @@
 #include <dlfcn.h>
 #include <errno.h>
 #include <string.h>
-#include "context.h"
 #include "uim-scm.h"
 #include "uim-compat-scm.h"
 #include "plugin.h"

Deleted: branches/r5rs/uim/context.h
===================================================================
--- branches/r5rs/uim/context.h	2005-09-21 12:32:54 UTC (rev 1535)
+++ branches/r5rs/uim/context.h	2005-09-21 18:53:48 UTC (rev 1536)
@@ -1,308 +0,0 @@
-/*
-
-  Copyright (c) 2003-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 COPYRIGHT HOLDERS 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 COPYRIGHT HOLDERS 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.
-*/
-
-#ifndef _context_h_included_
-#define _context_h_included_
-
-#ifdef __cplusplus
-extern "C" {
-#endif
-
-#include <stdio.h>
-#include "config.h"
-#include "gettext.h"
-#include "uim.h"
-#include "uim-scm.h"
-
-struct uim_im {
-  char *name;
-  char *lang;
-  char *encoding;
-  char *short_desc;
-};
-
-struct uim_candidate_ {
-  char *str;         /* candidate */
-  char *heading_label;
-  char *annotation;
-  /* uim_pos part_of_speech; */
-  /* int freq; */
-  /* int freshness; */
-  /* int formality; */
-  /* char *src_dict; */
-};
-
-struct preedit_segment {
-  int attr;
-  char *str;
-};
-
-struct uim_context_ {
-  /* cookier pointer */
-  void *ptr;
-  /* internal id */
-  int id;
-  /**/
-  int is_enable;
-
-  struct uim_code_converter *conv_if;
-  void *conv;
-  char *current_im_name;
-  char *short_desc;
-  char *encoding;
-  /**/
-  int commit_raw_flag;
-  /**/
-  int nr_modes;
-  char **modes;
-  /**/
-  int mode;
-  /**/
-  char *proplabelstr;
-  char *propstr;
-  /**/
-  int candidate_index;
-  int nr_candidates;
-  /**/
-  void (*commit_cb)(void *ptr, const char *str);
-  /* preedit */
-  void (*preedit_clear_cb)(void *ptr);
-  void (*preedit_pushback_cb)(void *ptr, int attr, const char *str);
-  void (*preedit_update_cb)(void *ptr);
-  /* mode list */
-  void (*mode_list_update_cb)(void *ptr);
-  /* mode */
-  void (*mode_update_cb)(void *ptr, int);
-  /* property list */
-  void (*prop_list_update_cb)(void *ptr, const char *str);
-  /* property label */
-  void (*prop_label_update_cb)(void *ptr, const char *str);
-  /* candidate window */
-  void (*candidate_selector_activate_cb)(void *ptr, int nr, int index);
-  void (*candidate_selector_select_cb)(void *ptr, int index);
-  void (*candidate_selector_shift_page_cb)(void *ptr, int direction);
-  void (*candidate_selector_deactivate_cb)(void *ptr);
-  /* surrounding text */
-  void (*request_surrounding_text_cb)(void *ptr);
-  int (*delete_surrounding_text_cb)(void *ptr, int offset, int len);
-  /* preedit segments array */
-  struct preedit_segment *psegs;
-  int nr_psegs;
-};
-
-
-/*
-  Most of following definitions should be separated into another file such as
-  private.h since they are not relevant to input contexts. I'm not having
-  enough time to do and validate it. Anyone?  -- YamaKen 2005-07-30
-*/
-
-#if 0
-/*
-  Evaluating a S-expression in C involves the two problems, performance and
-  sourcecode-simpleness. Traditional UIM_EVAL_FSTRINGn() satisfies the latter,
-  but loses former. Manual sexp construction and evaluation by a sequence of
-  function calling is an opponent. The two should co-exist until better
-  solution has been implemented as a uim-scm API.  -- YamaKen 2005-07-30
- */
-#define UIM_EVAL_SEXP_AS_STRING
-#endif
-
-#ifdef HAVE_PTHREAD_H
-#include <pthread.h>
-  #define UIM_DEFINE_MUTEX(mtx)                                              \
-           pthread_mutex_t mtx = PTHREAD_MUTEX_INITIALIZER
-  #define UIM_DEFINE_MUTEX_STATIC(mtx)                                       \
-    static pthread_mutex_t mtx = PTHREAD_MUTEX_INITIALIZER
-  #define UIM_LOCK_MUTEX(mtx)    pthread_mutex_lock(&mtx)
-  #define UIM_UNLOCK_MUTEX(mtx)  pthread_mutex_unlock(&mtx)
-#else
-  #define UIM_NEW_MUTEX(mtx)
-  #define UIM_NEW_MUTEX_STATIC(mtx)
-  #define UIM_LOCK_MUTEX(mtx)
-  #define UIM_UNLOCK_MUTEX(mtx)
-#endif /* HAVE_PTHREAD_H */
-
-#ifdef ENABLE_NLS
-#define UIM_PREPARE_SAVING_TEXTDOMAIN_CODESET() \
-    char *enc, *orig_encoding = NULL; \
-    const char *client_encoding;
-#define UIM_SWITCH_TEXTDOMAIN_CODESET(uc) \
-  if ((enc = bind_textdomain_codeset(GETTEXT_PACKAGE, NULL))) \
-    orig_encoding = strdup(enc); \
-  client_encoding = (uc) ? ((struct uim_context_ *)uc)->encoding : uim_last_client_encoding; \
-  bind_textdomain_codeset(GETTEXT_PACKAGE, client_encoding);
-#define UIM_RESTORE_TEXTDOMAIN_CODESET() \
-  bind_textdomain_codeset(GETTEXT_PACKAGE, orig_encoding); \
-  free(orig_encoding);
-#else  /* ENABLE_NLS */
-#define UIM_PREPARE_SAVING_TEXTDOMAIN_CODESET()
-#define UIM_SWITCH_TEXTDOMAIN_CODESET(uc)
-#define UIM_RESTORE_TEXTDOMAIN_CODESET()
-#endif  /* ENABLE_NLS */
-
-/* we cannot use the variadic macro (i.e. __VA_ARGS__) because we
-   should also support C89 compilers
-*/
-#define UIM_EVAL_STRING_INTERNAL(uc, sexp_str) \
-      if (uc) \
-        uim_eval_string(uc, sexp_str); \
-      else \
-        uim_scm_eval_c_string(sexp_str); \
-
-#define UIM_EVAL_STRING(uc, sexp_str) \
-  { \
-    UIM_PREPARE_SAVING_TEXTDOMAIN_CODESET(); \
-    UIM_SWITCH_TEXTDOMAIN_CODESET(uc); \
-    UIM_EVAL_STRING_INTERNAL(uc, sexp_str); \
-    UIM_RESTORE_TEXTDOMAIN_CODESET(); \
-  }
-
-#define UIM_EVAL_FSTRING1(uc, sexp_tmpl, arg1) \
-  { \
-    int form_size; \
-    char *buf; \
-    UIM_PREPARE_SAVING_TEXTDOMAIN_CODESET(); \
-    UIM_SWITCH_TEXTDOMAIN_CODESET(uc); \
-    form_size = uim_sizeof_sexp_str(sexp_tmpl, arg1); \
-    if (form_size != -1) { \
-      buf = malloc(form_size); \
-      snprintf(buf, form_size, sexp_tmpl, arg1); \
-      UIM_EVAL_STRING_INTERNAL(uc, buf); \
-      free(buf); \
-    } \
-    UIM_RESTORE_TEXTDOMAIN_CODESET(); \
-  }
-
-#define UIM_EVAL_FSTRING2(uc, sexp_tmpl, arg1, arg2) \
-  { \
-    int form_size; \
-    char *buf; \
-    UIM_PREPARE_SAVING_TEXTDOMAIN_CODESET(); \
-    UIM_SWITCH_TEXTDOMAIN_CODESET(uc); \
-    form_size = uim_sizeof_sexp_str(sexp_tmpl, arg1, arg2); \
-    if (form_size != -1) { \
-      buf = malloc(form_size); \
-      snprintf(buf, form_size, sexp_tmpl, arg1, arg2); \
-      UIM_EVAL_STRING_INTERNAL(uc, buf); \
-      free(buf); \
-    } \
-    UIM_RESTORE_TEXTDOMAIN_CODESET(); \
-  }
-
-#define UIM_EVAL_FSTRING3(uc, sexp_tmpl, arg1, arg2, arg3) \
-  { \
-    int form_size; \
-    char *buf; \
-    UIM_PREPARE_SAVING_TEXTDOMAIN_CODESET(); \
-    UIM_SWITCH_TEXTDOMAIN_CODESET(uc); \
-    form_size = uim_sizeof_sexp_str(sexp_tmpl, arg1, arg2, arg3); \
-    if (form_size != -1) { \
-      buf = malloc(form_size); \
-      snprintf(buf, form_size, sexp_tmpl, arg1, arg2, arg3); \
-      UIM_EVAL_STRING_INTERNAL(uc, buf); \
-      free(buf); \
-    } \
-    UIM_RESTORE_TEXTDOMAIN_CODESET(); \
-  }
-
-#define UIM_EVAL_FSTRING4(uc, sexp_tmpl, arg1, arg2, arg3, arg4) \
-  { \
-    int form_size; \
-    char *buf; \
-    UIM_PREPARE_SAVING_TEXTDOMAIN_CODESET(); \
-    UIM_SWITCH_TEXTDOMAIN_CODESET(uc); \
-    form_size = uim_sizeof_sexp_str(sexp_tmpl, arg1, arg2, arg3, arg4); \
-    if (form_size != -1) { \
-      buf = malloc(form_size); \
-      snprintf(buf, form_size, sexp_tmpl, arg1, arg2, arg3, arg4); \
-      UIM_EVAL_STRING_INTERNAL(uc, buf); \
-      free(buf); \
-    } \
-    UIM_RESTORE_TEXTDOMAIN_CODESET(); \
-  }
-
-#define UIM_EVAL_FSTRING5(uc, sexp_tmpl, arg1, arg2, arg3, arg4, arg5) \
-  { \
-    int form_size; \
-    char *buf; \
-    UIM_PREPARE_SAVING_TEXTDOMAIN_CODESET(); \
-    UIM_SWITCH_TEXTDOMAIN_CODESET(uc); \
-    form_size = uim_sizeof_sexp_str(sexp_tmpl, arg1, arg2, arg3, arg4, arg5); \
-    if (form_size != -1) { \
-      buf = malloc(form_size); \
-      snprintf(buf, form_size, sexp_tmpl, arg1, arg2, arg3, arg4, arg5); \
-      UIM_EVAL_STRING_INTERNAL(uc, buf); \
-      free(buf); \
-    } \
-    UIM_RESTORE_TEXTDOMAIN_CODESET(); \
-  }
-
-/**/
-uim_context
-uim_find_context(int id);
-void uim_scm_init(const char *verbose_level);
-void uim_scm_quit(void);
-
-#ifdef UIM_COMPAT_SCM
-void uim_init_compat_scm_subrs(void);
-#endif
-void uim_init_key_subrs(void);
-void uim_init_util_subrs(void);
-#ifdef UIM_COMPAT_TABLE
-void uim_init_table_subrs(void);
-#endif
-void uim_init_im_subrs(void);
-void uim_init_intl_subrs(void);
-
-/**/
-void uim_init_plugin(void);
-void uim_quit_plugin(void);
-
-int uim_iconv_is_convertible(const char *tocode, const char *fromcode);
-void *uim_iconv_create(const char *tocode, const char *fromcode);
-char *uim_iconv_code_conv(void *obj, const char *str);
-void uim_iconv_release(void *obj);
-
-int uim_sizeof_sexp_str(const char *tmpl, ...);
-void uim_eval_string(uim_context, char *str);
-void uim_release_preedit_segments(uim_context uc);
-void uim_update_preedit_segments(uim_context uc);
-
-extern struct uim_im *uim_im_array;
-extern int uim_nr_im;
-extern char *uim_last_client_encoding;
-
-#ifdef __cplusplus
-}
-#endif
-#endif

Modified: branches/r5rs/uim/editline.c
===================================================================
--- branches/r5rs/uim/editline.c	2005-09-21 12:32:54 UTC (rev 1535)
+++ branches/r5rs/uim/editline.c	2005-09-21 18:53:48 UTC (rev 1536)
@@ -58,6 +58,12 @@
 static uim_lisp uim_editline_readline(void);
 static char *prompt(EditLine *e);
 
+#if UIM_SCM_GCC4_READY_GC
+static UIM_SCM_GC_PROTECTED_FUNC_DECL(uim_lisp,
+				      uim_editline_readline_internal,
+				      (void));
+#endif
+
 void
 editline_init(void)
 {
@@ -82,12 +88,29 @@
 
 static uim_lisp
 uim_editline_readline(void)
+#if UIM_SCM_GCC4_READY_GC
 {
+  uim_lisp ret;
+
+  UIM_SCM_GC_CALL_PROTECTED_FUNC(ret, uim_editline_readline_internal, ());
+
+  return ret;
+}
+
+static uim_lisp
+uim_editline_readline_internal(void)
+#endif
+{
     const char *line;
     int count = 0;
-    uim_lisp ret, stack_start;
+#if !UIM_SCM_GCC4_READY_GC
+    uim_lisp stack_start;
+#endif
+    uim_lisp ret;
 
+#if !UIM_SCM_GCC4_READY_GC
     uim_scm_gc_protect_stack(&stack_start);
+#endif
 
     line = el_gets(el, &count);
 
@@ -98,7 +121,9 @@
 	ret = uim_scm_make_str("");
     }
 
+#if !UIM_SCM_GCC4_READY_GC
     uim_scm_gc_unprotect_stack(&stack_start);
+#endif
 
     return ret;
 }

Deleted: branches/r5rs/uim/getpeereid.c
===================================================================
--- branches/r5rs/uim/getpeereid.c	2005-09-21 12:32:54 UTC (rev 1535)
+++ branches/r5rs/uim/getpeereid.c	2005-09-21 18:53:48 UTC (rev 1536)
@@ -1,133 +0,0 @@
-/*
- * Copyright (c) 2002,2004 Damien Miller <djm at mindrot.org>
- *
- * Permission to use, copy, modify, and distribute this software for any
- * purpose with or without fee is hereby granted, provided that the above
- * copyright notice and this permission notice appear in all copies.
- *
- * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
- * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
- * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
- * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
- * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
- * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
- * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
- */
-
-#include "config.h"
-#include <stdio.h>
-#include <unistd.h>
-#include <sys/types.h>
-#include <sys/socket.h>
-#include <sys/un.h>
-#include <sys/param.h>
-#include "uim.h"
-#include "uim-helper.h"
-
-#if !defined(HAVE_GETPEEREID)
-
-#if defined(SO_PEERCRED)
-static int
-getpeereid(int s, uid_t *euid, gid_t *gid)
-{
-	struct ucred cred;
-	socklen_t len = sizeof(cred);
-
-	if (getsockopt(s, SOL_SOCKET, SO_PEERCRED, &cred, &len) < 0)
-		return (-1);
-	*euid = cred.uid;
-	*gid = cred.gid;
-
-	return (0);
-}
-#elif defined(LOCAL_CREDS)	/* NetBSD */
-int
-getpeereid(int s, uid_t *euid, gid_t *gid)
-{
-/* Credentials structure */
-#ifdef __NetBSD__	/* XXX: should use autoconf */
-#define HAVE_STRUCT_SOCKCRED
-#endif
-#if defined(HAVE_STRUCT_CMSGCRED)
-        typedef struct cmsgcred Cred;
-
-#define cruid cmcred_euid
-#define crgid cmcred_groups[0]
-#elif defined(HAVE_STRUCT_FCRED)
-        typedef struct fcred Cred;
-
-#define cruid fc_uid
-#define crgid fc_gid
-#elif defined(HAVE_STRUCT_SOCKCRED)
-        typedef struct sockcred Cred;
-
-#define cruid sc_euid
-#define crgid sc_egid
-#endif
-        Cred *cred;
-
-        /* Compute size without padding */
-        char cmsgmem[CMSG_SPACE(sizeof(Cred))]; /* for NetBSD */
-
-        /* Point to start of first structure */
-        struct cmsghdr *cmsg = (struct cmsghdr *)cmsgmem;
-
-        struct iovec iov;
-        char buf;
-        struct msghdr msg;
-
-        memset(&msg, 0, sizeof(msg));
-        msg.msg_iov = &iov;
-        msg.msg_iovlen = 1;
-        msg.msg_control = (char *)cmsg;
-        msg.msg_controllen = sizeof(cmsgmem);
-        memset(cmsg, 0, sizeof(cmsgmem));
-
-        /*
-         * The one character which is received here is not meaningful; its
-         * purposes is only to make sure that recvmsg() blocks long enough for
-         * the other side to send its credentials.
-         */
-        iov.iov_base = &buf;
-        iov.iov_len = 1;
-
-        if (recvmsg(s, &msg, 0) < 0 ||
-                cmsg->cmsg_len < sizeof(cmsgmem) ||
-                cmsg->cmsg_type != SCM_CREDS)
-        {
-                return -1;
-        }
-
-        cred = (Cred *)CMSG_DATA(cmsg);
-	*euid = cred->cruid;
-	*gid = cred->crgid;
-
-	return 0;
-}
-#else
-static int
-getpeereid(int s, uid_t *euid, gid_t *gid)
-{
-	*euid = geteuid();
-	*gid = getgid();
-
-	return (0);
-}
-#endif /* defined(SO_PEERCRED) */
-
-#endif /* !defined(HAVE_GETPEEREID) */
-int
-uim_helper_check_connection_fd(int fd)
-{
-  uid_t euid;
-  gid_t egid;
-  if (getpeereid(fd, &euid, &egid) < 0) {
-    perror("getpeereid failed");
-    return -1;
-  }
-  if ((euid != 0) && (euid != getuid())) {
-    fprintf(stderr, "uid mismatch\n");
-    return -1;
-  }
-  return 0;
-}

Modified: branches/r5rs/uim/intl.c
===================================================================
--- branches/r5rs/uim/intl.c	2005-09-21 12:32:54 UTC (rev 1535)
+++ branches/r5rs/uim/intl.c	2005-09-21 18:53:48 UTC (rev 1536)
@@ -50,7 +50,7 @@
 #include "uim-compat-scm.h"
 
 /* for uim_init_intl_subrs() */
-#include "context.h"
+#include "uimint.h"
 
 static uim_lisp
 intl_gettext_package()

Modified: branches/r5rs/uim/m17nlib.c
===================================================================
--- branches/r5rs/uim/m17nlib.c	2005-09-21 12:32:54 UTC (rev 1535)
+++ branches/r5rs/uim/m17nlib.c	2005-09-21 18:53:48 UTC (rev 1536)
@@ -37,7 +37,6 @@
 #include <m17n.h>
 #include "uim-scm.h"
 #include "uim-util.h"
-#include "context.h"
 #include "plugin.h"
 
 static int m17nlib_ok;

Modified: branches/r5rs/uim/plugin.c
===================================================================
--- branches/r5rs/uim/plugin.c	2005-09-21 12:32:54 UTC (rev 1535)
+++ branches/r5rs/uim/plugin.c	2005-09-21 18:53:48 UTC (rev 1536)
@@ -51,7 +51,7 @@
 #include "uim-compat-scm.h"
 #include "uim-compat-scm.h"
 #include "plugin.h"
-#include "context.h"
+#include "uimint.h"
 
 #ifndef HAVE_DLFUNC
 #define dlfunc dlsym
@@ -67,6 +67,13 @@
 #define DPRINTFN(n,x)
 #endif
 
+#if UIM_SCM_GCC4_READY_GC
+static UIM_SCM_GC_PROTECTED_FUNC_DECL(uim_lisp, plugin_unload_internal,
+				      (uim_lisp _name));
+static UIM_SCM_GC_PROTECTED_FUNC_DECL(void, uim_quit_plugin_internal, (void));
+#endif
+
+
 static uim_lisp 
 plugin_load(uim_lisp _name)
 {
@@ -188,12 +195,28 @@
 
 static uim_lisp
 plugin_unload(uim_lisp _name)
+#if UIM_SCM_GCC4_READY_GC
 {
+  uim_lisp ret;
+
+  UIM_SCM_GC_CALL_PROTECTED_FUNC(ret, plugin_unload_internal, (_name));
+
+  return ret;
+}
+
+static uim_lisp
+plugin_unload_internal(uim_lisp _name)
+#endif
+{
+#if !UIM_SCM_GCC4_READY_GC
   uim_lisp stack_start;
+#endif
   void *library;
   void (*plugin_instance_quit)(void);
 
+#if !UIM_SCM_GCC4_READY_GC
   uim_scm_gc_protect_stack(&stack_start);
+#endif
 
   UIM_EVAL_FSTRING1(NULL, "(plugin-list-query-library \"%s\")",
 		    uim_scm_refer_c_str(_name));
@@ -212,7 +235,11 @@
 
   UIM_EVAL_FSTRING1(NULL, "(plugin-list-delete \"%s\")",
 		    uim_scm_refer_c_str(_name));
+
+#if !UIM_SCM_GCC4_READY_GC
   uim_scm_gc_unprotect_stack(&stack_start);
+#endif
+
   return uim_scm_t();
 }
 
@@ -229,17 +256,33 @@
 /* Called from uim_quit */
 void
 uim_quit_plugin(void)
+#if UIM_SCM_GCC4_READY_GC
 {
+  UIM_SCM_GC_CALL_PROTECTED_VOID_FUNC(uim_quit_plugin_internal, ());
+}
+
+static void
+uim_quit_plugin_internal(void)
+#endif
+{
+#if !UIM_SCM_GCC4_READY_GC
   uim_lisp stack_start;
+#endif
   uim_lisp alist, rest, entry, name;
 
+#if !UIM_SCM_GCC4_READY_GC
   uim_scm_gc_protect_stack(&stack_start);
-  alist = uim_scm_symbol_value("plugin-alist");
+#endif
+
+  alist = uim_scm_eval_c_string("plugin-alist");
   for (rest = alist; !uim_scm_nullp(rest); rest = uim_scm_cdr(rest)) {
     entry = uim_scm_car(rest);
     name = uim_scm_car(entry);
 
     plugin_unload(name);
   }
+
+#if !UIM_SCM_GCC4_READY_GC
   uim_scm_gc_unprotect_stack(&stack_start);
+#endif
 }

Modified: branches/r5rs/uim/prime.c
===================================================================
--- branches/r5rs/uim/prime.c	2005-09-21 12:32:54 UTC (rev 1535)
+++ branches/r5rs/uim/prime.c	2005-09-21 18:53:48 UTC (rev 1536)
@@ -46,7 +46,6 @@
 #include "config.h"
 #include "uim-scm.h"
 #include "uim-compat-scm.h"
-#include "context.h"
 #include "plugin.h"
 #include "uim-helper.h"
 

Deleted: branches/r5rs/uim/setenv.c
===================================================================
--- branches/r5rs/uim/setenv.c	2005-09-21 12:32:54 UTC (rev 1535)
+++ branches/r5rs/uim/setenv.c	2005-09-21 18:53:48 UTC (rev 1536)
@@ -1,163 +0,0 @@
-/*
- * Copyright (c) 1987 Regents of the University of California.
- * 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 the University 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 COPYRIGHT HOLDERS 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 COPYRIGHT HOLDERS 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.
- */
-
-#include <stdlib.h>
-#include <string.h>
-
-#include "config.h"
-#if !defined(HAVE_SETENV) || !defined(HAVE_UNSETENV)
-
-static char *__findenv(const char *name, int *offset);
-#ifndef HAVE_SETENV
-int setenv(const char *, const char *, int);
-#endif
-#ifndef HAVE_UNSETENV
-void unsetenv(const char *);
-#endif
-extern char **environ;
-
-/*
- * __findenv --
- *	Returns pointer to value associated with name, if any, else NULL.
- *	Sets offset to be the offset of the name/value combination in the
- *	environmental array, for use by setenv(3) and unsetenv(3).
- *	Explicitly removes '=' in argument name.
- *
- *	This routine *should* be a static; don't use it.
- */
-static char *
-__findenv(name, offset)
-	register const char *name;
-	int *offset;
-{
-	register int len, i;
-	register const char *np;
-	register char **p, *cp;
-
-	if (name == NULL || environ == NULL)
-		return (NULL);
-	for (np = name; *np && *np != '='; ++np)
-		;
-	len = np - name;
-	for (p = environ; (cp = *p) != NULL; ++p) {
-		for (np = name, i = len; i && *cp; i--)
-			if (*cp++ != *np++)
-				break;
-		if (i == 0 && *cp++ == '=') {
-			*offset = p - environ;
-			return (cp);
-		}
-	}
-	return (NULL);
-}
-
-#ifndef HAVE_SETENV
-/*
- * setenv --
- *	Set the value of the environmental variable "name" to be
- *	"value".  If rewrite is set, replace any current value.
- */
-int
-setenv(name, value, rewrite)
-	register const char *name;
-	register const char *value;
-	int rewrite;
-{
-	static int alloced;			/* if allocated space before */
-	register char *C;
-	int offset;
-	size_t l_value;
-
-	if (*value == '=')			/* no `=' in value */
-		++value;
-	l_value = strlen(value);
-	if ((C = __findenv(name, &offset))) {	/* find if already exists */
-		if (!rewrite)
-			return (0);
-		if (strlen(C) >= l_value) {	/* old larger; copy over */
-			while ((*C++ = *value++))
-				;
-			return (0);
-		}
-	} else {					/* create new slot */
-		register int	cnt;
-		register char	**P;
-
-		for (P = environ, cnt = 0; *P; ++P, ++cnt);
-		if (alloced) {			/* just increase size */
-			P = (char **)realloc((void *)environ,
-			    (size_t)(sizeof(char *) * (cnt + 2)));
-			if (!P)
-				return (-1);
-			environ = P;
-		}
-		else {				/* get new space */
-			alloced = 1;		/* copy old entries into it */
-			P = (char **)malloc((size_t)(sizeof(char *) *
-			    (cnt + 2)));
-			if (!P)
-				return (-1);
-			memmove(P, environ, cnt * sizeof(char *));
-			environ = P;
-		}
-		environ[cnt + 1] = NULL;
-		offset = cnt;
-	}
-	for (C = (char *)name; *C && *C != '='; ++C);	/* no `=' in name */
-	if (!(environ[offset] =			/* name + `=' + value */
-	    malloc((size_t)((int)(C - name) + l_value + 2))))
-		return (-1);
-	for (C = environ[offset]; (*C = *name++) && *C != '='; ++C)
-		;
-	for (*C++ = '='; (*C++ = *value++); )
-		;
-	return (0);
-}
-#endif /* HAVE_SETENV */
-
-#ifndef HAVE_UNSETENV
-/*
- * unsetenv(name) --
- *	Delete environmental variable "name".
- */
-void
-unsetenv(name)
-	const char	*name;
-{
-	register char **P;
-	int offset;
-
-	while (__findenv(name, &offset))		/* if set multiple times */
-		for (P = &environ[offset];; ++P)
-			if (!(*P = *(P + 1)))
-				break;
-}
-#endif /* HAVE_UNSETENV */
-
-#endif /* !defined(HAVE_SETENV) || !defined(HAVE_UNSETENV) */

Modified: branches/r5rs/uim/skk.c
===================================================================
--- branches/r5rs/uim/skk.c	2005-09-21 12:32:54 UTC (rev 1535)
+++ branches/r5rs/uim/skk.c	2005-09-21 18:53:48 UTC (rev 1536)
@@ -52,7 +52,6 @@
 #include <netdb.h>
 
 #include "uim-scm.h"
-#include "context.h"
 #include "plugin.h"
 
 #define skk_isalpha(ch)	(skk_islower(ch) || skk_isupper(ch))

Modified: branches/r5rs/uim/spellcheck.c
===================================================================
--- branches/r5rs/uim/spellcheck.c	2005-09-21 12:32:54 UTC (rev 1535)
+++ branches/r5rs/uim/spellcheck.c	2005-09-21 18:53:48 UTC (rev 1536)
@@ -31,7 +31,7 @@
 
 */
 
-#include "context.h"
+#include "uimint.h"
 
 static FILE *spell_r = NULL, *spell_w = NULL;
 static int spell_pid = 0;

Deleted: branches/r5rs/uim/strsep.c
===================================================================
--- branches/r5rs/uim/strsep.c	2005-09-21 12:32:54 UTC (rev 1535)
+++ branches/r5rs/uim/strsep.c	2005-09-21 18:53:48 UTC (rev 1536)
@@ -1,74 +0,0 @@
-/*-
- * Copyright (c) 1990, 1993
- *	The Regents of the University of California.  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 the University 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 COPYRIGHT HOLDERS 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 COPYRIGHT HOLDERS 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.
- */
-
-#include "config.h"
-#include <string.h>
-#include <stdio.h>
-
-#if !defined(HAVE_STRSEP)
-
-/*
- * Get next token from string *stringp, where tokens are possibly-empty
- * strings separated by characters from delim.  
- *
- * Writes NULs into the string at *stringp to end tokens.
- * delim need not remain constant from call to call.
- * On return, *stringp points past the last NUL written (if there might
- * be further tokens), or is NULL (if there are definitely no more tokens).
- *
- * If *stringp is NULL, strsep returns NULL.
- */
-char *
-uim_strsep(char **stringp, const char *delim)
-{
-	char *s;
-	const char *spanp;
-	int c, sc;
-	char *tok;
-
-	if ((s = *stringp) == NULL)
-		return (NULL);
-	for (tok = s;;) {
-		c = *s++;
-		spanp = delim;
-		do {
-			if ((sc = *spanp++) == c) {
-				if (c == 0)
-					s = NULL;
-				else
-					s[-1] = 0;
-				*stringp = s;
-				return (tok);
-			}
-		} while (sc != 0);
-	}
-	/* NOTREACHED */
-}
-
-#endif /* !defined(HAVE_STRSEP) */

Modified: branches/r5rs/uim/uim-compat-scm.c
===================================================================
--- branches/r5rs/uim/uim-compat-scm.c	2005-09-21 12:32:54 UTC (rev 1535)
+++ branches/r5rs/uim/uim-compat-scm.c	2005-09-21 18:53:48 UTC (rev 1536)
@@ -37,8 +37,17 @@
 #include <string.h>
 
 #include "uim-compat-scm.h"
-#include "context.h"
+#include "uimint.h"
 
+#if UIM_SCM_GCC4_READY_GC
+static UIM_SCM_GC_PROTECTED_FUNC_DECL(int,
+				      uim_scm_symbol_value_int_internal,
+				      (const char *symbol_str));
+static UIM_SCM_GC_PROTECTED_FUNC_DECL(char *,
+				      uim_scm_symbol_value_str_internal,
+				      (const char *symbol_str));
+#endif
+
 static uim_lisp return_val;
 
 /* will be deprecated. use uim_scm_c_str() instead */
@@ -59,12 +68,29 @@
 
 int
 uim_scm_symbol_value_int(const char *symbol_str)
+#if UIM_SCM_GCC4_READY_GC
 {
+  int ret;
+
+  UIM_SCM_GC_CALL_PROTECTED_FUNC(ret, uim_scm_symbol_value_int_internal,
+				 (symbol_str));
+
+  return ret;
+}
+
+static int
+uim_scm_symbol_value_int_internal(const char *symbol_str)
+#endif
+{
+#if !UIM_SCM_GCC4_READY_GC
   uim_lisp stack_start;
+#endif
   uim_lisp val_;
   int val;
 
+#if !UIM_SCM_GCC4_READY_GC
   uim_scm_gc_protect_stack(&stack_start);
+#endif
   val_ = uim_scm_symbol_value(symbol_str);
 
   if NFALSEP(val_) {
@@ -72,7 +98,9 @@
   } else {
     val = 0;
   }
+#if !UIM_SCM_GCC4_READY_GC
   uim_scm_gc_unprotect_stack(&stack_start);
+#endif
 
   return val;
 }
@@ -85,12 +113,29 @@
 
 char *
 uim_scm_symbol_value_str(const char *symbol_str)
+#if UIM_SCM_GCC4_READY_GC
 {
+  char *ret;
+
+  UIM_SCM_GC_CALL_PROTECTED_FUNC(ret, uim_scm_symbol_value_str_internal,
+				 (symbol_str));
+
+  return ret;
+}
+
+static char *
+uim_scm_symbol_value_str_internal(const char *symbol_str)
+#endif
+{
+#if !UIM_SCM_GCC4_READY_GC
   uim_lisp stack_start;
+#endif
   uim_lisp val_ = uim_scm_f();
   char *val;
 
+#if !UIM_SCM_GCC4_READY_GC
   uim_scm_gc_protect_stack(&stack_start);
+#endif
   val_ = uim_scm_symbol_value(symbol_str);
 
   if NFALSEP(val_) {
@@ -98,7 +143,9 @@
   } else {
     val = NULL;
   }
+#if !UIM_SCM_GCC4_READY_GC
   uim_scm_gc_unprotect_stack(&stack_start);
+#endif
 
   return val;
 }

Modified: branches/r5rs/uim/uim-custom.c
===================================================================
--- branches/r5rs/uim/uim-custom.c	2005-09-21 12:32:54 UTC (rev 1535)
+++ branches/r5rs/uim/uim-custom.c	2005-09-21 18:53:48 UTC (rev 1536)
@@ -52,7 +52,7 @@
 #include "uim-scm.h"
 #include "uim-compat-scm.h"
 #include "uim-custom.h"
-#include "context.h"
+#include "uimint.h"
 #include "uim-helper.h"
 
 #if 0
@@ -132,6 +132,15 @@
 static uim_bool uim_custom_load_group(const char *group);
 static uim_bool uim_custom_save_group(const char *group);
 
+#if UIM_SCM_GCC4_READY_GC
+static UIM_SCM_GC_PROTECTED_FUNC_DECL(char *, literalize_string_internal,
+				      (const char *str));
+static UIM_SCM_GC_PROTECTED_FUNC_DECL(uim_bool, custom_cb_add_internal,
+				      (const char *hook, const char *validator,
+				       const char *custom_sym, void *ptr,
+				       const char *gate_func, void (*cb)(void)));
+#endif
+
 static const char str_list_arg[] = "uim-custom-c-str-list-arg";
 static const char custom_subdir[] = "customs";
 static const char custom_msg_tmpl[] = "prop_update_custom\n%s\n%s\n";
@@ -141,16 +150,36 @@
 
 static char *
 literalize_string(const char *str)
+#if UIM_SCM_GCC4_READY_GC
 {
+  char *ret;
+
+  UIM_SCM_GC_CALL_PROTECTED_FUNC(ret, literalize_string_internal, (str));
+
+  return ret;
+}
+
+static char *
+literalize_string_internal(const char *str)
+#endif
+{
+#if !UIM_SCM_GCC4_READY_GC
   uim_lisp stack_start;
+#endif
   uim_lisp form;
   char *escaped;
 
+#if !UIM_SCM_GCC4_READY_GC
   uim_scm_gc_protect_stack(&stack_start);
+#endif
+
   form = uim_scm_list2(uim_scm_make_symbol("string-escape"),
 		       uim_scm_make_str(str));
   escaped = uim_scm_c_str(uim_scm_eval(form));
+
+#if !UIM_SCM_GCC4_READY_GC
   uim_scm_gc_unprotect_stack(&stack_start);
+#endif
 
   return escaped;
 }
@@ -1372,12 +1401,33 @@
 custom_cb_add(const char *hook, const char *validator,
 	      const char *custom_sym, void *ptr,
 	      const char *gate_func, void (*cb)(void))
+#if UIM_SCM_GCC4_READY_GC
 {
+  uim_bool ret;
+
+  UIM_SCM_GC_CALL_PROTECTED_FUNC(ret, custom_cb_add_internal,
+				 (hook, validator, custom_sym, ptr, gate_func,
+				  cb));
+
+  return ret;
+}
+
+static uim_bool
+custom_cb_add_internal(const char *hook, const char *validator,
+		       const char *custom_sym, void *ptr,
+		       const char *gate_func, void (*cb)(void))
+#endif
+{
   uim_bool succeeded;
+#if !UIM_SCM_GCC4_READY_GC
   uim_lisp stack_start;
+#endif
   uim_lisp form;
 
+#if !UIM_SCM_GCC4_READY_GC
   uim_scm_gc_protect_stack(&stack_start);
+#endif
+
   form = uim_scm_list5(uim_scm_make_symbol(validator),
 		       uim_scm_quote(uim_scm_make_symbol(custom_sym)),
 		       uim_scm_make_ptr(ptr),
@@ -1386,7 +1436,10 @@
   form = uim_scm_cons(uim_scm_quote(uim_scm_make_symbol(hook)), form);
   form = uim_scm_cons(uim_scm_make_symbol("custom-register-cb"), form);
   succeeded = uim_scm_c_bool(uim_scm_eval(form));
+
+#if !UIM_SCM_GCC4_READY_GC
   uim_scm_gc_unprotect_stack(&stack_start);
+#endif
 
   return succeeded;
 }

Modified: branches/r5rs/uim/uim-func.c
===================================================================
--- branches/r5rs/uim/uim-func.c	2005-09-21 12:32:54 UTC (rev 1535)
+++ branches/r5rs/uim/uim-func.c	2005-09-21 18:53:48 UTC (rev 1536)
@@ -36,7 +36,7 @@
 #include <string.h>
 #include <stdlib.h>
 #include <stdarg.h>
-#include "context.h"
+#include "uimint.h"
 #include "uim-scm.h"
 #include "uim-encoding.h"
 #include "uim-util.h"

Modified: branches/r5rs/uim/uim-helper-client.c
===================================================================
--- branches/r5rs/uim/uim-helper-client.c	2005-09-21 12:32:54 UTC (rev 1535)
+++ branches/r5rs/uim/uim-helper-client.c	2005-09-21 18:53:48 UTC (rev 1536)
@@ -44,7 +44,7 @@
 #include <unistd.h>
 #include "uim.h"
 #include "uim-helper.h"
-#include "context.h"
+#include "uimint.h"
 
 
 #define RECV_BUFFER_SIZE 1024

Modified: branches/r5rs/uim/uim-helper.c
===================================================================
--- branches/r5rs/uim/uim-helper.c	2005-09-21 12:32:54 UTC (rev 1535)
+++ branches/r5rs/uim/uim-helper.c	2005-09-21 18:53:48 UTC (rev 1536)
@@ -46,7 +46,7 @@
 #include <pwd.h>
 #include <signal.h>
 #include <errno.h>
-#include "context.h"
+#include "uimint.h"
 #include "uim-helper.h"
 #include "uim-util.h"
 

Modified: branches/r5rs/uim/uim-im-switcher.h
===================================================================
--- branches/r5rs/uim/uim-im-switcher.h	2005-09-21 12:32:54 UTC (rev 1535)
+++ branches/r5rs/uim/uim-im-switcher.h	2005-09-21 18:53:48 UTC (rev 1536)
@@ -46,7 +46,7 @@
 
 /**
  * Get the name of current input method.
- * A uim_context has several input methods, only one of them is
+ * A uim_uimint.has several input methods, only one of them is
  * selected. This function returns the name of currently selected
  * input method.
  * 

Modified: branches/r5rs/uim/uim-ipc.c
===================================================================
--- branches/r5rs/uim/uim-ipc.c	2005-09-21 12:32:54 UTC (rev 1535)
+++ branches/r5rs/uim/uim-ipc.c	2005-09-21 18:53:48 UTC (rev 1536)
@@ -43,15 +43,10 @@
 #include <stdio.h>
 #include <string.h>
 
-#include "context.h"
+#include "uimint.h"
 #include "uim-helper.h"
 #include "uim-util.h"
 
-#ifndef HAVE_STRSEP
-char *uim_strsep(char **stringp, const char *delim);
-#define strsep	uim_strsep
-#endif
-
 /* This function is come from the GNU C Library manual */
 static int
 set_cloexec(int fd)
@@ -296,3 +291,19 @@
   *pid = uim_ipc_open_command(*pid, read_fp, write_fp, command);
   return NULL;
 }
+
+int
+uim_helper_check_connection_fd(int fd)
+{
+  uid_t euid;
+  gid_t egid;
+  if (getpeereid(fd, &euid, &egid) < 0) {
+    perror("getpeereid failed");
+    return -1;
+  }
+  if ((euid != 0) && (euid != getuid())) {
+    fprintf(stderr, "uid mismatch\n");
+    return -1;
+  }
+  return 0;
+}

Modified: branches/r5rs/uim/uim-key.c
===================================================================
--- branches/r5rs/uim/uim-key.c	2005-09-21 12:32:54 UTC (rev 1535)
+++ branches/r5rs/uim/uim-key.c	2005-09-21 18:53:48 UTC (rev 1536)
@@ -38,7 +38,7 @@
 #include "uim.h"
 #include "uim-scm.h"
 #include "uim-compat-scm.h"
-#include "context.h"
+#include "uimint.h"
 
 struct key_entry {
   int key;

Modified: branches/r5rs/uim/uim-module-manager.c
===================================================================
--- branches/r5rs/uim/uim-module-manager.c	2005-09-21 12:32:54 UTC (rev 1535)
+++ branches/r5rs/uim/uim-module-manager.c	2005-09-21 18:53:48 UTC (rev 1536)
@@ -42,7 +42,7 @@
 
 #include "uim.h"
 #include "uim-scm.h"
-#include "context.h"
+#include "uimint.h"
 
 #define MODULE_LIST_FILENAME UIM_DATADIR"/modules"
 #define LOADER_SCM_FILENAME  UIM_DATADIR"/loader.scm"

Added: branches/r5rs/uim/uim-scm-gc.c
===================================================================
--- branches/r5rs/uim/uim-scm-gc.c	2005-09-21 12:32:54 UTC (rev 1535)
+++ branches/r5rs/uim/uim-scm-gc.c	2005-09-21 18:53:48 UTC (rev 1536)
@@ -0,0 +1,66 @@
+/*
+
+  Copyright (c) 2003-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 COPYRIGHT HOLDERS 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 COPYRIGHT HOLDERS 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.
+
+*/
+
+#include "siod.h"
+#include "uim-scm.h"
+
+
+#if UIM_SCM_GCC4_READY_GC
+void
+uim_scm_gc_protect(uim_lisp *location)
+{
+  siod_gc_protect((LISP *)location);
+}
+
+uim_lisp *
+uim_scm_gc_protect_stack(void)
+{
+  LISP stack_start;
+
+  siod_gc_protect_stack(&stack_start);
+
+  return (uim_lisp *)&stack_start;
+}
+
+void
+uim_scm_gc_unprotect_stack(uim_lisp *stack_start)
+{
+  siod_gc_unprotect_stack((LISP *)stack_start);
+}
+
+uim_func_ptr
+uim_scm_gc_ensure_uninlined_func(uim_func_ptr func)
+{
+  return func;
+}
+#endif /* UIM_SCM_GCC4_READY_GC */

Modified: branches/r5rs/uim/uim-scm.c
===================================================================
--- branches/r5rs/uim/uim-scm.c	2005-09-21 12:32:54 UTC (rev 1535)
+++ branches/r5rs/uim/uim-scm.c	2005-09-21 18:53:48 UTC (rev 1536)
@@ -41,8 +41,27 @@
 #include "sigscheme/sigschemetype.h"
 #include "uim-scm.h"
 #include "uim-compat-scm.h"
-#include "context.h"
+#include "uimint.h"
 
+#if UIM_SCM_GCC4_READY_GC
+static UIM_SCM_GC_PROTECTED_FUNC_DECL(int,
+				      uim_scm_c_int_internal,
+				      (uim_lisp integer));
+static UIM_SCM_GC_PROTECTED_FUNC_DECL(const char *,
+				      uim_scm_refer_c_str_internal,
+				      (uim_lisp str));
+static UIM_SCM_GC_PROTECTED_FUNC_DECL(uim_lisp,
+				      uim_scm_eval_internal,
+				      (uim_lisp obj));
+static UIM_SCM_GC_PROTECTED_FUNC_DECL(void,
+				      siod_init_subr_internal,
+				      (const char *name, long type,
+				       SUBR_FUNC fcn));
+static UIM_SCM_GC_PROTECTED_FUNC_DECL(uim_lisp,
+				      uim_scm_eval_c_string_internal,
+				      (const char *str));
+#endif
+
 static uim_lisp true_sym;
 static uim_lisp false_sym;
 static uim_lisp protected_arg0;
@@ -94,16 +113,37 @@
 
 int
 uim_scm_c_int(uim_lisp integer)
+#if UIM_SCM_GCC4_READY_GC
 {
-  if (SCM_INTP((ScmObj)integer)) {
-    return SCM_INT_VALUE((ScmObj)integer);
-  } else {
-    uim_scm_error("uim_scm_c_int: number required but got ",
-                  (uim_lisp)integer);
-    return -1;
-  }
+  int ret;
+
+  UIM_SCM_GC_CALL_PROTECTED_FUNC(ret, uim_scm_c_int_internal, (integer));
+
+  return ret;
 }
 
+static int
+uim_scm_c_int_internal(uim_lisp integer)
+#endif
+{
+  int c_int;
+#if !UIM_SCM_GCC4_READY_GC
+  uim_lisp stack_start;
+
+  /* stack protection is required for my_err() */
+  uim_scm_gc_protect_stack(&stack_start);
+#endif
+
+  protected_arg0 = integer;
+  c_int = get_c_int((LISP)integer);
+
+#if !UIM_SCM_GCC4_READY_GC
+  uim_scm_gc_unprotect_stack(&stack_start);
+#endif
+
+  return c_int;
+}
+
 uim_lisp
 uim_scm_make_int(int integer)
 {
@@ -122,18 +162,37 @@
 
 const char *
 uim_scm_refer_c_str(uim_lisp str)
+#if UIM_SCM_GCC4_READY_GC
 {
-  if (SCM_STRINGP((ScmObj)str)) {
-    return SCM_STRING_STR((ScmObj)str);
-  } else if (SCM_SYMBOLP((ScmObj)str)) {
-    return SCM_SYMBOL_NAME((ScmObj)str);
-  } else {
-    uim_scm_error("uim_scm_refer_c_str: string or symbol required but got ",
-                  (uim_lisp)str);
-    return NULL;
-  }
+  const char *ret;
+
+  UIM_SCM_GC_CALL_PROTECTED_FUNC(ret, uim_scm_refer_c_str_internal, (str));
+
+  return ret;
 }
 
+static const char *
+uim_scm_refer_c_str_internal(uim_lisp str)
+#endif
+{
+  char *c_str;
+#if !UIM_SCM_GCC4_READY_GC
+  uim_lisp stack_start;
+
+  /* stack protection is required for my_err() */
+  uim_scm_gc_protect_stack(&stack_start);
+#endif
+
+  protected_arg0 = str;
+  c_str = get_c_string((LISP)str);
+
+#if !UIM_SCM_GCC4_READY_GC
+  uim_scm_gc_unprotect_stack(&stack_start);
+#endif
+
+  return c_str;
+}
+
 uim_lisp
 uim_scm_make_str(const char *str)
 {
@@ -187,6 +246,7 @@
   return (uim_lisp)Scm_NewCFuncPointer((ScmCFunc)func_ptr);
 }
 
+#if !UIM_SCM_GCC4_READY_GC
 void
 uim_scm_gc_protect(uim_lisp *location)
 {
@@ -204,6 +264,7 @@
 {
   SigScm_GC_UnprotectStack((ScmObj*)stack_start);
 }
+#endif /* UIM_SCM_GCC4_READY_GC */
 
 uim_bool
 uim_scm_is_alive(void)
@@ -315,13 +376,32 @@
 
 uim_lisp
 uim_scm_eval(uim_lisp obj)
+#if UIM_SCM_GCC4_READY_GC
 {
+  uim_lisp ret;
+
+  UIM_SCM_GC_CALL_PROTECTED_FUNC(ret, uim_scm_eval_internal, (obj));
+
+  return ret;
+}
+
+static uim_lisp
+uim_scm_eval_internal(uim_lisp obj)
+#endif
+{
   uim_lisp ret;  /* intentionally outside of next stack_start */
+#if !UIM_SCM_GCC4_READY_GC
   uim_lisp stack_start;
 
   uim_scm_gc_protect_stack(&stack_start);
-  ret = (uim_lisp)ScmOp_eval((ScmObj)obj, SCM_NULL);
+#endif
+
+  ret = (uim_lisp)leval((LISP)obj, NIL);
+
+#if !UIM_SCM_GCC4_READY_GC
   uim_scm_gc_unprotect_stack(&stack_start);
+#endif
+
   return ret;
 }
 
@@ -337,10 +417,23 @@
 
 uim_lisp
 uim_scm_eval_c_string(const char *str)
+#if UIM_SCM_GCC4_READY_GC
 {
-  return (uim_lisp)Scm_eval_c_string(str);
+  uim_lisp ret;
+
+  UIM_SCM_GC_CALL_PROTECTED_FUNC(ret, uim_scm_eval_c_string_internal, (str));
+
+  return ret;
 }
 
+static uim_lisp
+uim_scm_eval_c_string_internal(const char *str)
+#endif
+{
+  repl_c_string((char *)str, 0, 0);
+  return uim_scm_return_value();
+}
+
 uim_lisp
 uim_scm_return_value(void)
 {
@@ -423,7 +516,19 @@
 
 #if 0
 siod_init_subr(const char *name, long type, SUBR_FUNC fcn)
+#if UIM_SCM_GCC4_READY_GC
 {
+  UIM_SCM_GC_CALL_PROTECTED_VOID_FUNC(siod_init_subr_internal,
+				      (name, type, fcn));
+}
+
+static void
+siod_init_subr_internal(const char *name, long type, SUBR_FUNC fcn)
+{
+  init_subr(name, type, fcn);
+}
+#else
+{
   uim_lisp stack_start;
 
   uim_scm_gc_protect_stack(&stack_start);

Modified: branches/r5rs/uim/uim-scm.h
===================================================================
--- branches/r5rs/uim/uim-scm.h	2005-09-21 12:32:54 UTC (rev 1535)
+++ branches/r5rs/uim/uim-scm.h	2005-09-21 18:53:48 UTC (rev 1536)
@@ -69,6 +69,8 @@
 */
 #define UIM_SCM_EXTENDED_API
 
+#define UIM_SCM_GCC4_READY_GC 1
+
 /*
   uim companion tools should treat lisp object as opaque. struct
   uim_opaque exists only for type check and has no actual definition.
@@ -98,12 +100,53 @@
 void
 uim_scm_set_lib_path(const char *path);
 
+#if UIM_SCM_GCC4_READY_GC
+#ifdef __GNUC__
+#define UIM_SCM_NOINLINE __attribute__((noinline))
+#else
+#define UIM_SCM_NOINLINE
+#endif /* __GNUC__ */
+
+#define UIM_SCM_GC_PROTECTED_FUNC_T(func) uim_scm_gc_protected_type__##func
+
+#define UIM_SCM_GC_PROTECTED_FUNC_DECL(ret_type, func, args)                 \
+    ret_type func args UIM_SCM_NOINLINE;                                     \
+    typedef ret_type (*UIM_SCM_GC_PROTECTED_FUNC_T(func)) args
+
+#define UIM_SCM_GC_CALL_PROTECTED_FUNC(ret, func, args)                      \
+    UIM_SCM_GC_CALL_PROTECTED_FUNC_INTERNAL(ret = , func, args)
+
+#define UIM_SCM_GC_CALL_PROTECTED_VOID_FUNC(func, args)                      \
+    UIM_SCM_GC_CALL_PROTECTED_FUNC_INTERNAL((void), func, args)
+
+#define UIM_SCM_GC_CALL_PROTECTED_FUNC_INTERNAL(exp_ret, func, args)         \
+    do {                                                                     \
+        UIM_SCM_GC_PROTECTED_FUNC_T(func) fp;                                \
+        uim_lisp *stack_start;                                               \
+                                                                             \
+        stack_start = uim_scm_gc_protect_stack();                            \
+        fp = (UIM_SCM_GC_PROTECTED_FUNC_T(func))                             \
+                  uim_scm_gc_ensure_uninlined_func((uim_func_ptr)&func);     \
+        exp_ret (*fp)args;                                                   \
+        uim_scm_gc_unprotect_stack(stack_start);                             \
+    } while (/* CONSTCOND */ 0)
+
 void
 uim_scm_gc_protect(uim_lisp *location);
+uim_lisp *
+uim_scm_gc_protect_stack(void);
 void
+uim_scm_gc_unprotect_stack(uim_lisp *stack_start);
+uim_func_ptr
+uim_scm_gc_ensure_uninlined_func(uim_func_ptr func);
+#else /* UIM_SCM_GCC4_READY_GC */
+void
+uim_scm_gc_protect(uim_lisp *location);
+void
 uim_scm_gc_protect_stack(uim_lisp *stack_start);
 void
 uim_scm_gc_unprotect_stack(uim_lisp *stack_start);
+#endif /* UIM_SCM_GCC4_READY_GC */
 
 /* evaluations */
 uim_bool
@@ -123,7 +166,7 @@
 uim_scm_return_value(void);
 /*
   TODO: reorganize UIM_EVAL_FSTRINGn(), uim_sizeof_sexp_str() and
-  uim_eval_string() in context.h into this file
+  uim_eval_string() in uimint.h into this file
 */
 
 /* type conversions */

Modified: branches/r5rs/uim/uim-table.c
===================================================================
--- branches/r5rs/uim/uim-table.c	2005-09-21 12:32:54 UTC (rev 1535)
+++ branches/r5rs/uim/uim-table.c	2005-09-21 18:53:48 UTC (rev 1536)
@@ -42,7 +42,7 @@
 #include "uim-scm.h"
 #include "uim-compat-scm.h"
 #include "siod.h"
-#include "context.h"
+#include "uimint.h"
 
 /*This file is for find entry from table such Japanese roma-ji table*/
 

Modified: branches/r5rs/uim/uim-util.c
===================================================================
--- branches/r5rs/uim/uim-util.c	2005-09-21 12:32:54 UTC (rev 1535)
+++ branches/r5rs/uim/uim-util.c	2005-09-21 18:53:48 UTC (rev 1536)
@@ -40,19 +40,12 @@
 #include <string.h>
 #include <locale.h>
 #include <langinfo.h>
-#include "context.h"
+#include "uimint.h"
 #include "gettext.h"
 #include "uim-scm.h"
 #include "uim-compat-scm.h"
 #include "uim-util.h"
 
-#ifndef HAVE_SETENV
-int setenv(const char *, const char *, int);
-#endif
-#ifndef HAVE_UNSETENV
-void unsetenv(const char *);
-#endif
-
 extern char *uim_return_str;
 
 /* define constants as procedure to ensure unmodifiable */

Modified: branches/r5rs/uim/uim.c
===================================================================
--- branches/r5rs/uim/uim.c	2005-09-21 12:32:54 UTC (rev 1535)
+++ branches/r5rs/uim/uim.c	2005-09-21 18:53:48 UTC (rev 1536)
@@ -43,7 +43,7 @@
 #include "uim-scm.h"
 #include "uim-compat-scm.h"
 #include "uim-custom.h"
-#include "context.h"
+#include "uimint.h"
 #include "gettext.h"
 #include "uim-util.h"
 
@@ -243,6 +243,7 @@
 
   UIM_EVAL_FSTRING1(uc, "(release-context %d)", uc->id);
   uim_release_preedit_segments(uc);
+  uim_update_preedit_segments(uc);
 
   UIM_EVAL_FSTRING2(uc, "(create-context %d #f '%s)", id, engine);
   if (uc->current_im_name)

Added: branches/r5rs/uim/uimint.h
===================================================================
--- branches/r5rs/uim/uimint.h	2005-09-21 12:32:54 UTC (rev 1535)
+++ branches/r5rs/uim/uimint.h	2005-09-21 18:53:48 UTC (rev 1536)
@@ -0,0 +1,290 @@
+/*
+
+  Copyright (c) 2003-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 COPYRIGHT HOLDERS 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 COPYRIGHT HOLDERS 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.
+*/
+
+#ifndef _uimint_h_included_
+#define _uimint_h_included_
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+#include <stdio.h>
+#include "config.h"
+#include "gettext.h"
+#include "uim.h"
+#include "uim-scm.h"
+
+struct uim_im {
+  char *name;
+  char *lang;
+  char *encoding;
+  char *short_desc;
+};
+
+struct uim_candidate_ {
+  char *str;         /* candidate */
+  char *heading_label;
+  char *annotation;
+  /* uim_pos part_of_speech; */
+  /* int freq; */
+  /* int freshness; */
+  /* int formality; */
+  /* char *src_dict; */
+};
+
+struct preedit_segment {
+  int attr;
+  char *str;
+};
+
+struct uim_context_ {
+  /* cookier pointer */
+  void *ptr;
+  /* internal id */
+  int id;
+  /**/
+  int is_enable;
+
+  struct uim_code_converter *conv_if;
+  void *conv;
+  char *current_im_name;
+  char *short_desc;
+  char *encoding;
+  /**/
+  int commit_raw_flag;
+  /**/
+  int nr_modes;
+  char **modes;
+  /**/
+  int mode;
+  /**/
+  char *proplabelstr;
+  char *propstr;
+  /**/
+  int candidate_index;
+  int nr_candidates;
+  /**/
+  void (*commit_cb)(void *ptr, const char *str);
+  /* preedit */
+  void (*preedit_clear_cb)(void *ptr);
+  void (*preedit_pushback_cb)(void *ptr, int attr, const char *str);
+  void (*preedit_update_cb)(void *ptr);
+  /* mode list */
+  void (*mode_list_update_cb)(void *ptr);
+  /* mode */
+  void (*mode_update_cb)(void *ptr, int);
+  /* property list */
+  void (*prop_list_update_cb)(void *ptr, const char *str);
+  /* property label */
+  void (*prop_label_update_cb)(void *ptr, const char *str);
+  /* candidate window */
+  void (*candidate_selector_activate_cb)(void *ptr, int nr, int index);
+  void (*candidate_selector_select_cb)(void *ptr, int index);
+  void (*candidate_selector_shift_page_cb)(void *ptr, int direction);
+  void (*candidate_selector_deactivate_cb)(void *ptr);
+  /* surrounding text */
+  void (*request_surrounding_text_cb)(void *ptr);
+  int (*delete_surrounding_text_cb)(void *ptr, int offset, int len);
+  /* preedit segments array */
+  struct preedit_segment *psegs;
+  int nr_psegs;
+};
+
+#ifdef HAVE_PTHREAD_H
+#include <pthread.h>
+  #define UIM_DEFINE_MUTEX(mtx)                                              \
+           pthread_mutex_t mtx = PTHREAD_MUTEX_INITIALIZER
+  #define UIM_DEFINE_MUTEX_STATIC(mtx)                                       \
+    static pthread_mutex_t mtx = PTHREAD_MUTEX_INITIALIZER
+  #define UIM_LOCK_MUTEX(mtx)    pthread_mutex_lock(&mtx)
+  #define UIM_UNLOCK_MUTEX(mtx)  pthread_mutex_unlock(&mtx)
+#else
+  #define UIM_DEFINE_MUTEX(mtx)
+  #define UIM_DEFINE_MUTEX_STATIC(mtx)
+  #define UIM_LOCK_MUTEX(mtx)
+  #define UIM_UNLOCK_MUTEX(mtx)
+#endif /* HAVE_PTHREAD_H */
+
+#ifdef ENABLE_NLS
+#define UIM_PREPARE_SAVING_TEXTDOMAIN_CODESET() \
+    char *enc, *orig_encoding = NULL; \
+    const char *client_encoding;
+#define UIM_SWITCH_TEXTDOMAIN_CODESET(uc) \
+  if ((enc = bind_textdomain_codeset(GETTEXT_PACKAGE, NULL))) \
+    orig_encoding = strdup(enc); \
+  client_encoding = (uc) ? ((struct uim_context_ *)uc)->encoding : uim_last_client_encoding; \
+  bind_textdomain_codeset(GETTEXT_PACKAGE, client_encoding);
+#define UIM_RESTORE_TEXTDOMAIN_CODESET() \
+  bind_textdomain_codeset(GETTEXT_PACKAGE, orig_encoding); \
+  free(orig_encoding);
+#else  /* ENABLE_NLS */
+#define UIM_PREPARE_SAVING_TEXTDOMAIN_CODESET()
+#define UIM_SWITCH_TEXTDOMAIN_CODESET(uc)
+#define UIM_RESTORE_TEXTDOMAIN_CODESET()
+#endif  /* ENABLE_NLS */
+
+/* we cannot use the variadic macro (i.e. __VA_ARGS__) because we
+   should also support C89 compilers
+*/
+#define UIM_EVAL_STRING_INTERNAL(uc, sexp_str) \
+      if (uc) \
+        uim_eval_string(uc, sexp_str); \
+      else \
+        uim_scm_eval_c_string(sexp_str); \
+
+#define UIM_EVAL_STRING(uc, sexp_str) \
+  { \
+    UIM_PREPARE_SAVING_TEXTDOMAIN_CODESET(); \
+    UIM_SWITCH_TEXTDOMAIN_CODESET(uc); \
+    UIM_EVAL_STRING_INTERNAL(uc, sexp_str); \
+    UIM_RESTORE_TEXTDOMAIN_CODESET(); \
+  }
+
+#define UIM_EVAL_FSTRING1(uc, sexp_tmpl, arg1) \
+  { \
+    int form_size; \
+    char *buf; \
+    UIM_PREPARE_SAVING_TEXTDOMAIN_CODESET(); \
+    UIM_SWITCH_TEXTDOMAIN_CODESET(uc); \
+    form_size = uim_sizeof_sexp_str(sexp_tmpl, arg1); \
+    if (form_size != -1) { \
+      buf = malloc(form_size); \
+      snprintf(buf, form_size, sexp_tmpl, arg1); \
+      UIM_EVAL_STRING_INTERNAL(uc, buf); \
+      free(buf); \
+    } \
+    UIM_RESTORE_TEXTDOMAIN_CODESET(); \
+  }
+
+#define UIM_EVAL_FSTRING2(uc, sexp_tmpl, arg1, arg2) \
+  { \
+    int form_size; \
+    char *buf; \
+    UIM_PREPARE_SAVING_TEXTDOMAIN_CODESET(); \
+    UIM_SWITCH_TEXTDOMAIN_CODESET(uc); \
+    form_size = uim_sizeof_sexp_str(sexp_tmpl, arg1, arg2); \
+    if (form_size != -1) { \
+      buf = malloc(form_size); \
+      snprintf(buf, form_size, sexp_tmpl, arg1, arg2); \
+      UIM_EVAL_STRING_INTERNAL(uc, buf); \
+      free(buf); \
+    } \
+    UIM_RESTORE_TEXTDOMAIN_CODESET(); \
+  }
+
+#define UIM_EVAL_FSTRING3(uc, sexp_tmpl, arg1, arg2, arg3) \
+  { \
+    int form_size; \
+    char *buf; \
+    UIM_PREPARE_SAVING_TEXTDOMAIN_CODESET(); \
+    UIM_SWITCH_TEXTDOMAIN_CODESET(uc); \
+    form_size = uim_sizeof_sexp_str(sexp_tmpl, arg1, arg2, arg3); \
+    if (form_size != -1) { \
+      buf = malloc(form_size); \
+      snprintf(buf, form_size, sexp_tmpl, arg1, arg2, arg3); \
+      UIM_EVAL_STRING_INTERNAL(uc, buf); \
+      free(buf); \
+    } \
+    UIM_RESTORE_TEXTDOMAIN_CODESET(); \
+  }
+
+#define UIM_EVAL_FSTRING4(uc, sexp_tmpl, arg1, arg2, arg3, arg4) \
+  { \
+    int form_size; \
+    char *buf; \
+    UIM_PREPARE_SAVING_TEXTDOMAIN_CODESET(); \
+    UIM_SWITCH_TEXTDOMAIN_CODESET(uc); \
+    form_size = uim_sizeof_sexp_str(sexp_tmpl, arg1, arg2, arg3, arg4); \
+    if (form_size != -1) { \
+      buf = malloc(form_size); \
+      snprintf(buf, form_size, sexp_tmpl, arg1, arg2, arg3, arg4); \
+      UIM_EVAL_STRING_INTERNAL(uc, buf); \
+      free(buf); \
+    } \
+    UIM_RESTORE_TEXTDOMAIN_CODESET(); \
+  }
+
+#define UIM_EVAL_FSTRING5(uc, sexp_tmpl, arg1, arg2, arg3, arg4, arg5) \
+  { \
+    int form_size; \
+    char *buf; \
+    UIM_PREPARE_SAVING_TEXTDOMAIN_CODESET(); \
+    UIM_SWITCH_TEXTDOMAIN_CODESET(uc); \
+    form_size = uim_sizeof_sexp_str(sexp_tmpl, arg1, arg2, arg3, arg4, arg5); \
+    if (form_size != -1) { \
+      buf = malloc(form_size); \
+      snprintf(buf, form_size, sexp_tmpl, arg1, arg2, arg3, arg4, arg5); \
+      UIM_EVAL_STRING_INTERNAL(uc, buf); \
+      free(buf); \
+    } \
+    UIM_RESTORE_TEXTDOMAIN_CODESET(); \
+  }
+
+/**/
+uim_context
+uim_find_context(int id);
+void uim_scm_init(const char *verbose_level);
+void uim_scm_quit(void);
+
+#ifdef UIM_COMPAT_SCM
+void uim_init_compat_scm_subrs(void);
+#endif
+void uim_init_key_subrs(void);
+void uim_init_util_subrs(void);
+#ifdef UIM_COMPAT_TABLE
+void uim_init_table_subrs(void);
+#endif
+void uim_init_im_subrs(void);
+void uim_init_intl_subrs(void);
+
+/**/
+void uim_init_plugin(void);
+void uim_quit_plugin(void);
+
+int uim_iconv_is_convertible(const char *tocode, const char *fromcode);
+void *uim_iconv_create(const char *tocode, const char *fromcode);
+char *uim_iconv_code_conv(void *obj, const char *str);
+void uim_iconv_release(void *obj);
+
+int uim_sizeof_sexp_str(const char *tmpl, ...);
+void uim_eval_string(uim_context, char *str);
+void uim_release_preedit_segments(uim_context uc);
+void uim_update_preedit_segments(uim_context uc);
+
+extern struct uim_im *uim_im_array;
+extern int uim_nr_im;
+extern char *uim_last_client_encoding;
+
+#ifdef __cplusplus
+}
+#endif
+#endif

Modified: branches/r5rs/xim/canddisp.cpp
===================================================================
--- branches/r5rs/xim/canddisp.cpp	2005-09-21 12:32:54 UTC (rev 1535)
+++ branches/r5rs/xim/canddisp.cpp	2005-09-21 18:53:48 UTC (rev 1536)
@@ -34,6 +34,9 @@
 # include "config.h"
 #endif
 
+#ifndef _GNU_SOURCE
+#define _GNU_SOURCE
+#endif
 #include <stdlib.h>
 #include <stdio.h>
 #include <sys/types.h>
@@ -56,6 +59,8 @@
   #define DEFAULT_CANDWIN_PROG	(UIM_LIBEXECDIR "/uim-candwin-qt")
 #elif defined(USE_GTK_CANDWIN) && defined(USE_GTK2)
   #define DEFAULT_CANDWIN_PROG	(UIM_LIBEXECDIR "/uim-candwin-gtk")
+#else
+  #define DEFAULT_CANDWIN_PROG	NULL
 #endif
 
 static FILE *candwin_r, *candwin_w;

Modified: branches/r5rs/xim/util.h
===================================================================
--- branches/r5rs/xim/util.h	2005-09-21 12:32:54 UTC (rev 1535)
+++ branches/r5rs/xim/util.h	2005-09-21 18:53:48 UTC (rev 1536)
@@ -55,14 +55,4 @@
 int vasprintf(char **ptr, const char *fmt, va_list ap);
 #endif
 
-#ifndef HAVE_STRSEP
-#ifdef __cplusplus
-extern "C" {
 #endif
-char *uim_strsep(char **stringp, const char *delim);
-#define strsep	uim_strsep
-#ifdef __cplusplus
-}
-#endif
-#endif
-#endif



More information about the uim-commit mailing list