diff -u --recursive --new-file emacs-20.3/configure emacs-20.3+canna/configure --- emacs-20.3/configure Mon Jul 27 17:17:07 1998 +++ emacs-20.3+canna/configure Sat Aug 22 02:00:09 1998 @@ -12,6 +12,12 @@ ac_default_prefix=/usr/local # Any additions from configure.in: ac_help="$ac_help + --with-canna support CANNA" +ac_help="$ac_help + --with-canna-includes=DIR Search for CANNA header files in DIR" +ac_help="$ac_help + --with-canna-libraries=DIR Search for CANNA libraries in DIR" +ac_help="$ac_help --with-gcc use GCC to compile Emacs" ac_help="$ac_help --with-pop support POP for mail retrieval" @@ -544,6 +550,28 @@ archlibdir='${libexecdir}/emacs/${version}/${configuration}' docdir='${datadir}/emacs/${version}/etc' +# Check whether --with-canna or --without-canna was given. +if test "${with_canna+set}" = set; then + withval="$with_canna" + cat >> confdefs.h <<\EOF +#define CANNA 1 +EOF + +fi + +# Check whether --with-canna-includes or --without-canna-includes was given. +if test "${with_canna_includes+set}" = set; then + withval="$with_canna_includes" + : +fi + +# Check whether --with-canna-libraries or --without-canna-libraries was given. +if test "${with_canna_libraries+set}" = set; then + withval="$with_canna_libraries" + : +fi + + # Check whether --with-gcc or --without-gcc was given. if test "${with_gcc+set}" = set; then withval="$with_gcc" @@ -696,7 +724,7 @@ fi echo $ac_n "checking host system type""... $ac_c" 1>&6 -echo "configure:700: checking host system type" >&5 +echo "configure:728: checking host system type" >&5 host_alias=$host case "$host_alias" in @@ -1613,7 +1641,7 @@ * ) # Extract the first word of "gcc", so it can be a program name with args. set dummy gcc; ac_word=$2 echo $ac_n "checking for $ac_word""... $ac_c" 1>&6 -echo "configure:1617: checking for $ac_word" >&5 +echo "configure:1645: checking for $ac_word" >&5 if eval "test \"`echo '$''{'ac_cv_prog_CC'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else @@ -1642,7 +1670,7 @@ # Extract the first word of "cc", so it can be a program name with args. set dummy cc; ac_word=$2 echo $ac_n "checking for $ac_word""... $ac_c" 1>&6 -echo "configure:1646: checking for $ac_word" >&5 +echo "configure:1674: checking for $ac_word" >&5 if eval "test \"`echo '$''{'ac_cv_prog_CC'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else @@ -1690,7 +1718,7 @@ fi echo $ac_n "checking whether the C compiler ($CC $CFLAGS $LDFLAGS) works""... $ac_c" 1>&6 -echo "configure:1694: checking whether the C compiler ($CC $CFLAGS $LDFLAGS) works" >&5 +echo "configure:1722: checking whether the C compiler ($CC $CFLAGS $LDFLAGS) works" >&5 ac_ext=c # CFLAGS is not in ac_cpp because -g, -O, etc. are not valid cpp options. @@ -1700,11 +1728,11 @@ cross_compiling=$ac_cv_prog_cc_cross cat > conftest.$ac_ext <&5; (eval $ac_link) 2>&5; } && test -s conftest; then +if { (eval echo configure:1736: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest; then ac_cv_prog_cc_works=yes # If we can't run a trivial program, we are probably using a cross compiler. if (./conftest; exit) 2>/dev/null; then @@ -1724,12 +1752,12 @@ { echo "configure: error: installation or configuration problem: C compiler cannot create executables." 1>&2; exit 1; } fi echo $ac_n "checking whether the C compiler ($CC $CFLAGS $LDFLAGS) is a cross-compiler""... $ac_c" 1>&6 -echo "configure:1728: checking whether the C compiler ($CC $CFLAGS $LDFLAGS) is a cross-compiler" >&5 +echo "configure:1756: checking whether the C compiler ($CC $CFLAGS $LDFLAGS) is a cross-compiler" >&5 echo "$ac_t""$ac_cv_prog_cc_cross" 1>&6 cross_compiling=$ac_cv_prog_cc_cross echo $ac_n "checking whether we are using GNU C""... $ac_c" 1>&6 -echo "configure:1733: checking whether we are using GNU C" >&5 +echo "configure:1761: checking whether we are using GNU C" >&5 if eval "test \"`echo '$''{'ac_cv_prog_gcc'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else @@ -1738,7 +1766,7 @@ yes; #endif EOF -if { ac_try='${CC-cc} -E conftest.c'; { (eval echo configure:1742: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }; } | egrep yes >/dev/null 2>&1; then +if { ac_try='${CC-cc} -E conftest.c'; { (eval echo configure:1770: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }; } | egrep yes >/dev/null 2>&1; then ac_cv_prog_gcc=yes else ac_cv_prog_gcc=no @@ -1753,7 +1781,7 @@ ac_save_CFLAGS="$CFLAGS" CFLAGS= echo $ac_n "checking whether ${CC-cc} accepts -g""... $ac_c" 1>&6 -echo "configure:1757: checking whether ${CC-cc} accepts -g" >&5 +echo "configure:1785: checking whether ${CC-cc} accepts -g" >&5 if eval "test \"`echo '$''{'ac_cv_prog_cc_g'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else @@ -1829,7 +1857,7 @@ #### #undef clause to src/config.h.in for autoconf to modify. echo $ac_n "checking whether ln -s works""... $ac_c" 1>&6 -echo "configure:1833: checking whether ln -s works" >&5 +echo "configure:1861: checking whether ln -s works" >&5 if eval "test \"`echo '$''{'ac_cv_prog_LN_S'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else @@ -1850,7 +1878,7 @@ fi echo $ac_n "checking how to run the C preprocessor""... $ac_c" 1>&6 -echo "configure:1854: checking how to run the C preprocessor" >&5 +echo "configure:1882: checking how to run the C preprocessor" >&5 # On Suns, sometimes $CPP names a directory. if test -n "$CPP" && test -d "$CPP"; then CPP= @@ -1865,13 +1893,13 @@ # On the NeXT, cc -E runs the code through the compiler's parser, # not just through cpp. cat > conftest.$ac_ext < Syntax Error EOF ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out" -{ (eval echo configure:1875: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; } +{ (eval echo configure:1903: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; } ac_err=`grep -v '^ *+' conftest.out` if test -z "$ac_err"; then : @@ -1882,13 +1910,13 @@ rm -rf conftest* CPP="${CC-cc} -E -traditional-cpp" cat > conftest.$ac_ext < Syntax Error EOF ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out" -{ (eval echo configure:1892: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; } +{ (eval echo configure:1920: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; } ac_err=`grep -v '^ *+' conftest.out` if test -z "$ac_err"; then : @@ -1921,7 +1949,7 @@ # SVR4 /usr/ucb/install, which tries to use the nonexistent group "staff" # ./install, which can be erroneously created by make from ./install.sh. echo $ac_n "checking for a BSD compatible install""... $ac_c" 1>&6 -echo "configure:1925: checking for a BSD compatible install" >&5 +echo "configure:1953: checking for a BSD compatible install" >&5 if test -z "$INSTALL"; then if eval "test \"`echo '$''{'ac_cv_path_install'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 @@ -1975,7 +2003,7 @@ # Extract the first word of "$ac_prog", so it can be a program name with args. set dummy $ac_prog; ac_word=$2 echo $ac_n "checking for $ac_word""... $ac_c" 1>&6 -echo "configure:1979: checking for $ac_word" >&5 +echo "configure:2007: checking for $ac_word" >&5 if eval "test \"`echo '$''{'ac_cv_prog_YACC'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else @@ -2006,9 +2034,9 @@ echo $ac_n "checking for AIX""... $ac_c" 1>&6 -echo "configure:2010: checking for AIX" >&5 +echo "configure:2038: checking for AIX" >&5 cat > conftest.$ac_ext <&6 -echo "configure:2038: checking for $ac_hdr" >&5 +echo "configure:2066: checking for $ac_hdr" >&5 if eval "test \"`echo '$''{'ac_cv_header_$ac_safe'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext < EOF ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out" -{ (eval echo configure:2048: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; } +{ (eval echo configure:2076: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; } ac_err=`grep -v '^ *+' conftest.out` if test -z "$ac_err"; then rm -rf conftest* @@ -2071,12 +2099,12 @@ done echo $ac_n "checking for ANSI C header files""... $ac_c" 1>&6 -echo "configure:2075: checking for ANSI C header files" >&5 +echo "configure:2103: checking for ANSI C header files" >&5 if eval "test \"`echo '$''{'ac_cv_header_stdc'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext < #include @@ -2084,7 +2112,7 @@ #include EOF ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out" -{ (eval echo configure:2088: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; } +{ (eval echo configure:2116: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; } ac_err=`grep -v '^ *+' conftest.out` if test -z "$ac_err"; then rm -rf conftest* @@ -2101,7 +2129,7 @@ if test $ac_cv_header_stdc = yes; then # SunOS 4.x string.h does not declare mem*, contrary to ANSI. cat > conftest.$ac_ext < EOF @@ -2119,7 +2147,7 @@ if test $ac_cv_header_stdc = yes; then # ISC 2.0.2 stdlib.h does not declare free, contrary to ANSI. cat > conftest.$ac_ext < EOF @@ -2140,7 +2168,7 @@ : else cat > conftest.$ac_ext < #define ISLOWER(c) ('a' <= (c) && (c) <= 'z') @@ -2151,7 +2179,7 @@ exit (0); } EOF -if { (eval echo configure:2155: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest && (./conftest; exit) 2>/dev/null +if { (eval echo configure:2183: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest && (./conftest; exit) 2>/dev/null then : else @@ -2175,12 +2203,12 @@ fi echo $ac_n "checking whether time.h and sys/time.h may both be included""... $ac_c" 1>&6 -echo "configure:2179: checking whether time.h and sys/time.h may both be included" >&5 +echo "configure:2207: checking whether time.h and sys/time.h may both be included" >&5 if eval "test \"`echo '$''{'ac_cv_header_time'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext < #include @@ -2189,7 +2217,7 @@ struct tm *tp; ; return 0; } EOF -if { (eval echo configure:2193: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then +if { (eval echo configure:2221: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then rm -rf conftest* ac_cv_header_time=yes else @@ -2210,12 +2238,12 @@ fi echo $ac_n "checking for sys_siglist declaration in signal.h or unistd.h""... $ac_c" 1>&6 -echo "configure:2214: checking for sys_siglist declaration in signal.h or unistd.h" >&5 +echo "configure:2242: checking for sys_siglist declaration in signal.h or unistd.h" >&5 if eval "test \"`echo '$''{'ac_cv_decl_sys_siglist'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext < #include @@ -2227,7 +2255,7 @@ char *msg = *(sys_siglist + 1); ; return 0; } EOF -if { (eval echo configure:2231: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then +if { (eval echo configure:2259: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then rm -rf conftest* ac_cv_decl_sys_siglist=yes else @@ -2249,12 +2277,12 @@ echo $ac_n "checking for struct utimbuf""... $ac_c" 1>&6 -echo "configure:2253: checking for struct utimbuf" >&5 +echo "configure:2281: checking for struct utimbuf" >&5 if eval "test \"`echo '$''{'emacs_cv_struct_utimbuf'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext < @@ -2273,7 +2301,7 @@ static struct utimbuf x; x.actime = x.modtime; ; return 0; } EOF -if { (eval echo configure:2277: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then +if { (eval echo configure:2305: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then rm -rf conftest* emacs_cv_struct_utimbuf=yes else @@ -2294,12 +2322,12 @@ fi echo $ac_n "checking return type of signal handlers""... $ac_c" 1>&6 -echo "configure:2298: checking return type of signal handlers" >&5 +echo "configure:2326: checking return type of signal handlers" >&5 if eval "test \"`echo '$''{'ac_cv_type_signal'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext < #include @@ -2316,7 +2344,7 @@ int i; ; return 0; } EOF -if { (eval echo configure:2320: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then +if { (eval echo configure:2348: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then rm -rf conftest* ac_cv_type_signal=void else @@ -2336,12 +2364,12 @@ echo $ac_n "checking for struct timeval""... $ac_c" 1>&6 -echo "configure:2340: checking for struct timeval" >&5 +echo "configure:2368: checking for struct timeval" >&5 if eval "test \"`echo '$''{'emacs_cv_struct_timeval'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext < @@ -2357,7 +2385,7 @@ static struct timeval x; x.tv_sec = x.tv_usec; ; return 0; } EOF -if { (eval echo configure:2361: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then +if { (eval echo configure:2389: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then rm -rf conftest* emacs_cv_struct_timeval=yes else @@ -2379,12 +2407,12 @@ fi echo $ac_n "checking whether struct tm is in sys/time.h or time.h""... $ac_c" 1>&6 -echo "configure:2383: checking whether struct tm is in sys/time.h or time.h" >&5 +echo "configure:2411: checking whether struct tm is in sys/time.h or time.h" >&5 if eval "test \"`echo '$''{'ac_cv_struct_tm'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext < #include @@ -2392,7 +2420,7 @@ struct tm *tp; tp->tm_sec; ; return 0; } EOF -if { (eval echo configure:2396: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then +if { (eval echo configure:2424: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then rm -rf conftest* ac_cv_struct_tm=time.h else @@ -2413,12 +2441,12 @@ fi echo $ac_n "checking for tm_zone in struct tm""... $ac_c" 1>&6 -echo "configure:2417: checking for tm_zone in struct tm" >&5 +echo "configure:2445: checking for tm_zone in struct tm" >&5 if eval "test \"`echo '$''{'ac_cv_struct_tm_zone'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext < #include <$ac_cv_struct_tm> @@ -2426,7 +2454,7 @@ struct tm tm; tm.tm_zone; ; return 0; } EOF -if { (eval echo configure:2430: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then +if { (eval echo configure:2458: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then rm -rf conftest* ac_cv_struct_tm_zone=yes else @@ -2446,12 +2474,12 @@ else echo $ac_n "checking for tzname""... $ac_c" 1>&6 -echo "configure:2450: checking for tzname" >&5 +echo "configure:2478: checking for tzname" >&5 if eval "test \"`echo '$''{'ac_cv_var_tzname'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext < #ifndef tzname /* For SGI. */ @@ -2461,7 +2489,7 @@ atoi(*tzname); ; return 0; } EOF -if { (eval echo configure:2465: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest; then +if { (eval echo configure:2493: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest; then rm -rf conftest* ac_cv_var_tzname=yes else @@ -2484,12 +2512,12 @@ echo $ac_n "checking for working const""... $ac_c" 1>&6 -echo "configure:2488: checking for working const" >&5 +echo "configure:2516: checking for working const" >&5 if eval "test \"`echo '$''{'ac_cv_c_const'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext <&5; (eval $ac_compile) 2>&5; }; then +if { (eval echo configure:2570: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then rm -rf conftest* ac_cv_c_const=yes else @@ -2560,7 +2588,7 @@ echo $ac_n "checking whether ${MAKE-make} sets \${MAKE}""... $ac_c" 1>&6 -echo "configure:2564: checking whether ${MAKE-make} sets \${MAKE}" >&5 +echo "configure:2592: checking whether ${MAKE-make} sets \${MAKE}" >&5 set dummy ${MAKE-make}; ac_make=`echo "$2" | sed 'y%./+-%__p_%'` if eval "test \"`echo '$''{'ac_cv_prog_make_${ac_make}_set'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 @@ -2588,7 +2616,7 @@ echo $ac_n "checking for long file names""... $ac_c" 1>&6 -echo "configure:2592: checking for long file names" >&5 +echo "configure:2620: checking for long file names" >&5 if eval "test \"`echo '$''{'ac_cv_sys_long_file_names'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else @@ -2639,7 +2667,7 @@ # Uses ac_ vars as temps to allow command line to override cache and checks. # --without-x overrides everything else, but does not touch the cache. echo $ac_n "checking for X""... $ac_c" 1>&6 -echo "configure:2643: checking for X" >&5 +echo "configure:2671: checking for X" >&5 # Check whether --with-x or --without-x was given. if test "${with_x+set}" = set; then @@ -2701,12 +2729,12 @@ # First, try using that file with no special directory specified. cat > conftest.$ac_ext < EOF ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out" -{ (eval echo configure:2710: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; } +{ (eval echo configure:2738: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; } ac_err=`grep -v '^ *+' conftest.out` if test -z "$ac_err"; then rm -rf conftest* @@ -2775,14 +2803,14 @@ ac_save_LIBS="$LIBS" LIBS="-l$x_direct_test_library $LIBS" cat > conftest.$ac_ext <&5; (eval $ac_link) 2>&5; } && test -s conftest; then +if { (eval echo configure:2814: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest; then rm -rf conftest* LIBS="$ac_save_LIBS" # We can link X programs with no special library path. @@ -2956,7 +2984,7 @@ echo "checking the machine- and system-dependent files to find out - which libraries the lib-src programs will want, and - whether the GNU malloc routines are usable" 1>&6 -echo "configure:2960: checking the machine- and system-dependent files to find out +echo "configure:2988: checking the machine- and system-dependent files to find out - which libraries the lib-src programs will want, and - whether the GNU malloc routines are usable" >&5 @@ -3086,12 +3114,12 @@ GNU_MALLOC=yes doug_lea_malloc=yes echo $ac_n "checking for malloc_get_state""... $ac_c" 1>&6 -echo "configure:3090: checking for malloc_get_state" >&5 +echo "configure:3118: checking for malloc_get_state" >&5 if eval "test \"`echo '$''{'ac_cv_func_malloc_get_state'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext <&5; (eval $ac_link) 2>&5; } && test -s conftest; then +if { (eval echo configure:3146: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest; then rm -rf conftest* eval "ac_cv_func_malloc_get_state=yes" else @@ -3135,12 +3163,12 @@ fi echo $ac_n "checking for malloc_set_state""... $ac_c" 1>&6 -echo "configure:3139: checking for malloc_set_state" >&5 +echo "configure:3167: checking for malloc_set_state" >&5 if eval "test \"`echo '$''{'ac_cv_func_malloc_set_state'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext <&5; (eval $ac_link) 2>&5; } && test -s conftest; then +if { (eval echo configure:3195: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest; then rm -rf conftest* eval "ac_cv_func_malloc_set_state=yes" else @@ -3184,19 +3212,19 @@ fi echo $ac_n "checking whether __after_morecore_hook exists""... $ac_c" 1>&6 -echo "configure:3188: checking whether __after_morecore_hook exists" >&5 +echo "configure:3216: checking whether __after_morecore_hook exists" >&5 if eval "test \"`echo '$''{'emacs_cv_var___after_morecore_hook'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext <&5; (eval $ac_link) 2>&5; } && test -s conftest; then +if { (eval echo configure:3228: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest; then rm -rf conftest* emacs_cv_var___after_morecore_hook=yes else @@ -3234,6 +3262,20 @@ LISP_FLOAT_TYPE=yes +if test -n "${with_canna}" ; then + test -n "${with_canna_includes}" && C_SWITCH_CANNA="-I${with_canna_includes}" + if test -n "${with_canna_libraries}" ; then + if test -d ${with_canna_libraries} ; then + LD_SWITCH_CANNA="-L${with_canna_libraries}" + LD_SWITCH_CANNA_AUX="-R${with_canna_libraries}" + LIBS_MULE="${LIBS_MULE} -lcanna" + else + LIBS_MULE="${LIBS_MULE} ${with_canna_libraries}" + fi + else + LIBS_MULE="${LIBS_MULE} -lcanna" + fi +fi #### Add the libraries to LIBS and check for some functions. @@ -3246,7 +3288,7 @@ LIBS="$libsrc_libs $LIBS" echo $ac_n "checking for dnet_ntoa in -ldnet""... $ac_c" 1>&6 -echo "configure:3250: checking for dnet_ntoa in -ldnet" >&5 +echo "configure:3292: checking for dnet_ntoa in -ldnet" >&5 ac_lib_var=`echo dnet'_'dnet_ntoa | sed 'y%./+-%__p_%'` if eval "test \"`echo '$''{'ac_cv_lib_$ac_lib_var'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 @@ -3254,7 +3296,7 @@ ac_save_LIBS="$LIBS" LIBS="-ldnet $LIBS" cat > conftest.$ac_ext <&5; (eval $ac_link) 2>&5; } && test -s conftest; then +if { (eval echo configure:3311: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest; then rm -rf conftest* eval "ac_cv_lib_$ac_lib_var=yes" else @@ -3294,7 +3336,7 @@ echo $ac_n "checking for main in -lXbsd""... $ac_c" 1>&6 -echo "configure:3298: checking for main in -lXbsd" >&5 +echo "configure:3340: checking for main in -lXbsd" >&5 ac_lib_var=`echo Xbsd'_'main | sed 'y%./+-%__p_%'` if eval "test \"`echo '$''{'ac_cv_lib_$ac_lib_var'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 @@ -3302,14 +3344,14 @@ ac_save_LIBS="$LIBS" LIBS="-lXbsd $LIBS" cat > conftest.$ac_ext <&5; (eval $ac_link) 2>&5; } && test -s conftest; then +if { (eval echo configure:3355: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest; then rm -rf conftest* eval "ac_cv_lib_$ac_lib_var=yes" else @@ -3331,7 +3373,7 @@ echo $ac_n "checking for cma_open in -lpthreads""... $ac_c" 1>&6 -echo "configure:3335: checking for cma_open in -lpthreads" >&5 +echo "configure:3377: checking for cma_open in -lpthreads" >&5 ac_lib_var=`echo pthreads'_'cma_open | sed 'y%./+-%__p_%'` if eval "test \"`echo '$''{'ac_cv_lib_$ac_lib_var'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 @@ -3339,7 +3381,7 @@ ac_save_LIBS="$LIBS" LIBS="-lpthreads $LIBS" cat > conftest.$ac_ext <&5; (eval $ac_link) 2>&5; } && test -s conftest; then +if { (eval echo configure:3396: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest; then rm -rf conftest* eval "ac_cv_lib_$ac_lib_var=yes" else @@ -3379,7 +3421,7 @@ echo $ac_n "checking for XFree86""... $ac_c" 1>&6 -echo "configure:3383: checking for XFree86" >&5 +echo "configure:3425: checking for XFree86" >&5 if test -d /usr/X386/include; then HAVE_XFREE386=yes : ${C_SWITCH_X_SITE="-I/usr/X386/include"} @@ -3408,16 +3450,16 @@ if test "${opsys}" = "gnu-linux"; then echo $ac_n "checking whether X on GNU/Linux needs -b to link""... $ac_c" 1>&6 -echo "configure:3412: checking whether X on GNU/Linux needs -b to link" >&5 +echo "configure:3454: checking whether X on GNU/Linux needs -b to link" >&5 cat > conftest.$ac_ext <&5; (eval $ac_link) 2>&5; } && test -s conftest; then +if { (eval echo configure:3463: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest; then rm -rf conftest* xlinux_first_failure=no else @@ -3437,14 +3479,14 @@ CPPFLAGS="$CPPFLAGS -b i486-linuxaout" LIBS="$LIBS -b i486-linuxaout" cat > conftest.$ac_ext <&5; (eval $ac_link) 2>&5; } && test -s conftest; then +if { (eval echo configure:3490: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest; then rm -rf conftest* xlinux_second_failure=no else @@ -3474,12 +3516,12 @@ XScreenNumberOfScreen XSetWMProtocols do echo $ac_n "checking for $ac_func""... $ac_c" 1>&6 -echo "configure:3478: checking for $ac_func" >&5 +echo "configure:3520: checking for $ac_func" >&5 if eval "test \"`echo '$''{'ac_cv_func_$ac_func'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext <&5; (eval $ac_link) 2>&5; } && test -s conftest; then +if { (eval echo configure:3548: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest; then rm -rf conftest* eval "ac_cv_func_$ac_func=yes" else @@ -3530,12 +3572,12 @@ if test "${window_system}" = "x11"; then echo $ac_n "checking X11 version 6""... $ac_c" 1>&6 -echo "configure:3534: checking X11 version 6" >&5 +echo "configure:3576: checking X11 version 6" >&5 if eval "test \"`echo '$''{'emacs_cv_x11_version_6'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext < int main() { @@ -3545,7 +3587,7 @@ ; return 0; } EOF -if { (eval echo configure:3549: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest; then +if { (eval echo configure:3591: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest; then rm -rf conftest* emacs_cv_x11_version_6=yes else @@ -3570,12 +3612,12 @@ if test "${window_system}" = "x11"; then echo $ac_n "checking X11 version 5""... $ac_c" 1>&6 -echo "configure:3574: checking X11 version 5" >&5 +echo "configure:3616: checking X11 version 5" >&5 if eval "test \"`echo '$''{'emacs_cv_x11_version_5'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext < int main() { @@ -3585,7 +3627,7 @@ ; return 0; } EOF -if { (eval echo configure:3589: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest; then +if { (eval echo configure:3631: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest; then rm -rf conftest* emacs_cv_x11_version_5=yes else @@ -3613,12 +3655,12 @@ if test x"${USE_X_TOOLKIT}" = xmaybe; then if test x"${HAVE_X11R5}" = xyes; then echo $ac_n "checking X11 version 5 with Xaw""... $ac_c" 1>&6 -echo "configure:3617: checking X11 version 5 with Xaw" >&5 +echo "configure:3659: checking X11 version 5 with Xaw" >&5 if eval "test \"`echo '$''{'emacs_cv_x11_version_5_with_xaw'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext < @@ -3627,7 +3669,7 @@ ; return 0; } EOF -if { (eval echo configure:3631: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest; then +if { (eval echo configure:3673: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest; then rm -rf conftest* emacs_cv_x11_version_5_with_xaw=yes else @@ -3655,12 +3697,12 @@ if test "${USE_X_TOOLKIT}" != "none"; then echo $ac_n "checking X11 toolkit version""... $ac_c" 1>&6 -echo "configure:3659: checking X11 toolkit version" >&5 +echo "configure:3701: checking X11 toolkit version" >&5 if eval "test \"`echo '$''{'emacs_cv_x11_toolkit_version_6'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext < int main() { @@ -3670,7 +3712,7 @@ ; return 0; } EOF -if { (eval echo configure:3674: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest; then +if { (eval echo configure:3716: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest; then rm -rf conftest* emacs_cv_x11_toolkit_version_6=yes else @@ -3700,7 +3742,7 @@ LIBS="-lXt $LIBS" fi echo $ac_n "checking for XmuConvertStandardSelection in -lXmu""... $ac_c" 1>&6 -echo "configure:3704: checking for XmuConvertStandardSelection in -lXmu" >&5 +echo "configure:3746: checking for XmuConvertStandardSelection in -lXmu" >&5 ac_lib_var=`echo Xmu'_'XmuConvertStandardSelection | sed 'y%./+-%__p_%'` if eval "test \"`echo '$''{'ac_cv_lib_$ac_lib_var'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 @@ -3708,7 +3750,7 @@ ac_save_LIBS="$LIBS" LIBS="-lXmu $LIBS" cat > conftest.$ac_ext <&5; (eval $ac_link) 2>&5; } && test -s conftest; then +if { (eval echo configure:3765: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest; then rm -rf conftest* eval "ac_cv_lib_$ac_lib_var=yes" else @@ -3751,12 +3793,12 @@ if test "${USE_X_TOOLKIT}" = "MOTIF"; then echo $ac_n "checking for Motif version 2.1""... $ac_c" 1>&6 -echo "configure:3755: checking for Motif version 2.1" >&5 +echo "configure:3797: checking for Motif version 2.1" >&5 if eval "test \"`echo '$''{'emacs_cv_motif_version_2_1'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext < int main() { @@ -3767,7 +3809,7 @@ #endif ; return 0; } EOF -if { (eval echo configure:3771: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then +if { (eval echo configure:3813: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then rm -rf conftest* emacs_cv_motif_version_2_1=yes else @@ -3791,19 +3833,19 @@ # If netdb.h doesn't declare h_errno, we must declare it by hand. echo $ac_n "checking whether netdb declares h_errno""... $ac_c" 1>&6 -echo "configure:3795: checking whether netdb declares h_errno" >&5 +echo "configure:3837: checking whether netdb declares h_errno" >&5 if eval "test \"`echo '$''{'emacs_cv_netdb_declares_h_errno'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext < int main() { return h_errno; ; return 0; } EOF -if { (eval echo configure:3807: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest; then +if { (eval echo configure:3849: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest; then rm -rf conftest* emacs_cv_netdb_declares_h_errno=yes else @@ -3826,19 +3868,19 @@ # The Ultrix 4.2 mips builtin alloca declared by alloca.h only works # for constant arguments. Useless! echo $ac_n "checking for working alloca.h""... $ac_c" 1>&6 -echo "configure:3830: checking for working alloca.h" >&5 +echo "configure:3872: checking for working alloca.h" >&5 if eval "test \"`echo '$''{'ac_cv_header_alloca_h'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext < int main() { char *p = alloca(2 * sizeof(int)); ; return 0; } EOF -if { (eval echo configure:3842: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest; then +if { (eval echo configure:3884: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest; then rm -rf conftest* ac_cv_header_alloca_h=yes else @@ -3859,12 +3901,12 @@ fi echo $ac_n "checking for alloca""... $ac_c" 1>&6 -echo "configure:3863: checking for alloca" >&5 +echo "configure:3905: checking for alloca" >&5 if eval "test \"`echo '$''{'ac_cv_func_alloca_works'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext <&5; (eval $ac_link) 2>&5; } && test -s conftest; then +if { (eval echo configure:3933: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest; then rm -rf conftest* ac_cv_func_alloca_works=yes else @@ -3919,12 +3961,12 @@ echo $ac_n "checking whether alloca needs Cray hooks""... $ac_c" 1>&6 -echo "configure:3923: checking whether alloca needs Cray hooks" >&5 +echo "configure:3965: checking whether alloca needs Cray hooks" >&5 if eval "test \"`echo '$''{'ac_cv_os_cray'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext <&6 -echo "configure:3953: checking for $ac_func" >&5 +echo "configure:3995: checking for $ac_func" >&5 if eval "test \"`echo '$''{'ac_cv_func_$ac_func'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext <&5; (eval $ac_link) 2>&5; } && test -s conftest; then +if { (eval echo configure:4023: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest; then rm -rf conftest* eval "ac_cv_func_$ac_func=yes" else @@ -4004,7 +4046,7 @@ fi echo $ac_n "checking stack direction for C alloca""... $ac_c" 1>&6 -echo "configure:4008: checking stack direction for C alloca" >&5 +echo "configure:4050: checking stack direction for C alloca" >&5 if eval "test \"`echo '$''{'ac_cv_c_stack_direction'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else @@ -4012,7 +4054,7 @@ ac_cv_c_stack_direction=0 else cat > conftest.$ac_ext <&5; (eval $ac_link) 2>&5; } && test -s conftest && (./conftest; exit) 2>/dev/null +if { (eval echo configure:4077: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest && (./conftest; exit) 2>/dev/null then ac_cv_c_stack_direction=1 else @@ -4056,7 +4098,7 @@ # fmod, logb, and frexp are found in -lm on most systems. # On HPUX 9.01, -lm does not contain logb, so check for sqrt. echo $ac_n "checking for sqrt in -lm""... $ac_c" 1>&6 -echo "configure:4060: checking for sqrt in -lm" >&5 +echo "configure:4102: checking for sqrt in -lm" >&5 ac_lib_var=`echo m'_'sqrt | sed 'y%./+-%__p_%'` if eval "test \"`echo '$''{'ac_cv_lib_$ac_lib_var'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 @@ -4064,7 +4106,7 @@ ac_save_LIBS="$LIBS" LIBS="-lm $LIBS" cat > conftest.$ac_ext <&5; (eval $ac_link) 2>&5; } && test -s conftest; then +if { (eval echo configure:4121: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest; then rm -rf conftest* eval "ac_cv_lib_$ac_lib_var=yes" else @@ -4105,7 +4147,7 @@ # Check for mail-locking functions in a "mail" library echo $ac_n "checking for maillock in -lmail""... $ac_c" 1>&6 -echo "configure:4109: checking for maillock in -lmail" >&5 +echo "configure:4151: checking for maillock in -lmail" >&5 ac_lib_var=`echo mail'_'maillock | sed 'y%./+-%__p_%'` if eval "test \"`echo '$''{'ac_cv_lib_$ac_lib_var'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 @@ -4113,7 +4155,7 @@ ac_save_LIBS="$LIBS" LIBS="-lmail $LIBS" cat > conftest.$ac_ext <&5; (eval $ac_link) 2>&5; } && test -s conftest; then +if { (eval echo configure:4170: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest; then rm -rf conftest* eval "ac_cv_lib_$ac_lib_var=yes" else @@ -4146,12 +4188,12 @@ for ac_func in touchlock do echo $ac_n "checking for $ac_func""... $ac_c" 1>&6 -echo "configure:4150: checking for $ac_func" >&5 +echo "configure:4192: checking for $ac_func" >&5 if eval "test \"`echo '$''{'ac_cv_func_$ac_func'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext <&5; (eval $ac_link) 2>&5; } && test -s conftest; then +if { (eval echo configure:4220: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest; then rm -rf conftest* eval "ac_cv_func_$ac_func=yes" else @@ -4202,17 +4244,17 @@ do ac_safe=`echo "$ac_hdr" | sed 'y%./+-%__p_%'` echo $ac_n "checking for $ac_hdr""... $ac_c" 1>&6 -echo "configure:4206: checking for $ac_hdr" >&5 +echo "configure:4248: checking for $ac_hdr" >&5 if eval "test \"`echo '$''{'ac_cv_header_$ac_safe'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext < EOF ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out" -{ (eval echo configure:4216: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; } +{ (eval echo configure:4258: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; } ac_err=`grep -v '^ *+' conftest.out` if test -z "$ac_err"; then rm -rf conftest* @@ -4250,12 +4292,12 @@ utimes setrlimit setpgid getcwd shutdown strftime do echo $ac_n "checking for $ac_func""... $ac_c" 1>&6 -echo "configure:4254: checking for $ac_func" >&5 +echo "configure:4296: checking for $ac_func" >&5 if eval "test \"`echo '$''{'ac_cv_func_$ac_func'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext <&5; (eval $ac_link) 2>&5; } && test -s conftest; then +if { (eval echo configure:4324: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest; then rm -rf conftest* eval "ac_cv_func_$ac_func=yes" else @@ -4308,7 +4350,7 @@ # It's better to believe a function is not available # than to expect to find it in ncurses. echo $ac_n "checking for tparm in -lncurses""... $ac_c" 1>&6 -echo "configure:4312: checking for tparm in -lncurses" >&5 +echo "configure:4354: checking for tparm in -lncurses" >&5 ac_lib_var=`echo ncurses'_'tparm | sed 'y%./+-%__p_%'` if eval "test \"`echo '$''{'ac_cv_lib_$ac_lib_var'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 @@ -4316,7 +4358,7 @@ ac_save_LIBS="$LIBS" LIBS="-lncurses $LIBS" cat > conftest.$ac_ext <&5; (eval $ac_link) 2>&5; } && test -s conftest; then +if { (eval echo configure:4373: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest; then rm -rf conftest* eval "ac_cv_lib_$ac_lib_var=yes" else @@ -4358,7 +4400,7 @@ # These tell us which Kerberos-related libraries to use. if test "${with_kerberos+set}" = set; then echo $ac_n "checking for com_err in -lcom_err""... $ac_c" 1>&6 -echo "configure:4362: checking for com_err in -lcom_err" >&5 +echo "configure:4404: checking for com_err in -lcom_err" >&5 ac_lib_var=`echo com_err'_'com_err | sed 'y%./+-%__p_%'` if eval "test \"`echo '$''{'ac_cv_lib_$ac_lib_var'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 @@ -4366,7 +4408,7 @@ ac_save_LIBS="$LIBS" LIBS="-lcom_err $LIBS" cat > conftest.$ac_ext <&5; (eval $ac_link) 2>&5; } && test -s conftest; then +if { (eval echo configure:4423: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest; then rm -rf conftest* eval "ac_cv_lib_$ac_lib_var=yes" else @@ -4405,7 +4447,7 @@ fi echo $ac_n "checking for mit_des_cbc_encrypt in -lcrypto""... $ac_c" 1>&6 -echo "configure:4409: checking for mit_des_cbc_encrypt in -lcrypto" >&5 +echo "configure:4451: checking for mit_des_cbc_encrypt in -lcrypto" >&5 ac_lib_var=`echo crypto'_'mit_des_cbc_encrypt | sed 'y%./+-%__p_%'` if eval "test \"`echo '$''{'ac_cv_lib_$ac_lib_var'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 @@ -4413,7 +4455,7 @@ ac_save_LIBS="$LIBS" LIBS="-lcrypto $LIBS" cat > conftest.$ac_ext <&5; (eval $ac_link) 2>&5; } && test -s conftest; then +if { (eval echo configure:4470: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest; then rm -rf conftest* eval "ac_cv_lib_$ac_lib_var=yes" else @@ -4452,7 +4494,7 @@ fi echo $ac_n "checking for krb5_init_context in -lkrb5""... $ac_c" 1>&6 -echo "configure:4456: checking for krb5_init_context in -lkrb5" >&5 +echo "configure:4498: checking for krb5_init_context in -lkrb5" >&5 ac_lib_var=`echo krb5'_'krb5_init_context | sed 'y%./+-%__p_%'` if eval "test \"`echo '$''{'ac_cv_lib_$ac_lib_var'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 @@ -4460,7 +4502,7 @@ ac_save_LIBS="$LIBS" LIBS="-lkrb5 $LIBS" cat > conftest.$ac_ext <&5; (eval $ac_link) 2>&5; } && test -s conftest; then +if { (eval echo configure:4517: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest; then rm -rf conftest* eval "ac_cv_lib_$ac_lib_var=yes" else @@ -4501,7 +4543,7 @@ if test "${with_kerberos5+set}" = set; then if test "${with_gssapi+set}" = set; then echo $ac_n "checking for gss_init_sec_context in -lgssapi_krb5""... $ac_c" 1>&6 -echo "configure:4505: checking for gss_init_sec_context in -lgssapi_krb5" >&5 +echo "configure:4547: checking for gss_init_sec_context in -lgssapi_krb5" >&5 ac_lib_var=`echo gssapi_krb5'_'gss_init_sec_context | sed 'y%./+-%__p_%'` if eval "test \"`echo '$''{'ac_cv_lib_$ac_lib_var'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 @@ -4509,7 +4551,7 @@ ac_save_LIBS="$LIBS" LIBS="-lgssapi_krb5 $LIBS" cat > conftest.$ac_ext <&5; (eval $ac_link) 2>&5; } && test -s conftest; then +if { (eval echo configure:4566: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest; then rm -rf conftest* eval "ac_cv_lib_$ac_lib_var=yes" else @@ -4550,7 +4592,7 @@ fi else echo $ac_n "checking for des_cbc_encrypt in -ldes""... $ac_c" 1>&6 -echo "configure:4554: checking for des_cbc_encrypt in -ldes" >&5 +echo "configure:4596: checking for des_cbc_encrypt in -ldes" >&5 ac_lib_var=`echo des'_'des_cbc_encrypt | sed 'y%./+-%__p_%'` if eval "test \"`echo '$''{'ac_cv_lib_$ac_lib_var'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 @@ -4558,7 +4600,7 @@ ac_save_LIBS="$LIBS" LIBS="-ldes $LIBS" cat > conftest.$ac_ext <&5; (eval $ac_link) 2>&5; } && test -s conftest; then +if { (eval echo configure:4615: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest; then rm -rf conftest* eval "ac_cv_lib_$ac_lib_var=yes" else @@ -4595,7 +4637,7 @@ else echo "$ac_t""no" 1>&6 echo $ac_n "checking for des_cbc_encrypt in -ldes425""... $ac_c" 1>&6 -echo "configure:4599: checking for des_cbc_encrypt in -ldes425" >&5 +echo "configure:4641: checking for des_cbc_encrypt in -ldes425" >&5 ac_lib_var=`echo des425'_'des_cbc_encrypt | sed 'y%./+-%__p_%'` if eval "test \"`echo '$''{'ac_cv_lib_$ac_lib_var'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 @@ -4603,7 +4645,7 @@ ac_save_LIBS="$LIBS" LIBS="-ldes425 $LIBS" cat > conftest.$ac_ext <&5; (eval $ac_link) 2>&5; } && test -s conftest; then +if { (eval echo configure:4660: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest; then rm -rf conftest* eval "ac_cv_lib_$ac_lib_var=yes" else @@ -4644,7 +4686,7 @@ fi echo $ac_n "checking for krb_get_cred in -lkrb""... $ac_c" 1>&6 -echo "configure:4648: checking for krb_get_cred in -lkrb" >&5 +echo "configure:4690: checking for krb_get_cred in -lkrb" >&5 ac_lib_var=`echo krb'_'krb_get_cred | sed 'y%./+-%__p_%'` if eval "test \"`echo '$''{'ac_cv_lib_$ac_lib_var'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 @@ -4652,7 +4694,7 @@ ac_save_LIBS="$LIBS" LIBS="-lkrb $LIBS" cat > conftest.$ac_ext <&5; (eval $ac_link) 2>&5; } && test -s conftest; then +if { (eval echo configure:4709: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest; then rm -rf conftest* eval "ac_cv_lib_$ac_lib_var=yes" else @@ -4689,7 +4731,7 @@ else echo "$ac_t""no" 1>&6 echo $ac_n "checking for krb_get_cred in -lkrb4""... $ac_c" 1>&6 -echo "configure:4693: checking for krb_get_cred in -lkrb4" >&5 +echo "configure:4735: checking for krb_get_cred in -lkrb4" >&5 ac_lib_var=`echo krb4'_'krb_get_cred | sed 'y%./+-%__p_%'` if eval "test \"`echo '$''{'ac_cv_lib_$ac_lib_var'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 @@ -4697,7 +4739,7 @@ ac_save_LIBS="$LIBS" LIBS="-lkrb4 $LIBS" cat > conftest.$ac_ext <&5; (eval $ac_link) 2>&5; } && test -s conftest; then +if { (eval echo configure:4754: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest; then rm -rf conftest* eval "ac_cv_lib_$ac_lib_var=yes" else @@ -4744,17 +4786,17 @@ do ac_safe=`echo "$ac_hdr" | sed 'y%./+-%__p_%'` echo $ac_n "checking for $ac_hdr""... $ac_c" 1>&6 -echo "configure:4748: checking for $ac_hdr" >&5 +echo "configure:4790: checking for $ac_hdr" >&5 if eval "test \"`echo '$''{'ac_cv_header_$ac_safe'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext < EOF ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out" -{ (eval echo configure:4758: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; } +{ (eval echo configure:4800: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; } ac_err=`grep -v '^ *+' conftest.out` if test -z "$ac_err"; then rm -rf conftest* @@ -4785,17 +4827,17 @@ do ac_safe=`echo "$ac_hdr" | sed 'y%./+-%__p_%'` echo $ac_n "checking for $ac_hdr""... $ac_c" 1>&6 -echo "configure:4789: checking for $ac_hdr" >&5 +echo "configure:4831: checking for $ac_hdr" >&5 if eval "test \"`echo '$''{'ac_cv_header_$ac_safe'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext < EOF ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out" -{ (eval echo configure:4799: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; } +{ (eval echo configure:4841: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; } ac_err=`grep -v '^ *+' conftest.out` if test -z "$ac_err"; then rm -rf conftest* @@ -4822,17 +4864,17 @@ do ac_safe=`echo "$ac_hdr" | sed 'y%./+-%__p_%'` echo $ac_n "checking for $ac_hdr""... $ac_c" 1>&6 -echo "configure:4826: checking for $ac_hdr" >&5 +echo "configure:4868: checking for $ac_hdr" >&5 if eval "test \"`echo '$''{'ac_cv_header_$ac_safe'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext < EOF ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out" -{ (eval echo configure:4836: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; } +{ (eval echo configure:4878: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; } ac_err=`grep -v '^ *+' conftest.out` if test -z "$ac_err"; then rm -rf conftest* @@ -4859,17 +4901,17 @@ do ac_safe=`echo "$ac_hdr" | sed 'y%./+-%__p_%'` echo $ac_n "checking for $ac_hdr""... $ac_c" 1>&6 -echo "configure:4863: checking for $ac_hdr" >&5 +echo "configure:4905: checking for $ac_hdr" >&5 if eval "test \"`echo '$''{'ac_cv_header_$ac_safe'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext < EOF ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out" -{ (eval echo configure:4873: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; } +{ (eval echo configure:4915: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; } ac_err=`grep -v '^ *+' conftest.out` if test -z "$ac_err"; then rm -rf conftest* @@ -4905,17 +4947,17 @@ do ac_safe=`echo "$ac_hdr" | sed 'y%./+-%__p_%'` echo $ac_n "checking for $ac_hdr""... $ac_c" 1>&6 -echo "configure:4909: checking for $ac_hdr" >&5 +echo "configure:4951: checking for $ac_hdr" >&5 if eval "test \"`echo '$''{'ac_cv_header_$ac_safe'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext < EOF ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out" -{ (eval echo configure:4919: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; } +{ (eval echo configure:4961: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; } ac_err=`grep -v '^ *+' conftest.out` if test -z "$ac_err"; then rm -rf conftest* @@ -4942,17 +4984,17 @@ do ac_safe=`echo "$ac_hdr" | sed 'y%./+-%__p_%'` echo $ac_n "checking for $ac_hdr""... $ac_c" 1>&6 -echo "configure:4946: checking for $ac_hdr" >&5 +echo "configure:4988: checking for $ac_hdr" >&5 if eval "test \"`echo '$''{'ac_cv_header_$ac_safe'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext < EOF ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out" -{ (eval echo configure:4956: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; } +{ (eval echo configure:4998: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; } ac_err=`grep -v '^ *+' conftest.out` if test -z "$ac_err"; then rm -rf conftest* @@ -4979,17 +5021,17 @@ do ac_safe=`echo "$ac_hdr" | sed 'y%./+-%__p_%'` echo $ac_n "checking for $ac_hdr""... $ac_c" 1>&6 -echo "configure:4983: checking for $ac_hdr" >&5 +echo "configure:5025: checking for $ac_hdr" >&5 if eval "test \"`echo '$''{'ac_cv_header_$ac_safe'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext < EOF ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out" -{ (eval echo configure:4993: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; } +{ (eval echo configure:5035: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; } ac_err=`grep -v '^ *+' conftest.out` if test -z "$ac_err"; then rm -rf conftest* @@ -5026,17 +5068,17 @@ do ac_safe=`echo "$ac_hdr" | sed 'y%./+-%__p_%'` echo $ac_n "checking for $ac_hdr""... $ac_c" 1>&6 -echo "configure:5030: checking for $ac_hdr" >&5 +echo "configure:5072: checking for $ac_hdr" >&5 if eval "test \"`echo '$''{'ac_cv_header_$ac_safe'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext < EOF ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out" -{ (eval echo configure:5040: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; } +{ (eval echo configure:5082: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; } ac_err=`grep -v '^ *+' conftest.out` if test -z "$ac_err"; then rm -rf conftest* @@ -5066,7 +5108,7 @@ if test "${with_gssapi+set}" = set; then echo $ac_n "checking for gss_init_sec_context in -lgssapi""... $ac_c" 1>&6 -echo "configure:5070: checking for gss_init_sec_context in -lgssapi" >&5 +echo "configure:5112: checking for gss_init_sec_context in -lgssapi" >&5 ac_lib_var=`echo gssapi'_'gss_init_sec_context | sed 'y%./+-%__p_%'` if eval "test \"`echo '$''{'ac_cv_lib_$ac_lib_var'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 @@ -5074,7 +5116,7 @@ ac_save_LIBS="$LIBS" LIBS="-lgssapi $LIBS" cat > conftest.$ac_ext <&5; (eval $ac_link) 2>&5; } && test -s conftest; then +if { (eval echo configure:5131: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest; then rm -rf conftest* eval "ac_cv_lib_$ac_lib_var=yes" else @@ -5116,17 +5158,17 @@ do ac_safe=`echo "$ac_hdr" | sed 'y%./+-%__p_%'` echo $ac_n "checking for $ac_hdr""... $ac_c" 1>&6 -echo "configure:5120: checking for $ac_hdr" >&5 +echo "configure:5162: checking for $ac_hdr" >&5 if eval "test \"`echo '$''{'ac_cv_header_$ac_safe'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext < EOF ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out" -{ (eval echo configure:5130: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; } +{ (eval echo configure:5172: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; } ac_err=`grep -v '^ *+' conftest.out` if test -z "$ac_err"; then rm -rf conftest* @@ -5157,7 +5199,7 @@ # Solaris requires -lintl if you want strerror (which calls dgettext) # to return localized messages. echo $ac_n "checking for dgettext in -lintl""... $ac_c" 1>&6 -echo "configure:5161: checking for dgettext in -lintl" >&5 +echo "configure:5203: checking for dgettext in -lintl" >&5 ac_lib_var=`echo intl'_'dgettext | sed 'y%./+-%__p_%'` if eval "test \"`echo '$''{'ac_cv_lib_$ac_lib_var'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 @@ -5165,7 +5207,7 @@ ac_save_LIBS="$LIBS" LIBS="-lintl $LIBS" cat > conftest.$ac_ext <&5; (eval $ac_link) 2>&5; } && test -s conftest; then +if { (eval echo configure:5222: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest; then rm -rf conftest* eval "ac_cv_lib_$ac_lib_var=yes" else @@ -5205,7 +5247,7 @@ echo $ac_n "checking whether localtime caches TZ""... $ac_c" 1>&6 -echo "configure:5209: checking whether localtime caches TZ" >&5 +echo "configure:5251: checking whether localtime caches TZ" >&5 if eval "test \"`echo '$''{'emacs_cv_localtime_cache'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else @@ -5215,7 +5257,7 @@ emacs_cv_localtime_cache=yes else cat > conftest.$ac_ext < #if STDC_HEADERS @@ -5250,7 +5292,7 @@ exit (0); } EOF -if { (eval echo configure:5254: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest && (./conftest; exit) 2>/dev/null +if { (eval echo configure:5296: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest && (./conftest; exit) 2>/dev/null then emacs_cv_localtime_cache=no else @@ -5278,12 +5320,12 @@ if test "x$HAVE_TIMEVAL" = xyes; then echo $ac_n "checking whether gettimeofday can accept two arguments""... $ac_c" 1>&6 -echo "configure:5282: checking whether gettimeofday can accept two arguments" >&5 +echo "configure:5324: checking whether gettimeofday can accept two arguments" >&5 if eval "test \"`echo '$''{'emacs_cv_gettimeofday_two_arguments'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext <&5; (eval $ac_link) 2>&5; } && test -s conftest; then +if { (eval echo configure:5351: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest; then rm -rf conftest* emacs_cv_gettimeofday_two_arguments=yes else @@ -5328,12 +5370,12 @@ ok_so_far=yes echo $ac_n "checking for socket""... $ac_c" 1>&6 -echo "configure:5332: checking for socket" >&5 +echo "configure:5374: checking for socket" >&5 if eval "test \"`echo '$''{'ac_cv_func_socket'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext <&5; (eval $ac_link) 2>&5; } && test -s conftest; then +if { (eval echo configure:5402: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest; then rm -rf conftest* eval "ac_cv_func_socket=yes" else @@ -5379,17 +5421,17 @@ if test $ok_so_far = yes; then ac_safe=`echo "netinet/in.h" | sed 'y%./+-%__p_%'` echo $ac_n "checking for netinet/in.h""... $ac_c" 1>&6 -echo "configure:5383: checking for netinet/in.h" >&5 +echo "configure:5425: checking for netinet/in.h" >&5 if eval "test \"`echo '$''{'ac_cv_header_$ac_safe'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext < EOF ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out" -{ (eval echo configure:5393: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; } +{ (eval echo configure:5435: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; } ac_err=`grep -v '^ *+' conftest.out` if test -z "$ac_err"; then rm -rf conftest* @@ -5415,17 +5457,17 @@ if test $ok_so_far = yes; then ac_safe=`echo "arpa/inet.h" | sed 'y%./+-%__p_%'` echo $ac_n "checking for arpa/inet.h""... $ac_c" 1>&6 -echo "configure:5419: checking for arpa/inet.h" >&5 +echo "configure:5461: checking for arpa/inet.h" >&5 if eval "test \"`echo '$''{'ac_cv_header_$ac_safe'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext < EOF ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out" -{ (eval echo configure:5429: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; } +{ (eval echo configure:5471: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; } ac_err=`grep -v '^ *+' conftest.out` if test -z "$ac_err"; then rm -rf conftest* @@ -5538,6 +5580,23 @@ EOF +cat >> confdefs.h <> confdefs.h <> confdefs.h <> confdefs.h <> confdefs.h <<\EOF #define HAVE_X_WINDOWS 1 @@ -5642,7 +5701,7 @@ # Ultrix sh set writes to stderr and can't be redirected directly, # and sets the high bit in the cache file unless we assign to the vars. (set) 2>&1 | - case `(ac_space=' '; set | grep ac_space) 2>&1` in + case `(ac_space=' '; set) 2>&1` in *ac_space=\ *) # `set' does not quote correctly, so add quotes (double-quote substitution # turns \\\\ into \\, and sed turns \\ into \). diff -u --recursive --new-file emacs-20.3/configure.in emacs-20.3+canna/configure.in --- emacs-20.3/configure.in Wed Jul 1 07:15:05 1998 +++ emacs-20.3+canna/configure.in Sat Aug 22 01:42:33 1998 @@ -34,6 +34,14 @@ archlibdir='${libexecdir}/emacs/${version}/${configuration}' docdir='${datadir}/emacs/${version}/etc' +AC_ARG_WITH(canna, +[ --with-canna support CANNA], +[AC_DEFINE(CANNA)]) +AC_ARG_WITH(canna-includes, +[ --with-canna-includes=DIR Search for CANNA header files in DIR]) +AC_ARG_WITH(canna-libraries, +[ --with-canna-libraries=DIR Search for CANNA libraries in DIR]) + AC_ARG_WITH(gcc, [ --with-gcc use GCC to compile Emacs]) AC_ARG_WITH(pop, @@ -1395,6 +1403,20 @@ LISP_FLOAT_TYPE=yes +if test -n "${with_canna}" ; then + test -n "${with_canna_includes}" && C_SWITCH_CANNA="-I${with_canna_includes}" + if test -n "${with_canna_libraries}" ; then + if test -d ${with_canna_libraries} ; then + LD_SWITCH_CANNA="-L${with_canna_libraries}" + LD_SWITCH_CANNA_AUX="-R${with_canna_libraries}" + LIBS_MULE="${LIBS_MULE} -lcanna" + else + LIBS_MULE="${LIBS_MULE} ${with_canna_libraries}" + fi + else + LIBS_MULE="${LIBS_MULE} -lcanna" + fi +fi #### Add the libraries to LIBS and check for some functions. @@ -1802,6 +1824,11 @@ AC_DEFINE_UNQUOTED(LD_SWITCH_X_SITE_AUX, ${LD_SWITCH_X_SITE_AUX}) AC_DEFINE_UNQUOTED(C_SWITCH_X_SITE, ${C_SWITCH_X_SITE}) AC_DEFINE_UNQUOTED(UNEXEC_SRC, ${UNEXEC_SRC}) + +AC_DEFINE_UNQUOTED(LIBS_MULE, ${LIBS_MULE}) +AC_DEFINE_UNQUOTED(C_SWITCH_CANNA, ${C_SWITCH_CANNA}) +AC_DEFINE_UNQUOTED(LD_SWITCH_CANNA, ${LD_SWITCH_CANNA}) +AC_DEFINE_UNQUOTED(LD_SWITCH_CANNA_AUX, ${LD_SWITCH_CANNA_AUX}) if test "${HAVE_X_WINDOWS}" = "yes" ; then AC_DEFINE(HAVE_X_WINDOWS) diff -u --recursive --new-file emacs-20.3/lisp/canna.el emacs-20.3+canna/lisp/canna.el --- emacs-20.3/lisp/canna.el Thu Jan 1 09:00:00 1970 +++ emacs-20.3+canna/lisp/canna.el Sat Sep 19 00:48:08 1998 @@ -0,0 +1,1352 @@ +;; This file is a part of Canna on Nemacs/Mule. + +;; Canna on Nemacs/Mule is distributed in the forms of +;; patches to Nemacs under the terms of the GNU EMACS +;; GENERAL PUBLIC LICENSE which is distributed along with +;; GNU Emacs by the Free Software Foundation. + +;; Canna on Nemacs/Mule is distributed in the hope that it will +;; be useful, but WITHOUT ANY WARRANTY; without even the +;; implied warranty of MERCHANTABILITY or FITNESS FOR A +;; PARTICULAR PURPOSE. See the GNU EMACS GENERAL PUBLIC +;; LICENSE for more details. + +;; You should have received a copy of the GNU EMACS GENERAL +;; PUBLIC LICENSE along with Nemacs/Mule; see the file +;; COPYING. If not, write to the Free Software Foundation, +;; 675 Mass Ave, Cambridge, MA 02139, USA. + +;; Egg offered some influences to the implementation of +;; Canna on Nemacs/Mule, and this file contains a few part +;; of Egg which is written by S.Tomura, Electrotechnical +;; Lab. (tomura@etl.go.jp) + +;; Written by Akira Kon, NEC Corporation. +;; E-Mail: kon@d1.bs2.mt.nec.co.jp. + +;; -*-mode: emacs-lisp-*- + +(defconst canna-rcs-version "Canna/mule 2.x, based on Canna 2.2/3.2. : canna.el,v x.xx 1994/11/7 00:00:00") + +(defun canna-version () + (interactive) + (message (concat (substring canna-rcs-version 0 72) " ...")) ) + +(provide 'canna) + +;;; $B$+$s$J$NJQ?t(B + +(defvar canna-save-undo-text-predicate nil) +(defvar canna-undo-hook nil) + +(defvar canna-do-keybind-for-functionkeys t) +(defvar canna-use-functional-numbers nil) +(defvar canna-use-space-key-as-henkan-region t) + +(defvar canna-server nil) +(defvar canna-file nil) + +(defvar canna-underline nil) +(defvar canna-with-fences (not canna-underline)) + +(defvar canna-initialize-minibuffer-state-when-exit nil + "*Non-nil $B$N$H$-$O(B, $B%_%K%P%C%U%!$rH4$1$k;~F|K\8l>uBV$r=i4|2=$9$k(B.") + +(defvar canna-inhibit-hankakukana nil + "*Non-nil $B$N;~!";z3Q$+$J$KJQ49$7$J$$(B") + +;;; +;;; $B%b!<%I%i%$%s$N=$@0(B +;;; + +(defvar canna:*kanji-mode-string* "[ $B$"(B ]") +(defvar canna:*alpha-mode-string* "$B$+$s$J(B") +(defvar canna:*saved-mode-string* "[ $B$"(B ]") + +(defvar mode-line-canna-mode canna:*alpha-mode-string*) +(defvar mode-line-canna-mode-in-minibuffer canna:*alpha-mode-string*) + +(defvar display-minibuffer-mode-in-minibuffer nil) ; same name as TAKANA +; $B$?$+$J$G$O(B t $B$,%G%U%)%k%H$@$1$I!"(Bnil $B$r%G%U%)%k%H$K$7$F$*$3$&$+$J!#(B + +(make-variable-buffer-local 'mode-line-canna-mode) + +; select-window-hook $B$O(B mule $B$+$iF~$C$?$s$@$H;W$&$1$I!"(B +; $B$3$l$,L5$$$H(B preprompt $B$,$"$C$F$b$I$&$7$h$&$b$J$$$N$G$J$$$H$-$O(B +; display-minibuffer-mode-in-minibuffer $B$r(B nil $B$K$9$k!#(B + +(if (not (boundp 'select-window-hook)) + (setq display-minibuffer-mode-in-minibuffer nil)) + +(defun canna:select-window-hook (old new) + (if (and (eq old (minibuffer-window)) + (not (eq new (minibuffer-window)))) + (save-excursion + (set-buffer (window-buffer (minibuffer-window))) + ;; minibuffer$B$N%G%U%)%k%H$O%"%k%U%!%Y%C%H%b!<%I(B + (setq mode-line-canna-mode-in-minibuffer canna:*alpha-mode-string* + canna:*japanese-mode-in-minibuffer* nil + minibuffer-preprompt nil))) + (if (eq new (minibuffer-window)) + (setq minibuffer-window-selected t) + (setq minibuffer-window-selected nil))) + +; egg:select-window-hook $B$G$b==J,$J$N$G!"(Begg:select-window-hook $B$,(B +; $B@_Dj$5$l$F$$$J$$>l9g$N$_Dj5A$9$k!#(B + +; $BNI$/9M$($F$_$k$H(B display-minibuffer-mode-in-minibuffer $B$,(B t $B$N;~$O(B +; $B$d$O$j>e5-$N(B canna:select-window-hook $B$,I,MW$@$J$"!#$I$&$7$h$&!#(B + +(if (and (boundp 'select-window-hook) + (not (eq select-window-hook 'egg:select-window-hook))) + (setq select-window-hook 'canna:select-window-hook)) + +(defun mode-line-canna-mode-update (str) + (if (eq (current-buffer) (window-buffer (minibuffer-window))) + (if (and display-minibuffer-mode-in-minibuffer + (boundp 'minibuffer-preprompt)) + (setq minibuffer-preprompt str) + ;else + (setq mode-line-canna-mode-in-minibuffer str)) + (setq mode-line-canna-mode str) ) + (set-buffer-modified-p (buffer-modified-p)) ) + +;; memq $B$r6/D4$9$k$J$i!"0J2<$@$,!"(B +;(defun canna:memq-recursive (a l) +; (or (eq a l) +; (and (consp l) +; (or (canna:memq-recursive a (car l)) +; (canna:memq-recursive a (cdr l)) )))) +;; $B]$N?'(B\", \"$BA*BrBP>]$N?'(B\" $B$N(B +$B%j%9%H$r@_Dj$9$k(B") +(defvar canna:color-p nil "$B?'$,;H$($k$+(B") +(defvar canna:attr-mode nil "$B8=:_$N%G%#%9%W%l%$%b!<%I(B") +(defvar canna:attr-yomi nil "$BFI$_$N?'B0@-(B") +(defvar canna:attr-taishou nil "$BJQ49BP>]ItJ,$N?'B0@-(B") +(defvar canna:attr-select nil + "$B%_%K%P%C%U%!J,N%;~$N%a%K%e!<$NA*BrBP>]HV9f$N?'B0@-(B") +(defvar canna:attribute-alist ;colored by tagu@ae.keio.ac.jp + '((yomi (normal . "red") + (reverse . "moccasin")) + (taishou (normal . "blue/lavender") + (reverse . "yellow/cadet blue")) + (select (normal . "DarkOliveGreen1/cadet blue") + (reverse . "light sea green/burlywood1"))) + "$B$+$s$JJQ49;~$NG[?'$N(Balist") + +(make-variable-buffer-local (defvar canna:*yomi-overlay* nil)) +(make-variable-buffer-local (defvar canna:*henkan-overlay* nil)) +(make-variable-buffer-local (defvar canna:*select-overlay* nil)) + +;;; +;;; $B%-!<%^%C%W%F!<%V%k(B +;;; + +;; $B%U%'%s%9%b!<%I$G$N%m!<%+%k%^%C%W(B +(defvar canna-mode-map (make-sparse-keymap)) + +(let ((ch 0)) + (while (<= ch 127) + (define-key canna-mode-map (make-string 1 ch) 'canna-functional-insert-command) + (setq ch (1+ ch)))) + +(define-key canna-mode-map [up] [?\C-p]) +(define-key canna-mode-map [S-up] [?\C-p]) +(define-key canna-mode-map [C-up] [?\C-p]) +(define-key canna-mode-map [down] [?\C-n]) +(define-key canna-mode-map [S-down] [?\C-n]) +(define-key canna-mode-map [C-down] [?\C-n]) +(define-key canna-mode-map [right] [?\C-f]) +(define-key canna-mode-map [S-right] [?\C-f]) +(define-key canna-mode-map [C-right] [?\C-f]) +(define-key canna-mode-map [left] [?\C-b]) +(define-key canna-mode-map [S-left] [?\C-b]) +(define-key canna-mode-map [C-left] [?\C-b]) +(define-key canna-mode-map [kanji] [? ]) +(define-key canna-mode-map [?\C- ] [?\C-@]) + +;; $B%_%K%P%C%U%!$K2?$+$rI=<($7$F$$$k;~$N%m!<%+%k%^%C%W(B +(defvar canna-minibuffer-mode-map (make-sparse-keymap)) + +(let ((ch 0)) + (while (<= ch 127) + (define-key canna-minibuffer-mode-map (make-string 1 ch) 'canna-minibuffer-insert-command) + (setq ch (1+ ch)))) + +(define-key canna-minibuffer-mode-map [up] [?\C-p]) +(define-key canna-minibuffer-mode-map [S-up] [?\C-p]) +(define-key canna-minibuffer-mode-map [C-up] [?\C-p]) +(define-key canna-minibuffer-mode-map [down] [?\C-n]) +(define-key canna-minibuffer-mode-map [S-down] [?\C-n]) +(define-key canna-minibuffer-mode-map [C-down] [?\C-n]) +(define-key canna-minibuffer-mode-map [right] [?\C-f]) +(define-key canna-minibuffer-mode-map [S-right] [?\C-f]) +(define-key canna-minibuffer-mode-map [C-right] [?\C-f]) +(define-key canna-minibuffer-mode-map [left] [?\C-b]) +(define-key canna-minibuffer-mode-map [S-left] [?\C-b]) +(define-key canna-minibuffer-mode-map [C-left] [?\C-b]) +(define-key canna-minibuffer-mode-map [kanji] [? ]) +(define-key canna-minibuffer-mode-map [?\C- ] [?\C-@]) + +;;; +;;; $B%0%m!<%P%k4X?t$N=q$-BX$((B +;;; + + +;; Keyboard quit + +;(if (not (fboundp 'canna-sys:keyboard-quit)) +; (fset 'canna-sys:keyboard-quit (symbol-function 'keyboard-quit)) ) + +;(defun canna:keyboard-quit () +; "See documents for canna-sys:keyboard-quit" +; (interactive) +; (if canna:*japanese-mode* +; (progn +;; (setq canna:*japanese-mode* nil) +; (setq canna:*fence-mode* nil) +; (if (boundp 'disable-undo) +; (setq disable-undo canna:*fence-mode*)) +; (canna:mode-line-display) )) +; (canna-sys:keyboard-quit) ) + +;; Abort recursive edit + +;(if (not (fboundp 'canna-sys:abort-recursive-edit)) +; (fset 'canna-sys:abort-recursive-edit +; (symbol-function 'abort-recursive-edit)) ) + +;(defun canna:abort-recursive-edit () +; "see documents for canna-sys:abort-recursive-edit" +; (interactive) +; (if canna:*japanese-mode* +; (progn +; (setq canna:*japanese-mode* nil) +; (setq canna:*fence-mode* nil) +; (if (boundp 'disable-undo) +; (setq disable-undo canna:*fence-mode*)) +; (canna:mode-line-display) )) +; (canna-sys:abort-recursive-edit) ) + +;; Exit-minibuffer + +(defun canna:exit-minibuffer () + "Exit minibuffer turning off canna Japanese mode. +See also document for canna:saved-exit-minibuffer." + (interactive) + (if canna-initialize-minibuffer-state-when-exit + (setq canna:*japanese-mode-in-minibuffer* nil + mode-line-canna-mode-in-minibuffer canna:*alpha-mode-string*)) + ) + +(add-hook 'minibuffer-exit-hook 'canna:exit-minibuffer) + +;; kill-emacs + +(add-hook 'kill-emacs-hook 'canna:finalize) + +;;; +;;; function for mini-buffer +;;; + +(defun adjust-minibuffer-mode () + (if (eq (current-buffer) (window-buffer (minibuffer-window))) + (progn + (setq canna:*japanese-mode* canna:*japanese-mode-in-minibuffer*) + t) + nil)) + +;;; +;;; keyboard input for japanese language +;;; + +(defun canna-functional-insert-command (arg) + "Use input character as a key of complex translation input such as\n\ +kana-to-kanji translation." + (interactive "*p") + (canna:functional-insert-command2 last-command-char arg) ) + +(defun canna:functional-insert-command2 (ch arg) + "This function actualy isert a converted Japanese string." + ;; $B$3$N4X?t$OM?$($i$l$?J8;z$rF|K\8lF~NO$N$?$a$N%-!C$9!#(B + (progn + (canna:henkan-attr-off canna:*region-start* canna:*region-end*) + (canna:yomi-attr-off canna:*region-start* canna:*region-end*))) + (delete-region canna:*region-start* canna:*region-end*) + (setq canna:*last-kouho* 0) ))) + +(defun canna:insert-fixed (strs) + (cond ((> strs 0) + (cond ((and canna-kakutei-yomi + (or (null canna-save-undo-text-predicate) + (funcall canna-save-undo-text-predicate + (cons canna-kakutei-yomi + canna-kakutei-romaji) ))) + (setq canna:*undo-text-yomi* + (cons canna-kakutei-yomi canna-kakutei-romaji)) + (set-marker canna:*spos-undo-text* (point)) +;; +;; update kbnes + (let ((list (string-to-list canna-kakutei-string)) ; modified by knak 97.10.27 string-to-char-list -> string-to-list + ;; $BA^F~$NESCf$G(B blink $B$,5/$-$k$H$&$C$H$*$7$$$N$G!"(B + ;; $B0l;~E*$K(B blink $B$rM^;_$9$k!#(B + (blink-matching-paren nil)) +; (undo-boundary) ; append by knak 97.10.27 + (while list +; (self-insert-internal (car list)) ; comment by knak 97.10.21 + (insert-char (car list) 1) ; append by knak 97.10.21 + (setq list (cdr list))) +; (setq pending-undo-list nil) ; append by knak 97.10.21 + ) + ;; $BL$3NDj$NJ8;z$,$J$/!"3NDjJ8;zNs$N:G8e$,JD$83g8L$N(B + ;; $BN`$@$C$?$H$-$O(B blink $B$5$;$k!#(B + (if (and canna-empty-info + (eq (char-syntax (char-before (point))) ?\)) ) + (blink-matching-open)) + +; (if overwrite-mode +; (let ((num strs) +; (kanji-compare 128)) +; (catch 'delete-loop +; (while (> num 0) +; (if (eolp) +; (throw 'delete-loop nil)) +; (if (>= (following-char) kanji-compare) +; (setq num (1- num))) +; (delete-char 1) +; (setq num (1- num)))))) +;; end kbnes +; (insert canna-kakutei-string) + (if (and (boundp 'self-insert-after-hook) ; append by knak 97.10.21 + self-insert-after-hook) + (funcall self-insert-after-hook + canna:*region-start* canna:*region-end*)) + (canna:do-auto-fill) + (set-marker canna:*epos-undo-text* (point)) ) + (t +;; +;; update kbnes + (let ((list (string-to-list canna-kakutei-string)) ; modified by knak 97.10.21 string-to-char-list -> string-to-list + ;; $BA^F~$NESCf$G(B blink $B$,5/$-$k$H$&$C$H$*$7$$$N$G!"(B + ;; $B0l;~E*$K(B blink $B$rM^;_$9$k!#(B + (blink-matching-paren nil)) +; (undo-boundary) ; append by knak 97.10.21 + (while list +; (self-insert-internal (car list)) ; comment by knak 97.10.21 + (insert-char (car list) 1) ; appnd by knak 97.10.21 + (setq list (cdr list))) +; (setq pending-undo-list nil) ; append by knak 97.10.21 + ) + ;; $BL$3NDj$NJ8;z$,$J$/!"3NDjJ8;zNs$N:G8e$,JD$83g8L$N(B + ;; $BN`$@$C$?$H$-$O(B blink $B$5$;$k!#(B + (if (and canna-empty-info + (eq (char-syntax (char-before (point))) ?\)) ) + (blink-matching-open)) + +; (if overwrite-mode +; (let ((num strs) +; (kanji-compare 128)) +; (catch 'delete-loop +; (while (> num 0) +; (if (eolp) +; (throw 'delete-loop nil)) +; (if (>= (following-char) kanji-compare) +; (setq num (1- num))) +; (delete-char 1) +; (setq num (1- num)))))) +;; end kbnes +; (insert canna-kakutei-string) + (if (and (boundp 'self-insert-after-hook) ; append by knak 97.10.21 + self-insert-after-hook) + (funcall self-insert-after-hook + canna:*region-start* canna:*region-end*)) + (canna:do-auto-fill) )) + ) )) + +(defun canna:insert-preedit () + (cond ((> canna-henkan-length 0) + (set-marker canna:*region-start* (point)) +; (beep) + (mark-undo-boundary) ; append by knak 97.10.23 + (if canna-with-fences + (progn + (insert "||") + (set-marker canna:*region-end* (point)) + (backward-char 1) + )) + (insert canna-henkan-string) + (if (not canna-with-fences) + (set-marker canna:*region-end* (point)) ) + (if canna-underline + (canna:yomi-attr-on canna:*region-start* canna:*region-end*)) + (setq canna:*last-kouho* canna-henkan-length) + )) + + ;; $B8uJdNN0h$G$O6/D4$7$?$$J8;zNs$,B8:_$9$k$b$N$H9M$($i(B + ;; $B$l$k!#6/D4$7$?$$J8;z$O(BEmacs$B$G$O%+!<%=%k%]%8%7%g%s$K$FI=<((B + ;; $B$9$k$3$H$H$9$k!#6/D4$7$?$$J8;z$,$J$$$N$G$"$l$P!"%+!<%=%k(B + ;; $B$O0lHV8e$NItJ,(B($BF~NO$,9T$o$l$k%]%$%s%H(B)$B$KCV$$$F$*$/!#(B + + ;; $B%+!<%=%k$r0\F0$9$k!#(B + (if (not canna-underline) + (backward-char + (- canna:*last-kouho* + ;; $B%+!<%=%k0LCV$O!"H?E>I=<(ItJ,$,B8:_$7$J$$$N$G$"$l$P!"(B + ;; $B8uJdJ8;zNs$N:G8e$NItJ,$H$7!"H?E>I=<(ItJ,$,B8:_$9$k$N(B + ;; $B$G$"$l$P!"$=$NItJ,$N;O$a$H$9$k!#(B + (cond ((zerop canna-henkan-revlen) + canna:*last-kouho*) + (t canna-henkan-revpos) )) ) + (if (and (> canna-henkan-revlen 0) + (> canna-henkan-length 0)) + ; $B8uJd$ND9$5$,(B0$B$G$J$/!"(B + ; $BH?E>I=<($ND9$5$,(B0$B$G$J$1$l$P!"(B + ; $B$=$NItJ,$rJQE>I=<($9$k!#(B +;; appended by knak 1998.9.18 +;; wide character no kazoe kata ga 20.3 kara henkou ni nattatame + (let ((ctbl) + (clst (string-to-list (concat canna-henkan-string " "))) + (flg) + (i 0)) + (while clst + (setq ctbl (append ctbl (list i))) + (cond ((eq (char-charset (car clst)) 'ascii) + ) + ((eq (char-charset (car clst)) 'katakana-jisx0201) + (setq ctbl (append ctbl (list i)))) + (t + (setq ctbl (append ctbl (list i i))))) + (setq i (1+ i)) + (setq clst (cdr clst)) ) + (let ((canna-henkan-revpos (nth canna-henkan-revpos ctbl)) + (canna-henkan-revlen + (- (nth (+ canna-henkan-revpos canna-henkan-revlen) + ctbl) + (nth canna-henkan-revpos ctbl)))) +;; appended here knak 1998.9.18 + (let ((start (+ canna:*region-start* + (if canna-with-fences 1 0) + canna-henkan-revpos) )) + (if canna-underline + (canna:henkan-attr-on + start + (+ start canna-henkan-revlen))))) )) + ) ) + +(defun canna:display-candidates (strs) + (cond ((stringp strs) ; $B%(%i!<$,5/$3$C$?>l9g(B + (beep) + (message strs) ) + (canna-henkan-string + ;; $B$b$78uJdI=<($,A0$N7k2L$+$iJQ$o$C$F$$$J$/$J$$$H$-$O(B...... + + ;; $BC$9!#(B + (canna:delete-last-preedit) + + ;; $B3NDj$7$?J8;zNs$,$"$l$P$=$l$rA^F~$9$k!#(B + (canna:insert-fixed strs) + + ;; $BpJs$rJ]B8(B + ;; $B$7$F$*$/!#(B + (setq canna:*previous-window* (selected-window)) +; (select-frame (window-frame (minibuffer-window))) + +;; $B<+J,$KMh$kA0$,%_%K%P%C%U%!$+$I$&$+$rJQ?t$K$G$b$$$l$F$*$$$?J}$,$$$$$J$"!#(B + + (if (not canna:*cursor-was-in-minibuffer*) + (progn + ;; $B%_%K%P%C%U%!$r%/%j%"$9$k!#(B +; (if (eq canna:*previous-window* (selected-window)) +; (progn +; (canna:henkan-attr-off (point-min) (point-max)) +; (canna:delete-last-preedit) )) + + ;; $B%_%K%P%C%U%!%&%#%s%I%&$K8uJd0lMwMQ$N%P%C%U%!$r3d$jEv$F$k!#(B + (setq canna:*saved-minibuffer* (window-buffer (minibuffer-window))) +; (set-window-buffer (minibuffer-window) +; (get-buffer-create canna:*menu-buffer*)) + (setq canna:*saved-redirection* (frame-focus (selected-frame))) + (redirect-frame-focus (selected-frame) + (window-frame (minibuffer-window))) + + ;; $B%_%K%P%C%U%!$N%-!<%^%C%W$rJ]B8$7$F$*$/!#(B + (setq canna:*minibuffer-local-map-backup* (current-local-map)) + )) + (select-window (minibuffer-window)) + (set-window-buffer (minibuffer-window) + (get-buffer-create canna:*menu-buffer*)) + + (use-local-map canna-minibuffer-mode-map) + +; (canna:yomi-attr-off (point-min) (point-max) ) +; (canna:henkan-attr-off (point-min) (point-max) ) + (canna:select-attr-off (point-min) (point-max) ) + (setq canna:*cursor-was-in-minibuffer* t) + (delete-region (point-min) (point-max)) + (if (not (eq canna:*previous-window* (selected-window))) + (setq minibuffer-window-selected nil)) + + (insert str) + + ;; $B%_%K%P%C%U%!$GH?E>I=<($9$k$Y$-J8;z$N$H$3$m$K%+!<%=%k$r0\F0$9$k!#(B + (cond ((> revlen 0) + (backward-char (- len revpos)) )) + ;;(message "%s" (selected-frame)) (sit-for 3) + (raise-frame (window-frame (minibuffer-window))) +; (select-frame (window-frame (minibuffer-window))) + (and canna:color-p (not (eobp)) + (canna:select-attr-on (point) + (save-excursion (forward-char 1) (point)))) + + ;; $B%_%K%P%C%U%!$KI=<($9$k$Y$-J8;zNs$,%L%kJ8;zNs$J$N$G$"$l$P!"A0$N%&%#(B + ;; $B%s%I%&$KLa$k!#(B + (if (or (zerop len) canna-empty-info) + (progn + (setq canna:*cursor-was-in-minibuffer* nil) + (use-local-map canna:*minibuffer-local-map-backup*) + + ;; $B%_%K%P%C%U%!%&%#%s%I%&$N%P%C%U%!$r85$KLa$9!#(B + (set-window-buffer (minibuffer-window) canna:*saved-minibuffer*) +; (setq canna:*saved-minibuffer* nil) + (redirect-frame-focus (window-frame canna:*previous-window*) + canna:*saved-redirection*) + ; $B%_%K%P%C%U%!$GF~NO$7$F$$$?$N$J$i0J2<$b$9$k!#(B +; (if (eq canna:*previous-window* (selected-window)) +; (progn +; (canna:insert-fixed nfixed) +; (canna:insert-preedit) )) + + (if (and canna-empty-info (> len 0)) + (progn +; (delete-region (point-min) (point-max)) + (message str) )) + (select-window canna:*previous-window*) )) + ) + +(defun canna-minibuffer-insert-command (arg) + "Use input character as a key of complex translation input such as\n\ +kana-to-kanji translation, even if you are in the minibuffer." + (interactive "p") + (use-local-map canna:*minibuffer-local-map-backup*) + (set-window-buffer (minibuffer-window) canna:*saved-minibuffer*) + (select-window canna:*previous-window*) + (canna:functional-insert-command2 last-command-char arg) ) + +;;; +;;; $B$+$s$J%b!<%I$N= canna:*self-insert-non-undo-count* 20)) +; (setq canna:*self-insert-non-undo-count* 1) +; (cancel-undo-boundary) +; (setq canna:*self-insert-non-undo-count* +; (1+ canna:*self-insert-non-undo-count*))) + (if (and (eq last-command 'canna-self-insert-command) + (> last-command-char ? )) + (cancel-undo-boundary)) + (self-insert-command arg) +; (if canna-insert-after-hook +; (run-hooks 'canna-insert-after-hook)) + (if (and (boundp 'self-insert-after-hook) ; append by knak 97.10.21 + self-insert-after-hook) + (if (<= 1 arg) + (funcall self-insert-after-hook + (- (point) arg) (point))) + (if (= last-command-char ? ) (canna:do-auto-fill)))))) + +(defun canna-toggle-japanese-mode () + "Toggle canna japanese mode." + (interactive) + (let ((in-minibuffer (adjust-minibuffer-mode))) + (cond (canna:*japanese-mode* + (setq canna:*japanese-mode* nil) + (canna-abandon-undo-info) + (setq canna:*use-region-as-henkan-region* nil) + (setq canna:*saved-mode-string* mode-line-canna-mode) + (mode-line-canna-mode-update canna:*alpha-mode-string*) ) + (t + (setq canna:*japanese-mode* t) + (if (fboundp 'canna-query-mode) + (let ((new-mode (canna-query-mode))) + (if (string-equal new-mode "") + (setq canna:*kanji-mode-string* canna:*saved-mode-string*) + (setq canna:*kanji-mode-string* new-mode) + )) ) + (mode-line-canna-mode-update canna:*kanji-mode-string*) ) ) + (if in-minibuffer + (setq canna:*japanese-mode-in-minibuffer* canna:*japanese-mode*)) )) + +(defun canna:initialize () + (let ((init-val nil)) + (cond (canna:*initialized*) ; initialize $B$5$l$F$$$?$i2?$b$7$J$$(B + (t + (setq canna:*initialized* t) + (setq init-val (canna-initialize + (if canna-underline 0 1) + canna-server canna-file)) + (cond ((car (cdr (cdr init-val))) + (canna:output-warnings (car (cdr (cdr init-val)))) )) + (cond ((car (cdr init-val)) + (error (car (cdr init-val))) )) + ) ) + + (if (fboundp 'canna-query-mode) + (progn + (canna-change-mode canna-mode-alpha-mode) + (setq canna:*alpha-mode-string* (canna-query-mode)) )) + + (canna-do-function canna-func-japanese-mode) + + (if (fboundp 'canna-query-mode) + (setq canna:*kanji-mode-string* (canna-query-mode))) + + init-val)) + +(defun canna:finalize () + (cond ((null canna:*initialized*)) ; initialize $B$5$l$F$$$J$+$C$?$i2?$b$7$J$$(B + (t + (setq canna:*initialized* nil) + (let ((init-val (canna-finalize))) + (cond ((car (cdr (cdr init-val))) + (canna:output-warnings (car (cdr (cdr init-val)))) )) + (cond ((car (cdr init-val)) + (error (car (cdr init-val))) )) + ) + (message "$B!X$+$s$J!Y$N<-=q$r%;!<%V$7$^$9!#(B") + ))) + +(defun canna:enter-canna-mode () + (if (not canna:*initialized*) + (progn + (message "$B!X$+$s$J!Y$N=i4|2=$r9T$C$F$$$^$9(B....") + (canna:initialize) + (message "$B!X$+$s$J!Y$N=i4|2=$r9T$C$F$$$^$9(B....done") + )) + (canna-set-width (- (window-width (minibuffer-window)) + (minibuffer-prompt-width) + (if (and display-minibuffer-mode-in-minibuffer + (eq (selected-window) (minibuffer-window))) + (string-width + (let ((new-mode (canna-query-mode))) + (if (string-equal new-mode "") + canna:*saved-mode-string* + new-mode))) + 0))) + (setq canna:*local-map-backup* (current-local-map)) + (setq canna:*fence-mode* t) + (if (boundp 'buffer-disable-undo) ; append by knak 97.10.21 + (buffer-disable-undo (current-buffer))) ; append by knak 97.10.21 + (if (boundp 'disable-undo) + (setq disable-undo canna:*fence-mode*)) + (use-local-map canna-mode-map) ) + +(defun canna:enter-canna-mode-and-functional-insert () + (canna:enter-canna-mode) + (setq canna:*use-region-as-henkan-region* nil) + (setq unread-command-events (list last-command-event))) + +(defun canna:quit-canna-mode () + (cond (canna:*fence-mode* + (use-local-map canna:*local-map-backup*) + (setq canna:*fence-mode* nil) + (if canna:*exit-japanese-mode* + (progn + (setq canna:*exit-japanese-mode* nil) + (setq canna-mode-string canna:*alpha-mode-string*) + (if canna:*japanese-mode* + (canna-toggle-japanese-mode) + (mode-line-canna-mode-update canna:*alpha-mode-string*) ))) + (if (boundp 'buffer-disable-undo) ; append by knak 97.10.21 + (buffer-disable-undo (current-buffer))) ; append by knak 97.10.21 + (if (boundp 'disable-undo) + (setq disable-undo canna:*fence-mode*)) + )) + (set-marker canna:*region-start* nil) + (set-marker canna:*region-end* nil) + ) + +(defun canna-touroku () + "Register a word into a kana-to-kanji dictionary." + (interactive) +; (if canna:*japanese-mode* + (if (not canna:*fence-mode*) + (progn + (setq canna:*exit-japanese-mode* (not canna:*japanese-mode*)) + (canna:enter-canna-mode) + (canna:display-candidates (canna-touroku-string "")) ) + (beep) + )) + +(defun canna-without-newline (start end) + (and (not (eq start end)) + (or + (and (<= end (point)) + (save-excursion + (beginning-of-line) + (<= (point) start) )) + (and (<= (point) start) + (save-excursion + (end-of-line) + (<= end (point)) )) + ))) + +(defun canna-touroku-region (start end) + "Register a word which is indicated by region into a kana-to-kanji\n\ +dictionary." + (interactive "r") + (if (canna-without-newline start end) +; (if canna:*japanese-mode* + (if (not canna:*fence-mode*) + (progn + (setq canna:*use-region-as-henkan-region* nil) + (setq canna:*exit-japanese-mode* (not canna:*japanese-mode*)) + (canna:enter-canna-mode) + (canna:display-candidates + (canna-touroku-string (buffer-substring start end))) )) + (message "$B%j!<%8%g%s$,IT@5$G$9!#%L%k%j!<%8%g%s$+!"2~9T$,4^$^$l$F$$$^$9!#(B") + )) + +(defun canna-extend-mode () + "To enter an extend-mode of Canna." + (interactive "*") +; (if (and (not (eq (window-frame (minibuffer-window)) (selected-frame))) +; (not canna:*fence-mode*)) + ;; $B%_%K%P%C%U%!$rJ,N%$7$F$$$k;~$O0l;~E*$K%U%'%s%9%b!<%I$KF~$k(B + ;; $B$=$&$7$J$$$H%a%K%e!<$rA*$Y$J$$(B + ;; (focus$B$,%_%K%P%C%U%!$K9T$+$J$$$+$i(B) + (if (not canna:*fence-mode*) + (progn + (setq canna:*exit-japanese-mode* (not canna:*japanese-mode*)) + (canna:enter-canna-mode) + (canna:display-candidates + (canna-do-function canna-func-extend-mode) )) + (beep))) + +(defun canna-kigou-mode () + "Enter symbol choosing mode." + (interactive "*") +; (if canna:*japanese-mode* + (if (not canna:*fence-mode*) + (progn + (setq canna:*exit-japanese-mode* (not canna:*japanese-mode*)) + (canna:enter-canna-mode) + (canna:display-candidates (canna-change-mode canna-mode-kigo-mode)) ) + (beep) + )) + +(defun canna-hex-mode () + "Enter hex code entering mode." + (interactive "*") +; (if canna:*japanese-mode* + (if (not canna:*fence-mode*) + (progn + (setq canna:*exit-japanese-mode* (not canna:*japanese-mode*)) + (canna:enter-canna-mode) + (canna:display-candidates (canna-change-mode canna-mode-hex-mode)) ) + (beep) + )) + +(defun canna-bushu-mode () + "Enter special mode to convert by BUSHU name." + (interactive "*") +; (if canna:*japanese-mode* + (if (not canna:*fence-mode*) + (progn + (setq canna:*exit-japanese-mode* (not canna:*japanese-mode*)) + (canna:enter-canna-mode) + (canna:display-candidates (canna-change-mode canna-mode-bushu-mode)) ) + (beep) + )) + +(defun canna-reset () + (interactive) + (message "$B!X$+$s$J!Y$N<-=q$r%;!<%V$7$^$9!#(B"); + (canna:finalize) + (message "$B!X$+$s$J!Y$N:F=i4|2=$r9T$C$F$$$^$9(B....") + (canna:initialize) + (message "$B!X$+$s$J!Y$N:F=i4|2=$r9T$C$F$$$^$9(B....done") + ) + + +(defun canna () + (interactive) + (message "$B!X$+$s$J!Y$r=i4|2=$7$F$$$^$9(B....") + (let (init-val) + (cond ((and (fboundp 'canna-initialize) (fboundp 'canna-change-mode) ) + + ;; canna $B$,;H$($k;~$OuBV$G=i4|2=$9$kI,MW$,$"$k(B + (setq canna-underline (or canna:color-p canna-underline)) + (cond + (canna:color-p + (setq canna:attr-mode + (cond + ((or (and (boundp 'hilit-background-mode) + (eq hilit-background-mode 'dark)) + (string-match + "on\\|t" + (or (x-get-resource "ReverseVideo" "reverseVideo") + ""))) + 'reverse) ;$BH?E>$7$F$$$k$J$i(B 'reverse + (t 'normal))) + (setq canna:attr-yomi + (if (listp canna-use-color) + (car canna-use-color) + (cdr (assq canna:attr-mode + (assq 'yomi canna:attribute-alist))))) + (setq canna:attr-taishou + (if (listp canna-use-color) + (car (cdr canna-use-color)) + (setq canna:attr-taishou + (cdr (assq + canna:attr-mode + (assq 'taishou canna:attribute-alist)))))) + (setq canna:attr-select + (if (listp canna-use-color) + (car (cdr (cdr canna-use-color))) + (setq canna:attr-select + (cdr (assq canna:attr-mode + (assq 'select canna:attribute-alist)))))) + ;;$B?'$E$1MQ(Bface$B$N:n@.(B + (mapcar + (function + (lambda (face) + (let* ((color (symbol-value + (intern (concat "canna:" (symbol-name face))))) + backp) + (make-face face) + (if (stringp color) + (progn + (setq backp (string-match "/" color)) + (set-face-foreground + face (substring color 0 backp)) + (if backp + (set-face-background + face (substring color (1+ backp))))) + (copy-face color face))))) + '(attr-yomi attr-taishou attr-select)) + )) + ;;$BG[?'@_Dj=*N;(B + + ;; $B!X$+$s$J!Y%7%9%F%`$N=i4|2=(B + + (setq init-val (canna:initialize)) + + ;; $B%-!<$N%P%$%s%G%#%s%0(B + + (let ((ch 32)) + (while (< ch 127) + (define-key global-map (make-string 1 ch) 'canna-self-insert-command) + (setq ch (1+ ch)) )) + + (cond ((let ((keys (car init-val)) (ok nil)) + (while keys + (cond ((< (car keys) 128) + (global-set-key + (make-string 1 (car keys)) + 'canna-toggle-japanese-mode) + (setq ok t) )) + (setq keys (cdr keys)) + ) ok)) + (t ; $B%G%U%)%k%H$N@_Dj(B + (global-set-key "\C-o" 'canna-toggle-japanese-mode) )) + + (if (not (keymapp (global-key-binding "\e["))) + (global-unset-key "\e[") ) + (global-set-key "\e[210z" 'canna-toggle-japanese-mode) ; XFER + (define-key global-map [kanji] 'canna-toggle-japanese-mode) + (if canna-do-keybind-for-functionkeys + (progn + (global-set-key "\e[28~" 'canna-extend-mode) ; HELP on EWS4800 + (global-set-key "\e[2~" 'canna-kigou-mode) ; INS on EWS4800 + (global-set-key "\e[11~" 'canna-kigou-mode) + (global-set-key "\e[12~" 'canna-hex-mode) + (global-set-key "\e[13~" 'canna-bushu-mode) + (define-key global-map [help] 'canna-extend-mode) + (define-key global-map [insert] 'canna-kigou-mode) + (define-key global-map [f1] 'canna-kigou-mode) + (define-key global-map [f2] 'canna-hex-mode) + (define-key global-map [f3] 'canna-bushu-mode) + )) + + (if canna-use-space-key-as-henkan-region + (progn + (global-set-key "\C-@" 'canna-set-mark-command) + ;; X Window $B$O(B C-@ $B$H(B C-SPC $B$r6hJL$9$k$N$G!"$3$l$,I,MW!#(B + (global-set-key [?\C-\ ] 'canna-set-mark-command) + (global-set-key " " 'canna-henkan-region-or-self-insert) )) + + ;; $B%b!<%I9T$N:n@.(B + + (canna:create-mode-line) + (mode-line-canna-mode-update canna:*alpha-mode-string*) + + ;; $B%7%9%F%`4X?t$N=q$-BX$((B + +; (fset 'abort-recursive-edit +; (symbol-function 'canna:abort-recursive-edit)) +; (fset 'keyboard-quit +; (symbol-function 'canna:keyboard-quit)) + + ) + + ((fboundp 'canna-initialize) + (beep) + (with-output-to-temp-buffer "*canna-warning*" + (princ "$B$3$N(B Mule $B$G$O(B new-canna $B$,;H$($^$;$s(B") + (terpri) + (print-help-return-message)) ) + + (t ; $B!X$+$s$J!Y%7%9%F%`$,;H$($J$+$C$?;~$N=hM}(B + (beep) + (with-output-to-temp-buffer "*canna-warning*" + (princ "$B$3$N(B Mule $B$G$O(B canna $B$,;H$($^$;$s(B") + (terpri) + (print-help-return-message)) + )) + (message "$B!X$+$s$J!Y$r=i4|2=$7$F$$$^$9(B....done") + ) ) + +;;; +;;; auto fill controll (from egg) +;;; + +(defun canna:do-auto-fill () + (if (and auto-fill-function (not buffer-read-only) + (> (current-column) fill-column)) + (let ((ocolumn (current-column))) + (funcall auto-fill-function) + (while (and (< fill-column (current-column)) + (< (current-column) ocolumn)) + (setq ocolumn (current-column)) + (funcall auto-fill-function))))) + +(defun canna:output-warnings (mesg) + (with-output-to-temp-buffer "*canna-warning*" + (while mesg + (princ (car mesg)) + (terpri) + (setq mesg (cdr mesg)) ) + (print-help-return-message))) + +(defun canna-undo (&optional arg) + (interactive "*p") + (if (and canna:*undo-text-yomi* + (eq (current-buffer) (marker-buffer canna:*spos-undo-text*)) +; (canna-without-newline canna:*spos-undo-text* +; canna:*epos-undo-text*) + ) + (progn + (message "$BFI$_$KLa$7$^$9!*(B") +; (switch-to-buffer (marker-buffer canna:*spos-undo-text*)) + (goto-char canna:*spos-undo-text*) + (delete-region canna:*spos-undo-text* + canna:*epos-undo-text*) + + (if (null canna:*japanese-mode*) + (progn + (setq canna:*exit-japanese-mode* t) )) +; (canna-toggle-japanese-mode) )) + (if (not canna:*fence-mode*) + ;; $B%U%'%s%9%b!<%I$@$C$?$i$b$&0lEY%U%'%s%9%b!<%I$KF~$C$?$j$7(B + ;; $B$J$$!#(B + (canna:enter-canna-mode) ) + (canna:display-candidates +;; modified by knak 1998.9.17 +;; wide character no kazoe kata ga 20.3 kara kawatta tame +; (let ((texts (canna-store-yomi (car canna:*undo-text-yomi*) + (let ((texts (canna-store-yomi (if (and (>= emacs-major-version 20) + (>= emacs-minor-version 3)) + (progn + (encode-coding-string + (car canna:*undo-text-yomi*) + 'japanese-iso-8bit)) + (car canna:*undo-text-yomi*)) + (cdr canna:*undo-text-yomi*) )) ) + (cond (canna-undo-hook + (funcall canna-undo-hook)) + (t texts) ))) + (canna-abandon-undo-info) + ) + (canna-abandon-undo-info) +; (undo arg) + )) + +(defun canna-abandon-undo-info () + (interactive) + (setq canna:*undo-text-yomi* nil) + (set-marker canna:*spos-undo-text* nil) + (set-marker canna:*epos-undo-text* nil) ) + +(defun canna-henkan-region (start end) + "Convert a text which is indicated by region into a kanji text." + (interactive "*r") + (if (null canna:*japanese-mode*) + (progn + (setq canna:*exit-japanese-mode* t) )) +; (canna-toggle-japanese-mode) )) + (let ((res nil)) + (setq res (canna-store-yomi (buffer-substring start end))) + (delete-region start end) + (canna:enter-canna-mode) + (if (fboundp 'canna-do-function) + (setq res (canna-do-function canna-func-henkan))) + (canna:display-candidates res) )) + +;;; +;;; $B%^!<%/%3%^%s%I!$(Bcanna-henkan-region-or-self-insert $B$G;H$&$+$b(B +;;; + +(defun canna-set-mark-command (arg) + "Besides setting mark, set mark as a HENKAN region if it is in\n\ +the japanese mode." + (interactive "P") + (set-mark-command arg) + (if canna:*japanese-mode* + (progn + (setq canna:*use-region-as-henkan-region* t) + (message "Mark set($BJQ49NN0h3+;O(B)") ))) + +(defun canna-henkan-region-or-self-insert (arg) + "Do kana-to-kanji convert region if HENKAN region is defined,\n\ +self insert otherwise." + (interactive "*p") + (if (and canna:*use-region-as-henkan-region* +; (< (mark) (point)) +; (not (save-excursion (beginning-of-line) (< (mark) (point)))) ) + (canna-without-newline (region-beginning) (region-end))) + (progn + (setq canna:*use-region-as-henkan-region* nil) + (canna-henkan-region (region-beginning) (region-end))) + (canna-self-insert-command arg) )) + +;; +;; for C-mode +;; + +(defun canna-electric-c-terminator (arg) + (interactive "P") + (if canna:*japanese-mode* + (canna-self-insert-command arg) + (electric-c-terminator arg) )) + +(defun canna-electric-c-semi (arg) + (interactive "P") + (if canna:*japanese-mode* + (canna-self-insert-command arg) + (electric-c-semi arg) )) + +(defun canna-electric-c-brace (arg) + (interactive "P") + (if canna:*japanese-mode* + (canna-self-insert-command arg) + (electric-c-brace arg) )) + +(defun canna-c-mode-hook () + (define-key c-mode-map "{" 'canna-electric-c-brace) + (define-key c-mode-map "}" 'canna-electric-c-brace) + (define-key c-mode-map ";" 'canna-electric-c-semi) + (define-key c-mode-map ":" 'canna-electric-c-terminator) ) + +(defun canna-set-fence-mode-format (fence sep underline) + (setq canna-with-fences fence) + (canna-set-bunsetsu-kugiri sep) + (setq canna-underline underline) +) + +;; $B%j!<%8%g%s$K$"$k%m!<%^;z$r!X$+$s$J!Y$K?)$o$9!#(B +;; $B7k2L$H$7$F!"!X$+$s$J!Y$NFI$_%b!<%I$K$J$k!#(B +;; $B%j!<%8%g%s$KB8:_$7$F$$$k6uGrJ8;z$H@)8fJ8;z$O ch ? ) + (setq res (canna-do-function canna-func-functional-insert ch)) )) + (setq i (1+ i)) ) + res)) + +(defun canna-rk-trans-region (start end) + "Insert alpha-numeric string as it is sent from keyboard." + (interactive "*r") + (let ((res)) + (mark-undo-boundary) + (setq res (canna-rk-region start end)) + (delete-region start end) + (if (null canna:*japanese-mode*) + (progn + (setq canna:*exit-japanese-mode* t) )) + (setq res (canna-do-function canna-func-henkan)) + (canna:enter-canna-mode) + (canna:display-candidates res) )) + +;; $B%+!<%=%k$N:8$K$"$k(B arg $B%o!<%I$N%m!<%^;z$r!X$+$s$J!Y$K?)$o$9!#(B + +(defun canna-rk-trans (arg) + (interactive "*p") + (let ((po (point))) + (skip-chars-backward "-a-zA-Z.,?!~") + (if (not (eq (point) po)) + (canna-rk-trans-region (point) po) ))) + +(defun canna-henkan-kakutei-and-self-insert (arg) + (interactive "*p") + (if canna:*japanese-mode* + (canna-functional-insert-command arg) + (progn + (setq unread-command-events (list last-command-event)) + (canna-kakutei-to-basic-stat)) )) + +(defun canna-kakutei-to-basic-stat () + (let ((res 0) + (kakutei canna-henkan-string)) + (while (not canna-empty-info) +; (setq res (canna-key-proc ?\C-m))) + (setq res (canna-do-function canna-func-kakutei))) + (setq canna-kakutei-string kakutei) + (canna:display-candidates (length canna-kakutei-string)) + (if (not canna:*japanese-mode*) + (mode-line-canna-mode-update canna:*alpha-mode-string*)) + )) + +(defun canna-minibuffer-henkan-kakutei-and-self-insert (arg) + (interactive "p") + (set-window-buffer (minibuffer-window) canna:*saved-minibuffer*) + (select-window canna:*previous-window*) + (if canna:*japanese-mode* + (canna:functional-insert-command2 last-command-event arg) + (progn + (setq unread-command-events (list last-command-event)) + (canna-kakutei-to-basic-stat)) )) + +(defun canna-setup-for-being-boiled () + (let ((ch (1+ ? ))) + (while (< ch 127) + (define-key canna-mode-map (make-string 1 ch) 'canna-henkan-kakutei-and-self-insert) + (define-key canna-minibuffer-mode-map (make-string 1 ch) 'canna-minibuffer-henkan-kakutei-and-self-insert) + (setq ch (1+ ch))))) + +(defvar rK-trans-key "\C-j" "for `boil' only") +(make-variable-buffer-local 'rK-trans-key) + +(defun canna-boil () + "`canna-boil' cooks `canna' as if `boil' does for `egg'." + (interactive) + (canna-setup-for-being-boiled) + (local-set-key rK-trans-key 'canna-rk-trans) + (message "boiled")) + +;; +;; $B?'$E$1$N$?$a$N4X?t(B +;; +(defun canna:yomi-attr-on (start end) + (if (overlayp canna:*yomi-overlay*) + (move-overlay canna:*yomi-overlay* start end) + (overlay-put (setq canna:*yomi-overlay* (make-overlay start end nil nil t)) + 'face + (if canna:color-p 'attr-yomi 'underline)) + ) + ) + +(defun canna:yomi-attr-off (start end); + (and (overlayp canna:*yomi-overlay*) + (delete-overlay canna:*yomi-overlay*) + ) + ) + +(defun canna:henkan-attr-on (start end) + (if (overlayp canna:*henkan-overlay*) + (move-overlay canna:*henkan-overlay* start end) + (overlay-put (setq canna:*henkan-overlay* + (make-overlay start end nil nil t)) + 'face + (if canna:color-p 'attr-taishou 'region)) + ) + ) + +(defun canna:henkan-attr-off (start end) + (and (overlayp canna:*henkan-overlay*) + (delete-overlay canna:*henkan-overlay*) + ) + ) + +(defun canna:select-attr-on (start end) + (if (overlayp canna:*select-overlay*) + (move-overlay canna:*select-overlay* start end) + (overlay-put (setq canna:*select-overlay* + (make-overlay start end nil nil t)) + 'face + 'attr-select)) + ) + +(defun canna:select-attr-off (start end) + (and (overlayp canna:*select-overlay*) + (delete-overlay canna:*select-overlay*) + ) + ) + +; append by knak 1997.10.24 +(defun mark-undo-boundary () + (setq buffer-undo-list (append '(nil) buffer-undo-list))) + +(defun skip-undo-boundary () + (let ((ub buffer-undo-list) + (nub '(nil))) + (while (and (consp ub) (or (car ub) (nth 1 ub))) + (if (car ub) + (setq nub (append nub (list (car ub))))) + (setq ub (cdr ub))) + (setq buffer-undo-list (append nub (cdr ub))) )) diff -u --recursive --new-file emacs-20.3/src/Makefile.in emacs-20.3+canna/src/Makefile.in --- emacs-20.3/src/Makefile.in Sun Aug 2 09:29:21 1998 +++ emacs-20.3+canna/src/Makefile.in Fri Sep 11 00:23:46 1998 @@ -236,6 +236,22 @@ #define C_SWITCH_ASM #endif +#ifndef LIBS_MULE +# define LIBS_MULE +#endif /* LIBS_MULE */ + +#ifndef C_SWITCH_CANNA +# define C_SWITCH_CANNA +#endif /* C_SWITCH_CANNA */ + +#ifndef LD_SWITCH_CANNA +# define LD_SWITCH_CANNA +#endif /* LD_SWITCH_CANNA */ + +#ifndef LD_SWITCH_CANNA_AUX +# define LD_SWITCH_CANNA_AUX +#endif /* LD_SWITCH_CANNA_AUX */ + /* Figure out whether the system cpp can handle long names. Do it by testing it right now. If it loses, arrange to use the GNU cpp. */ @@ -457,7 +473,7 @@ #endif /* not ORDINARY_LINK */ ALL_LDFLAGS = LD_SWITCH_SYSTEM LD_SWITCH_SYSTEM_TEMACS LD_SWITCH_MACHINE \ - LD_SWITCH_MACHINE_TEMACS LD_SWITCH_SITE $(LDFLAGS) + LD_SWITCH_MACHINE_TEMACS LD_SWITCH_SITE LD_SWITCH_CANNA $(LDFLAGS) /* A macro which other sections of Makefile can redefine to munge the flags before they're passed to LD. This is helpful if you have @@ -506,12 +522,17 @@ #define MSDOS_OBJ #endif +#ifdef CANNA +# define CANNA_OBJ canna.o +#else /* not CANNA */ +# define CANNA_OBJ +#endif /* not CANNA */ /* lastfile must follow all files whose initialized data areas should be dumped as pure by dump-emacs. */ obj= dispnew.o frame.o scroll.o xdisp.o xmenu.o window.o \ charset.o coding.o category.o ccl.o\ - cm.o term.o xfaces.o $(XOBJ) \ + cm.o term.o xfaces.o $(XOBJ) CANNA_OBJ \ emacs.o keyboard.o macros.o keymap.o sysdep.o \ buffer.o filelock.o insdel.o marker.o INTERVAL_OBJ \ minibuf.o fileio.o dired.o filemode.o \ @@ -628,6 +649,12 @@ #define WINNT_SUPPORT #endif +#ifdef CANNA +#define CANNA_SUPPORT ${lispsource}canna.el +#else +#define CANNA_SUPPORT +#endif + /* List of Lisp files loaded into the dumped Emacs. It's arranged like this because it's easier to generate it semi-mechanically from loadup.el this way. @@ -703,6 +730,7 @@ VMS_SUPPORT \ MSDOS_SUPPORT \ WINNT_SUPPORT \ + CANNA_SUPPORT \ ${lispsource}widget.elc \ ${lispsource}window.elc \ ${lispsource}version.el @@ -780,13 +808,15 @@ ${dotdot}/lisp/select.elc ${dotdot}/lisp/scroll-bar.elc \ ${dotdot}/lisp/vmsproc.elc ${dotdot}/lisp/vms-patch.elc \ ${dotdot}/lisp/ls-lisp.elc ${dotdot}/lisp/dos-fns.elc \ - ${dotdot}/lisp/w32-fns.elc ${dotdot}/lisp/dos-w32.elc + ${dotdot}/lisp/w32-fns.elc ${dotdot}/lisp/dos-w32.elc \ + ${dotdot}/lisp/canna.el /* Construct full set of libraries to be linked. Note that SunOS needs -lm to come before -lc; otherwise, you get duplicated symbols. If the standard libraries were compiled with GCC, we might need gnulib again after them. */ LIBES = $(LOADLIBES) $(LDLIBS) $(LIBX) LIBS_SYSTEM LIBS_MACHINE LIBS_TERMCAP \ + LIBS_MULE \ LIBS_DEBUG $(GNULIB_VAR) LIB_MATH LIB_STANDARD $(GNULIB_VAR) /* Enable recompilation of certain other files depending on system type. */ @@ -1116,6 +1146,11 @@ $(config_h) dispextern.h msdos.h lread.o: lread.c commands.h keyboard.h buffer.h paths.h charset.h $(config_h) \ termhooks.h msdos.h + +#ifdef CANNA +canna.o: canna.c buffer.h charset.h $(config_h) + $(CC) -c $(CPPFLAGS) $(ALL_CFLAGS) C_SWITCH_CANNA $< +#endif /* Text properties support */ textprop.o: textprop.c buffer.h window.h intervals.h $(config_h) diff -u --recursive --new-file emacs-20.3/src/canna.c emacs-20.3+canna/src/canna.c --- emacs-20.3/src/canna.c Thu Jan 1 09:00:00 1970 +++ emacs-20.3+canna/src/canna.c Sat Aug 22 01:42:33 1998 @@ -0,0 +1,1355 @@ +/* + CANNA interface for NEmacs + + This file is a part of Canna on Nemacs. + + Canna on Nemacs is distributed in the forms of patches + to Nemacs under the terms of the GNU EMACS GENERAL + PUBLIC LICENSE which is distributed along with GNU Emacs + by the Free Software Foundation. + + Canna on Nemacs is distributed in the hope that it will + be useful, but WITHOUT ANY WARRANTY; without even the + implied warranty of MERCHANTABILITY or FITNESS FOR A + PARTICULAR PURPOSE. See the GNU EMACS GENERAL PUBLIC + LICENSE for more details. + + You should have received a copy of the GNU EMACS GENERAL + PUBLIC LICENSE along with Nemacs; see the file COPYING. + If not, write to the Free Software Foundation, 675 Mass + Ave, Cambridge, MA 02139, USA. + + Authors: Akira Kon (kon@d1.bs2.mt.nec.co.jp) + Ichiro Hirakura (hirakura@uxp.bs2.mt.nec.co.jp) + + Functions defined in this file are + + (canna-key-proc key) + key: single STRING + RETURNS: + Length of converted string if no error occurs. + Error string if error occurs. + DESCRIPTION: + Convert a key input to a set of strings. The + strings contain both well-formed string and a + intermediate result to show the translation + information to a user. converted strings are + stored in specific variables. + + (canna-initialize) + RETURNS: + List of the following things: + - list of keys to toggle Japanese-mode + - error message + - list of warning messages + DESCRIPTION: + Initialize ``canna'', which is a kana-to-kanji + converter for GNU Emacs. The first arg + specifies if inserting space character between + BUNSETSU when candidates are displayed. The + second arg specifies server. The third arg + specifies a file which will be used as a + customization description. If nil is + specified for each arg, the default value will + be used. + + (canna-finalize) + RETURNS: + list of warning messages + DESCRIPTION: + finalize ``canna'', which is a kana-to-kanji + converter for GNU Emacs. This cause to write + miscellaneous informations to kana-to-kanji + dictionary. + + (canna-touroku-string string) + string: + String to register to a dictionary. + RETURNS: + The same thing returns as canna-key-proc does. + DESCRIPTION: + Register Kanji words into kana-to-kanji + conversion dictionary. + + (canna-set-width width) + width: + Column width of the place where the candidates + of kana-to-kanji conversion will be shown. + RETURNS: + nil + DESCRIPTION: + Set status-line width information, which is + used to display kanji candidates. + + (canna-change-mode num) + num: + The mode number of Canna. + RETURNS: + The same thing returns as canna-key-proc does. + DESCRIPTION: + Change Japanese pre-edit mode. + + (canna-store-yomi yomi roma) + yomi: + ``Yomi'' to be stored. + roma: + ``Romaji'' which corresponds to the ``Yomi''. + RETURNS: + The same thing returns as canna-key-proc does. + DESCRIPTION: + Store yomi characters as a YOMI of + kana-to-kanji conversion. + + (canna-do-function num ch) + num: + A function number to be called. + ch: + A character will be specified in order to feed + the character to the function if the function + needs a input character. + RETURNS: + The same thing returns as canna-key-proc does. + DESCRIPTION: + Do specified function at current mode. + + (canna-parse string) + string: + To be parsed. + RETURNS: + List of warning messages. + DESCRIPTION: + Parse customize string. + + (canna-query-mode) + RETURNS: + A string which indicate the current mode. + DESCRIPTION: + Get current mode string. + + Functions below are used for KKCP compatible library. These + functions provides a base kana-to-kanji conversion system for EGG. + These functions may be used when users want to change the engine + from Wnn to Canna without changing user interface of Japanese input. + + (canna-henkan-begin) + (canna-henkan-next) + (canna-bunsetu-henkou) + (canna-henkan-kakutei) + (canna-henkan-end) + (canna-henkan-quit) + + */ + +#ifndef lint +static char rcs_id[] = "$Id: canna.c,v 1.35 1994/03/15 08:00:03 kon Exp $"; +#endif + +#include + +#include "config.h" +#include "lisp.h" +#include "buffer.h" +#ifdef CANNA_MULE +#include "charset.h" +#include "coding.h" +#endif + +#ifdef CANNA2 +#define IROHA_BC +#include "canna/jrkanji.h" +#include "canna/RK.h" +#else /* !CANNA2 */ +#include "iroha/jrkanji.h" +#include "iroha/RK.h" +#endif /* !CANNA2 */ +extern char *jrKanjiError; + +#define KEYTOSTRSIZE 2048 +static unsigned char buf[KEYTOSTRSIZE]; +static char **warning; + +static int Vcanna_empty_info, Vcanna_through_info; +static int Vcanna_underline; +static int Vcanna_inhibit_hankakukana; /* hir, 1994.12.5 */ + +static Lisp_Object Vcanna_kakutei_string; +static Lisp_Object Vcanna_kakutei_yomi; +static Lisp_Object Vcanna_kakutei_romaji; +static Lisp_Object Vcanna_henkan_string; +static int Vcanna_henkan_length; +static int Vcanna_henkan_revPos; +static int Vcanna_henkan_revLen; +static Lisp_Object Vcanna_ichiran_string; +static int Vcanna_ichiran_length; +static int Vcanna_ichiran_revPos; +static int Vcanna_ichiran_revLen; +static Lisp_Object Vcanna_mode_string; + +static int IRCP_context; + +#if __STDC__ +static Lisp_Object storeResults(unsigned char *, int, jrKanjiStatus *); +static Lisp_Object kanjiYomiList(int, int); +#else +static Lisp_Object storeResults(); +static Lisp_Object kanjiYomiList(); +#endif + +#ifdef CANNA_MULE +#if __STDC__ +static m2c(unsigned char *, int, unsigned char *); +static Lisp_Object mule_make_string(unsigned char *, int); +static mule_strlen(unsigned char *, int); +static count_char(unsigned char *,int, int, int, int *, int *, int *); +#else +static m2c(); +static Lisp_Object mule_make_string(); +static mule_strlen(); +static count_char(); +#endif +#define make_string mule_make_string +#endif + +/* Lisp functions definition */ + +DEFUN ("canna-key-proc", Fcanna_key_proc, Scanna_key_proc, + 1, 1, 0, +"Translate a key input to a set of strings. The strings contain both\n\ +well-formed string and intermediate result to show the translation\n\ +information to a user. Converted strings are stored in specific\n\ +variables.") + (ch) +Lisp_Object ch; +{ + jrKanjiStatus ks; + int len; + + CHECK_NUMBER (ch, 0); + len = jrKanjiString(0, XINT (ch), buf, KEYTOSTRSIZE, &ks); + return storeResults(buf, len, &ks); +} + +static +Lisp_Object +storeResults(buf, len, ks) +unsigned char *buf; +int len; +jrKanjiStatus *ks; +{ + Lisp_Object val = Qnil; + + if (len < 0) { /* Error detected */ + val = make_string((unsigned char*)jrKanjiError, strlen(jrKanjiError)); + } + else { + /* 確定した文字列 */ + Vcanna_kakutei_string = make_string(buf, len); + val = make_number(len); + /* 確定した文字列の読みの情報... */ + Vcanna_kakutei_yomi = Vcanna_kakutei_romaji = Qnil; + if (ks->info & KanjiYomiInfo) { + unsigned char *p = buf + len + 1; + int yomilen = strlen(p); + + if (len + yomilen + 1 < KEYTOSTRSIZE) { + int yomilen2; + + Vcanna_kakutei_yomi = make_string(p, yomilen); /* 読み */ + p += yomilen + 1; + yomilen2 = strlen(p); + if (len + yomilen + yomilen2 + 2 < KEYTOSTRSIZE) { + Vcanna_kakutei_romaji = make_string(p, yomilen2); /* ローマ字 */ + } + } + } + + + /* 候補表示の文字列です。*/ + Vcanna_henkan_string = Qnil; + if (ks->length >= 0) { + Vcanna_henkan_string = make_string(ks->echoStr, ks->length); +#ifndef CANNA_MULE + Vcanna_henkan_length = ks->length; + Vcanna_henkan_revPos = ks->revPos; + Vcanna_henkan_revLen = ks->revLen; +#else /* CANNA_MULE */ + if (Vcanna_underline) { + Vcanna_henkan_length = mule_strlen(ks->echoStr,ks->length); + Vcanna_henkan_revPos = mule_strlen(ks->echoStr,ks->revPos); + Vcanna_henkan_revLen = mule_strlen(ks->echoStr+ks->revPos,ks->revLen); + } + else { + count_char(ks->echoStr, ks->length, ks->revPos, ks->revLen, + &Vcanna_henkan_length, &Vcanna_henkan_revPos, + &Vcanna_henkan_revLen); + } +#endif /* CANNA_MULE */ + } + + /* 一覧の情報 */ + Vcanna_ichiran_string = Qnil; + if (ks->info & KanjiGLineInfo && ks->gline.length >= 0) { + Vcanna_ichiran_string = make_string(ks->gline.line, ks->gline.length); +#ifndef CANNA_MULE + Vcanna_ichiran_length = ks->gline.length; + Vcanna_ichiran_revPos = ks->gline.revPos; + Vcanna_ichiran_revLen = ks->gline.revLen; +#else /* CANNA_MULE */ + count_char(ks->gline.line, ks->gline.length, + ks->gline.revPos, ks->gline.revLen, &Vcanna_ichiran_length, + &Vcanna_ichiran_revPos, &Vcanna_ichiran_revLen); +#endif /* CANNA_MULE */ + } + + /* モードの情報 */ + Vcanna_mode_string = Qnil; + if (ks->info & KanjiModeInfo) { + Vcanna_mode_string = make_string(ks->mode, strlen(ks->mode)); + } + + /* その他の情報 */ + Vcanna_empty_info = (ks->info & KanjiEmptyInfo) ? 1 : 0; + Vcanna_through_info = (ks->info & KanjiThroughInfo) ? 1 : 0; + } + + return val; +} + +DEFUN ("canna-set-bunsetsu-kugiri", Fcanna_set_bunsetsu, Scanna_set_bunsetsu, + 0, 1, 0, +"This function sets the clause separator.\n\ +If non-nil value is specified, the white space separator will be used.\n\ +No separator will be used otherwise.") + (num) + Lisp_Object num; +{ + int kugiri; /* 文節区切りをするか? */ + + kugiri = NILP(num) ? 0 : 1; + + jrKanjiControl(0, KC_SETBUNSETSUKUGIRI, (char *)kugiri); + + return Qnil; +} + +DEFUN ("canna-initialize", Fcanna_initialize, Scanna_initialize, 0, 3, 0, +"Initialize ``canna'', which is a kana-to-kanji converter for GNU Emacs.\n\ +The first arg specifies if inserting space character between BUNSETSU when\n\ +candidates are displayed.\n\ +The second arg specifies server.\n\ +The third arg specifies a file which will be used as a customization\n\ +description.\n\ +If nil is specified for each arg, the default value will be used.") +(num, server, rcfile) +Lisp_Object num, server, rcfile; +{ + Lisp_Object val; + int res; + unsigned char **p, **q; + + int kugiri; /* 文節区切りをするか? */ + + IRCP_context = -1; + + if (NILP(num)) { + kugiri = 1; + } + else { + CHECK_NUMBER(num, 0); + kugiri = XINT(num); + kugiri = (kugiri == 1) ? 1 : 0; + } + + if (NILP(server)) { + jrKanjiControl(0, KC_SETSERVERNAME, (char *)0); + } + else { + char servername[256]; + + CHECK_STRING(server, 0); + strncpy(servername, XSTRING(server)->data, XSTRING(server)->size); + servername[XSTRING(server)->size] = '\0'; + jrKanjiControl(0, KC_SETSERVERNAME, servername); + } + + if (NILP(rcfile)) { + jrKanjiControl(0, KC_SETINITFILENAME, (char *)0); + } + else { + char rcname[256]; + + CHECK_STRING(rcfile, 0); + strncpy(rcname, XSTRING(rcfile)->data, XSTRING(rcfile)->size); + rcname[XSTRING(rcfile)->size] = '\0'; + jrKanjiControl(0, KC_SETINITFILENAME, rcname); + } + + warning = (char **)0; +#ifdef nec_ews_svr4 /* hir, 1994.2.24 */ + stop_polling (); +#endif /* nec_ews_svr4 */ + res = jrKanjiControl(0, KC_INITIALIZE, (char *)&warning); +#ifdef nec_ews_svr4 /* hir, 1994.2.24 */ + start_polling (); +#endif /* nec_ews_svr4 */ + val = Qnil; + if (warning) { + for (p = q = (unsigned char **)warning ; *q ; q++) + ; + while (p < q) { + q--; + val = Fcons(make_string(*q, strlen(*q)), val); + } + } + val = Fcons(val, Qnil); + + if (res == -1) { + val = Fcons(make_string((unsigned char*)jrKanjiError, + strlen(jrKanjiError)), val); + /* イニシャライズで失敗した場合。 */ + return Fcons(Qnil, val); + } + else { + extern (*jrBeepFunc)(); + Lisp_Object Fding(), CANNA_mode_keys(); + + jrBeepFunc = Fding; + +#ifdef KC_SETAPPNAME +#ifndef CANNA_MULE + wcKanjiControl(0, KC_SETAPPNAME, "nemacs"); +#else /* CANNA_MULE */ + wcKanjiControl(0, KC_SETAPPNAME, "mule"); +#endif /* CANNA_MULE */ +#endif /* KC_SETAPPNAME */ + + jrKanjiControl(0, KC_SETBUNSETSUKUGIRI, (char *)kugiri); + jrKanjiControl(0, KC_SETWIDTH, (char *)78); +#ifndef CANNA_MULE + jrKanjiControl(0, KC_INHIBITHANKAKUKANA, (char *)1); +#else /* hir, 1994.12.5 */ + /* mule だったら半角カタカナも使える */ + if (Vcanna_inhibit_hankakukana) + jrKanjiControl(0, KC_INHIBITHANKAKUKANA, (char *)1); +#endif + jrKanjiControl(0, KC_YOMIINFO, (char *)2); /* ※2: ローマ字まで返す */ + val = Fcons(Qnil, val); + return Fcons(CANNA_mode_keys(), val); + } +} + +DEFUN ("canna-finalize", Fcanna_finalize, Scanna_finalize, 0, 0, 0, +"finalize ``canna'', which is a kana-to-kanji converter for GNU Emacs.\n\ +This cause to write miscellaneous informations to kana-to-kanji dictionary.") +() +{ + Lisp_Object val; + unsigned char **p; + + jrKanjiControl(0, KC_FINALIZE, (char *)&warning); + + val = Qnil; + if (warning) { + for (p = (unsigned char**)warning ; *p ; p++) { + val = Fcons(make_string(*p, strlen(*p)), val); + } + } + val = Fcons(val, Qnil); + IRCP_context = -1; + return val; +} + +DEFUN ("canna-touroku-string", Fcanna_touroku_string, + Scanna_touroku_string, 1, 1, 0, +"Register Kanji words into kana-to-kanji conversion dictionary.") + (str) +Lisp_Object str; +{ + jrKanjiStatusWithValue ksv; + jrKanjiStatus ks; + int len; + Lisp_Object val; +#ifdef CANNA_MULE + unsigned char cbuf[4096]; +#endif + + CHECK_STRING(str, 0); + ksv.buffer = (unsigned char *)buf; + ksv.bytes_buffer = KEYTOSTRSIZE; +#ifndef CANNA_MULE + ks.echoStr = XSTRING (str)->data; + ks.length = XSTRING (str)->size; +#else /* CANNA_MULE */ + m2c(XSTRING (str)->data, XSTRING (str)->size, cbuf); + ks.echoStr = cbuf; + ks.length = strlen(cbuf); +#endif /* CANNA_MULE */ + ksv.ks = &ks; + len = jrKanjiControl(0, KC_DEFINEKANJI, (char *)&ksv); + val = storeResults(buf, ksv.val, ksv.ks); + return val; +} + +DEFUN ("canna-set-width", Fcanna_set_width, + Scanna_set_width, 1, 1, 0, +"Set status-line width information, which is used to display \n\ +kanji candidates.") + (num) +Lisp_Object num; +{ + CHECK_NUMBER(num, 0); + + jrKanjiControl(0, KC_SETWIDTH, (char *)XINT (num)); + return Qnil; +} + +DEFUN ("canna-change-mode", Fcanna_change_mode, + Scanna_change_mode, 1, 1, 0, +"Change Japanese pre-edit mode.") + (num) +Lisp_Object num; +{ + jrKanjiStatusWithValue ksv; + jrKanjiStatus ks; + Lisp_Object val; + + CHECK_NUMBER(num, 0); + + ksv.buffer = (unsigned char *)buf; + ksv.bytes_buffer = KEYTOSTRSIZE; + ksv.ks = &ks; + ksv.val = XINT (num); + jrKanjiControl(0, KC_CHANGEMODE, (char *)&ksv); + val = storeResults(buf, ksv.val, ksv.ks); + return val; +} + +Lisp_Object +CANNA_mode_keys() +{ +#define CANNAWORKBUFSIZE 32 + char xxx[CANNAWORKBUFSIZE]; + Lisp_Object val; + int i, n; + + n = jrKanjiControl(0, KC_MODEKEYS, xxx); + val = Qnil; + for (i = n ; i > 0 ;) { + --i; + val = Fcons(make_number((int)(0xFF & (unsigned char)xxx[i])), val); + } + return val; +} + +DEFUN ("canna-store-yomi", Fcanna_store_yomi, Scanna_store_yomi, + 1, 2, 0, +"Store yomi characters as a YOMI of kana-to-kanji conversion.") + (yomi, roma) +Lisp_Object yomi, roma; +{ + jrKanjiStatusWithValue ksv; + jrKanjiStatus ks; + + CHECK_STRING(yomi, 0); +#ifndef CANNA_MULE + strncpy(buf, XSTRING(yomi)->data, XSTRING(yomi)->size); + ks.length = XSTRING (yomi)->size; + buf[ks.length] = '\0'; +#else /* CANNA_MULE */ + m2c(XSTRING(yomi)->data, XSTRING(yomi)->size, buf); + ks.length = strlen(buf); +#endif /* CANNA_MULE */ + + if (NILP(roma)) { + ks.mode = 0; + } + else { + CHECK_STRING(roma, 0); + +#ifndef CANNA_MULE + strncpy(buf + XSTRING(yomi)->size + 1, XSTRING(roma)->data, + XSTRING(roma)->size); + buf[XSTRING(yomi)->size + 1 + XSTRING(roma)->size] = '\0'; + ks.mode = (unsigned char *)(buf + XSTRING(yomi)->size + 1); +#else /* CANNA_MULE */ + ks.mode = (unsigned char *)(buf + ks.length + 1); + m2c(XSTRING(roma)->data, XSTRING(roma)->size, ks.mode); +#endif /* CANNA_MULE */ + } + + ks.echoStr = (unsigned char *)buf; + ksv.buffer = (unsigned char *)buf; /* 返値用 */ + ksv.bytes_buffer = KEYTOSTRSIZE; + ksv.ks = &ks; + + jrKanjiControl(0, KC_STOREYOMI, (char *)&ksv); + + return storeResults(buf, ksv.val, ksv.ks); +} + +DEFUN ("canna-do-function", Fcanna_do_function, Scanna_do_function, + 1, 2, 0, +"Do specified function at current mode.") + (num, ch) +Lisp_Object num, ch; +{ + jrKanjiStatusWithValue ksv; + jrKanjiStatus ks; + Lisp_Object val; + + CHECK_NUMBER(num, 0); + + if (NILP(ch)) { + *buf = '@'; + } + else { + CHECK_NUMBER(ch, 0); + *buf = XINT (ch); + } + + ksv.buffer = (unsigned char *)buf; + ksv.bytes_buffer = KEYTOSTRSIZE; + ksv.ks = &ks; + ksv.val = XINT (num); + jrKanjiControl(0, KC_DO, (char *)&ksv); + val = storeResults(buf, ksv.val, ksv.ks); + return val; +} + +DEFUN ("canna-parse", Fcanna_parse, Scanna_parse, + 1, 1, 0, +"Parse customize string.") + (str) +Lisp_Object str; +{ + jrKanjiStatusWithValue ksv; + jrKanjiStatus ks; + Lisp_Object val; + unsigned char **p; + int n; + + CHECK_STRING(str, 0); + +#ifndef CANNA_MULE + strncpy(buf, XSTRING(str)->data, XSTRING(str)->size); + buf[XSTRING(str)->size] = '\0'; +#else /* CANNA_MULE */ + m2c(XSTRING(str)->data, XSTRING(str)->size, buf); +#endif /* CANNA_MULE */ + p = (unsigned char**)buf; + n = jrKanjiControl(0, KC_PARSE, (char *)&p); + val = Qnil; + while (n > 0) { + n--; + val = Fcons(make_string(p[n], strlen(p[n])), val); + } + return val; +} + +DEFUN ("canna-query-mode", Fcanna_query_mode, Scanna_query_mode, + 0, 0, 0, +"Get current mode string.") + () +{ + unsigned char buf[256]; + + jrKanjiControl(0, KC_QUERYMODE, buf); + return make_string(buf, strlen(buf)); +} + +/* + * Functions following this line are for KKCP interface compatible + * library. These functions may be used by MILK system. + */ + +#define RKBUFSIZE 1024 + +static unsigned char yomibuf[RKBUFSIZE]; +static short kugiri[RKBUFSIZE / 2]; + +static confirmContext() +{ + if (IRCP_context < 0) { + int context; + + if ((context = jrKanjiControl(0, KC_GETCONTEXT, (char *)0)) == -1) { + return 0; + } + IRCP_context = context; + } + return 1; +} + +static byteLen(bun, len) +int bun, len; +{ + int i = 0, offset = 0, ch; + + if (0 <= bun && bun < RKBUFSIZE) { + offset = kugiri[bun]; + } + + while (len-- > 0 && (ch = (int)yomibuf[offset + i])) { + i++; + if (ch & 0x80) { + i++; + } + } + return i; +} + +DEFUN ("canna-henkan-begin", Fcanna_henkan_begin, Scanna_henkan_begin, + 1, 1, 0, +"かな漢字変換した結果を返還する。文節切りがしてある。") + (yomi) + Lisp_Object yomi; +{ + int nbun; + Lisp_Object res; + + CHECK_STRING(yomi, 0); + if (confirmContext() == 0) { + return Qnil; + } +#ifndef CANNA_MULE + strncpy(yomibuf, XSTRING(yomi)->data, XSTRING(yomi)->size); + yomibuf[XSTRING(yomi)->size] = '\0'; + nbun = RkBgnBun(IRCP_context, XSTRING(yomi)->data, XSTRING(yomi)->size, + (RK_XFER << RK_XFERBITS) | RK_KFER); +#else /* CANNA_MULE */ + m2c(XSTRING(yomi)->data, XSTRING(yomi)->size, yomibuf); + nbun = RkBgnBun(IRCP_context, (char *)yomibuf, strlen(yomibuf), + (RK_XFER << RK_XFERBITS) | RK_KFER); +#endif /* CANNA_MULE */ + + return kanjiYomiList(IRCP_context, nbun); +} + +static Lisp_Object kanjiYomiList(context, nbun) +int context, nbun; +{ + Lisp_Object val, res = Qnil; + unsigned char RkBuf[RKBUFSIZE]; + int len, i, total; + + for (i = nbun ; i > 0 ; ) { + i--; + RkGoTo(context, i); + len = RkGetKanji(context, RkBuf, RKBUFSIZE); + val = make_string(RkBuf, len); + len = RkGetYomi(context, RkBuf, RKBUFSIZE); + res = Fcons(Fcons(val, make_string(RkBuf, len)), res); + if (i < RKBUFSIZE / 2) { + kugiri[i] = len; + } + } + for (i = 0, total = 0 ; i < nbun ; i++) { + int temp = kugiri[i]; + kugiri[i] = total; + total += temp; + } + return res; +} + +DEFUN ("canna-henkan-next", Fcanna_henkan_next, Scanna_henkan_next, + 1, 1, 0, +"候補一覧を求める。") + (bunsetsu) + Lisp_Object bunsetsu; +{ + int i, nbun, slen, len; + unsigned char *p, RkBuf[RKBUFSIZE]; + Lisp_Object res = Qnil, endp; + + CHECK_NUMBER(bunsetsu, 0); + if (confirmContext() == 0) { + return Qnil; + } + RkGoTo(IRCP_context, XINT (bunsetsu)); + len = RkGetKanjiList(IRCP_context, RkBuf, RKBUFSIZE); + p = RkBuf; + for (i = 0 ; i < len ; i++) { + slen = strlen(p); + if (res == Qnil) { + endp = res = Fcons(make_string(p, slen), Qnil); + } + else { + endp = XCONS (endp)->cdr = Fcons(make_string(p, slen), Qnil); + } + p += slen + 1; + } + return res; +} + +DEFUN ("canna-bunsetu-henkou", Fcanna_bunsetu_henkou, Scanna_bunsetu_henkou, + 2, 2, 0, +"文節の長さを指定する。") + (bunsetsu, bunlen) + Lisp_Object bunsetsu, bunlen; +{ + int nbun, len; + + CHECK_NUMBER(bunsetsu, 0); + CHECK_NUMBER(bunlen, 0); + + nbun = XINT (bunsetsu); + if (confirmContext() == 0) { + return Qnil; + } + RkGoTo(IRCP_context, nbun); + len = byteLen(nbun, XINT(bunlen)); + return kanjiYomiList(IRCP_context, RkResize(IRCP_context, len)); +} + +DEFUN ("canna-henkan-kakutei", Fcanna_henkan_kakutei, Scanna_henkan_kakutei, + 2, 2, 0, +"候補選択。") + (bun, kouho) +register Lisp_Object bun, kouho; +{ + if (confirmContext() == 0) { + return Qnil; + } + RkGoTo(IRCP_context, bun); + RkXfer(IRCP_context, kouho); + return Qt; +} + +DEFUN ("canna-henkan-end", Fcanna_henkan_end, Scanna_henkan_end, + 0, 0, 0, +"変換終了。") + () +{ + if (confirmContext() == 0) { + return Qnil; + } + RkEndBun(IRCP_context, 1); /* 学習はいつでも行って良いものなのか? */ + return Qt; +} + +DEFUN ("canna-henkan-quit", Fcanna_henkan_quit, Scanna_henkan_quit, + 0, 0, 0, +"変換終了。") + () +{ + if (confirmContext() == 0) { + return Qnil; + } + RkEndBun(IRCP_context, 0); + return Qt; +} + +/* variables below this line is constants of Canna */ + +static int Vcanna_mode_AlphaMode = IROHA_MODE_AlphaMode; +static int Vcanna_mode_EmptyMode = IROHA_MODE_EmptyMode; +static int Vcanna_mode_KigoMode = IROHA_MODE_KigoMode; +static int Vcanna_mode_YomiMode = IROHA_MODE_YomiMode; +static int Vcanna_mode_JishuMode = IROHA_MODE_JishuMode; +static int Vcanna_mode_TankouhoMode = IROHA_MODE_TankouhoMode; +static int Vcanna_mode_IchiranMode = IROHA_MODE_IchiranMode; +static int Vcanna_mode_YesNoMode = IROHA_MODE_YesNoMode; +static int Vcanna_mode_OnOffMode = IROHA_MODE_OnOffMode; +#ifdef CANNA_MODE_AdjustBunsetsuMode +static int Vcanna_mode_AdjustBunsetsuMode = CANNA_MODE_AdjustBunsetsuMode; +#endif +#ifdef CANNA_MODE_ChikujiYomiMode +static int Vcanna_mode_ChikujiYomiMode = CANNA_MODE_ChikujiYomiMode; +static int Vcanna_mode_ChikujiTanMode = CANNA_MODE_ChikujiTanMode; +#endif + +static int Vcanna_mode_HenkanMode = IROHA_MODE_HenkanMode; +#ifdef CANNA_MODE_HenkanNyuryokuMode +static int Vcanna_mode_HenkanNyuryokuMode = CANNA_MODE_HenkanNyuryokuMode; +#endif +#ifdef CANNA_MODE_ZenHiraHenkanMode +static int Vcanna_mode_ZenHiraHenkanMode = CANNA_MODE_ZenHiraHenkanMode; +#ifdef CANNA_MODE_HanHiraHenkanMode +static int Vcanna_mode_HanHiraHenkanMode = CANNA_MODE_HanHiraHenkanMode; +#endif +static int Vcanna_mode_ZenKataHenkanMode = CANNA_MODE_ZenKataHenkanMode; +static int Vcanna_mode_HanKataHenkanMode = CANNA_MODE_HanKataHenkanMode; +static int Vcanna_mode_ZenAlphaHenkanMode = CANNA_MODE_ZenAlphaHenkanMode; +static int Vcanna_mode_HanAlphaHenkanMode = CANNA_MODE_HanAlphaHenkanMode; +#endif +static int Vcanna_mode_ZenHiraKakuteiMode = IROHA_MODE_ZenHiraKakuteiMode; +#ifdef CANNA_MODE_HanHiraKakuteiMode +static int Vcanna_mode_HanHiraKakuteiMode = CANNA_MODE_HanHiraKakuteiMode; +#endif +static int Vcanna_mode_ZenKataKakuteiMode = IROHA_MODE_ZenKataKakuteiMode; +static int Vcanna_mode_HanKataKakuteiMode = IROHA_MODE_HanKataKakuteiMode; +static int Vcanna_mode_ZenAlphaKakuteiMode = IROHA_MODE_ZenAlphaKakuteiMode; +static int Vcanna_mode_HanAlphaKakuteiMode = IROHA_MODE_HanAlphaKakuteiMode; +static int Vcanna_mode_HexMode = IROHA_MODE_HexMode; +static int Vcanna_mode_BushuMode = IROHA_MODE_BushuMode; +static int Vcanna_mode_ExtendMode = IROHA_MODE_ExtendMode; +static int Vcanna_mode_RussianMode = IROHA_MODE_RussianMode; +static int Vcanna_mode_GreekMode = IROHA_MODE_GreekMode; +static int Vcanna_mode_LineMode = IROHA_MODE_LineMode; +static int Vcanna_mode_ChangingServerMode = IROHA_MODE_ChangingServerMode; +static int Vcanna_mode_HenkanMethodMode = IROHA_MODE_HenkanMethodMode; +static int Vcanna_mode_DeleteDicMode = IROHA_MODE_DeleteDicMode; +static int Vcanna_mode_TourokuMode = IROHA_MODE_TourokuMode; +static int Vcanna_mode_TourokuEmptyMode = IROHA_MODE_TourokuEmptyMode; +static int Vcanna_mode_TourokuHinshiMode = IROHA_MODE_TourokuHinshiMode; +static int Vcanna_mode_TourokuDicMode = IROHA_MODE_TourokuDicMode; +static int Vcanna_mode_QuotedInsertMode = IROHA_MODE_QuotedInsertMode; +static int Vcanna_mode_BubunMuhenkanMode = IROHA_MODE_BubunMuhenkanMode; +static int Vcanna_mode_MountDicMode = IROHA_MODE_MountDicMode; + +static int Vcanna_fn_SelfInsert = IROHA_FN_SelfInsert; +static int Vcanna_fn_FunctionalInsert = IROHA_FN_FunctionalInsert; +static int Vcanna_fn_QuotedInsert = IROHA_FN_QuotedInsert; +static int Vcanna_fn_JapaneseMode = IROHA_FN_JapaneseMode; +static int Vcanna_fn_AlphaMode = IROHA_FN_AlphaMode; +static int Vcanna_fn_HenkanNyuryokuMode = IROHA_FN_HenkanNyuryokuMode; +static int Vcanna_fn_Forward = IROHA_FN_Forward; +static int Vcanna_fn_Backward = IROHA_FN_Backward; +static int Vcanna_fn_Next = IROHA_FN_Next; +static int Vcanna_fn_Prev = IROHA_FN_Prev; +static int Vcanna_fn_BeginningOfLine = IROHA_FN_BeginningOfLine; +static int Vcanna_fn_EndOfLine = IROHA_FN_EndOfLine; +static int Vcanna_fn_DeleteNext = IROHA_FN_DeleteNext; +static int Vcanna_fn_DeletePrevious = IROHA_FN_DeletePrevious; +static int Vcanna_fn_KillToEndOfLine = IROHA_FN_KillToEndOfLine; +static int Vcanna_fn_Henkan = IROHA_FN_Henkan; +static int Vcanna_fn_Kakutei = IROHA_FN_Kakutei; +static int Vcanna_fn_Extend = IROHA_FN_Extend; +static int Vcanna_fn_Shrink = IROHA_FN_Shrink; +#ifdef CANNA_FN_AdjustBunsetsu +static int Vcanna_fn_AdjustBunsetsu = CANNA_FN_AdjustBunsetsu; +#endif +static int Vcanna_fn_Quit = IROHA_FN_Quit; +static int Vcanna_fn_ConvertAsHex = IROHA_FN_ConvertAsHex; +static int Vcanna_fn_ConvertAsBushu = IROHA_FN_ConvertAsBushu; +static int Vcanna_fn_KouhoIchiran = IROHA_FN_KouhoIchiran; +static int Vcanna_fn_BubunMuhenkan = IROHA_FN_BubunMuhenkan; +static int Vcanna_fn_Zenkaku = IROHA_FN_Zenkaku; +static int Vcanna_fn_Hankaku = IROHA_FN_Hankaku; +static int Vcanna_fn_ToUpper = IROHA_FN_ToUpper; +static int Vcanna_fn_Capitalize = IROHA_FN_Capitalize; +static int Vcanna_fn_ToLower = IROHA_FN_ToLower; +static int Vcanna_fn_Hiragana = IROHA_FN_Hiragana; +static int Vcanna_fn_Katakana = IROHA_FN_Katakana; +static int Vcanna_fn_Romaji = IROHA_FN_Romaji; +#ifdef CANNA_FN_BaseHiragana +static int Vcanna_fn_BaseHiragana = CANNA_FN_BaseHiragana; +static int Vcanna_fn_BaseKatakana = CANNA_FN_BaseKatakana; +static int Vcanna_fn_BaseEisu = CANNA_FN_BaseEisu; +static int Vcanna_fn_BaseZenkaku = CANNA_FN_BaseZenkaku; +static int Vcanna_fn_BaseHankaku = CANNA_FN_BaseHankaku; +static int Vcanna_fn_BaseKana = CANNA_FN_BaseKana; +static int Vcanna_fn_BaseKakutei = CANNA_FN_BaseKakutei; +static int Vcanna_fn_BaseHenkan = CANNA_FN_BaseHenkan; +static int Vcanna_fn_BaseHiraKataToggle = CANNA_FN_BaseHiraKataToggle; +static int Vcanna_fn_BaseZenHanToggle = CANNA_FN_BaseZenHanToggle; +static int Vcanna_fn_BaseKanaEisuToggle = CANNA_FN_BaseKanaEisuToggle; +static int Vcanna_fn_BaseKakuteiHenkanToggle = + CANNA_FN_BaseKakuteiHenkanToggle; +static int Vcanna_fn_BaseRotateForward = CANNA_FN_BaseRotateForward; +static int Vcanna_fn_BaseRotateBackward = CANNA_FN_BaseRotateBackward; +#endif +static int Vcanna_fn_ExtendMode = IROHA_FN_ExtendMode; +static int Vcanna_fn_Touroku = IROHA_FN_Touroku; +static int Vcanna_fn_HexMode = IROHA_FN_HexMode; +static int Vcanna_fn_BushuMode = IROHA_FN_BushuMode; +static int Vcanna_fn_KigouMode = IROHA_FN_KigouMode; +#ifdef CANNA_FN_Mark +static int Vcanna_fn_Mark = CANNA_FN_Mark; +#endif +#ifdef CANNA_FN_TemporalMode +static int Vcanna_fn_TemporalMode = CANNA_FN_TemporalMode; +#endif + +static int Vcanna_key_Nfer = IROHA_KEY_Nfer; +static int Vcanna_key_Xfer = IROHA_KEY_Xfer; +static int Vcanna_key_Up = IROHA_KEY_Up; +static int Vcanna_key_Left = IROHA_KEY_Left; +static int Vcanna_key_Right = IROHA_KEY_Right; +static int Vcanna_key_Down = IROHA_KEY_Down; +static int Vcanna_key_Insert = IROHA_KEY_Insert; +static int Vcanna_key_Rollup = IROHA_KEY_Rollup; +static int Vcanna_key_Rolldown = IROHA_KEY_Rolldown; +static int Vcanna_key_Home = IROHA_KEY_Home; +static int Vcanna_key_Help = IROHA_KEY_Help; +static int Vcanna_key_KP_Key = IROHA_KEY_KP_Key; +static int Vcanna_key_Shift_Nfer = IROHA_KEY_Shift_Nfer; +static int Vcanna_key_Shift_Xfer = IROHA_KEY_Shift_Xfer; +static int Vcanna_key_Shift_Up = IROHA_KEY_Shift_Up; +static int Vcanna_key_Shift_Left = IROHA_KEY_Shift_Left; +static int Vcanna_key_Shift_Right = IROHA_KEY_Shift_Right; +static int Vcanna_key_Shift_Down = IROHA_KEY_Shift_Down; +static int Vcanna_key_Cntrl_Nfer = IROHA_KEY_Cntrl_Nfer; +static int Vcanna_key_Cntrl_Xfer = IROHA_KEY_Cntrl_Xfer; +static int Vcanna_key_Cntrl_Up = IROHA_KEY_Cntrl_Up; +static int Vcanna_key_Cntrl_Left = IROHA_KEY_Cntrl_Left; +static int Vcanna_key_Cntrl_Right = IROHA_KEY_Cntrl_Right; +static int Vcanna_key_Cntrl_Down = IROHA_KEY_Cntrl_Down; + +/*static*/ Lisp_Object VCANNA; /* hir@nec, 1992.5.21 */ + +syms_of_canna () +{ + DEFVAR_LISP ("CANNA", &VCANNA, ""); /* hir@nec, 1992.5.21 */ + VCANNA = Qt; /* hir@nec, 1992.5.21 */ + + defsubr (&Scanna_key_proc); + defsubr (&Scanna_initialize); + defsubr (&Scanna_finalize); + defsubr (&Scanna_touroku_string); + defsubr (&Scanna_set_width); + defsubr (&Scanna_change_mode); + defsubr (&Scanna_store_yomi); + defsubr (&Scanna_do_function); + defsubr (&Scanna_parse); + defsubr (&Scanna_query_mode); + defsubr (&Scanna_set_bunsetsu); + + DEFVAR_LISP("canna-kakutei-string", &Vcanna_kakutei_string, ""); + DEFVAR_LISP("canna-kakutei-yomi", &Vcanna_kakutei_yomi, ""); + DEFVAR_LISP("canna-kakutei-romaji", &Vcanna_kakutei_romaji, ""); + DEFVAR_LISP("canna-henkan-string", &Vcanna_henkan_string, ""); + DEFVAR_INT ("canna-henkan-length", &Vcanna_henkan_length, ""); + DEFVAR_INT ("canna-henkan-revpos", &Vcanna_henkan_revPos, ""); + DEFVAR_INT ("canna-henkan-revlen", &Vcanna_henkan_revLen, ""); + DEFVAR_LISP("canna-ichiran-string", &Vcanna_ichiran_string, ""); + DEFVAR_INT ("canna-ichiran-length", &Vcanna_ichiran_length, ""); + DEFVAR_INT ("canna-ichiran-revpos", &Vcanna_ichiran_revPos, ""); + DEFVAR_INT ("canna-ichiran-revlen", &Vcanna_ichiran_revLen, ""); + DEFVAR_LISP("canna-mode-string", &Vcanna_mode_string, ""); + + DEFVAR_BOOL ("canna-empty-info", &Vcanna_empty_info, "For canna"); + DEFVAR_BOOL ("canna-through-info", &Vcanna_through_info, "For canna"); + DEFVAR_BOOL ("canna-underline", &Vcanna_underline, "For canna"); + DEFVAR_BOOL ("canna-inhibit-hankakukana", &Vcanna_inhibit_hankakukana, + "For canna"); /* hir, 1994.12.5 */ + + defsubr (&Scanna_henkan_begin); + defsubr (&Scanna_henkan_next); + defsubr (&Scanna_bunsetu_henkou); + defsubr (&Scanna_henkan_kakutei); + defsubr (&Scanna_henkan_end); + defsubr (&Scanna_henkan_quit); + + DEFVAR_INT ("canna-mode-alpha-mode", &Vcanna_mode_AlphaMode, ""); + DEFVAR_INT ("canna-mode-empty-mode", &Vcanna_mode_EmptyMode, ""); + DEFVAR_INT ("canna-mode-kigo-mode", &Vcanna_mode_KigoMode, ""); + DEFVAR_INT ("canna-mode-yomi-mode", &Vcanna_mode_YomiMode, ""); + DEFVAR_INT ("canna-mode-jishu-mode", &Vcanna_mode_JishuMode, ""); + DEFVAR_INT ("canna-mode-tankouho-mode", &Vcanna_mode_TankouhoMode, ""); + DEFVAR_INT ("canna-mode-ichiran-mode", &Vcanna_mode_IchiranMode, ""); + DEFVAR_INT ("canna-mode-yes-no-mode", &Vcanna_mode_YesNoMode, ""); + DEFVAR_INT ("canna-mode-on-off-mode", &Vcanna_mode_OnOffMode, ""); +#ifdef CANNA_MODE_AdjustBunsetsuMode + DEFVAR_INT ("canna-mode-adjust-bunsetsu-mode", + &Vcanna_mode_AdjustBunsetsuMode, ""); +#endif +#ifdef CANNA_MODE_ChikujiYomiMode + DEFVAR_INT ("canna-mode-chikuji-yomi-mode", &Vcanna_mode_ChikujiYomiMode,""); + DEFVAR_INT ("canna-mode-chikuji-bunsetsu-mode", + &Vcanna_mode_ChikujiTanMode, ""); +#endif + + DEFVAR_INT ("canna-mode-henkan-mode", &Vcanna_mode_HenkanMode, ""); +#ifdef CANNA_MODE_HenkanNyuryokuMode + DEFVAR_INT ("canna-mode-henkan-nyuuryoku-mode", + &Vcanna_mode_HenkanNyuryokuMode, 0); +#endif +#ifdef CANNA_MODE_ZenHiraHenkanMode + DEFVAR_INT ("canna-mode-zen-hira-henkan-mode", + &Vcanna_mode_ZenHiraHenkanMode, ""); +#ifdef CANNA_MODE_HanHiraHenkanMode + DEFVAR_INT ("canna-mode-han-hira-henkan-mode", + &Vcanna_mode_HanHiraHenkanMode, ""); +#endif + DEFVAR_INT ("canna-mode-zen-kata-henkan-mode", + &Vcanna_mode_ZenKataHenkanMode, ""); + DEFVAR_INT ("canna-mode-han-kata-henkan-mode", + &Vcanna_mode_HanKataHenkanMode, ""); + DEFVAR_INT ("canna-mode-zen-alpha-henkan-mode", + &Vcanna_mode_ZenAlphaHenkanMode, ""); + DEFVAR_INT ("canna-mode-han-alpha-henkan-mode", + &Vcanna_mode_HanAlphaHenkanMode, ""); +#endif + DEFVAR_INT ("canna-mode-zen-hira-kakutei-mode", + &Vcanna_mode_ZenHiraKakuteiMode, ""); +#ifdef CANNA_MODE_HanHiraKakuteiMode + DEFVAR_INT ("canna-mode-han-hira-kakutei-mode", + &Vcanna_mode_HanHiraKakuteiMode, ""); +#endif + DEFVAR_INT ("canna-mode-zen-kata-kakutei-mode", + &Vcanna_mode_ZenKataKakuteiMode, ""); + DEFVAR_INT ("canna-mode-han-kata-kakutei-mode", + &Vcanna_mode_HanKataKakuteiMode, ""); + DEFVAR_INT ("canna-mode-zen-alpha-kakutei-mode", + &Vcanna_mode_ZenAlphaKakuteiMode, ""); + DEFVAR_INT ("canna-mode-han-alpha-kakutei-mode", + &Vcanna_mode_HanAlphaKakuteiMode, ""); + DEFVAR_INT ("canna-mode-hex-mode", &Vcanna_mode_HexMode, ""); + DEFVAR_INT ("canna-mode-bushu-mode", &Vcanna_mode_BushuMode, ""); + DEFVAR_INT ("canna-mode-extend-mode", &Vcanna_mode_ExtendMode, ""); + DEFVAR_INT ("canna-mode-russian-mode", &Vcanna_mode_RussianMode, ""); + DEFVAR_INT ("canna-mode-greek-mode", &Vcanna_mode_GreekMode, ""); + DEFVAR_INT ("canna-mode-line-mode", &Vcanna_mode_LineMode, ""); + DEFVAR_INT ("canna-mode-changing-server-mode", + &Vcanna_mode_ChangingServerMode, ""); + DEFVAR_INT ("canna-mode-henkan-method-mode", + &Vcanna_mode_HenkanMethodMode, ""); + DEFVAR_INT ("canna-mode-delete-dic-mode", &Vcanna_mode_DeleteDicMode, ""); + DEFVAR_INT ("canna-mode-touroku-mode", &Vcanna_mode_TourokuMode, ""); + DEFVAR_INT ("canna-mode-touroku-empty-mode", + &Vcanna_mode_TourokuEmptyMode, ""); + DEFVAR_INT ("canna-mode-touroku-hinshi-mode", + &Vcanna_mode_TourokuHinshiMode, ""); + DEFVAR_INT ("canna-mode-touroku-dic-mode", &Vcanna_mode_TourokuDicMode, ""); + DEFVAR_INT ("canna-mode-quoted-insert-mode", + &Vcanna_mode_QuotedInsertMode, ""); + DEFVAR_INT ("canna-mode-bubun-muhenkan-mode", + &Vcanna_mode_BubunMuhenkanMode, ""); + DEFVAR_INT ("canna-mode-mount-dic-mode", &Vcanna_mode_MountDicMode, ""); + + DEFVAR_INT ("canna-func-self-insert", &Vcanna_fn_SelfInsert ,""); + DEFVAR_INT ("canna-func-functional-insert", &Vcanna_fn_FunctionalInsert ,""); + DEFVAR_INT ("canna-func-quoted-insert", &Vcanna_fn_QuotedInsert ,""); + DEFVAR_INT ("canna-func-japanese-mode", &Vcanna_fn_JapaneseMode ,""); + DEFVAR_INT ("canna-func-alpha-mode", &Vcanna_fn_AlphaMode ,""); + DEFVAR_INT ("canna-func-henkan-nyuryoku-mode", + &Vcanna_fn_HenkanNyuryokuMode ,""); + DEFVAR_INT ("canna-func-forward", &Vcanna_fn_Forward ,""); + DEFVAR_INT ("canna-func-backward", &Vcanna_fn_Backward ,""); + DEFVAR_INT ("canna-func-next", &Vcanna_fn_Next ,""); + DEFVAR_INT ("canna-func-previous", &Vcanna_fn_Prev ,""); + DEFVAR_INT ("canna-func-beginning-of-line", &Vcanna_fn_BeginningOfLine ,""); + DEFVAR_INT ("canna-func-end-of-line", &Vcanna_fn_EndOfLine ,""); + DEFVAR_INT ("canna-func-delete-next", &Vcanna_fn_DeleteNext ,""); + DEFVAR_INT ("canna-func-delete_previous", &Vcanna_fn_DeletePrevious ,""); + DEFVAR_INT ("canna-func-kill-to-end-of-line", &Vcanna_fn_KillToEndOfLine,""); + DEFVAR_INT ("canna-func-henkan", &Vcanna_fn_Henkan ,""); + DEFVAR_INT ("canna-func-kakutei", &Vcanna_fn_Kakutei ,""); + DEFVAR_INT ("canna-func-extend", &Vcanna_fn_Extend ,""); + DEFVAR_INT ("canna-func-shrink", &Vcanna_fn_Shrink ,""); +#ifdef CANNA_FN_AdjustBunsetsu + DEFVAR_INT ("canna-func-adjust-bunsetsu", &Vcanna_fn_AdjustBunsetsu ,""); +#endif + DEFVAR_INT ("canna-func-quit", &Vcanna_fn_Quit ,""); + DEFVAR_INT ("canna-func-convert-as-hex", &Vcanna_fn_ConvertAsHex ,""); + DEFVAR_INT ("canna-func-convert-as-bushu", &Vcanna_fn_ConvertAsBushu ,""); + DEFVAR_INT ("canna-func-kouho-ichiran", &Vcanna_fn_KouhoIchiran ,""); + DEFVAR_INT ("canna-func-bubun-muhenkan", &Vcanna_fn_BubunMuhenkan ,""); + DEFVAR_INT ("canna-func-zenkaku", &Vcanna_fn_Zenkaku ,""); + DEFVAR_INT ("canna-func-hankaku", &Vcanna_fn_Hankaku ,""); + DEFVAR_INT ("canna-func-to-upper", &Vcanna_fn_ToUpper ,""); + DEFVAR_INT ("canna-func-capitalize", &Vcanna_fn_Capitalize ,""); + DEFVAR_INT ("canna-func-to-lower", &Vcanna_fn_ToLower ,""); + DEFVAR_INT ("canna-func-hiragana", &Vcanna_fn_Hiragana ,""); + DEFVAR_INT ("canna-func-katakana", &Vcanna_fn_Katakana ,""); + DEFVAR_INT ("canna-func-romaji", &Vcanna_fn_Romaji ,""); +#ifdef CANNA_FN_BaseHiragana + DEFVAR_INT ("canna-func-base-hiragana", &Vcanna_fn_BaseHiragana ,""); + DEFVAR_INT ("canna-func-base-katakana", &Vcanna_fn_BaseKatakana ,""); + DEFVAR_INT ("canna-func-base-eisu", &Vcanna_fn_BaseEisu ,""); + DEFVAR_INT ("canna-func-base-zenkaku", &Vcanna_fn_BaseZenkaku ,""); + DEFVAR_INT ("canna-func-base-hankaku", &Vcanna_fn_BaseHankaku ,""); + DEFVAR_INT ("canna-func-base-kana", &Vcanna_fn_BaseKana ,""); + DEFVAR_INT ("canna-func-base-kakutei", &Vcanna_fn_BaseKakutei ,""); + DEFVAR_INT ("canna-func-base-henkan", &Vcanna_fn_BaseHenkan ,""); + DEFVAR_INT ("canna-func-base-hiragana-katakana-toggle", + &Vcanna_fn_BaseHiraKataToggle ,""); + DEFVAR_INT ("canna-func-base-zenkaku-hankaku-toggle", + &Vcanna_fn_BaseZenHanToggle ,""); + DEFVAR_INT ("canna-func-base-kana-eisu-toggle", + &Vcanna_fn_BaseKanaEisuToggle ,""); + DEFVAR_INT ("canna-func-base-kakutei-henkan-toggle", + &Vcanna_fn_BaseKakuteiHenkanToggle ,""); + DEFVAR_INT ("canna-func-base-rotate-forward", + &Vcanna_fn_BaseRotateForward ,""); + DEFVAR_INT ("canna-func-base-rotate-backward", + &Vcanna_fn_BaseRotateBackward ,""); +#endif + DEFVAR_INT ("canna-func-extend-mode", &Vcanna_fn_ExtendMode ,""); + DEFVAR_INT ("canna-func-touroku", &Vcanna_fn_Touroku ,""); + DEFVAR_INT ("canna-func-hex-mode", &Vcanna_fn_HexMode ,""); + DEFVAR_INT ("canna-func-bushu-mode", &Vcanna_fn_BushuMode ,""); + DEFVAR_INT ("canna-func-kigo-mode", &Vcanna_fn_KigouMode ,""); +#ifdef CANNA_FN_Mark + DEFVAR_INT ("canna-func-mark", &Vcanna_fn_Mark ,""); +#endif +#ifdef CANNA_FN_TemporalMode + DEFVAR_INT ("canna-func-temporal-mode", &Vcanna_fn_TemporalMode ,""); +#endif + + DEFVAR_INT ("canna-key-nfer", &Vcanna_key_Nfer, ""); + DEFVAR_INT ("canna-key-xfer", &Vcanna_key_Xfer, ""); + DEFVAR_INT ("canna-key-up", &Vcanna_key_Up, ""); + DEFVAR_INT ("canna-key-left", &Vcanna_key_Left, ""); + DEFVAR_INT ("canna-key-right", &Vcanna_key_Right, ""); + DEFVAR_INT ("canna-key-down", &Vcanna_key_Down, ""); + DEFVAR_INT ("canna-key-insert", &Vcanna_key_Insert, ""); + DEFVAR_INT ("canna-key-rollup", &Vcanna_key_Rollup, ""); + DEFVAR_INT ("canna-key-rolldown", &Vcanna_key_Rolldown, ""); + DEFVAR_INT ("canna-key-home", &Vcanna_key_Home, ""); + DEFVAR_INT ("canna-key-help", &Vcanna_key_Help, ""); + DEFVAR_INT ("canna-key-kp-key", &Vcanna_key_KP_Key, ""); + DEFVAR_INT ("canna-key-shift-nfer", &Vcanna_key_Shift_Nfer, ""); + DEFVAR_INT ("canna-key-shift-xfer", &Vcanna_key_Shift_Xfer, ""); + DEFVAR_INT ("canna-key-shift-up", &Vcanna_key_Shift_Up, ""); + DEFVAR_INT ("canna-key-shift-left", &Vcanna_key_Shift_Left, ""); + DEFVAR_INT ("canna-key-shift-right", &Vcanna_key_Shift_Right, ""); + DEFVAR_INT ("canna-key-shift-down", &Vcanna_key_Shift_Down, ""); + DEFVAR_INT ("canna-key-control-nfer", &Vcanna_key_Cntrl_Nfer, ""); + DEFVAR_INT ("canna-key-control-xfer", &Vcanna_key_Cntrl_Xfer, ""); + DEFVAR_INT ("canna-key-control-up", &Vcanna_key_Cntrl_Up, ""); + DEFVAR_INT ("canna-key-control-left", &Vcanna_key_Cntrl_Left, ""); + DEFVAR_INT ("canna-key-control-right", &Vcanna_key_Cntrl_Right, ""); + DEFVAR_INT ("canna-key-control-down", &Vcanna_key_Cntrl_Down, ""); +} + +#ifdef CANNA_MULE +/* To handle MULE internal code and EUC. + I assume CANNA can handle only Japanese EUC. */ + +/* EUC multibyte string to MULE internal string */ + +static +c2mu(cp, l, mp) +char *cp; +int l; +char *mp; +{ + char ch, *ep = cp+l; + + while((cp < ep) && (ch = *cp)) { + if ((unsigned char)ch == ISO_CODE_SS2) { + *mp++ = charset_katakana_jisx0201; + cp++; + } + else if ((unsigned char)ch == ISO_CODE_SS3) { + *mp++ = charset_jisx0212; /* LCJP2; */ + cp++; + *mp++ = *cp++; + } + else if(ch & 0x80) { + *mp++ = charset_jisx0208; + *mp++ = *cp++; + } + *mp++ = *cp++; + } + *mp = 0; +} + +/* MULE internal string to EUC multibyte string */ + +static +m2c(mp, l, cp) +unsigned char *mp; +int l; +unsigned char *cp; +{ + unsigned char ch, *ep = mp + l;; + + while((mp < ep) && (ch = *mp++)) { +#if 0 + switch (ch) { + case charset_katakana_jisx0201: + *cp++ = ISO_CODE_SS2; + *cp++ = *mp++; + break; + case charset_jisx0212 /*LCJP2*/: + *cp++ = ISO_CODE_SS3; + case charset_jisx0208: + *cp++ = *mp++; + *cp++ = *mp++; + break; + default: + *cp++ = ch; + break; + } +#endif + if (ch == charset_katakana_jisx0201) { + *cp++ = ISO_CODE_SS2; + *cp++ = *mp++; + } else if (ch == charset_jisx0212) { /* LCJP2 */ + *cp++ = ISO_CODE_SS3; + *cp++ = *mp++; + *cp++ = *mp++; + } else if (ch == charset_jisx0208) { /* LCJP */ + *cp++ = *mp++; + *cp++ = *mp++; + } else { + *cp++ = ch; + } + } + *cp = 0; +} + +#undef make_string + +/* make_string after converting EUC string to MULE internal string */ +static +Lisp_Object +mule_make_string(p,l) +unsigned char *p; +int l; +{ + unsigned char cbuf[4096]; + + c2mu(p,l,cbuf); + return (make_string(cbuf,strlen(cbuf))); +} + +/* return the MULE internal string length of EUC string */ +static +mule_strlen(p,l) +unsigned char *p; +int l; +{ + unsigned char ch, *cp = p; + int len = 0; + + while((cp < p + l) && (ch = *cp)) { + if ((unsigned char)ch == ISO_CODE_SS2) { + len += 2; + cp += 2; + } + else if ((unsigned char)ch == ISO_CODE_SS3) { + len += 3; + cp += 3; + } + else if(ch & 0x80) { + len += 3; + cp += 2; + } + else { + len++; + cp++; + } + } + return(len); +} + +/* count number of characters */ +static +count_char(p,len,pos,rev,clen,cpos,crev) +unsigned char *p; +int len,pos,rev,*clen,*cpos,*crev; +{ + unsigned char *q = p; + + *clen = *cpos = *crev = 0; + if (len == 0) return; + while (q < p + pos) { + (*clen)++; + (*cpos)++; + if (*q++ & 0x80) q++; + } + while (q < p + pos + rev) { + (*clen)++; + (*crev)++; + if (*q++ & 0x80) q++; + } + while (q < p + len) { + (*clen)++; + if (*q++ & 0x80) q++; + } +} +#endif /* CANNA_MULE */ diff -u --recursive --new-file emacs-20.3/src/charset.c emacs-20.3+canna/src/charset.c --- emacs-20.3/src/charset.c Tue Aug 18 16:37:25 1998 +++ emacs-20.3+canna/src/charset.c Sat Aug 22 01:42:33 1998 @@ -53,6 +53,7 @@ int charset_ascii; /* ASCII */ int charset_composition; /* for a composite character */ int charset_latin_iso8859_1; /* ISO8859-1 (Latin-1) */ +int charset_jisx0212; /* JISX0212 appended by knak 1997.10.26 */ int charset_jisx0208_1978; /* JISX0208.1978 (Japanese Kanji old set) */ int charset_jisx0208; /* JISX0208.1983 (Japanese Kanji) */ int charset_katakana_jisx0201; /* JISX0201.Kana (Japanese Katakana) */ @@ -1721,6 +1722,7 @@ charset_latin_iso8859_1 = charset_id_internal ("latin-iso8859-1"); charset_jisx0208_1978 = charset_id_internal ("japanese-jisx0208-1978"); charset_jisx0208 = charset_id_internal ("japanese-jisx0208"); + charset_jisx0212 = charset_id_internal ("japanese-jisx0212"); /* appended by knak 1997.10.26 */ charset_katakana_jisx0201 = charset_id_internal ("katakana-jisx0201"); charset_latin_jisx0201 = charset_id_internal ("latin-jisx0201"); charset_big5_1 = charset_id_internal ("chinese-big5-1"); diff -u --recursive --new-file emacs-20.3/src/charset.h emacs-20.3+canna/src/charset.h --- emacs-20.3/src/charset.h Mon Jul 6 15:31:32 1998 +++ emacs-20.3+canna/src/charset.h Sat Aug 22 01:42:33 1998 @@ -127,6 +127,7 @@ extern int charset_ascii; /* ASCII */ extern int charset_composition; /* for a composite character */ extern int charset_latin_iso8859_1; /* ISO8859-1 (Latin-1) */ +extern int charset_jisx0212; /* JISX212 appended by knak 1997.10.26 */ extern int charset_jisx0208_1978; /* JISX0208.1978 (Japanese Kanji old set) */ extern int charset_jisx0208; /* JISX0208.1983 (Japanese Kanji) */ extern int charset_katakana_jisx0201; /* JISX0201.Kana (Japanese Katakana) */ diff -u --recursive --new-file emacs-20.3/src/config.in emacs-20.3+canna/src/config.in --- emacs-20.3/src/config.in Mon May 25 13:07:33 1998 +++ emacs-20.3+canna/src/config.in Sat Aug 22 01:42:33 1998 @@ -252,6 +252,15 @@ /* Define if `struct timeval' is declared by . */ #undef HAVE_TIMEVAL +#undef LIBS_MULE + +#undef CANNA +#undef CANNA_MULE +#undef CANNA2 +#undef C_SWITCH_CANNA +#undef LD_SWITCH_CANNA +#undef LD_SWITCH_CANNA_AUX + /* If using GNU, then support inline function declarations. */ #ifdef __GNUC__ #define INLINE __inline__ @@ -388,6 +397,14 @@ #ifndef NOT_C_CODE extern char *getenv (); #endif + +#ifdef CANNA +# define CANNA2 +# define CANNA_MULE +# define CANNA_PURESIZE 18000 +#else /* not CANNA */ +# define CANNA_PURESIZE 0 +#endif /* not CANNA */ #endif /* EMACS_CONFIG_H */ diff -u --recursive --new-file emacs-20.3/src/emacs.c emacs-20.3+canna/src/emacs.c --- emacs-20.3/src/emacs.c Tue Jul 21 10:39:52 1998 +++ emacs-20.3+canna/src/emacs.c Sat Aug 22 01:42:33 1998 @@ -1194,6 +1194,10 @@ syms_of_w32menu (); #endif /* HAVE_NTGUI */ +#ifdef CANNA + syms_of_canna (); +#endif + #ifdef SYMS_SYSTEM SYMS_SYSTEM; #endif