From: tomo Date: Sun, 15 Dec 2002 18:25:21 +0000 (+0000) Subject: Basically sync with r21-2-19-utf-2000-0_6-1. X-Git-Tag: r21-4-10-kanon-0_6-1 X-Git-Url: http://git.chise.org/gitweb/?a=commitdiff_plain;h=c93e11a37f497a563320621b37a8a14be23b7029;p=chise%2Fxemacs-chise.git.1 Basically sync with r21-2-19-utf-2000-0_6-1. --- diff --git a/ChangeLog b/ChangeLog index fbbdaee..654f953 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,8 @@ +1999-09-09 MORIOKA Tomohiko + + * configure.in: Add new option `--with-text-coding'; define + `TEXT_CODING' if it is specified. + 1999-08-30 MORIOKA Tomohiko * configure.in: diff --git a/configure b/configure index 37fac4b..9a71bb6 100755 --- a/configure +++ b/configure @@ -340,6 +340,7 @@ while test $# != 0; do with_i18n3 | \ with_mule | \ with_utf_2000 | \ + with_text_coding| \ with_file_coding| \ with_canna | \ with_wnn | \ @@ -850,7 +851,7 @@ echo " Use \`$progname --help' to show usage.") >&2 && exit 1 fi echo $ac_n "checking whether ln -s works""... $ac_c" 1>&6 -echo "configure:854: checking whether ln -s works" >&5 +echo "configure:855: checking whether ln -s works" >&5 rm -f conftestdata if ln -s X conftestdata 2>/dev/null @@ -1115,7 +1116,7 @@ EOF echo $ac_n "checking "host system type"""... $ac_c" 1>&6 -echo "configure:1119: checking "host system type"" >&5 +echo "configure:1120: checking "host system type"" >&5 internal_configuration=`echo $configuration | sed 's/-\(workshop\)//'` canonical=`${CONFIG_SHELL-/bin/sh} $srcdir/config.sub "$internal_configuration"` configuration=`echo "$configuration" | sed 's/^\([^-][^-]*-[^-][^-]*-[^-][^-]*\)-.*$/\1/'` @@ -1634,7 +1635,7 @@ xe_save_CFLAGS="$CFLAGS" # 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:1638: checking for $ac_word" >&5 +echo "configure:1639: checking for $ac_word" >&5 if test -n "$CC"; then ac_cv_prog_CC="$CC" # Let the user override the test. @@ -1661,7 +1662,7 @@ if test -z "$CC"; then # 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:1665: checking for $ac_word" >&5 +echo "configure:1666: checking for $ac_word" >&5 if test -n "$CC"; then ac_cv_prog_CC="$CC" # Let the user override the test. @@ -1709,7 +1710,7 @@ fi # Extract the first word of "cl", so it can be a program name with args. set dummy cl; ac_word=$2 echo $ac_n "checking for $ac_word""... $ac_c" 1>&6 -echo "configure:1713: checking for $ac_word" >&5 +echo "configure:1714: checking for $ac_word" >&5 if test -n "$CC"; then ac_cv_prog_CC="$CC" # Let the user override the test. @@ -1738,7 +1739,7 @@ fi fi echo $ac_n "checking whether the C compiler ($CC $CFLAGS $LDFLAGS) works""... $ac_c" 1>&6 -echo "configure:1742: checking whether the C compiler ($CC $CFLAGS $LDFLAGS) works" >&5 +echo "configure:1743: checking whether the C compiler ($CC $CFLAGS $LDFLAGS) works" >&5 ac_ext=c xe_cppflags='$CPPFLAGS $c_switch_site $c_switch_machine $c_switch_system $c_switch_x_site $X_CFLAGS' @@ -1751,12 +1752,12 @@ cross_compiling=no cat > conftest.$ac_ext << EOF -#line 1755 "configure" +#line 1756 "configure" #include "confdefs.h" main(){return(0);} EOF -if { (eval echo configure:1760: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then +if { (eval echo configure:1761: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; 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 @@ -1784,19 +1785,19 @@ if test $ac_cv_prog_cc_works = no; then { 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:1788: checking whether the C compiler ($CC $CFLAGS $LDFLAGS) is a cross-compiler" >&5 +echo "configure:1789: 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:1793: checking whether we are using GNU C" >&5 +echo "configure:1794: checking whether we are using GNU C" >&5 cat > conftest.c <&5; (eval $ac_try) 2>&5; }; } | egrep yes >/dev/null 2>&1; then +if { ac_try='${CC-cc} -E conftest.c'; { (eval echo configure:1801: \"$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 @@ -1814,7 +1815,7 @@ ac_test_CFLAGS="${CFLAGS+set}" ac_save_CFLAGS="$CFLAGS" CFLAGS= echo $ac_n "checking whether ${CC-cc} accepts -g""... $ac_c" 1>&6 -echo "configure:1818: checking whether ${CC-cc} accepts -g" >&5 +echo "configure:1819: checking whether ${CC-cc} accepts -g" >&5 echo 'void f(){}' > conftest.c if test -z "`${CC-cc} -g -c conftest.c 2>&1`"; then @@ -1847,7 +1848,7 @@ if test "$with_gcc" = "no" -a "$GCC" = "yes"; then # 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:1851: checking for $ac_word" >&5 +echo "configure:1852: checking for $ac_word" >&5 if test -n "$CC"; then ac_cv_prog_CC="$CC" # Let the user override the test. @@ -1874,7 +1875,7 @@ if test -z "$CC"; then # 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:1878: checking for $ac_word" >&5 +echo "configure:1879: checking for $ac_word" >&5 if test -n "$CC"; then ac_cv_prog_CC="$CC" # Let the user override the test. @@ -1922,7 +1923,7 @@ fi # Extract the first word of "cl", so it can be a program name with args. set dummy cl; ac_word=$2 echo $ac_n "checking for $ac_word""... $ac_c" 1>&6 -echo "configure:1926: checking for $ac_word" >&5 +echo "configure:1927: checking for $ac_word" >&5 if test -n "$CC"; then ac_cv_prog_CC="$CC" # Let the user override the test. @@ -1951,7 +1952,7 @@ fi fi echo $ac_n "checking whether the C compiler ($CC $CFLAGS $LDFLAGS) works""... $ac_c" 1>&6 -echo "configure:1955: checking whether the C compiler ($CC $CFLAGS $LDFLAGS) works" >&5 +echo "configure:1956: checking whether the C compiler ($CC $CFLAGS $LDFLAGS) works" >&5 ac_ext=c xe_cppflags='$CPPFLAGS $c_switch_site $c_switch_machine $c_switch_system $c_switch_x_site $X_CFLAGS' @@ -1964,12 +1965,12 @@ cross_compiling=no cat > conftest.$ac_ext << EOF -#line 1968 "configure" +#line 1969 "configure" #include "confdefs.h" main(){return(0);} EOF -if { (eval echo configure:1973: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then +if { (eval echo configure:1974: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; 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 @@ -1997,19 +1998,19 @@ if test $ac_cv_prog_cc_works = no; then { 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:2001: checking whether the C compiler ($CC $CFLAGS $LDFLAGS) is a cross-compiler" >&5 +echo "configure:2002: 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:2006: checking whether we are using GNU C" >&5 +echo "configure:2007: checking whether we are using GNU C" >&5 cat > conftest.c <&5; (eval $ac_try) 2>&5; }; } | egrep yes >/dev/null 2>&1; then +if { ac_try='${CC-cc} -E conftest.c'; { (eval echo configure:2014: \"$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 @@ -2027,7 +2028,7 @@ ac_test_CFLAGS="${CFLAGS+set}" ac_save_CFLAGS="$CFLAGS" CFLAGS= echo $ac_n "checking whether ${CC-cc} accepts -g""... $ac_c" 1>&6 -echo "configure:2031: checking whether ${CC-cc} accepts -g" >&5 +echo "configure:2032: checking whether ${CC-cc} accepts -g" >&5 echo 'void f(){}' > conftest.c if test -z "`${CC-cc} -g -c conftest.c 2>&1`"; then @@ -2060,7 +2061,7 @@ elif test "$with_gcc" = "yes" -a "$GCC" != "yes" ; then # 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:2064: checking for $ac_word" >&5 +echo "configure:2065: checking for $ac_word" >&5 if test -n "$CC"; then ac_cv_prog_CC="$CC" # Let the user override the test. @@ -2087,7 +2088,7 @@ if test -z "$CC"; then # 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:2091: checking for $ac_word" >&5 +echo "configure:2092: checking for $ac_word" >&5 if test -n "$CC"; then ac_cv_prog_CC="$CC" # Let the user override the test. @@ -2135,7 +2136,7 @@ fi # Extract the first word of "cl", so it can be a program name with args. set dummy cl; ac_word=$2 echo $ac_n "checking for $ac_word""... $ac_c" 1>&6 -echo "configure:2139: checking for $ac_word" >&5 +echo "configure:2140: checking for $ac_word" >&5 if test -n "$CC"; then ac_cv_prog_CC="$CC" # Let the user override the test. @@ -2164,7 +2165,7 @@ fi fi echo $ac_n "checking whether the C compiler ($CC $CFLAGS $LDFLAGS) works""... $ac_c" 1>&6 -echo "configure:2168: checking whether the C compiler ($CC $CFLAGS $LDFLAGS) works" >&5 +echo "configure:2169: checking whether the C compiler ($CC $CFLAGS $LDFLAGS) works" >&5 ac_ext=c xe_cppflags='$CPPFLAGS $c_switch_site $c_switch_machine $c_switch_system $c_switch_x_site $X_CFLAGS' @@ -2177,12 +2178,12 @@ cross_compiling=no cat > conftest.$ac_ext << EOF -#line 2181 "configure" +#line 2182 "configure" #include "confdefs.h" main(){return(0);} EOF -if { (eval echo configure:2186: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then +if { (eval echo configure:2187: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; 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 @@ -2210,19 +2211,19 @@ if test $ac_cv_prog_cc_works = no; then { 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:2214: checking whether the C compiler ($CC $CFLAGS $LDFLAGS) is a cross-compiler" >&5 +echo "configure:2215: 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:2219: checking whether we are using GNU C" >&5 +echo "configure:2220: checking whether we are using GNU C" >&5 cat > conftest.c <&5; (eval $ac_try) 2>&5; }; } | egrep yes >/dev/null 2>&1; then +if { ac_try='${CC-cc} -E conftest.c'; { (eval echo configure:2227: \"$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 @@ -2240,7 +2241,7 @@ ac_test_CFLAGS="${CFLAGS+set}" ac_save_CFLAGS="$CFLAGS" CFLAGS= echo $ac_n "checking whether ${CC-cc} accepts -g""... $ac_c" 1>&6 -echo "configure:2244: checking whether ${CC-cc} accepts -g" >&5 +echo "configure:2245: checking whether ${CC-cc} accepts -g" >&5 echo 'void f(){}' > conftest.c if test -z "`${CC-cc} -g -c conftest.c 2>&1`"; then @@ -2277,7 +2278,7 @@ test -n "$CPP" -a -d "$CPP" && CPP= test -n "$NON_GNU_CPP" -a "$GCC" != "yes" -a -z "$CPP" && CPP="$NON_GNU_CPP" echo $ac_n "checking how to run the C preprocessor""... $ac_c" 1>&6 -echo "configure:2281: checking how to run the C preprocessor" >&5 +echo "configure:2282: checking how to run the C preprocessor" >&5 # On Suns, sometimes $CPP names a directory. if test -n "$CPP" && test -d "$CPP"; then CPP= @@ -2290,13 +2291,13 @@ if test -z "$CPP"; then # 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:2300: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; } +{ (eval echo configure:2301: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; } ac_err=`grep -v '^ *+' conftest.out | grep -v "^conftest.${ac_ext}\$"` if test -z "$ac_err"; then : @@ -2307,13 +2308,13 @@ else 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:2317: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; } +{ (eval echo configure:2318: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; } ac_err=`grep -v '^ *+' conftest.out | grep -v "^conftest.${ac_ext}\$"` if test -z "$ac_err"; then : @@ -2324,13 +2325,13 @@ else rm -rf conftest* CPP="${CC-cc} -nologo -E" cat > conftest.$ac_ext < Syntax Error EOF ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out" -{ (eval echo configure:2334: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; } +{ (eval echo configure:2335: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; } ac_err=`grep -v '^ *+' conftest.out | grep -v "^conftest.${ac_ext}\$"` if test -z "$ac_err"; then : @@ -2356,9 +2357,9 @@ echo "$ac_t""$CPP" 1>&6 echo $ac_n "checking for AIX""... $ac_c" 1>&6 -echo "configure:2360: checking for AIX" >&5 +echo "configure:2361: checking for AIX" >&5 cat > conftest.$ac_ext <&6 -echo "configure:2389: checking for GNU libc" >&5 +echo "configure:2390: checking for GNU libc" >&5 cat > conftest.$ac_ext < int main() { @@ -2399,7 +2400,7 @@ int main() { ; return 0; } EOF -if { (eval echo configure:2403: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then +if { (eval echo configure:2404: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then rm -rf conftest* have_glibc=yes else @@ -2476,7 +2477,7 @@ EOF esac cat > conftest.$ac_ext <&5; (eval $ac_link) 2>&5; } && test -s conftest && (./conftest; exit $?) 2>&5 +if { (eval echo configure:2495: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest && (./conftest; exit $?) 2>&5 then : else @@ -2724,17 +2725,17 @@ test "$__DECC" = "yes" && c_switch_site="$c_switch_site -std1" && if test "$ext if test "$__USLC__" = yes; then echo $ac_n "checking for whether the -Kalloca compiler flag is needed""... $ac_c" 1>&6 -echo "configure:2728: checking for whether the -Kalloca compiler flag is needed" >&5 +echo "configure:2729: checking for whether the -Kalloca compiler flag is needed" >&5 need_kalloca=no cat > conftest.$ac_ext <&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then +if { (eval echo configure:2739: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then rm -rf conftest* : else @@ -2745,14 +2746,14 @@ else xe_save_c_switch_system="$c_switch_system" c_switch_system="$c_switch_system -Kalloca" cat > conftest.$ac_ext <&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then +if { (eval echo configure:2757: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then rm -rf conftest* need_kalloca=yes else @@ -2790,7 +2791,7 @@ fi if test "$GCC" = "yes"; then echo $ac_n "checking for buggy gcc versions""... $ac_c" 1>&6 -echo "configure:2794: checking for buggy gcc versions" >&5 +echo "configure:2795: checking for buggy gcc versions" >&5 GCC_VERSION=`$CC --version` case `uname -s`:`uname -m`:$GCC_VERSION in *:sun4*:2.8.1|*:sun4*:egcs-2.90.*) @@ -2848,7 +2849,7 @@ fi if test "$pdump" != "yes"; then echo $ac_n "checking for \"-z nocombreloc\" linker flag""... $ac_c" 1>&6 -echo "configure:2852: checking for \"-z nocombreloc\" linker flag" >&5 +echo "configure:2853: checking for \"-z nocombreloc\" linker flag" >&5 case "`ld --help 2>&1`" in *-z\ nocombreloc* ) echo "$ac_t""yes" 1>&6 ld_switch_site="-z nocombreloc $ld_switch_site" && if test "$extra_verbose" = "yes"; then echo " Prepending \"-z nocombreloc\" to \$ld_switch_site"; fi ;; @@ -2937,7 +2938,7 @@ test "$pdump" = "yes" && extra_objs="$extra_objs dumper.o" && if test "$extra_v fi echo $ac_n "checking for dynodump""... $ac_c" 1>&6 -echo "configure:2941: checking for dynodump" >&5 +echo "configure:2942: checking for dynodump" >&5 if test "$unexec" != "unexsol2.o"; then echo "$ac_t""no" 1>&6 else @@ -2975,12 +2976,12 @@ if test "$unexec" = "unexaix.o"; then done echo $ac_n "checking for terminateAndUnload in -lC""... $ac_c" 1>&6 -echo "configure:2979: checking for terminateAndUnload in -lC" >&5 +echo "configure:2980: checking for terminateAndUnload in -lC" >&5 ac_lib_var=`echo C'_'terminateAndUnload | sed 'y%./+-%__p_%'` xe_check_libs=" -lC " cat > conftest.$ac_ext <&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then +if { (eval echo configure:2996: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then rm -rf conftest* eval "ac_cv_lib_$ac_lib_var=yes" else @@ -3099,7 +3100,7 @@ fi if test "$add_runtime_path" = "yes"; then echo $ac_n "checking "for runtime libraries flag"""... $ac_c" 1>&6 -echo "configure:3103: checking "for runtime libraries flag"" >&5 +echo "configure:3104: checking "for runtime libraries flag"" >&5 case "$opsys" in sol2 ) dash_r="-R" ;; decosf* | linux* | irix*) dash_r="-rpath " ;; @@ -3121,14 +3122,14 @@ if test "$GCC" = "yes"; then done fi cat > conftest.$ac_ext <&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then +if { (eval echo configure:3133: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then rm -rf conftest* dash_r="$try_dash_r" else @@ -3229,10 +3230,10 @@ else fi after_morecore_hook_exists=yes echo $ac_n "checking for malloc_set_state""... $ac_c" 1>&6 -echo "configure:3233: checking for malloc_set_state" >&5 +echo "configure:3234: checking for malloc_set_state" >&5 cat > conftest.$ac_ext <&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then +if { (eval echo configure:3260: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then rm -rf conftest* eval "ac_cv_func_malloc_set_state=yes" else @@ -3275,16 +3276,16 @@ doug_lea_malloc=no fi echo $ac_n "checking whether __after_morecore_hook exists""... $ac_c" 1>&6 -echo "configure:3279: checking whether __after_morecore_hook exists" >&5 +echo "configure:3280: checking whether __after_morecore_hook exists" >&5 cat > conftest.$ac_ext <&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then +if { (eval echo configure:3289: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then rm -rf conftest* echo "$ac_t""yes" 1>&6 else @@ -3340,7 +3341,7 @@ fi # Extract the first word of "ranlib", so it can be a program name with args. set dummy ranlib; ac_word=$2 echo $ac_n "checking for $ac_word""... $ac_c" 1>&6 -echo "configure:3344: checking for $ac_word" >&5 +echo "configure:3345: checking for $ac_word" >&5 if test -n "$RANLIB"; then ac_cv_prog_RANLIB="$RANLIB" # Let the user override the test. @@ -3395,7 +3396,7 @@ ac_configure=$ac_aux_dir/configure # This should be Cygnus configure. # 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:3399: checking for a BSD compatible install" >&5 +echo "configure:3400: checking for a BSD compatible install" >&5 if test -z "$INSTALL"; then IFS="${IFS= }"; ac_save_IFS="$IFS"; IFS=":" @@ -3449,7 +3450,7 @@ do # 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:3453: checking for $ac_word" >&5 +echo "configure:3454: checking for $ac_word" >&5 if test -n "$YACC"; then ac_cv_prog_YACC="$YACC" # Let the user override the test. @@ -3481,15 +3482,15 @@ for ac_hdr in a.out.h elf.h cygwin/version.h fcntl.h inttypes.h libg do ac_safe=`echo "$ac_hdr" | sed 'y%./+-%__p_%'` echo $ac_n "checking for $ac_hdr""... $ac_c" 1>&6 -echo "configure:3485: checking for $ac_hdr" >&5 +echo "configure:3486: checking for $ac_hdr" >&5 cat > conftest.$ac_ext < EOF ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out" -{ (eval echo configure:3493: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; } +{ (eval echo configure:3494: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; } ac_err=`grep -v '^ *+' conftest.out | grep -v "^conftest.${ac_ext}\$"` if test -z "$ac_err"; then rm -rf conftest* @@ -3519,10 +3520,10 @@ fi done echo $ac_n "checking for sys/wait.h that is POSIX.1 compatible""... $ac_c" 1>&6 -echo "configure:3523: checking for sys/wait.h that is POSIX.1 compatible" >&5 +echo "configure:3524: checking for sys/wait.h that is POSIX.1 compatible" >&5 cat > conftest.$ac_ext < #include @@ -3538,7 +3539,7 @@ wait (&s); s = WIFEXITED (s) ? WEXITSTATUS (s) : 1; ; return 0; } EOF -if { (eval echo configure:3542: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then +if { (eval echo configure:3543: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then rm -rf conftest* ac_cv_header_sys_wait_h=yes else @@ -3562,10 +3563,10 @@ EOF fi echo $ac_n "checking for ANSI C header files""... $ac_c" 1>&6 -echo "configure:3566: checking for ANSI C header files" >&5 +echo "configure:3567: checking for ANSI C header files" >&5 cat > conftest.$ac_ext < #include @@ -3573,7 +3574,7 @@ cat > conftest.$ac_ext < EOF ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out" -{ (eval echo configure:3577: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; } +{ (eval echo configure:3578: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; } ac_err=`grep -v '^ *+' conftest.out | grep -v "^conftest.${ac_ext}\$"` if test -z "$ac_err"; then rm -rf conftest* @@ -3590,7 +3591,7 @@ rm -f conftest* 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 @@ -3608,7 +3609,7 @@ fi 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 @@ -3626,7 +3627,7 @@ fi if test $ac_cv_header_stdc = yes; then # /bin/cc in Irix-4.0.5 gets non-ANSI ctype macros unless using -ansi. cat > conftest.$ac_ext < #define ISLOWER(c) ('a' <= (c) && (c) <= 'z') @@ -3637,7 +3638,7 @@ if (XOR (islower (i), ISLOWER (i)) || toupper (i) != TOUPPER (i)) exit(2); exit (0); } EOF -if { (eval echo configure:3641: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest && (./conftest; exit $?) 2>&5 +if { (eval echo configure:3642: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest && (./conftest; exit $?) 2>&5 then : else @@ -3663,10 +3664,10 @@ EOF fi echo $ac_n "checking whether time.h and sys/time.h may both be included""... $ac_c" 1>&6 -echo "configure:3667: checking whether time.h and sys/time.h may both be included" >&5 +echo "configure:3668: checking whether time.h and sys/time.h may both be included" >&5 cat > conftest.$ac_ext < #include @@ -3675,7 +3676,7 @@ int main() { struct tm *tp; ; return 0; } EOF -if { (eval echo configure:3679: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then +if { (eval echo configure:3680: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then rm -rf conftest* ac_cv_header_time=yes else @@ -3699,10 +3700,10 @@ EOF fi echo $ac_n "checking for sys_siglist declaration in signal.h or unistd.h""... $ac_c" 1>&6 -echo "configure:3703: checking for sys_siglist declaration in signal.h or unistd.h" >&5 +echo "configure:3704: checking for sys_siglist declaration in signal.h or unistd.h" >&5 cat > conftest.$ac_ext < #include @@ -3714,7 +3715,7 @@ int main() { char *msg = *(sys_siglist + 1); ; return 0; } EOF -if { (eval echo configure:3718: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then +if { (eval echo configure:3719: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then rm -rf conftest* ac_cv_decl_sys_siglist=yes else @@ -3740,9 +3741,9 @@ fi echo $ac_n "checking for utime""... $ac_c" 1>&6 -echo "configure:3744: checking for utime" >&5 +echo "configure:3745: checking for utime" >&5 cat > conftest.$ac_ext < #include @@ -3750,7 +3751,7 @@ int main() { struct utimbuf x; x.actime = x.modtime = 0; utime ("/", &x); ; return 0; } EOF -if { (eval echo configure:3754: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then +if { (eval echo configure:3755: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then rm -rf conftest* echo "$ac_t""yes" 1>&6 { test "$extra_verbose" = "yes" && cat << \EOF @@ -3769,10 +3770,10 @@ else for ac_func in utimes do echo $ac_n "checking for $ac_func""... $ac_c" 1>&6 -echo "configure:3773: checking for $ac_func" >&5 +echo "configure:3774: checking for $ac_func" >&5 cat > conftest.$ac_ext <&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then +if { (eval echo configure:3800: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then rm -rf conftest* eval "ac_cv_func_$ac_func=yes" else @@ -3827,10 +3828,10 @@ rm -f conftest* echo $ac_n "checking return type of signal handlers""... $ac_c" 1>&6 -echo "configure:3831: checking return type of signal handlers" >&5 +echo "configure:3832: checking return type of signal handlers" >&5 cat > conftest.$ac_ext < #include @@ -3847,7 +3848,7 @@ int main() { int i; ; return 0; } EOF -if { (eval echo configure:3851: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then +if { (eval echo configure:3852: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then rm -rf conftest* ac_cv_type_signal=void else @@ -3869,10 +3870,10 @@ EOF echo $ac_n "checking for size_t""... $ac_c" 1>&6 -echo "configure:3873: checking for size_t" >&5 +echo "configure:3874: checking for size_t" >&5 cat > conftest.$ac_ext < #if STDC_HEADERS @@ -3903,10 +3904,10 @@ EOF fi echo $ac_n "checking for pid_t""... $ac_c" 1>&6 -echo "configure:3907: checking for pid_t" >&5 +echo "configure:3908: checking for pid_t" >&5 cat > conftest.$ac_ext < #if STDC_HEADERS @@ -3937,10 +3938,10 @@ EOF fi echo $ac_n "checking for uid_t in sys/types.h""... $ac_c" 1>&6 -echo "configure:3941: checking for uid_t in sys/types.h" >&5 +echo "configure:3942: checking for uid_t in sys/types.h" >&5 cat > conftest.$ac_ext < EOF @@ -3976,10 +3977,10 @@ EOF fi echo $ac_n "checking for mode_t""... $ac_c" 1>&6 -echo "configure:3980: checking for mode_t" >&5 +echo "configure:3981: checking for mode_t" >&5 cat > conftest.$ac_ext < #if STDC_HEADERS @@ -4010,10 +4011,10 @@ EOF fi echo $ac_n "checking for off_t""... $ac_c" 1>&6 -echo "configure:4014: checking for off_t" >&5 +echo "configure:4015: checking for off_t" >&5 cat > conftest.$ac_ext < #if STDC_HEADERS @@ -4044,10 +4045,10 @@ EOF fi echo $ac_n "checking for ssize_t""... $ac_c" 1>&6 -echo "configure:4048: checking for ssize_t" >&5 +echo "configure:4049: checking for ssize_t" >&5 cat > conftest.$ac_ext < #if STDC_HEADERS @@ -4079,9 +4080,9 @@ fi echo $ac_n "checking for socklen_t""... $ac_c" 1>&6 -echo "configure:4083: checking for socklen_t" >&5 +echo "configure:4084: checking for socklen_t" >&5 cat > conftest.$ac_ext < #include @@ -4091,7 +4092,7 @@ int main() { ; return 0; } EOF -if { (eval echo configure:4095: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then +if { (eval echo configure:4096: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then rm -rf conftest* echo "$ac_t""yes" 1>&6 else @@ -4100,7 +4101,7 @@ else rm -rf conftest* cat > conftest.$ac_ext < #include @@ -4110,7 +4111,7 @@ int main() { ; return 0; } EOF -if { (eval echo configure:4114: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then +if { (eval echo configure:4115: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then rm -rf conftest* echo "$ac_t""size_t" 1>&6 @@ -4142,9 +4143,9 @@ fi rm -f conftest* echo $ac_n "checking for struct timeval""... $ac_c" 1>&6 -echo "configure:4146: checking for struct timeval" >&5 +echo "configure:4147: checking for struct timeval" >&5 cat > conftest.$ac_ext < @@ -4160,7 +4161,7 @@ int main() { static struct timeval x; x.tv_sec = x.tv_usec; ; return 0; } EOF -if { (eval echo configure:4164: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then +if { (eval echo configure:4165: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then rm -rf conftest* echo "$ac_t""yes" 1>&6 HAVE_TIMEVAL=yes @@ -4182,10 +4183,10 @@ fi rm -f conftest* echo $ac_n "checking whether struct tm is in sys/time.h or time.h""... $ac_c" 1>&6 -echo "configure:4186: checking whether struct tm is in sys/time.h or time.h" >&5 +echo "configure:4187: checking whether struct tm is in sys/time.h or time.h" >&5 cat > conftest.$ac_ext < #include @@ -4193,7 +4194,7 @@ int main() { struct tm *tp; tp->tm_sec; ; return 0; } EOF -if { (eval echo configure:4197: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then +if { (eval echo configure:4198: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then rm -rf conftest* ac_cv_struct_tm=time.h else @@ -4217,10 +4218,10 @@ EOF fi echo $ac_n "checking for tm_zone in struct tm""... $ac_c" 1>&6 -echo "configure:4221: checking for tm_zone in struct tm" >&5 +echo "configure:4222: checking for tm_zone in struct tm" >&5 cat > conftest.$ac_ext < #include <$ac_cv_struct_tm> @@ -4228,7 +4229,7 @@ int main() { struct tm tm; tm.tm_zone; ; return 0; } EOF -if { (eval echo configure:4232: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then +if { (eval echo configure:4233: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then rm -rf conftest* ac_cv_struct_tm_zone=yes else @@ -4251,10 +4252,10 @@ EOF else echo $ac_n "checking for tzname""... $ac_c" 1>&6 -echo "configure:4255: checking for tzname" >&5 +echo "configure:4256: checking for tzname" >&5 cat > conftest.$ac_ext < #ifndef tzname /* For SGI. */ @@ -4264,7 +4265,7 @@ int main() { atoi(*tzname); ; return 0; } EOF -if { (eval echo configure:4268: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then +if { (eval echo configure:4269: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then rm -rf conftest* ac_cv_var_tzname=yes else @@ -4290,10 +4291,10 @@ fi echo $ac_n "checking for working const""... $ac_c" 1>&6 -echo "configure:4294: checking for working const" >&5 +echo "configure:4295: checking for working const" >&5 cat > conftest.$ac_ext <&5; (eval $ac_compile) 2>&5; }; then +if { (eval echo configure:4347: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then rm -rf conftest* ac_cv_c_const=yes else @@ -4367,7 +4368,7 @@ fi echo $ac_n "checking whether ${MAKE-make} sets \${MAKE}""... $ac_c" 1>&6 -echo "configure:4371: checking whether ${MAKE-make} sets \${MAKE}" >&5 +echo "configure:4372: checking whether ${MAKE-make} sets \${MAKE}" >&5 set dummy ${MAKE-make}; ac_make=`echo "$2" | sed 'y%./+-%__p_%'` cat > conftestmake <<\EOF @@ -4392,12 +4393,12 @@ fi echo $ac_n "checking whether byte ordering is bigendian""... $ac_c" 1>&6 -echo "configure:4396: checking whether byte ordering is bigendian" >&5 +echo "configure:4397: checking whether byte ordering is bigendian" >&5 ac_cv_c_bigendian=unknown # See if sys/param.h defines the BYTE_ORDER macro. cat > conftest.$ac_ext < #include @@ -4408,11 +4409,11 @@ int main() { #endif ; return 0; } EOF -if { (eval echo configure:4412: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then +if { (eval echo configure:4413: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then rm -rf conftest* # It does; now see whether it defined to BIG_ENDIAN or not. cat > conftest.$ac_ext < #include @@ -4423,7 +4424,7 @@ int main() { #endif ; return 0; } EOF -if { (eval echo configure:4427: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then +if { (eval echo configure:4428: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then rm -rf conftest* ac_cv_c_bigendian=yes else @@ -4440,7 +4441,7 @@ fi rm -f conftest* if test $ac_cv_c_bigendian = unknown; then cat > conftest.$ac_ext <&5; (eval $ac_link) 2>&5; } && test -s conftest && (./conftest; exit $?) 2>&5 +if { (eval echo configure:4458: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest && (./conftest; exit $?) 2>&5 then ac_cv_c_bigendian=no else @@ -4480,10 +4481,10 @@ fi echo $ac_n "checking size of short""... $ac_c" 1>&6 -echo "configure:4484: checking size of short" >&5 +echo "configure:4485: checking size of short" >&5 cat > conftest.$ac_ext < #include @@ -4495,7 +4496,7 @@ main() exit(0); } EOF -if { (eval echo configure:4499: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest && (./conftest; exit $?) 2>&5 +if { (eval echo configure:4500: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest && (./conftest; exit $?) 2>&5 then ac_cv_sizeof_short=`cat conftestval` else @@ -4523,10 +4524,10 @@ if test "$ac_cv_sizeof_short" = 0; then exit 1 fi echo $ac_n "checking size of int""... $ac_c" 1>&6 -echo "configure:4527: checking size of int" >&5 +echo "configure:4528: checking size of int" >&5 cat > conftest.$ac_ext < #include @@ -4538,7 +4539,7 @@ main() exit(0); } EOF -if { (eval echo configure:4542: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest && (./conftest; exit $?) 2>&5 +if { (eval echo configure:4543: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest && (./conftest; exit $?) 2>&5 then ac_cv_sizeof_int=`cat conftestval` else @@ -4560,10 +4561,10 @@ EOF echo $ac_n "checking size of long""... $ac_c" 1>&6 -echo "configure:4564: checking size of long" >&5 +echo "configure:4565: checking size of long" >&5 cat > conftest.$ac_ext < #include @@ -4575,7 +4576,7 @@ main() exit(0); } EOF -if { (eval echo configure:4579: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest && (./conftest; exit $?) 2>&5 +if { (eval echo configure:4580: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest && (./conftest; exit $?) 2>&5 then ac_cv_sizeof_long=`cat conftestval` else @@ -4597,10 +4598,10 @@ EOF echo $ac_n "checking size of long long""... $ac_c" 1>&6 -echo "configure:4601: checking size of long long" >&5 +echo "configure:4602: checking size of long long" >&5 cat > conftest.$ac_ext < #include @@ -4612,7 +4613,7 @@ main() exit(0); } EOF -if { (eval echo configure:4616: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest && (./conftest; exit $?) 2>&5 +if { (eval echo configure:4617: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest && (./conftest; exit $?) 2>&5 then ac_cv_sizeof_long_long=`cat conftestval` else @@ -4634,10 +4635,10 @@ EOF echo $ac_n "checking size of void *""... $ac_c" 1>&6 -echo "configure:4638: checking size of void *" >&5 +echo "configure:4639: checking size of void *" >&5 cat > conftest.$ac_ext < #include @@ -4649,7 +4650,7 @@ main() exit(0); } EOF -if { (eval echo configure:4653: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest && (./conftest; exit $?) 2>&5 +if { (eval echo configure:4654: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest && (./conftest; exit $?) 2>&5 then ac_cv_sizeof_void_p=`cat conftestval` else @@ -4672,7 +4673,7 @@ EOF echo $ac_n "checking for long file names""... $ac_c" 1>&6 -echo "configure:4676: checking for long file names" >&5 +echo "configure:4677: checking for long file names" >&5 ac_cv_sys_long_file_names=yes # Test for long file names in all the places we know might matter: @@ -4718,10 +4719,10 @@ fi echo $ac_n "checking for sin""... $ac_c" 1>&6 -echo "configure:4722: checking for sin" >&5 +echo "configure:4723: checking for sin" >&5 cat > conftest.$ac_ext <&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then +if { (eval echo configure:4749: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then rm -rf conftest* eval "ac_cv_func_sin=yes" else @@ -4762,12 +4763,12 @@ else echo "$ac_t""no" 1>&6 echo $ac_n "checking for sin in -lm""... $ac_c" 1>&6 -echo "configure:4766: checking for sin in -lm" >&5 +echo "configure:4767: checking for sin in -lm" >&5 ac_lib_var=`echo m'_'sin | sed 'y%./+-%__p_%'` xe_check_libs=" -lm " cat > conftest.$ac_ext <&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then +if { (eval echo configure:4783: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then rm -rf conftest* eval "ac_cv_lib_$ac_lib_var=yes" else @@ -4822,14 +4823,14 @@ EOF cat > conftest.$ac_ext < int main() { return atanh(1.0) + asinh(1.0) + acosh(1.0); ; return 0; } EOF -if { (eval echo configure:4833: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then +if { (eval echo configure:4834: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then rm -rf conftest* { test "$extra_verbose" = "yes" && cat << \EOF Defining HAVE_INVERSE_HYPERBOLIC @@ -4846,14 +4847,14 @@ fi rm -f conftest* echo "checking type of mail spool file locking" 1>&6 -echo "configure:4850: checking type of mail spool file locking" >&5 +echo "configure:4851: checking type of mail spool file locking" >&5 for ac_func in lockf flock do echo $ac_n "checking for $ac_func""... $ac_c" 1>&6 -echo "configure:4854: checking for $ac_func" >&5 +echo "configure:4855: checking for $ac_func" >&5 cat > conftest.$ac_ext <&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then +if { (eval echo configure:4881: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then rm -rf conftest* eval "ac_cv_func_$ac_func=yes" else @@ -4958,12 +4959,12 @@ test "$mail_locking" = "locking" -a "$ac_cv_func_locking" != "yes" && \ case "$opsys" in decosf*) echo $ac_n "checking for cma_open in -lpthreads""... $ac_c" 1>&6 -echo "configure:4962: checking for cma_open in -lpthreads" >&5 +echo "configure:4963: checking for cma_open in -lpthreads" >&5 ac_lib_var=`echo pthreads'_'cma_open | sed 'y%./+-%__p_%'` xe_check_libs=" -lpthreads " cat > conftest.$ac_ext <&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then +if { (eval echo configure:4979: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then rm -rf conftest* eval "ac_cv_lib_$ac_lib_var=yes" else @@ -5011,7 +5012,7 @@ esac echo $ac_n "checking whether the -xildoff compiler flag is required""... $ac_c" 1>&6 -echo "configure:5015: checking whether the -xildoff compiler flag is required" >&5 +echo "configure:5016: checking whether the -xildoff compiler flag is required" >&5 if ${CC-cc} '-###' -xildon no_such_file.c 2>&1 | grep '^[^ ]*/ild ' > /dev/null ; then if ${CC-cc} '-###' -xildoff no_such_file.c 2>&1 | grep '^[^ ]*/ild ' > /dev/null ; then echo "$ac_t""no" 1>&6; @@ -5023,7 +5024,7 @@ fi if test "$opsys" = "sol2"; then if test "$os_release" -ge 56; then echo $ac_n "checking for \"-z ignore\" linker flag""... $ac_c" 1>&6 -echo "configure:5027: checking for \"-z ignore\" linker flag" >&5 +echo "configure:5028: checking for \"-z ignore\" linker flag" >&5 case "`ld -h 2>&1`" in *-z\ ignore\|record* ) echo "$ac_t""yes" 1>&6 ld_switch_site="-z ignore $ld_switch_site" && if test "$extra_verbose" = "yes"; then echo " Prepending \"-z ignore\" to \$ld_switch_site"; fi ;; @@ -5034,7 +5035,7 @@ fi echo "checking "for specified window system"" 1>&6 -echo "configure:5038: checking "for specified window system"" >&5 +echo "configure:5039: checking "for specified window system"" >&5 GNOME_CONFIG=no @@ -5042,7 +5043,7 @@ GTK_CONFIG=no if test "$with_gnome" != "no"; then echo $ac_n "checking for GNOME configuration script""... $ac_c" 1>&6 -echo "configure:5046: checking for GNOME configuration script" >&5 +echo "configure:5047: checking for GNOME configuration script" >&5 for possible in gnome-config do possible_version=`${possible} --version 2> /dev/null` @@ -5073,7 +5074,7 @@ fi if test "$with_gtk" != "no";then echo $ac_n "checking for GTK configuration script""... $ac_c" 1>&6 -echo "configure:5077: checking for GTK configuration script" >&5 +echo "configure:5078: checking for GTK configuration script" >&5 for possible in gtk12-config gtk14-config gtk-config do possible_version=`${possible} --version 2> /dev/null` @@ -5095,18 +5096,18 @@ fi if test "${GTK_CONFIG}" != "no"; then echo $ac_n "checking gtk version""... $ac_c" 1>&6 -echo "configure:5099: checking gtk version" >&5 +echo "configure:5100: checking gtk version" >&5 GTK_VERSION=`${GTK_CONFIG} --version` echo "$ac_t""${GTK_VERSION}" 1>&6 echo $ac_n "checking gtk libs""... $ac_c" 1>&6 -echo "configure:5104: checking gtk libs" >&5 +echo "configure:5105: checking gtk libs" >&5 GTK_LIBS=`${GTK_CONFIG} --libs` libs_gtk="$libs_gtk ${GTK_LIBS}" && if test "$extra_verbose" = "yes"; then echo " Appending \"${GTK_LIBS}\" to \$libs_gtk"; fi echo "$ac_t""${GTK_LIBS}" 1>&6 echo $ac_n "checking gtk cflags""... $ac_c" 1>&6 -echo "configure:5110: checking gtk cflags" >&5 +echo "configure:5111: checking gtk cflags" >&5 GTK_CFLAGS=`${GTK_CONFIG} --cflags` if test "$GCC" = "yes"; then GTK_CFLAGS="${GTK_CFLAGS} -Wno-shadow" @@ -5116,19 +5117,19 @@ echo "configure:5110: checking gtk cflags" >&5 echo $ac_n "checking for main in -lgdk_imlib""... $ac_c" 1>&6 -echo "configure:5120: checking for main in -lgdk_imlib" >&5 +echo "configure:5121: checking for main in -lgdk_imlib" >&5 ac_lib_var=`echo gdk_imlib'_'main | sed 'y%./+-%__p_%'` xe_check_libs=" -lgdk_imlib " cat > conftest.$ac_ext <&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then +if { (eval echo configure:5133: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then rm -rf conftest* eval "ac_cv_lib_$ac_lib_var=yes" else @@ -5150,12 +5151,12 @@ fi echo $ac_n "checking for Imlib_init in -lImlib""... $ac_c" 1>&6 -echo "configure:5154: checking for Imlib_init in -lImlib" >&5 +echo "configure:5155: checking for Imlib_init in -lImlib" >&5 ac_lib_var=`echo Imlib'_'Imlib_init | sed 'y%./+-%__p_%'` xe_check_libs=" -lImlib " cat > conftest.$ac_ext <&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then +if { (eval echo configure:5171: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then rm -rf conftest* eval "ac_cv_lib_$ac_lib_var=yes" else @@ -5189,10 +5190,10 @@ fi for ac_func in gdk_imlib_init do echo $ac_n "checking for $ac_func""... $ac_c" 1>&6 -echo "configure:5193: checking for $ac_func" >&5 +echo "configure:5194: checking for $ac_func" >&5 cat > conftest.$ac_ext <&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then +if { (eval echo configure:5220: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then rm -rf conftest* eval "ac_cv_func_$ac_func=yes" else @@ -5294,15 +5295,15 @@ EOF do ac_safe=`echo "$ac_hdr" | sed 'y%./+-%__p_%'` echo $ac_n "checking for $ac_hdr""... $ac_c" 1>&6 -echo "configure:5298: checking for $ac_hdr" >&5 +echo "configure:5299: checking for $ac_hdr" >&5 cat > conftest.$ac_ext < EOF ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out" -{ (eval echo configure:5306: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; } +{ (eval echo configure:5307: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; } ac_err=`grep -v '^ *+' conftest.out | grep -v "^conftest.${ac_ext}\$"` if test -z "$ac_err"; then rm -rf conftest* @@ -5333,19 +5334,19 @@ done echo $ac_n "checking for main in -lxml""... $ac_c" 1>&6 -echo "configure:5337: checking for main in -lxml" >&5 +echo "configure:5338: checking for main in -lxml" >&5 ac_lib_var=`echo xml'_'main | sed 'y%./+-%__p_%'` xe_check_libs=" -lxml " cat > conftest.$ac_ext <&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then +if { (eval echo configure:5350: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then rm -rf conftest* eval "ac_cv_lib_$ac_lib_var=yes" else @@ -5367,19 +5368,19 @@ fi echo $ac_n "checking for main in -lglade""... $ac_c" 1>&6 -echo "configure:5371: checking for main in -lglade" >&5 +echo "configure:5372: checking for main in -lglade" >&5 ac_lib_var=`echo glade'_'main | sed 'y%./+-%__p_%'` xe_check_libs=" -lglade " cat > conftest.$ac_ext <&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then +if { (eval echo configure:5384: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then rm -rf conftest* eval "ac_cv_lib_$ac_lib_var=yes" else @@ -5401,19 +5402,19 @@ fi echo $ac_n "checking for main in -lglade-gnome""... $ac_c" 1>&6 -echo "configure:5405: checking for main in -lglade-gnome" >&5 +echo "configure:5406: checking for main in -lglade-gnome" >&5 ac_lib_var=`echo glade-gnome'_'main | sed 'y%./+-%__p_%'` xe_check_libs=" -lglade-gnome " cat > conftest.$ac_ext <&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then +if { (eval echo configure:5418: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then rm -rf conftest* eval "ac_cv_lib_$ac_lib_var=yes" else @@ -5434,7 +5435,7 @@ fi cat > conftest.$ac_ext < EOF @@ -5493,7 +5494,7 @@ if test "$with_x11" != "no"; then # 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:5497: checking for X" >&5 +echo "configure:5498: checking for X" >&5 # Check whether --with-x or --without-x was given. if test "${with_x+set}" = set; then @@ -5553,12 +5554,12 @@ if test "$ac_x_includes" = NO; then # 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:5562: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; } +{ (eval echo configure:5563: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; } ac_err=`grep -v '^ *+' conftest.out | grep -v "^conftest.${ac_ext}\$"` if test -z "$ac_err"; then rm -rf conftest* @@ -5627,14 +5628,14 @@ if test "$ac_x_libraries" = NO; then ac_save_LIBS="$LIBS" LIBS="-l$x_direct_test_library $LIBS" cat > conftest.$ac_ext <&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then +if { (eval echo configure:5639: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then rm -rf conftest* LIBS="$ac_save_LIBS" # We can link X programs with no special library path. @@ -5743,17 +5744,17 @@ else case "`(uname -sr) 2>/dev/null`" in "SunOS 5"*) echo $ac_n "checking whether -R must be followed by a space""... $ac_c" 1>&6 -echo "configure:5747: checking whether -R must be followed by a space" >&5 +echo "configure:5748: checking whether -R must be followed by a space" >&5 ac_xsave_LIBS="$LIBS"; LIBS="$LIBS -R$x_libraries" cat > conftest.$ac_ext <&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then +if { (eval echo configure:5758: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then rm -rf conftest* ac_R_nospace=yes else @@ -5769,14 +5770,14 @@ rm -f conftest* else LIBS="$ac_xsave_LIBS -R $x_libraries" cat > conftest.$ac_ext <&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then +if { (eval echo configure:5781: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then rm -rf conftest* ac_R_space=yes else @@ -5812,12 +5813,12 @@ ac_cv_lib_dnet_dnet_ntoa=no else echo $ac_n "checking for dnet_ntoa in -ldnet""... $ac_c" 1>&6 -echo "configure:5816: checking for dnet_ntoa in -ldnet" >&5 +echo "configure:5817: checking for dnet_ntoa in -ldnet" >&5 ac_lib_var=`echo dnet'_'dnet_ntoa | sed 'y%./+-%__p_%'` xe_check_libs=" -ldnet " cat > conftest.$ac_ext <&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then +if { (eval echo configure:5833: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then rm -rf conftest* eval "ac_cv_lib_$ac_lib_var=yes" else @@ -5852,12 +5853,12 @@ fi if test $ac_cv_lib_dnet_dnet_ntoa = no; then echo $ac_n "checking for dnet_ntoa in -ldnet_stub""... $ac_c" 1>&6 -echo "configure:5856: checking for dnet_ntoa in -ldnet_stub" >&5 +echo "configure:5857: checking for dnet_ntoa in -ldnet_stub" >&5 ac_lib_var=`echo dnet_stub'_'dnet_ntoa | sed 'y%./+-%__p_%'` xe_check_libs=" -ldnet_stub " cat > conftest.$ac_ext <&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then +if { (eval echo configure:5873: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then rm -rf conftest* eval "ac_cv_lib_$ac_lib_var=yes" else @@ -5897,10 +5898,10 @@ fi # The nsl library prevents programs from opening the X display # on Irix 5.2, according to dickey@clark.net. echo $ac_n "checking for gethostbyname""... $ac_c" 1>&6 -echo "configure:5901: checking for gethostbyname" >&5 +echo "configure:5902: checking for gethostbyname" >&5 cat > conftest.$ac_ext <&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then +if { (eval echo configure:5928: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then rm -rf conftest* eval "ac_cv_func_gethostbyname=yes" else @@ -5944,12 +5945,12 @@ fi if test $ac_cv_func_gethostbyname = no; then echo $ac_n "checking for gethostbyname in -lnsl""... $ac_c" 1>&6 -echo "configure:5948: checking for gethostbyname in -lnsl" >&5 +echo "configure:5949: checking for gethostbyname in -lnsl" >&5 ac_lib_var=`echo nsl'_'gethostbyname | sed 'y%./+-%__p_%'` xe_check_libs=" -lnsl " cat > conftest.$ac_ext <&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then +if { (eval echo configure:5965: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then rm -rf conftest* eval "ac_cv_lib_$ac_lib_var=yes" else @@ -5990,10 +5991,10 @@ fi # -lsocket must be given before -lnsl if both are needed. # We assume that if connect needs -lnsl, so does gethostbyname. echo $ac_n "checking for connect""... $ac_c" 1>&6 -echo "configure:5994: checking for connect" >&5 +echo "configure:5995: checking for connect" >&5 cat > conftest.$ac_ext <&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then +if { (eval echo configure:6021: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then rm -rf conftest* eval "ac_cv_func_connect=yes" else @@ -6039,12 +6040,12 @@ fi xe_msg_checking="for connect in -lsocket" test -n "$X_EXTRA_LIBS" && xe_msg_checking="$xe_msg_checking using extra libs $X_EXTRA_LIBS" echo $ac_n "checking "$xe_msg_checking"""... $ac_c" 1>&6 -echo "configure:6043: checking "$xe_msg_checking"" >&5 +echo "configure:6044: checking "$xe_msg_checking"" >&5 ac_lib_var=`echo socket'_'connect | sed 'y%./+-%__p_%'` xe_check_libs=" -lsocket $X_EXTRA_LIBS" cat > conftest.$ac_ext <&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then +if { (eval echo configure:6060: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then rm -rf conftest* eval "ac_cv_lib_$ac_lib_var=yes" else @@ -6079,10 +6080,10 @@ fi # gomez@mi.uni-erlangen.de says -lposix is necessary on A/UX. echo $ac_n "checking for remove""... $ac_c" 1>&6 -echo "configure:6083: checking for remove" >&5 +echo "configure:6084: checking for remove" >&5 cat > conftest.$ac_ext <&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then +if { (eval echo configure:6110: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then rm -rf conftest* eval "ac_cv_func_remove=yes" else @@ -6126,12 +6127,12 @@ fi if test $ac_cv_func_remove = no; then echo $ac_n "checking for remove in -lposix""... $ac_c" 1>&6 -echo "configure:6130: checking for remove in -lposix" >&5 +echo "configure:6131: checking for remove in -lposix" >&5 ac_lib_var=`echo posix'_'remove | sed 'y%./+-%__p_%'` xe_check_libs=" -lposix " cat > conftest.$ac_ext <&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then +if { (eval echo configure:6147: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then rm -rf conftest* eval "ac_cv_lib_$ac_lib_var=yes" else @@ -6166,10 +6167,10 @@ fi # BSDI BSD/OS 2.1 needs -lipc for XOpenDisplay. echo $ac_n "checking for shmat""... $ac_c" 1>&6 -echo "configure:6170: checking for shmat" >&5 +echo "configure:6171: checking for shmat" >&5 cat > conftest.$ac_ext <&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then +if { (eval echo configure:6197: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then rm -rf conftest* eval "ac_cv_func_shmat=yes" else @@ -6213,12 +6214,12 @@ fi if test $ac_cv_func_shmat = no; then echo $ac_n "checking for shmat in -lipc""... $ac_c" 1>&6 -echo "configure:6217: checking for shmat in -lipc" >&5 +echo "configure:6218: checking for shmat in -lipc" >&5 ac_lib_var=`echo ipc'_'shmat | sed 'y%./+-%__p_%'` xe_check_libs=" -lipc " cat > conftest.$ac_ext <&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then +if { (eval echo configure:6234: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then rm -rf conftest* eval "ac_cv_lib_$ac_lib_var=yes" else @@ -6265,12 +6266,12 @@ fi xe_msg_checking="for IceConnectionNumber in -lICE" test -n "$X_EXTRA_LIBS" && xe_msg_checking="$xe_msg_checking using extra libs $X_EXTRA_LIBS" echo $ac_n "checking "$xe_msg_checking"""... $ac_c" 1>&6 -echo "configure:6269: checking "$xe_msg_checking"" >&5 +echo "configure:6270: checking "$xe_msg_checking"" >&5 ac_lib_var=`echo ICE'_'IceConnectionNumber | sed 'y%./+-%__p_%'` xe_check_libs=" -lICE $X_EXTRA_LIBS" cat > conftest.$ac_ext <&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then +if { (eval echo configure:6286: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then rm -rf conftest* eval "ac_cv_lib_$ac_lib_var=yes" else @@ -6448,7 +6449,7 @@ EOF echo "checking for X defines extracted by xmkmf" 1>&6 -echo "configure:6452: checking for X defines extracted by xmkmf" >&5 +echo "configure:6453: checking for X defines extracted by xmkmf" >&5 rm -fr conftestdir if mkdir conftestdir; then cd conftestdir @@ -6497,15 +6498,15 @@ EOF ac_safe=`echo "X11/Intrinsic.h" | sed 'y%./+-%__p_%'` echo $ac_n "checking for X11/Intrinsic.h""... $ac_c" 1>&6 -echo "configure:6501: checking for X11/Intrinsic.h" >&5 +echo "configure:6502: checking for X11/Intrinsic.h" >&5 cat > conftest.$ac_ext < EOF ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out" -{ (eval echo configure:6509: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; } +{ (eval echo configure:6510: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; } ac_err=`grep -v '^ *+' conftest.out | grep -v "^conftest.${ac_ext}\$"` if test -z "$ac_err"; then rm -rf conftest* @@ -6529,12 +6530,12 @@ fi echo $ac_n "checking for XOpenDisplay in -lX11""... $ac_c" 1>&6 -echo "configure:6533: checking for XOpenDisplay in -lX11" >&5 +echo "configure:6534: checking for XOpenDisplay in -lX11" >&5 ac_lib_var=`echo X11'_'XOpenDisplay | sed 'y%./+-%__p_%'` xe_check_libs=" -lX11 " cat > conftest.$ac_ext <&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then +if { (eval echo configure:6550: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then rm -rf conftest* eval "ac_cv_lib_$ac_lib_var=yes" else @@ -6570,12 +6571,12 @@ fi xe_msg_checking="for XGetFontProperty in -lX11" test -n "-b i486-linuxaout" && xe_msg_checking="$xe_msg_checking using extra libs -b i486-linuxaout" echo $ac_n "checking "$xe_msg_checking"""... $ac_c" 1>&6 -echo "configure:6574: checking "$xe_msg_checking"" >&5 +echo "configure:6575: checking "$xe_msg_checking"" >&5 ac_lib_var=`echo X11'_'XGetFontProperty | sed 'y%./+-%__p_%'` xe_check_libs=" -lX11 -b i486-linuxaout" cat > conftest.$ac_ext <&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then +if { (eval echo configure:6591: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then rm -rf conftest* eval "ac_cv_lib_$ac_lib_var=yes" else @@ -6613,12 +6614,12 @@ fi echo $ac_n "checking for XShapeSelectInput in -lXext""... $ac_c" 1>&6 -echo "configure:6617: checking for XShapeSelectInput in -lXext" >&5 +echo "configure:6618: checking for XShapeSelectInput in -lXext" >&5 ac_lib_var=`echo Xext'_'XShapeSelectInput | sed 'y%./+-%__p_%'` xe_check_libs=" -lXext " cat > conftest.$ac_ext <&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then +if { (eval echo configure:6634: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then rm -rf conftest* eval "ac_cv_lib_$ac_lib_var=yes" else @@ -6652,12 +6653,12 @@ fi echo $ac_n "checking for XtOpenDisplay in -lXt""... $ac_c" 1>&6 -echo "configure:6656: checking for XtOpenDisplay in -lXt" >&5 +echo "configure:6657: checking for XtOpenDisplay in -lXt" >&5 ac_lib_var=`echo Xt'_'XtOpenDisplay | sed 'y%./+-%__p_%'` xe_check_libs=" -lXt " cat > conftest.$ac_ext <&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then +if { (eval echo configure:6673: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then rm -rf conftest* eval "ac_cv_lib_$ac_lib_var=yes" else @@ -6691,14 +6692,14 @@ fi echo $ac_n "checking the version of X11 being used""... $ac_c" 1>&6 -echo "configure:6695: checking the version of X11 being used" >&5 +echo "configure:6696: checking the version of X11 being used" >&5 cat > conftest.$ac_ext < int main(int c, char *v[]) { return c>1 ? XlibSpecificationRelease : 0; } EOF -if { (eval echo configure:6702: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest && (./conftest; exit $?) 2>&5 +if { (eval echo configure:6703: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest && (./conftest; exit $?) 2>&5 then ./conftest foobar; x11_release=$? else @@ -6729,10 +6730,10 @@ EOF for ac_func in XConvertCase do echo $ac_n "checking for $ac_func""... $ac_c" 1>&6 -echo "configure:6733: checking for $ac_func" >&5 +echo "configure:6734: checking for $ac_func" >&5 cat > conftest.$ac_ext <&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then +if { (eval echo configure:6760: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then rm -rf conftest* eval "ac_cv_func_$ac_func=yes" else @@ -6787,15 +6788,15 @@ done do ac_safe=`echo "$ac_hdr" | sed 'y%./+-%__p_%'` echo $ac_n "checking for $ac_hdr""... $ac_c" 1>&6 -echo "configure:6791: checking for $ac_hdr" >&5 +echo "configure:6792: checking for $ac_hdr" >&5 cat > conftest.$ac_ext < EOF ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out" -{ (eval echo configure:6799: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; } +{ (eval echo configure:6800: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; } ac_err=`grep -v '^ *+' conftest.out | grep -v "^conftest.${ac_ext}\$"` if test -z "$ac_err"; then rm -rf conftest* @@ -6828,10 +6829,10 @@ done for ac_func in XRegisterIMInstantiateCallback do echo $ac_n "checking for $ac_func""... $ac_c" 1>&6 -echo "configure:6832: checking for $ac_func" >&5 +echo "configure:6833: checking for $ac_func" >&5 cat > conftest.$ac_ext <&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then +if { (eval echo configure:6859: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then rm -rf conftest* eval "ac_cv_func_$ac_func=yes" else @@ -6882,9 +6883,9 @@ fi done echo $ac_n "checking for standard XRegisterIMInstantiateCallback prototype""... $ac_c" 1>&6 -echo "configure:6886: checking for standard XRegisterIMInstantiateCallback prototype" >&5 +echo "configure:6887: checking for standard XRegisterIMInstantiateCallback prototype" >&5 cat > conftest.$ac_ext <&5; (eval $ac_compile) 2>&5; }; then +if { (eval echo configure:6901: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then rm -rf conftest* echo "$ac_t""yes" 1>&6 else @@ -6917,12 +6918,12 @@ rm -f conftest* test -z "$with_xmu" && { echo $ac_n "checking for XmuReadBitmapDataFromFile in -lXmu""... $ac_c" 1>&6 -echo "configure:6921: checking for XmuReadBitmapDataFromFile in -lXmu" >&5 +echo "configure:6922: checking for XmuReadBitmapDataFromFile in -lXmu" >&5 ac_lib_var=`echo Xmu'_'XmuReadBitmapDataFromFile | sed 'y%./+-%__p_%'` xe_check_libs=" -lXmu " cat > conftest.$ac_ext <&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then +if { (eval echo configure:6938: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then rm -rf conftest* eval "ac_cv_lib_$ac_lib_var=yes" else @@ -6972,19 +6973,19 @@ EOF echo $ac_n "checking for main in -lXbsd""... $ac_c" 1>&6 -echo "configure:6976: checking for main in -lXbsd" >&5 +echo "configure:6977: checking for main in -lXbsd" >&5 ac_lib_var=`echo Xbsd'_'main | sed 'y%./+-%__p_%'` xe_check_libs=" -lXbsd " cat > conftest.$ac_ext <&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then +if { (eval echo configure:6989: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then rm -rf conftest* eval "ac_cv_lib_$ac_lib_var=yes" else @@ -7021,22 +7022,22 @@ fi fi if test "$with_msw" != "no"; then echo "checking for MS-Windows" 1>&6 -echo "configure:7025: checking for MS-Windows" >&5 +echo "configure:7026: checking for MS-Windows" >&5 echo $ac_n "checking for main in -lgdi32""... $ac_c" 1>&6 -echo "configure:7028: checking for main in -lgdi32" >&5 +echo "configure:7029: checking for main in -lgdi32" >&5 ac_lib_var=`echo gdi32'_'main | sed 'y%./+-%__p_%'` xe_check_libs=" -lgdi32 " cat > conftest.$ac_ext <&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then +if { (eval echo configure:7041: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then rm -rf conftest* eval "ac_cv_lib_$ac_lib_var=yes" else @@ -7109,12 +7110,12 @@ EOF fi fi cat > conftest.$ac_ext < int main() { return (open("/dev/windows", O_RDONLY, 0) > 0)? 0 : 1; } EOF -if { (eval echo configure:7118: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest && (./conftest; exit $?) 2>&5 +if { (eval echo configure:7119: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest && (./conftest; exit $?) 2>&5 then need_event_unixoid=yes; { test "$extra_verbose" = "yes" && cat << \EOF Defining HAVE_MSG_SELECT @@ -7178,15 +7179,15 @@ fi if test "$with_x11" = "yes"; then ac_safe=`echo "X11/extensions/shape.h" | sed 'y%./+-%__p_%'` echo $ac_n "checking for X11/extensions/shape.h""... $ac_c" 1>&6 -echo "configure:7182: checking for X11/extensions/shape.h" >&5 +echo "configure:7183: checking for X11/extensions/shape.h" >&5 cat > conftest.$ac_ext < EOF ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out" -{ (eval echo configure:7190: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; } +{ (eval echo configure:7191: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; } ac_err=`grep -v '^ *+' conftest.out | grep -v "^conftest.${ac_ext}\$"` if test -z "$ac_err"; then rm -rf conftest* @@ -7238,7 +7239,7 @@ case "$x_libraries" in *X11R4* ) esac echo "checking for WM_COMMAND option" 1>&6 -echo "configure:7242: checking for WM_COMMAND option" >&5; +echo "configure:7243: checking for WM_COMMAND option" >&5; if test "$with_wmcommand" != "no"; then { test "$extra_verbose" = "yes" && cat << \EOF Defining HAVE_WMCOMMAND @@ -7253,15 +7254,15 @@ fi test -z "$with_xauth" && test "$window_system" = "none" && with_xauth=no test -z "$with_xauth" && { ac_safe=`echo "X11/Xauth.h" | sed 'y%./+-%__p_%'` echo $ac_n "checking for X11/Xauth.h""... $ac_c" 1>&6 -echo "configure:7257: checking for X11/Xauth.h" >&5 +echo "configure:7258: checking for X11/Xauth.h" >&5 cat > conftest.$ac_ext < EOF ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out" -{ (eval echo configure:7265: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; } +{ (eval echo configure:7266: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; } ac_err=`grep -v '^ *+' conftest.out | grep -v "^conftest.${ac_ext}\$"` if test -z "$ac_err"; then rm -rf conftest* @@ -7284,12 +7285,12 @@ fi } test -z "$with_xauth" && { echo $ac_n "checking for XauGetAuthByAddr in -lXau""... $ac_c" 1>&6 -echo "configure:7288: checking for XauGetAuthByAddr in -lXau" >&5 +echo "configure:7289: checking for XauGetAuthByAddr in -lXau" >&5 ac_lib_var=`echo Xau'_'XauGetAuthByAddr | sed 'y%./+-%__p_%'` xe_check_libs=" -lXau " cat > conftest.$ac_ext <&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then +if { (eval echo configure:7305: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then rm -rf conftest* eval "ac_cv_lib_$ac_lib_var=yes" else @@ -7345,15 +7346,15 @@ if test "$with_tooltalk" != "no" ; then for dir in "" "Tt/" "desktop/" ; do ac_safe=`echo "${dir}tt_c.h" | sed 'y%./+-%__p_%'` echo $ac_n "checking for ${dir}tt_c.h""... $ac_c" 1>&6 -echo "configure:7349: checking for ${dir}tt_c.h" >&5 +echo "configure:7350: checking for ${dir}tt_c.h" >&5 cat > conftest.$ac_ext < EOF ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out" -{ (eval echo configure:7357: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; } +{ (eval echo configure:7358: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; } ac_err=`grep -v '^ *+' conftest.out | grep -v "^conftest.${ac_ext}\$"` if test -z "$ac_err"; then rm -rf conftest* @@ -7389,12 +7390,12 @@ if test "$with_tooltalk" != "no" ; then xe_msg_checking="for tt_message_create in -ltt" test -n "$extra_libs" && xe_msg_checking="$xe_msg_checking using extra libs $extra_libs" echo $ac_n "checking "$xe_msg_checking"""... $ac_c" 1>&6 -echo "configure:7393: checking "$xe_msg_checking"" >&5 +echo "configure:7394: checking "$xe_msg_checking"" >&5 ac_lib_var=`echo tt'_'tt_message_create | sed 'y%./+-%__p_%'` xe_check_libs=" -ltt $extra_libs" cat > conftest.$ac_ext <&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then +if { (eval echo configure:7410: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then rm -rf conftest* eval "ac_cv_lib_$ac_lib_var=yes" else @@ -7462,15 +7463,15 @@ fi test -z "$with_cde" && { ac_safe=`echo "Dt/Dt.h" | sed 'y%./+-%__p_%'` echo $ac_n "checking for Dt/Dt.h""... $ac_c" 1>&6 -echo "configure:7466: checking for Dt/Dt.h" >&5 +echo "configure:7467: checking for Dt/Dt.h" >&5 cat > conftest.$ac_ext < EOF ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out" -{ (eval echo configure:7474: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; } +{ (eval echo configure:7475: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; } ac_err=`grep -v '^ *+' conftest.out | grep -v "^conftest.${ac_ext}\$"` if test -z "$ac_err"; then rm -rf conftest* @@ -7493,12 +7494,12 @@ fi } test -z "$with_cde" && { echo $ac_n "checking for DtDndDragStart in -lDtSvc""... $ac_c" 1>&6 -echo "configure:7497: checking for DtDndDragStart in -lDtSvc" >&5 +echo "configure:7498: checking for DtDndDragStart in -lDtSvc" >&5 ac_lib_var=`echo DtSvc'_'DtDndDragStart | sed 'y%./+-%__p_%'` xe_check_libs=" -lDtSvc " cat > conftest.$ac_ext <&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then +if { (eval echo configure:7514: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then rm -rf conftest* eval "ac_cv_lib_$ac_lib_var=yes" else @@ -7582,7 +7583,7 @@ fi if test "$with_dragndrop" != "no" ; then echo $ac_n "checking if drag and drop API is needed""... $ac_c" 1>&6 -echo "configure:7586: checking if drag and drop API is needed" >&5 +echo "configure:7587: checking if drag and drop API is needed" >&5 if test -n "$dragndrop_proto" ; then with_dragndrop=yes echo "$ac_t""yes (${dragndrop_proto} )" 1>&6 @@ -7602,18 +7603,18 @@ EOF fi echo "checking for LDAP" 1>&6 -echo "configure:7606: checking for LDAP" >&5 +echo "configure:7607: checking for LDAP" >&5 test -z "$with_ldap" && { ac_safe=`echo "ldap.h" | sed 'y%./+-%__p_%'` echo $ac_n "checking for ldap.h""... $ac_c" 1>&6 -echo "configure:7609: checking for ldap.h" >&5 +echo "configure:7610: checking for ldap.h" >&5 cat > conftest.$ac_ext < EOF ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out" -{ (eval echo configure:7617: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; } +{ (eval echo configure:7618: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; } ac_err=`grep -v '^ *+' conftest.out | grep -v "^conftest.${ac_ext}\$"` if test -z "$ac_err"; then rm -rf conftest* @@ -7636,15 +7637,15 @@ fi } test -z "$with_ldap" && { ac_safe=`echo "lber.h" | sed 'y%./+-%__p_%'` echo $ac_n "checking for lber.h""... $ac_c" 1>&6 -echo "configure:7640: checking for lber.h" >&5 +echo "configure:7641: checking for lber.h" >&5 cat > conftest.$ac_ext < EOF ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out" -{ (eval echo configure:7648: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; } +{ (eval echo configure:7649: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; } ac_err=`grep -v '^ *+' conftest.out | grep -v "^conftest.${ac_ext}\$"` if test -z "$ac_err"; then rm -rf conftest* @@ -7668,12 +7669,12 @@ fi if test "$with_ldap" != "no"; then echo $ac_n "checking for ldap_search in -lldap""... $ac_c" 1>&6 -echo "configure:7672: checking for ldap_search in -lldap" >&5 +echo "configure:7673: checking for ldap_search in -lldap" >&5 ac_lib_var=`echo ldap'_'ldap_search | sed 'y%./+-%__p_%'` xe_check_libs=" -lldap " cat > conftest.$ac_ext <&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then +if { (eval echo configure:7689: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then rm -rf conftest* eval "ac_cv_lib_$ac_lib_var=yes" else @@ -7709,12 +7710,12 @@ fi xe_msg_checking="for ldap_open in -lldap" test -n "-llber" && xe_msg_checking="$xe_msg_checking using extra libs -llber" echo $ac_n "checking "$xe_msg_checking"""... $ac_c" 1>&6 -echo "configure:7713: checking "$xe_msg_checking"" >&5 +echo "configure:7714: checking "$xe_msg_checking"" >&5 ac_lib_var=`echo ldap'_'ldap_open | sed 'y%./+-%__p_%'` xe_check_libs=" -lldap -llber" cat > conftest.$ac_ext <&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then +if { (eval echo configure:7730: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then rm -rf conftest* eval "ac_cv_lib_$ac_lib_var=yes" else @@ -7750,12 +7751,12 @@ fi xe_msg_checking="for ldap_open in -lldap" test -n "-llber -lkrb" && xe_msg_checking="$xe_msg_checking using extra libs -llber -lkrb" echo $ac_n "checking "$xe_msg_checking"""... $ac_c" 1>&6 -echo "configure:7754: checking "$xe_msg_checking"" >&5 +echo "configure:7755: checking "$xe_msg_checking"" >&5 ac_lib_var=`echo ldap'_'ldap_open | sed 'y%./+-%__p_%'` xe_check_libs=" -lldap -llber -lkrb" cat > conftest.$ac_ext <&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then +if { (eval echo configure:7771: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then rm -rf conftest* eval "ac_cv_lib_$ac_lib_var=yes" else @@ -7791,12 +7792,12 @@ fi xe_msg_checking="for ldap_open in -lldap" test -n "-llber -lkrb -ldes" && xe_msg_checking="$xe_msg_checking using extra libs -llber -lkrb -ldes" echo $ac_n "checking "$xe_msg_checking"""... $ac_c" 1>&6 -echo "configure:7795: checking "$xe_msg_checking"" >&5 +echo "configure:7796: checking "$xe_msg_checking"" >&5 ac_lib_var=`echo ldap'_'ldap_open | sed 'y%./+-%__p_%'` xe_check_libs=" -lldap -llber -lkrb -ldes" cat > conftest.$ac_ext <&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then +if { (eval echo configure:7812: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then rm -rf conftest* eval "ac_cv_lib_$ac_lib_var=yes" else @@ -7858,10 +7859,10 @@ EOF for ac_func in ldap_set_option ldap_get_lderrno ldap_result2error ldap_parse_result do echo $ac_n "checking for $ac_func""... $ac_c" 1>&6 -echo "configure:7862: checking for $ac_func" >&5 +echo "configure:7863: checking for $ac_func" >&5 cat > conftest.$ac_ext <&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then +if { (eval echo configure:7889: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then rm -rf conftest* eval "ac_cv_func_$ac_func=yes" else @@ -7915,20 +7916,20 @@ fi if test "$with_postgresql" != "no"; then echo "checking for PostgreSQL" 1>&6 -echo "configure:7919: checking for PostgreSQL" >&5 +echo "configure:7920: checking for PostgreSQL" >&5 for header_dir in "" "pgsql/" "postgresql/"; do ac_safe=`echo "${header_dir}libpq-fe.h" | sed 'y%./+-%__p_%'` echo $ac_n "checking for ${header_dir}libpq-fe.h""... $ac_c" 1>&6 -echo "configure:7924: checking for ${header_dir}libpq-fe.h" >&5 +echo "configure:7925: checking for ${header_dir}libpq-fe.h" >&5 cat > conftest.$ac_ext < EOF ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out" -{ (eval echo configure:7932: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; } +{ (eval echo configure:7933: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; } ac_err=`grep -v '^ *+' conftest.out | grep -v "^conftest.${ac_ext}\$"` if test -z "$ac_err"; then rm -rf conftest* @@ -7952,12 +7953,12 @@ fi test -n "$libpq_fe_h_file" && { echo $ac_n "checking for PQconnectdb in -lpq""... $ac_c" 1>&6 -echo "configure:7956: checking for PQconnectdb in -lpq" >&5 +echo "configure:7957: checking for PQconnectdb in -lpq" >&5 ac_lib_var=`echo pq'_'PQconnectdb | sed 'y%./+-%__p_%'` xe_check_libs=" -lpq " cat > conftest.$ac_ext <&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then +if { (eval echo configure:7973: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then rm -rf conftest* eval "ac_cv_lib_$ac_lib_var=yes" else @@ -8001,12 +8002,12 @@ EOF echo $ac_n "checking for PQconnectStart in -lpq""... $ac_c" 1>&6 -echo "configure:8005: checking for PQconnectStart in -lpq" >&5 +echo "configure:8006: checking for PQconnectStart in -lpq" >&5 ac_lib_var=`echo pq'_'PQconnectStart | sed 'y%./+-%__p_%'` xe_check_libs=" -lpq " cat > conftest.$ac_ext <&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then +if { (eval echo configure:8022: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then rm -rf conftest* eval "ac_cv_lib_$ac_lib_var=yes" else @@ -8065,7 +8066,7 @@ fi if test "$window_system" != "none"; then echo "checking for graphics libraries" 1>&6 -echo "configure:8069: checking for graphics libraries" >&5 +echo "configure:8070: checking for graphics libraries" >&5 libpath_xpm= incpath_xpm= @@ -8091,10 +8092,10 @@ echo "configure:8069: checking for graphics libraries" >&5 CFLAGS=""$incpath_xpm" $CFLAGS" && if test "$extra_verbose" = "yes"; then echo " Prepending \""$incpath_xpm"\" to \$CFLAGS"; fi LDFLAGS=""$libpath_xpm" $LDFLAGS" && if test "$extra_verbose" = "yes"; then echo " Prepending \""$libpath_xpm"\" to \$LDFLAGS"; fi echo $ac_n "checking for Xpm - no older than 3.4f""... $ac_c" 1>&6 -echo "configure:8095: checking for Xpm - no older than 3.4f" >&5 +echo "configure:8096: checking for Xpm - no older than 3.4f" >&5 xe_check_libs=-lXpm cat > conftest.$ac_ext < @@ -8103,7 +8104,7 @@ echo "configure:8095: checking for Xpm - no older than 3.4f" >&5 XpmIncludeVersion != XpmLibraryVersion() ? 1 : XpmIncludeVersion < 30406 ? 2 : 0 ;} EOF -if { (eval echo configure:8107: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest && (./conftest; exit $?) 2>&5 +if { (eval echo configure:8108: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest && (./conftest; exit $?) 2>&5 then ./conftest dummy_arg; xpm_status=$?; if test "$xpm_status" = "0"; then @@ -8147,17 +8148,17 @@ EOF libs_x="-lXpm $libs_x" && if test "$extra_verbose" = "yes"; then echo " Prepending \"-lXpm\" to \$libs_x"; fi CFLAGS=""$incpath_xpm" $CFLAGS" && if test "$extra_verbose" = "yes"; then echo " Prepending \""$incpath_xpm"\" to \$CFLAGS"; fi echo $ac_n "checking for \"FOR_MSW\" xpm""... $ac_c" 1>&6 -echo "configure:8151: checking for \"FOR_MSW\" xpm" >&5 +echo "configure:8152: checking for \"FOR_MSW\" xpm" >&5 xe_check_libs=-lXpm cat > conftest.$ac_ext <&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then +if { (eval echo configure:8162: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then rm -rf conftest* xpm_for_msw=no else @@ -8183,15 +8184,15 @@ EOF test -z "$with_xface" && { ac_safe=`echo "compface.h" | sed 'y%./+-%__p_%'` echo $ac_n "checking for compface.h""... $ac_c" 1>&6 -echo "configure:8187: checking for compface.h" >&5 +echo "configure:8188: checking for compface.h" >&5 cat > conftest.$ac_ext < EOF ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out" -{ (eval echo configure:8195: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; } +{ (eval echo configure:8196: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; } ac_err=`grep -v '^ *+' conftest.out | grep -v "^conftest.${ac_ext}\$"` if test -z "$ac_err"; then rm -rf conftest* @@ -8214,12 +8215,12 @@ fi } test -z "$with_xface" && { echo $ac_n "checking for UnGenFace in -lcompface""... $ac_c" 1>&6 -echo "configure:8218: checking for UnGenFace in -lcompface" >&5 +echo "configure:8219: checking for UnGenFace in -lcompface" >&5 ac_lib_var=`echo compface'_'UnGenFace | sed 'y%./+-%__p_%'` xe_check_libs=" -lcompface " cat > conftest.$ac_ext <&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then +if { (eval echo configure:8235: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then rm -rf conftest* eval "ac_cv_lib_$ac_lib_var=yes" else @@ -8282,12 +8283,12 @@ EOF if test "$with_png $with_tiff" != "no no"; then echo $ac_n "checking for inflate in -lc""... $ac_c" 1>&6 -echo "configure:8286: checking for inflate in -lc" >&5 +echo "configure:8287: checking for inflate in -lc" >&5 ac_lib_var=`echo c'_'inflate | sed 'y%./+-%__p_%'` xe_check_libs=" -lc " cat > conftest.$ac_ext <&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then +if { (eval echo configure:8303: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then rm -rf conftest* eval "ac_cv_lib_$ac_lib_var=yes" else @@ -8317,12 +8318,12 @@ else echo "$ac_t""no" 1>&6 echo $ac_n "checking for inflate in -lz""... $ac_c" 1>&6 -echo "configure:8321: checking for inflate in -lz" >&5 +echo "configure:8322: checking for inflate in -lz" >&5 ac_lib_var=`echo z'_'inflate | sed 'y%./+-%__p_%'` xe_check_libs=" -lz " cat > conftest.$ac_ext <&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then +if { (eval echo configure:8338: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then rm -rf conftest* eval "ac_cv_lib_$ac_lib_var=yes" else @@ -8352,12 +8353,12 @@ else echo "$ac_t""no" 1>&6 echo $ac_n "checking for inflate in -lgz""... $ac_c" 1>&6 -echo "configure:8356: checking for inflate in -lgz" >&5 +echo "configure:8357: checking for inflate in -lgz" >&5 ac_lib_var=`echo gz'_'inflate | sed 'y%./+-%__p_%'` xe_check_libs=" -lgz " cat > conftest.$ac_ext <&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then +if { (eval echo configure:8373: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then rm -rf conftest* eval "ac_cv_lib_$ac_lib_var=yes" else @@ -8398,15 +8399,15 @@ fi test -z "$with_jpeg" && { ac_safe=`echo "jpeglib.h" | sed 'y%./+-%__p_%'` echo $ac_n "checking for jpeglib.h""... $ac_c" 1>&6 -echo "configure:8402: checking for jpeglib.h" >&5 +echo "configure:8403: checking for jpeglib.h" >&5 cat > conftest.$ac_ext < EOF ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out" -{ (eval echo configure:8410: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; } +{ (eval echo configure:8411: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; } ac_err=`grep -v '^ *+' conftest.out | grep -v "^conftest.${ac_ext}\$"` if test -z "$ac_err"; then rm -rf conftest* @@ -8429,12 +8430,12 @@ fi } test -z "$with_jpeg" && { echo $ac_n "checking for jpeg_destroy_decompress in -ljpeg""... $ac_c" 1>&6 -echo "configure:8433: checking for jpeg_destroy_decompress in -ljpeg" >&5 +echo "configure:8434: checking for jpeg_destroy_decompress in -ljpeg" >&5 ac_lib_var=`echo jpeg'_'jpeg_destroy_decompress | sed 'y%./+-%__p_%'` xe_check_libs=" -ljpeg " cat > conftest.$ac_ext <&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then +if { (eval echo configure:8450: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then rm -rf conftest* eval "ac_cv_lib_$ac_lib_var=yes" else @@ -8481,10 +8482,10 @@ EOF png_problem="" test -z "$with_png" && { echo $ac_n "checking for pow""... $ac_c" 1>&6 -echo "configure:8485: checking for pow" >&5 +echo "configure:8486: checking for pow" >&5 cat > conftest.$ac_ext <&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then +if { (eval echo configure:8512: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then rm -rf conftest* eval "ac_cv_func_pow=yes" else @@ -8528,15 +8529,15 @@ fi } test -z "$with_png" && { ac_safe=`echo "png.h" | sed 'y%./+-%__p_%'` echo $ac_n "checking for png.h""... $ac_c" 1>&6 -echo "configure:8532: checking for png.h" >&5 +echo "configure:8533: checking for png.h" >&5 cat > conftest.$ac_ext < EOF ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out" -{ (eval echo configure:8540: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; } +{ (eval echo configure:8541: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; } ac_err=`grep -v '^ *+' conftest.out | grep -v "^conftest.${ac_ext}\$"` if test -z "$ac_err"; then rm -rf conftest* @@ -8559,12 +8560,12 @@ fi } test -z "$with_png" && { echo $ac_n "checking for png_read_image in -lpng""... $ac_c" 1>&6 -echo "configure:8563: checking for png_read_image in -lpng" >&5 +echo "configure:8564: checking for png_read_image in -lpng" >&5 ac_lib_var=`echo png'_'png_read_image | sed 'y%./+-%__p_%'` xe_check_libs=" -lpng " cat > conftest.$ac_ext <&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then +if { (eval echo configure:8580: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then rm -rf conftest* eval "ac_cv_lib_$ac_lib_var=yes" else @@ -8598,10 +8599,10 @@ fi } if test -z "$with_png"; then echo $ac_n "checking for workable png version information""... $ac_c" 1>&6 -echo "configure:8602: checking for workable png version information" >&5 +echo "configure:8603: checking for workable png version information" >&5 xe_check_libs="-lpng -lz" cat > conftest.$ac_ext < int main(int c, char **v) { @@ -8609,7 +8610,7 @@ echo "configure:8602: checking for workable png version information" >&5 if (strcmp(png_libpng_ver, PNG_LIBPNG_VER_STRING) != 0) return 1; return (PNG_LIBPNG_VER < 10002) ? 2 : 0 ;} EOF -if { (eval echo configure:8613: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest && (./conftest; exit $?) 2>&5 +if { (eval echo configure:8614: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest && (./conftest; exit $?) 2>&5 then ./conftest dummy_arg; png_status=$?; if test "$png_status" = "0"; then @@ -8652,15 +8653,15 @@ EOF test -z "$with_tiff" && { ac_safe=`echo "tiffio.h" | sed 'y%./+-%__p_%'` echo $ac_n "checking for tiffio.h""... $ac_c" 1>&6 -echo "configure:8656: checking for tiffio.h" >&5 +echo "configure:8657: checking for tiffio.h" >&5 cat > conftest.$ac_ext < EOF ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out" -{ (eval echo configure:8664: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; } +{ (eval echo configure:8665: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; } ac_err=`grep -v '^ *+' conftest.out | grep -v "^conftest.${ac_ext}\$"` if test -z "$ac_err"; then rm -rf conftest* @@ -8683,12 +8684,12 @@ fi } test -z "$with_tiff" && { echo $ac_n "checking for TIFFClientOpen in -ltiff""... $ac_c" 1>&6 -echo "configure:8687: checking for TIFFClientOpen in -ltiff" >&5 +echo "configure:8688: checking for TIFFClientOpen in -ltiff" >&5 ac_lib_var=`echo tiff'_'TIFFClientOpen | sed 'y%./+-%__p_%'` xe_check_libs=" -ltiff " cat > conftest.$ac_ext <&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then +if { (eval echo configure:8704: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then rm -rf conftest* eval "ac_cv_lib_$ac_lib_var=yes" else @@ -8738,15 +8739,15 @@ fi if test "$with_gtk" = "yes"; then test -z "$with_xface" && { ac_safe=`echo "compface.h" | sed 'y%./+-%__p_%'` echo $ac_n "checking for compface.h""... $ac_c" 1>&6 -echo "configure:8742: checking for compface.h" >&5 +echo "configure:8743: checking for compface.h" >&5 cat > conftest.$ac_ext < EOF ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out" -{ (eval echo configure:8750: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; } +{ (eval echo configure:8751: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; } ac_err=`grep -v '^ *+' conftest.out | grep -v "^conftest.${ac_ext}\$"` if test -z "$ac_err"; then rm -rf conftest* @@ -8769,12 +8770,12 @@ fi } test -z "$with_xface" && { echo $ac_n "checking for UnGenFace in -lcompface""... $ac_c" 1>&6 -echo "configure:8773: checking for UnGenFace in -lcompface" >&5 +echo "configure:8774: checking for UnGenFace in -lcompface" >&5 ac_lib_var=`echo compface'_'UnGenFace | sed 'y%./+-%__p_%'` xe_check_libs=" -lcompface " cat > conftest.$ac_ext <&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then +if { (eval echo configure:8790: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then rm -rf conftest* eval "ac_cv_lib_$ac_lib_var=yes" else @@ -8824,7 +8825,7 @@ fi if test "$with_x11" = "yes"; then echo "checking for X11 graphics libraries" 1>&6 -echo "configure:8828: checking for X11 graphics libraries" >&5 +echo "configure:8829: checking for X11 graphics libraries" >&5 fi case "$with_widgets" in @@ -8834,7 +8835,7 @@ esac if test "$with_x11" = "yes" -a "$detect_athena" = "yes" ; then echo "checking for the Athena widgets" 1>&6 -echo "configure:8838: checking for the Athena widgets" >&5 +echo "configure:8839: checking for the Athena widgets" >&5 case "$with_athena" in "xaw" | "") athena_variant=Xaw athena_3d=no ;; @@ -8848,12 +8849,12 @@ echo "configure:8838: checking for the Athena widgets" >&5 if test "$athena_3d" = "no"; then echo $ac_n "checking for XawScrollbarSetThumb in -l$athena_variant""... $ac_c" 1>&6 -echo "configure:8852: checking for XawScrollbarSetThumb in -l$athena_variant" >&5 +echo "configure:8853: checking for XawScrollbarSetThumb in -l$athena_variant" >&5 ac_lib_var=`echo $athena_variant'_'XawScrollbarSetThumb | sed 'y%./+-%__p_%'` xe_check_libs=" -l$athena_variant " cat > conftest.$ac_ext <&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then +if { (eval echo configure:8869: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then rm -rf conftest* eval "ac_cv_lib_$ac_lib_var=yes" else @@ -8880,12 +8881,12 @@ if eval "test \"`echo '$ac_cv_lib_'$ac_lib_var`\" = yes" ; then echo "$ac_t""yes" 1>&6 echo $ac_n "checking for threeDClassRec in -l$athena_variant""... $ac_c" 1>&6 -echo "configure:8884: checking for threeDClassRec in -l$athena_variant" >&5 +echo "configure:8885: checking for threeDClassRec in -l$athena_variant" >&5 ac_lib_var=`echo $athena_variant'_'threeDClassRec | sed 'y%./+-%__p_%'` xe_check_libs=" -l$athena_variant " cat > conftest.$ac_ext <&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then +if { (eval echo configure:8901: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then rm -rf conftest* eval "ac_cv_lib_$ac_lib_var=yes" else @@ -8927,12 +8928,12 @@ fi else echo $ac_n "checking for threeDClassRec in -l$athena_variant""... $ac_c" 1>&6 -echo "configure:8931: checking for threeDClassRec in -l$athena_variant" >&5 +echo "configure:8932: checking for threeDClassRec in -l$athena_variant" >&5 ac_lib_var=`echo $athena_variant'_'threeDClassRec | sed 'y%./+-%__p_%'` xe_check_libs=" -l$athena_variant " cat > conftest.$ac_ext <&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then +if { (eval echo configure:8948: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then rm -rf conftest* eval "ac_cv_lib_$ac_lib_var=yes" else @@ -8961,12 +8962,12 @@ if eval "test \"`echo '$ac_cv_lib_'$ac_lib_var`\" = yes" ; then else echo "$ac_t""no" 1>&6 echo $ac_n "checking for threeDClassRec in -lXaw""... $ac_c" 1>&6 -echo "configure:8965: checking for threeDClassRec in -lXaw" >&5 +echo "configure:8966: checking for threeDClassRec in -lXaw" >&5 ac_lib_var=`echo Xaw'_'threeDClassRec | sed 'y%./+-%__p_%'` xe_check_libs=" -lXaw " cat > conftest.$ac_ext <&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then +if { (eval echo configure:8982: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then rm -rf conftest* eval "ac_cv_lib_$ac_lib_var=yes" else @@ -9008,15 +9009,15 @@ fi if test "$athena_3d" = "no"; then ac_safe=`echo "X11/Xaw/ThreeD.h" | sed 'y%./+-%__p_%'` echo $ac_n "checking for X11/Xaw/ThreeD.h""... $ac_c" 1>&6 -echo "configure:9012: checking for X11/Xaw/ThreeD.h" >&5 +echo "configure:9013: checking for X11/Xaw/ThreeD.h" >&5 cat > conftest.$ac_ext < EOF ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out" -{ (eval echo configure:9020: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; } +{ (eval echo configure:9021: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; } ac_err=`grep -v '^ *+' conftest.out | grep -v "^conftest.${ac_ext}\$"` if test -z "$ac_err"; then rm -rf conftest* @@ -9036,15 +9037,15 @@ else echo "$ac_t""no" 1>&6 ac_safe=`echo "X11/Xaw/XawInit.h" | sed 'y%./+-%__p_%'` echo $ac_n "checking for X11/Xaw/XawInit.h""... $ac_c" 1>&6 -echo "configure:9040: checking for X11/Xaw/XawInit.h" >&5 +echo "configure:9041: checking for X11/Xaw/XawInit.h" >&5 cat > conftest.$ac_ext < EOF ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out" -{ (eval echo configure:9048: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; } +{ (eval echo configure:9049: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; } ac_err=`grep -v '^ *+' conftest.out | grep -v "^conftest.${ac_ext}\$"` if test -z "$ac_err"; then rm -rf conftest* @@ -9070,15 +9071,15 @@ fi else ac_safe=`echo "X11/$athena_variant/XawInit.h" | sed 'y%./+-%__p_%'` echo $ac_n "checking for X11/$athena_variant/XawInit.h""... $ac_c" 1>&6 -echo "configure:9074: checking for X11/$athena_variant/XawInit.h" >&5 +echo "configure:9075: checking for X11/$athena_variant/XawInit.h" >&5 cat > conftest.$ac_ext < EOF ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out" -{ (eval echo configure:9082: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; } +{ (eval echo configure:9083: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; } ac_err=`grep -v '^ *+' conftest.out | grep -v "^conftest.${ac_ext}\$"` if test -z "$ac_err"; then rm -rf conftest* @@ -9095,15 +9096,15 @@ if eval "test \"`echo '$ac_cv_header_'$ac_safe`\" = yes"; then echo "$ac_t""yes" 1>&6 ac_safe=`echo "X11/$athena_variant/ThreeD.h" | sed 'y%./+-%__p_%'` echo $ac_n "checking for X11/$athena_variant/ThreeD.h""... $ac_c" 1>&6 -echo "configure:9099: checking for X11/$athena_variant/ThreeD.h" >&5 +echo "configure:9100: checking for X11/$athena_variant/ThreeD.h" >&5 cat > conftest.$ac_ext < EOF ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out" -{ (eval echo configure:9107: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; } +{ (eval echo configure:9108: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; } ac_err=`grep -v '^ *+' conftest.out | grep -v "^conftest.${ac_ext}\$"` if test -z "$ac_err"; then rm -rf conftest* @@ -9131,15 +9132,15 @@ fi if test -z "$athena_h_path"; then ac_safe=`echo "$athena_variant/XawInit.h" | sed 'y%./+-%__p_%'` echo $ac_n "checking for $athena_variant/XawInit.h""... $ac_c" 1>&6 -echo "configure:9135: checking for $athena_variant/XawInit.h" >&5 +echo "configure:9136: checking for $athena_variant/XawInit.h" >&5 cat > conftest.$ac_ext < EOF ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out" -{ (eval echo configure:9143: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; } +{ (eval echo configure:9144: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; } ac_err=`grep -v '^ *+' conftest.out | grep -v "^conftest.${ac_ext}\$"` if test -z "$ac_err"; then rm -rf conftest* @@ -9156,15 +9157,15 @@ if eval "test \"`echo '$ac_cv_header_'$ac_safe`\" = yes"; then echo "$ac_t""yes" 1>&6 ac_safe=`echo "$athena_variant/ThreeD.h" | sed 'y%./+-%__p_%'` echo $ac_n "checking for $athena_variant/ThreeD.h""... $ac_c" 1>&6 -echo "configure:9160: checking for $athena_variant/ThreeD.h" >&5 +echo "configure:9161: checking for $athena_variant/ThreeD.h" >&5 cat > conftest.$ac_ext < EOF ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out" -{ (eval echo configure:9168: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; } +{ (eval echo configure:9169: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; } ac_err=`grep -v '^ *+' conftest.out | grep -v "^conftest.${ac_ext}\$"` if test -z "$ac_err"; then rm -rf conftest* @@ -9193,15 +9194,15 @@ fi if test -z "$athena_h_path" -a "$athena_variant" != "Xaw3d"; then ac_safe=`echo "X11/Xaw3d/XawInit.h" | sed 'y%./+-%__p_%'` echo $ac_n "checking for X11/Xaw3d/XawInit.h""... $ac_c" 1>&6 -echo "configure:9197: checking for X11/Xaw3d/XawInit.h" >&5 +echo "configure:9198: checking for X11/Xaw3d/XawInit.h" >&5 cat > conftest.$ac_ext < EOF ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out" -{ (eval echo configure:9205: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; } +{ (eval echo configure:9206: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; } ac_err=`grep -v '^ *+' conftest.out | grep -v "^conftest.${ac_ext}\$"` if test -z "$ac_err"; then rm -rf conftest* @@ -9218,15 +9219,15 @@ if eval "test \"`echo '$ac_cv_header_'$ac_safe`\" = yes"; then echo "$ac_t""yes" 1>&6 ac_safe=`echo "X11/Xaw3d/ThreeD.h" | sed 'y%./+-%__p_%'` echo $ac_n "checking for X11/Xaw3d/ThreeD.h""... $ac_c" 1>&6 -echo "configure:9222: checking for X11/Xaw3d/ThreeD.h" >&5 +echo "configure:9223: checking for X11/Xaw3d/ThreeD.h" >&5 cat > conftest.$ac_ext < EOF ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out" -{ (eval echo configure:9230: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; } +{ (eval echo configure:9231: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; } ac_err=`grep -v '^ *+' conftest.out | grep -v "^conftest.${ac_ext}\$"` if test -z "$ac_err"; then rm -rf conftest* @@ -9258,15 +9259,15 @@ fi if test -z "$athena_h_path" -a "$athena_variant" != "Xaw3d"; then ac_safe=`echo "Xaw3d/XawInit.h" | sed 'y%./+-%__p_%'` echo $ac_n "checking for Xaw3d/XawInit.h""... $ac_c" 1>&6 -echo "configure:9262: checking for Xaw3d/XawInit.h" >&5 +echo "configure:9263: checking for Xaw3d/XawInit.h" >&5 cat > conftest.$ac_ext < EOF ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out" -{ (eval echo configure:9270: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; } +{ (eval echo configure:9271: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; } ac_err=`grep -v '^ *+' conftest.out | grep -v "^conftest.${ac_ext}\$"` if test -z "$ac_err"; then rm -rf conftest* @@ -9283,15 +9284,15 @@ if eval "test \"`echo '$ac_cv_header_'$ac_safe`\" = yes"; then echo "$ac_t""yes" 1>&6 ac_safe=`echo "Xaw3d/ThreeD.h" | sed 'y%./+-%__p_%'` echo $ac_n "checking for Xaw3d/ThreeD.h""... $ac_c" 1>&6 -echo "configure:9287: checking for Xaw3d/ThreeD.h" >&5 +echo "configure:9288: checking for Xaw3d/ThreeD.h" >&5 cat > conftest.$ac_ext < EOF ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out" -{ (eval echo configure:9295: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; } +{ (eval echo configure:9296: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; } ac_err=`grep -v '^ *+' conftest.out | grep -v "^conftest.${ac_ext}\$"` if test -z "$ac_err"; then rm -rf conftest* @@ -9323,15 +9324,15 @@ fi if test -z "$athena_h_path"; then ac_safe=`echo "X11/Xaw/ThreeD.h" | sed 'y%./+-%__p_%'` echo $ac_n "checking for X11/Xaw/ThreeD.h""... $ac_c" 1>&6 -echo "configure:9327: checking for X11/Xaw/ThreeD.h" >&5 +echo "configure:9328: checking for X11/Xaw/ThreeD.h" >&5 cat > conftest.$ac_ext < EOF ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out" -{ (eval echo configure:9335: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; } +{ (eval echo configure:9336: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; } ac_err=`grep -v '^ *+' conftest.out | grep -v "^conftest.${ac_ext}\$"` if test -z "$ac_err"; then rm -rf conftest* @@ -9370,15 +9371,15 @@ fi if test "$with_x11" = "yes"; then ac_safe=`echo "Xm/Xm.h" | sed 'y%./+-%__p_%'` echo $ac_n "checking for Xm/Xm.h""... $ac_c" 1>&6 -echo "configure:9374: checking for Xm/Xm.h" >&5 +echo "configure:9375: checking for Xm/Xm.h" >&5 cat > conftest.$ac_ext < EOF ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out" -{ (eval echo configure:9382: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; } +{ (eval echo configure:9383: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; } ac_err=`grep -v '^ *+' conftest.out | grep -v "^conftest.${ac_ext}\$"` if test -z "$ac_err"; then rm -rf conftest* @@ -9395,12 +9396,12 @@ if eval "test \"`echo '$ac_cv_header_'$ac_safe`\" = yes"; then echo "$ac_t""yes" 1>&6 echo $ac_n "checking for XmStringFree in -lXm""... $ac_c" 1>&6 -echo "configure:9399: checking for XmStringFree in -lXm" >&5 +echo "configure:9400: checking for XmStringFree in -lXm" >&5 ac_lib_var=`echo Xm'_'XmStringFree | sed 'y%./+-%__p_%'` xe_check_libs=" -lXm " cat > conftest.$ac_ext <&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then +if { (eval echo configure:9416: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then rm -rf conftest* eval "ac_cv_lib_$ac_lib_var=yes" else @@ -9440,9 +9441,9 @@ fi if test "$have_motif" = "yes"; then echo $ac_n "checking for Lesstif""... $ac_c" 1>&6 -echo "configure:9444: checking for Lesstif" >&5 +echo "configure:9445: checking for Lesstif" >&5 cat > conftest.$ac_ext < #ifdef LESSTIF_VERSION @@ -9866,7 +9867,7 @@ fi if test "$with_mule" = "yes" ; then echo "checking for Mule-related features" 1>&6 -echo "configure:9870: checking for Mule-related features" >&5 +echo "configure:9871: checking for Mule-related features" >&5 { test "$extra_verbose" = "yes" && cat << \EOF Defining MULE EOF @@ -9883,23 +9884,39 @@ cat >> confdefs.h <<\EOF EOF } - extra_objs="$extra_objs mule.o mule-ccl.o mule-charset.o file-coding.o" && if test "$extra_verbose" = "yes"; then - echo " xemacs will be linked with \"mule.o mule-ccl.o mule-charset.o file-coding.o\"" + extra_objs="$extra_objs mule.o mule-ccl.o mule-charset.o" && if test "$extra_verbose" = "yes"; then + echo " xemacs will be linked with \"mule.o mule-ccl.o mule-charset.o\"" fi + if test "$with_utf_2000" = "yes" && test "$with_text_coding" = "yes"; then + { test "$extra_verbose" = "yes" && cat << \EOF + Defining TEXT_CODING +EOF +cat >> confdefs.h <<\EOF +#define TEXT_CODING 1 +EOF +} + extra_objs="$extra_objs text-coding.o" && if test "$extra_verbose" = "yes"; then + echo " xemacs will be linked with \"text-coding.o\"" + fi + else + extra_objs="$extra_objs file-coding.o" && if test "$extra_verbose" = "yes"; then + echo " xemacs will be linked with \"file-coding.o\"" + fi + fi for ac_hdr in libintl.h do ac_safe=`echo "$ac_hdr" | sed 'y%./+-%__p_%'` echo $ac_n "checking for $ac_hdr""... $ac_c" 1>&6 -echo "configure:9895: checking for $ac_hdr" >&5 +echo "configure:9912: checking for $ac_hdr" >&5 cat > conftest.$ac_ext < EOF ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out" -{ (eval echo configure:9903: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; } +{ (eval echo configure:9920: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; } ac_err=`grep -v '^ *+' conftest.out | grep -v "^conftest.${ac_ext}\$"` if test -z "$ac_err"; then rm -rf conftest* @@ -9930,12 +9947,12 @@ done echo $ac_n "checking for strerror in -lintl""... $ac_c" 1>&6 -echo "configure:9934: checking for strerror in -lintl" >&5 +echo "configure:9951: checking for strerror in -lintl" >&5 ac_lib_var=`echo intl'_'strerror | sed 'y%./+-%__p_%'` xe_check_libs=" -lintl " cat > conftest.$ac_ext <&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then +if { (eval echo configure:9967: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then rm -rf conftest* eval "ac_cv_lib_$ac_lib_var=yes" else @@ -9998,18 +10015,18 @@ EOF fi echo "checking for Mule input methods" 1>&6 -echo "configure:10002: checking for Mule input methods" >&5 +echo "configure:10019: checking for Mule input methods" >&5 case "$with_xim" in "" | "yes" ) echo "checking for XIM" 1>&6 -echo "configure:10005: checking for XIM" >&5 +echo "configure:10022: checking for XIM" >&5 echo $ac_n "checking for XOpenIM in -lX11""... $ac_c" 1>&6 -echo "configure:10008: checking for XOpenIM in -lX11" >&5 +echo "configure:10025: checking for XOpenIM in -lX11" >&5 ac_lib_var=`echo X11'_'XOpenIM | sed 'y%./+-%__p_%'` xe_check_libs=" -lX11 " cat > conftest.$ac_ext <&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then +if { (eval echo configure:10041: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then rm -rf conftest* eval "ac_cv_lib_$ac_lib_var=yes" else @@ -10044,12 +10061,12 @@ fi if test "$have_motif $have_lesstif" = "yes no"; then echo $ac_n "checking for XmImMbLookupString in -lXm""... $ac_c" 1>&6 -echo "configure:10048: checking for XmImMbLookupString in -lXm" >&5 +echo "configure:10065: checking for XmImMbLookupString in -lXm" >&5 ac_lib_var=`echo Xm'_'XmImMbLookupString | sed 'y%./+-%__p_%'` xe_check_libs=" -lXm " cat > conftest.$ac_ext <&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then +if { (eval echo configure:10081: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then rm -rf conftest* eval "ac_cv_lib_$ac_lib_var=yes" else @@ -10125,15 +10142,15 @@ EOF if test "$with_xfs" = "yes" ; then echo "checking for XFontSet" 1>&6 -echo "configure:10129: checking for XFontSet" >&5 +echo "configure:10146: checking for XFontSet" >&5 echo $ac_n "checking for XmbDrawString in -lX11""... $ac_c" 1>&6 -echo "configure:10132: checking for XmbDrawString in -lX11" >&5 +echo "configure:10149: checking for XmbDrawString in -lX11" >&5 ac_lib_var=`echo X11'_'XmbDrawString | sed 'y%./+-%__p_%'` xe_check_libs=" -lX11 " cat > conftest.$ac_ext <&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then +if { (eval echo configure:10165: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then rm -rf conftest* eval "ac_cv_lib_$ac_lib_var=yes" else @@ -10184,15 +10201,15 @@ EOF test "$with_wnn6" = "yes" && with_wnn=yes # wnn6 implies wnn support test -z "$with_wnn" && { ac_safe=`echo "wnn/jllib.h" | sed 'y%./+-%__p_%'` echo $ac_n "checking for wnn/jllib.h""... $ac_c" 1>&6 -echo "configure:10188: checking for wnn/jllib.h" >&5 +echo "configure:10205: checking for wnn/jllib.h" >&5 cat > conftest.$ac_ext < EOF ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out" -{ (eval echo configure:10196: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; } +{ (eval echo configure:10213: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; } ac_err=`grep -v '^ *+' conftest.out | grep -v "^conftest.${ac_ext}\$"` if test -z "$ac_err"; then rm -rf conftest* @@ -10215,15 +10232,15 @@ fi } test -z "$with_wnn" && { ac_safe=`echo "wnn/commonhd.h" | sed 'y%./+-%__p_%'` echo $ac_n "checking for wnn/commonhd.h""... $ac_c" 1>&6 -echo "configure:10219: checking for wnn/commonhd.h" >&5 +echo "configure:10236: checking for wnn/commonhd.h" >&5 cat > conftest.$ac_ext < EOF ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out" -{ (eval echo configure:10227: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; } +{ (eval echo configure:10244: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; } ac_err=`grep -v '^ *+' conftest.out | grep -v "^conftest.${ac_ext}\$"` if test -z "$ac_err"; then rm -rf conftest* @@ -10248,10 +10265,10 @@ fi for ac_func in crypt do echo $ac_n "checking for $ac_func""... $ac_c" 1>&6 -echo "configure:10252: checking for $ac_func" >&5 +echo "configure:10269: checking for $ac_func" >&5 cat > conftest.$ac_ext <&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then +if { (eval echo configure:10295: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then rm -rf conftest* eval "ac_cv_func_$ac_func=yes" else @@ -10303,12 +10320,12 @@ done test "$ac_cv_func_crypt" != "yes" && { echo $ac_n "checking for crypt in -lcrypt""... $ac_c" 1>&6 -echo "configure:10307: checking for crypt in -lcrypt" >&5 +echo "configure:10324: checking for crypt in -lcrypt" >&5 ac_lib_var=`echo crypt'_'crypt | sed 'y%./+-%__p_%'` xe_check_libs=" -lcrypt " cat > conftest.$ac_ext <&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then +if { (eval echo configure:10340: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then rm -rf conftest* eval "ac_cv_lib_$ac_lib_var=yes" else @@ -10354,12 +10371,12 @@ fi if test -z "$with_wnn" -o "$with_wnn" = "yes"; then echo $ac_n "checking for jl_dic_list_e in -lwnn""... $ac_c" 1>&6 -echo "configure:10358: checking for jl_dic_list_e in -lwnn" >&5 +echo "configure:10375: checking for jl_dic_list_e in -lwnn" >&5 ac_lib_var=`echo wnn'_'jl_dic_list_e | sed 'y%./+-%__p_%'` xe_check_libs=" -lwnn " cat > conftest.$ac_ext <&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then +if { (eval echo configure:10391: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then rm -rf conftest* eval "ac_cv_lib_$ac_lib_var=yes" else @@ -10388,12 +10405,12 @@ if eval "test \"`echo '$ac_cv_lib_'$ac_lib_var`\" = yes" ; then else echo "$ac_t""no" 1>&6 echo $ac_n "checking for jl_dic_list_e in -lwnn4""... $ac_c" 1>&6 -echo "configure:10392: checking for jl_dic_list_e in -lwnn4" >&5 +echo "configure:10409: checking for jl_dic_list_e in -lwnn4" >&5 ac_lib_var=`echo wnn4'_'jl_dic_list_e | sed 'y%./+-%__p_%'` xe_check_libs=" -lwnn4 " cat > conftest.$ac_ext <&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then +if { (eval echo configure:10425: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then rm -rf conftest* eval "ac_cv_lib_$ac_lib_var=yes" else @@ -10422,12 +10439,12 @@ if eval "test \"`echo '$ac_cv_lib_'$ac_lib_var`\" = yes" ; then else echo "$ac_t""no" 1>&6 echo $ac_n "checking for jl_dic_list_e in -lwnn6""... $ac_c" 1>&6 -echo "configure:10426: checking for jl_dic_list_e in -lwnn6" >&5 +echo "configure:10443: checking for jl_dic_list_e in -lwnn6" >&5 ac_lib_var=`echo wnn6'_'jl_dic_list_e | sed 'y%./+-%__p_%'` xe_check_libs=" -lwnn6 " cat > conftest.$ac_ext <&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then +if { (eval echo configure:10459: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then rm -rf conftest* eval "ac_cv_lib_$ac_lib_var=yes" else @@ -10456,12 +10473,12 @@ if eval "test \"`echo '$ac_cv_lib_'$ac_lib_var`\" = yes" ; then else echo "$ac_t""no" 1>&6 echo $ac_n "checking for dic_list_e in -lwnn6_fromsrc""... $ac_c" 1>&6 -echo "configure:10460: checking for dic_list_e in -lwnn6_fromsrc" >&5 +echo "configure:10477: checking for dic_list_e in -lwnn6_fromsrc" >&5 ac_lib_var=`echo wnn6_fromsrc'_'dic_list_e | sed 'y%./+-%__p_%'` xe_check_libs=" -lwnn6_fromsrc " cat > conftest.$ac_ext <&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then +if { (eval echo configure:10493: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then rm -rf conftest* eval "ac_cv_lib_$ac_lib_var=yes" else @@ -10520,12 +10537,12 @@ EOF if test "$with_wnn6" != "no"; then echo $ac_n "checking for jl_fi_dic_list in -l$libwnn""... $ac_c" 1>&6 -echo "configure:10524: checking for jl_fi_dic_list in -l$libwnn" >&5 +echo "configure:10541: checking for jl_fi_dic_list in -l$libwnn" >&5 ac_lib_var=`echo $libwnn'_'jl_fi_dic_list | sed 'y%./+-%__p_%'` xe_check_libs=" -l$libwnn " cat > conftest.$ac_ext <&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then +if { (eval echo configure:10557: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then rm -rf conftest* eval "ac_cv_lib_$ac_lib_var=yes" else @@ -10571,15 +10588,15 @@ EOF if test "$with_canna" != "no"; then ac_safe=`echo "canna/jrkanji.h" | sed 'y%./+-%__p_%'` echo $ac_n "checking for canna/jrkanji.h""... $ac_c" 1>&6 -echo "configure:10575: checking for canna/jrkanji.h" >&5 +echo "configure:10592: checking for canna/jrkanji.h" >&5 cat > conftest.$ac_ext < EOF ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out" -{ (eval echo configure:10583: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; } +{ (eval echo configure:10600: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; } ac_err=`grep -v '^ *+' conftest.out | grep -v "^conftest.${ac_ext}\$"` if test -z "$ac_err"; then rm -rf conftest* @@ -10606,15 +10623,15 @@ fi c_switch_site="$c_switch_site -I/usr/local/canna/include" ac_safe=`echo "canna/jrkanji.h" | sed 'y%./+-%__p_%'` echo $ac_n "checking for canna/jrkanji.h""... $ac_c" 1>&6 -echo "configure:10610: checking for canna/jrkanji.h" >&5 +echo "configure:10627: checking for canna/jrkanji.h" >&5 cat > conftest.$ac_ext < EOF ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out" -{ (eval echo configure:10618: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; } +{ (eval echo configure:10635: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; } ac_err=`grep -v '^ *+' conftest.out | grep -v "^conftest.${ac_ext}\$"` if test -z "$ac_err"; then rm -rf conftest* @@ -10642,15 +10659,15 @@ fi test -z "$with_canna" && { ac_safe=`echo "canna/RK.h" | sed 'y%./+-%__p_%'` echo $ac_n "checking for canna/RK.h""... $ac_c" 1>&6 -echo "configure:10646: checking for canna/RK.h" >&5 +echo "configure:10663: checking for canna/RK.h" >&5 cat > conftest.$ac_ext < EOF ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out" -{ (eval echo configure:10654: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; } +{ (eval echo configure:10671: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; } ac_err=`grep -v '^ *+' conftest.out | grep -v "^conftest.${ac_ext}\$"` if test -z "$ac_err"; then rm -rf conftest* @@ -10673,12 +10690,12 @@ fi } test -z "$with_canna" && { echo $ac_n "checking for RkBgnBun in -lRKC""... $ac_c" 1>&6 -echo "configure:10677: checking for RkBgnBun in -lRKC" >&5 +echo "configure:10694: checking for RkBgnBun in -lRKC" >&5 ac_lib_var=`echo RKC'_'RkBgnBun | sed 'y%./+-%__p_%'` xe_check_libs=" -lRKC " cat > conftest.$ac_ext <&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then +if { (eval echo configure:10710: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then rm -rf conftest* eval "ac_cv_lib_$ac_lib_var=yes" else @@ -10712,12 +10729,12 @@ fi } test -z "$with_canna" && { echo $ac_n "checking for jrKanjiControl in -lcanna""... $ac_c" 1>&6 -echo "configure:10716: checking for jrKanjiControl in -lcanna" >&5 +echo "configure:10733: checking for jrKanjiControl in -lcanna" >&5 ac_lib_var=`echo canna'_'jrKanjiControl | sed 'y%./+-%__p_%'` xe_check_libs=" -lcanna " cat > conftest.$ac_ext <&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then +if { (eval echo configure:10749: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then rm -rf conftest* eval "ac_cv_lib_$ac_lib_var=yes" else @@ -10777,12 +10794,12 @@ if test "$need_motif" = "yes" ; then libs_x="-lXm $libs_x" && if test "$extra_verbose" = "yes"; then echo " Prepending \"-lXm\" to \$libs_x"; fi echo $ac_n "checking for layout_object_getvalue in -li18n""... $ac_c" 1>&6 -echo "configure:10781: checking for layout_object_getvalue in -li18n" >&5 +echo "configure:10798: checking for layout_object_getvalue in -li18n" >&5 ac_lib_var=`echo i18n'_'layout_object_getvalue | sed 'y%./+-%__p_%'` xe_check_libs=" -li18n " cat > conftest.$ac_ext <&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then +if { (eval echo configure:10814: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then rm -rf conftest* eval "ac_cv_lib_$ac_lib_var=yes" else @@ -10880,10 +10897,10 @@ fi for ac_func in cbrt closedir dup2 eaccess fmod fpathconf frexp ftime getaddrinfo gethostname getnameinfo getpagesize gettimeofday getcwd getwd logb lrand48 matherr mkdir mktime perror poll random rename res_init rint rmdir select setitimer setpgid setlocale setsid sigblock sighold sigprocmask snprintf stpcpy strerror tzset ulimit usleep waitpid vsnprintf fsync ftruncate umask do echo $ac_n "checking for $ac_func""... $ac_c" 1>&6 -echo "configure:10884: checking for $ac_func" >&5 +echo "configure:10901: checking for $ac_func" >&5 cat > conftest.$ac_ext <&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then +if { (eval echo configure:10927: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then rm -rf conftest* eval "ac_cv_func_$ac_func=yes" else @@ -10947,10 +10964,10 @@ fi for ac_func in getpt _getpty grantpt unlockpt ptsname killpg tcgetpgrp do echo $ac_n "checking for $ac_func""... $ac_c" 1>&6 -echo "configure:10951: checking for $ac_func" >&5 +echo "configure:10968: checking for $ac_func" >&5 cat > conftest.$ac_ext <&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then +if { (eval echo configure:10994: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then rm -rf conftest* eval "ac_cv_func_$ac_func=yes" else @@ -11002,10 +11019,10 @@ done echo $ac_n "checking for openpty""... $ac_c" 1>&6 -echo "configure:11006: checking for openpty" >&5 +echo "configure:11023: checking for openpty" >&5 cat > conftest.$ac_ext <&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then +if { (eval echo configure:11049: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then rm -rf conftest* eval "ac_cv_func_openpty=yes" else @@ -11047,12 +11064,12 @@ else echo $ac_n "checking for openpty in -lutil""... $ac_c" 1>&6 -echo "configure:11051: checking for openpty in -lutil" >&5 +echo "configure:11068: checking for openpty in -lutil" >&5 ac_lib_var=`echo util'_'openpty | sed 'y%./+-%__p_%'` xe_check_libs=" -lutil " cat > conftest.$ac_ext <&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then +if { (eval echo configure:11084: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then rm -rf conftest* eval "ac_cv_lib_$ac_lib_var=yes" else @@ -11098,15 +11115,15 @@ EOF do ac_safe=`echo "$ac_hdr" | sed 'y%./+-%__p_%'` echo $ac_n "checking for $ac_hdr""... $ac_c" 1>&6 -echo "configure:11102: checking for $ac_hdr" >&5 +echo "configure:11119: checking for $ac_hdr" >&5 cat > conftest.$ac_ext < EOF ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out" -{ (eval echo configure:11110: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; } +{ (eval echo configure:11127: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; } ac_err=`grep -v '^ *+' conftest.out | grep -v "^conftest.${ac_ext}\$"` if test -z "$ac_err"; then rm -rf conftest* @@ -11142,15 +11159,15 @@ for ac_hdr in stropts.h do ac_safe=`echo "$ac_hdr" | sed 'y%./+-%__p_%'` echo $ac_n "checking for $ac_hdr""... $ac_c" 1>&6 -echo "configure:11146: checking for $ac_hdr" >&5 +echo "configure:11163: checking for $ac_hdr" >&5 cat > conftest.$ac_ext < EOF ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out" -{ (eval echo configure:11154: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; } +{ (eval echo configure:11171: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; } ac_err=`grep -v '^ *+' conftest.out | grep -v "^conftest.${ac_ext}\$"` if test -z "$ac_err"; then rm -rf conftest* @@ -11183,10 +11200,10 @@ if test "$ac_cv_header_stropts_h" = "yes"; then for ac_func in isastream do echo $ac_n "checking for $ac_func""... $ac_c" 1>&6 -echo "configure:11187: checking for $ac_func" >&5 +echo "configure:11204: checking for $ac_func" >&5 cat > conftest.$ac_ext <&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then +if { (eval echo configure:11230: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then rm -rf conftest* eval "ac_cv_func_$ac_func=yes" else @@ -11240,15 +11257,15 @@ done do ac_safe=`echo "$ac_hdr" | sed 'y%./+-%__p_%'` echo $ac_n "checking for $ac_hdr""... $ac_c" 1>&6 -echo "configure:11244: checking for $ac_hdr" >&5 +echo "configure:11261: checking for $ac_hdr" >&5 cat > conftest.$ac_ext < EOF ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out" -{ (eval echo configure:11252: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; } +{ (eval echo configure:11269: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; } ac_err=`grep -v '^ *+' conftest.out | grep -v "^conftest.${ac_ext}\$"` if test -z "$ac_err"; then rm -rf conftest* @@ -11285,10 +11302,10 @@ extra_objs="$extra_objs realpath.o" && if test "$extra_verbose" = "yes"; then for ac_func in getloadavg do echo $ac_n "checking for $ac_func""... $ac_c" 1>&6 -echo "configure:11289: checking for $ac_func" >&5 +echo "configure:11306: checking for $ac_func" >&5 cat > conftest.$ac_ext <&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then +if { (eval echo configure:11332: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then rm -rf conftest* eval "ac_cv_func_$ac_func=yes" else @@ -11344,15 +11361,15 @@ if test "$ac_cv_func_getloadavg" = "yes"; then do ac_safe=`echo "$ac_hdr" | sed 'y%./+-%__p_%'` echo $ac_n "checking for $ac_hdr""... $ac_c" 1>&6 -echo "configure:11348: checking for $ac_hdr" >&5 +echo "configure:11365: checking for $ac_hdr" >&5 cat > conftest.$ac_ext < EOF ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out" -{ (eval echo configure:11356: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; } +{ (eval echo configure:11373: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; } ac_err=`grep -v '^ *+' conftest.out | grep -v "^conftest.${ac_ext}\$"` if test -z "$ac_err"; then rm -rf conftest* @@ -11388,12 +11405,12 @@ else echo $ac_n "checking for kstat_open in -lkstat""... $ac_c" 1>&6 -echo "configure:11392: checking for kstat_open in -lkstat" >&5 +echo "configure:11409: checking for kstat_open in -lkstat" >&5 ac_lib_var=`echo kstat'_'kstat_open | sed 'y%./+-%__p_%'` xe_check_libs=" -lkstat " cat > conftest.$ac_ext <&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then +if { (eval echo configure:11425: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then rm -rf conftest* eval "ac_cv_lib_$ac_lib_var=yes" else @@ -11439,15 +11456,15 @@ fi do ac_safe=`echo "$ac_hdr" | sed 'y%./+-%__p_%'` echo $ac_n "checking for $ac_hdr""... $ac_c" 1>&6 -echo "configure:11443: checking for $ac_hdr" >&5 +echo "configure:11460: checking for $ac_hdr" >&5 cat > conftest.$ac_ext < EOF ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out" -{ (eval echo configure:11451: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; } +{ (eval echo configure:11468: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; } ac_err=`grep -v '^ *+' conftest.out | grep -v "^conftest.${ac_ext}\$"` if test -z "$ac_err"; then rm -rf conftest* @@ -11479,12 +11496,12 @@ done echo $ac_n "checking for kvm_read in -lkvm""... $ac_c" 1>&6 -echo "configure:11483: checking for kvm_read in -lkvm" >&5 +echo "configure:11500: checking for kvm_read in -lkvm" >&5 ac_lib_var=`echo kvm'_'kvm_read | sed 'y%./+-%__p_%'` xe_check_libs=" -lkvm " cat > conftest.$ac_ext <&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then +if { (eval echo configure:11516: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then rm -rf conftest* eval "ac_cv_lib_$ac_lib_var=yes" else @@ -11529,16 +11546,16 @@ fi fi echo $ac_n "checking whether netdb declares h_errno""... $ac_c" 1>&6 -echo "configure:11533: checking whether netdb declares h_errno" >&5 +echo "configure:11550: checking whether netdb declares h_errno" >&5 cat > conftest.$ac_ext < int main() { return h_errno; ; return 0; } EOF -if { (eval echo configure:11542: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then +if { (eval echo configure:11559: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then rm -rf conftest* echo "$ac_t""yes" 1>&6 { test "$extra_verbose" = "yes" && cat << \EOF @@ -11558,16 +11575,16 @@ fi rm -f conftest* echo $ac_n "checking for sigsetjmp""... $ac_c" 1>&6 -echo "configure:11562: checking for sigsetjmp" >&5 +echo "configure:11579: checking for sigsetjmp" >&5 cat > conftest.$ac_ext < int main() { sigjmp_buf bar; sigsetjmp (bar, 0); ; return 0; } EOF -if { (eval echo configure:11571: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then +if { (eval echo configure:11588: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then rm -rf conftest* echo "$ac_t""yes" 1>&6 { test "$extra_verbose" = "yes" && cat << \EOF @@ -11587,11 +11604,11 @@ fi rm -f conftest* echo $ac_n "checking whether localtime caches TZ""... $ac_c" 1>&6 -echo "configure:11591: checking whether localtime caches TZ" >&5 +echo "configure:11608: checking whether localtime caches TZ" >&5 if test "$ac_cv_func_tzset" = "yes"; then cat > conftest.$ac_ext < #if STDC_HEADERS @@ -11626,7 +11643,7 @@ main() exit (0); } EOF -if { (eval echo configure:11630: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest && (./conftest; exit $?) 2>&5 +if { (eval echo configure:11647: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest && (./conftest; exit $?) 2>&5 then emacs_cv_localtime_cache=no else @@ -11656,9 +11673,9 @@ fi if test "$HAVE_TIMEVAL" = "yes"; then echo $ac_n "checking whether gettimeofday accepts one or two arguments""... $ac_c" 1>&6 -echo "configure:11660: checking whether gettimeofday accepts one or two arguments" >&5 +echo "configure:11677: checking whether gettimeofday accepts one or two arguments" >&5 cat > conftest.$ac_ext <&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then +if { (eval echo configure:11700: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then rm -rf conftest* echo "$ac_t""two" 1>&6 else @@ -11701,19 +11718,19 @@ fi echo $ac_n "checking for inline""... $ac_c" 1>&6 -echo "configure:11705: checking for inline" >&5 +echo "configure:11722: checking for inline" >&5 ac_cv_c_inline=no for ac_kw in inline __inline__ __inline; do cat > conftest.$ac_ext <&5; (eval $ac_compile) 2>&5; }; then +if { (eval echo configure:11734: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then rm -rf conftest* ac_cv_c_inline=$ac_kw; break else @@ -11754,17 +11771,17 @@ if test "$__DECC" != "yes"; then # 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:11758: checking for working alloca.h" >&5 +echo "configure:11775: checking for working alloca.h" >&5 cat > conftest.$ac_ext < int main() { char *p = alloca(2 * sizeof(int)); ; return 0; } EOF -if { (eval echo configure:11768: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then +if { (eval echo configure:11785: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then rm -rf conftest* ac_cv_header_alloca_h=yes else @@ -11788,10 +11805,10 @@ EOF fi echo $ac_n "checking for alloca""... $ac_c" 1>&6 -echo "configure:11792: checking for alloca" >&5 +echo "configure:11809: checking for alloca" >&5 cat > conftest.$ac_ext <&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then +if { (eval echo configure:11840: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then rm -rf conftest* ac_cv_func_alloca_works=yes else @@ -11858,10 +11875,10 @@ EOF echo $ac_n "checking whether alloca needs Cray hooks""... $ac_c" 1>&6 -echo "configure:11862: checking whether alloca needs Cray hooks" >&5 +echo "configure:11879: checking whether alloca needs Cray hooks" >&5 cat > conftest.$ac_ext <&6 if test $ac_cv_os_cray = yes; then for ac_func in _getb67 GETB67 getb67; do echo $ac_n "checking for $ac_func""... $ac_c" 1>&6 -echo "configure:11889: checking for $ac_func" >&5 +echo "configure:11906: checking for $ac_func" >&5 cat > conftest.$ac_ext <&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then +if { (eval echo configure:11932: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then rm -rf conftest* eval "ac_cv_func_$ac_func=yes" else @@ -11941,10 +11958,10 @@ done fi echo $ac_n "checking stack direction for C alloca""... $ac_c" 1>&6 -echo "configure:11945: checking stack direction for C alloca" >&5 +echo "configure:11962: checking stack direction for C alloca" >&5 cat > conftest.$ac_ext <&5; (eval $ac_link) 2>&5; } && test -s conftest && (./conftest; exit $?) 2>&5 +if { (eval echo configure:11984: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest && (./conftest; exit $?) 2>&5 then ac_cv_c_stack_direction=1 else @@ -11993,15 +12010,15 @@ fi ac_safe=`echo "vfork.h" | sed 'y%./+-%__p_%'` echo $ac_n "checking for vfork.h""... $ac_c" 1>&6 -echo "configure:11997: checking for vfork.h" >&5 +echo "configure:12014: checking for vfork.h" >&5 cat > conftest.$ac_ext < EOF ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out" -{ (eval echo configure:12005: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; } +{ (eval echo configure:12022: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; } ac_err=`grep -v '^ *+' conftest.out | grep -v "^conftest.${ac_ext}\$"` if test -z "$ac_err"; then rm -rf conftest* @@ -12029,10 +12046,10 @@ else fi echo $ac_n "checking for working vfork""... $ac_c" 1>&6 -echo "configure:12033: checking for working vfork" >&5 +echo "configure:12050: checking for working vfork" >&5 cat > conftest.$ac_ext < @@ -12127,7 +12144,7 @@ main() { } } EOF -if { (eval echo configure:12131: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest && (./conftest; exit $?) 2>&5 +if { (eval echo configure:12148: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest && (./conftest; exit $?) 2>&5 then ac_cv_func_vfork_works=yes else @@ -12153,10 +12170,10 @@ fi echo $ac_n "checking for working strcoll""... $ac_c" 1>&6 -echo "configure:12157: checking for working strcoll" >&5 +echo "configure:12174: checking for working strcoll" >&5 cat > conftest.$ac_ext < main () @@ -12166,7 +12183,7 @@ main () strcoll ("123", "456") >= 0); } EOF -if { (eval echo configure:12170: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest && (./conftest; exit $?) 2>&5 +if { (eval echo configure:12187: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest && (./conftest; exit $?) 2>&5 then ac_cv_func_strcoll_works=yes else @@ -12194,10 +12211,10 @@ fi for ac_func in getpgrp do echo $ac_n "checking for $ac_func""... $ac_c" 1>&6 -echo "configure:12198: checking for $ac_func" >&5 +echo "configure:12215: checking for $ac_func" >&5 cat > conftest.$ac_ext <&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then +if { (eval echo configure:12241: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then rm -rf conftest* eval "ac_cv_func_$ac_func=yes" else @@ -12248,10 +12265,10 @@ fi done echo $ac_n "checking whether getpgrp takes no argument""... $ac_c" 1>&6 -echo "configure:12252: checking whether getpgrp takes no argument" >&5 +echo "configure:12269: checking whether getpgrp takes no argument" >&5 cat > conftest.$ac_ext <&5; (eval $ac_link) 2>&5; } && test -s conftest && (./conftest; exit $?) 2>&5 +if { (eval echo configure:12327: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest && (./conftest; exit $?) 2>&5 then ac_cv_func_getpgrp_void=yes else @@ -12333,10 +12350,10 @@ fi echo $ac_n "checking for working mmap""... $ac_c" 1>&6 -echo "configure:12337: checking for working mmap" >&5 +echo "configure:12354: checking for working mmap" >&5 case "$opsys" in ultrix* ) have_mmap=no ;; *) cat > conftest.$ac_ext < #include @@ -12369,7 +12386,7 @@ int main (int argc, char *argv[]) return 1; } EOF -if { (eval echo configure:12373: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest && (./conftest; exit $?) 2>&5 +if { (eval echo configure:12390: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest && (./conftest; exit $?) 2>&5 then have_mmap=yes else @@ -12398,9 +12415,9 @@ test "$GNU_MALLOC" != "yes" -a "$have_mmap" != "yes" && rel_alloc=no if test "$rel_alloc $have_mmap" = "default yes"; then if test "$doug_lea_malloc" = "yes"; then echo $ac_n "checking for M_MMAP_THRESHOLD""... $ac_c" 1>&6 -echo "configure:12402: checking for M_MMAP_THRESHOLD" >&5 +echo "configure:12419: checking for M_MMAP_THRESHOLD" >&5 cat > conftest.$ac_ext < int main() { @@ -12412,7 +12429,7 @@ int main() { ; return 0; } EOF -if { (eval echo configure:12416: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then +if { (eval echo configure:12433: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then rm -rf conftest* rel_alloc=no; echo "$ac_t""yes" 1>&6; else @@ -12437,15 +12454,15 @@ EOF ac_safe=`echo "termios.h" | sed 'y%./+-%__p_%'` echo $ac_n "checking for termios.h""... $ac_c" 1>&6 -echo "configure:12441: checking for termios.h" >&5 +echo "configure:12458: checking for termios.h" >&5 cat > conftest.$ac_ext < EOF ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out" -{ (eval echo configure:12449: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; } +{ (eval echo configure:12466: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; } ac_err=`grep -v '^ *+' conftest.out | grep -v "^conftest.${ac_ext}\$"` if test -z "$ac_err"; then rm -rf conftest* @@ -12488,15 +12505,15 @@ else echo "$ac_t""no" 1>&6 ac_safe=`echo "termio.h" | sed 'y%./+-%__p_%'` echo $ac_n "checking for termio.h""... $ac_c" 1>&6 -echo "configure:12492: checking for termio.h" >&5 +echo "configure:12509: checking for termio.h" >&5 cat > conftest.$ac_ext < EOF ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out" -{ (eval echo configure:12500: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; } +{ (eval echo configure:12517: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; } ac_err=`grep -v '^ *+' conftest.out | grep -v "^conftest.${ac_ext}\$"` if test -z "$ac_err"; then rm -rf conftest* @@ -12528,10 +12545,10 @@ fi echo $ac_n "checking for socket""... $ac_c" 1>&6 -echo "configure:12532: checking for socket" >&5 +echo "configure:12549: checking for socket" >&5 cat > conftest.$ac_ext <&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then +if { (eval echo configure:12575: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then rm -rf conftest* eval "ac_cv_func_socket=yes" else @@ -12569,15 +12586,15 @@ if eval "test \"`echo '$ac_cv_func_'socket`\" = yes"; then echo "$ac_t""yes" 1>&6 ac_safe=`echo "netinet/in.h" | sed 'y%./+-%__p_%'` echo $ac_n "checking for netinet/in.h""... $ac_c" 1>&6 -echo "configure:12573: checking for netinet/in.h" >&5 +echo "configure:12590: checking for netinet/in.h" >&5 cat > conftest.$ac_ext < EOF ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out" -{ (eval echo configure:12581: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; } +{ (eval echo configure:12598: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; } ac_err=`grep -v '^ *+' conftest.out | grep -v "^conftest.${ac_ext}\$"` if test -z "$ac_err"; then rm -rf conftest* @@ -12594,15 +12611,15 @@ if eval "test \"`echo '$ac_cv_header_'$ac_safe`\" = yes"; then echo "$ac_t""yes" 1>&6 ac_safe=`echo "arpa/inet.h" | sed 'y%./+-%__p_%'` echo $ac_n "checking for arpa/inet.h""... $ac_c" 1>&6 -echo "configure:12598: checking for arpa/inet.h" >&5 +echo "configure:12615: checking for arpa/inet.h" >&5 cat > conftest.$ac_ext < EOF ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out" -{ (eval echo configure:12606: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; } +{ (eval echo configure:12623: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; } ac_err=`grep -v '^ *+' conftest.out | grep -v "^conftest.${ac_ext}\$"` if test -z "$ac_err"; then rm -rf conftest* @@ -12627,9 +12644,9 @@ EOF } echo $ac_n "checking "for sun_len member in struct sockaddr_un"""... $ac_c" 1>&6 -echo "configure:12631: checking "for sun_len member in struct sockaddr_un"" >&5 +echo "configure:12648: checking "for sun_len member in struct sockaddr_un"" >&5 cat > conftest.$ac_ext < @@ -12640,7 +12657,7 @@ int main() { static struct sockaddr_un x; x.sun_len = 1; ; return 0; } EOF -if { (eval echo configure:12644: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then +if { (eval echo configure:12661: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then rm -rf conftest* echo "$ac_t""yes" 1>&6; { test "$extra_verbose" = "yes" && cat << \EOF Defining HAVE_SOCKADDR_SUN_LEN @@ -12658,9 +12675,9 @@ else fi rm -f conftest* echo $ac_n "checking "for ip_mreq struct in netinet/in.h"""... $ac_c" 1>&6 -echo "configure:12662: checking "for ip_mreq struct in netinet/in.h"" >&5 +echo "configure:12679: checking "for ip_mreq struct in netinet/in.h"" >&5 cat > conftest.$ac_ext < @@ -12670,7 +12687,7 @@ int main() { static struct ip_mreq x; ; return 0; } EOF -if { (eval echo configure:12674: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then +if { (eval echo configure:12691: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then rm -rf conftest* echo "$ac_t""yes" 1>&6; { test "$extra_verbose" = "yes" && cat << \EOF Defining HAVE_MULTICAST @@ -12701,10 +12718,10 @@ fi echo $ac_n "checking for msgget""... $ac_c" 1>&6 -echo "configure:12705: checking for msgget" >&5 +echo "configure:12722: checking for msgget" >&5 cat > conftest.$ac_ext <&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then +if { (eval echo configure:12748: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then rm -rf conftest* eval "ac_cv_func_msgget=yes" else @@ -12742,15 +12759,15 @@ if eval "test \"`echo '$ac_cv_func_'msgget`\" = yes"; then echo "$ac_t""yes" 1>&6 ac_safe=`echo "sys/ipc.h" | sed 'y%./+-%__p_%'` echo $ac_n "checking for sys/ipc.h""... $ac_c" 1>&6 -echo "configure:12746: checking for sys/ipc.h" >&5 +echo "configure:12763: checking for sys/ipc.h" >&5 cat > conftest.$ac_ext < EOF ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out" -{ (eval echo configure:12754: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; } +{ (eval echo configure:12771: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; } ac_err=`grep -v '^ *+' conftest.out | grep -v "^conftest.${ac_ext}\$"` if test -z "$ac_err"; then rm -rf conftest* @@ -12767,15 +12784,15 @@ if eval "test \"`echo '$ac_cv_header_'$ac_safe`\" = yes"; then echo "$ac_t""yes" 1>&6 ac_safe=`echo "sys/msg.h" | sed 'y%./+-%__p_%'` echo $ac_n "checking for sys/msg.h""... $ac_c" 1>&6 -echo "configure:12771: checking for sys/msg.h" >&5 +echo "configure:12788: checking for sys/msg.h" >&5 cat > conftest.$ac_ext < EOF ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out" -{ (eval echo configure:12779: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; } +{ (eval echo configure:12796: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; } ac_err=`grep -v '^ *+' conftest.out | grep -v "^conftest.${ac_ext}\$"` if test -z "$ac_err"; then rm -rf conftest* @@ -12813,15 +12830,15 @@ fi ac_safe=`echo "dirent.h" | sed 'y%./+-%__p_%'` echo $ac_n "checking for dirent.h""... $ac_c" 1>&6 -echo "configure:12817: checking for dirent.h" >&5 +echo "configure:12834: checking for dirent.h" >&5 cat > conftest.$ac_ext < EOF ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out" -{ (eval echo configure:12825: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; } +{ (eval echo configure:12842: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; } ac_err=`grep -v '^ *+' conftest.out | grep -v "^conftest.${ac_ext}\$"` if test -z "$ac_err"; then rm -rf conftest* @@ -12848,15 +12865,15 @@ else echo "$ac_t""no" 1>&6 ac_safe=`echo "sys/dir.h" | sed 'y%./+-%__p_%'` echo $ac_n "checking for sys/dir.h""... $ac_c" 1>&6 -echo "configure:12852: checking for sys/dir.h" >&5 +echo "configure:12869: checking for sys/dir.h" >&5 cat > conftest.$ac_ext < EOF ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out" -{ (eval echo configure:12860: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; } +{ (eval echo configure:12877: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; } ac_err=`grep -v '^ *+' conftest.out | grep -v "^conftest.${ac_ext}\$"` if test -z "$ac_err"; then rm -rf conftest* @@ -12889,15 +12906,15 @@ fi ac_safe=`echo "nlist.h" | sed 'y%./+-%__p_%'` echo $ac_n "checking for nlist.h""... $ac_c" 1>&6 -echo "configure:12893: checking for nlist.h" >&5 +echo "configure:12910: checking for nlist.h" >&5 cat > conftest.$ac_ext < EOF ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out" -{ (eval echo configure:12901: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; } +{ (eval echo configure:12918: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; } ac_err=`grep -v '^ *+' conftest.out | grep -v "^conftest.${ac_ext}\$"` if test -z "$ac_err"; then rm -rf conftest* @@ -12927,22 +12944,22 @@ fi echo "checking "for sound support"" 1>&6 -echo "configure:12931: checking "for sound support"" >&5 +echo "configure:12948: checking "for sound support"" >&5 test -z "$with_native_sound" -a -n "$native_sound_lib" && with_native_sound=yes if test "$with_native_sound" != "no"; then if test -n "$native_sound_lib"; then ac_safe=`echo "multimedia/audio_device.h" | sed 'y%./+-%__p_%'` echo $ac_n "checking for multimedia/audio_device.h""... $ac_c" 1>&6 -echo "configure:12938: checking for multimedia/audio_device.h" >&5 +echo "configure:12955: checking for multimedia/audio_device.h" >&5 cat > conftest.$ac_ext < EOF ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out" -{ (eval echo configure:12946: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; } +{ (eval echo configure:12963: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; } ac_err=`grep -v '^ *+' conftest.out | grep -v "^conftest.${ac_ext}\$"` if test -z "$ac_err"; then rm -rf conftest* @@ -12990,12 +13007,12 @@ fi if test -z "$native_sound_lib"; then echo $ac_n "checking for ALopenport in -laudio""... $ac_c" 1>&6 -echo "configure:12994: checking for ALopenport in -laudio" >&5 +echo "configure:13011: checking for ALopenport in -laudio" >&5 ac_lib_var=`echo audio'_'ALopenport | sed 'y%./+-%__p_%'` xe_check_libs=" -laudio " cat > conftest.$ac_ext <&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then +if { (eval echo configure:13027: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then rm -rf conftest* eval "ac_cv_lib_$ac_lib_var=yes" else @@ -13037,12 +13054,12 @@ fi if test -z "$native_sound_lib"; then echo $ac_n "checking for AOpenAudio in -lAlib""... $ac_c" 1>&6 -echo "configure:13041: checking for AOpenAudio in -lAlib" >&5 +echo "configure:13058: checking for AOpenAudio in -lAlib" >&5 ac_lib_var=`echo Alib'_'AOpenAudio | sed 'y%./+-%__p_%'` xe_check_libs=" -lAlib " cat > conftest.$ac_ext <&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then +if { (eval echo configure:13074: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then rm -rf conftest* eval "ac_cv_lib_$ac_lib_var=yes" else @@ -13098,15 +13115,15 @@ fi for dir in "machine" "sys" "linux"; do ac_safe=`echo "${dir}/soundcard.h" | sed 'y%./+-%__p_%'` echo $ac_n "checking for ${dir}/soundcard.h""... $ac_c" 1>&6 -echo "configure:13102: checking for ${dir}/soundcard.h" >&5 +echo "configure:13119: checking for ${dir}/soundcard.h" >&5 cat > conftest.$ac_ext < EOF ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out" -{ (eval echo configure:13110: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; } +{ (eval echo configure:13127: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; } ac_err=`grep -v '^ *+' conftest.out | grep -v "^conftest.${ac_ext}\$"` if test -z "$ac_err"; then rm -rf conftest* @@ -13160,15 +13177,15 @@ fi if test "$with_nas_sound" != "no"; then ac_safe=`echo "audio/audiolib.h" | sed 'y%./+-%__p_%'` echo $ac_n "checking for audio/audiolib.h""... $ac_c" 1>&6 -echo "configure:13164: checking for audio/audiolib.h" >&5 +echo "configure:13181: checking for audio/audiolib.h" >&5 cat > conftest.$ac_ext < EOF ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out" -{ (eval echo configure:13172: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; } +{ (eval echo configure:13189: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; } ac_err=`grep -v '^ *+' conftest.out | grep -v "^conftest.${ac_ext}\$"` if test -z "$ac_err"; then rm -rf conftest* @@ -13186,12 +13203,12 @@ if eval "test \"`echo '$ac_cv_header_'$ac_safe`\" = yes"; then echo $ac_n "checking for AuOpenServer in -laudio""... $ac_c" 1>&6 -echo "configure:13190: checking for AuOpenServer in -laudio" >&5 +echo "configure:13207: checking for AuOpenServer in -laudio" >&5 ac_lib_var=`echo audio'_'AuOpenServer | sed 'y%./+-%__p_%'` xe_check_libs=" -laudio " cat > conftest.$ac_ext <&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then +if { (eval echo configure:13223: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then rm -rf conftest* eval "ac_cv_lib_$ac_lib_var=yes" else @@ -13241,7 +13258,7 @@ EOF fi libs_x="-laudio $libs_x" && if test "$extra_verbose" = "yes"; then echo " Prepending \"-laudio\" to \$libs_x"; fi cat > conftest.$ac_ext < EOF @@ -13272,7 +13289,7 @@ if test "$with_esd_sound" != "no"; then # Extract the first word of "esd-config", so it can be a program name with args. set dummy esd-config; ac_word=$2 echo $ac_n "checking for $ac_word""... $ac_c" 1>&6 -echo "configure:13276: checking for $ac_word" >&5 +echo "configure:13293: checking for $ac_word" >&5 if test -n "$have_esd_config"; then ac_cv_prog_have_esd_config="$have_esd_config" # Let the user override the test. @@ -13301,10 +13318,10 @@ fi c_switch_site="$c_switch_site `esd-config --cflags`" && if test "$extra_verbose" = "yes"; then echo " Appending \"`esd-config --cflags`\" to \$c_switch_site"; fi LIBS="`esd-config --libs` $LIBS" && if test "$extra_verbose" = "yes"; then echo " Prepending \"`esd-config --libs`\" to \$LIBS"; fi echo $ac_n "checking for esd_play_stream""... $ac_c" 1>&6 -echo "configure:13305: checking for esd_play_stream" >&5 +echo "configure:13322: checking for esd_play_stream" >&5 cat > conftest.$ac_ext <&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then +if { (eval echo configure:13348: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then rm -rf conftest* eval "ac_cv_func_esd_play_stream=yes" else @@ -13378,7 +13395,7 @@ test -z "$with_tty" && with_tty=yes if test "$with_tty" = "yes" ; then echo "checking for TTY-related features" 1>&6 -echo "configure:13382: checking for TTY-related features" >&5 +echo "configure:13399: checking for TTY-related features" >&5 { test "$extra_verbose" = "yes" && cat << \EOF Defining HAVE_TTY EOF @@ -13394,12 +13411,12 @@ EOF if test -z "$with_ncurses"; then echo $ac_n "checking for tgetent in -lncurses""... $ac_c" 1>&6 -echo "configure:13398: checking for tgetent in -lncurses" >&5 +echo "configure:13415: checking for tgetent in -lncurses" >&5 ac_lib_var=`echo ncurses'_'tgetent | sed 'y%./+-%__p_%'` xe_check_libs=" -lncurses " cat > conftest.$ac_ext <&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then +if { (eval echo configure:13431: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then rm -rf conftest* eval "ac_cv_lib_$ac_lib_var=yes" else @@ -13443,15 +13460,15 @@ EOF ac_safe=`echo "ncurses/curses.h" | sed 'y%./+-%__p_%'` echo $ac_n "checking for ncurses/curses.h""... $ac_c" 1>&6 -echo "configure:13447: checking for ncurses/curses.h" >&5 +echo "configure:13464: checking for ncurses/curses.h" >&5 cat > conftest.$ac_ext < EOF ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out" -{ (eval echo configure:13455: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; } +{ (eval echo configure:13472: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; } ac_err=`grep -v '^ *+' conftest.out | grep -v "^conftest.${ac_ext}\$"` if test -z "$ac_err"; then rm -rf conftest* @@ -13473,15 +13490,15 @@ fi ac_safe=`echo "ncurses/term.h" | sed 'y%./+-%__p_%'` echo $ac_n "checking for ncurses/term.h""... $ac_c" 1>&6 -echo "configure:13477: checking for ncurses/term.h" >&5 +echo "configure:13494: checking for ncurses/term.h" >&5 cat > conftest.$ac_ext < EOF ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out" -{ (eval echo configure:13485: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; } +{ (eval echo configure:13502: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; } ac_err=`grep -v '^ *+' conftest.out | grep -v "^conftest.${ac_ext}\$"` if test -z "$ac_err"; then rm -rf conftest* @@ -13511,15 +13528,15 @@ fi c_switch_site="$c_switch_site -I/usr/include/ncurses" ac_safe=`echo "ncurses/curses.h" | sed 'y%./+-%__p_%'` echo $ac_n "checking for ncurses/curses.h""... $ac_c" 1>&6 -echo "configure:13515: checking for ncurses/curses.h" >&5 +echo "configure:13532: checking for ncurses/curses.h" >&5 cat > conftest.$ac_ext < EOF ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out" -{ (eval echo configure:13523: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; } +{ (eval echo configure:13540: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; } ac_err=`grep -v '^ *+' conftest.out | grep -v "^conftest.${ac_ext}\$"` if test -z "$ac_err"; then rm -rf conftest* @@ -13554,12 +13571,12 @@ fi for lib in curses termlib termcap; do echo $ac_n "checking for tgetent in -l$lib""... $ac_c" 1>&6 -echo "configure:13558: checking for tgetent in -l$lib" >&5 +echo "configure:13575: checking for tgetent in -l$lib" >&5 ac_lib_var=`echo $lib'_'tgetent | sed 'y%./+-%__p_%'` xe_check_libs=" -l$lib " cat > conftest.$ac_ext <&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then +if { (eval echo configure:13591: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then rm -rf conftest* eval "ac_cv_lib_$ac_lib_var=yes" else @@ -13595,12 +13612,12 @@ fi else if test -n "$libs_termcap" -a "$opsys" = "openbsd"; then echo $ac_n "checking for tgoto in -ltermcap""... $ac_c" 1>&6 -echo "configure:13599: checking for tgoto in -ltermcap" >&5 +echo "configure:13616: checking for tgoto in -ltermcap" >&5 ac_lib_var=`echo termcap'_'tgoto | sed 'y%./+-%__p_%'` xe_check_libs=" -ltermcap " cat > conftest.$ac_ext <&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then +if { (eval echo configure:13632: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then rm -rf conftest* eval "ac_cv_lib_$ac_lib_var=yes" else @@ -13656,12 +13673,12 @@ fi else echo $ac_n "checking for tgetent in -lcurses""... $ac_c" 1>&6 -echo "configure:13660: checking for tgetent in -lcurses" >&5 +echo "configure:13677: checking for tgetent in -lcurses" >&5 ac_lib_var=`echo curses'_'tgetent | sed 'y%./+-%__p_%'` xe_check_libs=" -lcurses " cat > conftest.$ac_ext <&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then +if { (eval echo configure:13693: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then rm -rf conftest* eval "ac_cv_lib_$ac_lib_var=yes" else @@ -13690,12 +13707,12 @@ if eval "test \"`echo '$ac_cv_lib_'$ac_lib_var`\" = yes" ; then else echo "$ac_t""no" 1>&6 echo $ac_n "checking for tgetent in -ltermcap""... $ac_c" 1>&6 -echo "configure:13694: checking for tgetent in -ltermcap" >&5 +echo "configure:13711: checking for tgetent in -ltermcap" >&5 ac_lib_var=`echo termcap'_'tgetent | sed 'y%./+-%__p_%'` xe_check_libs=" -ltermcap " cat > conftest.$ac_ext <&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then +if { (eval echo configure:13727: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then rm -rf conftest* eval "ac_cv_lib_$ac_lib_var=yes" else @@ -13754,15 +13771,15 @@ EOF test -z "$with_gpm" && { ac_safe=`echo "gpm.h" | sed 'y%./+-%__p_%'` echo $ac_n "checking for gpm.h""... $ac_c" 1>&6 -echo "configure:13758: checking for gpm.h" >&5 +echo "configure:13775: checking for gpm.h" >&5 cat > conftest.$ac_ext < EOF ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out" -{ (eval echo configure:13766: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; } +{ (eval echo configure:13783: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; } ac_err=`grep -v '^ *+' conftest.out | grep -v "^conftest.${ac_ext}\$"` if test -z "$ac_err"; then rm -rf conftest* @@ -13785,12 +13802,12 @@ fi } test -z "$with_gpm" && { echo $ac_n "checking for Gpm_Open in -lgpm""... $ac_c" 1>&6 -echo "configure:13789: checking for Gpm_Open in -lgpm" >&5 +echo "configure:13806: checking for Gpm_Open in -lgpm" >&5 ac_lib_var=`echo gpm'_'Gpm_Open | sed 'y%./+-%__p_%'` xe_check_libs=" -lgpm " cat > conftest.$ac_ext <&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then +if { (eval echo configure:13822: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then rm -rf conftest* eval "ac_cv_lib_$ac_lib_var=yes" else @@ -13851,20 +13868,20 @@ test "$with_x11" = "yes" -o "$with_tty" = "yes" -o "$need_event_unixoid" = "yes" test "$with_database_gdbm $with_database_dbm $with_database_berkdb" \ != "no no no" && echo "checking for database support" 1>&6 -echo "configure:13855: checking for database support" >&5 +echo "configure:13872: checking for database support" >&5 if test "$with_database_gdbm $with_database_dbm" != "no no"; then ac_safe=`echo "ndbm.h" | sed 'y%./+-%__p_%'` echo $ac_n "checking for ndbm.h""... $ac_c" 1>&6 -echo "configure:13860: checking for ndbm.h" >&5 +echo "configure:13877: checking for ndbm.h" >&5 cat > conftest.$ac_ext < EOF ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out" -{ (eval echo configure:13868: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; } +{ (eval echo configure:13885: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; } ac_err=`grep -v '^ *+' conftest.out | grep -v "^conftest.${ac_ext}\$"` if test -z "$ac_err"; then rm -rf conftest* @@ -13894,12 +13911,12 @@ fi if test "$with_database_gdbm" != "no"; then echo $ac_n "checking for dbm_open in -lgdbm""... $ac_c" 1>&6 -echo "configure:13898: checking for dbm_open in -lgdbm" >&5 +echo "configure:13915: checking for dbm_open in -lgdbm" >&5 ac_lib_var=`echo gdbm'_'dbm_open | sed 'y%./+-%__p_%'` xe_check_libs=" -lgdbm " cat > conftest.$ac_ext <&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then +if { (eval echo configure:13931: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then rm -rf conftest* eval "ac_cv_lib_$ac_lib_var=yes" else @@ -13938,10 +13955,10 @@ fi if test "$with_database_dbm" != "no"; then echo $ac_n "checking for dbm_open""... $ac_c" 1>&6 -echo "configure:13942: checking for dbm_open" >&5 +echo "configure:13959: checking for dbm_open" >&5 cat > conftest.$ac_ext <&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then +if { (eval echo configure:13985: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then rm -rf conftest* eval "ac_cv_func_dbm_open=yes" else @@ -13983,12 +14000,12 @@ else echo $ac_n "checking for dbm_open in -ldbm""... $ac_c" 1>&6 -echo "configure:13987: checking for dbm_open in -ldbm" >&5 +echo "configure:14004: checking for dbm_open in -ldbm" >&5 ac_lib_var=`echo dbm'_'dbm_open | sed 'y%./+-%__p_%'` xe_check_libs=" -ldbm " cat > conftest.$ac_ext <&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then +if { (eval echo configure:14020: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then rm -rf conftest* eval "ac_cv_lib_$ac_lib_var=yes" else @@ -14040,10 +14057,10 @@ EOF if test "$with_database_berkdb" != "no"; then echo $ac_n "checking for Berkeley db.h""... $ac_c" 1>&6 -echo "configure:14044: checking for Berkeley db.h" >&5 +echo "configure:14061: checking for Berkeley db.h" >&5 for header in "db/db.h" "db.h"; do cat > conftest.$ac_ext < @@ -14065,7 +14082,7 @@ int main() { ; return 0; } EOF -if { (eval echo configure:14069: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then +if { (eval echo configure:14086: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then rm -rf conftest* db_h_file="$header"; break else @@ -14081,9 +14098,9 @@ rm -f conftest* if test "$with_database_berkdb" != "no"; then echo $ac_n "checking for Berkeley DB version""... $ac_c" 1>&6 -echo "configure:14085: checking for Berkeley DB version" >&5 +echo "configure:14102: checking for Berkeley DB version" >&5 cat > conftest.$ac_ext < #if DB_VERSION_MAJOR > 1 @@ -14095,7 +14112,7 @@ if (eval "$ac_cpp conftest.$ac_ext") 2>&5 | egrep "yes" >/dev/null 2>&1; then rm -rf conftest* cat > conftest.$ac_ext < #if DB_VERSION_MAJOR > 2 @@ -14122,10 +14139,10 @@ fi rm -f conftest* echo $ac_n "checking for $dbfunc""... $ac_c" 1>&6 -echo "configure:14126: checking for $dbfunc" >&5 +echo "configure:14143: checking for $dbfunc" >&5 cat > conftest.$ac_ext <&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then +if { (eval echo configure:14169: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then rm -rf conftest* eval "ac_cv_func_$dbfunc=yes" else @@ -14167,12 +14184,12 @@ else echo $ac_n "checking for $dbfunc in -ldb""... $ac_c" 1>&6 -echo "configure:14171: checking for $dbfunc in -ldb" >&5 +echo "configure:14188: checking for $dbfunc in -ldb" >&5 ac_lib_var=`echo db'_'$dbfunc | sed 'y%./+-%__p_%'` xe_check_libs=" -ldb " cat > conftest.$ac_ext <&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then +if { (eval echo configure:14204: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then rm -rf conftest* eval "ac_cv_lib_$ac_lib_var=yes" else @@ -14247,12 +14264,12 @@ fi if test "$with_socks" = "yes"; then echo $ac_n "checking for SOCKSinit in -lsocks""... $ac_c" 1>&6 -echo "configure:14251: checking for SOCKSinit in -lsocks" >&5 +echo "configure:14268: checking for SOCKSinit in -lsocks" >&5 ac_lib_var=`echo socks'_'SOCKSinit | sed 'y%./+-%__p_%'` xe_check_libs=" -lsocks " cat > conftest.$ac_ext <&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then +if { (eval echo configure:14284: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then rm -rf conftest* eval "ac_cv_lib_$ac_lib_var=yes" else @@ -14318,22 +14335,22 @@ fi if test "$with_modules" != "no"; then echo "checking for module support" 1>&6 -echo "configure:14322: checking for module support" >&5 +echo "configure:14339: checking for module support" >&5 if test "$with_msw" = "yes"; then have_dl=yes; else ac_safe=`echo "dlfcn.h" | sed 'y%./+-%__p_%'` echo $ac_n "checking for dlfcn.h""... $ac_c" 1>&6 -echo "configure:14329: checking for dlfcn.h" >&5 +echo "configure:14346: checking for dlfcn.h" >&5 cat > conftest.$ac_ext < EOF ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out" -{ (eval echo configure:14337: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; } +{ (eval echo configure:14354: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; } ac_err=`grep -v '^ *+' conftest.out | grep -v "^conftest.${ac_ext}\$"` if test -z "$ac_err"; then rm -rf conftest* @@ -14350,16 +14367,16 @@ if eval "test \"`echo '$ac_cv_header_'$ac_safe`\" = yes"; then echo "$ac_t""yes" 1>&6 echo $ac_n "checking for dlopen in -lc""... $ac_c" 1>&6 -echo "configure:14354: checking for dlopen in -lc" >&5 +echo "configure:14371: checking for dlopen in -lc" >&5 cat > conftest.$ac_ext < int main() { dlopen ("", 0); ; return 0; } EOF -if { (eval echo configure:14363: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then +if { (eval echo configure:14380: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then rm -rf conftest* have_dl=yes else @@ -14368,18 +14385,18 @@ else rm -rf conftest* echo $ac_n "checking for dlopen in -ldl""... $ac_c" 1>&6 -echo "configure:14372: checking for dlopen in -ldl" >&5 +echo "configure:14389: checking for dlopen in -ldl" >&5 ac_save_LIBS="$LIBS" LIBS="-ldl $LIBS" cat > conftest.$ac_ext < int main() { dlopen ("", 0); ; return 0; } EOF -if { (eval echo configure:14383: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then +if { (eval echo configure:14400: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then rm -rf conftest* have_dl=yes else @@ -14408,12 +14425,12 @@ EOF else echo $ac_n "checking for shl_load in -ldld""... $ac_c" 1>&6 -echo "configure:14412: checking for shl_load in -ldld" >&5 +echo "configure:14429: checking for shl_load in -ldld" >&5 ac_lib_var=`echo dld'_'shl_load | sed 'y%./+-%__p_%'` xe_check_libs=" -ldld " cat > conftest.$ac_ext <&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then +if { (eval echo configure:14445: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then rm -rf conftest* eval "ac_cv_lib_$ac_lib_var=yes" else @@ -14451,12 +14468,12 @@ else echo "$ac_t""no" 1>&6 echo $ac_n "checking for dld_init in -ldld""... $ac_c" 1>&6 -echo "configure:14455: checking for dld_init in -ldld" >&5 +echo "configure:14472: checking for dld_init in -ldld" >&5 ac_lib_var=`echo dld'_'dld_init | sed 'y%./+-%__p_%'` xe_check_libs=" -ldld " cat > conftest.$ac_ext <&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then +if { (eval echo configure:14488: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then rm -rf conftest* eval "ac_cv_lib_$ac_lib_var=yes" else @@ -14512,7 +14529,7 @@ xehost=$canonical xealias=$internal_configuration echo "checking how to build dynamic libraries for ${xehost}" 1>&6 -echo "configure:14516: checking how to build dynamic libraries for ${xehost}" >&5 +echo "configure:14533: checking how to build dynamic libraries for ${xehost}" >&5 # Transform *-*-linux* to *-*-linux-gnu*, to support old configure scripts. case "$xehost" in *-*-linux-gnu*) ;; @@ -14540,9 +14557,9 @@ if test "$GCC" = "yes"; then XEGCC=yes else echo $ac_n "checking checking whether we are using GNU C""... $ac_c" 1>&6 -echo "configure:14544: checking checking whether we are using GNU C" >&5 +echo "configure:14561: checking checking whether we are using GNU C" >&5 cat > conftest.$ac_ext <&6 -echo "configure:14568: checking how to produce PIC code" >&5 +echo "configure:14585: checking how to produce PIC code" >&5 wl= can_build_shared=yes @@ -14665,18 +14682,18 @@ if test -n "$dll_cflags"; then # Check to make sure the dll_cflags actually works. echo $ac_n "checking if PIC flag ${dll_cflags} really works""... $ac_c" 1>&6 -echo "configure:14669: checking if PIC flag ${dll_cflags} really works" >&5 +echo "configure:14686: checking if PIC flag ${dll_cflags} really works" >&5 save_CFLAGS="$CFLAGS" CFLAGS="$CFLAGS $dll_cflags -DPIC" cat > conftest.$ac_ext <&5; (eval $ac_compile) 2>&5; }; then +if { (eval echo configure:14697: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then rm -rf conftest* # On HP-UX, the stripped-down bundled CC doesn't accept +Z, but also @@ -14707,7 +14724,7 @@ cc_produces_so=no xldf= xcldf= echo $ac_n "checking if C compiler can produce shared libraries""... $ac_c" 1>&6 -echo "configure:14711: checking if C compiler can produce shared libraries" >&5 +echo "configure:14728: checking if C compiler can produce shared libraries" >&5 if test "$XEGCC" = yes; then xcldf="-shared" xldf="-shared" @@ -14758,14 +14775,14 @@ if test -n "$xcldf"; then xe_libs= ac_link='${CC-cc} -o conftest $CFLAGS '"$xe_cppflags $xe_ldflags"' conftest.$ac_ext '"$xe_libs"' 1>&5' cat > conftest.$ac_ext <&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then +if { (eval echo configure:14786: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then rm -rf conftest* cc_produces_so=yes else @@ -14790,7 +14807,7 @@ if test -z "$LTLD"; then if test "$XEGCC" = yes; then # Check if gcc -print-prog-name=ld gives a path. echo $ac_n "checking for ld used by GCC""... $ac_c" 1>&6 -echo "configure:14794: checking for ld used by GCC" >&5 +echo "configure:14811: checking for ld used by GCC" >&5 ac_prog=`($CC -print-prog-name=ld) 2>&5` case "$ac_prog" in # Accept absolute paths. @@ -14816,7 +14833,7 @@ echo "configure:14794: checking for ld used by GCC" >&5 esac else echo $ac_n "checking for GNU ld""... $ac_c" 1>&6 -echo "configure:14820: checking for GNU ld" >&5 +echo "configure:14837: checking for GNU ld" >&5 fi if test -z "$LTLD"; then @@ -14854,7 +14871,7 @@ ld_dynamic_link_flags= # Check to see if it really is or isn't GNU ld. echo $ac_n "checking if the linker is GNU ld""... $ac_c" 1>&6 -echo "configure:14858: checking if the linker is GNU ld" >&5 +echo "configure:14875: checking if the linker is GNU ld" >&5 # I'd rather use --version here, but apparently some GNU ld's only accept -v. if $LTLD -v 2>&1 &5; then xe_gnu_ld=yes @@ -14882,7 +14899,7 @@ else # OK - only NOW do we futz about with ld. # See if the linker supports building shared libraries. echo $ac_n "checking whether the linker supports shared libraries""... $ac_c" 1>&6 -echo "configure:14886: checking whether the linker supports shared libraries" >&5 +echo "configure:14903: checking whether the linker supports shared libraries" >&5 dll_ld=$CC dll_ldflags=$LDFLAGS ld_shlibs=yes @@ -15093,10 +15110,10 @@ EOF for ac_func in dlerror _dlerror do echo $ac_n "checking for $ac_func""... $ac_c" 1>&6 -echo "configure:15097: checking for $ac_func" >&5 +echo "configure:15114: checking for $ac_func" >&5 cat > conftest.$ac_ext <&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then +if { (eval echo configure:15140: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then rm -rf conftest* eval "ac_cv_func_$ac_func=yes" else @@ -15158,11 +15175,11 @@ done fi cat > conftest.$ac_ext <&5; (eval $ac_link) 2>&5; } && test -s conftest && (./conftest; exit $?) 2>&5 +if { (eval echo configure:15183: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest && (./conftest; exit $?) 2>&5 then : else @@ -15919,6 +15936,7 @@ echo " Internationalization:" test "$with_mule" = yes && echo " Compiling in support for Mule (multi-lingual Emacs)." test "$with_utf_2000" = yes && echo " Using UTF-2000 (UTF-8) buffer/string representation." +test "$with_text_coding" = yes && echo " Compiling in Text coding support." test "$with_file_coding" = yes && echo " Compiling in support for file coding." test "$with_xim" != no && echo " Compiling in support for XIM (X11R5+ I18N input method)." test "$with_xim" = motif && echo " - Using Motif to provide XIM support." diff --git a/configure.in b/configure.in index 416d910..19a4122 100644 --- a/configure.in +++ b/configure.in @@ -492,6 +492,7 @@ while test $# != 0; do with_i18n3 | \ with_mule | \ with_utf_2000 | \ + with_text_coding| \ with_file_coding| \ with_canna | \ with_wnn | \ @@ -3685,8 +3686,13 @@ if test "$with_mule" = "yes" ; then AC_CHECKING(for Mule-related features) AC_DEFINE(MULE) AC_DEFINE(FILE_CODING) - XE_ADD_OBJS(mule.o mule-ccl.o mule-charset.o file-coding.o) - + XE_ADD_OBJS(mule.o mule-ccl.o mule-charset.o) + if test "$with_utf_2000" = "yes" && test "$with_text_coding" = "yes"; then + AC_DEFINE(TEXT_CODING) + XE_ADD_OBJS(text-coding.o) + else + XE_ADD_OBJS(file-coding.o) + fi dnl Use -lintl to get internationalized strerror for Mule AC_CHECK_HEADERS(libintl.h) AC_CHECK_LIB(intl, strerror) @@ -5038,6 +5044,7 @@ echo " Internationalization:" test "$with_mule" = yes && echo " Compiling in support for Mule (multi-lingual Emacs)." test "$with_utf_2000" = yes && echo " Using UTF-2000 (UTF-8) buffer/string representation." +test "$with_text_coding" = yes && echo " Compiling in Text coding support." test "$with_file_coding" = yes && echo " Compiling in support for file coding." test "$with_xim" != no && echo " Compiling in support for XIM (X11R5+ I18N input method)." test "$with_xim" = motif && echo " - Using Motif to provide XIM support." diff --git a/lisp/ChangeLog b/lisp/ChangeLog index 5ac73a5..b78dd2f 100644 --- a/lisp/ChangeLog +++ b/lisp/ChangeLog @@ -1,3 +1,9 @@ +1999-09-09 MORIOKA Tomohiko + + * mule/viet-chars.el: Don't define charset + `vietnamese-viscii-lower' and `vietnamese-viscii-upper' because + they are defined as builtin charsets. + 1999-08-31 MORIOKA Tomohiko * version.el (emacs-version): Add more space just before UTF-2000 diff --git a/lisp/custom-load.el b/lisp/custom-load.el index c7bddd7..7f0c64b 100644 --- a/lisp/custom-load.el +++ b/lisp/custom-load.el @@ -73,7 +73,7 @@ (custom-add-loads 'fill '("simple" "fill")) (custom-add-loads 'custom-magic-faces '("cus-edit")) (custom-add-loads 'display '("modeline" "toolbar" "scrollbar" "auto-show")) -(custom-add-loads 'faces '("faces" "cus-edit" "font-lock" "font" "hyper-apropos" "info" "wid-edit")) +(custom-add-loads 'faces '("faces" "font" "cus-edit" "font-lock" "hyper-apropos" "info" "wid-edit")) (custom-add-loads 'emacs '("faces" "help" "files" "cus-edit" "package-get")) (custom-add-loads 'processes '("process" "gnuserv")) (custom-add-loads 'hyper-apropos '("hyper-apropos")) diff --git a/lisp/mule/viet-chars.el b/lisp/mule/viet-chars.el index 0df00f9..7b3c4a4 100644 --- a/lisp/mule/viet-chars.el +++ b/lisp/mule/viet-chars.el @@ -31,21 +31,23 @@ ;; read in before the code that creates those sets is evaluated. ;; Vietnamese VISCII with two tables. -(make-charset 'vietnamese-viscii-lower "VISCII lower (Vietnamese)" - '(registry "VISCII1.1" - dimension 1 - chars 96 - final ?1 - graphic 1 - )) - -(make-charset 'vietnamese-viscii-upper "VISCII upper (Vietnamese)" - '(registry "VISCII1.1" - dimension 1 - chars 96 - final ?2 - graphic 1 - )) +(unless (featurep 'utf-2000) + (make-charset 'vietnamese-viscii-lower "VISCII lower (Vietnamese)" + '(registry "VISCII1.1" + dimension 1 + chars 96 + final ?1 + graphic 1 + )) + + (make-charset 'vietnamese-viscii-upper "VISCII upper (Vietnamese)" + '(registry "VISCII1.1" + dimension 1 + chars 96 + final ?2 + graphic 1 + )) + ) (modify-syntax-entry 'vietnamese-viscii-lower "w") (modify-syntax-entry 'vietnamese-viscii-upper "w") diff --git a/src/ChangeLog b/src/ChangeLog index 00f6353..a41ff49 100644 --- a/src/ChangeLog +++ b/src/ChangeLog @@ -1,3 +1,83 @@ +1999-09-09 MORIOKA Tomohiko + + * char-ucs.h (Emchar_to_byte_table): New type. + (get_byte_from_character_table): New function interface. + (Vcharset_latin_jisx0201): New variable. + (latin_jisx0201_to_ucs): New variable. + (ucs_to_latin_jisx0201): New variable. + (Vcharset_latin_iso8859_2): New variable. + (latin_iso8859_2_to_ucs): New variable. + (ucs_to_latin_iso8859_2): New variable. + (Vcharset_latin_iso8859_3): New variable. + (latin_iso8859_3_to_ucs): New variable. + (ucs_to_latin_iso8859_3): New variable. + (Vcharset_latin_iso8859_4): New variable. + (latin_iso8859_4_to_ucs): New variable. + (ucs_to_latin_iso8859_4): New variable. + (Vcharset_latin_iso8859_9): New variable. + (latin_iso8859_9_to_ucs): New variable. + (ucs_to_latin_iso8859_9): New variable. + (Vcharset_latin_viscii_lower): New variable. + (latin_viscii_lower_to_ucs): New variable. + (ucs_to_latin_viscii_lower): New variable. + (Vcharset_latin_viscii_upper): New variable. + (latin_viscii_upper_to_ucs): New variable. + (ucs_to_latin_viscii_upper): New variable. + (CHARSET_ID_OFFSET_94): Changed from 0x60 to 0x55. + (LEADING_BYTE_LATIN_VISCII_LOWER): New macro. + (LEADING_BYTE_LATIN_VISCII_UPPER): New macro. + (MAKE_CHAR): Map `latin-iso8859-2', `latin-iso8859-3', + `latin-iso8859-4', `latin-iso8859-9', `latin-jisx0201', + `vietnamese-viscii-lower' and `vietnamese-viscii-upper' to BMP. + (breakup_char_1): Use `ucs_to_latin_iso8859_2', + `ucs_to_latin_iso8859_3', `ucs_to_latin_iso8859_4', + `ucs_to_latin_iso8859_9', `ucs_to_latin_viscii_lower', + `ucs_to_latin_viscii_upper' and `ucs_to_latin_jisx0201' tables. + + * mule-charset.c (Vcharset_latin_viscii_lower): New variable. + (Vcharset_latin_viscii_upper): New variable. + (make_byte_from_character_table): New function. + (put_byte_from_character_table): New function. + (get_byte_from_character_table): New function. + (CHAR96): New macro. + (ucs_to_latin_jisx0201): New variable. + (latin_jisx0201_to_ucs): New variable. + (ucs_to_latin_iso8859_2): New variable. + (latin_iso8859_2_to_ucs): New variable. + (ucs_to_latin_iso8859_3): New variable. + (latin_iso8859_3_to_ucs): New variable. + (ucs_to_latin_iso8859_4): New variable. + (latin_iso8859_4_to_ucs): New variable. + (ucs_to_latin_iso8859_9): New variable. + (latin_iso8859_9_to_ucs): New variable. + (ucs_to_latin_viscii_lower): New variable. + (latin_viscii_lower_to_ucs): New variable. + (ucs_to_latin_viscii_upper): New variable. + (latin_viscii_upper_to_ucs): New variable. + (ucs_to_latin_tcvn5712): New variable. + (latin_tcvn5712_to_ucs): New variable. + (Qlatin_viscii_lower): New variable. + (Qlatin_viscii_upper): New variable. + (syms_of_mule_charset): Set up new symbol + `vietnamese-viscii-lower' and `vietnamese-viscii-upper'. + (complex_vars_of_mule_charset): Set up new charset + `vietnamese-viscii-lower' and `vietnamese-viscii-upper'; new macro + `GENERATE_94_SET' and `GENERATE_96_SET'; use them to generate + `ucs_to_' tables. + +1999-09-08 MORIOKA Tomohiko + + * text-coding.c: New file. + +1999-09-07 MORIOKA Tomohiko + + * mule-charset.c (Fmake_char): Fix problem of 256-set. + + * char-ucs.h (Vcharset_ucs_bmp): New variable. + (MAKE_CHAR): Modify for `ucs-bmp'. + (breakup_char_1): Return `ucs-bmp' and code point of BMP for + non-MULE characters of BMP. + 1999-09-06 MORIOKA Tomohiko * mule-charset.c (vars_of_mule_charset): diff --git a/src/char-ucs.h b/src/char-ucs.h index 45e801b..9482331 100644 --- a/src/char-ucs.h +++ b/src/char-ucs.h @@ -29,6 +29,34 @@ Boston, MA 02111-1307, USA. */ #define CHAR_ASCII_P(ch) ((ch) <= 0x7F) +unsigned char +get_byte_from_character_table (Emchar ch, + Emchar* table, size_t size, unsigned char offset); + +extern Lisp_Object Vcharset_ucs_bmp; + +extern Lisp_Object Vcharset_latin_jisx0201; +extern Emchar latin_jisx0201_to_ucs[94]; + +extern Lisp_Object Vcharset_latin_iso8859_2; +extern Emchar latin_iso8859_2_to_ucs[96]; + +extern Lisp_Object Vcharset_latin_iso8859_3; +extern Emchar latin_iso8859_3_to_ucs[96]; + +extern Lisp_Object Vcharset_latin_iso8859_4; +extern Emchar latin_iso8859_4_to_ucs[96]; + +extern Lisp_Object Vcharset_latin_iso8859_9; +extern Emchar latin_iso8859_9_to_ucs[96]; + +extern Lisp_Object Vcharset_latin_viscii_lower; +extern Emchar latin_viscii_lower_to_ucs[96]; + +extern Lisp_Object Vcharset_latin_viscii_upper; +extern Emchar latin_viscii_upper_to_ucs[96]; + + /************************************************************************/ /* Definition of leading bytes */ /************************************************************************/ @@ -41,7 +69,7 @@ typedef int Charset_ID; #define LEADING_BYTE_CONTROL_1 0x81 /* represent normal 80-9F */ -#define CHARSET_ID_OFFSET_94 0x60 +#define CHARSET_ID_OFFSET_94 0x55 #define MIN_CHARSET_ID_PRIVATE_94 (CHARSET_ID_OFFSET_94 + '0') #define MAX_CHARSET_ID_PRIVATE_94 (CHARSET_ID_OFFSET_94 + '?') @@ -58,6 +86,9 @@ typedef int Charset_ID; #define CHARSET_ID_OFFSET_96 0x70 +#define LEADING_BYTE_LATIN_VISCII_LOWER (CHARSET_ID_OFFSET_96 + '1') +#define LEADING_BYTE_LATIN_VISCII_UPPER (CHARSET_ID_OFFSET_96 + '2') + /* Right half of ISO 8859-1 */ #define LEADING_BYTE_LATIN_ISO8859_1 (CHARSET_ID_OFFSET_96 + 'A') @@ -342,14 +373,24 @@ MAKE_CHAR (Lisp_Object charset, int c1, int c2) return c1; else if (EQ (charset, Vcharset_control_1)) return c1 | 0x80; + else if (EQ (charset, Vcharset_ucs_bmp)) + return (c1 << 8) | c2; else if (EQ (charset, Vcharset_latin_iso8859_1)) return c1 | 0x80; - else if (EQ (charset, Vcharset_greek_iso8859_7)) - return c1 + MIN_CHAR_GREEK - 0x20; + else if (EQ (charset, Vcharset_latin_iso8859_2)) + return latin_iso8859_2_to_ucs[c1 - 32]; + else if (EQ (charset, Vcharset_latin_iso8859_3)) + return latin_iso8859_3_to_ucs[c1 - 32]; + else if (EQ (charset, Vcharset_latin_iso8859_4)) + return latin_iso8859_4_to_ucs[c1 - 32]; else if (EQ (charset, Vcharset_cyrillic_iso8859_5)) return c1 + MIN_CHAR_CYRILLIC - 0x20; + else if (EQ (charset, Vcharset_greek_iso8859_7)) + return c1 + MIN_CHAR_GREEK - 0x20; else if (EQ (charset, Vcharset_hebrew_iso8859_8)) return c1 + MIN_CHAR_HEBREW - 0x20; + else if (EQ (charset, Vcharset_latin_iso8859_9)) + return latin_iso8859_9_to_ucs[c1 - 32]; else if (EQ (charset, Vcharset_thai_tis620)) return c1 + MIN_CHAR_THAI - 0x20; else if (EQ (charset, Vcharset_katakana_jisx0201)) @@ -357,6 +398,12 @@ MAKE_CHAR (Lisp_Object charset, int c1, int c2) return c1 + MIN_CHAR_HALFWIDTH_KATAKANA - 0x20; else return 32; + else if (EQ (charset, Vcharset_latin_jisx0201)) + return latin_jisx0201_to_ucs[c1 - 33]; + else if (EQ (charset, Vcharset_latin_viscii_lower)) + return latin_viscii_lower_to_ucs[c1 - 32]; + else if (EQ (charset, Vcharset_latin_viscii_upper)) + return latin_viscii_upper_to_ucs[c1 - 32]; else if (XCHARSET_DIMENSION (charset) == 1) { switch (XCHARSET_CHARS (charset)) @@ -419,13 +466,82 @@ breakup_char_1 (Emchar c, Lisp_Object *charset, int *c1, int *c2) { *charset = CHARSET_BY_LEADING_BYTE (latin_a_char_to_charset[c - 0x100]); - *c1 = latin_a_char_to_byte1[c - 0x100]; - *c2 = latin_a_char_to_byte2[c - 0x100]; + + if (EQ (*charset, Vcharset_latin_iso8859_2)) + { + *c1 = get_byte_from_character_table (c, latin_iso8859_2_to_ucs, 96, 32); + *c2 = 0; + } + else if (EQ (*charset, Vcharset_latin_iso8859_3)) + { + *c1 = get_byte_from_character_table (c, latin_iso8859_3_to_ucs, 96, 32); + *c2 = 0; + } + else if (EQ (*charset, Vcharset_latin_iso8859_4)) + { + *c1 = get_byte_from_character_table (c, latin_iso8859_4_to_ucs, 96, 32); + *c2 = 0; + } + else if (EQ (*charset, Vcharset_latin_iso8859_9)) + { + *c1 = get_byte_from_character_table (c, latin_iso8859_9_to_ucs, 96, 32); + *c2 = 0; + } + else + { + *c1 = latin_a_char_to_byte1[c - 0x100]; + *c2 = latin_a_char_to_byte2[c - 0x100]; + } } else if (c < MIN_CHAR_GREEK) { - printf("not break up u+%x", c); - abort (); + if ( (*c1 = get_byte_from_character_table (c, latin_iso8859_2_to_ucs, + 96, 32)) ) + { + *charset = Vcharset_latin_iso8859_2; + *c2 = 0; + } + else if ( (*c1 = + get_byte_from_character_table (c, latin_iso8859_3_to_ucs, + 96, 32)) ) + { + *charset = Vcharset_latin_iso8859_3; + *c2 = 0; + } + else if ( (*c1 = + get_byte_from_character_table (c, latin_iso8859_4_to_ucs, + 96, 32)) ) + { + *charset = Vcharset_latin_iso8859_4; + *c2 = 0; + } + else if ( (*c1 = + get_byte_from_character_table (c, latin_iso8859_9_to_ucs, + 96, 32)) ) + { + *charset = Vcharset_latin_iso8859_9; + *c2 = 0; + } + else if ( (*c1 = + get_byte_from_character_table (c, latin_viscii_lower_to_ucs, + 96, 32)) ) + { + *charset = Vcharset_latin_viscii_lower; + *c2 = 0; + } + else if ( (*c1 = + get_byte_from_character_table (c, latin_viscii_upper_to_ucs, + 96, 32)) ) + { + *charset = Vcharset_latin_viscii_upper; + *c2 = 0; + } + else + { + *charset = Vcharset_ucs_bmp; + *c1 = c >> 8; + *c2 = c & 0xff; + } } else if (c <= MAX_CHAR_GREEK) { @@ -435,8 +551,9 @@ breakup_char_1 (Emchar c, Lisp_Object *charset, int *c1, int *c2) } else if (c < MIN_CHAR_CYRILLIC) { - printf("not break up u+%x", c); - abort (); + *charset = Vcharset_ucs_bmp; + *c1 = c >> 8; + *c2 = c & 0xff; } else if (c <= MAX_CHAR_CYRILLIC) { @@ -446,8 +563,9 @@ breakup_char_1 (Emchar c, Lisp_Object *charset, int *c1, int *c2) } else if (c < MIN_CHAR_HEBREW) { - printf("not break up u+%x", c); - abort (); + *charset = Vcharset_ucs_bmp; + *c1 = c >> 8; + *c2 = c & 0xff; } else if (c <= MAX_CHAR_HEBREW) { @@ -457,8 +575,9 @@ breakup_char_1 (Emchar c, Lisp_Object *charset, int *c1, int *c2) } else if (c < MIN_CHAR_THAI) { - printf("not break up u+%x", c); - abort (); + *charset = Vcharset_ucs_bmp; + *c1 = c >> 8; + *c2 = c & 0xff; } else if (c <= MAX_CHAR_THAI) { @@ -468,8 +587,32 @@ breakup_char_1 (Emchar c, Lisp_Object *charset, int *c1, int *c2) } else if (c < MIN_CHAR_HALFWIDTH_KATAKANA) { - printf("not break up u+%x", c); - abort (); + if ( (*c1 = get_byte_from_character_table (c, latin_jisx0201_to_ucs, + 94, 33)) ) + { + *charset = Vcharset_latin_jisx0201; + *c2 = 0; + } + else if ( (*c1 = get_byte_from_character_table (c, + latin_viscii_lower_to_ucs, + 96, 32)) ) + { + *charset = Vcharset_latin_viscii_lower; + *c2 = 0; + } + else if ( (*c1 = get_byte_from_character_table (c, + latin_viscii_upper_to_ucs, + 96, 32)) ) + { + *charset = Vcharset_latin_viscii_upper; + *c2 = 0; + } + else + { + *charset = Vcharset_ucs_bmp; + *c1 = c >> 8; + *c2 = c & 0xff; + } } else if (c <= MAX_CHAR_HALFWIDTH_KATAKANA) { diff --git a/src/mule-charset.c b/src/mule-charset.c index 9af1db5..c0fe875 100644 --- a/src/mule-charset.c +++ b/src/mule-charset.c @@ -64,6 +64,8 @@ Lisp_Object Vcharset_chinese_cns11643_5; Lisp_Object Vcharset_chinese_cns11643_6; Lisp_Object Vcharset_chinese_cns11643_7; Lisp_Object Vcharset_ucs_bmp; +Lisp_Object Vcharset_latin_viscii_lower; +Lisp_Object Vcharset_latin_viscii_upper; #endif Lisp_Object Vcharset_chinese_big5_1; Lisp_Object Vcharset_chinese_big5_2; @@ -133,6 +135,822 @@ const Bytecount rep_bytes_by_first_byte[0xA0] = #endif #ifdef UTF2000 +unsigned char +get_byte_from_character_table (Emchar ch, + Emchar* table, size_t size, unsigned char offset) +{ + size_t i; + + for (i = 0; i < size; i++) + { + if (table[i] == ch) + return i + offset; + } + return 0; +} + +#define CHAR96(ft,b) (MIN_CHAR_96 + (ft - '0') * 96 + (b & 0x7f) - 32) + +Emchar latin_jisx0201_to_ucs[94] = +{ + 0x0021 /* 0x21 EXCLAMATION MARK */, + 0x0022 /* 0x22 QUOTATION MARK */, + 0x0023 /* 0x23 NUMBER SIGN */, + 0x0024 /* 0x24 DOLLAR SIGN */, + 0x0025 /* 0x25 PERCENT SIGN */, + 0x0026 /* 0x26 AMPERSAND */, + 0x0027 /* 0x27 APOSTROPHE */, + 0x0028 /* 0x28 LEFT PARENTHESIS */, + 0x0029 /* 0x29 RIGHT PARENTHESIS */, + 0x002A /* 0x2A ASTERISK */, + 0x002B /* 0x2B PLUS SIGN */, + 0x002C /* 0x2C COMMA */, + 0x002D /* 0x2D HYPHEN-MINUS */, + 0x002E /* 0x2E FULL STOP */, + 0x002F /* 0x2F SOLIDUS */, + 0x0030 /* 0x30 DIGIT ZERO */, + 0x0031 /* 0x31 DIGIT ONE */, + 0x0032 /* 0x32 DIGIT TWO */, + 0x0033 /* 0x33 DIGIT THREE */, + 0x0034 /* 0x34 DIGIT FOUR */, + 0x0035 /* 0x35 DIGIT FIVE */, + 0x0036 /* 0x36 DIGIT SIX */, + 0x0037 /* 0x37 DIGIT SEVEN */, + 0x0038 /* 0x38 DIGIT EIGHT */, + 0x0039 /* 0x39 DIGIT NINE */, + 0x003A /* 0x3A COLON */, + 0x003B /* 0x3B SEMICOLON */, + 0x003C /* 0x3C LESS-THAN SIGN */, + 0x003D /* 0x3D EQUALS SIGN */, + 0x003E /* 0x3E GREATER-THAN SIGN */, + 0x003F /* 0x3F QUESTION MARK */, + 0x0040 /* 0x40 COMMERCIAL AT */, + 0x0041 /* 0x41 LATIN CAPITAL LETTER A */, + 0x0042 /* 0x42 LATIN CAPITAL LETTER B */, + 0x0043 /* 0x43 LATIN CAPITAL LETTER C */, + 0x0044 /* 0x44 LATIN CAPITAL LETTER D */, + 0x0045 /* 0x45 LATIN CAPITAL LETTER E */, + 0x0046 /* 0x46 LATIN CAPITAL LETTER F */, + 0x0047 /* 0x47 LATIN CAPITAL LETTER G */, + 0x0048 /* 0x48 LATIN CAPITAL LETTER H */, + 0x0049 /* 0x49 LATIN CAPITAL LETTER I */, + 0x004A /* 0x4A LATIN CAPITAL LETTER J */, + 0x004B /* 0x4B LATIN CAPITAL LETTER K */, + 0x004C /* 0x4C LATIN CAPITAL LETTER L */, + 0x004D /* 0x4D LATIN CAPITAL LETTER M */, + 0x004E /* 0x4E LATIN CAPITAL LETTER N */, + 0x004F /* 0x4F LATIN CAPITAL LETTER O */, + 0x0050 /* 0x50 LATIN CAPITAL LETTER P */, + 0x0051 /* 0x51 LATIN CAPITAL LETTER Q */, + 0x0052 /* 0x52 LATIN CAPITAL LETTER R */, + 0x0053 /* 0x53 LATIN CAPITAL LETTER S */, + 0x0054 /* 0x54 LATIN CAPITAL LETTER T */, + 0x0055 /* 0x55 LATIN CAPITAL LETTER U */, + 0x0056 /* 0x56 LATIN CAPITAL LETTER V */, + 0x0057 /* 0x57 LATIN CAPITAL LETTER W */, + 0x0058 /* 0x58 LATIN CAPITAL LETTER X */, + 0x0059 /* 0x59 LATIN CAPITAL LETTER Y */, + 0x005A /* 0x5A LATIN CAPITAL LETTER Z */, + 0x005B /* 0x5B LEFT SQUARE BRACKET */, + 0x00A5 /* 0x5C YEN SIGN */, + 0x005D /* 0x5D RIGHT SQUARE BRACKET */, + 0x005E /* 0x5E CIRCUMFLEX ACCENT */, + 0x005F /* 0x5F LOW LINE */, + 0x0060 /* 0x60 GRAVE ACCENT */, + 0x0061 /* 0x61 LATIN SMALL LETTER A */, + 0x0062 /* 0x62 LATIN SMALL LETTER B */, + 0x0063 /* 0x63 LATIN SMALL LETTER C */, + 0x0064 /* 0x64 LATIN SMALL LETTER D */, + 0x0065 /* 0x65 LATIN SMALL LETTER E */, + 0x0066 /* 0x66 LATIN SMALL LETTER F */, + 0x0067 /* 0x67 LATIN SMALL LETTER G */, + 0x0068 /* 0x68 LATIN SMALL LETTER H */, + 0x0069 /* 0x69 LATIN SMALL LETTER I */, + 0x006A /* 0x6A LATIN SMALL LETTER J */, + 0x006B /* 0x6B LATIN SMALL LETTER K */, + 0x006C /* 0x6C LATIN SMALL LETTER L */, + 0x006D /* 0x6D LATIN SMALL LETTER M */, + 0x006E /* 0x6E LATIN SMALL LETTER N */, + 0x006F /* 0x6F LATIN SMALL LETTER O */, + 0x0070 /* 0x70 LATIN SMALL LETTER P */, + 0x0071 /* 0x71 LATIN SMALL LETTER Q */, + 0x0072 /* 0x72 LATIN SMALL LETTER R */, + 0x0073 /* 0x73 LATIN SMALL LETTER S */, + 0x0074 /* 0x74 LATIN SMALL LETTER T */, + 0x0075 /* 0x75 LATIN SMALL LETTER U */, + 0x0076 /* 0x76 LATIN SMALL LETTER V */, + 0x0077 /* 0x77 LATIN SMALL LETTER W */, + 0x0078 /* 0x78 LATIN SMALL LETTER X */, + 0x0079 /* 0x79 LATIN SMALL LETTER Y */, + 0x007A /* 0x7A LATIN SMALL LETTER Z */, + 0x007B /* 0x7B LEFT CURLY BRACKET */, + 0x007C /* 0x7C VERTICAL LINE */, + 0x007D /* 0x7D RIGHT CURLY BRACKET */, + 0x203E /* 0x7E OVERLINE */ +}; + + +Emchar latin_iso8859_2_to_ucs[96] = +{ + 0x00A0 /* 0xA0 NO-BREAK SPACE */, + 0x0104 /* 0xA1 LATIN CAPITAL LETTER A WITH OGONEK */, + 0x02D8 /* 0xA2 BREVE */, + 0x0141 /* 0xA3 LATIN CAPITAL LETTER L WITH STROKE */, + 0x00A4 /* 0xA4 CURRENCY SIGN */, + 0x013D /* 0xA5 LATIN CAPITAL LETTER L WITH CARON */, + 0x015A /* 0xA6 LATIN CAPITAL LETTER S WITH ACUTE */, + 0x00A7 /* 0xA7 SECTION SIGN */, + 0x00A8 /* 0xA8 DIAERESIS */, + 0x0160 /* 0xA9 LATIN CAPITAL LETTER S WITH CARON */, + 0x015E /* 0xAA LATIN CAPITAL LETTER S WITH CEDILLA */, + 0x0164 /* 0xAB LATIN CAPITAL LETTER T WITH CARON */, + 0x0179 /* 0xAC LATIN CAPITAL LETTER Z WITH ACUTE */, + 0x00AD /* 0xAD SOFT HYPHEN */, + 0x017D /* 0xAE LATIN CAPITAL LETTER Z WITH CARON */, + 0x017B /* 0xAF LATIN CAPITAL LETTER Z WITH DOT ABOVE */, + 0x00B0 /* 0xB0 DEGREE SIGN */, + 0x0105 /* 0xB1 LATIN SMALL LETTER A WITH OGONEK */, + 0x02DB /* 0xB2 OGONEK */, + 0x0142 /* 0xB3 LATIN SMALL LETTER L WITH STROKE */, + 0x00B4 /* 0xB4 ACUTE ACCENT */, + 0x013E /* 0xB5 LATIN SMALL LETTER L WITH CARON */, + 0x015B /* 0xB6 LATIN SMALL LETTER S WITH ACUTE */, + 0x02C7 /* 0xB7 CARON */, + 0x00B8 /* 0xB8 CEDILLA */, + 0x0161 /* 0xB9 LATIN SMALL LETTER S WITH CARON */, + 0x015F /* 0xBA LATIN SMALL LETTER S WITH CEDILLA */, + 0x0165 /* 0xBB LATIN SMALL LETTER T WITH CARON */, + 0x017A /* 0xBC LATIN SMALL LETTER Z WITH ACUTE */, + 0x02DD /* 0xBD DOUBLE ACUTE ACCENT */, + 0x017E /* 0xBE LATIN SMALL LETTER Z WITH CARON */, + 0x017C /* 0xBF LATIN SMALL LETTER Z WITH DOT ABOVE */, + 0x0154 /* 0xC0 LATIN CAPITAL LETTER R WITH ACUTE */, + 0x00C1 /* 0xC1 LATIN CAPITAL LETTER A WITH ACUTE */, + 0x00C2 /* 0xC2 LATIN CAPITAL LETTER A WITH CIRCUMFLEX */, + 0x0102 /* 0xC3 LATIN CAPITAL LETTER A WITH BREVE */, + 0x00C4 /* 0xC4 LATIN CAPITAL LETTER A WITH DIAERESIS */, + 0x0139 /* 0xC5 LATIN CAPITAL LETTER L WITH ACUTE */, + 0x0106 /* 0xC6 LATIN CAPITAL LETTER C WITH ACUTE */, + 0x00C7 /* 0xC7 LATIN CAPITAL LETTER C WITH CEDILLA */, + 0x010C /* 0xC8 LATIN CAPITAL LETTER C WITH CARON */, + 0x00C9 /* 0xC9 LATIN CAPITAL LETTER E WITH ACUTE */, + 0x0118 /* 0xCA LATIN CAPITAL LETTER E WITH OGONEK */, + 0x00CB /* 0xCB LATIN CAPITAL LETTER E WITH DIAERESIS */, + 0x011A /* 0xCC LATIN CAPITAL LETTER E WITH CARON */, + 0x00CD /* 0xCD LATIN CAPITAL LETTER I WITH ACUTE */, + 0x00CE /* 0xCE LATIN CAPITAL LETTER I WITH CIRCUMFLEX */, + 0x010E /* 0xCF LATIN CAPITAL LETTER D WITH CARON */, + 0x0110 /* 0xD0 LATIN CAPITAL LETTER D WITH STROKE */, + 0x0143 /* 0xD1 LATIN CAPITAL LETTER N WITH ACUTE */, + 0x0147 /* 0xD2 LATIN CAPITAL LETTER N WITH CARON */, + 0x00D3 /* 0xD3 LATIN CAPITAL LETTER O WITH ACUTE */, + 0x00D4 /* 0xD4 LATIN CAPITAL LETTER O WITH CIRCUMFLEX */, + 0x0150 /* 0xD5 LATIN CAPITAL LETTER O WITH DOUBLE ACUTE */, + 0x00D6 /* 0xD6 LATIN CAPITAL LETTER O WITH DIAERESIS */, + 0x00D7 /* 0xD7 MULTIPLICATION SIGN */, + 0x0158 /* 0xD8 LATIN CAPITAL LETTER R WITH CARON */, + 0x016E /* 0xD9 LATIN CAPITAL LETTER U WITH RING ABOVE */, + 0x00DA /* 0xDA LATIN CAPITAL LETTER U WITH ACUTE */, + 0x0170 /* 0xDB LATIN CAPITAL LETTER U WITH DOUBLE ACUTE */, + 0x00DC /* 0xDC LATIN CAPITAL LETTER U WITH DIAERESIS */, + 0x00DD /* 0xDD LATIN CAPITAL LETTER Y WITH ACUTE */, + 0x0162 /* 0xDE LATIN CAPITAL LETTER T WITH CEDILLA */, + 0x00DF /* 0xDF LATIN SMALL LETTER SHARP S */, + 0x0155 /* 0xE0 LATIN SMALL LETTER R WITH ACUTE */, + 0x00E1 /* 0xE1 LATIN SMALL LETTER A WITH ACUTE */, + 0x00E2 /* 0xE2 LATIN SMALL LETTER A WITH CIRCUMFLEX */, + 0x0103 /* 0xE3 LATIN SMALL LETTER A WITH BREVE */, + 0x00E4 /* 0xE4 LATIN SMALL LETTER A WITH DIAERESIS */, + 0x013A /* 0xE5 LATIN SMALL LETTER L WITH ACUTE */, + 0x0107 /* 0xE6 LATIN SMALL LETTER C WITH ACUTE */, + 0x00E7 /* 0xE7 LATIN SMALL LETTER C WITH CEDILLA */, + 0x010D /* 0xE8 LATIN SMALL LETTER C WITH CARON */, + 0x00E9 /* 0xE9 LATIN SMALL LETTER E WITH ACUTE */, + 0x0119 /* 0xEA LATIN SMALL LETTER E WITH OGONEK */, + 0x00EB /* 0xEB LATIN SMALL LETTER E WITH DIAERESIS */, + 0x011B /* 0xEC LATIN SMALL LETTER E WITH CARON */, + 0x00ED /* 0xED LATIN SMALL LETTER I WITH ACUTE */, + 0x00EE /* 0xEE LATIN SMALL LETTER I WITH CIRCUMFLEX */, + 0x010F /* 0xEF LATIN SMALL LETTER D WITH CARON */, + 0x0111 /* 0xF0 LATIN SMALL LETTER D WITH STROKE */, + 0x0144 /* 0xF1 LATIN SMALL LETTER N WITH ACUTE */, + 0x0148 /* 0xF2 LATIN SMALL LETTER N WITH CARON */, + 0x00F3 /* 0xF3 LATIN SMALL LETTER O WITH ACUTE */, + 0x00F4 /* 0xF4 LATIN SMALL LETTER O WITH CIRCUMFLEX */, + 0x0151 /* 0xF5 LATIN SMALL LETTER O WITH DOUBLE ACUTE */, + 0x00F6 /* 0xF6 LATIN SMALL LETTER O WITH DIAERESIS */, + 0x00F7 /* 0xF7 DIVISION SIGN */, + 0x0159 /* 0xF8 LATIN SMALL LETTER R WITH CARON */, + 0x016F /* 0xF9 LATIN SMALL LETTER U WITH RING ABOVE */, + 0x00FA /* 0xFA LATIN SMALL LETTER U WITH ACUTE */, + 0x0171 /* 0xFB LATIN SMALL LETTER U WITH DOUBLE ACUTE */, + 0x00FC /* 0xFC LATIN SMALL LETTER U WITH DIAERESIS */, + 0x00FD /* 0xFD LATIN SMALL LETTER Y WITH ACUTE */, + 0x0163 /* 0xFE LATIN SMALL LETTER T WITH CEDILLA */, + 0x02D9 /* 0xFF DOT ABOVE */ +}; + +Emchar latin_iso8859_3_to_ucs[96] = +{ + 0x00A0 /* 0xA0 NO-BREAK SPACE */, + 0x0126 /* 0xA1 LATIN CAPITAL LETTER H WITH STROKE */, + 0x02D8 /* 0xA2 BREVE */, + 0x00A3 /* 0xA3 POUND SIGN */, + 0x00A4 /* 0xA4 CURRENCY SIGN */, + CHAR96('C', 0xA5), + 0x0124 /* 0xA6 LATIN CAPITAL LETTER H WITH CIRCUMFLEX */, + 0x00A7 /* 0xA7 SECTION SIGN */, + 0x00A8 /* 0xA8 DIAERESIS */, + 0x0130 /* 0xA9 LATIN CAPITAL LETTER I WITH DOT ABOVE */, + 0x015E /* 0xAA LATIN CAPITAL LETTER S WITH CEDILLA */, + 0x011E /* 0xAB LATIN CAPITAL LETTER G WITH BREVE */, + 0x0134 /* 0xAC LATIN CAPITAL LETTER J WITH CIRCUMFLEX */, + 0x00AD /* 0xAD SOFT HYPHEN */, + CHAR96('C', 0xAE), + 0x017B /* 0xAF LATIN CAPITAL LETTER Z WITH DOT ABOVE */, + 0x00B0 /* 0xB0 DEGREE SIGN */, + 0x0127 /* 0xB1 LATIN SMALL LETTER H WITH STROKE */, + 0x00B2 /* 0xB2 SUPERSCRIPT TWO */, + 0x00B3 /* 0xB3 SUPERSCRIPT THREE */, + 0x00B4 /* 0xB4 ACUTE ACCENT */, + 0x00B5 /* 0xB5 MICRO SIGN */, + 0x0125 /* 0xB6 LATIN SMALL LETTER H WITH CIRCUMFLEX */, + 0x00B7 /* 0xB7 MIDDLE DOT */, + 0x00B8 /* 0xB8 CEDILLA */, + 0x0131 /* 0xB9 LATIN SMALL LETTER DOTLESS I */, + 0x015F /* 0xBA LATIN SMALL LETTER S WITH CEDILLA */, + 0x011F /* 0xBB LATIN SMALL LETTER G WITH BREVE */, + 0x0135 /* 0xBC LATIN SMALL LETTER J WITH CIRCUMFLEX */, + 0x00BD /* 0xBD VULGAR FRACTION ONE HALF */, + CHAR96('C', 0xBE), + 0x017C /* 0xBF LATIN SMALL LETTER Z WITH DOT ABOVE */, + 0x00C0 /* 0xC0 LATIN CAPITAL LETTER A WITH GRAVE */, + 0x00C1 /* 0xC1 LATIN CAPITAL LETTER A WITH ACUTE */, + 0x00C2 /* 0xC2 LATIN CAPITAL LETTER A WITH CIRCUMFLEX */, + CHAR96('C', 0xC3), + 0x00C4 /* 0xC4 LATIN CAPITAL LETTER A WITH DIAERESIS */, + 0x010A /* 0xC5 LATIN CAPITAL LETTER C WITH DOT ABOVE */, + 0x0108 /* 0xC6 LATIN CAPITAL LETTER C WITH CIRCUMFLEX */, + 0x00C7 /* 0xC7 LATIN CAPITAL LETTER C WITH CEDILLA */, + 0x00C8 /* 0xC8 LATIN CAPITAL LETTER E WITH GRAVE */, + 0x00C9 /* 0xC9 LATIN CAPITAL LETTER E WITH ACUTE */, + 0x00CA /* 0xCA LATIN CAPITAL LETTER E WITH CIRCUMFLEX */, + 0x00CB /* 0xCB LATIN CAPITAL LETTER E WITH DIAERESIS */, + 0x00CC /* 0xCC LATIN CAPITAL LETTER I WITH GRAVE */, + 0x00CD /* 0xCD LATIN CAPITAL LETTER I WITH ACUTE */, + 0x00CE /* 0xCE LATIN CAPITAL LETTER I WITH CIRCUMFLEX */, + 0x00CF /* 0xCF LATIN CAPITAL LETTER I WITH DIAERESIS */, + CHAR96('C', 0xD0), + 0x00D1 /* 0xD1 LATIN CAPITAL LETTER N WITH TILDE */, + 0x00D2 /* 0xD2 LATIN CAPITAL LETTER O WITH GRAVE */, + 0x00D3 /* 0xD3 LATIN CAPITAL LETTER O WITH ACUTE */, + 0x00D4 /* 0xD4 LATIN CAPITAL LETTER O WITH CIRCUMFLEX */, + 0x0120 /* 0xD5 LATIN CAPITAL LETTER G WITH DOT ABOVE */, + 0x00D6 /* 0xD6 LATIN CAPITAL LETTER O WITH DIAERESIS */, + 0x00D7 /* 0xD7 MULTIPLICATION SIGN */, + 0x011C /* 0xD8 LATIN CAPITAL LETTER G WITH CIRCUMFLEX */, + 0x00D9 /* 0xD9 LATIN CAPITAL LETTER U WITH GRAVE */, + 0x00DA /* 0xDA LATIN CAPITAL LETTER U WITH ACUTE */, + 0x00DB /* 0xDB LATIN CAPITAL LETTER U WITH CIRCUMFLEX */, + 0x00DC /* 0xDC LATIN CAPITAL LETTER U WITH DIAERESIS */, + 0x016C /* 0xDD LATIN CAPITAL LETTER U WITH BREVE */, + 0x015C /* 0xDE LATIN CAPITAL LETTER S WITH CIRCUMFLEX */, + 0x00DF /* 0xDF LATIN SMALL LETTER SHARP S */, + 0x00E0 /* 0xE0 LATIN SMALL LETTER A WITH GRAVE */, + 0x00E1 /* 0xE1 LATIN SMALL LETTER A WITH ACUTE */, + 0x00E2 /* 0xE2 LATIN SMALL LETTER A WITH CIRCUMFLEX */, + CHAR96('C', 0xE3), + 0x00E4 /* 0xE4 LATIN SMALL LETTER A WITH DIAERESIS */, + 0x010B /* 0xE5 LATIN SMALL LETTER C WITH DOT ABOVE */, + 0x0109 /* 0xE6 LATIN SMALL LETTER C WITH CIRCUMFLEX */, + 0x00E7 /* 0xE7 LATIN SMALL LETTER C WITH CEDILLA */, + 0x00E8 /* 0xE8 LATIN SMALL LETTER E WITH GRAVE */, + 0x00E9 /* 0xE9 LATIN SMALL LETTER E WITH ACUTE */, + 0x00EA /* 0xEA LATIN SMALL LETTER E WITH CIRCUMFLEX */, + 0x00EB /* 0xEB LATIN SMALL LETTER E WITH DIAERESIS */, + 0x00EC /* 0xEC LATIN SMALL LETTER I WITH GRAVE */, + 0x00ED /* 0xED LATIN SMALL LETTER I WITH ACUTE */, + 0x00EE /* 0xEE LATIN SMALL LETTER I WITH CIRCUMFLEX */, + 0x00EF /* 0xEF LATIN SMALL LETTER I WITH DIAERESIS */, + CHAR96('C', 0xF0), + 0x00F1 /* 0xF1 LATIN SMALL LETTER N WITH TILDE */, + 0x00F2 /* 0xF2 LATIN SMALL LETTER O WITH GRAVE */, + 0x00F3 /* 0xF3 LATIN SMALL LETTER O WITH ACUTE */, + 0x00F4 /* 0xF4 LATIN SMALL LETTER O WITH CIRCUMFLEX */, + 0x0121 /* 0xF5 LATIN SMALL LETTER G WITH DOT ABOVE */, + 0x00F6 /* 0xF6 LATIN SMALL LETTER O WITH DIAERESIS */, + 0x00F7 /* 0xF7 DIVISION SIGN */, + 0x011D /* 0xF8 LATIN SMALL LETTER G WITH CIRCUMFLEX */, + 0x00F9 /* 0xF9 LATIN SMALL LETTER U WITH GRAVE */, + 0x00FA /* 0xFA LATIN SMALL LETTER U WITH ACUTE */, + 0x00FB /* 0xFB LATIN SMALL LETTER U WITH CIRCUMFLEX */, + 0x00FC /* 0xFC LATIN SMALL LETTER U WITH DIAERESIS */, + 0x016D /* 0xFD LATIN SMALL LETTER U WITH BREVE */, + 0x015D /* 0xFE LATIN SMALL LETTER S WITH CIRCUMFLEX */, + 0x02D9 /* 0xFF DOT ABOVE */ +}; + +Emchar latin_iso8859_4_to_ucs[96] = +{ + 0x00A0 /* 0xA0 NO-BREAK SPACE */, + 0x0104 /* 0xA1 LATIN CAPITAL LETTER A WITH OGONEK */, + 0x0138 /* 0xA2 LATIN SMALL LETTER KRA */, + 0x0156 /* 0xA3 LATIN CAPITAL LETTER R WITH CEDILLA */, + 0x00A4 /* 0xA4 CURRENCY SIGN */, + 0x0128 /* 0xA5 LATIN CAPITAL LETTER I WITH TILDE */, + 0x013B /* 0xA6 LATIN CAPITAL LETTER L WITH CEDILLA */, + 0x00A7 /* 0xA7 SECTION SIGN */, + 0x00A8 /* 0xA8 DIAERESIS */, + 0x0160 /* 0xA9 LATIN CAPITAL LETTER S WITH CARON */, + 0x0112 /* 0xAA LATIN CAPITAL LETTER E WITH MACRON */, + 0x0122 /* 0xAB LATIN CAPITAL LETTER G WITH CEDILLA */, + 0x0166 /* 0xAC LATIN CAPITAL LETTER T WITH STROKE */, + 0x00AD /* 0xAD SOFT HYPHEN */, + 0x017D /* 0xAE LATIN CAPITAL LETTER Z WITH CARON */, + 0x00AF /* 0xAF MACRON */, + 0x00B0 /* 0xB0 DEGREE SIGN */, + 0x0105 /* 0xB1 LATIN SMALL LETTER A WITH OGONEK */, + 0x02DB /* 0xB2 OGONEK */, + 0x0157 /* 0xB3 LATIN SMALL LETTER R WITH CEDILLA */, + 0x00B4 /* 0xB4 ACUTE ACCENT */, + 0x0129 /* 0xB5 LATIN SMALL LETTER I WITH TILDE */, + 0x013C /* 0xB6 LATIN SMALL LETTER L WITH CEDILLA */, + 0x02C7 /* 0xB7 CARON */, + 0x00B8 /* 0xB8 CEDILLA */, + 0x0161 /* 0xB9 LATIN SMALL LETTER S WITH CARON */, + 0x0113 /* 0xBA LATIN SMALL LETTER E WITH MACRON */, + 0x0123 /* 0xBB LATIN SMALL LETTER G WITH CEDILLA */, + 0x0167 /* 0xBC LATIN SMALL LETTER T WITH STROKE */, + 0x014A /* 0xBD LATIN CAPITAL LETTER ENG */, + 0x017E /* 0xBE LATIN SMALL LETTER Z WITH CARON */, + 0x014B /* 0xBF LATIN SMALL LETTER ENG */, + 0x0100 /* 0xC0 LATIN CAPITAL LETTER A WITH MACRON */, + 0x00C1 /* 0xC1 LATIN CAPITAL LETTER A WITH ACUTE */, + 0x00C2 /* 0xC2 LATIN CAPITAL LETTER A WITH CIRCUMFLEX */, + 0x00C3 /* 0xC3 LATIN CAPITAL LETTER A WITH TILDE */, + 0x00C4 /* 0xC4 LATIN CAPITAL LETTER A WITH DIAERESIS */, + 0x00C5 /* 0xC5 LATIN CAPITAL LETTER A WITH RING ABOVE */, + 0x00C6 /* 0xC6 LATIN CAPITAL LETTER AE */, + 0x012E /* 0xC7 LATIN CAPITAL LETTER I WITH OGONEK */, + 0x010C /* 0xC8 LATIN CAPITAL LETTER C WITH CARON */, + 0x00C9 /* 0xC9 LATIN CAPITAL LETTER E WITH ACUTE */, + 0x0118 /* 0xCA LATIN CAPITAL LETTER E WITH OGONEK */, + 0x00CB /* 0xCB LATIN CAPITAL LETTER E WITH DIAERESIS */, + 0x0116 /* 0xCC LATIN CAPITAL LETTER E WITH DOT ABOVE */, + 0x00CD /* 0xCD LATIN CAPITAL LETTER I WITH ACUTE */, + 0x00CE /* 0xCE LATIN CAPITAL LETTER I WITH CIRCUMFLEX */, + 0x012A /* 0xCF LATIN CAPITAL LETTER I WITH MACRON */, + 0x0110 /* 0xD0 LATIN CAPITAL LETTER D WITH STROKE */, + 0x0145 /* 0xD1 LATIN CAPITAL LETTER N WITH CEDILLA */, + 0x014C /* 0xD2 LATIN CAPITAL LETTER O WITH MACRON */, + 0x0136 /* 0xD3 LATIN CAPITAL LETTER K WITH CEDILLA */, + 0x00D4 /* 0xD4 LATIN CAPITAL LETTER O WITH CIRCUMFLEX */, + 0x00D5 /* 0xD5 LATIN CAPITAL LETTER O WITH TILDE */, + 0x00D6 /* 0xD6 LATIN CAPITAL LETTER O WITH DIAERESIS */, + 0x00D7 /* 0xD7 MULTIPLICATION SIGN */, + 0x00D8 /* 0xD8 LATIN CAPITAL LETTER O WITH STROKE */, + 0x0172 /* 0xD9 LATIN CAPITAL LETTER U WITH OGONEK */, + 0x00DA /* 0xDA LATIN CAPITAL LETTER U WITH ACUTE */, + 0x00DB /* 0xDB LATIN CAPITAL LETTER U WITH CIRCUMFLEX */, + 0x00DC /* 0xDC LATIN CAPITAL LETTER U WITH DIAERESIS */, + 0x0168 /* 0xDD LATIN CAPITAL LETTER U WITH TILDE */, + 0x016A /* 0xDE LATIN CAPITAL LETTER U WITH MACRON */, + 0x00DF /* 0xDF LATIN SMALL LETTER SHARP S */, + 0x0101 /* 0xE0 LATIN SMALL LETTER A WITH MACRON */, + 0x00E1 /* 0xE1 LATIN SMALL LETTER A WITH ACUTE */, + 0x00E2 /* 0xE2 LATIN SMALL LETTER A WITH CIRCUMFLEX */, + 0x00E3 /* 0xE3 LATIN SMALL LETTER A WITH TILDE */, + 0x00E4 /* 0xE4 LATIN SMALL LETTER A WITH DIAERESIS */, + 0x00E5 /* 0xE5 LATIN SMALL LETTER A WITH RING ABOVE */, + 0x00E6 /* 0xE6 LATIN SMALL LETTER AE */, + 0x012F /* 0xE7 LATIN SMALL LETTER I WITH OGONEK */, + 0x010D /* 0xE8 LATIN SMALL LETTER C WITH CARON */, + 0x00E9 /* 0xE9 LATIN SMALL LETTER E WITH ACUTE */, + 0x0119 /* 0xEA LATIN SMALL LETTER E WITH OGONEK */, + 0x00EB /* 0xEB LATIN SMALL LETTER E WITH DIAERESIS */, + 0x0117 /* 0xEC LATIN SMALL LETTER E WITH DOT ABOVE */, + 0x00ED /* 0xED LATIN SMALL LETTER I WITH ACUTE */, + 0x00EE /* 0xEE LATIN SMALL LETTER I WITH CIRCUMFLEX */, + 0x012B /* 0xEF LATIN SMALL LETTER I WITH MACRON */, + 0x0111 /* 0xF0 LATIN SMALL LETTER D WITH STROKE */, + 0x0146 /* 0xF1 LATIN SMALL LETTER N WITH CEDILLA */, + 0x014D /* 0xF2 LATIN SMALL LETTER O WITH MACRON */, + 0x0137 /* 0xF3 LATIN SMALL LETTER K WITH CEDILLA */, + 0x00F4 /* 0xF4 LATIN SMALL LETTER O WITH CIRCUMFLEX */, + 0x00F5 /* 0xF5 LATIN SMALL LETTER O WITH TILDE */, + 0x00F6 /* 0xF6 LATIN SMALL LETTER O WITH DIAERESIS */, + 0x00F7 /* 0xF7 DIVISION SIGN */, + 0x00F8 /* 0xF8 LATIN SMALL LETTER O WITH STROKE */, + 0x0173 /* 0xF9 LATIN SMALL LETTER U WITH OGONEK */, + 0x00FA /* 0xFA LATIN SMALL LETTER U WITH ACUTE */, + 0x00FB /* 0xFB LATIN SMALL LETTER U WITH CIRCUMFLEX */, + 0x00FC /* 0xFC LATIN SMALL LETTER U WITH DIAERESIS */, + 0x0169 /* 0xFD LATIN SMALL LETTER U WITH TILDE */, + 0x016B /* 0xFE LATIN SMALL LETTER U WITH MACRON */, + 0x02D9 /* 0xFF DOT ABOVE */ +}; + +Emchar latin_iso8859_9_to_ucs[96] = +{ + 0x00A0 /* 0xA0 NO-BREAK SPACE */, + 0x00A1 /* 0xA1 INVERTED EXCLAMATION MARK */, + 0x00A2 /* 0xA2 CENT SIGN */, + 0x00A3 /* 0xA3 POUND SIGN */, + 0x00A4 /* 0xA4 CURRENCY SIGN */, + 0x00A5 /* 0xA5 YEN SIGN */, + 0x00A6 /* 0xA6 BROKEN BAR */, + 0x00A7 /* 0xA7 SECTION SIGN */, + 0x00A8 /* 0xA8 DIAERESIS */, + 0x00A9 /* 0xA9 COPYRIGHT SIGN */, + 0x00AA /* 0xAA FEMININE ORDINAL INDICATOR */, + 0x00AB /* 0xAB LEFT-POINTING DOUBLE ANGLE QUOTATION MARK */, + 0x00AC /* 0xAC NOT SIGN */, + 0x00AD /* 0xAD SOFT HYPHEN */, + 0x00AE /* 0xAE REGISTERED SIGN */, + 0x00AF /* 0xAF MACRON */, + 0x00B0 /* 0xB0 DEGREE SIGN */, + 0x00B1 /* 0xB1 PLUS-MINUS SIGN */, + 0x00B2 /* 0xB2 SUPERSCRIPT TWO */, + 0x00B3 /* 0xB3 SUPERSCRIPT THREE */, + 0x00B4 /* 0xB4 ACUTE ACCENT */, + 0x00B5 /* 0xB5 MICRO SIGN */, + 0x00B6 /* 0xB6 PILCROW SIGN */, + 0x00B7 /* 0xB7 MIDDLE DOT */, + 0x00B8 /* 0xB8 CEDILLA */, + 0x00B9 /* 0xB9 SUPERSCRIPT ONE */, + 0x00BA /* 0xBA MASCULINE ORDINAL INDICATOR */, + 0x00BB /* 0xBB RIGHT-POINTING DOUBLE ANGLE QUOTATION MARK */, + 0x00BC /* 0xBC VULGAR FRACTION ONE QUARTER */, + 0x00BD /* 0xBD VULGAR FRACTION ONE HALF */, + 0x00BE /* 0xBE VULGAR FRACTION THREE QUARTERS */, + 0x00BF /* 0xBF INVERTED QUESTION MARK */, + 0x00C0 /* 0xC0 LATIN CAPITAL LETTER A WITH GRAVE */, + 0x00C1 /* 0xC1 LATIN CAPITAL LETTER A WITH ACUTE */, + 0x00C2 /* 0xC2 LATIN CAPITAL LETTER A WITH CIRCUMFLEX */, + 0x00C3 /* 0xC3 LATIN CAPITAL LETTER A WITH TILDE */, + 0x00C4 /* 0xC4 LATIN CAPITAL LETTER A WITH DIAERESIS */, + 0x00C5 /* 0xC5 LATIN CAPITAL LETTER A WITH RING ABOVE */, + 0x00C6 /* 0xC6 LATIN CAPITAL LETTER AE */, + 0x00C7 /* 0xC7 LATIN CAPITAL LETTER C WITH CEDILLA */, + 0x00C8 /* 0xC8 LATIN CAPITAL LETTER E WITH GRAVE */, + 0x00C9 /* 0xC9 LATIN CAPITAL LETTER E WITH ACUTE */, + 0x00CA /* 0xCA LATIN CAPITAL LETTER E WITH CIRCUMFLEX */, + 0x00CB /* 0xCB LATIN CAPITAL LETTER E WITH DIAERESIS */, + 0x00CC /* 0xCC LATIN CAPITAL LETTER I WITH GRAVE */, + 0x00CD /* 0xCD LATIN CAPITAL LETTER I WITH ACUTE */, + 0x00CE /* 0xCE LATIN CAPITAL LETTER I WITH CIRCUMFLEX */, + 0x00CF /* 0xCF LATIN CAPITAL LETTER I WITH DIAERESIS */, + 0x011E /* 0xD0 LATIN CAPITAL LETTER G WITH BREVE */, + 0x00D1 /* 0xD1 LATIN CAPITAL LETTER N WITH TILDE */, + 0x00D2 /* 0xD2 LATIN CAPITAL LETTER O WITH GRAVE */, + 0x00D3 /* 0xD3 LATIN CAPITAL LETTER O WITH ACUTE */, + 0x00D4 /* 0xD4 LATIN CAPITAL LETTER O WITH CIRCUMFLEX */, + 0x00D5 /* 0xD5 LATIN CAPITAL LETTER O WITH TILDE */, + 0x00D6 /* 0xD6 LATIN CAPITAL LETTER O WITH DIAERESIS */, + 0x00D7 /* 0xD7 MULTIPLICATION SIGN */, + 0x00D8 /* 0xD8 LATIN CAPITAL LETTER O WITH STROKE */, + 0x00D9 /* 0xD9 LATIN CAPITAL LETTER U WITH GRAVE */, + 0x00DA /* 0xDA LATIN CAPITAL LETTER U WITH ACUTE */, + 0x00DB /* 0xDB LATIN CAPITAL LETTER U WITH CIRCUMFLEX */, + 0x00DC /* 0xDC LATIN CAPITAL LETTER U WITH DIAERESIS */, + 0x0130 /* 0xDD LATIN CAPITAL LETTER I WITH DOT ABOVE */, + 0x015E /* 0xDE LATIN CAPITAL LETTER S WITH CEDILLA */, + 0x00DF /* 0xDF LATIN SMALL LETTER SHARP S */, + 0x00E0 /* 0xE0 LATIN SMALL LETTER A WITH GRAVE */, + 0x00E1 /* 0xE1 LATIN SMALL LETTER A WITH ACUTE */, + 0x00E2 /* 0xE2 LATIN SMALL LETTER A WITH CIRCUMFLEX */, + 0x00E3 /* 0xE3 LATIN SMALL LETTER A WITH TILDE */, + 0x00E4 /* 0xE4 LATIN SMALL LETTER A WITH DIAERESIS */, + 0x00E5 /* 0xE5 LATIN SMALL LETTER A WITH RING ABOVE */, + 0x00E6 /* 0xE6 LATIN SMALL LETTER AE */, + 0x00E7 /* 0xE7 LATIN SMALL LETTER C WITH CEDILLA */, + 0x00E8 /* 0xE8 LATIN SMALL LETTER E WITH GRAVE */, + 0x00E9 /* 0xE9 LATIN SMALL LETTER E WITH ACUTE */, + 0x00EA /* 0xEA LATIN SMALL LETTER E WITH CIRCUMFLEX */, + 0x00EB /* 0xEB LATIN SMALL LETTER E WITH DIAERESIS */, + 0x00EC /* 0xEC LATIN SMALL LETTER I WITH GRAVE */, + 0x00ED /* 0xED LATIN SMALL LETTER I WITH ACUTE */, + 0x00EE /* 0xEE LATIN SMALL LETTER I WITH CIRCUMFLEX */, + 0x00EF /* 0xEF LATIN SMALL LETTER I WITH DIAERESIS */, + 0x011F /* 0xF0 LATIN SMALL LETTER G WITH BREVE */, + 0x00F1 /* 0xF1 LATIN SMALL LETTER N WITH TILDE */, + 0x00F2 /* 0xF2 LATIN SMALL LETTER O WITH GRAVE */, + 0x00F3 /* 0xF3 LATIN SMALL LETTER O WITH ACUTE */, + 0x00F4 /* 0xF4 LATIN SMALL LETTER O WITH CIRCUMFLEX */, + 0x00F5 /* 0xF5 LATIN SMALL LETTER O WITH TILDE */, + 0x00F6 /* 0xF6 LATIN SMALL LETTER O WITH DIAERESIS */, + 0x00F7 /* 0xF7 DIVISION SIGN */, + 0x00F8 /* 0xF8 LATIN SMALL LETTER O WITH STROKE */, + 0x00F9 /* 0xF9 LATIN SMALL LETTER U WITH GRAVE */, + 0x00FA /* 0xFA LATIN SMALL LETTER U WITH ACUTE */, + 0x00FB /* 0xFB LATIN SMALL LETTER U WITH CIRCUMFLEX */, + 0x00FC /* 0xFC LATIN SMALL LETTER U WITH DIAERESIS */, + 0x0131 /* 0xFD LATIN SMALL LETTER DOTLESS I */, + 0x015F /* 0xFE LATIN SMALL LETTER S WITH CEDILLA */, + 0x00FF /* 0xFF LATIN SMALL LETTER Y WITH DIAERESIS */, +}; + +Emchar latin_viscii_lower_to_ucs[96] = +{ + CHAR96('1', 0x20), + 0x1eaf /* 0x21 */, + 0x1eb1 /* 0x22 */, + 0x1eb7 /* 0x23 */, + 0x1ea5 /* 0x24 */, + 0x1ea7 /* 0x25 */, + 0x1ea9 /* 0x26 */, + 0x1ead /* 0x27 */, + 0x1ebd /* 0x28 */, + 0x1eb9 /* 0x29 */, + 0x1ebf /* 0x2a */, + 0x1ec1 /* 0x2b */, + 0x1ec3 /* 0x2c */, + 0x1ec5 /* 0x2d */, + 0x1ec7 /* 0x2e */, + 0x1ed1 /* 0x2f */, + 0x1ed3 /* 0x30 */, + 0x1ed5 /* 0x31 */, + 0x1ed7 /* 0x32 */, + CHAR96('1', 0x33), + CHAR96('1', 0x34), + 0x1ed9 /* 0x35 */, + 0x1edd /* 0x36 */, + 0x1edf /* 0x37 */, + 0x1ecb /* 0x38 */, + CHAR96('1', 0x39), + CHAR96('1', 0x3A), + CHAR96('1', 0x3B), + CHAR96('1', 0x3C), + 0x01a1 /* 0x3d */, + 0x1edb /* 0x3e */, + CHAR96('1', 0x3F), + CHAR96('1', 0x40), + CHAR96('1', 0x41), + CHAR96('1', 0x42), + CHAR96('1', 0x43), + CHAR96('1', 0x44), + CHAR96('1', 0x45), + 0x1eb3 /* 0x46 */, + 0x1eb5 /* 0x47 */, + CHAR96('1', 0x48), + CHAR96('1', 0x49), + CHAR96('1', 0x4A), + CHAR96('1', 0x4B), + CHAR96('1', 0x4C), + CHAR96('1', 0x4D), + CHAR96('1', 0x4E), + 0x1ef3 /* 0x4f */, + CHAR96('1', 0x50), + 0x1ee9 /* 0x51 */, + CHAR96('1', 0x52), + CHAR96('1', 0x53), + CHAR96('1', 0x54), + 0x1ea1 /* 0x55 */, + 0x1ef7 /* 0x56 */, + 0x1eeb /* 0x57 */, + 0x1eed /* 0x58 */, + CHAR96('1', 0x59), + CHAR96('1', 0x5A), + 0x1ef9 /* 0x5b */, + 0x1ef5 /* 0x5c */, + CHAR96('1', 0x5D), + 0x1ee1 /* 0x5e */, + 0x01b0 /* 0x5f */, + 0x00e0 /* 0x60 */, + 0x00e1 /* 0x61 */, + 0x00e2 /* 0x62 */, + 0x00e3 /* 0x63 */, + 0x1ea3 /* 0x64 */, + 0x0103 /* 0x65 */, + 0x1eef /* 0x66 */, + 0x1eab /* 0x67 */, + 0x00e8 /* 0x68 */, + 0x00e9 /* 0x69 */, + 0x00ea /* 0x6a */, + 0x1ebb /* 0x6b */, + 0x00ec /* 0x6c */, + 0x00ed /* 0x6d */, + 0x0129 /* 0x6e */, + 0x1ec9 /* 0x6f */, + 0x0111 /* 0x70 */, + 0x1ef1 /* 0x71 */, + 0x00f2 /* 0x72 */, + 0x00f3 /* 0x73 */, + 0x00f4 /* 0x74 */, + 0x00f5 /* 0x75 */, + 0x1ecf /* 0x76 */, + 0x1ecd /* 0x77 */, + 0x1ee5 /* 0x78 */, + 0x00f9 /* 0x79 */, + 0x00fa /* 0x7a */, + 0x0169 /* 0x7b */, + 0x1ee7 /* 0x7c */, + 0x00fd /* 0x7d */, + 0x1ee3 /* 0x7e */, + CHAR96('1', 0x7F) +}; + +Emchar latin_viscii_upper_to_ucs[96] = +{ + CHAR96('2', 0x20), + 0x1eae /* 0x21 */, + 0x1eb0 /* 0x22 */, + 0x1eb6 /* 0x23 */, + 0x1ea4 /* 0x24 */, + 0x1ea6 /* 0x25 */, + 0x1ea8 /* 0x26 */, + 0x1eac /* 0x27 */, + 0x1ebc /* 0x28 */, + 0x1eb8 /* 0x29 */, + 0x1ebe /* 0x2a */, + 0x1ec0 /* 0x2b */, + 0x1ec2 /* 0x2c */, + 0x1ec4 /* 0x2d */, + 0x1ec6 /* 0x2e */, + 0x1ed0 /* 0x2f */, + 0x1ed2 /* 0x30 */, + 0x1ed4 /* 0x31 */, + 0x1ed6 /* 0x32 */, + CHAR96('2', 0x33), + CHAR96('2', 0x34), + 0x1ed8 /* 0x35 */, + 0x1edc /* 0x36 */, + 0x1ede /* 0x37 */, + 0x1eca /* 0x38 */, + CHAR96('2', 0x39), + CHAR96('2', 0x3a), + CHAR96('2', 0x3b), + CHAR96('2', 0x3c), + 0x01a0 /* 0x3d */, + 0x1eda /* 0x3e */, + CHAR96('2', 0x3f), + CHAR96('2', 0x40), + CHAR96('2', 0x41), + CHAR96('2', 0x42), + CHAR96('2', 0x43), + CHAR96('2', 0x44), + CHAR96('2', 0x45), + 0x1eb2 /* 0x46 */, + 0x1eb4 /* 0x47 */, + CHAR96('2', 0x48), + CHAR96('2', 0x49), + CHAR96('2', 0x4a), + CHAR96('2', 0x4b), + CHAR96('2', 0x4c), + CHAR96('2', 0x4d), + CHAR96('2', 0x4e), + 0x1ef2 /* 0x4f */, + CHAR96('2', 0x50), + 0x1ee8 /* 0x51 */, + CHAR96('2', 0x52), + CHAR96('2', 0x53), + CHAR96('2', 0x54), + 0x1ea0 /* 0x55 */, + 0x1ef6 /* 0x56 */, + 0x1eea /* 0x57 */, + 0x1eec /* 0x58 */, + CHAR96('2', 0x59), + CHAR96('2', 0x5a), + 0x1ef8 /* 0x5b */, + 0x1ef4 /* 0x5c */, + CHAR96('2', 0x5d), + 0x1ee0 /* 0x5e */, + 0x01af /* 0x5f */, + 0x00c0 /* 0x60 */, + 0x00c1 /* 0x61 */, + 0x00c2 /* 0x62 */, + 0x00c3 /* 0x63 */, + 0x1ea2 /* 0x64 */, + 0x0102 /* 0x65 */, + 0x1eee /* 0x66 */, + 0x1eaa /* 0x67 */, + 0x00c8 /* 0x68 */, + 0x00c9 /* 0x69 */, + 0x00ca /* 0x6a */, + 0x1eba /* 0x6b */, + 0x00cc /* 0x6c */, + 0x00cd /* 0x6d */, + 0x0128 /* 0x6e */, + 0x1ec8 /* 0x6f */, + 0x0110 /* 0x70 */, + 0x1ef0 /* 0x71 */, + 0x00d2 /* 0x72 */, + 0x00d3 /* 0x73 */, + 0x00d4 /* 0x74 */, + 0x00d5 /* 0x75 */, + 0x1ece /* 0x76 */, + 0x1ecc /* 0x77 */, + 0x1ee4 /* 0x78 */, + 0x00d9 /* 0x79 */, + 0x00da /* 0x7a */, + 0x0168 /* 0x7b */, + 0x1ee6 /* 0x7c */, + 0x00dd /* 0x7d */, + 0x1ee2 /* 0x7e */, + CHAR96('2', 0x7f) +}; + + +Emchar latin_tcvn5712_to_ucs[96] = +{ + 0x00A0 /* 0xA0 NO-BREAK SPACE */, + 0x0102 /* 0xA1 LATIN CAPITAL LETTER A WITH BREVE */, + 0x00C2 /* 0xA2 LATIN CAPITAL LETTER A WITH CIRCUMFLEX */, + 0x00CA /* 0xA3 LATIN CAPITAL LETTER E WITH CIRCUMFLEX */, + 0x00D4 /* 0xA4 LATIN CAPITAL LETTER O WITH CIRCUMFLEX */, + 0x01A0 /* 0xA5 LATIN CAPITAL LETTER O WITH HORN */, + 0x01AF /* 0xA6 LATIN CAPITAL LETTER U WITH HORN */, + 0x0110 /* 0xA7 LATIN CAPITAL LETTER D WITH STROKE */, + 0x0103 /* 0xA8 LATIN SMALL LETTER A WITH BREVE */, + 0x00E2 /* 0xA9 LATIN SMALL LETTER A WITH CIRCUMFLEX */, + 0x00EA /* 0xAA LATIN SMALL LETTER E WITH CIRCUMFLEX */, + 0x00F4 /* 0xAB LATIN SMALL LETTER O WITH CIRCUMFLEX */, + 0x01A1 /* 0xAC LATIN SMALL LETTER O WITH HORN */, + 0x01B0 /* 0xAD LATIN SMALL LETTER U WITH HORN */, + 0x0111 /* 0xAE LATIN SMALL LETTER D WITH STROKE */, + 0x1EB0 /* 0xAF LATIN CAPITAL LETTER A WITH BREVE AND GRAVE */, + 0x0300 /* 0xB0 COMBINING GRAVE ACCENT */, + 0x0309 /* 0xB1 COMBINING HOOK ABOVE */, + 0x0303 /* 0xB2 COMBINING TILDE */, + 0x0301 /* 0xB3 COMBINING ACUTE ACCENT */, + 0x0323 /* 0xB4 COMBINING DOT BELOW */, + 0x00E0 /* 0xB5 LATIN SMALL LETTER A WITH GRAVE */, + 0x1EA3 /* 0xB6 LATIN SMALL LETTER A WITH HOOK ABOVE */, + 0x00E3 /* 0xB7 LATIN SMALL LETTER A WITH TILDE */, + 0x00E1 /* 0xB8 LATIN SMALL LETTER A WITH ACUTE */, + 0x1EA1 /* 0xB9 LATIN SMALL LETTER A WITH DOT BELOW */, + 0x1EB2 /* 0xBA LATIN CAPITAL LETTER A WITH BREVE AND HOOK ABOVE */, + 0x1EB1 /* 0xBB LATIN SMALL LETTER A WITH BREVE AND GRAVE */, + 0x1EB3 /* 0xBC LATIN SMALL LETTER A WITH BREVE AND HOOK ABOVE */, + 0x1EB5 /* 0xBD LATIN SMALL LETTER A WITH BREVE AND TILDE */, + 0x1EAF /* 0xBE LATIN SMALL LETTER A WITH BREVE AND ACUTE */, + 0x1EB4 /* 0xBF LATIN CAPITAL LETTER A WITH BREVE AND TILDE */, + 0x1EAE /* 0xC0 LATIN CAPITAL LETTER A WITH BREVE AND ACUTE */, + 0x1EA6 /* 0xC1 LATIN CAPITAL LETTER A WITH CIRCUMFLEX AND GRAVE */, + 0x1EA8 /* 0xC2 LATIN CAPITAL LETTER A WITH CIRCUMFLEX AND HOOK ABOVE */, + 0x1EAA /* 0xC3 LATIN CAPITAL LETTER A WITH CIRCUMFLEX AND TILDE */, + 0x1EA4 /* 0xC4 LATIN CAPITAL LETTER A WITH CIRCUMFLEX AND ACUTE */, + 0x1EC0 /* 0xC5 LATIN CAPITAL LETTER E WITH CIRCUMFLEX AND GRAVE */, + 0x1EB7 /* 0xC6 LATIN SMALL LETTER A WITH BREVE AND DOT BELOW */, + 0x1EA7 /* 0xC7 LATIN SMALL LETTER A WITH CIRCUMFLEX AND GRAVE */, + 0x1EA9 /* 0xC8 LATIN SMALL LETTER A WITH CIRCUMFLEX AND HOOK ABOVE */, + 0x1EAB /* 0xC9 LATIN SMALL LETTER A WITH CIRCUMFLEX AND TILDE */, + 0x1EA5 /* 0xCA LATIN SMALL LETTER A WITH CIRCUMFLEX AND ACUTE */, + 0x1EAD /* 0xCB LATIN SMALL LETTER A WITH CIRCUMFLEX AND DOT BELOW */, + 0x00E8 /* 0xCC LATIN SMALL LETTER E WITH GRAVE */, + 0x1EC2 /* 0xCD LATIN CAPITAL LETTER E WITH CIRCUMFLEX AND HOOK ABOVE */, + 0x1EBB /* 0xCE LATIN SMALL LETTER E WITH HOOK ABOVE */, + 0x1EBD /* 0xCF LATIN SMALL LETTER E WITH TILDE */, + 0x00E9 /* 0xD0 LATIN SMALL LETTER E WITH ACUTE */, + 0x1EB9 /* 0xD1 LATIN SMALL LETTER E WITH DOT BELOW */, + 0x1EC1 /* 0xD2 LATIN SMALL LETTER E WITH CIRCUMFLEX AND GRAVE */, + 0x1EC3 /* 0xD3 LATIN SMALL LETTER E WITH CIRCUMFLEX AND HOOK ABOVE */, + 0x1EC5 /* 0xD4 LATIN SMALL LETTER E WITH CIRCUMFLEX AND TILDE */, + 0x1EBF /* 0xD5 LATIN SMALL LETTER E WITH CIRCUMFLEX AND ACUTE */, + 0x1EC7 /* 0xD6 LATIN SMALL LETTER E WITH CIRCUMFLEX AND DOT BELOW */, + 0x00EC /* 0xD7 LATIN SMALL LETTER I WITH GRAVE */, + 0x1EC9 /* 0xD8 LATIN SMALL LETTER I WITH HOOK ABOVE */, + 0x1EC4 /* 0xD9 LATIN CAPITAL LETTER E WITH CIRCUMFLEX AND TILDE */, + 0x1EBE /* 0xDA LATIN CAPITAL LETTER E WITH CIRCUMFLEX AND ACUTE */, + 0x1ED2 /* 0xDB LATIN CAPITAL LETTER O WITH CIRCUMFLEX AND GRAVE */, + 0x0129 /* 0xDC LATIN SMALL LETTER I WITH TILDE */, + 0x00ED /* 0xDD LATIN SMALL LETTER I WITH ACUTE */, + 0x1ECB /* 0xDE LATIN SMALL LETTER I WITH DOT BELOW */, + 0x00F2 /* 0xDF LATIN SMALL LETTER O WITH GRAVE */, + 0x1ED4 /* 0xE0 LATIN CAPITAL LETTER O WITH CIRCUMFLEX AND HOOK ABOVE */, + 0x1ECF /* 0xE1 LATIN SMALL LETTER O WITH HOOK ABOVE */, + 0x00F5 /* 0xE2 LATIN SMALL LETTER O WITH TILDE */, + 0x00F3 /* 0xE3 LATIN SMALL LETTER O WITH ACUTE */, + 0x1ECD /* 0xE4 LATIN SMALL LETTER O WITH DOT BELOW */, + 0x1ED3 /* 0xE5 LATIN SMALL LETTER O WITH CIRCUMFLEX AND GRAVE */, + 0x1ED5 /* 0xE6 LATIN SMALL LETTER O WITH CIRCUMFLEX AND HOOK ABOVE */, + 0x1ED7 /* 0xE7 LATIN SMALL LETTER O WITH CIRCUMFLEX AND TILDE */, + 0x1ED1 /* 0xE8 LATIN SMALL LETTER O WITH CIRCUMFLEX AND ACUTE */, + 0x1ED9 /* 0xE9 LATIN SMALL LETTER O WITH CIRCUMFLEX AND DOT BELOW */, + 0x1EDD /* 0xEA LATIN SMALL LETTER O WITH HORN AND GRAVE */, + 0x1EDF /* 0xEB LATIN SMALL LETTER O WITH HORN AND HOOK ABOVE */, + 0x1EE1 /* 0xEC LATIN SMALL LETTER O WITH HORN AND TILDE */, + 0x1EDB /* 0xED LATIN SMALL LETTER O WITH HORN AND ACUTE */, + 0x1EE3 /* 0xEE LATIN SMALL LETTER O WITH HORN AND DOT BELOW */, + 0x00F9 /* 0xEF LATIN SMALL LETTER U WITH GRAVE */, + 0x1ED6 /* 0xF0 LATIN CAPITAL LETTER O WITH CIRCUMFLEX AND TILDE */, + 0x1EE7 /* 0xF1 LATIN SMALL LETTER U WITH HOOK ABOVE */, + 0x0169 /* 0xF2 LATIN SMALL LETTER U WITH TILDE */, + 0x00FA /* 0xF3 LATIN SMALL LETTER U WITH ACUTE */, + 0x1EE5 /* 0xF4 LATIN SMALL LETTER U WITH DOT BELOW */, + 0x1EEB /* 0xF5 LATIN SMALL LETTER U WITH HORN AND GRAVE */, + 0x1EED /* 0xF6 LATIN SMALL LETTER U WITH HORN AND HOOK ABOVE */, + 0x1EEF /* 0xF7 LATIN SMALL LETTER U WITH HORN AND TILDE */, + 0x1EE9 /* 0xF8 LATIN SMALL LETTER U WITH HORN AND ACUTE */, + 0x1EF1 /* 0xF9 LATIN SMALL LETTER U WITH HORN AND DOT BELOW */, + 0x1EF3 /* 0xFA LATIN SMALL LETTER Y WITH GRAVE */, + 0x1EF7 /* 0xFB LATIN SMALL LETTER Y WITH HOOK ABOVE */, + 0x1EF9 /* 0xFC LATIN SMALL LETTER Y WITH TILDE */, + 0x00FD /* 0xFD LATIN SMALL LETTER Y WITH ACUTE */, + 0x1EF5 /* 0xFE LATIN SMALL LETTER Y WITH DOT BELOW */, + 0x1ED0 /* 0xFF LATIN CAPITAL LETTER O WITH CIRCUMFLEX AND ACUTE */ +}; + Charset_ID latin_a_char_to_charset[128] = { /* U+0100 */ LEADING_BYTE_LATIN_ISO8859_4, /* U+0101 */ LEADING_BYTE_LATIN_ISO8859_4, @@ -570,6 +1388,8 @@ Lisp_Object Qascii, Qchinese_cns11643_6, Qchinese_cns11643_7, Qucs_bmp, + Qlatin_viscii_lower, + Qlatin_viscii_upper, #endif Qchinese_big5_1, Qchinese_big5_2, @@ -1659,6 +2479,9 @@ character s with caron. if (EQ (charset, Vcharset_ascii)) lowlim = 0, highlim = 127; else if (EQ (charset, Vcharset_control_1)) lowlim = 0, highlim = 31; +#ifdef UTF2000 + else if (CHARSET_CHARS (cs) == 256) lowlim = 0, highlim = 255; +#endif else if (CHARSET_CHARS (cs) == 94) lowlim = 33, highlim = 126; else /* CHARSET_CHARS (cs) == 96) */ lowlim = 32, highlim = 127; @@ -1667,7 +2490,13 @@ character s with caron. the 8th bit off ARG1 and ARG2 because it allows programmers to write (make-char 'latin-iso8859-2 CODE) where code is the actual Latin 2 code of the character. */ - a1 = XINT (arg1) & 0x7f; +#ifdef UTF2000 + a1 = XINT (arg1); + if (highlim < 128) + a1 &= 0x7f; +#else + a1 = XINT (arg1); +#endif if (a1 < lowlim || a1 > highlim) args_out_of_range_3 (arg1, make_int (lowlim), make_int (highlim)); @@ -1680,7 +2509,13 @@ character s with caron. } CHECK_INT (arg2); +#ifdef UTF2000 + a2 = XINT (arg2); + if (highlim < 128) + a2 &= 0x7f; +#else a2 = XINT (arg2) & 0x7f; +#endif if (a2 < lowlim || a2 > highlim) args_out_of_range_3 (arg2, make_int (lowlim), make_int (highlim)); @@ -1901,6 +2736,8 @@ syms_of_mule_charset (void) defsymbol (&Qchinese_cns11643_6, "chinese-cns11643-6"); defsymbol (&Qchinese_cns11643_7, "chinese-cns11643-7"); defsymbol (&Qucs_bmp, "ucs-bmp"); + defsymbol (&Qlatin_viscii_lower, "vietnamese-viscii-lower"); + defsymbol (&Qlatin_viscii_upper, "vietnamese-viscii-upper"); #endif defsymbol (&Qchinese_big5_1, "chinese-big5-1"); defsymbol (&Qchinese_big5_2, "chinese-big5-2"); @@ -2225,6 +3062,22 @@ complex_vars_of_mule_charset (void) build_string ("CNS 11643 Plane 7 Chinese traditional"), build_string (CHINESE_CNS_PLANE_RE("7"))); + Vcharset_latin_viscii_lower = + make_charset (LEADING_BYTE_LATIN_VISCII_LOWER, Qlatin_viscii_lower, 2, + CHARSET_TYPE_96, 1, 1, '1', + CHARSET_LEFT_TO_RIGHT, + build_string ("VISCII lower"), + build_string ("VISCII lower (Vietnamese)"), + build_string ("VISCII lower (Vietnamese)"), + build_string ("VISCII1.1")); + Vcharset_latin_viscii_upper = + make_charset (LEADING_BYTE_LATIN_VISCII_UPPER, Qlatin_viscii_upper, 2, + CHARSET_TYPE_96, 1, 1, '2', + CHARSET_LEFT_TO_RIGHT, + build_string ("VISCII upper"), + build_string ("VISCII upper (Vietnamese)"), + build_string ("VISCII upper (Vietnamese)"), + build_string ("VISCII1.1")); #endif staticpro (&Vcharset_chinese_big5_1); Vcharset_chinese_big5_1 = @@ -2247,7 +3100,6 @@ complex_vars_of_mule_charset (void) ("Big5 Level-2 Chinese traditional"), build_string ("big5")); - #ifdef ENABLE_COMPOSITE_CHARS /* #### For simplicity, we put composite chars into a 96x96 charset. This is going to lead to problems because you can run out of diff --git a/src/text-coding.c b/src/text-coding.c new file mode 100644 index 0000000..8b20b52 --- /dev/null +++ b/src/text-coding.c @@ -0,0 +1,5985 @@ +/* Code conversion functions. + Copyright (C) 1991, 1995 Free Software Foundation, Inc. + Copyright (C) 1995 Sun Microsystems, Inc. + +This file is part of XEmacs. + +XEmacs is free software; you can redistribute it and/or modify it +under the terms of the GNU General Public License as published by the +Free Software Foundation; either version 2, or (at your option) any +later version. + +XEmacs 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 General Public License +for more details. + +You should have received a copy of the GNU General Public License +along with XEmacs; see the file COPYING. If not, write to +the Free Software Foundation, Inc., 59 Temple Place - Suite 330, +Boston, MA 02111-1307, USA. */ + +/* Synched up with: Mule 2.3. Not in FSF. */ + +/* Rewritten by Ben Wing . */ + +#include +#include "lisp.h" + +#include "buffer.h" +#include "elhash.h" +#include "insdel.h" +#include "lstream.h" +#include "opaque.h" +#ifdef MULE +#include "mule-ccl.h" +#include "chartab.h" +#endif +#include "file-coding.h" + +Lisp_Object Qcoding_system_error; + +Lisp_Object Vkeyboard_coding_system; +Lisp_Object Vterminal_coding_system; +Lisp_Object Vcoding_system_for_read; +Lisp_Object Vcoding_system_for_write; +Lisp_Object Vfile_name_coding_system; + +/* Table of symbols identifying each coding category. */ +Lisp_Object coding_category_symbol[CODING_CATEGORY_LAST]; + + + +struct file_coding_dump { + /* Coding system currently associated with each coding category. */ + Lisp_Object coding_category_system[CODING_CATEGORY_LAST]; + + /* Table of all coding categories in decreasing order of priority. + This describes a permutation of the possible coding categories. */ + int coding_category_by_priority[CODING_CATEGORY_LAST]; + +#ifdef MULE + Lisp_Object ucs_to_mule_table[65536]; +#endif +} *fcd; + +static const struct lrecord_description fcd_description_1[] = { + { XD_LISP_OBJECT_ARRAY, offsetof (struct file_coding_dump, coding_category_system), CODING_CATEGORY_LAST }, +#if defined(MULE) && !defined(UTF2000) + { XD_LISP_OBJECT_ARRAY, offsetof (struct file_coding_dump, ucs_to_mule_table), countof (fcd->ucs_to_mule_table) }, +#endif + { XD_END } +}; + +static const struct struct_description fcd_description = { + sizeof (struct file_coding_dump), + fcd_description_1 +}; + +#ifdef MULE +Lisp_Object mule_to_ucs_table; +#endif + +Lisp_Object Qcoding_systemp; + +Lisp_Object Qraw_text, Qno_conversion, Qccl, Qiso2022; +/* Qinternal in general.c */ + +Lisp_Object Qmnemonic, Qeol_type; +Lisp_Object Qcr, Qcrlf, Qlf; +Lisp_Object Qeol_cr, Qeol_crlf, Qeol_lf; +Lisp_Object Qpost_read_conversion; +Lisp_Object Qpre_write_conversion; + +#ifdef MULE +Lisp_Object Qucs4, Qutf8; +Lisp_Object Qbig5, Qshift_jis; +Lisp_Object Qcharset_g0, Qcharset_g1, Qcharset_g2, Qcharset_g3; +Lisp_Object Qforce_g0_on_output, Qforce_g1_on_output; +Lisp_Object Qforce_g2_on_output, Qforce_g3_on_output; +Lisp_Object Qno_iso6429; +Lisp_Object Qinput_charset_conversion, Qoutput_charset_conversion; +Lisp_Object Qescape_quoted; +Lisp_Object Qshort, Qno_ascii_eol, Qno_ascii_cntl, Qseven, Qlock_shift; +#endif +Lisp_Object Qencode, Qdecode; + +Lisp_Object Vcoding_system_hash_table; + +int enable_multibyte_characters; + +#ifdef MULE +/* Additional information used by the ISO2022 decoder and detector. */ +struct iso2022_decoder +{ + /* CHARSET holds the character sets currently assigned to the G0 + through G3 variables. It is initialized from the array + INITIAL_CHARSET in CODESYS. */ + Lisp_Object charset[4]; + + /* Which registers are currently invoked into the left (GL) and + right (GR) halves of the 8-bit encoding space? */ + int register_left, register_right; + + /* ISO_ESC holds a value indicating part of an escape sequence + that has already been seen. */ + enum iso_esc_flag esc; + + /* This records the bytes we've seen so far in an escape sequence, + in case the sequence is invalid (we spit out the bytes unchanged). */ + unsigned char esc_bytes[8]; + + /* Index for next byte to store in ISO escape sequence. */ + int esc_bytes_index; + +#ifdef ENABLE_COMPOSITE_CHARS + /* Stuff seen so far when composing a string. */ + unsigned_char_dynarr *composite_chars; +#endif + + /* If we saw an invalid designation sequence for a particular + register, we flag it here and switch to ASCII. The next time we + see a valid designation for this register, we turn off the flag + and do the designation normally, but pretend the sequence was + invalid. The effect of all this is that (most of the time) the + escape sequences for both the switch to the unknown charset, and + the switch back to the known charset, get inserted literally into + the buffer and saved out as such. The hope is that we can + preserve the escape sequences so that the resulting written out + file makes sense. If we don't do any of this, the designation + to the invalid charset will be preserved but that switch back + to the known charset will probably get eaten because it was + the same charset that was already present in the register. */ + unsigned char invalid_designated[4]; + + /* We try to do similar things as above for direction-switching + sequences. If we encountered a direction switch while an + invalid designation was present, or an invalid designation + just after a direction switch (i.e. no valid designation + encountered yet), we insert the direction-switch escape + sequence literally into the output stream, and later on + insert the corresponding direction-restoring escape sequence + literally also. */ + unsigned int switched_dir_and_no_valid_charset_yet :1; + unsigned int invalid_switch_dir :1; + + /* Tells the decoder to output the escape sequence literally + even though it was valid. Used in the games we play to + avoid lossage when we encounter invalid designations. */ + unsigned int output_literally :1; + /* We encountered a direction switch followed by an invalid + designation. We didn't output the direction switch + literally because we didn't know about the invalid designation; + but we have to do so now. */ + unsigned int output_direction_sequence :1; +}; +#endif /* MULE */ +EXFUN (Fcopy_coding_system, 2); +#ifdef MULE +struct detection_state; + +static void +text_encode_generic (Lstream *encoding, const Bufbyte *src, + unsigned_char_dynarr *dst, Lstream_data_count n); + +static int detect_coding_sjis (struct detection_state *st, + const Extbyte *src, Lstream_data_count n); +static void decode_coding_sjis (Lstream *decoding, const Extbyte *src, + unsigned_char_dynarr *dst, Lstream_data_count n); +static void encode_coding_sjis (Lstream *encoding, const Bufbyte *src, + unsigned_char_dynarr *dst, Lstream_data_count n); +static int detect_coding_big5 (struct detection_state *st, + const Extbyte *src, Lstream_data_count n); +static void decode_coding_big5 (Lstream *decoding, const Extbyte *src, + unsigned_char_dynarr *dst, Lstream_data_count n); +static void encode_coding_big5 (Lstream *encoding, const Bufbyte *src, + unsigned_char_dynarr *dst, Lstream_data_count n); +static int detect_coding_ucs4 (struct detection_state *st, + const Extbyte *src, Lstream_data_count n); +static void decode_coding_ucs4 (Lstream *decoding, const Extbyte *src, + unsigned_char_dynarr *dst, Lstream_data_count n); +static void encode_coding_ucs4 (Lstream *encoding, const Bufbyte *src, + unsigned_char_dynarr *dst, Lstream_data_count n); +static int detect_coding_utf8 (struct detection_state *st, + const Extbyte *src, Lstream_data_count n); +static void decode_coding_utf8 (Lstream *decoding, const Extbyte *src, + unsigned_char_dynarr *dst, Lstream_data_count n); +void char_encode_utf8 (struct encoding_stream *str, Emchar c, + unsigned_char_dynarr *dst, unsigned int *flags); +void char_finish_utf8 (struct encoding_stream *str, + unsigned_char_dynarr *dst, unsigned int *flags); + +static int postprocess_iso2022_mask (int mask); +static void reset_iso2022 (Lisp_Object coding_system, + struct iso2022_decoder *iso); +static int detect_coding_iso2022 (struct detection_state *st, + const Extbyte *src, Lstream_data_count n); +static void decode_coding_iso2022 (Lstream *decoding, const Extbyte *src, + unsigned_char_dynarr *dst, Lstream_data_count n); +void char_encode_iso2022 (struct encoding_stream *str, Emchar c, + unsigned_char_dynarr *dst, unsigned int *flags); +void char_finish_iso2022 (struct encoding_stream *str, + unsigned_char_dynarr *dst, unsigned int *flags); +#endif /* MULE */ +static void decode_coding_no_conversion (Lstream *decoding, const Extbyte *src, + unsigned_char_dynarr *dst, Lstream_data_count n); +static void encode_coding_no_conversion (Lstream *encoding, const Bufbyte *src, + unsigned_char_dynarr *dst, Lstream_data_count n); +static void mule_decode (Lstream *decoding, const Extbyte *src, + unsigned_char_dynarr *dst, Lstream_data_count n); +static void mule_encode (Lstream *encoding, const Bufbyte *src, + unsigned_char_dynarr *dst, Lstream_data_count n); + +typedef struct codesys_prop codesys_prop; +struct codesys_prop +{ + Lisp_Object sym; + int prop_type; +}; + +typedef struct +{ + Dynarr_declare (codesys_prop); +} codesys_prop_dynarr; + +static const struct lrecord_description codesys_prop_description_1[] = { + { XD_LISP_OBJECT, offsetof (codesys_prop, sym) }, + { XD_END } +}; + +static const struct struct_description codesys_prop_description = { + sizeof (codesys_prop), + codesys_prop_description_1 +}; + +static const struct lrecord_description codesys_prop_dynarr_description_1[] = { + XD_DYNARR_DESC (codesys_prop_dynarr, &codesys_prop_description), + { XD_END } +}; + +static const struct struct_description codesys_prop_dynarr_description = { + sizeof (codesys_prop_dynarr), + codesys_prop_dynarr_description_1 +}; + +codesys_prop_dynarr *the_codesys_prop_dynarr; + +enum codesys_prop_enum +{ + CODESYS_PROP_ALL_OK, + CODESYS_PROP_ISO2022, + CODESYS_PROP_CCL +}; + + +/************************************************************************/ +/* Coding system functions */ +/************************************************************************/ + +static Lisp_Object mark_coding_system (Lisp_Object); +static void print_coding_system (Lisp_Object, Lisp_Object, int); +static void finalize_coding_system (void *header, int for_disksave); + +#ifdef MULE +static const struct lrecord_description ccs_description_1[] = { + { XD_LISP_OBJECT, offsetof (charset_conversion_spec, from_charset) }, + { XD_LISP_OBJECT, offsetof (charset_conversion_spec, to_charset) }, + { XD_END } +}; + +static const struct struct_description ccs_description = { + sizeof (charset_conversion_spec), + ccs_description_1 +}; + +static const struct lrecord_description ccsd_description_1[] = { + XD_DYNARR_DESC (charset_conversion_spec_dynarr, &ccs_description), + { XD_END } +}; + +static const struct struct_description ccsd_description = { + sizeof (charset_conversion_spec_dynarr), + ccsd_description_1 +}; +#endif + +static const struct lrecord_description coding_system_description[] = { + { XD_LISP_OBJECT, offsetof (Lisp_Coding_System, name) }, + { XD_LISP_OBJECT, offsetof (Lisp_Coding_System, doc_string) }, + { XD_LISP_OBJECT, offsetof (Lisp_Coding_System, mnemonic) }, + { XD_LISP_OBJECT, offsetof (Lisp_Coding_System, post_read_conversion) }, + { XD_LISP_OBJECT, offsetof (Lisp_Coding_System, pre_write_conversion) }, + { XD_LISP_OBJECT, offsetof (Lisp_Coding_System, eol_lf) }, + { XD_LISP_OBJECT, offsetof (Lisp_Coding_System, eol_crlf) }, + { XD_LISP_OBJECT, offsetof (Lisp_Coding_System, eol_cr) }, +#ifdef MULE + { XD_LISP_OBJECT_ARRAY, offsetof (Lisp_Coding_System, iso2022.initial_charset), 4 }, + { XD_STRUCT_PTR, offsetof (Lisp_Coding_System, iso2022.input_conv), 1, &ccsd_description }, + { XD_STRUCT_PTR, offsetof (Lisp_Coding_System, iso2022.output_conv), 1, &ccsd_description }, + { XD_LISP_OBJECT, offsetof (Lisp_Coding_System, ccl.decode) }, + { XD_LISP_OBJECT, offsetof (Lisp_Coding_System, ccl.encode) }, +#endif + { XD_END } +}; + +DEFINE_LRECORD_IMPLEMENTATION ("coding-system", coding_system, + mark_coding_system, print_coding_system, + finalize_coding_system, + 0, 0, coding_system_description, + Lisp_Coding_System); + +static Lisp_Object +mark_coding_system (Lisp_Object obj) +{ + Lisp_Coding_System *codesys = XCODING_SYSTEM (obj); + + mark_object (CODING_SYSTEM_NAME (codesys)); + mark_object (CODING_SYSTEM_DOC_STRING (codesys)); + mark_object (CODING_SYSTEM_MNEMONIC (codesys)); + mark_object (CODING_SYSTEM_EOL_LF (codesys)); + mark_object (CODING_SYSTEM_EOL_CRLF (codesys)); + mark_object (CODING_SYSTEM_EOL_CR (codesys)); + + switch (CODING_SYSTEM_TYPE (codesys)) + { +#ifdef MULE + int i; + case CODESYS_ISO2022: + for (i = 0; i < 4; i++) + mark_object (CODING_SYSTEM_ISO2022_INITIAL_CHARSET (codesys, i)); + if (codesys->iso2022.input_conv) + { + for (i = 0; i < Dynarr_length (codesys->iso2022.input_conv); i++) + { + struct charset_conversion_spec *ccs = + Dynarr_atp (codesys->iso2022.input_conv, i); + mark_object (ccs->from_charset); + mark_object (ccs->to_charset); + } + } + if (codesys->iso2022.output_conv) + { + for (i = 0; i < Dynarr_length (codesys->iso2022.output_conv); i++) + { + struct charset_conversion_spec *ccs = + Dynarr_atp (codesys->iso2022.output_conv, i); + mark_object (ccs->from_charset); + mark_object (ccs->to_charset); + } + } + break; + + case CODESYS_CCL: + mark_object (CODING_SYSTEM_CCL_DECODE (codesys)); + mark_object (CODING_SYSTEM_CCL_ENCODE (codesys)); + break; +#endif /* MULE */ + default: + break; + } + + mark_object (CODING_SYSTEM_PRE_WRITE_CONVERSION (codesys)); + return CODING_SYSTEM_POST_READ_CONVERSION (codesys); +} + +static void +print_coding_system (Lisp_Object obj, Lisp_Object printcharfun, + int escapeflag) +{ + Lisp_Coding_System *c = XCODING_SYSTEM (obj); + if (print_readably) + error ("printing unreadable object #", + c->header.uid); + + write_c_string ("#name, printcharfun, 1); + write_c_string (">", printcharfun); +} + +static void +finalize_coding_system (void *header, int for_disksave) +{ + Lisp_Coding_System *c = (Lisp_Coding_System *) header; + /* Since coding systems never go away, this function is not + necessary. But it would be necessary if we changed things + so that coding systems could go away. */ + if (!for_disksave) /* see comment in lstream.c */ + { + switch (CODING_SYSTEM_TYPE (c)) + { +#ifdef MULE + case CODESYS_ISO2022: + if (c->iso2022.input_conv) + { + Dynarr_free (c->iso2022.input_conv); + c->iso2022.input_conv = 0; + } + if (c->iso2022.output_conv) + { + Dynarr_free (c->iso2022.output_conv); + c->iso2022.output_conv = 0; + } + break; +#endif /* MULE */ + default: + break; + } + } +} + +static eol_type_t +symbol_to_eol_type (Lisp_Object symbol) +{ + CHECK_SYMBOL (symbol); + if (NILP (symbol)) return EOL_AUTODETECT; + if (EQ (symbol, Qlf)) return EOL_LF; + if (EQ (symbol, Qcrlf)) return EOL_CRLF; + if (EQ (symbol, Qcr)) return EOL_CR; + + signal_simple_error ("Unrecognized eol type", symbol); + return EOL_AUTODETECT; /* not reached */ +} + +static Lisp_Object +eol_type_to_symbol (eol_type_t type) +{ + switch (type) + { + default: abort (); + case EOL_LF: return Qlf; + case EOL_CRLF: return Qcrlf; + case EOL_CR: return Qcr; + case EOL_AUTODETECT: return Qnil; + } +} + +static void +setup_eol_coding_systems (Lisp_Coding_System *codesys) +{ + Lisp_Object codesys_obj; + int len = string_length (XSYMBOL (CODING_SYSTEM_NAME (codesys))->name); + char *codesys_name = (char *) alloca (len + 7); + int mlen = -1; + char *codesys_mnemonic=0; + + Lisp_Object codesys_name_sym, sub_codesys_obj; + + /* kludge */ + + XSETCODING_SYSTEM (codesys_obj, codesys); + + memcpy (codesys_name, + string_data (XSYMBOL (CODING_SYSTEM_NAME (codesys))->name), len); + + if (STRINGP (CODING_SYSTEM_MNEMONIC (codesys))) + { + mlen = XSTRING_LENGTH (CODING_SYSTEM_MNEMONIC (codesys)); + codesys_mnemonic = (char *) alloca (mlen + 7); + memcpy (codesys_mnemonic, + XSTRING_DATA (CODING_SYSTEM_MNEMONIC (codesys)), mlen); + } + +#define DEFINE_SUB_CODESYS(op_sys, op_sys_abbr, Type) do { \ + strcpy (codesys_name + len, "-" op_sys); \ + if (mlen != -1) \ + strcpy (codesys_mnemonic + mlen, op_sys_abbr); \ + codesys_name_sym = intern (codesys_name); \ + sub_codesys_obj = Fcopy_coding_system (codesys_obj, codesys_name_sym); \ + XCODING_SYSTEM_EOL_TYPE (sub_codesys_obj) = Type; \ + if (mlen != -1) \ + XCODING_SYSTEM_MNEMONIC(sub_codesys_obj) = \ + build_string (codesys_mnemonic); \ + CODING_SYSTEM_##Type (codesys) = sub_codesys_obj; \ +} while (0) + + DEFINE_SUB_CODESYS("unix", "", EOL_LF); + DEFINE_SUB_CODESYS("dos", ":T", EOL_CRLF); + DEFINE_SUB_CODESYS("mac", ":t", EOL_CR); +} + +DEFUN ("coding-system-p", Fcoding_system_p, 1, 1, 0, /* +Return t if OBJECT is a coding system. +A coding system is an object that defines how text containing multiple +character sets is encoded into a stream of (typically 8-bit) bytes. +The coding system is used to decode the stream into a series of +characters (which may be from multiple charsets) when the text is read +from a file or process, and is used to encode the text back into the +same format when it is written out to a file or process. + +For example, many ISO2022-compliant coding systems (such as Compound +Text, which is used for inter-client data under the X Window System) +use escape sequences to switch between different charsets -- Japanese +Kanji, for example, is invoked with "ESC $ ( B"; ASCII is invoked +with "ESC ( B"; and Cyrillic is invoked with "ESC - L". See +`make-coding-system' for more information. + +Coding systems are normally identified using a symbol, and the +symbol is accepted in place of the actual coding system object whenever +a coding system is called for. (This is similar to how faces work.) +*/ + (object)) +{ + return CODING_SYSTEMP (object) ? Qt : Qnil; +} + +DEFUN ("find-coding-system", Ffind_coding_system, 1, 1, 0, /* +Retrieve the coding system of the given name. + +If CODING-SYSTEM-OR-NAME is a coding-system object, it is simply +returned. Otherwise, CODING-SYSTEM-OR-NAME should be a symbol. +If there is no such coding system, nil is returned. Otherwise the +associated coding system object is returned. +*/ + (coding_system_or_name)) +{ + if (NILP (coding_system_or_name)) + coding_system_or_name = Qbinary; + else if (CODING_SYSTEMP (coding_system_or_name)) + return coding_system_or_name; + else + CHECK_SYMBOL (coding_system_or_name); + + while (1) + { + coding_system_or_name = + Fgethash (coding_system_or_name, Vcoding_system_hash_table, Qnil); + + if (CODING_SYSTEMP (coding_system_or_name) || NILP (coding_system_or_name)) + return coding_system_or_name; + } +} + +DEFUN ("get-coding-system", Fget_coding_system, 1, 1, 0, /* +Retrieve the coding system of the given name. +Same as `find-coding-system' except that if there is no such +coding system, an error is signaled instead of returning nil. +*/ + (name)) +{ + Lisp_Object coding_system = Ffind_coding_system (name); + + if (NILP (coding_system)) + signal_simple_error ("No such coding system", name); + return coding_system; +} + +/* We store the coding systems in hash tables with the names as the key and the + actual coding system object as the value. Occasionally we need to use them + in a list format. These routines provide us with that. */ +struct coding_system_list_closure +{ + Lisp_Object *coding_system_list; +}; + +static int +add_coding_system_to_list_mapper (Lisp_Object key, Lisp_Object value, + void *coding_system_list_closure) +{ + /* This function can GC */ + struct coding_system_list_closure *cscl = + (struct coding_system_list_closure *) coding_system_list_closure; + Lisp_Object *coding_system_list = cscl->coding_system_list; + + *coding_system_list = Fcons (key, *coding_system_list); + return 0; +} + +DEFUN ("coding-system-list", Fcoding_system_list, 0, 0, 0, /* +Return a list of the names of all defined coding systems. +*/ + ()) +{ + Lisp_Object coding_system_list = Qnil; + struct gcpro gcpro1; + struct coding_system_list_closure coding_system_list_closure; + + GCPRO1 (coding_system_list); + coding_system_list_closure.coding_system_list = &coding_system_list; + elisp_maphash (add_coding_system_to_list_mapper, Vcoding_system_hash_table, + &coding_system_list_closure); + UNGCPRO; + + return coding_system_list; +} + +DEFUN ("coding-system-name", Fcoding_system_name, 1, 1, 0, /* +Return the name of the given coding system. +*/ + (coding_system)) +{ + coding_system = Fget_coding_system (coding_system); + return XCODING_SYSTEM_NAME (coding_system); +} + +static Lisp_Coding_System * +allocate_coding_system (enum coding_system_type type, Lisp_Object name) +{ + Lisp_Coding_System *codesys = + alloc_lcrecord_type (Lisp_Coding_System, &lrecord_coding_system); + + zero_lcrecord (codesys); + CODING_SYSTEM_PRE_WRITE_CONVERSION (codesys) = Qnil; + CODING_SYSTEM_POST_READ_CONVERSION (codesys) = Qnil; + CODING_SYSTEM_EOL_TYPE (codesys) = EOL_AUTODETECT; + CODING_SYSTEM_EOL_CRLF (codesys) = Qnil; + CODING_SYSTEM_EOL_CR (codesys) = Qnil; + CODING_SYSTEM_EOL_LF (codesys) = Qnil; + CODING_SYSTEM_TYPE (codesys) = type; + CODING_SYSTEM_MNEMONIC (codesys) = Qnil; +#ifdef MULE + if (type == CODESYS_ISO2022) + { + int i; + for (i = 0; i < 4; i++) + CODING_SYSTEM_ISO2022_INITIAL_CHARSET (codesys, i) = Qnil; + } + else if (type == CODESYS_CCL) + { + CODING_SYSTEM_CCL_DECODE (codesys) = Qnil; + CODING_SYSTEM_CCL_ENCODE (codesys) = Qnil; + } +#endif /* MULE */ + CODING_SYSTEM_NAME (codesys) = name; + + return codesys; +} + +#ifdef MULE +/* Given a list of charset conversion specs as specified in a Lisp + program, parse it into STORE_HERE. */ + +static void +parse_charset_conversion_specs (charset_conversion_spec_dynarr *store_here, + Lisp_Object spec_list) +{ + Lisp_Object rest; + + EXTERNAL_LIST_LOOP (rest, spec_list) + { + Lisp_Object car = XCAR (rest); + Lisp_Object from, to; + struct charset_conversion_spec spec; + + if (!CONSP (car) || !CONSP (XCDR (car)) || !NILP (XCDR (XCDR (car)))) + signal_simple_error ("Invalid charset conversion spec", car); + from = Fget_charset (XCAR (car)); + to = Fget_charset (XCAR (XCDR (car))); + if (XCHARSET_TYPE (from) != XCHARSET_TYPE (to)) + signal_simple_error_2 + ("Attempted conversion between different charset types", + from, to); + spec.from_charset = from; + spec.to_charset = to; + + Dynarr_add (store_here, spec); + } +} + +/* Given a dynarr LOAD_HERE of internally-stored charset conversion + specs, return the equivalent as the Lisp programmer would see it. + + If LOAD_HERE is 0, return Qnil. */ + +static Lisp_Object +unparse_charset_conversion_specs (charset_conversion_spec_dynarr *load_here) +{ + int i; + Lisp_Object result; + + if (!load_here) + return Qnil; + for (i = 0, result = Qnil; i < Dynarr_length (load_here); i++) + { + struct charset_conversion_spec *ccs = Dynarr_atp (load_here, i); + result = Fcons (list2 (ccs->from_charset, ccs->to_charset), result); + } + + return Fnreverse (result); +} + +#endif /* MULE */ + +DEFUN ("make-coding-system", Fmake_coding_system, 2, 4, 0, /* +Register symbol NAME as a coding system. + +TYPE describes the conversion method used and should be one of + +nil or 'undecided + Automatic conversion. XEmacs attempts to detect the coding system + used in the file. +'no-conversion + No conversion. Use this for binary files and such. On output, + graphic characters that are not in ASCII or Latin-1 will be + replaced by a ?. (For a no-conversion-encoded buffer, these + characters will only be present if you explicitly insert them.) +'shift-jis + Shift-JIS (a Japanese encoding commonly used in PC operating systems). +'ucs-4 + ISO 10646 UCS-4 encoding. +'utf-8 + ISO 10646 UTF-8 encoding. +'iso2022 + Any ISO2022-compliant encoding. Among other things, this includes + JIS (the Japanese encoding commonly used for e-mail), EUC (the + standard Unix encoding for Japanese and other languages), and + Compound Text (the encoding used in X11). You can specify more + specific information about the conversion with the PROPS argument. +'big5 + Big5 (the encoding commonly used for Taiwanese). +'ccl + The conversion is performed using a user-written pseudo-code + program. CCL (Code Conversion Language) is the name of this + pseudo-code. +'internal + Write out or read in the raw contents of the memory representing + the buffer's text. This is primarily useful for debugging + purposes, and is only enabled when XEmacs has been compiled with + DEBUG_XEMACS defined (via the --debug configure option). + WARNING: Reading in a file using 'internal conversion can result + in an internal inconsistency in the memory representing a + buffer's text, which will produce unpredictable results and may + cause XEmacs to crash. Under normal circumstances you should + never use 'internal conversion. + +DOC-STRING is a string describing the coding system. + +PROPS is a property list, describing the specific nature of the +character set. Recognized properties are: + +'mnemonic + String to be displayed in the modeline when this coding system is + active. + +'eol-type + End-of-line conversion to be used. It should be one of + + nil + Automatically detect the end-of-line type (LF, CRLF, + or CR). Also generate subsidiary coding systems named + `NAME-unix', `NAME-dos', and `NAME-mac', that are + identical to this coding system but have an EOL-TYPE + value of 'lf, 'crlf, and 'cr, respectively. + 'lf + The end of a line is marked externally using ASCII LF. + Since this is also the way that XEmacs represents an + end-of-line internally, specifying this option results + in no end-of-line conversion. This is the standard + format for Unix text files. + 'crlf + The end of a line is marked externally using ASCII + CRLF. This is the standard format for MS-DOS text + files. + 'cr + The end of a line is marked externally using ASCII CR. + This is the standard format for Macintosh text files. + t + Automatically detect the end-of-line type but do not + generate subsidiary coding systems. (This value is + converted to nil when stored internally, and + `coding-system-property' will return nil.) + +'post-read-conversion + Function called after a file has been read in, to perform the + decoding. Called with two arguments, START and END, denoting + a region of the current buffer to be decoded. + +'pre-write-conversion + Function called before a file is written out, to perform the + encoding. Called with two arguments, START and END, denoting + a region of the current buffer to be encoded. + + +The following additional properties are recognized if TYPE is 'iso2022: + +'charset-g0 +'charset-g1 +'charset-g2 +'charset-g3 + The character set initially designated to the G0 - G3 registers. + The value should be one of + + -- A charset object (designate that character set) + -- nil (do not ever use this register) + -- t (no character set is initially designated to + the register, but may be later on; this automatically + sets the corresponding `force-g*-on-output' property) + +'force-g0-on-output +'force-g1-on-output +'force-g2-on-output +'force-g2-on-output + If non-nil, send an explicit designation sequence on output before + using the specified register. + +'short + If non-nil, use the short forms "ESC $ @", "ESC $ A", and + "ESC $ B" on output in place of the full designation sequences + "ESC $ ( @", "ESC $ ( A", and "ESC $ ( B". + +'no-ascii-eol + If non-nil, don't designate ASCII to G0 at each end of line on output. + Setting this to non-nil also suppresses other state-resetting that + normally happens at the end of a line. + +'no-ascii-cntl + If non-nil, don't designate ASCII to G0 before control chars on output. + +'seven + If non-nil, use 7-bit environment on output. Otherwise, use 8-bit + environment. + +'lock-shift + If non-nil, use locking-shift (SO/SI) instead of single-shift + or designation by escape sequence. + +'no-iso6429 + If non-nil, don't use ISO6429's direction specification. + +'escape-quoted + If non-nil, literal control characters that are the same as + the beginning of a recognized ISO2022 or ISO6429 escape sequence + (in particular, ESC (0x1B), SO (0x0E), SI (0x0F), SS2 (0x8E), + SS3 (0x8F), and CSI (0x9B)) are "quoted" with an escape character + so that they can be properly distinguished from an escape sequence. + (Note that doing this results in a non-portable encoding.) This + encoding flag is used for byte-compiled files. Note that ESC + is a good choice for a quoting character because there are no + escape sequences whose second byte is a character from the Control-0 + or Control-1 character sets; this is explicitly disallowed by the + ISO2022 standard. + +'input-charset-conversion + A list of conversion specifications, specifying conversion of + characters in one charset to another when decoding is performed. + Each specification is a list of two elements: the source charset, + and the destination charset. + +'output-charset-conversion + A list of conversion specifications, specifying conversion of + characters in one charset to another when encoding is performed. + The form of each specification is the same as for + 'input-charset-conversion. + + +The following additional properties are recognized (and required) +if TYPE is 'ccl: + +'decode + CCL program used for decoding (converting to internal format). + +'encode + CCL program used for encoding (converting to external format). +*/ + (name, type, doc_string, props)) +{ + Lisp_Coding_System *codesys; + enum coding_system_type ty; + int need_to_setup_eol_systems = 1; + + /* Convert type to constant */ + if (NILP (type) || EQ (type, Qundecided)) + { ty = CODESYS_AUTODETECT; } +#ifdef MULE + else if (EQ (type, Qshift_jis)) { ty = CODESYS_SHIFT_JIS; } + else if (EQ (type, Qiso2022)) { ty = CODESYS_ISO2022; } + else if (EQ (type, Qbig5)) { ty = CODESYS_BIG5; } + else if (EQ (type, Qucs4)) { ty = CODESYS_UCS4; } + else if (EQ (type, Qutf8)) { ty = CODESYS_UTF8; } + else if (EQ (type, Qccl)) { ty = CODESYS_CCL; } +#endif + else if (EQ (type, Qno_conversion)) { ty = CODESYS_NO_CONVERSION; } +#ifdef DEBUG_XEMACS + else if (EQ (type, Qinternal)) { ty = CODESYS_INTERNAL; } +#endif + else + signal_simple_error ("Invalid coding system type", type); + + CHECK_SYMBOL (name); + + codesys = allocate_coding_system (ty, name); + + if (NILP (doc_string)) + doc_string = build_string (""); + else + CHECK_STRING (doc_string); + CODING_SYSTEM_DOC_STRING (codesys) = doc_string; + +#ifdef UTF2000 + if (ty == CODESYS_NO_CONVERSION) + codesys->fixed.size = 1; +#endif + { + EXTERNAL_PROPERTY_LIST_LOOP_3 (key, value, props) + { + if (EQ (key, Qmnemonic)) + { + if (!NILP (value)) + CHECK_STRING (value); + CODING_SYSTEM_MNEMONIC (codesys) = value; + } + + else if (EQ (key, Qeol_type)) + { + need_to_setup_eol_systems = NILP (value); + if (EQ (value, Qt)) + value = Qnil; + CODING_SYSTEM_EOL_TYPE (codesys) = symbol_to_eol_type (value); + } + + else if (EQ (key, Qpost_read_conversion)) CODING_SYSTEM_POST_READ_CONVERSION (codesys) = value; + else if (EQ (key, Qpre_write_conversion)) CODING_SYSTEM_PRE_WRITE_CONVERSION (codesys) = value; +#ifdef MULE + else if (ty == CODESYS_ISO2022) + { +#define FROB_INITIAL_CHARSET(charset_num) \ + CODING_SYSTEM_ISO2022_INITIAL_CHARSET (codesys, charset_num) = \ + ((EQ (value, Qt) || EQ (value, Qnil)) ? value : Fget_charset (value)) + + if (EQ (key, Qcharset_g0)) FROB_INITIAL_CHARSET (0); + else if (EQ (key, Qcharset_g1)) FROB_INITIAL_CHARSET (1); + else if (EQ (key, Qcharset_g2)) FROB_INITIAL_CHARSET (2); + else if (EQ (key, Qcharset_g3)) FROB_INITIAL_CHARSET (3); + +#define FROB_FORCE_CHARSET(charset_num) \ + CODING_SYSTEM_ISO2022_FORCE_CHARSET_ON_OUTPUT (codesys, charset_num) = !NILP (value) + + else if (EQ (key, Qforce_g0_on_output)) FROB_FORCE_CHARSET (0); + else if (EQ (key, Qforce_g1_on_output)) FROB_FORCE_CHARSET (1); + else if (EQ (key, Qforce_g2_on_output)) FROB_FORCE_CHARSET (2); + else if (EQ (key, Qforce_g3_on_output)) FROB_FORCE_CHARSET (3); + +#define FROB_BOOLEAN_PROPERTY(prop) \ + CODING_SYSTEM_ISO2022_##prop (codesys) = !NILP (value) + + else if (EQ (key, Qshort)) FROB_BOOLEAN_PROPERTY (SHORT); + else if (EQ (key, Qno_ascii_eol)) FROB_BOOLEAN_PROPERTY (NO_ASCII_EOL); + else if (EQ (key, Qno_ascii_cntl)) FROB_BOOLEAN_PROPERTY (NO_ASCII_CNTL); + else if (EQ (key, Qseven)) FROB_BOOLEAN_PROPERTY (SEVEN); + else if (EQ (key, Qlock_shift)) FROB_BOOLEAN_PROPERTY (LOCK_SHIFT); + else if (EQ (key, Qno_iso6429)) FROB_BOOLEAN_PROPERTY (NO_ISO6429); + else if (EQ (key, Qescape_quoted)) FROB_BOOLEAN_PROPERTY (ESCAPE_QUOTED); + + else if (EQ (key, Qinput_charset_conversion)) + { + codesys->iso2022.input_conv = + Dynarr_new (charset_conversion_spec); + parse_charset_conversion_specs (codesys->iso2022.input_conv, + value); + } + else if (EQ (key, Qoutput_charset_conversion)) + { + codesys->iso2022.output_conv = + Dynarr_new (charset_conversion_spec); + parse_charset_conversion_specs (codesys->iso2022.output_conv, + value); + } + else + signal_simple_error ("Unrecognized property", key); + } + else if (EQ (type, Qccl)) + { + Lisp_Object sym; + struct ccl_program test_ccl; + Extbyte *suffix; + + /* Check key first. */ + if (EQ (key, Qdecode)) + suffix = "-ccl-decode"; + else if (EQ (key, Qencode)) + suffix = "-ccl-encode"; + else + signal_simple_error ("Unrecognized property", key); + + /* If value is vector, register it as a ccl program + associated with an newly created symbol for + backward compatibility. */ + if (VECTORP (value)) + { + sym = Fintern (concat2 (Fsymbol_name (name), + build_string (suffix)), + Qnil); + Fregister_ccl_program (sym, value); + } + else + { + CHECK_SYMBOL (value); + sym = value; + } + /* check if the given ccl programs are valid. */ + if (setup_ccl_program (&test_ccl, sym) < 0) + signal_simple_error ("Invalid CCL program", value); + + if (EQ (key, Qdecode)) + CODING_SYSTEM_CCL_DECODE (codesys) = sym; + else if (EQ (key, Qencode)) + CODING_SYSTEM_CCL_ENCODE (codesys) = sym; + + } +#endif /* MULE */ + else + signal_simple_error ("Unrecognized property", key); + } + } + + if (need_to_setup_eol_systems) + setup_eol_coding_systems (codesys); + + { + Lisp_Object codesys_obj; + XSETCODING_SYSTEM (codesys_obj, codesys); + Fputhash (name, codesys_obj, Vcoding_system_hash_table); + return codesys_obj; + } +} + +DEFUN ("copy-coding-system", Fcopy_coding_system, 2, 2, 0, /* +Copy OLD-CODING-SYSTEM to NEW-NAME. +If NEW-NAME does not name an existing coding system, a new one will +be created. +*/ + (old_coding_system, new_name)) +{ + Lisp_Object new_coding_system; + old_coding_system = Fget_coding_system (old_coding_system); + new_coding_system = Ffind_coding_system (new_name); + if (NILP (new_coding_system)) + { + XSETCODING_SYSTEM (new_coding_system, + allocate_coding_system + (XCODING_SYSTEM_TYPE (old_coding_system), + new_name)); + Fputhash (new_name, new_coding_system, Vcoding_system_hash_table); + } + + { + Lisp_Coding_System *to = XCODING_SYSTEM (new_coding_system); + Lisp_Coding_System *from = XCODING_SYSTEM (old_coding_system); + memcpy (((char *) to ) + sizeof (to->header), + ((char *) from) + sizeof (from->header), + sizeof (*from) - sizeof (from->header)); + to->name = new_name; + } + return new_coding_system; +} + +DEFUN ("coding-system-canonical-name-p", Fcoding_system_canonical_name_p, 1, 1, 0, /* +Return t if OBJECT names a coding system, and is not a coding system alias. +*/ + (object)) +{ + return CODING_SYSTEMP (Fgethash (object, Vcoding_system_hash_table, Qnil)) + ? Qt : Qnil; +} + +DEFUN ("coding-system-alias-p", Fcoding_system_alias_p, 1, 1, 0, /* +Return t if OBJECT is a coding system alias. +All coding system aliases are created by `define-coding-system-alias'. +*/ + (object)) +{ + return SYMBOLP (Fgethash (object, Vcoding_system_hash_table, Qzero)) + ? Qt : Qnil; +} + +DEFUN ("coding-system-aliasee", Fcoding_system_aliasee, 1, 1, 0, /* +Return the coding-system symbol for which symbol ALIAS is an alias. +*/ + (alias)) +{ + Lisp_Object aliasee = Fgethash (alias, Vcoding_system_hash_table, Qnil); + if (SYMBOLP (aliasee)) + return aliasee; + else + signal_simple_error ("Symbol is not a coding system alias", alias); + return Qnil; /* To keep the compiler happy */ +} + +static Lisp_Object +append_suffix_to_symbol (Lisp_Object symbol, const char *ascii_string) +{ + return Fintern (concat2 (Fsymbol_name (symbol), build_string (ascii_string)), + Qnil); +} + +/* A maphash function, for removing dangling coding system aliases. */ +static int +dangling_coding_system_alias_p (Lisp_Object alias, + Lisp_Object aliasee, + void *dangling_aliases) +{ + if (SYMBOLP (aliasee) + && NILP (Fgethash (aliasee, Vcoding_system_hash_table, Qnil))) + { + (*(int *) dangling_aliases)++; + return 1; + } + else + return 0; +} + +DEFUN ("define-coding-system-alias", Fdefine_coding_system_alias, 2, 2, 0, /* +Define symbol ALIAS as an alias for coding system ALIASEE. + +You can use this function to redefine an alias that has already been defined, +but you cannot redefine a name which is the canonical name for a coding system. +\(a canonical name of a coding system is what is returned when you call +`coding-system-name' on a coding system). + +ALIASEE itself can be an alias, which allows you to define nested aliases. + +You are forbidden, however, from creating alias loops or `dangling' aliases. +These will be detected, and an error will be signaled if you attempt to do so. + +If ALIASEE is nil, then ALIAS will simply be undefined. + +See also `coding-system-alias-p', `coding-system-aliasee', +and `coding-system-canonical-name-p'. +*/ + (alias, aliasee)) +{ + Lisp_Object real_coding_system, probe; + + CHECK_SYMBOL (alias); + + if (!NILP (Fcoding_system_canonical_name_p (alias))) + signal_simple_error + ("Symbol is the canonical name of a coding system and cannot be redefined", + alias); + + if (NILP (aliasee)) + { + Lisp_Object subsidiary_unix = append_suffix_to_symbol (alias, "-unix"); + Lisp_Object subsidiary_dos = append_suffix_to_symbol (alias, "-dos"); + Lisp_Object subsidiary_mac = append_suffix_to_symbol (alias, "-mac"); + + Fremhash (alias, Vcoding_system_hash_table); + + /* Undefine subsidiary aliases, + presumably created by a previous call to this function */ + if (! NILP (Fcoding_system_alias_p (subsidiary_unix)) && + ! NILP (Fcoding_system_alias_p (subsidiary_dos)) && + ! NILP (Fcoding_system_alias_p (subsidiary_mac))) + { + Fdefine_coding_system_alias (subsidiary_unix, Qnil); + Fdefine_coding_system_alias (subsidiary_dos, Qnil); + Fdefine_coding_system_alias (subsidiary_mac, Qnil); + } + + /* Undefine dangling coding system aliases. */ + { + int dangling_aliases; + + do { + dangling_aliases = 0; + elisp_map_remhash (dangling_coding_system_alias_p, + Vcoding_system_hash_table, + &dangling_aliases); + } while (dangling_aliases > 0); + } + + return Qnil; + } + + if (CODING_SYSTEMP (aliasee)) + aliasee = XCODING_SYSTEM_NAME (aliasee); + + /* Checks that aliasee names a coding-system */ + real_coding_system = Fget_coding_system (aliasee); + + /* Check for coding system alias loops */ + if (EQ (alias, aliasee)) + alias_loop: signal_simple_error_2 + ("Attempt to create a coding system alias loop", alias, aliasee); + + for (probe = aliasee; + SYMBOLP (probe); + probe = Fgethash (probe, Vcoding_system_hash_table, Qzero)) + { + if (EQ (probe, alias)) + goto alias_loop; + } + + Fputhash (alias, aliasee, Vcoding_system_hash_table); + + /* Set up aliases for subsidiaries. + #### There must be a better way to handle subsidiary coding systems. */ + { + static const char *suffixes[] = { "-unix", "-dos", "-mac" }; + int i; + for (i = 0; i < countof (suffixes); i++) + { + Lisp_Object alias_subsidiary = + append_suffix_to_symbol (alias, suffixes[i]); + Lisp_Object aliasee_subsidiary = + append_suffix_to_symbol (aliasee, suffixes[i]); + + if (! NILP (Ffind_coding_system (aliasee_subsidiary))) + Fdefine_coding_system_alias (alias_subsidiary, aliasee_subsidiary); + } + } + /* FSF return value is a vector of [ALIAS-unix ALIAS-dos ALIAS-mac], + but it doesn't look intentional, so I'd rather return something + meaningful or nothing at all. */ + return Qnil; +} + +static Lisp_Object +subsidiary_coding_system (Lisp_Object coding_system, eol_type_t type) +{ + Lisp_Coding_System *cs = XCODING_SYSTEM (coding_system); + Lisp_Object new_coding_system; + + if (CODING_SYSTEM_EOL_TYPE (cs) != EOL_AUTODETECT) + return coding_system; + + switch (type) + { + case EOL_AUTODETECT: return coding_system; + case EOL_LF: new_coding_system = CODING_SYSTEM_EOL_LF (cs); break; + case EOL_CR: new_coding_system = CODING_SYSTEM_EOL_CR (cs); break; + case EOL_CRLF: new_coding_system = CODING_SYSTEM_EOL_CRLF (cs); break; + default: abort (); return Qnil; + } + + return NILP (new_coding_system) ? coding_system : new_coding_system; +} + +DEFUN ("subsidiary-coding-system", Fsubsidiary_coding_system, 2, 2, 0, /* +Return the subsidiary coding system of CODING-SYSTEM with eol type EOL-TYPE. +*/ + (coding_system, eol_type)) +{ + coding_system = Fget_coding_system (coding_system); + + return subsidiary_coding_system (coding_system, + symbol_to_eol_type (eol_type)); +} + + +/************************************************************************/ +/* Coding system accessors */ +/************************************************************************/ + +DEFUN ("coding-system-doc-string", Fcoding_system_doc_string, 1, 1, 0, /* +Return the doc string for CODING-SYSTEM. +*/ + (coding_system)) +{ + coding_system = Fget_coding_system (coding_system); + return XCODING_SYSTEM_DOC_STRING (coding_system); +} + +DEFUN ("coding-system-type", Fcoding_system_type, 1, 1, 0, /* +Return the type of CODING-SYSTEM. +*/ + (coding_system)) +{ + switch (XCODING_SYSTEM_TYPE (Fget_coding_system (coding_system))) + { + default: abort (); + case CODESYS_AUTODETECT: return Qundecided; +#ifdef MULE + case CODESYS_SHIFT_JIS: return Qshift_jis; + case CODESYS_ISO2022: return Qiso2022; + case CODESYS_BIG5: return Qbig5; + case CODESYS_UCS4: return Qucs4; + case CODESYS_UTF8: return Qutf8; + case CODESYS_CCL: return Qccl; +#endif + case CODESYS_NO_CONVERSION: return Qno_conversion; +#ifdef DEBUG_XEMACS + case CODESYS_INTERNAL: return Qinternal; +#endif + } +} + +#ifdef MULE +static +Lisp_Object coding_system_charset (Lisp_Object coding_system, int gnum) +{ + Lisp_Object cs + = XCODING_SYSTEM_ISO2022_INITIAL_CHARSET (coding_system, gnum); + + return CHARSETP (cs) ? XCHARSET_NAME (cs) : Qnil; +} + +DEFUN ("coding-system-charset", Fcoding_system_charset, 2, 2, 0, /* +Return initial charset of CODING-SYSTEM designated to GNUM. +GNUM allows 0 .. 3. +*/ + (coding_system, gnum)) +{ + coding_system = Fget_coding_system (coding_system); + CHECK_INT (gnum); + + return coding_system_charset (coding_system, XINT (gnum)); +} +#endif /* MULE */ + +DEFUN ("coding-system-property", Fcoding_system_property, 2, 2, 0, /* +Return the PROP property of CODING-SYSTEM. +*/ + (coding_system, prop)) +{ + int i, ok = 0; + enum coding_system_type type; + + coding_system = Fget_coding_system (coding_system); + CHECK_SYMBOL (prop); + type = XCODING_SYSTEM_TYPE (coding_system); + + for (i = 0; !ok && i < Dynarr_length (the_codesys_prop_dynarr); i++) + if (EQ (Dynarr_at (the_codesys_prop_dynarr, i).sym, prop)) + { + ok = 1; + switch (Dynarr_at (the_codesys_prop_dynarr, i).prop_type) + { + case CODESYS_PROP_ALL_OK: + break; +#ifdef MULE + case CODESYS_PROP_ISO2022: + if (type != CODESYS_ISO2022) + signal_simple_error + ("Property only valid in ISO2022 coding systems", + prop); + break; + + case CODESYS_PROP_CCL: + if (type != CODESYS_CCL) + signal_simple_error + ("Property only valid in CCL coding systems", + prop); + break; +#endif /* MULE */ + default: + abort (); + } + } + + if (!ok) + signal_simple_error ("Unrecognized property", prop); + + if (EQ (prop, Qname)) + return XCODING_SYSTEM_NAME (coding_system); + else if (EQ (prop, Qtype)) + return Fcoding_system_type (coding_system); + else if (EQ (prop, Qdoc_string)) + return XCODING_SYSTEM_DOC_STRING (coding_system); + else if (EQ (prop, Qmnemonic)) + return XCODING_SYSTEM_MNEMONIC (coding_system); + else if (EQ (prop, Qeol_type)) + return eol_type_to_symbol (XCODING_SYSTEM_EOL_TYPE (coding_system)); + else if (EQ (prop, Qeol_lf)) + return XCODING_SYSTEM_EOL_LF (coding_system); + else if (EQ (prop, Qeol_crlf)) + return XCODING_SYSTEM_EOL_CRLF (coding_system); + else if (EQ (prop, Qeol_cr)) + return XCODING_SYSTEM_EOL_CR (coding_system); + else if (EQ (prop, Qpost_read_conversion)) + return XCODING_SYSTEM_POST_READ_CONVERSION (coding_system); + else if (EQ (prop, Qpre_write_conversion)) + return XCODING_SYSTEM_PRE_WRITE_CONVERSION (coding_system); +#ifdef MULE + else if (type == CODESYS_ISO2022) + { + if (EQ (prop, Qcharset_g0)) + return coding_system_charset (coding_system, 0); + else if (EQ (prop, Qcharset_g1)) + return coding_system_charset (coding_system, 1); + else if (EQ (prop, Qcharset_g2)) + return coding_system_charset (coding_system, 2); + else if (EQ (prop, Qcharset_g3)) + return coding_system_charset (coding_system, 3); + +#define FORCE_CHARSET(charset_num) \ + (XCODING_SYSTEM_ISO2022_FORCE_CHARSET_ON_OUTPUT \ + (coding_system, charset_num) ? Qt : Qnil) + + else if (EQ (prop, Qforce_g0_on_output)) return FORCE_CHARSET (0); + else if (EQ (prop, Qforce_g1_on_output)) return FORCE_CHARSET (1); + else if (EQ (prop, Qforce_g2_on_output)) return FORCE_CHARSET (2); + else if (EQ (prop, Qforce_g3_on_output)) return FORCE_CHARSET (3); + +#define LISP_BOOLEAN(prop) \ + (XCODING_SYSTEM_ISO2022_##prop (coding_system) ? Qt : Qnil) + + else if (EQ (prop, Qshort)) return LISP_BOOLEAN (SHORT); + else if (EQ (prop, Qno_ascii_eol)) return LISP_BOOLEAN (NO_ASCII_EOL); + else if (EQ (prop, Qno_ascii_cntl)) return LISP_BOOLEAN (NO_ASCII_CNTL); + else if (EQ (prop, Qseven)) return LISP_BOOLEAN (SEVEN); + else if (EQ (prop, Qlock_shift)) return LISP_BOOLEAN (LOCK_SHIFT); + else if (EQ (prop, Qno_iso6429)) return LISP_BOOLEAN (NO_ISO6429); + else if (EQ (prop, Qescape_quoted)) return LISP_BOOLEAN (ESCAPE_QUOTED); + + else if (EQ (prop, Qinput_charset_conversion)) + return + unparse_charset_conversion_specs + (XCODING_SYSTEM (coding_system)->iso2022.input_conv); + else if (EQ (prop, Qoutput_charset_conversion)) + return + unparse_charset_conversion_specs + (XCODING_SYSTEM (coding_system)->iso2022.output_conv); + else + abort (); + } + else if (type == CODESYS_CCL) + { + if (EQ (prop, Qdecode)) + return XCODING_SYSTEM_CCL_DECODE (coding_system); + else if (EQ (prop, Qencode)) + return XCODING_SYSTEM_CCL_ENCODE (coding_system); + else + abort (); + } +#endif /* MULE */ + else + abort (); + + return Qnil; /* not reached */ +} + + +/************************************************************************/ +/* Coding category functions */ +/************************************************************************/ + +static int +decode_coding_category (Lisp_Object symbol) +{ + int i; + + CHECK_SYMBOL (symbol); + for (i = 0; i < CODING_CATEGORY_LAST; i++) + if (EQ (coding_category_symbol[i], symbol)) + return i; + + signal_simple_error ("Unrecognized coding category", symbol); + return 0; /* not reached */ +} + +DEFUN ("coding-category-list", Fcoding_category_list, 0, 0, 0, /* +Return a list of all recognized coding categories. +*/ + ()) +{ + int i; + Lisp_Object list = Qnil; + + for (i = CODING_CATEGORY_LAST - 1; i >= 0; i--) + list = Fcons (coding_category_symbol[i], list); + return list; +} + +DEFUN ("set-coding-priority-list", Fset_coding_priority_list, 1, 1, 0, /* +Change the priority order of the coding categories. +LIST should be list of coding categories, in descending order of +priority. Unspecified coding categories will be lower in priority +than all specified ones, in the same relative order they were in +previously. +*/ + (list)) +{ + int category_to_priority[CODING_CATEGORY_LAST]; + int i, j; + Lisp_Object rest; + + /* First generate a list that maps coding categories to priorities. */ + + for (i = 0; i < CODING_CATEGORY_LAST; i++) + category_to_priority[i] = -1; + + /* Highest priority comes from the specified list. */ + i = 0; + EXTERNAL_LIST_LOOP (rest, list) + { + int cat = decode_coding_category (XCAR (rest)); + + if (category_to_priority[cat] >= 0) + signal_simple_error ("Duplicate coding category in list", XCAR (rest)); + category_to_priority[cat] = i++; + } + + /* Now go through the existing categories by priority to retrieve + the categories not yet specified and preserve their priority + order. */ + for (j = 0; j < CODING_CATEGORY_LAST; j++) + { + int cat = fcd->coding_category_by_priority[j]; + if (category_to_priority[cat] < 0) + category_to_priority[cat] = i++; + } + + /* Now we need to construct the inverse of the mapping we just + constructed. */ + + for (i = 0; i < CODING_CATEGORY_LAST; i++) + fcd->coding_category_by_priority[category_to_priority[i]] = i; + + /* Phew! That was confusing. */ + return Qnil; +} + +DEFUN ("coding-priority-list", Fcoding_priority_list, 0, 0, 0, /* +Return a list of coding categories in descending order of priority. +*/ + ()) +{ + int i; + Lisp_Object list = Qnil; + + for (i = CODING_CATEGORY_LAST - 1; i >= 0; i--) + list = Fcons (coding_category_symbol[fcd->coding_category_by_priority[i]], + list); + return list; +} + +DEFUN ("set-coding-category-system", Fset_coding_category_system, 2, 2, 0, /* +Change the coding system associated with a coding category. +*/ + (coding_category, coding_system)) +{ + int cat = decode_coding_category (coding_category); + + coding_system = Fget_coding_system (coding_system); + fcd->coding_category_system[cat] = coding_system; + return Qnil; +} + +DEFUN ("coding-category-system", Fcoding_category_system, 1, 1, 0, /* +Return the coding system associated with a coding category. +*/ + (coding_category)) +{ + int cat = decode_coding_category (coding_category); + Lisp_Object sys = fcd->coding_category_system[cat]; + + if (!NILP (sys)) + return XCODING_SYSTEM_NAME (sys); + return Qnil; +} + + +/************************************************************************/ +/* Detecting the encoding of data */ +/************************************************************************/ + +struct detection_state +{ + eol_type_t eol_type; + int seen_non_ascii; + int mask; +#ifdef MULE + struct + { + int mask; + int in_second_byte; + } + big5; + + struct + { + int mask; + int in_second_byte; + } + shift_jis; + + struct + { + int mask; + int in_byte; + } + ucs4; + + struct + { + int mask; + int in_byte; + } + utf8; + + struct + { + int mask; + int initted; + struct iso2022_decoder iso; + unsigned int flags; + int high_byte_count; + unsigned int saw_single_shift:1; + } + iso2022; +#endif + struct + { + int seen_anything; + int just_saw_cr; + } + eol; +}; + +static int +acceptable_control_char_p (int c) +{ + switch (c) + { + /* Allow and ignore control characters that you might + reasonably see in a text file */ + case '\r': + case '\n': + case '\t': + case 7: /* bell */ + case 8: /* backspace */ + case 11: /* vertical tab */ + case 12: /* form feed */ + case 26: /* MS-DOS C-z junk */ + case 31: /* '^_' -- for info */ + return 1; + default: + return 0; + } +} + +static int +mask_has_at_most_one_bit_p (int mask) +{ + /* Perhaps the only thing useful you learn from intensive Microsoft + technical interviews */ + return (mask & (mask - 1)) == 0; +} + +static eol_type_t +detect_eol_type (struct detection_state *st, const Extbyte *src, + Lstream_data_count n) +{ + while (n--) + { + unsigned char c = *(unsigned char *)src++; + if (c == '\n') + { + if (st->eol.just_saw_cr) + return EOL_CRLF; + else if (st->eol.seen_anything) + return EOL_LF; + } + else if (st->eol.just_saw_cr) + return EOL_CR; + else if (c == '\r') + st->eol.just_saw_cr = 1; + else + st->eol.just_saw_cr = 0; + st->eol.seen_anything = 1; + } + + return EOL_AUTODETECT; +} + +/* Attempt to determine the encoding and EOL type of the given text. + Before calling this function for the first type, you must initialize + st->eol_type as appropriate and initialize st->mask to ~0. + + st->eol_type holds the determined EOL type, or EOL_AUTODETECT if + not yet known. + + st->mask holds the determined coding category mask, or ~0 if only + ASCII has been seen so far. + + Returns: + + 0 == st->eol_type is EOL_AUTODETECT and/or more than coding category + is present in st->mask + 1 == definitive answers are here for both st->eol_type and st->mask +*/ + +static int +detect_coding_type (struct detection_state *st, const Extbyte *src, + Lstream_data_count n, int just_do_eol) +{ + if (st->eol_type == EOL_AUTODETECT) + st->eol_type = detect_eol_type (st, src, n); + + if (just_do_eol) + return st->eol_type != EOL_AUTODETECT; + + if (!st->seen_non_ascii) + { + for (; n; n--, src++) + { + unsigned char c = *(unsigned char *) src; + if ((c < 0x20 && !acceptable_control_char_p (c)) || c >= 0x80) + { + st->seen_non_ascii = 1; +#ifdef MULE + st->shift_jis.mask = ~0; + st->big5.mask = ~0; + st->ucs4.mask = ~0; + st->utf8.mask = ~0; + st->iso2022.mask = ~0; +#endif + break; + } + } + } + + if (!n) + return 0; +#ifdef MULE + if (!mask_has_at_most_one_bit_p (st->iso2022.mask)) + st->iso2022.mask = detect_coding_iso2022 (st, src, n); + if (!mask_has_at_most_one_bit_p (st->shift_jis.mask)) + st->shift_jis.mask = detect_coding_sjis (st, src, n); + if (!mask_has_at_most_one_bit_p (st->big5.mask)) + st->big5.mask = detect_coding_big5 (st, src, n); + if (!mask_has_at_most_one_bit_p (st->utf8.mask)) + st->utf8.mask = detect_coding_utf8 (st, src, n); + if (!mask_has_at_most_one_bit_p (st->ucs4.mask)) + st->ucs4.mask = detect_coding_ucs4 (st, src, n); + + st->mask + = st->iso2022.mask | st->shift_jis.mask | st->big5.mask + | st->utf8.mask | st->ucs4.mask; +#endif + { + int retval = mask_has_at_most_one_bit_p (st->mask); + st->mask |= CODING_CATEGORY_NO_CONVERSION_MASK; + return retval && st->eol_type != EOL_AUTODETECT; + } +} + +static Lisp_Object +coding_system_from_mask (int mask) +{ + if (mask == ~0) + { + /* If the file was entirely or basically ASCII, use the + default value of `buffer-file-coding-system'. */ + Lisp_Object retval = + XBUFFER (Vbuffer_defaults)->buffer_file_coding_system; + if (!NILP (retval)) + { + retval = Ffind_coding_system (retval); + if (NILP (retval)) + { + warn_when_safe + (Qbad_variable, Qwarning, + "Invalid `default-buffer-file-coding-system', set to nil"); + XBUFFER (Vbuffer_defaults)->buffer_file_coding_system = Qnil; + } + } + if (NILP (retval)) + retval = Fget_coding_system (Qraw_text); + return retval; + } + else + { + int i; + int cat = -1; +#ifdef MULE + mask = postprocess_iso2022_mask (mask); +#endif + /* Look through the coding categories by priority and find + the first one that is allowed. */ + for (i = 0; i < CODING_CATEGORY_LAST; i++) + { + cat = fcd->coding_category_by_priority[i]; + if ((mask & (1 << cat)) && + !NILP (fcd->coding_category_system[cat])) + break; + } + if (cat >= 0) + return fcd->coding_category_system[cat]; + else + return Fget_coding_system (Qraw_text); + } +} + +/* Given a seekable read stream and potential coding system and EOL type + as specified, do any autodetection that is called for. If the + coding system and/or EOL type are not `autodetect', they will be left + alone; but this function will never return an autodetect coding system + or EOL type. + + This function does not automatically fetch subsidiary coding systems; + that should be unnecessary with the explicit eol-type argument. */ + +#define LENGTH(string_constant) (sizeof (string_constant) - 1) +/* number of leading lines to check for a coding cookie */ +#define LINES_TO_CHECK 2 + +void +determine_real_coding_system (Lstream *stream, Lisp_Object *codesys_in_out, + eol_type_t *eol_type_in_out) +{ + struct detection_state decst; + + if (*eol_type_in_out == EOL_AUTODETECT) + *eol_type_in_out = XCODING_SYSTEM_EOL_TYPE (*codesys_in_out); + + xzero (decst); + decst.eol_type = *eol_type_in_out; + decst.mask = ~0; + + /* If autodetection is called for, do it now. */ + if (XCODING_SYSTEM_TYPE (*codesys_in_out) == CODESYS_AUTODETECT + || *eol_type_in_out == EOL_AUTODETECT) + { + Extbyte buf[4096]; + Lisp_Object coding_system = Qnil; + Extbyte *p; + Lstream_data_count nread = Lstream_read (stream, buf, sizeof (buf)); + Extbyte *scan_end; + int lines_checked = 0; + + /* Look for initial "-*-"; mode line prefix */ + for (p = buf, + scan_end = buf + nread - LENGTH ("-*-coding:?-*-"); + p <= scan_end + && lines_checked < LINES_TO_CHECK; + p++) + if (*p == '-' && *(p+1) == '*' && *(p+2) == '-') + { + Extbyte *local_vars_beg = p + 3; + /* Look for final "-*-"; mode line suffix */ + for (p = local_vars_beg, + scan_end = buf + nread - LENGTH ("-*-"); + p <= scan_end + && lines_checked < LINES_TO_CHECK; + p++) + if (*p == '-' && *(p+1) == '*' && *(p+2) == '-') + { + Extbyte *suffix = p; + /* Look for "coding:" */ + for (p = local_vars_beg, + scan_end = suffix - LENGTH ("coding:?"); + p <= scan_end; + p++) + if (memcmp ("coding:", p, LENGTH ("coding:")) == 0 + && (p == local_vars_beg + || (*(p-1) == ' ' || + *(p-1) == '\t' || + *(p-1) == ';'))) + { + Extbyte save; + int n; + p += LENGTH ("coding:"); + while (*p == ' ' || *p == '\t') p++; + + /* Get coding system name */ + save = *suffix; *suffix = '\0'; + /* Characters valid in a MIME charset name (rfc 1521), + and in a Lisp symbol name. */ + n = strspn ( (char *) p, + "ABCDEFGHIJKLMNOPQRSTUVWXYZ" + "abcdefghijklmnopqrstuvwxyz" + "0123456789" + "!$%&*+-.^_{|}~"); + *suffix = save; + if (n > 0) + { + save = p[n]; p[n] = '\0'; + coding_system = + Ffind_coding_system (intern ((char *) p)); + p[n] = save; + } + break; + } + break; + } + /* #### file must use standard EOLs or we miss 2d line */ + /* #### not to mention this is broken for UTF-16 DOS files */ + else if (*p == '\n' || *p == '\r') + { + lines_checked++; + /* skip past multibyte (DOS) newline */ + if (*p == '\r' && *(p+1) == '\n') p++; + } + break; + } + /* #### file must use standard EOLs or we miss 2d line */ + /* #### not to mention this is broken for UTF-16 DOS files */ + else if (*p == '\n' || *p == '\r') + { + lines_checked++; + /* skip past multibyte (DOS) newline */ + if (*p == '\r' && *(p+1) == '\n') p++; + } + + if (NILP (coding_system)) + do + { + if (detect_coding_type (&decst, buf, nread, + XCODING_SYSTEM_TYPE (*codesys_in_out) + != CODESYS_AUTODETECT)) + break; + nread = Lstream_read (stream, buf, sizeof (buf)); + if (nread == 0) + break; + } + while (1); + + else if (XCODING_SYSTEM_TYPE (*codesys_in_out) == CODESYS_AUTODETECT + && XCODING_SYSTEM_EOL_TYPE (coding_system) == EOL_AUTODETECT) + do + { + if (detect_coding_type (&decst, buf, nread, 1)) + break; + nread = Lstream_read (stream, buf, sizeof (buf)); + if (!nread) + break; + } + while (1); + + *eol_type_in_out = decst.eol_type; + if (XCODING_SYSTEM_TYPE (*codesys_in_out) == CODESYS_AUTODETECT) + { + if (NILP (coding_system)) + *codesys_in_out = coding_system_from_mask (decst.mask); + else + *codesys_in_out = coding_system; + } + } + + /* If we absolutely can't determine the EOL type, just assume LF. */ + if (*eol_type_in_out == EOL_AUTODETECT) + *eol_type_in_out = EOL_LF; + + Lstream_rewind (stream); +} + +DEFUN ("detect-coding-region", Fdetect_coding_region, 2, 3, 0, /* +Detect coding system of the text in the region between START and END. +Return a list of possible coding systems ordered by priority. +If only ASCII characters are found, return 'undecided or one of +its subsidiary coding systems according to a detected end-of-line +type. Optional arg BUFFER defaults to the current buffer. +*/ + (start, end, buffer)) +{ + Lisp_Object val = Qnil; + struct buffer *buf = decode_buffer (buffer, 0); + Bufpos b, e; + Lisp_Object instream, lb_instream; + Lstream *istr, *lb_istr; + struct detection_state decst; + struct gcpro gcpro1, gcpro2; + + get_buffer_range_char (buf, start, end, &b, &e, 0); + lb_instream = make_lisp_buffer_input_stream (buf, b, e, 0); + lb_istr = XLSTREAM (lb_instream); + instream = make_encoding_input_stream (lb_istr, Fget_coding_system (Qbinary)); + istr = XLSTREAM (instream); + GCPRO2 (instream, lb_instream); + xzero (decst); + decst.eol_type = EOL_AUTODETECT; + decst.mask = ~0; + while (1) + { + Extbyte random_buffer[4096]; + Lstream_data_count nread = Lstream_read (istr, random_buffer, sizeof (random_buffer)); + + if (!nread) + break; + if (detect_coding_type (&decst, random_buffer, nread, 0)) + break; + } + + if (decst.mask == ~0) + val = subsidiary_coding_system (Fget_coding_system (Qundecided), + decst.eol_type); + else + { + int i; + + val = Qnil; +#ifdef MULE + decst.mask = postprocess_iso2022_mask (decst.mask); +#endif + for (i = CODING_CATEGORY_LAST - 1; i >= 0; i--) + { + int sys = fcd->coding_category_by_priority[i]; + if (decst.mask & (1 << sys)) + { + Lisp_Object codesys = fcd->coding_category_system[sys]; + if (!NILP (codesys)) + codesys = subsidiary_coding_system (codesys, decst.eol_type); + val = Fcons (codesys, val); + } + } + } + Lstream_close (istr); + UNGCPRO; + Lstream_delete (istr); + Lstream_delete (lb_istr); + return val; +} + + +/************************************************************************/ +/* Converting to internal Mule format ("decoding") */ +/************************************************************************/ + +/* A decoding stream is a stream used for decoding text (i.e. + converting from some external format to internal format). + The decoding-stream object keeps track of the actual coding + stream, the stream that is at the other end, and data that + needs to be persistent across the lifetime of the stream. */ + +/* Handle the EOL stuff related to just-read-in character C. + EOL_TYPE is the EOL type of the coding stream. + FLAGS is the current value of FLAGS in the coding stream, and may + be modified by this macro. (The macro only looks at the + CODING_STATE_CR flag.) DST is the Dynarr to which the decoded + bytes are to be written. You need to also define a local goto + label "label_continue_loop" that is at the end of the main + character-reading loop. + + If C is a CR character, then this macro handles it entirely and + jumps to label_continue_loop. Otherwise, this macro does not add + anything to DST, and continues normally. You should continue + processing C normally after this macro. */ + +#define DECODE_HANDLE_EOL_TYPE(eol_type, c, flags, dst) \ +do { \ + if (c == '\r') \ + { \ + if (eol_type == EOL_CR) \ + Dynarr_add (dst, '\n'); \ + else if (eol_type != EOL_CRLF || flags & CODING_STATE_CR) \ + Dynarr_add (dst, c); \ + else \ + flags |= CODING_STATE_CR; \ + goto label_continue_loop; \ + } \ + else if (flags & CODING_STATE_CR) \ + { /* eol_type == CODING_SYSTEM_EOL_CRLF */ \ + if (c != '\n') \ + Dynarr_add (dst, '\r'); \ + flags &= ~CODING_STATE_CR; \ + } \ +} while (0) + +/* C should be a binary character in the range 0 - 255; convert + to internal format and add to Dynarr DST. */ + +#ifdef UTF2000 +#define DECODE_ADD_BINARY_CHAR(c, dst) \ +do { \ + if (BYTE_ASCII_P (c)) \ + Dynarr_add (dst, c); \ + else \ + { \ + Dynarr_add (dst, (c >> 6) | 0xc0); \ + Dynarr_add (dst, (c & 0x3f) | 0x80); \ + } \ +} while (0) + +INLINE_HEADER void +DECODE_ADD_UCS_CHAR(Emchar c, unsigned_char_dynarr* dst); +INLINE_HEADER void +DECODE_ADD_UCS_CHAR(Emchar c, unsigned_char_dynarr* dst) +{ + if ( c <= 0x7f ) + { + Dynarr_add (dst, c); + } + else if ( c <= 0x7ff ) + { + Dynarr_add (dst, (c >> 6) | 0xc0); + Dynarr_add (dst, (c & 0x3f) | 0x80); + } + else if ( c <= 0xffff ) + { + Dynarr_add (dst, (c >> 12) | 0xe0); + Dynarr_add (dst, ((c >> 6) & 0x3f) | 0x80); + Dynarr_add (dst, (c & 0x3f) | 0x80); + } + else if ( c <= 0x1fffff ) + { + Dynarr_add (dst, (c >> 18) | 0xf0); + Dynarr_add (dst, ((c >> 12) & 0x3f) | 0x80); + Dynarr_add (dst, ((c >> 6) & 0x3f) | 0x80); + Dynarr_add (dst, (c & 0x3f) | 0x80); + } + else if ( c <= 0x3ffffff ) + { + Dynarr_add (dst, (c >> 24) | 0xf8); + Dynarr_add (dst, ((c >> 18) & 0x3f) | 0x80); + Dynarr_add (dst, ((c >> 12) & 0x3f) | 0x80); + Dynarr_add (dst, ((c >> 6) & 0x3f) | 0x80); + Dynarr_add (dst, (c & 0x3f) | 0x80); + } + else + { + Dynarr_add (dst, (c >> 30) | 0xfc); + Dynarr_add (dst, ((c >> 24) & 0x3f) | 0x80); + Dynarr_add (dst, ((c >> 18) & 0x3f) | 0x80); + Dynarr_add (dst, ((c >> 12) & 0x3f) | 0x80); + Dynarr_add (dst, ((c >> 6) & 0x3f) | 0x80); + Dynarr_add (dst, (c & 0x3f) | 0x80); + } +} +#else +#define DECODE_ADD_BINARY_CHAR(c, dst) \ +do { \ + if (BYTE_ASCII_P (c)) \ + Dynarr_add (dst, c); \ + else if (BYTE_C1_P (c)) \ + { \ + Dynarr_add (dst, LEADING_BYTE_CONTROL_1); \ + Dynarr_add (dst, c + 0x20); \ + } \ + else \ + { \ + Dynarr_add (dst, LEADING_BYTE_LATIN_ISO8859_1); \ + Dynarr_add (dst, c); \ + } \ +} while (0) +#endif + +#define DECODE_OUTPUT_PARTIAL_CHAR(ch) \ +do { \ + if (ch) \ + { \ + DECODE_ADD_BINARY_CHAR (ch, dst); \ + ch = 0; \ + } \ +} while (0) + +#define DECODE_HANDLE_END_OF_CONVERSION(flags, ch, dst) \ +do { \ + if (flags & CODING_STATE_END) \ + { \ + DECODE_OUTPUT_PARTIAL_CHAR (ch); \ + if (flags & CODING_STATE_CR) \ + Dynarr_add (dst, '\r'); \ + } \ +} while (0) + +#define DECODING_STREAM_DATA(stream) LSTREAM_TYPE_DATA (stream, decoding) + +struct decoding_stream +{ + /* Coding system that governs the conversion. */ + Lisp_Coding_System *codesys; + + /* Stream that we read the encoded data from or + write the decoded data to. */ + Lstream *other_end; + + /* If we are reading, then we can return only a fixed amount of + data, so if the conversion resulted in too much data, we store it + here for retrieval the next time around. */ + unsigned_char_dynarr *runoff; + + /* FLAGS holds flags indicating the current state of the decoding. + Some of these flags are dependent on the coding system. */ + unsigned int flags; + + /* CH holds a partially built-up character. Since we only deal + with one- and two-byte characters at the moment, we only use + this to store the first byte of a two-byte character. */ + unsigned int ch; + + /* EOL_TYPE specifies the type of end-of-line conversion that + currently applies. We need to keep this separate from the + EOL type stored in CODESYS because the latter might indicate + automatic EOL-type detection while the former will always + indicate a particular EOL type. */ + eol_type_t eol_type; +#ifdef MULE + /* Additional ISO2022 information. We define the structure above + because it's also needed by the detection routines. */ + struct iso2022_decoder iso2022; + + /* Additional information (the state of the running CCL program) + used by the CCL decoder. */ + struct ccl_program ccl; + + /* counter for UTF-8 or UCS-4 */ + unsigned char counter; +#endif + struct detection_state decst; +}; + +static Lstream_data_count decoding_reader (Lstream *stream, + unsigned char *data, Lstream_data_count size); +static Lstream_data_count decoding_writer (Lstream *stream, + const unsigned char *data, Lstream_data_count size); +static int decoding_rewinder (Lstream *stream); +static int decoding_seekable_p (Lstream *stream); +static int decoding_flusher (Lstream *stream); +static int decoding_closer (Lstream *stream); + +static Lisp_Object decoding_marker (Lisp_Object stream); + +DEFINE_LSTREAM_IMPLEMENTATION ("decoding", lstream_decoding, + sizeof (struct decoding_stream)); + +static Lisp_Object +decoding_marker (Lisp_Object stream) +{ + Lstream *str = DECODING_STREAM_DATA (XLSTREAM (stream))->other_end; + Lisp_Object str_obj; + + /* We do not need to mark the coding systems or charsets stored + within the stream because they are stored in a global list + and automatically marked. */ + + XSETLSTREAM (str_obj, str); + mark_object (str_obj); + if (str->imp->marker) + return (str->imp->marker) (str_obj); + else + return Qnil; +} + +/* Read SIZE bytes of data and store it into DATA. We are a decoding stream + so we read data from the other end, decode it, and store it into DATA. */ + +static Lstream_data_count +decoding_reader (Lstream *stream, unsigned char *data, Lstream_data_count size) +{ + struct decoding_stream *str = DECODING_STREAM_DATA (stream); + unsigned char *orig_data = data; + Lstream_data_count read_size; + int error_occurred = 0; + + /* We need to interface to mule_decode(), which expects to take some + amount of data and store the result into a Dynarr. We have + mule_decode() store into str->runoff, and take data from there + as necessary. */ + + /* We loop until we have enough data, reading chunks from the other + end and decoding it. */ + while (1) + { + /* Take data from the runoff if we can. Make sure to take at + most SIZE bytes, and delete the data from the runoff. */ + if (Dynarr_length (str->runoff) > 0) + { + Lstream_data_count chunk = min (size, (Lstream_data_count) Dynarr_length (str->runoff)); + memcpy (data, Dynarr_atp (str->runoff, 0), chunk); + Dynarr_delete_many (str->runoff, 0, chunk); + data += chunk; + size -= chunk; + } + + if (size == 0) + break; /* No more room for data */ + + if (str->flags & CODING_STATE_END) + /* This means that on the previous iteration, we hit the EOF on + the other end. We loop once more so that mule_decode() can + output any final stuff it may be holding, or any "go back + to a sane state" escape sequences. (This latter makes sense + during encoding.) */ + break; + + /* Exhausted the runoff, so get some more. DATA has at least + SIZE bytes left of storage in it, so it's OK to read directly + into it. (We'll be overwriting above, after we've decoded it + into the runoff.) */ + read_size = Lstream_read (str->other_end, data, size); + if (read_size < 0) + { + error_occurred = 1; + break; + } + if (read_size == 0) + /* There might be some more end data produced in the translation. + See the comment above. */ + str->flags |= CODING_STATE_END; + mule_decode (stream, (Extbyte *) data, str->runoff, read_size); + } + + if (data - orig_data == 0) + return error_occurred ? -1 : 0; + else + return data - orig_data; +} + +static Lstream_data_count +decoding_writer (Lstream *stream, const unsigned char *data, Lstream_data_count size) +{ + struct decoding_stream *str = DECODING_STREAM_DATA (stream); + Lstream_data_count retval; + + /* Decode all our data into the runoff, and then attempt to write + it all out to the other end. Remove whatever chunk we succeeded + in writing. */ + mule_decode (stream, (Extbyte *) data, str->runoff, size); + retval = Lstream_write (str->other_end, Dynarr_atp (str->runoff, 0), + Dynarr_length (str->runoff)); + if (retval > 0) + Dynarr_delete_many (str->runoff, 0, retval); + /* Do NOT return retval. The return value indicates how much + of the incoming data was written, not how many bytes were + written. */ + return size; +} + +static void +reset_decoding_stream (struct decoding_stream *str) +{ +#ifdef MULE + if (CODING_SYSTEM_TYPE (str->codesys) == CODESYS_ISO2022) + { + Lisp_Object coding_system; + XSETCODING_SYSTEM (coding_system, str->codesys); + reset_iso2022 (coding_system, &str->iso2022); + } + else if (CODING_SYSTEM_TYPE (str->codesys) == CODESYS_CCL) + { + setup_ccl_program (&str->ccl, CODING_SYSTEM_CCL_DECODE (str->codesys)); + } + str->counter = 0; +#endif /* MULE */ + if (CODING_SYSTEM_TYPE (str->codesys) == CODESYS_AUTODETECT + || CODING_SYSTEM_EOL_TYPE (str->codesys) == EOL_AUTODETECT) + { + xzero (str->decst); + str->decst.eol_type = EOL_AUTODETECT; + str->decst.mask = ~0; + } + str->flags = str->ch = 0; +} + +static int +decoding_rewinder (Lstream *stream) +{ + struct decoding_stream *str = DECODING_STREAM_DATA (stream); + reset_decoding_stream (str); + Dynarr_reset (str->runoff); + return Lstream_rewind (str->other_end); +} + +static int +decoding_seekable_p (Lstream *stream) +{ + struct decoding_stream *str = DECODING_STREAM_DATA (stream); + return Lstream_seekable_p (str->other_end); +} + +static int +decoding_flusher (Lstream *stream) +{ + struct decoding_stream *str = DECODING_STREAM_DATA (stream); + return Lstream_flush (str->other_end); +} + +static int +decoding_closer (Lstream *stream) +{ + struct decoding_stream *str = DECODING_STREAM_DATA (stream); + if (stream->flags & LSTREAM_FL_WRITE) + { + str->flags |= CODING_STATE_END; + decoding_writer (stream, 0, 0); + } + Dynarr_free (str->runoff); +#ifdef MULE +#ifdef ENABLE_COMPOSITE_CHARS + if (str->iso2022.composite_chars) + Dynarr_free (str->iso2022.composite_chars); +#endif +#endif + return Lstream_close (str->other_end); +} + +Lisp_Object +decoding_stream_coding_system (Lstream *stream) +{ + Lisp_Object coding_system; + struct decoding_stream *str = DECODING_STREAM_DATA (stream); + + XSETCODING_SYSTEM (coding_system, str->codesys); + return subsidiary_coding_system (coding_system, str->eol_type); +} + +void +set_decoding_stream_coding_system (Lstream *lstr, Lisp_Object codesys) +{ + Lisp_Coding_System *cs = XCODING_SYSTEM (codesys); + struct decoding_stream *str = DECODING_STREAM_DATA (lstr); + str->codesys = cs; + if (CODING_SYSTEM_EOL_TYPE (cs) != EOL_AUTODETECT) + str->eol_type = CODING_SYSTEM_EOL_TYPE (cs); + reset_decoding_stream (str); +} + +/* WARNING WARNING WARNING WARNING!!!!! If you open up a decoding + stream for writing, no automatic code detection will be performed. + The reason for this is that automatic code detection requires a + seekable input. Things will also fail if you open a decoding + stream for reading using a non-fully-specified coding system and + a non-seekable input stream. */ + +static Lisp_Object +make_decoding_stream_1 (Lstream *stream, Lisp_Object codesys, + const char *mode) +{ + Lstream *lstr = Lstream_new (lstream_decoding, mode); + struct decoding_stream *str = DECODING_STREAM_DATA (lstr); + Lisp_Object obj; + + xzero (*str); + str->other_end = stream; + str->runoff = (unsigned_char_dynarr *) Dynarr_new (unsigned_char); + str->eol_type = EOL_AUTODETECT; + if (!strcmp (mode, "r") + && Lstream_seekable_p (stream)) + /* We can determine the coding system now. */ + determine_real_coding_system (stream, &codesys, &str->eol_type); + set_decoding_stream_coding_system (lstr, codesys); + str->decst.eol_type = str->eol_type; + str->decst.mask = ~0; + XSETLSTREAM (obj, lstr); + return obj; +} + +Lisp_Object +make_decoding_input_stream (Lstream *stream, Lisp_Object codesys) +{ + return make_decoding_stream_1 (stream, codesys, "r"); +} + +Lisp_Object +make_decoding_output_stream (Lstream *stream, Lisp_Object codesys) +{ + return make_decoding_stream_1 (stream, codesys, "w"); +} + +/* Note: the decode_coding_* functions all take the same + arguments as mule_decode(), which is to say some SRC data of + size N, which is to be stored into dynamic array DST. + DECODING is the stream within which the decoding is + taking place, but no data is actually read from or + written to that stream; that is handled in decoding_reader() + or decoding_writer(). This allows the same functions to + be used for both reading and writing. */ + +static void +mule_decode (Lstream *decoding, const Extbyte *src, + unsigned_char_dynarr *dst, Lstream_data_count n) +{ + struct decoding_stream *str = DECODING_STREAM_DATA (decoding); + + /* If necessary, do encoding-detection now. We do this when + we're a writing stream or a non-seekable reading stream, + meaning that we can't just process the whole input, + rewind, and start over. */ + + if (CODING_SYSTEM_TYPE (str->codesys) == CODESYS_AUTODETECT || + str->eol_type == EOL_AUTODETECT) + { + Lisp_Object codesys; + + XSETCODING_SYSTEM (codesys, str->codesys); + detect_coding_type (&str->decst, src, n, + CODING_SYSTEM_TYPE (str->codesys) != + CODESYS_AUTODETECT); + if (CODING_SYSTEM_TYPE (str->codesys) == CODESYS_AUTODETECT && + str->decst.mask != ~0) + /* #### This is cheesy. What we really ought to do is + buffer up a certain amount of data so as to get a + less random result. */ + codesys = coding_system_from_mask (str->decst.mask); + str->eol_type = str->decst.eol_type; + if (XCODING_SYSTEM (codesys) != str->codesys) + { + /* Preserve the CODING_STATE_END flag in case it was set. + If we erase it, bad things might happen. */ + int was_end = str->flags & CODING_STATE_END; + set_decoding_stream_coding_system (decoding, codesys); + if (was_end) + str->flags |= CODING_STATE_END; + } + } + + switch (CODING_SYSTEM_TYPE (str->codesys)) + { +#ifdef DEBUG_XEMACS + case CODESYS_INTERNAL: + Dynarr_add_many (dst, src, n); + break; +#endif + case CODESYS_AUTODETECT: + /* If we got this far and still haven't decided on the coding + system, then do no conversion. */ + case CODESYS_NO_CONVERSION: + decode_coding_no_conversion (decoding, src, dst, n); + break; +#ifdef MULE + case CODESYS_SHIFT_JIS: + decode_coding_sjis (decoding, src, dst, n); + break; + case CODESYS_BIG5: + decode_coding_big5 (decoding, src, dst, n); + break; + case CODESYS_UCS4: + decode_coding_ucs4 (decoding, src, dst, n); + break; + case CODESYS_UTF8: + decode_coding_utf8 (decoding, src, dst, n); + break; + case CODESYS_CCL: + str->ccl.last_block = str->flags & CODING_STATE_END; + /* When applying ccl program to stream, MUST NOT set NULL + pointer to src. */ + ccl_driver (&str->ccl, (src ? (unsigned char *)src : (unsigned char*)""), + dst, n, 0, CCL_MODE_DECODING); + break; + case CODESYS_ISO2022: + decode_coding_iso2022 (decoding, src, dst, n); + break; +#endif /* MULE */ + default: + abort (); + } +} + +DEFUN ("decode-coding-region", Fdecode_coding_region, 3, 4, 0, /* +Decode the text between START and END which is encoded in CODING-SYSTEM. +This is useful if you've read in encoded text from a file without decoding +it (e.g. you read in a JIS-formatted file but used the `binary' or +`no-conversion' coding system, so that it shows up as "^[$B! [ENCODE AS BINARY] + ------> [DECODE AS SPECIFIED] + ------> [BUFFER] + */ + + while (1) + { + char tempbuf[1024]; /* some random amount */ + Bufpos newpos, even_newer_pos; + Bufpos oldpos = lisp_buffer_stream_startpos (istr); + Lstream_data_count size_in_bytes = Lstream_read (istr, tempbuf, sizeof (tempbuf)); + + if (!size_in_bytes) + break; + newpos = lisp_buffer_stream_startpos (istr); + Lstream_write (ostr, tempbuf, size_in_bytes); + even_newer_pos = lisp_buffer_stream_startpos (istr); + buffer_delete_range (buf, even_newer_pos - (newpos - oldpos), + even_newer_pos, 0); + } + Lstream_close (istr); + Lstream_close (ostr); + UNGCPRO; + Lstream_delete (istr); + Lstream_delete (ostr); + Lstream_delete (XLSTREAM (de_outstream)); + Lstream_delete (XLSTREAM (lb_outstream)); + return Qnil; +} + + +/************************************************************************/ +/* Converting to an external encoding ("encoding") */ +/************************************************************************/ + +/* An encoding stream is an output stream. When you create the + stream, you specify the coding system that governs the encoding + and another stream that the resulting encoded data is to be + sent to, and then start sending data to it. */ + +#define ENCODING_STREAM_DATA(stream) LSTREAM_TYPE_DATA (stream, encoding) + +struct encoding_stream +{ + /* Coding system that governs the conversion. */ + Lisp_Coding_System *codesys; + + /* Stream that we read the encoded data from or + write the decoded data to. */ + Lstream *other_end; + + /* If we are reading, then we can return only a fixed amount of + data, so if the conversion resulted in too much data, we store it + here for retrieval the next time around. */ + unsigned_char_dynarr *runoff; + + /* FLAGS holds flags indicating the current state of the encoding. + Some of these flags are dependent on the coding system. */ + unsigned int flags; + + /* CH holds a partially built-up character. Since we only deal + with one- and two-byte characters at the moment, we only use + this to store the first byte of a two-byte character. */ + unsigned int ch; +#ifdef MULE + /* Additional information used by the ISO2022 encoder. */ + struct + { + /* CHARSET holds the character sets currently assigned to the G0 + through G3 registers. It is initialized from the array + INITIAL_CHARSET in CODESYS. */ + Lisp_Object charset[4]; + + /* Which registers are currently invoked into the left (GL) and + right (GR) halves of the 8-bit encoding space? */ + int register_left, register_right; + + /* Whether we need to explicitly designate the charset in the + G? register before using it. It is initialized from the + array FORCE_CHARSET_ON_OUTPUT in CODESYS. */ + unsigned char force_charset_on_output[4]; + + /* Other state variables that need to be preserved across + invocations. */ + Lisp_Object current_charset; + int current_half; + int current_char_boundary; + } iso2022; + + void (*encode_char) (struct encoding_stream *str, Emchar c, + unsigned_char_dynarr *dst, unsigned int *flags); + void (*finish) (struct encoding_stream *str, + unsigned_char_dynarr *dst, unsigned int *flags); + + /* Additional information (the state of the running CCL program) + used by the CCL encoder. */ + struct ccl_program ccl; +#endif /* MULE */ +}; + +static Lstream_data_count encoding_reader (Lstream *stream, unsigned char *data, Lstream_data_count size); +static Lstream_data_count encoding_writer (Lstream *stream, const unsigned char *data, + Lstream_data_count size); +static int encoding_rewinder (Lstream *stream); +static int encoding_seekable_p (Lstream *stream); +static int encoding_flusher (Lstream *stream); +static int encoding_closer (Lstream *stream); + +static Lisp_Object encoding_marker (Lisp_Object stream); + +DEFINE_LSTREAM_IMPLEMENTATION ("encoding", lstream_encoding, + sizeof (struct encoding_stream)); + +static Lisp_Object +encoding_marker (Lisp_Object stream) +{ + Lstream *str = ENCODING_STREAM_DATA (XLSTREAM (stream))->other_end; + Lisp_Object str_obj; + + /* We do not need to mark the coding systems or charsets stored + within the stream because they are stored in a global list + and automatically marked. */ + + XSETLSTREAM (str_obj, str); + mark_object (str_obj); + if (str->imp->marker) + return (str->imp->marker) (str_obj); + else + return Qnil; +} + +/* Read SIZE bytes of data and store it into DATA. We are a encoding stream + so we read data from the other end, encode it, and store it into DATA. */ + +static Lstream_data_count +encoding_reader (Lstream *stream, unsigned char *data, Lstream_data_count size) +{ + struct encoding_stream *str = ENCODING_STREAM_DATA (stream); + unsigned char *orig_data = data; + Lstream_data_count read_size; + int error_occurred = 0; + + /* We need to interface to mule_encode(), which expects to take some + amount of data and store the result into a Dynarr. We have + mule_encode() store into str->runoff, and take data from there + as necessary. */ + + /* We loop until we have enough data, reading chunks from the other + end and encoding it. */ + while (1) + { + /* Take data from the runoff if we can. Make sure to take at + most SIZE bytes, and delete the data from the runoff. */ + if (Dynarr_length (str->runoff) > 0) + { + int chunk = min ((int) size, Dynarr_length (str->runoff)); + memcpy (data, Dynarr_atp (str->runoff, 0), chunk); + Dynarr_delete_many (str->runoff, 0, chunk); + data += chunk; + size -= chunk; + } + + if (size == 0) + break; /* No more room for data */ + + if (str->flags & CODING_STATE_END) + /* This means that on the previous iteration, we hit the EOF on + the other end. We loop once more so that mule_encode() can + output any final stuff it may be holding, or any "go back + to a sane state" escape sequences. (This latter makes sense + during encoding.) */ + break; + + /* Exhausted the runoff, so get some more. DATA at least SIZE bytes + left of storage in it, so it's OK to read directly into it. + (We'll be overwriting above, after we've encoded it into the + runoff.) */ + read_size = Lstream_read (str->other_end, data, size); + if (read_size < 0) + { + error_occurred = 1; + break; + } + if (read_size == 0) + /* There might be some more end data produced in the translation. + See the comment above. */ + str->flags |= CODING_STATE_END; + mule_encode (stream, data, str->runoff, read_size); + } + + if (data == orig_data) + return error_occurred ? -1 : 0; + else + return data - orig_data; +} + +static Lstream_data_count +encoding_writer (Lstream *stream, const unsigned char *data, Lstream_data_count size) +{ + struct encoding_stream *str = ENCODING_STREAM_DATA (stream); + Lstream_data_count retval; + + /* Encode all our data into the runoff, and then attempt to write + it all out to the other end. Remove whatever chunk we succeeded + in writing. */ + mule_encode (stream, data, str->runoff, size); + retval = Lstream_write (str->other_end, Dynarr_atp (str->runoff, 0), + Dynarr_length (str->runoff)); + if (retval > 0) + Dynarr_delete_many (str->runoff, 0, retval); + /* Do NOT return retval. The return value indicates how much + of the incoming data was written, not how many bytes were + written. */ + return size; +} + +static void +reset_encoding_stream (struct encoding_stream *str) +{ +#ifdef MULE + switch (CODING_SYSTEM_TYPE (str->codesys)) + { + case CODESYS_ISO2022: + { + int i; + + str->encode_char = &char_encode_iso2022; + str->finish = &char_finish_iso2022; + for (i = 0; i < 4; i++) + { + str->iso2022.charset[i] = + CODING_SYSTEM_ISO2022_INITIAL_CHARSET (str->codesys, i); + str->iso2022.force_charset_on_output[i] = + CODING_SYSTEM_ISO2022_FORCE_CHARSET_ON_OUTPUT (str->codesys, i); + } + str->iso2022.register_left = 0; + str->iso2022.register_right = 1; + str->iso2022.current_charset = Qnil; + str->iso2022.current_half = 0; + break; + } + case CODESYS_CCL: + setup_ccl_program (&str->ccl, CODING_SYSTEM_CCL_ENCODE (str->codesys)); + break; + case CODESYS_UTF8: + str->encode_char = &char_encode_utf8; + str->finish = &char_finish_utf8; + default: + break; + } +#endif /* MULE */ + str->iso2022.current_char_boundary = 0; + str->flags = str->ch = 0; +} + +static int +encoding_rewinder (Lstream *stream) +{ + struct encoding_stream *str = ENCODING_STREAM_DATA (stream); + reset_encoding_stream (str); + Dynarr_reset (str->runoff); + return Lstream_rewind (str->other_end); +} + +static int +encoding_seekable_p (Lstream *stream) +{ + struct encoding_stream *str = ENCODING_STREAM_DATA (stream); + return Lstream_seekable_p (str->other_end); +} + +static int +encoding_flusher (Lstream *stream) +{ + struct encoding_stream *str = ENCODING_STREAM_DATA (stream); + return Lstream_flush (str->other_end); +} + +static int +encoding_closer (Lstream *stream) +{ + struct encoding_stream *str = ENCODING_STREAM_DATA (stream); + if (stream->flags & LSTREAM_FL_WRITE) + { + str->flags |= CODING_STATE_END; + encoding_writer (stream, 0, 0); + } + Dynarr_free (str->runoff); + return Lstream_close (str->other_end); +} + +Lisp_Object +encoding_stream_coding_system (Lstream *stream) +{ + Lisp_Object coding_system; + struct encoding_stream *str = ENCODING_STREAM_DATA (stream); + + XSETCODING_SYSTEM (coding_system, str->codesys); + return coding_system; +} + +void +set_encoding_stream_coding_system (Lstream *lstr, Lisp_Object codesys) +{ + Lisp_Coding_System *cs = XCODING_SYSTEM (codesys); + struct encoding_stream *str = ENCODING_STREAM_DATA (lstr); + str->codesys = cs; + reset_encoding_stream (str); +} + +static Lisp_Object +make_encoding_stream_1 (Lstream *stream, Lisp_Object codesys, + const char *mode) +{ + Lstream *lstr = Lstream_new (lstream_encoding, mode); + struct encoding_stream *str = ENCODING_STREAM_DATA (lstr); + Lisp_Object obj; + + xzero (*str); + str->runoff = Dynarr_new (unsigned_char); + str->other_end = stream; + set_encoding_stream_coding_system (lstr, codesys); + XSETLSTREAM (obj, lstr); + return obj; +} + +Lisp_Object +make_encoding_input_stream (Lstream *stream, Lisp_Object codesys) +{ + return make_encoding_stream_1 (stream, codesys, "r"); +} + +Lisp_Object +make_encoding_output_stream (Lstream *stream, Lisp_Object codesys) +{ + return make_encoding_stream_1 (stream, codesys, "w"); +} + +/* Convert N bytes of internally-formatted data stored in SRC to an + external format, according to the encoding stream ENCODING. + Store the encoded data into DST. */ + +static void +mule_encode (Lstream *encoding, const Bufbyte *src, + unsigned_char_dynarr *dst, Lstream_data_count n) +{ + struct encoding_stream *str = ENCODING_STREAM_DATA (encoding); + + switch (CODING_SYSTEM_TYPE (str->codesys)) + { +#ifdef DEBUG_XEMACS + case CODESYS_INTERNAL: + Dynarr_add_many (dst, src, n); + break; +#endif + case CODESYS_AUTODETECT: + /* If we got this far and still haven't decided on the coding + system, then do no conversion. */ + case CODESYS_NO_CONVERSION: + encode_coding_no_conversion (encoding, src, dst, n); + break; +#ifdef MULE + case CODESYS_SHIFT_JIS: + encode_coding_sjis (encoding, src, dst, n); + break; + case CODESYS_BIG5: + encode_coding_big5 (encoding, src, dst, n); + break; + case CODESYS_UCS4: + encode_coding_ucs4 (encoding, src, dst, n); + break; + case CODESYS_CCL: + str->ccl.last_block = str->flags & CODING_STATE_END; + /* When applying ccl program to stream, MUST NOT set NULL + pointer to src. */ + ccl_driver (&str->ccl, ((src) ? src : (unsigned char*)""), + dst, n, 0, CCL_MODE_ENCODING); + break; +#endif /* MULE */ + default: + text_encode_generic (encoding, src, dst, n); + } +} + +DEFUN ("encode-coding-region", Fencode_coding_region, 3, 4, 0, /* +Encode the text between START and END using CODING-SYSTEM. +This will, for example, convert Japanese characters into stuff such as +"^[$B! [ENCODE AS SPECIFIED] + ------> [DECODE AS BINARY] + ------> [BUFFER] + */ + while (1) + { + char tempbuf[1024]; /* some random amount */ + Bufpos newpos, even_newer_pos; + Bufpos oldpos = lisp_buffer_stream_startpos (istr); + Lstream_data_count size_in_bytes = Lstream_read (istr, tempbuf, sizeof (tempbuf)); + + if (!size_in_bytes) + break; + newpos = lisp_buffer_stream_startpos (istr); + Lstream_write (ostr, tempbuf, size_in_bytes); + even_newer_pos = lisp_buffer_stream_startpos (istr); + buffer_delete_range (buf, even_newer_pos - (newpos - oldpos), + even_newer_pos, 0); + } + + { + Charcount retlen = + lisp_buffer_stream_startpos (XLSTREAM (instream)) - b; + Lstream_close (istr); + Lstream_close (ostr); + UNGCPRO; + Lstream_delete (istr); + Lstream_delete (ostr); + Lstream_delete (XLSTREAM (de_outstream)); + Lstream_delete (XLSTREAM (lb_outstream)); + return make_int (retlen); + } +} + +#ifdef MULE + +static void +text_encode_generic (Lstream *encoding, const Bufbyte *src, + unsigned_char_dynarr *dst, Lstream_data_count n) +{ + unsigned char c; + unsigned char char_boundary; + struct encoding_stream *str = ENCODING_STREAM_DATA (encoding); + unsigned int flags = str->flags; + Emchar ch = str->ch; + Lisp_Object charset; + int half; + + char_boundary = str->iso2022.current_char_boundary; + charset = str->iso2022.current_charset; + half = str->iso2022.current_half; + + while (n--) + { + c = *src++; + + switch (char_boundary) + { + case 0: + if ( c >= 0xfc ) + { + ch = c & 0x01; + char_boundary = 5; + } + else if ( c >= 0xf8 ) + { + ch = c & 0x03; + char_boundary = 4; + } + else if ( c >= 0xf0 ) + { + ch = c & 0x07; + char_boundary = 3; + } + else if ( c >= 0xe0 ) + { + ch = c & 0x0f; + char_boundary = 2; + } + else if ( c >= 0xc0 ) + { + ch = c & 0x1f; + char_boundary = 1; + } + else + { + (*str->encode_char) (str, c, dst, &flags); + ch = 0; + char_boundary = 0; + } + break; + case 1: + (*str->encode_char) (str, (ch << 6) | (c & 0x3f), dst, &flags); + ch =0; + char_boundary = 0; + break; + default: + ch = ( ch << 6 ) | ( c & 0x3f ); + char_boundary--; + } + } + + if ( (char_boundary == 0) && flags & CODING_STATE_END) + { + (*str->finish) (str, dst, &flags); + } + + str->flags = flags; + str->ch = ch; + str->iso2022.current_char_boundary = char_boundary; + str->iso2022.current_charset = charset; + str->iso2022.current_half = half; + + /* Verbum caro factum est! */ +} + + +/************************************************************************/ +/* Shift-JIS methods */ +/************************************************************************/ + +/* Shift-JIS is a coding system encoding three character sets: ASCII, right + half of JISX0201-Kana, and JISX0208. An ASCII character is encoded + as is. A character of JISX0201-Kana (DIMENSION1_CHARS94 character set) is + encoded by "position-code + 0x80". A character of JISX0208 + (DIMENSION2_CHARS94 character set) is encoded in 2-byte but two + position-codes are divided and shifted so that it fit in the range + below. + + --- CODE RANGE of Shift-JIS --- + (character set) (range) + ASCII 0x00 .. 0x7F + JISX0201-Kana 0xA0 .. 0xDF + JISX0208 (1st byte) 0x80 .. 0x9F and 0xE0 .. 0xEF + (2nd byte) 0x40 .. 0x7E and 0x80 .. 0xFC + ------------------------------- + +*/ + +/* Is this the first byte of a Shift-JIS two-byte char? */ + +#define BYTE_SJIS_TWO_BYTE_1_P(c) \ + (((c) >= 0x81 && (c) <= 0x9F) || ((c) >= 0xE0 && (c) <= 0xEF)) + +/* Is this the second byte of a Shift-JIS two-byte char? */ + +#define BYTE_SJIS_TWO_BYTE_2_P(c) \ + (((c) >= 0x40 && (c) <= 0x7E) || ((c) >= 0x80 && (c) <= 0xFC)) + +#define BYTE_SJIS_KATAKANA_P(c) \ + ((c) >= 0xA1 && (c) <= 0xDF) + +static int +detect_coding_sjis (struct detection_state *st, const Extbyte *src, Lstream_data_count n) +{ + while (n--) + { + unsigned char c = *(unsigned char *)src++; + if (c == ISO_CODE_ESC || c == ISO_CODE_SI || c == ISO_CODE_SO) + return 0; + if (st->shift_jis.in_second_byte) + { + st->shift_jis.in_second_byte = 0; + if (c < 0x40) + return 0; + } + else if ((c >= 0x80 && c < 0xA0) || c >= 0xE0) + st->shift_jis.in_second_byte = 1; + } + return CODING_CATEGORY_SHIFT_JIS_MASK; +} + +/* Convert Shift-JIS data to internal format. */ + +static void +decode_coding_sjis (Lstream *decoding, const Extbyte *src, + unsigned_char_dynarr *dst, Lstream_data_count n) +{ + struct decoding_stream *str = DECODING_STREAM_DATA (decoding); + unsigned int flags = str->flags; + unsigned int ch = str->ch; + eol_type_t eol_type = str->eol_type; + + while (n--) + { + unsigned char c = *(unsigned char *)src++; + + if (ch) + { + /* Previous character was first byte of Shift-JIS Kanji char. */ + if (BYTE_SJIS_TWO_BYTE_2_P (c)) + { + unsigned char e1, e2; + + DECODE_SJIS (ch, c, e1, e2); +#ifdef UTF2000 + DECODE_ADD_UCS_CHAR(MAKE_CHAR(Vcharset_japanese_jisx0208, + e1 & 0x7F, + e2 & 0x7F), dst); +#else + Dynarr_add (dst, LEADING_BYTE_JAPANESE_JISX0208); + Dynarr_add (dst, e1); + Dynarr_add (dst, e2); +#endif + } + else + { + DECODE_ADD_BINARY_CHAR (ch, dst); + DECODE_ADD_BINARY_CHAR (c, dst); + } + ch = 0; + } + else + { + DECODE_HANDLE_EOL_TYPE (eol_type, c, flags, dst); + if (BYTE_SJIS_TWO_BYTE_1_P (c)) + ch = c; + else if (BYTE_SJIS_KATAKANA_P (c)) + { +#ifdef UTF2000 + DECODE_ADD_UCS_CHAR(MAKE_CHAR(Vcharset_katakana_jisx0201, + c & 0x7F, 0), dst); +#else + Dynarr_add (dst, LEADING_BYTE_KATAKANA_JISX0201); + Dynarr_add (dst, c); +#endif + } + else + DECODE_ADD_BINARY_CHAR (c, dst); + } + label_continue_loop:; + } + + DECODE_HANDLE_END_OF_CONVERSION (flags, ch, dst); + + str->flags = flags; + str->ch = ch; +} + +/* Convert internally-formatted data to Shift-JIS. */ + +static void +encode_coding_sjis (Lstream *encoding, const Bufbyte *src, + unsigned_char_dynarr *dst, Lstream_data_count n) +{ + struct encoding_stream *str = ENCODING_STREAM_DATA (encoding); + unsigned int flags = str->flags; + unsigned int ch = str->ch; + eol_type_t eol_type = CODING_SYSTEM_EOL_TYPE (str->codesys); +#ifdef UTF2000 + unsigned char char_boundary = str->iso2022.current_char_boundary; +#endif + + while (n--) + { + Bufbyte c = *src++; +#ifdef UTF2000 + switch (char_boundary) + { + case 0: + if ( c >= 0xfc ) + { + ch = c & 0x01; + char_boundary = 5; + } + else if ( c >= 0xf8 ) + { + ch = c & 0x03; + char_boundary = 4; + } + else if ( c >= 0xf0 ) + { + ch = c & 0x07; + char_boundary = 3; + } + else if ( c >= 0xe0 ) + { + ch = c & 0x0f; + char_boundary = 2; + } + else if ( c >= 0xc0 ) + { + ch = c & 0x1f; + char_boundary = 1; + } + else + { + ch = 0; + if (c == '\n') + { + if (eol_type != EOL_LF && eol_type != EOL_AUTODETECT) + Dynarr_add (dst, '\r'); + if (eol_type != EOL_CR) + Dynarr_add (dst, c); + } + else + Dynarr_add (dst, c); + char_boundary = 0; + } + break; + case 1: + ch = ( ch << 6 ) | ( c & 0x3f ); + { + Lisp_Object charset; + unsigned int c1, c2, s1, s2; + + BREAKUP_CHAR (ch, charset, c1, c2); + if (EQ(charset, Vcharset_katakana_jisx0201)) + { + Dynarr_add (dst, c1 | 0x80); + } + else if (EQ(charset, Vcharset_japanese_jisx0208)) + { + ENCODE_SJIS (c1 | 0x80, c2 | 0x80, s1, s2); + Dynarr_add (dst, s1); + Dynarr_add (dst, s2); + } + } + char_boundary = 0; + break; + default: + ch = ( ch << 6 ) | ( c & 0x3f ); + char_boundary--; + } +#else + if (c == '\n') + { + if (eol_type != EOL_LF && eol_type != EOL_AUTODETECT) + Dynarr_add (dst, '\r'); + if (eol_type != EOL_CR) + Dynarr_add (dst, '\n'); + ch = 0; + } + else if (BYTE_ASCII_P (c)) + { + Dynarr_add (dst, c); + ch = 0; + } + else if (BUFBYTE_LEADING_BYTE_P (c)) + ch = (c == LEADING_BYTE_KATAKANA_JISX0201 || + c == LEADING_BYTE_JAPANESE_JISX0208_1978 || + c == LEADING_BYTE_JAPANESE_JISX0208) ? c : 0; + else if (ch) + { + if (ch == LEADING_BYTE_KATAKANA_JISX0201) + { + Dynarr_add (dst, c); + ch = 0; + } + else if (ch == LEADING_BYTE_JAPANESE_JISX0208_1978 || + ch == LEADING_BYTE_JAPANESE_JISX0208) + ch = c; + else + { + unsigned char j1, j2; + ENCODE_SJIS (ch, c, j1, j2); + Dynarr_add (dst, j1); + Dynarr_add (dst, j2); + ch = 0; + } + } +#endif + } + + str->flags = flags; + str->ch = ch; +#ifdef UTF2000 + str->iso2022.current_char_boundary = char_boundary; +#endif +} + +DEFUN ("decode-shift-jis-char", Fdecode_shift_jis_char, 1, 1, 0, /* +Decode a JISX0208 character of Shift-JIS coding-system. +CODE is the character code in Shift-JIS as a cons of type bytes. +Return the corresponding character. +*/ + (code)) +{ + unsigned char c1, c2, s1, s2; + + CHECK_CONS (code); + CHECK_INT (XCAR (code)); + CHECK_INT (XCDR (code)); + s1 = XINT (XCAR (code)); + s2 = XINT (XCDR (code)); + if (BYTE_SJIS_TWO_BYTE_1_P (s1) && + BYTE_SJIS_TWO_BYTE_2_P (s2)) + { + DECODE_SJIS (s1, s2, c1, c2); + return make_char (MAKE_CHAR (Vcharset_japanese_jisx0208, + c1 & 0x7F, c2 & 0x7F)); + } + else + return Qnil; +} + +DEFUN ("encode-shift-jis-char", Fencode_shift_jis_char, 1, 1, 0, /* +Encode a JISX0208 character CHARACTER to SHIFT-JIS coding-system. +Return the corresponding character code in SHIFT-JIS as a cons of two bytes. +*/ + (character)) +{ + Lisp_Object charset; + int c1, c2, s1, s2; + + CHECK_CHAR_COERCE_INT (character); + BREAKUP_CHAR (XCHAR (character), charset, c1, c2); + if (EQ (charset, Vcharset_japanese_jisx0208)) + { + ENCODE_SJIS (c1 | 0x80, c2 | 0x80, s1, s2); + return Fcons (make_int (s1), make_int (s2)); + } + else + return Qnil; +} + + +/************************************************************************/ +/* Big5 methods */ +/************************************************************************/ + +/* BIG5 is a coding system encoding two character sets: ASCII and + Big5. An ASCII character is encoded as is. Big5 is a two-byte + character set and is encoded in two-byte. + + --- CODE RANGE of BIG5 --- + (character set) (range) + ASCII 0x00 .. 0x7F + Big5 (1st byte) 0xA1 .. 0xFE + (2nd byte) 0x40 .. 0x7E and 0xA1 .. 0xFE + -------------------------- + + Since the number of characters in Big5 is larger than maximum + characters in Emacs' charset (96x96), it can't be handled as one + charset. So, in Emacs, Big5 is divided into two: `charset-big5-1' + and `charset-big5-2'. Both s are DIMENSION2_CHARS94. The former + contains frequently used characters and the latter contains less + frequently used characters. */ + +#define BYTE_BIG5_TWO_BYTE_1_P(c) \ + ((c) >= 0xA1 && (c) <= 0xFE) + +/* Is this the second byte of a Shift-JIS two-byte char? */ + +#define BYTE_BIG5_TWO_BYTE_2_P(c) \ + (((c) >= 0x40 && (c) <= 0x7E) || ((c) >= 0xA1 && (c) <= 0xFE)) + +/* Number of Big5 characters which have the same code in 1st byte. */ + +#define BIG5_SAME_ROW (0xFF - 0xA1 + 0x7F - 0x40) + +/* Code conversion macros. These are macros because they are used in + inner loops during code conversion. + + Note that temporary variables in macros introduce the classic + dynamic-scoping problems with variable names. We use capital- + lettered variables in the assumption that XEmacs does not use + capital letters in variables except in a very formalized way + (e.g. Qstring). */ + +/* Convert Big5 code (b1, b2) into its internal string representation + (lb, c1, c2). */ + +/* There is a much simpler way to split the Big5 charset into two. + For the moment I'm going to leave the algorithm as-is because it + claims to separate out the most-used characters into a single + charset, which perhaps will lead to optimizations in various + places. + + The way the algorithm works is something like this: + + Big5 can be viewed as a 94x157 charset, where the row is + encoded into the bytes 0xA1 .. 0xFE and the column is encoded + into the bytes 0x40 .. 0x7E and 0xA1 .. 0xFE. As for frequency, + the split between low and high column numbers is apparently + meaningless; ascending rows produce less and less frequent chars. + Therefore, we assign the lower half of rows (0xA1 .. 0xC8) to + the first charset, and the upper half (0xC9 .. 0xFE) to the + second. To do the conversion, we convert the character into + a single number where 0 .. 156 is the first row, 157 .. 313 + is the second, etc. That way, the characters are ordered by + decreasing frequency. Then we just chop the space in two + and coerce the result into a 94x94 space. + */ + +#define DECODE_BIG5(b1, b2, lb, c1, c2) do \ +{ \ + int B1 = b1, B2 = b2; \ + unsigned int I \ + = (B1 - 0xA1) * BIG5_SAME_ROW + B2 - (B2 < 0x7F ? 0x40 : 0x62); \ + \ + if (B1 < 0xC9) \ + { \ + lb = LEADING_BYTE_CHINESE_BIG5_1; \ + } \ + else \ + { \ + lb = LEADING_BYTE_CHINESE_BIG5_2; \ + I -= (BIG5_SAME_ROW) * (0xC9 - 0xA1); \ + } \ + c1 = I / (0xFF - 0xA1) + 0xA1; \ + c2 = I % (0xFF - 0xA1) + 0xA1; \ +} while (0) + +/* Convert the internal string representation of a Big5 character + (lb, c1, c2) into Big5 code (b1, b2). */ + +#define ENCODE_BIG5(lb, c1, c2, b1, b2) do \ +{ \ + unsigned int I = ((c1) - 0xA1) * (0xFF - 0xA1) + ((c2) - 0xA1); \ + \ + if (lb == LEADING_BYTE_CHINESE_BIG5_2) \ + { \ + I += BIG5_SAME_ROW * (0xC9 - 0xA1); \ + } \ + b1 = I / BIG5_SAME_ROW + 0xA1; \ + b2 = I % BIG5_SAME_ROW; \ + b2 += b2 < 0x3F ? 0x40 : 0x62; \ +} while (0) + +static int +detect_coding_big5 (struct detection_state *st, const Extbyte *src, Lstream_data_count n) +{ + while (n--) + { + unsigned char c = *(unsigned char *)src++; + if (c == ISO_CODE_ESC || c == ISO_CODE_SI || c == ISO_CODE_SO || + (c >= 0x80 && c <= 0xA0)) + return 0; + if (st->big5.in_second_byte) + { + st->big5.in_second_byte = 0; + if (c < 0x40 || (c >= 0x80 && c <= 0xA0)) + return 0; + } + else if (c >= 0xA1) + st->big5.in_second_byte = 1; + } + return CODING_CATEGORY_BIG5_MASK; +} + +/* Convert Big5 data to internal format. */ + +static void +decode_coding_big5 (Lstream *decoding, const Extbyte *src, + unsigned_char_dynarr *dst, Lstream_data_count n) +{ + struct decoding_stream *str = DECODING_STREAM_DATA (decoding); + unsigned int flags = str->flags; + unsigned int ch = str->ch; + eol_type_t eol_type = str->eol_type; + + while (n--) + { + unsigned char c = *(unsigned char *)src++; + if (ch) + { + /* Previous character was first byte of Big5 char. */ + if (BYTE_BIG5_TWO_BYTE_2_P (c)) + { + unsigned char b1, b2, b3; + DECODE_BIG5 (ch, c, b1, b2, b3); + Dynarr_add (dst, b1); + Dynarr_add (dst, b2); + Dynarr_add (dst, b3); + } + else + { + DECODE_ADD_BINARY_CHAR (ch, dst); + DECODE_ADD_BINARY_CHAR (c, dst); + } + ch = 0; + } + else + { + DECODE_HANDLE_EOL_TYPE (eol_type, c, flags, dst); + if (BYTE_BIG5_TWO_BYTE_1_P (c)) + ch = c; + else + DECODE_ADD_BINARY_CHAR (c, dst); + } + label_continue_loop:; + } + + DECODE_HANDLE_END_OF_CONVERSION (flags, ch, dst); + + str->flags = flags; + str->ch = ch; +} + +/* Convert internally-formatted data to Big5. */ + +static void +encode_coding_big5 (Lstream *encoding, const Bufbyte *src, + unsigned_char_dynarr *dst, Lstream_data_count n) +{ +#ifndef UTF2000 + unsigned char c; + struct encoding_stream *str = ENCODING_STREAM_DATA (encoding); + unsigned int flags = str->flags; + unsigned int ch = str->ch; + eol_type_t eol_type = CODING_SYSTEM_EOL_TYPE (str->codesys); + + while (n--) + { + c = *src++; + if (c == '\n') + { + if (eol_type != EOL_LF && eol_type != EOL_AUTODETECT) + Dynarr_add (dst, '\r'); + if (eol_type != EOL_CR) + Dynarr_add (dst, '\n'); + } + else if (BYTE_ASCII_P (c)) + { + /* ASCII. */ + Dynarr_add (dst, c); + } + else if (BUFBYTE_LEADING_BYTE_P (c)) + { + if (c == LEADING_BYTE_CHINESE_BIG5_1 || + c == LEADING_BYTE_CHINESE_BIG5_2) + { + /* A recognized leading byte. */ + ch = c; + continue; /* not done with this character. */ + } + /* otherwise just ignore this character. */ + } + else if (ch == LEADING_BYTE_CHINESE_BIG5_1 || + ch == LEADING_BYTE_CHINESE_BIG5_2) + { + /* Previous char was a recognized leading byte. */ + ch = (ch << 8) | c; + continue; /* not done with this character. */ + } + else if (ch) + { + /* Encountering second byte of a Big5 character. */ + unsigned char b1, b2; + + ENCODE_BIG5 (ch >> 8, ch & 0xFF, c, b1, b2); + Dynarr_add (dst, b1); + Dynarr_add (dst, b2); + } + + ch = 0; + } + + str->flags = flags; + str->ch = ch; +#endif +} + + +DEFUN ("decode-big5-char", Fdecode_big5_char, 1, 1, 0, /* +Decode a Big5 character CODE of BIG5 coding-system. +CODE is the character code in BIG5, a cons of two integers. +Return the corresponding character. +*/ + (code)) +{ + unsigned char c1, c2, b1, b2; + + CHECK_CONS (code); + CHECK_INT (XCAR (code)); + CHECK_INT (XCDR (code)); + b1 = XINT (XCAR (code)); + b2 = XINT (XCDR (code)); + if (BYTE_BIG5_TWO_BYTE_1_P (b1) && + BYTE_BIG5_TWO_BYTE_2_P (b2)) + { + Charset_ID leading_byte; + Lisp_Object charset; + DECODE_BIG5 (b1, b2, leading_byte, c1, c2); + charset = CHARSET_BY_LEADING_BYTE (leading_byte); + return make_char (MAKE_CHAR (charset, c1 & 0x7F, c2 & 0x7F)); + } + else + return Qnil; +} + +DEFUN ("encode-big5-char", Fencode_big5_char, 1, 1, 0, /* +Encode the Big5 character CHARACTER in the BIG5 coding-system. +Return the corresponding character code in Big5. +*/ + (character)) +{ + Lisp_Object charset; + int c1, c2, b1, b2; + + CHECK_CHAR_COERCE_INT (character); + BREAKUP_CHAR (XCHAR (character), charset, c1, c2); + if (EQ (charset, Vcharset_chinese_big5_1) || + EQ (charset, Vcharset_chinese_big5_2)) + { + ENCODE_BIG5 (XCHARSET_LEADING_BYTE (charset), c1 | 0x80, c2 | 0x80, + b1, b2); + return Fcons (make_int (b1), make_int (b2)); + } + else + return Qnil; +} + + +/************************************************************************/ +/* UCS-4 methods */ +/* */ +/* UCS-4 character codes are implemented as nonnegative integers. */ +/* */ +/************************************************************************/ + + +DEFUN ("set-ucs-char", Fset_ucs_char, 2, 2, 0, /* +Map UCS-4 code CODE to Mule character CHARACTER. + +Return T on success, NIL on failure. +*/ + (code, character)) +{ + size_t c; + + CHECK_CHAR (character); + CHECK_NATNUM (code); + c = XINT (code); + + if (c < countof (fcd->ucs_to_mule_table)) + { + fcd->ucs_to_mule_table[c] = character; + return Qt; + } + else + return Qnil; +} + +static Lisp_Object +ucs_to_char (unsigned long code) +{ + if (code < countof (fcd->ucs_to_mule_table)) + { + return fcd->ucs_to_mule_table[code]; + } + else if ((0xe00000 <= code) && (code <= 0xe00000 + 94 * 94 * 14)) + { + unsigned int c; + + code -= 0xe00000; + c = code % (94 * 94); + return make_char + (MAKE_CHAR (CHARSET_BY_ATTRIBUTES + (CHARSET_TYPE_94X94, code / (94 * 94) + '@', + CHARSET_LEFT_TO_RIGHT), + c / 94 + 33, c % 94 + 33)); + } + else + return Qnil; +} + +DEFUN ("ucs-char", Fucs_char, 1, 1, 0, /* +Return Mule character corresponding to UCS code CODE (a positive integer). +*/ + (code)) +{ + CHECK_NATNUM (code); + return ucs_to_char (XINT (code)); +} + +DEFUN ("set-char-ucs", Fset_char_ucs, 2, 2, 0, /* +Map Mule character CHARACTER to UCS code CODE (a positive integer). +*/ + (character, code)) +{ + /* #### Isn't this gilding the lily? Fput_char_table checks its args. + Fset_char_ucs is more restrictive on index arg, but should + check code arg in a char_table method. */ + CHECK_CHAR (character); + CHECK_NATNUM (code); + return Fput_char_table (character, code, mule_to_ucs_table); +} + +DEFUN ("char-ucs", Fchar_ucs, 1, 1, 0, /* +Return the UCS code (a positive integer) corresponding to CHARACTER. +*/ + (character)) +{ + return Fget_char_table (character, mule_to_ucs_table); +} + +#ifdef UTF2000 +#define decode_ucs4 DECODE_ADD_UCS_CHAR +#else +/* Decode a UCS-4 character into a buffer. If the lookup fails, use + (U+3013) of JIS X 0208, which means correct character + is not found, instead. + #### do something more appropriate (use blob?) + Danger, Will Robinson! Data loss. Should we signal user? */ +static void +decode_ucs4 (unsigned long ch, unsigned_char_dynarr *dst) +{ + Lisp_Object chr = ucs_to_char (ch); + + if (! NILP (chr)) + { + Bufbyte work[MAX_EMCHAR_LEN]; + int len; + + ch = XCHAR (chr); + len = (ch < 128) ? + simple_set_charptr_emchar (work, ch) : + non_ascii_set_charptr_emchar (work, ch); + Dynarr_add_many (dst, work, len); + } + else + { + Dynarr_add (dst, LEADING_BYTE_JAPANESE_JISX0208); + Dynarr_add (dst, 34 + 128); + Dynarr_add (dst, 46 + 128); + } +} +#endif + +static unsigned long +mule_char_to_ucs4 (Lisp_Object charset, + unsigned char h, unsigned char l) +{ + Lisp_Object code + = Fget_char_table (make_char (MAKE_CHAR (charset, h & 127, l & 127)), + mule_to_ucs_table); + + if (INTP (code)) + { + return XINT (code); + } + else if ( (XCHARSET_DIMENSION (charset) == 2) && + (XCHARSET_CHARS (charset) == 94) ) + { + unsigned char final = XCHARSET_FINAL (charset); + + if ( ('@' <= final) && (final < 0x7f) ) + { + return 0xe00000 + (final - '@') * 94 * 94 + + ((h & 127) - 33) * 94 + (l & 127) - 33; + } + else + { + return '?'; + } + } + else + { + return '?'; + } +} + +static void +encode_ucs4 (Lisp_Object charset, + unsigned char h, unsigned char l, unsigned_char_dynarr *dst) +{ + unsigned long code = mule_char_to_ucs4 (charset, h, l); + Dynarr_add (dst, code >> 24); + Dynarr_add (dst, (code >> 16) & 255); + Dynarr_add (dst, (code >> 8) & 255); + Dynarr_add (dst, code & 255); +} + +static int +detect_coding_ucs4 (struct detection_state *st, const Extbyte *src, Lstream_data_count n) +{ + while (n--) + { + unsigned char c = *(unsigned char *)src++; + switch (st->ucs4.in_byte) + { + case 0: + if (c >= 128) + return 0; + else + st->ucs4.in_byte++; + break; + case 3: + st->ucs4.in_byte = 0; + break; + default: + st->ucs4.in_byte++; + } + } + return CODING_CATEGORY_UCS4_MASK; +} + +static void +decode_coding_ucs4 (Lstream *decoding, const Extbyte *src, + unsigned_char_dynarr *dst, Lstream_data_count n) +{ + struct decoding_stream *str = DECODING_STREAM_DATA (decoding); + unsigned int flags = str->flags; + unsigned int ch = str->ch; + unsigned char counter = str->counter; + + while (n--) + { + unsigned char c = *(unsigned char *)src++; + switch (counter) + { + case 0: + ch = c; + counter = 3; + break; + case 1: + decode_ucs4 ( ( ch << 8 ) | c, dst); + ch = 0; + counter = 0; + break; + default: + ch = ( ch << 8 ) | c; + counter--; + } + } + if (counter & CODING_STATE_END) + DECODE_OUTPUT_PARTIAL_CHAR (ch); + + str->flags = flags; + str->ch = ch; + str->counter = counter; +} + +static void +encode_coding_ucs4 (Lstream *encoding, const Bufbyte *src, + unsigned_char_dynarr *dst, Lstream_data_count n) +{ +#ifndef UTF2000 + struct encoding_stream *str = ENCODING_STREAM_DATA (encoding); + unsigned int flags = str->flags; + unsigned int ch = str->ch; + unsigned char char_boundary = str->iso2022.current_char_boundary; + Lisp_Object charset = str->iso2022.current_charset; + +#ifdef ENABLE_COMPOSITE_CHARS + /* flags for handling composite chars. We do a little switcharoo + on the source while we're outputting the composite char. */ + unsigned int saved_n = 0; + const unsigned char *saved_src = NULL; + int in_composite = 0; + + back_to_square_n: +#endif + + while (n--) + { + unsigned char c = *src++; + + if (BYTE_ASCII_P (c)) + { /* Processing ASCII character */ + ch = 0; + encode_ucs4 (Vcharset_ascii, c, 0, dst); + char_boundary = 1; + } + else if (BUFBYTE_LEADING_BYTE_P (c) || BUFBYTE_LEADING_BYTE_P (ch)) + { /* Processing Leading Byte */ + ch = 0; + charset = CHARSET_BY_LEADING_BYTE (c); + if (LEADING_BYTE_PREFIX_P(c)) + ch = c; + char_boundary = 0; + } + else + { /* Processing Non-ASCII character */ + char_boundary = 1; + if (EQ (charset, Vcharset_control_1)) + { + encode_ucs4 (Vcharset_control_1, c, 0, dst); + } + else + { + switch (XCHARSET_REP_BYTES (charset)) + { + case 2: + encode_ucs4 (charset, c, 0, dst); + break; + case 3: + if (XCHARSET_PRIVATE_P (charset)) + { + encode_ucs4 (charset, c, 0, dst); + ch = 0; + } + else if (ch) + { +#ifdef ENABLE_COMPOSITE_CHARS + if (EQ (charset, Vcharset_composite)) + { + if (in_composite) + { + /* #### Bother! We don't know how to + handle this yet. */ + Dynarr_add (dst, '\0'); + Dynarr_add (dst, '\0'); + Dynarr_add (dst, '\0'); + Dynarr_add (dst, '~'); + } + else + { + Emchar emch = MAKE_CHAR (Vcharset_composite, + ch & 0x7F, c & 0x7F); + Lisp_Object lstr = composite_char_string (emch); + saved_n = n; + saved_src = src; + in_composite = 1; + src = XSTRING_DATA (lstr); + n = XSTRING_LENGTH (lstr); + } + } + else +#endif /* ENABLE_COMPOSITE_CHARS */ + { + encode_ucs4(charset, ch, c, dst); + } + ch = 0; + } + else + { + ch = c; + char_boundary = 0; + } + break; + case 4: + if (ch) + { + encode_ucs4 (charset, ch, c, dst); + ch = 0; + } + else + { + ch = c; + char_boundary = 0; + } + break; + default: + abort (); + } + } + } + } + +#ifdef ENABLE_COMPOSITE_CHARS + if (in_composite) + { + n = saved_n; + src = saved_src; + in_composite = 0; + goto back_to_square_n; /* Wheeeeeeeee ..... */ + } +#endif /* ENABLE_COMPOSITE_CHARS */ + + str->flags = flags; + str->ch = ch; + str->iso2022.current_char_boundary = char_boundary; + str->iso2022.current_charset = charset; + + /* Verbum caro factum est! */ +#endif +} + + +/************************************************************************/ +/* UTF-8 methods */ +/************************************************************************/ + +static int +detect_coding_utf8 (struct detection_state *st, const Extbyte *src, Lstream_data_count n) +{ + while (n--) + { + unsigned char c = *(unsigned char *)src++; + switch (st->utf8.in_byte) + { + case 0: + if (c == ISO_CODE_ESC || c == ISO_CODE_SI || c == ISO_CODE_SO) + return 0; + else if (c >= 0xfc) + st->utf8.in_byte = 5; + else if (c >= 0xf8) + st->utf8.in_byte = 4; + else if (c >= 0xf0) + st->utf8.in_byte = 3; + else if (c >= 0xe0) + st->utf8.in_byte = 2; + else if (c >= 0xc0) + st->utf8.in_byte = 1; + else if (c >= 0x80) + return 0; + break; + default: + if ((c & 0xc0) != 0x80) + return 0; + else + st->utf8.in_byte--; + } + } + return CODING_CATEGORY_UTF8_MASK; +} + +static void +decode_coding_utf8 (Lstream *decoding, const Extbyte *src, + unsigned_char_dynarr *dst, Lstream_data_count n) +{ + struct decoding_stream *str = DECODING_STREAM_DATA (decoding); + unsigned int flags = str->flags; + unsigned int ch = str->ch; + eol_type_t eol_type = str->eol_type; + unsigned char counter = str->counter; + + while (n--) + { + unsigned char c = *(unsigned char *)src++; + switch (counter) + { + case 0: + if ( c >= 0xfc ) + { + ch = c & 0x01; + counter = 5; + } + else if ( c >= 0xf8 ) + { + ch = c & 0x03; + counter = 4; + } + else if ( c >= 0xf0 ) + { + ch = c & 0x07; + counter = 3; + } + else if ( c >= 0xe0 ) + { + ch = c & 0x0f; + counter = 2; + } + else if ( c >= 0xc0 ) + { + ch = c & 0x1f; + counter = 1; + } + else + { + DECODE_HANDLE_EOL_TYPE (eol_type, c, flags, dst); + decode_ucs4 (c, dst); + } + break; + case 1: + ch = ( ch << 6 ) | ( c & 0x3f ); + decode_ucs4 (ch, dst); + ch = 0; + counter = 0; + break; + default: + ch = ( ch << 6 ) | ( c & 0x3f ); + counter--; + } + label_continue_loop:; + } + + if (flags & CODING_STATE_END) + DECODE_OUTPUT_PARTIAL_CHAR (ch); + + str->flags = flags; + str->ch = ch; + str->counter = counter; +} + +void +char_encode_utf8 (struct encoding_stream *str, Emchar code, + unsigned_char_dynarr *dst, unsigned int *flags) +{ + if ( code <= 0x7f ) + { + Dynarr_add (dst, code); + } + else if ( code <= 0x7ff ) + { + Dynarr_add (dst, (code >> 6) | 0xc0); + Dynarr_add (dst, (code & 0x3f) | 0x80); + } + else if ( code <= 0xffff ) + { + Dynarr_add (dst, (code >> 12) | 0xe0); + Dynarr_add (dst, ((code >> 6) & 0x3f) | 0x80); + Dynarr_add (dst, (code & 0x3f) | 0x80); + } + else if ( code <= 0x1fffff ) + { + Dynarr_add (dst, (code >> 18) | 0xf0); + Dynarr_add (dst, ((code >> 12) & 0x3f) | 0x80); + Dynarr_add (dst, ((code >> 6) & 0x3f) | 0x80); + Dynarr_add (dst, (code & 0x3f) | 0x80); + } + else if ( code <= 0x3ffffff ) + { + Dynarr_add (dst, (code >> 24) | 0xf8); + Dynarr_add (dst, ((code >> 18) & 0x3f) | 0x80); + Dynarr_add (dst, ((code >> 12) & 0x3f) | 0x80); + Dynarr_add (dst, ((code >> 6) & 0x3f) | 0x80); + Dynarr_add (dst, (code & 0x3f) | 0x80); + } + else + { + Dynarr_add (dst, (code >> 30) | 0xfc); + Dynarr_add (dst, ((code >> 24) & 0x3f) | 0x80); + Dynarr_add (dst, ((code >> 18) & 0x3f) | 0x80); + Dynarr_add (dst, ((code >> 12) & 0x3f) | 0x80); + Dynarr_add (dst, ((code >> 6) & 0x3f) | 0x80); + Dynarr_add (dst, (code & 0x3f) | 0x80); + } +} + +void +char_finish_utf8 (struct encoding_stream *str, unsigned_char_dynarr *dst, + unsigned int *flags) +{ +} + + +/************************************************************************/ +/* ISO2022 methods */ +/************************************************************************/ + +/* The following note describes the coding system ISO2022 briefly. + Since the intention of this note is to help understand the + functions in this file, some parts are NOT ACCURATE or OVERLY + SIMPLIFIED. For thorough understanding, please refer to the + original document of ISO2022. + + ISO2022 provides many mechanisms to encode several character sets + in 7-bit and 8-bit environments. For 7-bit environments, all text + is encoded using bytes less than 128. This may make the encoded + text a little bit longer, but the text passes more easily through + several gateways, some of which strip off MSB (Most Signigant Bit). + + There are two kinds of character sets: control character set and + graphic character set. The former contains control characters such + as `newline' and `escape' to provide control functions (control + functions are also provided by escape sequences). The latter + contains graphic characters such as 'A' and '-'. Emacs recognizes + two control character sets and many graphic character sets. + + Graphic character sets are classified into one of the following + four classes, according to the number of bytes (DIMENSION) and + number of characters in one dimension (CHARS) of the set: + - DIMENSION1_CHARS94 + - DIMENSION1_CHARS96 + - DIMENSION2_CHARS94 + - DIMENSION2_CHARS96 + + In addition, each character set is assigned an identification tag, + unique for each set, called "final character" (denoted as + hereafter). The of each character set is decided by ECMA(*) + when it is registered in ISO. The code range of is 0x30..0x7F + (0x30..0x3F are for private use only). + + Note (*): ECMA = European Computer Manufacturers Association + + Here are examples of graphic character set [NAME()]: + o DIMENSION1_CHARS94 -- ASCII('B'), right-half-of-JISX0201('I'), ... + o DIMENSION1_CHARS96 -- right-half-of-ISO8859-1('A'), ... + o DIMENSION2_CHARS94 -- GB2312('A'), JISX0208('B'), ... + o DIMENSION2_CHARS96 -- none for the moment + + A code area (1 byte = 8 bits) is divided into 4 areas, C0, GL, C1, and GR. + C0 [0x00..0x1F] -- control character plane 0 + GL [0x20..0x7F] -- graphic character plane 0 + C1 [0x80..0x9F] -- control character plane 1 + GR [0xA0..0xFF] -- graphic character plane 1 + + A control character set is directly designated and invoked to C0 or + C1 by an escape sequence. The most common case is that: + - ISO646's control character set is designated/invoked to C0, and + - ISO6429's control character set is designated/invoked to C1, + and usually these designations/invocations are omitted in encoded + text. In a 7-bit environment, only C0 can be used, and a control + character for C1 is encoded by an appropriate escape sequence to + fit into the environment. All control characters for C1 are + defined to have corresponding escape sequences. + + A graphic character set is at first designated to one of four + graphic registers (G0 through G3), then these graphic registers are + invoked to GL or GR. These designations and invocations can be + done independently. The most common case is that G0 is invoked to + GL, G1 is invoked to GR, and ASCII is designated to G0. Usually + these invocations and designations are omitted in encoded text. + In a 7-bit environment, only GL can be used. + + When a graphic character set of CHARS94 is invoked to GL, codes + 0x20 and 0x7F of the GL area work as control characters SPACE and + DEL respectively, and codes 0xA0 and 0xFF of the GR area should not + be used. + + There are two ways of invocation: locking-shift and single-shift. + With locking-shift, the invocation lasts until the next different + invocation, whereas with single-shift, the invocation affects the + following character only and doesn't affect the locking-shift + state. Invocations are done by the following control characters or + escape sequences: + + ---------------------------------------------------------------------- + abbrev function cntrl escape seq description + ---------------------------------------------------------------------- + SI/LS0 (shift-in) 0x0F none invoke G0 into GL + SO/LS1 (shift-out) 0x0E none invoke G1 into GL + LS2 (locking-shift-2) none ESC 'n' invoke G2 into GL + LS3 (locking-shift-3) none ESC 'o' invoke G3 into GL + LS1R (locking-shift-1 right) none ESC '~' invoke G1 into GR (*) + LS2R (locking-shift-2 right) none ESC '}' invoke G2 into GR (*) + LS3R (locking-shift 3 right) none ESC '|' invoke G3 into GR (*) + SS2 (single-shift-2) 0x8E ESC 'N' invoke G2 for one char + SS3 (single-shift-3) 0x8F ESC 'O' invoke G3 for one char + ---------------------------------------------------------------------- + (*) These are not used by any known coding system. + + Control characters for these functions are defined by macros + ISO_CODE_XXX in `coding.h'. + + Designations are done by the following escape sequences: + ---------------------------------------------------------------------- + escape sequence description + ---------------------------------------------------------------------- + ESC '(' designate DIMENSION1_CHARS94 to G0 + ESC ')' designate DIMENSION1_CHARS94 to G1 + ESC '*' designate DIMENSION1_CHARS94 to G2 + ESC '+' designate DIMENSION1_CHARS94 to G3 + ESC ',' designate DIMENSION1_CHARS96 to G0 (*) + ESC '-' designate DIMENSION1_CHARS96 to G1 + ESC '.' designate DIMENSION1_CHARS96 to G2 + ESC '/' designate DIMENSION1_CHARS96 to G3 + ESC '$' '(' designate DIMENSION2_CHARS94 to G0 (**) + ESC '$' ')' designate DIMENSION2_CHARS94 to G1 + ESC '$' '*' designate DIMENSION2_CHARS94 to G2 + ESC '$' '+' designate DIMENSION2_CHARS94 to G3 + ESC '$' ',' designate DIMENSION2_CHARS96 to G0 (*) + ESC '$' '-' designate DIMENSION2_CHARS96 to G1 + ESC '$' '.' designate DIMENSION2_CHARS96 to G2 + ESC '$' '/' designate DIMENSION2_CHARS96 to G3 + ---------------------------------------------------------------------- + + In this list, "DIMENSION1_CHARS94" means a graphic character set + of dimension 1, chars 94, and final character , etc... + + Note (*): Although these designations are not allowed in ISO2022, + Emacs accepts them on decoding, and produces them on encoding + CHARS96 character sets in a coding system which is characterized as + 7-bit environment, non-locking-shift, and non-single-shift. + + Note (**): If is '@', 'A', or 'B', the intermediate character + '(' can be omitted. We refer to this as "short-form" hereafter. + + Now you may notice that there are a lot of ways for encoding the + same multilingual text in ISO2022. Actually, there exist many + coding systems such as Compound Text (used in X11's inter client + communication, ISO-2022-JP (used in Japanese internet), ISO-2022-KR + (used in Korean internet), EUC (Extended UNIX Code, used in Asian + localized platforms), and all of these are variants of ISO2022. + + In addition to the above, Emacs handles two more kinds of escape + sequences: ISO6429's direction specification and Emacs' private + sequence for specifying character composition. + + ISO6429's direction specification takes the following form: + o CSI ']' -- end of the current direction + o CSI '0' ']' -- end of the current direction + o CSI '1' ']' -- start of left-to-right text + o CSI '2' ']' -- start of right-to-left text + The control character CSI (0x9B: control sequence introducer) is + abbreviated to the escape sequence ESC '[' in a 7-bit environment. + + Character composition specification takes the following form: + o ESC '0' -- start character composition + o ESC '1' -- end character composition + Since these are not standard escape sequences of any ISO standard, + their use with these meanings is restricted to Emacs only. */ + +static void +reset_iso2022 (Lisp_Object coding_system, struct iso2022_decoder *iso) +{ + int i; + + for (i = 0; i < 4; i++) + { + if (!NILP (coding_system)) + iso->charset[i] = + XCODING_SYSTEM_ISO2022_INITIAL_CHARSET (coding_system, i); + else + iso->charset[i] = Qt; + iso->invalid_designated[i] = 0; + } + iso->esc = ISO_ESC_NOTHING; + iso->esc_bytes_index = 0; + iso->register_left = 0; + iso->register_right = 1; + iso->switched_dir_and_no_valid_charset_yet = 0; + iso->invalid_switch_dir = 0; + iso->output_direction_sequence = 0; + iso->output_literally = 0; +#ifdef ENABLE_COMPOSITE_CHARS + if (iso->composite_chars) + Dynarr_reset (iso->composite_chars); +#endif +} + +static int +fit_to_be_escape_quoted (unsigned char c) +{ + switch (c) + { + case ISO_CODE_ESC: + case ISO_CODE_CSI: + case ISO_CODE_SS2: + case ISO_CODE_SS3: + case ISO_CODE_SO: + case ISO_CODE_SI: + return 1; + + default: + return 0; + } +} + +/* Parse one byte of an ISO2022 escape sequence. + If the result is an invalid escape sequence, return 0 and + do not change anything in STR. Otherwise, if the result is + an incomplete escape sequence, update ISO2022.ESC and + ISO2022.ESC_BYTES and return -1. Otherwise, update + all the state variables (but not ISO2022.ESC_BYTES) and + return 1. + + If CHECK_INVALID_CHARSETS is non-zero, check for designation + or invocation of an invalid character set and treat that as + an unrecognized escape sequence. */ + +static int +parse_iso2022_esc (Lisp_Object codesys, struct iso2022_decoder *iso, + unsigned char c, unsigned int *flags, + int check_invalid_charsets) +{ + /* (1) If we're at the end of a designation sequence, CS is the + charset being designated and REG is the register to designate + it to. + + (2) If we're at the end of a locking-shift sequence, REG is + the register to invoke and HALF (0 == left, 1 == right) is + the half to invoke it into. + + (3) If we're at the end of a single-shift sequence, REG is + the register to invoke. */ + Lisp_Object cs = Qnil; + int reg, half; + + /* NOTE: This code does goto's all over the fucking place. + The reason for this is that we're basically implementing + a state machine here, and hierarchical languages like C + don't really provide a clean way of doing this. */ + + if (! (*flags & CODING_STATE_ESCAPE)) + /* At beginning of escape sequence; we need to reset our + escape-state variables. */ + iso->esc = ISO_ESC_NOTHING; + + iso->output_literally = 0; + iso->output_direction_sequence = 0; + + switch (iso->esc) + { + case ISO_ESC_NOTHING: + iso->esc_bytes_index = 0; + switch (c) + { + case ISO_CODE_ESC: /* Start escape sequence */ + *flags |= CODING_STATE_ESCAPE; + iso->esc = ISO_ESC; + goto not_done; + + case ISO_CODE_CSI: /* ISO6429 (specifying directionality) */ + *flags |= CODING_STATE_ESCAPE; + iso->esc = ISO_ESC_5_11; + goto not_done; + + case ISO_CODE_SO: /* locking shift 1 */ + reg = 1; half = 0; + goto locking_shift; + case ISO_CODE_SI: /* locking shift 0 */ + reg = 0; half = 0; + goto locking_shift; + + case ISO_CODE_SS2: /* single shift */ + reg = 2; + goto single_shift; + case ISO_CODE_SS3: /* single shift */ + reg = 3; + goto single_shift; + + default: /* Other control characters */ + return 0; + } + + case ISO_ESC: + switch (c) + { + /**** single shift ****/ + + case 'N': /* single shift 2 */ + reg = 2; + goto single_shift; + case 'O': /* single shift 3 */ + reg = 3; + goto single_shift; + + /**** locking shift ****/ + + case '~': /* locking shift 1 right */ + reg = 1; half = 1; + goto locking_shift; + case 'n': /* locking shift 2 */ + reg = 2; half = 0; + goto locking_shift; + case '}': /* locking shift 2 right */ + reg = 2; half = 1; + goto locking_shift; + case 'o': /* locking shift 3 */ + reg = 3; half = 0; + goto locking_shift; + case '|': /* locking shift 3 right */ + reg = 3; half = 1; + goto locking_shift; + +#ifdef ENABLE_COMPOSITE_CHARS + /**** composite ****/ + + case '0': + iso->esc = ISO_ESC_START_COMPOSITE; + *flags = (*flags & CODING_STATE_ISO2022_LOCK) | + CODING_STATE_COMPOSITE; + return 1; + + case '1': + iso->esc = ISO_ESC_END_COMPOSITE; + *flags = (*flags & CODING_STATE_ISO2022_LOCK) & + ~CODING_STATE_COMPOSITE; + return 1; +#endif /* ENABLE_COMPOSITE_CHARS */ + + /**** directionality ****/ + + case '[': + iso->esc = ISO_ESC_5_11; + goto not_done; + + /**** designation ****/ + + case '$': /* multibyte charset prefix */ + iso->esc = ISO_ESC_2_4; + goto not_done; + + default: + if (0x28 <= c && c <= 0x2F) + { + iso->esc = (enum iso_esc_flag) (c - 0x28 + ISO_ESC_2_8); + goto not_done; + } + + /* This function is called with CODESYS equal to nil when + doing coding-system detection. */ + if (!NILP (codesys) + && XCODING_SYSTEM_ISO2022_ESCAPE_QUOTED (codesys) + && fit_to_be_escape_quoted (c)) + { + iso->esc = ISO_ESC_LITERAL; + *flags &= CODING_STATE_ISO2022_LOCK; + return 1; + } + + /* bzzzt! */ + return 0; + } + + + + /**** directionality ****/ + + case ISO_ESC_5_11: /* ISO6429 direction control */ + if (c == ']') + { + *flags &= (CODING_STATE_ISO2022_LOCK & ~CODING_STATE_R2L); + goto directionality; + } + if (c == '0') iso->esc = ISO_ESC_5_11_0; + else if (c == '1') iso->esc = ISO_ESC_5_11_1; + else if (c == '2') iso->esc = ISO_ESC_5_11_2; + else return 0; + goto not_done; + + case ISO_ESC_5_11_0: + if (c == ']') + { + *flags &= (CODING_STATE_ISO2022_LOCK & ~CODING_STATE_R2L); + goto directionality; + } + return 0; + + case ISO_ESC_5_11_1: + if (c == ']') + { + *flags = (CODING_STATE_ISO2022_LOCK & ~CODING_STATE_R2L); + goto directionality; + } + return 0; + + case ISO_ESC_5_11_2: + if (c == ']') + { + *flags = (*flags & CODING_STATE_ISO2022_LOCK) | CODING_STATE_R2L; + goto directionality; + } + return 0; + + directionality: + iso->esc = ISO_ESC_DIRECTIONALITY; + /* Various junk here to attempt to preserve the direction sequences + literally in the text if they would otherwise be swallowed due + to invalid designations that don't show up as actual charset + changes in the text. */ + if (iso->invalid_switch_dir) + { + /* We already inserted a direction switch literally into the + text. We assume (#### this may not be right) that the + next direction switch is the one going the other way, + and we need to output that literally as well. */ + iso->output_literally = 1; + iso->invalid_switch_dir = 0; + } + else + { + int jj; + + /* If we are in the thrall of an invalid designation, + then stick the directionality sequence literally into the + output stream so it ends up in the original text again. */ + for (jj = 0; jj < 4; jj++) + if (iso->invalid_designated[jj]) + break; + if (jj < 4) + { + iso->output_literally = 1; + iso->invalid_switch_dir = 1; + } + else + /* Indicate that we haven't yet seen a valid designation, + so that if a switch-dir is directly followed by an + invalid designation, both get inserted literally. */ + iso->switched_dir_and_no_valid_charset_yet = 1; + } + return 1; + + + /**** designation ****/ + + case ISO_ESC_2_4: + if (0x28 <= c && c <= 0x2F) + { + iso->esc = (enum iso_esc_flag) (c - 0x28 + ISO_ESC_2_4_8); + goto not_done; + } + if (0x40 <= c && c <= 0x42) + { + cs = CHARSET_BY_ATTRIBUTES (CHARSET_TYPE_94X94, c, + *flags & CODING_STATE_R2L ? + CHARSET_RIGHT_TO_LEFT : + CHARSET_LEFT_TO_RIGHT); + reg = 0; + goto designated; + } + return 0; + + default: + { + int type =-1; + + if (c < '0' || c > '~') + return 0; /* bad final byte */ + + if (iso->esc >= ISO_ESC_2_8 && + iso->esc <= ISO_ESC_2_15) + { + type = ((iso->esc >= ISO_ESC_2_12) ? + CHARSET_TYPE_96 : CHARSET_TYPE_94); + reg = (iso->esc - ISO_ESC_2_8) & 3; + } + else if (iso->esc >= ISO_ESC_2_4_8 && + iso->esc <= ISO_ESC_2_4_15) + { + type = ((iso->esc >= ISO_ESC_2_4_12) ? + CHARSET_TYPE_96X96 : CHARSET_TYPE_94X94); + reg = (iso->esc - ISO_ESC_2_4_8) & 3; + } + else + { + /* Can this ever be reached? -slb */ + abort(); + return 0; + } + + cs = CHARSET_BY_ATTRIBUTES (type, c, + *flags & CODING_STATE_R2L ? + CHARSET_RIGHT_TO_LEFT : + CHARSET_LEFT_TO_RIGHT); + goto designated; + } + } + + not_done: + iso->esc_bytes[iso->esc_bytes_index++] = (unsigned char) c; + return -1; + + single_shift: + if (check_invalid_charsets && !CHARSETP (iso->charset[reg])) + /* can't invoke something that ain't there. */ + return 0; + iso->esc = ISO_ESC_SINGLE_SHIFT; + *flags &= CODING_STATE_ISO2022_LOCK; + if (reg == 2) + *flags |= CODING_STATE_SS2; + else + *flags |= CODING_STATE_SS3; + return 1; + + locking_shift: + if (check_invalid_charsets && + !CHARSETP (iso->charset[reg])) + /* can't invoke something that ain't there. */ + return 0; + if (half) + iso->register_right = reg; + else + iso->register_left = reg; + *flags &= CODING_STATE_ISO2022_LOCK; + iso->esc = ISO_ESC_LOCKING_SHIFT; + return 1; + + designated: + if (NILP (cs) && check_invalid_charsets) + { + iso->invalid_designated[reg] = 1; + iso->charset[reg] = Vcharset_ascii; + iso->esc = ISO_ESC_DESIGNATE; + *flags &= CODING_STATE_ISO2022_LOCK; + iso->output_literally = 1; + if (iso->switched_dir_and_no_valid_charset_yet) + { + /* We encountered a switch-direction followed by an + invalid designation. Ensure that the switch-direction + gets outputted; otherwise it will probably get eaten + when the text is written out again. */ + iso->switched_dir_and_no_valid_charset_yet = 0; + iso->output_direction_sequence = 1; + /* And make sure that the switch-dir going the other + way gets outputted, as well. */ + iso->invalid_switch_dir = 1; + } + return 1; + } + /* This function is called with CODESYS equal to nil when + doing coding-system detection. */ + if (!NILP (codesys)) + { + charset_conversion_spec_dynarr *dyn = + XCODING_SYSTEM (codesys)->iso2022.input_conv; + + if (dyn) + { + int i; + + for (i = 0; i < Dynarr_length (dyn); i++) + { + struct charset_conversion_spec *spec = Dynarr_atp (dyn, i); + if (EQ (cs, spec->from_charset)) + cs = spec->to_charset; + } + } + } + + iso->charset[reg] = cs; + iso->esc = ISO_ESC_DESIGNATE; + *flags &= CODING_STATE_ISO2022_LOCK; + if (iso->invalid_designated[reg]) + { + iso->invalid_designated[reg] = 0; + iso->output_literally = 1; + } + if (iso->switched_dir_and_no_valid_charset_yet) + iso->switched_dir_and_no_valid_charset_yet = 0; + return 1; +} + +static int +detect_coding_iso2022 (struct detection_state *st, const Extbyte *src, Lstream_data_count n) +{ + int mask; + + /* #### There are serious deficiencies in the recognition mechanism + here. This needs to be much smarter if it's going to cut it. + The sequence "\xff\x0f" is currently detected as LOCK_SHIFT while + it should be detected as Latin-1. + All the ISO2022 stuff in this file should be synced up with the + code from FSF Emacs-20.4, in which Mule should be more or less stable. + Perhaps we should wait till R2L works in FSF Emacs? */ + + if (!st->iso2022.initted) + { + reset_iso2022 (Qnil, &st->iso2022.iso); + st->iso2022.mask = (CODING_CATEGORY_ISO_7_MASK | + CODING_CATEGORY_ISO_8_DESIGNATE_MASK | + CODING_CATEGORY_ISO_8_1_MASK | + CODING_CATEGORY_ISO_8_2_MASK | + CODING_CATEGORY_ISO_LOCK_SHIFT_MASK); + st->iso2022.flags = 0; + st->iso2022.high_byte_count = 0; + st->iso2022.saw_single_shift = 0; + st->iso2022.initted = 1; + } + + mask = st->iso2022.mask; + + while (n--) + { + unsigned char c = *(unsigned char *)src++; + if (c >= 0xA0) + { + mask &= ~CODING_CATEGORY_ISO_7_MASK; + st->iso2022.high_byte_count++; + } + else + { + if (st->iso2022.high_byte_count && !st->iso2022.saw_single_shift) + { + if (st->iso2022.high_byte_count & 1) + /* odd number of high bytes; assume not iso-8-2 */ + mask &= ~CODING_CATEGORY_ISO_8_2_MASK; + } + st->iso2022.high_byte_count = 0; + st->iso2022.saw_single_shift = 0; + if (c > 0x80) + mask &= ~CODING_CATEGORY_ISO_7_MASK; + } + if (!(st->iso2022.flags & CODING_STATE_ESCAPE) + && (BYTE_C0_P (c) || BYTE_C1_P (c))) + { /* control chars */ + switch (c) + { + /* Allow and ignore control characters that you might + reasonably see in a text file */ + case '\r': + case '\n': + case '\t': + case 7: /* bell */ + case 8: /* backspace */ + case 11: /* vertical tab */ + case 12: /* form feed */ + case 26: /* MS-DOS C-z junk */ + case 31: /* '^_' -- for info */ + goto label_continue_loop; + + default: + break; + } + } + + if ((st->iso2022.flags & CODING_STATE_ESCAPE) || BYTE_C0_P (c) + || BYTE_C1_P (c)) + { + if (parse_iso2022_esc (Qnil, &st->iso2022.iso, c, + &st->iso2022.flags, 0)) + { + switch (st->iso2022.iso.esc) + { + case ISO_ESC_DESIGNATE: + mask &= ~CODING_CATEGORY_ISO_8_1_MASK; + mask &= ~CODING_CATEGORY_ISO_8_2_MASK; + break; + case ISO_ESC_LOCKING_SHIFT: + mask = CODING_CATEGORY_ISO_LOCK_SHIFT_MASK; + goto ran_out_of_chars; + case ISO_ESC_SINGLE_SHIFT: + mask &= ~CODING_CATEGORY_ISO_8_DESIGNATE_MASK; + st->iso2022.saw_single_shift = 1; + break; + default: + break; + } + } + else + { + mask = 0; + goto ran_out_of_chars; + } + } + label_continue_loop:; + } + + ran_out_of_chars: + + return mask; +} + +static int +postprocess_iso2022_mask (int mask) +{ + /* #### kind of cheesy */ + /* If seven-bit ISO is allowed, then assume that the encoding is + entirely seven-bit and turn off the eight-bit ones. */ + if (mask & CODING_CATEGORY_ISO_7_MASK) + mask &= ~ (CODING_CATEGORY_ISO_8_DESIGNATE_MASK | + CODING_CATEGORY_ISO_8_1_MASK | + CODING_CATEGORY_ISO_8_2_MASK); + return mask; +} + +/* If FLAGS is a null pointer or specifies right-to-left motion, + output a switch-dir-to-left-to-right sequence to DST. + Also update FLAGS if it is not a null pointer. + If INTERNAL_P is set, we are outputting in internal format and + need to handle the CSI differently. */ + +static void +restore_left_to_right_direction (Lisp_Coding_System *codesys, + unsigned_char_dynarr *dst, + unsigned int *flags, + int internal_p) +{ + if (!flags || (*flags & CODING_STATE_R2L)) + { + if (CODING_SYSTEM_ISO2022_SEVEN (codesys)) + { + Dynarr_add (dst, ISO_CODE_ESC); + Dynarr_add (dst, '['); + } + else if (internal_p) + DECODE_ADD_BINARY_CHAR (ISO_CODE_CSI, dst); + else + Dynarr_add (dst, ISO_CODE_CSI); + Dynarr_add (dst, '0'); + Dynarr_add (dst, ']'); + if (flags) + *flags &= ~CODING_STATE_R2L; + } +} + +/* If FLAGS is a null pointer or specifies a direction different from + DIRECTION (which should be either CHARSET_RIGHT_TO_LEFT or + CHARSET_LEFT_TO_RIGHT), output the appropriate switch-dir escape + sequence to DST. Also update FLAGS if it is not a null pointer. + If INTERNAL_P is set, we are outputting in internal format and + need to handle the CSI differently. */ + +static void +ensure_correct_direction (int direction, Lisp_Coding_System *codesys, + unsigned_char_dynarr *dst, unsigned int *flags, + int internal_p) +{ + if ((!flags || (*flags & CODING_STATE_R2L)) && + direction == CHARSET_LEFT_TO_RIGHT) + restore_left_to_right_direction (codesys, dst, flags, internal_p); + else if (!CODING_SYSTEM_ISO2022_NO_ISO6429 (codesys) + && (!flags || !(*flags & CODING_STATE_R2L)) && + direction == CHARSET_RIGHT_TO_LEFT) + { + if (CODING_SYSTEM_ISO2022_SEVEN (codesys)) + { + Dynarr_add (dst, ISO_CODE_ESC); + Dynarr_add (dst, '['); + } + else if (internal_p) + DECODE_ADD_BINARY_CHAR (ISO_CODE_CSI, dst); + else + Dynarr_add (dst, ISO_CODE_CSI); + Dynarr_add (dst, '2'); + Dynarr_add (dst, ']'); + if (flags) + *flags |= CODING_STATE_R2L; + } +} + +/* Convert ISO2022-format data to internal format. */ + +static void +decode_coding_iso2022 (Lstream *decoding, const Extbyte *src, + unsigned_char_dynarr *dst, Lstream_data_count n) +{ + struct decoding_stream *str = DECODING_STREAM_DATA (decoding); + unsigned int flags = str->flags; + unsigned int ch = str->ch; + eol_type_t eol_type = str->eol_type; +#ifdef ENABLE_COMPOSITE_CHARS + unsigned_char_dynarr *real_dst = dst; +#endif + Lisp_Object coding_system; + + XSETCODING_SYSTEM (coding_system, str->codesys); + +#ifdef ENABLE_COMPOSITE_CHARS + if (flags & CODING_STATE_COMPOSITE) + dst = str->iso2022.composite_chars; +#endif /* ENABLE_COMPOSITE_CHARS */ + + while (n--) + { + unsigned char c = *(unsigned char *)src++; + if (flags & CODING_STATE_ESCAPE) + { /* Within ESC sequence */ + int retval = parse_iso2022_esc (coding_system, &str->iso2022, + c, &flags, 1); + + if (retval) + { + switch (str->iso2022.esc) + { +#ifdef ENABLE_COMPOSITE_CHARS + case ISO_ESC_START_COMPOSITE: + if (str->iso2022.composite_chars) + Dynarr_reset (str->iso2022.composite_chars); + else + str->iso2022.composite_chars = Dynarr_new (unsigned_char); + dst = str->iso2022.composite_chars; + break; + case ISO_ESC_END_COMPOSITE: + { + Bufbyte comstr[MAX_EMCHAR_LEN]; + Bytecount len; + Emchar emch = lookup_composite_char (Dynarr_atp (dst, 0), + Dynarr_length (dst)); + dst = real_dst; + len = set_charptr_emchar (comstr, emch); + Dynarr_add_many (dst, comstr, len); + break; + } +#endif /* ENABLE_COMPOSITE_CHARS */ + + case ISO_ESC_LITERAL: + DECODE_ADD_BINARY_CHAR (c, dst); + break; + + default: + /* Everything else handled already */ + break; + } + } + + /* Attempted error recovery. */ + if (str->iso2022.output_direction_sequence) + ensure_correct_direction (flags & CODING_STATE_R2L ? + CHARSET_RIGHT_TO_LEFT : + CHARSET_LEFT_TO_RIGHT, + str->codesys, dst, 0, 1); + /* More error recovery. */ + if (!retval || str->iso2022.output_literally) + { + /* Output the (possibly invalid) sequence */ + int i; + for (i = 0; i < str->iso2022.esc_bytes_index; i++) + DECODE_ADD_BINARY_CHAR (str->iso2022.esc_bytes[i], dst); + flags &= CODING_STATE_ISO2022_LOCK; + if (!retval) + n++, src--;/* Repeat the loop with the same character. */ + else + { + /* No sense in reprocessing the final byte of the + escape sequence; it could mess things up anyway. + Just add it now. */ + DECODE_ADD_BINARY_CHAR (c, dst); + } + } + ch = 0; + } + else if (BYTE_C0_P (c) || BYTE_C1_P (c)) + { /* Control characters */ + + /***** Error-handling *****/ + + /* If we were in the middle of a character, dump out the + partial character. */ + DECODE_OUTPUT_PARTIAL_CHAR (ch); + + /* If we just saw a single-shift character, dump it out. + This may dump out the wrong sort of single-shift character, + but least it will give an indication that something went + wrong. */ + if (flags & CODING_STATE_SS2) + { + DECODE_ADD_BINARY_CHAR (ISO_CODE_SS2, dst); + flags &= ~CODING_STATE_SS2; + } + if (flags & CODING_STATE_SS3) + { + DECODE_ADD_BINARY_CHAR (ISO_CODE_SS3, dst); + flags &= ~CODING_STATE_SS3; + } + + /***** Now handle the control characters. *****/ + + /* Handle CR/LF */ + DECODE_HANDLE_EOL_TYPE (eol_type, c, flags, dst); + + flags &= CODING_STATE_ISO2022_LOCK; + + if (!parse_iso2022_esc (coding_system, &str->iso2022, c, &flags, 1)) + DECODE_ADD_BINARY_CHAR (c, dst); + } + else + { /* Graphic characters */ + Lisp_Object charset; +#ifndef UTF2000 + Charset_ID lb; +#endif + int reg; + + DECODE_HANDLE_EOL_TYPE (eol_type, c, flags, dst); + + /* Now determine the charset. */ + reg = ((flags & CODING_STATE_SS2) ? 2 + : (flags & CODING_STATE_SS3) ? 3 + : !BYTE_ASCII_P (c) ? str->iso2022.register_right + : str->iso2022.register_left); + charset = str->iso2022.charset[reg]; + + /* Error checking: */ + if (! CHARSETP (charset) + || str->iso2022.invalid_designated[reg] + || (((c & 0x7F) == ' ' || (c & 0x7F) == ISO_CODE_DEL) + && XCHARSET_CHARS (charset) == 94)) + /* Mrmph. We are trying to invoke a register that has no + or an invalid charset in it, or trying to add a character + outside the range of the charset. Insert that char literally + to preserve it for the output. */ + { + DECODE_OUTPUT_PARTIAL_CHAR (ch); + DECODE_ADD_BINARY_CHAR (c, dst); + } + + else + { + /* Things are probably hunky-dorey. */ + + /* Fetch reverse charset, maybe. */ + if (((flags & CODING_STATE_R2L) && + XCHARSET_DIRECTION (charset) == CHARSET_LEFT_TO_RIGHT) + || + (!(flags & CODING_STATE_R2L) && + XCHARSET_DIRECTION (charset) == CHARSET_RIGHT_TO_LEFT)) + { + Lisp_Object new_charset = + XCHARSET_REVERSE_DIRECTION_CHARSET (charset); + if (!NILP (new_charset)) + charset = new_charset; + } + +#ifndef UTF2000 + lb = XCHARSET_LEADING_BYTE (charset); +#endif + switch (XCHARSET_REP_BYTES (charset)) + { + case 1: /* ASCII */ + DECODE_OUTPUT_PARTIAL_CHAR (ch); + Dynarr_add (dst, c & 0x7F); + break; + + case 2: /* one-byte official */ + DECODE_OUTPUT_PARTIAL_CHAR (ch); +#ifdef UTF2000 + DECODE_ADD_UCS_CHAR(MAKE_CHAR(charset, c & 0x7F, 0), dst); +#else + Dynarr_add (dst, lb); + Dynarr_add (dst, c | 0x80); +#endif + break; + + case 3: /* one-byte private or two-byte official */ +#ifdef UTF2000 + if (XCHARSET_DIMENSION (charset) == 1) +#else + if (XCHARSET_PRIVATE_P (charset)) +#endif + { + DECODE_OUTPUT_PARTIAL_CHAR (ch); +#ifdef UTF2000 + DECODE_ADD_UCS_CHAR(MAKE_CHAR(charset, c & 0x7F, 0), + dst); +#else + Dynarr_add (dst, PRE_LEADING_BYTE_PRIVATE_1); + Dynarr_add (dst, lb); + Dynarr_add (dst, c | 0x80); +#endif + } + else + { + if (ch) + { +#ifdef UTF2000 + DECODE_ADD_UCS_CHAR(MAKE_CHAR(charset, + ch & 0x7F, + c & 0x7F), dst); +#else + Dynarr_add (dst, lb); + Dynarr_add (dst, ch | 0x80); + Dynarr_add (dst, c | 0x80); +#endif + ch = 0; + } + else + ch = c; + } + break; + + default: /* two-byte private */ + if (ch) + { +#ifdef UTF2000 + DECODE_ADD_UCS_CHAR(MAKE_CHAR(charset, + ch & 0x7F, + c & 0x7F), dst); +#else + Dynarr_add (dst, PRE_LEADING_BYTE_PRIVATE_2); + Dynarr_add (dst, lb); + Dynarr_add (dst, ch | 0x80); + Dynarr_add (dst, c | 0x80); +#endif + ch = 0; + } + else + ch = c; + } + } + + if (!ch) + flags &= CODING_STATE_ISO2022_LOCK; + } + + label_continue_loop:; + } + + if (flags & CODING_STATE_END) + DECODE_OUTPUT_PARTIAL_CHAR (ch); + + str->flags = flags; + str->ch = ch; +} + + +/***** ISO2022 encoder *****/ + +/* Designate CHARSET into register REG. */ + +static void +iso2022_designate (Lisp_Object charset, unsigned char reg, + struct encoding_stream *str, unsigned_char_dynarr *dst) +{ + static const char inter94[] = "()*+"; + static const char inter96[] = ",-./"; + unsigned int type; + unsigned char final; + Lisp_Object old_charset = str->iso2022.charset[reg]; + + str->iso2022.charset[reg] = charset; + if (!CHARSETP (charset)) + /* charset might be an initial nil or t. */ + return; + type = XCHARSET_TYPE (charset); + final = XCHARSET_FINAL (charset); + if (!str->iso2022.force_charset_on_output[reg] && + CHARSETP (old_charset) && + XCHARSET_TYPE (old_charset) == type && + XCHARSET_FINAL (old_charset) == final) + return; + + str->iso2022.force_charset_on_output[reg] = 0; + + { + charset_conversion_spec_dynarr *dyn = + str->codesys->iso2022.output_conv; + + if (dyn) + { + int i; + + for (i = 0; i < Dynarr_length (dyn); i++) + { + struct charset_conversion_spec *spec = Dynarr_atp (dyn, i); + if (EQ (charset, spec->from_charset)) + charset = spec->to_charset; + } + } + } + + Dynarr_add (dst, ISO_CODE_ESC); + switch (type) + { + case CHARSET_TYPE_94: + Dynarr_add (dst, inter94[reg]); + break; + case CHARSET_TYPE_96: + Dynarr_add (dst, inter96[reg]); + break; + case CHARSET_TYPE_94X94: + Dynarr_add (dst, '$'); + if (reg != 0 + || !(CODING_SYSTEM_ISO2022_SHORT (str->codesys)) + || final < '@' + || final > 'B') + Dynarr_add (dst, inter94[reg]); + break; + case CHARSET_TYPE_96X96: + Dynarr_add (dst, '$'); + Dynarr_add (dst, inter96[reg]); + break; + } + Dynarr_add (dst, final); +} + +static void +ensure_normal_shift (struct encoding_stream *str, unsigned_char_dynarr *dst) +{ + if (str->iso2022.register_left != 0) + { + Dynarr_add (dst, ISO_CODE_SI); + str->iso2022.register_left = 0; + } +} + +static void +ensure_shift_out (struct encoding_stream *str, unsigned_char_dynarr *dst) +{ + if (str->iso2022.register_left != 1) + { + Dynarr_add (dst, ISO_CODE_SO); + str->iso2022.register_left = 1; + } +} + +void +char_encode_iso2022 (struct encoding_stream *str, Emchar ch, + unsigned_char_dynarr *dst, unsigned int *flags) +{ + unsigned char charmask; + Lisp_Coding_System* codesys = str->codesys; + eol_type_t eol_type = CODING_SYSTEM_EOL_TYPE (str->codesys); + int i; + Lisp_Object charset; + int half; + unsigned int byte1, byte2; + + if (ch <= 0x7F) + { + restore_left_to_right_direction (codesys, dst, flags, 0); + + /* Make sure G0 contains ASCII */ + if ((ch > ' ' && ch < ISO_CODE_DEL) + || !CODING_SYSTEM_ISO2022_NO_ASCII_CNTL (codesys)) + { + ensure_normal_shift (str, dst); + iso2022_designate (Vcharset_ascii, 0, str, dst); + } + + /* If necessary, restore everything to the default state + at end-of-line */ + if (ch == '\n' && !(CODING_SYSTEM_ISO2022_NO_ASCII_EOL (codesys))) + { + restore_left_to_right_direction (codesys, dst, flags, 0); + + ensure_normal_shift (str, dst); + + for (i = 0; i < 4; i++) + { + Lisp_Object initial_charset = + CODING_SYSTEM_ISO2022_INITIAL_CHARSET (codesys, i); + iso2022_designate (initial_charset, i, str, dst); + } + } + if (ch == '\n') + { + if (eol_type != EOL_LF && eol_type != EOL_AUTODETECT) + Dynarr_add (dst, '\r'); + if (eol_type != EOL_CR) + Dynarr_add (dst, ch); + } + else + { + if (CODING_SYSTEM_ISO2022_ESCAPE_QUOTED (codesys) + && fit_to_be_escape_quoted (ch)) + Dynarr_add (dst, ISO_CODE_ESC); + Dynarr_add (dst, ch); + } + } + else if ( (0x80 <= ch) && (ch <= 0x9f) ) + { + charmask = (half == 0 ? 0x00 : 0x80); + + if (CODING_SYSTEM_ISO2022_ESCAPE_QUOTED (codesys) + && fit_to_be_escape_quoted (ch)) + Dynarr_add (dst, ISO_CODE_ESC); + /* you asked for it ... */ + Dynarr_add (dst, ch); + } + else + { + int reg; + + BREAKUP_CHAR (ch, charset, byte1, byte2); + ensure_correct_direction (XCHARSET_DIRECTION (charset), + codesys, dst, flags, 0); + + /* Now determine which register to use. */ + reg = -1; + for (i = 0; i < 4; i++) + { + if (EQ (charset, str->iso2022.charset[i]) || + EQ (charset, + CODING_SYSTEM_ISO2022_INITIAL_CHARSET (codesys, i))) + { + reg = i; + break; + } + } + + if (reg == -1) + { + if (XCHARSET_GRAPHIC (charset) != 0) + { + if (!NILP (str->iso2022.charset[1]) && + (!CODING_SYSTEM_ISO2022_SEVEN (codesys) + || CODING_SYSTEM_ISO2022_LOCK_SHIFT (codesys))) + reg = 1; + else if (!NILP (str->iso2022.charset[2])) + reg = 2; + else if (!NILP (str->iso2022.charset[3])) + reg = 3; + else + reg = 0; + } + else + reg = 0; + } + + iso2022_designate (charset, reg, str, dst); + + /* Now invoke that register. */ + switch (reg) + { + case 0: + ensure_normal_shift (str, dst); + half = 0; + break; + case 1: + if (CODING_SYSTEM_ISO2022_SEVEN (codesys)) + { + ensure_shift_out (str, dst); + half = 0; + } + else + half = 1; + break; + case 2: + if (CODING_SYSTEM_ISO2022_SEVEN (str->codesys)) + { + Dynarr_add (dst, ISO_CODE_ESC); + Dynarr_add (dst, 'N'); + half = 0; + } + else + { + Dynarr_add (dst, ISO_CODE_SS2); + half = 1; + } + break; + case 3: + if (CODING_SYSTEM_ISO2022_SEVEN (str->codesys)) + { + Dynarr_add (dst, ISO_CODE_ESC); + Dynarr_add (dst, 'O'); + half = 0; + } + else + { + Dynarr_add (dst, ISO_CODE_SS3); + half = 1; + } + break; + default: + abort (); + } + + charmask = (half == 0 ? 0x00 : 0x80); + + switch (XCHARSET_DIMENSION (charset)) + { + case 1: + Dynarr_add (dst, byte1 | charmask); + break; + case 2: + Dynarr_add (dst, byte1 | charmask); + Dynarr_add (dst, byte2 | charmask); + break; + default: + abort (); + } + } +} + +void +char_finish_iso2022 (struct encoding_stream *str, unsigned_char_dynarr *dst, + unsigned int *flags) +{ + Lisp_Coding_System* codesys = str->codesys; + int i; + + restore_left_to_right_direction (codesys, dst, flags, 0); + ensure_normal_shift (str, dst); + for (i = 0; i < 4; i++) + { + Lisp_Object initial_charset + = CODING_SYSTEM_ISO2022_INITIAL_CHARSET (codesys, i); + iso2022_designate (initial_charset, i, str, dst); + } +} +#endif /* MULE */ + +/************************************************************************/ +/* No-conversion methods */ +/************************************************************************/ + +/* This is used when reading in "binary" files -- i.e. files that may + contain all 256 possible byte values and that are not to be + interpreted as being in any particular decoding. */ +static void +decode_coding_no_conversion (Lstream *decoding, const Extbyte *src, + unsigned_char_dynarr *dst, Lstream_data_count n) +{ + struct decoding_stream *str = DECODING_STREAM_DATA (decoding); + unsigned int flags = str->flags; + unsigned int ch = str->ch; + eol_type_t eol_type = str->eol_type; + + while (n--) + { + unsigned char c = *(unsigned char *)src++; + + DECODE_HANDLE_EOL_TYPE (eol_type, c, flags, dst); + DECODE_ADD_BINARY_CHAR (c, dst); + label_continue_loop:; + } + + DECODE_HANDLE_END_OF_CONVERSION (flags, ch, dst); + + str->flags = flags; + str->ch = ch; +} + +static void +encode_coding_no_conversion (Lstream *encoding, const Bufbyte *src, + unsigned_char_dynarr *dst, Lstream_data_count n) +{ + unsigned char c; + struct encoding_stream *str = ENCODING_STREAM_DATA (encoding); + unsigned int flags = str->flags; + unsigned int ch = str->ch; + eol_type_t eol_type = CODING_SYSTEM_EOL_TYPE (str->codesys); +#ifdef UTF2000 + unsigned char char_boundary = str->iso2022.current_char_boundary; +#endif + + while (n--) + { + c = *src++; +#ifdef UTF2000 + switch (char_boundary) + { + case 0: + if ( c >= 0xfc ) + { + ch = c & 0x01; + char_boundary = 5; + } + else if ( c >= 0xf8 ) + { + ch = c & 0x03; + char_boundary = 4; + } + else if ( c >= 0xf0 ) + { + ch = c & 0x07; + char_boundary = 3; + } + else if ( c >= 0xe0 ) + { + ch = c & 0x0f; + char_boundary = 2; + } + else if ( c >= 0xc0 ) + { + ch = c & 0x1f; + char_boundary = 1; + } + else + { + ch = 0; + + if (c == '\n') + { + if (eol_type != EOL_LF && eol_type != EOL_AUTODETECT) + Dynarr_add (dst, '\r'); + if (eol_type != EOL_CR) + Dynarr_add (dst, c); + } + else + Dynarr_add (dst, c); + char_boundary = 0; + } + break; + case 1: + ch = ( ch << 6 ) | ( c & 0x3f ); + switch ( str->codesys->fixed.size ) + { + case 1: + Dynarr_add (dst, ch & 0xff); + break; + case 2: + Dynarr_add (dst, (ch >> 8) & 0xff); + Dynarr_add (dst, ch & 0xff); + break; + case 3: + Dynarr_add (dst, (ch >> 16) & 0xff); + Dynarr_add (dst, (ch >> 8) & 0xff); + Dynarr_add (dst, ch & 0xff); + break; + case 4: + Dynarr_add (dst, (ch >> 24) & 0xff); + Dynarr_add (dst, (ch >> 16) & 0xff); + Dynarr_add (dst, (ch >> 8) & 0xff); + Dynarr_add (dst, ch & 0xff); + break; + default: + fprintf(stderr, "It seems %d bytes stream.\n", + str->codesys->fixed.size); + abort (); + } + char_boundary = 0; + break; + default: + ch = ( ch << 6 ) | ( c & 0x3f ); + char_boundary--; + } +#else /* not UTF2000 */ + if (c == '\n') + { + if (eol_type != EOL_LF && eol_type != EOL_AUTODETECT) + Dynarr_add (dst, '\r'); + if (eol_type != EOL_CR) + Dynarr_add (dst, '\n'); + ch = 0; + } + else if (BYTE_ASCII_P (c)) + { + assert (ch == 0); + Dynarr_add (dst, c); + } + else if (BUFBYTE_LEADING_BYTE_P (c)) + { + assert (ch == 0); + if (c == LEADING_BYTE_LATIN_ISO8859_1 || + c == LEADING_BYTE_CONTROL_1) + ch = c; + else + Dynarr_add (dst, '~'); /* untranslatable character */ + } + else + { + if (ch == LEADING_BYTE_LATIN_ISO8859_1) + Dynarr_add (dst, c); + else if (ch == LEADING_BYTE_CONTROL_1) + { + assert (c < 0xC0); + Dynarr_add (dst, c - 0x20); + } + /* else it should be the second or third byte of an + untranslatable character, so ignore it */ + ch = 0; + } +#endif /* not UTF2000 */ + } + + str->flags = flags; + str->ch = ch; +#ifdef UTF2000 + str->iso2022.current_char_boundary = char_boundary; +#endif +} + + + +/************************************************************************/ +/* Initialization */ +/************************************************************************/ + +void +syms_of_file_coding (void) +{ + INIT_LRECORD_IMPLEMENTATION (coding_system); + + DEFERROR_STANDARD (Qcoding_system_error, Qio_error); + + DEFSUBR (Fcoding_system_p); + DEFSUBR (Ffind_coding_system); + DEFSUBR (Fget_coding_system); + DEFSUBR (Fcoding_system_list); + DEFSUBR (Fcoding_system_name); + DEFSUBR (Fmake_coding_system); + DEFSUBR (Fcopy_coding_system); + DEFSUBR (Fcoding_system_canonical_name_p); + DEFSUBR (Fcoding_system_alias_p); + DEFSUBR (Fcoding_system_aliasee); + DEFSUBR (Fdefine_coding_system_alias); + DEFSUBR (Fsubsidiary_coding_system); + + DEFSUBR (Fcoding_system_type); + DEFSUBR (Fcoding_system_doc_string); +#ifdef MULE + DEFSUBR (Fcoding_system_charset); +#endif + DEFSUBR (Fcoding_system_property); + + DEFSUBR (Fcoding_category_list); + DEFSUBR (Fset_coding_priority_list); + DEFSUBR (Fcoding_priority_list); + DEFSUBR (Fset_coding_category_system); + DEFSUBR (Fcoding_category_system); + + DEFSUBR (Fdetect_coding_region); + DEFSUBR (Fdecode_coding_region); + DEFSUBR (Fencode_coding_region); +#ifdef MULE + DEFSUBR (Fdecode_shift_jis_char); + DEFSUBR (Fencode_shift_jis_char); + DEFSUBR (Fdecode_big5_char); + DEFSUBR (Fencode_big5_char); + DEFSUBR (Fset_ucs_char); + DEFSUBR (Fucs_char); + DEFSUBR (Fset_char_ucs); + DEFSUBR (Fchar_ucs); +#endif /* MULE */ + defsymbol (&Qcoding_systemp, "coding-system-p"); + defsymbol (&Qno_conversion, "no-conversion"); + defsymbol (&Qraw_text, "raw-text"); +#ifdef MULE + defsymbol (&Qbig5, "big5"); + defsymbol (&Qshift_jis, "shift-jis"); + defsymbol (&Qucs4, "ucs-4"); + defsymbol (&Qutf8, "utf-8"); + defsymbol (&Qccl, "ccl"); + defsymbol (&Qiso2022, "iso2022"); +#endif /* MULE */ + defsymbol (&Qmnemonic, "mnemonic"); + defsymbol (&Qeol_type, "eol-type"); + defsymbol (&Qpost_read_conversion, "post-read-conversion"); + defsymbol (&Qpre_write_conversion, "pre-write-conversion"); + + defsymbol (&Qcr, "cr"); + defsymbol (&Qlf, "lf"); + defsymbol (&Qcrlf, "crlf"); + defsymbol (&Qeol_cr, "eol-cr"); + defsymbol (&Qeol_lf, "eol-lf"); + defsymbol (&Qeol_crlf, "eol-crlf"); +#ifdef MULE + defsymbol (&Qcharset_g0, "charset-g0"); + defsymbol (&Qcharset_g1, "charset-g1"); + defsymbol (&Qcharset_g2, "charset-g2"); + defsymbol (&Qcharset_g3, "charset-g3"); + defsymbol (&Qforce_g0_on_output, "force-g0-on-output"); + defsymbol (&Qforce_g1_on_output, "force-g1-on-output"); + defsymbol (&Qforce_g2_on_output, "force-g2-on-output"); + defsymbol (&Qforce_g3_on_output, "force-g3-on-output"); + defsymbol (&Qno_iso6429, "no-iso6429"); + defsymbol (&Qinput_charset_conversion, "input-charset-conversion"); + defsymbol (&Qoutput_charset_conversion, "output-charset-conversion"); + + defsymbol (&Qshort, "short"); + defsymbol (&Qno_ascii_eol, "no-ascii-eol"); + defsymbol (&Qno_ascii_cntl, "no-ascii-cntl"); + defsymbol (&Qseven, "seven"); + defsymbol (&Qlock_shift, "lock-shift"); + defsymbol (&Qescape_quoted, "escape-quoted"); +#endif /* MULE */ + defsymbol (&Qencode, "encode"); + defsymbol (&Qdecode, "decode"); + +#ifdef MULE + defsymbol (&coding_category_symbol[CODING_CATEGORY_SHIFT_JIS], + "shift-jis"); + defsymbol (&coding_category_symbol[CODING_CATEGORY_BIG5], + "big5"); + defsymbol (&coding_category_symbol[CODING_CATEGORY_UCS4], + "ucs-4"); + defsymbol (&coding_category_symbol[CODING_CATEGORY_UTF8], + "utf-8"); + defsymbol (&coding_category_symbol[CODING_CATEGORY_ISO_7], + "iso-7"); + defsymbol (&coding_category_symbol[CODING_CATEGORY_ISO_8_DESIGNATE], + "iso-8-designate"); + defsymbol (&coding_category_symbol[CODING_CATEGORY_ISO_8_1], + "iso-8-1"); + defsymbol (&coding_category_symbol[CODING_CATEGORY_ISO_8_2], + "iso-8-2"); + defsymbol (&coding_category_symbol[CODING_CATEGORY_ISO_LOCK_SHIFT], + "iso-lock-shift"); +#endif /* MULE */ + defsymbol (&coding_category_symbol[CODING_CATEGORY_NO_CONVERSION], + "no-conversion"); +} + +void +lstream_type_create_file_coding (void) +{ + LSTREAM_HAS_METHOD (decoding, reader); + LSTREAM_HAS_METHOD (decoding, writer); + LSTREAM_HAS_METHOD (decoding, rewinder); + LSTREAM_HAS_METHOD (decoding, seekable_p); + LSTREAM_HAS_METHOD (decoding, flusher); + LSTREAM_HAS_METHOD (decoding, closer); + LSTREAM_HAS_METHOD (decoding, marker); + + LSTREAM_HAS_METHOD (encoding, reader); + LSTREAM_HAS_METHOD (encoding, writer); + LSTREAM_HAS_METHOD (encoding, rewinder); + LSTREAM_HAS_METHOD (encoding, seekable_p); + LSTREAM_HAS_METHOD (encoding, flusher); + LSTREAM_HAS_METHOD (encoding, closer); + LSTREAM_HAS_METHOD (encoding, marker); +} + +void +vars_of_file_coding (void) +{ + int i; + + fcd = xnew (struct file_coding_dump); + dump_add_root_struct_ptr (&fcd, &fcd_description); + + /* Initialize to something reasonable ... */ + for (i = 0; i < CODING_CATEGORY_LAST; i++) + { + fcd->coding_category_system[i] = Qnil; + fcd->coding_category_by_priority[i] = i; + } + + Fprovide (intern ("file-coding")); + + DEFVAR_LISP ("keyboard-coding-system", &Vkeyboard_coding_system /* +Coding system used for TTY keyboard input. +Not used under a windowing system. +*/ ); + Vkeyboard_coding_system = Qnil; + + DEFVAR_LISP ("terminal-coding-system", &Vterminal_coding_system /* +Coding system used for TTY display output. +Not used under a windowing system. +*/ ); + Vterminal_coding_system = Qnil; + + DEFVAR_LISP ("coding-system-for-read", &Vcoding_system_for_read /* +Overriding coding system used when reading from a file or process. +You should bind this variable with `let', but do not set it globally. +If this is non-nil, it specifies the coding system that will be used +to decode input on read operations, such as from a file or process. +It overrides `buffer-file-coding-system-for-read', +`insert-file-contents-pre-hook', etc. Use those variables instead of +this one for permanent changes to the environment. */ ); + Vcoding_system_for_read = Qnil; + + DEFVAR_LISP ("coding-system-for-write", + &Vcoding_system_for_write /* +Overriding coding system used when writing to a file or process. +You should bind this variable with `let', but do not set it globally. +If this is non-nil, it specifies the coding system that will be used +to encode output for write operations, such as to a file or process. +It overrides `buffer-file-coding-system', `write-region-pre-hook', etc. +Use those variables instead of this one for permanent changes to the +environment. */ ); + Vcoding_system_for_write = Qnil; + + DEFVAR_LISP ("file-name-coding-system", &Vfile_name_coding_system /* +Coding system used to convert pathnames when accessing files. +*/ ); + Vfile_name_coding_system = Qnil; + + DEFVAR_BOOL ("enable-multibyte-characters", &enable_multibyte_characters /* +Non-nil means the buffer contents are regarded as multi-byte form +of characters, not a binary code. This affects the display, file I/O, +and behaviors of various editing commands. + +Setting this to nil does not do anything. +*/ ); + enable_multibyte_characters = 1; +} + +void +complex_vars_of_file_coding (void) +{ + staticpro (&Vcoding_system_hash_table); + Vcoding_system_hash_table = + make_lisp_hash_table (50, HASH_TABLE_NON_WEAK, HASH_TABLE_EQ); + + the_codesys_prop_dynarr = Dynarr_new (codesys_prop); + dump_add_root_struct_ptr (&the_codesys_prop_dynarr, &codesys_prop_dynarr_description); + +#define DEFINE_CODESYS_PROP(Prop_Type, Sym) do \ +{ \ + struct codesys_prop csp; \ + csp.sym = (Sym); \ + csp.prop_type = (Prop_Type); \ + Dynarr_add (the_codesys_prop_dynarr, csp); \ +} while (0) + + DEFINE_CODESYS_PROP (CODESYS_PROP_ALL_OK, Qmnemonic); + DEFINE_CODESYS_PROP (CODESYS_PROP_ALL_OK, Qeol_type); + DEFINE_CODESYS_PROP (CODESYS_PROP_ALL_OK, Qeol_cr); + DEFINE_CODESYS_PROP (CODESYS_PROP_ALL_OK, Qeol_crlf); + DEFINE_CODESYS_PROP (CODESYS_PROP_ALL_OK, Qeol_lf); + DEFINE_CODESYS_PROP (CODESYS_PROP_ALL_OK, Qpost_read_conversion); + DEFINE_CODESYS_PROP (CODESYS_PROP_ALL_OK, Qpre_write_conversion); +#ifdef MULE + DEFINE_CODESYS_PROP (CODESYS_PROP_ISO2022, Qcharset_g0); + DEFINE_CODESYS_PROP (CODESYS_PROP_ISO2022, Qcharset_g1); + DEFINE_CODESYS_PROP (CODESYS_PROP_ISO2022, Qcharset_g2); + DEFINE_CODESYS_PROP (CODESYS_PROP_ISO2022, Qcharset_g3); + DEFINE_CODESYS_PROP (CODESYS_PROP_ISO2022, Qforce_g0_on_output); + DEFINE_CODESYS_PROP (CODESYS_PROP_ISO2022, Qforce_g1_on_output); + DEFINE_CODESYS_PROP (CODESYS_PROP_ISO2022, Qforce_g2_on_output); + DEFINE_CODESYS_PROP (CODESYS_PROP_ISO2022, Qforce_g3_on_output); + DEFINE_CODESYS_PROP (CODESYS_PROP_ISO2022, Qshort); + DEFINE_CODESYS_PROP (CODESYS_PROP_ISO2022, Qno_ascii_eol); + DEFINE_CODESYS_PROP (CODESYS_PROP_ISO2022, Qno_ascii_cntl); + DEFINE_CODESYS_PROP (CODESYS_PROP_ISO2022, Qseven); + DEFINE_CODESYS_PROP (CODESYS_PROP_ISO2022, Qlock_shift); + DEFINE_CODESYS_PROP (CODESYS_PROP_ISO2022, Qno_iso6429); + DEFINE_CODESYS_PROP (CODESYS_PROP_ISO2022, Qescape_quoted); + DEFINE_CODESYS_PROP (CODESYS_PROP_ISO2022, Qinput_charset_conversion); + DEFINE_CODESYS_PROP (CODESYS_PROP_ISO2022, Qoutput_charset_conversion); + + DEFINE_CODESYS_PROP (CODESYS_PROP_CCL, Qencode); + DEFINE_CODESYS_PROP (CODESYS_PROP_CCL, Qdecode); +#endif /* MULE */ + /* Need to create this here or we're really screwed. */ + Fmake_coding_system + (Qraw_text, Qno_conversion, + build_string ("Raw text, which means it converts only line-break-codes."), + list2 (Qmnemonic, build_string ("Raw"))); + + Fmake_coding_system + (Qbinary, Qno_conversion, + build_string ("Binary, which means it does not convert anything."), + list4 (Qeol_type, Qlf, + Qmnemonic, build_string ("Binary"))); + +#ifdef UTF2000 + Fmake_coding_system + (Qutf8, Qutf8, + build_string ("Coding-system of ISO/IEC 10646 UTF-8."), + list2 (Qmnemonic, build_string ("UTF8"))); +#endif + + Fdefine_coding_system_alias (Qno_conversion, Qraw_text); + + Fdefine_coding_system_alias (Qfile_name, Qbinary); + + Fdefine_coding_system_alias (Qterminal, Qbinary); + Fdefine_coding_system_alias (Qkeyboard, Qbinary); + + /* Need this for bootstrapping */ + fcd->coding_category_system[CODING_CATEGORY_NO_CONVERSION] = + Fget_coding_system (Qraw_text); + +#ifdef UTF2000 + fcd->coding_category_system[CODING_CATEGORY_UTF8] + = Fget_coding_system (Qutf8); +#endif + +#if defined(MULE) && !defined(UTF2000) + { + size_t i; + + for (i = 0; i < countof (fcd->ucs_to_mule_table); i++) + fcd->ucs_to_mule_table[i] = Qnil; + } + staticpro (&mule_to_ucs_table); + mule_to_ucs_table = Fmake_char_table(Qgeneric); +#endif /* defined(MULE) && !defined(UTF2000) */ +}