[Uim] reliability fix: uim-fep.c
Iwata
iwata at quasiquote.org
Sun Apr 8 17:49:57 EEST 2007
"Etsushi Kato" <ek.kato at gmail.com> writes:
> On 4/4/07, Etsushi Kato <ek.kato at gmail.com> wrote:
> Now committed in the trunk. Thanks Iwata-san.
Thank you.
I wrote a new patch for look.scm, fix typo (not me!),
fixed backspace behavior, and LLONG_MAX checking in configure.ac.
BTW, Configure macro of EB has been provided by EB library project (eb4.m4).
I suggest that you should import it.
Cheers,
Index: configure.ac
===================================================================
--- configure.ac (revision 4537)
+++ configure.ac (working copy)
@@ -283,7 +283,108 @@
[ #include <signal.h> ])
AC_CHECK_TYPES(sig_t, , ,
[ #include <signal.h> ])
+# Check for long long datatypes
+AC_CHECK_TYPES([long long, unsigned long long, long double])
+AC_CHECK_SIZEOF(long long int, 8)
+# compute LLONG_MIN and LLONG_MAX if we don't know them.
+if test -z "$have_llong_max"; then
+ AC_MSG_CHECKING([for max value of long long])
+ AC_RUN_IFELSE(
+ [AC_LANG_SOURCE([[
+#include <stdio.h>
+/* Why is this so damn hard? */
+#ifdef __GNUC__
+# undef __GNUC__
+#endif
+#define __USE_ISOC99
+#include <limits.h>
+#define DATA "conftest.llminmax"
+#define my_abs(a) ((a) < 0 ? ((a) * -1) : (a))
+
+/*
+ * printf in libc on some platforms (eg old Tru64) does not understand %lld so
+ * we do this the hard way.
+ */
+static int
+fprint_ll(FILE *f, long long n)
+{
+ unsigned int i;
+ int l[sizeof(long long) * 8];
+
+ if (n < 0)
+ if (fprintf(f, "-") < 0)
+ return -1;
+ for (i = 0; n != 0; i++) {
+ l[i] = my_abs(n % 10);
+ n /= 10;
+ }
+ do {
+ if (fprintf(f, "%d", l[--i]) < 0)
+ return -1;
+ } while (i != 0);
+ if (fprintf(f, " ") < 0)
+ return -1;
+ return 0;
+}
+
+int main(void) {
+ FILE *f;
+ long long i, llmin, llmax = 0;
+
+ if((f = fopen(DATA,"w")) == NULL)
+ exit(1);
+
+#if defined(LLONG_MIN) && defined(LLONG_MAX)
+ fprintf(stderr, "Using system header for LLONG_MIN and LLONG_MAX\n");
+ llmin = LLONG_MIN;
+ llmax = LLONG_MAX;
+#else
+ fprintf(stderr, "Calculating LLONG_MIN and LLONG_MAX\n");
+ /* This will work on one's complement and two's complement */
+ for (i = 1; i > llmax; i <<= 1, i++)
+ llmax = i;
+ llmin = llmax + 1LL; /* wrap */
+#endif
+
+ /* Sanity check */
+ if (llmin + 1 < llmin || llmin - 1 < llmin || llmax + 1 > llmax
+ || llmax - 1 > llmax || llmin == llmax || llmin == 0
+ || llmax == 0 || llmax < LONG_MAX || llmin > LONG_MIN) {
+ fprintf(f, "unknown unknown\n");
+ exit(2);
+ }
+
+ if (fprint_ll(f, llmin) < 0)
+ exit(3);
+ if (fprint_ll(f, llmax) < 0)
+ exit(4);
+ if (fclose(f) < 0)
+ exit(5);
+ exit(0);
+}
+ ]])],
+ [
+ llong_min=`$AWK '{print $1}' conftest.llminmax`
+ llong_max=`$AWK '{print $2}' conftest.llminmax`
+
+ AC_MSG_RESULT($llong_max)
+ AC_DEFINE_UNQUOTED(LLONG_MAX, [${llong_max}LL],
+ [max value of long long calculated by configure])
+ AC_MSG_CHECKING([for min value of long long])
+ AC_MSG_RESULT($llong_min)
+ AC_DEFINE_UNQUOTED(LLONG_MIN, [${llong_min}LL],
+ [min value of long long calculated by configure])
+ ],
+ [
+ AC_MSG_RESULT(not found)
+ ],
+ [
+ AC_MSG_WARN([cross compiling: not checking])
+ ]
+ )
+fi
+
# Checks for structures
# Checks for compiler characteristics
@@ -369,6 +470,33 @@
AC_DEFINE(HAVE_CONST_GAI_STRERROR_PROTO, 1,
[Define if gai_strerror() returns const char *])])])
+AC_CHECK_DECL(LLONG_MAX, have_llong_max=1, , [#include <limits.h>])
+
+if test "$GCC" = "yes" || test "$GCC" = "egcs"; then
+ CFLAGS="$CFLAGS -Wall -Wpointer-arith -Wuninitialized"
+ GCC_VER=`$CC -v 2>&1 | $AWK '/gcc version /{print $3}'`
+ case $GCC_VER in
+ 1.*) ;;
+ 2.8* | 2.9*) CFLAGS="$CFLAGS -Wsign-compare" ;;
+ 2.*) ;;
+ 3.*) CFLAGS="$CFLAGS -Wsign-compare" ;;
+ 4.*) CFLAGS="$CFLAGS -Wsign-compare -Wno-pointer-sign" ;;
+ *) ;;
+ esac
+
+ if test -z "$have_llong_max"; then
+ # retry LLONG_MAX with -std=gnu99, needed on some Linuxes
+ unset ac_cv_have_decl_LLONG_MAX
+ saved_CFLAGS="$CFLAGS"
+ CFLAGS="$CFLAGS -std=gnu99"
+ AC_CHECK_DECL(LLONG_MAX,
+ [have_llong_max=1],
+ [CFLAGS="$saved_CFLAGS"],
+ [#include <limits.h>]
+ )
+ fi
+fi
+
# Check for broken snprintf
if test "x$ac_cv_func_snprintf" = "xyes" ; then
AC_MSG_CHECKING([whether snprintf correctly terminates long strings])
Index: scm/look.scm
===================================================================
--- scm/look.scm (revision 4537)
+++ scm/look.scm (working copy)
@@ -289,7 +289,7 @@
(look-context-dict lc)))))))
(if (< (length (look-context-prev lc)) look-prepered-words)
(look-context-set-prev! lc (append (look-context-prev lc)
- (list (strintg->symbol (look-context-left lc)))))
+ (list (string->symbol (look-context-left lc)))))
(if (= 0 look-prepered-words)
#t
(look-context-set-prev! lc (append (cdr (look-context-prev lc))
@@ -469,9 +469,13 @@
(look-append-char-from-candidate-to-left! lc)
(look-update lc)
(look-update-preedit lc))
- ((and (look-prev-char-key? key state)
- (< 0 (look-get-length-left lc)))
- (look-remove-last-char-from-left! lc)
+ ((look-prev-char-key? key state)
+ (cond ((<= (look-get-length-left lc) 0)
+ (look-context-flush lc)
+ ;; or (look-context-clean lc)
+ (im-commit-raw lc))
+ (else
+ (look-remove-last-char-from-left! lc)))
(look-update lc)
(look-update-preedit lc))
((look-next-candidate-key? key state)
More information about the uim
mailing list