# HG changeset patch # User cvs # Date 1186993382 -7200 # Node ID 11cf20601dec9c13ab438bbaece27d1b807d7911 # Parent 58424f6abf5694b663c7df75f5895c4de09ba0a6 Import from CVS: tag r20-5b28 diff -r 58424f6abf56 -r 11cf20601dec CHANGES-beta --- a/CHANGES-beta Mon Aug 13 10:22:10 2007 +0200 +++ b/CHANGES-beta Mon Aug 13 10:23:02 2007 +0200 @@ -1,4 +1,21 @@ -*- indented-text -*- +to 20.5 beta28 "LaMancha" +-- eudc/LDAP stuffs courtesy of Oscar Figueiredo +-- file-coding separation from Mule courtesy of Andy Piper +-- Various fixes from Kyle Jones +-- Support for multicasting courtesy of Didier Verna +-- Fix for respecting tty-erase-char courtesy of Glynn Clements +-- Miscellaneous patches from Karl Hegbloom +-- Miscellaneous patches from Greg Klanderman +-- Allow `XEmacs' to be used in X resources courtesy of Greg Klanderman +-- menu fixes courtesy of Aki Vehtari +-- gnu(serv|client) can use TMPDIR if set courtesy of Glynn Clements +-- miscellaneous fixes from Greg Klanderman +-- Various modeline fixes courtesy of Didier Verna +-- Miscellaneous doc fixes courtesy of Karl Hegbloom +-- Miscellaneous bug fixes +-- Glyph changes when dragging modeline courtesy of Didier Verna + to 20.5 beta27 "Kinder" -- Locale fix courtesy of Kazuyuki IENAGA -- Fix for TZSET problem on Sun via Jens Krinke diff -r 58424f6abf56 -r 11cf20601dec ChangeLog --- a/ChangeLog Mon Aug 13 10:22:10 2007 +0200 +++ b/ChangeLog Mon Aug 13 10:23:02 2007 +0200 @@ -1,3 +1,30 @@ +1998-02-25 SL Baur + + * XEmacs 20.5-beta28 is released. + + * configure.in (with_session): Fix reporting of the setting. + (with_database_gnudbm): Correctly report setting. + +1998-02-24 SL Baur + + * configure.usage: Restore documentation of graphics library + flags. + From Karl M. Hegbloom + +1998-02-19 Karl M. Hegbloom + + * PROBLEMS: Tell of the `gpm' SIGTSTP bug and `C-z' on the Linux + console. + +1998-02-23 SL Baur + + * XEmacs 20.4 is released to the beta testers. + +1998-02-21 SL Baur + + * configure.in (after_morecore_hook_exists): Modify dlmalloc tests + to also test for Linux libc5. + 1998-02-19 SL Baur * XEmacs 20.5-beta27 is released. diff -r 58424f6abf56 -r 11cf20601dec PROBLEMS --- a/PROBLEMS Mon Aug 13 10:22:10 2007 +0200 +++ b/PROBLEMS Mon Aug 13 10:23:02 2007 +0200 @@ -415,6 +415,13 @@ * Problems with running XEmacs ============================== +** `C-z', or `M-x suspend-emacs' hangs instead of suspending. + +If you build with `gpm' support on Linux, you cannot suspend XEmacs +because gpm installs a buggy SIGTSTP handler. Either compile with +`--with-gpm=no', or don't suspend XEmacs on the Linux console until +this bug is fixed. + ** You type Control-H (Backspace) expecting to delete characters. Emacs has traditionally used Control-H for help; unfortunately this diff -r 58424f6abf56 -r 11cf20601dec configure --- a/configure Mon Aug 13 10:22:10 2007 +0200 +++ b/configure Mon Aug 13 10:23:02 2007 +0200 @@ -234,7 +234,7 @@ with_menubars='' with_scrollbars='' with_dialogs='' -with_mule_coding='' +with_file_coding='' const_is_losing='yes' puresize='' cflags='UNSPECIFIED' @@ -325,13 +325,14 @@ with_xfs | \ with_i18n3 | \ with_mule | \ - with_mule_coding | \ + with_file_coding | \ with_canna | \ with_wnn | \ with_wnn6 | \ with_workshop | \ with_sparcworks | \ with_tooltalk | \ + with_ldap | \ with_pop | \ with_kerberos | \ with_hesiod | \ @@ -638,7 +639,7 @@ if test -z "$configuration"; then echo $ac_n "checking "host system type"""... $ac_c" 1>&6 -echo "configure:642: checking "host system type"" >&5 +echo "configure:643: checking "host system type"" >&5 if configuration=`${CONFIG_SHELL-/bin/sh} $srcdir/config.guess | \ sed 's/^\([^-][^-]*-[^-][^-]*-[^-][^-]*\)-.*$/\1/'` ; then echo "$ac_t""$configuration" 1>&6 @@ -652,7 +653,7 @@ fi echo $ac_n "checking whether ln -s works""... $ac_c" 1>&6 -echo "configure:656: checking whether ln -s works" >&5 +echo "configure:657: checking whether ln -s works" >&5 rm -f conftestdata if ln -s X conftestdata 2>/dev/null @@ -829,7 +830,7 @@ echo "checking "the configuration name"" 1>&6 -echo "configure:833: checking "the configuration name"" >&5 +echo "configure:834: checking "the configuration name"" >&5 internal_configuration=`echo $configuration | sed 's/-\(workshop\)//'` if canonical=`$srcdir/config.sub "$internal_configuration"` ; then : ; else exit $? @@ -1300,7 +1301,7 @@ # Extract the first word of "gcc", so it can be a program name with args. set dummy gcc; ac_word=$2 echo $ac_n "checking for $ac_word""... $ac_c" 1>&6 -echo "configure:1304: checking for $ac_word" >&5 +echo "configure:1305: checking for $ac_word" >&5 if test -n "$CC"; then ac_cv_prog_CC="$CC" # Let the user override the test. @@ -1326,7 +1327,7 @@ # Extract the first word of "cc", so it can be a program name with args. set dummy cc; ac_word=$2 echo $ac_n "checking for $ac_word""... $ac_c" 1>&6 -echo "configure:1330: checking for $ac_word" >&5 +echo "configure:1331: checking for $ac_word" >&5 if test -n "$CC"; then ac_cv_prog_CC="$CC" # Let the user override the test. @@ -1371,7 +1372,7 @@ fi echo $ac_n "checking whether the C compiler ($CC $CFLAGS $LDFLAGS) works""... $ac_c" 1>&6 -echo "configure:1375: checking whether the C compiler ($CC $CFLAGS $LDFLAGS) works" >&5 +echo "configure:1376: 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' @@ -1383,11 +1384,11 @@ cross_compiling=no cat > conftest.$ac_ext <&5; (eval $ac_link) 2>&5; } && test -s conftest; then +if { (eval echo configure:1392: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest; then ac_cv_prog_cc_works=yes # If we can't run a trivial program, we are probably using a cross compiler. if (./conftest; exit) 2>/dev/null; then @@ -1407,19 +1408,19 @@ { 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:1411: checking whether the C compiler ($CC $CFLAGS $LDFLAGS) is a cross-compiler" >&5 +echo "configure:1412: 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:1416: checking whether we are using GNU C" >&5 +echo "configure:1417: 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:1424: \"$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 @@ -1433,7 +1434,7 @@ ac_save_CFLAGS="$CFLAGS" CFLAGS= echo $ac_n "checking whether ${CC-cc} accepts -g""... $ac_c" 1>&6 -echo "configure:1437: checking whether ${CC-cc} accepts -g" >&5 +echo "configure:1438: checking whether ${CC-cc} accepts -g" >&5 echo 'void f(){}' > conftest.c if test -z "`${CC-cc} -g -c conftest.c 2>&1`"; then @@ -1462,7 +1463,7 @@ # Extract the first word of "gcc", so it can be a program name with args. set dummy gcc; ac_word=$2 echo $ac_n "checking for $ac_word""... $ac_c" 1>&6 -echo "configure:1466: checking for $ac_word" >&5 +echo "configure:1467: checking for $ac_word" >&5 if test -n "$CC"; then ac_cv_prog_CC="$CC" # Let the user override the test. @@ -1488,7 +1489,7 @@ # Extract the first word of "cc", so it can be a program name with args. set dummy cc; ac_word=$2 echo $ac_n "checking for $ac_word""... $ac_c" 1>&6 -echo "configure:1492: checking for $ac_word" >&5 +echo "configure:1493: checking for $ac_word" >&5 if test -n "$CC"; then ac_cv_prog_CC="$CC" # Let the user override the test. @@ -1533,7 +1534,7 @@ fi echo $ac_n "checking whether the C compiler ($CC $CFLAGS $LDFLAGS) works""... $ac_c" 1>&6 -echo "configure:1537: checking whether the C compiler ($CC $CFLAGS $LDFLAGS) works" >&5 +echo "configure:1538: 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' @@ -1545,11 +1546,11 @@ cross_compiling=no cat > conftest.$ac_ext <&5; (eval $ac_link) 2>&5; } && test -s conftest; then +if { (eval echo configure:1554: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest; then ac_cv_prog_cc_works=yes # If we can't run a trivial program, we are probably using a cross compiler. if (./conftest; exit) 2>/dev/null; then @@ -1569,19 +1570,19 @@ { 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:1573: checking whether the C compiler ($CC $CFLAGS $LDFLAGS) is a cross-compiler" >&5 +echo "configure:1574: 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:1578: checking whether we are using GNU C" >&5 +echo "configure:1579: 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:1586: \"$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 @@ -1595,7 +1596,7 @@ ac_save_CFLAGS="$CFLAGS" CFLAGS= echo $ac_n "checking whether ${CC-cc} accepts -g""... $ac_c" 1>&6 -echo "configure:1599: checking whether ${CC-cc} accepts -g" >&5 +echo "configure:1600: checking whether ${CC-cc} accepts -g" >&5 echo 'void f(){}' > conftest.c if test -z "`${CC-cc} -g -c conftest.c 2>&1`"; then @@ -1624,7 +1625,7 @@ # Extract the first word of "gcc", so it can be a program name with args. set dummy gcc; ac_word=$2 echo $ac_n "checking for $ac_word""... $ac_c" 1>&6 -echo "configure:1628: checking for $ac_word" >&5 +echo "configure:1629: checking for $ac_word" >&5 if test -n "$CC"; then ac_cv_prog_CC="$CC" # Let the user override the test. @@ -1650,7 +1651,7 @@ # Extract the first word of "cc", so it can be a program name with args. set dummy cc; ac_word=$2 echo $ac_n "checking for $ac_word""... $ac_c" 1>&6 -echo "configure:1654: checking for $ac_word" >&5 +echo "configure:1655: checking for $ac_word" >&5 if test -n "$CC"; then ac_cv_prog_CC="$CC" # Let the user override the test. @@ -1695,7 +1696,7 @@ fi echo $ac_n "checking whether the C compiler ($CC $CFLAGS $LDFLAGS) works""... $ac_c" 1>&6 -echo "configure:1699: checking whether the C compiler ($CC $CFLAGS $LDFLAGS) works" >&5 +echo "configure:1700: 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' @@ -1707,11 +1708,11 @@ cross_compiling=no cat > conftest.$ac_ext <&5; (eval $ac_link) 2>&5; } && test -s conftest; then +if { (eval echo configure:1716: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest; then ac_cv_prog_cc_works=yes # If we can't run a trivial program, we are probably using a cross compiler. if (./conftest; exit) 2>/dev/null; then @@ -1731,19 +1732,19 @@ { 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:1735: checking whether the C compiler ($CC $CFLAGS $LDFLAGS) is a cross-compiler" >&5 +echo "configure:1736: 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:1740: checking whether we are using GNU C" >&5 +echo "configure:1741: 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:1748: \"$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 @@ -1757,7 +1758,7 @@ ac_save_CFLAGS="$CFLAGS" CFLAGS= echo $ac_n "checking whether ${CC-cc} accepts -g""... $ac_c" 1>&6 -echo "configure:1761: checking whether ${CC-cc} accepts -g" >&5 +echo "configure:1762: checking whether ${CC-cc} accepts -g" >&5 echo 'void f(){}' > conftest.c if test -z "`${CC-cc} -g -c conftest.c 2>&1`"; then @@ -1790,7 +1791,7 @@ 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:1794: checking how to run the C preprocessor" >&5 +echo "configure:1795: checking how to run the C preprocessor" >&5 # On Suns, sometimes $CPP names a directory. if test -n "$CPP" && test -d "$CPP"; then CPP= @@ -1803,13 +1804,13 @@ # On the NeXT, cc -E runs the code through the compiler's parser, # not just through cpp. cat > conftest.$ac_ext < Syntax Error EOF ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out" -{ (eval echo configure:1813: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; } +{ (eval echo configure:1814: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; } ac_err=`grep -v '^ *+' conftest.out` if test -z "$ac_err"; then : @@ -1820,13 +1821,13 @@ rm -rf conftest* CPP="${CC-cc} -E -traditional-cpp" cat > conftest.$ac_ext < Syntax Error EOF ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out" -{ (eval echo configure:1830: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; } +{ (eval echo configure:1831: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; } ac_err=`grep -v '^ *+' conftest.out` if test -z "$ac_err"; then : @@ -1849,9 +1850,9 @@ echo $ac_n "checking for AIX""... $ac_c" 1>&6 -echo "configure:1853: checking for AIX" >&5 -cat > conftest.$ac_ext <&5 +cat > conftest.$ac_ext <&6 -echo "configure:1882: checking for GNU libc" >&5 -cat > conftest.$ac_ext <&5 +cat > conftest.$ac_ext < int main() { @@ -1892,7 +1893,7 @@ ; return 0; } EOF -if { (eval echo configure:1896: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then +if { (eval echo configure:1897: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then rm -rf conftest* have_glibc=yes else @@ -1913,9 +1914,9 @@ echo $ac_n "checking whether we are using SunPro C""... $ac_c" 1>&6 -echo "configure:1917: checking whether we are using SunPro C" >&5 -cat > conftest.$ac_ext <&5 +cat > conftest.$ac_ext <&5; (eval $ac_compile) 2>&5; }; then +if { (eval echo configure:1931: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then rm -rf conftest* __sunpro_c=yes else @@ -2202,7 +2203,7 @@ fi echo $ac_n "checking for dynodump""... $ac_c" 1>&6 -echo "configure:2206: checking for dynodump" >&5 +echo "configure:2207: checking for dynodump" >&5 if test "$unexec" != "unexsol2.o"; then echo "$ac_t""no" 1>&6 else @@ -2300,19 +2301,19 @@ if test "$add_runtime_path" = "yes"; then echo $ac_n "checking "for runtime libraries flag"""... $ac_c" 1>&6 -echo "configure:2304: checking "for runtime libraries flag"" >&5 +echo "configure:2305: checking "for runtime libraries flag"" >&5 dash_r="" for try_dash_r in "-R" "-R " "-rpath "; do xe_check_libs="${try_dash_r}/no/such/file-or-directory" cat > conftest.$ac_ext <&5; (eval $ac_link) 2>&5; } && test -s conftest; then +#line 2310 "configure" +#include "confdefs.h" + +int main() { + +; return 0; } +EOF +if { (eval echo configure:2317: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest; then rm -rf conftest* dash_r="$try_dash_r" else @@ -2393,11 +2394,12 @@ GNU_MALLOC=yes doug_lea_malloc=yes +after_morecore_hook_exists=yes echo $ac_n "checking for malloc_get_state""... $ac_c" 1>&6 -echo "configure:2398: checking for malloc_get_state" >&5 - -cat > conftest.$ac_ext <&5 + +cat > conftest.$ac_ext <&5; (eval $ac_link) 2>&5; } && test -s conftest; then +if { (eval echo configure:2426: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest; then rm -rf conftest* eval "ac_cv_func_malloc_get_state=yes" else @@ -2440,10 +2442,10 @@ fi echo $ac_n "checking for malloc_set_state""... $ac_c" 1>&6 -echo "configure:2444: checking for malloc_set_state" >&5 - -cat > conftest.$ac_ext <&5 + +cat > conftest.$ac_ext <&5; (eval $ac_link) 2>&5; } && test -s conftest; then +if { (eval echo configure:2472: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest; then rm -rf conftest* eval "ac_cv_func_malloc_set_state=yes" else @@ -2486,24 +2488,24 @@ fi echo $ac_n "checking whether __after_morecore_hook exists""... $ac_c" 1>&6 -echo "configure:2490: checking whether __after_morecore_hook exists" >&5 -cat > conftest.$ac_ext <&5 +cat > conftest.$ac_ext <&5; (eval $ac_link) 2>&5; } && test -s conftest; then - rm -rf conftest* - echo "$ac_t""yes" 1>&6 -else - echo "configure: failed program was:" >&5 - cat conftest.$ac_ext >&5 - rm -rf conftest* - echo "$ac_t""no" 1>&6 - doug_lea_malloc=no +if { (eval echo configure:2501: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest; then + rm -rf conftest* + echo "$ac_t""yes" 1>&6 +else + echo "configure: failed program was:" >&5 + cat conftest.$ac_ext >&5 + rm -rf conftest* + echo "$ac_t""no" 1>&6 + after_morecore_hook_exists=no fi rm -f conftest* if test "$system_malloc" = "yes" ; then @@ -2523,7 +2525,7 @@ if test "$doug_lea_malloc" = "yes" ; then if test "$GNU_MALLOC" = yes ; then GNU_MALLOC_reason=" - (Using Doug Lea's new malloc from the GNU C Library.)" + (Using Doug Lea's new malloc from the GNU C Library.)" fi { test "$extra_verbose" = "yes" && cat << \EOF Defining DOUG_LEA_MALLOC @@ -2541,6 +2543,18 @@ EOF } + if test "$after_morecore_hook_exists" = "no" ; then + GNU_MALLOC_reason=" + (Using Doug Lea's new malloc from the Linux C Library.)" + { test "$extra_verbose" = "yes" && cat << \EOF + Defining _NO_MALLOC_WARNING_ +EOF +cat >> confdefs.h <<\EOF +#define _NO_MALLOC_WARNING_ 1 +EOF +} + + fi with_minimal_tagbits=yes fi @@ -2548,7 +2562,7 @@ # 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:2552: checking for $ac_word" >&5 +echo "configure:2566: checking for $ac_word" >&5 if test -n "$RANLIB"; then ac_cv_prog_RANLIB="$RANLIB" # Let the user override the test. @@ -2601,7 +2615,7 @@ # SVR4 /usr/ucb/install, which tries to use the nonexistent group "staff" # ./install, which can be erroneously created by make from ./install.sh. echo $ac_n "checking for a BSD compatible install""... $ac_c" 1>&6 -echo "configure:2605: checking for a BSD compatible install" >&5 +echo "configure:2619: checking for a BSD compatible install" >&5 if test -z "$INSTALL"; then IFS="${IFS= }"; ac_save_IFS="$IFS"; IFS="${IFS}:" @@ -2652,7 +2666,7 @@ # Extract the first word of "$ac_prog", so it can be a program name with args. set dummy $ac_prog; ac_word=$2 echo $ac_n "checking for $ac_word""... $ac_c" 1>&6 -echo "configure:2656: checking for $ac_word" >&5 +echo "configure:2670: checking for $ac_word" >&5 if test -n "$YACC"; then ac_cv_prog_YACC="$YACC" # Let the user override the test. @@ -2683,15 +2697,15 @@ do ac_safe=`echo "$ac_hdr" | sed 'y%./+-%__p_%'` echo $ac_n "checking for $ac_hdr""... $ac_c" 1>&6 -echo "configure:2687: checking for $ac_hdr" >&5 - -cat > conftest.$ac_ext <&5 + +cat > conftest.$ac_ext < EOF ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out" -{ (eval echo configure:2695: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; } +{ (eval echo configure:2709: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; } ac_err=`grep -v '^ *+' conftest.out` if test -z "$ac_err"; then rm -rf conftest* @@ -2724,15 +2738,15 @@ do ac_safe=`echo "$ac_hdr" | sed 'y%./+-%__p_%'` echo $ac_n "checking for $ac_hdr""... $ac_c" 1>&6 -echo "configure:2728: checking for $ac_hdr" >&5 - -cat > conftest.$ac_ext <&5 + +cat > conftest.$ac_ext < EOF ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out" -{ (eval echo configure:2736: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; } +{ (eval echo configure:2750: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; } ac_err=`grep -v '^ *+' conftest.out` if test -z "$ac_err"; then rm -rf conftest* @@ -2765,15 +2779,15 @@ do ac_safe=`echo "$ac_hdr" | sed 'y%./+-%__p_%'` echo $ac_n "checking for $ac_hdr""... $ac_c" 1>&6 -echo "configure:2769: checking for $ac_hdr" >&5 - -cat > conftest.$ac_ext <&5 + +cat > conftest.$ac_ext < EOF ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out" -{ (eval echo configure:2777: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; } +{ (eval echo configure:2791: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; } ac_err=`grep -v '^ *+' conftest.out` if test -z "$ac_err"; then rm -rf conftest* @@ -2803,10 +2817,10 @@ done echo $ac_n "checking for sys/wait.h that is POSIX.1 compatible""... $ac_c" 1>&6 -echo "configure:2807: checking for sys/wait.h that is POSIX.1 compatible" >&5 - -cat > conftest.$ac_ext <&5 + +cat > conftest.$ac_ext < #include @@ -2822,7 +2836,7 @@ s = WIFEXITED (s) ? WEXITSTATUS (s) : 1; ; return 0; } EOF -if { (eval echo configure:2826: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then +if { (eval echo configure:2840: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then rm -rf conftest* ac_cv_header_sys_wait_h=yes else @@ -2846,10 +2860,10 @@ fi echo $ac_n "checking for ANSI C header files""... $ac_c" 1>&6 -echo "configure:2850: checking for ANSI C header files" >&5 - -cat > conftest.$ac_ext <&5 + +cat > conftest.$ac_ext < #include @@ -2857,7 +2871,7 @@ #include EOF ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out" -{ (eval echo configure:2861: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; } +{ (eval echo configure:2875: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; } ac_err=`grep -v '^ *+' conftest.out` if test -z "$ac_err"; then rm -rf conftest* @@ -2874,7 +2888,7 @@ if test $ac_cv_header_stdc = yes; then # SunOS 4.x string.h does not declare mem*, contrary to ANSI. cat > conftest.$ac_ext < EOF @@ -2892,7 +2906,7 @@ if test $ac_cv_header_stdc = yes; then # ISC 2.0.2 stdlib.h does not declare free, contrary to ANSI. cat > conftest.$ac_ext < EOF @@ -2910,7 +2924,7 @@ 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') @@ -2921,7 +2935,7 @@ exit (0); } EOF -if { (eval echo configure:2925: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest && (./conftest; exit) 2>&5 +if { (eval echo configure:2939: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest && (./conftest; exit) 2>&5 then : else @@ -2946,10 +2960,10 @@ fi echo $ac_n "checking whether time.h and sys/time.h may both be included""... $ac_c" 1>&6 -echo "configure:2950: checking whether time.h and sys/time.h may both be included" >&5 - -cat > conftest.$ac_ext <&5 + +cat > conftest.$ac_ext < #include @@ -2958,7 +2972,7 @@ struct tm *tp; ; return 0; } EOF -if { (eval echo configure:2962: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then +if { (eval echo configure:2976: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then rm -rf conftest* ac_cv_header_time=yes else @@ -2982,10 +2996,10 @@ fi echo $ac_n "checking for sys_siglist declaration in signal.h or unistd.h""... $ac_c" 1>&6 -echo "configure:2986: checking for sys_siglist declaration in signal.h or unistd.h" >&5 - -cat > conftest.$ac_ext <&5 + +cat > conftest.$ac_ext < #include @@ -2997,7 +3011,7 @@ char *msg = *(sys_siglist + 1); ; return 0; } EOF -if { (eval echo configure:3001: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then +if { (eval echo configure:3015: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then rm -rf conftest* ac_cv_decl_sys_siglist=yes else @@ -3022,9 +3036,9 @@ echo $ac_n "checking for struct utimbuf""... $ac_c" 1>&6 -echo "configure:3026: checking for struct utimbuf" >&5 -cat > conftest.$ac_ext <&5 +cat > conftest.$ac_ext < @@ -3043,7 +3057,7 @@ static struct utimbuf x; x.actime = x.modtime; ; return 0; } EOF -if { (eval echo configure:3047: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then +if { (eval echo configure:3061: \"$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 @@ -3063,10 +3077,10 @@ rm -f conftest* echo $ac_n "checking return type of signal handlers""... $ac_c" 1>&6 -echo "configure:3067: checking return type of signal handlers" >&5 - -cat > conftest.$ac_ext <&5 + +cat > conftest.$ac_ext < #include @@ -3083,7 +3097,7 @@ int i; ; return 0; } EOF -if { (eval echo configure:3087: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then +if { (eval echo configure:3101: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then rm -rf conftest* ac_cv_type_signal=void else @@ -3105,10 +3119,10 @@ echo $ac_n "checking for size_t""... $ac_c" 1>&6 -echo "configure:3109: checking for size_t" >&5 - -cat > conftest.$ac_ext <&5 + +cat > conftest.$ac_ext < #if STDC_HEADERS @@ -3139,10 +3153,10 @@ fi echo $ac_n "checking for pid_t""... $ac_c" 1>&6 -echo "configure:3143: checking for pid_t" >&5 - -cat > conftest.$ac_ext <&5 + +cat > conftest.$ac_ext < #if STDC_HEADERS @@ -3173,10 +3187,10 @@ fi echo $ac_n "checking for uid_t in sys/types.h""... $ac_c" 1>&6 -echo "configure:3177: checking for uid_t in sys/types.h" >&5 - -cat > conftest.$ac_ext <&5 + +cat > conftest.$ac_ext < EOF @@ -3212,10 +3226,10 @@ fi echo $ac_n "checking for mode_t""... $ac_c" 1>&6 -echo "configure:3216: checking for mode_t" >&5 - -cat > conftest.$ac_ext <&5 + +cat > conftest.$ac_ext < #if STDC_HEADERS @@ -3246,10 +3260,10 @@ fi echo $ac_n "checking for off_t""... $ac_c" 1>&6 -echo "configure:3250: checking for off_t" >&5 - -cat > conftest.$ac_ext <&5 + +cat > conftest.$ac_ext < #if STDC_HEADERS @@ -3281,9 +3295,9 @@ echo $ac_n "checking for struct timeval""... $ac_c" 1>&6 -echo "configure:3285: checking for struct timeval" >&5 -cat > conftest.$ac_ext <&5 +cat > conftest.$ac_ext < @@ -3299,7 +3313,7 @@ static struct timeval x; x.tv_sec = x.tv_usec; ; return 0; } EOF -if { (eval echo configure:3303: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then +if { (eval echo configure:3317: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then rm -rf conftest* echo "$ac_t""yes" 1>&6 HAVE_TIMEVAL=yes @@ -3321,10 +3335,10 @@ rm -f conftest* echo $ac_n "checking whether struct tm is in sys/time.h or time.h""... $ac_c" 1>&6 -echo "configure:3325: checking whether struct tm is in sys/time.h or time.h" >&5 - -cat > conftest.$ac_ext <&5 + +cat > conftest.$ac_ext < #include @@ -3332,7 +3346,7 @@ struct tm *tp; tp->tm_sec; ; return 0; } EOF -if { (eval echo configure:3336: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then +if { (eval echo configure:3350: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then rm -rf conftest* ac_cv_struct_tm=time.h else @@ -3356,10 +3370,10 @@ fi echo $ac_n "checking for tm_zone in struct tm""... $ac_c" 1>&6 -echo "configure:3360: checking for tm_zone in struct tm" >&5 - -cat > conftest.$ac_ext <&5 + +cat > conftest.$ac_ext < #include <$ac_cv_struct_tm> @@ -3367,7 +3381,7 @@ struct tm tm; tm.tm_zone; ; return 0; } EOF -if { (eval echo configure:3371: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then +if { (eval echo configure:3385: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then rm -rf conftest* ac_cv_struct_tm_zone=yes else @@ -3390,10 +3404,10 @@ else echo $ac_n "checking for tzname""... $ac_c" 1>&6 -echo "configure:3394: checking for tzname" >&5 - -cat > conftest.$ac_ext <&5 + +cat > conftest.$ac_ext < #ifndef tzname /* For SGI. */ @@ -3403,7 +3417,7 @@ atoi(*tzname); ; return 0; } EOF -if { (eval echo configure:3407: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest; then +if { (eval echo configure:3421: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest; then rm -rf conftest* ac_cv_var_tzname=yes else @@ -3429,10 +3443,10 @@ echo $ac_n "checking for working const""... $ac_c" 1>&6 -echo "configure:3433: checking for working const" >&5 - -cat > conftest.$ac_ext <&5 + +cat > conftest.$ac_ext <&5; (eval $ac_compile) 2>&5; }; then +if { (eval echo configure:3499: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then rm -rf conftest* ac_cv_c_const=yes else @@ -3506,7 +3520,7 @@ echo $ac_n "checking whether ${MAKE-make} sets \${MAKE}""... $ac_c" 1>&6 -echo "configure:3510: checking whether ${MAKE-make} sets \${MAKE}" >&5 +echo "configure:3524: checking whether ${MAKE-make} sets \${MAKE}" >&5 set dummy ${MAKE-make}; ac_make=`echo "$2" | sed 'y%./+-%__p_%'` cat > conftestmake <<\EOF @@ -3531,12 +3545,12 @@ echo $ac_n "checking whether byte ordering is bigendian""... $ac_c" 1>&6 -echo "configure:3535: checking whether byte ordering is bigendian" >&5 +echo "configure:3549: 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 @@ -3547,11 +3561,11 @@ #endif ; return 0; } EOF -if { (eval echo configure:3551: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then +if { (eval echo configure:3565: \"$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 @@ -3562,7 +3576,7 @@ #endif ; return 0; } EOF -if { (eval echo configure:3566: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then +if { (eval echo configure:3580: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then rm -rf conftest* ac_cv_c_bigendian=yes else @@ -3579,7 +3593,7 @@ 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:3610: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest && (./conftest; exit) 2>&5 then ac_cv_c_bigendian=no else @@ -3618,10 +3632,10 @@ echo $ac_n "checking size of short""... $ac_c" 1>&6 -echo "configure:3622: checking size of short" >&5 - -cat > conftest.$ac_ext <&5 + +cat > conftest.$ac_ext < main() @@ -3632,7 +3646,7 @@ exit(0); } EOF -if { (eval echo configure:3636: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest && (./conftest; exit) 2>&5 +if { (eval echo configure:3650: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest && (./conftest; exit) 2>&5 then ac_cv_sizeof_short=`cat conftestval` else @@ -3659,10 +3673,10 @@ exit 1 fi echo $ac_n "checking size of int""... $ac_c" 1>&6 -echo "configure:3663: checking size of int" >&5 - -cat > conftest.$ac_ext <&5 + +cat > conftest.$ac_ext < main() @@ -3673,7 +3687,7 @@ exit(0); } EOF -if { (eval echo configure:3677: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest && (./conftest; exit) 2>&5 +if { (eval echo configure:3691: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest && (./conftest; exit) 2>&5 then ac_cv_sizeof_int=`cat conftestval` else @@ -3694,10 +3708,10 @@ echo $ac_n "checking size of long""... $ac_c" 1>&6 -echo "configure:3698: checking size of long" >&5 - -cat > conftest.$ac_ext <&5 + +cat > conftest.$ac_ext < main() @@ -3708,7 +3722,7 @@ exit(0); } EOF -if { (eval echo configure:3712: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest && (./conftest; exit) 2>&5 +if { (eval echo configure:3726: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest && (./conftest; exit) 2>&5 then ac_cv_sizeof_long=`cat conftestval` else @@ -3729,10 +3743,10 @@ echo $ac_n "checking size of long long""... $ac_c" 1>&6 -echo "configure:3733: checking size of long long" >&5 - -cat > conftest.$ac_ext <&5 + +cat > conftest.$ac_ext < main() @@ -3743,7 +3757,7 @@ exit(0); } EOF -if { (eval echo configure:3747: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest && (./conftest; exit) 2>&5 +if { (eval echo configure:3761: \"$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 @@ -3764,10 +3778,10 @@ echo $ac_n "checking size of void *""... $ac_c" 1>&6 -echo "configure:3768: checking size of void *" >&5 - -cat > conftest.$ac_ext <&5 + +cat > conftest.$ac_ext < main() @@ -3778,7 +3792,7 @@ exit(0); } EOF -if { (eval echo configure:3782: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest && (./conftest; exit) 2>&5 +if { (eval echo configure:3796: \"$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 @@ -3800,7 +3814,7 @@ echo $ac_n "checking for long file names""... $ac_c" 1>&6 -echo "configure:3804: checking for long file names" >&5 +echo "configure:3818: 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: @@ -3847,12 +3861,12 @@ echo $ac_n "checking for sin in -lm""... $ac_c" 1>&6 -echo "configure:3851: checking for sin in -lm" >&5 +echo "configure:3865: 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; then +if { (eval echo configure:3881: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest; then rm -rf conftest* eval "ac_cv_lib_$ac_lib_var=yes" else @@ -3905,14 +3919,14 @@ cat > conftest.$ac_ext < int main() { return atanh(1.0) + asinh(1.0) + acosh(1.0); ; return 0; } EOF -if { (eval echo configure:3916: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest; then +if { (eval echo configure:3930: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest; then rm -rf conftest* { test "$extra_verbose" = "yes" && cat << \EOF Defining HAVE_INVERSE_HYPERBOLIC @@ -3929,7 +3943,7 @@ rm -f conftest* echo "checking type of mail spool file locking" 1>&6 -echo "configure:3933: checking type of mail spool file locking" >&5 +echo "configure:3947: checking type of mail spool file locking" >&5 test -z "$mail_locking" -a "$mail_use_flock" = "yes" && mail_locking=flock test -z "$mail_locking" -a "$mail_use_lockf" = "yes" && mail_locking=lockf if test "$mail_locking" = "lockf"; then { test "$extra_verbose" = "yes" && cat << \EOF @@ -3953,12 +3967,12 @@ echo $ac_n "checking for kstat_open in -lkstat""... $ac_c" 1>&6 -echo "configure:3957: checking for kstat_open in -lkstat" >&5 +echo "configure:3971: 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; then +if { (eval echo configure:3987: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest; then rm -rf conftest* eval "ac_cv_lib_$ac_lib_var=yes" else @@ -4003,12 +4017,12 @@ echo $ac_n "checking for kvm_read in -lkvm""... $ac_c" 1>&6 -echo "configure:4007: checking for kvm_read in -lkvm" >&5 +echo "configure:4021: 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; then +if { (eval echo configure:4037: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest; then rm -rf conftest* eval "ac_cv_lib_$ac_lib_var=yes" else @@ -4053,12 +4067,12 @@ echo $ac_n "checking for cma_open in -lpthreads""... $ac_c" 1>&6 -echo "configure:4057: checking for cma_open in -lpthreads" >&5 +echo "configure:4071: 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; then +if { (eval echo configure:4087: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest; then rm -rf conftest* eval "ac_cv_lib_$ac_lib_var=yes" else @@ -4105,7 +4119,7 @@ fi echo $ac_n "checking whether the -xildoff compiler flag is required""... $ac_c" 1>&6 -echo "configure:4109: checking whether the -xildoff compiler flag is required" >&5 +echo "configure:4123: 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; @@ -4116,7 +4130,7 @@ if test "$opsys" = "sol2" && test "$OS_RELEASE" -ge 56; then echo $ac_n "checking for \"-z ignore\" linker flag""... $ac_c" 1>&6 -echo "configure:4120: checking for \"-z ignore\" linker flag" >&5 +echo "configure:4134: 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 ;; @@ -4126,7 +4140,7 @@ echo "checking "for specified window system"" 1>&6 -echo "configure:4130: checking "for specified window system"" >&5 +echo "configure:4144: checking "for specified window system"" >&5 if test "$with_x11" != "no"; then test "$x_includes $x_libraries" != "NONE NONE" && \ @@ -4156,7 +4170,7 @@ # Uses ac_ vars as temps to allow command line to override cache and checks. # --without-x overrides everything else, but does not touch the cache. echo $ac_n "checking for X""... $ac_c" 1>&6 -echo "configure:4160: checking for X" >&5 +echo "configure:4174: checking for X" >&5 # Check whether --with-x or --without-x was given. if test "${with_x+set}" = set; then @@ -4216,12 +4230,12 @@ # First, try using that file with no special directory specified. cat > conftest.$ac_ext < EOF ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out" -{ (eval echo configure:4225: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; } +{ (eval echo configure:4239: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; } ac_err=`grep -v '^ *+' conftest.out` if test -z "$ac_err"; then rm -rf conftest* @@ -4290,14 +4304,14 @@ ac_save_LIBS="$LIBS" LIBS="-l$x_direct_test_library $LIBS" cat > conftest.$ac_ext <&5; (eval $ac_link) 2>&5; } && test -s conftest; then +if { (eval echo configure:4315: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest; then rm -rf conftest* LIBS="$ac_save_LIBS" # We can link X programs with no special library path. @@ -4406,17 +4420,17 @@ 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:4410: checking whether -R must be followed by a space" >&5 +echo "configure:4424: 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; then +#line 4427 "configure" +#include "confdefs.h" + +int main() { + +; return 0; } +EOF +if { (eval echo configure:4434: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest; then rm -rf conftest* ac_R_nospace=yes else @@ -4432,14 +4446,14 @@ else LIBS="$ac_xsave_LIBS -R $x_libraries" cat > conftest.$ac_ext <&5; (eval $ac_link) 2>&5; } && test -s conftest; then +#line 4450 "configure" +#include "confdefs.h" + +int main() { + +; return 0; } +EOF +if { (eval echo configure:4457: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest; then rm -rf conftest* ac_R_space=yes else @@ -4475,12 +4489,12 @@ else echo $ac_n "checking for dnet_ntoa in -ldnet""... $ac_c" 1>&6 -echo "configure:4479: checking for dnet_ntoa in -ldnet" >&5 +echo "configure:4493: 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; then +if { (eval echo configure:4509: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest; then rm -rf conftest* eval "ac_cv_lib_$ac_lib_var=yes" else @@ -4515,12 +4529,12 @@ 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:4519: checking for dnet_ntoa in -ldnet_stub" >&5 +echo "configure:4533: 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; then +if { (eval echo configure:4549: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest; then rm -rf conftest* eval "ac_cv_lib_$ac_lib_var=yes" else @@ -4560,10 +4574,10 @@ # 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:4564: checking for gethostbyname" >&5 - -cat > conftest.$ac_ext <&5 + +cat > conftest.$ac_ext <&5; (eval $ac_link) 2>&5; } && test -s conftest; then +if { (eval echo configure:4604: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest; then rm -rf conftest* eval "ac_cv_func_gethostbyname=yes" else @@ -4607,12 +4621,12 @@ if test $ac_cv_func_gethostbyname = no; then echo $ac_n "checking for gethostbyname in -lnsl""... $ac_c" 1>&6 -echo "configure:4611: checking for gethostbyname in -lnsl" >&5 +echo "configure:4625: 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; then +if { (eval echo configure:4641: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest; then rm -rf conftest* eval "ac_cv_lib_$ac_lib_var=yes" else @@ -4653,10 +4667,10 @@ # -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:4657: checking for connect" >&5 - -cat > conftest.$ac_ext <&5 + +cat > conftest.$ac_ext <&5; (eval $ac_link) 2>&5; } && test -s conftest; then +if { (eval echo configure:4697: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest; then rm -rf conftest* eval "ac_cv_func_connect=yes" else @@ -4702,12 +4716,12 @@ 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:4706: checking "$xe_msg_checking"" >&5 +echo "configure:4720: 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; then +if { (eval echo configure:4736: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest; then rm -rf conftest* eval "ac_cv_lib_$ac_lib_var=yes" else @@ -4742,10 +4756,10 @@ # gomez@mi.uni-erlangen.de says -lposix is necessary on A/UX. echo $ac_n "checking for remove""... $ac_c" 1>&6 -echo "configure:4746: checking for remove" >&5 - -cat > conftest.$ac_ext <&5 + +cat > conftest.$ac_ext <&5; (eval $ac_link) 2>&5; } && test -s conftest; then +if { (eval echo configure:4786: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest; then rm -rf conftest* eval "ac_cv_func_remove=yes" else @@ -4789,12 +4803,12 @@ if test $ac_cv_func_remove = no; then echo $ac_n "checking for remove in -lposix""... $ac_c" 1>&6 -echo "configure:4793: checking for remove in -lposix" >&5 +echo "configure:4807: 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; then +if { (eval echo configure:4823: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest; then rm -rf conftest* eval "ac_cv_lib_$ac_lib_var=yes" else @@ -4829,10 +4843,10 @@ # BSDI BSD/OS 2.1 needs -lipc for XOpenDisplay. echo $ac_n "checking for shmat""... $ac_c" 1>&6 -echo "configure:4833: checking for shmat" >&5 - -cat > conftest.$ac_ext <&5 + +cat > conftest.$ac_ext <&5; (eval $ac_link) 2>&5; } && test -s conftest; then +if { (eval echo configure:4873: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest; then rm -rf conftest* eval "ac_cv_func_shmat=yes" else @@ -4876,12 +4890,12 @@ if test $ac_cv_func_shmat = no; then echo $ac_n "checking for shmat in -lipc""... $ac_c" 1>&6 -echo "configure:4880: checking for shmat in -lipc" >&5 +echo "configure:4894: 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; then +if { (eval echo configure:4910: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest; then rm -rf conftest* eval "ac_cv_lib_$ac_lib_var=yes" else @@ -4926,12 +4940,12 @@ # --interran@uluru.Stanford.EDU, kb@cs.umb.edu. echo $ac_n "checking for IceConnectionNumber in -lICE""... $ac_c" 1>&6 -echo "configure:4930: checking for IceConnectionNumber in -lICE" >&5 +echo "configure:4944: checking for IceConnectionNumber in -lICE" >&5 ac_lib_var=`echo ICE'_'IceConnectionNumber | sed 'y%./+-%__p_%'` xe_check_libs=" -lICE " cat > conftest.$ac_ext <&5; (eval $ac_link) 2>&5; } && test -s conftest; then +if { (eval echo configure:4960: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest; then rm -rf conftest* eval "ac_cv_lib_$ac_lib_var=yes" else @@ -4979,22 +4993,22 @@ if test "$window_system" = "none" && test -z "$with_tty"; then echo "checking for MS-Windows" 1>&6 -echo "configure:4983: checking for MS-Windows" >&5 +echo "configure:4997: checking for MS-Windows" >&5 echo $ac_n "checking for main in -lgdi32""... $ac_c" 1>&6 -echo "configure:4986: checking for main in -lgdi32" >&5 +echo "configure:5000: 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; then +if { (eval echo configure:5012: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest; then rm -rf conftest* eval "ac_cv_lib_$ac_lib_var=yes" else @@ -5035,7 +5049,7 @@ with_toolbars=no with_tty=no const_is_losing=no - #with_mule_coding=yes + with_file_coding=yes extra_objs="$extra_objs console-msw.o device-msw.o event-msw.o frame-msw.o objects-msw.o select-msw.o redisplay-msw.o gif_err.o gifalloc.o dgif_lib.o" && if test "$extra_verbose" = "yes"; then echo " xemacs will be linked with \"console-msw.o device-msw.o event-msw.o frame-msw.o objects-msw.o select-msw.o redisplay-msw.o gif_err.o gifalloc.o dgif_lib.o\"" fi @@ -5140,7 +5154,7 @@ fi echo "checking for X defines extracted by xmkmf" 1>&6 -echo "configure:5144: checking for X defines extracted by xmkmf" >&5 +echo "configure:5158: checking for X defines extracted by xmkmf" >&5 rm -fr conftestdir if mkdir conftestdir; then cd conftestdir @@ -5172,15 +5186,15 @@ ac_safe=`echo "X11/Intrinsic.h" | sed 'y%./+-%__p_%'` echo $ac_n "checking for X11/Intrinsic.h""... $ac_c" 1>&6 -echo "configure:5176: checking for X11/Intrinsic.h" >&5 - -cat > conftest.$ac_ext <&5 + +cat > conftest.$ac_ext < EOF ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out" -{ (eval echo configure:5184: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; } +{ (eval echo configure:5198: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; } ac_err=`grep -v '^ *+' conftest.out` if test -z "$ac_err"; then rm -rf conftest* @@ -5204,12 +5218,12 @@ echo $ac_n "checking for XOpenDisplay in -lX11""... $ac_c" 1>&6 -echo "configure:5208: checking for XOpenDisplay in -lX11" >&5 +echo "configure:5222: 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; then +if { (eval echo configure:5238: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest; then rm -rf conftest* eval "ac_cv_lib_$ac_lib_var=yes" else @@ -5245,12 +5259,12 @@ 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:5249: checking "$xe_msg_checking"" >&5 +echo "configure:5263: 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; then +if { (eval echo configure:5279: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest; then rm -rf conftest* eval "ac_cv_lib_$ac_lib_var=yes" else @@ -5288,12 +5302,12 @@ echo $ac_n "checking for XShapeSelectInput in -lXext""... $ac_c" 1>&6 -echo "configure:5292: checking for XShapeSelectInput in -lXext" >&5 +echo "configure:5306: 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; then +if { (eval echo configure:5322: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest; then rm -rf conftest* eval "ac_cv_lib_$ac_lib_var=yes" else @@ -5327,12 +5341,12 @@ echo $ac_n "checking for XtOpenDisplay in -lXt""... $ac_c" 1>&6 -echo "configure:5331: checking for XtOpenDisplay in -lXt" >&5 +echo "configure:5345: 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; then +if { (eval echo configure:5361: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest; then rm -rf conftest* eval "ac_cv_lib_$ac_lib_var=yes" else @@ -5366,14 +5380,14 @@ echo $ac_n "checking the version of X11 being used""... $ac_c" 1>&6 -echo "configure:5370: checking the version of X11 being used" >&5 +echo "configure:5384: checking the version of X11 being used" >&5 cat > conftest.$ac_ext < main(int c, char* v[]) { return c>1 ? XlibSpecificationRelease : 0; } EOF -if { (eval echo configure:5377: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest && (./conftest; exit) 2>&5 +if { (eval echo configure:5391: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest && (./conftest; exit) 2>&5 then ./conftest foobar; x11_release=$? else @@ -5397,15 +5411,15 @@ do ac_safe=`echo "$ac_hdr" | sed 'y%./+-%__p_%'` echo $ac_n "checking for $ac_hdr""... $ac_c" 1>&6 -echo "configure:5401: checking for $ac_hdr" >&5 - -cat > conftest.$ac_ext <&5 + +cat > conftest.$ac_ext < EOF ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out" -{ (eval echo configure:5409: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; } +{ (eval echo configure:5423: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; } ac_err=`grep -v '^ *+' conftest.out` if test -z "$ac_err"; then rm -rf conftest* @@ -5436,7 +5450,7 @@ echo $ac_n "checking for XFree86""... $ac_c" 1>&6 -echo "configure:5440: checking for XFree86" >&5 +echo "configure:5454: checking for XFree86" >&5 if test -d "/usr/X386/include" -o \ -f "/etc/XF86Config" -o \ -f "/etc/X11/XF86Config" -o \ @@ -5456,12 +5470,12 @@ test -z "$with_xmu" && { echo $ac_n "checking for XmuReadBitmapDataFromFile in -lXmu""... $ac_c" 1>&6 -echo "configure:5460: checking for XmuReadBitmapDataFromFile in -lXmu" >&5 +echo "configure:5474: 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; then +if { (eval echo configure:5490: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest; then rm -rf conftest* eval "ac_cv_lib_$ac_lib_var=yes" else @@ -5511,19 +5525,19 @@ echo $ac_n "checking for main in -lXbsd""... $ac_c" 1>&6 -echo "configure:5515: checking for main in -lXbsd" >&5 +echo "configure:5529: 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; then +if { (eval echo configure:5541: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest; then rm -rf conftest* eval "ac_cv_lib_$ac_lib_var=yes" else @@ -5582,7 +5596,7 @@ esac echo "checking for session-management option" 1>&6 -echo "configure:5586: checking for session-management option" >&5; +echo "configure:5600: checking for session-management option" >&5; if test "$with_session" != "no"; then { test "$extra_verbose" = "yes" && cat << \EOF Defining HAVE_SESSION @@ -5597,15 +5611,15 @@ 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:5601: checking for X11/Xauth.h" >&5 - -cat > conftest.$ac_ext <&5 + +cat > conftest.$ac_ext < EOF ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out" -{ (eval echo configure:5609: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; } +{ (eval echo configure:5623: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; } ac_err=`grep -v '^ *+' conftest.out` if test -z "$ac_err"; then rm -rf conftest* @@ -5628,12 +5642,12 @@ } test -z "$with_xauth" && { echo $ac_n "checking for XauGetAuthByAddr in -lXau""... $ac_c" 1>&6 -echo "configure:5632: checking for XauGetAuthByAddr in -lXau" >&5 +echo "configure:5646: 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; then +if { (eval echo configure:5662: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest; then rm -rf conftest* eval "ac_cv_lib_$ac_lib_var=yes" else @@ -5708,15 +5722,15 @@ 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:5712: checking for ${dir}tt_c.h" >&5 - -cat > conftest.$ac_ext <&5 + +cat > conftest.$ac_ext < EOF ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out" -{ (eval echo configure:5720: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; } +{ (eval echo configure:5734: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; } ac_err=`grep -v '^ *+' conftest.out` if test -z "$ac_err"; then rm -rf conftest* @@ -5745,12 +5759,12 @@ 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:5749: checking "$xe_msg_checking"" >&5 +echo "configure:5763: 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; then +if { (eval echo configure:5779: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest; then rm -rf conftest* eval "ac_cv_lib_$ac_lib_var=yes" else @@ -5810,15 +5824,15 @@ 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:5814: checking for Dt/Dt.h" >&5 - -cat > conftest.$ac_ext <&5 + +cat > conftest.$ac_ext < EOF ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out" -{ (eval echo configure:5822: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; } +{ (eval echo configure:5836: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; } ac_err=`grep -v '^ *+' conftest.out` if test -z "$ac_err"; then rm -rf conftest* @@ -5841,12 +5855,12 @@ } test -z "$with_cde" && { echo $ac_n "checking for DtDndDragStart in -lDtSvc""... $ac_c" 1>&6 -echo "configure:5845: checking for DtDndDragStart in -lDtSvc" >&5 +echo "configure:5859: 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; then +if { (eval echo configure:5875: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest; then rm -rf conftest* eval "ac_cv_lib_$ac_lib_var=yes" else @@ -5893,17 +5907,207 @@ need_motif=yes # CDE requires Motif fi +echo "checking for LDAP" 1>&6 +echo "configure:5912: 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:5915: 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:5923: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; } +ac_err=`grep -v '^ *+' conftest.out` +if test -z "$ac_err"; then + rm -rf conftest* + eval "ac_cv_header_$ac_safe=yes" +else + echo "$ac_err" >&5 + echo "configure: failed program was:" >&5 + cat conftest.$ac_ext >&5 + rm -rf conftest* + eval "ac_cv_header_$ac_safe=no" +fi +rm -f conftest* +if eval "test \"`echo '$ac_cv_header_'$ac_safe`\" = yes"; then + echo "$ac_t""yes" 1>&6 + : +else + echo "$ac_t""no" 1>&6 +with_ldap=no +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:5946: 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:5954: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; } +ac_err=`grep -v '^ *+' conftest.out` +if test -z "$ac_err"; then + rm -rf conftest* + eval "ac_cv_header_$ac_safe=yes" +else + echo "$ac_err" >&5 + echo "configure: failed program was:" >&5 + cat conftest.$ac_ext >&5 + rm -rf conftest* + eval "ac_cv_header_$ac_safe=no" +fi +rm -f conftest* +if eval "test \"`echo '$ac_cv_header_'$ac_safe`\" = yes"; then + echo "$ac_t""yes" 1>&6 + : +else + echo "$ac_t""no" 1>&6 +with_ldap=no +fi + } +test -z "$with_ldap" -o "$with_ldap" = "yes" && { +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:5979: 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; then + rm -rf conftest* + eval "ac_cv_lib_$ac_lib_var=yes" +else + echo "configure: failed program was:" >&5 + cat conftest.$ac_ext >&5 + rm -rf conftest* + eval "ac_cv_lib_$ac_lib_var=no" +fi +rm -f conftest* +xe_check_libs="" + +if eval "test \"`echo '$ac_cv_lib_'$ac_lib_var`\" = yes" ; then + echo "$ac_t""yes" 1>&6 + with_umich_ldap=yes +else + echo "$ac_t""no" 1>&6 +with_umich_ldap=no +fi + + } +test \( -z "$with_ldap" -o "$with_ldap" = "yes" \) -a "$with_umich_ldap" = "no" && { +echo $ac_n "checking for ldap_set_option in -lldap10""... $ac_c" 1>&6 +echo "configure:6018: checking for ldap_set_option in -lldap10" >&5 +ac_lib_var=`echo ldap10'_'ldap_set_option | sed 'y%./+-%__p_%'` + +xe_check_libs=" -lldap10 " +cat > conftest.$ac_ext <&5; (eval $ac_link) 2>&5; } && test -s conftest; then + rm -rf conftest* + eval "ac_cv_lib_$ac_lib_var=yes" +else + echo "configure: failed program was:" >&5 + cat conftest.$ac_ext >&5 + rm -rf conftest* + eval "ac_cv_lib_$ac_lib_var=no" +fi +rm -f conftest* +xe_check_libs="" + +if eval "test \"`echo '$ac_cv_lib_'$ac_lib_var`\" = yes" ; then + echo "$ac_t""yes" 1>&6 + with_ns_ldap=yes +else + echo "$ac_t""no" 1>&6 +with_ns_ldap=no +fi + + } +test -z "$with_ldap" -a \( "$with_umich_ldap" = "yes" -o "$with_ns_ldap" = "yes" \) && with_ldap=yes +if test "$with_ldap" = "yes" -a "$with_umich_ldap" = "yes" ; then + { test "$extra_verbose" = "yes" && cat << \EOF + Defining HAVE_LDAP +EOF +cat >> confdefs.h <<\EOF +#define HAVE_LDAP 1 +EOF +} + + { test "$extra_verbose" = "yes" && cat << \EOF + Defining HAVE_UMICH_LDAP +EOF +cat >> confdefs.h <<\EOF +#define HAVE_UMICH_LDAP 1 +EOF +} + + LIBS="-llber $LIBS" && if test "$extra_verbose" = "yes"; then echo " Prepending \"-llber\" to \$LIBS"; fi + LIBS="-lldap $LIBS" && if test "$extra_verbose" = "yes"; then echo " Prepending \"-lldap\" to \$LIBS"; fi + extra_objs="$extra_objs eldap.o" && if test "$extra_verbose" = "yes"; then + echo " xemacs will be linked with \"eldap.o\"" + fi +elif test "$with_ldap" = "yes" -a "$with_ns_ldap" = "yes" ; then + { test "$extra_verbose" = "yes" && cat << \EOF + Defining HAVE_LDAP +EOF +cat >> confdefs.h <<\EOF +#define HAVE_LDAP 1 +EOF +} + + { test "$extra_verbose" = "yes" && cat << \EOF + Defining HAVE_NS_LDAP +EOF +cat >> confdefs.h <<\EOF +#define HAVE_NS_LDAP 1 +EOF +} + + LIBS="-lldap10 $LIBS" && if test "$extra_verbose" = "yes"; then echo " Prepending \"-lldap10\" to \$LIBS"; fi + extra_objs="$extra_objs eldap.o" && if test "$extra_verbose" = "yes"; then + echo " xemacs will be linked with \"eldap.o\"" + fi +fi + if test "$with_x11" = "yes"; then echo "checking for X11 graphics libraries" 1>&6 -echo "configure:5901: checking for X11 graphics libraries" >&5 +echo "configure:6105: checking for X11 graphics libraries" >&5 echo $ac_n "checking for Xpm - no older than 3.4f""... $ac_c" 1>&6 -echo "configure:5904: checking for Xpm - no older than 3.4f" >&5 +echo "configure:6108: checking for Xpm - no older than 3.4f" >&5 xe_check_libs=-lXpm test -z "$with_xpm" && { cat > conftest.$ac_ext < int main(int c, char **v) { @@ -5913,7 +6117,7 @@ 0 ; } EOF -if { (eval echo configure:5917: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest && (./conftest; exit) 2>&5 +if { (eval echo configure:6121: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest && (./conftest; exit) 2>&5 then ./conftest foobar; xpm_status=$?; if test "$xpm_status" = "0"; then with_xpm=yes; else with_xpm=no; fi; @@ -5951,15 +6155,15 @@ 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:5955: checking for compface.h" >&5 - -cat > conftest.$ac_ext <&5 + +cat > conftest.$ac_ext < EOF ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out" -{ (eval echo configure:5963: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; } +{ (eval echo configure:6167: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; } ac_err=`grep -v '^ *+' conftest.out` if test -z "$ac_err"; then rm -rf conftest* @@ -5982,12 +6186,12 @@ } test -z "$with_xface" && { echo $ac_n "checking for UnGenFace in -lcompface""... $ac_c" 1>&6 -echo "configure:5986: checking for UnGenFace in -lcompface" >&5 +echo "configure:6190: 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; then +if { (eval echo configure:6206: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest; then rm -rf conftest* eval "ac_cv_lib_$ac_lib_var=yes" else @@ -6049,15 +6253,15 @@ 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:6053: checking for jpeglib.h" >&5 - -cat > conftest.$ac_ext <&5 + +cat > conftest.$ac_ext < EOF ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out" -{ (eval echo configure:6061: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; } +{ (eval echo configure:6265: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; } ac_err=`grep -v '^ *+' conftest.out` if test -z "$ac_err"; then rm -rf conftest* @@ -6080,12 +6284,12 @@ } test -z "$with_jpeg" && { echo $ac_n "checking for jpeg_destroy_decompress in -ljpeg""... $ac_c" 1>&6 -echo "configure:6084: checking for jpeg_destroy_decompress in -ljpeg" >&5 +echo "configure:6288: 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; then +if { (eval echo configure:6304: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest; then rm -rf conftest* eval "ac_cv_lib_$ac_lib_var=yes" else @@ -6132,15 +6336,15 @@ 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:6136: checking for png.h" >&5 - -cat > conftest.$ac_ext <&5 + +cat > conftest.$ac_ext < EOF ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out" -{ (eval echo configure:6144: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; } +{ (eval echo configure:6348: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; } ac_err=`grep -v '^ *+' conftest.out` if test -z "$ac_err"; then rm -rf conftest* @@ -6162,10 +6366,10 @@ fi } test -z "$with_png" && { echo $ac_n "checking for pow""... $ac_c" 1>&6 -echo "configure:6166: checking for pow" >&5 - -cat > conftest.$ac_ext <&5 + +cat > conftest.$ac_ext <&5; (eval $ac_link) 2>&5; } && test -s conftest; then +if { (eval echo configure:6396: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest; then rm -rf conftest* eval "ac_cv_func_pow=yes" else @@ -6213,12 +6417,12 @@ xe_msg_checking="for png_read_image in -lpng" 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:6217: checking "$xe_msg_checking"" >&5 +echo "configure:6421: checking "$xe_msg_checking"" >&5 ac_lib_var=`echo png'_'png_read_image | sed 'y%./+-%__p_%'` xe_check_libs=" -lpng $extra_libs" cat > conftest.$ac_ext <&5; (eval $ac_link) 2>&5; } && test -s conftest; then +if { (eval echo configure:6437: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest; then rm -rf conftest* eval "ac_cv_lib_$ac_lib_var=yes" else @@ -6271,12 +6475,12 @@ xe_msg_checking="for TIFFReadScanline in -ltiff" 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:6275: checking "$xe_msg_checking"" >&5 +echo "configure:6479: checking "$xe_msg_checking"" >&5 ac_lib_var=`echo tiff'_'TIFFReadScanline | sed 'y%./+-%__p_%'` xe_check_libs=" -ltiff $extra_libs" cat > conftest.$ac_ext <&5; (eval $ac_link) 2>&5; } && test -s conftest; then +if { (eval echo configure:6495: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest; then rm -rf conftest* eval "ac_cv_lib_$ac_lib_var=yes" else @@ -6325,12 +6529,12 @@ echo $ac_n "checking for XawScrollbarSetThumb in -lXaw""... $ac_c" 1>&6 -echo "configure:6329: checking for XawScrollbarSetThumb in -lXaw" >&5 +echo "configure:6533: checking for XawScrollbarSetThumb in -lXaw" >&5 ac_lib_var=`echo Xaw'_'XawScrollbarSetThumb | sed 'y%./+-%__p_%'` xe_check_libs=" -lXaw " cat > conftest.$ac_ext <&5; (eval $ac_link) 2>&5; } && test -s conftest; then +if { (eval echo configure:6549: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest; then rm -rf conftest* eval "ac_cv_lib_$ac_lib_var=yes" else @@ -6365,15 +6569,15 @@ ac_safe=`echo "Xm/Xm.h" | sed 'y%./+-%__p_%'` echo $ac_n "checking for Xm/Xm.h""... $ac_c" 1>&6 -echo "configure:6369: checking for Xm/Xm.h" >&5 - -cat > conftest.$ac_ext <&5 + +cat > conftest.$ac_ext < EOF ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out" -{ (eval echo configure:6377: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; } +{ (eval echo configure:6581: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; } ac_err=`grep -v '^ *+' conftest.out` if test -z "$ac_err"; then rm -rf conftest* @@ -6390,12 +6594,12 @@ echo "$ac_t""yes" 1>&6 echo $ac_n "checking for XmStringFree in -lXm""... $ac_c" 1>&6 -echo "configure:6394: checking for XmStringFree in -lXm" >&5 +echo "configure:6598: 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; then +if { (eval echo configure:6614: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest; then rm -rf conftest* eval "ac_cv_lib_$ac_lib_var=yes" else @@ -6678,26 +6882,26 @@ test -z "$with_mule" && with_mule=no -test -z "$with_mule_coding" && with_mule_coding=no - - -if test "$with_mule_coding" = "yes" && test "$with_mule" = "no"; then +test -z "$with_file_coding" && with_file_coding=no + + +if test "$with_file_coding" = "yes" && test "$with_mule" = "no"; then { test "$extra_verbose" = "yes" && cat << \EOF - Defining MULE_CODING -EOF -cat >> confdefs.h <<\EOF -#define MULE_CODING 1 -EOF -} - - extra_objs="$extra_objs mule-coding.o" && if test "$extra_verbose" = "yes"; then - echo " xemacs will be linked with \"mule-coding.o\"" + Defining FILE_CODING +EOF +cat >> confdefs.h <<\EOF +#define FILE_CODING 1 +EOF +} + + extra_objs="$extra_objs file-coding.o" && if test "$extra_verbose" = "yes"; then + echo " xemacs will be linked with \"file-coding.o\"" fi fi if test "$with_mule" = "yes" ; then echo "checking for Mule-related features" 1>&6 -echo "configure:6701: checking for Mule-related features" >&5 +echo "configure:6905: checking for Mule-related features" >&5 { test "$extra_verbose" = "yes" && cat << \EOF Defining MULE EOF @@ -6707,30 +6911,30 @@ } { test "$extra_verbose" = "yes" && cat << \EOF - Defining MULE_CODING -EOF -cat >> confdefs.h <<\EOF -#define MULE_CODING 1 -EOF -} - - extra_objs="$extra_objs mule.o mule-ccl.o mule-charset.o mule-coding.o" && if test "$extra_verbose" = "yes"; then - echo " xemacs will be linked with \"mule.o mule-ccl.o mule-charset.o mule-coding.o\"" + Defining FILE_CODING +EOF +cat >> confdefs.h <<\EOF +#define FILE_CODING 1 +EOF +} + + extra_objs="$extra_objs mule.o mule-ccl.o mule-charset.o mule-coding.o file-coding.o" && if test "$extra_verbose" = "yes"; then + echo " xemacs will be linked with \"mule.o mule-ccl.o mule-charset.o mule-coding.o file-coding.o\"" 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:6726: checking for $ac_hdr" >&5 - -cat > conftest.$ac_ext <&5 + +cat > conftest.$ac_ext < EOF ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out" -{ (eval echo configure:6734: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; } +{ (eval echo configure:6938: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; } ac_err=`grep -v '^ *+' conftest.out` if test -z "$ac_err"; then rm -rf conftest* @@ -6761,12 +6965,12 @@ echo $ac_n "checking for strerror in -lintl""... $ac_c" 1>&6 -echo "configure:6765: checking for strerror in -lintl" >&5 +echo "configure:6969: 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; then +if { (eval echo configure:6985: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest; then rm -rf conftest* eval "ac_cv_lib_$ac_lib_var=yes" else @@ -6810,19 +7014,19 @@ echo "checking for Mule input methods" 1>&6 -echo "configure:6814: checking for Mule input methods" >&5 +echo "configure:7018: checking for Mule input methods" >&5 test -z "$with_xim" -a "$opsys" != "sol2" && with_xim=no case "$with_xim" in "" | "yes" ) echo "checking for XIM" 1>&6 -echo "configure:6818: checking for XIM" >&5 +echo "configure:7022: checking for XIM" >&5 echo $ac_n "checking for XmImMbLookupString in -lXm""... $ac_c" 1>&6 -echo "configure:6821: checking for XmImMbLookupString in -lXm" >&5 +echo "configure:7025: 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; then +if { (eval echo configure:7041: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest; then rm -rf conftest* eval "ac_cv_lib_$ac_lib_var=yes" else @@ -6898,15 +7102,15 @@ if test "$with_xfs" = "yes" ; then echo "checking for XFontSet" 1>&6 -echo "configure:6902: checking for XFontSet" >&5 +echo "configure:7106: checking for XFontSet" >&5 echo $ac_n "checking for XmbDrawString in -lX11""... $ac_c" 1>&6 -echo "configure:6905: checking for XmbDrawString in -lX11" >&5 +echo "configure:7109: 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; then +if { (eval echo configure:7125: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest; then rm -rf conftest* eval "ac_cv_lib_$ac_lib_var=yes" else @@ -6957,15 +7161,15 @@ 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:6961: checking for wnn/jllib.h" >&5 - -cat > conftest.$ac_ext <&5 + +cat > conftest.$ac_ext < EOF ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out" -{ (eval echo configure:6969: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; } +{ (eval echo configure:7173: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; } ac_err=`grep -v '^ *+' conftest.out` if test -z "$ac_err"; then rm -rf conftest* @@ -6990,10 +7194,10 @@ for ac_func in crypt do echo $ac_n "checking for $ac_func""... $ac_c" 1>&6 -echo "configure:6994: checking for $ac_func" >&5 - -cat > conftest.$ac_ext <&5 + +cat > conftest.$ac_ext <&5; (eval $ac_link) 2>&5; } && test -s conftest; then +if { (eval echo configure:7224: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest; then rm -rf conftest* eval "ac_cv_func_$ac_func=yes" else @@ -7045,12 +7249,12 @@ test "$ac_cv_func_crypt" != "yes" && { echo $ac_n "checking for crypt in -lcrypt""... $ac_c" 1>&6 -echo "configure:7049: checking for crypt in -lcrypt" >&5 +echo "configure:7253: 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; then +if { (eval echo configure:7269: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest; then rm -rf conftest* eval "ac_cv_lib_$ac_lib_var=yes" else @@ -7095,12 +7299,12 @@ fi test -z "$with_wnn" && { echo $ac_n "checking for jl_dic_list_e in -lwnn""... $ac_c" 1>&6 -echo "configure:7099: checking for jl_dic_list_e in -lwnn" >&5 +echo "configure:7303: 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; then +if { (eval echo configure:7319: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest; then rm -rf conftest* eval "ac_cv_lib_$ac_lib_var=yes" else @@ -7148,12 +7352,12 @@ fi echo $ac_n "checking for jl_fi_dic_list in -lwnn""... $ac_c" 1>&6 -echo "configure:7152: checking for jl_fi_dic_list in -lwnn" >&5 +echo "configure:7356: checking for jl_fi_dic_list in -lwnn" >&5 ac_lib_var=`echo wnn'_'jl_fi_dic_list | sed 'y%./+-%__p_%'` xe_check_libs=" -lwnn " cat > conftest.$ac_ext <&5; (eval $ac_link) 2>&5; } && test -s conftest; then +if { (eval echo configure:7372: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest; then rm -rf conftest* eval "ac_cv_lib_$ac_lib_var=yes" else @@ -7196,15 +7400,15 @@ 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:7200: checking for canna/RK.h" >&5 - -cat > conftest.$ac_ext <&5 + +cat > conftest.$ac_ext < EOF ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out" -{ (eval echo configure:7208: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; } +{ (eval echo configure:7412: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; } ac_err=`grep -v '^ *+' conftest.out` if test -z "$ac_err"; then rm -rf conftest* @@ -7227,12 +7431,12 @@ } test -z "$with_canna" && { echo $ac_n "checking for RkBgnBun in -lRKC""... $ac_c" 1>&6 -echo "configure:7231: checking for RkBgnBun in -lRKC" >&5 +echo "configure:7435: 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; then +if { (eval echo configure:7451: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest; then rm -rf conftest* eval "ac_cv_lib_$ac_lib_var=yes" else @@ -7266,12 +7470,12 @@ } test -z "$with_canna" && { echo $ac_n "checking for jrKanjiControl in -lcanna""... $ac_c" 1>&6 -echo "configure:7270: checking for jrKanjiControl in -lcanna" >&5 +echo "configure:7474: 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; then +if { (eval echo configure:7490: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest; then rm -rf conftest* eval "ac_cv_lib_$ac_lib_var=yes" else @@ -7331,12 +7535,12 @@ 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:7335: checking for layout_object_getvalue in -li18n" >&5 +echo "configure:7539: 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; then +if { (eval echo configure:7555: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest; then rm -rf conftest* eval "ac_cv_lib_$ac_lib_var=yes" else @@ -7420,10 +7624,10 @@ for ac_func in cbrt closedir dup2 eaccess fmod fpathconf frexp ftime gethostname 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 strcasecmp strerror tzset ulimit usleep utimes waitpid do echo $ac_n "checking for $ac_func""... $ac_c" 1>&6 -echo "configure:7424: checking for $ac_func" >&5 - -cat > conftest.$ac_ext <&5 + +cat > conftest.$ac_ext <&5; (eval $ac_link) 2>&5; } && test -s conftest; then +if { (eval echo configure:7654: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest; then rm -rf conftest* eval "ac_cv_func_$ac_func=yes" else @@ -7483,10 +7687,10 @@ for ac_func in realpath do echo $ac_n "checking for $ac_func""... $ac_c" 1>&6 -echo "configure:7487: checking for $ac_func" >&5 - -cat > conftest.$ac_ext <&5 + +cat > conftest.$ac_ext <&5; (eval $ac_link) 2>&5; } && test -s conftest; then +if { (eval echo configure:7717: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest; then rm -rf conftest* eval "ac_cv_func_$ac_func=yes" else @@ -7542,16 +7746,16 @@ esac echo $ac_n "checking whether netdb declares h_errno""... $ac_c" 1>&6 -echo "configure:7546: checking whether netdb declares h_errno" >&5 -cat > conftest.$ac_ext <&5 +cat > conftest.$ac_ext < int main() { return h_errno; ; return 0; } EOF -if { (eval echo configure:7555: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest; then +if { (eval echo configure:7759: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest; then rm -rf conftest* echo "$ac_t""yes" 1>&6 { test "$extra_verbose" = "yes" && cat << \EOF @@ -7571,16 +7775,16 @@ rm -f conftest* echo $ac_n "checking for sigsetjmp""... $ac_c" 1>&6 -echo "configure:7575: checking for sigsetjmp" >&5 -cat > conftest.$ac_ext <&5 +cat > conftest.$ac_ext < int main() { sigjmp_buf bar; sigsetjmp (bar, 0); ; return 0; } EOF -if { (eval echo configure:7584: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then +if { (eval echo configure:7788: \"$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 @@ -7600,11 +7804,11 @@ rm -f conftest* echo $ac_n "checking whether localtime caches TZ""... $ac_c" 1>&6 -echo "configure:7604: checking whether localtime caches TZ" >&5 +echo "configure:7808: checking whether localtime caches TZ" >&5 if test "$ac_cv_func_tzset" = "yes"; then cat > conftest.$ac_ext < #if STDC_HEADERS @@ -7639,7 +7843,7 @@ exit (0); } EOF -if { (eval echo configure:7643: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest && (./conftest; exit) 2>&5 +if { (eval echo configure:7847: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest && (./conftest; exit) 2>&5 then emacs_cv_localtime_cache=no else @@ -7668,9 +7872,9 @@ if test "$HAVE_TIMEVAL" = "yes"; then echo $ac_n "checking whether gettimeofday cannot accept two arguments""... $ac_c" 1>&6 -echo "configure:7672: checking whether gettimeofday cannot accept two arguments" >&5 -cat > conftest.$ac_ext <&5 +cat > conftest.$ac_ext <&5; (eval $ac_link) 2>&5; } && test -s conftest; then +if { (eval echo configure:7900: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest; then rm -rf conftest* echo "$ac_t""no" 1>&6 else @@ -7714,19 +7918,19 @@ echo $ac_n "checking for inline""... $ac_c" 1>&6 -echo "configure:7718: checking for inline" >&5 +echo "configure:7922: 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:7934: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then rm -rf conftest* ac_cv_c_inline=$ac_kw; break else @@ -7776,17 +7980,17 @@ # 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:7780: checking for working alloca.h" >&5 - -cat > conftest.$ac_ext <&5 + +cat > conftest.$ac_ext < int main() { char *p = alloca(2 * sizeof(int)); ; return 0; } EOF -if { (eval echo configure:7790: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest; then +if { (eval echo configure:7994: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest; then rm -rf conftest* ac_cv_header_alloca_h=yes else @@ -7810,10 +8014,10 @@ fi echo $ac_n "checking for alloca""... $ac_c" 1>&6 -echo "configure:7814: checking for alloca" >&5 - -cat > conftest.$ac_ext <&5 + +cat > conftest.$ac_ext <&5; (eval $ac_link) 2>&5; } && test -s conftest; then +if { (eval echo configure:8044: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest; then rm -rf conftest* ac_cv_func_alloca_works=yes else @@ -7875,10 +8079,10 @@ echo $ac_n "checking whether alloca needs Cray hooks""... $ac_c" 1>&6 -echo "configure:7879: checking whether alloca needs Cray hooks" >&5 - -cat > conftest.$ac_ext <&5 + +cat > conftest.$ac_ext <&6 -echo "configure:7906: checking for $ac_func" >&5 - -cat > conftest.$ac_ext <&5 + +cat > conftest.$ac_ext <&5; (eval $ac_link) 2>&5; } && test -s conftest; then +if { (eval echo configure:8136: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest; then rm -rf conftest* eval "ac_cv_func_$ac_func=yes" else @@ -7958,10 +8162,10 @@ fi echo $ac_n "checking stack direction for C alloca""... $ac_c" 1>&6 -echo "configure:7962: checking stack direction for C alloca" >&5 - -cat > conftest.$ac_ext <&5 + +cat > conftest.$ac_ext <&5; (eval $ac_link) 2>&5; } && test -s conftest && (./conftest; exit) 2>&5 +if { (eval echo configure:8188: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest && (./conftest; exit) 2>&5 then ac_cv_c_stack_direction=1 else @@ -8008,15 +8212,15 @@ ac_safe=`echo "vfork.h" | sed 'y%./+-%__p_%'` echo $ac_n "checking for vfork.h""... $ac_c" 1>&6 -echo "configure:8012: checking for vfork.h" >&5 - -cat > conftest.$ac_ext <&5 + +cat > conftest.$ac_ext < EOF ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out" -{ (eval echo configure:8020: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; } +{ (eval echo configure:8224: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; } ac_err=`grep -v '^ *+' conftest.out` if test -z "$ac_err"; then rm -rf conftest* @@ -8044,10 +8248,10 @@ fi echo $ac_n "checking for working vfork""... $ac_c" 1>&6 -echo "configure:8048: checking for working vfork" >&5 - -cat > conftest.$ac_ext <&5 + +cat > conftest.$ac_ext < @@ -8142,7 +8346,7 @@ } } EOF -if { (eval echo configure:8146: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest && (./conftest; exit) 2>&5 +if { (eval echo configure:8350: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest && (./conftest; exit) 2>&5 then ac_cv_func_vfork_works=yes else @@ -8167,10 +8371,10 @@ echo $ac_n "checking for working strcoll""... $ac_c" 1>&6 -echo "configure:8171: checking for working strcoll" >&5 - -cat > conftest.$ac_ext <&5 + +cat > conftest.$ac_ext < main () @@ -8180,7 +8384,7 @@ strcoll ("123", "456") >= 0); } EOF -if { (eval echo configure:8184: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest && (./conftest; exit) 2>&5 +if { (eval echo configure:8388: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest && (./conftest; exit) 2>&5 then ac_cv_func_strcoll_works=yes else @@ -8207,10 +8411,10 @@ for ac_func in getpgrp do echo $ac_n "checking for $ac_func""... $ac_c" 1>&6 -echo "configure:8211: checking for $ac_func" >&5 - -cat > conftest.$ac_ext <&5 + +cat > conftest.$ac_ext <&5; (eval $ac_link) 2>&5; } && test -s conftest; then +if { (eval echo configure:8441: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest; then rm -rf conftest* eval "ac_cv_func_$ac_func=yes" else @@ -8261,10 +8465,10 @@ done echo $ac_n "checking whether getpgrp takes no argument""... $ac_c" 1>&6 -echo "configure:8265: checking whether getpgrp takes no argument" >&5 - -cat > conftest.$ac_ext <&5 + +cat > conftest.$ac_ext <&5; (eval $ac_link) 2>&5; } && test -s conftest && (./conftest; exit) 2>&5 +if { (eval echo configure:8527: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest && (./conftest; exit) 2>&5 then ac_cv_func_getpgrp_void=yes else @@ -8345,10 +8549,10 @@ echo $ac_n "checking for working mmap""... $ac_c" 1>&6 -echo "configure:8349: checking for working mmap" >&5 +echo "configure:8553: checking for working mmap" >&5 case "$opsys" in ultrix* ) have_mmap=no ;; *) cat > conftest.$ac_ext < #include @@ -8381,7 +8585,7 @@ return 1; } EOF -if { (eval echo configure:8385: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest && (./conftest; exit) 2>&5 +if { (eval echo configure:8589: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest && (./conftest; exit) 2>&5 then have_mmap=yes else @@ -8415,15 +8619,15 @@ ac_safe=`echo "termios.h" | sed 'y%./+-%__p_%'` echo $ac_n "checking for termios.h""... $ac_c" 1>&6 -echo "configure:8419: checking for termios.h" >&5 - -cat > conftest.$ac_ext <&5 + +cat > conftest.$ac_ext < EOF ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out" -{ (eval echo configure:8427: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; } +{ (eval echo configure:8631: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; } ac_err=`grep -v '^ *+' conftest.out` if test -z "$ac_err"; then rm -rf conftest* @@ -8466,15 +8670,15 @@ 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:8470: checking for termio.h" >&5 - -cat > conftest.$ac_ext <&5 + +cat > conftest.$ac_ext < EOF ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out" -{ (eval echo configure:8478: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; } +{ (eval echo configure:8682: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; } ac_err=`grep -v '^ *+' conftest.out` if test -z "$ac_err"; then rm -rf conftest* @@ -8506,10 +8710,10 @@ echo $ac_n "checking for socket""... $ac_c" 1>&6 -echo "configure:8510: checking for socket" >&5 - -cat > conftest.$ac_ext <&5 + +cat > conftest.$ac_ext <&5; (eval $ac_link) 2>&5; } && test -s conftest; then +if { (eval echo configure:8740: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest; then rm -rf conftest* eval "ac_cv_func_socket=yes" else @@ -8547,15 +8751,15 @@ 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:8551: checking for netinet/in.h" >&5 - -cat > conftest.$ac_ext <&5 + +cat > conftest.$ac_ext < EOF ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out" -{ (eval echo configure:8559: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; } +{ (eval echo configure:8763: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; } ac_err=`grep -v '^ *+' conftest.out` if test -z "$ac_err"; then rm -rf conftest* @@ -8572,15 +8776,15 @@ 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:8576: checking for arpa/inet.h" >&5 - -cat > conftest.$ac_ext <&5 + +cat > conftest.$ac_ext < EOF ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out" -{ (eval echo configure:8584: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; } +{ (eval echo configure:8788: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; } ac_err=`grep -v '^ *+' conftest.out` if test -z "$ac_err"; then rm -rf conftest* @@ -8605,9 +8809,9 @@ } echo $ac_n "checking "for sun_len member in struct sockaddr_un"""... $ac_c" 1>&6 -echo "configure:8609: checking "for sun_len member in struct sockaddr_un"" >&5 +echo "configure:8813: checking "for sun_len member in struct sockaddr_un"" >&5 cat > conftest.$ac_ext < @@ -8618,7 +8822,7 @@ static struct sockaddr_un x; x.sun_len = 1; ; return 0; } EOF -if { (eval echo configure:8622: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest; then +if { (eval echo configure:8826: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest; then rm -rf conftest* echo "$ac_t""yes" 1>&6; { test "$extra_verbose" = "yes" && cat << \EOF Defining HAVE_SOCKADDR_SUN_LEN @@ -8635,6 +8839,35 @@ echo "$ac_t""no" 1>&6 fi rm -f conftest* + echo $ac_n "checking "for ip_mreq struct in netinet/in.h"""... $ac_c" 1>&6 +echo "configure:8844: checking "for ip_mreq struct in netinet/in.h"" >&5 + cat > conftest.$ac_ext < + +int main() { +static struct ip_mreq x; +; return 0; } +EOF +if { (eval echo configure:8855: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest; then + rm -rf conftest* + echo "$ac_t""yes" 1>&6; { test "$extra_verbose" = "yes" && cat << \EOF + Defining HAVE_MULTICAST +EOF +cat >> confdefs.h <<\EOF +#define HAVE_MULTICAST 1 +EOF +} + +else + echo "configure: failed program was:" >&5 + cat conftest.$ac_ext >&5 + rm -rf conftest* + echo "$ac_t""no" 1>&6 +fi +rm -f conftest* else echo "$ac_t""no" 1>&6 fi @@ -8649,10 +8882,10 @@ echo $ac_n "checking for msgget""... $ac_c" 1>&6 -echo "configure:8653: checking for msgget" >&5 - -cat > conftest.$ac_ext <&5 + +cat > conftest.$ac_ext <&5; (eval $ac_link) 2>&5; } && test -s conftest; then +if { (eval echo configure:8912: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest; then rm -rf conftest* eval "ac_cv_func_msgget=yes" else @@ -8690,15 +8923,15 @@ 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:8694: checking for sys/ipc.h" >&5 - -cat > conftest.$ac_ext <&5 + +cat > conftest.$ac_ext < EOF ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out" -{ (eval echo configure:8702: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; } +{ (eval echo configure:8935: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; } ac_err=`grep -v '^ *+' conftest.out` if test -z "$ac_err"; then rm -rf conftest* @@ -8715,15 +8948,15 @@ 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:8719: checking for sys/msg.h" >&5 - -cat > conftest.$ac_ext <&5 + +cat > conftest.$ac_ext < EOF ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out" -{ (eval echo configure:8727: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; } +{ (eval echo configure:8960: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; } ac_err=`grep -v '^ *+' conftest.out` if test -z "$ac_err"; then rm -rf conftest* @@ -8761,15 +8994,15 @@ ac_safe=`echo "dirent.h" | sed 'y%./+-%__p_%'` echo $ac_n "checking for dirent.h""... $ac_c" 1>&6 -echo "configure:8765: checking for dirent.h" >&5 - -cat > conftest.$ac_ext <&5 + +cat > conftest.$ac_ext < EOF ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out" -{ (eval echo configure:8773: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; } +{ (eval echo configure:9006: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; } ac_err=`grep -v '^ *+' conftest.out` if test -z "$ac_err"; then rm -rf conftest* @@ -8796,15 +9029,15 @@ 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:8800: checking for sys/dir.h" >&5 - -cat > conftest.$ac_ext <&5 + +cat > conftest.$ac_ext < EOF ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out" -{ (eval echo configure:8808: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; } +{ (eval echo configure:9041: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; } ac_err=`grep -v '^ *+' conftest.out` if test -z "$ac_err"; then rm -rf conftest* @@ -8837,15 +9070,15 @@ ac_safe=`echo "nlist.h" | sed 'y%./+-%__p_%'` echo $ac_n "checking for nlist.h""... $ac_c" 1>&6 -echo "configure:8841: checking for nlist.h" >&5 - -cat > conftest.$ac_ext <&5 + +cat > conftest.$ac_ext < EOF ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out" -{ (eval echo configure:8849: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; } +{ (eval echo configure:9082: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; } ac_err=`grep -v '^ *+' conftest.out` if test -z "$ac_err"; then rm -rf conftest* @@ -8875,7 +9108,7 @@ echo "checking "for sound support"" 1>&6 -echo "configure:8879: checking "for sound support"" >&5 +echo "configure:9112: checking "for sound support"" >&5 case "$with_sound" in native | both ) with_native_sound=yes;; nas | no ) with_native_sound=no;; @@ -8886,15 +9119,15 @@ 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:8890: checking for multimedia/audio_device.h" >&5 - -cat > conftest.$ac_ext <&5 + +cat > conftest.$ac_ext < EOF ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out" -{ (eval echo configure:8898: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; } +{ (eval echo configure:9131: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; } ac_err=`grep -v '^ *+' conftest.out` if test -z "$ac_err"; then rm -rf conftest* @@ -8942,12 +9175,12 @@ if test -z "$native_sound_lib"; then echo $ac_n "checking for ALopenport in -laudio""... $ac_c" 1>&6 -echo "configure:8946: checking for ALopenport in -laudio" >&5 +echo "configure:9179: 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; then +if { (eval echo configure:9195: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest; then rm -rf conftest* eval "ac_cv_lib_$ac_lib_var=yes" else @@ -8989,12 +9222,12 @@ if test -z "$native_sound_lib"; then echo $ac_n "checking for AOpenAudio in -lAlib""... $ac_c" 1>&6 -echo "configure:8993: checking for AOpenAudio in -lAlib" >&5 +echo "configure:9226: 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; then +if { (eval echo configure:9242: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest; then rm -rf conftest* eval "ac_cv_lib_$ac_lib_var=yes" else @@ -9043,15 +9276,15 @@ 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:9047: checking for ${dir}/soundcard.h" >&5 - -cat > conftest.$ac_ext <&5 + +cat > conftest.$ac_ext < EOF ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out" -{ (eval echo configure:9055: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; } +{ (eval echo configure:9288: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; } ac_err=`grep -v '^ *+' conftest.out` if test -z "$ac_err"; then rm -rf conftest* @@ -9121,7 +9354,7 @@ fi libs_x="-laudio $libs_x" && if test "$extra_verbose" = "yes"; then echo " Prepending \"-laudio\" to \$libs_x"; fi cat > conftest.$ac_ext < EOF @@ -9148,7 +9381,7 @@ if test "$with_tty" = "yes" ; then echo "checking for TTY-related features" 1>&6 -echo "configure:9152: checking for TTY-related features" >&5 +echo "configure:9385: checking for TTY-related features" >&5 { test "$extra_verbose" = "yes" && cat << \EOF Defining HAVE_TTY EOF @@ -9164,12 +9397,12 @@ if test -z "$with_ncurses"; then echo $ac_n "checking for tgetent in -lncurses""... $ac_c" 1>&6 -echo "configure:9168: checking for tgetent in -lncurses" >&5 +echo "configure:9401: 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; then +if { (eval echo configure:9417: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest; then rm -rf conftest* eval "ac_cv_lib_$ac_lib_var=yes" else @@ -9213,15 +9446,15 @@ ac_safe=`echo "ncurses/curses.h" | sed 'y%./+-%__p_%'` echo $ac_n "checking for ncurses/curses.h""... $ac_c" 1>&6 -echo "configure:9217: checking for ncurses/curses.h" >&5 - -cat > conftest.$ac_ext <&5 + +cat > conftest.$ac_ext < EOF ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out" -{ (eval echo configure:9225: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; } +{ (eval echo configure:9458: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; } ac_err=`grep -v '^ *+' conftest.out` if test -z "$ac_err"; then rm -rf conftest* @@ -9243,15 +9476,15 @@ ac_safe=`echo "ncurses/term.h" | sed 'y%./+-%__p_%'` echo $ac_n "checking for ncurses/term.h""... $ac_c" 1>&6 -echo "configure:9247: checking for ncurses/term.h" >&5 - -cat > conftest.$ac_ext <&5 + +cat > conftest.$ac_ext < EOF ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out" -{ (eval echo configure:9255: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; } +{ (eval echo configure:9488: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; } ac_err=`grep -v '^ *+' conftest.out` if test -z "$ac_err"; then rm -rf conftest* @@ -9281,15 +9514,15 @@ 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:9285: checking for ncurses/curses.h" >&5 - -cat > conftest.$ac_ext <&5 + +cat > conftest.$ac_ext < EOF ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out" -{ (eval echo configure:9293: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; } +{ (eval echo configure:9526: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; } ac_err=`grep -v '^ *+' conftest.out` if test -z "$ac_err"; then rm -rf conftest* @@ -9324,12 +9557,12 @@ for lib in curses termlib termcap; do echo $ac_n "checking for tgetent in -l$lib""... $ac_c" 1>&6 -echo "configure:9328: checking for tgetent in -l$lib" >&5 +echo "configure:9561: 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; then +if { (eval echo configure:9577: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest; then rm -rf conftest* eval "ac_cv_lib_$ac_lib_var=yes" else @@ -9371,12 +9604,12 @@ else echo $ac_n "checking for tgetent in -lcurses""... $ac_c" 1>&6 -echo "configure:9375: checking for tgetent in -lcurses" >&5 +echo "configure:9608: 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; then +if { (eval echo configure:9624: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest; then rm -rf conftest* eval "ac_cv_lib_$ac_lib_var=yes" else @@ -9405,12 +9638,12 @@ else echo "$ac_t""no" 1>&6 echo $ac_n "checking for tgetent in -ltermcap""... $ac_c" 1>&6 -echo "configure:9409: checking for tgetent in -ltermcap" >&5 +echo "configure:9642: 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; then +if { (eval echo configure:9658: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest; then rm -rf conftest* eval "ac_cv_lib_$ac_lib_var=yes" else @@ -9469,15 +9702,15 @@ 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:9473: checking for gpm.h" >&5 - -cat > conftest.$ac_ext <&5 + +cat > conftest.$ac_ext < EOF ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out" -{ (eval echo configure:9481: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; } +{ (eval echo configure:9714: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; } ac_err=`grep -v '^ *+' conftest.out` if test -z "$ac_err"; then rm -rf conftest* @@ -9500,12 +9733,12 @@ } test -z "$with_gpm" && { echo $ac_n "checking for Gpm_Open in -lgpm""... $ac_c" 1>&6 -echo "configure:9504: checking for Gpm_Open in -lgpm" >&5 +echo "configure:9737: 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; then +if { (eval echo configure:9753: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest; then rm -rf conftest* eval "ac_cv_lib_$ac_lib_var=yes" else @@ -9565,17 +9798,17 @@ echo "checking for database support" 1>&6 -echo "configure:9569: checking for database support" >&5 +echo "configure:9802: checking for database support" >&5 if test "$with_database_gnudbm" != "no"; then echo $ac_n "checking for dbm_open in -lgdbm""... $ac_c" 1>&6 -echo "configure:9574: checking for dbm_open in -lgdbm" >&5 +echo "configure:9807: 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; then +if { (eval echo configure:9823: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest; then rm -rf conftest* eval "ac_cv_lib_$ac_lib_var=yes" else @@ -9608,10 +9841,10 @@ if test "$with_database_gnudbm" != "yes"; then echo $ac_n "checking for dbm_open""... $ac_c" 1>&6 -echo "configure:9612: checking for dbm_open" >&5 - -cat > conftest.$ac_ext <&5 + +cat > conftest.$ac_ext <&5; (eval $ac_link) 2>&5; } && test -s conftest; then +if { (eval echo configure:9871: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest; then rm -rf conftest* eval "ac_cv_func_dbm_open=yes" else @@ -9670,10 +9903,10 @@ if test "$with_database_dbm" != "no"; then echo $ac_n "checking for dbm_open""... $ac_c" 1>&6 -echo "configure:9674: checking for dbm_open" >&5 - -cat > conftest.$ac_ext <&5 + +cat > conftest.$ac_ext <&5; (eval $ac_link) 2>&5; } && test -s conftest; then +if { (eval echo configure:9933: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest; then rm -rf conftest* eval "ac_cv_func_dbm_open=yes" else @@ -9717,12 +9950,12 @@ if test "$need_libdbm" != "no"; then echo $ac_n "checking for dbm_open in -ldbm""... $ac_c" 1>&6 -echo "configure:9721: checking for dbm_open in -ldbm" >&5 +echo "configure:9954: 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; then +if { (eval echo configure:9970: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest; then rm -rf conftest* eval "ac_cv_lib_$ac_lib_var=yes" else @@ -9770,10 +10003,10 @@ if test "$with_database_berkdb" != "no"; then echo $ac_n "checking for dbopen""... $ac_c" 1>&6 -echo "configure:9774: checking for dbopen" >&5 - -cat > conftest.$ac_ext <&5 + +cat > conftest.$ac_ext <&5; (eval $ac_link) 2>&5; } && test -s conftest; then +if { (eval echo configure:10033: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest; then rm -rf conftest* eval "ac_cv_func_dbopen=yes" else @@ -9817,12 +10050,12 @@ if test "$need_libdb" != "no"; then echo $ac_n "checking for dbopen in -ldb""... $ac_c" 1>&6 -echo "configure:9821: checking for dbopen in -ldb" >&5 +echo "configure:10054: checking for dbopen in -ldb" >&5 ac_lib_var=`echo db'_'dbopen | sed 'y%./+-%__p_%'` xe_check_libs=" -ldb " cat > conftest.$ac_ext <&5; (eval $ac_link) 2>&5; } && test -s conftest; then +if { (eval echo configure:10070: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest; then rm -rf conftest* eval "ac_cv_lib_$ac_lib_var=yes" else @@ -9857,7 +10090,7 @@ if test "$with_database_berkdb" = "yes"; then for path in "db/db.h" "db.h"; do cat > conftest.$ac_ext <&5; (eval $ac_compile) 2>&5; }; then +if { (eval echo configure:10112: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then rm -rf conftest* db_h_path="$path"; break else @@ -9927,12 +10160,12 @@ if test "$with_socks" = "yes"; then echo $ac_n "checking for SOCKSinit in -lsocks""... $ac_c" 1>&6 -echo "configure:9931: checking for SOCKSinit in -lsocks" >&5 +echo "configure:10164: 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; then +if { (eval echo configure:10180: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest; then rm -rf conftest* eval "ac_cv_lib_$ac_lib_var=yes" else @@ -10457,13 +10690,17 @@ test "$with_database_berkdb" = yes && echo " Compiling in support for Berkeley DB." test "$with_database_dbm" = yes && echo " Compiling in support for DBM." -test "$with_database_gnudbm" = yes && echo " Compiling in support for DBM." +test "$with_database_gnudbm" = yes && echo " Compiling in support for GNU DBM." + +test "$with_umich_ldap" = yes && echo " Compiling in support for LDAP (UMich libs)." +test "$with_ns_ldap" = yes && echo " Compiling in support for LDAP (Netscape SDK)." +test "$with_ldap" = yes -a "$with_umich_ldap" = no -a "$with_ns_ldap" = no && echo " Compiling in support for LDAP (Generic)." test "$with_ncurses" = yes && echo " Compiling in support for ncurses." test "$with_gpm" = yes && echo " Compiling in support for GPM (General Purpose Mouse)." test "$with_mule" = yes && echo " Compiling in Mule (multi-lingual) support." -test "$with_mule_coding" = yes && echo " Compiling in Mule coding support." +test "$with_file_coding" = yes && echo " Compiling in File coding support." test "$with_xim" != no && echo " Compiling in XIM (X11R5+ I18N input method) support." test "$with_xim" = motif && echo " Using Motif to provide XIM support." test "$with_xim" = xlib && echo " Using raw Xlib to provide XIM support." @@ -10479,7 +10716,7 @@ test "$with_tooltalk" = yes && echo " Compiling in support for ToolTalk." test "$with_offix" = yes && echo " Compiling in support for OffiX." test "$with_workshop" = yes && echo " Compiling in support for Sun WorkShop." -test "$with_session" = yes && echo " Compiling in support for proper session-management." +test "$with_session" != no && echo " Compiling in support for proper session-management." case "$with_menubars" in lucid ) echo " Using Lucid menubars." ;; motif ) echo " Using Motif menubars." diff -r 58424f6abf56 -r 11cf20601dec configure.in --- a/configure.in Mon Aug 13 10:22:10 2007 +0200 +++ b/configure.in Mon Aug 13 10:23:02 2007 +0200 @@ -344,7 +344,7 @@ with_menubars='' with_scrollbars='' with_dialogs='' -with_mule_coding='' +with_file_coding='' const_is_losing='yes' puresize='' cflags='UNSPECIFIED' @@ -472,13 +472,14 @@ with_xfs | \ with_i18n3 | \ with_mule | \ - with_mule_coding | \ + with_file_coding | \ with_canna | \ with_wnn | \ with_wnn6 | \ with_workshop | \ with_sparcworks | \ with_tooltalk | \ + with_ldap | \ with_pop | \ with_kerberos | \ with_hesiod | \ @@ -1922,13 +1923,14 @@ dnl Assume not, until told otherwise. GNU_MALLOC=yes doug_lea_malloc=yes +after_morecore_hook_exists=yes AC_CHECK_FUNC(malloc_get_state, ,doug_lea_malloc=no) AC_CHECK_FUNC(malloc_set_state, ,doug_lea_malloc=no) AC_MSG_CHECKING(whether __after_morecore_hook exists) AC_TRY_LINK([extern void (* __after_morecore_hook)();],[__after_morecore_hook = 0], [AC_MSG_RESULT(yes)], [AC_MSG_RESULT(no) - doug_lea_malloc=no]) + after_morecore_hook_exists=no]) if test "$system_malloc" = "yes" ; then GNU_MALLOC=no GNU_MALLOC_reason=" @@ -1946,10 +1948,15 @@ if test "$doug_lea_malloc" = "yes" ; then if test "$GNU_MALLOC" = yes ; then GNU_MALLOC_reason=" - (Using Doug Lea's new malloc from the GNU C Library.)" + (Using Doug Lea's new malloc from the GNU C Library.)" fi AC_DEFINE(DOUG_LEA_MALLOC) AC_DEFINE(USE_MINIMAL_TAGBITS) + if test "$after_morecore_hook_exists" = "no" ; then + GNU_MALLOC_reason=" + (Using Doug Lea's new malloc from the Linux C Library.)" + AC_DEFINE(_NO_MALLOC_WARNING_) + fi with_minimal_tagbits=yes fi @@ -2152,7 +2159,7 @@ with_toolbars=no with_tty=no const_is_losing=no - #with_mule_coding=yes + with_file_coding=yes XE_ADD_OBJS(console-msw.o device-msw.o event-msw.o frame-msw.o objects-msw.o select-msw.o redisplay-msw.o gif_err.o gifalloc.o dgif_lib.o) fi fi @@ -2396,6 +2403,30 @@ need_motif=yes # CDE requires Motif fi +dnl Autodetect LDAP +AC_CHECKING(for LDAP) +test -z "$with_ldap" && { AC_CHECK_HEADER(ldap.h, ,with_ldap=no) } +test -z "$with_ldap" && { AC_CHECK_HEADER(lber.h, ,with_ldap=no) } +test -z "$with_ldap" -o "$with_ldap" = "yes" && { AC_CHECK_LIB(ldap, ldap_open, with_umich_ldap=yes, with_umich_ldap=no, -llber) } +test \( -z "$with_ldap" -o "$with_ldap" = "yes" \) -a "$with_umich_ldap" = "no" && { AC_CHECK_LIB(ldap10, ldap_set_option, with_ns_ldap=yes, with_ns_ldap=no) } +test -z "$with_ldap" -a \( "$with_umich_ldap" = "yes" -o "$with_ns_ldap" = "yes" \) && with_ldap=yes +if test "$with_ldap" = "yes" -a "$with_umich_ldap" = "yes" ; then + AC_DEFINE(HAVE_LDAP) + AC_DEFINE(HAVE_UMICH_LDAP) + XE_PREPEND(-llber, LIBS) + XE_PREPEND(-lldap, LIBS) + XE_ADD_OBJS(eldap.o) +elif test "$with_ldap" = "yes" -a "$with_ns_ldap" = "yes" ; then + AC_DEFINE(HAVE_LDAP) + AC_DEFINE(HAVE_NS_LDAP) + XE_PREPEND(-lldap10, LIBS) + XE_ADD_OBJS(eldap.o) +dnl else +dnl AC_DEFINE(HAVE_LDAP) +dnl XE_PREPEND(-lldap, LIBS) +dnl XE_ADD_OBJS(eldap.o) +fi + dnl ---------------------- dnl X11 Graphics libraries dnl ---------------------- @@ -2592,7 +2623,7 @@ dnl ---------------------- test -z "$with_mule" && with_mule=no -test -z "$with_mule_coding" && with_mule_coding=no +test -z "$with_file_coding" && with_file_coding=no dnl if test "$with_mule" = "yes" && test ! -d "$srcdir/lisp/mule"; then dnl echo "Attempt to Build with Mule without Mule/Lisp" @@ -2601,16 +2632,16 @@ dnl exit 1 dnl fi -if test "$with_mule_coding" = "yes" && test "$with_mule" = "no"; then - AC_DEFINE(MULE_CODING) - XE_ADD_OBJS(mule-coding.o) +if test "$with_file_coding" = "yes" && test "$with_mule" = "no"; then + AC_DEFINE(FILE_CODING) + XE_ADD_OBJS(file-coding.o) fi if test "$with_mule" = "yes" ; then AC_CHECKING(for Mule-related features) AC_DEFINE(MULE) - AC_DEFINE(MULE_CODING) - XE_ADD_OBJS(mule.o mule-ccl.o mule-charset.o mule-coding.o) + AC_DEFINE(FILE_CODING) + XE_ADD_OBJS(mule.o mule-ccl.o mule-charset.o mule-coding.o file-coding.o) dnl Use -lintl to get internationalized strerror for Mule AC_CHECK_HEADERS(libintl.h) @@ -2898,6 +2929,13 @@ ], [static struct sockaddr_un x; x.sun_len = 1;], [AC_MSG_RESULT(yes); AC_DEFINE(HAVE_SOCKADDR_SUN_LEN)], + [AC_MSG_RESULT(no)]) + AC_MSG_CHECKING("for ip_mreq struct in netinet/in.h") + AC_TRY_LINK([ +#include + ], + [static struct ip_mreq x;], + [AC_MSG_RESULT(yes); AC_DEFINE(HAVE_MULTICAST)], [AC_MSG_RESULT(no)])])])]) dnl Check for SYS V IPC. (Inferior to sockets.) @@ -3438,13 +3476,17 @@ test "$with_database_berkdb" = yes && echo " Compiling in support for Berkeley DB." test "$with_database_dbm" = yes && echo " Compiling in support for DBM." -test "$with_database_gnudbm" = yes && echo " Compiling in support for DBM." +test "$with_database_gnudbm" = yes && echo " Compiling in support for GNU DBM." + +test "$with_umich_ldap" = yes && echo " Compiling in support for LDAP (UMich libs)." +test "$with_ns_ldap" = yes && echo " Compiling in support for LDAP (Netscape SDK)." +test "$with_ldap" = yes -a "$with_umich_ldap" = no -a "$with_ns_ldap" = no && echo " Compiling in support for LDAP (Generic)." test "$with_ncurses" = yes && echo " Compiling in support for ncurses." test "$with_gpm" = yes && echo " Compiling in support for GPM (General Purpose Mouse)." test "$with_mule" = yes && echo " Compiling in Mule (multi-lingual) support." -test "$with_mule_coding" = yes && echo " Compiling in Mule coding support." +test "$with_file_coding" = yes && echo " Compiling in File coding support." test "$with_xim" != no && echo " Compiling in XIM (X11R5+ I18N input method) support." test "$with_xim" = motif && echo " Using Motif to provide XIM support." test "$with_xim" = xlib && echo " Using raw Xlib to provide XIM support." @@ -3460,7 +3502,7 @@ test "$with_tooltalk" = yes && echo " Compiling in support for ToolTalk." test "$with_offix" = yes && echo " Compiling in support for OffiX." test "$with_workshop" = yes && echo " Compiling in support for Sun WorkShop." -test "$with_session" = yes && echo " Compiling in support for proper session-management." +test "$with_session" != no && echo " Compiling in support for proper session-management." case "$with_menubars" in lucid ) echo " Using Lucid menubars." ;; motif ) echo " Using Motif menubars." diff -r 58424f6abf56 -r 11cf20601dec configure.usage --- a/configure.usage Mon Aug 13 10:22:10 2007 +0200 +++ b/configure.usage Mon Aug 13 10:23:02 2007 +0200 @@ -80,11 +80,15 @@ --with-xface (*) Compile with support for X-Face mail header conversion. Requires the compface library. Get it from the XEmacs FTP site. ---with-imagick (*) Compile with support for ImageMagick image conversion. - Requires ImageMagick from wizards.dupont.com and - libraries for whatever image types you wish to have - supported. +--with-gif Compile with support for GIF image conversion. + This support is built-in and defaults to `yes'. +--with-jpeg (*) Compile with support for JPEG image conversion. + Requires libjpeg from the Independent JPEG Group. Get it from the XEmacs FTP site. +--with-png (*) Compile with support for PNG image conversion. + Requires libpng. Get it from the XEmacs FTP site. +--with-tiff Compile with support for TIFF image conversion + (not yet implemented). TTY options: @@ -113,6 +117,8 @@ --with-kerberos support Kerberos-authenticated POP --with-hesiod support Hesiod to get the POP server host --with-dnet (*) Compile with support for DECnet. +--with-ldap (*) Compile with support for the LDAP protocol (requires + installed LDAP libraries on the system). --mail-locking=TYPE (*) Specify the locking to be used by movemail to prevent concurrent updates of mail spool files. Valid types are `lockf', `flock', and `file'. diff -r 58424f6abf56 -r 11cf20601dec etc/BETA --- a/etc/BETA Mon Aug 13 10:22:10 2007 +0200 +++ b/etc/BETA Mon Aug 13 10:23:02 2007 +0200 @@ -80,6 +80,12 @@ down without loss of information. MIME is the preferred method for making the image attachments. +** Getting the Source +===================== + +In addition to the normal tar distribution, XEmacs source is now +available via CVS. Please see the URL: . + * Compiling Beta XEmacs ======================= diff -r 58424f6abf56 -r 11cf20601dec etc/NEWS --- a/etc/NEWS Mon Aug 13 10:22:10 2007 +0200 +++ b/etc/NEWS Mon Aug 13 10:23:02 2007 +0200 @@ -165,6 +165,9 @@ very large buffers. This is achieved by caching the line numbers of recent buffer positions, and reusing them. This cache is used only in the buffers where `line-number-mode' is in effect. + +** When the new GNU Malloc aka Doug Lea Malloc is available, it will be used. + * Changes in XEmacs 20.4 ======================== diff -r 58424f6abf56 -r 11cf20601dec etc/mcook-m.xpm.Z Binary file etc/mcook-m.xpm.Z has changed diff -r 58424f6abf56 -r 11cf20601dec etc/mcook.xpm.Z Binary file etc/mcook.xpm.Z has changed diff -r 58424f6abf56 -r 11cf20601dec etc/toolbar/ediff-A-up.xbm --- a/etc/toolbar/ediff-A-up.xbm Mon Aug 13 10:22:10 2007 +0200 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,6 +0,0 @@ -#define ediff-A-up_width 15 -#define ediff-A-up_height 15 -static char ediff-A-up_bits[] = { - 0x00,0x80,0x00,0x80,0x00,0x80,0xc0,0x81,0xe0,0x83,0x60,0x83,0x70,0x87,0x30, - 0x86,0x38,0x8e,0xf8,0x8f,0x18,0x8c,0x18,0x8c,0x00,0x80,0x00,0x80,0x00,0x80 - }; diff -r 58424f6abf56 -r 11cf20601dec etc/toolbar/ediff-A-up.xpm --- a/etc/toolbar/ediff-A-up.xpm Mon Aug 13 10:22:10 2007 +0200 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,24 +0,0 @@ -/* XPM */ -static char *ediff_A[] = { -/* width height num_colors chars_per_pixel */ -" 15 15 2 1", -/* colors */ -". c blue", -"# c Gray75 s backgroundToolBarColor", -/* pixels */ -"###############", -"###############", -"###############", -"######...######", -"#####.....#####", -"#####..#..#####", -"####...#...####", -"####..###..####", -"###...###...###", -"###.........###", -"###..#####..###", -"###..#####..###", -"###############", -"###############", -"###############", -}; diff -r 58424f6abf56 -r 11cf20601dec etc/toolbar/ediff-A-xx.xpm --- a/etc/toolbar/ediff-A-xx.xpm Mon Aug 13 10:22:10 2007 +0200 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,24 +0,0 @@ -/* XPM */ -static char *ediff_A[] = { -/* width height num_colors chars_per_pixel */ -" 15 15 2 1", -/* colors */ -". c gray60", -"# c Gray75 s backgroundToolBarColor", -/* pixels */ -"###############", -"###############", -"###############", -"######...######", -"#####.....#####", -"#####..#..#####", -"####...#...####", -"####..###..####", -"###...###...###", -"###.........###", -"###..#####..###", -"###..#####..###", -"###############", -"###############", -"###############", -}; diff -r 58424f6abf56 -r 11cf20601dec etc/toolbar/ediff-B-up.xbm --- a/etc/toolbar/ediff-B-up.xbm Mon Aug 13 10:22:10 2007 +0200 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,6 +0,0 @@ -#define ediff-B-up_width 15 -#define ediff-B-up_height 15 -static char ediff-B-up_bits[] = { - 0x00,0x80,0x00,0x80,0xf8,0x81,0xf8,0x83,0x38,0x87,0x38,0x86,0xf8,0x83,0xf8, - 0x87,0x38,0x8e,0x38,0x8c,0x38,0x8e,0xf8,0x87,0xf8,0x83,0x00,0x80,0x00,0x80 - }; diff -r 58424f6abf56 -r 11cf20601dec etc/toolbar/ediff-B-up.xpm --- a/etc/toolbar/ediff-B-up.xpm Mon Aug 13 10:22:10 2007 +0200 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,25 +0,0 @@ -/* XPM */ -static char *ediff-B-up[] = { -/* width height num_colors chars_per_pixel */ -" 15 15 2 1", -/* colors */ -". c blue", -"# c Gray75 s backgroundToolBarColor", -/* pixels */ -"###############", -"###############", -"###......######", -"###.......#####", -"###...##...####", -"###...###..####", -"###.......#####", -"###........####", -"###...###...###", -"###...####..###", -"###...###...###", -"###........####", -"###.......#####", -"###############", -"###############", -"###############" -}; diff -r 58424f6abf56 -r 11cf20601dec etc/toolbar/ediff-B-xx.xpm --- a/etc/toolbar/ediff-B-xx.xpm Mon Aug 13 10:22:10 2007 +0200 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,25 +0,0 @@ -/* XPM */ -static char *ediff-B-up[] = { -/* width height num_colors chars_per_pixel */ -" 15 15 2 1", -/* colors */ -". c gray60", -"# c Gray75 s backgroundToolBarColor", -/* pixels */ -"###############", -"###############", -"###......######", -"###.......#####", -"###...##...####", -"###...###..####", -"###.......#####", -"###........####", -"###...###...###", -"###...####..###", -"###...###...###", -"###........####", -"###.......#####", -"###############", -"###############", -"###############" -}; diff -r 58424f6abf56 -r 11cf20601dec etc/toolbar/ediff-help.xbm --- a/etc/toolbar/ediff-help.xbm Mon Aug 13 10:22:10 2007 +0200 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,6 +0,0 @@ -#define ediff-help_width 15 -#define ediff-help_height 15 -static char ediff-help_bits[] = { - 0x00,0x80,0xf0,0x83,0x0c,0x86,0xe4,0x8c,0x74,0x8d,0xb4,0x8c,0x58,0x86,0x20, - 0x83,0xa0,0x83,0xa0,0x81,0xc0,0x80,0x20,0x83,0x20,0x83,0xc0,0x81,0x00,0x80 - }; diff -r 58424f6abf56 -r 11cf20601dec etc/toolbar/ediff-help.xpm --- a/etc/toolbar/ediff-help.xpm Mon Aug 13 10:22:10 2007 +0200 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,26 +0,0 @@ -/* XPM */ -static char *help[] = { -/* width height num_colors chars_per_pixel */ -" 15 15 3 1", -/* colors */ -". c #000000", -"b c Gray75 s backgroundToolBarColor", -"c c #ffff00", -/* pixels */ -"bbbbbbbbbbbbbbb", -"bbbb......bbbbb", -"bbb.ccccc..bbbb", -"bb.cc...cc..bbb", -"bb.c..bb.c..bbb", -"bb.c..b.cc..bbb", -"bbb..b.cc..bbbb", -"bbbbb.cc..bbbbb", -"bbbbb.c..bbbbbb", -"bbbbb.c..bbbbbb", -"bbbbbb..bbbbbbb", -"bbbbb.cc..bbbbb", -"bbbbb.cc..bbbbb", -"bbbbbb...bbbbbb", -"bbbbbbbbbbbbbbb" -"bbbbbbbbbbbbbbb" -}; diff -r 58424f6abf56 -r 11cf20601dec etc/toolbar/ediff-next.xbm --- a/etc/toolbar/ediff-next.xbm Mon Aug 13 10:22:10 2007 +0200 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,6 +0,0 @@ -#define ediff-next_width 15 -#define ediff-next_height 15 -static char ediff-next_bits[] = { - 0x00,0x80,0x80,0x80,0x80,0x83,0x80,0x82,0xfe,0x8c,0x02,0x8a,0xfa,0xb7,0xfa, - 0xbf,0xfa,0x9f,0xfe,0x8f,0xfe,0x87,0x80,0x83,0x80,0x81,0x80,0x80,0x00,0x80 - }; diff -r 58424f6abf56 -r 11cf20601dec etc/toolbar/ediff-next.xpm --- a/etc/toolbar/ediff-next.xpm Mon Aug 13 10:22:10 2007 +0200 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,25 +0,0 @@ -/* XPM */ -static char * file[] = { -/* width height num_colors chars_per_pixel */ -"15 15 5 1", -" c Gray75 s backgroundToolBarColor", -". c black", -"X c white", -"o c black", -"O c black", -" ", -" . ", -" .. ", -" .X. ", -" .......XX. ", -" .XXXXXXXoX. ", -" .XooooooooX. ", -" .Xoooooooooo. ", -" .XooooooooO. ", -" .oOOOOOOoO. ", -" .......OO. ", -" .O. ", -" .. ", -" . ", -" ", -}; diff -r 58424f6abf56 -r 11cf20601dec etc/toolbar/ediff-prev.xbm --- a/etc/toolbar/ediff-prev.xbm Mon Aug 13 10:22:10 2007 +0200 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,6 +0,0 @@ -#define ediff-prev_width 15 -#define ediff-prev_height 15 -static char ediff-prev_bits[] = { - 0x00,0x80,0x00,0x81,0x80,0x81,0x40,0x81,0x20,0xbf,0x50,0xa0,0xe8,0xaf,0xfc, - 0xaf,0xf8,0xaf,0xf0,0xbf,0xe0,0xbf,0xc0,0x81,0x80,0x81,0x00,0x81,0x00,0x80 - }; diff -r 58424f6abf56 -r 11cf20601dec etc/toolbar/ediff-prev.xpm --- a/etc/toolbar/ediff-prev.xpm Mon Aug 13 10:22:10 2007 +0200 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,23 +0,0 @@ -/* XPM */ -static char * left-arrow_xpm[] = { -/* width height num_colors chars_per_pixel */ -"15 15 3 1", -" c Gray75 s backgroundToolBarColor", -". c black", -"X c white", -" ", -" . ", -" .. ", -" .X. ", -" .XX...... ", -" .X.XXXXXX. ", -" .X.......X. ", -" ..........X. ", -" .........X. ", -" .......... ", -" ......... ", -" ... ", -" .. ", -" . ", -" ", -}; diff -r 58424f6abf56 -r 11cf20601dec etc/toolbar/ediff-quit.xbm --- a/etc/toolbar/ediff-quit.xbm Mon Aug 13 10:22:10 2007 +0200 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,6 +0,0 @@ -#define ediff-quit_width 15 -#define ediff-quit_height 15 -static char ediff-quit_bits[] = { - 0x00,0x80,0x06,0xb0,0x1e,0x98,0x3c,0x8c,0x70,0x82,0xe0,0x83,0xc0,0x81,0xe0, - 0x83,0x70,0x86,0x38,0x8c,0x1c,0x88,0x1c,0x90,0x08,0x80,0x00,0x80,0x00,0x80 - }; diff -r 58424f6abf56 -r 11cf20601dec etc/toolbar/ediff-quit.xpm --- a/etc/toolbar/ediff-quit.xpm Mon Aug 13 10:22:10 2007 +0200 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,26 +0,0 @@ -/* XPM */ -static char *delete[] = { -/* width height num_colors chars_per_pixel */ -" 15 15 4 1", -/* colors */ -". c #808080", -"# c #800000", -"a c #ffffff", -"b c #c0c0c0", -/* pixels */ -"bbbbbbbbbbbbbbb", -"b##abbbbbbbb##a", -"b####abbbbb##ab", -"bb####abbb##abb", -"bbbb###ab#abbbb", -"bbbbb#####abbbb", -"bbbbbb###abbbbb", -"bbbbb#####abbbb", -"bbbb###ab##abbb", -"bbb###abbb##abb", -"bb###abbbbb#abb", -"bb###abbbbbb#ab", -"bbb#abbbbbbbbbb", -"bbb#abbbbbbbbbb", -"bbbbbbbbbbbbbbb", -}; diff -r 58424f6abf56 -r 11cf20601dec etc/toolbar/ediff-refine.xbm --- a/etc/toolbar/ediff-refine.xbm Mon Aug 13 10:22:10 2007 +0200 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,6 +0,0 @@ -#define ediff-refine_width 15 -#define ediff-refine_height 15 -static char ediff-refine_bits[] = { - 0x00,0x80,0x80,0x80,0x84,0x90,0x8c,0x98,0x98,0x8c,0xf0,0x87,0xe0,0x83,0xe0, - 0x83,0xe0,0x83,0xf0,0x87,0x98,0x8c,0x8c,0x98,0x84,0x90,0x80,0x80,0x00,0x80 - }; diff -r 58424f6abf56 -r 11cf20601dec etc/toolbar/ediff-refine.xpm --- a/etc/toolbar/ediff-refine.xpm Mon Aug 13 10:22:10 2007 +0200 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,24 +0,0 @@ -/* XPM */ -static char *help[] = { -/* width height num_colors chars_per_pixel */ -" 15 15 2 1", -/* colors */ -"# c #000000", -"a c Gray75 s backgroundToolBarColor", -/* pixels */ -"aaaaaaaaaaaaaaa", -"aaaaaaa#aaaaaaa", -"aa#aaaa#aaaa#aa", -"aa##aaa#aaa##aa", -"aaa##aa#aa##aaa", -"aaaa#######aaaa", -"aaaaa#####aaaaa", -"aaaaa#####aaaaa", -"aaaaa#####aaaaa", -"aaaa#######aaaa", -"aaa##aa#aa##aaa", -"aa##aaa#aaa##aa", -"aa#aaaa#aaaa#aa", -"aaaaaaa#aaaaaaa", -"aaaaaaaaaaaaaaa", -}; diff -r 58424f6abf56 -r 11cf20601dec etc/toolbar/ediff-save-xx.xbm --- a/etc/toolbar/ediff-save-xx.xbm Mon Aug 13 10:22:10 2007 +0200 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,6 +0,0 @@ -#define disk-xx_width 15 -#define disk-xx_height 15 -static char disk-xx_bits[] = { - 0x00,0x00,0x0a,0x28,0x00,0x00,0x0a,0x28,0x00,0x00,0x0a,0x28,0x00,0x00,0xfa, - 0x2f,0x00,0x00,0x02,0x20,0x00,0x00,0x0a,0x29,0x00,0x00,0xf8,0x3f,0x00,0x00 - }; diff -r 58424f6abf56 -r 11cf20601dec etc/toolbar/ediff-save-xx.xpm --- a/etc/toolbar/ediff-save-xx.xpm Mon Aug 13 10:22:10 2007 +0200 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,25 +0,0 @@ -/* XPM */ -static char * disk[] = { -"15 15 5 1", -"X c Gray75 s backgroundToolBarColor", -"o c Gray60", -"O c Gray60", -"+ c Gray90", -"@ c Gray40", -"XXXXXXXXXXXXXXX", -"XXXXXXXXXXXXXXX", -"XoooooooooooooX", -"XoOo+++++++oOoX", -"XoOo+++++++oOoX", -"XoOo+++++++oOoX", -"XoOo+++++++oOoX", -"XoOoooooooooOoX", -"XoOOOOOOOOOOOoX", -"XoOoooooooooOoX", -"XoOo@@@@o++oOoX", -"XoOo@@@@o++oOoX", -"XoOo@@@@o++oOoX", -"XXooooooooooooX", -"XXXXXXXXXXXXXXX", -"XXXXXXXXXXXXXXX" -}; diff -r 58424f6abf56 -r 11cf20601dec etc/toolbar/ediff-save.xbm --- a/etc/toolbar/ediff-save.xbm Mon Aug 13 10:22:10 2007 +0200 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,6 +0,0 @@ -#define disk-up_width 15 -#define disk-up_height 15 -static char disk-up_bits[] = { - 0x00,0x00,0xfe,0x3f,0x0a,0x28,0x0a,0x28,0x0a,0x38,0x0a,0x28,0x0a,0x28,0xfa, - 0x2f,0x02,0x20,0xfa,0x2f,0x0a,0x29,0x0a,0x29,0x0c,0x29,0xf8,0x3f,0x00,0x00 - }; diff -r 58424f6abf56 -r 11cf20601dec etc/toolbar/ediff-save.xpm --- a/etc/toolbar/ediff-save.xpm Mon Aug 13 10:22:10 2007 +0200 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,25 +0,0 @@ -/* XPM */ -static char * disk[] = { -"15 15 5 1", -"X c Gray75 s backgroundToolBarColor", -"o c black", -"O c Gray60", -"+ c Gray90", -"@ c Gray40", -"XXXXXXXXXXXXXXX", -"XXXXXXXXXXXXXXX", -"XoooooooooooooX", -"XoOo+++++++oOoX", -"XoOo+++++++oOoX", -"XoOo+++++++oOoX", -"XoOo+++++++oOoX", -"XoOoooooooooOoX", -"XoOOOOOOOOOOOoX", -"XoOoooooooooOoX", -"XoOo@@@@o++oOoX", -"XoOo@@@@o++oOoX", -"XoOo@@@@o++oOoX", -"XXooooooooooooX", -"XXXXXXXXXXXXXXX", -"XXXXXXXXXXXXXXX" -}; diff -r 58424f6abf56 -r 11cf20601dec etc/toolbar/ediff-toggle-split-up.xbm --- a/etc/toolbar/ediff-toggle-split-up.xbm Mon Aug 13 10:22:10 2007 +0200 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,6 +0,0 @@ -#define ediff-toggle-split-up_width 15 -#define ediff-toggle-split-up_height 15 -static char ediff-toggle-split-up_bits[] = { - 0x00,0x80,0xfe,0x87,0xfe,0x87,0x00,0x80,0x00,0xb0,0x7e,0xb0,0x1e,0xb0,0x1e, - 0xb0,0x3e,0xb2,0x72,0xb3,0xe2,0xb3,0xc0,0xb3,0xc0,0xb3,0xf0,0xb7,0x00,0x80 - }; diff -r 58424f6abf56 -r 11cf20601dec etc/toolbar/ediff-toggle-split-up.xpm --- a/etc/toolbar/ediff-toggle-split-up.xpm Mon Aug 13 10:22:10 2007 +0200 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,25 +0,0 @@ -/* XPM */ -static char *ediff-toggle-split-up[] = { -/* width height num_colors chars_per_pixel */ -" 15 15 3 1", -/* colors */ -"# c #000000", -"a c firebrick", -"f c Gray75 s backgroundToolBarColor", -/* pixels */ -"fffffffffffffff", -"faaaaaaaaaaffff", -"faaaaaaaaaaffff", -"fffffffffffffff", -"ffffffffffffaaf", -"f######fffffaaf", -"f####fffffffaaf", -"f####fffffffaaf", -"f#####fff#ffaaf", -"f#ff###ff#ffaaf", -"f#fff#####ffaaf", -"ffffff####ffaaf", -"ffffff####ffaaf", -"ffff######ffaaf", -"fffffffffffffff", -}; diff -r 58424f6abf56 -r 11cf20601dec etc/toolbar/ediff-update.xbm --- a/etc/toolbar/ediff-update.xbm Mon Aug 13 10:22:10 2007 +0200 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,6 +0,0 @@ -#define ediff-update_width 15 -#define ediff-update_height 15 -static char ediff-update_bits[] = { - 0x00,0x80,0x78,0x80,0xcc,0x99,0x04,0x9b,0x04,0x9c,0x04,0x9e,0x0c,0x9f,0x00, - 0x80,0x7c,0x98,0x3c,0x90,0x1c,0x90,0x6c,0x90,0xcc,0x99,0x00,0x8f,0x00,0x80 - }; diff -r 58424f6abf56 -r 11cf20601dec etc/toolbar/ediff-update.xpm --- a/etc/toolbar/ediff-update.xpm Mon Aug 13 10:22:10 2007 +0200 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,25 +0,0 @@ -/* XPM */ -static char *update[] = { -/* width height num_colors chars_per_pixel */ -" 15 15 3 1", -/* colors */ -". c #000000", -"a c #000080", -"c c Gray75 s backgroundToolBarColor", -/* pixels */ -"ccccccccccccccc", -"ccc.aaacccccccc", -"cc.acccaacccacc", -"ccaccccccacaacc", -"ccacccccccaaacc", -"ccaccccccaaaacc", -"cc.accccaaaaacc", -"ccccccccccccccc", -"ccaaaaacccca.cc", -"ccaaaaccccccacc", -"ccaaacccccccacc", -"ccaacaccccccacc", -"ccacccaaccca.cc", -"ccccccccaaa.ccc", -"ccccccccccccccc", -}; diff -r 58424f6abf56 -r 11cf20601dec lib-src/ChangeLog --- a/lib-src/ChangeLog Mon Aug 13 10:22:10 2007 +0200 +++ b/lib-src/ChangeLog Mon Aug 13 10:23:02 2007 +0200 @@ -1,3 +1,27 @@ +Tue Feb 17 12:50:37 1998 Andy Piper + + * lib-src/Makefile.in.in: make sure clean removes msw executables + +1998-02-24 SL Baur + + * gnuserv.h: Enable USE_TMPDIR. + +1998-02-23 Glynn Clements + + * gnuclient.c (main): initialise variable `tmpdir' from the TMPDIR + environment variable. + + * gnuserv.c (various): replace hardcoded references to /tmp with + the value of `tmpdir'. + (main): initialise variable `tmpdir' from the TMPDIR + environment variable. + + * gnuserv.h: include (commented-out) definition of USE_TMPDIR. + Add `extern char *tmpdir'. + + * gnuslib.c (various): replace hardcoded references to /tmp with + the value of `tmpdir'. + 1998-02-15 SL Baur * getopt.c (_getopt_internal): Add braces for clarity. diff -r 58424f6abf56 -r 11cf20601dec lib-src/Makefile.in.in --- a/lib-src/Makefile.in.in Mon Aug 13 10:22:10 2007 +0200 +++ b/lib-src/Makefile.in.in Mon Aug 13 10:23:02 2007 +0200 @@ -223,7 +223,7 @@ mostlyclean: $(RM) *.o *.i core clean: mostlyclean - $(RM) ${INSTALLABLES} ${UTILITIES} + $(RM) ${INSTALLABLES} ${UTILITIES} *.exe distclean: clean $(RM) DOC *.tab.c *.tab.h aixcc.c TAGS $(RM) Makefile Makefile.in blessmail config.values diff -r 58424f6abf56 -r 11cf20601dec lib-src/gnuclient.c --- a/lib-src/gnuclient.c Mon Aug 13 10:22:10 2007 +0200 +++ b/lib-src/gnuclient.c Mon Aug 13 10:23:02 2007 +0200 @@ -312,6 +312,12 @@ else progname = argv[0]; +#ifdef USE_TMPDIR + tmpdir = getenv ("TMPDIR"); +#endif + if (!tmpdir) + tmpdir = "/tmp"; + display = getenv ("DISPLAY"); if (!display) suppress_windows_system = 1; diff -r 58424f6abf56 -r 11cf20601dec lib-src/gnuserv.c --- a/lib-src/gnuserv.c Mon Aug 13 10:22:10 2007 +0200 +++ b/lib-src/gnuserv.c Mon Aug 13 10:23:02 2007 +0200 @@ -139,7 +139,7 @@ key_t key; /* messge key */ char buf[GSERV_BUFSZ]; /* pathname for key */ - sprintf (buf,"/tmp/gsrv%d",(int)geteuid ()); + sprintf (buf,"%s/gsrv%d",tmpdir,(int)geteuid ()); creat (buf,0600); key = ftok (buf,1); @@ -743,7 +743,7 @@ /* Set up address structure for the listen socket. */ #ifdef HIDE_UNIX_SOCKET - sprintf(server.sun_path,"/tmp/gsrvdir%d",(int)geteuid()); + sprintf(server.sun_path,"%s/gsrvdir%d",tmpdir,(int)geteuid()); if (mkdir(server.sun_path, 0700) < 0) { /* assume it already exists, and try to set perms */ @@ -758,7 +758,7 @@ strcat(server.sun_path,"/gsrv"); unlink(server.sun_path); /* remove old file if it exists */ #else /* HIDE_UNIX_SOCKET */ - sprintf(server.sun_path,"/tmp/gsrv%d",(int)geteuid()); + sprintf(server.sun_path,"%s/gsrv%d",tmpdir,(int)geteuid()); unlink(server.sun_path); /* remove old file if it exists */ #endif /* HIDE_UNIX_SOCKET */ @@ -849,6 +849,11 @@ for(chan=3; chan < _NFILE; close(chan++)) /* close unwanted channels */ ; +#ifdef USE_TMPDIR + tmpdir = getenv("TMPDIR"); +#endif + if (!tmpdir) + tmpdir = "/tmp"; #ifdef USE_LITOUT { /* this is to allow ^D to pass to emacs */ diff -r 58424f6abf56 -r 11cf20601dec lib-src/gnuserv.h --- a/lib-src/gnuserv.h Mon Aug 13 10:22:10 2007 +0200 +++ b/lib-src/gnuserv.h Mon Aug 13 10:23:02 2007 +0200 @@ -34,6 +34,8 @@ static char header_rcsid [] = "!Header: gnuserv.h,v 2.4 95/02/16 11:58:11 arup alpha !"; #endif +#define USE_TMPDIR + #define NO_SHORTNAMES #define PATCHLEVEL 2 @@ -189,6 +191,7 @@ extern char *optarg; extern int optind; extern char *progname; +extern char *tmpdir; /* The casts shut Sun's compiler up and are safe in the context these are actually used. */ diff -r 58424f6abf56 -r 11cf20601dec lib-src/gnuslib.c --- a/lib-src/gnuslib.c Mon Aug 13 10:22:10 2007 +0200 +++ b/lib-src/gnuslib.c Mon Aug 13 10:23:02 2007 +0200 @@ -72,6 +72,8 @@ #include +char *tmpdir = NULL; + char *progname = NULL; int make_connection(hostarg, portarg, s) @@ -134,7 +136,7 @@ key_t key; /* message key */ char buf[GSERV_BUFSZ+1]; /* buffer for filename */ - sprintf(buf,"/tmp/gsrv%d",(int)geteuid()); + sprintf(buf,"%s/gsrv%d",tmpdir,(int)geteuid()); creat(buf,0600); if ((key = ftok(buf,1)) == -1) { perror(progname); @@ -263,9 +265,9 @@ server.sun_family = AF_UNIX; #ifdef HIDE_UNIX_SOCKET - sprintf(server.sun_path,"/tmp/gsrvdir%d/gsrv",(int)geteuid()); + sprintf(server.sun_path,"%s/gsrvdir%d/gsrv",tmpdir,(int)geteuid()); #else /* HIDE_UNIX_SOCKET */ - sprintf(server.sun_path,"/tmp/gsrv%d",(int)geteuid()); + sprintf(server.sun_path,"%s/gsrv%d",tmpdir,(int)geteuid()); #endif /* HIDE_UNIX_SOCKET */ if (connect(s,(struct sockaddr *)&server,strlen(server.sun_path)+2) < 0) { perror(progname); diff -r 58424f6abf56 -r 11cf20601dec lib-src/movemail.c --- a/lib-src/movemail.c Mon Aug 13 10:22:10 2007 +0200 +++ b/lib-src/movemail.c Mon Aug 13 10:23:02 2007 +0200 @@ -534,7 +534,9 @@ error ("Error in open: %s, %s", strerror (errno), outfile); return (1); } +#ifndef __CYGWIN32__ fchown (mbfi, getuid (), -1); +#endif if ((mbf = fdopen (mbfi, "wb")) == NULL) { diff -r 58424f6abf56 -r 11cf20601dec lib-src/pop.c --- a/lib-src/pop.c Mon Aug 13 10:22:10 2007 +0200 +++ b/lib-src/pop.c Mon Aug 13 10:23:02 2007 +0200 @@ -128,7 +128,7 @@ #define ERROR_MAX 80 /* a pretty arbitrary size */ #define POP_PORT 110 #define KPOP_PORT 1109 -#ifdef WINDOWSNT +#if defined(WINDOWSNT) || defined(__CYGWIN32__) #define POP_SERVICE "pop3" /* we don't want the POP2 port! */ #else #define POP_SERVICE "pop" @@ -1027,7 +1027,11 @@ { hostent = gethostbyname (host); try_count++; - if ((! hostent) && ((h_errno != TRY_AGAIN) || (try_count == 5))) + if ((! hostent) +#ifndef BROKEN_CYGWIN + && ((h_errno != TRY_AGAIN) || (try_count == 5)) +#endif + ) { strcpy (pop_error, "Could not determine POP server's address"); return (-1); diff -r 58424f6abf56 -r 11cf20601dec lisp/ChangeLog --- a/lisp/ChangeLog Mon Aug 13 10:22:10 2007 +0200 +++ b/lisp/ChangeLog Mon Aug 13 10:23:02 2007 +0200 @@ -1,3 +1,118 @@ +Tue Feb 17 12:50:37 1998 Andy Piper + + * code-files.el: new file. a virtual copy of mule-files.el + but without charset + dependencies. (toggle-buffer-file-ocding-system) new function for + changing the eol type for the current buffer. + + * code-process.el: new file. a copy of + mule-process.el. mule-process.el will disappear when things have + settled. + + * coding.el: new file. a virtual copy of mule-files.el but + without charset dependencies. (coding-system-base) new function + for getting the parent coding system of a coding system with eol + type set. + + * dumped-lisp.el: add above files for the non-mule case. + +1998-02-25 Kyle Jones + + * window-xemacs.el (display-buffer): If no explicit + frame is specified, search for a window that displays + the buffer on the currently selected frame, before + searching other frames. + +1998-02-25 Kyle Jones + + * frame.el (get-frame-for-buffer): If not-this-window-p + is non-nil, use window on the selected frame if it is not + also the selected window. When defaulting, search for + windows on the currently selected fgrame before searching + other frames. + +1998-02-25 Didier Verna + + * modeline.el (modeline-swap-buffers): originally named + `mouse-release-modeline'. Whether to actually swap the buffers is + decided in `mouse-drag-modeline'. + (mouse-drag-modeline): A button release event is considered a + mouse click is both X (modeline scroll) and Y (modeline drag) pos + stay unchanged. + +1998-02-25 SL Baur + + * x-menubar.el: Put redo on the menubar. + From Aki Vehtari + +1998-02-22 Greg Klanderman + + * bytecomp.el (displaying-byte-compile-warnings): if + temp-buffer-show-function is set, use it to display current set of + warnings in the "*Compile-Log-Show*" buffer. + + * simple.el (display-warning-buffer): if temp-buffer-show-function + is set, use it to display current set of warnings in the + "*Warnings-Show*" buffer. + +1998-02-20 Karl M. Hegbloom + + * cl-extra.el (equalp): Make (equalp ?A ?a) return t as in + Common Lisp. + +1998-02-23 Aki Vehtari + + * menubar.el: Allow button descriptors at least 2 long. + + * x-menubar.el (default-menubar): Use recommended forms. + (file-menu-filter): Remove. + (edit-menu-filter): Remove. + +1998-02-24 SL Baur + + * about.el (about-hackers): Updated. + +1998-02-22 Greg Klanderman + + * help.el (help-max-help-buffers): new variable + (help-register-and-maybe-prune-excess): new function + (help-buffer-name): use help-max-help-buffers. + (with-displaying-help-buffer): use + help-register-and-maybe-prune-excess. + + * help.el (help-maybe-pretty-print-value): if the value fits on + one line, let it. + +1998-02-21 Greg Klanderman + + * (with-displaying-help-buffer): there is no need to kill the buffer + if it exists, becasuse with-output-to-temp-buffer will clear it. + further, killing the buffer violates the rule that + temp-buffer-show-function, if set, has the full responsibility of + showing the temp buffer. killing the buffer fucks with the window + configuration, hosing temp-buffer-show-function. + + +1998-02-23 Didier Verna + + * modeline.el (mouse-drag-modeline): + - Always scroll the modeline that was originally clicked on. + - Use x pixels instead of x characters (which doesn't work anyway) + as horizontal reference for modeline dragging. This allows us to + keep on dragging the modeline even if the motion event occurs in + another window. + +1998-02-23 Didier Verna + + * x-mouse.el (x-init-pointer-shape): use a crossed-arrows cursor + glyph on the modeline to indicate that dragging the mouse has an + effect both horizontally and vertically. + +1998-02-24 SL Baur + + * about.el (about-xemacs): Get rid of redundant visible version + number. + 1998-02-19 SL Baur * about.el (about-hackers): Update credits. diff -r 58424f6abf56 -r 11cf20601dec lisp/about.el --- a/lisp/about.el Mon Aug 13 10:22:10 2007 +0200 +++ b/lisp/about.el Mon Aug 13 10:23:02 2007 +0200 @@ -72,6 +72,7 @@ (kyle "Kyle Jones" "kyle_jones@wonderworks.com") (larsi "Lars Magne Ingebrigtsen" "larsi@gnus.org") (marcpa "Marc Paquette" "marcpa@CAM.ORG") + (mcook "Michael R. Cook" "mcook@cognex.com") (mly "Richard Mlynarik" "mly@adoc.xerox.com") (morioka "MORIOKA Tomohiko" "morioka@jaist.ac.jp") (mrb "Martin Buchholz" "mrb@sun.eng.com") @@ -259,7 +260,7 @@ firewalls) in order to work correctly. XEmacs is the result of the time and effort of many people. The -developers responsible for the 20.4 release are:\n\n") +developers responsible for this release are:\n\n") (flet ((setup-person (who) (widget-insert "\t* ") @@ -1228,6 +1229,9 @@ will get to finish it sometime sooner rather than later. I do vaguely remember University where it seems like I had more spare time that I can believe now. Oh well, such is life.\n") + (print-short "Michael R. Cook" "mcook@cognex.com" "\ +Author of the \"shy groups\" and minimal matching regular expression +extensions.\n") "\n\ In addition to those just mentioned, the following people have spent a great deal of effort providing feedback, testing beta versions of @@ -1345,6 +1349,7 @@ (print-short "Rob Kooper" "kooper@cc.gatech.edu") (print-short "Peter Skov Knudsen" "knu@dde.dk") (print-short "Jens Krinke" "krinke@ips.cs.tu-bs.de") + (print-short "Maximilien Lincourt" "max@toonboom.com") (print-short "Mats Larsson" "Mats.Larsson@uab.ericsson.se") (print-short "Simon Leinen" "simon@instrumatic.ch") (print-short "Carsten Leonhardt" "leo@arioch.tng.oche.de") @@ -1367,7 +1372,6 @@ (print-short "Pekka Marjola" "pema@iki.fi") (print-short "Simon Marshall" "simon@gnu.ai.mit.edu") (print-short "Dave Mason" "dmason@plg.uwaterloo.ca") - (print-short "Jason R Mastaler" "jason@4b.org") (print-short "Jaye Mathisen" "mrcpu@cdsnet.net") (print-short "Jason McLaren" "mclaren@math.mcgill.ca") (print-short "Michael McNamara" "mac@silicon-sorcery.com") diff -r 58424f6abf56 -r 11cf20601dec lisp/bytecomp.el --- a/lisp/bytecomp.el Mon Aug 13 10:22:10 2007 +0200 +++ b/lisp/bytecomp.el Mon Aug 13 10:23:02 2007 +0200 @@ -1332,11 +1332,24 @@ (set-buffer "*Compile-Log*") (if (= byte-compile-warnings-point-max (point-max)) nil - (select-window - (prog1 (selected-window) - (select-window (display-buffer (current-buffer))) - (goto-char byte-compile-warnings-point-max) - (recenter 1)))))))) + (if temp-buffer-show-function + (let ((show-buffer (get-buffer-create "*Compile-Log-Show*"))) + (save-excursion + (set-buffer show-buffer) + (setq buffer-read-only nil) + (erase-buffer)) + (copy-to-buffer show-buffer + (save-excursion + (goto-char byte-compile-warnings-point-max) + (forward-line -1) + (point)) + (point-max)) + (funcall temp-buffer-show-function show-buffer)) + (select-window + (prog1 (selected-window) + (select-window (display-buffer (current-buffer))) + (goto-char byte-compile-warnings-point-max) + (recenter 1))))))))) ;;;###autoload diff -r 58424f6abf56 -r 11cf20601dec lisp/cl-extra.el --- a/lisp/cl-extra.el Mon Aug 13 10:22:10 2007 +0200 +++ b/lisp/cl-extra.el Mon Aug 13 10:23:02 2007 +0200 @@ -98,6 +98,10 @@ (and (stringp y) (= (length x) (length y)) (or (string-equal x y) (string-equal (downcase x) (downcase y))))) ; lazy but simple! + ((characterp x) + (and (characterp y) + (or (char-equal x y) + (char-equal (downcase x) (downcase y))))) ((numberp x) (and (numberp y) (= x y))) ((consp x) diff -r 58424f6abf56 -r 11cf20601dec lisp/code-files.el --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/lisp/code-files.el Mon Aug 13 10:23:02 2007 +0200 @@ -0,0 +1,561 @@ +;;; code-files.el --- File I/O functions for XEmacs. + +;; Copyright (C) 1992,93,94,95 Free Software Foundation, Inc. +;; Copyright (C) 1995 Amdahl Corporation. +;; Copyright (C) 1995 Sun Microsystems. + +;; This file is part of XEmacs. + +;; This file is very similar to mule-files.el + +;; 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. + +;;; Commentary: + +;;; Derived from mule.el in the original Mule but heavily modified +;;; by Ben Wing. + +;; 1997/3/11 modified by MORIOKA Tomohiko to sync with Emacs 20 API. + +;;; Code: + +(setq-default buffer-file-coding-system 'undecided) +(put 'buffer-file-coding-system 'permanent-local t) + +(define-obsolete-variable-alias + 'file-coding-system + 'buffer-file-coding-system) + +(define-obsolete-variable-alias + 'overriding-file-coding-system + 'coding-system-for-read) + +(defvar buffer-file-coding-system-for-read 'undecided + "Coding system used when reading a file. +This provides coarse-grained control; for finer-grained control, use +`file-coding-system-alist'. From a Lisp program, if you wish to +unilaterally specify the coding system used for one particular +operation, you should bind the variable `coding-system-for-read' +rather than setting this variable, which is intended to be used for +global environment specification.") + +(define-obsolete-variable-alias + 'file-coding-system-for-read + 'buffer-file-coding-system-for-read) + +(defvar file-coding-system-alist + '(("\\.elc$" . (binary . binary)) + ("loaddefs.el$" . (binary . binary)) + ("\\.tar$" . (binary . binary)) + ("\\.\\(tif\\|tiff\\)$" . (binary . binary)) + ("\\.png$" . (binary . binary)) + ("\\.gif$" . (binary . binary)) + ("\\.\\(jpeg\\|jpg\\)$" . (binary . binary)) + ("TUTORIAL\\.hr$" . iso-8859-2) + ("TUTORIAL\\.pl$" . iso-8859-2) + ;; ("\\.\\(el\\|emacs\\|info\\(-[0-9]+\\)?\\|texi\\)$" . iso-2022-8) + ;; ("\\(ChangeLog\\|CHANGES-beta\\)$" . iso-2022-8) + ("\\.\\(gz\\|Z\\)$" . binary) + ("/spool/mail/.*$" . convert-mbox-coding-system)) + "Alist to decide a coding system to use for a file I/O operation. +The format is ((PATTERN . VAL) ...), +where PATTERN is a regular expression matching a file name, +VAL is a coding system, a cons of coding systems, or a function symbol. +If VAL is a coding system, it is used for both decoding and encoding +the file contents. +If VAL is a cons of coding systems, the car part is used for decoding, +and the cdr part is used for encoding. +If VAL is a function symbol, the function must return a coding system +or a cons of coding systems which are used as above. + +This overrides the more general specification in +`buffer-file-coding-system-for-read', but is overridden by +`coding-system-for-read'.") + +(defun set-buffer-file-coding-system (coding-system &optional force) + "Set buffer-file-coding-system of the current buffer to CODING-SYSTEM. +If optional argument FORCE (interactively, the prefix argument) is not +given, attempt to match the EOL type of the new coding system to +the current value of `buffer-file-coding-system'." + (interactive "zFile coding system: \nP") + (get-coding-system coding-system) ;; correctness check + (if (not force) + (setq coding-system + (subsidiary-coding-system + coding-system + (coding-system-eol-type buffer-file-coding-system)))) + (setq buffer-file-coding-system coding-system) + (redraw-modeline t)) + +(defun toggle-buffer-file-coding-system () + "Set EOL type of buffer-file-coding-system of the current buffer to +something other than what it is at the moment." + (interactive) + (let ((eol-type + (coding-system-eol-type buffer-file-coding-system))) + (setq buffer-file-coding-system + (subsidiary-coding-system + (coding-system-base buffer-file-coding-system) + (cond ((eq eol-type 'lf) 'crlf) + ((eq eol-type 'crlf) 'lf) + ((eq eol-type 'cr) 'lf)))))) + +(define-obsolete-function-alias + 'set-file-coding-system + 'set-buffer-file-coding-system) + +(defun set-buffer-file-coding-system-for-read (coding-system) + "Set the coding system used when reading in a file. +This is equivalent to setting the variable +`buffer-file-coding-system-for-read'. You can also use +`file-coding-system-alist' to specify the coding system for +particular files." + (interactive "zFile coding system for read: ") + (get-coding-system coding-system) ;; correctness check + (setq buffer-file-coding-system-for-read coding-system)) + +(define-obsolete-function-alias + 'set-file-coding-system-for-read + 'set-buffer-file-coding-system-for-read) + +(defun set-default-buffer-file-coding-system (coding-system) + "Set the default value of `buffer-file-coding-system' to CODING-SYSTEM. +The default value is used both for buffers without associated files +and for files with no apparent coding system (i.e. primarily ASCII). +See `buffer-file-coding-system' for more information." + (interactive "zDefault file coding system: ") + (setq-default buffer-file-coding-system coding-system) + (redraw-modeline t)) + +(define-obsolete-function-alias + 'set-default-file-coding-system + 'set-default-buffer-file-coding-system) + +(defun find-file-coding-system-for-read-from-filename (filename) + "Look up coding system to read a file in `file-coding-system-alist'. +The return value will be nil (no applicable entry) or a coding system +object (the entry specified a coding system)." + (let ((alist file-coding-system-alist) + (found nil) + (codesys nil)) + (let ((case-fold-search (eq system-type 'vax-vms))) + (setq filename (file-name-sans-versions filename)) + (while (and (not found) alist) + (if (string-match (car (car alist)) filename) + (setq codesys (cdr (car alist)) + found t)) + (setq alist (cdr alist)))) + (when codesys + (if (functionp codesys) + (setq codesys (funcall codesys 'insert-file-contents filename)) + ) + (cond ((consp codesys) (find-coding-system (car codesys))) + ((find-coding-system codesys)) + )))) + +(define-obsolete-function-alias + 'find-file-coding-system-from-filename + 'find-file-coding-system-for-read-from-filename) + +(defun find-file-coding-system-for-write-from-filename (filename) + "Look up coding system to write a file in `file-coding-system-alist'. +The return value will be nil (no applicable entry) or a coding system +object (the entry specified a coding system)." + (let ((alist file-coding-system-alist) + (found nil) + (codesys nil)) + (let ((case-fold-search (eq system-type 'vax-vms))) + (setq filename (file-name-sans-versions filename)) + (while (and (not found) alist) + (if (string-match (car (car alist)) filename) + (setq codesys (cdr (car alist)) + found t)) + (setq alist (cdr alist)))) + (when codesys + (if (functionp codesys) + (setq codesys (funcall codesys 'write-region filename)) + ) + (cond ((consp codesys) (find-coding-system (cdr codesys))) + ((find-coding-system codesys)) + )))) + +(defun convert-mbox-coding-system (filename visit start end) + "Decoding function for Unix mailboxes. +Does separate detection and decoding on each message, since each +message might be in a different encoding." + (let ((buffer-read-only nil)) + (save-restriction + (narrow-to-region start end) + (goto-char (point-min)) + (while (not (eobp)) + (let ((start (point)) + end) + (forward-char 1) + (if (re-search-forward "^From" nil 'move) + (beginning-of-line)) + (setq end (point)) + (decode-coding-region start end 'undecided)))))) + +(defun find-coding-system-magic-cookie () + "Look for the coding-system magic cookie in the current buffer.\n" +"The coding-system magic cookie is the exact string\n" +"\";;;###coding system: \" followed by a valid coding system symbol,\n" +"somewhere within the first 3000 characters of the file. If found,\n" +"the coding system symbol is returned; otherwise nil is returned.\n" +"Note that it is extremely unlikely that such a string would occur\n" +"coincidentally as the result of encoding some characters in a non-ASCII\n" +"charset, and that the spaces make it even less likely since the space\n" +"character is not a valid octet in any ISO 2022 encoding of most non-ASCII\n" +"charsets." + (save-excursion + (goto-char (point-min)) + (or (and (looking-at + "^[^\n]*-\\*-[^\n]*coding: \\([^ \t\n;]+\\)[^\n]*-\\*-") + (let ((codesys (intern (buffer-substring + (match-beginning 1)(match-end 1))))) + (if (find-coding-system codesys) codesys))) + ;; (save-excursion + ;; (let (start end) + ;; (and (re-search-forward "^;+[ \t]*Local Variables:" nil t) + ;; (setq start (match-end 0)) + ;; (re-search-forward "\n;+[ \t]*End:") + ;; (setq end (match-beginning 0)) + ;; (save-restriction + ;; (narrow-to-region start end) + ;; (goto-char start) + ;; (re-search-forward "^;;; coding: \\([^\n]+\\)$" nil t) + ;; ) + ;; (let ((codesys + ;; (intern (buffer-substring + ;; (match-beginning 1)(match-end 1))))) + ;; (if (find-coding-system codesys) codesys)) + ;; ))) + (let ((case-fold-search nil)) + (if (search-forward + ";;;###coding system: " (+ (point-min) 3000) t) + (let ((start (point)) + (end (progn + (skip-chars-forward "^ \t\n\r") + (point)))) + (if (> end start) + (let ((codesys (intern (buffer-substring start end)))) + (if (find-coding-system codesys) codesys))) + ))) + ))) + +(defun load (file &optional noerror nomessage nosuffix) + "Execute a file of Lisp code named FILE. +First tries FILE with .elc appended, then tries with .el, + then tries FILE unmodified. Searches directories in load-path. +If optional second arg NOERROR is non-nil, + report no error if FILE doesn't exist. +Print messages at start and end of loading unless + optional third arg NOMESSAGE is non-nil. +If optional fourth arg NOSUFFIX is non-nil, don't try adding + suffixes .elc or .el to the specified name FILE. +Return t if file exists." + (let* ((filename (substitute-in-file-name file)) + (handler (find-file-name-handler filename 'load)) + (path nil)) + (if handler + (funcall handler 'load filename noerror nomessage nosuffix) + (if (or (<= (length filename) 0) + (null (setq path + (locate-file filename load-path + (and (not nosuffix) ".elc:.el:"))))) + (and (null noerror) + (signal 'file-error (list "Cannot open load file" filename))) + ;; now use the internal load to actually load the file. + (load-internal + file noerror nomessage nosuffix + (let ((elc ; use string= instead of string-match to keep match-data. + (string= ".elc" (downcase (substring path -4))))) + (or (and (not elc) coding-system-for-read) ; prefer for source file + ;; find magic-cookie + (save-excursion + (set-buffer (get-buffer-create " *load*")) + (erase-buffer) + (let ((coding-system-for-read 'no-conversion)) + (insert-file-contents path nil 1 3001)) + (find-coding-system-magic-cookie)) + (if elc + ;; if reading a byte-compiled file and we didn't find + ;; a coding-system magic cookie, then use `binary'. + ;; We need to guarantee that we never do autodetection + ;; on byte-compiled files because confusion here would + ;; be a very bad thing. Pre-existing byte-compiled + ;; files are always in the `binary' coding system. + ;; Also, byte-compiled files always use `lf' to terminate + ;; a line; don't risk confusion here either. + 'binary + (or (find-file-coding-system-for-read-from-filename path) + ;; looking up in `file-coding-system-alist'. + ;; otherwise use `buffer-file-coding-system-for-read', + ;; as normal + buffer-file-coding-system-for-read) + ))) + ))))) + +(defvar insert-file-contents-access-hook nil + "A hook to make a file accessible before reading it. +`insert-file-contents' calls this hook before doing anything else. +Called with two arguments: FILENAME and VISIT, the same as the +corresponding arguments in the call to `insert-file-contents'.") + +(defvar insert-file-contents-pre-hook nil + "A special hook to decide the coding system used for reading in a file. + +Before reading a file, `insert-file-contents' calls the functions on +this hook with arguments FILENAME and VISIT, the same as the +corresponding arguments in the call to `insert-file-contents'. In +these functions, you may refer to the global variable +`buffer-file-coding-system-for-read'. + +The return value of the functions should be either + +-- nil +-- A coding system or a symbol denoting it, indicating the coding system + to be used for reading the file +-- A list of two elements (absolute pathname and length of data inserted), + which is used as the return value to `insert-file-contents'. In this + case, `insert-file-contents' assumes that the function has inserted + the file for itself and suppresses further reading. + +If any function returns non-nil, the remaining functions are not called.") + +(defvar insert-file-contents-error-hook nil + "A hook to set `buffer-file-coding-system' when a read error has occurred. + +When a file error (e.g. nonexistent file) occurs while read a file, +`insert-file-contents' calls the functions on this hook with three +arguments: FILENAME and VISIT (the same as the corresponding arguments +in the call to `insert-file-contents') and a cons (SIGNALED-CONDITIONS +. SIGNAL-DATA). + +After calling this hook, the error is signalled for real and +propagates to the caller of `insert-file-contents'.") + +(defvar insert-file-contents-post-hook nil + "A hook to set `buffer-file-coding-system' for the current buffer. + +After successful reading, `insert-file-contents' calls the functions +on this hook with four arguments: FILENAME and VISIT (the same as the +corresponding arguments in the call to `insert-file-contents'), +CODING-SYSTEM (the actual coding system used to decode the file), and +a cons of absolute pathname and length of data inserted (the same +thing as will be returned from `insert-file-contents').") + +(defun insert-file-contents (filename &optional visit beg end replace) + "Insert contents of file FILENAME after point. +Returns list of absolute file name and length of data inserted. +If second argument VISIT is non-nil, the buffer's visited filename +and last save file modtime are set, and it is marked unmodified. +If visiting and the file does not exist, visiting is completed +before the error is signaled. + +The optional third and fourth arguments BEG and END +specify what portion of the file to insert. +If VISIT is non-nil, BEG and END must be nil. +If optional fifth argument REPLACE is non-nil, +it means replace the current buffer contents (in the accessible portion) +with the file contents. This is better than simply deleting and inserting +the whole thing because (1) it preserves some marker positions +and (2) it puts less data in the undo list. + +NOTE: When Mule support is enabled, the REPLACE argument is +currently ignored. + +The coding system used for decoding the file is determined as follows: + +1. `coding-system-for-read', if non-nil. +2. The result of `insert-file-contents-pre-hook', if non-nil. +3. The matching value for this filename from + `file-coding-system-alist', if any. +4. `buffer-file-coding-system-for-read', if non-nil. +5. The coding system 'no-conversion. + +If a local value for `buffer-file-coding-system' in the current buffer +does not exist, it is set to the coding system which was actually used +for reading. + +See also `insert-file-contents-access-hook', +`insert-file-contents-pre-hook', `insert-file-contents-error-hook', +and `insert-file-contents-post-hook'." + (let (return-val coding-system used-codesys conversion-func) + ;; OK, first load the file. + (condition-case err + (progn + (run-hook-with-args 'insert-file-contents-access-hook + filename visit) + ;; determine the coding system to use, as described above. + (setq coding-system + (or + ;; #1. + coding-system-for-read + ;; #2. + (run-special-hook-with-args 'insert-file-contents-pre-hook + filename visit) + ;; #3. + (find-file-coding-system-for-read-from-filename filename) + ;; #4. + buffer-file-coding-system-for-read + ;; #5. + 'no-conversion)) + (if (consp coding-system) + (setq return-val coding-system) + (if (null (find-coding-system coding-system)) + (progn + (message + "Invalid coding-system (%s), using 'undecided" + coding-system) + (setq coding-system 'undecided))) + (setq return-val + (insert-file-contents-internal filename visit beg end + replace coding-system + ;; store here! + 'used-codesys)) + )) + (file-error + (run-hook-with-args 'insert-file-contents-error-hook + filename visit err) + (signal (car err) (cdr err)))) + (setq coding-system used-codesys) + ;; call any `post-read-conversion' for the coding system that + ;; was used ... + (let ((func + (coding-system-property coding-system 'post-read-conversion)) + (endmark (make-marker))) + (set-marker endmark (+ (point) (nth 1 return-val))) + (if func + (unwind-protect + (save-excursion + (let (buffer-read-only) + (funcall func (point) (marker-position endmark)))) + (if visit + (progn + (set-buffer-auto-saved) + (set-buffer-modified-p nil))))) + (setcar (cdr return-val) (- (marker-position endmark) (point)))) + ;; now finally set the buffer's `buffer-file-coding-system'. + (if (run-special-hook-with-args 'insert-file-contents-post-hook + filename visit return-val) + nil + (if (local-variable-p 'buffer-file-coding-system (current-buffer)) + ;; if buffer-file-coding-system is already local, just + ;; set its eol type to what was found, if it wasn't + ;; set already. + (set-buffer-file-coding-system + (subsidiary-coding-system buffer-file-coding-system + (coding-system-eol-type coding-system))) + ;; otherwise actually set buffer-file-coding-system. + (set-buffer-file-coding-system coding-system))) + return-val)) + +(defvar write-region-pre-hook nil + "A special hook to decide the coding system used for writing out a file. + +Before writing a file, `write-region' calls the functions on this hook +with arguments START, END, FILENAME, APPEND, VISIT, and CODING-SYSTEM, +the same as the corresponding arguments in the call to +`write-region'. + +The return value of the functions should be either + +-- nil +-- A coding system or a symbol denoting it, indicating the coding system + to be used for reading the file +-- A list of two elements (absolute pathname and length of data written), + which is used as the return value to `write-region'. In this + case, `write-region' assumes that the function has written + the file for itself and suppresses further writing. + +If any function returns non-nil, the remaining functions are not called.") + +(defvar write-region-post-hook nil + "A hook called by `write-region' after a file has been written out. + +The functions on this hook are called with arguments START, END, +FILENAME, APPEND, VISIT, and CODING-SYSTEM, the same as the +corresponding arguments in the call to `write-region'.") + +(defun write-region (start end filename &optional append visit lockname coding-system) + "Write current region into specified file. +By default the file's existing contents are replaced by the specified region. +When called from a program, takes three arguments: +START, END and FILENAME. START and END are buffer positions. +Optional fourth argument APPEND if non-nil means + append to existing file contents (if any). +Optional fifth argument VISIT if t means + set last-save-file-modtime of buffer to this file's modtime + and mark buffer not modified. +If VISIT is a string, it is a second file name; + the output goes to FILENAME, but the buffer is marked as visiting VISIT. + VISIT is also the file name to lock and unlock for clash detection. +If VISIT is neither t nor nil nor a string, + that means do not print the \"Wrote file\" message. +The optional sixth arg LOCKNAME, if non-nil, specifies the name to + use for locking and unlocking, overriding FILENAME and VISIT. +Kludgy feature: if START is a string, then that string is written +to the file, instead of any buffer contents, and END is ignored. +Optional seventh argument CODING-SYSTEM specifies the coding system + used to encode the text when it is written out, and defaults to + the value of `buffer-file-coding-system' in the current buffer. + Interactively, with a prefix arg, you will be prompted for the + coding system. +See also `write-region-pre-hook' and `write-region-post-hook'." + (interactive "r\nFWrite region to file: \ni\ni\ni\nZCoding-system: ") + (setq coding-system + (or coding-system-for-write + (run-special-hook-with-args + 'write-region-pre-hook start end filename append visit lockname) + coding-system + buffer-file-coding-system + (find-file-coding-system-for-write-from-filename filename) + )) + (if (consp coding-system) + coding-system + (let ((func + (coding-system-property coding-system 'pre-write-conversion))) + (if func + (let ((curbuf (current-buffer)) + (tempbuf (generate-new-buffer " *temp-write-buffer*")) + (modif (buffer-modified-p))) + (unwind-protect + (save-excursion + (set-buffer tempbuf) + (erase-buffer) + (insert-buffer-substring curbuf start end) + (funcall func (point-min) (point-max)) + (write-region-internal (point-min) (point-max) filename + append + (if (eq visit t) nil visit) + lockname + coding-system)) + ;; leaving a buffer associated with file will cause problems + ;; when next visiting. + (kill-buffer tempbuf) + (if (or visit (null modif)) + (progn + (set-buffer-auto-saved) + (set-buffer-modified-p nil) + (if (buffer-file-name) (set-visited-file-modtime)))))) + (write-region-internal start end filename append visit lockname + coding-system))) + (run-hook-with-args 'write-region-post-hook + start end filename append visit lockname + coding-system))) + +;;; mule-files.el ends here diff -r 58424f6abf56 -r 11cf20601dec lisp/code-process.el --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/lisp/code-process.el Mon Aug 13 10:23:02 2007 +0200 @@ -0,0 +1,256 @@ +;;; code-process.el --- Process coding functions for XEmacs. + +;; Copyright (C) 1985-1987, 1993, 1994, 1997 Free Software Foundation, Inc. +;; Copyright (C) 1995 Ben Wing +;; Copyright (C) 1997 MORIOKA Tomohiko + +;; Author: Ben Wing +;; MORIOKA Tomohiko +;; Maintainer: XEmacs Development Team +;; Keywords: mule, multilingual, coding system, process + +;; This file is part of XEmacs. + +;; This file is very similar to code-process.el + +;; 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. + +;;; Code: + +(defvar process-coding-system-alist nil + "Alist to decide a coding system to use for a process I/O operation. +The format is ((PATTERN . VAL) ...), +where PATTERN is a regular expression matching a program name, +VAL is a coding system, a cons of coding systems, or a function symbol. +If VAL is a coding system, it is used for both decoding what received +from the program and encoding what sent to the program. +If VAL is a cons of coding systems, the car part is used for decoding, +and the cdr part is used for encoding. +If VAL is a function symbol, the function must return a coding system +or a cons of coding systems which are used as above.") + +(defun call-process (program &optional infile buffer displayp &rest args) + "Call PROGRAM synchronously in separate process. +The program's input comes from file INFILE (nil means `/dev/null'). +Insert output in BUFFER before point; t means current buffer; + nil for BUFFER means discard it; 0 means discard and don't wait. +BUFFER can also have the form (REAL-BUFFER STDERR-FILE); in that case, +REAL-BUFFER says what to do with standard output, as above, +while STDERR-FILE says what to do with standard error in the child. +STDERR-FILE may be nil (discard standard error output), +t (mix it with ordinary output), or a file name string. + +Fourth arg DISPLAYP non-nil means redisplay buffer as output is inserted. +Remaining arguments are strings passed as command arguments to PROGRAM. + +If BUFFER is 0, `call-process' returns immediately with value nil. +Otherwise it waits for PROGRAM to terminate and returns a numeric exit status + or a signal description string. +If you quit, the process is killed with SIGINT, or SIGKILL if you + quit again." + (let* ((coding-system-for-read + (or coding-system-for-read + (let (ret) + (catch 'found + (let ((alist process-coding-system-alist) + (case-fold-search (eq system-type 'vax-vms))) + (while alist + (if (string-match (car (car alist)) program) + (throw 'found (setq ret (cdr (car alist)))) + ) + (setq alist (cdr alist)) + ))) + (if (functionp ret) + (setq ret (funcall ret 'call-process program)) + ) + (cond ((consp ret) (car ret)) + ((find-coding-system ret) ret) + ) + )))) + (apply 'call-process-internal program infile buffer displayp args) + )) + +(defun call-process-region (start end program + &optional deletep buffer displayp + &rest args) + "Send text from START to END to a synchronous process running PROGRAM. +Delete the text if fourth arg DELETEP is non-nil. + +Insert output in BUFFER before point; t means current buffer; + nil for BUFFER means discard it; 0 means discard and don't wait. +BUFFER can also have the form (REAL-BUFFER STDERR-FILE); in that case, +REAL-BUFFER says what to do with standard output, as above, +while STDERR-FILE says what to do with standard error in the child. +STDERR-FILE may be nil (discard standard error output), +t (mix it with ordinary output), or a file name string. + +Sixth arg DISPLAYP non-nil means redisplay buffer as output is inserted. +Remaining args are passed to PROGRAM at startup as command args. + +If BUFFER is 0, returns immediately with value nil. +Otherwise waits for PROGRAM to terminate +and returns a numeric exit status or a signal description string. +If you quit, the process is first killed with SIGINT, then with SIGKILL if +you quit again before the process exits." + (let ((temp (cond ((eq system-type 'vax-vms) + (make-temp-name "tmp:emacs")) + ((or (eq system-type 'ms-dos) + (eq system-type 'windows-nt)) + (make-temp-name + (concat (file-name-as-directory + (or (getenv "TMP") + (getenv "TEMP") + "")) + "em"))) + (t + (make-temp-name "/tmp/emacs"))))) + (unwind-protect + (let (cs-r cs-w) + (let (ret) + (catch 'found + (let ((alist process-coding-system-alist) + (case-fold-search (eq system-type 'vax-vms))) + (while alist + (if (string-match (car (car alist)) program) + (throw 'found (setq ret (cdr (car alist))))) + (setq alist (cdr alist)) + ))) + (if (functionp ret) + (setq ret (funcall ret 'call-process-region program))) + (cond ((consp ret) + (setq cs-r (car ret) + cs-w (cdr ret))) + ((find-coding-system ret) + (setq cs-r ret + cs-w ret)))) + (let ((coding-system-for-read + (or coding-system-for-read cs-r)) + (coding-system-for-write + (or coding-system-for-write cs-w))) + (if (or (eq system-type 'ms-dos) + (eq system-type 'windows-nt)) + (let ((buffer-file-type binary-process-output)) + (write-region start end temp nil 'silent)) + (write-region start end temp nil 'silent)) + (if deletep (delete-region start end)) + (apply #'call-process program temp buffer displayp args))) + (condition-case () + (delete-file temp) + (file-error nil))))) + +(defun start-process (name buffer program &rest program-args) + "Start a program in a subprocess. Return the process object for it. +Args are NAME BUFFER PROGRAM &rest PROGRAM-ARGS +NAME is name for process. It is modified if necessary to make it unique. +BUFFER is the buffer or (buffer-name) to associate with the process. + Process output goes at end of that buffer, unless you specify + an output stream or filter function to handle the output. + BUFFER may be also nil, meaning that this process is not associated + with any buffer +Third arg is program file name. It is searched for as in the shell. +Remaining arguments are strings to give program as arguments. +INCODE and OUTCODE specify the coding-system objects used in input/output + from/to the process." + (let (cs-r cs-w) + (let (ret) + (catch 'found + (let ((alist process-coding-system-alist) + (case-fold-search (eq system-type 'vax-vms))) + (while alist + (if (string-match (car (car alist)) program) + (throw 'found (setq ret (cdr (car alist))))) + (setq alist (cdr alist)) + ))) + (if (functionp ret) + (setq ret (funcall ret 'start-process program))) + (cond ((consp ret) + (setq cs-r (car ret) + cs-w (cdr ret))) + ((find-coding-system ret) + (setq cs-r ret + cs-w ret)))) + (let ((coding-system-for-read + (or coding-system-for-read cs-r)) + (coding-system-for-write + (or coding-system-for-write cs-w))) + (apply 'start-process-internal name buffer program program-args) + ))) + +(defvar network-coding-system-alist nil + "Alist to decide a coding system to use for a network I/O operation. +The format is ((PATTERN . VAL) ...), +where PATTERN is a regular expression matching a network service name +or is a port number to connect to, +VAL is a coding system, a cons of coding systems, or a function symbol. +If VAL is a coding system, it is used for both decoding what received +from the network stream and encoding what sent to the network stream. +If VAL is a cons of coding systems, the car part is used for decoding, +and the cdr part is used for encoding. +If VAL is a function symbol, the function must return a coding system +or a cons of coding systems which are used as above. + +See also the function `find-operation-coding-system'.") + +(defun open-network-stream (name buffer host service) + "Open a TCP connection for a service to a host. +Returns a subprocess-object to represent the connection. +Input and output work as for subprocesses; `delete-process' closes it. +Args are NAME BUFFER HOST SERVICE. +NAME is name for process. It is modified if necessary to make it unique. +BUFFER is the buffer (or buffer-name) to associate with the process. + Process output goes at end of that buffer, unless you specify + an output stream or filter function to handle the output. + BUFFER may be also nil, meaning that this process is not associated + with any buffer +Third arg is name of the host to connect to, or its IP address. +Fourth arg SERVICE is name of the service desired, or an integer + specifying a port number to connect to." + (let (cs-r cs-w) + (let (ret) + (catch 'found + (let ((alist network-coding-system-alist) + (case-fold-search (eq system-type 'vax-vms)) + pattern) + (while alist + (setq pattern (car (car alist))) + (and + (cond ((numberp pattern) + (and (numberp service) + (eq pattern service))) + ((stringp pattern) + (or (and (stringp service) + (string-match pattern service)) + (and (numberp service) + (string-match pattern + (number-to-string service)))))) + (throw 'found (setq ret (cdr (car alist))))) + (setq alist (cdr alist)) + ))) + (if (functionp ret) + (setq ret (funcall ret 'open-network-stream service))) + (cond ((consp ret) + (setq cs-r (car ret) + cs-w (cdr ret))) + ((find-coding-system ret) + (setq cs-r ret + cs-w ret)))) + (let ((coding-system-for-read + (or coding-system-for-read cs-r)) + (coding-system-for-write + (or coding-system-for-write cs-w))) + (open-network-stream-internal name buffer host service)))) + +;;; mule-process.el ends here diff -r 58424f6abf56 -r 11cf20601dec lisp/coding.el --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/lisp/coding.el Mon Aug 13 10:23:02 2007 +0200 @@ -0,0 +1,208 @@ +;;; coding.el --- Coding-system functions for XEmacs. + +;; Copyright (C) 1995 Electrotechnical Laboratory, JAPAN. +;; Licensed to the Free Software Foundation. +;; Copyright (C) 1995 Amdahl Corporation. +;; Copyright (C) 1995 Sun Microsystems. +;; Copyright (C) 1997 MORIOKA Tomohiko + +;; This file is part of XEmacs. + +;; This file is very similar to mule-coding.el + +;; 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. + +;;; Commentary: + +;;; split off of mule.el. + +;;; Code: + +(defalias 'check-coding-system 'get-coding-system) + +(defconst modeline-multibyte-status '("%C") + "Modeline control for showing multibyte extension status.") + +;; override the default value defined in loaddefs.el. +(setq-default modeline-format + (cons (purecopy "") + (cons 'modeline-multibyte-status + (cdr modeline-format)))) + +(defun modify-coding-system-alist (target-type regexp coding-system) + "Modify one of look up tables for finding a coding system on I/O operation. +There are three of such tables, `file-coding-system-alist', +`process-coding-system-alist', and `network-coding-system-alist'. + +TARGET-TYPE specifies which of them to modify. +If it is `file', it affects `file-coding-system-alist' (which see). +If it is `process', it affects `process-coding-system-alist' (which see). +If it is `network', it affects `network-codign-system-alist' (which see). + +REGEXP is a regular expression matching a target of I/O operation. +The target is a file name if TARGET-TYPE is `file', a program name if +TARGET-TYPE is `process', or a network service name or a port number +to connect to if TARGET-TYPE is `network'. + +CODING-SYSTEM is a coding system to perform code conversion on the I/O +operation, or a cons cell (DECODING . ENCODING) specifying the coding systems +for decoding and encoding respectively, +or a function symbol which, when called, returns such a cons cell." + (or (memq target-type '(file process network)) + (error "Invalid target type: %s" target-type)) + (or (stringp regexp) + (and (eq target-type 'network) (integerp regexp)) + (error "Invalid regular expression: %s" regexp)) + (if (symbolp coding-system) + (if (not (fboundp coding-system)) + (progn + (check-coding-system coding-system) + (setq coding-system (cons coding-system coding-system)))) + (check-coding-system (car coding-system)) + (check-coding-system (cdr coding-system))) + (cond ((eq target-type 'file) + (let ((slot (assoc regexp file-coding-system-alist))) + (if slot + (setcdr slot coding-system) + (setq file-coding-system-alist + (cons (cons regexp coding-system) + file-coding-system-alist))))) + ((eq target-type 'process) + (let ((slot (assoc regexp process-coding-system-alist))) + (if slot + (setcdr slot coding-system) + (setq process-coding-system-alist + (cons (cons regexp coding-system) + process-coding-system-alist))))) + (t + (let ((slot (assoc regexp network-coding-system-alist))) + (if slot + (setcdr slot coding-system) + (setq network-coding-system-alist + (cons (cons regexp coding-system) + network-coding-system-alist))))))) + +(defsubst keyboard-coding-system () + "Return coding-system of what is sent from terminal keyboard." + keyboard-coding-system) + +(defun set-keyboard-coding-system (coding-system) + "Set the coding system used for TTY keyboard input. Currently broken." + (interactive "zkeyboard-coding-system: ") + (get-coding-system coding-system) ; correctness check + (setq keyboard-coding-system coding-system) + (redraw-modeline t)) + +(defsubst terminal-coding-system () + "Return coding-system of your terminal." + terminal-coding-system) + +(defun set-terminal-coding-system (coding-system) + "Set the coding system used for TTY display output. Currently broken." + (interactive "zterminal-coding-system: ") + (get-coding-system coding-system) ; correctness check + (setq terminal-coding-system coding-system) + (set-console-tty-coding-system (device-console) terminal-coding-system) + (redraw-modeline t)) + +(defun set-pathname-coding-system (coding-system) + "Set the coding system used for file system path names." + (interactive "zPathname-coding-system: ") + (get-coding-system coding-system) ; correctness check + (setq file-name-coding-system coding-system)) + +(defun what-coding-system (start end &optional arg) + "Show the encoding of text in the region. +This function is meant to be called interactively; +from a Lisp program, use `detect-coding-region' instead." + (interactive "r\nP") + (princ (detect-coding-region start end))) + +(defun decode-coding-string (str coding-system) + "Decode the string STR which is encoded in CODING-SYSTEM. +Does not modify STR. Returns the decoded string on successful conversion." + (with-string-as-buffer-contents + str (decode-coding-region (point-min) (point-max) coding-system))) + +(defun encode-coding-string (str coding-system) + "Encode the string STR using CODING-SYSTEM. +Does not modify STR. Returns the encoded string on successful conversion." + (with-string-as-buffer-contents + str (encode-coding-region (point-min) (point-max) coding-system))) + + +;;;; Coding system accessors + +(defun coding-system-mnemonic (coding-system) + "Return the 'mnemonic property of CODING-SYSTEM." + (coding-system-property coding-system 'mnemonic)) + +(defalias 'coding-system-docstring 'coding-system-doc-string) + +(defun coding-system-eol-type (coding-system) + "Return the 'eol-type property of CODING-SYSTEM." + (coding-system-property coding-system 'eol-type)) + +(defun coding-system-eol-lf (coding-system) + "Return the 'eol-lf property of CODING-SYSTEM." + (coding-system-property coding-system 'eol-lf)) + +(defun coding-system-eol-crlf (coding-system) + "Return the 'eol-crlf property of CODING-SYSTEM." + (coding-system-property coding-system 'eol-crlf)) + +(defun coding-system-eol-cr (coding-system) + "Return the 'eol-cr property of CODING-SYSTEM." + (coding-system-property coding-system 'eol-cr)) + +(defun coding-system-post-read-conversion (coding-system) + "Return the 'post-read-conversion property of CODING-SYSTEM." + (coding-system-property coding-system 'post-read-conversion)) + +(defun coding-system-pre-write-conversion (coding-system) + "Return the 'pre-write-conversion property of CODING-SYSTEM." + (coding-system-property coding-system 'pre-write-conversion)) + +(defun coding-system-base (coding-system) + "Return the base coding system of CODING-SYSTEM." + (if (not (coding-system-eol-type coding-system)) + coding-system + (find-coding-system + (intern + (substring + (symbol-name (coding-system-name coding-system)) + 0 + (string-match "-unix$\\|-dos$\\|-mac$" + (symbol-name (coding-system-name coding-system)))))))) + +;;;; Definitions of predefined coding systems + +(make-coding-system + 'undecided 'undecided + "Automatic conversion." + '(mnemonic "Auto")) + +;; compatibility for old XEmacsen (don't use it) +(copy-coding-system 'undecided 'automatic-conversion) + +(copy-coding-system 'no-conversion 'raw-text) + +(make-compatible-variable 'enable-multibyte-characters "Unimplemented") + +(define-obsolete-variable-alias + 'pathname-coding-system 'file-name-coding-system) + +;;; mule-coding.el ends here diff -r 58424f6abf56 -r 11cf20601dec lisp/dumped-lisp.el --- a/lisp/dumped-lisp.el Mon Aug 13 10:22:10 2007 +0200 +++ b/lisp/dumped-lisp.el Mon Aug 13 10:23:02 2007 +0200 @@ -27,7 +27,8 @@ "extents" "events" "text-props" - "process" + "process" ;; This is bad. network-streams may not be defined. + ;; #+multicast "multicast" ;; #+network-streams implicitely true "frame" ; move up here cause some stuff needs it here "map-ynp" "simple" @@ -51,7 +52,7 @@ #-mule "help-nomule" "help" ;; (load-gc "hyper-apropos") Soon... - #-mule "files-nomule" + #-file-coding "files-nomule" "files" #-infodock "lib-complete" ; InfoDock uses an older version "format" @@ -85,11 +86,13 @@ #+menubar "menubar" #+dialog "dialog" #+mule "mule-charset" + #+file-coding "coding" #+mule "mule-coding" ;; Handle I/O of files with extended characters. + #+file-coding "code-files" #+mule "mule-files" ;; Handle process with encoding/decoding non-ascii coding-system. - #+mule "mule-process" + #+file-coding "code-process" #+mule "mule-help" ;; Load the remaining basic files. #+mule "mule-category" diff -r 58424f6abf56 -r 11cf20601dec lisp/frame.el --- a/lisp/frame.el Mon Aug 13 10:22:10 2007 +0200 +++ b/lisp/frame.el Mon Aug 13 10:23:02 2007 +0200 @@ -902,11 +902,6 @@ (set-window-buffer w buffer)) fr)) -(defcustom get-frame-for-buffer-default-to-current nil - "*When non-nil, `get-frame-for-buffer' will default to the current frame." - :type 'boolean - :group 'frames) - (defun get-frame-for-buffer-noselect (buffer &optional not-this-window-p on-frame) "Return a frame in which to display BUFFER. @@ -1012,31 +1007,38 @@ (get-frame-for-buffer-make-new-frame buffer) (car frames)))) - ;; - ;; This buffer's mode did not express a preference for a frame of a - ;; particular name. However, the user wants the frame to be the - ;; current one in that case. - ;; - (get-frame-for-buffer-default-to-current nil) - + (not-this-window-p + (let ((w-list (windows-of-buffer buffer)) + f w + (first-choice nil) + (second-choice nil) + (last-resort nil)) + (while (and w-list (null first-choice)) + (setq w (car w-list) + f (window-frame w)) + (cond ((eq w (selected-window)) nil) + ((not (frame-visible-p f)) + (if (null last-resort) + (setq last-resort w))) + ((eq f (selected-frame)) + (setq first-choice w)) + ((null second-choice) + (setq second-choice w))) + (setq w-list (cdr w-list))) + (or first-choice second-choice last-resort))) (t ;; ;; This buffer's mode did not express a preference for a frame of a ;; particular name. So try to find a frame already displaying this ;; buffer. ;; - (let ((w (or (get-buffer-window buffer 'visible) ; check visible first + (let ((w (or (get-buffer-window buffer nil) ; check current first + (get-buffer-window buffer 'visible) ; then visible (get-buffer-window buffer 0)))) ; then iconic (cond ((null w) ;; It's not in any window - return nil, meaning no frame has ;; preference. nil) - ((and not-this-window-p - (eq (selected-frame) (window-frame w))) - ;; It's in a window, but on this frame, and we have been - ;; asked to pick another window. Return nil, meaning no - ;; frame has preference. - nil) (t ;; Otherwise, return the frame of the buffer's window. (window-frame w)))))))) diff -r 58424f6abf56 -r 11cf20601dec lisp/help.el --- a/lisp/help.el Mon Aug 13 10:22:10 2007 +0200 +++ b/lisp/help.el Mon Aug 13 10:23:02 2007 +0200 @@ -420,9 +420,48 @@ :type 'boolean :group 'help-appearance) +(defcustom help-max-help-buffers 10 + "*Maximum help buffers to allow before they start getting killed. +If this is a positive integer, before a help buffer is displayed +by `with-displaying-help-buffer', any excess help buffers which +are not being displayed are first killed. Otherwise, if it is +zero or nil, only one help buffer, \"*Help*\" is ever used." + :type '(choice integer (const :tag "None" nil)) + :group 'help-appearance) + +(defvar help-buffer-list nil + "List of help buffers used by `help-register-and-maybe-prune-excess'") + +(defun help-register-and-maybe-prune-excess (newbuf) + "Register use of a help buffer and possibly kill any excess ones." + ;; remove new buffer from list + (setq help-buffer-list (remove newbuf help-buffer-list)) + ;; maybe kill excess help buffers + (if (and (integerp help-max-help-buffers) + (> (length help-buffer-list) help-max-help-buffers)) + (let ((keep-list nil) + (num-kill (- (length help-buffer-list) + help-max-help-buffers))) + (while help-buffer-list + (let ((buf (car help-buffer-list))) + (if (and (or (equal buf newbuf) (get-buffer buf)) + (string-match "^*Help" buf) + (save-excursion (set-buffer buf) + (eq major-mode 'help-mode))) + (if (and (>= num-kill (length help-buffer-list)) + (not (get-buffer-window buf t t))) + (kill-buffer buf) + (setq keep-list (cons buf keep-list))))) + (setq help-buffer-list (cdr help-buffer-list))) + (setq help-buffer-list (nreverse keep-list)))) + ;; push new buffer + (setq help-buffer-list (cons newbuf help-buffer-list))) + (defun help-buffer-name (name) "Return a name for a Help buffer using string NAME for context." - (if (stringp name) + (if (and (integerp help-max-help-buffers) + (> help-max-help-buffers 0) + (stringp name)) (format "*Help: %s*" name) "*Help*")) @@ -442,8 +481,7 @@ (member (selected-frame) (mapcar 'window-frame (windows-of-buffer buffer-name))))))) - (if (get-buffer buffer-name) - (kill-buffer buffer-name)) + (help-register-and-maybe-prune-excess buffer-name) (prog1 (with-output-to-temp-buffer buffer-name (prog1 ,@body (save-excursion @@ -1146,21 +1184,26 @@ Uses `pp-internal' if defined, otherwise `cl-prettyprint'" (princ - (if (and (or (listp object) (vectorp object)) - (< (length object) - help-pretty-print-limit)) - (with-output-to-string - (with-syntax-table emacs-lisp-mode-syntax-table - ;; print `#<...>' values better - (modify-syntax-entry ?< "(>") - (modify-syntax-entry ?> ")<") - (let ((indent-line-function 'lisp-indent-line)) - (if (fboundp 'pp-internal) - (progn - (pp-internal object "\n") - (terpri)) - (cl-prettyprint object))))) - (format "\n%S\n" object)))) + (let ((valstr + (if (and (or (listp object) (vectorp object)) + (< (length object) + help-pretty-print-limit)) + (with-output-to-string + (with-syntax-table emacs-lisp-mode-syntax-table + ;; print `#<...>' values better + (modify-syntax-entry ?< "(>") + (modify-syntax-entry ?> ")<") + (let ((indent-line-function 'lisp-indent-line)) + (if (fboundp 'pp-internal) + (progn + (pp-internal object "\n") + (terpri)) + (cl-prettyprint object))))) + (format "\n%S\n" object)))) + + (if (string-match "^\n[^\n]*\n$" valstr) + (substring valstr 1) + valstr)))) (defun describe-variable (variable) "Display the full documentation of VARIABLE (a symbol)." diff -r 58424f6abf56 -r 11cf20601dec lisp/ldap.el --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/lisp/ldap.el Mon Aug 13 10:23:02 2007 +0200 @@ -0,0 +1,94 @@ +;;; ldap.el --- LDAP support for Emacs + +;; Copyright (C) 1997 Free Software Foundation, Inc. + +;; Author: Oscar Figueiredo +;; Maintainer: Oscar Figueiredo +;; Created: Jan 1998 +;; Version: $Revision: 1.1 $ +;; Keywords: help comm + +;; 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. + +;;; Commentary: +;; This file provides mid-level and user-level functions to access directory +;; servers using the LDAP protocol (RFC 1777). + +;;; Installation: +;; LDAP support must have been built into XEmacs. + + +;;; Code: + +(require 'ldap-internal) + +(defvar ldap-host-parameters-alist nil + "An alist describing per host options to use for LDAP transactions +The list has the form ((HOST OPTION OPTION ...) (HOST OPTION OPTION ...)) +HOST is the name of an LDAP server. OPTIONs are cons cells describing +parameters for the server. Valid options are: + (binddn . BINDDN) + (passwd . PASSWD) + (auth . AUTH) + (base . BASE) + (scope . SCOPE) + (deref . DEREF) + (timelimit . TL) + (sizelimit . SL)) +BINDDN is the distinguished name of the user to bind as (in RFC 1779 syntax). +PASSWD is the password to use for simple authentication. +AUTH is the authentication method to use, possible values are: +`simple', `krbv41' and `krbv42'. +BASE is the base for the search as described in RFC 1779. +SCOPE is one of the three symbols `subtree', `base' or `onelevel'. +DEREF is one of the symbols `never', `always', `search' or `find'. +TL is the timeout limit for the connection in seconds. +SL is the maximum number of matches to return." ) + + +(defun ldap-search (filter &optional host attributes attrsonly) + "Perform an LDAP search. +FILTER is the search filter in RFC1558 syntax +HOST is the LDAP host on which to perform the search +ATTRIBUTES is the specific attributes to retrieve, nil means +retrieve all +ATTRSONLY if non nil retrieves the attributes only without +the associated values. +Additional search parameters can be specified through +`ldap-host-parameters-alist' which see." + (interactive "sFilter:") + (let (host-alist) + (if (null host) + (setq host ldap-default-host)) + (if (null host) + (error "No LDAP host specified")) + (setq host-alist + (assoc host ldap-host-parameters-alist)) + (ldap-search-internal (append + (list 'host host + 'filter filter + 'attributes attributes + 'attrsonly attrsonly) + (alist-to-plist host-alist))) + )) + + + +(provide 'ldap) + +;;; ldap.el ends here diff -r 58424f6abf56 -r 11cf20601dec lisp/menubar.el --- a/lisp/menubar.el Mon Aug 13 10:22:10 2007 +0200 +++ b/lisp/menubar.el Mon Aug 13 10:23:02 2007 +0200 @@ -1,6 +1,6 @@ ;;; menubar.el --- Menubar support for XEmacs -;; Copyright (C) 1991-4, 1997 Free Software Foundation, Inc. +;; Copyright (C) 1991-4, 1997-1998 Free Software Foundation, Inc. ;; Copyright (C) 1995 Tinker Systems and INS Engineering Corp. ;; Copyright (C) 1995, 1996 Ben Wing. @@ -122,11 +122,12 @@ ((vectorp menuitem) (let ((L (length menuitem)) plistp) - (and (< L 3) + (and (< L 2) (signal 'error - (list "button descriptors must be at least 3 long" + (list "button descriptors must be at least 2 long" menuitem))) - (setq plistp (or (>= L 5) (keywordp (aref menuitem 2)))) + (setq plistp (or (>= L 5) + (and (> L 2) (keywordp (aref menuitem 2))))) (or (stringp (aref menuitem 0)) (signal 'error (list diff -r 58424f6abf56 -r 11cf20601dec lisp/modeline.el --- a/lisp/modeline.el Mon Aug 13 10:22:10 2007 +0200 +++ b/lisp/modeline.el Mon Aug 13 10:23:02 2007 +0200 @@ -74,8 +74,9 @@ (start-event-frame (event-frame event)) (start-event-window (event-window event)) (start-nwindows (count-windows t)) - (hscroll-offset - (- (modeline-hscroll (event-window event)) (event-x event))) + (hscroll-delta (face-width 'modeline)) + (start-hscroll (modeline-hscroll (event-window event))) + (start-x-pixel (event-x-pixel event)) (last-timestamp 0) default-line-height modeline-height @@ -131,8 +132,12 @@ done t)) ((button-release-event-p event) (setq done t) - (if modeline-click-swaps-buffers - (mouse-release-modeline event depress-line))) + ;; Consider we have a mouse click neither X pos (modeline + ;; scroll) nore Y pos (modeline drag) have changed. + (and modeline-click-swaps-buffers + (= depress-line (event-y event)) + (= start-hscroll (modeline-hscroll start-event-window)) + (modeline-swap-buffers event))) ((button-event-p event) (setq done t)) ((not (motion-event-p event)) @@ -143,8 +148,11 @@ drag-modeline-event-lag) nil) (t - (set-modeline-hscroll (event-window event) - (+ hscroll-offset (event-x event))) + (set-modeline-hscroll start-event-window + (+ (/ (- (event-x-pixel event) + start-x-pixel) + hscroll-delta) + start-hscroll)) (setq last-timestamp (event-timestamp event) y (event-y-pixel event) edges (window-pixel-edges start-event-window) @@ -201,22 +209,24 @@ (set-window-configuration wconfig)))))))) ;; from Bob Weiner (bob_weiner@pts.mot.com) -(defun mouse-release-modeline (event line-num) - "Handle modeline click EVENT on LINE-NUM by switching buffers. +;; Whether this function should be called is now decided in +;; mouse-drag-modeline - dverna feb. 98 +(defun modeline-swap-buffers (event) + "Handle mouse clicks on modeline by switching buffers. If click on left half of a frame's modeline, bury current buffer. If click on right half of a frame's modeline, raise bottommost buffer. -Args are: EVENT, the mouse release event, and LINE-NUM, the line number -within the frame at which the mouse was first depressed." - (if (= line-num (event-y event)) - ;; Button press and release are at same line, treat this as - ;; a click and switch buffers. - (if (< (event-x event) (/ (window-width (event-window event)) 2)) - ;; On left half of modeline, bury current buffer, - ;; displaying second buffer on list. - (mouse-bury-buffer event) - ;; On right half of modeline, raise and display bottommost - ;; buffer in buffer list. - (mouse-unbury-buffer event)))) +Arg EVENT is the button release event that occured on the modeline." + (or (event-over-modeline-p event) + (error "not over a modeline")) + (or (button-release-event-p event) + (error "not a button release event")) + (if (< (event-x event) (/ (window-width (event-window event)) 2)) + ;; On left half of modeline, bury current buffer, + ;; displaying second buffer on list. + (mouse-bury-buffer event) + ;; On right half of modeline, raise and display bottommost + ;; buffer in buffer list. + (mouse-unbury-buffer event))) (defconst modeline-menu '("Window Commands" diff -r 58424f6abf56 -r 11cf20601dec lisp/simple.el --- a/lisp/simple.el Mon Aug 13 10:22:10 2007 +0200 +++ b/lisp/simple.el Mon Aug 13 10:23:02 2007 +0200 @@ -3880,7 +3880,19 @@ (not (eq (marker-buffer warning-marker) buffer))) (setq warning-marker (make-marker)) (set-marker warning-marker 1 buffer)) - (set-window-start (display-buffer buffer) warning-marker) + (if temp-buffer-show-function + (let ((show-buffer (get-buffer-create "*Warnings-Show*"))) + (save-excursion + (set-buffer show-buffer) + (setq buffer-read-only nil) + (erase-buffer)) + (save-excursion + (set-buffer buffer) + (copy-to-buffer show-buffer + (marker-position warning-marker) + (point-max))) + (funcall temp-buffer-show-function show-buffer)) + (set-window-start (display-buffer buffer) warning-marker)) (set-marker warning-marker (point-max buffer) buffer))) (defun emacs-name () diff -r 58424f6abf56 -r 11cf20601dec lisp/window-xemacs.el --- a/lisp/window-xemacs.el Mon Aug 13 10:22:10 2007 +0200 +++ b/lisp/window-xemacs.el Mon Aug 13 10:23:02 2007 +0200 @@ -461,7 +461,12 @@ ;; Otherwise, find some window that it's already in, and ;; return that, unless that window is the selected window ;; and that isn't ok. What a contorted mess! - (setq window (get-buffer-window buffer target-frame)) + (setq window (or (if (not explicit-frame) + ;; search the selected frame + ;; first if the user didn't + ;; specify an explicit frame. + (get-buffer-window buffer nil)) + (get-buffer-window buffer target-frame))) (if (and window (or (not not-this-window-p) (not (eq window (selected-window))))) diff -r 58424f6abf56 -r 11cf20601dec lisp/x-menubar.el --- a/lisp/x-menubar.el Mon Aug 13 10:22:10 2007 +0200 +++ b/lisp/x-menubar.el Mon Aug 13 10:23:02 2007 +0200 @@ -1,6 +1,6 @@ ;;; x-menubar.el --- Menubar and popup-menu support for X. -;; Copyright (C) 1991-5, 1997 Free Software Foundation, Inc. +;; Copyright (C) 1991-1995, 1997-1998 Free Software Foundation, Inc. ;; Copyright (C) 1995 Tinker Systems and INS Engineering Corp. ;; Copyright (C) 1995 Sun Microsystems. ;; Copyright (C) 1995, 1996 Ben Wing. @@ -46,62 +46,99 @@ ;; note backquote. `( ("File" - :filter file-menu-filter - ["Open..." find-file t] - ["Open in Other Window..." find-file-other-window t] - ["Open in New Frame..." find-file-other-frame t] - ["Insert File..." insert-file t] - ["View File..." view-file t] + ["Open..." find-file] + ["Open in Other Window..." find-file-other-window] + ["Open in New Frame..." find-file-other-frame] + ["Insert File..." insert-file] + ["View File..." view-file] "------" - ["Save" save-buffer t nil] - ["Save As..." write-file t] - ["Save Some Buffers" save-some-buffers t] + ["Save" save-buffer + :active (buffer-modified-p) + :suffix (if put-buffer-names-in-file-menu (buffer-name) "")] + ["Save As..." write-file] + ["Save Some Buffers" save-some-buffers] + "-----" + ["Print Buffer" lpr-buffer + :active (fboundp 'lpr-buffer) + :suffix (if put-buffer-names-in-file-menu (buffer-name) "")] + ["Pretty-Print Buffer" ps-print-buffer-with-faces + :active (fboundp 'ps-print-buffer-with-faces) + :suffix (if put-buffer-names-in-file-menu (buffer-name) "")] "-----" - ;; Ugly, ugly. The following two items _must_ be written in deprecated - ;; form due to braindamage in the `file-menu-filter' function. - ["Print Buffer" lpr-buffer (fboundp 'lpr-buffer) nil] - ["Pretty-Print Buffer" ps-print-buffer-with-faces (fboundp 'ps-print-buffer-with-faces) nil] + ["New Frame" make-frame] + ["Frame on Other Display..." make-frame-on-display] + ["Delete Frame" delete-frame + :active (not (eq (next-frame (selected-frame) 'nomini 'window-system) + (selected-frame)))] "-----" - ["New Frame" make-frame t] - ["Frame on Other Display..." - make-frame-on-display t] - ["Delete Frame" delete-frame t] + ["Split Window" split-window-vertically] + ["Un-Split (Keep This)" delete-other-windows + :active (not (one-window-p t))] + ["Un-Split (Keep Others)" delete-window + :active (not (one-window-p t))] "-----" - ["Split Window" split-window-vertically t] - ["Un-Split (Keep This)" delete-other-windows (not (one-window-p t))] - ["Un-Split (Keep Others)" delete-window (not (one-window-p t))] - "-----" - ["Revert Buffer" revert-buffer t nil] - ["Delete Buffer" kill-this-buffer t nil] + ["Revert Buffer" revert-buffer + :active (or buffer-file-name revert-buffer-function) + :suffix (if put-buffer-names-in-file-menu (buffer-name) "")] + ["Delete Buffer" kill-this-buffer + :active t + :suffix (if put-buffer-names-in-file-menu (buffer-name) "")] "-----" - ["Exit XEmacs" save-buffers-kill-emacs t] + ["Exit XEmacs" save-buffers-kill-emacs] ) - + ("Edit" - :filter edit-menu-filter - ["Undo" advertised-undo t] - ["Cut" x-kill-primary-selection t] - ["Copy" x-copy-primary-selection t] - ["Paste" x-yank-clipboard-selection t] - ["Clear" x-delete-primary-selection t] + ["Undo" advertised-undo + :active (and (not (eq buffer-undo-list t)) + (or buffer-undo-list pending-undo-list)) + :suffix (if (or (eq last-command 'undo) + (eq last-command 'advertised-undo)) + "More" "")] + ["Redo" redo + :included (fboundp 'redo) + :active (not (or (eq buffer-undo-list t) + (eq last-buffer-undo-list nil) + (not (or (eq last-buffer-undo-list buffer-undo-list) + (and (null (car-safe buffer-undo-list)) + (eq last-buffer-undo-list + (cdr-safe buffer-undo-list))))) + (or (eq buffer-undo-list pending-undo-list) + (eq (cdr buffer-undo-list) pending-undo-list)))) + :suffix (if (eq last-command 'redo) "More" "")] + ["Cut" x-kill-primary-selection + :active (and (eq 'x (device-type (selected-device))) + (x-selection-owner-p))] + ["Copy" x-copy-primary-selection + :active (and (eq 'x (device-type (selected-device))) + (x-selection-owner-p))] + ["Paste" x-yank-clipboard-selection + :active (and (eq 'x (device-type (selected-device))) + (x-selection-exists-p 'CLIPBOARD))] + ["Clear" x-delete-primary-selection + :active (and (eq 'x (device-type (selected-device))) + (x-selection-owner-p))] "----" - ["Search..." isearch-forward t] - ["Search Backward..." isearch-backward t] - ["Replace..." query-replace t] + ["Search..." isearch-forward] + ["Search Backward..." isearch-backward] + ["Replace..." query-replace] "----" - ["Search (Regexp)..." isearch-forward-regexp t] - ["Search Backward (Regexp)..." isearch-backward-regexp t] - ["Replace (Regexp)..." query-replace-regexp t] + ["Search (Regexp)..." isearch-forward-regexp] + ["Search Backward (Regexp)..." isearch-backward-regexp] + ["Replace (Regexp)..." query-replace-regexp] "----" - ["Goto Line..." goto-line t] - ["What Line" what-line t] - ("Bookmarks":filter bookmark-menu-filter) + ["Goto Line..." goto-line] + ["What Line" what-line] + ("Bookmarks" + :filter bookmark-menu-filter) "----" - ["Start Macro Recording" start-kbd-macro (not defining-kbd-macro)] - ["End Macro Recording" end-kbd-macro defining-kbd-macro] - ["Execute Last Macro" call-last-kbd-macro last-kbd-macro] + ["Start Macro Recording" start-kbd-macro + :active (not defining-kbd-macro)] + ["End Macro Recording" end-kbd-macro + :active defining-kbd-macro] + ["Execute Last Macro" call-last-kbd-macro + :active last-kbd-macro] "----" - ["Show Message Log" show-message-log t] + ["Show Message Log" show-message-log] ) ,@(if (featurep 'mule) @@ -109,24 +146,28 @@ ("Describe language support") ("Set language environment") "--" - ["Toggle input method" toggle-input-method t] - ["Select input method" select-input-method t] - ["Describe input method" describe-input-method t] + ["Toggle input method" toggle-input-method] + ["Select input method" select-input-method] + ["Describe input method" describe-input-method] "--" ["Describe current coding systems" - describe-current-coding-system t] + describe-current-coding-system] ["Set coding system of buffer file" - set-buffer-file-coding-system t] + set-buffer-file-coding-system] + ;; not implemented yet ["Set coding system of terminal" - set-terminal-coding-system nil] ; not implemented yet + set-terminal-coding-system :active nil] + ;; not implemented yet ["Set coding system of keyboard" - set-keyboard-coding-system nil] ; not implemented yet + set-keyboard-coding-system :active nil] + ;; not implemented yet ["Set coding system of process" - set-current-process-coding-system nil] ; not implemented yet + set-current-process-coding-system :active nil] "--" - ["Show character table" view-charset-by-menu t] - ["Show diagnosis for MULE" mule-diag nil] ; not implemented yet - ["Show many languages" view-hello-file t]))) + ["Show character table" view-charset-by-menu] + ;; not implemented yet + ["Show diagnosis for MULE" mule-diag :active nil] + ["Show many languages" view-hello-file]))) ("Apps" ["Read Mail (VM)..." vm @@ -159,7 +200,7 @@ :active (fboundp 'phases-of-moon)] ["Sunrise/Sunset" sunrise-sunset :active (fboundp 'sunrise-sunset)]) - + ("Games" ["Mine Game" xmine :active (fboundp 'xmine)] @@ -187,14 +228,14 @@ ("Options" ("Customize" ("Emacs" :filter (lambda (&rest junk) - (cdr (custom-menu-create 'emacs)))) - ["Group..." customize-group t] - ["Variable..." customize-variable t] - ["Face..." customize-face t] - ["Saved..." customize-saved t] - ["Set..." customize-customized t] - ["Apropos..." customize-apropos t] - ["Browse..." customize-browse t]) + (cdr (custom-menu-create 'emacs)))) + ["Group..." customize-group] + ["Variable..." customize-variable] + ["Face..." customize-face] + ["Saved..." customize-saved] + ["Set..." customize-customized] + ["Apropos..." customize-apropos] + ["Browse..." customize-browse]) ["Read Only" (toggle-read-only) :style toggle :selected buffer-read-only] ("Editing Options" @@ -203,7 +244,8 @@ (setq-default overwrite-mode overwrite-mode)) :style toggle :selected overwrite-mode] ["Case Sensitive Search" (progn - (setq case-fold-search (not case-fold-search)) + (setq case-fold-search + (not case-fold-search)) (setq-default case-fold-search case-fold-search)) :style toggle :selected (not case-fold-search)] @@ -381,11 +423,11 @@ :style toggle :selected (and (boundp 'font-lock-mode) font-lock-mode) :active (fboundp 'font-lock-mode)] ["Automatic" (if (not (featurep 'font-lock)) - (progn - (setq font-lock-auto-fontify t) - (require 'font-lock)) - (setq font-lock-auto-fontify - (not font-lock-auto-fontify))) + (progn + (setq font-lock-auto-fontify t) + (require 'font-lock)) + (setq font-lock-auto-fontify + (not font-lock-auto-fontify))) :style toggle :selected (and (featurep 'font-lock) font-lock-auto-fontify) :active (fboundp 'font-lock-mode)] @@ -521,13 +563,13 @@ "-----" ("Frame Appearance" ,@(if (featurep 'scrollbar) - '(["Scrollbars" (if (= (specifier-instance scrollbar-width) 0) - (progn - (set-specifier scrollbar-width 15) - (set-specifier scrollbar-height 15)) - (set-specifier scrollbar-width 0) - (set-specifier scrollbar-height 0)) - :style toggle :selected (> (specifier-instance scrollbar-width) 0)])) + '(["Scrollbars" (if (= (specifier-instance scrollbar-width) 0) + (progn + (set-specifier scrollbar-width 15) + (set-specifier scrollbar-height 15)) + (set-specifier scrollbar-width 0) + (set-specifier scrollbar-height 0)) + :style toggle :selected (> (specifier-instance scrollbar-width) 0)])) ["3D Modeline" (progn (if (zerop (specifier-instance modeline-shadow-thickness)) @@ -552,48 +594,47 @@ :style toggle :selected (and (boundp 'blink-cursor-mode) blink-cursor-mode)] ["Frame-Local Font Menu" (setq font-menu-this-frame-only-p - (not font-menu-this-frame-only-p)) + (not font-menu-this-frame-only-p)) :style toggle :selected (and (boundp 'font-menu-this-frame-only-p) font-menu-this-frame-only-p)] -; ["Line Numbers" (line-number-mode nil) -; :style toggle :selected line-number-mode] - ) + ; ["Line Numbers" (line-number-mode nil) + ; :style toggle :selected line-number-mode] + ) ("Menubar Appearance" ["Buffers Menu Length..." (progn (setq buffers-menu-max-size (read-number "Enter number of buffers to display (or 0 for unlimited): ")) - (if (eq buffers-menu-max-size 0) (setq buffers-menu-max-size nil))) - t] + (if (eq buffers-menu-max-size 0) (setq buffers-menu-max-size nil)))] ["Multi-Operation Buffers Sub-Menus" (setq complex-buffers-menu-p (not complex-buffers-menu-p)) :style toggle :selected complex-buffers-menu-p] ("Buffers Menu Sorting" - ["Most Recently Used" - (progn - (setq buffers-menu-sort-function nil) - (setq buffers-menu-grouping-function nil)) - :style radio - :selected (null buffers-menu-sort-function)] - ["Alphabetically" - (progn - (setq buffers-menu-sort-function - 'sort-buffers-menu-alphabetically) - (setq buffers-menu-grouping-function nil)) - :style radio - :selected (eq 'sort-buffers-menu-alphabetically - buffers-menu-sort-function)] - ["By Major Mode, Then Alphabetically" - (progn - (setq buffers-menu-sort-function - 'sort-buffers-menu-by-mode-then-alphabetically) - (setq buffers-menu-grouping-function - 'group-buffers-menu-by-mode-then-alphabetically)) - :style radio - :selected (eq 'sort-buffers-menu-by-mode-then-alphabetically - buffers-menu-sort-function)]) + ["Most Recently Used" + (progn + (setq buffers-menu-sort-function nil) + (setq buffers-menu-grouping-function nil)) + :style radio + :selected (null buffers-menu-sort-function)] + ["Alphabetically" + (progn + (setq buffers-menu-sort-function + 'sort-buffers-menu-alphabetically) + (setq buffers-menu-grouping-function nil)) + :style radio + :selected (eq 'sort-buffers-menu-alphabetically + buffers-menu-sort-function)] + ["By Major Mode, Then Alphabetically" + (progn + (setq buffers-menu-sort-function + 'sort-buffers-menu-by-mode-then-alphabetically) + (setq buffers-menu-grouping-function + 'group-buffers-menu-by-mode-then-alphabetically)) + :style radio + :selected (eq 'sort-buffers-menu-by-mode-then-alphabetically + buffers-menu-sort-function)]) ["Submenus for Buffer Groups" (setq buffers-menu-submenus-for-groups-p (not buffers-menu-submenus-for-groups-p)) @@ -607,29 +648,29 @@ font-menu-ignore-scaled-fonts)] ) ,@(if (featurep 'toolbar) - '(("Toolbar Appearance" - ["Visible" (set-specifier default-toolbar-visible-p - (not (specifier-instance - default-toolbar-visible-p))) - :style toggle - :selected (specifier-instance default-toolbar-visible-p)] - ["Captioned" (set-specifier toolbar-buttons-captioned-p - (not (specifier-instance - toolbar-buttons-captioned-p))) - :style toggle - :selected - (specifier-instance toolbar-buttons-captioned-p)] - ("Default Location" - ["Top" (set-default-toolbar-position 'top) - :style radio :selected (eq (default-toolbar-position) 'top)] - ["Bottom" (set-default-toolbar-position 'bottom) - :style radio :selected (eq (default-toolbar-position) 'bottom)] - ["Left" (set-default-toolbar-position 'left) - :style radio :selected (eq (default-toolbar-position) 'left)] - ["Right" (set-default-toolbar-position 'right) - :style radio :selected (eq (default-toolbar-position) 'right)] - ) - ))) + '(("Toolbar Appearance" + ["Visible" (set-specifier default-toolbar-visible-p + (not (specifier-instance + default-toolbar-visible-p))) + :style toggle + :selected (specifier-instance default-toolbar-visible-p)] + ["Captioned" (set-specifier toolbar-buttons-captioned-p + (not (specifier-instance + toolbar-buttons-captioned-p))) + :style toggle + :selected + (specifier-instance toolbar-buttons-captioned-p)] + ("Default Location" + ["Top" (set-default-toolbar-position 'top) + :style radio :selected (eq (default-toolbar-position) 'top)] + ["Bottom" (set-default-toolbar-position 'bottom) + :style radio :selected (eq (default-toolbar-position) 'bottom)] + ["Left" (set-default-toolbar-position 'left) + :style radio :selected (eq (default-toolbar-position) 'left)] + ["Right" (set-default-toolbar-position 'right) + :style radio :selected (eq (default-toolbar-position) 'right)] + ) + ))) ("Mouse" ["Avoid-Text" (if (equal (device-type) 'x) @@ -693,19 +734,19 @@ :selected (and (boundp 'browse-url-browser-function) (eq browse-url-browser-function 'browse-url-grail)) :active (fboundp 'browse-url-grail)] - ) + ) "-----" - ["Browse Faces..." edit-faces t] + ["Browse Faces..." edit-faces] ("Font" :filter font-menu-family-constructor) ("Size" :filter font-menu-size-constructor) ("Weight" :filter font-menu-weight-constructor) "-----" - ["Save Options" save-options-menu-settings t] + ["Save Options" save-options-menu-settings] ) ("Buffers" :filter buffers-menu-filter - ["List All Buffers" list-buffers t] + ["List All Buffers" list-buffers] "--" ) @@ -719,34 +760,33 @@ ["Shell Command..." shell-command :active (fboundp 'shell-command)] ["Shell Command on Region..." shell-command-on-region - :active (and (fboundp 'shell-command-on-region) - (region-exists-p))] + :active (and (fboundp 'shell-command-on-region) (region-exists-p))] ["Debug (GDB)..." gdb :active (fboundp 'gdb)] ["Debug (DBX)..." dbx :active (fboundp 'dbx)] "-----" ("Tags" - ["Find Tag..." find-tag t] - ["Find Other Window..." find-tag-other-window t] - ["Next Tag..." (find-tag nil) t] - ["Next Other Window..." (find-tag-other-window nil) t] - ["Next File" next-file t] + ["Find Tag..." find-tag] + ["Find Other Window..." find-tag-other-window] + ["Next Tag..." (find-tag nil)] + ["Next Other Window..." (find-tag-other-window nil)] + ["Next File" next-file] "-----" - ["Tags Search..." tags-search t] - ["Tags Replace..." tags-query-replace t] - ["Continue Search/Replace" tags-loop-continue t] + ["Tags Search..." tags-search] + ["Tags Replace..." tags-query-replace] + ["Continue Search/Replace" tags-loop-continue] "-----" - ["Pop stack" pop-tag-mark t] - ["Apropos..." tags-apropos t] + ["Pop stack" pop-tag-mark] + ["Apropos..." tags-apropos] "-----" - ["Set Tags Table File..." visit-tags-table t] + ["Set Tags Table File..." visit-tags-table] )) - nil ; the partition: menus after this are flushright + nil ; the partition: menus after this are flushright ("Help" - ["About XEmacs..." about-xemacs t] + ["About XEmacs..." about-xemacs] ("Basics" ;; Tutorials. ,(if (featurep 'mule) @@ -759,7 +799,7 @@ (setq submenu (cons - `[,(caar lang) (help-with-tutorial nil ,(cdr tut)) t] + `[,(caar lang) (help-with-tutorial nil ,(cdr tut))] submenu))) (setq lang (cdr lang))) (append `("Tutorials" @@ -775,62 +815,56 @@ (cons `[,(caar lang) (help-with-tutorial ,(format "TUTORIAL.%s" - (cadr (car lang)))) t] + (cadr (car lang))))] submenu)) (setq lang (cdr lang))) (append '("Tutorials" - ["English" help-with-tutorial t]) + ["English" help-with-tutorial]) submenu))) - ["News" view-emacs-news t] - ["Packages" finder-by-keyword t] - ["Splash" xemacs-splash-buffer t]) + ["News" view-emacs-news] + ["Packages" finder-by-keyword] + ["Splash" xemacs-splash-buffer]) "-----" ("XEmacs FAQ" - ["FAQ (local)" xemacs-local-faq t] - ["FAQ via WWW" xemacs-www-faq (boundp 'browse-url-browser-function)] - ["Home Page" xemacs-www-page (boundp 'browse-url-browser-function)]) + ["FAQ (local)" xemacs-local-faq] + ["FAQ via WWW" xemacs-www-faq (boundp 'browse-url-browser-function)] + ["Home Page" xemacs-www-page (boundp 'browse-url-browser-function)]) ("Samples" - ["Sample" (find-file - (expand-file-name "sample.emacs" - data-directory)) - t ".emacs"] - ["Sample" (find-file - (expand-file-name "sample.Xdefaults" - data-directory)) - t ".Xdefaults"] - ["Sample" (find-file - (expand-file-name "enriched.doc" - data-directory)) - t "enriched"]) + ["Sample .emacs" (find-file (expand-file-name "sample.emacs" + data-directory))] + ["Sample .Xdefaults" (find-file (expand-file-name "sample.Xdefaults" + data-directory))] + ["Sample enriched" (find-file (expand-file-name "enriched.doc" + data-directory))]) "-----" ("Lookup in Info" - ["Key Binding..." Info-goto-emacs-key-command-node t] - ["Command..." Info-goto-emacs-command-node t] - ["Function..." Info-elisp-ref t] - ["Topic..." Info-query t]) + ["Key Binding..." Info-goto-emacs-key-command-node] + ["Command..." Info-goto-emacs-command-node] + ["Function..." Info-elisp-ref] + ["Topic..." Info-query]) ("Manuals" - ["Info" info t] - ["Unix Manual..." manual-entry t]) + ["Info" info] + ["Unix Manual..." manual-entry]) ("Commands & Keys" - ["Mode" describe-mode t] - ["Apropos..." hyper-apropos t] - ["Apropos Docs..." apropos-documentation t] + ["Mode" describe-mode] + ["Apropos..." hyper-apropos] + ["Apropos Docs..." apropos-documentation] "-----" - ["Key..." describe-key t] - ["Bindings" describe-bindings t] - ["Mouse Bindings" describe-pointer t] - ["Recent Keys" view-lossage t] + ["Key..." describe-key] + ["Bindings" describe-bindings] + ["Mouse Bindings" describe-pointer] + ["Recent Keys" view-lossage] "-----" - ["Function..." describe-function t] - ["Variable..." describe-variable t] - ["Locate Command..." where-is t]) + ["Function..." describe-function] + ["Variable..." describe-variable] + ["Locate Command..." where-is]) "-----" - ["Recent Messages" view-lossage t] + ["Recent Messages" view-lossage] ("Misc" - ["No Warranty" describe-no-warranty t] - ["XEmacs License" describe-copying t] - ["The Latest Version" describe-distribution t]) - ["Submit Bug Report" send-pr t])))) + ["No Warranty" describe-no-warranty] + ["XEmacs License" describe-copying] + ["The Latest Version" describe-distribution]) + ["Submit Bug Report" send-pr])))) (defun maybe-add-init-button () @@ -850,123 +884,17 @@ ["Load .emacs" (progn (delete-menu-item '("Load .emacs")) (load-user-init-file (user-login-name))) - t] + ] "Help")) (t nil))) (add-hook 'before-init-hook 'maybe-add-init-button) -;;; The File and Edit menus +;;; The File menu (defvar put-buffer-names-in-file-menu t) -;; The sensitivity part of this function could be done by just adding forms -;; to evaluate to the menu items themselves; that would be marginally less -;; efficient but not perceptibly so (I think). But in order to change the -;; names of the Undo menu item and the various things on the File menu item, -;; we need to use a hook. - -(defun file-menu-filter (menu-items) - "Incrementally update the file menu. -This function changes the arguments and sensitivity of these File menu items: - - Delete Buffer has the name of the current buffer appended to it. - Print Buffer has the name of the current buffer appended to it. - Pretty-Print Buffer - has the name of the current buffer appended to it. - Save has the name of the current buffer appended to it, and is - sensitive only when the current buffer is modified. - Revert Buffer has the name of the current buffer appended to it, and is - sensitive only when the current buffer has a file. - Delete Frame sensitive only when there is more than one frame. - -The name of the current buffer is only appended to the menu items if -`put-buffer-names-in-file-menu' is non-nil. This behavior is the default." - (let* ((bufname (buffer-name)) - (result menu-items) ; save pointer to start of menu. - name - item) - ;; the contents of the menu items in the file menu are destructively - ;; modified so that there is as little consing as possible. This is okay. - ;; As soon as the result is returned, it is converted to widget_values - ;; inside lwlib and the lisp menu-items can be safely modified again. - (while (setq item (pop menu-items)) - (if (vectorp item) - (progn - (setq name (aref item 0)) - (and put-buffer-names-in-file-menu - (member name '("Save" "Revert Buffer" "Print Buffer" - "Pretty-Print Buffer" "Delete Buffer")) - (>= (length item) 4) - (aset item 3 bufname)) - (and (string= "Save" name) - (aset item 2 (buffer-modified-p))) - (and (string= "Revert Buffer" name) - (aset item 2 (not (not (or buffer-file-name - revert-buffer-function))))) - (and (string= "Delete Frame" name) - (aset item 2 (not (eq (next-frame (selected-frame) - 'nomini 'window-system) - (selected-frame))))) - ))) - result)) - -(defun edit-menu-filter (menu-items) - "For use as an incremental menu construction filter. -This function changes the sensitivity of these Edit menu items: - - Cut sensitive only when emacs owns the primary X Selection. - Copy sensitive only when emacs owns the primary X Selection. - Clear sensitive only when emacs owns the primary X Selection. - Paste sensitive only when there is an owner for the X Clipboard Selection. - Undo sensitive only when there is undo information. - While in the midst of an undo, this is changed to \"Undo More\"." - (let* (item - name - (result menu-items) ; save pointer to head of list - (x-dev (eq 'x (device-type (selected-device)))) - (emacs-owns-selection-p (and x-dev (x-selection-owner-p))) - (clipboard-exists-p (and x-dev (x-selection-exists-p 'CLIPBOARD))) -;;; undo-available undoing-more -;;; (undo-info-available (not (null (and (not (eq t buffer-undo-list)) -;;; (if (eq last-command 'undo) -;;; (setq undoing-more -;;; (and (boundp 'pending-undo-list) -;;; pending-undo-list) -;;; buffer-undo-list)))))) - undo-name undo-state - ) - ;; As with file-menu-filter, menu-items are destructively modified. - ;; This is OK. - (while (setq item (pop menu-items)) - (if (vectorp item) - (progn - (setq name (aref item 0)) - (and (member name '("Cut" "Copy" "Clear")) - (aset item 2 emacs-owns-selection-p)) - (and (string= name "Paste") - (aset item 2 clipboard-exists-p)) - (and (member name '("Undo" "Undo More")) - (progn - ;; we could also do this with the third field of the item. - (if (eq last-command 'undo) - (setq undo-name "Undo More" - undo-state (not (null (and (boundp 'pending-undo-list) - pending-undo-list)))) - (setq undo-name "Undo" - undo-state (and (not (eq buffer-undo-list t)) - (not (null - (or buffer-undo-list - (and (boundp 'pending-undo-list) - pending-undo-list))))))) - (if buffer-read-only (setq undo-state nil)) - (aset item 0 undo-name) - (aset item 2 undo-state) - )) - ))) - result)) - ;;; The Bookmarks menu @@ -978,7 +906,7 @@ '("Jump to Bookmark" :filter (lambda (&rest junk) (mapcar #'(lambda (bmk) - `[,bmk (bookmark-jump ',bmk) t]) + `[,bmk (bookmark-jump ',bmk)]) (bookmark-all-names)))) ["Jump to Bookmark" nil nil]) ["Set bookmark" bookmark-set @@ -995,7 +923,7 @@ '("Delete Bookmark" :filter (lambda (&rest junk) (mapcar #'(lambda (bmk) - `[,bmk (bookmark-delete ',bmk) t]) + `[,bmk (bookmark-delete ',bmk)]) (bookmark-all-names)))) ["Delete Bookmark" nil nil]) ["Edit Bookmark List" bookmark-bmenu-list ,definedp] @@ -1272,7 +1200,7 @@ "This is the menu filter for the \"Language Environment\" submenu." (mapcar (lambda (env-sym) `[ ,(capitalize (symbol-name env-sym)) - (set-language-environment ',env-sym) t]) + (set-language-environment ',env-sym)]) language-environment-list)) @@ -1352,7 +1280,7 @@ ;; Paren Highlighting (if paren-mode - `(progn (require 'paren) (paren-set-mode ',paren-mode))) + `(progn (require 'paren) (paren-set-mode ',paren-mode))) ;; For specifiers, we only save global settings since the others ;; will belong to objects which only exist during this session. @@ -1625,16 +1553,28 @@ (defconst default-popup-menu '("XEmacs Commands" - :filter edit-menu-filter - ["Undo" advertised-undo t] - ["Cut" x-kill-primary-selection t] - ["Copy" x-copy-primary-selection t] - ["Paste" x-yank-clipboard-selection t] - ["Clear" x-delete-primary-selection t] + ["Undo" advertised-undo + :active (and (not (eq buffer-undo-list t)) + (or buffer-undo-list pending-undo-list)) + :suffix (if (or (eq last-command 'undo) + (eq last-command 'advertised-undo)) + "More" "")] + ["Cut" x-kill-primary-selection + :active (and (eq 'x (device-type (selected-device))) + (x-selection-owner-p))] + ["Copy" x-copy-primary-selection + :active (and (eq 'x (device-type (selected-device))) + (x-selection-owner-p))] + ["Paste" x-yank-clipboard-selection + :active (and (eq 'x (device-type (selected-device))) + (x-selection-exists-p 'CLIPBOARD))] + ["Clear" x-delete-primary-selection + :active (and (eq 'x (device-type (selected-device))) + (x-selection-owner-p))] "-----" - ["Select Block" mark-paragraph t] - ["Split Window" (split-window) t] - ["Unsplit Window" delete-other-windows t] + ["Select Block" mark-paragraph] + ["Split Window" (split-window)] + ["Unsplit Window" delete-other-windows] )) (defvar global-popup-menu nil @@ -1698,11 +1638,11 @@ (error "Pointer must be in a normal window")) (select-window window) (if current-menubar - (setq bmenu (assoc "Buffers" current-menubar))) + (setq bmenu (assoc "Buffers" current-menubar))) (if (null bmenu) - (setq bmenu (assoc "Buffers" default-menubar))) + (setq bmenu (assoc "Buffers" default-menubar))) (if (null bmenu) - (error "Can't find the Buffers menu")) + (error "Can't find the Buffers menu")) (popup-menu bmenu))) (defun popup-menubar-menu (event) @@ -1731,37 +1671,37 @@ ;; Here's a test of the cool new menu features (from Stig). -;(setq mode-popup-menu -; '("Test Popup Menu" -; :filter cdr -; ["this item won't appear because of the menu filter" ding t] -; "--:singleLine" -; "singleLine" -; "--:doubleLine" -; "doubleLine" -; "--:singleDashedLine" -; "singleDashedLine" -; "--:doubleDashedLine" -; "doubleDashedLine" -; "--:noLine" -; "noLine" -; "--:shadowEtchedIn" -; "shadowEtchedIn" -; "--:shadowEtchedOut" -; "shadowEtchedOut" -; "--:shadowDoubleEtchedIn" -; "shadowDoubleEtchedIn" -; "--:shadowDoubleEtchedOut" -; "shadowDoubleEtchedOut" -; "--:shadowEtchedInDash" -; "shadowEtchedInDash" -; "--:shadowEtchedOutDash" -; "shadowEtchedOutDash" -; "--:shadowDoubleEtchedInDash" -; "shadowDoubleEtchedInDash" -; "--:shadowDoubleEtchedOutDash" -; "shadowDoubleEtchedOutDash" -; )) +;;(setq mode-popup-menu +;; '("Test Popup Menu" +;; :filter cdr +;; ["this item won't appear because of the menu filter" ding t] +;; "--:singleLine" +;; "singleLine" +;; "--:doubleLine" +;; "doubleLine" +;; "--:singleDashedLine" +;; "singleDashedLine" +;; "--:doubleDashedLine" +;; "doubleDashedLine" +;; "--:noLine" +;; "noLine" +;; "--:shadowEtchedIn" +;; "shadowEtchedIn" +;; "--:shadowEtchedOut" +;; "shadowEtchedOut" +;; "--:shadowDoubleEtchedIn" +;; "shadowDoubleEtchedIn" +;; "--:shadowDoubleEtchedOut" +;; "shadowDoubleEtchedOut" +;; "--:shadowEtchedInDash" +;; "shadowEtchedInDash" +;; "--:shadowEtchedOutDash" +;; "shadowEtchedOutDash" +;; "--:shadowDoubleEtchedInDash" +;; "shadowDoubleEtchedInDash" +;; "--:shadowDoubleEtchedOutDash" +;; "shadowDoubleEtchedOutDash" +;; )) (defun xemacs-splash-buffer () "Redisplay XEmacs splash screen in a buffer." @@ -1772,6 +1712,7 @@ (startup-splash-frame) (pop-to-buffer buffer) (delete-other-windows))) + (provide 'x-menubar) diff -r 58424f6abf56 -r 11cf20601dec lisp/x-mouse.el --- a/lisp/x-mouse.el Mon Aug 13 10:22:10 2007 +0200 +++ b/lisp/x-mouse.el Mon Aug 13 10:23:02 2007 +0200 @@ -150,7 +150,7 @@ "xterm")) ; was "crosshair" (set-glyph-image modeline-pointer-glyph (or (x-get-resource "modeLinePointer" "Cursor" 'string device) - "sb_v_double_arrow")) + "fleur")) (set-glyph-image gc-pointer-glyph (or (x-get-resource "gcPointer" "Cursor" 'string device) "watch")) diff -r 58424f6abf56 -r 11cf20601dec man/ChangeLog --- a/man/ChangeLog Mon Aug 13 10:22:10 2007 +0200 +++ b/man/ChangeLog Mon Aug 13 10:23:02 2007 +0200 @@ -1,3 +1,30 @@ +1998-02-22 Karl M. Hegbloom + + * cl.texi (Creating Symbols): Tell a little bit about the new + handling of gensyms. + +1998-02-21 Greg Klanderman + + * xemacs/custom.texi (X Resources): update to describe automatic + setting of x-emacs-application-class. + + * lispref/x-windows.texi (Resources): update doc for + x-emacs-application-class. + +1998-02-20 Karl M. Hegbloom + + * cl.texi (Equality Predicates): Update to reflect change to + `equalp' made in "cl-extra.el" - now compares characters case + insensitively. + +1998-02-23 Aki Vehtari + + * lispref/menus.texi (Menu Format): Doc fix: suffix can be form. + +1998-02-19 Karl M. Hegbloom + + * lispref/display.texi (Beeping): Linux has sound too. + 1998-02-19 Hrvoje Niksic * cl.texi (Argument Lists): Keywords are handled specially by diff -r 58424f6abf56 -r 11cf20601dec man/cl.texi --- a/man/cl.texi Mon Aug 13 10:22:10 2007 +0200 +++ b/man/cl.texi Mon Aug 13 10:23:02 2007 +0200 @@ -941,22 +941,19 @@ @defun equalp a b This function is a more flexible version of @code{equal}. In -particular, it compares strings case-insensitively, and it compares -numbers without regard to type (so that @code{(equalp 3 3.0)} is -true). Vectors and conses are compared recursively. All other +particular, it compares strings and characters case-insensitively, and +it compares numbers without regard to type (so that @code{(equalp 3 +3.0)} is true). Vectors and conses are compared recursively. All other objects are compared as if by @code{equal}. This function differs from Common Lisp @code{equalp} in several -respects. First, Common Lisp's @code{equalp} also compares -@emph{characters} case-insensitively, which would be impractical -in this package since Emacs does not distinguish between integers -and characters. In keeping with the idea that strings are less -vector-like in Emacs Lisp, this package's @code{equalp} also will -not compare strings against vectors of integers. Finally, Common -Lisp's @code{equalp} compares hash tables without regard to -ordering, whereas this package simply compares hash tables in -terms of their underlying structure (which means vectors for Lucid -Emacs 19 hash tables, or lists for other hash tables). +respects. First, in keeping with the idea that strings are less +vector-like in Emacs Lisp, this package's @code{equalp} also will not +compare strings against vectors of integers. Second, Common Lisp's +@code{equalp} compares hash tables without regard to ordering, whereas +this package simply compares hash tables in terms of their underlying +structure (which means vectors for Lucid Emacs 19 hash tables, or lists +for other hash tables). @end defun Also note that the Common Lisp functions @code{member} and @code{assoc} @@ -3413,10 +3410,11 @@ this is initialized with 0, but this package initializes it with a random (time-dependent) value to avoid trouble when two files that each used @code{gensym} in their compilation are loaded together. -(Uninterned symbols become interned when the compiler writes them -out to a file and the Emacs loader loads them, so their names have to -be treated a bit more carefully than in Common Lisp where uninterned -symbols remain uninterned after loading.) + +@strong{XEmacs note:} As of XEmacs 20.5, an uninterned symbol remains +uninterned even after being dumped to bytecode. Older versions of Emacs +didn't distinguish the printed representation of interned and uninterned +symbols, so their names had to be treated more carefully. @end defvar @defun gentemp &optional x diff -r 58424f6abf56 -r 11cf20601dec man/internals/internals.texi --- a/man/internals/internals.texi Mon Aug 13 10:22:10 2007 +0200 +++ b/man/internals/internals.texi Mon Aug 13 10:23:02 2007 +0200 @@ -503,6 +503,7 @@ @item version 20.3 (the first stable version of XEmacs 20.x) released November 30, 1997. +version 20.4 released February 28, 1998. @end itemize @node GNU Emacs 19 diff -r 58424f6abf56 -r 11cf20601dec man/lispref/display.texi --- a/man/lispref/display.texi Mon Aug 13 10:22:10 2007 +0200 +++ b/man/lispref/display.texi Mon Aug 13 10:23:02 2007 +0200 @@ -875,9 +875,10 @@ specified, it should be a symbol specifying which sound to make. This sound will be played if @code{visible-bell} is @code{nil}. (This only works if sound support was compiled into the executable and you are -running on the console of a Sun SparcStation, SGI, or HP9000s700. -Otherwise you just get a beep.) The optional third argument specifies -what device to make the sound on, and defaults to the selected device. +running on the console of a Sun SparcStation, SGI, HP9000s700, or Linux +PC. Otherwise you just get a beep.) The optional third argument +specifies what device to make the sound on, and defaults to the selected +device. @end defun @defun beep &optional dont-terminate sound device diff -r 58424f6abf56 -r 11cf20601dec man/lispref/menus.texi --- a/man/lispref/menus.texi Mon Aug 13 10:22:10 2007 +0200 +++ b/man/lispref/menus.texi Mon Aug 13 10:23:02 2007 +0200 @@ -172,10 +172,11 @@ result is non-@code{nil}. If the item is unselectable, it will usually be displayed grayed-out to indicate this. -@item :suffix @var{string} -The string is appended to the displayed name. This provides a -convenient way of adding the name of a command's ``argument'' to the -menu, like @samp{Kill Buffer NAME}. +@item :suffix @var{form} +@var{form} will be evaluated when the menu that this item is a part of +is about to be displayed, and the resulting string is appended to the +displayed name. This provides a convenient way of adding the name of a +command's ``argument'' to the menu, like @samp{Kill Buffer NAME}. @item :keys @var{string} Normally, the keyboard equivalents of commands in menus are displayed diff -r 58424f6abf56 -r 11cf20601dec man/lispref/x-windows.texi --- a/man/lispref/x-windows.texi Mon Aug 13 10:22:10 2007 +0200 +++ b/man/lispref/x-windows.texi Mon Aug 13 10:23:02 2007 +0200 @@ -236,6 +236,11 @@ be made before the connection to the X server is initialized, that is, this variable may only be changed before XEmacs is dumped, or by setting it in the file @file{lisp/term/x-win.el}. + +By default, this variable is nil at startup. When the connection +to the X server is first initialized, the X resource database will +be consulted and the value will be set according to whether any +resources are found for the application class ``XEmacs''. @end defvar @node Server Data diff -r 58424f6abf56 -r 11cf20601dec man/xemacs/custom.texi --- a/man/xemacs/custom.texi Mon Aug 13 10:22:10 2007 +0200 +++ b/man/xemacs/custom.texi Mon Aug 13 10:23:02 2007 +0200 @@ -2062,6 +2062,20 @@ @cindex X resources @findex x-create-frame +Historically, XEmacs has used the X resource application class @samp{Emacs} +for its resources. Unfortunately, GNU Emacs uses the same application +class, and resources are not compatible between the two Emacsen. This +sharing of the application class often leads to trouble if you want to +run both variants. + +Starting with XEmacs 20.5, XEmacs will use the class @samp{XEmacs} if it +finds any XEmacs resources in the resource database when the X +connection is initialized. Otherwise, it will use the class @samp{Emacs} +for backwards compatability. The variable @var{x-emacs-application-class} +may be consulted to determine the application class being used. + +The examples in this section assume the application class is @samp{Emacs}. + The Emacs resources are generally set per-frame. Each Emacs frame can have its own name or the same name as another, depending on the name passed to the @code{make-frame} function. diff -r 58424f6abf56 -r 11cf20601dec src/ChangeLog --- a/src/ChangeLog Mon Aug 13 10:22:10 2007 +0200 +++ b/src/ChangeLog Mon Aug 13 10:23:02 2007 +0200 @@ -1,3 +1,123 @@ +1998-02-25 SL Baur + + * file-coding.c (setup_eol_coding_systems): Unix/Binary sub + coding-system display should default to the empty string. + - Use '(t)' for Mac/Text mode. + +Tue Feb 17 12:50:37 1998 Andy Piper + + * Makefile.in.in: make sure clean removes msw executables. This + prevents the build stalling after puresize has been adjusted. Add + file-coding.o to list of objects. + + * buffer.c: + * buffer.h: + * bufslots.h: + * callproc.c: + * console-tty.c: + * emacs.c: + * event-Xt.c: + * event-stream.c: + * glyphs-x.c: + * lread.c: + * md5.c: + * mule-canna.c: + * mule-ccl.c: + * process.c: + * redisplay-x.c: + * redisplay.c: remove #ifdef MULE's from stuff that relates to + file-coding. include file-coding.h rather than mule-coding.h + where applicable. + + * mule-coding.c: #if 0 out functionality until file-coding is + split up. + + * file-coding.h: + * file-coding.c: new files. copies of mule-coding.h and + mule-coding.c. The mule case is unchanged. The non-mule case + removes coding relating to other charsets - iso2022, big5, sjis, + ccl. (setup_eol_coding_systems) add the eol type to the subsidiary + coding system mnemonics so that it shows on the modeline, + currently (B) for unix style (T) for mac and dos styles. + + * fileio.c: remove #ifdef MULE's from stuff that relates to + file-coding. include file-coding.h rather than mule-coding.h where + applicable. FSFMACS_SPEEDY_INSERT is gone since file coding is + always on. + + * sheap.c: (more_static_core) remove spurious \n's from error + message. + +1998-02-25 Kyle Jones + + * lisp-disunion.h: Added XUINT macro. + + * lisp-union.h: Added XUINT macro. + + * data.c (Flsh): Used XUINT instead of XINT to + extract the value of the first argument to avoid sign + extension of the result. + +1998-02-25 SL Baur + + * s/decosf4-0.h: Add -D_BSD. + From Tore Olsen + +1998-02-21 Greg Klanderman + + * device-x.c (x_init_device): allow `x-emacs-application-class' to + be nil prior to connecting to the X server. When this is the + case, the application class is chosen based on whether the user + has any resources with application class `XEmacs' set in the + resource database. + (vars_of_device_x): make x-emacs-application-class nil by default + and document new behavior in its doc string. + +1998-02-23 Aki Vehtari + + * menubar.c: Doc fix: suffix can be form. + + * gui.c (gui_parse_item_keywords): Allow button descriptors + at least 2 long. + (gui_item_display_flush_left): Suffix can be form. + + * gui-x.c (button_item_to_widget_value): Allow button descriptors + at least 2 long. + (button_item_to_widget_value): Suffix can be form. + +1998-02-24 SL Baur + + * s/sol2.h: define HAVE_GETLOADAVG for late edition Solaris + From Georg Nikodym + +1998-02-24 Didier Verna + + * redisplay.c (generate_fstring_runes): fixed the modeline + scrolling lossage (the % constructs appearing in the + modeline). Now that we can have negative positions and boundaries, + max_pos == -1 can't mean 'no limit' anymore. Me, stupido! + (add_string_to_fstring_db_runes): Ditto. + (add_glyph_to_fstring_db_runes): Ditto. + +1998-02-19 Jim Radford + + * sysdep.c: Don't clobber SIGIO event flags we don't care about. + * device.h: removed old_sigio_flag, sigio_enabled from device + Secretly (on Solaris) F_SETOWN calls I_SETSIG. We unknowingly + clobbered the changes so restoring the owner would cause + F_SETOWN's I_SETSIG to fail therby causing an annoying syslog + message. Changed FASYNC version to match (untested). + +1998-02-22 SL Baur + + * emacs.c (main): Enable mmap for glibc-2.1 and Linux libc5. + Enable mmap only for non-Mule for glibc-2.0. + +1998-02-21 SL Baur + + * config.h.in: Define _NO_MALLOC_WARNING_ if using dlmalloc from + Linux libc5. + 1998-02-19 Andreas Jaeger * emacs.c: declare hooks only if !DOUG_LEA_MALLOC since the diff -r 58424f6abf56 -r 11cf20601dec src/Makefile.in.in --- a/src/Makefile.in.in Mon Aug 13 10:22:10 2007 +0200 +++ b/src/Makefile.in.in Mon Aug 13 10:23:02 2007 +0200 @@ -624,8 +624,8 @@ .PHONY: mostlyclean clean distclean realclean versionclean extraclean mostlyclean: - $(RM) temacs puremacs quantmacs depend.* *.o *.i \ - core puresize-adjust.h sheap-adjust.h + $(RM) temacs puremacs quantmacs prefix-args depend.* *.o *.i \ + core temacs.exe puresize-adjust.h sheap-adjust.h clean: mostlyclean versionclean $(RM) libextcli* update-elc.stamp ## This is used in making a distribution. @@ -635,7 +635,7 @@ Makefile Makefile.in TAGS xemacs.* realclean: distclean versionclean: - $(RM) xemacs ${libsrc}DOC + $(RM) xemacs xemacs.exe ${libsrc}DOC extraclean: realclean $(RM) *~ \#* m/*~ m/\#* s/*~ s/\#* diff -r 58424f6abf56 -r 11cf20601dec src/buffer.c --- a/src/buffer.c Mon Aug 13 10:22:10 2007 +0200 +++ b/src/buffer.c Mon Aug 13 10:23:02 2007 +0200 @@ -2276,7 +2276,7 @@ buffer_local_flags.cache_long_line_scans = make_int (0x2000); #endif buffer_local_flags.buffer_file_type = make_int (0x4000); -#ifdef MULE +#ifdef FILE_CODING buffer_local_flags.buffer_file_coding_system = make_int (0x8000); #endif @@ -2482,8 +2482,7 @@ On those systems, it is automatically local in every buffer. On other systems, this variable is normally always nil. */ ); - -#ifdef MULE +#ifdef FILE_CODING DEFVAR_BUFFER_DEFAULTS ("default-buffer-file-coding-system", buffer_file_coding_system /* Default value of `buffer-file-coding-system' for buffers that do not override it. This is the same as (default-value 'buffer-file-coding-system). @@ -2533,7 +2532,7 @@ `coding-system-for-read' rather than changing the other two variables just mentioned, which are intended to be used for global environment specification. */ ); -#endif /* MULE */ +#endif DEFVAR_BUFFER_LOCAL ("auto-fill-function", auto_fill_function /* Function called (if non-nil) to perform auto-fill. diff -r 58424f6abf56 -r 11cf20601dec src/buffer.h --- a/src/buffer.h Mon Aug 13 10:22:10 2007 +0200 +++ b/src/buffer.h Mon Aug 13 10:23:02 2007 +0200 @@ -1102,7 +1102,7 @@ format strings back from a library function. */ -#ifdef MULE +#ifdef FILE_CODING /* WARNING: These use a static buffer. This can lead to disaster if these functions are not used *very* carefully. Under normal diff -r 58424f6abf56 -r 11cf20601dec src/bufslots.h --- a/src/bufslots.h Mon Aug 13 10:22:10 2007 +0200 +++ b/src/bufslots.h Mon Aug 13 10:23:02 2007 +0200 @@ -100,11 +100,11 @@ #ifdef MULE /* This buffer's category table. */ MARKED_SLOT (category_table); - +#endif /* MULE */ +#ifdef FILE_CODING /* This buffer's coding system. */ MARKED_SLOT (buffer_file_coding_system); -#endif /* MULE */ - +#endif /* Values of several buffer-local variables. tab-width is buffer-local so that redisplay can find it diff -r 58424f6abf56 -r 11cf20601dec src/callproc.c --- a/src/callproc.c Mon Aug 13 10:22:10 2007 +0200 +++ b/src/callproc.c Mon Aug 13 10:23:02 2007 +0200 @@ -32,8 +32,8 @@ #include "process.h" #include "sysdep.h" #include "window.h" -#ifdef MULE -#include "mule-coding.h" +#ifdef FILE_CODING +#include "file-coding.h" #endif #include "systime.h" @@ -550,13 +550,13 @@ if (EQ (buffer, Qt)) XSETBUFFER (buffer, current_buffer); instream = make_filedesc_input_stream (fd[0], 0, -1, LSTR_ALLOW_QUIT); -#ifdef MULE +#ifdef FILE_CODING instream = make_decoding_input_stream (XLSTREAM (instream), Fget_coding_system (Vcoding_system_for_read)); Lstream_set_character_mode (XLSTREAM (instream)); -#endif /* MULE */ +#endif NGCPRO1 (instream); while (1) { @@ -974,8 +974,10 @@ { char **envp; for (envp = environ; envp && *envp; envp++) - Vprocess_environment = Fcons (build_ext_string (*envp, FORMAT_OS), - Vprocess_environment); + { + Vprocess_environment = Fcons (build_ext_string (*envp, FORMAT_OS), + Vprocess_environment); + } } /* jwz: don't do these things when in temacs (this used to be the case by diff -r 58424f6abf56 -r 11cf20601dec src/config.h.in --- a/src/config.h.in Mon Aug 13 10:22:10 2007 +0200 +++ b/src/config.h.in Mon Aug 13 10:23:02 2007 +0200 @@ -88,9 +88,12 @@ /* Define GNU_MALLOC if you want to use the GNU memory allocator. */ #undef GNU_MALLOC -/* Define if you are using the GNU C Library. -- experimental */ +/* Define if you are using the GNU C Library. -- experimental. */ #undef DOUG_LEA_MALLOC +/* Define if you are using dlmalloc from the Linux C library. */ +#undef _NO_MALLOC_WARNING_ + /* Use the system malloc? */ #undef USE_SYSTEM_MALLOC @@ -276,6 +279,7 @@ #undef HAVE_SOCKETS #undef HAVE_SOCKADDR_SUN_LEN +#undef HAVE_MULTICAST #undef HAVE_SYSVIPC #undef SYSV_SYSTEM_DIR @@ -325,6 +329,13 @@ /* Do we have either DBM or Berkeley DB database support? */ #undef HAVE_DATABASE +/* Do we have LDAP support? */ +#undef HAVE_LDAP +/* Do we have the LDAP library of the University of Michigan ? */ +#undef HAVE_UMICH_LDAP +/* Do we have Netscape LDAP SDK library */ +#undef HAVE_NS_LDAP + /* Do you have the Xauth library present? This will add some extra functionality to gnuserv. */ #undef HAVE_XAUTH @@ -421,8 +432,8 @@ if you're working with ASCII files. */ #undef MULE -/* Define this if you want Mule coding support */ -#undef MULE_CODING +/* Define this if you want file coding support */ +#undef FILE_CODING /* Do we want to use X window input methods for use with Mule? (requires X11R5) If so, use raw Xlib or higher level Motif interface? */ diff -r 58424f6abf56 -r 11cf20601dec src/console-tty.c --- a/src/console-tty.c Mon Aug 13 10:22:10 2007 +0200 +++ b/src/console-tty.c Mon Aug 13 10:23:02 2007 +0200 @@ -35,8 +35,8 @@ #include "lstream.h" #include "redisplay.h" #include "sysdep.h" -#ifdef MULE -#include "mule-coding.h" +#ifdef FILE_CODING +#include "file-coding.h" #endif #ifdef HAVE_GPM #include "gpmevent.h" diff -r 58424f6abf56 -r 11cf20601dec src/data.c --- a/src/data.c Mon Aug 13 10:22:10 2007 +0200 +++ b/src/data.c Mon Aug 13 10:23:02 2007 +0200 @@ -1665,7 +1665,7 @@ { int C_count = XINT (count); /* EMACS_UINT C_value = (EMACS_UINT) XUINT (value);*/ - EMACS_UINT C_value = (EMACS_UINT) XINT (value); + EMACS_UINT C_value = (EMACS_UINT) XUINT (value); XSETINT (val, C_count > 0 ? C_value << C_count : C_value >> -C_count); } return val; diff -r 58424f6abf56 -r 11cf20601dec src/device-x.c --- a/src/device-x.c Mon Aug 13 10:22:10 2007 +0200 +++ b/src/device-x.c Mon Aug 13 10:23:02 2007 +0200 @@ -226,6 +226,45 @@ DEVICE_CLASS (d) = Qmono; } +static int +have_xemacs_resources_in_xrdb(char *disp_name) +{ + Display *dpy; + char *xdefs, *key; + int len, found; + + /* + ** This function figures out whether the user has any resources of the + ** form "XEmacs.foo" or "XEmacs*foo". + ** + ** Currently we only consult the display's global resources; to look + ** for screen specific resources, we would need to also consult: + ** xdefs = XScreenResourceString(ScreenOfDisplay(dpy, scrno)); + */ + + key = "XEmacs"; + len = strlen(key); + + dpy = XOpenDisplay(disp_name); + + if (!dpy) return 0; + + xdefs = XResourceManagerString(dpy); /* don't free - owned by X */ + for (found = 0; xdefs && *xdefs; ) { + if (strncmp(xdefs, key, len) == 0 && + (xdefs[len] == '*' || xdefs[len] == '.')) { + found = 1; + break; + } + + while (*xdefs && *xdefs++ != '\n') /* find start of next entry.. */ + ; + } + + XCloseDisplay(dpy); + return found; +} + static void x_init_device (struct device *d, Lisp_Object props) { @@ -251,13 +290,19 @@ make_argc_argv (Vx_initial_argv_list, &argc, &argv); + GET_C_STRING_CTEXT_DATA_ALLOCA (display, disp_name); + if (STRINGP (Vx_emacs_application_class) && XSTRING_LENGTH (Vx_emacs_application_class) > 0) GET_C_STRING_CTEXT_DATA_ALLOCA (Vx_emacs_application_class, app_class); - else - app_class = "Emacs"; - - GET_C_STRING_CTEXT_DATA_ALLOCA (display, disp_name); + else { + app_class = (NILP(Vx_emacs_application_class) && + have_xemacs_resources_in_xrdb(disp_name)) + ? "XEmacs" + : "Emacs"; + /* need to update Vx_emacs_application_class: */ + Vx_emacs_application_class = build_string(app_class); + } slow_down_interrupts (); /* The Xt code can't deal with signals here. Yuck. */ @@ -1613,8 +1658,17 @@ must be made before the connection to the X server is initialized, that is, this variable may only be changed before emacs is dumped, or by setting it in the file lisp/term/x-win.el. + +If this variable is nil before the connection to the X server is first +initialized (which it is by default), the X resource database will be +consulted and the value will be set according to whether any resources +are found for the application class `XEmacs'. If the user has set any +resources for the XEmacs application class, the XEmacs process will use +the application class `XEmacs'. Otherwise, the XEmacs process will use +the application class `Emacs' which is backwards compatible to previous +XEmacs versions but may conflict with resources intended for GNU Emacs. */ ); - Vx_emacs_application_class = Fpurecopy (build_string ("Emacs")); + Vx_emacs_application_class = Qnil; DEFVAR_LISP ("x-initial-argv-list", &Vx_initial_argv_list /* You don't want to know. diff -r 58424f6abf56 -r 11cf20601dec src/device.h --- a/src/device.h Mon Aug 13 10:22:10 2007 +0200 +++ b/src/device.h Mon Aug 13 10:23:02 2007 +0200 @@ -209,9 +209,7 @@ be inside of device_data; but it is used for both TTY's and X device. Perhaps it should be conditionalized on SIGIO; but this requires including syssignal.h and systty.h. */ - int old_sigio_flag; int old_fcntl_owner; - unsigned int sigio_enabled :1; #endif }; @@ -318,7 +316,6 @@ #define DEVICE_BAUD_RATE(d) ((d)->baud_rate) #define DEVICE_INFD(d) ((d)->infd) #define DEVICE_OUTFD(d) ((d)->outfd) -#define DEVICE_OLD_SIGIO_FLAG(d) ((d)->old_sigio_flag) #define DEVICE_OLD_FCNTL_OWNER(d) ((d)->old_fcntl_owner) #define DEVICE_ON_CONSOLE_P(d) ((d)->on_console_p) #define DEVICE_CONNECTED_TO_NAS_P(d) ((d)->connected_to_nas_p) diff -r 58424f6abf56 -r 11cf20601dec src/eldap.c --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/src/eldap.c Mon Aug 13 10:23:02 2007 +0200 @@ -0,0 +1,466 @@ +/* LDAP client interface for XEmacs. + Copyright (C) ***FIXME*** + +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: Not in FSF. */ + +/* Author: Oscar Figueiredo */ + +/* This file provides lisp primitives for access to an LDAP library + conforming to the API defined in RFC 1823. + It has been tested with: + - UMich LDAP 3.3 (http://www.umich.edu/~dirsvcs/ldap/) + - Netscape's LDAP SDK 1.0 (http://developer.netscape.com) */ + + + +#include + +#if defined (HAVE_LDAP) + +/* The entire file is within this conditional */ + +#include "lisp.h" + +#include "eldap.h" +#include +#include + +#ifdef HAVE_NS_LDAP +#define HAVE_LDAP_SET_OPTION 1 +#define HAVE_LDAP_GET_ERRNO 1 +#else +#undef HAVE_LDAP_SET_OPTION +#undef HAVE_LDAP_GET_ERRNO +#endif + +static Lisp_Object Vldap_default_base; +static Lisp_Object Vldap_default_host; + +/* ldap-search-internal plist keywords */ +static Lisp_Object Qhost, Qfilter, Qattributes, Qattrsonly, Qbase, Qscope, + Qauth, Qbinddn, Qpasswd, Qderef, Qtimelimit, Qsizelimit; +/* Search scope limits */ +static Lisp_Object Qbase, Qonelevel, Qsubtree; +/* Authentication methods */ +static Lisp_Object Qsimple; +#ifdef LDAP_AUTH_KRBV41 +static Lisp_Object Qkrbv41; +#endif +#ifdef LDAP_AUTH_KRBV42 +static Lisp_Object Qkrbv42; +#endif +/* Deref policy */ +static Lisp_Object Qnever, Qalways, Qsearch, Qfind; + +DEFUN ("ldap-search-internal", Fldap_search_internal, 1, 1, 0, /* +Perform a search on a LDAP server. +SEARCH-PLIST is a property list describing the search request. +Valid keys in that list are: + `host' is a string naming one or more (blank separated) LDAP servers to +to try to connect to. Each host name may optionally be of the form host:port. + `filter' is a filter string for the search as described in RFC 1558 + `attributes' is a list of strings indicating which attributes to retrieve +for each matching entry. If nil return all available attributes. + `attrsonly' if non-nil indicates that only the attributes are retrieved, not +the associated values. + `base' is the base for the search as described in RFC 1779. + `scope' is one of the three symbols `subtree', `base' or `onelevel'. + `auth' is the authentication method to use, possible values depend on +the LDAP library XEmacs was compiled with: `simple', `krbv41' and `krbv42'. + `binddn' is the distinguished name of the user to bind as (in RFC 1779 syntax). + `passwd' is the password to use for simple authentication. + `deref' is one of the symbols `never', `always', `search' or `find'. + `timelimit' is the timeout limit for the connection in seconds. + `sizelimit' is the maximum number of matches to return. +The function returns a list of matching entries. Each entry is itself +an alist of attribute/values. +*/ + (search_plist)) +{ + /* This function calls lisp */ + + /* Vars for query */ + LDAP *ld; + LDAPMessage *res, *e; + BerElement *ptr; + char *a; + int i, rc, err; + + char *ldap_host = NULL; + char *ldap_filter = NULL; + char **ldap_attributes = NULL; + int ldap_attrsonly = 0; + char *ldap_base = NULL; + int ldap_scope = LDAP_SCOPE_SUBTREE; + int ldap_auth = LDAP_AUTH_SIMPLE; + char *ldap_binddn = NULL; + char *ldap_passwd = NULL; + int ldap_deref = LDAP_DEREF_NEVER; + int ldap_timelimit = 0; + int ldap_sizelimit = 0; + + char **vals = NULL; + int matches; + + Lisp_Object list, entry, result, keyword, value; + struct gcpro gcpro1, gcpro2, gcpro3, gcpro4, gcpro5; + + list = entry = result = keyword = value = Qnil; + GCPRO5 (list, entry, result, keyword, value); + + + EXTERNAL_PROPERTY_LIST_LOOP(list, keyword, value, search_plist) + { + /* Host */ + if (EQ (keyword, Qhost)) + { + CHECK_STRING (value); + ldap_host = alloca (XSTRING_LENGTH (value) + 1); + strcpy (ldap_host, (char *)XSTRING_DATA (value)); + } + /* Filter */ + else if (EQ (keyword, Qfilter)) + { + CHECK_STRING (value); + ldap_filter = alloca (XSTRING_LENGTH (value) + 1); + strcpy (ldap_filter, (char *)XSTRING_DATA (value)); + } + /* Attributes */ + else if (EQ (keyword, Qattributes)) + { + if (! NILP (value)) + { + Lisp_Object attr_left = value; + struct gcpro ngcpro1; + + NGCPRO1 (attr_left); + CHECK_CONS (value); + + ldap_attributes = alloca ((XINT (Flength (value)) + 1)*sizeof (char *)); + + for (i=0; !NILP (attr_left); i++) { + CHECK_STRING (XCAR (attr_left)); + ldap_attributes[i] = alloca (XSTRING_LENGTH (XCAR (attr_left)) + 1); + strcpy(ldap_attributes[i], + (char *)(XSTRING_DATA( XCAR (attr_left)))); + attr_left = XCDR (attr_left); + } + ldap_attributes[i] = NULL; + NUNGCPRO; + } + } + /* Attributes Only */ + else if (EQ (keyword, Qattrsonly)) + { + CHECK_SYMBOL (value); + ldap_attrsonly = NILP (value) ? 0 : 1; + } + /* Base */ + else if (EQ (keyword, Qbase)) + { + if (!NILP (value)) + { + CHECK_STRING (value); + ldap_base = alloca (XSTRING_LENGTH (value) + 1); + strcpy (ldap_base, (char *)XSTRING_DATA (value)); + } + } + /* Scope */ + else if (EQ (keyword, Qscope)) + { + CHECK_SYMBOL (value); + + if (EQ (value, Qbase)) + ldap_scope = LDAP_SCOPE_BASE; + else if (EQ (value, Qonelevel)) + ldap_scope = LDAP_SCOPE_ONELEVEL; + else if (EQ (value, Qsubtree)) + ldap_scope = LDAP_SCOPE_SUBTREE; + else + signal_simple_error ("Invalid scope", value); + } + /* Authentication method */ + else if (EQ (keyword, Qauth)) + { + CHECK_SYMBOL (value); + + if (EQ (value, Qsimple)) + ldap_auth = LDAP_AUTH_SIMPLE; +#ifdef LDAP_AUTH_KRBV41 + else if (EQ (value, Qkrbv41)) + ldap_auth = LDAP_AUTH_KRBV41; +#endif +#ifdef LDAP_AUTH_KRBV42 + else if (EQ (value, Qkrbv42)) + ldap_auth = LDAP_AUTH_KRBV42; +#endif + else + signal_simple_error ("Invalid authentication method", value); + } + /* Bind DN */ + else if (EQ (keyword, Qbinddn)) + { + if (!NILP (value)) + { + CHECK_STRING (value); + ldap_binddn = alloca (XSTRING_LENGTH (value) + 1); + strcpy (ldap_binddn, (char *)XSTRING_DATA (value)); + } + } + /* Password */ + else if (EQ (keyword, Qpasswd)) + { + if (!NILP (value)) + { + CHECK_STRING (value); + ldap_passwd = alloca (XSTRING_LENGTH (value) + 1); + strcpy (ldap_passwd, (char *)XSTRING_DATA (value)); + } + } + /* Deref */ + else if (EQ (keyword, Qderef)) + { + CHECK_SYMBOL (value); + if (EQ (value, Qnever)) + ldap_deref = LDAP_DEREF_NEVER; + else if (EQ (value, Qsearch)) + ldap_deref = LDAP_DEREF_SEARCHING; + else if (EQ (value, Qfind)) + ldap_deref = LDAP_DEREF_FINDING; + else if (EQ (value, Qalways)) + ldap_deref = LDAP_DEREF_ALWAYS; + else + signal_simple_error ("Invalid deref value", value); + } + /* Timelimit */ + else if (EQ (keyword, Qtimelimit)) + { + if (!NILP (value)) + { + CHECK_INT (value); + ldap_timelimit = XINT (value); + } + } + /* Sizelimit */ + else if (EQ (keyword, Qsizelimit)) + { + if (!NILP (value)) + { + CHECK_INT (value); + ldap_sizelimit = XINT (value); + } + } + } + + /* Use ldap-default-base if no default base was given */ + if (ldap_base == NULL && !NILP (Vldap_default_base)) + { + CHECK_STRING (Vldap_default_base); + ldap_base = alloca (XSTRING_LENGTH (Vldap_default_base) + 1); + strcpy (ldap_base, (char *)XSTRING_DATA (Vldap_default_base)); + } + + /* Use ldap-default-host if no host was given */ + if (ldap_host == NULL && !NILP (Vldap_default_host)) + { + CHECK_STRING (Vldap_default_host); + ldap_host = alloca (XSTRING_LENGTH (Vldap_default_host) + 1); + strcpy (ldap_host, (char *)XSTRING_DATA (Vldap_default_host)); + } + + if (ldap_filter == NULL) + error ("Empty search filter"); + + /* Garbage collect before connecting (if using UMich lib). + This is ugly, I know, but without this, the UMich LDAP library 3.3 + frequently reports "Can't contact LDAP server". I really need to + check what happens inside that lib. Anyway this should be harmless to + XEmacs and makes things work. */ +#if defined (HAVE_UMICH_LDAP) + Fgarbage_collect (); +#endif + + /* Connect to the server and bind */ + message ("Connecting to %s...", ldap_host); + if ( (ld = ldap_open (ldap_host, LDAP_PORT)) == NULL ) + signal_simple_error ("Failed connecting to host", + build_string (ldap_host)); + +#if HAVE_LDAP_SET_OPTION + if (ldap_set_option (ld, LDAP_OPT_DEREF, (void *)&ldap_deref) != LDAP_SUCCESS) + error ("Failed to set deref option"); + if (ldap_set_option (ld, LDAP_OPT_TIMELIMIT, (void *)&ldap_timelimit) != LDAP_SUCCESS) + error ("Failed to set timelimit option"); + if (ldap_set_option (ld, LDAP_OPT_SIZELIMIT, (void *)&ldap_sizelimit) != LDAP_SUCCESS) + error ("Failed to set sizelimit option"); + if (ldap_set_option (ld, LDAP_OPT_REFERRALS, LDAP_OPT_ON) != LDAP_SUCCESS) + error ("Failed to set referral option"); +#else /* HAVE_LDAP_SET_OPTION */ + ld->ld_deref = ldap_deref; + ld->ld_timelimit = ldap_timelimit; + ld->ld_sizelimit = ldap_sizelimit; +#ifdef LDAP_REFERRALS + ld->ld_options = LDAP_OPT_REFERRALS; +#else /* LDAP_REFERRALS */ + ld->ld_options = 0; +#endif /* LDAP_REFERRALS */ +#endif /* HAVE_LDAP_SET_OPTION */ + + message ("Binding to %s...", ldap_host); + if ( (err = (ldap_bind_s (ld, ldap_binddn, ldap_passwd, ldap_auth ))) != LDAP_SUCCESS ) + signal_simple_error ("Failed binding to the server", + build_string (ldap_err2string (err))); + + /* Perform the search */ + message ("Searching with LDAP on %s...", ldap_host); + if ( ldap_search (ld, ldap_base, ldap_scope, ldap_filter, + ldap_attributes, ldap_attrsonly) == -1) + { + ldap_unbind (ld); +#if HAVE_LDAP_GET_ERRNO + signal_simple_error ("Error during LDAP search", + build_string (ldap_err2string (ldap_get_lderrno (ld, NULL, NULL)))); +#else + signal_simple_error ("Error during LDAP search", + build_string (ldap_err2string (ld->ld_errno))); +#endif + } + + /* Build the results list */ + matches = 0; + + while ( (rc = ldap_result (ld, LDAP_RES_ANY, 0, NULL, &res)) + == LDAP_RES_SEARCH_ENTRY ) + { + matches ++; + e = ldap_first_entry (ld, res); + message ("Parsing results... %d", matches); + entry = Qnil; + for (a= ldap_first_attribute (ld, e, &ptr); + a != NULL; + a= ldap_next_attribute (ld, e, ptr) ) + { + list = Fcons (build_string (a), Qnil); + vals = ldap_get_values (ld, e, a); + if (vals != NULL) + { + for (i=0; vals[i]!=NULL; i++) + { + list = Fcons (build_string (vals[i]), + list); + } + } + entry = Fcons (Fnreverse (list), + entry); + ldap_value_free (vals); + } + result = Fcons (Fnreverse (entry), + result); + ldap_msgfree (res); + } + + if (rc == -1) + { +#if HAVE_LDAP_GET_ERRNO + signal_simple_error ("Error retrieving result", + build_string (ldap_err2string (ldap_get_lderrno (ld, NULL, NULL)))); +#else + signal_simple_error ("Error retrieving result", + build_string (ldap_err2string (ld->ld_errno))); +#endif + } + + if ((rc = ldap_result2error (ld, res, 0)) != LDAP_SUCCESS) + { +#if HAVE_LDAP_GET_ERRNO + signal_simple_error ("Error on result", + build_string (ldap_err2string (ldap_get_lderrno (ld, NULL, NULL)))); +#else + signal_simple_error ("Error on result", + build_string (ldap_err2string (ld->ld_errno))); +#endif + } + + ldap_msgfree (res); + ldap_unbind (ld); + message ("Done."); + + result = Fnreverse (result); + clear_message (); + + UNGCPRO; + return result; +} + + +void +syms_of_eldap (void) +{ + DEFSUBR(Fldap_search_internal); + + defsymbol (&Qhost, "host"); + defsymbol (&Qfilter, "filter"); + defsymbol (&Qattributes, "attributes"); + defsymbol (&Qattrsonly, "attrsonly"); + defsymbol (&Qbase, "base"); + defsymbol (&Qscope, "scope"); + defsymbol (&Qauth, "auth"); + defsymbol (&Qbinddn, "binddn"); + defsymbol (&Qpasswd, "passwd"); + defsymbol (&Qderef, "deref"); + defsymbol (&Qtimelimit, "timelimit"); + defsymbol (&Qsizelimit, "sizelimit"); + defsymbol (&Qbase, "base"); + defsymbol (&Qonelevel, "onelevel"); + defsymbol (&Qsubtree, "subtree"); + defsymbol (&Qsimple, "simple"); +#ifdef LDAP_AUTH_KRBV41 + defsymbol (&Qkrbv41, "krbv41"); +#endif +#ifdef LDAP_AUTH_KRBV42 + defsymbol (&Qkrbv42, "krbv42"); +#endif + defsymbol (&Qnever, "never"); + defsymbol (&Qalways, "always"); + defsymbol (&Qsearch, "search"); + defsymbol (&Qfind, "find"); +} + +void +vars_of_eldap (void) +{ + Fprovide (intern ("ldap-internal")); + + DEFVAR_LISP ("ldap-default-host", &Vldap_default_host /* +Default LDAP host. +*/ ); + + DEFVAR_LISP ("ldap-default-base", &Vldap_default_base /* +Default base for LDAP searches. +This is a string using the syntax of RFC 1779. +For instance, "o=ACME, c=US" limits the search to the +Acme organization in the United States. +*/ ); + + Vldap_default_host = Qnil; + Vldap_default_base = Qnil; +} + +#endif /* HAVE_LDAP */ diff -r 58424f6abf56 -r 11cf20601dec src/emacs.c --- a/src/emacs.c Mon Aug 13 10:22:10 2007 +0200 +++ b/src/emacs.c Mon Aug 13 10:23:02 2007 +0200 @@ -941,7 +941,11 @@ syms_of_mule (); syms_of_mule_ccl (); syms_of_mule_charset (); +#endif +#ifdef FILE_CODING syms_of_mule_coding (); +#endif +#ifdef MULE #ifdef HAVE_WNN syms_of_mule_wnn (); #endif @@ -976,6 +980,10 @@ syms_of_sunpro (); #endif +#ifdef HAVE_LDAP + syms_of_eldap (); +#endif + /* Now create the subtypes for the types that have them. We do this before the vars_*() because more symbols may get initialized here. */ @@ -1093,7 +1101,7 @@ */ lstream_type_create (); -#ifdef MULE +#ifdef FILE_CODING lstream_type_create_mule_coding (); #endif lstream_type_create_print (); @@ -1279,7 +1287,11 @@ #ifdef MULE vars_of_mule (); vars_of_mule_charset (); +#endif +#ifdef FILE_CODING vars_of_mule_coding (); +#endif +#ifdef MULE #ifdef HAVE_WNN vars_of_mule_wnn (); #endif @@ -1296,6 +1308,10 @@ vars_of_sunpro (); #endif +#ifdef HAVE_LDAP + vars_of_eldap (); +#endif + /* Now initialize any specifier variables. We do this later because it has some dependence on the vars initialized above. @@ -1343,6 +1359,8 @@ /* These two depend on hashtables and various variables declared earlier. The second may also depend on the first. */ complex_vars_of_mule_charset (); +#endif +#if defined(FILE_CODING) complex_vars_of_mule_coding (); #endif @@ -1786,11 +1804,11 @@ (int nargs, Lisp_Object *args)) { int ac; - Extbyte *wampum; + CONST Extbyte *wampum; int namesize; int total_len; Lisp_Object orig_invoc_name = Fcar (Vcommand_line_args); - Extbyte **wampum_all = alloca_array (Extbyte *, nargs); + CONST Extbyte **wampum_all = alloca_array (CONST Extbyte *, nargs); int *wampum_all_len = alloca_array (int, nargs); assert (!gc_in_progress); @@ -1936,7 +1954,11 @@ #if 0 free (malloc_state_ptr); #endif -#if !defined(MULE) && !defined(DEBUG_DOUG_LEA_MALLOC) + /* mmap works in glibc-2.1, glibc-2.0 (Non-Mule only) and Linux libc5 */ +#if (defined(__GLIBC__) && __GLIBC_MINOR__ >= 1) || \ + defined(_NO_MALLOC_WARNING_) || \ + (defined(__GLIBC__) && __GLIBC_MINOR__ < 1 && !defined(MULE)) || \ + defined(DEBUG_DOUG_LEA_MALLOC) mallopt (M_MMAP_MAX, 64); #endif #ifdef REL_ALLOC diff -r 58424f6abf56 -r 11cf20601dec src/event-Xt.c --- a/src/event-Xt.c Mon Aug 13 10:22:10 2007 +0200 +++ b/src/event-Xt.c Mon Aug 13 10:23:02 2007 +0200 @@ -55,7 +55,7 @@ #include #endif #include "lstream.h" -#include "mule-coding.h" +#include "file-coding.h" #endif #ifdef HAVE_OFFIX_DND diff -r 58424f6abf56 -r 11cf20601dec src/event-msw.c --- a/src/event-msw.c Mon Aug 13 10:22:10 2007 +0200 +++ b/src/event-msw.c Mon Aug 13 10:23:02 2007 +0200 @@ -615,6 +615,9 @@ { DWORD len = DdeGetData (hdata, NULL, 0, 0); char *cmd = alloca (len+1); +#ifdef __CYGWIN32__ + char *cmd_1; +#endif char *end; Lisp_Object l_dndlist; Lisp_Object emacs_event = Fmake_event (Qnil, Qnil); @@ -648,7 +651,10 @@ end++; if (*end) return DDE_FNOTPROCESSED; - +#ifdef __CYGWIN32__ + CYGWIN_CONV_PATH(cmd,cmd_1); + cmd = cmd_1; +#endif l_dndlist = make_ext_string (cmd, strlen(cmd), FORMAT_FILENAME); event->channel = Qnil; @@ -1151,6 +1157,9 @@ UINT filecount, i, len; POINT point; char filename[MAX_PATH]; +#ifdef __CYGWIN32__ + char* fname; +#endif Lisp_Object l_type, l_dndlist = Qnil, l_item; emacs_event = Fmake_event (Qnil, Qnil); @@ -1164,7 +1173,13 @@ { l_type = make_int (DndFile); len = DragQueryFile ((HANDLE) wParam, 0, filename, MAX_PATH); +#ifdef __CYGWIN32__ + CYGWIN_CONV_PATH(filename, fname); + len=strlen(fname); + l_dndlist = make_ext_string (fname, len, FORMAT_FILENAME); +#else l_dndlist = make_ext_string (filename, len, FORMAT_FILENAME); +#endif } else { @@ -1172,7 +1187,13 @@ for (i=0; i @@ -4817,7 +4816,7 @@ if (fd < 0) error ("Unable to create dribble file"); Vdribble_file = make_filedesc_output_stream (fd, 0, 0, LSTR_CLOSING); -#ifdef MULE +#ifdef FILE_CODING Vdribble_file = make_encoding_output_stream (XLSTREAM (Vdribble_file), Fget_coding_system (Qescape_quoted)); diff -r 58424f6abf56 -r 11cf20601dec src/events.c --- a/src/events.c Mon Aug 13 10:22:10 2007 +0200 +++ b/src/events.c Mon Aug 13 10:23:02 2007 +0200 @@ -1000,13 +1000,17 @@ case 'J': k = QKlinefeed; m &= ~MOD_CONTROL; break; case 'M': k = QKreturn; m &= ~MOD_CONTROL; break; case '[': k = QKescape; m &= ~MOD_CONTROL; break; -# if 0 - /* This is probably too controversial... */ - case 'H': k = QKbackspace; m &= ~MOD_CONTROL; break; -# endif + default: + if (c - '@' == XCHAR(con->tty_erase_char)) { + k = QKbackspace; + m &= ~MOD_CONTROL; + } + break; } if (c >= 'A' && c <= 'Z') c -= 'A'-'a'; } + else if (c == XCHAR(con->tty_erase_char)) + k = QKbackspace; else if (c == 127) k = QKdelete; else if (c == ' ') diff -r 58424f6abf56 -r 11cf20601dec src/file-coding.c --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/src/file-coding.c Mon Aug 13 10:23:02 2007 +0200 @@ -0,0 +1,4874 @@ +/* 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" +#ifdef MULE +#include "mule-ccl.h" +#endif +#include "file-coding.h" + +Lisp_Object Qbuffer_file_coding_system, 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 + 1]; + +/* Coding system currently associated with each coding category. */ +Lisp_Object coding_category_system[CODING_CATEGORY_LAST + 1]; + +/* 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 + 1]; + +Lisp_Object Qcoding_system_p; + +Lisp_Object 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 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 Qctext; +#endif +Lisp_Object Qshort, Qno_ascii_eol, Qno_ascii_cntl, Qseven, Qlock_shift; + +Lisp_Object Qencode, Qdecode, Qescape_quoted; + +Lisp_Object Vcoding_system_hashtable; + +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; + + /* Stuff seen so far when composing a string. */ + unsigned_char_dynarr *composite_chars; + + /* 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 +Lisp_Object Fcopy_coding_system (Lisp_Object old_coding_system, + Lisp_Object new_name); +#ifdef MULE +struct detection_state; +static int detect_coding_sjis (struct detection_state *st, + CONST unsigned char *src, + unsigned int n); +static void decode_coding_sjis (Lstream *decoding, + CONST unsigned char *src, + unsigned_char_dynarr *dst, + unsigned int n); +static void encode_coding_sjis (Lstream *encoding, + CONST unsigned char *src, + unsigned_char_dynarr *dst, + unsigned int n); +static int detect_coding_big5 (struct detection_state *st, + CONST unsigned char *src, + unsigned int n); +static void decode_coding_big5 (Lstream *decoding, + CONST unsigned char *src, + unsigned_char_dynarr *dst, unsigned int n); +static void encode_coding_big5 (Lstream *encoding, + CONST unsigned char *src, + unsigned_char_dynarr *dst, unsigned int n); +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 unsigned char *src, + unsigned int n); +static void decode_coding_iso2022 (Lstream *decoding, + CONST unsigned char *src, + unsigned_char_dynarr *dst, unsigned int n); +static void encode_coding_iso2022 (Lstream *encoding, + CONST unsigned char *src, + unsigned_char_dynarr *dst, unsigned int n); +#endif /* MULE */ +static void decode_coding_no_conversion (Lstream *decoding, + CONST unsigned char *src, + unsigned_char_dynarr *dst, + unsigned int n); +static void encode_coding_no_conversion (Lstream *encoding, + CONST unsigned char *src, + unsigned_char_dynarr *dst, + unsigned int n); +static void mule_decode (Lstream *decoding, CONST unsigned char *src, + unsigned_char_dynarr *dst, unsigned int n); +static void mule_encode (Lstream *encoding, CONST unsigned char *src, + unsigned_char_dynarr *dst, unsigned int 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; + +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, void (*) (Lisp_Object)); +static void print_coding_system (Lisp_Object, Lisp_Object, int); +static void finalize_coding_system (void *header, int for_disksave); + +DEFINE_LRECORD_IMPLEMENTATION ("coding-system", coding_system, + mark_coding_system, print_coding_system, + finalize_coding_system, + 0, 0, struct Lisp_Coding_System); + +static Lisp_Object +mark_coding_system (Lisp_Object obj, void (*markobj) (Lisp_Object)) +{ + struct Lisp_Coding_System *codesys = XCODING_SYSTEM (obj); + + (markobj) (CODING_SYSTEM_NAME (codesys)); + (markobj) (CODING_SYSTEM_DOC_STRING (codesys)); + (markobj) (CODING_SYSTEM_MNEMONIC (codesys)); + (markobj) (CODING_SYSTEM_EOL_LF (codesys)); + (markobj) (CODING_SYSTEM_EOL_CRLF (codesys)); + (markobj) (CODING_SYSTEM_EOL_CR (codesys)); + + switch (CODING_SYSTEM_TYPE (codesys)) + { +#ifdef MULE + int i; + case CODESYS_ISO2022: + for (i = 0; i < 4; i++) + (markobj) (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); + (markobj) (ccs->from_charset); + (markobj) (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); + (markobj) (ccs->from_charset); + (markobj) (ccs->to_charset); + } + } + break; + + case CODESYS_CCL: + (markobj) (CODING_SYSTEM_CCL_DECODE (codesys)); + (markobj) (CODING_SYSTEM_CCL_ENCODE (codesys)); + break; +#endif + default: + break; + } + + (markobj) (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) +{ + struct 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) +{ + struct Lisp_Coding_System *c = (struct 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 + default: + break; + } + } +} + +static enum eol_type +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 (enum eol_type type) +{ + switch (type) + { + case EOL_LF: return Qlf; + case EOL_CRLF: return Qcrlf; + case EOL_CR: return Qcr; + case EOL_AUTODETECT: return Qnil; + default: abort (); return Qnil; /* not reached */ + } +} + +static void +setup_eol_coding_systems (struct Lisp_Coding_System *codesys) +{ + Lisp_Object codesys_obj = Qnil; + int len = string_length (XSYMBOL (CODING_SYSTEM_NAME (codesys))->name); + char *codesys_name = (char *) alloca (len + 7); + + int mlen = XSTRING_LENGTH(CODING_SYSTEM_MNEMONIC (codesys)); + char *codesys_mnemonic = (char *) alloca (mlen + 7); + + 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); + + 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); \ + 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; \ + 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, /* +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; + if (CODING_SYSTEMP (coding_system_or_name)) + return coding_system_or_name; + CHECK_SYMBOL (coding_system_or_name); + + return Fgethash (coding_system_or_name, Vcoding_system_hashtable, Qnil); +} + +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 (CONST void *hash_key, void *hash_contents, + void *coding_system_list_closure) +{ + /* This function can GC */ + Lisp_Object key, contents; + Lisp_Object *coding_system_list; + struct coding_system_list_closure *cscl = + (struct coding_system_list_closure *) coding_system_list_closure; + CVOID_TO_LISP (key, hash_key); + VOID_TO_LISP (contents, hash_contents); + coding_system_list = cscl->coding_system_list; + + *coding_system_list = Fcons (XCODING_SYSTEM (contents)->name, + *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_hashtable, + &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 struct Lisp_Coding_System * +allocate_coding_system (enum coding_system_type type, Lisp_Object name) +{ + struct Lisp_Coding_System *codesys = + alloc_lcrecord_type (struct 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; +#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 + 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 = Qnil; + + if (!load_here) + return Qnil; + for (i = 0; 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 + +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). +'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 FLAGS 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, BEG 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, BEG 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)) +{ + struct Lisp_Coding_System *codesys; + Lisp_Object rest, key, value; + 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, 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; + + EXTERNAL_PROPERTY_LIST_LOOP (rest, 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)) + { + if (EQ (key, Qdecode)) + { + CHECK_VECTOR (value); + CODING_SYSTEM_CCL_DECODE (codesys) = value; + } + else if (EQ (key, Qencode)) + { + CHECK_VECTOR (value); + CODING_SYSTEM_CCL_ENCODE (codesys) = value; + } + else + signal_simple_error ("Unrecognized property", key); + } +#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_hashtable); + 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_hashtable); + } + + { + struct Lisp_Coding_System *to = XCODING_SYSTEM (new_coding_system); + struct 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; +} + +static Lisp_Object +subsidiary_coding_system (Lisp_Object coding_system, enum eol_type type) +{ + struct 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 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))) + { + 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_CCL: return Qccl; +#endif + case CODESYS_NO_CONVERSION: return Qno_conversion; +#ifdef DEBUG_XEMACS + case CODESYS_INTERNAL: return Qinternal; +#endif + default: + abort (); + } + + return Qnil; /* not reached */ +} + +#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); + + if (CHARSETP(cs)){ + return XCHARSET_NAME(cs); + } + else { + return 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 + +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; 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 + 1]; + 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 = 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++) + 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; i >= 0; i--) + list = Fcons (coding_category_symbol[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); + 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 = coding_category_system[cat]; + + if (!NILP (sys)) + return XCODING_SYSTEM_NAME (sys); + return Qnil; +} + + +/************************************************************************/ +/* Detecting the encoding of data */ +/************************************************************************/ + +struct detection_state +{ + enum eol_type 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 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 enum eol_type +detect_eol_type (struct detection_state *st, CONST unsigned char *src, + unsigned int n) +{ + int c; + + while (n--) + { + c = *src++; + if (c == '\r') + st->eol.just_saw_cr = 1; + else + { + 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; + 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 unsigned char *src, + unsigned int n, int just_do_eol) +{ + int c; + + 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++) + { + c = *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->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); + + st->mask = st->iso2022.mask | st->shift_jis.mask | st->big5.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 (Qno_conversion); + 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 = coding_category_by_priority[i]; + if ((mask & (1 << cat)) && + !NILP (coding_category_system[cat])) + break; + } + if (cat >= 0) + return coding_category_system[cat]; + else + return Fget_coding_system (Qno_conversion); + } +} + +/* 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. */ + +void +determine_real_coding_system (Lstream *stream, Lisp_Object *codesys_in_out, + enum eol_type *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); + + memset (&decst, 0, sizeof (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) + { + + while (1) + { + unsigned char random_buffer[4096]; + int nread; + + nread = Lstream_read (stream, random_buffer, sizeof (random_buffer)); + if (!nread) + break; + if (detect_coding_type (&decst, random_buffer, nread, + XCODING_SYSTEM_TYPE (*codesys_in_out) != + CODESYS_AUTODETECT)) + break; + } + + *eol_type_in_out = decst.eol_type; + if (XCODING_SYSTEM_TYPE (*codesys_in_out) == CODESYS_AUTODETECT) + *codesys_in_out = coding_system_from_mask (decst.mask); + } + + /* 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. +Returned a list of possible coding systems ordered by priority. +If only ASCII characters are found, it returns '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); + memset (&decst, 0, sizeof (decst)); + decst.eol_type = EOL_AUTODETECT; + decst.mask = ~0; + while (1) + { + unsigned char random_buffer[4096]; + int 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; i >= 0; i--) + { + int sys = coding_category_by_priority[i]; + if (decst.mask & (1 << sys)) + { + Lisp_Object codesys = 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. */ + +#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) + +#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 { \ + DECODE_OUTPUT_PARTIAL_CHAR (ch); \ + if ((flags & CODING_STATE_END) && \ + (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. */ + struct 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. */ + enum eol_type 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; +#endif + struct detection_state decst; +}; + +static int decoding_reader (Lstream *stream, unsigned char *data, int size); +static int decoding_writer (Lstream *stream, CONST unsigned char *data, int 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, + void (*markobj) (Lisp_Object)); + +DEFINE_LSTREAM_IMPLEMENTATION ("decoding", lstream_decoding, + sizeof (struct decoding_stream)); + +static Lisp_Object +decoding_marker (Lisp_Object stream, void (*markobj) (Lisp_Object)) +{ + 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); + (markobj) (str_obj); + if (str->imp->marker) + return (str->imp->marker) (str_obj, markobj); + 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 int +decoding_reader (Lstream *stream, unsigned char *data, int size) +{ + struct decoding_stream *str = DECODING_STREAM_DATA (stream); + unsigned char *orig_data = data; + int 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) + { + int chunk = min (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_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, data, str->runoff, read_size); + } + + if (data - orig_data == 0) + return error_occurred ? -1 : 0; + else + return data - orig_data; +} + +static int +decoding_writer (Lstream *stream, CONST unsigned char *data, int size) +{ + struct decoding_stream *str = DECODING_STREAM_DATA (stream); + int 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, 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 = Qnil; + 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)); + } +#endif + 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 + if (str->iso2022.composite_chars) + Dynarr_free (str->iso2022.composite_chars); +#endif + return Lstream_close (str->other_end); +} + +Lisp_Object +decoding_stream_coding_system (Lstream *stream) +{ + Lisp_Object coding_system = Qnil; + 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) +{ + struct 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; + + memset (str, 0, sizeof (*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 unsigned char *src, + unsigned_char_dynarr *dst, unsigned int 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 = Qnil; + + 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_CCL: + ccl_driver (&str->ccl, src, dst, n, 0); + break; + case CODESYS_ISO2022: + decode_coding_iso2022 (decoding, src, dst, n); + break; +#endif + 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); + int 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. */ + struct 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; + + /* Additional information (the state of the running CCL program) + used by the CCL encoder. */ + struct ccl_program ccl; +#endif +}; + +static int encoding_reader (Lstream *stream, unsigned char *data, int size); +static int encoding_writer (Lstream *stream, CONST unsigned char *data, + int 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, + void (*markobj) (Lisp_Object)); + +DEFINE_LSTREAM_IMPLEMENTATION ("encoding", lstream_encoding, + sizeof (struct encoding_stream)); + +static Lisp_Object +encoding_marker (Lisp_Object stream, void (*markobj) (Lisp_Object)) +{ + 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); + (markobj) (str_obj); + if (str->imp->marker) + return (str->imp->marker) (str_obj, markobj); + 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 int +encoding_reader (Lstream *stream, unsigned char *data, int size) +{ + struct encoding_stream *str = ENCODING_STREAM_DATA (stream); + unsigned char *orig_data = data; + int 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 (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 int +encoding_writer (Lstream *stream, CONST unsigned char *data, int size) +{ + struct encoding_stream *str = ENCODING_STREAM_DATA (stream); + int 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) +{ + switch (CODING_SYSTEM_TYPE (str->codesys)) + { +#ifdef MULE + case CODESYS_ISO2022: + { + int i; + + 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; + str->iso2022.current_char_boundary = 1; + break; + } + case CODESYS_CCL: + setup_ccl_program (&str->ccl, CODING_SYSTEM_CCL_ENCODE (str->codesys)); + break; +#endif + default: + break; + } + + 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 = Qnil; + 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) +{ + struct 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; + + memset (str, 0, sizeof (*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 unsigned char *src, + unsigned_char_dynarr *dst, unsigned int 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_CCL: + ccl_driver (&str->ccl, src, dst, n, 0); + break; + case CODESYS_ISO2022: + encode_coding_iso2022 (encoding, src, dst, n); + break; +#endif /* MULE */ + default: + abort (); + } +} + +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); + int 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 + +/************************************************************************/ +/* 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 (TYPE94 character set) is + encoded by "position-code + 0x80". A character of JISX0208 + (TYPE94x94 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 unsigned char *src, + unsigned int n) +{ + int c; + + while (n--) + { + c = *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 unsigned char *src, + unsigned_char_dynarr *dst, unsigned int n) +{ + unsigned char c; + unsigned int flags, ch; + enum eol_type eol_type; + struct decoding_stream *str = DECODING_STREAM_DATA (decoding); + + CODING_STREAM_DECOMPOSE (str, flags, ch); + eol_type = str->eol_type; + + while (n--) + { + c = *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; + + Dynarr_add (dst, LEADING_BYTE_JAPANESE_JISX0208); + DECODE_SJIS (ch, c, e1, e2); + Dynarr_add (dst, e1); + Dynarr_add (dst, e2); + } + 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)) + { + Dynarr_add (dst, LEADING_BYTE_KATAKANA_JISX0201); + Dynarr_add (dst, c); + } + else + DECODE_ADD_BINARY_CHAR (c, dst); + } + label_continue_loop:; + } + + DECODE_HANDLE_END_OF_CONVERSION (flags, ch, dst); + + CODING_STREAM_COMPOSE (str, flags, ch); +} + +/* Convert internally-formatted data to Shift-JIS. */ + +static void +encode_coding_sjis (Lstream *encoding, CONST unsigned char *src, + unsigned_char_dynarr *dst, unsigned int n) +{ + unsigned char c; + struct encoding_stream *str = ENCODING_STREAM_DATA (encoding); + unsigned int flags, ch; + enum eol_type eol_type; + + CODING_STREAM_DECOMPOSE (str, flags, ch); + 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'); + 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; + } + } + } + + CODING_STREAM_COMPOSE (str, flags, ch); +} + +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 CHAR to SHIFT-JIS coding-system. +Return the corresponding character code in SHIFT-JIS as a cons of two bytes. +*/ + (ch)) +{ + Lisp_Object charset; + int c1, c2, s1, s2; + + CHECK_CHAR_COERCE_INT (ch); + BREAKUP_CHAR (XCHAR (ch), 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 devided into two: `charset-big5-1' + and `charset-big5-2'. Both s are TYPE94x94. 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 unsigned char *src, + unsigned int n) +{ + int c; + + while (n--) + { + c = *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 unsigned char *src, + unsigned_char_dynarr *dst, unsigned int n) +{ + unsigned char c; + unsigned int flags, ch; + enum eol_type eol_type; + struct decoding_stream *str = DECODING_STREAM_DATA (decoding); + + CODING_STREAM_DECOMPOSE (str, flags, ch); + eol_type = str->eol_type; + + while (n--) + { + c = *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); + + CODING_STREAM_COMPOSE (str, flags, ch); +} + +/* Convert internally-formatted data to Big5. */ + +static void +encode_coding_big5 (Lstream *encoding, CONST unsigned char *src, + unsigned_char_dynarr *dst, unsigned int n) +{ + unsigned char c; + struct encoding_stream *str = ENCODING_STREAM_DATA (encoding); + unsigned int flags, ch; + enum eol_type eol_type; + + CODING_STREAM_DECOMPOSE (str, flags, ch); + 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; + } + + CODING_STREAM_COMPOSE (str, flags, ch); +} + + +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)) + { + int 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 CH to BIG5 coding-system. +Return the corresponding character code in Big5. +*/ + (ch)) +{ + Lisp_Object charset; + int c1, c2, b1, b2; + + CHECK_CHAR_COERCE_INT (ch); + BREAKUP_CHAR (XCHAR (ch), 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; +} + + +/************************************************************************/ +/* ISO2022 methods */ +/************************************************************************/ + +/* The following note describes the coding system ISO2022 briefly. + Since the intention of this note is to help understanding of the + programs 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. If one chooses 7-bit environment, + all text is encoded by codes of less than 128. This may make the + encoded text a little bit longer, but the text get more stability + to pass through several gateways (some of them strip off MSB). + + There are two kind 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 provided also by escape sequence). 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 four types, + according to the dimension and number of characters in the set: + TYPE94, TYPE96, TYPE94x94, and TYPE96x96. In addition, each + character set is assigned an identification byte, unique for each + type, called "final character" (denoted as hereafter). The + of each character set is decided by ECMA(*) when it is registered + in ISO. 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 TYPE94 -- ASCII('B'), right-half-of-JISX0201('I'), ... + o TYPE96 -- right-half-of-ISO8859-1('A'), ... + o TYPE94x94 -- GB2312('A'), JISX0208('B'), ... + o TYPE96x96 -- none for the moment + + A code area (1byte=8bits) 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 TYPE94 or TYPE94x94 is invoked to + GL, codes 0x20 and 0x7F of the GL area work as control characters + SPACE and DEL respectively, and code 0xA0 and 0xFF of 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 works only + for the following character and doesn't affect locking-shift. + 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 + LS1R (locking-shift-1 right) none ESC '~' invoke G1 into GR + LS2 (locking-shift-2) none ESC 'n' invoke G2 into GL + LS2R (locking-shift-2 right) none ESC '}' invoke G2 into GR + LS3 (locking-shift-3) none ESC 'o' invoke G3 into GL + 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 + ---------------------------------------------------------------------- + The first four are for locking-shift. 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 TYPE94 to G0 + ESC ')' designate TYPE94 to G1 + ESC '*' designate TYPE94 to G2 + ESC '+' designate TYPE94 to G3 + ESC ',' designate TYPE96 to G0 (*) + ESC '-' designate TYPE96 to G1 + ESC '.' designate TYPE96 to G2 + ESC '/' designate TYPE96 to G3 + ESC '$' '(' designate TYPE94x94 to G0 (**) + ESC '$' ')' designate TYPE94x94 to G1 + ESC '$' '*' designate TYPE94x94 to G2 + ESC '$' '+' designate TYPE94x94 to G3 + ESC '$' ',' designate TYPE96x96 to G0 (*) + ESC '$' '-' designate TYPE96x96 to G1 + ESC '$' '.' designate TYPE96x96 to G2 + ESC '$' '/' designate TYPE96x96 to G3 + ---------------------------------------------------------------------- + In this list, "TYPE94" means a graphic character set of type TYPE94 + and final character , and etc. + + Note (*): Although these designations are not allowed in ISO2022, + Emacs accepts them on decoding, and produces them on encoding + TYPE96 or TYPE96x96 character set 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 call this as "short-form" here after. + + 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 X'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 format: + 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 7-bit environment. + + Character composition specification takes the following format: + o ESC '0' -- start character composition + o ESC '1' -- end character composition + Since these are not standard escape sequences of any ISO, the use + of them for 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; + if (iso->composite_chars) + Dynarr_reset (iso->composite_chars); +} + +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; + + /**** 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; + + /**** 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(); + } + + 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 unsigned char *src, + unsigned int n) +{ + int c; + int mask; + + /* #### There are serious deficiencies in the recognition mechanism + here. This needs to be much smarter if it's going to cut it. */ + + 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--) + { + c = *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 (struct 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, struct 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 unsigned char *src, + unsigned_char_dynarr *dst, unsigned int n) +{ + unsigned char c; + unsigned int flags, ch; + enum eol_type eol_type; + struct decoding_stream *str = DECODING_STREAM_DATA (decoding); + Lisp_Object coding_system = Qnil; + unsigned_char_dynarr *real_dst = dst; + + CODING_STREAM_DECOMPOSE (str, flags, ch); + eol_type = str->eol_type; + XSETCODING_SYSTEM (coding_system, str->codesys); + + if (flags & CODING_STATE_COMPOSITE) + dst = str->iso2022.composite_chars; + + while (n--) + { + c = *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) + { + 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; + } + + 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; + int lb; + 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 (NILP (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; + } + + lb = XCHARSET_LEADING_BYTE (charset); + 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); + Dynarr_add (dst, lb); + Dynarr_add (dst, c | 0x80); + break; + + case 3: /* one-byte private or two-byte official */ + if (XCHARSET_PRIVATE_P (charset)) + { + DECODE_OUTPUT_PARTIAL_CHAR (ch); + Dynarr_add (dst, PRE_LEADING_BYTE_PRIVATE_1); + Dynarr_add (dst, lb); + Dynarr_add (dst, c | 0x80); + } + else + { + if (ch) + { + Dynarr_add (dst, lb); + Dynarr_add (dst, ch | 0x80); + Dynarr_add (dst, c | 0x80); + ch = 0; + } + else + ch = c; + } + break; + + default: /* two-byte private */ + if (ch) + { + Dynarr_add (dst, PRE_LEADING_BYTE_PRIVATE_2); + Dynarr_add (dst, lb); + Dynarr_add (dst, ch | 0x80); + Dynarr_add (dst, c | 0x80); + 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); + + CODING_STREAM_COMPOSE (str, flags, 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) +{ + CONST char *inter94 = "()*+", *inter96= ",-./"; + 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; + } +} + +/* Convert internally-formatted data to ISO2022 format. */ + +static void +encode_coding_iso2022 (Lstream *encoding, CONST unsigned char *src, + unsigned_char_dynarr *dst, unsigned int n) +{ + unsigned char charmask, c; + unsigned int flags, ch; + enum eol_type eol_type; + unsigned char char_boundary; + struct encoding_stream *str = ENCODING_STREAM_DATA (encoding); + struct Lisp_Coding_System *codesys = str->codesys; + int i; + Lisp_Object charset; + int half; + + /* 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; + + CODING_STREAM_DECOMPOSE (str, flags, ch); + eol_type = CODING_SYSTEM_EOL_TYPE (str->codesys); + char_boundary = str->iso2022.current_char_boundary; + charset = str->iso2022.current_charset; + half = str->iso2022.current_half; + + back_to_square_n: + while (n--) + { + c = *src++; + + if (BYTE_ASCII_P (c)) + { /* Processing ASCII character */ + ch = 0; + + restore_left_to_right_direction (codesys, dst, &flags, 0); + + /* Make sure G0 contains ASCII */ + if ((c > ' ' && c < 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 (c == '\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 (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 + { + if (CODING_SYSTEM_ISO2022_ESCAPE_QUOTED (codesys) + && fit_to_be_escape_quoted (c)) + Dynarr_add (dst, ISO_CODE_ESC); + Dynarr_add (dst, c); + } + 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; + else if (!EQ (charset, Vcharset_control_1) + && !EQ (charset, Vcharset_composite)) + { + int reg; + + 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 (); + } + } + char_boundary = 0; + } + else + { /* Processing Non-ASCII character */ + charmask = (half == 0 ? 0x7F : 0xFF); + char_boundary = 1; + if (EQ (charset, Vcharset_control_1)) + { + if (CODING_SYSTEM_ISO2022_ESCAPE_QUOTED (codesys) + && fit_to_be_escape_quoted (c)) + Dynarr_add (dst, ISO_CODE_ESC); + /* you asked for it ... */ + Dynarr_add (dst, c - 0x20); + } + else + { + switch (XCHARSET_REP_BYTES (charset)) + { + case 2: + Dynarr_add (dst, c & charmask); + break; + case 3: + if (XCHARSET_PRIVATE_P (charset)) + { + Dynarr_add (dst, c & charmask); + ch = 0; + } + else if (ch) + { + if (EQ (charset, Vcharset_composite)) + { + if (in_composite) + { + /* #### Bother! We don't know how to + handle this yet. */ + 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); + Dynarr_add (dst, ISO_CODE_ESC); + Dynarr_add (dst, '0'); /* start composing */ + } + } + else + { + Dynarr_add (dst, ch & charmask); + Dynarr_add (dst, c & charmask); + } + ch = 0; + } + else + { + ch = c; + char_boundary = 0; + } + break; + case 4: + if (ch) + { + Dynarr_add (dst, ch & charmask); + Dynarr_add (dst, c & charmask); + ch = 0; + } + else + { + ch = c; + char_boundary = 0; + } + break; + default: + abort (); + } + } + } + } + + if (in_composite) + { + n = saved_n; + src = saved_src; + in_composite = 0; + Dynarr_add (dst, ISO_CODE_ESC); + Dynarr_add (dst, '1'); /* end composing */ + goto back_to_square_n; /* Wheeeeeeeee ..... */ + } + + if (char_boundary && flags & CODING_STATE_END) + { + 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); + } + } + + CODING_STREAM_COMPOSE (str, flags, ch); + str->iso2022.current_char_boundary = char_boundary; + str->iso2022.current_charset = charset; + str->iso2022.current_half = half; + + /* Verbum caro factum est! */ +} +#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 unsigned char *src, + unsigned_char_dynarr *dst, unsigned int n) +{ + unsigned char c; + unsigned int flags, ch; + enum eol_type eol_type; + struct decoding_stream *str = DECODING_STREAM_DATA (decoding); + + CODING_STREAM_DECOMPOSE (str, flags, ch); + eol_type = str->eol_type; + + while (n--) + { + c = *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); + + CODING_STREAM_COMPOSE (str, flags, ch); +} + +static void +encode_coding_no_conversion (Lstream *encoding, CONST unsigned char *src, + unsigned_char_dynarr *dst, unsigned int n) +{ + unsigned char c; + struct encoding_stream *str = ENCODING_STREAM_DATA (encoding); + unsigned int flags, ch; + enum eol_type eol_type; + + CODING_STREAM_DECOMPOSE (str, flags, ch); + 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'); + 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; + } + } + + CODING_STREAM_COMPOSE (str, flags, ch); +} + + +/************************************************************************/ +/* Simple internal/external functions */ +/************************************************************************/ + +static Extbyte_dynarr *conversion_out_dynarr; +static Bufbyte_dynarr *conversion_in_dynarr; + +/* Determine coding system from coding format */ + +#define FILE_NAME_CODING_SYSTEM \ + ((NILP (Vfile_name_coding_system) || \ + (EQ ((Vfile_name_coding_system), Qbinary))) ? \ + Qnil : Fget_coding_system (Vfile_name_coding_system)) + +/* #### not correct for all values of `fmt'! */ +#define FMT_CODING_SYSTEM(fmt) \ + (((fmt) == FORMAT_FILENAME) ? FILE_NAME_CODING_SYSTEM : \ + ((fmt) == FORMAT_CTEXT ) ? Fget_coding_system (Qctext) : \ + ((fmt) == FORMAT_TERMINAL) ? FILE_NAME_CODING_SYSTEM : \ + Qnil) + +extern CONST Extbyte * +convert_to_external_format (CONST Bufbyte *ptr, + Bytecount len, + Extcount *len_out, + enum external_data_format fmt) +{ +#ifdef MULE + Lisp_Object coding_system = FMT_CODING_SYSTEM (fmt); +#else + Lisp_Object coding_system = Qnil; +#endif + + if (!conversion_out_dynarr) + conversion_out_dynarr = Dynarr_new (Extbyte); + else + Dynarr_reset (conversion_out_dynarr); + + if (NILP (coding_system)) + { + CONST Bufbyte *end = ptr + len; + + for (; ptr < end;) + { + Bufbyte c = + (BYTE_ASCII_P (*ptr)) ? *ptr : + (*ptr == LEADING_BYTE_CONTROL_1) ? (*(ptr+1) - 0x20) : + (*ptr == LEADING_BYTE_LATIN_ISO8859_1) ? (*(ptr+1)) : + '~'; + + Dynarr_add (conversion_out_dynarr, (Extbyte) c); + INC_CHARPTR (ptr); + } + +#ifdef ERROR_CHECK_BUFPOS + assert (ptr == end); +#endif + } + else + { + Lisp_Object instream, outstream, da_outstream; + Lstream *istr, *ostr; + struct gcpro gcpro1, gcpro2, gcpro3; + char tempbuf[1024]; /* some random amount */ + + instream = make_fixed_buffer_input_stream ((unsigned char *) ptr, len); + da_outstream = make_dynarr_output_stream + ((unsigned_char_dynarr *) conversion_out_dynarr); + outstream = + make_encoding_output_stream (XLSTREAM (da_outstream), coding_system); + istr = XLSTREAM (instream); + ostr = XLSTREAM (outstream); + GCPRO3 (instream, outstream, da_outstream); + while (1) + { + int size_in_bytes = Lstream_read (istr, tempbuf, sizeof (tempbuf)); + if (!size_in_bytes) + break; + Lstream_write (ostr, tempbuf, size_in_bytes); + } + Lstream_close (istr); + Lstream_close (ostr); + UNGCPRO; + Lstream_delete (istr); + Lstream_delete (ostr); + Lstream_delete (XLSTREAM (da_outstream)); + } + + *len_out = Dynarr_length (conversion_out_dynarr); + Dynarr_add (conversion_out_dynarr, 0); /* remember to zero-terminate! */ + return Dynarr_atp (conversion_out_dynarr, 0); +} + +extern CONST Bufbyte * +convert_from_external_format (CONST Extbyte *ptr, + Extcount len, + Bytecount *len_out, + enum external_data_format fmt) +{ +#ifdef MULE + Lisp_Object coding_system = FMT_CODING_SYSTEM (fmt); +#else + Lisp_Object coding_system = Qnil; +#endif + + if (!conversion_in_dynarr) + conversion_in_dynarr = Dynarr_new (Bufbyte); + else + Dynarr_reset (conversion_in_dynarr); + + if (NILP (coding_system)) + { + CONST Extbyte *end = ptr + len; + for (; ptr < end; ptr++) + { + Extbyte c = *ptr; + DECODE_ADD_BINARY_CHAR (c, conversion_in_dynarr); + } + } + else + { + Lisp_Object instream, outstream, da_outstream; + Lstream *istr, *ostr; + struct gcpro gcpro1, gcpro2, gcpro3; + char tempbuf[1024]; /* some random amount */ + + instream = make_fixed_buffer_input_stream ((unsigned char *) ptr, len); + da_outstream = make_dynarr_output_stream + ((unsigned_char_dynarr *) conversion_in_dynarr); + outstream = + make_decoding_output_stream (XLSTREAM (da_outstream), coding_system); + istr = XLSTREAM (instream); + ostr = XLSTREAM (outstream); + GCPRO3 (instream, outstream, da_outstream); + while (1) + { + int size_in_bytes = Lstream_read (istr, tempbuf, sizeof (tempbuf)); + if (!size_in_bytes) + break; + Lstream_write (ostr, tempbuf, size_in_bytes); + } + Lstream_close (istr); + Lstream_close (ostr); + UNGCPRO; + Lstream_delete (istr); + Lstream_delete (ostr); + Lstream_delete (XLSTREAM (da_outstream)); + } + + *len_out = Dynarr_length (conversion_in_dynarr); + Dynarr_add (conversion_in_dynarr, 0); /* remember to zero-terminate! */ + return Dynarr_atp (conversion_in_dynarr, 0); +} + + +/************************************************************************/ +/* Initialization */ +/************************************************************************/ + +void +syms_of_mule_coding (void) +{ + defsymbol (&Qbuffer_file_coding_system, "buffer-file-coding-system"); + deferror (&Qcoding_system_error, "coding-system-error", + "Coding-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 (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); +#endif /* MULE */ + defsymbol (&Qcoding_system_p, "coding-system-p"); + defsymbol (&Qno_conversion, "no-conversion"); +#ifdef MULE + defsymbol (&Qbig5, "big5"); + defsymbol (&Qshift_jis, "shift-jis"); + 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"); +#endif + 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"); + + defsymbol (&Qencode, "encode"); + defsymbol (&Qdecode, "decode"); + +#ifdef MULE + defsymbol (&Qctext, "ctext"); + defsymbol (&coding_category_symbol[CODING_CATEGORY_SHIFT_JIS], + "shift-jis"); + defsymbol (&coding_category_symbol[CODING_CATEGORY_BIG5], + "big5"); +#endif /* MULE */ + 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"); + defsymbol (&coding_category_symbol[CODING_CATEGORY_NO_CONVERSION], + "no-conversion"); +} + +void +lstream_type_create_mule_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_mule_coding (void) +{ + int i; + + /* Initialize to something reasonable ... */ + for (i = 0; i <= CODING_CATEGORY_LAST; i++) + { + coding_category_system[i] = Qnil; + 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 writing a file or process. +You should *bind* this, not set it. If this is non-nil, it specifies +the coding system that will be used when a file or process is read +in, and 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 a file or process. +You should *bind* this, not set it. If this is non-nil, it specifies +the coding system that will be used when a file or process is wrote +in, and 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_mule_coding (void) +{ + staticpro (&Vcoding_system_hashtable); + Vcoding_system_hashtable = make_lisp_hashtable (50, HASHTABLE_NONWEAK, + HASHTABLE_EQ); + + the_codesys_prop_dynarr = Dynarr_new (codesys_prop); + +#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 (Qno_conversion, Qno_conversion, build_string ("No conversion"), + list2 (Qmnemonic, build_string ("Noconv"))); + + Fcopy_coding_system (Fcoding_system_property (Qno_conversion, Qeol_lf), + Qbinary); + + /* Need this for bootstrapping */ + coding_category_system[CODING_CATEGORY_NO_CONVERSION] = + Fget_coding_system (Qno_conversion); +} diff -r 58424f6abf56 -r 11cf20601dec src/file-coding.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/src/file-coding.h Mon Aug 13 10:23:02 2007 +0200 @@ -0,0 +1,471 @@ +/* Header for code conversion stuff + 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. */ + +/* 91.10.09 written by K.Handa */ +/* Rewritten by Ben Wing . */ + +#ifndef _XEMACS_MULE_CODING_H_ +#define _XEMACS_MULE_CODING_H_ + +struct decoding_stream; +struct encoding_stream; + +/* Coding system types. These go into the TYPE field of a + struct Lisp_Coding_System. */ + +enum coding_system_type +{ + CODESYS_AUTODETECT, /* Automatic conversion. */ +#ifdef MULE + CODESYS_SHIFT_JIS, /* Shift-JIS; Hankaku (half-width) KANA + is also supported. */ + CODESYS_ISO2022, /* Any ISO2022-compliant coding system. + Includes JIS, EUC, CTEXT */ + CODESYS_BIG5, /* BIG5 (used for Taiwanese). */ + CODESYS_CCL, /* Converter written in CCL. */ +#endif + CODESYS_NO_CONVERSION /* "No conversion"; used for binary files. + We use quotes because there really + is some conversion being applied, + but it appears to the user as if + the text is read in without conversion. */ +#ifdef DEBUG_XEMACS + ,CODESYS_INTERNAL /* Raw (internally-formatted) data. */ +#endif +}; + +enum eol_type +{ + EOL_AUTODETECT, + EOL_LF, + EOL_CRLF, + EOL_CR +}; + +typedef struct charset_conversion_spec charset_conversion_spec; +struct charset_conversion_spec +{ + Lisp_Object from_charset; + Lisp_Object to_charset; +}; + +typedef struct +{ + Dynarr_declare (charset_conversion_spec); +} charset_conversion_spec_dynarr; + +struct Lisp_Coding_System +{ + struct lcrecord_header header; + + /* Name and doc string of this coding system. */ + Lisp_Object name, doc_string; + + /* This is the major type of the coding system -- one of Big5, ISO2022, + Shift-JIS, etc. See the constants above. */ + enum coding_system_type type; + + /* Mnemonic string displayed in the modeline when this coding + system is active for a particular buffer. */ + Lisp_Object mnemonic; + + Lisp_Object post_read_conversion, pre_write_conversion; + + enum eol_type eol_type; + + /* Subsidiary coding systems that specify a particular type of EOL + marking, rather than autodetecting it. These will only be non-nil + if (eol_type == EOL_AUTODETECT). */ + Lisp_Object eol_lf, eol_crlf, eol_cr; + + struct + { + /* What are the charsets to be initially designated to G0, G1, + G2, G3? If t, no charset is initially designated. If nil, + no charset is initially designated and no charset is allowed + to be designated. */ + Lisp_Object initial_charset[4]; + + /* If true, a designation escape sequence needs to be sent on output + for the charset in G[0-3] before that charset is used. */ + unsigned char force_charset_on_output[4]; + + charset_conversion_spec_dynarr *input_conv; + charset_conversion_spec_dynarr *output_conv; + + unsigned int shoort :1; /* C makes you speak Dutch */ + unsigned int no_ascii_eol :1; + unsigned int no_ascii_cntl :1; + unsigned int seven :1; + unsigned int lock_shift :1; + unsigned int no_iso6429 :1; + unsigned int escape_quoted :1; + } iso2022; + + struct + { + /* For a CCL coding system, these specify the CCL programs used for + decoding (input) and encoding (output). */ + Lisp_Object decode, encode; + } ccl; +}; + +DECLARE_LRECORD (coding_system, struct Lisp_Coding_System); +#define XCODING_SYSTEM(x) XRECORD (x, coding_system, struct Lisp_Coding_System) +#define XSETCODING_SYSTEM(x, p) XSETRECORD (x, p, coding_system) +#define CODING_SYSTEMP(x) RECORDP (x, coding_system) +#define GC_CODING_SYSTEMP(x) GC_RECORDP (x, coding_system) +#define CHECK_CODING_SYSTEM(x) CHECK_RECORD (x, coding_system) +#define CONCHECK_CODING_SYSTEM(x) CONCHECK_RECORD (x, coding_system) + +#define CODING_SYSTEM_NAME(codesys) ((codesys)->name) +#define CODING_SYSTEM_DOC_STRING(codesys) ((codesys)->doc_string) +#define CODING_SYSTEM_TYPE(codesys) ((codesys)->type) +#define CODING_SYSTEM_MNEMONIC(codesys) ((codesys)->mnemonic) +#define CODING_SYSTEM_POST_READ_CONVERSION(codesys) \ + ((codesys)->post_read_conversion) +#define CODING_SYSTEM_PRE_WRITE_CONVERSION(codesys) \ + ((codesys)->pre_write_conversion) +#define CODING_SYSTEM_EOL_TYPE(codesys) ((codesys)->eol_type) +#define CODING_SYSTEM_EOL_LF(codesys) ((codesys)->eol_lf) +#define CODING_SYSTEM_EOL_CRLF(codesys) ((codesys)->eol_crlf) +#define CODING_SYSTEM_EOL_CR(codesys) ((codesys)->eol_cr) +#define CODING_SYSTEM_ISO2022_INITIAL_CHARSET(codesys, g) \ + ((codesys)->iso2022.initial_charset[g]) +#define CODING_SYSTEM_ISO2022_FORCE_CHARSET_ON_OUTPUT(codesys, g) \ + ((codesys)->iso2022.force_charset_on_output[g]) +#define CODING_SYSTEM_ISO2022_SHORT(codesys) ((codesys)->iso2022.shoort) +#define CODING_SYSTEM_ISO2022_NO_ASCII_EOL(codesys) \ + ((codesys)->iso2022.no_ascii_eol) +#define CODING_SYSTEM_ISO2022_NO_ASCII_CNTL(codesys) \ + ((codesys)->iso2022.no_ascii_cntl) +#define CODING_SYSTEM_ISO2022_SEVEN(codesys) ((codesys)->iso2022.seven) +#define CODING_SYSTEM_ISO2022_LOCK_SHIFT(codesys) \ + ((codesys)->iso2022.lock_shift) +#define CODING_SYSTEM_ISO2022_NO_ISO6429(codesys) \ + ((codesys)->iso2022.no_iso6429) +#define CODING_SYSTEM_ISO2022_ESCAPE_QUOTED(codesys) \ + ((codesys)->iso2022.escape_quoted) +#define CODING_SYSTEM_CCL_DECODE(codesys) ((codesys)->ccl.decode) +#define CODING_SYSTEM_CCL_ENCODE(codesys) ((codesys)->ccl.encode) + +#define XCODING_SYSTEM_NAME(codesys) \ + CODING_SYSTEM_NAME (XCODING_SYSTEM (codesys)) +#define XCODING_SYSTEM_DOC_STRING(codesys) \ + CODING_SYSTEM_DOC_STRING (XCODING_SYSTEM (codesys)) +#define XCODING_SYSTEM_TYPE(codesys) \ + CODING_SYSTEM_TYPE (XCODING_SYSTEM (codesys)) +#define XCODING_SYSTEM_MNEMONIC(codesys) \ + CODING_SYSTEM_MNEMONIC (XCODING_SYSTEM (codesys)) +#define XCODING_SYSTEM_POST_READ_CONVERSION(codesys) \ + CODING_SYSTEM_POST_READ_CONVERSION (XCODING_SYSTEM (codesys)) +#define XCODING_SYSTEM_PRE_WRITE_CONVERSION(codesys) \ + CODING_SYSTEM_PRE_WRITE_CONVERSION (XCODING_SYSTEM (codesys)) +#define XCODING_SYSTEM_EOL_TYPE(codesys) \ + CODING_SYSTEM_EOL_TYPE (XCODING_SYSTEM (codesys)) +#define XCODING_SYSTEM_EOL_LF(codesys) \ + CODING_SYSTEM_EOL_LF (XCODING_SYSTEM (codesys)) +#define XCODING_SYSTEM_EOL_CRLF(codesys) \ + CODING_SYSTEM_EOL_CRLF (XCODING_SYSTEM (codesys)) +#define XCODING_SYSTEM_EOL_CR(codesys) \ + CODING_SYSTEM_EOL_CR (XCODING_SYSTEM (codesys)) +#define XCODING_SYSTEM_ISO2022_INITIAL_CHARSET(codesys, g) \ + CODING_SYSTEM_ISO2022_INITIAL_CHARSET (XCODING_SYSTEM (codesys), g) +#define XCODING_SYSTEM_ISO2022_FORCE_CHARSET_ON_OUTPUT(codesys, g) \ + CODING_SYSTEM_ISO2022_FORCE_CHARSET_ON_OUTPUT (XCODING_SYSTEM (codesys), g) +#define XCODING_SYSTEM_ISO2022_SHORT(codesys) \ + CODING_SYSTEM_ISO2022_SHORT (XCODING_SYSTEM (codesys)) +#define XCODING_SYSTEM_ISO2022_NO_ASCII_EOL(codesys) \ + CODING_SYSTEM_ISO2022_NO_ASCII_EOL (XCODING_SYSTEM (codesys)) +#define XCODING_SYSTEM_ISO2022_NO_ASCII_CNTL(codesys) \ + CODING_SYSTEM_ISO2022_NO_ASCII_CNTL (XCODING_SYSTEM (codesys)) +#define XCODING_SYSTEM_ISO2022_SEVEN(codesys) \ + CODING_SYSTEM_ISO2022_SEVEN (XCODING_SYSTEM (codesys)) +#define XCODING_SYSTEM_ISO2022_LOCK_SHIFT(codesys) \ + CODING_SYSTEM_ISO2022_LOCK_SHIFT (XCODING_SYSTEM (codesys)) +#define XCODING_SYSTEM_ISO2022_NO_ISO6429(codesys) \ + CODING_SYSTEM_ISO2022_NO_ISO6429 (XCODING_SYSTEM (codesys)) +#define XCODING_SYSTEM_ISO2022_ESCAPE_QUOTED(codesys) \ + CODING_SYSTEM_ISO2022_ESCAPE_QUOTED (XCODING_SYSTEM (codesys)) +#define XCODING_SYSTEM_CCL_DECODE(codesys) \ + CODING_SYSTEM_CCL_DECODE (XCODING_SYSTEM (codesys)) +#define XCODING_SYSTEM_CCL_ENCODE(codesys) \ + CODING_SYSTEM_CCL_ENCODE (XCODING_SYSTEM (codesys)) + +extern Lisp_Object Qbuffer_file_coding_system, Qcoding_system_error; + +extern Lisp_Object Vkeyboard_coding_system; +extern Lisp_Object Vterminal_coding_system; +extern Lisp_Object Vcoding_system_for_read; +extern Lisp_Object Vcoding_system_for_write; +extern Lisp_Object Vpathname_coding_system; + +extern Lisp_Object Qescape_quoted; + +/* Flags indicating current state while converting code. */ + +/* Used by everyone. */ + +#define CODING_STATE_END (1 << 0) /* If set, this is the last chunk of + data being processed. When this + is finished, output any necessary + terminating control characters, + escape sequences, etc. */ +#define CODING_STATE_CR (1 << 1) /* If set, we just saw a CR. */ + + +/* Used by Big 5 on output. */ + +#define CODING_STATE_BIG5_1 (1 << 2) /* If set, we just encountered + LEADING_BYTE_BIG5_1. */ +#define CODING_STATE_BIG5_2 (1 << 3) /* If set, we just encountered + LEADING_BYTE_BIG5_2. */ + + +/* Used by ISO2022 on input and output. */ + +#define CODING_STATE_R2L (1 << 4) /* If set, the current + directionality is right-to-left. + Otherwise, it's left-to-right. */ + + +/* Used by ISO2022 on input. */ + +#define CODING_STATE_ESCAPE (1 << 5) /* If set, we're currently parsing + an escape sequence and the upper + 16 bits should be looked at to + indicate what partial escape + sequence we've seen so far. + Otherwise, we're running + through actual text. */ +#define CODING_STATE_SS2 (1 << 6) /* If set, G2 is invoked into GL, but + only for the next character. */ +#define CODING_STATE_SS3 (1 << 7) /* If set, G3 is invoked into GL, + but only for the next character. + If both CODING_STATE_SS2 and + CODING_STATE_SS3 are set, + CODING_STATE_SS2 overrides; but + this probably indicates an error + in the text encoding. */ +#define CODING_STATE_COMPOSITE (1 << 8) /* If set, we're currently processing + a composite character (i.e. a + character constructed by + overstriking two or more + characters). */ + + +/* CODING_STATE_ISO2022_LOCK is the mask of flags that remain on until + explicitly turned off when in the ISO2022 encoder/decoder. Other flags are + turned off at the end of processing each character or escape sequence. */ +# define CODING_STATE_ISO2022_LOCK \ + (CODING_STATE_END | CODING_STATE_COMPOSITE | CODING_STATE_R2L) +#define CODING_STATE_BIG5_LOCK \ + CODING_STATE_END + +/* Flags indicating what we've seen so far when parsing an + ISO2022 escape sequence. */ +enum iso_esc_flag +{ + /* Partial sequences */ + ISO_ESC_NOTHING, /* Nothing has been seen. */ + ISO_ESC, /* We've seen ESC. */ + ISO_ESC_2_4, /* We've seen ESC $. This indicates + that we're designating a multi-byte, rather + than a single-byte, character set. */ + ISO_ESC_2_8, /* We've seen ESC 0x28, i.e. ESC (. + This means designate a 94-character + character set into G0. */ + ISO_ESC_2_9, /* We've seen ESC 0x29 -- designate a + 94-character character set into G1. */ + ISO_ESC_2_10, /* We've seen ESC 0x2A. */ + ISO_ESC_2_11, /* We've seen ESC 0x2B. */ + ISO_ESC_2_12, /* We've seen ESC 0x2C -- designate a + 96-character character set into G0. + (This is not ISO2022-standard. + The following 96-character + control sequences are standard, + though.) */ + ISO_ESC_2_13, /* We've seen ESC 0x2D -- designate a + 96-character character set into G1. + */ + ISO_ESC_2_14, /* We've seen ESC 0x2E. */ + ISO_ESC_2_15, /* We've seen ESC 0x2F. */ + ISO_ESC_2_4_8, /* We've seen ESC $ 0x28 -- designate + a 94^N character set into G0. */ + ISO_ESC_2_4_9, /* We've seen ESC $ 0x29. */ + ISO_ESC_2_4_10, /* We've seen ESC $ 0x2A. */ + ISO_ESC_2_4_11, /* We've seen ESC $ 0x2B. */ + ISO_ESC_2_4_12, /* We've seen ESC $ 0x2C. */ + ISO_ESC_2_4_13, /* We've seen ESC $ 0x2D. */ + ISO_ESC_2_4_14, /* We've seen ESC $ 0x2E. */ + ISO_ESC_2_4_15, /* We've seen ESC $ 0x2F. */ + ISO_ESC_5_11, /* We've seen ESC [ or 0x9B. This + starts a directionality-control + sequence. The next character + must be 0, 1, 2, or ]. */ + ISO_ESC_5_11_0, /* We've seen 0x9B 0. The next + character must be ]. */ + ISO_ESC_5_11_1, /* We've seen 0x9B 1. The next + character must be ]. */ + ISO_ESC_5_11_2, /* We've seen 0x9B 2. The next + character must be ]. */ + + /* Full sequences. */ + ISO_ESC_START_COMPOSITE, /* Private usage for START COMPOSING */ + ISO_ESC_END_COMPOSITE, /* Private usage for END COMPOSING */ + ISO_ESC_SINGLE_SHIFT, /* We've seen a complete single-shift sequence. */ + ISO_ESC_LOCKING_SHIFT,/* We've seen a complete locking-shift sequence. */ + ISO_ESC_DESIGNATE, /* We've seen a complete designation sequence. */ + ISO_ESC_DIRECTIONALITY,/* We've seen a complete ISO6429 directionality + sequence. */ + ISO_ESC_LITERAL /* We've seen a literal character ala + escape-quoting. */ +}; + +/* Macros to define code of control characters for ISO2022's functions. */ + /* code */ /* function */ +#define ISO_CODE_LF 0x0A /* line-feed */ +#define ISO_CODE_CR 0x0D /* carriage-return */ +#define ISO_CODE_SO 0x0E /* shift-out */ +#define ISO_CODE_SI 0x0F /* shift-in */ +#define ISO_CODE_ESC 0x1B /* escape */ +#define ISO_CODE_DEL 0x7F /* delete */ +#define ISO_CODE_SS2 0x8E /* single-shift-2 */ +#define ISO_CODE_SS3 0x8F /* single-shift-3 */ +#define ISO_CODE_CSI 0x9B /* control-sequence-introduce */ + +/* Macros to access an encoding stream or decoding stream */ + +#define CODING_STREAM_DECOMPOSE(str, flags, ch) \ +do { \ + flags = (str)->flags; \ + ch = (str)->ch; \ +} while (0) + +#define CODING_STREAM_COMPOSE(str, flags, ch) \ +do { \ + (str)->flags = flags; \ + (str)->ch = ch; \ +} while (0) + + +/* For detecting the encoding of text */ +enum coding_category_type +{ + CODING_CATEGORY_SHIFT_JIS, + CODING_CATEGORY_ISO_7, /* ISO2022 system using only seven-bit bytes, + no locking shift */ + CODING_CATEGORY_ISO_8_DESIGNATE, /* ISO2022 system using eight-bit bytes, + no locking shift, no single shift, + using designation to switch charsets */ + CODING_CATEGORY_ISO_8_1, /* ISO2022 system using eight-bit bytes, + no locking shift, no designation sequences, + one-dimension characters in the upper half. */ + CODING_CATEGORY_ISO_8_2, /* ISO2022 system using eight-bit bytes, + no locking shift, no designation sequences, + two-dimension characters in the upper half. */ + CODING_CATEGORY_ISO_LOCK_SHIFT, /* ISO2022 system using locking shift */ + CODING_CATEGORY_BIG5, + CODING_CATEGORY_NO_CONVERSION +}; + +#define CODING_CATEGORY_LAST CODING_CATEGORY_NO_CONVERSION + +#define CODING_CATEGORY_SHIFT_JIS_MASK \ + (1 << CODING_CATEGORY_SHIFT_JIS) +#define CODING_CATEGORY_ISO_7_MASK \ + (1 << CODING_CATEGORY_ISO_7) +#define CODING_CATEGORY_ISO_8_DESIGNATE_MASK \ + (1 << CODING_CATEGORY_ISO_8_DESIGNATE) +#define CODING_CATEGORY_ISO_8_1_MASK \ + (1 << CODING_CATEGORY_ISO_8_1) +#define CODING_CATEGORY_ISO_8_2_MASK \ + (1 << CODING_CATEGORY_ISO_8_2) +#define CODING_CATEGORY_ISO_LOCK_SHIFT_MASK \ + (1 << CODING_CATEGORY_ISO_LOCK_SHIFT) +#define CODING_CATEGORY_BIG5_MASK \ + (1 << CODING_CATEGORY_BIG5) +#define CODING_CATEGORY_NO_CONVERSION_MASK \ + (1 << CODING_CATEGORY_NO_CONVERSION) +#define CODING_CATEGORY_NOT_FINISHED_MASK \ + (1 << 30) + +/* Convert shift-JIS code (sj1, sj2) into internal string + representation (c1, c2). (The leading byte is assumed.) */ + +#define DECODE_SJIS(sj1, sj2, c1, c2) \ +do { \ + int I1 = sj1, I2 = sj2; \ + if (I2 >= 0x9f) \ + c1 = (I1 << 1) - ((I1 >= 0xe0) ? 0xe0 : 0x60), \ + c2 = I2 + 2; \ + else \ + c1 = (I1 << 1) - ((I1 >= 0xe0) ? 0xe1 : 0x61), \ + c2 = I2 + ((I2 >= 0x7f) ? 0x60 : 0x61); \ +} while (0) + +/* Convert the internal string representation of a Shift-JIS character + (c1, c2) into Shift-JIS code (sj1, sj2). The leading byte is + assumed. */ + +#define ENCODE_SJIS(c1, c2, sj1, sj2) \ +do { \ + int I1 = c1, I2 = c2; \ + if (I1 & 1) \ + sj1 = (I1 >> 1) + ((I1 < 0xdf) ? 0x31 : 0x71), \ + sj2 = I2 - ((I2 >= 0xe0) ? 0x60 : 0x61); \ + else \ + sj1 = (I1 >> 1) + ((I1 < 0xdf) ? 0x30 : 0x70), \ + sj2 = I2 - 2; \ +} while (0) + +extern Lisp_Object make_decoding_input_stream (Lstream *stream, + Lisp_Object codesys); +extern Lisp_Object make_encoding_input_stream (Lstream *stream, + Lisp_Object codesys); +extern Lisp_Object make_decoding_output_stream (Lstream *stream, + Lisp_Object codesys); +extern Lisp_Object make_encoding_output_stream (Lstream *stream, + Lisp_Object codesys); +extern Lisp_Object decoding_stream_coding_system (Lstream *stream); +extern Lisp_Object encoding_stream_coding_system (Lstream *stream); +extern void set_decoding_stream_coding_system (Lstream *stream, + Lisp_Object codesys); +extern void set_encoding_stream_coding_system (Lstream *stream, + Lisp_Object codesys); +extern void determine_real_coding_system (Lstream *stream, Lisp_Object *codesys_in_out, + enum eol_type *eol_type_in_out); + + +#ifndef MULE +#define MIN_LEADING_BYTE 0x80 +/* These need special treatment in a string and/or character */ +#define LEADING_BYTE_COMPOSITE 0x80 /* for a composite character */ +#define LEADING_BYTE_CONTROL_1 0x8F /* represent normal 80-9F */ +#define LEADING_BYTE_LATIN_ISO8859_1 0x81 /* Right half of ISO 8859-1 */ +#define BYTE_C1_P(c) ((unsigned int) ((unsigned int) (c) - 0x80) < 0x20) +#define BUFBYTE_FIRST_BYTE_P(c) ((c) < 0xA0) +#define BUFBYTE_LEADING_BYTE_P(c) BYTE_C1_P (c) +#endif /* not MULE */ +#endif /* _XEMACS_MULE_CODING_H_ */ + diff -r 58424f6abf56 -r 11cf20601dec src/fileio.c --- a/src/fileio.c Mon Aug 13 10:22:10 2007 +0200 +++ b/src/fileio.c Mon Aug 13 10:23:02 2007 +0200 @@ -33,8 +33,8 @@ #include "redisplay.h" #include "sysdep.h" #include "window.h" /* minibuf_level */ -#ifdef MULE -#include "mule-coding.h" +#ifdef FILE_CODING +#include "file-coding.h" #endif #ifdef HAVE_LIBGEN_H /* Must come before sysfile.h */ @@ -2760,7 +2760,7 @@ goto handled; } -#ifdef MULE +#ifdef FILE_CODING if (!NILP (used_codesys)) CHECK_SYMBOL (used_codesys); #endif @@ -2861,7 +2861,7 @@ with the file contents. Avoid replacing text at the beginning or end of the buffer that matches the file contents; that preserves markers pointing to the unchanged parts. */ -#if !defined (MULE) +#if !defined (FILE_CODING) /* The replace-mode code currently only works when the assumption 'one byte == one char' holds true. This fails Mule because files may contain multibyte characters. It holds under Windows NT @@ -3164,7 +3164,7 @@ NGCPRO1 (stream); Lstream_set_buffering (XLSTREAM (stream), LSTREAM_BLOCKN_BUFFERED, 65536); -#ifdef MULE +#ifdef FILE_CODING stream = make_decoding_input_stream (XLSTREAM (stream), Fget_coding_system (codesys)); Lstream_set_character_mode (XLSTREAM (stream)); @@ -3278,7 +3278,7 @@ inserted += cc_inserted; cur_point += cc_inserted; } -#ifdef MULE +#ifdef FILE_CODING if (!NILP (used_codesys)) { Fset (used_codesys, @@ -3438,7 +3438,7 @@ = NILP (current_buffer->buffer_file_type) ? O_TEXT : O_BINARY; #endif /* DOS_NT */ -#ifdef MULE +#ifdef FILE_CODING codesys = Fget_coding_system (codesys); #endif /* MULE */ @@ -3587,7 +3587,7 @@ outstream = make_filedesc_output_stream (desc, 0, -1, 0); Lstream_set_buffering (XLSTREAM (outstream), LSTREAM_BLOCKN_BUFFERED, 65536); -#ifdef MULE +#ifdef FILE_CODING outstream = make_encoding_output_stream (XLSTREAM (outstream), codesys); Lstream_set_buffering (XLSTREAM (outstream), @@ -4308,7 +4308,7 @@ auto save name. */ if (listdesc >= 0) { - Extbyte *auto_save_file_name_ext; + CONST Extbyte *auto_save_file_name_ext; Extcount auto_save_file_name_ext_len; GET_STRING_FILENAME_DATA_ALLOCA @@ -4317,7 +4317,7 @@ auto_save_file_name_ext_len); if (!NILP (b->filename)) { - Extbyte *filename_ext; + CONST Extbyte *filename_ext; Extcount filename_ext_len; GET_STRING_FILENAME_DATA_ALLOCA (b->filename, diff -r 58424f6abf56 -r 11cf20601dec src/glyphs-x.c --- a/src/glyphs-x.c Mon Aug 13 10:22:10 2007 +0200 +++ b/src/glyphs-x.c Mon Aug 13 10:23:02 2007 +0200 @@ -66,9 +66,8 @@ #else #include #endif - -#ifdef MULE -#include "mule-coding.h" +#ifdef FILE_CODING +#include "file-coding.h" #endif #define LISP_DEVICE_TO_X_SCREEN(dev) \ @@ -452,7 +451,7 @@ static Extbyte_dynarr *conversion_out_dynarr = NULL; Bytecount bstart, bend; struct gcpro gcpro1, gcpro2; -#ifdef MULE +#ifdef FILE_CODING Lisp_Object conv_out_stream; Lstream *costr; struct gcpro gcpro3; @@ -489,7 +488,7 @@ /* setup the out stream */ outstream = make_dynarr_output_stream((unsigned_char_dynarr *)conversion_out_dynarr); ostr = XLSTREAM (outstream); -#ifdef MULE +#ifdef FILE_CODING /* setup the conversion stream */ conv_out_stream = make_encoding_output_stream (ostr, Fget_coding_system(Qbinary)); costr = XLSTREAM (conv_out_stream); @@ -504,7 +503,7 @@ if (!size_in_bytes) break; /* It does seem the flushes are necessary... */ -#ifdef MULE +#ifdef FILE_CODING Lstream_write (costr, tempbuf, size_in_bytes); Lstream_flush (costr); #else @@ -524,7 +523,7 @@ if (fclose (tmpfil) != 0) fubar = 1; Lstream_close (istr); -#ifdef MULE +#ifdef FILE_CODING Lstream_close (costr); #endif Lstream_close (ostr); @@ -532,9 +531,10 @@ UNGCPRO; Lstream_delete (istr); Lstream_delete (ostr); -#ifdef MULE +#ifdef FILE_CODING Lstream_delete (costr); #endif + if (fubar) report_file_error ("Writing temp file", list1 (build_string (filename_out))); diff -r 58424f6abf56 -r 11cf20601dec src/gui-x.c --- a/src/gui-x.c Mon Aug 13 10:22:10 2007 +0200 +++ b/src/gui-x.c Mon Aug 13 10:23:02 2007 +0200 @@ -2,6 +2,7 @@ Copyright (C) 1995 Board of Trustees, University of Illinois. Copyright (C) 1995, 1996 Ben Wing. Copyright (C) 1995 Sun Microsystems, Inc. + Copyright (C) 1998 Free Software Foundation, Inc. This file is part of XEmacs. @@ -375,17 +376,18 @@ int plist_p; int selected_spec = 0, included_spec = 0; - if (length < 3) - signal_simple_error ("button descriptors must be at least 3 long", desc); + if (length < 2) + signal_simple_error ("button descriptors must be at least 2 long", desc); - /* length 3: [ "name" callback active-p ] + /* length 2: [ "name" callback ] + length 3: [ "name" callback active-p ] length 4: [ "name" callback active-p suffix ] or [ "name" callback keyword value ] length 5+: [ "name" callback [ keyword value ]+ ] */ - plist_p = (length >= 5 || KEYWORDP (contents [2])); + plist_p = (length >= 5 || (length > 2 && KEYWORDP (contents [2]))); - if (!plist_p) + if (!plist_p && length > 2) /* the old way */ { name = contents [0]; @@ -453,8 +455,18 @@ if (!NILP (suffix)) { CONST char *const_bogosity; - CHECK_STRING (suffix); - GET_C_STRING_FILENAME_DATA_ALLOCA (suffix, const_bogosity); + Lisp_Object suffix2; + + /* Shortcut to avoid evaluating suffix each time */ + if (STRINGP (suffix)) + suffix2 = suffix; + else + { + suffix2 = Feval (suffix); + CHECK_STRING (suffix2); + } + + GET_C_STRING_FILENAME_DATA_ALLOCA (suffix2, const_bogosity); wv->value = (char *) const_bogosity; wv->value = xstrdup (wv->value); } diff -r 58424f6abf56 -r 11cf20601dec src/gui.c --- a/src/gui.c Mon Aug 13 10:22:10 2007 +0200 +++ b/src/gui.c Mon Aug 13 10:23:02 2007 +0200 @@ -2,6 +2,7 @@ Copyright (C) 1995 Board of Trustees, University of Illinois. Copyright (C) 1995, 1996 Ben Wing. Copyright (C) 1995 Sun Microsystems, Inc. + Copyright (C) 1998 Free Software Foundation, Inc. This file is part of XEmacs. @@ -130,20 +131,21 @@ length = XVECTOR_LENGTH (item); contents = XVECTOR_DATA (item); - if (length < 3) - signal_simple_error ("GUI item descriptors must be at least 3 elts long", item); + if (length < 2) + signal_simple_error ("GUI item descriptors must be at least 2 elts long", item); - /* length 3: [ "name" callback active-p ] + /* length 2: [ "name" callback ] + length 3: [ "name" callback active-p ] length 4: [ "name" callback active-p suffix ] or [ "name" callback keyword value ] length 5+: [ "name" callback [ keyword value ]+ ] */ - plist_p = (length >= 5 || KEYWORDP (contents [2])); + plist_p = (length >= 5 || (length > 2 && KEYWORDP (contents [2]))); pgui_item->name = contents [0]; pgui_item->callback = contents [1]; - if (!plist_p) + if (!plist_p && length > 2) /* the old way */ { pgui_item->active = contents [2]; @@ -234,14 +236,26 @@ buf += (consumed = XSTRING_LENGTH (pgui_item->name)); buf_len -= consumed; - /* Add space and suffix text, if there is a suffix */ + /* Add space and suffix, if there is a suffix. + * If suffix is not string evaluate it */ if (!NILP (pgui_item->suffix)) { - if (XSTRING_LENGTH (pgui_item->suffix) + 1 > buf_len) + Lisp_Object suffix2; + + /* Shortcut to avoid evaluating suffix each time */ + if (STRINGP (pgui_item->suffix)) + suffix2 = pgui_item->suffix; + else + { + suffix2 = Feval (pgui_item->suffix); + CHECK_STRING (suffix2); + } + + if (XSTRING_LENGTH (suffix2) + 1 > buf_len) signal_too_long_error (pgui_item->name); *(buf++) = ' '; - strcpy (buf, XSTRING_DATA (pgui_item->suffix)); - consumed += XSTRING_LENGTH (pgui_item->suffix) + 1; + strcpy (buf, XSTRING_DATA (suffix2)); + consumed += XSTRING_LENGTH (suffix2) + 1; } return consumed; diff -r 58424f6abf56 -r 11cf20601dec src/inline.c --- a/src/inline.c Mon Aug 13 10:22:10 2007 +0200 +++ b/src/inline.c Mon Aug 13 10:23:02 2007 +0200 @@ -67,12 +67,15 @@ #include "glyphs-x.h" #include "gui-x.h" #endif - -#ifdef MULE -#include "mule-coding.h" +#ifdef FILE_CODING +#include "file-coding.h" #endif #ifdef TOOLTALK #include TT_C_H_PATH #include "tooltalk.h" #endif + +#ifdef HAVE_LDAP +#include "eldap.h" +#endif diff -r 58424f6abf56 -r 11cf20601dec src/lisp-disunion.h --- a/src/lisp-disunion.h Mon Aug 13 10:22:10 2007 +0200 +++ b/src/lisp-disunion.h Mon Aug 13 10:23:02 2007 +0200 @@ -163,6 +163,13 @@ # endif #endif +/* Extract the value of a Lisp integer as an unsigned integer. */ +#ifdef USE_MINIMAL_TAGBITS +# define XUINT(a) ((EMACS_UINT)(a) >> (LONGBITS-VALBITS-1)) +#else +# define XUINT(a) XPNTRVAL(a) +#endif + /* * Extract the pointer value bits of a pointer based type. */ diff -r 58424f6abf56 -r 11cf20601dec src/lisp-union.h --- a/src/lisp-union.h Mon Aug 13 10:22:10 2007 +0200 +++ b/src/lisp-union.h Mon Aug 13 10:23:02 2007 +0200 @@ -65,6 +65,16 @@ unsigned bit: GCTYPEBITS - 1; #endif } si; + struct + { +#if (!!defined (WORDS_BIGENDIAN) != !!defined (LOWTAGS)) + unsigned bit: GCTYPEBITS - 1; +#endif + unsigned EMACS_INT val: VALBITS + 1; +#if (!!defined (WORDS_BIGENDIAN) == !!defined (LOWTAGS)) + unsigned bit: GCTYPEBITS - 1; +#endif + } u_i; #endif /* USE_MINIMAL_TAGBITS */ EMACS_UINT ui; EMACS_INT i; @@ -122,6 +132,12 @@ #endif /* EXPLICIT_SIGN_EXTEND */ #ifdef USE_MINIMAL_TAGBITS +# define XUINT(a) ((a).u_i.val) +#else +# define XUINT(a) XPNTRVAL(a) +#endif + +#ifdef USE_MINIMAL_TAGBITS # define XPNTRVAL(a) ((a).ui) # define XCHARVAL(a) ((a).gu.val) #else diff -r 58424f6abf56 -r 11cf20601dec src/lread.c --- a/src/lread.c Mon Aug 13 10:22:10 2007 +0200 +++ b/src/lread.c Mon Aug 13 10:23:02 2007 +0200 @@ -36,8 +36,8 @@ #include "opaque.h" #include #endif -#ifdef MULE -#include "mule-coding.h" +#ifdef FILE_CODING +#include "file-coding.h" #endif #include "sysfile.h" @@ -596,8 +596,7 @@ the need to gcpro noerror, nomessage and nosuffix. (Below here, we care only whether they are nil or not.) */ file = Fsubstitute_in_file_name (file); - -#ifdef MULE +#ifdef FILE_CODING if (!NILP (used_codesys)) CHECK_SYMBOL (used_codesys); #endif @@ -732,13 +731,12 @@ files aren't really all that big. */ Lstream_set_buffering (XLSTREAM (lispstream), LSTREAM_BLOCKN_BUFFERED, block_size); -#ifdef MULE +#ifdef FILE_CODING lispstream = make_decoding_input_stream (XLSTREAM (lispstream), Fget_coding_system (codesys)); Lstream_set_buffering (XLSTREAM (lispstream), LSTREAM_BLOCKN_BUFFERED, block_size); -#endif /* MULE */ - +#endif /* NOTE: Order of these is very important. Don't rearrange them. */ record_unwind_protect (load_unwind, lispstream); record_unwind_protect (load_descriptor_unwind, Vload_descriptor_list); @@ -782,12 +780,12 @@ load_byte_code_version = 100; /* no Ebolification needed */ readevalloop (lispstream, file, Feval, 0); -#ifdef MULE +#ifdef FILE_CODING if (!NILP (used_codesys)) Fset (used_codesys, XCODING_SYSTEM_NAME (decoding_stream_coding_system (XLSTREAM (lispstream)))); -#endif /* MULE */ +#endif unbind_to (speccount, Qnil); NUNGCPRO; diff -r 58424f6abf56 -r 11cf20601dec src/md5.c --- a/src/md5.c Mon Aug 13 10:22:10 2007 +0200 +++ b/src/md5.c Mon Aug 13 10:23:02 2007 +0200 @@ -32,8 +32,8 @@ #include "buffer.h" #include "insdel.h" #include "lstream.h" -#ifdef MULE -#include "mule-coding.h" +#ifdef FILE_CODING +#include "file-coding.h" #endif typedef unsigned char *POINTER;/* POINTER defines a generic pointer type */ @@ -390,7 +390,7 @@ static Extbyte_dynarr *conversion_out_dynarr; char tempbuf[1024]; /* some random amount */ struct gcpro gcpro1, gcpro2; -#ifdef MULE +#ifdef FILE_CODING Lisp_Object conv_out_stream, coding_system; Lstream *costr; struct gcpro gcpro3; @@ -421,7 +421,7 @@ } istr = XLSTREAM (instream); -#ifdef MULE +#ifdef FILE_CODING /* Find out what format the buffer will be saved in, so we can make the digest based on what it will look like on disk */ if (NILP(coding)) @@ -457,11 +457,11 @@ coding_system = Fget_coding_system(Qbinary); /* default to binary */ } #endif - + /* setup the out stream */ outstream = make_dynarr_output_stream((unsigned_char_dynarr *)conversion_out_dynarr); ostr = XLSTREAM (outstream); -#ifdef MULE +#ifdef FILE_CODING /* setup the conversion stream */ conv_out_stream = make_encoding_output_stream (ostr, coding_system); costr = XLSTREAM (conv_out_stream); @@ -476,7 +476,7 @@ if (!size_in_bytes) break; /* It does seem the flushes are necessary... */ -#ifdef MULE +#ifdef FILE_CODING Lstream_write (costr, tempbuf, size_in_bytes); Lstream_flush (costr); #else @@ -492,7 +492,7 @@ Lstream_rewind(ostr); } Lstream_close (istr); -#ifdef MULE +#ifdef FILE_CODING Lstream_close (costr); #endif Lstream_close (ostr); @@ -500,7 +500,7 @@ UNGCPRO; Lstream_delete (istr); Lstream_delete (ostr); -#ifdef MULE +#ifdef FILE_CODING Lstream_delete (costr); #endif } diff -r 58424f6abf56 -r 11cf20601dec src/menubar.c --- a/src/menubar.c Mon Aug 13 10:22:10 2007 +0200 +++ b/src/menubar.c Mon Aug 13 10:23:02 2007 +0200 @@ -223,7 +223,7 @@ A menu item can have any of the following forms: [ "name" callback ] - [ "name" callback "suffix" ] + [ "name" callback ] [ "name" callback : : ... ] The name is the string to display on the menu; it is filtered through the @@ -241,10 +241,12 @@ displayed, and the menu will be selectable only if the result is non-nil. - :suffix "string" Same as "suffix" in the second form: the suffix is - appended to the displayed name, providing a convenient - way of adding the name of a command's ``argument'' to - the menu, like ``Kill Buffer NAME''. + :suffix
Same as in the second form: the expression + is evaluated just before the menu is displayed and + resulting string is appended to the displayed name, + providing a convenient way of adding the name of a + command's ``argument'' to the menu, like + ``Kill Buffer NAME''. :keys "string" Normally, the keyboard equivalents of commands in menus are displayed when the `callback' is a symbol. @@ -426,7 +428,7 @@ A menu item can have any of the following forms: [ "name" callback ] - [ "name" callback "suffix" ] + [ "name" callback ] [ "name" callback : : ... ] The name is the string to display on the menu; it is filtered through the @@ -444,10 +446,12 @@ displayed, and the menu will be selectable only if the result is non-nil. - :suffix "string" Same as "suffix" in the second form: the suffix is - appended to the displayed name, providing a convenient - way of adding the name of a command's ``argument'' to - the menu, like ``Kill Buffer NAME''. + :suffix Same as in the second form: the expression + is evaluated just before the menu is displayed and + resulting string is appended to the displayed name, + providing a convenient way of adding the name of a + command's ``argument'' to the menu, like + ``Kill Buffer NAME''. :keys "string" Normally, the keyboard equivalents of commands in menus are displayed when the `callback' is a symbol. diff -r 58424f6abf56 -r 11cf20601dec src/mule-canna.c --- a/src/mule-canna.c Mon Aug 13 10:22:10 2007 +0200 +++ b/src/mule-canna.c Mon Aug 13 10:23:02 2007 +0200 @@ -153,7 +153,7 @@ #include "lisp.h" #include "buffer.h" -#include "mule-coding.h" +#include "file-coding.h" #ifdef CANNA2 #define IROHA_BC diff -r 58424f6abf56 -r 11cf20601dec src/mule-ccl.c --- a/src/mule-ccl.c Mon Aug 13 10:22:10 2007 +0200 +++ b/src/mule-ccl.c Mon Aug 13 10:23:02 2007 +0200 @@ -30,7 +30,7 @@ #include "buffer.h" #include "mule-charset.h" #include "mule-ccl.h" -#include "mule-coding.h" +#include "file-coding.h" #else /* not emacs */ diff -r 58424f6abf56 -r 11cf20601dec src/mule-coding.c --- a/src/mule-coding.c Mon Aug 13 10:22:10 2007 +0200 +++ b/src/mule-coding.c Mon Aug 13 10:23:02 2007 +0200 @@ -23,6 +23,8 @@ /* Rewritten by Ben Wing . */ +#if 0 /* while file-coding not split up */ + #include #include "lisp.h" @@ -4811,3 +4813,5 @@ coding_category_system[CODING_CATEGORY_NO_CONVERSION] = Fget_coding_system (Qno_conversion); } + +#endif diff -r 58424f6abf56 -r 11cf20601dec src/process.c --- a/src/process.c Mon Aug 13 10:22:10 2007 +0200 +++ b/src/process.c Mon Aug 13 10:23:02 2007 +0200 @@ -23,8 +23,8 @@ /* Synched up with: Mule 2.0, FSF 19.30. */ -/* This file has been Mule-ized except for `start-process-internal' - and `open-network-stream-internal'. */ +/* This file has been Mule-ized except for `start-process-internal', + `open-network-stream-internal' and `open-multicast-group-internal'. */ #include @@ -44,8 +44,8 @@ #include "process.h" #include "sysdep.h" #include "window.h" -#ifdef MULE -#include "mule-coding.h" +#ifdef FILE_CODING +#include "file-coding.h" #endif #include @@ -65,6 +65,10 @@ /* Qrun => Qopen, Qexit => Qclosed for "network connection" processes */ Lisp_Object Qopen, Qclosed; +#ifdef HAVE_MULTICAST +Lisp_Object Qmulticast; /* Will be used for occasional warnings */ +#endif + /* t means use pty, nil means use a pipe, maybe other values to come. */ static Lisp_Object Vprocess_connection_type; @@ -787,7 +791,9 @@ filedesc_stream_set_pty_flushing (XLSTREAM (p->outstream), pty_max_bytes, eof_char); } -#ifdef MULE + +#ifdef FILE_CODING + p->instream = make_decoding_input_stream (XLSTREAM (p->instream), Fget_coding_system (Vcoding_system_for_read)); @@ -797,7 +803,7 @@ Fget_coding_system (Vcoding_system_for_write)); /* CODE_CNTL (&out_state[outchannel]) |= CC_END; !!#### What's going on here? */ -#endif /* MULE */ +#endif } static void @@ -1505,6 +1511,231 @@ return proc; } +#ifdef HAVE_MULTICAST +/* Didier Verna Nov. 28 1997. + + This function is similar to open-network-stream-internal, but provides a + mean to open an UDP multicast connection instead of a TCP one. Like in the + TCP case, the multicast connection will be seen as a sub-process, + + Some notes: + - Normaly, we should use sendto and recvfrom with non connected + sockets. The current code doesn't allow us to do this. In the future, it + would be a good idea to extend the process data structure in order to deal + properly with the different types network connections. + - For the same reason, when leaving a multicast group, it is better to make + a setsockopt - IP_DROP_MEMBERSHIP before closing the descriptors. + Unfortunately, this can't be done here because delete_process doesn't know + about the kind of connection we have. However, this is not such an + important issue. +*/ +DEFUN ("open-multicast-group-internal", Fopen_multicast_group_internal, 5, 5, 0, /* +Open a multicast connection on the specified dest/port/ttl. +Returns a subprocess-object to represent the connection. +Input and output work as for subprocesses; `delete-process' closes it. + +NAME is name for process. It is modified if necessary to make it unique. +BUFFER is the buffer (or buffer-name) to associate with the process. + Process output goes at end of that buffer, unless you specify + an output stream or filter function to handle the output. + BUFFER may also be nil, meaning that this process is not associated + with any buffer. +Third, fourth and fifth args are the multicast destination group, port and ttl. + dest must be an internet address between 224.0.0.0 and 239.255.255.255 + port is a communication port like in traditional unicast + ttl is the time-to-live (15 for site, 63 for region and 127 for world) +*/ + (name, buffer, dest, port, ttl)) +{ + /* !!#### This function has not been Mule-ized */ + /* This function can GC */ + Lisp_Object proc; + struct ip_mreq imr; + struct sockaddr_in sa; + struct protoent *udp; + int ws, rs; + int theport; + unsigned char thettl; + int one = 1; /* For REUSEADDR */ + int ret; + volatile int retry = 0; + struct gcpro gcpro1; + + CHECK_STRING (name); + CHECK_STRING (dest); + + CHECK_NATNUM (port); + theport = htons ((unsigned short) XINT (port)); + + CHECK_NATNUM (ttl); + thettl = (unsigned char) XINT (ttl); + + if ((udp = getprotobyname ("udp")) == NULL) + error ("No info available for UDP protocol"); + + /* Init the sockets. Yes, I need 2 sockets. I couldn't duplicate one. */ + if ((rs = socket (PF_INET, SOCK_DGRAM, udp->p_proto)) < 0) + report_file_error ("error creating socket", list1(name)); + if ((ws = socket (PF_INET, SOCK_DGRAM, udp->p_proto)) < 0) + { + close (rs); + report_file_error ("error creating socket", list1(name)); + } + + /* This will be used for both sockets */ + bzero(&sa, sizeof(sa)); + sa.sin_family = AF_INET; + sa.sin_port = theport; + sa.sin_addr.s_addr = htonl (inet_addr ((char *) XSTRING_DATA (dest))); + + /* Socket configuration for reading ------------------------ */ + + /* Multiple connections from the same machine. This must be done before + bind. If it fails, it shouldn't be fatal. The only consequence is that + people won't be able to connect twice from the same machine. */ + if (setsockopt (rs, SOL_SOCKET, SO_REUSEADDR, (char *) &one, sizeof (one)) + < 0) + warn_when_safe (Qmulticast, Qwarning, "Cannot reuse socket address"); + + /* bind socket name */ + if (bind (rs, (struct sockaddr *)&sa, sizeof(sa))) + { + close (rs); + close (ws); + report_file_error ("error binding socket", list2(name, port)); + } + + /* join multicast group */ + imr.imr_multiaddr.s_addr = htonl (inet_addr ((char *) XSTRING_DATA (dest))); + imr.imr_interface.s_addr = htonl (INADDR_ANY); + if (setsockopt (rs, IPPROTO_IP, IP_ADD_MEMBERSHIP, + (char *) &imr, sizeof (struct ip_mreq)) < 0) + { + close (ws); + close (rs); + report_file_error ("error adding membership", list2(name, dest)); + } + + /* Socket configuration for writing ----------------------- */ + + /* Normaly, there's no 'connect' in multicast, since we use preferentialy + 'sendto' and 'recvfrom'. However, in order to handle this connection in + the process-like way it is done for TCP, we must be able to use 'write' + instead of 'sendto'. Consequently, we 'connect' this socket. */ + + /* See open-network-stream-internal for comments on this part of the code */ + slow_down_interrupts (); + + loop: + + /* A system call interrupted with a SIGALRM or SIGIO comes back + here, with can_break_system_calls reset to 0. */ + SETJMP (break_system_call_jump); + if (QUITP) + { + speed_up_interrupts (); + REALLY_QUIT; + /* In case something really weird happens ... */ + slow_down_interrupts (); + } + + /* Break out of connect with a signal (it isn't otherwise possible). + Thus you don't get screwed with a hung network. */ + can_break_system_calls = 1; + ret = connect (ws, (struct sockaddr *) &sa, sizeof (sa)); + can_break_system_calls = 0; + if (ret == -1 && errno != EISCONN) + { + int xerrno = errno; + + if (errno == EINTR) + goto loop; + if (errno == EADDRINUSE && retry < 20) + { + /* A delay here is needed on some FreeBSD systems, + and it is harmless, since this retrying takes time anyway + and should be infrequent. + `sleep-for' allowed for quitting this loop with interrupts + slowed down so it can't be used here. Async timers should + already be disabled at this point so we can use `sleep'. */ + sleep (1); + retry++; + goto loop; + } + + close (rs); + close (ws); + speed_up_interrupts (); + + errno = xerrno; + report_file_error ("error connecting socket", list2(name, port)); + } + + speed_up_interrupts (); + + /* scope */ + if (setsockopt (ws, IPPROTO_IP, IP_MULTICAST_TTL, + (char *) &thettl, sizeof (thettl)) < 0) + { + close (rs); + close (ws); + report_file_error ("error setting ttl", list2(name, ttl)); + } + + if (!NILP (buffer)) + buffer = Fget_buffer_create (buffer); + + proc = make_process_internal (name); + GCPRO1 (proc); + + descriptor_to_process[rs] = proc; + +#ifdef PROCESS_IO_BLOCKING + { + Lisp_Object tail; + + for (tail = network_stream_blocking_port_list; + CONSP (tail); tail = XCDR (tail)) + { + Lisp_Object tail_port = XCAR (tail); + + if (STRINGP (tail_port)) + { + struct servent *svc_info; + + svc_info = + getservbyname ((char *) XSTRING_DATA (tail_port), "udp"); + if ((svc_info != 0) && (svc_info->s_port == theport)) + break; + else + continue; + } + else if ((INTP (tail_port)) && + (htons ((unsigned short) XINT (tail_port)) == theport)) + break; + } + + if (!CONSP (tail)) + { +#endif /* PROCESS_IO_BLOCKING */ + set_descriptor_non_blocking (rs); +#ifdef PROCESS_IO_BLOCKING + } + } +#endif /* PROCESS_IO_BLOCKING */ + + XPROCESS (proc)->pid = Fcons (port, dest); + XPROCESS (proc)->buffer = buffer; + init_process_fds (XPROCESS (proc), rs, ws); + XPROCESS (proc)->connected_via_filedesc_p = 0; + + event_stream_select_process (XPROCESS (proc)); + + UNGCPRO; + return proc; +} +#endif /* HAVE_MULTICAST */ + #endif /* HAVE_SOCKETS */ Lisp_Object @@ -1967,7 +2198,7 @@ return Qnil; } -#ifdef MULE +#ifdef FILE_CODING DEFUN ("process-input-coding-system", Fprocess_input_coding_system, 1, 1, 0, /* Return PROCESS's input coding system. @@ -2039,7 +2270,7 @@ return Qnil; } -#endif /* MULE */ +#endif /************************************************************************/ @@ -3257,6 +3488,10 @@ defsymbol (&Qopen, "open"); defsymbol (&Qclosed, "closed"); +#ifdef HAVE_MULTICAST + defsymbol(&Qmulticast, "multicast"); /* Used for occasional warnings */ +#endif + DEFSUBR (Fprocessp); DEFSUBR (Fget_process); DEFSUBR (Fget_buffer_process); @@ -3281,6 +3516,9 @@ DEFSUBR (Fstart_process_internal); #ifdef HAVE_SOCKETS DEFSUBR (Fopen_network_stream_internal); +#ifdef HAVE_MULTICAST + DEFSUBR (Fopen_multicast_group_internal); +#endif /* HAVE_MULTICAST */ #endif /* HAVE_SOCKETS */ DEFSUBR (Fprocess_send_region); DEFSUBR (Fprocess_send_string); @@ -3292,14 +3530,14 @@ DEFSUBR (Fprocess_send_eof); DEFSUBR (Fsignal_process); /* DEFSUBR (Fprocess_connection); */ -#ifdef MULE +#ifdef FILE_CODING DEFSUBR (Fprocess_input_coding_system); DEFSUBR (Fprocess_output_coding_system); DEFSUBR (Fset_process_input_coding_system); DEFSUBR (Fset_process_output_coding_system); DEFSUBR (Fprocess_coding_system); DEFSUBR (Fset_process_coding_system); -#endif /* MULE */ +#endif } void @@ -3308,7 +3546,10 @@ Fprovide (intern ("subprocesses")); #ifdef HAVE_SOCKETS Fprovide (intern ("network-streams")); -#endif +#ifdef HAVE_MULTICAST + Fprovide (intern ("multicast")); +#endif /* HAVE_MULTICAST */ +#endif /* HAVE_SOCKETS */ staticpro (&Vprocess_list); DEFVAR_BOOL ("delete-exited-processes", &delete_exited_processes /* diff -r 58424f6abf56 -r 11cf20601dec src/process.h --- a/src/process.h Mon Aug 13 10:22:10 2007 +0200 +++ b/src/process.h Mon Aug 13 10:23:02 2007 +0200 @@ -63,6 +63,11 @@ Lisp_Object buffer, Lisp_Object host, Lisp_Object service); +Lisp_Object Fopen_multicast_group_internal (Lisp_Object name, + Lisp_Object buffer, + Lisp_Object dest, + Lisp_Object port, + Lisp_Object ttl); Lisp_Object Fprocess_kill_without_query (Lisp_Object, Lisp_Object); Lisp_Object connect_to_file_descriptor (Lisp_Object name, diff -r 58424f6abf56 -r 11cf20601dec src/redisplay-x.c --- a/src/redisplay-x.c Mon Aug 13 10:22:10 2007 +0200 +++ b/src/redisplay-x.c Mon Aug 13 10:23:02 2007 +0200 @@ -49,7 +49,7 @@ #ifdef MULE #include "mule-ccl.h" -#include "mule-coding.h" /* for CCL conversion */ +#include "file-coding.h" /* for CCL conversion */ #endif /* X_DIVIDER_LINE_WIDTH is the width of the line drawn in the gutter. diff -r 58424f6abf56 -r 11cf20601dec src/redisplay.c --- a/src/redisplay.c Mon Aug 13 10:22:10 2007 +0200 +++ b/src/redisplay.c Mon Aug 13 10:23:02 2007 +0200 @@ -57,9 +57,8 @@ #include "toolbar.h" #include "window.h" #include "line-number.h" - -#ifdef MULE -#include "mule-coding.h" +#ifdef FILE_CODING +#include "file-coding.h" #endif #ifdef HAVE_TTY @@ -258,7 +257,8 @@ int modeline); static Charcount generate_fstring_runes (struct window *w, pos_data *data, Charcount pos, Charcount min_pos, - Charcount max_pos, Lisp_Object elt, + Charcount max_pos, int no_limit, + Lisp_Object elt, int depth, int max_pixsize, face_index findex, int type); static prop_block_dynarr *add_emchar_rune (pos_data *data); @@ -3613,8 +3613,10 @@ the current modeline horizontal scroll. */ generate_fstring_runes (w, &data, - (modeline && WINDOW_HAS_MODELINE_P (w)) ? - w->modeline_hscroll : 0, - 0, -1, format_str, 0, max_pixpos - min_pixpos, findex, type); + (modeline && WINDOW_HAS_MODELINE_P (w)) ? - w->modeline_hscroll : 0, + (modeline && WINDOW_HAS_MODELINE_P (w)) ? - w->modeline_hscroll : 0, + 0, /* no limit */ 1, format_str, 0, max_pixpos - min_pixpos, findex, + type); if (Dynarr_length (db->runes)) { @@ -3689,7 +3691,8 @@ scrolled modeline */ static Charcount add_string_to_fstring_db_runes (pos_data *data, CONST Bufbyte *str, - Charcount pos, Charcount min_pos, Charcount max_pos) + Charcount pos, Charcount min_pos, + Charcount max_pos, int no_limit) { /* This function has been Mule-ized. */ Charcount initial_pos = pos; @@ -3699,11 +3702,11 @@ data->blank_width = space_width (XWINDOW (data->window)); add_something = ((pos < min_pos) - || ((*cur_pos) && (max_pos == -1)) + || ((*cur_pos) && no_limit) || ((*cur_pos) && (pos < max_pos))); while (add_something) { - if (((initial_pos < 0) && (pos == 1)) || (pos == initial_pos)) + if ((initial_pos >= 0) && (pos == initial_pos)) while (Dynarr_length (db->runes) < pos) add_blank_rune (data, NULL, 0); @@ -3742,7 +3745,7 @@ } } add_something = ((pos < min_pos) - || ((*cur_pos) && (max_pos == -1)) + || ((*cur_pos) && no_limit) || ((*cur_pos) && (pos < max_pos))); } @@ -3753,7 +3756,8 @@ modeline extents. */ static Charcount add_glyph_to_fstring_db_runes (pos_data *data, Lisp_Object glyph, - Charcount pos, Charcount min_pos, Charcount max_pos) + Charcount pos, Charcount min_pos, + Charcount max_pos, int no_limit) { /* This function has been Mule-ized. */ Charcount end; @@ -3771,7 +3775,7 @@ add_blank_rune (data, NULL, 0); end = Dynarr_length (db->runes) + 1; - if (max_pos != -1) + if (!no_limit) end = min (max_pos, end); gb.glyph = glyph; @@ -3800,7 +3804,7 @@ modeline. */ static Charcount generate_fstring_runes (struct window *w, pos_data *data, Charcount pos, - Charcount min_pos, Charcount max_pos, + Charcount min_pos, Charcount max_pos, int no_limit, Lisp_Object elt, int depth, int max_pixsize, face_index findex, int type) { @@ -3825,7 +3829,7 @@ Bufbyte *this = XSTRING_DATA (elt); - while ((pos < max_pos || max_pos == -1) && *this) + while ((no_limit || pos < max_pos) && *this) { Bufbyte *last = this; @@ -3837,10 +3841,10 @@ /* The string is just a string. */ Charcount size = bytecount_to_charcount (last, this - last) + pos; - Charcount tmp_max = (max_pos == -1 ? size : min (size, max_pos)); + Charcount tmp_max = (no_limit ? size : min (size, max_pos)); pos = add_string_to_fstring_db_runes (data, last, pos, pos, - tmp_max); + tmp_max, /* limit */0); } else /* *this == '%' */ { @@ -3863,7 +3867,8 @@ if (*this == 'M') { pos = generate_fstring_runes (w, data, pos, spec_width, - max_pos, Vglobal_mode_string, + max_pos, no_limit, + Vglobal_mode_string, depth, max_pixsize, findex, type); } @@ -3873,7 +3878,7 @@ if (max_pixsize < 0) num_to_add = 0; - else if (max_pos != -1) + else if (! no_limit) num_to_add = max_pos - pos; else { @@ -3892,7 +3897,8 @@ while (num_to_add--) pos = add_string_to_fstring_db_runes - (data, (CONST Bufbyte *) "-", pos, pos, max_pos); + (data, (CONST Bufbyte *) "-", + pos, pos, max_pos, no_limit); } else if (*this != 0) { @@ -3902,7 +3908,7 @@ str = Dynarr_atp (mode_spec_bufbyte_string, 0); pos = add_string_to_fstring_db_runes (data,str, pos, pos, - max_pos); + max_pos, no_limit); } /* NOT this++. There could be any sort of character at @@ -3934,7 +3940,7 @@ { pos = add_string_to_fstring_db_runes - (data, XSTRING_DATA (tem), pos, min_pos, max_pos); + (data, XSTRING_DATA (tem), pos, min_pos, max_pos, no_limit); } /* Give up right away for nil or t. */ else if (!EQ (tem, elt)) @@ -4004,7 +4010,7 @@ * (20 -10 . foo) should truncate foo to 10 col * and then pad to 20. */ - if (max_pos == -1) + if (no_limit) max_pos = pos - lim; else max_pos = min (max_pos, pos - lim); @@ -4015,7 +4021,7 @@ * current maximum. */ lim += pos; - if (max_pos != -1 && lim > max_pos) + if (!no_limit && lim > max_pos) lim = max_pos; /* If that's more padding than already wanted, queue it. * But don't reduce padding already specified even if @@ -4024,16 +4030,17 @@ if (lim > min_pos) min_pos = lim; } + no_limit = 0; goto tail_recurse; } else if (STRINGP (car) || CONSP (car)) { int limit = 50; /* LIMIT is to protect against circular lists. */ - while (CONSP (elt) && --limit > 0 - && (pos < max_pos || max_pos == -1)) + while (CONSP (elt) && --limit > 0 && (no_limit || pos < max_pos)) { - pos = generate_fstring_runes (w, data, pos, pos, max_pos, + pos = generate_fstring_runes (w, data, pos, pos, max_pos, + no_limit, XCAR (elt), depth, max_pixsize, findex, type); elt = XCDR (elt); @@ -4072,7 +4079,8 @@ new_findex = old_findex; data->findex = new_findex; - pos = generate_fstring_runes (w, data, pos, pos, max_pos, + pos = generate_fstring_runes (w, data, pos, pos, max_pos, + no_limit, XCDR (elt), depth - 1, max_pixsize, new_findex, type); data->findex = old_findex; @@ -4084,21 +4092,22 @@ } else if (GLYPHP (elt)) { - pos = add_glyph_to_fstring_db_runes (data, elt, pos, pos, max_pos); + pos = add_glyph_to_fstring_db_runes + (data, elt, pos, pos, max_pos, no_limit); } else { invalid: pos = add_string_to_fstring_db_runes - (data, (CONST Bufbyte *) GETTEXT ("*invalid*"), pos, min_pos, - max_pos); + (data, (CONST Bufbyte *) GETTEXT ("*invalid*"), pos, min_pos, max_pos, + no_limit); } if (min_pos > pos) { add_string_to_fstring_db_runes (data, (CONST Bufbyte *) "", pos, min_pos, - -1); + 0, /* no limit */ 1); } return pos; @@ -5808,8 +5817,7 @@ goto decode_mode_spec_done; } - -#ifdef MULE +#ifdef FILE_CODING /* print the file coding system */ case 'C': { @@ -5823,7 +5831,7 @@ } } break; -#endif /* MULE */ +#endif /* print the current line number */ case 'l': diff -r 58424f6abf56 -r 11cf20601dec src/s/cygwin32.h --- a/src/s/cygwin32.h Mon Aug 13 10:22:10 2007 +0200 +++ b/src/s/cygwin32.h Mon Aug 13 10:23:02 2007 +0200 @@ -30,18 +30,28 @@ * * The important thing about building is that it is done on a binary * mounted filesystem. i.e. something mounted like: mount -b c: - * /binary. If you do not do this then compilation of el files will - * produce garbage. Make sure you have installed cygwin32 b18 + - * patched dll (which can be found at http://www.lexa.ru/sos or on my - * home page. Alternatively when b19 comes out the patched dll will be - * unnecessary. Also make sure your HOME path is unix style - - * i.e. without a drive letter. + * /binary. If you do not do this then compilation of el files may + * produce garbage. As of b24 there are fixes in xemacs to make + * building on text mounts but I don't generally do this. Make sure + * you have installed cygwin32 b18 + patched dll (which can be found + * at http://www.lexa.ru/sos or on my home page + * http://www.parallax.co.uk/~andyp. Alternatively when b19 comes out + * the patched dll will be unnecessary. Also make sure your HOME path + * is unix style - i.e. without a drive letter. + * + * Note that some people have reported problems with the patched + * cygwin.dll on Sergey's home page so you may want to use the one on + * mine which I *know* works. * * once you have done this, configure and make. If you want unexec - * support you need to download coff.h from my web page or use cygwin + * support you need to download a.out.h from my web page or use cygwin * b19. You probably want to build with mule support since this * addresses crlf issues in a sensible way. * + * windows '95 - I haven't tested this under '95, it will probably + * build but I konw there are some limitations with cygwin under 95 so + * YMMV. I build with NT4 SP3. + * * What I want to do: * * the fileio stuff merely uses the unix system calls this means that @@ -66,6 +76,8 @@ #else #define BROKEN_CYGWIN #endif +extern void cygwin32_win32_to_posix_path_list(const char*, char*); +extern int cygwin32_win32_to_posix_path_list_buf_size(const char*); #endif #ifdef HAVE_MS_WINDOWS @@ -114,6 +126,7 @@ #endif #undef MAIL_USE_SYSTEM_LOCK +#define MAIL_USE_POP /* Define NO_ARG_ARRAY if you cannot take the address of the first of a * group of arguments and treat it as an array of the arguments. */ @@ -209,6 +222,10 @@ /* We need a little extra space, see ../../lisp/loadup.el */ #define SYSTEM_PURESIZE_EXTRA 15000 +#define CYGWIN_CONV_PATH(src, dst) \ +dst = alloca (cygwin32_win32_to_posix_path_list_buf_size(src)); \ +cygwin32_win32_to_posix_path_list(src, dst) + /* * stolen from usg. */ diff -r 58424f6abf56 -r 11cf20601dec src/s/decosf4-0.h --- a/src/s/decosf4-0.h Mon Aug 13 10:22:10 2007 +0200 +++ b/src/s/decosf4-0.h Mon Aug 13 10:23:02 2007 +0200 @@ -24,6 +24,9 @@ #define regoff_t sys_regoff_t #define regmatch_t sys_regmatch_t +#undef C_SWITCH_SYSTEM +#define C_SWITCH_SYSTEM "-D_BSD" + #define SYSTEM_MALLOC /* Some V4.0* versions before V4.0B don't detect rename properly. */ diff -r 58424f6abf56 -r 11cf20601dec src/s/sol2.h --- a/src/s/sol2.h Mon Aug 13 10:22:10 2007 +0200 +++ b/src/s/sol2.h Mon Aug 13 10:23:02 2007 +0200 @@ -24,6 +24,10 @@ #define _XOPEN_SOURCE_EXTENDED 1 #endif /* > Solaris 2.4 */ +#if OS_RELEASE >= 57 +#define HAVE_GETLOADAVG +#endif + /* Fix understandable GCC lossage on Solaris 2.6 */ #if defined(__GNUC__) && OS_RELEASE >= 56 && !defined(NOT_C_CODE) diff -r 58424f6abf56 -r 11cf20601dec src/sheap.c --- a/src/sheap.c Mon Aug 13 10:22:10 2007 +0200 +++ b/src/sheap.c Mon Aug 13 10:23:02 2007 +0200 @@ -29,7 +29,7 @@ #define STATIC_HEAP_SLOP 0x30000 #else #define STATIC_HEAP_BASE 0x400000 -#define STATIC_HEAP_SLOP 0x20000 +#define STATIC_HEAP_SLOP 0x30000 #endif #define STATIC_HEAP_SIZE \ (STATIC_HEAP_BASE + SHEAP_ADJUSTMENT + STATIC_HEAP_SLOP) @@ -84,12 +84,11 @@ { printf( -"\nRequested %d bytes, static heap exhausted! base is %p,\n -current ptr is %p. You have exhausted the static heap, if\n -you want to run temacs, adjust sheap-adjust.h to 0 or a +ve\n -number. If you are dumping then STATIC_HEAP_SLOP is too\n -small. Generally you should *not* try to run temacs with a\n -static heap, you should dump first.", size, +"\nRequested %d bytes, static heap exhausted! base is %p, current ptr +is %p. You have exhausted the static heap, if you want to run temacs, +adjust sheap-adjust.h to 0 or a +ve number. If you are dumping then +STATIC_HEAP_SLOP is too small. Generally you should *not* try to run +temacs with a static heap, you should dump first.\n", size, static_heap_base, static_heap_ptr); exit(-1); @@ -117,3 +116,4 @@ ((static_heap_ptr - static_heap_buffer) - STATIC_HEAP_BASE)); fclose (stream); } + diff -r 58424f6abf56 -r 11cf20601dec src/symsinit.h --- a/src/symsinit.h Mon Aug 13 10:22:10 2007 +0200 +++ b/src/symsinit.h Mon Aug 13 10:23:02 2007 +0200 @@ -134,6 +134,7 @@ void syms_of_widget (void); void syms_of_window (void); void syms_of_xselect (void); +void syms_of_eldap (void); /* Initialize the console types (dump-time only). */ @@ -283,6 +284,7 @@ void vars_of_undo (void); void vars_of_window (void); void vars_of_xselect (void); +void vars_of_ldap (void); /* Initialize specifier variables (dump-time only). */ diff -r 58424f6abf56 -r 11cf20601dec src/sysdep.c --- a/src/sysdep.c Mon Aug 13 10:22:10 2007 +0200 +++ b/src/sysdep.c Mon Aug 13 10:23:02 2007 +0200 @@ -894,14 +894,6 @@ { int filedesc = DEVICE_INFD (d); -#if defined (I_SETSIG) && !defined(HPUX10) - ioctl (filedesc, I_GETSIG, &DEVICE_OLD_SIGIO_FLAG (d)); - DEVICE_OLD_SIGIO_FLAG (d) &= ~S_INPUT; -#elif defined (FASYNC) - DEVICE_OLD_SIGIO_FLAG (d) = - fcntl (filedesc, F_GETFL, 0) & ~FASYNC; -#endif - #if defined (FIOSSAIOOWN) { /* HPUX stuff */ int owner = getpid (); @@ -964,15 +956,14 @@ { int filedesc = DEVICE_INFD (d); - /* prevent redundant ioctl()s, which may cause syslog messages - (e.g. on Solaris) */ - if (d->sigio_enabled) - return; - #if defined (I_SETSIG) && !defined(HPUX10) - ioctl (filedesc, I_SETSIG, DEVICE_OLD_SIGIO_FLAG (d) | S_INPUT); + { + int events=0; + ioctl (filedesc, I_GETSIG, &events); + ioctl (filedesc, I_SETSIG, events | S_INPUT); + } #elif defined (FASYNC) - fcntl (filedesc, F_SETFL, DEVICE_OLD_SIGIO_FLAG (d) | FASYNC); + fcntl (filedesc, F_SETFL, fcntl (filedesc, F_GETFL, 0) | FASYNC); #elif defined (FIOSSAIOSTAT) { /* DG: Changed for HP-UX. HP-UX uses different IOCTLs for @@ -1003,8 +994,6 @@ #if defined (_CX_UX) /* #### Is this crap necessary? */ EMACS_UNBLOCK_SIGNAL (SIGIO); #endif - - d->sigio_enabled = 1; } static void @@ -1012,15 +1001,14 @@ { int filedesc = DEVICE_INFD (d); - /* prevent redundant ioctl()s, which may cause syslog messages - (e.g. on Solaris) */ - if (!d->sigio_enabled) - return; - #if defined (I_SETSIG) && !defined(HPUX10) - ioctl (filedesc, I_SETSIG, DEVICE_OLD_SIGIO_FLAG (d)); + { + int events=0; + ioctl (filedesc, I_GETSIG, &events); + ioctl (filedesc, I_SETSIG, events & ~S_INPUT); + } #elif defined (FASYNC) - fcntl (filedesc, F_SETFL, DEVICE_OLD_SIGIO_FLAG (d)); + fcntl (filedesc, F_SETFL, fcntl (filedesc, F_GETFL, 0) & ~FASYNC); #elif defined (FIOSSAIOSTAT) { /* DG: Changed for HP-UX. HP-UX uses different IOCTLs for @@ -1048,8 +1036,6 @@ ioctl (filedesc, FIOASYNC, &off); } #endif - - d->sigio_enabled = 0; } void diff -r 58424f6abf56 -r 11cf20601dec src/unexelf.c --- a/src/unexelf.c Mon Aug 13 10:22:10 2007 +0200 +++ b/src/unexelf.c Mon Aug 13 10:23:02 2007 +0200 @@ -420,7 +420,7 @@ #include #include -#if __GLIBC__ - 0 >= 6 +#if __GLIBC__ - 0 >= 2 # include /* get ElfW etc */ #endif diff -r 58424f6abf56 -r 11cf20601dec src/window.c --- a/src/window.c Mon Aug 13 10:22:10 2007 +0200 +++ b/src/window.c Mon Aug 13 10:23:02 2007 +0200 @@ -3070,7 +3070,8 @@ w->buffer = buffer; w->window_end_pos[CURRENT_DISP] = 0; - w->hscroll = 0;; + w->hscroll = 0; + w->modeline_hscroll = 0; Fset_marker (w->pointm[CURRENT_DISP], make_int (BUF_PT (XBUFFER (buffer))), buffer); diff -r 58424f6abf56 -r 11cf20601dec version.sh --- a/version.sh Mon Aug 13 10:22:10 2007 +0200 +++ b/version.sh Mon Aug 13 10:23:02 2007 +0200 @@ -1,5 +1,5 @@ #!/bin/sh emacs_major_version=20 emacs_minor_version=5 -emacs_beta_version=27 -xemacs_codename="Kinder" +emacs_beta_version=28 +xemacs_codename="LaMancha"