# HG changeset patch # User Ben Wing # Date 1265450506 21600 # Node ID 8f0cf4fd3d2c193e7be64aabba4e93a71830c81e # Parent d2ec55325515c2656327f7d1af13e8244587d3b0# Parent 4cfb6aeb989da4aa64ced3ef6c551258e8cfbfeb Automatic merge diff -r d2ec55325515 -r 8f0cf4fd3d2c ChangeLog --- a/ChangeLog Sat Feb 06 03:59:18 2010 -0600 +++ b/ChangeLog Sat Feb 06 04:01:46 2010 -0600 @@ -1,3 +1,55 @@ +2010-01-31 Ben Wing + + * configure.ac (TAB): + Say "This Xft feature" rather than just "This feature" to make it + possible to more safely filter out the warning in my `runcc' + script without the possibility of filtering out genuinely + important warnings. + * configure: Regenerate. + +2010-01-23 Ben Wing + + * configure: + * configure.ac (XE_COMPLEX_ARG): + Expand the help for --with-debug to describe more specifically what + exactly gets turned on. Expand the help for --with-error-checking + to describe all the possible arguments, including `all', `none', + `noFOO', multiple arguments, etc. + + Change so that `--with-error-checking' is the same as + `--with-error-checking=all'. Currently, `--with-error-checking' has + no effect at all! It just means "leave all error-checking for + specific classes to their default values", which are "maybe", and + get converted to "yes" or "no" depending on whether we are running + a beta XEmacs. + +2010-01-24 Ben Wing + + * configure: Rebuild. + +2010-01-24 Ben Wing + + * aclocal.m4 (XE_SHLIB_STUFF): + Use -export-all-symbols instead of -export-dynamic on PE targets + (Cygwin and MinGW). + + * configure.ac (XE_EXPAND_VARIABLE): + * configure.ac (TAB): + Create variable XEMACS_CC_GPP to check whether we're running g++. + Don't just check for an executable called `g++' -- it might be + called g++-4 or whatever. Instead, check for either named `g++*' + or claiming to be g++ when called with --version. Rewrite code do + use the variable. + + Add -fno-strict-aliasing to optimization flags when GCC and + optimized, and in all cases with g++, since under these circumstances + strict aliasing is otherwise assumed, and XEmacs can't easily be + made to respect its restrictions. + + * configure: Regenerate. + + + 2010-02-01 Ben Wing * configure: @@ -14,6 +66,26 @@ * configure: Regenerate, now we no longer look for rint(). +2010-01-20 Ben Wing + + * Makefile.in.in: + * Makefile.in.in (GENERATED_HEADERS): + * Makefile.in.in (.PHONY): + * Makefile.in.in (src/.gdbinit): + * configure: + * configure.ac (TAB): + etc/gdbinit.in has been moved to src/.gdbinit.in.in. Reflect + this -- generate src/.gdbinit.in from src/.gdbinit.in.in, and + use the normal mechanism for doing so instead of copying it + specially. + + Add target for `config-changed' and pass down to `src'. + Move some PHONY declarations to just before the actual targets. + +2010-01-16 Aidan Kehoe + + * configure: Regenerate, now we no longer look for rint(). + 2010-01-13 Jerry James * configure.ac: Update comment about Cygwin and pdump. diff -r d2ec55325515 -r 8f0cf4fd3d2c Makefile.in.in --- a/Makefile.in.in Sat Feb 06 03:59:18 2010 -0600 +++ b/Makefile.in.in Sat Feb 06 04:01:46 2010 -0600 @@ -1,4 +1,4 @@ -## Copyright (C) 2003, 2005 Ben Wing. +## Copyright (C) 2003, 2005, 2010 Ben Wing. ## DIST: This is the distribution Makefile for XEmacs. configure can ## DIST: make most of the changes to this file you might want, so try @@ -243,7 +243,7 @@ ## instead, we have written out explicit code in the `install' targets. COPYDIR = ${srcdir}/etc ${srcdir}/lisp COPYDESTS = ${etcdir} ${lispdir} -GENERATED_HEADERS = src/paths.h src/Emacs.ad.h src/config.h lwlib/config.h src/sheap-adjust.h src/xemacs.def etc/PROBLEMS +GENERATED_HEADERS = src/paths.h src/Emacs.ad.h src/config.h lwlib/config.h src/sheap-adjust.h src/xemacs.def etc/PROBLEMS src/.gdbinit ## MAKE_SUBDIR will always be of the form lib-src ... src, where ## `...' includes various other directories that may be inserted by @@ -282,9 +282,15 @@ depend ${srcdir}/src/depend: cd ./src && $(MAKE) $(RECURSIVE_MAKE_ARGS) depend +.PHONY: config-changed +config-changed: + cd ./src && $(MAKE) $(RECURSIVE_MAKE_ARGS) $@ + +.PHONY: check check: cd ./src && $(MAKE) $(RECURSIVE_MAKE_ARGS) $@ +.PHONY: check-features check-features: all cd ./src && $(MAKE) $(RECURSIVE_MAKE_ARGS) $@ @@ -355,6 +361,9 @@ src/xemacs.def: $(srcdir)/src/xemacs.def.in.in ./config.status && touch $@ +src/.gdbinit: ${srcdir}/src/.gdbinit.in.in + ./config.status && touch $@ + etc/PROBLEMS: $(srcdir)/PROBLEMS cp $^ $@ @@ -367,7 +376,6 @@ ## On AIX, use tar xBf. .PHONY: install-only install install-arch-dep install-arch-indep gzip.el mkdir -.PHONY: check check-features ## We delete each directory in ${COPYDESTS} before we copy into it; ## that way, we can reinstall over directories that have been put in diff -r d2ec55325515 -r 8f0cf4fd3d2c aclocal.m4 --- a/aclocal.m4 Sat Feb 06 03:59:18 2010 -0600 +++ b/aclocal.m4 Sat Feb 06 04:01:46 2010 -0600 @@ -513,10 +513,17 @@ dnl usually need to be prefix with ${wl} or some other such thing. dnl -if test "$xe_gnu_ld" = yes; then - if test "$ld_shlibs" = yes; then +if test "$xe_gnu_ld" = yes -a "$ld_shlibs" = yes; then + case "$xehost_os" in + *cygwin* | *mingw* ) + # -export-all-symbols is the PE equivalent of ELF-specific -export-dynamic + ld_dynamic_link_flags="${wl}-export-all-symbols" + ;; + + *) ld_dynamic_link_flags="${wl}-export-dynamic" - fi + ;; + esac fi if test -z "$ld_dynamic_link_flags"; then diff -r d2ec55325515 -r 8f0cf4fd3d2c configure --- a/configure Sat Feb 06 03:59:18 2010 -0600 +++ b/configure Sat Feb 06 04:01:46 2010 -0600 @@ -1952,13 +1952,37 @@ Debugging options ----------------- - --with-debug Enable additional debugging information. No time - cost. - --with-error-checking=TESTS + --with-debug Enable additional debugging information. No + noticeable time cost (unlike + `--with-error-checking'). This turns adds `-g' to + the compiler options so that debug information is + compiled into the XEmacs executable. It also turns + on assert checks in the source code (i.e. same as + `--with-assertions'); enables Lisp commands for + determining detailed memory usage statistics (same + as `--with-memory-usage-stats'); adds various Lisp + variables and functions that allow one to display + internal structures, show the internal workings of + certain subsystems, and exit to the debugger; causes + Lisp errors during building to exit to the debugger + or dump core; and adds debugging-related C functions + meant to be called from a debugger. + --with-error-checking=CLASS|all|none Compile with internal error-checking added. Causes - noticeable loss of speed. Valid TESTS are - `byte_code', `display', `extents', `gc', `glyphs', - `malloc', `structures' `text', `types'. + noticeable loss of speed. Valid classes are + `byte_code', `display' (redisplay), `extents', `gc' + (garbage collection), `glyphs', `malloc' (memory + allocation), `structures' (C structures), `text' + (text handling and conversion), `types' (correct + Lisp-object type for type-specific operations). + `all' or `none' can be given to set all or no + classes, respectively. Any of the classes can be + prefixed with `no' to turn the class off. A + comma-separated list of classes can also be given. + For example, `all,nogc' turns on all but + garbage-collection-related checking. Omitting any + argument or specifying just `yes' is the same as + `all'. --with-assertions Compile in runtime assertions. --with-memory-usage-stats Enable LISP memory usage API. @@ -5152,6 +5176,9 @@ withval="$with_debug" fi; +if test "$with_error_checking" = "yes"; then + with_error_checking=all +fi _error_checking_notfirst="" _error_checking_byte_code_default="" _error_checking_display_default="" @@ -8935,6 +8962,24 @@ : ${XEMACS_CC:="$CC"} +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking whether we are using g++" >&5 +$as_echo_n "checking whether we are using g++... " >&6; } + +XEMACS_CC_GPP=no +case "$XEMACS_CC" in + *g++* ) XEMACS_CC_GPP=yes ;; +esac + +if test "$XEMACS_CC_GPP" = "no" -a "$GCC" = "yes"; then + case "`$XEMACS_CC --version`" in + g++* ) XEMACS_CC_GPP=yes ;; + esac +fi + +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $XEMACS_CC_GPP" >&5 +$as_echo "$XEMACS_CC_GPP" >&6; } + + test -n "$CPP" -a -d "$CPP" && CPP= test -n "$NON_GNU_CPP" -a "$GCC" != "yes" -a -z "$CPP" && CPP="$NON_GNU_CPP" @@ -9463,26 +9508,15 @@ xemacs_cc_cc_mismatch=no if test "$CC" != "$XEMACS_CC"; then - case "$XEMACS_CC" in - *g++* ) - if test "$GCC" != "yes"; then - { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: CC and g++ are mismatched; XE_CFLAGS may be wrong" >&5 + if test "$XEMACS_CC_GPP" = "yes" -a "$GCC" != "yes"; then + { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: CC and g++ are mismatched; XE_CFLAGS may be wrong" >&5 $as_echo "$as_me: WARNING: CC and g++ are mismatched; XE_CFLAGS may be wrong" >&2;} - xemacs_cc_cc_mismatch=yes - fi - ;; - esac - if test -n "$GCC"; then - case $XEMACS_CC in - *g++* ) - # it's as expected, do nothing - ;; - * ) - { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: gcc and XEMACS_CC are mismatched; XE_CFLAGS may be wrong" >&5 + xemacs_cc_cc_mismatch=yes + fi + if test -n "$GCC" -a "$XEMACS_CC_GPP" != "yes" ; then + { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: gcc and XEMACS_CC are mismatched; XE_CFLAGS may be wrong" >&5 $as_echo "$as_me: WARNING: gcc and XEMACS_CC are mismatched; XE_CFLAGS may be wrong" >&2;} - xemacs_cc_cc_mismatch=yes - ;; - esac + xemacs_cc_cc_mismatch=yes fi fi @@ -9505,10 +9539,10 @@ { $as_echo "$as_me:${as_lineno-$LINENO}: checking for preferred optimization flags" >&5 $as_echo_n "checking for preferred optimization flags... " >&6; } -if test "$with_optimization" = "yes" ; then - if test "$cflags_optimization_specified" = "no"; then +if test "$cflags_optimization_specified" = "no"; then + if test "$with_optimization" = "yes" ; then if test "$GCC" = "yes"; then - with_cflags_optimization="-O3" + with_cflags_optimization="-O3 -fno-strict-aliasing" elif test "$__SUNPRO_C" = "yes"; then case "$opsys" in sol2 ) with_cflags_optimization="-xO4" ;; @@ -9521,9 +9555,9 @@ with_cflags_optimization="-O3 -Ob2" else with_cflags_optimization="-O" ; fi - fi -else - with_cflags_optimization= + elif test "$XEMACS_CC_GPP" = "yes" ; then + with_cflags_optimization="-fno-strict-aliasing" + fi fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: ${with_cflags_optimization}" >&5 @@ -9566,7 +9600,7 @@ test "$__GCC" -ge 3 && with_cflags_warning="$with_cflags_warning -Wpacked" test "$have_glibc" != "yes" && \ with_cflags_warning="$with_cflags_warning -Wpointer-arith" - if test "$with_xemacs_compiler" = "g++"; then + if test "$XEMACS_CC_GPP" = "yes"; then xe_cflags_warning="$with_cflags_warning -Weffc++" elif test "$__GCC" -ge 3; then xe_cflags_warning="$with_cflags_warning -Wunused-parameter" @@ -13909,7 +13943,7 @@ -if test "$with_xemacs_compiler" = "g++"; then +if test "$XEMACS_CC_GPP" = "yes"; then LIBSTDCPP=-lstdc++ else LIBSTDCPP= @@ -14581,10 +14615,17 @@ fi # End of if cc_produces_so = no -if test "$xe_gnu_ld" = yes; then - if test "$ld_shlibs" = yes; then +if test "$xe_gnu_ld" = yes -a "$ld_shlibs" = yes; then + case "$xehost_os" in + *cygwin* | *mingw* ) + # -export-all-symbols is the PE equivalent of ELF-specific -export-dynamic + ld_dynamic_link_flags="${wl}-export-all-symbols" + ;; + + *) ld_dynamic_link_flags="${wl}-export-dynamic" - fi + ;; + esac fi if test -z "$ld_dynamic_link_flags"; then @@ -20315,7 +20356,7 @@ fi -internal_makefile_list="Makefile.in" +internal_makefile_list="Makefile.in src/.gdbinit.in" SUBDIR_MAKEFILES='' test -d lock || mkdir lock for dir in $MAKE_SUBDIR; do @@ -20362,10 +20403,6 @@ fi -if test -f "$srcdir/etc/gdbinit.in"; then - test "$verbose" = "yes" && echo "creating src/.gdbinit.in" - cp $srcdir/etc/gdbinit.in src/.gdbinit.in -fi if test -f "$srcdir/etc/dbxrc.in"; then test "$verbose" = "yes" && echo "creating src/.dbxrc.in" @@ -20673,41 +20710,41 @@ $as_echo "#define USE_SYSTEM_MALLOC 1" >>confdefs.h fi -test "$GCC" = "yes" && $as_echo "#define USE_GCC 1" >>confdefs.h - -test "$with_xemacs_compiler" = "g++" && $as_echo "#define USE_GPLUSPLUS 1" >>confdefs.h +test "$GCC" = "yes" && $as_echo "#define USE_GCC 1" >>confdefs.h + +test "$XEMACS_CC_GPP" = "yes" && $as_echo "#define USE_GPLUSPLUS 1" >>confdefs.h test "$with_external_widget" = "yes" && $as_echo "#define EXTERNAL_WIDGET 1" >>confdefs.h -test "$with_kkcc" = "yes" && $as_echo "#define USE_KKCC 1" >>confdefs.h - -test "$with_newgc" = "yes" && $as_echo "#define NEW_GC 1" >>confdefs.h - -test "$have_vdb_posix" = "yes" && $as_echo "#define VDB_POSIX 1" >>confdefs.h - -test "$have_vdb_fake" = "yes" && $as_echo "#define VDB_FAKE 1" >>confdefs.h - -test "$with_quick_build" = "yes" && $as_echo "#define QUICK_BUILD 1" >>confdefs.h - -test "$with_purify" = "yes" && $as_echo "#define PURIFY 1" >>confdefs.h - -test "$with_quantify" = "yes" && $as_echo "#define QUANTIFY 1" >>confdefs.h - -test "$with_valgrind" = "yes" && $as_echo "#define USE_VALGRIND 1" >>confdefs.h - -test "$with_pop" = "yes" && $as_echo "#define MAIL_USE_POP 1" >>confdefs.h - -test "$with_kerberos" = "yes" && $as_echo "#define KERBEROS 1" >>confdefs.h - -test "$with_hesiod" = "yes" && $as_echo "#define HESIOD 1" >>confdefs.h - -test "$with_union_type" = "yes" && $as_echo "#define USE_UNION_TYPE 1" >>confdefs.h - -test "$with_pdump" = "yes" && $as_echo "#define PDUMP 1" >>confdefs.h - -test "$with_dump_in_exec" = "yes" && $as_echo "#define DUMP_IN_EXEC 1" >>confdefs.h - -test "$with_ipv6_cname" = "yes" && $as_echo "#define IPV6_CANONICALIZE 1" >>confdefs.h +test "$with_kkcc" = "yes" && $as_echo "#define USE_KKCC 1" >>confdefs.h + +test "$with_newgc" = "yes" && $as_echo "#define NEW_GC 1" >>confdefs.h + +test "$have_vdb_posix" = "yes" && $as_echo "#define VDB_POSIX 1" >>confdefs.h + +test "$have_vdb_fake" = "yes" && $as_echo "#define VDB_FAKE 1" >>confdefs.h + +test "$with_quick_build" = "yes" && $as_echo "#define QUICK_BUILD 1" >>confdefs.h + +test "$with_purify" = "yes" && $as_echo "#define PURIFY 1" >>confdefs.h + +test "$with_quantify" = "yes" && $as_echo "#define QUANTIFY 1" >>confdefs.h + +test "$with_valgrind" = "yes" && $as_echo "#define USE_VALGRIND 1" >>confdefs.h + +test "$with_pop" = "yes" && $as_echo "#define MAIL_USE_POP 1" >>confdefs.h + +test "$with_kerberos" = "yes" && $as_echo "#define KERBEROS 1" >>confdefs.h + +test "$with_hesiod" = "yes" && $as_echo "#define HESIOD 1" >>confdefs.h + +test "$with_union_type" = "yes" && $as_echo "#define USE_UNION_TYPE 1" >>confdefs.h + +test "$with_pdump" = "yes" && $as_echo "#define PDUMP 1" >>confdefs.h + +test "$with_dump_in_exec" = "yes" && $as_echo "#define DUMP_IN_EXEC 1" >>confdefs.h + +test "$with_ipv6_cname" = "yes" && $as_echo "#define IPV6_CANONICALIZE 1" >>confdefs.h @@ -20832,7 +20869,7 @@ esac if test "$with_xft_menubars" = "yes"; then echo " - Using Xft to render antialiased fonts in menubars." - echo " WARNING: This feature will be replaced with a face." + echo " WARNING: This Xft feature will be replaced with a face." fi case "$with_scrollbars" in gtk ) echo " Using GTK scrollbars." ;; @@ -20861,12 +20898,12 @@ esac if test "$with_xft_tabs" = "yes"; then echo " - Using Xft to render antialiased fonts in tab controls." - echo " WARNING: This feature will be replaced with a face." + echo " WARNING: This Xft feature will be replaced with a face." fi if test "$with_xft_gauges" = "yes"; then echo " - Using Xft to render antialiased fonts in progress bars." - echo " WARNING: This feature will be replaced with a face." - echo " WARNING: This feature not yet implemented; setting ignored." + echo " WARNING: This Xft feature will be replaced with a face." + echo " WARNING: This Xft feature not yet implemented; setting ignored." fi if test "$with_dragndrop" = yes; then echo " Compiling in support for Drag'n'Drop (EXPERIMENTAL)." diff -r d2ec55325515 -r 8f0cf4fd3d2c configure.ac --- a/configure.ac Sat Feb 06 03:59:18 2010 -0600 +++ b/configure.ac Sat Feb 06 04:01:46 2010 -0600 @@ -970,14 +970,36 @@ dnl XE_HELP_SUBSECTION([Debugging options]) XE_MERGED_ARG([debug], - AS_HELP_STRING([--with-debug],[Enable additional debugging information. No time cost.]), + AS_HELP_STRING([--with-debug],[Enable additional debugging information. No noticeable time cost (unlike +`--with-error-checking'). This turns adds `-g' to the compiler options so that +debug information is compiled into the XEmacs executable. It also turns on +assert checks in the source code (i.e. same as `--with-assertions'); enables +Lisp commands for determining detailed memory usage statistics (same as +`--with-memory-usage-stats'); adds various Lisp variables and functions +that allow one to display internal structures, show the internal workings +of certain subsystems, and exit to the debugger; causes Lisp errors during +building to exit to the debugger or dump core; and adds debugging-related +C functions meant to be called from a debugger.]), [], []) -dnl Keep TESTS sorted to help with syncing doc to reality. +dnl If just --with-error-checking or --with-error-checking=yes is given, +dnl it should be the same as --with-error-checking=all. Currently it's +dnl the same as saying nothing at all. +if test "$with_error_checking" = "yes"; then + with_error_checking=all +fi XE_COMPLEX_ARG([error-checking], - AS_HELP_STRING([--with-error-checking=TESTS],[Compile with internal error-checking added. - Causes noticeable loss of speed. Valid TESTS - are `byte_code', `display', `extents', `gc', `glyphs', `malloc', `structures' `text', `types'.]), - [], [], + AS_HELP_STRING([--with-error-checking[=CLASS|all|none]],[Compile with internal error-checking added. +Causes noticeable loss of speed. Valid classes are `byte_code', `display' +(redisplay), `extents', `gc' (garbage collection), `glyphs', `malloc' +(memory allocation), `structures' (C structures), `text' (text handling and +conversion), `types' (correct Lisp-object type for type-specific +operations). `all' or `none' can be given to set all or no classes, +respectively. Any of the classes can be prefixed with `no' to turn the +class off. A comma-separated list of classes can also be given. For +example, `all,nogc' turns on all but garbage-collection-related checking. +Omitting any argument or specifying just `yes' is the same as `all'.]), + [], [], +dnl Keep TESTS sorted to help with syncing doc to reality. [XE_COMPLEX_OPTION([byte_code],[""]), XE_COMPLEX_OPTION([display],[""]), XE_COMPLEX_OPTION([extents],[""]), @@ -1591,6 +1613,31 @@ test -n "$with_xemacs_compiler" && XEMACS_CC="$with_xemacs_compiler" : ${XEMACS_CC:="$CC"} +dnl Are we using g++? + +AC_MSG_CHECKING(whether we are using g++) + +dnl Is it named g++*? +XEMACS_CC_GPP=no +case "$XEMACS_CC" in + *g++* ) XEMACS_CC_GPP=yes ;; +esac + +dnl If it's known to be in the GCC family, does it claim to be g++? We don't +dnl run this test unless we know it's GCC-like, because not all compilers +dnl accept --version. +dnl +dnl It's not clear we need both tests, but it doesn't hurt. g++ might not +dnl have always output "g++" as the first thing in its version string, and +dnl might not always in the future. +if test "$XEMACS_CC_GPP" = "no" -a "$GCC" = "yes"; then + case "`$XEMACS_CC --version`" in + g++* ) XEMACS_CC_GPP=yes ;; + esac +fi + +AC_MSG_RESULT($XEMACS_CC_GPP) + dnl Figure out what C preprocessor to use. dnl On Sun systems, people sometimes set up the variable CPP @@ -1877,24 +1924,13 @@ xemacs_cc_cc_mismatch=no if test "$CC" != "$XEMACS_CC"; then - case "$XEMACS_CC" in - *g++* ) - if test "$GCC" != "yes"; then - AC_MSG_WARN([CC and g++ are mismatched; XE_CFLAGS may be wrong]) - xemacs_cc_cc_mismatch=yes - fi - ;; - esac - if test -n "$GCC"; then - case $XEMACS_CC in - *g++* ) - # it's as expected, do nothing - ;; - * ) - AC_MSG_WARN([gcc and XEMACS_CC are mismatched; XE_CFLAGS may be wrong]) - xemacs_cc_cc_mismatch=yes - ;; - esac + if test "$XEMACS_CC_GPP" = "yes" -a "$GCC" != "yes"; then + AC_MSG_WARN([CC and g++ are mismatched; XE_CFLAGS may be wrong]) + xemacs_cc_cc_mismatch=yes + fi + if test -n "$GCC" -a "$XEMACS_CC_GPP" != "yes" ; then + AC_MSG_WARN([gcc and XEMACS_CC are mismatched; XE_CFLAGS may be wrong]) + xemacs_cc_cc_mismatch=yes fi dnl #### Add other detectable mismatches here. fi @@ -1919,12 +1955,17 @@ fi AC_MSG_CHECKING([for preferred optimization flags]) -if test "$with_optimization" = "yes" ; then - if test "$cflags_optimization_specified" = "no"; then +if test "$cflags_optimization_specified" = "no"; then + if test "$with_optimization" = "yes" ; then dnl Following values of cflags_optimization are known to work well. dnl Should we take debugging options into consideration? if test "$GCC" = "yes"; then - with_cflags_optimization="-O3" + dnl If you want to remove the -fno-strict-aliasing, then you will have + dnl to rewrite all cases of "type-punning" expressions like + dnl (* (foo *) (&bar)), which occur all over XEmacs, by making `bar' a + dnl union (use an anonymous union if you're willing to put in an ifdef + dnl for anon-union support, falling back to the type-punned expression. + with_cflags_optimization="-O3 -fno-strict-aliasing" elif test "$__SUNPRO_C" = "yes"; then case "$opsys" in sol2 ) with_cflags_optimization="-xO4" ;; @@ -1940,9 +1981,12 @@ else with_cflags_optimization="-O" ;dnl The only POSIX-approved flag fi + elif test "$XEMACS_CC_GPP" = "yes" ; then + dnl Fuck me! g++ v4 turns on strict aliasing by default, even without + dnl optimization. See comment above about why we can't have strict + dnl aliasing currently in XEmacs. + with_cflags_optimization="-fno-strict-aliasing" fi -else - with_cflags_optimization= fi AC_MSG_RESULT([${with_cflags_optimization}]) @@ -2005,7 +2049,7 @@ dnl But gcc warns about -Weffc++ in C compiles. dnl With g++, there is no effective way to use -Wunused-parameter without dnl some very ugly code changes. - if test "$with_xemacs_compiler" = "g++"; then + if test "$XEMACS_CC_GPP" = "yes"; then xe_cflags_warning="$with_cflags_warning -Weffc++" elif test "$__GCC" -ge 3; then xe_cflags_warning="$with_cflags_warning -Wunused-parameter" @@ -3312,7 +3356,7 @@ dnl If g++ is used, we have to explicitly link modules with -lstdc++ on Cygwin dnl to avoid undefined symbol errors. This will never hurt, so just do it on dnl all platforms in case others have the same brain damage. -if test "$with_xemacs_compiler" = "g++"; then +if test "$XEMACS_CC_GPP" = "yes"; then LIBSTDCPP=-lstdc++ else LIBSTDCPP= @@ -5236,7 +5280,7 @@ dnl Compute lists of Makefiles and subdirs AC_SUBST(SRC_SUBDIR_DEPS) -internal_makefile_list="Makefile.in" +internal_makefile_list="Makefile.in src/.gdbinit.in" SUBDIR_MAKEFILES='' test -d lock || mkdir lock for dir in $MAKE_SUBDIR; do @@ -5286,11 +5330,8 @@ dnl Unlike TAGS, debugger init files depend on config.h. dnl Regenerate them locally on every configure. -dnl Create a .gdbinit useful for debugging XEmacs -if test -f "$srcdir/etc/gdbinit.in"; then - test "$verbose" = "yes" && echo "creating src/.gdbinit.in" - cp $srcdir/etc/gdbinit.in src/.gdbinit.in -fi +dnl .gdbinit is now handled like xemacs.def or other src files, and +dnl its source is in src/.gdbinit.in.in. dnl Create a .dbxrc useful for debugging XEmacs if test -f "$srcdir/etc/dbxrc.in"; then @@ -5490,24 +5531,24 @@ elif test "$with_debug_malloc" = "yes"; then AC_DEFINE(USE_DEBUG_MALLOC) AC_DEFINE(USE_SYSTEM_MALLOC) fi -test "$GCC" = "yes" && AC_DEFINE(USE_GCC) -test "$with_xemacs_compiler" = "g++" && AC_DEFINE(USE_GPLUSPLUS) +test "$GCC" = "yes" && AC_DEFINE(USE_GCC) +test "$XEMACS_CC_GPP" = "yes" && AC_DEFINE(USE_GPLUSPLUS) test "$with_external_widget" = "yes" && AC_DEFINE(EXTERNAL_WIDGET) -test "$with_kkcc" = "yes" && AC_DEFINE(USE_KKCC) -test "$with_newgc" = "yes" && AC_DEFINE(NEW_GC) -test "$have_vdb_posix" = "yes" && AC_DEFINE(VDB_POSIX) -test "$have_vdb_fake" = "yes" && AC_DEFINE(VDB_FAKE) -test "$with_quick_build" = "yes" && AC_DEFINE(QUICK_BUILD) -test "$with_purify" = "yes" && AC_DEFINE(PURIFY) -test "$with_quantify" = "yes" && AC_DEFINE(QUANTIFY) -test "$with_valgrind" = "yes" && AC_DEFINE(USE_VALGRIND) -test "$with_pop" = "yes" && AC_DEFINE(MAIL_USE_POP) -test "$with_kerberos" = "yes" && AC_DEFINE(KERBEROS) -test "$with_hesiod" = "yes" && AC_DEFINE(HESIOD) -test "$with_union_type" = "yes" && AC_DEFINE(USE_UNION_TYPE) -test "$with_pdump" = "yes" && AC_DEFINE(PDUMP) -test "$with_dump_in_exec" = "yes" && AC_DEFINE(DUMP_IN_EXEC) -test "$with_ipv6_cname" = "yes" && AC_DEFINE(IPV6_CANONICALIZE) +test "$with_kkcc" = "yes" && AC_DEFINE(USE_KKCC) +test "$with_newgc" = "yes" && AC_DEFINE(NEW_GC) +test "$have_vdb_posix" = "yes" && AC_DEFINE(VDB_POSIX) +test "$have_vdb_fake" = "yes" && AC_DEFINE(VDB_FAKE) +test "$with_quick_build" = "yes" && AC_DEFINE(QUICK_BUILD) +test "$with_purify" = "yes" && AC_DEFINE(PURIFY) +test "$with_quantify" = "yes" && AC_DEFINE(QUANTIFY) +test "$with_valgrind" = "yes" && AC_DEFINE(USE_VALGRIND) +test "$with_pop" = "yes" && AC_DEFINE(MAIL_USE_POP) +test "$with_kerberos" = "yes" && AC_DEFINE(KERBEROS) +test "$with_hesiod" = "yes" && AC_DEFINE(HESIOD) +test "$with_union_type" = "yes" && AC_DEFINE(USE_UNION_TYPE) +test "$with_pdump" = "yes" && AC_DEFINE(PDUMP) +test "$with_dump_in_exec" = "yes" && AC_DEFINE(DUMP_IN_EXEC) +test "$with_ipv6_cname" = "yes" && AC_DEFINE(IPV6_CANONICALIZE) @@ -5640,7 +5681,7 @@ esac if test "$with_xft_menubars" = "yes"; then echo " - Using Xft to render antialiased fonts in menubars." - echo " WARNING: This feature will be replaced with a face." + echo " WARNING: This Xft feature will be replaced with a face." fi case "$with_scrollbars" in gtk ) echo " Using GTK scrollbars." ;; @@ -5669,12 +5710,12 @@ esac if test "$with_xft_tabs" = "yes"; then echo " - Using Xft to render antialiased fonts in tab controls." - echo " WARNING: This feature will be replaced with a face." + echo " WARNING: This Xft feature will be replaced with a face." fi if test "$with_xft_gauges" = "yes"; then echo " - Using Xft to render antialiased fonts in progress bars." - echo " WARNING: This feature will be replaced with a face." - echo " WARNING: This feature not yet implemented; setting ignored." + echo " WARNING: This Xft feature will be replaced with a face." + echo " WARNING: This Xft feature not yet implemented; setting ignored." fi if test "$with_dragndrop" = yes; then echo " Compiling in support for Drag'n'Drop (EXPERIMENTAL)." diff -r d2ec55325515 -r 8f0cf4fd3d2c etc/gdbinit.in --- a/etc/gdbinit.in Sat Feb 06 03:59:18 2010 -0600 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,542 +0,0 @@ -## gdb init file for XEmacs -*- ksh -*- -## This is the source for src/.gdbinit. Edit it, and rerun configure. -## (Running config.status is not enough.) -## The generated file depends on src/config.h (currently only in one place). - -## To insert comments that will remain in the generated file, we use the -## imake XCOMM convention. Lines beginning with "XCOMM " exactly (no -## leading whitespace, one trailing ASCII space, case sensitive) will be -## transformed to gdb command file comments in the generated file. - -XCOMM gdb init file for XEmacs -XCOMM AUTOMATICALLY GENERATED FROM etc/gdbinit.in BY configure -- DO NOT EDIT. -XCOMM See etc/gdbinit.in for licensing information and usage hints. -XCOMM Copyright (C) 1998 Free Software Foundation, 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., 51 Franklin Street, Fifth Floor, -## Boston, MA 02110-1301 USA - -## Author: Martin Buchholz - -## Other contributors you could ask for help: Ivan Golubev, Jerry James, -## Stephen Turnbull. - -## Some useful commands for debugging emacs with gdb 4.16 or better. -## -## Since this file is called `.gdbinit', it will be read by gdb -## automatically when gdb is run in the build directory, which is where -## developers usually debug their xemacs. You can also source this -## file from your ~/.gdbinit, if you like. -## -## Configure xemacs with --debug, and compile with -g. -## -## See also the question of the XEmacs FAQ, titled -## "How to Debug an XEmacs problem with a debugger". -## -## This can be used to debug XEmacs no matter how the following are -## specified: - -## USE_UNION_TYPE - -## (the above all have configure equivalents) - -## Some functions defined here require a running process, but most -## don't. Considerable effort has been expended to this end. - -## See the dbg_ C support code in src/alloc.c that allows the functions -## defined in this file to work correctly. - -#define NOT_C_CODE -#include "config.h" - -set print union off -set print pretty off - -#ifdef VDB_POSIX -handle SIGSEGV SIGBUS nostop noprint -#endif - -set $Lisp_Type_Int = -2 -set $Lisp_Type_Record = 0 -set $Lisp_Type_Char = 2 - -define decode_object - set $obj = (unsigned long) $arg0 - if $obj & 1 - ## It's an int - set $val = $obj >> 1 - set $type = $Lisp_Type_Int - else - set $type = $obj & dbg_typemask - if $type == $Lisp_Type_Char - set $val = ($obj & dbg_valmask) >> dbg_gctypebits - else - ## It's a record pointer - set $val = $obj - end - end - - if $type == $Lisp_Type_Record - set $lheader = ((struct lrecord_header *) $val) - set $lrecord_type = ($lheader->type) - set $imp = ((struct lrecord_implementation *) lrecord_implementations_table[(int) $lrecord_type]) - else - set $lrecord_type = -1 - set $lheader = -1 - set $imp = -1 - end -end - -document decode_object -Usage: decode_object lisp_object -Extract implementation information from a Lisp Object. -Defines variables $val, $type and $imp. -end - -define xint -decode_object $arg0 -print ((long) $val) -end - -define xtype - decode_object $arg0 - if $type == $Lisp_Type_Int - echo int\n - else - if $type == $Lisp_Type_Char - echo char\n - else - printf "record type: %s\n", $imp->name - end - end -end - -document xtype -Usage: xtype lisp_object -Print the Lisp type of a lisp object. -end - -define lisp-shadows - run -batch -vanilla -f list-load-path-shadows -end - -document lisp-shadows -Usage: lisp-shadows -Run xemacs to check for lisp shadows -end - -define environment-to-run-temacs - unset env EMACSLOADPATH - set env EMACSBOOTSTRAPLOADPATH=../lisp/:.. - set env EMACSBOOTSTRAPMODULEPATH=../modules/:.. -end - -define run-temacs - environment-to-run-temacs - run -nd -batch -l ../lisp/loadup.el run-temacs -q -end - -document run-temacs -Usage: run-temacs -Run temacs interactively, like xemacs. -Use this with debugging tools (like purify) that cannot deal with dumping, -or when temacs builds successfully, but xemacs does not. -end - -define check-xemacs - run -batch -l ../tests/automated/test-harness.el -f batch-test-emacs ../tests/automated -end - -document check-xemacs -Usage: check-xemacs -Run the test suite. Equivalent to 'make check'. -end - -define check-temacs - environment-to-run-temacs - run -nd -batch -l ../lisp/loadup.el run-temacs -q -batch -l ../tests/automated/test-harness.el -f batch-test-emacs ../tests/automated -end - -document check-temacs -Usage: check-temacs -Run the test suite on temacs. Equivalent to 'make check-temacs'. -Use this with debugging tools (like purify) that cannot deal with dumping, -or when temacs builds successfully, but xemacs does not. -end - -define update-elc - environment-to-run-temacs - run -nd -batch -l ../lisp/update-elc.el -end - -document update-elc -Usage: update-elc -Run the core lisp byte compilation part of the build procedure. -Use when debugging temacs, not xemacs! -Use this when temacs builds successfully, but xemacs does not. -end - -define dmp - environment-to-run-temacs - run -nd -batch -l ../lisp/loadup.el dump -end - -document dmp -Usage: dmp -Run the dumping part of the build procedure. -Use when debugging temacs, not xemacs! -Use this when temacs builds successfully, but xemacs does not. -end - -define ldp - printf "%s", "Lisp => " - call debug_print($arg0) -end - -document ldp -Usage: ldp lisp_object -Print a Lisp Object value using the Lisp printer. -Requires a running xemacs process. -end - -define lbt -call debug_backtrace() -end - -document lbt -Usage: lbt -Print the current Lisp stack trace. -Requires a running xemacs process. -end - - -define leval -ldp Feval(Fcar(Fread_from_string(build_string($arg0),Qnil,Qnil))) -end - -document leval -Usage: leval "SEXP" -Eval a lisp expression. -Requires a running xemacs process. - -Example: -(gdb) leval "(+ 1 2)" -Lisp ==> 3 -end - - -define wtype -print $arg0->core.widget_class->core_class.class_name -end - -define xtname -print XrmQuarkToString(((Object)($arg0))->object.xrm_name) -end - -## GDB's command language makes you want to ... - -define pptype - set $type_ptr = ($arg0 *) $val - print $type_ptr - print *$type_ptr -end - -define pstructtype - set $type_ptr = (struct $arg0 *) $val - print $type_ptr - print *$type_ptr -end - -define pobj - decode_object $arg0 - if $type == $Lisp_Type_Int - printf "Integer: %d\n", $val - else - if $type == $Lisp_Type_Char - if $val > 32 && $val < 128 - printf "Char: %c\n", $val - else - printf "Char: %d\n", $val - end - else - if $lrecord_type == lrecord_type_string - pptype Lisp_String - else - if $lrecord_type == lrecord_type_cons - pptype Lisp_Cons - else - if $lrecord_type == lrecord_type_symbol - pptype Lisp_Symbol - printf "Symbol name: %s\n", ((Lisp_String *)$type_ptr->name)->data_ - else - if $lrecord_type == lrecord_type_vector - pptype Lisp_Vector - printf "Vector of length %d\n", $type_ptr->size - ##print *($type_ptr->data) @ $type_ptr->size - else - if $lrecord_type == lrecord_type_bit_vector - pptype Lisp_Bit_Vector - else - if $lrecord_type == lrecord_type_buffer - pstructtype buffer - else - if $lrecord_type == lrecord_type_char_table - pptype Lisp_Char_Table - else - if $lrecord_type == lrecord_type_char_table_entry - pptype Lisp_Char_Table_Entry - else - if $lrecord_type == lrecord_type_charset - pptype Lisp_Charset - else - if $lrecord_type == lrecord_type_coding_system - pptype Lisp_Coding_System - else - if $lrecord_type == lrecord_type_color_instance - pptype Lisp_Color_Instance - else - if $lrecord_type == lrecord_type_command_builder - pptype command_builder - else - if $lrecord_type == lrecord_type_compiled_function - pptype Lisp_Compiled_Function - else - if $lrecord_type == lrecord_type_console - pstructtype console - else - if $lrecord_type == lrecord_type_database - pptype Lisp_Database - else - if $lrecord_type == lrecord_type_device - pstructtype device - else - if $lrecord_type == lrecord_type_event - pptype Lisp_Event - else - if $lrecord_type == lrecord_type_extent - pstructtype extent - else - if $lrecord_type == lrecord_type_extent_auxiliary - pstructtype extent_auxiliary - else - if $lrecord_type == lrecord_type_extent_info - pstructtype extent_info - else - if $lrecord_type == lrecord_type_face - pptype Lisp_Face - else - if $lrecord_type == lrecord_type_float - pptype Lisp_Float - else - if $lrecord_type == lrecord_type_font_instance - pptype Lisp_Font_Instance - else - if $lrecord_type == lrecord_type_frame - pstructtype frame - else - if $lrecord_type == lrecord_type_glyph - pptype Lisp_Glyph - else - if $lrecord_type == lrecord_type_gui_item - pptype Lisp_Gui_Item - else - if $lrecord_type == lrecord_type_hash_table - pptype Lisp_Hash_Table - else - if $lrecord_type == lrecord_type_image_instance - pptype Lisp_Image_Instance - else - if $lrecord_type == lrecord_type_keymap - pptype Lisp_Keymap - else - if $lrecord_type == lrecord_type_lcrecord_list - pstructtype lcrecord_list - else - if $lrecord_type == lrecord_type_ldap - pptype Lisp_LDAP - else - if $lrecord_type == lrecord_type_lstream - pstructtype lstream - else - if $lrecord_type == lrecord_type_marker - pptype Lisp_Marker - else - if $lrecord_type == lrecord_type_opaque - pptype Lisp_Opaque - else - if $lrecord_type == lrecord_type_opaque_ptr - pptype Lisp_Opaque_Ptr - else - if $lrecord_type == lrecord_type_popup_data - pptype popup_data - else - if $lrecord_type == lrecord_type_process - pptype Lisp_Process - else - if $lrecord_type == lrecord_type_range_table - pptype Lisp_Range_Table - else - if $lrecord_type == lrecord_type_specifier - pptype Lisp_Specifier - else - if $lrecord_type == lrecord_type_subr - pptype Lisp_Subr - else - if $lrecord_type == lrecord_type_symbol_value_buffer_local - pstructtype symbol_value_buffer_local - else - if $lrecord_type == lrecord_type_symbol_value_forward - pstructtype symbol_value_forward - else - if $lrecord_type == lrecord_type_symbol_value_lisp_magic - pstructtype symbol_value_lisp_magic - else - if $lrecord_type == lrecord_type_symbol_value_varalias - pstructtype symbol_value_varalias - else - if $lrecord_type == lrecord_type_timeout - pptype Lisp_Timeout - else - if $lrecord_type == lrecord_type_toolbar_button - pstructtype toolbar_button - else - if $lrecord_type == lrecord_type_tooltalk_message - pptype Lisp_Tooltalk_Message - else - if $lrecord_type == lrecord_type_tooltalk_pattern - pptype Lisp_Tooltalk_Pattern - else - if $lrecord_type == lrecord_type_weak_list - pstructtype weak_list - else - if $lrecord_type == lrecord_type_window - pstructtype window - else - if $lrecord_type == lrecord_type_window_configuration - pstructtype window_config - else - if $lrecord_type == lrecord_type_fc_pattern - pstructtype fc_pattern - else - if $lrecord_type == lrecord_type_fc_config - pstructtype fc_config - else - echo Unknown Lisp Object type\n - print $arg0 - ## Barf, gag, retch - end - end - end - end - end - end - end - end - end - end - end - end - end - end - end - end - end - end - end - ## Repeat after me... gdb sux, gdb sux, gdb sux... - end - end - end - end - end - end - end - end - end - end - end - end - end - end - end - end - end - end - ## Are we having fun yet?? - end - end - end - end - end - end - end - end - end - end - end - end - end - end - end - end - end - end -end - -document pobj -Usage: pobj lisp_object -Print the internal C representation of a Lisp Object. -end - -## ------------------------------------------------------------- -## functions to test the debugging support itself. -## If you change this file, make sure the following still work... -## ------------------------------------------------------------- -define test_xtype - printf "Vemacs_major_version: " - xtype Vemacs_major_version - printf "Vhelp_char: " - xtype Vhelp_char - printf "Qnil: " - xtype Qnil - printf "Qunbound: " - xtype Qunbound - printf "Vobarray: " - xtype Vobarray - printf "Vall_weak_lists: " - xtype Vall_weak_lists - printf "Vxemacs_codename: " - xtype Vxemacs_codename -end - -define test_pobj - printf "Vemacs_major_version: " - pobj Vemacs_major_version - printf "Vhelp_char: " - pobj Vhelp_char - printf "Qnil: " - pobj Qnil - printf "Qunbound: " - pobj Qunbound - printf "Vobarray: " - pobj Vobarray - printf "Vall_weak_lists: " - pobj Vall_weak_lists - printf "Vxemacs_codename: " - pobj Vxemacs_codename -end - diff -r d2ec55325515 -r 8f0cf4fd3d2c lib-src/ChangeLog --- a/lib-src/ChangeLog Sat Feb 06 03:59:18 2010 -0600 +++ b/lib-src/ChangeLog Sat Feb 06 04:01:46 2010 -0600 @@ -1,3 +1,15 @@ +2010-01-26 Ben Wing + + * make-msgfile.lex: Vague hacking on this file, insert a comment + about what should be done if we ever want this to work. + +2010-01-24 Ben Wing + + * fakemail.c (args_size): + * fakemail.c (parse_header): + * ootags.c (C_entries): + Fix warnings about possible use of uninitialized vars. + 2010-02-01 Vin Shelton * make-mswin-unicode.pl: Add description of override. diff -r d2ec55325515 -r 8f0cf4fd3d2c lib-src/fakemail.c --- a/lib-src/fakemail.c Sat Feb 06 03:59:18 2010 -0600 +++ b/lib-src/fakemail.c Sat Feb 06 04:01:46 2010 -0600 @@ -512,7 +512,7 @@ register int size = 0; do { - char *field; + char *field = NULL; register char *keyword = get_keyword (the_header->text->string, &field); if ((strcmp (keyword, "TO") == 0) || (strcmp (keyword, "CC") == 0) || @@ -535,7 +535,7 @@ register header old = the_header; do { - char *field; + char *field = NULL; register char *keyword = get_keyword (the_header->text->string, &field); if (strcmp (keyword, "TO") == 0) where = add_field (the_header->text->continuation, field, where); diff -r d2ec55325515 -r 8f0cf4fd3d2c lib-src/fix-perms.sh --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/lib-src/fix-perms.sh Sat Feb 06 04:01:46 2010 -0600 @@ -0,0 +1,87 @@ +#!/bin/sh +### fix-perms.sh --- Correct the permissions on XEmacs source/build files + +# Copyright (C) 2010 Ben Wing. + +# Author: Ben Wing +# Keywords: internal + +# 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 program sets the executable bit on all scripts and executable files +# in the XEmacs source tree, including those that are built. + +### Code: + +# List of executable source files in various directories (root, lib-src, etc) +# other than .sh files. Note that we are free to list files in +# subdirectories here rather than creating a separate item list" +ROOT_EXES="configure config.guess install-sh move-if-change \ + modules/canna/configure" +LIB_SRC_EXES="ad2c gnuattach gnudoit rcs2log vcdiff *.pl" +ETC_EXES="" + +LIB_SRC_BUILT_EXES="`cd lib-src; ls -1 *.c | sed 's/\.c$//g'`" +LIB_SRC_BUILT_EXES="minitar ctags $LIB_SRC_BUILT_EXES" +SRC_BUILT_EXES="temacs xemacs" + +find . -type f -print0 | xargs -0 chmod a-x + +for dir in . lib-src etc ; do + if [ "$dir" = "." ]; then + exes="$ROOT_EXES" + elif [ "$dir" = "lib-src" ]; then + exes="$LIB_SRC_EXES" + elif [ "$dir" = "etc" ]; then + exes="$ETC_EXES" + else + echo "Error! Don't know how to handle directory '$dir'"; exit 2 + fi + pwd=`pwd` + cd $dir + for x in $exes *.sh ; do + if [ ! -f $x ]; then + echo "Warning: file '$dir/$x' doesn't exist" + else + chmod a+x $x + fi + done + cd "$pwd" +done + +# Now do the built executables. Don't warn or anything if we don't find +# anything, since they may not be built. +for dir in lib-src src ; do + if [ "$dir" = "src" ]; then + exes="$SRC_BUILT_EXES" + elif [ "$dir" = "lib-src" ]; then + exes="$LIB_SRC_BUILT_EXES" + else + echo "Error! Don't know how to handle directory '$dir'"; exit 2 + fi + pwd=`pwd` + cd $dir + for x in $exes *.exe ; do + if [ -f $x ]; then + chmod a+x $x + fi + done + cd "$pwd" +done diff -r d2ec55325515 -r 8f0cf4fd3d2c lib-src/make-msgfile.lex --- a/lib-src/make-msgfile.lex Sat Feb 06 03:59:18 2010 -0600 +++ b/lib-src/make-msgfile.lex Sat Feb 06 04:01:46 2010 -0600 @@ -4,6 +4,7 @@ /* Localizable-message snarfing. Copyright (C) 1994, 1995 Amdahl Corporation. + Copyright (C) 2010 Ben Wing. This file is part of XEmacs. @@ -25,6 +26,27 @@ /* Written by Ben Wing, November 1994. Some code based on earlier make-msgfile.c. */ +/* #### A comment: + + Directly writing a lex file isn't right. We want to be able to specify + functions to snarf in simpler ways, e.g. + +BEGIN_C_FUNCS + +weird_doc (arg, snarf, snarf, arg); +signal_error (arg, snarf, arg); +etc. + +END_C_FUNCS + + In this case, `arg' indicates an arbitrary argument and `snarf' indicates + that when a quoted string is seen, it should be snarfed. + + Then either we write a program to read this script and directly snarf + messages, or we write a program to convert the script into lex. + +--ben, 1/26/10 */ + /* See text.c for a proposal about how this whole system should work. */ /* Note: there is still much work to be done on this. @@ -84,25 +106,34 @@ %s DO_C DO_LISP DEFUN %s DEFUN2 DEFUN3 LDEF -W [ \t\n] -Any (.|"\n") -Q "\"" -NQ [^"] -NT [^A-Za-z_0-9] -LP "(" -RP ")" -BS "\\" -Esc ({BS}{Any}) -Wh ({W}*) -LCom (";"({Esc}|.)*) -LWh (({W}|{Lcom})*) -Open ({Wh}{LP}) -OpWQ ({Open}{Wh}{Q}) -String ({Q}({Esc}|{NQ})*{Q}) -Arg ([^,]*",") -StringArg ({Wh}{String}{Wh}",") -OpenString ({Open}{StringArg}) -LispToken (({Esc}|[-A-Za-z0-9!@$%^&*_=+|{}`~,<.>/?])+) +W [ \t\n] +Any .|\n +Q \" +Cm , +NQ [^\"] +NT [^A-Za-z_0-9] +LP "(" +RP ")" +NQP [^\"()] +NQPCm [^,\"()] +BS "\\" +Esc ({BS}{Any}) +Wh ({W}*) +LCom (;({Esc}|.)*) +LWh ({W}|{LCom})* +Open {Wh}{LP} +OpWQ {Open}{Wh}{Q} +String {Q}({Esc}|{NQ})*{Q} +ParenExpr5 "("({String}|{NQP})*")" +ParenExpr4 "("({String}|{NQP}|{ParenExpr5})*")" +ParenExpr3 "("({String}|{NQP}|{ParenExpr4})*")" +ParenExpr2 "("({String}|{NQP}|{ParenExpr3})*")" +ParenExpr "("({String}|{NQP}|{ParenExpr5})*")" +Arg ({NQPCm}|{String}|{ParenExpr})* +ArgCm {Arg}{Cm} +StringArg {Wh}{String}{Wh}"," +OpenString {Open}{StringArg} +LispToken ({Esc}|[-A-Za-z0-9!@$%^&*_=+|{}`~,<.>/?])+ %% {NT}"GETTEXT"{OpWQ} { snarf (); } @@ -128,16 +159,17 @@ {NT}"stdout_out"{OpWQ} { snarf (); } {NT}"stderr_out"{OpWQ} { snarf (); } {NT}"with_output_to_temp_buffer"{OpWQ} { snarf (); } +{NT}"weird_doc"{Open}{ArgCm}{Wh}{Q} { snarf (); /* #### FIXME snarf next arg() */} -{NT}"DEFVAR_BOOL"{OpenString}{Arg}{Wh}{Q} { snarf (); } -{NT}"DEFVAR_LISP"{OpenString}{Arg}{Wh}{Q} { snarf (); } -{NT}"DEFVAR_SPECIFIER"{OpenString}{Arg}{Wh}{Q} { snarf (); } -{NT}"DEFVAR_INT"{OpenString}{Arg}{Wh}{Q} { snarf (); } -{NT}"DEFVAR_BUFFER_LOCAL"{OpenString}{Arg}{Wh}{Q} { snarf (); } -{NT}"DEFVAR_BUFFER_DEFAULTS"{OpenString}{Arg}{Wh}{Q} { snarf (); } -{NT}"deferror"{Open}{Arg}{StringArg}{Wh}{Q} { snarf (); } +{NT}"DEFVAR_BOOL"{OpenString}{ArgCm}{Wh}{Q} { snarf (); } +{NT}"DEFVAR_LISP"{OpenString}{ArgCm}{Wh}{Q} { snarf (); } +{NT}"DEFVAR_SPECIFIER"{OpenString}{ArgCm}{Wh}{Q} { snarf (); } +{NT}"DEFVAR_INT"{OpenString}{ArgCm}{Wh}{Q} { snarf (); } +{NT}"DEFVAR_BUFFER_LOCAL"{OpenString}{ArgCm}{Wh}{Q} { snarf (); } +{NT}"DEFVAR_BUFFER_DEFAULTS"{OpenString}{ArgCm}{Wh}{Q} { snarf (); } +{NT}"deferror"{Open}{ArgCm}{StringArg}{Wh}{Q} { snarf (); } -{NT}"barf_or_query_if_file_exists"{Open}{Arg}{Wh}{Q} { +{NT}"barf_or_query_if_file_exists"{Open}{ArgCm}{Wh}{Q} { /* #### see comment above about use of Arg */ snarf (); } @@ -153,7 +185,7 @@ {Q} { BEGIN C_QUOTE; } {Any} { } -{StringArg}{Arg}{Arg}{Arg}{Arg}{Wh} { BEGIN DEFUN2; } +{StringArg}{ArgCm}{ArgCm}{ArgCm}{ArgCm}{Wh} { BEGIN DEFUN2; } {Any} { bad_c_defun (); } {Q} { @@ -163,7 +195,7 @@ } [^,]* { /* This function doesn't have an interactive specification. - Don't use {Arg} in the specification because DEFUN3 looks + Don't use {ArgCm} in the specification because DEFUN3 looks for the comma. */ BEGIN DEFUN3; } diff -r d2ec55325515 -r 8f0cf4fd3d2c lib-src/ootags.c --- a/lib-src/ootags.c Sat Feb 06 03:59:18 2010 -0600 +++ b/lib-src/ootags.c Sat Feb 06 04:01:46 2010 -0600 @@ -2639,7 +2639,7 @@ int parlev; /* current parenthesis level */ bool incomm, inquote, inchar, quotednl, midtoken; bool cplpl, cjava; - token savetok; /* token saved during preprocessor handling */ + token savetok = {0}; /* token saved during preprocessor handling */ tokoff = toklen = 0; /* keep compiler quiet */ diff -r d2ec55325515 -r 8f0cf4fd3d2c lisp/ChangeLog --- a/lisp/ChangeLog Sat Feb 06 03:59:18 2010 -0600 +++ b/lisp/ChangeLog Sat Feb 06 04:01:46 2010 -0600 @@ -45,6 +45,201 @@ 'cygwin-use-utf-8). Uses `utf-8' for all defaults except for `bfcs-for-read', which is `undecided'. +2010-01-28 Ben Wing + + * lisp-mode.el: Finish documenting `lisp-indent-specform', + on Mike Sperber's request. + +2010-01-17 Ben Wing + + * bytecomp-runtime.el: + * bytecomp-runtime.el (error-unless-tests-match): New. + * bytecomp-runtime.el (byte-compile-file-being-compiled): New. + * bytecomp-runtime.el (compiled-if): New. + * bytecomp-runtime.el (compiled-when): New. + Add functions for dealing with conditional compilation of different code + depending on the presence or absence of features. Necessary for some + Mule code where code is run during compilation (macros or eval-when-compile) + but, depending on how the code is written, the code itself will crash + either with or without Unicode-internal. + + compiled-if and compiled-when are the basic functions for conditional + compilation. They automatically trigger an error message upon file + loading if, at that time, the test expression that selected which code + to compile does not have the same value as at compile time. + +2010-01-25 Ben Wing + + * mule/cyrillic.el (koi8-c): + Fix bug in #83 mapping. + * mule/vietnamese.el (viscii): + Fix bug in #A6 mapping. + +2010-01-24 Ben Wing + + * simple.el (capitalize-string-as-title): + Use `with-string-as-buffer-contents' instead of emulating it. + +2010-01-24 Ben Wing + + * syntax.el: + * syntax.el (make-syntax-table): + Expand doc string. + +2010-01-22 Ben Wing + + * lisp-mode.el: + * lisp-mode.el (lisp-indent-function): + If the function begins with `with-', assume it is a macro or + special form whose last argument is a body. Call + `lisp-indent-specform' with a flag indicating that it should indent + all arguments as a body instead of with normal (full) indent. + * lisp-mode.el (lisp-indent-specform): + Add an optional flag argument indicating that all non-distinguished + arguments, not just the first, should be indented as a body. This + is useful when the number of distinguished (i.e. pre-body) arguments + isn't known, and is used for this purpose by `lisp-indent-function'. + + +2010-01-20 Aidan Kehoe + + * simple.el (handle-pre-motion-command-current-command-is-motion): + This function is called a *lot*, make it faster, making + keysyms-equal inline, calling #'characterp (which doesn't have a + bytecode) much more rarely, and not throwing and catching. This + won't make much difference in practice, but does eliminate losts + of noise from profiling, e.g. at startup. + +2010-01-13 Ben Wing + + * loadup.el: + * loadup.el (featurep): + * loadup.el (member): + When featurep `debug-xemacs' (configure --with-debug), set + debug-on-error, so that we get an exit-to-debugger/assertion + failure upon Lisp error during loadup. Unset before dumping. + +2010-01-10 Ben Wing + + * mule/mule-cmds.el (get-native-coding-system-from-language-environment): + Under Cygwin, force utf-8 if we are using Cygwin 1.7 or later + (making use of the magic feature 'cygwin-use-utf-8). + +2010-01-11 Ben Wing + + * unicode.el: + * unicode.el (utf-8): + Don't define `utf-8' coding system here, because it's too late. + We need it during early startup code at dump time so we create it + in C in unicode.c. + +2010-01-10 Didier Verna + + * x-faces.el (x-init-face-from-resources) + (x-init-device-faces) + (x-init-frame-faces): Cosmetic changes (comments formatting). + +2010-01-09 Didier Verna + + * x-faces.el (x-init-global-faces): Deactivate obsolete code. + * x-faces.el (x-init-device-faces): Ditto. + * x-faces.el (x-init-frame-faces): Ditto. + +2010-01-09 Didier Verna + + * glyphs.el (init-glyphs): Recognize bitmaps/ directory as + containing bitmap files. + +2010-01-09 Aidan Kehoe + + * subr.el (with-trapping-errors): + Fix a bug here, where I used a normal quote instead of a + backquote. Thank you the byte-compiler. + +2010-01-08 Aidan Kehoe + + * indent.el (indent-region): + Make COLUMN optional as in GNU, merging Andreas Roehler's change + of http://mid.gmane.org/4B46F5FC.2070506@online.de ; thank you + Andreas! + +2010-01-07 Aidan Kehoe + + * cl-macs.el (map): + Add a compiler macro for this function, for cases where CL-TYPE is + constant and understood. + +2010-01-07 Aidan Kehoe + + * unicode.el (load-unicode-tables): + * mule/mule-msw-init-late.el: + * mule/mule-category.el (predefined-category-list): + * mule/arabic.el: + Move arabic-iso8859-6 back to C, it needs to be there, otherwise + X11 character input lookup fails. + +2010-01-06 Didier Verna + + * cl-extra.el (get-properties): New. + +2009-12-31 Aidan Kehoe + + * list-mode.el (next-list-mode-item, switch-to-completions): Use + next-single-char-property-change, + previous-single-char-property-change now + next-single-property-change no longer pays attention to extents + not created using the text property functions. Fix for issue 546, + bug dates from changeset 8c96bdabcaf9. + +2009-12-21 Jerry James + + * dragdrop.el (offix-start-drag): Remove. + (offix-start-drag-region): Remove. + * mouse.el (mouse-begin-drag-n-drop): Remove OffiX support. + +2009-12-21 Adrian Aichner + + * package-get.el (package-get-download-sites): Remove + dk.xemacs.org from list of package download sites. + * package-get.el (package-get-pre-release-download-sites): Ditto. + +2009-12-21 Aidan Kehoe + + * mule/arabic.el (arabic-iso8859-6): + Move the creation of this character set to this (dumped) file, + since it's needed for input on X11. + * mule/iso-with-esc.el: + Remove arabic-iso8859-6 and its Unicode map from this file. + * unicode.el (load-unicode-tables): + Load arabic-iso8859-6 on startup again. + +2009-12-19 Aidan Kehoe + + * cl-macs.el (cl-do-arglist): + * cl-compat.el (keyword-of): + Remove support in our generated code for emacs versions where + keywords are not self-quoting. + +2010-02-03 Aidan Kehoe + + Delete a couple of XEmacs-specific functions that duplicate CL + functions. + + * find-paths.el (paths-filter, paths-uniq-append): + Remove #'paths-filter, a reimplementation of #'remove-if-not, and + #'paths-uniq-append, a reimplementation of #'union with test + #'equal. + (paths-decode-directory-path): Don't use #'path-filter here. + * packages.el (packages-package-hierarchy-directory-names): + Don't use #'path-filter here. + (packages-find-installation-package-directories): + Use #'union, not #'paths-uniq-append here. + * setup-paths.el (paths-find-invocation-roots) + (paths-find-emacs-roots, paths-construct-info-path) + (paths-construct-info-path): + Replace #'paths-filter with #'remove-if-not, #'paths-uniq-append + with #'union. + 2010-02-01 Aidan Kehoe * loadhist.el (symbol-file): diff -r d2ec55325515 -r 8f0cf4fd3d2c lisp/bytecomp-runtime.el --- a/lisp/bytecomp-runtime.el Sat Feb 06 03:59:18 2010 -0600 +++ b/lisp/bytecomp-runtime.el Sat Feb 06 04:01:46 2010 -0600 @@ -1,7 +1,7 @@ ;;; bytecomp-runtime.el --- byte-compiler support for inlining ;; Copyright (C) 1992, 1997 Free Software Foundation, Inc. -;; Copyright (C) 2002 Ben Wing. +;; Copyright (C) 2002, 2010 Ben Wing. ;; Author: Jamie Zawinski ;; Author: Hallvard Furuseth @@ -493,6 +493,60 @@ `(with-byte-compiler-warnings-suppressed 'obsolete ,@body)) + +(defmacro error-unless-tests-match (test &optional source) + "Signal an error unless TEST matches when being compiled and loaded. +This is for use in a file that will be byte-compiled. Unless TEST has the +same nilness or non-nilness when the file is compiled and loaded, an error +will be signalled. SOURCE is the name of the source file." + (let ((source (eval source))) + `(unless (eq (not ,test) ,(not (eval test))) + (error ,(format "This file was compiled with `%s' %s, +but it was %s when run. This file needs to be compiled with +the same value for the expression as when it is run. Please delete +%s and rebuild." + test (if (eval test) "true" "false") + (if (eval test) "false" "true") + (cond + ((null source) "the .elc for this file") + ((string-match "\.elc$" source) source) + ((string-match "\.el$" source) (concat source "c")) + (t (concat source ".elc")))))))) + +(defun byte-compile-file-being-compiled () + "When byte-compiling a file, return the name of the file being compiled. +Return nil otherwise." + (or + ;;The first of these, but not the second, seems to work noninteractively; + ;;vice-versa interactively. This is because interactively a *Compile Log* + ;;buffer is created and byte-compile-log-1 inserts a "Compiling file ..." + ;;message into thelog buffer, and then sets byte-compile-current-file to + ;;nil to indicate that the message shouldn't be printed again. + (and-boundp 'byte-compile-current-file byte-compile-current-file) + (and-boundp 'byte-compile-log-buffer + (with-current-buffer byte-compile-log-buffer + (save-excursion + (and (re-search-backward "Compiling file \\(.*\\) at " nil t) + (match-string 1))))))) + + +(defmacro compiled-if (test if &rest else) + "Like a regular `if' statement but the TEST will be evalled at compile time. +If TEST doesn't match at compile time and load time, an error will be +signalled." + (let ((being-compiled (byte-compile-file-being-compiled))) + `(progn + (error-unless-tests-match ,test ,being-compiled) + ,(if (eval test) + if + `(progn ,else))))) + +(defmacro compiled-when (test &rest when) + "Like a regular `when' statement but the TEST will be evalled at compile time. +See `compiled-if'." + `(compiled-if ,test (progn ,@when))) + + ;;; Interface to file-local byte-compiler parameters. ;;; Redefined in bytecomp.el. diff -r d2ec55325515 -r 8f0cf4fd3d2c lisp/find-paths.el --- a/lisp/find-paths.el Sat Feb 06 03:59:18 2010 -0600 +++ b/lisp/find-paths.el Sat Feb 06 04:01:46 2010 -0600 @@ -352,25 +352,6 @@ (setq directories (cdr directories))) (reverse reverse-directories))) -(defun paths-uniq-append (list-1 list-2) - "Append LIST-1 and LIST-2, omitting EQUAL duplicates." - (let ((reverse-survivors '())) - (while list-2 - (if (null (member (car list-2) list-1)) - (setq reverse-survivors (cons (car list-2) reverse-survivors))) - (setq list-2 (cdr list-2))) - (append list-1 - (reverse reverse-survivors)))) - -(defun paths-filter (predicate list) - "Delete all matches of PREDICATE from LIST." - (let ((reverse-result '())) - (while list - (if (funcall predicate (car list)) - (setq reverse-result (cons (car list) reverse-result))) - (setq list (cdr list))) - (nreverse reverse-result))) - (defun paths-decode-directory-path (string &optional drop-empties) "Split STRING at path separators into a directory list. Non-\"\" components are converted into directory form. @@ -384,9 +365,7 @@ (file-name-as-directory component))) components))) (if drop-empties - (paths-filter #'(lambda (component) - (null (string-equal "" component))) - directories) + (delete "" directories) directories))) ;;; find-paths.el ends here diff -r d2ec55325515 -r 8f0cf4fd3d2c lisp/lisp-mode.el --- a/lisp/lisp-mode.el Sat Feb 06 03:59:18 2010 -0600 +++ b/lisp/lisp-mode.el Sat Feb 06 04:01:46 2010 -0600 @@ -2,7 +2,7 @@ ;; Copyright (C) 1985, 1996, 1997 Free Software Foundation, Inc. ;; Copyright (C) 1995 Tinker Systems. -;; Copyright (C) 2002 Ben Wing. +;; Copyright (C) 2002, 2010 Ben Wing. ;; Maintainer: FSF ;; Keywords: lisp, languages, dumped @@ -846,7 +846,11 @@ (lisp-indent-specform method state indent-point normal-indent)) (method - (funcall method state indent-point))))))) + (funcall method state indent-point)) + ((and (> (length function) 5) + (string-match "\\`with-" function)) + (lisp-indent-specform 0 state indent-point normal-indent + t))))))) (defun lisp-indent-quoteform (state indent-point) (goto-char (car (cdr state))) @@ -859,7 +863,36 @@ (defvar lisp-body-indent 2 "Number of columns to indent the second line of a `(def...)' form.") -(defun lisp-indent-specform (count state indent-point normal-indent) +;; Calculate the appropriate indentation for a special form (e.g. defun) or +;; a macro that behaves like a special form (e.g. with-temp-buffer). +;; Return value is as for `calculate-lisp-indent' (q.v.). +;; +;; COUNT is the number of "distinguished" forms (e.g. arguments before the +;; "body", in a macro taking a body as its last argument). +;; +;; INDENT-POINT is usually the value of (point) at the beginning of the +;; line containing the form to be indented. +;; +;; STATE is the result of calling (parse-partial-sexp (point) INDENT-POINT) +;; when (point) is sitting on (i.e. just before) the outermost containing +;; left paren for the form to be indented. +;; +;; NORMAL-INDENT is the amount of "full" indentation used for arguments +;; that aren't given some special indentation (usually less), and normally +;; it lines up with the first word after the function name. forms are +;; indented as follows: +;; +;; -- The first and second distinguished forms are given 2 times body indent +;; (determined by `lisp-body-indent') +;; -- Other distinguished forms are given normal indent +;; -- The first nondistinguished form (the body, usually) is given body indent +;; -- Normally, any further nondistinguished forms are given normal indent +;; -- However, if INDENT-REMAINING-AS-BODY was specified, any further +;; nondistinguished forms are given body indent. This is useful when the +;; number of distinguished forms isn't known or may vary. + +(defun lisp-indent-specform (count state indent-point normal-indent + &optional indent-remaining-as-body) (let ((containing-form-start (elt state 1)) (i count) body-indent containing-form-column) @@ -900,7 +933,8 @@ ;; or if this is the first undistinguished form and the preceding ;; distinguished form has indentation at least as great as body-indent. (if (or (and (= i 0) (= count 0)) - (and (= count 0) (<= body-indent normal-indent))) + (and (or (= count 0) indent-remaining-as-body) + (<= body-indent normal-indent))) body-indent normal-indent)))) diff -r d2ec55325515 -r 8f0cf4fd3d2c lisp/mule/cyrillic.el diff -r d2ec55325515 -r 8f0cf4fd3d2c lisp/packages.el --- a/lisp/packages.el Sat Feb 06 03:59:18 2010 -0600 +++ b/lisp/packages.el Sat Feb 06 04:01:46 2010 -0600 @@ -106,11 +106,10 @@ "Returns a list package hierarchy directory names. These are the valid immediate directory names of package directories, directories with higher priority first" - (paths-filter #'(lambda (x) x) - `("site-packages" - ,(when (featurep 'infodock) "infodock-packages") - ,(when (featurep 'mule) "mule-packages") - "xemacs-packages"))) + (delq nil `("site-packages" + ,(when (featurep 'infodock) "infodock-packages") + ,(when (featurep 'mule) "mule-packages") + "xemacs-packages"))) (defun package-get-key-1 (info key) "Locate keyword `key' in list." @@ -386,8 +385,8 @@ (defun packages-find-installation-package-directories (roots) "Find the package directories in the XEmacs installation. ROOTS is a list of installation roots." - (paths-uniq-append (paths-find-version-directories roots (list "") nil nil nil t) - (paths-find-site-directories roots (list "") nil))) + (union (paths-find-version-directories roots (list "") nil nil nil t) + (paths-find-site-directories roots (list "") nil) :test #'equal)) (defun packages-find-package-hierarchies (package-directories &optional envvar default) "Find package hierarchies in a list of package directories. diff -r d2ec55325515 -r 8f0cf4fd3d2c lisp/setup-paths.el --- a/lisp/setup-paths.el Sat Feb 06 03:59:18 2010 -0600 +++ b/lisp/setup-paths.el Sat Feb 06 04:01:46 2010 -0600 @@ -127,8 +127,7 @@ (maybe-root-2 (file-name-as-directory (paths-construct-path '(".." "..") executable-directory)))) - (paths-filter root-p - (list maybe-root-1 maybe-root-2)))) + (delete-if-not root-p (list maybe-root-1 maybe-root-2)))) (defun paths-find-emacs-roots (invocation-directory invocation-name @@ -143,17 +142,17 @@ invocation-name root-p)) (potential-installation-roots - (paths-uniq-append + (union (and configure-exec-prefix-directory (list (file-name-as-directory configure-exec-prefix-directory))) (and configure-prefix-directory (list (file-name-as-directory - configure-prefix-directory))))) + configure-prefix-directory))) + :test #'equal)) (installation-roots - (paths-filter root-p potential-installation-roots))) - (paths-uniq-append invocation-roots - installation-roots))) + (remove-if-not root-p potential-installation-roots))) + (union invocation-roots installation-roots :test #'equal))) (defun paths-find-site-lisp-directory (roots) "Find the site Lisp directory of the XEmacs hierarchy. @@ -261,7 +260,7 @@ LAST-PACKAGE-HIERARCHIES are lists of package hierarchy roots, respectively." (let ((info-path-envval (getenv "INFOPATH"))) - (paths-uniq-append + (union (append (let ((info-directory (paths-find-version-directory roots (list "info") @@ -275,9 +274,11 @@ (and info-path-envval (paths-decode-directory-path info-path-envval 'drop-empties))) (and (null info-path-envval) - (paths-uniq-append + (union (paths-directories-which-exist configure-info-path) - (paths-directories-which-exist paths-default-info-directories)))))) + (paths-directories-which-exist paths-default-info-directories) + :test #'equal)) + :test #'equal))) (defun paths-find-doc-directory (roots) "Find the documentation directory. diff -r d2ec55325515 -r 8f0cf4fd3d2c lisp/simple.el --- a/lisp/simple.el Sat Feb 06 03:59:18 2010 -0600 +++ b/lisp/simple.el Sat Feb 06 04:01:46 2010 -0600 @@ -3835,13 +3835,8 @@ (defun capitalize-string-as-title (string) "Capitalize the words in the string, except for small words (as in titles). The words not capitalized are specified in `uncapitalized-title-words'." - (let ((buffer (get-buffer-create " *capitalize-string-as-title*"))) - (unwind-protect - (progn - (insert-string string buffer) - (capitalize-region-as-title 1 (point-max buffer) buffer) - (buffer-string buffer)) - (kill-buffer buffer)))) + (with-string-as-buffer-contents string + (capitalize-region-as-title (point-min) (point-max)))) (defun capitalize-region-as-title (b e &optional buffer) "Capitalize the words in the region, except for small words (as in titles). diff -r d2ec55325515 -r 8f0cf4fd3d2c lisp/syntax.el --- a/lisp/syntax.el Sat Feb 06 03:59:18 2010 -0600 +++ b/lisp/syntax.el Sat Feb 06 04:01:46 2010 -0600 @@ -2,7 +2,7 @@ ;; Copyright (C) 1993, 1997 Free Software Foundation, Inc. ;; Copyright (C) 1995 Sun Microsystems. -;; Copyright (C) 2005 Ben Wing. +;; Copyright (C) 2005, 2010 Ben Wing. ;; This file is part of XEmacs. @@ -36,7 +36,20 @@ (defun make-syntax-table (&optional oldtable) "Return a new syntax table. -It inherits all characters from the standard syntax table." + +It inherits all characters from the standard syntax table. + +A syntax table is a char table of type `syntax' (see `make-char-table'). +The valid values are integers (intended to be syntax codes as generated by +`syntax-string-to-code'), and the default result given by `get-char-table' +is the syntax code for `word'. (Note: In 21.4 and prior, it was the code +for `inherit'.) + +To modify a syntax table, you should normally use `modify-syntax-entry' +rather than directly modify the table with `put-char-table'. + +See `modify-syntax-entry' for a description of the character codes used +to indicate the various syntax classes." (make-char-table 'syntax)) (defun syntax-after (pos) diff -r d2ec55325515 -r 8f0cf4fd3d2c lwlib/ChangeLog --- a/lwlib/ChangeLog Sat Feb 06 03:59:18 2010 -0600 +++ b/lwlib/ChangeLog Sat Feb 06 04:01:46 2010 -0600 @@ -1,3 +1,9 @@ +2010-01-24 Ben Wing + + * xlwgauge.c (GaugeResize): + * xlwgauge.c (GaugeSize): + Fix warnings about possible use of uninitialized vars. + 2010-02-01 Ben Wing * lwlib-colors.c: diff -r d2ec55325515 -r 8f0cf4fd3d2c lwlib/xlwgauge.c --- a/lwlib/xlwgauge.c Sat Feb 06 03:59:18 2010 -0600 +++ b/lwlib/xlwgauge.c Sat Feb 06 04:01:46 2010 -0600 @@ -314,7 +314,7 @@ if( gw->gauge.nlabels > 1 ) { - Dimension lwm, lw0, lw1 ; /* width of max, left, right labels */ + Dimension lwm, lw0=0, lw1 ;/* width of max, left, right labels */ Dimension lh ; MaxLabel(gw,&lwm,&lh, &lw0,&lw1) ; @@ -1017,7 +1017,7 @@ */ if( gw->gauge.nlabels > 0 ) { - Dimension lwm, lw0, lw1 ; /* width of max, left, right labels */ + Dimension lwm, lw0=0, lw1 ;/* width of max, left, right labels */ Dimension lh ; MaxLabel(gw,&lwm,&lh, &lw0,&lw1) ; diff -r d2ec55325515 -r 8f0cf4fd3d2c man/ChangeLog --- a/man/ChangeLog Sat Feb 06 03:59:18 2010 -0600 +++ b/man/ChangeLog Sat Feb 06 04:01:46 2010 -0600 @@ -1,3 +1,35 @@ +2010-02-05 Ben Wing + + * internals/internals.texi (A Summary of the Various XEmacs Modules): + * internals/internals.texi (Conversion to and from External Data): + * internals/internals.texi (General Guidelines for Writing Mule-Aware Code): + Correct names of files renamed common -> xlike. + Fix up outdated explanation of old-style DFC conversion macros. + Add a section on the different types of character and their uses, + taken from a long comment in lisp.h. + +2010-01-27 Ben Wing + + * internals/internals.texi (lrecords): + * internals/internals.texi (The DFC API): + * internals/internals.texi (Conversion to and from External Data): + * internals/internals.texi (Mule-izing Code): + * internals/internals.texi (Pervasive changes throughout XEmacs sources): + * internals/internals.texi (Ben's README): + * internals/internals.texi (Future Work -- Localized Text/Messages): + * emodules.texi (Defining Variables): + Rename: + + write_c_string -> write_cistring + build_intstring -> build_istring + build_string -> build_cistring + build_ext_string -> build_extstring + make_ext_string -> make_extstring + buffer_insert_c_string -> buffer_insert_ascstring + intern_int -> intern_istring + + See comment in src/ChangeLog about this. + 2010-02-03 Ben Wing * internals/internals.texi (Top): diff -r d2ec55325515 -r 8f0cf4fd3d2c man/emodules.texi --- a/man/emodules.texi Sat Feb 06 03:59:18 2010 -0600 +++ b/man/emodules.texi Sat Feb 06 04:01:46 2010 -0600 @@ -1058,7 +1058,7 @@ */); sample_boolean = 0; - Vsample_string = build_string("My string"); + Vsample_string = build_ascstring ("My string"); @} @end cartouche @end example diff -r d2ec55325515 -r 8f0cf4fd3d2c man/internals/internals.texi --- a/man/internals/internals.texi Sat Feb 06 03:59:18 2010 -0600 +++ b/man/internals/internals.texi Sat Feb 06 04:01:46 2010 -0600 @@ -3183,7 +3183,7 @@ @item @file{scrollbar.c} @tab @ref{Modules for other Display-Related Lisp Objects}. @item @file{scrollbar.h} @tab @ref{Modules for other Display-Related Lisp Objects}. @item @file{search.c} @tab @ref{Modules for Standard Editing Operations}. -@item @file{select-common.h} @tab +@item @file{select-xlike-inc.c} @tab @item @file{select-gtk.c} @tab @item @file{select-msw.c} @tab @ref{Modules for Interfacing with X Windows}. @item @file{select-x.c} @tab @ref{Modules for Interfacing with X Windows}. @@ -3229,8 +3229,8 @@ @item @file{tests.c} @tab @item @file{text.c} @tab @item @file{text.h} @tab -@item @file{toolbar-common.c} @tab -@item @file{toolbar-common.h} @tab +@item @file{toolbar-xlike.c} @tab +@item @file{toolbar-xlike.h} @tab @item @file{toolbar-gtk.c} @tab @item @file{toolbar-msw.c} @tab @ref{Modules for other Display-Related Lisp Objects}. @item @file{toolbar-x.c} @tab @ref{Modules for other Display-Related Lisp Objects}. @@ -8678,7 +8678,7 @@ Sub-objects are printed using @code{print_internal()}, which takes exactly the same arguments as are passed to the print method. -Literal C strings should be printed using @code{write_c_string()}, +Literal C strings should be printed using @code{write_cistring()}, or @code{write_string_1()} for non-null-terminated strings. Functions that do not have a readable representation should check the @@ -11838,7 +11838,7 @@ of conversions involving raw data and/or Lisp strings, especially when the output is an @code{alloca()}ed string. (When the destination is a Lisp_String, there are other functions that should be used instead -- -@code{build_ext_string()} and @code{make_ext_string()}, for example.) The convenience +@code{build_extstring()} and @code{make_extstring()}, for example.) The convenience macros are of two types -- the older kind that store the result into a specified variable, and the newer kind that return the result. The newer kind of macros don't exist when the output is sized data, because that @@ -12900,20 +12900,19 @@ many types of conversions involving raw data and/or Lisp strings, especially when the output is an @code{alloca()}ed string. (When the destination is a Lisp string, there are other functions that should be -used instead -- @code{build_ext_string()} and @code{make_ext_string()}, -for example.) The convenience macros are of two types -- the older kind -that store the result into a specified variable, and the newer kind that -return the result. The newer kind of macros don't exist when the output -is sized data, because that would have two return values. NOTE: All -convenience macros are ultimately defined in terms of -@code{TO_EXTERNAL_FORMAT} and @code{TO_INTERNAL_FORMAT}. Thus, any -comments above about the workings of these macros also apply to all -convenience macros. - -A typical old-style convenience macro is - -@example - C_STRING_TO_EXTERNAL (in, out, codesys); +used instead -- @code{build_extstring()} and @code{make_extstring()}, +for example.) Most convenience macros return the result as the return +value. However, when two values need to be returned (that is, the +output is sized data), both values are stored into variables that are +passed into the macros as parameters. NOTE: All convenience macros +are ultimately defined in terms of @code{TO_EXTERNAL_FORMAT} and +@code{TO_INTERNAL_FORMAT}. Thus, any comments above about the +workings of these macros also apply to all convenience macros. + +A typical convenience macro is + +@example + out = ITEXT_TO_EXTERNAL (in, codesys); @end example This is equivalent to @@ -12922,14 +12921,13 @@ TO_EXTERNAL_FORMAT (C_STRING, in, C_STRING_ALLOCA, out, codesys); @end example -but is easier to write and somewhat clearer, since it clearly identifies -the arguments without the clutter of having the preprocessor types mixed -in. - -The new-style equivalent is @code{NEW_C_STRING_TO_EXTERNAL (src, -codesys)}, which @emph{returns} the converted data (still in -@code{alloca()} space). This is far more convenient for most -operations. +but is easier to write and somewhat clearer, since it clearly +identifies the arguments without the clutter of having the +preprocessor types mixed in. Furthermore, it @emph{returns} the +converted data (still in @code{alloca()} space) rather than +@emph{storing} it, which is far more convenient for most operations +as there is no need to declare an extra temporary variable to hold +the return value. @node General Guidelines for Writing Mule-Aware Code, An Example of Mule-Aware Code, Conversion to and from External Data, Coding for Mule @subsection General Guidelines for Writing Mule-Aware Code @@ -12948,9 +12946,69 @@ format, use @code{Ibyte}. If you want a Lisp-visible character, use a @code{Lisp_Object} and @code{make_char}. If you want a pointer to move through the internal text, use @code{Ibyte *}. Also note that you -almost certainly do not need @code{Ichar *}. Other typedefs to clarify -the use of @code{char} are @code{Char_ASCII}, @code{Char_Binary}, -@code{UChar_Binary}, and @code{CIbyte}. +almost certainly do not need @code{Ichar *}. + +All uses of @code{char} should be replaced with one of the following: + +@table @code +@item Ibyte +Pointer to internally-formatted text. The data representing the text +in a buffer is logically a set of Ibytes. +@item CIbyte +Used when you are working with internal data but for whatever reason +need to have it declared a @code{char *}. Examples are function arguments +whose values are most commonly literal strings, or where you have to +apply a stdlib string function to internal data. + +In general, you should avoid this where possible and use Ascbyte if the +text is just ASCII (e.g. string literals) or otherwise Ibyte, for +consistency. For example, the new Mule workspace contains Ibyte +versions of the stdlib string functions. +@item Extbyte, UExtbyte +Pointer to text in some external format, which can be defined as all +formats other than the internal one. The data representing a string +in "external" format (binary or any external encoding) is logically a +set of Extbytes. Extbyte is guaranteed to be just a char, so for +example strlen (Extbyte *) is OK. Extbyte is only a documentation +device for referring to external text. +@item Ascbyte, UAscbyte +pure ASCII text, consisting of bytesf in a string in entirely US-ASCII +format: (Nothing outside the range 00 - 7F). +@item Binbyte, CBinbyte, SBinbyte +Binary data that is not meant to be interpreted as text. +@item Rawbyte, CRawbyte +General data in memory, where we don't care about whether it's text or +binary; often used when computing memory-based/byte-based offsets of +pointers. In general, there should be no manipulation of the memory +pointed to by these pointers other than just copying it around. +@item Boolbyte +A byte used to represent a boolean value: 0 or 1. +Normally use plain Boolint, and only use Boolbyte to save space. +@item Bitbyte +A byte composed of bitfields. Hardly ever used. +@item Chbyte, UChbyte, SChbyte +A no-semantics @code{char}. Used (pretty-much) ONLY for casting +arguments to functions accepting a @code{char *}, @code{unsigned char +*}, etc. where the other types don't exactly apply and what you are +logically concerned with is the type of the function's argument and +not its semantics. + +DO NOT DO NOT DO NOT DO NOT use this as a sloppy replacement for one of +the other types. If you're not using this as part of casting an +argument to a function call, and you're not Ben Wing, you're using it +wrong. Go find another one of the types. +@end table + +Note the significance of the prefixed versions of the above types: + +@table @code +@item U +@code{unsigned char} +@item S +@code{signed char} +@item C +plain @code{char} +@end table @item Be careful not to confuse @code{Charcount}, @code{Bytecount}, @code{Charbpos} and @code{Bytebpos}. The whole point of using different types is to avoid confusion about the @@ -13061,13 +13119,13 @@ @item Check all uses of @code{XSTRING_DATA}. @item -Check all uses of @code{build_string} and @code{make_string}. +Check all uses of @code{build_cistring} and @code{make_string}. @item Check all uses of @code{tolower} and @code{toupper}. @item Check object print methods. @item -Check for use of functions such as @code{write_c_string}, +Check for use of functions such as @code{write_cistring}, @code{write_fmt_string}, @code{stderr_out}, @code{stdout_out}. @item Check all occurrences of @code{char} and correct to one of the other @@ -14385,15 +14443,15 @@ strings, which is quite often. @item -new fun @code{build_intstring()} takes an @code{Intbyte *}. also new -funs @code{build_msg_intstring} (like @code{build_intstring()}) and -@code{build_msg_string} (like @code{build_string()}) to do a +new fun @code{build_istring()} takes an @code{Intbyte *}. also new +funs @code{build_msg_intstring} (like @code{build_istring()}) and +@code{build_msg_string} (like @code{build_cistring()}) to do a @code{GETTEXT()} before building the string. (elimination of old @code{build_translated_string()}, replaced by @code{build_msg_string()}). @item -function @code{intern_int()} for @code{Intbyte *} arguments, like +function @code{intern_istring()} for @code{Intbyte *} arguments, like @code{intern()}. @item @@ -15379,10 +15437,10 @@ menu item to revert to most recent auto save. @item -consider renaming @code{build_string} -> @code{build_intstring} and -@code{build_c_string} to @code{build_string}. (consistent with +consider renaming @code{build_cistring} -> @code{build_istring} and +@code{build_c_string} to @code{build_cistring}. (consistent with @code{build_msg_string} et al; many more @code{build_c_string} than -@code{build_string}) +@code{build_cistring}) @end itemize @heading oct 20, 2001 @@ -25771,7 +25829,7 @@ signal_simple_error_2 ("string" ... ) build_translated_string ("string") - #### add this and use it instead of @code{build_string()} in some places. + #### add this and use it instead of @code{build_cistring()} in some places. yes_or_no_p ("string" ... ) #### add this instead of funcalling Qyes_or_no_p directly. diff -r d2ec55325515 -r 8f0cf4fd3d2c modules/ChangeLog --- a/modules/ChangeLog Sat Feb 06 03:59:18 2010 -0600 +++ b/modules/ChangeLog Sat Feb 06 04:01:46 2010 -0600 @@ -1,3 +1,93 @@ +2010-02-05 Ben Wing + + * postgresql/postgresql.c: + * postgresql/postgresql.c (CHECK_LIVE_CONNECTION): + * postgresql/postgresql.c (Fpq_connectdb): + * postgresql/postgresql.c (Fpq_connect_start): + * postgresql/postgresql.c (Fpq_lo_import): + * postgresql/postgresql.c (Fpq_lo_export): + * ldap/eldap.c (Fldap_open): + * ldap/eldap.c (Fldap_search_basic): + * ldap/eldap.c (Fldap_add): + * ldap/eldap.c (Fldap_modify): + * ldap/eldap.c (Fldap_delete): + * canna/canna_api.c (Fcanna_initialize): + * canna/canna_api.c (Fcanna_store_yomi): + * canna/canna_api.c (Fcanna_parse): + * canna/canna_api.c (Fcanna_henkan_begin): + EXTERNAL_TO_C_STRING returns its argument instead of storing it + in a parameter, and is renamed to EXTERNAL_TO_ITEXT. Similar + things happen to related macros. See entry in src/ChangeLog. + + More Mule-izing of postgresql.c. Extract out common code + between `pq-connectdb' and `pq-connect-start'. Fix places + that signal an error string using a formatted string to instead + follow the standard and have a fixed reason followed by the + particular error message stored as one of the frobs. + +2010-01-27 Ben Wing + + * postgresql/postgresql.c (print_pgconn): + * postgresql/postgresql.c (print_pgresult): + * postgresql/postgresql.c (Fpq_conn_defaults): + * postgresql/postgresql.c (Fpq_pgconn): + * postgresql/postgresql.c (Fpq_res_status): + * postgresql/postgresql.c (Fpq_result_error_message): + * postgresql/postgresql.c (Fpq_fname): + * postgresql/postgresql.c (Fpq_get_value): + * postgresql/postgresql.c (Fpq_cmd_status): + * postgresql/postgresql.c (Fpq_cmd_tuples): + * postgresql/postgresql.c (Fpq_notifies): + * postgresql/postgresql.c (Fpq_get_line): + * postgresql/postgresql.c (Fpq_get_line_async): + * postgresql/postgresql.c (FROB): + * postgresql/postgresql.c (init_postgresql_from_environment): + * ldap/eldap.c: + * ldap/eldap.c (Fldap_open): + * ldap/eldap.c (Fldap_search_basic): + * canna/canna_api.c: + * canna/canna_api.c (make_euc_string): + Rename: + + write_c_string -> write_cistring + build_intstring -> build_istring + build_string -> build_cistring + build_ext_string -> build_extstring + make_ext_string -> make_extstring + buffer_insert_c_string -> buffer_insert_ascstring + intern_int -> intern_istring + + See comment in src/ChangeLog about this. + +2010-01-26 Ben Wing + + * postgresql/postgresql.c: + * postgresql/postgresql.c (CHECK_LIVE_CONNECTION): + * postgresql/postgresql.c (print_pgresult): + * postgresql/postgresql.c (Fpq_conn_defaults): + * postgresql/postgresql.c (Fpq_connectdb): + * postgresql/postgresql.c (Fpq_connect_start): + * postgresql/postgresql.c (Fpq_result_status): + * postgresql/postgresql.c (Fpq_res_status): + Mule-ize large parts of it. + +2010-01-26 Ben Wing + + * ldap/eldap.c (print_ldap): + * ldap/eldap.c (allocate_ldap): + Use write_ascstring(). + +2010-01-24 Ben Wing + + * postgresql/postgresql.c (CHECK_LIVE_CONNECTION): + * postgresql/postgresql.c (print_pgconn): + * postgresql/postgresql.c (Fpq_connectdb): + * postgresql/postgresql.c (Fpq_connect_start): + * postgresql/postgresql.c (Fpq_exec): + * postgresql/postgresql.c (Fpq_get_result): + Fix g++ 4.3 complaints about implicit conversions of string + literals (const char *) to char *. + 2010-01-16 Ben Wing * common/Makefile.common: diff -r d2ec55325515 -r 8f0cf4fd3d2c modules/canna/canna_api.c --- a/modules/canna/canna_api.c Sat Feb 06 03:59:18 2010 -0600 +++ b/modules/canna/canna_api.c Sat Feb 06 04:01:46 2010 -0600 @@ -199,8 +199,8 @@ static Lisp_Object CANNA_mode_keys (void); static Lisp_Object Qeuc_jp; -#define make_euc_string(p, len) make_ext_string ((Extbyte *) p, len, Qeuc_jp) -#define build_euc_string(p) build_ext_string ((Extbyte *) p, Qeuc_jp) +#define make_euc_string(p, len) make_extstring ((Extbyte *) p, len, Qeuc_jp) +#define build_euc_string(p) build_extstring ((Extbyte *) p, Qeuc_jp) #ifdef CANNA_MULE static int euc_jp_num_chars (unsigned char *, int); @@ -390,7 +390,7 @@ CHECK_STRING (server); jrKanjiControl (0, KC_SETSERVERNAME, /* !!#### Check encoding */ - NEW_LISP_STRING_TO_EXTERNAL (server, Qnative)); + LISP_STRING_TO_EXTERNAL (server, Qnative)); } if (NILP (rcfile)) @@ -401,7 +401,7 @@ { CHECK_STRING (rcfile); jrKanjiControl (0, KC_SETINITFILENAME, - NEW_LISP_STRING_TO_EXTERNAL (rcfile, Qfile_name)); + LISP_STRING_TO_EXTERNAL (rcfile, Qfile_name)); } { @@ -561,7 +561,7 @@ Extbyte *ext; CHECK_STRING (yomi); - LISP_STRING_TO_EXTERNAL (yomi, ext, Qeuc_jp); + ext = LISP_STRING_TO_EXTERNAL (yomi, Qeuc_jp); strncpy (key_buffer, ext, sizeof (key_buffer)); key_buffer[sizeof (key_buffer) - 1] = '\0'; ks.length = strlen (key_buffer); @@ -573,7 +573,7 @@ else { CHECK_STRING (roma); - LISP_STRING_TO_EXTERNAL (roma, ext, Qeuc_jp); + ext = LISP_STRING_TO_EXTERNAL (roma, Qeuc_jp); ks.mode = (unsigned char *) (key_buffer + ks.length + 1); strncpy (key_buffer + ks.length + 1, ext, sizeof (key_buffer) - ks.length - 1); @@ -629,7 +629,7 @@ Extbyte *ext; CHECK_STRING (str); - LISP_STRING_TO_EXTERNAL (str, ext, Qeuc_jp); + ext = LISP_STRING_TO_EXTERNAL (str, Qeuc_jp); strncpy (key_buffer, ext, sizeof (key_buffer)); key_buffer[sizeof (key_buffer) - 1] = '\0'; p = (Extbyte **) key_buffer; @@ -716,7 +716,7 @@ return Qnil; } - LISP_STRING_TO_EXTERNAL (yomi, ext, Qeuc_jp); + ext = LISP_STRING_TO_EXTERNAL (yomi, Qeuc_jp); strncpy ((char *) yomibuf, ext, sizeof (yomibuf)); yomibuf[sizeof (yomibuf) - 1] = '\0'; diff -r d2ec55325515 -r 8f0cf4fd3d2c modules/ldap/eldap.c --- a/modules/ldap/eldap.c Sat Feb 06 03:59:18 2010 -0600 +++ b/modules/ldap/eldap.c Sat Feb 06 04:01:46 2010 -0600 @@ -99,7 +99,7 @@ #endif } invalid_operation ("LDAP error", - build_ext_string (ldap_err2string (ldap_err), Qnative)); + build_extstring (ldap_err2string (ldap_err), Qnative)); } @@ -134,7 +134,7 @@ write_fmt_string_lisp (printcharfun, "#host); if (!ldap->ld) - write_c_string (printcharfun,"(dead) "); + write_ascstring (printcharfun,"(dead) "); write_fmt_string (printcharfun, " 0x%lx>", (long)ldap); } @@ -263,13 +263,13 @@ else if (EQ (keyword, Qbinddn)) { CHECK_STRING (value); - LISP_STRING_TO_EXTERNAL (value, ldap_binddn, Qnative); + ldap_binddn = LISP_STRING_TO_EXTERNAL (value, Qnative); } /* Password */ else if (EQ (keyword, Qpasswd)) { CHECK_STRING (value); - LISP_STRING_TO_EXTERNAL (value, ldap_password, Qnative); + ldap_password = LISP_STRING_TO_EXTERNAL (value, Qnative); } /* Deref */ else if (EQ (keyword, Qderef)) @@ -307,7 +307,7 @@ /* Connect to the server and bind */ slow_down_interrupts (); - ld = ldap_open (NEW_LISP_STRING_TO_EXTERNAL (host, Qnative), ldap_port); + ld = ldap_open (LISP_STRING_TO_EXTERNAL (host, Qnative), ldap_port); speed_up_interrupts (); if (ld == NULL ) @@ -346,7 +346,7 @@ if (err != LDAP_SUCCESS) { signal_error (Qprocess_error, "Failed binding to the server", - build_ext_string (ldap_err2string (err), Qnative)); + build_extstring (ldap_err2string (err), Qnative)); } ldap = allocate_ldap (); @@ -486,7 +486,7 @@ EXTERNAL_LIST_LOOP_2 (current, attrs) { CHECK_STRING (current); - LISP_STRING_TO_EXTERNAL (current, ldap_attributes[i], Qnative); + ldap_attributes[i] = LISP_STRING_TO_EXTERNAL (current, Qnative); ++i; } } @@ -498,9 +498,9 @@ /* Perform the search */ bs = NILP (base) ? (Extbyte *) "" : - NEW_LISP_STRING_TO_EXTERNAL (base, Qnative); + LISP_STRING_TO_EXTERNAL (base, Qnative); filt = NILP (filter) ? (Extbyte *) "" : - NEW_LISP_STRING_TO_EXTERNAL (filter, Qnative); + LISP_STRING_TO_EXTERNAL (filter, Qnative); if (ldap_search (ld, bs, ldap_scope, filt, ldap_attributes, NILP (attrsonly) ? 0 : 1) == -1) @@ -535,19 +535,19 @@ dn = ldap_get_dn (ld, e); if (dn == NULL) signal_ldap_error (ld, e, 0); - entry = Fcons (build_ext_string (dn, Qnative), Qnil); + entry = Fcons (build_extstring (dn, Qnative), Qnil); } for (a = ldap_first_attribute (ld, e, &ptr); a != NULL; a = ldap_next_attribute (ld, e, ptr)) { - list = Fcons (build_ext_string (a, Qnative), Qnil); + list = Fcons (build_extstring (a, Qnative), Qnil); unwind.vals = ldap_get_values_len (ld, e, a); if (unwind.vals != NULL) { for (i = 0; unwind.vals[i] != NULL; i++) { - list = Fcons (make_ext_string ((Extbyte *) unwind.vals[i]->bv_val, + list = Fcons (make_extstring ((Extbyte *) unwind.vals[i]->bv_val, unwind.vals[i]->bv_len, Qnative), list); @@ -646,8 +646,8 @@ CHECK_CONS (current); CHECK_STRING (XCAR (current)); ldap_mods_ptrs[i] = &(ldap_mods[i]); - LISP_STRING_TO_EXTERNAL (XCAR (current), ldap_mods[i].mod_type, - Qnative); + ldap_mods[i].mod_type = + LISP_STRING_TO_EXTERNAL (XCAR (current), Qnative); ldap_mods[i].mod_op = LDAP_MOD_ADD | LDAP_MOD_BVALUES; values = XCDR (current); if (CONSP (values)) @@ -688,7 +688,7 @@ } } ldap_mods_ptrs[i] = NULL; - rc = ldap_add_s (ld, NEW_LISP_STRING_TO_EXTERNAL (dn, Qnative), + rc = ldap_add_s (ld, LISP_STRING_TO_EXTERNAL (dn, Qnative), ldap_mods_ptrs); if (rc != LDAP_SUCCESS) signal_ldap_error (ld, NULL, rc); @@ -756,8 +756,8 @@ invalid_constant ("Invalid LDAP modification type", mod_op); current = XCDR (current); CHECK_STRING (XCAR (current)); - LISP_STRING_TO_EXTERNAL (XCAR (current), ldap_mods[i].mod_type, - Qnative); + ldap_mods[i].mod_type = + LISP_STRING_TO_EXTERNAL (XCAR (current), Qnative); values = XCDR (current); len = (Elemcount) XINT (Flength (values)); bervals = alloca_array (struct berval, len); @@ -781,7 +781,7 @@ } } ldap_mods_ptrs[i] = NULL; - rc = ldap_modify_s (ld, NEW_LISP_STRING_TO_EXTERNAL (dn, Qnative), + rc = ldap_modify_s (ld, LISP_STRING_TO_EXTERNAL (dn, Qnative), ldap_mods_ptrs); if (rc != LDAP_SUCCESS) signal_ldap_error (ld, NULL, rc); @@ -806,7 +806,7 @@ ld = XLDAP (ldap)->ld; CHECK_STRING (dn); - rc = ldap_delete_s (ld, NEW_LISP_STRING_TO_EXTERNAL (dn, Qnative)); + rc = ldap_delete_s (ld, LISP_STRING_TO_EXTERNAL (dn, Qnative)); if (rc != LDAP_SUCCESS) signal_ldap_error (ld, NULL, rc); diff -r d2ec55325515 -r 8f0cf4fd3d2c modules/postgresql/postgresql.c --- a/modules/postgresql/postgresql.c Sat Feb 06 03:59:18 2010 -0600 +++ b/modules/postgresql/postgresql.c Sat Feb 06 04:01:46 2010 -0600 @@ -97,7 +97,6 @@ /* #define POSTGRES_LO_IMPORT_IS_VOID 1 */ #include "lisp.h" -#include "sysdep.h" #include "buffer.h" #include "postgresql.h" @@ -105,6 +104,8 @@ #ifdef HAVE_SHLIB # include "emodules.h" #endif +#include "sysdep.h" +#include "sysfile.h" #ifdef RUNNING_XEMACS_21_1 /* handle interface changes */ #define PG_OS_CODING FORMAT_FILENAME @@ -118,15 +119,36 @@ Lisp_Object Vpg_coding_system; #endif -#define CHECK_LIVE_CONNECTION(P) do { \ - if (!P || (PQstatus (P) != CONNECTION_OK)) { \ - char *e = "bad value"; \ - if (P) e = PQerrorMessage (P); \ - signal_ferror (Qprocess_error, "dead connection [%s]", e); \ - } } while (0) -#define PUKE_IF_NULL(p) do { \ - if (!p) signal_error (Qinvalid_argument, "bad value", Qunbound); \ - } while (0) +#define CHECK_LIVE_CONNECTION(P) \ +do \ +{ \ + if (!P || (PQstatus (P) != CONNECTION_OK)) \ + { \ + Lisp_Object err; \ + \ + if (P) \ + err = build_extstring (PQerrorMessage (P), PG_OS_CODING); \ + else \ + err = build_msg_string ("Bad value"); \ + signal_error (Qprocess_error, "Dead connection", err); \ + } \ +} \ +while (0) + +#define PUKE_IF_NULL(p) \ +do \ +{ \ + if (!p) signal_error (Qinvalid_argument, "Bad value", Qunbound); \ +} \ +while (0) + +#define SIGNAL_ERROR(p, reason) \ +do \ +{ \ + signal_error (Qprocess_error, reason, \ + build_extstring (PQerrorMessage (p), PG_OS_CODING)); \ +} \ +while (0) static Lisp_Object VXPGHOST; static Lisp_Object VXPGUSER; @@ -203,7 +225,7 @@ char buf[256]; PGconn *P; ConnStatusType cst; - char *host="", *db="", *user="", *port=""; + const char *host="", *db="", *user="", *port=""; P = (XPGCONN (obj))->pgconn; @@ -231,7 +253,7 @@ if (print_readably) printing_unreadable_object ("%s", buf); else - write_c_string (printcharfun, buf); + write_cistring (printcharfun, buf); } static Lisp_PGconn * @@ -338,7 +360,7 @@ PQcmdStatus (res)); break; default: -notuples: + notuples: /* No counts to print */ sprintf (buf, RESULT_DEFAULT_FMT, /* evil! */ PQresStatus (PQresultStatus (res)), @@ -352,7 +374,7 @@ if (print_readably) printing_unreadable_object ("%s", buf); else - write_c_string (printcharfun, buf); + write_cistring (printcharfun, buf); } #undef RESULT_TUPLES_FMT @@ -431,23 +453,25 @@ pcio = PQconndefaults(); if (!pcio) return Qnil; /* can never happen in libpq-7.0 */ - temp = list1 (Fcons (build_ext_string (pcio[0].keyword, PG_OS_CODING), - Fcons (build_ext_string (pcio[0].envvar, PG_OS_CODING), - Fcons (build_ext_string (pcio[0].compiled, PG_OS_CODING), - Fcons (build_ext_string (pcio[0].val, PG_OS_CODING), - Fcons (build_ext_string (pcio[0].label, PG_OS_CODING), - Fcons (build_ext_string (pcio[0].dispchar, PG_OS_CODING), - Fcons (make_int (pcio[0].dispsize), Qnil)))))))); + temp = + list1 (nconc2 (list4 (build_extstring (pcio[0].keyword, PG_OS_CODING), + build_extstring (pcio[0].envvar, PG_OS_CODING), + build_extstring (pcio[0].compiled, PG_OS_CODING), + build_extstring (pcio[0].val, PG_OS_CODING)), + list3 (build_extstring (pcio[0].label, PG_OS_CODING), + build_extstring (pcio[0].dispchar, PG_OS_CODING), + make_int (pcio[0].dispsize)))); for (i = 1; pcio[i].keyword; i++) { - temp1 = list1 (Fcons (build_ext_string (pcio[i].keyword, PG_OS_CODING), - Fcons (build_ext_string (pcio[i].envvar, PG_OS_CODING), - Fcons (build_ext_string (pcio[i].compiled, PG_OS_CODING), - Fcons (build_ext_string (pcio[i].val, PG_OS_CODING), - Fcons (build_ext_string (pcio[i].label, PG_OS_CODING), - Fcons (build_ext_string (pcio[i].dispchar, PG_OS_CODING), - Fcons (make_int (pcio[i].dispsize), Qnil)))))))); + temp1 = + list1 (nconc2 (list4 (build_extstring (pcio[i].keyword, PG_OS_CODING), + build_extstring (pcio[i].envvar, PG_OS_CODING), + build_extstring (pcio[i].compiled, PG_OS_CODING), + build_extstring (pcio[i].val, PG_OS_CODING)), + list3 (build_extstring (pcio[i].label, PG_OS_CODING), + build_extstring (pcio[i].dispchar, PG_OS_CODING), + make_int (pcio[i].dispsize)))); { Lisp_Object args[2]; args[0] = temp; @@ -464,44 +488,57 @@ PGconn *PQconnectdb(const char *conninfo) */ +#ifdef HAVE_POSTGRESQLV7 +#define USED_IF_V7(x) x +#else +#define USED_IF_V7(x) UNUSED (x) +#endif + +static Lisp_Object +postgresql_connect (Lisp_Object conninfo, int USED_IF_V7 (async)) +{ + PGconn *P; + Lisp_PGconn *lisp_pgconn; + + CHECK_STRING (conninfo); + + P = ( +#ifdef HAVE_POSTGRESQLV7 + async ? PQconnectStart : +#endif + PQconnectdb) + (LISP_STRING_TO_EXTERNAL (conninfo, PG_OS_CODING)); + if (P && (PQstatus (P) == CONNECTION_OK)) + { + (void) PQsetNoticeProcessor (P, xemacs_notice_processor, NULL); + lisp_pgconn = allocate_pgconn (); + lisp_pgconn->pgconn = P; + return make_pgconn (lisp_pgconn); + } + else + { + /* Connection failed. Destroy the connection and signal an error. */ + + Lisp_Object errmsg; + if (P) + { + errmsg = build_extstring (PQerrorMessage (P), PG_OS_CODING); + PQfinish (P); + } + else + errmsg = build_msg_string ("Out of Memory?"); + signal_error (Qprocess_error, "Connecting to PostGreSQL backend", + errmsg); + } +} + /* ###autoload */ DEFUN ("pq-connectdb", Fpq_connectdb, 1, 1, 0, /* Make a new connection to a PostgreSQL backend. */ (conninfo)) { - PGconn *P; - Lisp_PGconn *lisp_pgconn; - char *error_message = "Out of Memory?"; - char *c_conninfo; - - CHECK_STRING (conninfo); - - TO_EXTERNAL_FORMAT(LISP_STRING, conninfo, - C_STRING_ALLOCA, c_conninfo, Qnative); - P = PQconnectdb (c_conninfo); - if (P && (PQstatus (P) == CONNECTION_OK)) - { - (void)PQsetNoticeProcessor (P, xemacs_notice_processor, NULL); - lisp_pgconn = allocate_pgconn(); - lisp_pgconn->pgconn = P; - return make_pgconn (lisp_pgconn); - } - else - { - /* Connection failed. Destroy the connection and signal an error. */ - char buf[BLCKSZ]; - strcpy (buf, error_message); - if (P) - { - /* storage for the error message gets erased when call PQfinish */ - /* so we must temporarily stash it somewhere */ - strncpy (buf, PQerrorMessage (P), sizeof (buf)); - buf[sizeof (buf) - 1] = '\0'; - PQfinish (P); - } - signal_ferror (Qprocess_error, "libpq: %s", buf); - } + return postgresql_connect (conninfo, 0); } /* PQconnectStart Makes a new asynchronous connection to a backend. @@ -515,37 +552,7 @@ */ (conninfo)) { - PGconn *P; - Lisp_PGconn *lisp_pgconn; - char *error_message = "Out of Memory?"; - char *c_conninfo; - - CHECK_STRING (conninfo); - TO_EXTERNAL_FORMAT (LISP_STRING, conninfo, - C_STRING_ALLOCA, c_conninfo, Qnative); - P = PQconnectStart (c_conninfo); - - if (P && (PQstatus (P) != CONNECTION_BAD)) - { - (void)PQsetNoticeProcessor (P, xemacs_notice_processor, NULL); - lisp_pgconn = allocate_pgconn(); - lisp_pgconn->pgconn = P; - - return make_pgconn (lisp_pgconn); - } - else - { - /* capture the error message before destroying the object */ - char buf[BLCKSZ]; - strcpy (buf, error_message); - if (P) - { - strncpy (buf, PQerrorMessage (P), sizeof (buf)); - buf[sizeof (buf) - 1] = '\0'; - PQfinish (P); - } - signal_ferror (Qprocess_error, "libpq: %s", buf); - } + return postgresql_connect (conninfo, 1); } DEFUN ("pq-connect-poll", Fpq_connect_poll, 1, 1, 0, /* @@ -566,10 +573,7 @@ { case PGRES_POLLING_FAILED: /* Something Bad has happened */ - { - char *e = PQerrorMessage (P); - signal_ferror (Qprocess_error, "libpq: %s", e); - } + SIGNAL_ERROR (P, "Polling asynchronous connection"); case PGRES_POLLING_OK: return Qpgres_polling_ok; case PGRES_POLLING_READING: @@ -732,10 +736,7 @@ CHECK_LIVE_CONNECTION (P); if (PQresetStart (P)) return Qt; - { - char *e = PQerrorMessage (P); - signal_ferror (Qprocess_error, "libpq: %s", e); - } + SIGNAL_ERROR (P, "Resetting connection"); } DEFUN ("pq-reset-poll", Fpq_reset_poll, 1, 1, 0, /* @@ -755,11 +756,7 @@ switch (polling_status) { case PGRES_POLLING_FAILED: - /* Something Bad has happened */ - { - char *e = PQerrorMessage (P); - signal_ferror (Qprocess_error, "libpq: %s", e); - } + SIGNAL_ERROR (P, "Polling asynchronous reset"); case PGRES_POLLING_OK: return Qpgres_polling_ok; case PGRES_POLLING_READING: @@ -821,22 +818,22 @@ /* PQdb Returns the database name of the connection. char *PQdb(PGconn *conn) */ - return build_ext_string (PQdb(P), PG_OS_CODING); + return build_extstring (PQdb(P), PG_OS_CODING); else if (EQ (field, Qpquser)) /* PQuser Returns the user name of the connection. char *PQuser(PGconn *conn) */ - return build_ext_string (PQuser(P), PG_OS_CODING); + return build_extstring (PQuser(P), PG_OS_CODING); else if (EQ (field, Qpqpass)) /* PQpass Returns the password of the connection. char *PQpass(PGconn *conn) */ - return build_ext_string (PQpass(P), PG_OS_CODING); + return build_extstring (PQpass(P), PG_OS_CODING); else if (EQ (field, Qpqhost)) /* PQhost Returns the server host name of the connection. char *PQhost(PGconn *conn) */ - return build_ext_string (PQhost(P), PG_OS_CODING); + return build_extstring (PQhost(P), PG_OS_CODING); else if (EQ (field, Qpqport)) { char *p; @@ -852,12 +849,12 @@ /* PQtty Returns the debug tty of the connection. char *PQtty(PGconn *conn) */ - return build_ext_string (PQtty(P), PG_OS_CODING); + return build_extstring (PQtty(P), PG_OS_CODING); else if (EQ (field, Qpqoptions)) /* PQoptions Returns the backend options used in the connection. char *PQoptions(PGconn *conn) */ - return build_ext_string (PQoptions(P), PG_OS_CODING); + return build_extstring (PQoptions(P), PG_OS_CODING); else if (EQ (field, Qpqstatus)) { ConnStatusType cst; @@ -886,7 +883,7 @@ by an operation on the connection. char *PQerrorMessage(PGconn* conn); */ - return build_ext_string (PQerrorMessage(P), PG_OS_CODING); + return build_extstring (PQerrorMessage(P), PG_OS_CODING); else if (EQ (field, Qpqbackendpid)) /* PQbackendPID Returns the process ID of the backend server handling this connection. @@ -919,7 +916,8 @@ R = PQexec (P, c_query); { - char *tag, buf[BLCKSZ]; + const Ascbyte *tag; + char buf[BLCKSZ]; if (!R) out_of_memory ("query: out of memory", Qunbound); else @@ -970,7 +968,7 @@ C_STRING_ALLOCA, c_query, Qnative); if (PQsendQuery (P, c_query)) return Qt; - else signal_ferror (Qprocess_error, "async query: %s", PQerrorMessage (P)); + else SIGNAL_ERROR (P, "Sending asynchronous query"); } DEFUN ("pq-get-result", Fpq_get_result, 1, 1, 0, /* @@ -992,7 +990,8 @@ if (!R) return Qnil; /* not an error, there's no more data to get */ { - char *tag, buf[BLCKSZ]; + const Ascbyte *tag; + char buf[BLCKSZ]; switch (PQresultStatus (R)) { @@ -1044,7 +1043,9 @@ case PGRES_FATAL_ERROR: return Qpgres_fatal_error; default: /* they've added a new field we don't know about */ - signal_ferror (Qprocess_error, "Help! Unknown exec status code %08x from backend!", est); + signal_ferror (Qprocess_error, + "Help! Unknown exec status code %08x from backend!", + est); } } @@ -1059,7 +1060,7 @@ R = (XPGRESULT (result))->pgresult; PUKE_IF_NULL (R); - return build_ext_string (PQresStatus (PQresultStatus (R)), PG_OS_CODING); + return build_extstring (PQresStatus (PQresultStatus (R)), PG_OS_CODING); } /* Sundry PGresult accessor functions */ @@ -1074,7 +1075,7 @@ R = (XPGRESULT (result))->pgresult; PUKE_IF_NULL (R); - return build_ext_string (PQresultErrorMessage (R), PG_OS_CODING); + return build_extstring (PQresultErrorMessage (R), PG_OS_CODING); } DEFUN ("pq-ntuples", Fpq_ntuples, 1, 1, 0, /* @@ -1132,7 +1133,7 @@ R = (XPGRESULT (result))->pgresult; PUKE_IF_NULL (R); - return build_ext_string (PQfname (R, XINT (field_index)), PG_OS_CODING); + return build_extstring (PQfname (R, XINT (field_index)), PG_OS_CODING); } DEFUN ("pq-fnumber", Fpq_fnumber, 2, 2, 0, /* @@ -1217,7 +1218,7 @@ R = (XPGRESULT (result))->pgresult; PUKE_IF_NULL (R); - return build_ext_string (PQgetvalue (R, XINT (tup_num), XINT (field_num)), + return build_extstring (PQgetvalue (R, XINT (tup_num), XINT (field_num)), PG_OS_CODING); } @@ -1267,7 +1268,7 @@ R = (XPGRESULT (result))->pgresult; PUKE_IF_NULL (R); - return build_ext_string (PQcmdStatus (R), PG_OS_CODING); + return build_extstring (PQcmdStatus (R), PG_OS_CODING); } DEFUN ("pq-cmd-tuples", Fpq_cmd_tuples, 1, 1, 0, /* @@ -1281,7 +1282,7 @@ R = (XPGRESULT (result))->pgresult; PUKE_IF_NULL (R); - return build_ext_string (PQcmdTuples (R), PG_OS_CODING); + return build_extstring (PQcmdTuples (R), PG_OS_CODING); } DEFUN ("pq-oid-value", Fpq_oid_value, 1, 1, 0, /* @@ -1375,7 +1376,7 @@ { Lisp_Object temp; - temp = list2 (build_ext_string (PGN->relname, PG_OS_CODING), make_int (PGN->be_pid)); + temp = list2 (build_extstring (PGN->relname, PG_OS_CODING), make_int (PGN->be_pid)); free ((void *)PGN); return temp; } @@ -1405,9 +1406,7 @@ P = (XPGCONN (conn))->pgconn; CHECK_LIVE_CONNECTION (P); - TO_EXTERNAL_FORMAT (LISP_STRING, filename, - C_STRING_ALLOCA, c_filename, - Qfile_name); + LISP_PATHNAME_CONVERT_OUT (filename, c_filename); return make_int ((int)lo_import (P, c_filename)); } @@ -1426,8 +1425,7 @@ P = (XPGCONN (conn))->pgconn; CHECK_LIVE_CONNECTION (P); - TO_EXTERNAL_FORMAT (LISP_STRING, filename, - C_STRING_ALLOCA, c_filename, Qfile_name); + LISP_PATHNAME_CONVERT_OUT (filename, c_filename); return make_int ((int)lo_export (P, XINT (oid), c_filename)); } @@ -1489,7 +1487,7 @@ ret = PQgetline (P, buffer, sizeof (buffer)); - return Fcons (make_int (ret), build_ext_string (buffer, PG_OS_CODING)); + return Fcons (make_int (ret), build_extstring (buffer, PG_OS_CODING)); } DEFUN ("pq-put-line", Fpq_put_line, 2, 2, 0, /* @@ -1558,7 +1556,7 @@ if (ret == -1) return Qt; /* done! */ else if (!ret) return Qnil; /* no data yet */ else return Fcons (make_int (ret), - make_ext_string ((Extbyte *) buffer, ret, PG_OS_CODING)); + make_extstring ((Extbyte *) buffer, ret, PG_OS_CODING)); } DEFUN ("pq-put-nbytes", Fpq_put_nbytes, 2, 2, 0, /* @@ -1828,7 +1826,7 @@ #define FROB(envvar, var) \ if ((p = egetenv (envvar))) \ - var = build_intstring (p); \ + var = build_istring (p); \ else \ var = Qnil diff -r d2ec55325515 -r 8f0cf4fd3d2c nt/ChangeLog --- a/nt/ChangeLog Sat Feb 06 03:59:18 2010 -0600 +++ b/nt/ChangeLog Sat Feb 06 04:01:46 2010 -0600 @@ -1,3 +1,9 @@ +2010-02-03 Jerry James + + * xemacs.rc: Add license and copyright boilerplate text for Jonathan + Harris. + * xpm.mak: Ditto. + 2010-01-28 Jerry James * compface.mak: Add license and copyright boilerplate text based diff -r d2ec55325515 -r 8f0cf4fd3d2c nt/ad2c.sed --- a/nt/ad2c.sed Sat Feb 06 03:59:18 2010 -0600 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,22 +0,0 @@ -/^!/d -/^$/d -s/\\/\\\\/g -s/\\$//g -s/"/\\"/g -s/^/(String) "/ -: test -/\\$/b slash -s/$/",/ -p -d -: slash -n -/^!/d -/^$/d -s/"/\\"/g -s/\\\\/\\/g -s/\\n/\\\\n/g -s/\\t/\\\\t/g -s/\\f/\\\\f/g -s/\\b/\\\\b/g -b test diff -r d2ec55325515 -r 8f0cf4fd3d2c nt/x11.patch --- a/nt/x11.patch Sat Feb 06 03:59:18 2010 -0600 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,27 +0,0 @@ -*** X11.def.old Thu Apr 10 07:29:27 1997 ---- X11.def Wed Jul 02 22:20:16 1997 -*************** -*** 5,15 **** - VERSION 6.1 - EXPORTS - _Xdebug_p=_Xdebug CONSTANT -- _XCreateMutex_fn_p=_XCreateMutex_fn CONSTANT -- _XFreeMutex_fn_p=_XFreeMutex_fn CONSTANT -- _XLockMutex_fn_p=_XLockMutex_fn CONSTANT -- _XUnlockMutex_fn_p=_XUnlockMutex_fn CONSTANT -- _Xglobal_lock_p=_Xglobal_lock CONSTANT - XActivateScreenSaver - XAddConnectionWatch - XAddExtension ---- 5,10 ---- -*************** -*** 623,630 **** - _XUnregisterFilter - _XUnregisterInternalConnection - _XVIDtoVisual -- _Xthread_init -- _Xthread_waiter - XkbIgnoreExtension - XkbOpenDisplay - XkbQueryExtension ---- 618,623 ---- diff -r d2ec55325515 -r 8f0cf4fd3d2c nt/xemacs.mak --- a/nt/xemacs.mak Sat Feb 06 03:59:18 2010 -0600 +++ b/nt/xemacs.mak Sat Feb 06 04:01:46 2010 -0600 @@ -1033,9 +1033,6 @@ set COPYCMD=$(COPYCMD) @copy $(SRC)\config.h.in $(SRC)\config.h -#$(SRC)\Emacs.ad.h: $(SRCROOT)\etc\Emacs.ad -# !"sed -f ad2c.sed < $(SRCROOT)\etc\Emacs.ad > $(SRC)\Emacs.ad.h" - #$(SRC)\paths.h: $(SRC)\paths.h.in # !"cd $(SRC); cp paths.h.in paths.h" diff -r d2ec55325515 -r 8f0cf4fd3d2c nt/xemacs.rc --- a/nt/xemacs.rc Sat Feb 06 03:59:18 2010 -0600 +++ b/nt/xemacs.rc Sat Feb 06 04:01:46 2010 -0600 @@ -1,3 +1,22 @@ +/* Copyright (C) 1997 Free Software Foundation, 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., 51 Franklin St. - Fifth Floor, +Boston, MA 02110-1301, USA. */ + #ifdef INCLUDE_DUMP 101 DUMP "xemacs.dmp" #endif diff -r d2ec55325515 -r 8f0cf4fd3d2c nt/xpm.mak --- a/nt/xpm.mak Sat Feb 06 03:59:18 2010 -0600 +++ b/nt/xpm.mak Sat Feb 06 04:01:46 2010 -0600 @@ -1,6 +1,25 @@ # # XPM Makefile for Microsoft NMAKE without X libraries # +# Copyright (C) 1997 Free Software Foundation, 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., 51 Franklin St. - Fifth Floor, +# Boston, MA 02110-1301, USA. +# !if !defined(DEBUG) !if defined(DEBUG_XEMACS) DEBUG=$(DEBUG_XEMACS) diff -r d2ec55325515 -r 8f0cf4fd3d2c src/.gdbinit.in.in --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/src/.gdbinit.in.in Sat Feb 06 04:01:46 2010 -0600 @@ -0,0 +1,572 @@ +## gdb init file for XEmacs -*- ksh -*- +## This is the source for src/.gdbinit. Edit it, and rerun configure. +## (Running config.status is not enough.) +## The generated file depends on src/config.h (currently only in one place). + +## To insert comments that will remain in the generated file, we use the +## imake XCOMM convention. Lines beginning with "XCOMM " exactly (no +## leading whitespace, one trailing ASCII space, case sensitive) will be +## transformed to gdb command file comments in the generated file. + +XCOMM gdb init file for XEmacs +XCOMM AUTOMATICALLY GENERATED FROM etc/gdbinit.in BY configure -- DO NOT EDIT. +XCOMM See etc/gdbinit.in for licensing information and usage hints. +XCOMM Copyright (C) 1998 Free Software Foundation, Inc. +XCOMM Copyright (C) 2010 Ben Wing. + +## 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., 51 Franklin Street, Fifth Floor, +## Boston, MA 02110-1301 USA + +## Author: Martin Buchholz + +## Other contributors you could ask for help: Ivan Golubev, Jerry James, +## Stephen Turnbull. + +## Some useful commands for debugging emacs with gdb 4.16 or better. +## +## Since this file is called `.gdbinit', it will be read by gdb +## automatically when gdb is run in the build directory, which is where +## developers usually debug their xemacs. You can also source this +## file from your ~/.gdbinit, if you like. +## +## Configure xemacs with --debug, and compile with -g. +## +## See also the question of the XEmacs FAQ, titled +## "How to Debug an XEmacs problem with a debugger". +## +## This can be used to debug XEmacs no matter how the following are +## specified: + +## USE_UNION_TYPE + +## (the above all have configure equivalents) + +## Some functions defined here require a running process, but most +## don't. Considerable effort has been expended to this end. + +## See the dbg_ C support code in src/alloc.c that allows the functions +## defined in this file to work correctly. + +#define NOT_C_CODE +#include "config.h" + +set print union off +set print pretty off + +#ifdef VDB_POSIX +handle SIGSEGV SIGBUS nostop noprint +#endif + +set $Lisp_Type_Int = -2 +set $Lisp_Type_Record = 0 +set $Lisp_Type_Char = 2 + +define decode_object + set $obj = (unsigned long) $arg0 + if $obj & 1 + ## It's an int + set $val = $obj >> 1 + set $type = $Lisp_Type_Int + else + set $type = $obj & dbg_typemask + if $type == $Lisp_Type_Char + set $val = ($obj & dbg_valmask) >> dbg_gctypebits + else + ## It's a record pointer + set $val = $obj + end + end + + if $type == $Lisp_Type_Record + set $lheader = ((struct lrecord_header *) $val) + set $lrecord_type = ($lheader->type) + set $imp = ((struct lrecord_implementation *) lrecord_implementations_table[(int) $lrecord_type]) + else + set $lrecord_type = -1 + set $lheader = -1 + set $imp = -1 + end +end + +document decode_object +Usage: decode_object lisp_object +Extract implementation information from a Lisp Object. +Defines variables $val, $type and $imp. +end + +define xint +decode_object $arg0 +print ((long) $val) +end + +define xtype + decode_object $arg0 + if $type == $Lisp_Type_Int + echo int\n + else + if $type == $Lisp_Type_Char + echo char\n + else + printf "record type: %s\n", $imp->name + end + end +end + +document xtype +Usage: xtype lisp_object +Print the Lisp type of a lisp object. +end + +define lisp-shadows + run -batch -vanilla -f list-load-path-shadows +end + +document lisp-shadows +Usage: lisp-shadows +Run xemacs to check for lisp shadows +end + +define environment-to-run-temacs + unset env EMACSLOADPATH + set env EMACSBOOTSTRAPLOADPATH=@srcdir@/../lisp/:@srcdir@/.. + set env EMACSBOOTSTRAPMODULEPATH=../modules/:.. +end + +define run-temacs + environment-to-run-temacs + run -nd -no-packages -batch -l @srcdir@/../lisp/loadup.el run-temacs -q +end + +document run-temacs +Usage: run-temacs +Run temacs interactively, like xemacs. +Use this with debugging tools (like purify) that cannot deal with dumping, +or when temacs builds successfully, but xemacs does not. +end + +define check-xemacs-arg + run -vanilla -batch -l @srcdir@/../tests/automated/test-harness.el -f batch-test-emacs @srcdir@/../tests/$arg0 +end + +define check-xemacs + if $argc == 0 + check-xemacs-arg automated + else + check-xemacs-arg automated/$arg0 + end +end + +document check-xemacs +Usage: check-xemacs [FILE] +Run the test suite. If no file given, run the whole suite, equivalent to +'make check'. If a file given, run the suite only on the specified file. +end + +define check-temacs-arg + environment-to-run-temacs + run -nd -no-packages -batch -l @srcdir@/../lisp/loadup.el run-temacs -q -batch -l @srcdir@/../tests/automated/test-harness.el -f batch-test-emacs @srcdir@/../tests/$arg0 + +define check-temacs + if $argc == 0 + check-temacs-arg automated + else + check-temacs-arg automated/$arg0 + end +end + +document check-temacs +Usage: check-temacs [FILE] +Run the test suite on temacs. If no file given, run the whole suite, +equivalent to 'make check-temacs'. If a file given, run the suite only on +the specified file. + +Use this with debugging tools (like purify) that cannot deal with dumping, +or when temacs builds successfully, but xemacs does not. +end + +define update-elc + environment-to-run-temacs + run -nd -no-packages -batch -l @srcdir@/../lisp/update-elc.el +end + +document update-elc +Usage: update-elc +Run the core lisp byte compilation part of the build procedure. +Use when debugging temacs, not xemacs! +Use this when temacs builds successfully, but xemacs does not. +end + +define update-elc-2 + environment-to-run-temacs + run -no-packages -batch -no-autoloads -l update-elc-2.el -f batch-update-elc-2 @srcdir@/../lisp +end + +document update-elc-2 +Usage: update-elc-2 +Run the post-dump core lisp byte compilation part of the build procedure. +end + +define dmp + environment-to-run-temacs + run -nd -no-packages -batch -l @srcdir@/../lisp/loadup.el dump +end + +document dmp +Usage: dmp +Run the dumping part of the build procedure. +Use when debugging temacs, not xemacs! +Use this when temacs builds successfully, but xemacs does not. +end + +define ldp + printf "%s", "Lisp => " + call debug_print($arg0) +end + +document ldp +Usage: ldp lisp_object +Print a Lisp Object value using the Lisp printer. +Requires a running xemacs process. +end + +define lbt +call debug_backtrace() +end + +document lbt +Usage: lbt +Print the current Lisp stack trace. +Requires a running xemacs process. +end + + +define leval +ldp Feval(Fcar(Fread_from_string(build_cistring($arg0),Qnil,Qnil))) +end + +document leval +Usage: leval "SEXP" +Eval a lisp expression. +Requires a running xemacs process. + +Example: +(gdb) leval "(+ 1 2)" +Lisp ==> 3 +end + + +define wtype +print $arg0->core.widget_class->core_class.class_name +end + +define xtname +print XrmQuarkToString(((Object)($arg0))->object.xrm_name) +end + +## GDB's command language makes you want to ... + +define pptype + set $type_ptr = ($arg0 *) $val + print $type_ptr + print *$type_ptr +end + +define pstructtype + set $type_ptr = (struct $arg0 *) $val + print $type_ptr + print *$type_ptr +end + +define pobj + decode_object $arg0 + if $type == $Lisp_Type_Int + printf "Integer: %d\n", $val + else + if $type == $Lisp_Type_Char + if $val > 32 && $val < 128 + printf "Char: %c\n", $val + else + printf "Char: %d\n", $val + end + else + if $lrecord_type == lrecord_type_string + pptype Lisp_String + else + if $lrecord_type == lrecord_type_cons + pptype Lisp_Cons + else + if $lrecord_type == lrecord_type_symbol + pptype Lisp_Symbol + printf "Symbol name: %s\n", ((Lisp_String *)$type_ptr->name)->data_ + else + if $lrecord_type == lrecord_type_vector + pptype Lisp_Vector + printf "Vector of length %d\n", $type_ptr->size + ##print *($type_ptr->data) @ $type_ptr->size + else + if $lrecord_type == lrecord_type_bit_vector + pptype Lisp_Bit_Vector + else + if $lrecord_type == lrecord_type_buffer + pstructtype buffer + else + if $lrecord_type == lrecord_type_char_table + pptype Lisp_Char_Table + else + if $lrecord_type == lrecord_type_char_table_entry + pptype Lisp_Char_Table_Entry + else + if $lrecord_type == lrecord_type_charset + pptype Lisp_Charset + else + if $lrecord_type == lrecord_type_coding_system + pptype Lisp_Coding_System + else + if $lrecord_type == lrecord_type_color_instance + pptype Lisp_Color_Instance + else + if $lrecord_type == lrecord_type_command_builder + pptype command_builder + else + if $lrecord_type == lrecord_type_compiled_function + pptype Lisp_Compiled_Function + else + if $lrecord_type == lrecord_type_console + pstructtype console + else + if $lrecord_type == lrecord_type_database + pptype Lisp_Database + else + if $lrecord_type == lrecord_type_device + pstructtype device + else + if $lrecord_type == lrecord_type_event + pptype Lisp_Event + else + if $lrecord_type == lrecord_type_extent + pstructtype extent + else + if $lrecord_type == lrecord_type_extent_auxiliary + pstructtype extent_auxiliary + else + if $lrecord_type == lrecord_type_extent_info + pstructtype extent_info + else + if $lrecord_type == lrecord_type_face + pptype Lisp_Face + else + if $lrecord_type == lrecord_type_float + pptype Lisp_Float + else + if $lrecord_type == lrecord_type_font_instance + pptype Lisp_Font_Instance + else + if $lrecord_type == lrecord_type_frame + pstructtype frame + else + if $lrecord_type == lrecord_type_glyph + pptype Lisp_Glyph + else + if $lrecord_type == lrecord_type_gui_item + pptype Lisp_Gui_Item + else + if $lrecord_type == lrecord_type_hash_table + pptype Lisp_Hash_Table + else + if $lrecord_type == lrecord_type_image_instance + pptype Lisp_Image_Instance + else + if $lrecord_type == lrecord_type_keymap + pptype Lisp_Keymap + else + if $lrecord_type == lrecord_type_lcrecord_list + pstructtype lcrecord_list + else + if $lrecord_type == lrecord_type_ldap + pptype Lisp_LDAP + else + if $lrecord_type == lrecord_type_lstream + pstructtype lstream + else + if $lrecord_type == lrecord_type_marker + pptype Lisp_Marker + else + if $lrecord_type == lrecord_type_opaque + pptype Lisp_Opaque + else + if $lrecord_type == lrecord_type_opaque_ptr + pptype Lisp_Opaque_Ptr + else + if $lrecord_type == lrecord_type_popup_data + pptype popup_data + else + if $lrecord_type == lrecord_type_process + pptype Lisp_Process + else + if $lrecord_type == lrecord_type_range_table + pptype Lisp_Range_Table + else + if $lrecord_type == lrecord_type_specifier + pptype Lisp_Specifier + else + if $lrecord_type == lrecord_type_subr + pptype Lisp_Subr + else + if $lrecord_type == lrecord_type_symbol_value_buffer_local + pstructtype symbol_value_buffer_local + else + if $lrecord_type == lrecord_type_symbol_value_forward + pstructtype symbol_value_forward + else + if $lrecord_type == lrecord_type_symbol_value_lisp_magic + pstructtype symbol_value_lisp_magic + else + if $lrecord_type == lrecord_type_symbol_value_varalias + pstructtype symbol_value_varalias + else + if $lrecord_type == lrecord_type_timeout + pptype Lisp_Timeout + else + if $lrecord_type == lrecord_type_toolbar_button + pstructtype toolbar_button + else + if $lrecord_type == lrecord_type_tooltalk_message + pptype Lisp_Tooltalk_Message + else + if $lrecord_type == lrecord_type_tooltalk_pattern + pptype Lisp_Tooltalk_Pattern + else + if $lrecord_type == lrecord_type_weak_list + pstructtype weak_list + else + if $lrecord_type == lrecord_type_window + pstructtype window + else + if $lrecord_type == lrecord_type_window_configuration + pstructtype window_config + else + if $lrecord_type == lrecord_type_fc_pattern + pstructtype fc_pattern + else + if $lrecord_type == lrecord_type_fc_config + pstructtype fc_config + else + echo Unknown Lisp Object type\n + print $arg0 + ## Barf, gag, retch + end + end + end + end + end + end + end + end + end + end + end + end + end + end + end + end + end + end + end + ## Repeat after me... gdb sux, gdb sux, gdb sux... + end + end + end + end + end + end + end + end + end + end + end + end + end + end + end + end + end + end + ## Are we having fun yet?? + end + end + end + end + end + end + end + end + end + end + end + end + end + end + end + end + end + end +end + +document pobj +Usage: pobj lisp_object +Print the internal C representation of a Lisp Object. +end + +## ------------------------------------------------------------- +## functions to test the debugging support itself. +## If you change this file, make sure the following still work... +## ------------------------------------------------------------- +define test_xtype + printf "Vemacs_major_version: " + xtype Vemacs_major_version + printf "Vhelp_char: " + xtype Vhelp_char + printf "Qnil: " + xtype Qnil + printf "Qunbound: " + xtype Qunbound + printf "Vobarray: " + xtype Vobarray + printf "Vall_weak_lists: " + xtype Vall_weak_lists + printf "Vxemacs_codename: " + xtype Vxemacs_codename +end + +define test_pobj + printf "Vemacs_major_version: " + pobj Vemacs_major_version + printf "Vhelp_char: " + pobj Vhelp_char + printf "Qnil: " + pobj Qnil + printf "Qunbound: " + pobj Qunbound + printf "Vobarray: " + pobj Vobarray + printf "Vall_weak_lists: " + pobj Vall_weak_lists + printf "Vxemacs_codename: " + pobj Vxemacs_codename +end + diff -r d2ec55325515 -r 8f0cf4fd3d2c src/ChangeLog --- a/src/ChangeLog Sat Feb 06 03:59:18 2010 -0600 +++ b/src/ChangeLog Sat Feb 06 04:01:46 2010 -0600 @@ -1,3 +1,836 @@ +2010-02-05 Ben Wing + + * syswindows.h (LOCAL_FILE_FORMAT_TO_TSTR): + Cast pointer when storing value to avoid problems because some + store vars are Extbyte * and some are LPTSTR. + +2010-02-05 Jerry James + + * s/sco7.h: Add copyright and license header with the permission of + Ron Record, the author. + +2010-02-05 Ben Wing + + * depend: + Regenerate. + * make-src-depend (PrintPatternDeps): + Remove refs to xgccache, no longer existent. + + * select-gtk.c (THIS_IS_GTK): + * select-gtk.c (gtk_decline_selection_request): + * select-x.c (THIS_IS_X): + * select-xlike-inc.c: + * select-xlike-inc.c (selection_data_to_lisp_data): + Rename PROCESSING_X_CODE to THIS_IS_X and PROCESSING_GTK_CODE to + THIS_SI_GTK for consistency with other xlike code. + + Rename select-xlike-inc.c from select-common.h, in keeping with + xlike terminology. + +2010-02-05 Ben Wing + + * console-msw.c (write_string_to_mswindows_debugging_output): + * console-msw.c (Fmswindows_message_box): + * console-x.c (x_perhaps_init_unseen_key_defaults): + * console.c: + * database.c (dbm_get): + * database.c (dbm_put): + * database.c (dbm_remove): + * database.c (berkdb_get): + * database.c (berkdb_put): + * database.c (berkdb_remove): + * database.c (Fopen_database): + * device-gtk.c (gtk_init_device): + * device-msw.c (msprinter_init_device_internal): + * device-msw.c (msprinter_default_printer): + * device-msw.c (msprinter_init_device): + * device-msw.c (sync_printer_with_devmode): + * device-msw.c (Fmsprinter_select_settings): + * device-x.c (sanity_check_geometry_resource): + * device-x.c (Dynarr_add_validified_lisp_string): + * device-x.c (x_init_device): + * device-x.c (Fx_put_resource): + * device-x.c (Fx_valid_keysym_name_p): + * device-x.c (Fx_set_font_path): + * dialog-msw.c (push_lisp_string_as_unicode): + * dialog-msw.c (handle_directory_dialog_box): + * dialog-msw.c (handle_file_dialog_box): + * dialog-x.c (dbox_descriptor_to_widget_value): + * editfns.c (Fformat_time_string): + * editfns.c (Fencode_time): + * editfns.c (Fset_time_zone_rule): + * emacs.c (make_argc_argv): + * emacs.c (Fdump_emacs): + * emodules.c (emodules_load): + * eval.c: + * eval.c (maybe_signal_error_1): + * event-msw.c (Fdde_alloc_advise_item): + * event-msw.c (mswindows_dde_callback): + * event-msw.c (mswindows_wnd_proc): + * fileio.c (report_error_with_errno): + * fileio.c (Fsysnetunam): + * fileio.c (Fdo_auto_save): + * font-mgr.c (extract_fcapi_string): + * font-mgr.c (Ffc_config_app_font_add_file): + * font-mgr.c (Ffc_config_app_font_add_dir): + * font-mgr.c (Ffc_config_filename): + * frame-gtk.c (gtk_set_frame_text_value): + * frame-gtk.c (gtk_create_widgets): + * frame-msw.c (mswindows_init_frame_1): + * frame-msw.c (mswindows_set_title_from_ibyte): + * frame-msw.c (msprinter_init_frame_3): + * frame-x.c (x_set_frame_text_value): + * frame-x.c (x_set_frame_properties): + * frame-x.c (start_drag_internal_1): + * frame-x.c (x_cde_transfer_callback): + * frame-x.c (x_create_widgets): + * glyphs-eimage.c (my_jpeg_output_message): + * glyphs-eimage.c (jpeg_instantiate): + * glyphs-eimage.c (gif_instantiate): + * glyphs-eimage.c (png_instantiate): + * glyphs-eimage.c (tiff_instantiate): + * glyphs-gtk.c (xbm_instantiate_1): + * glyphs-gtk.c (gtk_xbm_instantiate): + * glyphs-gtk.c (gtk_xpm_instantiate): + * glyphs-gtk.c (gtk_xface_instantiate): + * glyphs-gtk.c (cursor_font_instantiate): + * glyphs-gtk.c (gtk_redisplay_widget): + * glyphs-gtk.c (gtk_widget_instantiate_1): + * glyphs-gtk.c (gtk_add_tab_item): + * glyphs-msw.c (mswindows_xpm_instantiate): + * glyphs-msw.c (bmp_instantiate): + * glyphs-msw.c (mswindows_resource_instantiate): + * glyphs-msw.c (xbm_instantiate_1): + * glyphs-msw.c (mswindows_xbm_instantiate): + * glyphs-msw.c (mswindows_xface_instantiate): + * glyphs-msw.c (mswindows_redisplay_widget): + * glyphs-msw.c (mswindows_widget_instantiate): + * glyphs-msw.c (add_tree_item): + * glyphs-msw.c (add_tab_item): + * glyphs-msw.c (mswindows_combo_box_instantiate): + * glyphs-msw.c (mswindows_widget_query_string_geometry): + * glyphs-x.c (x_locate_pixmap_file): + * glyphs-x.c (xbm_instantiate_1): + * glyphs-x.c (x_xbm_instantiate): + * glyphs-x.c (extract_xpm_color_names): + * glyphs-x.c (x_xpm_instantiate): + * glyphs-x.c (x_xface_instantiate): + * glyphs-x.c (autodetect_instantiate): + * glyphs-x.c (safe_XLoadFont): + * glyphs-x.c (cursor_font_instantiate): + * glyphs-x.c (x_redisplay_widget): + * glyphs-x.c (Fchange_subwindow_property): + * glyphs-x.c (x_widget_instantiate): + * glyphs-x.c (x_tab_control_redisplay): + * glyphs.c (pixmap_to_lisp_data): + * gui-x.c (menu_separator_style_and_to_external): + * gui-x.c (add_accel_and_to_external): + * gui-x.c (button_item_to_widget_value): + * hpplay.c (player_error_internal): + * hpplay.c (play_sound_file): + * hpplay.c (play_sound_data): + * intl.c (Fset_current_locale): + * lisp.h: + * menubar-gtk.c (gtk_xemacs_set_accel_keys): + * menubar-msw.c (populate_menu_add_item): + * menubar-msw.c (populate_or_checksum_helper): + * menubar-x.c (menu_item_descriptor_to_widget_value_1): + * nt.c (init_user_info): + * nt.c (get_long_basename): + * nt.c (nt_get_resource): + * nt.c (init_mswindows_environment): + * nt.c (get_cached_volume_information): + * nt.c (mswindows_readdir): + * nt.c (read_unc_volume): + * nt.c (mswindows_stat): + * nt.c (mswindows_getdcwd): + * nt.c (mswindows_executable_type): + * nt.c (Fmswindows_short_file_name): + * ntplay.c (nt_play_sound_file): + * objects-gtk.c: + * objects-gtk.c (gtk_valid_color_name_p): + * objects-gtk.c (gtk_initialize_font_instance): + * objects-gtk.c (gtk_font_list): + * objects-msw.c (font_enum_callback_2): + * objects-msw.c (parse_font_spec): + * objects-x.c (x_parse_nearest_color): + * objects-x.c (x_valid_color_name_p): + * objects-x.c (x_initialize_font_instance): + * objects-x.c (x_font_instance_truename): + * objects-x.c (x_font_list): + * objects-xlike-inc.c (XFUN): + * objects-xlike-inc.c (xft_find_charset_font): + * process-nt.c (mswindows_report_winsock_error): + * process-nt.c (nt_create_process): + * process-nt.c (get_internet_address): + * process-nt.c (nt_open_network_stream): + * process-unix.c: + * process-unix.c (allocate_pty): + * process-unix.c (get_internet_address): + * process-unix.c (unix_canonicalize_host_name): + * process-unix.c (unix_open_network_stream): + * realpath.c: + * select-common.h (lisp_data_to_selection_data): + * select-gtk.c (symbol_to_gtk_atom): + * select-gtk.c (atom_to_symbol): + * select-msw.c (symbol_to_ms_cf): + * select-msw.c (mswindows_register_selection_data_type): + * select-x.c (symbol_to_x_atom): + * select-x.c (x_atom_to_symbol): + * select-x.c (hack_motif_clipboard_selection): + * select-x.c (Fx_store_cutbuffer_internal): + * sound.c (Fplay_sound_file): + * sound.c (Fplay_sound): + * sound.h (sound_perror): + * sysdep.c: + * sysdep.c (qxe_allocating_getcwd): + * sysdep.c (qxe_execve): + * sysdep.c (copy_in_passwd): + * sysdep.c (qxe_getpwnam): + * sysdep.c (qxe_ctime): + * sysdll.c (dll_open): + * sysdll.c (dll_function): + * sysdll.c (dll_variable): + * sysdll.c (search_linked_libs): + * sysdll.c (dll_error): + * sysfile.h: + * sysfile.h (PATHNAME_CONVERT_OUT_TSTR): + * sysfile.h (PATHNAME_CONVERT_OUT_UTF_8): + * sysfile.h (PATHNAME_CONVERT_OUT): + * sysfile.h (LISP_PATHNAME_CONVERT_OUT): + * syswindows.h (ITEXT_TO_TSTR): + * syswindows.h (LOCAL_FILE_FORMAT_TO_TSTR): + * syswindows.h (TSTR_TO_LOCAL_FILE_FORMAT): + * syswindows.h (LOCAL_FILE_FORMAT_TO_INTERNAL_MSWIN): + * syswindows.h (LISP_LOCAL_FILE_FORMAT_MAYBE_URL_TO_TSTR): + * text.h: + * text.h (eicpy_ext_len): + * text.h (enum new_dfc_src_type): + * text.h (EXTERNAL_TO_ITEXT): + * text.h (GET_STRERROR): + * tooltalk.c (check_status): + * tooltalk.c (Fadd_tooltalk_message_arg): + * tooltalk.c (Fadd_tooltalk_pattern_attribute): + * tooltalk.c (Fadd_tooltalk_pattern_arg): + * win32.c (tstr_to_local_file_format): + * win32.c (mswindows_lisp_error_1): + * win32.c (mswindows_report_process_error): + * win32.c (Fmswindows_shell_execute): + * win32.c (mswindows_read_link_1): + + Changes involving external/internal format conversion, + mostly code cleanup and renaming. + + 1. Eliminate the previous macros like LISP_STRING_TO_EXTERNAL + that stored its result in a parameter. The new version of + LISP_STRING_TO_EXTERNAL returns its result through the + return value, same as the previous NEW_LISP_STRING_TO_EXTERNAL. + Use the new-style macros throughout the code. + 2. Rename C_STRING_TO_EXTERNAL and friends to ITEXT_TO_EXTERNAL, + in keeping with overall naming rationalization involving + Itext and related types. + + Macros involved in previous two: + + EXTERNAL_TO_C_STRING -> EXTERNAL_TO_ITEXT + EXTERNAL_TO_C_STRING_MALLOC -> EXTERNAL_TO_ITEXT_MALLOC + SIZED_EXTERNAL_TO_C_STRING -> SIZED_EXTERNAL_TO_ITEXT + SIZED_EXTERNAL_TO_C_STRING_MALLOC -> SIZED_EXTERNAL_TO_ITEXT_MALLOC + C_STRING_TO_EXTERNAL -> ITEXT_TO_EXTERNAL + C_STRING_TO_EXTERNAL_MALLOC -> ITEXT_TO_EXTERNAL_MALLOC + LISP_STRING_TO_EXTERNAL + LISP_STRING_TO_EXTERNAL_MALLOC + LISP_STRING_TO_TSTR + C_STRING_TO_TSTR -> ITEXT_TO_TSTR + TSTR_TO_C_STRING -> TSTR_TO_ITEXT + + The following four still return their values through parameters, + since they have more than one value to return: + + C_STRING_TO_SIZED_EXTERNAL -> ITEXT_TO_SIZED_EXTERNAL + LISP_STRING_TO_SIZED_EXTERNAL + C_STRING_TO_SIZED_EXTERNAL_MALLOC -> ITEXT_TO_SIZED_EXTERNAL_MALLOC + LISP_STRING_TO_SIZED_EXTERNAL_MALLOC + + Sometimes additional casts had to be inserted, since the old + macros played strange games and completely defeated the type system + of the store params. + 3. Rewrite many places where direct calls to TO_EXTERNAL_FORMAT + occurred with calls to one of the convenience macros listed above, + or to make_extstring(). + 4. Eliminate SIZED_C_STRING macros (they were hardly used, anyway) + and use a direct call to TO_EXTERNAL_FORMAT or TO_INTERNAL_FORMAT. + 4. Use LISP_PATHNAME_CONVERT_OUT in many places instead of something + like LISP_STRING_TO_EXTERNAL(..., Qfile_name). + 5. Eliminate some temporary variables that are no longer necessary + now that we return a value rather than storing it into a variable. + 6. Some Mule-izing in database.c. + 7. Error functions: + -- A bit of code cleanup in maybe_signal_error_1. + -- Eliminate report_file_type_error; it's just an alias for + signal_error_2 with params in a different order. + -- Fix some places in the hostname-handling code that directly + inserted externally-retrieved error strings into the + supposed ASCII "reason" param instead of doing the right thing + and sticking text descriptive of what was going on in "reason" + and putting the external message in a frob. + 8. Use Ascbyte instead of CIbyte in process-unix.c and maybe one + or two other places. + 9. Some code cleanup in copy_in_passwd() in sysdep.c. + 10. Fix a real bug due to accidental variable shadowing in + tstr_to_local_file_format() in win32.c. + +2010-02-05 Ben Wing + + * lisp.h: + * lisp.h (staticpro_nodump_1): + Define staticpro_1 and staticpro_nodump_1 when not XEMACS_DEBUG. + + * symbols.c (defsymbol_massage_name_1): + * symbols.c (defsymbol_massage_multiword_predicate): + Cosmetic fixes. + +2010-02-05 Ben Wing + + * bytecode.c (bytecode_assert): + Use 0 instead of x in disabled_assert calls to avoid errors due + to using undefined vars/params (they are defined only when + ERROR_CHECK_BYTE_CODE, which also turns on/off the asserts). + +2010-02-04 Ben Wing + + * alloc.c (release_breathing_space): + * alloc.c (resize_string): + * alloc.c (sweep_lcrecords_1): + * alloc.c (SWEEP_FIXED_TYPE_BLOCK_1): + * alloc.c (ADDITIONAL_FREE_compiled_function): + * alloc.c (compact_string_chars): + * alloc.c (ADDITIONAL_FREE_string): + * alloc.c (sweep_strings): + * alloca.c (xemacs_c_alloca): + * alsaplay.c (alsa_play_sound_file): + * buffer.c (init_initial_directory): + * buffer.h: + * buffer.h (BUFFER_FREE): + * console-stream.c (stream_delete_console): + * console-tty.c (free_tty_console_struct): + * data.c (Fnumber_to_string): + * device-gtk.c (gtk_init_device): + * device-gtk.c (free_gtk_device_struct): + * device-gtk.c (gtk_delete_device): + * device-msw.c (mswindows_delete_device): + * device-msw.c (msprinter_delete_device): + * device-tty.c (free_tty_device_struct): + * device-tty.c (tty_delete_device): + * device-x.c (x_init_device): + * device-x.c (free_x_device_struct): + * device-x.c (x_delete_device): + * dialog-msw.c (handle_directory_dialog_box): + * dialog-x.c (dbox_descriptor_to_widget_value): + * dired-msw.c (Fmswindows_insert_directory): + * dired.c (free_user_cache): + * dired.c (user_name_completion_unwind): + * doc.c (unparesseuxify_doc_string): + * doc.c (Fsubstitute_command_keys): + * doprnt.c (emacs_doprnt_1): + * dumper.c (pdump_load_finish): + * dumper.c (pdump_file_free): + * dumper.c (pdump_file_unmap): + * dynarr.c: + * dynarr.c (Dynarr_free): + * editfns.c (uncache_home_directory): + * editfns.c (Fset_time_zone_rule): + * elhash.c: + * elhash.c (pdump_reorganize_hash_table): + * elhash.c (maphash_unwind): + * emacs.c (make_arg_list_1): + * emacs.c (free_argc_argv): + * emacs.c (sort_args): + * emacs.c (Frunning_temacs_p): + * emodules.c (attempt_module_delete): + * eval.c (free_pointer): + * event-Xt.c (unselect_filedesc): + * event-Xt.c (emacs_Xt_select_process): + * event-gtk.c (unselect_filedesc): + * event-gtk.c (dragndrop_data_received): + * event-msw.c (winsock_closer): + * event-msw.c (mswindows_dde_callback): + * event-msw.c (mswindows_wnd_proc): + * event-stream.c (finalize_command_builder): + * event-stream.c (free_command_builder): + * extents.c (free_gap_array): + * extents.c (free_extent_list): + * extents.c (free_soe): + * extents.c (extent_fragment_delete): + * extents.c (extent_priority_sort_function): + * file-coding.c (make_coding_system_1): + * file-coding.c (coding_finalizer): + * file-coding.c (set_coding_stream_coding_system): + * file-coding.c (chain_finalize_coding_stream_1): + * file-coding.c (chain_finalize): + * file-coding.c (free_detection_state): + * file-coding.c (coding_category_symbol_to_id): + * fileio.c: + * fileio.c (Ffile_name_directory): + * fileio.c (if): + * fileio.c (Ffile_symlink_p): + * filelock.c (FREE_LOCK_INFO): + * filelock.c (current_lock_owner): + * font-mgr.c (Ffc_name_unparse): + * font-mgr.c (Ffc_pattern_duplicate): + * frame-gtk.c (gtk_delete_frame): + * frame-msw.c (mswindows_delete_frame): + * frame-msw.c (msprinter_delete_frame): + * frame-x.c (x_cde_destroy_callback): + * frame-x.c (Fcde_start_drag_internal): + * frame-x.c (x_cde_transfer_callback): + * frame-x.c (x_delete_frame): + * frame.c (update_frame_title): + * frame.c (Fset_frame_pointer): + * gc.c (register_for_finalization): + * gccache-gtk.c (free_gc_cache): + * gccache-gtk.c (gc_cache_lookup): + * gccache-x.c (free_gc_cache): + * gccache-x.c (gc_cache_lookup): + * glyphs-eimage.c: + * glyphs-eimage.c (jpeg_instantiate_unwind): + * glyphs-eimage.c (gif_instantiate_unwind): + * glyphs-eimage.c (png_instantiate_unwind): + * glyphs-eimage.c (png_instantiate): + * glyphs-eimage.c (tiff_instantiate_unwind): + * glyphs-gtk.c (convert_EImage_to_GDKImage): + * glyphs-gtk.c (gtk_finalize_image_instance): + * glyphs-gtk.c (gtk_init_image_instance_from_eimage): + * glyphs-gtk.c (gtk_xpm_instantiate): + * glyphs-msw.c (convert_EImage_to_DIBitmap): + * glyphs-msw.c (mswindows_init_image_instance_from_eimage): + * glyphs-msw.c (mswindows_initialize_image_instance_mask): + * glyphs-msw.c (xpm_to_eimage): + * glyphs-msw.c (mswindows_xpm_instantiate): + * glyphs-msw.c (xbm_create_bitmap_from_data): + * glyphs-msw.c (mswindows_finalize_image_instance): + * glyphs-x.c (convert_EImage_to_XImage): + * glyphs-x.c (x_finalize_image_instance): + * glyphs-x.c (x_init_image_instance_from_eimage): + * glyphs-x.c (x_xpm_instantiate): + * gui-x.c (free_popup_widget_value_tree): + * hash.c (free_hash_table): + * hash.c (grow_hash_table): + * hash.c (pregrow_hash_table_if_necessary): + * imgproc.c (build_EImage_quantable): + * insdel.c (uninit_buffer_text): + * intl-win32.c (convert_multibyte_to_internal_malloc): + * intl.c: + * intl.c (Fset_current_locale): + * keymap.c: + * keymap.c (where_is_recursive_mapper): + * keymap.c (where_is_internal): + * lisp.h: + * lisp.h (xfree): + * lstream.c (Lstream_close): + * lstream.c (resizing_buffer_closer): + * mule-coding.c: + * mule-coding.c (iso2022_finalize_detection_state): + * nt.c: + * nt.c (mswindows_get_long_filename): + * nt.c (nt_get_resource): + * nt.c (init_mswindows_environment): + * nt.c (get_cached_volume_information): + * nt.c (mswindows_opendir): + * nt.c (mswindows_closedir): + * nt.c (mswindows_readdir): + * nt.c (mswindows_stat): + * nt.c (mswindows_getdcwd): + * nt.c (Fmswindows_long_file_name): + * ntplay.c (nt_play_sound_file): + * ntplay.c (play_sound_data_1): + * number-gmp.c (gmp_free): + * number-gmp.c (init_number_gmp): + * number-mp.c (bignum_to_string): + * number-mp.c (BIGNUM_TO_TYPE): + * number.c (bignum_print): + * number.c (bignum_convfree): + * number.c (ratio_print): + * number.c (bigfloat_print): + * number.c (bigfloat_finalize): + * objects-gtk.c (gtk_finalize_color_instance): + * objects-gtk.c (gtk_finalize_font_instance): + * objects-msw.c (mswindows_finalize_color_instance): + * objects-msw.c (mswindows_finalize_font_instance): + * objects-tty.c (tty_finalize_color_instance): + * objects-tty.c (tty_finalize_font_instance): + * objects-tty.c (tty_font_list): + * objects-x.c (x_finalize_color_instance): + * objects-x.c (x_finalize_font_instance): + * process.c: + * process.c (finalize_process): + * realpath.c: + * redisplay.c (add_propagation_runes): + * regex.c: + * regex.c (xfree): + * regex.c (REGEX_FREE_STACK): + * regex.c (FREE_STACK_RETURN): + * regex.c (regex_compile): + * regex.c (regexec): + * regex.c (regfree): + * scrollbar-gtk.c (gtk_free_scrollbar_instance): + * scrollbar-gtk.c (gtk_release_scrollbar_instance): + * scrollbar-msw.c (mswindows_free_scrollbar_instance): + * scrollbar-msw.c (unshow_that_mofo): + * scrollbar-x.c (x_free_scrollbar_instance): + * scrollbar-x.c (x_release_scrollbar_instance): + * select-gtk.c (emacs_gtk_selection_handle): + * select-msw.c (mswindows_own_selection): + * select-x.c: + * select-x.c (x_handle_selection_request): + * select-x.c (unexpect_property_change): + * select-x.c (x_handle_property_notify): + * select-x.c (receive_incremental_selection): + * select-x.c (x_get_window_property_as_lisp_data): + * select-x.c (Fx_get_cutbuffer_internal): + * specifier.c (finalize_specifier): + * syntax.c (uninit_buffer_syntax_cache): + * sysdep.c (qxe_allocating_getcwd): + * sysdep.c (qxe_lstat): + * sysdep.c (copy_in_passwd): + * sysdep.c (qxe_ctime): + * sysdep.c (closedir): + * sysdep.c (DIRSIZ): + * termcap.c (tgetent): + * termcap.c (tprint): + * tests.c (Ftest_data_format_conversion): + * text.c (new_dfc_convert_copy_data): + * text.h (eifree): + * text.h (eito_alloca): + * text.h (eito_external): + * toolbar-msw.c (mswindows_output_toolbar): + * ui-gtk.c (CONVERT_RETVAL): + * ui-gtk.c (__allocate_object_storage): + * unicode.c (free_from_unicode_table): + * unicode.c (free_to_unicode_table): + * unicode.c (free_charset_unicode_tables): + * win32.c (mswindows_read_link_1): + Rename: xfree(VAL, TYPE)->xfree(VAL) + + Command used: + + gr 'xfree *\((.*),.*\);' 'xfree (\1);' *.[ch] + + Followed by grepping for 'xfree.*,' and fixing anything left. + + Rationale: Having to specify the TYPE argument is annoying and + error-prone. It was originally put in to work around warnings + due to strict aliasing but years and years ago I rewrote it + in a way that doesn't use the TYPE argument at all and no one + has complained since then. (And anyway, XEmacs is far from + ever being in compliance with strict aliasing and would require + far-reaching changes to get that way.) + +2010-02-04 Ben Wing + + * emacs.c (SHEBANG_EXE_PROGNAME_LENGTH): + * emacs.c (main_1): + Restore old definition of SHEBANG_EXE_PROGNAME_LENGTH; not possible + to ANSI-concatenate wide and narrow strings. + * print.c (write_msg_istring): + * print.c (write_msg_cistring): + * print.c (write_msg_ascstring): + Can't return a value in a void-declared function. + +2010-02-04 Ben Wing + + * filelock.c: + * filelock.c (fill_in_lock_file_name): + Name the lock symlink file .#FN# instead of .#FN for file FN, so + that the link file doesn't have a .c or .el or whatever extension, + which confuses programs/functions that search by extension (e.g. + etags, byte-recompile-directory, etc.). + +2010-02-04 Ben Wing + + * symbols.c (defsymbol_massage_name_1): + * symbols.c (defsymbol_nodump): + * symbols.c (defsymbol): + * symbols.c (defkeyword): + * symeval.h (DEFVAR_SYMVAL_FWD_OBJECT): + Put this back again: + + Make the various calls to staticpro() instead call staticpro_1(), + passing in the name of the C var being staticpro'ed, so that it + shows up in staticpro_names. Otherwise staticpro_names just has + 1000+ copies of the word `location'. + +2010-02-04 Ben Wing + + * bytecode.c (assert_failed_with_remembered_ops): + * bytecode.c (init_opcode_table_multi_op): + Declare some things const to shut up G++ v4 warnings. + + * redisplay.c (add_ibyte_string_runes): + * redisplay.c (add_string_to_fstring_db_runes): + * redisplay.c (generate_fstring_runes): + * redisplay.c (window_line_number): + * redisplay.c (decode_mode_spec): + Use Ascbyte instead of char in various places. + +2010-02-03 Ben Wing + + * frame.c (Fmake_frame): + * glyphs.c: + * glyphs.c (NUM_PRECACHED_GLYPHS): + * glyphs.c (get_glyph_cachel_index): + * glyphs.c (FROB): + * glyphs.c (mark_glyph_cachels_as_not_updated): + * redisplay.c (regenerate_window): + * redisplay.c (redisplay_window): + When creating a frame, call reset_glyph_cachels on the minibuffer + window as well as the root window. Fixes a crash due to other + glyphs (e.g. the gutter glyph) getting in the glyph cachel before + the pre-cached glyphs that are supposed to have fixed indices + (continuation-glyph, truncation-glyph, etc.). + + Add a bunch of asserts to make sure that the glyph cachels always + properly contain the pre-cached glyphs. + +2010-02-03 Ben Wing + + * device-x.c (x_get_resource_prefix): + * device-x.c (Fx_get_resource): + * device-x.c (Fx_get_resource_prefix): + * device-x.c (Fx_put_resource): + * dialog-msw.c: + * dialog-msw.c (handle_question_dialog_box): + * dired-msw.c (mswindows_sort_files): + * dired-msw.c (mswindows_get_files): + * extents.c (extent_fragment_sort_by_priority): + * extents.c (Fset_extent_parent): + * file-coding.c (coding_reader): + * file-coding.c (coding_writer): + * file-coding.c (gzip_convert): + * frame.c (generate_title_string): + * gutter.c (calculate_gutter_size_from_display_lines): + * indent.c (vmotion_1): + * lread.c (read_bit_vector): + * mule-coding.c (iso2022_decode): + * rangetab.c: + * rangetab.c (Fcopy_range_table): + * rangetab.c (Fget_range_table): + * rangetab.c (unified_range_table_copy_data): + * redisplay-msw.c (mswindows_output_string): + * redisplay-output.c (output_display_line): + * redisplay-output.c (redisplay_move_cursor): + * redisplay-output.c (redisplay_clear_bottom_of_window): + * redisplay-tty.c (tty_output_ichar_dynarr): + * redisplay-tty.c (set_foreground_to): + * redisplay-tty.c (set_background_to): + * redisplay-xlike-inc.c (XLIKE_output_string): + * redisplay.c (redisplay_window_text_width_string): + * redisplay.c (redisplay_text_width_string): + * redisplay.c (create_text_block): + * redisplay.c (SET_CURRENT_MODE_CHARS_PIXSIZE): + * redisplay.c (generate_fstring_runes): + * redisplay.c (regenerate_modeline): + * redisplay.c (ensure_modeline_generated): + * redisplay.c (real_current_modeline_height): + * redisplay.c (create_string_text_block): + * redisplay.c (regenerate_window): + * redisplay.c (REGEN_INC_FIND_START_END): + * redisplay.c (point_visible): + * redisplay.c (redisplay_window): + * redisplay.c (mark_glyph_block_dynarr): + * redisplay.c (line_start_cache_start): + * redisplay.c (start_with_line_at_pixpos): + * redisplay.c (update_line_start_cache): + * redisplay.c (glyph_to_pixel_translation): + * redisplay.c (pixel_to_glyph_translation): + * sysdep.c (qxe_readdir): + * text.c (dfc_convert_to_external_format): + * text.c (dfc_convert_to_internal_format): + * toolbar-common.c (common_output_toolbar_button): + * window.c (window_modeline_height): + * window.c (Fwindow_last_line_visible_height): + * window.c (window_displayed_height): + * window.c (window_scroll): + * window.c (get_current_pixel_pos): + Use Dynarr_begin() in place of Dynarr_atp (foo, 0). + + * dynarr.c (Dynarr_realloc): + * dynarr.c (Dynarr_lisp_realloc): + * dynarr.c (Dynarr_resize): + * dynarr.c (Dynarr_insert_many): + * dynarr.c (Dynarr_delete_many): + * dynarr.c (Dynarr_memory_usage): + * dynarr.c (stack_like_malloc): + * dynarr.c (stack_like_free): + * lisp.h: + * lisp.h (DECLARE_DYNARR_LISP_IMP): + * lisp.h (XD_DYNARR_DESC): + * lisp.h (Dynarr_pop): + * gutter.c (output_gutter): + * redisplay-output.c (sync_rune_structs): + * redisplay-output.c (redisplay_output_window): + Redo the dynarr code, add greater checks. + + Rename the `len', `largest' and `max' members to `len_', + `largest_' and `max_' to try and catch existing places that might + directly modify these values. Make new accessors Dynarr_largest() + and Dynarr_max() and make them and existing Dynarr_length() be + non-lvalues by adding '+ 0' to them; fix a couple of places in the + redisplay code that tried to modify the length directly by setting + Dynarr_length(). Use the accessors whenever possible even in the + dynarr code itself. The accessors also verify that 0 <= len <= + largest <= max. Rename settor function Dynarr_set_size() to + Dynarr_set_length() and use it more consistently; also create + lower-level Dynarr_set_length_1(). This latter function should be + the only function that directly modifies the `len_' member of a + Dynarr, and in the process makes sure that the `largest' value is + kept correct. + + Consistently use ERROR_CHECK_STRUCTURES instead of + ERROR_CHECK_TYPES for error-checking code. Reintroduce the + temporarily disabled verification code on the positions of + Dynarr_at(), Dynarr_atp() and Dynarr_atp_past_end(). + Also create Dynarr_resize_if() in place of a repeated + code fragment. Clean up all the functions that modify Dynarrs to + use the new macros and functions and verify the correctness of the + Dynarr both before and after the change. + + Note that there are two kinds of verification -- one for accessing + and one for modifying. The difference is that the modify + verification additionally checks to make sure that the Dynarr + isn't locked. (This is used in redisplay to check for problems + with reentrancy.) + + * lrecord.h: Move XD_DYNARR_DESC to lisp.h, grouping with the dynarr code. + +2010-02-03 Jerry James + + * s/mach-bsd4-3.h: Add historical copyright and license information, + unearthed by Ben Wing. + +2010-02-03 Ben Wing + + * bytecode.c: + Fix minor compile problem. + +2010-02-03 Ben Wing + + * symbols.c (defsymbol_massage_name_1): + * symbols.c (defsymbol_nodump): + * symbols.c (defsymbol): + * symbols.c (defkeyword): + * symeval.h (DEFVAR_SYMVAL_FWD_OBJECT): + Temporarily back out staticpro-related changes in symbols.c and + symeval.h to fix compile problems, will put back when `latest-fix' + workspace gets merged in. + +2010-02-03 Ben Wing + + * alloc.c (Fmake_byte_code): + * lread.c: + * lread.c (readevalloop): + * lread.c (Fread): + * lread.c (Fread_from_string): + * lread.c (read_list_conser): + * lread.c (read_list): + * lread.c (vars_of_lread): + Remove the old kludgy stuff bracketed by `#ifdef + COMPILED_FUNCTION_ANNOTATION_HACK_OLD_WAY'. + +2010-02-03 Ben Wing + + * alloc.c (Fmake_byte_code): + * bytecode.h: + * lisp.h: + * lread.c: + * lread.c (readevalloop): + * lread.c (Fread): + * lread.c (Fread_from_string): + * lread.c (read_list_conser): + * lread.c (read_list): + * lread.c (vars_of_lread): + * symbols.c: + * symbols.c (Fdefine_function): + Turn on the "compiled-function annotation hack". Implement it + properly by hooking into Fdefalias(). Note in the docstring to + `defalias' that we do this. Remove some old broken code and + change code that implemented the old kludgy way of hooking into + the Lisp reader into bracketed by `#ifdef + COMPILED_FUNCTION_ANNOTATION_HACK_OLD_WAY', which is not enabled. + + Also enable byte-code metering when DEBUG_XEMACS -- this is a form + of profiling for computing histograms of which sequences of two + bytecodes are used most often. + + * bytecode-ops.h: + * bytecode-ops.h (OPCODE): + New file. Extract out all the opcodes and declare them using + OPCODE(), a bit like frame slots and such. This way the file can + be included multiple times if necessary to iterate multiple times + over the byte opcodes. + + * bytecode.c: + * bytecode.c (NUM_REMEMBERED_BYTE_OPS): + * bytecode.c (OPCODE): + * bytecode.c (assert_failed_with_remembered_ops): + * bytecode.c (READ_UINT_2): + * bytecode.c (READ_INT_1): + * bytecode.c (READ_INT_2): + * bytecode.c (PEEK_INT_1): + * bytecode.c (PEEK_INT_2): + * bytecode.c (JUMP_RELATIVE): + * bytecode.c (JUMP_NEXT): + * bytecode.c (PUSH): + * bytecode.c (POP_WITH_MULTIPLE_VALUES): + * bytecode.c (DISCARD): + * bytecode.c (UNUSED): + * bytecode.c (optimize_byte_code): + * bytecode.c (optimize_compiled_function): + * bytecode.c (Fbyte_code): + * bytecode.c (vars_of_bytecode): + * bytecode.c (init_opcode_table_multi_op): + * bytecode.c (reinit_vars_of_bytecode): + * emacs.c (main_1): + * eval.c (funcall_compiled_function): + * symsinit.h: + Any time we change either the instruction pointer or the stack + pointer, assert that we're going to move it to a valid location. + This should catch failures right when they occur rather than + sometime later. This requires that we pass in another couple of + parameters into some functions (only with error-checking enabled, + see below). + + Also keep track, using a circular queue, of the last 100 byte + opcodes seen, and when we hit an assert failure during byte-code + execution, output the contents of the queue in a nice readable + fashion. This requires that bytecode-ops.h be included a second + time so that a table mapping opcodes to the name of their operation + can be constructed. This table is constructed in new function + reinit_vars_of_bytecode(). + + Everything in the last two paras happens only when + ERROR_CHECK_BYTE_CODE. + + Add some longish comments describing how the arrays that hold the + stack and instructions, and the pointers used to access them, work. + + * gc.c: + Import some code from my `latest-fix' workspace to mark the + staticpro's in order from lowest to highest, rather than highest to + lowest, so it's easier to debug when something goes wrong. + + * lisp.h (abort_with_message): Renamed from abort_with_msg(). + + * symbols.c (defsymbol_massage_name_1): + * symbols.c (defsymbol_nodump): + * symbols.c (defsymbol): + * symbols.c (defkeyword): + * symeval.h (DEFVAR_SYMVAL_FWD_OBJECT): + Make the various calls to staticpro() instead call staticpro_1(), + passing in the name of the C var being staticpro'ed, so that it + shows up in staticpro_names. Otherwise staticpro_names just has + 1000+ copies of the word `location'. + 2010-02-02 Ben Wing * bytecode.c (execute_rare_opcode): @@ -111,6 +944,11 @@ 2010-02-01 Ben Wing + * alloc.c (common_init_alloc_early): + Fix compiler breakage. + +2010-02-01 Ben Wing + * objects-gtk-impl.h: * objects-gtk-impl.h (XCOLOR_INSTANCE_GTK_COLOR): * objects-gtk-impl.h (XFONT_INSTANCE_GTK_FONT): @@ -120,6 +958,12 @@ XFONT_INSTANCE_X_FONT, XFONT_INSTANCE_GTK_FONT for convenience purposes. Fixes compile bug in redisplay-xlike-inc.c. +2010-01-29 Ben Wing + + * lisp.h: + * objects.h (set_face_boolean_attached_to): + Use lisp.h for EXFUN of Fregexp_quote, that's what it's for. + 2010-02-01 Ben Wing * compiler.h: @@ -440,9 +1284,787 @@ Oops, change #else to #endif here; thank you Vin Shelton, thank you Robert Delius Royar. +2010-01-28 Ben Wing + + * device-x.c (x_init_device): + * emodules.c (emodules_load): + * emodules.c (emodules_doc_subr): + * emodules.c (emodules_doc_sym): + * emodules.h: + Make the externally-called functions emodules_doc_sym() and + emodules_doc_subr() take Ascbyte * pointers since they're usually + passed string constants and we can't guarantee the encoding if + it's not ASCII. Fix pointer type in calls to dll_variable(), etc. + 2010-01-27 Ben Wing - * casetab.c: Typo in comment. + * lread.c (vars_of_lread): + Turn on load-ignore-out-of-date-elc-files by default. + +2010-01-27 Ben Wing + + * event-unixoid.c (read_event_from_tty_or_stream_desc): + Don't try to write one byte into a four-byte variable, leaving + the rest undefined. This is a recipe for crashing. + +2010-01-27 Ben Wing + + * .gdbinit.in.in: + * README: + * abbrev.c (write_abbrev): + * abbrev.c (describe_abbrev): + * alloc.c (make_extstring): + * alloc.c (build_istring): + * alloc.c (build_cistring): + * alloc.c (build_ascstring): + * alloc.c (build_extstring): + * alloc.c (build_msg_istring): + * alloc.c (build_defer_istring): + * buffer.c (Fgenerate_new_buffer_name): + * buffer.c (init_buffer_2): + * console-tty.c (tty_init_console): + * console-x.c (get_display_arg_connection): + * console-x.c (x_perhaps_init_unseen_key_defaults): + * database.c (dbm_map): + * database.c (dbm_get): + * database.c (berkdb_get): + * database.c (berkdb_map): + * device-gtk.c (FROB_PIXMAP): + * device-gtk.c (Fgtk_style_info): + * device-msw.c (msprinter_default_printer): + * device-msw.c (sync_printer_with_devmode): + * device-x.c (coding_system_of_xrm_database): + * device-x.c (x_init_device): + * device-x.c (signal_if_x_error): + * device-x.c (Fx_get_resource): + * device-x.c (Fx_server_vendor): + * device-x.c (Fx_get_font_path): + * dialog-x.c (maybe_run_dbox_text_callback): + * doc.c (extract_object_file_name): + * doc.c (unparesseuxify_doc_string): + * doc.c (get_doc_string): + * doc.c (get_object_file_name): + * doc.c (Fdocumentation): + * doc.c (Fsnarf_documentation): + * doc.c (Fsubstitute_command_keys): + * editfns.c (init_editfns): + * editfns.c (Ftemp_directory): + * editfns.c (Fuser_login_name): + * editfns.c (Fuser_real_login_name): + * editfns.c (Fuser_home_directory): + * editfns.c (Fformat_time_string): + * editfns.c (Fcurrent_time_string): + * editfns.c (Fcurrent_time_zone): + * emacs.c: + * emacs.c (main_1): + * emodules.c (Flist_modules): + * emodules.c (emodules_load): + * emodules.c (emodules_doc_sym): + * emodules.c (vars_of_module): + * event-Xt.c (x_has_keysym): + * event-gtk.c (emacs_gtk_format_magic_event): + * event-gtk.c (dragndrop_data_received): + * event-gtk.c (gtk_reset_key_mapping): + * event-msw.c (mswindows_dde_callback): + * event-msw.c (mswindows_wnd_proc): + * faces.c (complex_vars_of_faces): + * file-coding.c (find_coding_system): + * file-coding.c (setup_eol_coding_systems): + * file-coding.c (make_coding_system_1): + * file-coding.c (snarf_coding_system): + * fileio.c: + * fileio.c (lisp_strerror): + * fileio.c (Ffile_name_directory): + * fileio.c (Ffile_name_as_directory): + * fileio.c (Fdirectory_file_name): + * fileio.c (if): + * fileio.c (Ffile_symlink_p): + * fileio.c (Fencrypt_string): + * fileio.c (Fdecrypt_string): + * filelock.c (lock_file): + * filelock.c (Ffile_locked_p): + * floatfns.c (matherr): + * font-mgr.c (build_fcapi_string): + * font-mgr.c (make_xlfd_font_regexp): + * frame-msw.c (mswindows_window_id): + * frame-msw.c (mswindows_frame_property): + * frame-x.c: + * frame-x.c (color_to_string): + * frame-x.c (maybe_set_frame_title_format): + * frame-x.c (x_cde_transfer_callback): + * frame-x.c (Fx_window_id): + * glade.c (connector): + * glade.c (Fglade_xml_textdomain): + * glade.c (syms_of_glade): + * glyphs-eimage.c (jpeg_instantiate): + * glyphs-eimage.c (png_instantiate): + * glyphs-eimage.c (tiff_instantiate): + * glyphs-gtk.c (font_instantiate): + * glyphs-gtk.c (BUILD_GLYPH_INST): + * glyphs-x.c (x_locate_pixmap_file): + * glyphs-x.c (font_instantiate): + * glyphs-x.c (x_widget_property): + * glyphs-x.c (BUILD_GLYPH_INST): + * glyphs.c (print_image_instance): + * glyphs.c (bitmap_to_lisp_data): + * glyphs.c (pixmap_to_lisp_data): + * gpmevent.c (turn_off_gpm): + * gpmevent.c (Fgpm_enabled_p): + * gpmevent.c (Fgpm_enable): + * gtk-glue.c (__make_string_mapper): + * gtk-glue.c (xemacs_gtklist_to_list): + * gtk-xemacs.c (FROB_FACE): + * gtk-xemacs.c (xemacs_gtk_convert_color): + * hpplay.c (player_error_internal): + * hpplay.c (myHandler): + * insdel.c (buffer_insert_ascstring_1): + * insdel.h: + * insdel.h (buffer_insert_ascstring): + * intl.c (Fcurrent_locale): + * intl.c (Fset_current_locale): + * keymap.c (make_key_description): + * keymap.c (Ftext_char_description): + * keymap.c (describe_command): + * keymap.c (describe_map): + * lisp.h: + * lread.c: + * lread.c (locate_file_in_directory_mapper): + * lread.c (locate_file_construct_suffixed_files_mapper): + * mule-charset.c (Fmake_charset): + * nt.c (Fmswindows_short_file_name): + * nt.c (Fmswindows_long_file_name): + * objects-gtk.c (__get_gtk_font_truename): + * objects-gtk.c (__gtk_font_list_internal): + * objects-msw.c (font_enum_callback_2): + * objects-msw.c (create_hfont_from_font_spec): + * objects-msw.c (mswindows_font_list): + * objects-msw.c (mswindows_font_spec_matches_charset_stage_2): + * objects-tty.c (tty_initialize_font_instance): + * objects-x.c (x_font_truename): + * objects-x.c (x_font_instance_truename): + * objects-x.c (x_font_instance_properties): + * objects-x.c (x_font_list): + * print.c (write_cistring): + * print.c (print_vector_internal): + * print.c (print_cons): + * process-nt.c (nt_canonicalize_host_name): + * process-unix.c (unix_create_process): + * process-unix.c (unix_canonicalize_host_name): + * process.c (status_message): + * process.c (status_notify): + * process.c (init_xemacs_process): + * process.c (syms_of_process): + * redisplay-tty.c (term_get_fkeys_1): + * redisplay-tty.c (CONDITIONAL_REASSIGN): + * search.c (compile_pattern_1): + * select-common.h (selection_data_to_lisp_data): + * select-gtk.c (atom_to_symbol): + * select-gtk.c (PROCESSING_GTK_CODE): + * select-msw.c (mswindows_get_foreign_selection): + * select-x.c (x_atom_to_symbol): + * select-x.c (Fx_get_cutbuffer_internal): + * symbols.c (intern_istring): + * symbols.c (intern): + * symbols.c (intern_converting_underscores_to_dashes): + * symbols.c (Fintern): + * sysdep.c (init_system_name): + * sysdll.c (dll_error): + * sysdll.c (dll_open): + * syswindows.h: + * syswindows.h (build_tstr_string): + * tests.c (DFC_CHECK_LENGTH): + * tests.c (DFC_CHECK_CONTENT): + * tests.c (DFC_RESULT_PASS): + * tests.c (Ftest_data_format_conversion): + * text.c: + * text.c (new_dfc_convert_now_damn_it): + * text.h: + * text.h (build_wext_string): + * tooltalk.c (tt_build_c_string): + * tooltalk.c (Ftooltalk_default_procid): + * tooltalk.c (Ftooltalk_default_session): + * tooltalk.c (init_tooltalk): + * ui-byhand.c (Fgtk_clist_get_text): + * ui-byhand.c (Fgtk_clist_get_pixtext): + * ui-byhand.c (Fgtk_label_get): + * ui-byhand.c (Fgtk_notebook_query_tab_label_packing): + * ui-gtk.c (emacs_gtk_object_printer): + * ui-gtk.c (emacs_gtk_boxed_printer): + * ui-gtk.c (gtk_type_to_lisp): + * ui-gtk.c (symbol_to_enum): + * ui-gtk.c (enum_to_symbol): + * unexaix.c (report_error): + * unexaix.c (ERROR0): + * unexec.c (report_error): + * unexec.c (ERROR0): + * unicode.c (unicode_to_ichar): + * win32.c (tstr_to_local_file_format): + * win32.c (Fmswindows_cygwin_to_win32_path): + * win32.c (struct read_link_hash): + * xemacs.def.in.in: + + Rename: + + write_c_string -> write_cistring + build_intstring -> build_istring + build_string -> build_cistring + build_ext_string -> build_extstring + make_ext_string -> make_extstring + buffer_insert_c_string -> buffer_insert_ascstring + intern_int -> intern_istring + + These functions have been renamed so that the naming harmonizes + with the typedefs for strings: `cistring' along with CIbyte *, + `istring' along with Ibyte *, `extstring' along with Extbyte *, + `ascstring' along with Ascbyte *. + + Also make buffer_insert_ascstring take Ascbyte * and assert + that its argument is ASCII. + +2010-01-26 Ben Wing + + * alloc.c: + * alloc.c (build_ascstring): + * alloc.c (build_msg_cistring): + * alloc.c (staticpro_1): + * alloc.c (staticpro_name): + * alloc.c (staticpro_nodump_1): + * alloc.c (staticpro_nodump_name): + * alloc.c (unstaticpro_nodump_1): + * alloc.c (mcpro_1): + * alloc.c (mcpro_name): + * alloc.c (object_memory_usage_stats): + * alloc.c (common_init_alloc_early): + * alloc.c (init_alloc_once_early): + * buffer.c (print_buffer): + * buffer.c (vars_of_buffer): + * buffer.c (common_init_complex_vars_of_buffer): + * buffer.c (init_initial_directory): + * bytecode.c (invalid_byte_code): + * bytecode.c (print_compiled_function): + * bytecode.c (mark_compiled_function): + * chartab.c (print_table_entry): + * chartab.c (print_char_table): + * config.h.in: + * console-gtk.c: + * console-gtk.c (gtk_device_to_console_connection): + * console-gtk.c (gtk_semi_canonicalize_console_connection): + * console-gtk.c (gtk_canonicalize_console_connection): + * console-gtk.c (gtk_semi_canonicalize_device_connection): + * console-gtk.c (gtk_canonicalize_device_connection): + * console-stream.c (stream_init_frame_1): + * console-stream.c (vars_of_console_stream): + * console-stream.c (init_console_stream): + * console-x.c (x_semi_canonicalize_console_connection): + * console-x.c (x_semi_canonicalize_device_connection): + * console-x.c (x_canonicalize_device_connection): + * console-x.h: + * data.c (eq_with_ebola_notice): + * data.c (Fsubr_interactive): + * data.c (Fnumber_to_string): + * data.c (digit_to_number): + * device-gtk.c (gtk_init_device): + * device-msw.c (print_devmode): + * device-x.c (x_event_name): + * dialog-msw.c (handle_directory_dialog_box): + * dialog-msw.c (handle_file_dialog_box): + * dialog-msw.c (vars_of_dialog_mswindows): + * doc.c (weird_doc): + * doc.c (Fsnarf_documentation): + * doc.c (vars_of_doc): + * dumper.c (pdump): + * dynarr.c: + * dynarr.c (Dynarr_realloc): + * editfns.c (Fuser_real_login_name): + * editfns.c (get_home_directory): + * elhash.c (print_hash_table_data): + * elhash.c (print_hash_table): + * emacs.c (main_1): + * emacs.c (vars_of_emacs): + * emodules.c: + * emodules.c (_emodules_list): + * emodules.c (Fload_module): + * emodules.c (Funload_module): + * emodules.c (Flist_modules): + * emodules.c (find_make_module): + * emodules.c (attempt_module_delete): + * emodules.c (emodules_load): + * emodules.c (emodules_doc_subr): + * emodules.c (emodules_doc_sym): + * emodules.c (syms_of_module): + * emodules.c (vars_of_module): + * emodules.h: + * eval.c (print_subr): + * eval.c (signal_call_debugger): + * eval.c (build_error_data): + * eval.c (signal_error): + * eval.c (maybe_signal_error): + * eval.c (signal_continuable_error): + * eval.c (maybe_signal_continuable_error): + * eval.c (signal_error_2): + * eval.c (maybe_signal_error_2): + * eval.c (signal_continuable_error_2): + * eval.c (maybe_signal_continuable_error_2): + * eval.c (signal_ferror): + * eval.c (maybe_signal_ferror): + * eval.c (signal_continuable_ferror): + * eval.c (maybe_signal_continuable_ferror): + * eval.c (signal_ferror_with_frob): + * eval.c (maybe_signal_ferror_with_frob): + * eval.c (signal_continuable_ferror_with_frob): + * eval.c (maybe_signal_continuable_ferror_with_frob): + * eval.c (syntax_error): + * eval.c (syntax_error_2): + * eval.c (maybe_syntax_error): + * eval.c (sferror): + * eval.c (sferror_2): + * eval.c (maybe_sferror): + * eval.c (invalid_argument): + * eval.c (invalid_argument_2): + * eval.c (maybe_invalid_argument): + * eval.c (invalid_constant): + * eval.c (invalid_constant_2): + * eval.c (maybe_invalid_constant): + * eval.c (invalid_operation): + * eval.c (invalid_operation_2): + * eval.c (maybe_invalid_operation): + * eval.c (invalid_change): + * eval.c (invalid_change_2): + * eval.c (maybe_invalid_change): + * eval.c (invalid_state): + * eval.c (invalid_state_2): + * eval.c (maybe_invalid_state): + * eval.c (wtaerror): + * eval.c (stack_overflow): + * eval.c (out_of_memory): + * eval.c (print_multiple_value): + * eval.c (issue_call_trapping_problems_warning): + * eval.c (backtrace_specials): + * eval.c (backtrace_unevalled_args): + * eval.c (Fbacktrace): + * eval.c (warn_when_safe): + * event-Xt.c (modwarn): + * event-Xt.c (modbarf): + * event-Xt.c (check_modifier): + * event-Xt.c (store_modifier): + * event-Xt.c (emacs_Xt_format_magic_event): + * event-Xt.c (describe_event): + * event-gtk.c (dragndrop_data_received): + * event-gtk.c (store_modifier): + * event-gtk.c (gtk_reset_modifier_mapping): + * event-msw.c (dde_eval_string): + * event-msw.c (Fdde_alloc_advise_item): + * event-msw.c (mswindows_dde_callback): + * event-msw.c (FROB): + * event-msw.c (emacs_mswindows_format_magic_event): + * event-stream.c (external_debugging_print_event): + * event-stream.c (execute_help_form): + * event-stream.c (vars_of_event_stream): + * events.c (print_event_1): + * events.c (print_event): + * events.c (event_equal): + * extents.c (print_extent_1): + * extents.c (print_extent): + * extents.c (vars_of_extents): + * faces.c (print_face): + * faces.c (complex_vars_of_faces): + * file-coding.c: + * file-coding.c (print_coding_system): + * file-coding.c (print_coding_system_in_print_method): + * file-coding.c (default_query_method): + * file-coding.c (find_coding_system): + * file-coding.c (make_coding_system_1): + * file-coding.c (chain_print): + * file-coding.c (undecided_print): + * file-coding.c (gzip_print): + * file-coding.c (vars_of_file_coding): + * file-coding.c (complex_vars_of_file_coding): + * fileio.c: + * fileio.c (report_file_type_error): + * fileio.c (report_error_with_errno): + * fileio.c (report_file_error): + * fileio.c (barf_or_query_if_file_exists): + * fileio.c (vars_of_fileio): + * floatfns.c (matherr): + * fns.c (print_bit_vector): + * fns.c (Fmapconcat): + * fns.c (add_suffix_to_symbol): + * fns.c (add_prefix_to_symbol): + * frame-gtk.c: + * frame-gtk.c (Fgtk_window_id): + * frame-x.c (def): + * frame-x.c (x_cde_transfer_callback): + * frame.c: + * frame.c (Fmake_frame): + * gc.c (show_gc_cursor_and_message): + * gc.c (vars_of_gc): + * glyphs-eimage.c (png_instantiate): + * glyphs-eimage.c (tiff_instantiate): + * glyphs-gtk.c (gtk_print_image_instance): + * glyphs-msw.c (mswindows_print_image_instance): + * glyphs-x.c (x_print_image_instance): + * glyphs-x.c (update_widget_face): + * glyphs.c (make_string_from_file): + * glyphs.c (print_image_instance): + * glyphs.c (signal_image_error): + * glyphs.c (signal_image_error_2): + * glyphs.c (signal_double_image_error): + * glyphs.c (signal_double_image_error_2): + * glyphs.c (xbm_mask_file_munging): + * glyphs.c (pixmap_to_lisp_data): + * glyphs.h: + * gui.c (gui_item_display_flush_left): + * hpplay.c (player_error_internal): + * hpplay.c (myHandler): + * intl-win32.c: + * intl-win32.c (langcode_to_lang): + * intl-win32.c (sublangcode_to_lang): + * intl-win32.c (Fmswindows_get_locale_info): + * intl-win32.c (lcid_to_locale_mule_or_no): + * intl-win32.c (mswindows_multibyte_to_unicode_print): + * intl-win32.c (complex_vars_of_intl_win32): + * keymap.c: + * keymap.c (print_keymap): + * keymap.c (ensure_meta_prefix_char_keymapp): + * keymap.c (Fkey_description): + * keymap.c (Ftext_char_description): + * lisp.h: + * lisp.h (struct): + * lisp.h (DECLARE_INLINE_HEADER): + * lread.c (Fload_internal): + * lread.c (locate_file): + * lread.c (read_escape): + * lread.c (read_raw_string): + * lread.c (read1): + * lread.c (read_list): + * lread.c (read_compiled_function): + * lread.c (init_lread): + * lrecord.h: + * marker.c (print_marker): + * marker.c (marker_equal): + * menubar-msw.c (displayable_menu_item): + * menubar-x.c (command_builder_operate_menu_accelerator): + * menubar.c (vars_of_menubar): + * minibuf.c (reinit_complex_vars_of_minibuf): + * minibuf.c (complex_vars_of_minibuf): + * mule-charset.c (Fmake_charset): + * mule-charset.c (complex_vars_of_mule_charset): + * mule-coding.c (iso2022_print): + * mule-coding.c (fixed_width_query): + * number.c (bignum_print): + * number.c (ratio_print): + * number.c (bigfloat_print): + * number.c (bigfloat_finalize): + * objects-msw.c: + * objects-msw.c (mswindows_color_to_string): + * objects-msw.c (mswindows_color_list): + * objects-tty.c: + * objects-tty.c (tty_font_list): + * objects-tty.c (tty_find_charset_font): + * objects-xlike-inc.c (xft_find_charset_font): + * objects-xlike-inc.c (endif): + * print.c: + * print.c (write_istring): + * print.c (write_ascstring): + * print.c (Fterpri): + * print.c (Fprint): + * print.c (print_error_message): + * print.c (print_vector_internal): + * print.c (print_cons): + * print.c (print_string): + * print.c (printing_unreadable_object): + * print.c (print_internal): + * print.c (print_float): + * print.c (print_symbol): + * process-nt.c (mswindows_report_winsock_error): + * process-nt.c (nt_canonicalize_host_name): + * process-unix.c (unix_canonicalize_host_name): + * process.c (print_process): + * process.c (report_process_error): + * process.c (report_network_error): + * process.c (make_process_internal): + * process.c (Fstart_process_internal): + * process.c (status_message): + * process.c (putenv_internal): + * process.c (vars_of_process): + * process.h: + * profile.c (vars_of_profile): + * rangetab.c (print_range_table): + * realpath.c (vars_of_realpath): + * redisplay.c (vars_of_redisplay): + * search.c (wordify): + * search.c (Freplace_match): + * sheap.c (sheap_adjust_h): + * sound.c (report_sound_error): + * sound.c (Fplay_sound_file): + * specifier.c (print_specifier): + * symbols.c (Fsubr_name): + * symbols.c (do_symval_forwarding): + * symbols.c (set_default_buffer_slot_variable): + * symbols.c (set_default_console_slot_variable): + * symbols.c (store_symval_forwarding): + * symbols.c (default_value): + * symbols.c (defsymbol_massage_name_1): + * symbols.c (defsymbol_massage_name_nodump): + * symbols.c (defsymbol_massage_name): + * symbols.c (defsymbol_massage_multiword_predicate_nodump): + * symbols.c (defsymbol_massage_multiword_predicate): + * symbols.c (defsymbol_nodump): + * symbols.c (defsymbol): + * symbols.c (defkeyword): + * symbols.c (defkeyword_massage_name): + * symbols.c (check_module_subr): + * symbols.c (deferror_1): + * symbols.c (deferror): + * symbols.c (deferror_massage_name): + * symbols.c (deferror_massage_name_and_message): + * symbols.c (defvar_magic): + * symeval.h: + * symeval.h (DEFVAR_SYMVAL_FWD): + * sysdep.c: + * sysdep.c (init_system_name): + * sysdll.c: + * sysdll.c (MAYBE_PREPEND_UNDERSCORE): + * sysdll.c (dll_function): + * sysdll.c (dll_variable): + * sysdll.c (dll_error): + * sysdll.c (dll_open): + * sysdll.c (dll_close): + * sysdll.c (image_for_address): + * sysdll.c (my_find_image): + * sysdll.c (search_linked_libs): + * sysdll.h: + * sysfile.h: + * sysfile.h (DEFAULT_DIRECTORY_FALLBACK): + * syswindows.h: + * tests.c (DFC_CHECK_LENGTH): + * tests.c (DFC_CHECK_CONTENT): + * tests.c (Ftest_hash_tables): + * text.c (vars_of_text): + * text.h: + * tooltalk.c (tt_opnum_string): + * tooltalk.c (tt_message_arg_ival_string): + * tooltalk.c (Ftooltalk_default_procid): + * tooltalk.c (Ftooltalk_default_session): + * tooltalk.c (init_tooltalk): + * tooltalk.c (vars_of_tooltalk): + * ui-gtk.c (Fdll_load): + * ui-gtk.c (type_to_marshaller_type): + * ui-gtk.c (Fgtk_import_function_internal): + * ui-gtk.c (emacs_gtk_object_printer): + * ui-gtk.c (emacs_gtk_boxed_printer): + * unicode.c (unicode_to_ichar): + * unicode.c (unicode_print): + * unicode.c (unicode_query): + * unicode.c (vars_of_unicode): + * unicode.c (complex_vars_of_unicode): + * win32.c: + * win32.c (mswindows_report_process_error): + * window.c (print_window): + * xemacs.def.in.in: + + BASIC IDEA: Further fixing up uses of char * and CIbyte * + to reflect their actual semantics; Mule-izing some code; + redoing of the not-yet-working code to handle message translation. + + Clean up code to handle message-translation (not yet working). + Create separate versions of build_msg_string() for working with + Ibyte *, CIbyte *, and Ascbyte * arguments. Assert that Ascbyte * + arguments are pure-ASCII. Make build_msg_string() be the same + as build_msg_ascstring(). Create same three versions of GETTEXT() + and DEFER_GETTEXT(). Also create build_defer_string() and + variants for the equivalent of DEFER_GETTEXT() when building a + string. Remove old CGETTEXT(). Clean up code where GETTEXT(), + DEFER_GETTEXT(), build_msg_string(), etc. was being called and + introduce some new calls to build_msg_string(), etc. Remove + GETTEXT() from calls to weird_doc() -- we assume that the + message snarfer knows about weird_doc(). Remove uses of + DEFER_GETTEXT() from error messages in sysdep.c and instead use + special comments /* @@@begin-snarf@@@ */ and /* @@@end-snarf@@@ */ + that the message snarfer presumably knows about. + + Create build_ascstring() and use it in many instances in place + of build_string(). The purpose of having Ascbyte * variants is + to make the code more self-documenting in terms of what sort of + semantics is expected for char * strings. In fact in the process + of looking for uses of build_string(), much improperly Mule-ized + was discovered. + + Mule-ize a lot of code as described in previous paragraph, + e.g. in sysdep.c. + + Make the error functions take Ascbyte * strings and fix up a + couple of places where non-pure-ASCII strings were being passed in + (file-coding.c, mule-coding.c, unicode.c). (It's debatable whether + we really need to make the error functions work this way. It + helps catch places where code is written in a way that message + translation won't work, but we may well never implement message + translation.) + + Make staticpro() and friends take Ascbyte * strings instead of + raw char * strings. Create a const_Ascbyte_ptr dynarr type + to describe what's held by staticpro_names[] and friends, + create pdump descriptions for const_Ascbyte_ptr dynarrs, and + use them in place of specially-crafted staticpro descriptions. + + Mule-ize certain other functions (e.g. x_event_name) by correcting + raw use of char * to Ascbyte *, Rawbyte * or another such type, + and raw use of char[] buffers to another type (usually Ascbyte[]). + + Change many uses of write_c_string() to write_msg_string(), + write_ascstring(), etc. + + Mule-ize emodules.c, emodules.h, sysdll.h. + + Fix some un-Mule-ized code in intl-win32.c. + + A comment in event-Xt.c and the limitations of the message + snarfer (make-msgfile or whatever) is presumably incorrect -- + it should be smart enough to handle function calls spread over + more than one line. Clean up code in event-Xt.c that was + written awkwardly for this reason. + + In config.h.in, instead of NEED_ERROR_CHECK_TYPES_INLINES, + create a more general XEMACS_DEFS_NEEDS_INLINE_DECLS to + indicate when inlined functions need to be declared in + xemacs.defs.in.in, and make use of it in xemacs.defs.in.in. + We need to do this because postgresql.c now calls qxestrdup(), + which is an inline function. + + Make nconc2() and other such functions MODULE_API and put + them in xemacs.defs.in.in since postgresql.c now uses them. + + Clean up indentation in lread.c and a few other places. + + In text.h, document ASSERT_ASCTEXT_ASCII() and + ASSERT_ASCTEXT_ASCII_LEN(), group together the stand-in + encodings and add some more for DLL symbols, function and + variable names, etc. + +2010-01-26 Ben Wing + + * .gdbinit.in.in: Allow an argument to check-xemacs and check-temacs + to check a specific file. + +2010-01-24 Ben Wing + + * chartab.c (decode_char_table_range): + * extents.c (extent_fragment_update): + * objects-msw.c (initialize_font_instance): + * process.c (Fgetenv): + * redisplay-output.c (get_next_display_block): + Fix warnings about possible use of uninitialized vars. + + * compiler.h: + * compiler.h (REGISTER): + * event-stream.c (is_scrollbar_event): + * window.c (window_scrollbar_width): + * window.c (window_scrollbar_height): + * window.c (window_left_window_gutter_width): + * window.c (window_right_window_gutter_width): + Add USED_IF_SCROLLBARS. Use it to fix warnings about unused + vars when --with-scrollbars=no. + + * config.h.in: + Change comment to explain better why DECLARE_INLINE_HEADER + is needed. + + * dialog-msw.c: + * emacs.c (SHEBANG_EXE_PROGNAME_LENGTH): + * emacs.c (main_1): + * event-msw.c (struct mswin_message_debug): + * event-msw.c (debug_output_mswin_message): + * font-mgr.c: + * font-mgr.c (Ffc_config_filename): + * glyphs-msw.c (struct): + * glyphs-msw.c (bitmap_table): + * glyphs-x.c (update_widget_face): + * intl-win32.c (struct lang_to_string): + * intl-win32.c (lang_to_string_table): + * nas.c: + * objects-xlike-inc.c: + * objects-xlike-inc.c (xft_find_charset_font): + * syswindows.h: + * win32.c (mswindows_output_last_error): + Fix g++ 4.3 complaints about implicit conversions of string + literals (const char *) to char *. + + * lisp.h: + G++ 4.3 needs #include to avoid errors about min/max. + + * lisp.h (disabled_assert_with_message): + Use disabled_assert* whenever asserts are disabled. Rewrite + disabled_assert* to avoid complaints about unused vars by + pretending to use the vars but casting them to (void). + Remove code that defined assert() weirdly if DEBUG_XEMACS but + not USE_ASSERTIONS -- configure sets USE_ASSERTIONS automatically + when DEBUG_XEMACS, and if the user has forced it off, then + so be it. + + * lisp.h (SYMBOL_KEYWORD): + Put some of the combined `extern Lisp_Object's back under + the file they are declared in. Cosmetic fix. + + * number.h: + Remove `extern Lisp_Object' decls that duplicate lisp.h, + since they have different C vs. C++ linkage. + +2010-01-21 Ben Wing + + * Makefile.in.in: + Oops. Use two hashes for comments in Makefile.in.in. + +2010-01-20 Ben Wing + + * symbols.c: + Add long comment about the types of magic symbols, and the various + declarations that go along with them. + +2010-01-20 Ben Wing + + * .gdbinit.in.in: + Moved here from etc/.gdbinit.in. + Put @srcdir@ in various places rather than just `..' whenever + Makefile.in.in does so. Fixes various strange crashes and errors + than occur when using `..'. + * Makefile.in.in (config-changed): + Add target, useful when building both Unicode-internal and + old-Mule workspaces using --srcdir and don't run configure before + switching from one to the other. + +2010-01-20 Ben Wing + + * lrecord.h: + * lrecord.h (enum lrecord_type): + * lrecord.h (struct lrecord_implementation): + Clean up description of finalizer methods. Clean up and expand + the long comment at the top of lrecord.h. Add a section about why + New-GC requires a bunch of new internal objects to be created (not + completely understood). + +2010-01-20 Ben Wing + + * lisp.h: + Disable error-checking code in Dynarr_at and related lookup + functions. It leads to a crash in the glyph-cachels code under + Cygwin 1.7 and GCC 3.4.4. I assume this is a compiler bug since + the code in question doesn't (or shouldn't) modify anything. + Changing the code from inline to non-inline didn't help. + +2010-01-19 Ben Wing + + * console-impl.h (struct console_methods): + * console-stream.c (stream_text_width): + * redisplay-msw.c (mswindows_output_string): + * redisplay-msw.c (mswindows_text_width): + * redisplay-tty.c (tty_text_width): + * redisplay-xlike-inc.c (XLIKE_text_width): + * redisplay-xlike-inc.c (XLIKE_output_string): + * redisplay.c: + * redisplay.c (redisplay_window_text_width_ichar_string): + * redisplay.c (redisplay_text_width_string): + Change the text_width method to take a window instead of a frame. + Needed for Unicode-internal. 2010-01-18 Ben Wing @@ -656,6 +2278,10 @@ Declare some temporary pointer variables const to avoid compile errors under C++ and/or Visual Studio 6. +2010-01-27 Ben Wing + + * casetab.c: Typo in comment. + 2010-01-24 Aidan Kehoe * number.c (Fnumerator, Fdenominator, Fcanonicalize_number): diff -r d2ec55325515 -r 8f0cf4fd3d2c src/Makefile.in.in --- a/src/Makefile.in.in Sat Feb 06 03:59:18 2010 -0600 +++ b/src/Makefile.in.in Sat Feb 06 04:01:46 2010 -0600 @@ -3,7 +3,7 @@ ## Copyright (C) 1994, 1995 Board of Trustees, University of Illinois ## Copyright (C) 1996, 1997 Sun Microsystems, Inc. ## Copyright (C) 1998, 1999 J. Kean Johnston. -## Copyright (C) 2001, 2002, 2003, 2005 Ben Wing. +## Copyright (C) 2001, 2002, 2003, 2005, 2010 Ben Wing. ## This file is part of XEmacs. @@ -884,6 +884,19 @@ testdir = $(SRC)/../tests/automated batch_test_emacs = $(BATCH_PACKAGES) -l $(testdir)/test-harness.el -f batch-test-emacs $(testdir) +## `config-changed' is useful if you are building both Unicode-internal +## and old-Mule workspaces using --srcdir and don't run configure before +## switching from one to the other. If you rerun configure, update-elc.el +## notices this and automatically removes the two files below, but not +## if you just switch directories and `make'. In that case, do +## `make config-changed' to avoid an error. + +.PHONY: remove-config-dependent-elcs config-changed +remove-config-dependent-elcs: + rm $(LISP)/mule/chinese.elc $(LISP)/mule/general-late.elc +config-changed: remove-config-dependent-elcs all + + .PHONY: check check-temacs check-features check: $(DO_XEMACS) $(batch_test_emacs) diff -r d2ec55325515 -r 8f0cf4fd3d2c src/README --- a/src/README Sat Feb 06 03:59:18 2010 -0600 +++ b/src/README Sat Feb 06 04:01:46 2010 -0600 @@ -61,7 +61,7 @@ eval.c for a classification of various error functions. -- Constant strings occurring in source files need to get wrapped - in a call to GETTEXT (or if inside of a call to `build_string', + in a call to GETTEXT (or if inside of a call to `build_ascstring', change that function to `build_translated_string') if they don't occur in certain places where the I18N3 message snarfer will see them. For a complete discussion of this, see the file diff -r d2ec55325515 -r 8f0cf4fd3d2c src/abbrev.c --- a/src/abbrev.c Sat Feb 06 03:59:18 2010 -0600 +++ b/src/abbrev.c Sat Feb 06 04:01:46 2010 -0600 @@ -424,16 +424,16 @@ if (NILP (XSYMBOL_VALUE (sym)) || ! NILP (system_flag)) return; - buffer_insert_c_string (buf, " ("); + buffer_insert_ascstring (buf, " ("); name = Fsymbol_name (sym); Fprin1 (name, stream); - buffer_insert_c_string (buf, " "); + buffer_insert_ascstring (buf, " "); Fprin1 (XSYMBOL_VALUE (sym), stream); - buffer_insert_c_string (buf, " "); + buffer_insert_ascstring (buf, " "); Fprin1 (XSYMBOL (sym)->function, stream); - buffer_insert_c_string (buf, " "); + buffer_insert_ascstring (buf, " "); Fprin1 (count, stream); - buffer_insert_c_string (buf, ")\n"); + buffer_insert_ascstring (buf, ")\n"); } static void @@ -462,7 +462,7 @@ if (!NILP (system_flag)) { - buffer_insert_c_string (buf, " (sys)"); + buffer_insert_ascstring (buf, " (sys)"); Findent_to (make_int (20), one, Qnil); } else @@ -476,7 +476,7 @@ Findent_to (make_int (45), one, Qnil); Fprin1 (XSYMBOL (sym)->function, stream); } - buffer_insert_c_string (buf, "\n"); + buffer_insert_ascstring (buf, "\n"); } static int @@ -528,28 +528,28 @@ if (!NILP (readable)) { - buffer_insert_c_string (buf, "("); + buffer_insert_ascstring (buf, "("); Fprin1 (name, stream); - buffer_insert_c_string (buf, ")\n\n"); + buffer_insert_ascstring (buf, ")\n\n"); while (! NILP (symbols)) { describe_abbrev (XCAR (symbols), stream); symbols = XCDR (symbols); } - buffer_insert_c_string (buf, "\n\n"); + buffer_insert_ascstring (buf, "\n\n"); } else { - buffer_insert_c_string (buf, "(define-abbrev-table '"); + buffer_insert_ascstring (buf, "(define-abbrev-table '"); Fprin1 (name, stream); - buffer_insert_c_string (buf, " '(\n"); + buffer_insert_ascstring (buf, " '(\n"); while (! NILP (symbols)) { write_abbrev (XCAR (symbols), stream); symbols = XCDR (symbols); } - buffer_insert_c_string (buf, " ))\n\n"); + buffer_insert_ascstring (buf, " ))\n\n"); } return Qnil; diff -r d2ec55325515 -r 8f0cf4fd3d2c src/alloc.c --- a/src/alloc.c Sat Feb 06 03:59:18 2010 -0600 +++ b/src/alloc.c Sat Feb 06 04:01:46 2010 -0600 @@ -229,7 +229,7 @@ { void *tmp = breathing_space; breathing_space = 0; - xfree (tmp, void *); + xfree (tmp); } } #endif /* not NEW_GC */ @@ -272,7 +272,7 @@ /* Unbelievably, calling free() on 0xDEADBEEF doesn't cause an \ error until much later on for many system mallocs, such as \ the one that comes with Solaris 2.3. FMH!! */ \ - assert (block != (void *) 0xDEADBEEF); \ + assert (block != (void *) DEADBEEF_CONSTANT); \ MALLOC_BEGIN (); \ } \ while (0) @@ -283,7 +283,7 @@ /* Unbelievably, calling free() on 0xDEADBEEF doesn't cause an \ error until much later on for many system mallocs, such as \ the one that comes with Solaris 2.3. FMH!! */ \ - assert (block != (void *) 0xDEADBEEF); \ + assert (block != (void *) DEADBEEF_CONSTANT); \ /* You cannot free something within dumped space, because there is \ no longer any sort of malloc structure associated with the block. \ If you are tripping this, you may need to conditionalize on \ @@ -1930,19 +1930,7 @@ f->stack_depth = (unsigned short) XINT (stack_depth); #ifdef COMPILED_FUNCTION_ANNOTATION_HACK - if (!NILP (Vcurrent_compiled_function_annotation)) - f->annotated = Fcopy (Vcurrent_compiled_function_annotation); - else if (!NILP (Vload_file_name_internal_the_purecopy)) - f->annotated = Vload_file_name_internal_the_purecopy; - else if (!NILP (Vload_file_name_internal)) - { - struct gcpro gcpro1; - GCPRO1 (fun); /* don't let fun get reaped */ - Vload_file_name_internal_the_purecopy = - Ffile_name_nondirectory (Vload_file_name_internal); - f->annotated = Vload_file_name_internal_the_purecopy; - UNGCPRO; - } + f->annotated = Vload_file_name_internal; #endif /* COMPILED_FUNCTION_ANNOTATION_HACK */ /* doc_string may be nil, string, int, or a cons (string . int). @@ -2660,7 +2648,7 @@ XSTRING_LENGTH (s) + 1 - pos); } XSET_STRING_DATA (s, new_data); - xfree (old_data, Ibyte *); + xfree (old_data); } } else /* old string is small */ @@ -2878,7 +2866,7 @@ /* Take some raw memory, encoded in some external data format, and convert it into a Lisp string. */ Lisp_Object -make_ext_string (const Extbyte *contents, EMACS_INT length, +make_extstring (const Extbyte *contents, EMACS_INT length, Lisp_Object coding_system) { Lisp_Object string; @@ -2889,39 +2877,93 @@ } Lisp_Object -build_intstring (const Ibyte *str) +build_istring (const Ibyte *str) { /* Some strlen's crash and burn if passed null. */ return make_string (str, (str ? qxestrlen (str) : (Bytecount) 0)); } Lisp_Object -build_string (const CIbyte *str) -{ - /* Some strlen's crash and burn if passed null. */ - return make_string ((const Ibyte *) str, (str ? strlen (str) : 0)); +build_cistring (const CIbyte *str) +{ + return build_istring ((const Ibyte *) str); +} + +Lisp_Object +build_ascstring (const Ascbyte *str) +{ + ASSERT_ASCTEXT_ASCII (str); + return build_istring ((const Ibyte *) str); } Lisp_Object -build_ext_string (const Extbyte *str, Lisp_Object coding_system) +build_extstring (const Extbyte *str, Lisp_Object coding_system) { /* Some strlen's crash and burn if passed null. */ - return make_ext_string ((const Extbyte *) str, + return make_extstring ((const Extbyte *) str, (str ? dfc_external_data_len (str, coding_system) : 0), coding_system); } +/* Build a string whose content is a translatable message, and translate + the message according to the current language environment. */ + +Lisp_Object +build_msg_istring (const Ibyte *str) +{ + return build_istring (IGETTEXT (str)); +} + +/* Build a string whose content is a translatable message, and translate + the message according to the current language environment. */ + +Lisp_Object +build_msg_cistring (const CIbyte *str) +{ + return build_msg_istring ((const Ibyte *) str); +} + +/* Build a string whose content is a translatable message, and translate + the message according to the current language environment. + String must be pure-ASCII, and when compiled with error-checking, + an abort will have if not pure-ASCII. */ + +Lisp_Object +build_msg_ascstring (const Ascbyte *str) +{ + ASSERT_ASCTEXT_ASCII (str); + return build_msg_istring ((const Ibyte *) str); +} + +/* Build a string whose content is a translatable message, but don't + translate the message immediately. Perhaps do something else instead, + such as put a property on the string indicating that it needs to be + translated. + + This is useful for strings that are built at dump time or init time, + rather than on-the-fly when the current language environment is set + properly. */ + +Lisp_Object +build_defer_istring (const Ibyte *str) +{ + Lisp_Object retval = build_istring ((Ibyte *) str); + /* Possibly do something to the return value */ + return retval; +} + Lisp_Object -build_msg_intstring (const Ibyte *str) -{ - return build_intstring (GETTEXT (str)); +build_defer_cistring (const CIbyte *str) +{ + return build_defer_istring ((Ibyte *) str); } Lisp_Object -build_msg_string (const CIbyte *str) -{ - return build_string (CGETTEXT (str)); +build_defer_ascstring (const Ascbyte *str) +{ + ASSERT_ASCTEXT_ASCII (str); + return build_defer_istring ((Ibyte *) str); } Lisp_Object @@ -3247,62 +3289,54 @@ #ifdef DEBUG_XEMACS -static const struct memory_description staticpro_one_name_description_1[] = { - { XD_ASCII_STRING, 0 }, - { XD_END } -}; - -static const struct sized_memory_description staticpro_one_name_description = { - sizeof (char *), - staticpro_one_name_description_1 -}; - -static const struct memory_description staticpro_names_description_1[] = { - XD_DYNARR_DESC (char_ptr_dynarr, &staticpro_one_name_description), - { XD_END } -}; - - -extern const struct sized_memory_description staticpro_names_description; - -const struct sized_memory_description staticpro_names_description = { - sizeof (char_ptr_dynarr), - staticpro_names_description_1 -}; - /* Help debug crashes gc-marking a staticpro'ed object. */ Lisp_Object_ptr_dynarr *staticpros; -char_ptr_dynarr *staticpro_names; +const_Ascbyte_ptr_dynarr *staticpro_names; /* Mark the Lisp_Object at non-heap VARADDRESS as a root object for garbage collection, and for dumping. */ void -staticpro_1 (Lisp_Object *varaddress, char *varname) +staticpro_1 (Lisp_Object *varaddress, const Ascbyte *varname) { Dynarr_add (staticpros, varaddress); Dynarr_add (staticpro_names, varname); dump_add_root_lisp_object (varaddress); } +/* External debugging function: Return the name of the variable at offset + COUNT. */ +const Ascbyte * +staticpro_name (int count) +{ + return Dynarr_at (staticpro_names, count); +} Lisp_Object_ptr_dynarr *staticpros_nodump; -char_ptr_dynarr *staticpro_nodump_names; +const_Ascbyte_ptr_dynarr *staticpro_nodump_names; /* Mark the Lisp_Object at heap VARADDRESS as a root object for garbage collection, but not for dumping. (See below.) */ void -staticpro_nodump_1 (Lisp_Object *varaddress, char *varname) +staticpro_nodump_1 (Lisp_Object *varaddress, const Ascbyte *varname) { Dynarr_add (staticpros_nodump, varaddress); Dynarr_add (staticpro_nodump_names, varname); } +/* External debugging function: Return the name of the variable at offset + COUNT. */ +const Ascbyte * +staticpro_nodump_name (int count) +{ + return Dynarr_at (staticpro_nodump_names, count); +} + #ifdef HAVE_SHLIB /* Stop treating the Lisp_Object at non-heap VARADDRESS as a root object for garbage collection, but not for dumping. */ void -unstaticpro_nodump_1 (Lisp_Object *varaddress, char *varname) +unstaticpro_nodump_1 (Lisp_Object *varaddress, const Ascbyte *varname) { Dynarr_delete_object (staticpros, varaddress); Dynarr_delete_object (staticpro_names, varname); @@ -3386,42 +3420,28 @@ #ifdef DEBUG_XEMACS -static const struct memory_description mcpro_one_name_description_1[] = { - { XD_ASCII_STRING, 0 }, - { XD_END } -}; - -static const struct sized_memory_description mcpro_one_name_description = { - sizeof (char *), - mcpro_one_name_description_1 -}; - -static const struct memory_description mcpro_names_description_1[] = { - XD_DYNARR_DESC (char_ptr_dynarr, &mcpro_one_name_description), - { XD_END } -}; - -extern const struct sized_memory_description mcpro_names_description; - -const struct sized_memory_description mcpro_names_description = { - sizeof (char_ptr_dynarr), - mcpro_names_description_1 -}; - /* Help debug crashes gc-marking a mcpro'ed object. */ Lisp_Object_dynarr *mcpros; -char_ptr_dynarr *mcpro_names; +const_Ascbyte_ptr_dynarr *mcpro_names; /* Mark the Lisp_Object at non-heap VARADDRESS as a root object for garbage collection, and for dumping. */ void -mcpro_1 (Lisp_Object varaddress, char *varname) +mcpro_1 (Lisp_Object varaddress, const Ascbyte *varname) { Dynarr_add (mcpros, varaddress); Dynarr_add (mcpro_names, varname); } +/* External debugging function: Return the name of the variable at offset + COUNT. */ +const Ascbyte * +mcpro_name (int count) +{ + return Dynarr_at (mcpro_names, count); +} + #else /* not DEBUG_XEMACS */ Lisp_Object_dynarr *mcpros; @@ -3540,7 +3560,7 @@ *prev = next; tick_lcrecord_stats (h, 1); /* used to call finalizer right here. */ - xfree (header, struct old_lcrecord_header *); + xfree (header); header = next; } } @@ -3664,7 +3684,7 @@ SFTB_current = SFTB_current->prev; \ { \ *SFTB_prev = SFTB_current; \ - xfree (SFTB_victim_block, struct typename##_block *); \ + xfree (SFTB_victim_block); \ /* Restore free list to what it was before victim was swept */ \ typename##_free_list = SFTB_old_free_list; \ num_free -= SFTB_limit; \ @@ -3770,7 +3790,7 @@ { #define UNMARK_compiled_function(ptr) UNMARK_RECORD_HEADER (&((ptr)->lheader)) #define ADDITIONAL_FREE_compiled_function(ptr) \ - if (ptr->args_in_array) xfree (ptr->args, Lisp_Object *) + if (ptr->args_in_array) xfree (ptr->args) SWEEP_FIXED_TYPE_BLOCK (compiled_function, Lisp_Compiled_Function); } @@ -4203,7 +4223,7 @@ for (victim = to_sb->next; victim; ) { struct string_chars_block *next = victim->next; - xfree (victim, struct string_chars_block *); + xfree (victim); victim = next; } @@ -4263,7 +4283,7 @@ #define ADDITIONAL_FREE_string(ptr) do { \ Bytecount size = ptr->size_; \ if (BIG_STRING_SIZE_P (size)) \ - xfree (ptr->data_, Ibyte *); \ + xfree (ptr->data_); \ } while (0) SWEEP_FIXED_TYPE_BLOCK_1 (string, Lisp_String, u.lheader); @@ -4453,8 +4473,8 @@ { if (lrecord_stats[i].instances_in_use != 0) { - char buf [255]; - const char *name = lrecord_implementations_table[i]->name; + Ascbyte buf[255]; + const Ascbyte *name = lrecord_implementations_table[i]->name; int len = strlen (name); if (lrecord_stats[i].bytes_in_use_including_overhead != @@ -4497,8 +4517,8 @@ || lcrecord_stats[i].bytes_freed != 0 || lcrecord_stats[i].instances_on_free_list != 0) { - char buf [255]; - const char *name = lrecord_implementations_table[i]->name; + Ascbyte buf[255]; + const Ascbyte *name = lrecord_implementations_table[i]->name; int len = strlen (name); sprintf (buf, "%s-storage", name); @@ -4940,7 +4960,8 @@ #ifdef DEBUG_XEMACS if (staticpro_nodump_names) Dynarr_free (staticpro_nodump_names); - staticpro_nodump_names = Dynarr_new2 (char_ptr_dynarr, char *); + staticpro_nodump_names = Dynarr_new2 (const_Ascbyte_ptr_dynarr, + const Ascbyte *); Dynarr_resize (staticpro_nodump_names, 100); /* ditto */ #endif @@ -4949,9 +4970,10 @@ Dynarr_resize (mcpros, 1410); /* merely a small optimization */ dump_add_root_block_ptr (&mcpros, &mcpros_description); #ifdef DEBUG_XEMACS - mcpro_names = Dynarr_new2 (char_ptr_dynarr, char *); + mcpro_names = Dynarr_new2 (const_Ascbyte_ptr_dynarr, const Ascbyte *); Dynarr_resize (mcpro_names, 1410); /* merely a small optimization */ - dump_add_root_block_ptr (&mcpro_names, &mcpro_names_description); + dump_add_root_block_ptr (&mcpro_names, + &const_Ascbyte_ptr_dynarr_description); #endif #endif /* NEW_GC */ @@ -5044,9 +5066,10 @@ Dynarr_resize (staticpros, 1410); /* merely a small optimization */ dump_add_root_block_ptr (&staticpros, &staticpros_description); #ifdef DEBUG_XEMACS - staticpro_names = Dynarr_new2 (char_ptr_dynarr, char *); + staticpro_names = Dynarr_new2 (const_Ascbyte_ptr_dynarr, const Ascbyte *); Dynarr_resize (staticpro_names, 1410); /* merely a small optimization */ - dump_add_root_block_ptr (&staticpro_names, &staticpro_names_description); + dump_add_root_block_ptr (&staticpro_names, + &const_Ascbyte_ptr_dynarr_description); #endif #ifdef NEW_GC @@ -5054,9 +5077,10 @@ Dynarr_resize (mcpros, 1410); /* merely a small optimization */ dump_add_root_block_ptr (&mcpros, &mcpros_description); #ifdef DEBUG_XEMACS - mcpro_names = Dynarr_new2 (char_ptr_dynarr, char *); + mcpro_names = Dynarr_new2 (const_Ascbyte_ptr_dynarr, const Ascbyte *); Dynarr_resize (mcpro_names, 1410); /* merely a small optimization */ - dump_add_root_block_ptr (&mcpro_names, &mcpro_names_description); + dump_add_root_block_ptr (&mcpro_names, + &const_Ascbyte_ptr_dynarr_description); #endif #else /* not NEW_GC */ init_lcrecord_lists (); diff -r d2ec55325515 -r 8f0cf4fd3d2c src/alloca.c --- a/src/alloca.c Sat Feb 06 03:59:18 2010 -0600 +++ b/src/alloca.c Sat Feb 06 04:01:46 2010 -0600 @@ -152,7 +152,7 @@ register header *np = hp->h.next; #ifdef emacs - xfree (hp, header *); /* Collect garbage. */ + xfree (hp); /* Collect garbage. */ #else free (hp); /* Collect garbage. */ #endif diff -r d2ec55325515 -r 8f0cf4fd3d2c src/alsaplay.c --- a/src/alsaplay.c Sat Feb 06 03:59:18 2010 -0600 +++ b/src/alsaplay.c Sat Feb 06 04:01:46 2010 -0600 @@ -414,6 +414,6 @@ retry_read (fd, data, st.st_size); retry_close (fd); retval = alsa_play_sound_data (data, st.st_size, volume); - xfree (data, Binbyte); + xfree (data); return retval; } diff -r d2ec55325515 -r 8f0cf4fd3d2c src/buffer.c --- a/src/buffer.c Sat Feb 06 03:59:18 2010 -0600 +++ b/src/buffer.c Sat Feb 06 04:01:46 2010 -0600 @@ -309,7 +309,7 @@ printing_unreadable_object ("#", XSTRING_DATA (b->name)); } else if (!BUFFER_LIVE_P (b)) - write_c_string (printcharfun, "#"); + write_ascstring (printcharfun, "#"); else if (escapeflag) write_fmt_string_lisp (printcharfun, "#", 1, b->name); else @@ -788,7 +788,7 @@ while (1) { qxesprintf (number, "<%d>", ++count); - gentemp = concat2 (name, build_intstring (number)); + gentemp = concat2 (name, build_istring (number)); if (!NILP (ignore)) { tem = Fstring_equal (gentemp, ignore); @@ -1998,8 +1998,8 @@ staticpro (&QSFundamental); staticpro (&QSscratch); - QSFundamental = build_string ("Fundamental"); - QSscratch = build_string (DEFER_GETTEXT ("*scratch*")); + QSFundamental = build_ascstring ("Fundamental"); + QSscratch = build_ascstring ("*scratch*"); DEFVAR_LISP ("change-major-mode-hook", &Vchange_major_mode_hook /* List of hooks to be run before killing local variables in a buffer. @@ -2258,7 +2258,7 @@ defs->syntax_table = Vstandard_syntax_table; defs->mirror_syntax_table = XCHAR_TABLE (Vstandard_syntax_table)->mirror_table; - defs->modeline_format = build_string ("%-"); /* reset in loaddefs.el */ + defs->modeline_format = build_ascstring ("%-"); /* reset in loaddefs.el */ defs->case_fold_search = Qt; defs->selective_display_ellipses = Qt; defs->tab_width = make_int (8); @@ -2935,7 +2935,7 @@ stderr_out ("`getcwd' failed: %s: changing default directory to %s\n", errmess, DEFAULT_DIRECTORY_FALLBACK); - if (qxe_chdir ((Ibyte *)DEFAULT_DIRECTORY_FALLBACK) < 0) + if (qxe_chdir ((Ibyte *) DEFAULT_DIRECTORY_FALLBACK) < 0) { GET_STRERROR (errmess, errno); @@ -2964,7 +2964,7 @@ #ifdef WIN32_NATIVE { Ibyte *newinit = mswindows_canonicalize_filename (initial_directory); - xfree (initial_directory, Ibyte *); + xfree (initial_directory); initial_directory = newinit; } @@ -2982,7 +2982,7 @@ XECOPY_TCHAR (p, '\0'); qxeSetCurrentDirectory (modname); - xfree (modname, Extbyte *); + xfree (modname); } #endif } @@ -2999,7 +2999,7 @@ /* This function can GC */ Fset_buffer (Fget_buffer (QSscratch)); - current_buffer->directory = build_intstring (initial_directory); + current_buffer->directory = build_istring (initial_directory); #if 0 /* FSFmacs */ /* #### is this correct? */ diff -r d2ec55325515 -r 8f0cf4fd3d2c src/buffer.h --- a/src/buffer.h Sat Feb 06 03:59:18 2010 -0600 +++ b/src/buffer.h Sat Feb 06 04:01:46 2010 -0600 @@ -1149,7 +1149,7 @@ #define BUFFER_REALLOC(data,size)\ ((Ibyte *) xrealloc (data, (size) * sizeof(Ibyte))) /* Avoid excess parentheses, or syntax errors may rear their heads. */ -#define BUFFER_FREE(data) xfree (data, Ibyte *) +#define BUFFER_FREE(data) xfree (data) #define R_ALLOC_DECLARE(var,data) #endif /* !REL_ALLOC */ diff -r d2ec55325515 -r 8f0cf4fd3d2c src/bytecode-ops.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/src/bytecode-ops.h Sat Feb 06 04:01:46 2010 -0600 @@ -0,0 +1,185 @@ +/* Execution of byte code produced by bytecomp.el. + Implementation of compiled-function objects. + Copyright (C) 1992, 1993 Free Software Foundation, Inc. + Copyright (C) 1995, 2002, 2010 Ben Wing. + +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.0, FSF 19.30. */ + +/* There is more than one place in bytecode.c that may want to do something + with the list of all the opcodes. To handle this, we extract them into + a separate file that can get included after defining OPCODE(sym, val) + appropriately. No need to undefine OPCODE; that happens automatically. +*/ + + OPCODE (varref, 010) + OPCODE (varset, 020) + OPCODE (varbind, 030) + OPCODE (call, 040) + OPCODE (unbind, 050) + + OPCODE (nth, 070) + OPCODE (symbolp, 071) + OPCODE (consp, 072) + OPCODE (stringp, 073) + OPCODE (listp, 074) + OPCODE (old_eq, 075) + OPCODE (old_memq, 076) + OPCODE (not, 077) + OPCODE (car, 0100) + OPCODE (cdr, 0101) + OPCODE (cons, 0102) + OPCODE (list1, 0103) + OPCODE (list2, 0104) + OPCODE (list3, 0105) + OPCODE (list4, 0106) + OPCODE (length, 0107) + OPCODE (aref, 0110) + OPCODE (aset, 0111) + OPCODE (symbol_value, 0112) + OPCODE (symbol_function, 0113) + OPCODE (set, 0114) + OPCODE (fset, 0115) + OPCODE (get, 0116) + OPCODE (substring, 0117) + OPCODE (concat2, 0120) + OPCODE (concat3, 0121) + OPCODE (concat4, 0122) + OPCODE (sub1, 0123) + OPCODE (add1, 0124) + OPCODE (eqlsign, 0125) + OPCODE (gtr, 0126) + OPCODE (lss, 0127) + OPCODE (leq, 0130) + OPCODE (geq, 0131) + OPCODE (diff, 0132) + OPCODE (negate, 0133) + OPCODE (plus, 0134) + OPCODE (max, 0135) + OPCODE (min, 0136) + OPCODE (mult, 0137) + + OPCODE (point, 0140) + OPCODE (eq, 0141) /* was Bmark, but no longer + generated as of v18 */ + OPCODE (goto_char, 0142) + OPCODE (insert, 0143) + OPCODE (point_max, 0144) + OPCODE (point_min, 0145) + OPCODE (char_after, 0146) + OPCODE (following_char, 0147) + OPCODE (preceding_char, 0150) + OPCODE (current_column, 0151) + OPCODE (indent_to, 0152) + OPCODE (equal, 0153) /* was Bscan_buffer, but no + longer generated as of + v18 */ + OPCODE (eolp, 0154) + OPCODE (eobp, 0155) + OPCODE (bolp, 0156) + OPCODE (bobp, 0157) + OPCODE (current_buffer, 0160) + OPCODE (set_buffer, 0161) + OPCODE (save_current_buffer, 0162) /* was Bread_char, but no + longer generated as of + v19 */ + OPCODE (memq, 0163) /* was Bset_mark, but no + longer generated as of + v18 */ + OPCODE (interactive_p, 0164) /* Needed since interactive-p + takes unevalled args */ + OPCODE (forward_char, 0165) + OPCODE (forward_word, 0166) + OPCODE (skip_chars_forward, 0167) + OPCODE (skip_chars_backward, 0170) + OPCODE (forward_line, 0171) + OPCODE (char_syntax, 0172) + OPCODE (buffer_substring, 0173) + OPCODE (delete_region, 0174) + OPCODE (narrow_to_region, 0175) + OPCODE (widen, 0176) + OPCODE (end_of_line, 0177) + + OPCODE (constant2, 0201) + OPCODE (goto, 0202) + OPCODE (gotoifnil, 0203) + OPCODE (gotoifnonnil, 0204) + OPCODE (gotoifnilelsepop, 0205) + OPCODE (gotoifnonnilelsepop, 0206) + OPCODE (return, 0207) + OPCODE (discard, 0210) + OPCODE (dup, 0211) + + OPCODE (save_excursion, 0212) + OPCODE (save_window_excursion, 0213) + OPCODE (save_restriction, 0214) + OPCODE (catch, 0215) + + OPCODE (unwind_protect, 0216) + OPCODE (condition_case, 0217) + OPCODE (temp_output_buffer_setup, 0220) + OPCODE (temp_output_buffer_show, 0221) + + OPCODE (unbind_all, 0222) + + OPCODE (set_marker, 0223) + OPCODE (match_beginning, 0224) + OPCODE (match_end, 0225) + OPCODE (upcase, 0226) + OPCODE (downcase, 0227) + + OPCODE (string_equal, 0230) + OPCODE (string_lessp, 0231) + OPCODE (old_equal, 0232) + OPCODE (nthcdr, 0233) + OPCODE (elt, 0234) + OPCODE (old_member, 0235) + OPCODE (old_assq, 0236) + OPCODE (nreverse, 0237) + OPCODE (setcar, 0240) + OPCODE (setcdr, 0241) + OPCODE (car_safe, 0242) + OPCODE (cdr_safe, 0243) + OPCODE (nconc, 0244) + OPCODE (quo, 0245) + OPCODE (rem, 0246) + OPCODE (numberp, 0247) + OPCODE (fixnump, 0250) /* Was Bintegerp. */ + + OPCODE (Rgoto, 0252) + OPCODE (Rgotoifnil, 0253) + OPCODE (Rgotoifnonnil, 0254) + OPCODE (Rgotoifnilelsepop, 0255) + OPCODE (Rgotoifnonnilelsepop, 0256) + + OPCODE (listN, 0257) + OPCODE (concatN, 0260) + OPCODE (insertN, 0261) + + OPCODE (bind_multiple_value_limits, 0262) /* New in 21.5. */ + OPCODE (multiple_value_list_internal, 0263) /* New in 21.5. */ + OPCODE (multiple_value_call, 0264) /* New in 21.5. */ + OPCODE (throw, 0265) /* New in 21.5. */ + + OPCODE (member, 0266) /* new in v20 */ + OPCODE (assq, 0267) /* new in v20 */ + + OPCODE (constant, 0300) + +#undef OPCODE diff -r d2ec55325515 -r 8f0cf4fd3d2c src/bytecode.c --- a/src/bytecode.c Sat Feb 06 03:59:18 2010 -0600 +++ b/src/bytecode.c Sat Feb 06 04:01:46 2010 -0600 @@ -58,6 +58,8 @@ #include "syntax.h" #include "window.h" +#define NUM_REMEMBERED_BYTE_OPS 100 + #ifdef NEW_GC static Lisp_Object make_compiled_function_args (int totalargs) @@ -101,169 +103,110 @@ Lisp_Object Qbyte_code, Qcompiled_functionp, Qinvalid_byte_code; + enum Opcode /* Byte codes */ { - Bvarref = 010, - Bvarset = 020, - Bvarbind = 030, - Bcall = 040, - Bunbind = 050, - - Bnth = 070, - Bsymbolp = 071, - Bconsp = 072, - Bstringp = 073, - Blistp = 074, - Bold_eq = 075, - Bold_memq = 076, - Bnot = 077, - Bcar = 0100, - Bcdr = 0101, - Bcons = 0102, - Blist1 = 0103, - Blist2 = 0104, - Blist3 = 0105, - Blist4 = 0106, - Blength = 0107, - Baref = 0110, - Baset = 0111, - Bsymbol_value = 0112, - Bsymbol_function = 0113, - Bset = 0114, - Bfset = 0115, - Bget = 0116, - Bsubstring = 0117, - Bconcat2 = 0120, - Bconcat3 = 0121, - Bconcat4 = 0122, - Bsub1 = 0123, - Badd1 = 0124, - Beqlsign = 0125, - Bgtr = 0126, - Blss = 0127, - Bleq = 0130, - Bgeq = 0131, - Bdiff = 0132, - Bnegate = 0133, - Bplus = 0134, - Bmax = 0135, - Bmin = 0136, - Bmult = 0137, - - Bpoint = 0140, - Beq = 0141, /* was Bmark, - but no longer generated as of v18 */ - Bgoto_char = 0142, - Binsert = 0143, - Bpoint_max = 0144, - Bpoint_min = 0145, - Bchar_after = 0146, - Bfollowing_char = 0147, - Bpreceding_char = 0150, - Bcurrent_column = 0151, - Bindent_to = 0152, - Bequal = 0153, /* was Bscan_buffer, - but no longer generated as of v18 */ - Beolp = 0154, - Beobp = 0155, - Bbolp = 0156, - Bbobp = 0157, - Bcurrent_buffer = 0160, - Bset_buffer = 0161, - Bsave_current_buffer = 0162, /* was Bread_char, - but no longer generated as of v19 */ - Bmemq = 0163, /* was Bset_mark, - but no longer generated as of v18 */ - Binteractive_p = 0164, /* Needed since interactive-p takes - unevalled args */ - Bforward_char = 0165, - Bforward_word = 0166, - Bskip_chars_forward = 0167, - Bskip_chars_backward = 0170, - Bforward_line = 0171, - Bchar_syntax = 0172, - Bbuffer_substring = 0173, - Bdelete_region = 0174, - Bnarrow_to_region = 0175, - Bwiden = 0176, - Bend_of_line = 0177, - - Bconstant2 = 0201, - Bgoto = 0202, - Bgotoifnil = 0203, - Bgotoifnonnil = 0204, - Bgotoifnilelsepop = 0205, - Bgotoifnonnilelsepop = 0206, - Breturn = 0207, - Bdiscard = 0210, - Bdup = 0211, - - Bsave_excursion = 0212, - Bsave_window_excursion= 0213, - Bsave_restriction = 0214, - Bcatch = 0215, - - Bunwind_protect = 0216, - Bcondition_case = 0217, - Btemp_output_buffer_setup = 0220, - Btemp_output_buffer_show = 0221, - - Bunbind_all = 0222, - - Bset_marker = 0223, - Bmatch_beginning = 0224, - Bmatch_end = 0225, - Bupcase = 0226, - Bdowncase = 0227, - - Bstring_equal = 0230, - Bstring_lessp = 0231, - Bold_equal = 0232, - Bnthcdr = 0233, - Belt = 0234, - Bold_member = 0235, - Bold_assq = 0236, - Bnreverse = 0237, - Bsetcar = 0240, - Bsetcdr = 0241, - Bcar_safe = 0242, - Bcdr_safe = 0243, - Bnconc = 0244, - Bquo = 0245, - Brem = 0246, - Bnumberp = 0247, - Bfixnump = 0250, /* Was Bintegerp. */ - - BRgoto = 0252, - BRgotoifnil = 0253, - BRgotoifnonnil = 0254, - BRgotoifnilelsepop = 0255, - BRgotoifnonnilelsepop = 0256, - - BlistN = 0257, - BconcatN = 0260, - BinsertN = 0261, - - Bbind_multiple_value_limits = 0262, /* New in 21.5. */ - Bmultiple_value_list_internal = 0263, /* New in 21.5. */ - Bmultiple_value_call = 0264, /* New in 21.5. */ - Bthrow = 0265, /* New in 21.5. */ - - Bmember = 0266, /* new in v20 */ - Bassq = 0267, /* new in v20 */ - - Bconstant = 0300 +#define OPCODE(sym, val) B##sym = val, +#include "bytecode-ops.h" }; typedef enum Opcode Opcode; - Lisp_Object * execute_rare_opcode (Lisp_Object *stack_ptr, +#ifdef ERROR_CHECK_BYTE_CODE + Lisp_Object *stack_beg, + Lisp_Object *stack_end, +#endif /* ERROR_CHECK_BYTE_CODE */ const Opbyte *program_ptr, Opcode opcode); -/* Define BYTE_CODE_METER to enable generation of a byte-op usage histogram. - This isn't defined in FSF Emacs and isn't defined in XEmacs v19. */ -/* #define BYTE_CODE_METER */ +#ifndef ERROR_CHECK_BYTE_CODE + +/* Normally we would use `x' instead of `0' in the argument list, to avoid + problems if `x' (an expression) has side effects, and warnings if `x' + contains variables or parameters that are otherwise unused. But in + this case `x' contains references to vars and params that exist only + when ERROR_CHECK_BYTE_CODE, and leaving in `x' would result in compile + errors. */ +# define bytecode_assert(x) disabled_assert (0) +# define bytecode_assert_with_message(x, msg) disabled_assert(0) +# define bytecode_abort_with_message(msg) abort_with_message (msg) + +#else /* ERROR_CHECK_BYTE_CODE */ + +# define bytecode_assert(x) \ + ((x) ? (void) 0 : assert_failed_with_remembered_ops (__FILE__, __LINE__, #x)) +# define bytecode_assert_with_message(x, msg) \ + ((x) ? (void) 0 : assert_failed_with_remembered_ops (__FILE__, __LINE__, msg)) +# define bytecode_abort_with_message(msg) \ + assert_failed_with_remembered_ops (__FILE__, __LINE__, msg) + +/* Table mapping opcodes to their names. This handles opcodes like + Bvarref+7, but it doesn't list any of the Bconstant+N opcodes; those + are handled specially. */ +Ascbyte *opcode_name_table[256]; + +/* Circular queue remembering the most recent operations. */ +Opcode remembered_ops[NUM_REMEMBERED_BYTE_OPS]; +int remembered_op_next_pos, num_remembered; + +static void +remember_operation (Opcode op) +{ + remembered_ops[remembered_op_next_pos] = op; + remembered_op_next_pos = + (remembered_op_next_pos + 1) % NUM_REMEMBERED_BYTE_OPS; + if (num_remembered < NUM_REMEMBERED_BYTE_OPS) + num_remembered++; +} + +static void +assert_failed_with_remembered_ops (const Ascbyte *file, int line, + const Ascbyte *msg_to_abort_with) +{ + Ascbyte *msg = + alloca_array (Ascbyte, + NUM_REMEMBERED_BYTE_OPS*50 + strlen (msg_to_abort_with)); + int i; + + if (msg_to_abort_with) + strcpy (msg, msg_to_abort_with); + strcat (msg, "\n\nRecent bytecodes, oldest first:\n\n"); + + for (i = 0; i < num_remembered; i++) + { + Ascbyte msg2[50]; + int pos; + Opcode op; + + sprintf (msg2, "%5d: ", i - num_remembered + 1); + strcat (msg, msg2); + pos = (remembered_op_next_pos + NUM_REMEMBERED_BYTE_OPS + + i - num_remembered) % NUM_REMEMBERED_BYTE_OPS; + op = remembered_ops[pos]; + if (op >= Bconstant) + { + sprintf (msg2, "constant+%d", op - Bconstant); + strcat (msg, msg2); + } + else + { + const Ascbyte *opname = opcode_name_table[op]; + if (!opname) + { + stderr_out ("Internal error! NULL pointer in opcode_name_table, opcode %d\n", op); + strcat (msg, "NULL"); + } + else + strcat (msg, opname); + } + sprintf (msg2, " (%d)\n", op); + strcat (msg, msg2); + } + + assert_failed (file, line, msg); +} + +#endif /* ERROR_CHECK_BYTE_CODE */ #ifdef BYTE_CODE_METER @@ -619,72 +562,127 @@ } + +/*********************** The instruction array *********************/ + +/* Check that there are at least LEN elements left in the end of the + instruction array before fetching them. Note that we allow for + PROGRAM_PTR == PROGRAM_END after the fetch -- that means there are + no more elements to fetch next time around, but we might exit before + next time comes. + + When checking the destination if jumps, however, we don't allow + PROGRAM_PTR to equal PROGRAM_END, since we will always be fetching + another instruction after the jump. */ + +#define CHECK_OPCODE_SPACE(len) \ + bytecode_assert (program_ptr + len <= program_end) + /* Read next uint8 from the instruction stream. */ -#define READ_UINT_1 ((unsigned int) (unsigned char) *program_ptr++) +#define READ_UINT_1 \ + (CHECK_OPCODE_SPACE (1), (unsigned int) (unsigned char) *program_ptr++) /* Read next uint16 from the instruction stream. */ #define READ_UINT_2 \ - (program_ptr += 2, \ + (CHECK_OPCODE_SPACE (2), \ + program_ptr += 2, \ (((unsigned int) (unsigned char) program_ptr[-1]) * 256 + \ ((unsigned int) (unsigned char) program_ptr[-2]))) /* Read next int8 from the instruction stream. */ -#define READ_INT_1 ((int) (signed char) *program_ptr++) +#define READ_INT_1 \ + (CHECK_OPCODE_SPACE (1), (int) (signed char) *program_ptr++) /* Read next int16 from the instruction stream. */ #define READ_INT_2 \ - (program_ptr += 2, \ + (CHECK_OPCODE_SPACE (2), \ + program_ptr += 2, \ (((int) ( signed char) program_ptr[-1]) * 256 + \ ((int) (unsigned char) program_ptr[-2]))) /* Read next int8 from instruction stream; don't advance program_pointer */ -#define PEEK_INT_1 ((int) (signed char) program_ptr[0]) +#define PEEK_INT_1 \ + (CHECK_OPCODE_SPACE (1), (int) (signed char) program_ptr[0]) /* Read next int16 from instruction stream; don't advance program_pointer */ #define PEEK_INT_2 \ - ((((int) ( signed char) program_ptr[1]) * 256) | \ + (CHECK_OPCODE_SPACE (2), \ + (((int) ( signed char) program_ptr[1]) * 256) | \ ((int) (unsigned char) program_ptr[0])) /* Do relative jumps from the current location. We only do a QUIT if we jump backwards, for efficiency. No infloops without backward jumps! */ -#define JUMP_RELATIVE(jump) do { \ - int JR_jump = (jump); \ - if (JR_jump < 0) QUIT; \ - program_ptr += JR_jump; \ +#define JUMP_RELATIVE(jump) do { \ + int _JR_jump = (jump); \ + if (_JR_jump < 0) QUIT; \ + /* Check that where we're going to is in range. Note that we don't use \ + CHECK_OPCODE_SPACE() -- that only checks the end, and it allows \ + program_ptr == program_end, which we don't allow. */ \ + bytecode_assert (program_ptr + _JR_jump >= program && \ + program_ptr + _JR_jump < program_end); \ + program_ptr += _JR_jump; \ } while (0) #define JUMP JUMP_RELATIVE (PEEK_INT_2) #define JUMPR JUMP_RELATIVE (PEEK_INT_1) -#define JUMP_NEXT ((void) (program_ptr += 2)) -#define JUMPR_NEXT ((void) (program_ptr += 1)) +#define JUMP_NEXT (CHECK_OPCODE_SPACE (2), (void) (program_ptr += 2)) +#define JUMPR_NEXT (CHECK_OPCODE_SPACE (1), (void) (program_ptr += 1)) + +/*********************** The stack array *********************/ + +/* NOTE: The stack array doesn't work quite like you'd expect. + + STACK_PTR points to the value on the top of the stack. Popping a value + fetches the value from the STACK_PTR and then decrements it. Pushing a + value first increments it, then writes the new value. STACK_PTR - + STACK_BEG is the number of elements on the stack. + + This means that when STACK_PTR == STACK_BEG, the stack is empty, and + the space at STACK_BEG is never written to -- the first push will write + into the space directly after STACK_BEG. This is why the call to + alloca_array() below has a count of `stack_depth + 1', and why + we GCPRO1 (stack_ptr[1]) -- the value at stack_ptr[0] is unused and + uninitialized. + + Also, STACK_END actually points to the last usable storage location, + and does not point past the end, like you'd expect. */ + +#define CHECK_STACKPTR_OFFSET(len) \ + bytecode_assert (stack_ptr + (len) >= stack_beg && \ + stack_ptr + (len) <= stack_end) /* Push x onto the execution stack. */ -#define PUSH(x) (*++stack_ptr = (x)) +#define PUSH(x) (CHECK_STACKPTR_OFFSET (1), *++stack_ptr = (x)) /* Pop a value, which may be multiple, off the execution stack. */ -#define POP_WITH_MULTIPLE_VALUES (*stack_ptr--) +#define POP_WITH_MULTIPLE_VALUES (CHECK_STACKPTR_OFFSET (-1), *stack_ptr--) /* Pop a value off the execution stack, treating multiple values as single. */ #define POP (IGNORE_MULTIPLE_VALUES (POP_WITH_MULTIPLE_VALUES)) -#define DISCARD_PRESERVING_MULTIPLE_VALUES(n) (stack_ptr -= (n)) +/* ..._UNSAFE() means it evaluates its argument more than once. */ +#define DISCARD_PRESERVING_MULTIPLE_VALUES_UNSAFE(n) \ + (CHECK_STACKPTR_OFFSET (-(n)), stack_ptr -= (n)) /* Discard n values from the execution stack. */ #define DISCARD(n) do { \ + int _discard_n = (n); \ if (1 != multiple_value_current_limit) \ { \ - int i, en = n; \ - for (i = 0; i < en; i++) \ + int i; \ + for (i = 0; i < _discard_n; i++) \ { \ + CHECK_STACKPTR_OFFSET (-1); \ *stack_ptr = ignore_multiple_values (*stack_ptr); \ stack_ptr--; \ } \ } \ else \ { \ - stack_ptr -= (n); \ + CHECK_STACKPTR_OFFSET (-_discard_n); \ + stack_ptr -= _discard_n; \ } \ } while (0) @@ -705,6 +703,7 @@ /* See comment before the big switch in execute_optimized_program(). */ #define GCPRO_STACK (gcpro1.nvars = stack_ptr - stack_beg) + /* The actual interpreter for byte code. This function has been seriously optimized for performance. Don't change the constructs unless you are willing to do @@ -713,18 +712,25 @@ Lisp_Object execute_optimized_program (const Opbyte *program, +#ifdef ERROR_CHECK_BYTE_CODE + Elemcount program_length, +#endif int stack_depth, Lisp_Object *constants_data) { /* This function can GC */ REGISTER const Opbyte *program_ptr = (Opbyte *) program; +#ifdef ERROR_CHECK_BYTE_CODE + const Opbyte *program_end = program_ptr + program_length; +#endif + /* See comment above explaining the `+ 1' */ Lisp_Object *stack_beg = alloca_array (Lisp_Object, stack_depth + 1); REGISTER Lisp_Object *stack_ptr = stack_beg; int speccount = specpdl_depth (); struct gcpro gcpro1; #ifdef BYTE_CODE_METER - Opcode this_opcode = 0; + Opcode this_opcode = (Opcode) 0; Opcode prev_opcode; #endif @@ -759,13 +765,22 @@ return from the interpreter do we need to finalize the struct gcpro itself, and that's done at case Breturn. */ + + /* See comment above explaining the `[1]' */ GCPRO1 (stack_ptr[1]); while (1) { REGISTER Opcode opcode = (Opcode) READ_UINT_1; +#ifdef ERROR_CHECK_BYTE_CODE + remember_operation (opcode); +#endif + GCPRO_STACK; /* Get nvars right before maybe signaling. */ + /* #### NOTE: This code should probably never get triggered, since we + now catch the problems earlier, farther down, before we ever set + a bad value for STACK_PTR. */ #ifdef ERROR_CHECK_BYTE_CODE if (stack_ptr > stack_end) stack_overflow ("byte code stack overflow", Qunbound); @@ -790,7 +805,13 @@ { /* We're not sure what these do, so better safe than sorry. */ /* GCPRO_STACK; */ - stack_ptr = execute_rare_opcode (stack_ptr, program_ptr, opcode); + stack_ptr = execute_rare_opcode (stack_ptr, +#ifdef ERROR_CHECK_BYTE_CODE + stack_beg, + stack_end, +#endif /* ERROR_CHECK_BYTE_CODE */ + program_ptr, opcode); + CHECK_STACKPTR_OFFSET (0); } break; @@ -1438,6 +1459,10 @@ Don't make this function static, since then the compiler might inline it. */ Lisp_Object * execute_rare_opcode (Lisp_Object *stack_ptr, +#ifdef ERROR_CHECK_BYTE_CODE + Lisp_Object *stack_beg, + Lisp_Object *stack_end, +#endif /* ERROR_CHECK_BYTE_CODE */ const Opbyte *UNUSED (program_ptr), Opcode opcode) { @@ -1445,7 +1470,7 @@ switch (opcode) { - + case Bsave_excursion: record_unwind_protect (save_excursion_restore, save_excursion_save ()); @@ -1714,7 +1739,7 @@ case Bmultiple_value_call: { n = XINT (POP); - DISCARD_PRESERVING_MULTIPLE_VALUES (n - 1); + DISCARD_PRESERVING_MULTIPLE_VALUES_UNSAFE (n - 1); /* Discard multiple values for the first (function) argument: */ TOP_LVALUE = TOP; TOP_LVALUE = multiple_value_call (n, TOP_ADDRESS); @@ -1723,7 +1748,7 @@ case Bmultiple_value_list_internal: { - DISCARD_PRESERVING_MULTIPLE_VALUES (3); + DISCARD_PRESERVING_MULTIPLE_VALUES_UNSAFE (3); TOP_LVALUE = multiple_value_list_internal (4, TOP_ADDRESS); break; } @@ -1741,7 +1766,7 @@ { Ascbyte msg[100]; sprintf (msg, "Unknown opcode %d", opcode); - abort_with_msg (msg); + bytecode_abort_with_message (msg); } break; } @@ -1750,7 +1775,7 @@ DOESNT_RETURN -invalid_byte_code (const CIbyte *reason, Lisp_Object frob) +invalid_byte_code (const Ascbyte *reason, Lisp_Object frob) { signal_error (Qinvalid_byte_code, reason, frob); } @@ -1866,8 +1891,8 @@ Lisp_Object constants, /* out */ Opbyte * const program, - int * const program_length, - int * const varbind_count) + Elemcount * const program_length, + Elemcount * const varbind_count) { Bytecount instructions_length = XSTRING_LENGTH (instructions); Elemcount comfy_size = (Elemcount) (2 * instructions_length); @@ -2131,8 +2156,8 @@ optimize_compiled_function (Lisp_Object compiled_function) { Lisp_Compiled_Function *f = XCOMPILED_FUNCTION (compiled_function); - int program_length; - int varbind_count; + Elemcount program_length; + Elemcount varbind_count; Opbyte *program; { @@ -2222,7 +2247,7 @@ struct gcpro gcpro1, gcpro2; GCPRO2 (obj, printcharfun); - write_c_string (printcharfun, print_readably ? "#[" : "#"); + write_ascstring (printcharfun, print_readably ? "]" : ">"); } @@ -2704,8 +2729,8 @@ (instructions, constants, stack_depth)) { /* This function can GC */ - int varbind_count; - int program_length; + Elemcount varbind_count; + Elemcount program_length; Opbyte *program; CHECK_STRING (instructions); @@ -2720,6 +2745,9 @@ &program_length, &varbind_count); SPECPDL_RESERVE (varbind_count); return execute_optimized_program (program, +#ifdef ERROR_CHECK_BYTE_CODE + program_length, +#endif XINT (stack_depth), XVECTOR_DATA (constants)); } @@ -2762,7 +2790,6 @@ vars_of_bytecode (void) { #ifdef BYTE_CODE_METER - DEFVAR_LISP ("byte-code-meter", &Vbyte_code_meter /* A vector of vectors which holds a histogram of byte code usage. \(aref (aref byte-code-meter 0) CODE) indicates how many times the byte @@ -2787,3 +2814,57 @@ } #endif /* BYTE_CODE_METER */ } + +#ifdef ERROR_CHECK_BYTE_CODE + +/* Initialize the opcodes in the table that correspond to a base opcode + plus an offset (except for Bconstant). */ + +static void +init_opcode_table_multi_op (Opcode op) +{ + const Ascbyte *basename = opcode_name_table[op]; + Ascbyte temp[300]; + int i; + + for (i = 1; i < 7; i++) + { + assert (!opcode_name_table[op + i]); + sprintf (temp, "%s+%d", basename, i); + opcode_name_table[op + i] = xstrdup (temp); + } +} + +#endif /* ERROR_CHECK_BYTE_CODE */ + +void +reinit_vars_of_bytecode (void) +{ +#ifdef ERROR_CHECK_BYTE_CODE + int i; + +#define OPCODE(sym, val) opcode_name_table[val] = xstrdup (#sym); +#include "bytecode-ops.h" + + for (i = 0; i < countof (opcode_name_table); i++) + { + int j; + Ascbyte *name = opcode_name_table[i]; + if (name) + { + Bytecount len = strlen (name); + /* Prettify the name by converting underscores to hyphens, similar + to what happens with DEFSYMBOL. */ + for (j = 0; j < len; j++) + if (name[j] == '_') + name[j] = '-'; + } + } + + init_opcode_table_multi_op (Bvarref); + init_opcode_table_multi_op (Bvarset); + init_opcode_table_multi_op (Bvarbind); + init_opcode_table_multi_op (Bcall); + init_opcode_table_multi_op (Bunbind); +#endif /* ERROR_CHECK_BYTE_CODE */ +} diff -r d2ec55325515 -r 8f0cf4fd3d2c src/bytecode.h --- a/src/bytecode.h Sat Feb 06 03:59:18 2010 -0600 +++ b/src/bytecode.h Sat Feb 06 04:01:46 2010 -0600 @@ -67,8 +67,19 @@ #define COMPILED_INTERACTIVE 5 #define COMPILED_DOMAIN 6 -/* It doesn't make sense to have this and also have load-history */ -/* #define COMPILED_FUNCTION_ANNOTATION_HACK */ +/* Someone claims: [[ It doesn't make sense to have this and also have + load-history ]] But in fact they are quite different things. Perhaps + we should turn this on only when DEBUG_XEMACS but there's no speed + harm at all, so no reason not to do it always. */ +#define COMPILED_FUNCTION_ANNOTATION_HACK + +#ifdef DEBUG_XEMACS +/* Define BYTE_CODE_METER to enable generation of a byte-op usage + histogram. This isn't defined in FSF Emacs and isn't defined in XEmacs + v19. But this is precisely the thing to turn on when DEBUG_XEMACS. It + may lead to a slight speed penalty but nothing major. */ +#define BYTE_CODE_METER +#endif struct Lisp_Compiled_Function { @@ -131,6 +142,9 @@ typedef unsigned char Opbyte; Lisp_Object execute_optimized_program (const Opbyte *program, +#ifdef ERROR_CHECK_BYTE_CODE + Elemcount program_length, +#endif int stack_depth, Lisp_Object *constants_data); diff -r d2ec55325515 -r 8f0cf4fd3d2c src/chartab.c --- a/src/chartab.c Sat Feb 06 03:59:18 2010 -0600 +++ b/src/chartab.c Sat Feb 06 04:01:46 2010 -0600 @@ -228,6 +228,7 @@ static void decode_char_table_range (Lisp_Object range, struct chartab_range *outrange) { + xzero (*outrange); if (EQ (range, Qt)) outrange->type = CHARTAB_RANGE_ALL; else if (CHAR_OR_CHAR_INTP (range)) @@ -315,7 +316,7 @@ struct gcpro gcpro1; Lisp_Object lisprange; if (!a->first) - write_c_string (a->printcharfun, " "); + write_ascstring (a->printcharfun, " "); a->first = 0; lisprange = encode_char_table_range (range); GCPRO1 (lisprange); @@ -339,7 +340,7 @@ write_fmt_string_lisp (printcharfun, "#s(char-table type %s data (", 1, char_table_type_to_symbol (ct->type)); map_char_table (obj, &range, print_table_entry, &arg); - write_c_string (printcharfun, "))"); + write_ascstring (printcharfun, "))"); /* #### need to print and read the default; but that will allow the default to be modified, which we don't (yet) support -- but FSF does */ diff -r d2ec55325515 -r 8f0cf4fd3d2c src/compiler.h --- a/src/compiler.h Sat Feb 06 03:59:18 2010 -0600 +++ b/src/compiler.h Sat Feb 06 04:01:46 2010 -0600 @@ -243,6 +243,11 @@ # else # define USED_IF_XFT(decl) UNUSED (decl) # endif +# ifdef HAVE_SCROLLBARS +# define USED_IF_SCROLLBARS(decl) decl +# else +# define USED_IF_SCROLLBARS(decl) UNUSED (decl) +# endif #endif /* UNUSED */ /* Declaration that variable or expression X is "used" to defeat diff -r d2ec55325515 -r 8f0cf4fd3d2c src/config.h.in --- a/src/config.h.in Sat Feb 06 03:59:18 2010 -0600 +++ b/src/config.h.in Sat Feb 06 04:01:46 2010 -0600 @@ -1092,7 +1092,8 @@ /* Use DECLARE_INLINE_HEADER() to declare an inline function in a header file, like this: (This avoids the need to write a prototype directly - followed by the function header itself.) + followed by the function header itself, in order to avoid a + "no prototype" warning from GCC.) DECLARE_INLINE_HEADER (int foo (int x)) { @@ -1175,9 +1176,9 @@ aren't using the C++ preprocessor when processing xemacs.def.in.in even if we're using a C++ compiler. I suspect we only need this at all GCC is being used. */ -#if defined (ERROR_CHECK_TYPES) && !defined (USE_GPLUSPLUS) +#if !defined (USE_GPLUSPLUS) /* #if !defined (INLINE_HEADERS_ARE_STATIC) */ -#define NEED_ERROR_CHECK_TYPES_INLINES +#define XEMACS_DEFS_NEEDS_INLINE_DECLS #endif #endif /* _SRC_CONFIG_H_ */ diff -r d2ec55325515 -r 8f0cf4fd3d2c src/console-gtk.c --- a/src/console-gtk.c Sat Feb 06 03:59:18 2010 -0600 +++ b/src/console-gtk.c Sat Feb 06 04:01:46 2010 -0600 @@ -60,7 +60,7 @@ return Qnil; else { - connection = build_string ("gtk"); + connection = build_ascstring ("gtk"); } return connection; } @@ -73,7 +73,7 @@ GCPRO1 (connection); - connection = build_string ("gtk"); + connection = build_ascstring ("gtk"); RETURN_UNGCPRO (connection); } @@ -87,7 +87,7 @@ GCPRO2 (connection, hostname); - connection = build_string ("gtk"); + connection = build_ascstring ("gtk"); RETURN_UNGCPRO (connection); } @@ -100,7 +100,7 @@ GCPRO1 (connection); - connection = build_string("gtk"); + connection = build_ascstring("gtk"); RETURN_UNGCPRO (connection); } @@ -112,7 +112,7 @@ struct gcpro gcpro1; GCPRO1 (connection); - connection = build_string("gtk"); + connection = build_ascstring("gtk"); RETURN_UNGCPRO (connection); } diff -r d2ec55325515 -r 8f0cf4fd3d2c src/console-impl.h --- a/src/console-impl.h Sat Feb 06 03:59:18 2010 -0600 +++ b/src/console-impl.h Sat Feb 06 04:01:46 2010 -0600 @@ -145,7 +145,7 @@ /* redisplay methods */ int (*left_margin_width_method) (struct window *); int (*right_margin_width_method) (struct window *); - int (*text_width_method) (struct frame *f, struct face_cachel *cachel, + int (*text_width_method) (struct window *w, struct face_cachel *cachel, const Ichar *str, Charcount len); void (*output_display_block_method) (struct window *, struct display_line *, int, int, int, int, int, int, int); diff -r d2ec55325515 -r 8f0cf4fd3d2c src/console-msw.c --- a/src/console-msw.c Sat Feb 06 03:59:18 2010 -0600 +++ b/src/console-msw.c Sat Feb 06 04:01:46 2010 -0600 @@ -347,8 +347,7 @@ if (initialized && !inhibit_non_essential_conversion_operations) { TO_EXTERNAL_FORMAT (DATA, (str, len), - C_STRING_ALLOCA, extptr, - Qmswindows_tstr); + C_STRING_ALLOCA, extptr, Qmswindows_tstr); qxeOutputDebugString (extptr); } else @@ -578,12 +577,12 @@ } CHECK_STRING (message_); - LISP_STRING_TO_TSTR (message_, msgout); + msgout = LISP_STRING_TO_TSTR (message_); if (!NILP (title)) { CHECK_STRING (title); - LISP_STRING_TO_TSTR (title, titleout); + titleout = LISP_STRING_TO_TSTR (title); } { diff -r d2ec55325515 -r 8f0cf4fd3d2c src/console-stream.c --- a/src/console-stream.c Sat Feb 06 03:59:18 2010 -0600 +++ b/src/console-stream.c Sat Feb 06 04:01:46 2010 -0600 @@ -138,7 +138,7 @@ retry_fclose (stream_con->in); #ifndef NEW_GC - xfree (stream_con, struct stream_console *); + xfree (stream_con); #endif /* not NEW_GC */ CONSOLE_STREAM_DATA (con) = NULL; } @@ -194,7 +194,7 @@ invalid_operation ("Only one frame allowed on stream devices", Qunbound); #endif if (frame_name_is_defaulted) - f->name = build_string ("stream"); + f->name = build_ascstring ("stream"); f->height = 80; f->width = 24; f->visible = 0; /* so redisplay doesn't try to do anything */ @@ -202,7 +202,7 @@ static int -stream_text_width (struct frame *UNUSED (f), +stream_text_width (struct window *UNUSED (w), struct face_cachel *UNUSED (cachel), const Ichar *UNUSED (str), Charcount len) { @@ -374,7 +374,7 @@ Vterminal_frame = Qnil; /* Moved from console-tty.c */ - Vstdio_str = build_string ("stdio"); + Vstdio_str = build_ascstring ("stdio"); staticpro (&Vstdio_str); } diff -r d2ec55325515 -r 8f0cf4fd3d2c src/console-tty.c --- a/src/console-tty.c Sat Feb 06 03:59:18 2010 -0600 +++ b/src/console-tty.c Sat Feb 06 04:01:46 2010 -0600 @@ -114,7 +114,7 @@ invalid_state ("Cannot determine terminal type", Qunbound); } else - terminal_type = build_intstring (temp_type); + terminal_type = build_istring (temp_type); } /* Determine the controlling process */ @@ -216,11 +216,11 @@ { if (tty_con->term_entry_buffer) /* allocated in term_init () */ { - xfree (tty_con->term_entry_buffer, char *); + xfree (tty_con->term_entry_buffer); tty_con->term_entry_buffer = NULL; } #ifndef NEW_GC - xfree (tty_con, struct tty_console *); + xfree (tty_con); #endif /* not NEW_GC */ CONSOLE_TTY_DATA (con) = NULL; } diff -r d2ec55325515 -r 8f0cf4fd3d2c src/console-x.c --- a/src/console-x.c Sat Feb 06 03:59:18 2010 -0600 +++ b/src/console-x.c Sat Feb 06 04:01:46 2010 -0600 @@ -162,12 +162,12 @@ /* assert: display_arg is only set if we found the display arg earlier so we can't fail to find it now. */ assert (disp_name != NULL); - conn = build_ext_string (disp_name, Qcommand_argument_encoding); + conn = build_extstring (disp_name, Qcommand_argument_encoding); free_argc_argv (argv); return conn; } else - return build_ext_string (XDisplayName (0), Qx_display_name_encoding); + return build_extstring (XDisplayName (0), Qx_display_name_encoding); } /* "semi-canonicalize" means convert to a nicer form for printing, but @@ -202,7 +202,7 @@ /* Check for a couple of standard special cases */ if (string_ichar (connection, 0) == ':') - connection = concat2 (build_string ("localhost"), connection); + connection = concat2 (build_ascstring ("localhost"), connection); else { /* connection =~ s/^unix:/localhost:/; */ @@ -217,7 +217,7 @@ INC_IBYTEPTR (p); } - connection = concat2 (build_string ("localhost:"), + connection = concat2 (build_ascstring ("localhost:"), make_string (p, end - p)); } ok: @@ -277,7 +277,7 @@ &screen_length); if (!screen_length) - connection = concat2 (connection, build_string (".0")); + connection = concat2 (connection, build_ascstring (".0")); RETURN_UNGCPRO (connection); } @@ -335,7 +335,7 @@ CHECK_CHAR(key); buf[set_itext_ichar(buf, XCHAR(key))] = '\0'; - key_name = build_intstring (buf); + key_name = build_istring (buf); /* We need to do the lookup and compare later, because we can't check the Qcharacter_of_keysym property belonging to an actual character. */ @@ -347,7 +347,7 @@ return Qnil; } - LISP_STRING_TO_EXTERNAL (key_name, keysym_ext, Qctext); + keysym_ext = LISP_STRING_TO_EXTERNAL (key_name, Qctext); xkeysym = XStringToKeysym(keysym_ext); if (NoSymbol == xkeysym) { diff -r d2ec55325515 -r 8f0cf4fd3d2c src/console-x.h --- a/src/console-x.h Sat Feb 06 03:59:18 2010 -0600 +++ b/src/console-x.h Sat Feb 06 04:01:46 2010 -0600 @@ -104,7 +104,7 @@ void x_wm_set_cell_size (Widget wmshell, int cw, int ch); void x_wm_set_variable_size (Widget wmshell, int width, int height); -const char *x_event_name (int event_type); +const Ascbyte *x_event_name (int event_type); int check_if_pending_expose_event (struct device *d); int x_error_handler (Display *disp, XErrorEvent *event); void expect_x_error (Display *dpy); diff -r d2ec55325515 -r 8f0cf4fd3d2c src/console.c --- a/src/console.c Sat Feb 06 03:59:18 2010 -0600 +++ b/src/console.c Sat Feb 06 04:01:46 2010 -0600 @@ -1007,9 +1007,7 @@ Bytecount count; Extbyte *p; - TO_EXTERNAL_FORMAT (LISP_STRING, stuffstring, - ALLOCA, (p, count), - Qkeyboard); + LISP_STRING_TO_SIZED_EXTERNAL (stuffstring, p, count, Qkeyboard); while (count-- > 0) stuff_char (XCONSOLE (Vcontrolling_terminal), *p++); stuff_char (XCONSOLE (Vcontrolling_terminal), '\n'); diff -r d2ec55325515 -r 8f0cf4fd3d2c src/data.c --- a/src/data.c Sat Feb 06 03:59:18 2010 -0600 +++ b/src/data.c Sat Feb 06 04:01:46 2010 -0600 @@ -81,13 +81,13 @@ { /* #### It would be really nice if this were a proper warning instead of brain-dead print to Qexternal_debugging_output. */ - write_c_string + write_msg_string (Qexternal_debugging_output, "Comparison between integer and character is constant nil ("); Fprinc (obj1, Qexternal_debugging_output); - write_c_string (Qexternal_debugging_output, " and "); + write_msg_string (Qexternal_debugging_output, " and "); Fprinc (obj2, Qexternal_debugging_output); - write_c_string (Qexternal_debugging_output, ")\n"); + write_msg_string (Qexternal_debugging_output, ")\n"); debug_short_backtrace (debug_ebola_backtrace_length); } return EQ (obj1, obj2); @@ -365,7 +365,7 @@ const CIbyte *prompt; CHECK_SUBR (subr); prompt = XSUBR (subr)->prompt; - return prompt ? list2 (Qinteractive, build_msg_string (prompt)) : Qnil; + return prompt ? list2 (Qinteractive, build_msg_cistring (prompt)) : Qnil; } @@ -1224,44 +1224,44 @@ if (FLOATP (number)) { - char pigbuf[350]; /* see comments in float_to_string */ + Ascbyte pigbuf[350]; /* see comments in float_to_string */ float_to_string (pigbuf, XFLOAT_DATA (number)); - return build_string (pigbuf); + return build_ascstring (pigbuf); } #ifdef HAVE_BIGNUM if (BIGNUMP (number)) { - char *str = bignum_to_string (XBIGNUM_DATA (number), 10); - Lisp_Object retval = build_string (str); - xfree (str, char *); + Ascbyte *str = bignum_to_string (XBIGNUM_DATA (number), 10); + Lisp_Object retval = build_ascstring (str); + xfree (str); return retval; } #endif #ifdef HAVE_RATIO if (RATIOP (number)) { - char *str = ratio_to_string (XRATIO_DATA (number), 10); - Lisp_Object retval = build_string (str); - xfree (str, char *); + Ascbyte *str = ratio_to_string (XRATIO_DATA (number), 10); + Lisp_Object retval = build_ascstring (str); + xfree (str); return retval; } #endif #ifdef HAVE_BIGFLOAT if (BIGFLOATP (number)) { - char *str = bigfloat_to_string (XBIGFLOAT_DATA (number), 10); - Lisp_Object retval = build_string (str); - xfree (str, char *); + Ascbyte *str = bigfloat_to_string (XBIGFLOAT_DATA (number), 10); + Lisp_Object retval = build_ascstring (str); + xfree (str); return retval; } #endif { - char buffer[DECIMAL_PRINT_SIZE (long)]; + Ascbyte buffer[DECIMAL_PRINT_SIZE (long)]; long_to_string (buffer, XINT (number)); - return build_string (buffer); + return build_ascstring (buffer); } } diff -r d2ec55325515 -r 8f0cf4fd3d2c src/database.c --- a/src/database.c Sat Feb 06 03:59:18 2010 -0600 +++ b/src/database.c Sat Feb 06 04:01:46 2010 -0600 @@ -327,9 +327,9 @@ keydatum = dbm_nextkey (db->dbm_handle)) { valdatum = dbm_fetch (db->dbm_handle, keydatum); - key = make_ext_string ((Extbyte *) keydatum.dptr, keydatum.dsize, + key = make_extstring ((Extbyte *) keydatum.dptr, keydatum.dsize, db->coding_system); - val = make_ext_string ((Extbyte *) valdatum.dptr, valdatum.dsize, + val = make_extstring ((Extbyte *) valdatum.dptr, valdatum.dsize, db->coding_system); call2 (func, key, val); } @@ -340,13 +340,12 @@ { datum keydatum, valdatum; - TO_EXTERNAL_FORMAT (LISP_STRING, key, - ALLOCA, (keydatum.dptr, keydatum.dsize), - db->coding_system); + LISP_STRING_TO_SIZED_EXTERNAL (key, keydatum.dptr, keydatum.dsize, + db->coding_system); valdatum = dbm_fetch (db->dbm_handle, keydatum); return (valdatum.dptr - ? make_ext_string ((Extbyte *) valdatum.dptr, valdatum.dsize, + ? make_extstring ((Extbyte *) valdatum.dptr, valdatum.dsize, db->coding_system) : Qnil); } @@ -357,12 +356,10 @@ { datum keydatum, valdatum; - TO_EXTERNAL_FORMAT (LISP_STRING, val, - ALLOCA, (valdatum.dptr, valdatum.dsize), - db->coding_system); - TO_EXTERNAL_FORMAT (LISP_STRING, key, - ALLOCA, (keydatum.dptr, keydatum.dsize), - db->coding_system); + LISP_STRING_TO_SIZED_EXTERNAL (val, valdatum.dptr, valdatum.dsize, + db->coding_system); + LISP_STRING_TO_SIZED_EXTERNAL (key, keydatum.dptr, keydatum.dsize, + db->coding_system); return !dbm_store (db->dbm_handle, keydatum, valdatum, NILP (replace) ? DBM_INSERT : DBM_REPLACE); @@ -373,9 +370,8 @@ { datum keydatum; - TO_EXTERNAL_FORMAT (LISP_STRING, key, - ALLOCA, (keydatum.dptr, keydatum.dsize), - db->coding_system); + LISP_STRING_TO_SIZED_EXTERNAL (key, keydatum.dptr, keydatum.dsize, + db->coding_system); return dbm_delete (db->dbm_handle, keydatum); } @@ -462,9 +458,8 @@ xzero (keydatum); xzero (valdatum); - TO_EXTERNAL_FORMAT (LISP_STRING, key, - ALLOCA, (keydatum.data, keydatum.size), - db->coding_system); + LISP_STRING_TO_SIZED_EXTERNAL (key, keydatum.data, keydatum.size, + db->coding_system); #if DB_VERSION_MAJOR == 1 status = db->db_handle->get (db->db_handle, &keydatum, &valdatum, 0); @@ -473,7 +468,7 @@ #endif /* DB_VERSION_MAJOR */ if (!status) - return make_ext_string ((const Extbyte *) valdatum.data, valdatum.size, + return make_extstring ((const Extbyte *) valdatum.data, valdatum.size, db->coding_system); #if DB_VERSION_MAJOR == 1 @@ -498,12 +493,10 @@ xzero (keydatum); xzero (valdatum); - TO_EXTERNAL_FORMAT (LISP_STRING, key, - ALLOCA, (keydatum.data, keydatum.size), - db->coding_system); - TO_EXTERNAL_FORMAT (LISP_STRING, val, - ALLOCA, (valdatum.data, valdatum.size), - db->coding_system); + LISP_STRING_TO_SIZED_EXTERNAL (key, keydatum.data, keydatum.size, + db->coding_system); + LISP_STRING_TO_SIZED_EXTERNAL (val, valdatum.data, valdatum.size, + db->coding_system); #if DB_VERSION_MAJOR == 1 status = db->db_handle->put (db->db_handle, &keydatum, &valdatum, NILP (replace) ? R_NOOVERWRITE : 0); @@ -526,9 +519,8 @@ /* DB Version 2 requires DBT's to be zeroed before use. */ xzero (keydatum); - TO_EXTERNAL_FORMAT (LISP_STRING, key, - ALLOCA, (keydatum.data, keydatum.size), - db->coding_system); + LISP_STRING_TO_SIZED_EXTERNAL (key, keydatum.data, keydatum.size, + db->coding_system); #if DB_VERSION_MAJOR == 1 status = db->db_handle->del (db->db_handle, &keydatum, 0); @@ -564,9 +556,9 @@ status == 0; status = dbp->seq (dbp, &keydatum, &valdatum, R_NEXT)) { - key = make_ext_string ((const Extbyte *) keydatum.data, keydatum.size, + key = make_extstring ((const Extbyte *) keydatum.data, keydatum.size, db->coding_system); - val = make_ext_string ((const Extbyte *) valdatum.data, valdatum.size, + val = make_extstring ((const Extbyte *) valdatum.data, valdatum.size, db->coding_system); call2 (func, key, val); } @@ -583,9 +575,9 @@ status == 0; status = dbcp->c_get (dbcp, &keydatum, &valdatum, DB_NEXT)) { - key = make_ext_string ((const Extbyte *) keydatum.data, keydatum.size, + key = make_extstring ((const Extbyte *) keydatum.data, keydatum.size, db->coding_system); - val = make_ext_string ((const Extbyte *) valdatum.data, valdatum.size, + val = make_extstring ((const Extbyte *) valdatum.data, valdatum.size, db->coding_system); call2 (func, key, val); } @@ -653,7 +645,7 @@ int modemask; int accessmask = 0; Lisp_Database *db = NULL; - char *filename; + Extbyte *filename; struct gcpro gcpro1, gcpro2; CHECK_STRING (file); @@ -661,9 +653,7 @@ file = Fexpand_file_name (file, Qnil); UNGCPRO; - TO_EXTERNAL_FORMAT (LISP_STRING, file, - C_STRING_ALLOCA, filename, - Qfile_name); + LISP_PATHNAME_CONVERT_OUT (file, filename); if (NILP (access_)) { @@ -671,16 +661,16 @@ } else { - char *acc; + Ibyte *acc; CHECK_STRING (access_); - acc = (char *) XSTRING_DATA (access_); + acc = XSTRING_DATA (access_); - if (strchr (acc, '+')) + if (qxestrchr (acc, '+')) accessmask |= O_CREAT; { - char *rp = strchr (acc, 'r'); - char *wp = strchr (acc, 'w'); + int rp = !!qxestrchr (acc, 'r'); + int wp = !!qxestrchr (acc, 'w'); if (rp && wp) accessmask |= O_RDWR; else if (wp) accessmask |= O_WRONLY; else accessmask |= O_RDONLY; diff -r d2ec55325515 -r 8f0cf4fd3d2c src/depend --- a/src/depend Sat Feb 06 03:59:18 2010 -0600 +++ b/src/depend Sat Feb 06 04:01:46 2010 -0600 @@ -34,6 +34,7 @@ event-xlike-inc.o: objects-xlike-inc.o: $(LWLIB_SRCDIR)/lwlib.h conslots.h console-gtk-impl.h console-gtk.h console-impl.h console-x-impl.h console-x.h console-xlike-inc.h console.h gccache-gtk.h gccache-x.h glyphs-gtk.h glyphs-x.h glyphs.h objects-gtk-impl.h objects-gtk.h objects-impl.h objects-x-impl.h objects-x.h objects.h redisplay.h scrollbar.h specifier.h sysgtk.h window-impl.h window.h winslots.h xintrinsic.h redisplay-xlike-inc.o: $(CONFIG_H) $(LISP_H) $(LWLIB_SRCDIR)/lwlib.h EmacsFrame.h EmacsFrameP.h buffer.h bufslots.h casetab.h charset.h chartab.h coding-system-slots.h compiler.h conslots.h console-gtk-impl.h console-gtk.h console-impl.h console-x-impl.h console-x.h console-xlike-inc.h console.h debug.h device-impl.h device.h devslots.h dumper.h faces.h file-coding.h frame-impl.h frame.h frameslots.h gc.h gccache-gtk.h gccache-x.h general-slots.h glyphs-gtk.h glyphs-x.h glyphs.h gutter.h lisp-disunion.h lisp-union.h lisp.h lrecord.h mc-alloc.h mule-ccl.h number-gmp.h number-mp.h number.h objects-gtk-impl.h objects-gtk.h objects-impl.h objects-x-impl.h objects-x.h objects.h redisplay.h scrollbar.h specifier.h symeval.h symsinit.h sysdep.h sysgtk.h sysproc.h syssignal.h systime.h text.h vdb.h window-impl.h window.h winslots.h xintrinsic.h xintrinsicp.h xmotif.h xmprimitivep.h +select-xlike-inc.o: toolbar-xlike.o: $(CONFIG_H) $(LISP_H) $(LWLIB_SRCDIR)/lwlib.h charset.h compiler.h conslots.h console-gtk-impl.h console-gtk.h console-impl.h console-x-impl.h console-x.h console.h device-impl.h device.h devslots.h dumper.h faces.h frame-impl.h frame.h frameslots.h gc.h general-slots.h glyphs.h lisp-disunion.h lisp-union.h lisp.h lrecord.h mc-alloc.h number-gmp.h number-mp.h number.h redisplay.h scrollbar.h specifier.h symeval.h symsinit.h sysgtk.h text.h toolbar-xlike.h toolbar.h vdb.h window-impl.h window.h winslots.h xintrinsic.h #endif #if defined(HAVE_X_WINDOWS) @@ -55,7 +56,7 @@ objects-x.o: $(CONFIG_H) $(LISP_H) $(LWLIB_SRCDIR)/lwlib.h charset.h compiler.h conslots.h console-gtk-impl.h console-gtk.h console-impl.h console-x-impl.h console-x.h console-xlike-inc.h console.h device-impl.h device.h devslots.h dumper.h elhash.h font-mgr.h gc.h gccache-gtk.h gccache-x.h general-slots.h glyphs-gtk.h glyphs-x.h glyphs.h insdel.h lisp-disunion.h lisp-union.h lisp.h lrecord.h mc-alloc.h number-gmp.h number-mp.h number.h objects-gtk-impl.h objects-gtk.h objects-impl.h objects-x-impl.h objects-x.h objects-xlike-inc.c objects.h redisplay.h scrollbar.h specifier.h symeval.h symsinit.h sysgtk.h text.h vdb.h window-impl.h window.h winslots.h xintrinsic.h redisplay-x.o: $(CONFIG_H) $(LISP_H) $(LWLIB_SRCDIR)/lwlib.h EmacsFrame.h EmacsFrameP.h buffer.h bufslots.h casetab.h charset.h chartab.h coding-system-slots.h compiler.h conslots.h console-gtk-impl.h console-gtk.h console-impl.h console-x-impl.h console-x.h console-xlike-inc.h console.h debug.h device-impl.h device.h devslots.h dumper.h faces.h file-coding.h frame-impl.h frame.h frameslots.h gc.h gccache-gtk.h gccache-x.h general-slots.h glyphs-gtk.h glyphs-x.h glyphs.h gutter.h lisp-disunion.h lisp-union.h lisp.h lrecord.h mc-alloc.h mule-ccl.h number-gmp.h number-mp.h number.h objects-gtk-impl.h objects-gtk.h objects-impl.h objects-x-impl.h objects-x.h objects.h redisplay-xlike-inc.c redisplay.h scrollbar.h specifier.h symeval.h symsinit.h sysdep.h sysgtk.h sysproc.h syssignal.h systime.h text.h vdb.h window-impl.h window.h winslots.h xintrinsic.h xintrinsicp.h xmotif.h xmprimitivep.h scrollbar-x.o: $(CONFIG_H) $(LISP_H) $(LWLIB_SRCDIR)/lwlib.h EmacsFrame.h compiler.h conslots.h console-impl.h console-x-impl.h console-x.h console.h device-impl.h device.h devslots.h dumper.h frame-impl.h frame.h frameslots.h gc.h general-slots.h glyphs-x.h glyphs.h lisp-disunion.h lisp-union.h lisp.h lrecord.h mc-alloc.h number-gmp.h number-mp.h number.h redisplay.h scrollbar-x.h scrollbar.h specifier.h symeval.h symsinit.h text.h vdb.h window-impl.h window.h winslots.h xintrinsic.h -select-x.o: $(CONFIG_H) $(LISP_H) $(LWLIB_SRCDIR)/lwlib.h charset.h compiler.h conslots.h console-impl.h console-x-impl.h console-x.h console.h device-impl.h device.h devslots.h dumper.h frame-impl.h frame.h frameslots.h gc.h general-slots.h lisp-disunion.h lisp-union.h lisp.h lrecord.h mc-alloc.h number-gmp.h number-mp.h number.h objects-x.h objects.h opaque.h redisplay.h select-common.h select.h specifier.h symeval.h symsinit.h systime.h text.h vdb.h xintrinsic.h xmotif.h +select-x.o: $(CONFIG_H) $(LISP_H) $(LWLIB_SRCDIR)/lwlib.h charset.h compiler.h conslots.h console-impl.h console-x-impl.h console-x.h console.h device-impl.h device.h devslots.h dumper.h frame-impl.h frame.h frameslots.h gc.h general-slots.h lisp-disunion.h lisp-union.h lisp.h lrecord.h mc-alloc.h number-gmp.h number-mp.h number.h objects-x.h objects.h opaque.h redisplay.h select-xlike-inc.c select.h specifier.h symeval.h symsinit.h systime.h text.h vdb.h xintrinsic.h xmotif.h toolbar-x.o: $(CONFIG_H) $(LISP_H) $(LWLIB_SRCDIR)/lwlib.h EmacsFrame.h EmacsFrameP.h charset.h compiler.h conslots.h console-impl.h console-x-impl.h console-x.h console.h dumper.h faces.h frame-impl.h frame.h frameslots.h gc.h general-slots.h glyphs-x.h glyphs.h lisp-disunion.h lisp-union.h lisp.h lrecord.h mc-alloc.h number-gmp.h number-mp.h number.h objects-x.h objects.h redisplay.h scrollbar.h specifier.h symeval.h symsinit.h text.h toolbar-xlike.h toolbar.h vdb.h window-impl.h window.h winslots.h xintrinsic.h xintrinsicp.h xmotif.h xmprimitivep.h #endif #if defined(HAVE_TTY) @@ -85,7 +86,7 @@ objects-gtk.o: $(CONFIG_H) $(LISP_H) $(LWLIB_SRCDIR)/lwlib.h buffer.h bufslots.h casetab.h charset.h chartab.h compiler.h conslots.h console-gtk-impl.h console-gtk.h console-impl.h console-x-impl.h console-x.h console-xlike-inc.h console.h device-impl.h device.h devslots.h dumper.h gc.h gccache-gtk.h gccache-x.h general-slots.h glyphs-gtk.h glyphs-x.h glyphs.h insdel.h lisp-disunion.h lisp-union.h lisp.h lrecord.h mc-alloc.h number-gmp.h number-mp.h number.h objects-gtk-impl.h objects-gtk.h objects-impl.h objects-x-impl.h objects-x.h objects-xlike-inc.c objects.h redisplay.h scrollbar.h specifier.h symeval.h symsinit.h sysgdkx.h sysgtk.h text.h vdb.h window-impl.h window.h winslots.h xintrinsic.h redisplay-gtk.o: $(CONFIG_H) $(LISP_H) $(LWLIB_SRCDIR)/lwlib.h EmacsFrame.h EmacsFrameP.h buffer.h bufslots.h casetab.h charset.h chartab.h coding-system-slots.h compiler.h conslots.h console-gtk-impl.h console-gtk.h console-impl.h console-x-impl.h console-x.h console-xlike-inc.h console.h debug.h device-impl.h device.h devslots.h dumper.h faces.h file-coding.h frame-impl.h frame.h frameslots.h gc.h gccache-gtk.h gccache-x.h general-slots.h glyphs-gtk.h glyphs-x.h glyphs.h gutter.h lisp-disunion.h lisp-union.h lisp.h lrecord.h mc-alloc.h mule-ccl.h number-gmp.h number-mp.h number.h objects-gtk-impl.h objects-gtk.h objects-impl.h objects-x-impl.h objects-x.h objects.h redisplay-xlike-inc.c redisplay.h scrollbar.h specifier.h symeval.h symsinit.h sysdep.h sysgdkx.h sysgtk.h sysproc.h syssignal.h systime.h text.h vdb.h window-impl.h window.h winslots.h xintrinsic.h xintrinsicp.h xmotif.h xmprimitivep.h scrollbar-gtk.o: $(CONFIG_H) $(LISP_H) compiler.h conslots.h console-gtk-impl.h console-gtk.h console-impl.h console.h dumper.h frame-impl.h frame.h frameslots.h gc.h general-slots.h glyphs-gtk.h glyphs.h lisp-disunion.h lisp-union.h lisp.h lrecord.h mc-alloc.h number-gmp.h number-mp.h number.h redisplay.h scrollbar-gtk.h scrollbar.h specifier.h symeval.h symsinit.h sysgtk.h text.h vdb.h window-impl.h window.h winslots.h -select-gtk.o: $(CONFIG_H) $(LISP_H) buffer.h bufslots.h casetab.h charset.h chartab.h compiler.h conslots.h console-gtk-impl.h console-gtk.h console-impl.h console.h device-impl.h device.h devslots.h dumper.h events.h frame.h gc.h general-slots.h keymap-buttons.h lisp-disunion.h lisp-union.h lisp.h lrecord.h mc-alloc.h number-gmp.h number-mp.h number.h opaque.h redisplay.h select-common.h select.h specifier.h symeval.h symsinit.h sysgtk.h systime.h text.h vdb.h +select-gtk.o: $(CONFIG_H) $(LISP_H) buffer.h bufslots.h casetab.h charset.h chartab.h compiler.h conslots.h console-gtk-impl.h console-gtk.h console-impl.h console.h device-impl.h device.h devslots.h dumper.h events.h frame.h gc.h general-slots.h keymap-buttons.h lisp-disunion.h lisp-union.h lisp.h lrecord.h mc-alloc.h number-gmp.h number-mp.h number.h opaque.h redisplay.h select-xlike-inc.c select.h specifier.h symeval.h symsinit.h sysgtk.h systime.h text.h vdb.h toolbar-gtk.o: $(CONFIG_H) $(LISP_H) compiler.h conslots.h console-gtk-impl.h console-gtk.h console-impl.h console.h dumper.h frame.h gc.h general-slots.h lisp-disunion.h lisp-union.h lisp.h lrecord.h mc-alloc.h number-gmp.h number-mp.h number.h redisplay.h specifier.h symeval.h symsinit.h sysgtk.h text.h toolbar-xlike.h vdb.h ui-byhand.o: gui.h ui-gtk.o: $(CONFIG_H) $(LISP_H) buffer.h bufslots.h bytecode.h casetab.h charset.h chartab.h compiler.h conslots.h console-gtk-impl.h console-gtk.h console-impl.h console.h device.h dumper.h elhash.h emacs-marshals.c emacs-widget-accessors.c events.h faces.h gc.h general-slots.h glade.c glyphs-gtk.h glyphs.h gtk-glue.c gui.h hash.h keymap-buttons.h lisp-disunion.h lisp-union.h lisp.h lrecord.h mc-alloc.h number-gmp.h number-mp.h number.h objects-gtk-impl.h objects-gtk.h objects-impl.h objects.h redisplay.h scrollbar.h specifier.h symeval.h symsinit.h sysdll.h sysgtk.h systime.h text.h ui-byhand.c ui-gtk.h vdb.h window-impl.h window.h winslots.h @@ -112,7 +113,7 @@ alsaplay.o: $(CONFIG_H) $(LISP_H) buffer.h bufslots.h casetab.h charset.h chartab.h compiler.h dumper.h gc.h general-slots.h intl-auto-encap-win32.h lisp-disunion.h lisp-union.h lisp.h lrecord.h mc-alloc.h number-gmp.h number-mp.h number.h sound.h symeval.h symsinit.h sysfile.h syswindows.h text.h vdb.h blocktype.o: $(CONFIG_H) $(LISP_H) blocktype.h compiler.h dumper.h gc.h general-slots.h lisp-disunion.h lisp-union.h lisp.h lrecord.h mc-alloc.h number-gmp.h number-mp.h number.h symeval.h symsinit.h text.h vdb.h buffer.o: $(CONFIG_H) $(LISP_H) buffer.h bufslots.h casetab.h charset.h chartab.h coding-system-slots.h commands.h compiler.h conslots.h console-impl.h console.h device-impl.h device.h devslots.h dumper.h elhash.h extents.h faces.h file-coding.h frame-impl.h frame.h frameslots.h gc.h general-slots.h insdel.h intl-auto-encap-win32.h lisp-disunion.h lisp-union.h lisp.h lrecord.h lstream.h mc-alloc.h ndir.h number-gmp.h number-mp.h number.h process.h redisplay.h scrollbar.h select.h specifier.h symeval.h symsinit.h syntax.h sysdir.h sysfile.h syswindows.h text.h vdb.h window.h -bytecode.o: $(CONFIG_H) $(LISP_H) backtrace.h buffer.h bufslots.h bytecode.h casetab.h charset.h chartab.h compiler.h dumper.h gc.h general-slots.h lisp-disunion.h lisp-union.h lisp.h lrecord.h mc-alloc.h number-gmp.h number-mp.h number.h opaque.h redisplay.h scrollbar.h symeval.h symsinit.h syntax.h text.h vdb.h window.h +bytecode.o: $(CONFIG_H) $(LISP_H) backtrace.h buffer.h bufslots.h bytecode-ops.h bytecode.h casetab.h charset.h chartab.h compiler.h dumper.h gc.h general-slots.h lisp-disunion.h lisp-union.h lisp.h lrecord.h mc-alloc.h number-gmp.h number-mp.h number.h opaque.h redisplay.h scrollbar.h symeval.h symsinit.h syntax.h text.h vdb.h window.h callint.o: $(CONFIG_H) $(LISP_H) buffer.h bufslots.h bytecode.h casetab.h charset.h chartab.h commands.h compiler.h dumper.h events.h gc.h general-slots.h insdel.h keymap-buttons.h lisp-disunion.h lisp-union.h lisp.h lrecord.h mc-alloc.h number-gmp.h number-mp.h number.h redisplay.h scrollbar.h symeval.h symsinit.h systime.h text.h vdb.h window-impl.h window.h winslots.h casefiddle.o: $(CONFIG_H) $(LISP_H) buffer.h bufslots.h casetab.h charset.h chartab.h compiler.h dumper.h gc.h general-slots.h insdel.h lisp-disunion.h lisp-union.h lisp.h lrecord.h mc-alloc.h number-gmp.h number-mp.h number.h symeval.h symsinit.h syntax.h text.h vdb.h casetab.o: $(CONFIG_H) $(LISP_H) buffer.h bufslots.h casetab.h charset.h chartab.h compiler.h dumper.h gc.h general-slots.h lisp-disunion.h lisp-union.h lisp.h lrecord.h mc-alloc.h number-gmp.h number-mp.h number.h opaque.h symeval.h symsinit.h text.h vdb.h @@ -226,7 +227,7 @@ strftime.o: $(CONFIG_H) $(LISP_H) compiler.h dumper.h gc.h general-slots.h lisp-disunion.h lisp-union.h lisp.h lrecord.h mc-alloc.h number-gmp.h number-mp.h number.h symeval.h symsinit.h text.h vdb.h sunplay.o: $(CONFIG_H) $(LISP_H) buffer.h bufslots.h casetab.h charset.h chartab.h compiler.h dumper.h gc.h general-slots.h intl-auto-encap-win32.h lisp-disunion.h lisp-union.h lisp.h lrecord.h mc-alloc.h number-gmp.h number-mp.h number.h sound.h symeval.h symsinit.h sysdep.h sysfile.h syssignal.h syswindows.h text.h vdb.h sunpro.o: $(CONFIG_H) $(LISP_H) compiler.h dumper.h gc.h general-slots.h lisp-disunion.h lisp-union.h lisp.h lrecord.h mc-alloc.h number-gmp.h number-mp.h number.h symeval.h symsinit.h text.h vdb.h -symbols.o: $(CONFIG_H) $(LISP_H) buffer.h bufslots.h casetab.h charset.h chartab.h compiler.h conslots.h console-impl.h console.h dumper.h elhash.h gc.h general-slots.h lisp-disunion.h lisp-union.h lisp.h lrecord.h mc-alloc.h number-gmp.h number-mp.h number.h specifier.h symeval.h symsinit.h text.h vdb.h +symbols.o: $(CONFIG_H) $(LISP_H) buffer.h bufslots.h bytecode.h casetab.h charset.h chartab.h compiler.h conslots.h console-impl.h console.h dumper.h elhash.h gc.h general-slots.h lisp-disunion.h lisp-union.h lisp.h lrecord.h mc-alloc.h number-gmp.h number-mp.h number.h specifier.h symeval.h symsinit.h text.h vdb.h syntax.o: $(CONFIG_H) $(LISP_H) buffer.h bufslots.h casetab.h charset.h chartab.h compiler.h dumper.h extents.h gc.h general-slots.h lisp-disunion.h lisp-union.h lisp.h lrecord.h mc-alloc.h number-gmp.h number-mp.h number.h symeval.h symsinit.h syntax.h text.h vdb.h sysdep.o: $(CONFIG_H) $(LISP_H) buffer.h bufslots.h casetab.h charset.h chartab.h compiler.h conslots.h console-impl.h console-stream-impl.h console-stream.h console-tty-impl.h console-tty.h console.h device-impl.h device.h devslots.h dumper.h events.h frame.h gc.h general-slots.h intl-auto-encap-win32.h keymap-buttons.h lisp-disunion.h lisp-union.h lisp.h lrecord.h mc-alloc.h ndir.h number-gmp.h number-mp.h number.h process.h redisplay.h scrollbar.h specifier.h symeval.h symsinit.h sysdep.h sysdir.h sysfile.h sysproc.h syspwd.h syssignal.h systime.h systty.h syswait.h syswindows.h text.h vdb.h window.h sysdll.o: $(CONFIG_H) $(LISP_H) compiler.h dumper.h gc.h general-slots.h intl-auto-encap-win32.h lisp-disunion.h lisp-union.h lisp.h lrecord.h mc-alloc.h number-gmp.h number-mp.h number.h symeval.h symsinit.h sysdll.h sysfile.h syswindows.h text.h vdb.h diff -r d2ec55325515 -r 8f0cf4fd3d2c src/device-gtk.c --- a/src/device-gtk.c Sat Feb 06 03:59:18 2010 -0600 +++ b/src/device-gtk.c Sat Feb 06 04:01:46 2010 -0600 @@ -236,7 +236,7 @@ /* Attempt to load a site-specific gtkrc */ { - Lisp_Object gtkrc = Fexpand_file_name (build_string ("gtkrc"), Vdata_directory); + Lisp_Object gtkrc = Fexpand_file_name (build_ascstring ("gtkrc"), Vdata_directory); gchar **default_files = gtk_rc_get_default_files (); gint num_files; @@ -250,7 +250,7 @@ new_rc_files = xnew_array_and_zero (gchar *, num_files + 3); - LISP_STRING_TO_EXTERNAL (gtkrc, new_rc_files[0], Qfile_name); + LISP_PATHNAME_CONVERT_OUT (gtkrc, new_rc_files[0]); for (ctr = 1; default_files[ctr-1]; ctr++) new_rc_files[ctr] = g_strdup (default_files[ctr-1]); @@ -260,7 +260,7 @@ for (ctr = 1; new_rc_files[ctr]; ctr++) free(new_rc_files[ctr]); - xfree (new_rc_files, gchar **); + xfree (new_rc_files); } } @@ -356,7 +356,7 @@ static void free_gtk_device_struct (struct device *d) { - xfree (d->device_data, void *); + xfree (d->device_data); } #endif /* not NEW_GC */ @@ -666,7 +666,7 @@ result = nconc2 (result, list2 (Qfont, convert_font (style->font))); -#define FROB_PIXMAP(state) (style->rc_style->bg_pixmap_name[state] ? build_string (style->rc_style->bg_pixmap_name[state]) : Qnil) +#define FROB_PIXMAP(state) (style->rc_style->bg_pixmap_name[state] ? build_cistring (style->rc_style->bg_pixmap_name[state]) : Qnil) if (style->rc_style) result = nconc2 (result, list2 (Qbackground, diff -r d2ec55325515 -r 8f0cf4fd3d2c src/device-msw.c --- a/src/device-msw.c Sat Feb 06 03:59:18 2010 -0600 +++ b/src/device-msw.c Sat Feb 06 04:01:46 2010 -0600 @@ -305,7 +305,7 @@ DeleteDC (DEVICE_MSWINDOWS_HCDC (d)); #ifndef NEW_GC - xfree (d->device_data, void *); + xfree (d->device_data); #endif /* not NEW_GC */ } @@ -446,7 +446,7 @@ DEVICE_MSPRINTER_NAME (d) = printer_name; - LISP_STRING_TO_TSTR (printer_name, printer_ext); + printer_ext = LISP_STRING_TO_TSTR (printer_name); if (!qxeOpenPrinter (printer_ext, &DEVICE_MSPRINTER_HPRINTER (d), NULL)) { @@ -498,7 +498,7 @@ if (qxeGetProfileString (XETEXT ("windows"), XETEXT ("device"), NULL, name, sizeof (name) / XETCHAR_SIZE) <= 0) return Qnil; - TSTR_TO_C_STRING (name, nameint); + nameint = TSTR_TO_ITEXT (name); if (nameint[0] == '\0') return Qnil; @@ -507,7 +507,7 @@ name[] or ALLOCA ()ed */ qxestrtok (nameint, ","); - return build_intstring (nameint); + return build_istring (nameint); } @@ -545,7 +545,7 @@ if (!msprinter_init_device_internal (d, DEVICE_CONNECTION (d))) signal_open_printer_error (d); - LISP_STRING_TO_TSTR (DEVICE_CONNECTION (d), printer_name); + printer_name = LISP_STRING_TO_TSTR (DEVICE_CONNECTION (d)); /* Determine DEVMODE size and store the default DEVMODE */ dm_size = qxeDocumentProperties (NULL, DEVICE_MSPRINTER_HPRINTER (d), printer_name, NULL, NULL, 0); @@ -579,7 +579,7 @@ } #ifndef NEW_GC - xfree (d->device_data, void *); + xfree (d->device_data); #endif /* not NEW_GC */ } } @@ -672,7 +672,7 @@ Ibyte new_connext[20]; qxesprintf (new_connext, ":%X", d->header.uid); - new_connection = concat2 (devname, build_intstring (new_connext)); + new_connection = concat2 (devname, build_istring (new_connext)); } DEVICE_CONNECTION (d) = new_connection; @@ -687,7 +687,7 @@ { Extbyte *nameext; - LISP_STRING_TO_TSTR (DEVICE_MSPRINTER_NAME (d), nameext); + nameext = LISP_STRING_TO_TSTR (DEVICE_MSPRINTER_NAME (d)); /* Apply the new devmode to the printer */ qxeDocumentProperties (NULL, DEVICE_MSPRINTER_HPRINTER (d), @@ -1043,7 +1043,7 @@ Extbyte *nameext; LONG dm_size; - LISP_STRING_TO_TSTR (DEVICE_MSPRINTER_NAME (d), nameext); + nameext = LISP_STRING_TO_TSTR (DEVICE_MSPRINTER_NAME (d)); dm_size = qxeDocumentProperties (NULL, DEVICE_MSPRINTER_HPRINTER (d), nameext, NULL, NULL, 0); if (dm_size <= 0) @@ -1155,7 +1155,7 @@ Lisp_Devmode *dm = XDEVMODE (obj); if (print_readably) printing_unreadable_lcrecord (obj, 0); - write_c_string (printcharfun, "#printer_name)) write_fmt_string_lisp (printcharfun, " for %S", 1, dm->printer_name); if (!NILP (dm->device)) diff -r d2ec55325515 -r 8f0cf4fd3d2c src/device-tty.c --- a/src/device-tty.c Sat Feb 06 03:59:18 2010 -0600 +++ b/src/device-tty.c Sat Feb 06 04:01:46 2010 -0600 @@ -118,7 +118,7 @@ free_tty_device_struct (struct device *d) { if (d->device_data) - xfree (d->device_data, void *); + xfree (d->device_data); } static void diff -r d2ec55325515 -r 8f0cf4fd3d2c src/device-x.c --- a/src/device-x.c Sat Feb 06 03:59:18 2010 -0600 +++ b/src/device-x.c Sat Feb 06 04:01:46 2010 -0600 @@ -210,7 +210,7 @@ last_xrm_db = db; locale = XrmLocaleOfDatabase (db); - localestr = build_ext_string (locale, Qbinary); + localestr = build_extstring (locale, Qbinary); last_coding_system = call1 (Qget_coding_system_from_locale, localestr); return last_coding_system; @@ -265,9 +265,9 @@ { Ibyte *app_name_int, *app_class_int, *value_addr_int; Lisp_Object codesys = coding_system_of_xrm_database (XtDatabase (dpy)); - EXTERNAL_TO_C_STRING (app_name, app_name_int, codesys); - EXTERNAL_TO_C_STRING (app_class, app_class_int, codesys); - EXTERNAL_TO_C_STRING (value.addr, value_addr_int, codesys); + app_name_int = EXTERNAL_TO_ITEXT (app_name, codesys); + app_class_int = EXTERNAL_TO_ITEXT (app_class, codesys); + value_addr_int = EXTERNAL_TO_ITEXT (value.addr, codesys); warn_when_safe (Qgeometry, Qerror, "\n" @@ -389,7 +389,7 @@ Bytecount len; Extbyte *data; - TO_EXTERNAL_FORMAT (LISP_STRING, str, ALLOCA, (data, len), Qbinary); + LISP_STRING_TO_SIZED_EXTERNAL (str, data, len, Qbinary); Dynarr_add_many (cda, data, len); validify_resource_component (Dynarr_atp (cda, Dynarr_length (cda) - len), len); @@ -585,7 +585,8 @@ { /* Look for the Xaw3d function */ dll_func xaw_function_handle = - dll_function (xaw_dll_handle, "Xaw3dComputeTopShadowRGB"); + dll_function (xaw_dll_handle, + (const Ibyte *) "Xaw3dComputeTopShadowRGB"); /* If we found it, warn the user in big, nasty, unfriendly letters */ if (xaw_function_handle != NULL) @@ -623,7 +624,7 @@ make_argc_argv (Vx_initial_argv_list, &argc, &argv); - LISP_STRING_TO_EXTERNAL (display, disp_name, Qctext); + disp_name = LISP_STRING_TO_EXTERNAL (display, Qctext); /* * Break apart the old XtOpenDisplay call into XOpenDisplay and @@ -647,7 +648,7 @@ if (STRINGP (Vx_emacs_application_class) && XSTRING_LENGTH (Vx_emacs_application_class) > 0) - LISP_STRING_TO_EXTERNAL (Vx_emacs_application_class, app_class, Qctext); + app_class = LISP_STRING_TO_EXTERNAL (Vx_emacs_application_class, Qctext); else { if (egetenv ("USE_EMACS_AS_DEFAULT_APPLICATION_CLASS")) @@ -667,7 +668,7 @@ } /* need to update Vx_emacs_application_class: */ - Vx_emacs_application_class = build_string (app_class); + Vx_emacs_application_class = build_cistring (app_class); } slow_down_interrupts (); @@ -696,14 +697,13 @@ if (STRINGP (Vx_app_defaults_directory) && XSTRING_LENGTH (Vx_app_defaults_directory) > 0) { - LISP_STRING_TO_EXTERNAL (Vx_app_defaults_directory, data_dir, - Qfile_name); + LISP_PATHNAME_CONVERT_OUT (Vx_app_defaults_directory, data_dir); path = alloca_extbytes (strlen (data_dir) + strlen (locale) + 7); format = "%s%s/Emacs"; } else if (STRINGP (Vdata_directory) && XSTRING_LENGTH (Vdata_directory) > 0) { - LISP_STRING_TO_EXTERNAL (Vdata_directory, data_dir, Qfile_name); + LISP_PATHNAME_CONVERT_OUT (Vdata_directory, data_dir); path = alloca_extbytes (strlen (data_dir) + 13 + strlen (locale) + 7); format = "%sapp-defaults/%s/Emacs"; } @@ -742,7 +742,7 @@ { /* Cast off const for G++ 4.3. */ Extbyte *temp = (Extbyte *) locale; - xfree (temp, Extbyte*); + xfree (temp); } } #endif /* MULE */ @@ -950,7 +950,7 @@ static void free_x_device_struct (struct device *d) { - xfree (d->device_data, void *); + xfree (d->device_data); } #endif /* not NEW_GC */ @@ -1005,10 +1005,10 @@ /* handle X errors */ /************************************************************************/ -const char * +const Ascbyte * x_event_name (int event_type) { - static const char *events[] = + static const Ascbyte *events[] = { "0: ERROR!", "1: REPLY", @@ -1198,19 +1198,19 @@ return 0; data = Qnil; qxesprintf (num, "0x%X", (unsigned int) last_error.resourceid); - data = Fcons (build_intstring (num), data); + data = Fcons (build_istring (num), data); qxesprintf (num, "%d", last_error.request_code); XGetErrorDatabaseText (last_error.display, "XRequest", (char *) num, "", buf, sizeof (buf)); if (*buf) - data = Fcons (build_ext_string (buf, Qx_error_message_encoding), data); + data = Fcons (build_extstring (buf, Qx_error_message_encoding), data); else { qxesprintf (num, "Request-%d", last_error.request_code); - data = Fcons (build_intstring (num), data); + data = Fcons (build_istring (num), data); } XGetErrorText (last_error.display, last_error.error_code, buf, sizeof (buf)); - data = Fcons (build_ext_string (buf, Qx_error_message_encoding), data); + data = Fcons (build_extstring (buf, Qx_error_message_encoding), data); again: Fsignal (Qx_error, data); if (! resumable_p) goto again; @@ -1427,8 +1427,8 @@ class_len = strlen (appclass); Dynarr_add_many (name, appname, name_len); Dynarr_add_many (class_, appclass, class_len); - validify_resource_component (Dynarr_atp (name, 0), name_len); - validify_resource_component (Dynarr_atp (class_, 0), class_len); + validify_resource_component (Dynarr_begin (name), name_len); + validify_resource_component (Dynarr_begin (class_), class_len); } if (EQ (locale, Qglobal)) @@ -1570,8 +1570,8 @@ Dynarr_add (name_Extbyte_dynarr, '\0'); Dynarr_add (class_Extbyte_dynarr, '\0'); - name_string = Dynarr_atp (name_Extbyte_dynarr, 0); - class_string = Dynarr_atp (class_Extbyte_dynarr, 0); + name_string = Dynarr_begin (name_Extbyte_dynarr); + class_string = Dynarr_begin (class_Extbyte_dynarr); { XrmValue xrm_value; @@ -1605,7 +1605,7 @@ } if (EQ (type, Qstring)) - return build_ext_string (raw_result, codesys); + return build_extstring (raw_result, codesys); else if (EQ (type, Qboolean)) { if (!strcasecmp (raw_result, "off") || @@ -1618,8 +1618,8 @@ return Fcons (Qt, Qnil); return maybe_signal_continuable_error_2 (Qinvalid_operation, "Can't convert to a Boolean", - build_ext_string (name_string, Qbinary), - build_ext_string (raw_result, codesys), Qresource, + build_extstring (name_string, Qbinary), + build_extstring (raw_result, codesys), Qresource, errb); } else if (EQ (type, Qinteger) || EQ (type, Qnatnum)) @@ -1629,13 +1629,13 @@ if (1 != sscanf (raw_result, "%d%c", &i, &c)) return maybe_signal_continuable_error_2 (Qinvalid_operation, "Can't convert to an integer", - build_ext_string (name_string, Qbinary), - build_ext_string (raw_result, codesys), Qresource, + build_extstring (name_string, Qbinary), + build_extstring (raw_result, codesys), Qresource, errb); else if (EQ (type, Qnatnum) && i < 0) return maybe_signal_continuable_error_2 (Qinvalid_argument, "Invalid numerical value for resource", - make_int (i), build_ext_string (name_string, Qbinary), + make_int (i), build_extstring (name_string, Qbinary), Qresource, errb); else return make_int (i); @@ -1670,9 +1670,9 @@ if (!display) return Qnil; - return Fcons (make_string ((Ibyte *) Dynarr_atp (name_Extbyte_dynarr, 0), + return Fcons (make_string ((Ibyte *) Dynarr_begin (name_Extbyte_dynarr), Dynarr_length (name_Extbyte_dynarr)), - make_string ((Ibyte *) Dynarr_atp (class_Extbyte_dynarr, 0), + make_string ((Ibyte *) Dynarr_begin (class_Extbyte_dynarr), Dynarr_length (class_Extbyte_dynarr))); } @@ -1691,8 +1691,8 @@ Extbyte *str, *colon_pos; CHECK_STRING (resource_line); - LISP_STRING_TO_EXTERNAL (resource_line, str, - coding_system_of_xrm_database (db)); + str = LISP_STRING_TO_EXTERNAL (resource_line, + coding_system_of_xrm_database (db)); if (!(colon_pos = strchr (str, ':')) || strchr (str, '\n')) invalid: syntax_error ("Invalid resource line", resource_line); @@ -1803,7 +1803,7 @@ Display *dpy = get_x_display (device); Extbyte *vendor = ServerVendor (dpy); - return build_ext_string (vendor ? vendor : "", Qx_hpc_encoding); + return build_extstring (vendor ? vendor : "", Qx_hpc_encoding); } DEFUN ("x-server-version", Fx_server_version, 0, 1, 0, /* @@ -1831,7 +1831,7 @@ const Extbyte *keysym_ext; CHECK_STRING (keysym); - LISP_STRING_TO_EXTERNAL (keysym, keysym_ext, Qctext); + keysym_ext = LISP_STRING_TO_EXTERNAL (keysym, Qctext); return XStringToKeysym (keysym_ext) ? Qt : Qnil; } @@ -2048,7 +2048,7 @@ gui_error ("Can't get X font path", device); while (ndirs_return--) - font_path = Fcons (build_ext_string (directories[ndirs_return], + font_path = Fcons (build_extstring (directories[ndirs_return], Qfile_name), font_path); @@ -2089,10 +2089,7 @@ { EXTERNAL_LIST_LOOP_2 (path_entry, font_path) - { - LISP_STRING_TO_EXTERNAL (path_entry, directories[i++], - Qfile_name); - } + LISP_PATHNAME_CONVERT_OUT (path_entry, directories[i++]); } expect_x_error (dpy); diff -r d2ec55325515 -r 8f0cf4fd3d2c src/dialog-msw.c --- a/src/dialog-msw.c Sat Feb 06 03:59:18 2010 -0600 +++ b/src/dialog-msw.c Sat Feb 06 04:01:46 2010 -0600 @@ -1,6 +1,6 @@ /* Implements elisp-programmable dialog boxes -- MS Windows interface. Copyright (C) 1998 Kirill M. Katsnelson - Copyright (C) 2000, 2001, 2002, 2003, 2004 Ben Wing. + Copyright (C) 2000, 2001, 2002, 2003, 2004, 2010 Ben Wing. This file is part of XEmacs. @@ -250,9 +250,8 @@ int length; Extbyte *uni_string; - TO_EXTERNAL_FORMAT (LISP_STRING, string, - ALLOCA, (uni_string, length), - Qmswindows_unicode); + LISP_STRING_TO_SIZED_EXTERNAL (string, uni_string, length, + Qmswindows_unicode); Dynarr_add_many (dynarr, uni_string, length); Dynarr_add (dynarr, '\0'); Dynarr_add (dynarr, '\0'); @@ -297,7 +296,7 @@ static struct { DWORD errmess; - Ascbyte *errname; + const Ascbyte *errname; } common_dialog_errors[] = { { CDERR_DIALOGFAILURE, "CDERR_DIALOGFAILURE" }, @@ -394,7 +393,7 @@ BIF_RETURNONLYFSDIRS | BIF_STATUSTEXT | BIF_EDITBOX | BIF_NEWDIALOGSTYLE; bi.lpfn = handle_directory_proc; - LISP_LOCAL_FILE_FORMAT_TO_TSTR (Fexpand_file_name (build_string (""), Qnil), + LISP_LOCAL_FILE_FORMAT_TO_TSTR (Fexpand_file_name (build_ascstring (""), Qnil), pd.fname); { @@ -403,7 +402,7 @@ if (EQ (key, Q_title)) { CHECK_STRING (value); - LISP_STRING_TO_EXTERNAL (value, bi.lpszTitle, Qmswindows_tstr); + bi.lpszTitle = (XELPTSTR) LISP_STRING_TO_TSTR (value); } else if (EQ (key, Q_initial_directory)) LISP_LOCAL_FILE_FORMAT_TO_TSTR (Fexpand_file_name (value, Qnil), @@ -442,7 +441,7 @@ else if (pd.unknown_fname != 0) { ret = tstr_to_local_file_format (pd.unknown_fname); - xfree (pd.unknown_fname, Extbyte *); + xfree (pd.unknown_fname); } else while (1) signal_quit (); @@ -468,8 +467,9 @@ ofn.nMaxFile = sizeof (fnbuf) / XETCHAR_SIZE; qxetcscpy (fnbuf, XETEXT ("")); - LISP_LOCAL_FILE_FORMAT_TO_TSTR (Fexpand_file_name (build_string (""), Qnil), - ofn.lpstrInitialDir); + LISP_LOCAL_FILE_FORMAT_TO_TSTR (Fexpand_file_name (build_ascstring (""), + Qnil), + ofn.lpstrInitialDir); { EXTERNAL_PROPERTY_LIST_LOOP_3 (key, value, keys) @@ -485,11 +485,11 @@ else if (EQ (key, Q_title)) { CHECK_STRING (value); - LISP_STRING_TO_TSTR (value, ofn.lpstrTitle); + ofn.lpstrTitle = (XELPTSTR) LISP_STRING_TO_TSTR (value); } else if (EQ (key, Q_initial_directory)) LISP_LOCAL_FILE_FORMAT_TO_TSTR (Fexpand_file_name (value, Qnil), - ofn.lpstrInitialDir); + ofn.lpstrInitialDir); else if (EQ (key, Q_file_must_exist)) { if (!NILP (value)) @@ -765,7 +765,7 @@ /* Woof! Everything is ready. Pop pop pop in now! */ did->hwnd = qxeCreateDialogIndirectParam (NULL, - (LPDLGTEMPLATE) Dynarr_atp (template_, 0), + (LPDLGTEMPLATE) Dynarr_begin (template_), FRAME_MSWINDOWS_HANDLE (f), dialog_proc, (LPARAM) LISP_TO_VOID (dialog_data)); if (!did->hwnd) @@ -844,9 +844,9 @@ &Vdefault_file_dialog_filter_alist /* */ ); Vdefault_file_dialog_filter_alist = - list5 (Fcons (build_msg_string ("Text Files"), build_string ("*.txt")), - Fcons (build_msg_string ("C Files"), build_string ("*.c;*.h")), - Fcons (build_msg_string ("Elisp Files"), build_string ("*.el")), - Fcons (build_msg_string ("HTML Files"), build_string ("*.html;*.html")), - Fcons (build_msg_string ("All Files"), build_string ("*.*"))); + list5 (Fcons (build_defer_string ("Text Files"), build_ascstring ("*.txt")), + Fcons (build_defer_string ("C Files"), build_ascstring ("*.c;*.h")), + Fcons (build_defer_string ("Elisp Files"), build_ascstring ("*.el")), + Fcons (build_defer_string ("HTML Files"), build_ascstring ("*.html;*.html")), + Fcons (build_defer_string ("All Files"), build_ascstring ("*.*"))); } diff -r d2ec55325515 -r 8f0cf4fd3d2c src/dialog-x.c --- a/src/dialog-x.c Sat Feb 06 03:59:18 2010 -0600 +++ b/src/dialog-x.c Sat Feb 06 04:01:46 2010 -0600 @@ -58,7 +58,7 @@ void *tmp = LISP_TO_VOID (cons3 (Qnil, list2 (text_field_callback, - build_ext_string (text_field_value, + build_extstring (text_field_value, Qlwlib_encoding)), Qnil)); popup_selection_callback (0, id, (XtPointer) tmp); @@ -171,7 +171,7 @@ wv_closure = make_opaque_ptr (kids); record_unwind_protect (widget_value_unwind, wv_closure); prev->name = xstrdup ("message"); - LISP_STRING_TO_EXTERNAL_MALLOC (question, prev->value, Qlwlib_encoding); + prev->value = LISP_STRING_TO_EXTERNAL_MALLOC (question, Qlwlib_encoding); prev->enabled = 1; { @@ -207,7 +207,7 @@ { allow_text_p = 0; /* only allow text field at the front */ if (wv->value) - xfree (wv->value, char *); + xfree (wv->value); wv->value = wv->name; /* what a mess... */ wv->name = xstrdup (button_names [n]); diff -r d2ec55325515 -r 8f0cf4fd3d2c src/dired-msw.c --- a/src/dired-msw.c Sat Feb 06 03:59:18 2010 -0600 +++ b/src/dired-msw.c Sat Feb 06 04:01:46 2010 -0600 @@ -179,7 +179,7 @@ { mswindows_sort_method = sort_by; mswindows_reverse_sort = reverse; - qsort (Dynarr_atp (files, 0), Dynarr_length (files), + qsort (Dynarr_begin (files), Dynarr_length (files), sizeof (Win32_file), mswindows_ls_sort_fcn); } @@ -587,7 +587,7 @@ for (i = 0; i < Dynarr_length (files); ++i) { Win32_file *file = Dynarr_atp (files, i); - xfree (file->cFileName, Ibyte *); + xfree (file->cFileName); } Dynarr_free (files); diff -r d2ec55325515 -r 8f0cf4fd3d2c src/dired.c --- a/src/dired.c Sat Feb 06 03:59:18 2010 -0600 +++ b/src/dired.c Sat Feb 06 04:01:46 2010 -0600 @@ -578,8 +578,8 @@ { int i; for (i = 0; i < cache->length; i++) - xfree (cache->user_names[i].ptr, Ibyte *); - xfree (cache->user_names, struct user_name *); + xfree (cache->user_names[i].ptr); + xfree (cache->user_names); xzero (*cache); } diff -r d2ec55325515 -r 8f0cf4fd3d2c src/doc.c --- a/src/doc.c Sat Feb 06 03:59:18 2010 -0600 +++ b/src/doc.c Sat Feb 06 04:01:46 2010 -0600 @@ -65,7 +65,7 @@ if (0 > lseek (fd, position, 0)) { if (name_nonreloc) - name_reloc = build_intstring (name_nonreloc); + name_reloc = build_istring (name_nonreloc); return_me = list3 (build_msg_string ("Position out of range in doc string file"), name_reloc, make_int (position)); @@ -180,7 +180,7 @@ if (0 > lseek (fd, position, 0)) { if (name_nonreloc) - name_reloc = build_intstring (name_nonreloc); + name_reloc = build_istring (name_nonreloc); return_me = list3 (build_msg_string ("Position out of range in doc string file"), name_reloc, make_int (position)); @@ -289,7 +289,7 @@ } UNGCPRO; if (buffer != buf) /* We must have allocated buffer above */ - xfree (buffer, Ibyte *); + xfree (buffer); return return_me; } @@ -378,7 +378,7 @@ if (fd < 0) report_file_error ("Cannot open doc string file", - name_nonreloc ? build_intstring (name_nonreloc) : + name_nonreloc ? build_istring (name_nonreloc) : name_reloc); } @@ -475,7 +475,7 @@ if (fd < 0) report_file_error ("Cannot open doc string file", - name_nonreloc ? build_intstring (name_nonreloc) : + name_nonreloc ? build_istring (name_nonreloc) : name_reloc); } @@ -491,12 +491,13 @@ static void -weird_doc (Lisp_Object sym, const CIbyte *weirdness, const CIbyte *type, +weird_doc (Lisp_Object sym, const Ascbyte *weirdness, const Ascbyte *type, int pos) { - if (!strcmp (weirdness, GETTEXT ("duplicate"))) return; + if (!strcmp (weirdness, "duplicate")) return; message ("Note: Strange doc (%s) for %s %s @ %d", - weirdness, type, XSTRING_DATA (XSYMBOL (sym)->name), pos); + GETTEXT (weirdness), GETTEXT (type), + XSTRING_DATA (XSYMBOL (sym)->name), pos); } DEFUN ("built-in-symbol-file", Fbuilt_in_symbol_file, 1, 2, 0, /* @@ -598,7 +599,7 @@ if (XSUBR (fun)->doc == 0) return Qnil; if ((EMACS_INT) XSUBR (fun)->doc >= 0) - doc = build_string (XSUBR (fun)->doc); + doc = build_cistring (XSUBR (fun)->doc); else doc = get_doc_string (make_int (- (EMACS_INT) XSUBR (fun)->doc)); } @@ -753,7 +754,7 @@ fd = qxe_open (name, O_RDONLY | OPEN_BINARY, 0); if (fd < 0) - report_file_error ("Opening doc string file", build_intstring (name)); + report_file_error ("Opening doc string file", build_istring (name)); Vinternal_doc_file_name = filename; filled = 0; pos = 0; @@ -789,8 +790,8 @@ Lisp_Object old = Fget (sym, Qvariable_documentation, Qzero); if (!ZEROP (old)) { - weird_doc (sym, GETTEXT ("duplicate"), - GETTEXT ("variable"), pos); + weird_doc (sym, "duplicate", + "variable", pos); /* In the case of duplicate doc file entries, always take the later one. But if the doc is not an int (a string, say) leave it alone. */ @@ -830,8 +831,8 @@ So I'm disabling this. --ben */ /* May have been #if'ed out or something */ - weird_doc (sym, GETTEXT ("not fboundp"), - GETTEXT ("function"), pos); + weird_doc (sym, "not fboundp", + "function", pos); #endif goto weird; } @@ -840,8 +841,8 @@ /* Lisp_Subrs have a slot for it. */ if (XSUBR (fun)->doc) { - weird_doc (sym, GETTEXT ("duplicate"), - GETTEXT ("subr"), pos); + weird_doc (sym, "duplicate", + "subr", pos); goto weird; } XSUBR (fun)->doc = (char *) (- XINT (offset)); @@ -859,11 +860,12 @@ Lisp_Object old = XCAR (tem); if (!ZEROP (old)) { - weird_doc (sym, GETTEXT ("duplicate"), - (EQ (tem, Qlambda) - ? GETTEXT ("lambda") - : GETTEXT ("autoload")), - pos); + if (EQ (tem, Qlambda)) + weird_doc (sym, "duplicate", "lambda", + pos); + else + weird_doc (sym, "duplicate", "autoload", + pos); /* In the case of duplicate doc file entries, always take the later one. But if the doc is not an int (a string, say) leave it @@ -875,24 +877,23 @@ } else if (!CONSP (tem)) { - weird_doc (sym, GETTEXT ("!CONSP(tem)"), - GETTEXT ("function"), pos); + weird_doc (sym, "!CONSP(tem)", "function", pos); goto cont; } else { /* DOC string is a string not integer 0 */ #if 0 - weird_doc (sym, GETTEXT ("!INTP(XCAR(tem))"), - GETTEXT ("function"), pos); + weird_doc (sym, "!INTP(XCAR(tem))", + "function", pos); #endif goto cont; } } else { - weird_doc (sym, GETTEXT ("not lambda or autoload"), - GETTEXT ("function"), pos); + weird_doc (sym, "not lambda or autoload", + "function", pos); goto cont; } } @@ -911,8 +912,7 @@ if (! (f->flags.documentationp)) { - weird_doc (sym, GETTEXT ("no doc slot"), - GETTEXT ("bytecode"), pos); + weird_doc (sym, "no doc slot", "bytecode", pos); goto weird; } else @@ -921,8 +921,7 @@ compiled_function_documentation (f); if (!ZEROP (old)) { - weird_doc (sym, GETTEXT ("duplicate"), - GETTEXT ("bytecode"), pos); + weird_doc (sym, "duplicate", "bytecode", pos); /* In the case of duplicate doc file entries, always take the later one. But if the doc is not an int (a string, say) leave it alone. */ @@ -936,8 +935,7 @@ { /* Otherwise the function is undefined or otherwise weird. Ignore it. */ - weird_doc (sym, GETTEXT ("weird function"), - GETTEXT ("function"), pos); + weird_doc (sym, "weird function", "function", pos); goto weird; } } @@ -1245,9 +1243,9 @@ if (NILP (tem)) { - buffer_insert_c_string (buf_, "(uses keymap \""); + buffer_insert_ascstring (buf_, "(uses keymap \""); buffer_insert_lisp_string (buf_, Fsymbol_name (name)); - buffer_insert_c_string (buf_, "\", which is not currently defined) "); + buffer_insert_ascstring (buf_, "\", which is not currently defined) "); if (start[-1] == '<') keymap = Qnil; } @@ -1284,7 +1282,7 @@ tem = make_string (buf, bufp - buf); else tem = string; - xfree (buf, Ibyte *); + xfree (buf); UNGCPRO; return tem; } @@ -1315,6 +1313,6 @@ */ ); Vinternal_doc_file_name = Qnil; - QSsubstitute = build_string (" *substitute*"); + QSsubstitute = build_ascstring (" *substitute*"); staticpro (&QSsubstitute); } diff -r d2ec55325515 -r 8f0cf4fd3d2c src/doprnt.c --- a/src/doprnt.c Sat Feb 06 03:59:18 2010 -0600 +++ b/src/doprnt.c Sat Feb 06 04:01:46 2010 -0600 @@ -754,7 +754,7 @@ strlen ((const char *) text_to_print), spec->minwidth, -1, spec->minus_flag, spec->zero_flag); - xfree (text_to_print, Ibyte *); + xfree (text_to_print); } #endif #ifdef HAVE_RATIO @@ -766,7 +766,7 @@ strlen ((const char *) text_to_print), spec->minwidth, -1, spec->minus_flag, spec->zero_flag); - xfree (text_to_print, Ibyte *); + xfree (text_to_print); } #endif } @@ -779,7 +779,7 @@ doprnt_2 (stream, text_to_print, strlen ((const char *) text_to_print), spec->minwidth, -1, spec->minus_flag, spec->zero_flag); - xfree (text_to_print, Ibyte *); + xfree (text_to_print); } #endif /* HAVE_BIGFLOAT */ else if (ch == 'b') diff -r d2ec55325515 -r 8f0cf4fd3d2c src/dumper.c --- a/src/dumper.c Sat Feb 06 03:59:18 2010 -0600 +++ b/src/dumper.c Sat Feb 06 04:01:46 2010 -0600 @@ -2123,11 +2123,11 @@ O_WRONLY | O_CREAT | O_TRUNC | OPEN_BINARY, 0666); if (pdump_fd < 0) report_file_error ("Unable to open dump file", - build_string (EMACS_PROGNAME ".dmp")); + build_ascstring (EMACS_PROGNAME ".dmp")); pdump_out = fdopen (pdump_fd, "w"); if (pdump_out < 0) report_file_error ("Unable to open dump file for writing", - build_string (EMACS_PROGNAME ".dmp")); + build_ascstring (EMACS_PROGNAME ".dmp")); retry_fwrite (&header, sizeof (header), 1, pdump_out); PDUMP_ALIGN_OUTPUT (max_align_t); @@ -2402,7 +2402,7 @@ } #ifdef NEW_GC - xfree (pdump_mc_hash, mc_addr_elt *); + xfree (pdump_mc_hash); #endif /* NEW_GC */ #ifdef NEW_GC @@ -2518,7 +2518,7 @@ static void pdump_file_free (void) { - xfree (pdump_start, Rawbyte *); + xfree (pdump_start); } #ifdef HAVE_MMAP diff -r d2ec55325515 -r 8f0cf4fd3d2c src/dynarr.c --- a/src/dynarr.c Sat Feb 06 03:59:18 2010 -0600 +++ b/src/dynarr.c Sat Feb 06 04:01:46 2010 -0600 @@ -1,6 +1,6 @@ /* Support for dynamic arrays. Copyright (C) 1993 Sun Microsystems, Inc. - Copyright (C) 2002, 2003, 2004, 2005 Ben Wing. + Copyright (C) 2002, 2003, 2004, 2005, 2010 Ben Wing. This file is part of XEmacs. @@ -127,6 +127,27 @@ #include #include "lisp.h" +static const struct memory_description const_Ascbyte_ptr_description_1[] = { + { XD_ASCII_STRING, 0 }, + { XD_END } +}; + +const struct sized_memory_description const_Ascbyte_ptr_description = { + sizeof (const Ascbyte *), + const_Ascbyte_ptr_description_1 +}; + +static const struct memory_description const_Ascbyte_ptr_dynarr_description_1[] = { + XD_DYNARR_DESC (const_Ascbyte_ptr_dynarr, &const_Ascbyte_ptr_description), + { XD_END } +}; + +const struct sized_memory_description const_Ascbyte_ptr_dynarr_description = { + sizeof (const_Ascbyte_ptr_dynarr), + const_Ascbyte_ptr_dynarr_description_1 +}; + + static int Dynarr_min_size = 8; static void @@ -136,7 +157,8 @@ { void *new_base = malloc (new_size * dy->elsize); memcpy (new_base, dy->base, - (dy->max < new_size ? dy->max : new_size) * dy->elsize); + (Dynarr_max (dy) < new_size ? Dynarr_max (dy) : new_size) * + dy->elsize); dy->base = new_base; } else @@ -165,7 +187,8 @@ void *new_base = alloc_lrecord_array (dy->elsize, new_size, dy->lisp_imp); if (dy->base) memcpy (new_base, dy->base, - (dy->max < new_size ? dy->max : new_size) * dy->elsize); + (Dynarr_max (dy) < new_size ? Dynarr_max (dy) : new_size) * + dy->elsize); dy->base = new_base; } @@ -189,16 +212,16 @@ double multiplier; Dynarr *dy = (Dynarr *) Dynarr_verify (d); - if (dy->max <= 8) + if (Dynarr_max (dy) <= 8) multiplier = 2; else multiplier = 1.5; - for (newsize = dy->max; newsize < size;) + for (newsize = Dynarr_max (dy); newsize < size;) newsize = max (Dynarr_min_size, (int) (multiplier * newsize)); /* Don't do anything if the array is already big enough. */ - if (newsize > dy->max) + if (newsize > Dynarr_max (dy)) { #ifdef NEW_GC if (dy->lisp_imp) @@ -208,7 +231,7 @@ #else /* not NEW_GC */ Dynarr_realloc (dy, newsize); #endif /* not NEW_GC */ - dy->max = newsize; + dy->max_ = newsize; } } @@ -216,47 +239,43 @@ void Dynarr_insert_many (void *d, const void *el, int len, int start) { - Dynarr *dy = (Dynarr *) Dynarr_verify (d); - - if (dy->len + len > dy->max) - Dynarr_resize (dy, dy->len + len); -#if 0 - /* WTF? We should be catching these problems. */ - /* Silently adjust start to be valid. */ - if (start > dy->len) - start = dy->len; - else if (start < 0) - start = 0; -#else + Dynarr *dy = Dynarr_verify_mod (d); + + Dynarr_resize_if (dy, len); + /* #### This could conceivably be wrong, if code wants to access stuff between len and largest. */ - type_checking_assert (start >= 0 && start <= dy->len); -#endif + structure_checking_assert (start >= 0 && start <= Dynarr_length (dy)); - if (start != dy->len) + if (start != Dynarr_length (dy)) { memmove ((char *) dy->base + (start + len)*dy->elsize, (char *) dy->base + start*dy->elsize, - (dy->len - start)*dy->elsize); + (Dynarr_length (dy) - start)*dy->elsize); } + /* Some functions call us with a value of 0 to mean "reserve space but + don't write into it" */ if (el) memcpy ((char *) dy->base + start*dy->elsize, el, len*dy->elsize); - dy->len += len; - if (dy->len > dy->largest) - dy->largest = dy->len; + Dynarr_set_length_1 (dy, Dynarr_length (dy) + len); + (void) Dynarr_verify_mod (dy); } void Dynarr_delete_many (void *d, int start, int len) { - Dynarr *dy = (Dynarr *) Dynarr_verify (d); + Dynarr *dy = Dynarr_verify_mod (d); - type_checking_assert (start >= 0 && len >= 0 && start + len <= dy->len); + structure_checking_assert (start >= 0 && len >= 0 && + start + len <= Dynarr_length (dy)); + memmove ((char *) dy->base + start*dy->elsize, (char *) dy->base + (start + len)*dy->elsize, - (dy->len - start - len)*dy->elsize); - dy->len -= len; + (Dynarr_length (dy) - start - len)*dy->elsize); + + Dynarr_set_length_1 (dy, Dynarr_length (dy) - len); + (void) Dynarr_verify_mod (dy); } void @@ -268,18 +287,18 @@ if (dy->base && !DUMPEDP (dy->base)) { if (!dy->lisp_imp) - xfree (dy->base, void *); + xfree (dy->base); } if(!DUMPEDP (dy)) { if (!dy->lisp_imp) - xfree (dy, Dynarr *); + xfree (dy); } #else /* not NEW_GC */ if (dy->base && !DUMPEDP (dy->base)) - xfree (dy->base, void *); + xfree (dy->base); if(!DUMPEDP (dy)) - xfree (dy, Dynarr *); + xfree (dy); #endif /* not NEW_GC */ } @@ -305,12 +324,13 @@ if (dy->base) { - Bytecount malloc_used = malloced_storage_size (dy->base, - dy->elsize * dy->max, 0); + Bytecount malloc_used = + malloced_storage_size (dy->base, dy->elsize * Dynarr_max (dy), 0); /* #### This may or may not be correct. Some Dynarrs would prefer that we use dy->len instead of dy->largest here. */ - Bytecount was_requested = dy->elsize * dy->largest; - Bytecount dynarr_overhead = dy->elsize * (dy->max - dy->largest); + Bytecount was_requested = dy->elsize * Dynarr_largest (dy); + Bytecount dynarr_overhead = + dy->elsize * (Dynarr_max (dy) - Dynarr_largest (dy)); total += malloc_used; stats->was_requested += was_requested; @@ -359,7 +379,7 @@ Dynarr_add (stack_like_in_use_list, this_one); Dynarr_reset (this_one); Dynarr_add_many (this_one, 0, size); - return Dynarr_atp (this_one, 0); + return Dynarr_begin (this_one); } void @@ -371,7 +391,7 @@ order, and the item at the end of the list will be the one we're looking for, so just check for this first and avoid any function calls. */ - if (Dynarr_atp (Dynarr_at (stack_like_in_use_list, len - 1), 0) == val) + if (Dynarr_begin (Dynarr_at (stack_like_in_use_list, len - 1)) == val) { char_dynarr *this_one = Dynarr_pop (stack_like_in_use_list); Dynarr_add (stack_like_free_list, this_one); @@ -382,7 +402,7 @@ int i; assert (len >= 2); for (i = len - 2; i >= 0; i--) - if (Dynarr_atp (Dynarr_at (stack_like_in_use_list, i), 0) == + if (Dynarr_begin (Dynarr_at (stack_like_in_use_list, i)) == val) { char_dynarr *this_one = Dynarr_at (stack_like_in_use_list, i); diff -r d2ec55325515 -r 8f0cf4fd3d2c src/editfns.c --- a/src/editfns.c Sat Feb 06 03:59:18 2010 -0600 +++ b/src/editfns.c Sat Feb 06 04:01:46 2010 -0600 @@ -95,7 +95,7 @@ if ((p = egetenv ("NAME"))) /* I don't think it's the right thing to do the ampersand modification on NAME. Not that it matters anymore... -hniksic */ - Vuser_full_name = build_intstring (p); + Vuser_full_name = build_istring (p); else Vuser_full_name = Fuser_full_name (Qnil); } @@ -649,7 +649,7 @@ } #endif - return build_intstring (tmpdir); + return build_istring (tmpdir); } DEFUN ("user-login-name", Fuser_login_name, 0, 1, 0, /* @@ -678,7 +678,7 @@ /* #### - I believe this should return nil instead of "unknown" when pw==0 pw=0 is indicated by a null return from user_login_name */ - return returned_name ? build_intstring (returned_name) : Qnil; + return returned_name ? build_istring (returned_name) : Qnil; } /* This function may be called from other C routines when a @@ -744,7 +744,7 @@ struct passwd *pw = qxe_getpwuid (getuid ()); /* #### - I believe this should return nil instead of "unknown" when pw==0 */ - return build_string (pw ? pw->pw_name : "unknown"); + return build_extstring (pw ? pw->pw_name : "unknown", Quser_name_encoding); } DEFUN ("user-uid", Fuser_uid, 0, 0, 0, /* @@ -831,7 +831,7 @@ uncache_home_directory (void) { if (cached_home_directory) - xfree (cached_home_directory, Ibyte *); + xfree (cached_home_directory); cached_home_directory = NULL; } @@ -869,7 +869,7 @@ We probably should try to extract pw_dir from /etc/passwd, before falling back to this. */ cached_home_directory - = qxestrdup ((const Ibyte *)DEFAULT_DIRECTORY_FALLBACK); + = qxestrdup ((const Ibyte *) DEFAULT_DIRECTORY_FALLBACK); output_home_warning = 1; } } @@ -895,7 +895,7 @@ Ibyte *path = get_home_directory (); return !path ? Qnil : - Fexpand_file_name (Fsubstitute_in_file_name (build_intstring (path)), + Fexpand_file_name (Fsubstitute_in_file_name (build_istring (path)), Qnil); } @@ -1068,17 +1068,17 @@ Extbyte *buf = alloca_extbytes (size); Extbyte *formext; /* make a copy of the static buffer returned by localtime() */ - struct tm tm = * localtime(&value); + struct tm tm = *localtime (&value); *buf = 1; /* !!#### this use of external here is not totally safe, and potentially data lossy. */ - LISP_STRING_TO_EXTERNAL (format_string, formext, - Qtime_function_encoding); + formext = LISP_STRING_TO_EXTERNAL (format_string, + Qtime_function_encoding); if (emacs_strftime (buf, size, formext, &tm) || !*buf) - return build_ext_string (buf, Qtime_function_encoding); + return build_extstring (buf, Qtime_function_encoding); /* If buffer was too small, make it bigger. */ size *= 2; } @@ -1188,7 +1188,7 @@ Extbyte **oldenv = environ, **newenv; if (STRINGP (zone)) - LISP_STRING_TO_EXTERNAL (zone, tzstring, Qtime_zone_encoding); + tzstring = LISP_STRING_TO_EXTERNAL (zone, Qtime_zone_encoding); else if (INTP (zone)) { int abszone = abs (XINT (zone)); @@ -1237,7 +1237,7 @@ { time_t value; Ibyte *the_ctime; - EMACS_INT len; /* this is what make_ext_string() accepts; #### + EMACS_INT len; /* this is what make_extstring() accepts; #### should it be an Bytecount? */ if (! lisp_to_time (specified_time, &value)) @@ -1320,7 +1320,7 @@ #endif #endif /* not HAVE_TM_ZONE */ if (s) - tem = build_ext_string (s, Qtime_zone_encoding); + tem = build_extstring (s, Qtime_zone_encoding); else { Ibyte buf[6]; @@ -1329,7 +1329,7 @@ int am = (offset < 0 ? -offset : offset) / 60; qxesprintf (buf, "%c%02d%02d", (offset < 0 ? '-' : '+'), am/60, am%60); - tem = build_intstring (buf); + tem = build_istring (buf); } return list2 (make_int (offset), tem); } @@ -1434,12 +1434,12 @@ else { CHECK_STRING (tz); - LISP_STRING_TO_EXTERNAL (tz, tzstring, Qtime_zone_encoding); + tzstring = LISP_STRING_TO_EXTERNAL (tz, Qtime_zone_encoding); } set_time_zone_rule (tzstring); if (environbuf) - xfree (environbuf, Extbyte **); + xfree (environbuf); environbuf = environ; return Qnil; diff -r d2ec55325515 -r 8f0cf4fd3d2c src/elhash.c --- a/src/elhash.c Sat Feb 06 03:59:18 2010 -0600 +++ b/src/elhash.c Sat Feb 06 04:01:46 2010 -0600 @@ -313,16 +313,16 @@ int count = 0; htentry *e, *sentinel; - write_c_string (printcharfun, " :data ("); + write_ascstring (printcharfun, " :data ("); for (e = ht->hentries, sentinel = e + ht->size; e < sentinel; e++) if (!HTENTRY_CLEAR_P (e)) { if (count > 0) - write_c_string (printcharfun, " "); + write_ascstring (printcharfun, " "); if (!print_readably && count > 3) { - write_c_string (printcharfun, "..."); + write_ascstring (printcharfun, "..."); break; } print_internal (e->key, printcharfun, 1); @@ -330,7 +330,7 @@ count++; } - write_c_string (printcharfun, ")"); + write_ascstring (printcharfun, ")"); } static void @@ -340,16 +340,16 @@ Lisp_Hash_Table *ht = XHASH_TABLE (obj); Ascbyte pigbuf[350]; - write_c_string (printcharfun, + write_ascstring (printcharfun, print_readably ? "#s(hash-table" : "#test_function) - write_c_string (printcharfun, " :test eq"); + write_ascstring (printcharfun, " :test eq"); else if (ht->test_function == lisp_object_equal_equal) - write_c_string (printcharfun, " :test equal"); + write_ascstring (printcharfun, " :test equal"); else if (ht->test_function == lisp_object_eql_equal) DO_NOTHING; else @@ -393,7 +393,7 @@ print_hash_table_data (ht, printcharfun); if (print_readably) - write_c_string (printcharfun, ")"); + write_ascstring (printcharfun, ")"); else write_fmt_string (printcharfun, " 0x%x>", ht->header.uid); } @@ -417,7 +417,7 @@ #endif if (!DUMPEDP (hentries)) - xfree (hentries, htentry *); + xfree (hentries); } static void @@ -1128,7 +1128,7 @@ memcpy (ht->hentries, new_entries, ht->size * sizeof (htentry)); #ifndef NEW_GC - xfree (new_entries, htentry *); + xfree (new_entries); #endif /* not NEW_GC */ } @@ -1423,7 +1423,7 @@ maphash_unwind (Lisp_Object unwind_obj) { void *ptr = (void *) get_opaque_ptr (unwind_obj); - xfree (ptr, void *); + xfree (ptr); free_opaque_ptr (unwind_obj); return Qnil; } diff -r d2ec55325515 -r 8f0cf4fd3d2c src/emacs.c --- a/src/emacs.c Sat Feb 06 03:59:18 2010 -0600 +++ b/src/emacs.c Sat Feb 06 04:01:46 2010 -0600 @@ -714,7 +714,7 @@ full_exe_path = mswindows_get_module_file_name (); assert (full_exe_path); fullpath = build_tstr_string (full_exe_path); - xfree (full_exe_path, Extbyte *); + xfree (full_exe_path); result = Fcons (fullpath, result); } else @@ -747,8 +747,8 @@ { CHECK_STRING (XCAR (next)); - LISP_STRING_TO_EXTERNAL_MALLOC (XCAR (next), (*argv) [i], - Qcommand_argument_encoding); + (*argv)[i] = LISP_STRING_TO_EXTERNAL_MALLOC (XCAR (next), + Qcommand_argument_encoding); } (*argv) [n] = 0; *argc = i; @@ -761,10 +761,10 @@ while (argv[elt]) { - xfree (argv[elt], Wexttext *); + xfree (argv[elt]); elt++; } - xfree (argv, Wexttext **); + xfree (argv); } static void @@ -936,8 +936,8 @@ #define SHEBANG_PROGNAME_LENGTH \ (int)((sizeof (WEXTSTRING (SHEBANG_PROGNAME)) - sizeof (WEXTSTRING ("")))) -#define SHEBANG_EXE_PROGNAME_LENGTH \ - (int)(sizeof (WEXTSTRING (SHEBANG_PROGNAME) WEXTSTRING(".exe")) \ +#define SHEBANG_EXE_PROGNAME_LENGTH \ + (int)(sizeof (WEXTSTRING (SHEBANG_PROGNAME) WEXTSTRING (".exe")) \ - sizeof (WEXTSTRING (""))) { @@ -959,7 +959,7 @@ int j; newarr[0] = argv[0]; - newarr[1] = WEXTSTRING ("--script"); + newarr[1] = (Wexttext *) WEXTSTRING ("--script"); for (j = 1; j < argc; ++j) { newarr[j + 1] = argv[j]; @@ -1252,7 +1252,7 @@ for (j = 0; j < count_before + 1; j++) new_[j] = argv[j]; - new_[count_before + 1] = WEXTSTRING ("-d"); + new_[count_before + 1] = (Wexttext *) WEXTSTRING ("-d"); new_[count_before + 2] = dpy; for (j = count_before + 2; j count_before && argv[count_before + 1][1] == '-') - argv[count_before + 1] = WEXTSTRING ("-d"); + argv[count_before + 1] = (Wexttext *) WEXTSTRING ("-d"); /* Don't actually discard this arg. */ skip_args = count_before; @@ -2010,8 +2010,9 @@ -- Fset() on a symbol that is unbound -- Any of the object-creating functions in alloc.c: e.g. - make_string() - - build_intstring() - - build_string() + - build_istring() + - build_cistring() + - build_ascstring() - make_vector() - make_int() - make_char() @@ -2295,6 +2296,7 @@ /* Now do additional vars_of_*() initialization that happens both at dump time and after pdump load. */ reinit_vars_of_buffer (); + reinit_vars_of_bytecode (); reinit_vars_of_console (); #ifdef DEBUG_XEMACS reinit_vars_of_debug (); @@ -2632,7 +2634,7 @@ if (XSTRING_DATA (Vinvocation_name)[0] == '-') { /* XEmacs as a login shell, oh goody! */ - Vinvocation_name = build_intstring (egetenv ("SHELL")); + Vinvocation_name = build_istring (egetenv ("SHELL")); } Vinvocation_directory = Vinvocation_name; @@ -2918,9 +2920,9 @@ } memcpy (argv, new_argv, sizeof (Wexttext *) * argc); - xfree (new_argv, Wexttext **); - xfree (options, int *); - xfree (priority, int *); + xfree (new_argv); + xfree (options); + xfree (priority); } DEFUN ("running-temacs-p", Frunning_temacs_p, 0, 0, 0, /* @@ -3008,15 +3010,15 @@ run_temacs_argc = nargs + 1; run_temacs_argv = xnew_array (Wexttext *, nargs + 2); - LISP_STRING_TO_EXTERNAL_MALLOC (Fcar (Vcommand_line_args), - run_temacs_argv[0], - Qcommand_argument_encoding); + run_temacs_argv[0] = + LISP_STRING_TO_EXTERNAL_MALLOC (Fcar (Vcommand_line_args), + Qcommand_argument_encoding); for (i = 0; i < nargs; i++) { CHECK_STRING (args[i]); - LISP_STRING_TO_EXTERNAL_MALLOC (args[i], run_temacs_argv[i + 1], - Qcommand_argument_encoding); + run_temacs_argv[i + 1] = + LISP_STRING_TO_EXTERNAL_MALLOC (args[i], Qcommand_argument_encoding); } run_temacs_argv[nargs + 1] = 0; @@ -3293,10 +3295,10 @@ Extbyte *filename_ext; Extbyte *symfile_ext; - LISP_STRING_TO_EXTERNAL (filename, filename_ext, Qfile_name); + LISP_PATHNAME_CONVERT_OUT (filename, filename_ext); if (STRINGP (symfile)) - LISP_STRING_TO_EXTERNAL (symfile, symfile_ext, Qfile_name); + LISP_PATHNAME_CONVERT_OUT (symfile, symfile_ext); else symfile_ext = 0; @@ -4208,7 +4210,7 @@ DEFVAR_LISP ("system-configuration", &Vsystem_configuration /* String naming the configuration XEmacs was built for. */ ); - Vsystem_configuration = build_string (EMACS_CONFIGURATION); + Vsystem_configuration = build_ascstring (EMACS_CONFIGURATION); #ifndef EMACS_CONFIG_OPTIONS # define EMACS_CONFIG_OPTIONS "UNKNOWN" @@ -4216,7 +4218,7 @@ DEFVAR_LISP ("system-configuration-options", &Vsystem_configuration_options /* String containing the configuration options XEmacs was built with. */ ); - Vsystem_configuration_options = build_string (EMACS_CONFIG_OPTIONS); + Vsystem_configuration_options = build_ascstring (EMACS_CONFIG_OPTIONS); DEFVAR_LISP ("emacs-major-version", &Vemacs_major_version /* Major version number of this version of Emacs, as an integer. @@ -4282,7 +4284,7 @@ #ifndef XEMACS_CODENAME #define XEMACS_CODENAME "Noname" #endif - Vxemacs_codename = build_string (XEMACS_CODENAME); + Vxemacs_codename = build_ascstring (XEMACS_CODENAME); DEFVAR_LISP ("xemacs-extra-name", &Vxemacs_extra_name /* Arbitrary string to place in the version string after the codename. @@ -4295,7 +4297,7 @@ to indicate particular branches, etc. */ ); #ifdef XEMACS_EXTRA_NAME - Vxemacs_extra_name = build_string (XEMACS_EXTRA_NAME); + Vxemacs_extra_name = build_ascstring (XEMACS_EXTRA_NAME); #endif DEFVAR_LISP ("xemacs-release-date", &Vxemacs_release_date /* @@ -4307,7 +4309,7 @@ #ifndef XEMACS_RELEASE_DATE #define XEMACS_RELEASE_DATE "2005-02-18 (defaulted in emacs.c)" #endif - Vxemacs_release_date = build_string (XEMACS_RELEASE_DATE); + Vxemacs_release_date = build_ascstring (XEMACS_RELEASE_DATE); /* Lisp variables which contain command line flags. @@ -4476,14 +4478,14 @@ For example, this may be \"xemacs\" or \"infodock\". This is mainly meant for use in path searching. */ ); - Vemacs_program_name = build_ext_string (PATH_PROGNAME, Qfile_name); + Vemacs_program_name = build_extstring (PATH_PROGNAME, Qfile_name); DEFVAR_LISP ("emacs-program-version", &Vemacs_program_version /* *Version of the Emacs variant. This typically has the form NN.NN-bNN. This is mainly meant for use in path searching. */ ); - Vemacs_program_version = build_ext_string (PATH_VERSION, Qfile_name); + Vemacs_program_version = build_extstring (PATH_VERSION, Qfile_name); DEFVAR_LISP ("exec-path", &Vexec_path /* *List of directories to search programs to run in subprocesses. @@ -4503,7 +4505,7 @@ */ ); #ifdef PATH_EXEC Vconfigure_exec_directory = Ffile_name_as_directory - (build_ext_string (PATH_EXEC, Qfile_name)); + (build_extstring (PATH_EXEC, Qfile_name)); #else Vconfigure_exec_directory = Qnil; #endif @@ -4519,7 +4521,7 @@ */ ); #ifdef PATH_LOADSEARCH Vconfigure_lisp_directory = Ffile_name_as_directory - (build_ext_string (PATH_LOADSEARCH, Qfile_name)); + (build_extstring (PATH_LOADSEARCH, Qfile_name)); #else Vconfigure_lisp_directory = Qnil; #endif @@ -4535,7 +4537,7 @@ */ ); #ifdef PATH_MULELOADSEARCH Vconfigure_mule_lisp_directory = Ffile_name_as_directory - (build_ext_string (PATH_MULELOADSEARCH, Qfile_name); + (build_extstring (PATH_MULELOADSEARCH, Qfile_name); #else Vconfigure_mule_lisp_directory = Qnil; #endif @@ -4551,7 +4553,7 @@ */ ); #ifdef PATH_MODULESEARCH Vconfigure_module_directory = Ffile_name_as_directory - (build_ext_string (PATH_MODULESEARCH, Qfile_name)); + (build_extstring (PATH_MODULESEARCH, Qfile_name)); #else Vconfigure_module_directory = Qnil; #endif @@ -4611,7 +4613,7 @@ */ ); #ifdef PATH_DATA Vconfigure_data_directory = Ffile_name_as_directory - (build_ext_string (PATH_DATA, Qfile_name)); + (build_extstring (PATH_DATA, Qfile_name)); #else Vconfigure_data_directory = Qnil; #endif @@ -4633,7 +4635,7 @@ */ ); #ifdef PATH_SITE Vconfigure_site_directory = Ffile_name_as_directory - (build_ext_string (PATH_SITE, Qfile_name)); + (build_extstring (PATH_SITE, Qfile_name)); #else Vconfigure_site_directory = Qnil; #endif @@ -4649,7 +4651,7 @@ */ ); #ifdef PATH_SITE_MODULES Vconfigure_site_module_directory = Ffile_name_as_directory - (build_ext_string (PATH_SITE_MODULES, Qfile_name)); + (build_extstring (PATH_SITE_MODULES, Qfile_name)); #else Vconfigure_site_module_directory = Qnil; #endif @@ -4666,7 +4668,7 @@ */ ); #ifdef PATH_DOC Vconfigure_doc_directory = Ffile_name_as_directory - (build_ext_string (PATH_DOC, Qfile_name)); + (build_extstring (PATH_DOC, Qfile_name)); #else Vconfigure_doc_directory = Qnil; #endif @@ -4677,7 +4679,7 @@ */ ); #ifdef PATH_EXEC_PREFIX Vconfigure_exec_prefix_directory = Ffile_name_as_directory - (build_ext_string (PATH_EXEC_PREFIX, Qfile_name)); + (build_extstring (PATH_EXEC_PREFIX, Qfile_name)); #else Vconfigure_exec_prefix_directory = Qnil; #endif @@ -4688,7 +4690,7 @@ */ ); #ifdef PATH_PREFIX Vconfigure_prefix_directory = Ffile_name_as_directory - (build_ext_string (PATH_PREFIX, Qfile_name)); + (build_extstring (PATH_PREFIX, Qfile_name)); #else Vconfigure_prefix_directory = Qnil; #endif @@ -4701,7 +4703,7 @@ */ ); #ifdef PATH_INFO Vconfigure_info_directory = - Ffile_name_as_directory (build_ext_string (PATH_INFO, Qfile_name)); + Ffile_name_as_directory (build_extstring (PATH_INFO, Qfile_name)); #else Vconfigure_info_directory = Qnil; #endif diff -r d2ec55325515 -r 8f0cf4fd3d2c src/emodules.c --- a/src/emodules.c Sat Feb 06 03:59:18 2010 -0600 +++ b/src/emodules.c Sat Feb 06 04:01:46 2010 -0600 @@ -1,5 +1,6 @@ /* emodules.c - Support routines for dynamic module loading (C) Copyright 1998, 1999 J. Kean Johnston. All rights reserved. +(C) Copyright 2010 Ben Wing. This file is part of XEmacs. @@ -18,6 +19,8 @@ the Free Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ +/* This file has been Mule-ized, Ben Wing, 1-26-10. */ + #include "emodules.h" #include "sysdll.h" #ifdef HAVE_LTDL @@ -48,11 +51,11 @@ typedef struct _emodules_list { int used; /* Is this slot used? */ - CIbyte *soname; /* Name of the shared object loaded (full path) */ - CIbyte *modname; /* The name of the module */ - CIbyte *modver; /* The module version string */ - CIbyte *modtitle; /* How the module announces itself */ - void (*unload)(void); /* Module cleanup function to run before unloading */ + Ibyte *soname; /* Name of the shared object loaded (full path) */ + Ibyte *modname; /* The name of the module */ + Ibyte *modver; /* The module version string */ + Ibyte *modtitle; /* How the module announces itself */ + void (*unload) (void);/* Module cleanup function to run before unloading */ dll_handle dlhandle; /* Dynamic lib handle */ } emodules_list; @@ -61,8 +64,8 @@ static emodules_list *modules; static int modnum; -static int find_make_module (const CIbyte *mod, const CIbyte *name, - const CIbyte *ver, int make_or_find); +static int find_make_module (Lisp_Object mod, const Ibyte *name, + const Ibyte *ver, int make_or_find); static Lisp_Object module_load_unwind (Lisp_Object); static void attempt_module_delete (int mod); @@ -96,22 +99,22 @@ */ (file, name, version)) { - const CIbyte *mod, *mname, *mver; + const Ibyte *mod, *mname, *mver; int speccount = specpdl_depth(); - CHECK_STRING(file); + CHECK_STRING (file); - mod = (CIbyte *) XSTRING_DATA (file); + mod = XSTRING_DATA (file); if (NILP (name)) - mname = ""; + mname = (const Ibyte *) ""; else - mname = (CIbyte *) XSTRING_DATA (name); + mname = XSTRING_DATA (name); if (NILP (version)) - mver = ""; + mver = (const Ibyte *) ""; else - mver = (CIbyte *) XSTRING_DATA (version); + mver = XSTRING_DATA (version); dlhandle = 0; record_unwind_protect (module_load_unwind, make_int(modnum)); @@ -136,7 +139,7 @@ (file, name, version)) { int x; - const CIbyte *mod, *mname, *mver; + const Ibyte *mname, *mver; Lisp_Object foundname = Qnil; struct gcpro gcpro1; @@ -146,20 +149,19 @@ if (locate_file (Vmodule_load_path, file, Vmodule_extensions, &foundname, 0) < 0) return Qt; - mod = (CIbyte *) XSTRING_DATA (foundname); UNGCPRO; if (NILP (name)) - mname = ""; + mname = (const Ibyte *) ""; else - mname = (CIbyte *) XSTRING_DATA (name); + mname = XSTRING_DATA (name); if (NILP (version)) - mver = ""; + mver = (const Ibyte *) ""; else - mver = (CIbyte *) XSTRING_DATA (version); + mver = XSTRING_DATA (version); - x = find_make_module (mod, mname, mver, 1); + x = find_make_module (foundname, mname, mver, 1); if (x != -1) { if (modules[x].unload != NULL) @@ -199,30 +201,31 @@ for (i = 0; i < modnum; i++) { if (modules[i].used == 1) - mlist = Fcons (list4 (build_string (modules[i].soname), - build_string (modules[i].modname), - build_string (modules[i].modver), - build_string (modules[i].modtitle)), mlist); + mlist = Fcons (list4 (build_istring (modules[i].soname), + build_istring (modules[i].modname), + build_istring (modules[i].modver), + build_istring (modules[i].modtitle)), mlist); } return mlist; } static int -find_make_module (const CIbyte *mod, const CIbyte *name, const CIbyte *ver, +find_make_module (Lisp_Object mod, const Ibyte *name, const Ibyte *ver, int mof) { int i, fs = -1; + Ibyte *modstr = XSTRING_DATA (mod); for (i = 0; i < modnum; i++) { if (fs == -1 && modules[i].used == 0) fs = i; - if (strcmp (modules[i].soname, mod) == 0) + if (qxestrcmp (modules[i].soname, modstr) == 0) { - if (name && name[0] && strcmp (modules[i].modname, name)) + if (name && name[0] && qxestrcmp (modules[i].modname, name)) continue; - if (ver && ver[0] && strcmp (modules[i].modver, ver)) + if (ver && ver[0] && qxestrcmp (modules[i].modver, ver)) continue; return i; /* Found a match */ } @@ -253,10 +256,10 @@ { if (dll_close (modules[mod].dlhandle) == 0) { - xfree (modules[mod].soname, CIbyte *); - xfree (modules[mod].modname, CIbyte *); - xfree (modules[mod].modver, CIbyte *); - xfree (modules[mod].modtitle, CIbyte *); + xfree (modules[mod].soname); + xfree (modules[mod].modname); + xfree (modules[mod].modver); + xfree (modules[mod].modtitle); modules[mod].dlhandle = 0; modules[mod].used = 0; } @@ -330,18 +333,16 @@ * the cleaning up. */ void -emodules_load (const CIbyte *module, const CIbyte *modname, - const CIbyte *modver) +emodules_load (const Ibyte *module, const Ibyte *modname, + const Ibyte *modver) { - /* !!#### Needs serious work */ Lisp_Object old_load_list; Lisp_Object filename; Lisp_Object foundname, lisp_modname; int x, mpx; - CIbyte *soname; - const CIbyte **f; + const Extbyte **f; const long *ellcc_rev; - CIbyte *mver, *mname, *mtitle, *symname; + Ibyte *mver, *mname, *mtitle, *symname; void (*modload)(void) = 0; void (*modsyms)(void) = 0; void (*modvars)(void) = 0; @@ -359,13 +360,12 @@ if (module == NULL || module[0] == '\0') invalid_argument ("Empty module name", Qunbound); - GCPRO4(filename, foundname, old_load_list, lisp_modname); - filename = build_string (module); + GCPRO4 (filename, foundname, old_load_list, lisp_modname); + filename = build_istring (module); if (locate_file (Vmodule_load_path, filename, Vmodule_extensions, &foundname, 0) < 0) signal_error (Qdll_error, "Cannot open dynamic module", filename); - LISP_STRING_TO_EXTERNAL (foundname, soname, Qfile_name); lisp_modname = call1 (Qfile_name_sans_extension, Ffile_name_nondirectory (foundname)); @@ -375,76 +375,87 @@ signal_error (Qdll_error, "Opening dynamic module", dll_error ()); } - ellcc_rev = (const long *)dll_variable (dlhandle, "emodule_compiler"); + ellcc_rev = (const long *) dll_variable (dlhandle, + (const Ibyte *) "emodule_compiler"); if (ellcc_rev == NULL || *ellcc_rev <= 0L) signal_error (Qdll_error, "Invalid dynamic module: Missing symbol `emodule_compiler'", Qunbound); if (*ellcc_rev > EMODULES_REVISION) signal_ferror (Qdll_error, "Invalid dynamic module: Unsupported version `%ld(%ld)'", *ellcc_rev, EMODULES_REVISION); - f = (const CIbyte **) dll_variable (dlhandle, "emodule_name"); + f = (const Extbyte **) dll_variable (dlhandle, + (const Ibyte *) "emodule_name"); if (f == NULL || *f == NULL) signal_error (Qdll_error, "Invalid dynamic module: Missing symbol `emodule_name'", Qunbound); - mname = (CIbyte *) ALLOCA (strlen (*f) + 1); - strcpy (mname, *f); + mname = EXTERNAL_TO_ITEXT (f, Qemodule_string_encoding); + /* #### Not obvious we have to force an alloca copy here, but the old + code did so */ + IBYTE_STRING_TO_ALLOCA (mname, mname); + if (mname[0] == '\0') signal_error (Qdll_error, "Invalid dynamic module: Empty value for `emodule_name'", Qunbound); - f = (const CIbyte **) dll_variable (dlhandle, "emodule_version"); + f = (const Extbyte **) dll_variable (dlhandle, + (const Ibyte *) "emodule_version"); if (f == NULL || *f == NULL) signal_error (Qdll_error, "Missing symbol `emodule_version': Invalid dynamic module", Qunbound); - mver = (CIbyte *) ALLOCA (strlen (*f) + 1); - strcpy (mver, *f); + mver = EXTERNAL_TO_ITEXT (f, Qemodule_string_encoding); + /* #### Not obvious we have to force an alloca copy here, but the old + code did so */ + IBYTE_STRING_TO_ALLOCA (mver, mver); - f = (const CIbyte **) dll_variable (dlhandle, "emodule_title"); + f = (const Extbyte **) dll_variable (dlhandle, + (const Ibyte *) "emodule_title"); if (f == NULL || *f == NULL) signal_error (Qdll_error, "Invalid dynamic module: Missing symbol `emodule_title'", Qunbound); - mtitle = (CIbyte *) ALLOCA (strlen (*f) + 1); - strcpy (mtitle, *f); + mtitle = EXTERNAL_TO_ITEXT (f, Qemodule_string_encoding); + /* #### Not obvious we have to force an alloca copy here, but the old + code did so */ + IBYTE_STRING_TO_ALLOCA (mtitle, mtitle); - symname = (CIbyte *) ALLOCA (strlen (mname) + 15); + symname = alloca_ibytes (qxestrlen (mname) + 15); - strcpy (symname, "modules_of_"); - strcat (symname, mname); - modload = (void (*)(void))dll_function (dlhandle, symname); + qxestrcpy_ascii (symname, "modules_of_"); + qxestrcat (symname, mname); + modload = (void (*)(void)) dll_function (dlhandle, symname); /* * modload is optional. If the module doesn't require other modules it can * be left out. */ - strcpy (symname, "syms_of_"); - strcat (symname, mname); - modsyms = (void (*)(void))dll_function (dlhandle, symname); + qxestrcpy_ascii (symname, "syms_of_"); + qxestrcat (symname, mname); + modsyms = (void (*)(void)) dll_function (dlhandle, symname); if (modsyms == NULL) { missing_symbol: signal_error (Qdll_error, "Invalid dynamic module: Missing symbol", - build_string (symname)); + build_istring (symname)); } - strcpy (symname, "vars_of_"); - strcat (symname, mname); - modvars = (void (*)(void))dll_function (dlhandle, symname); + qxestrcpy_ascii (symname, "vars_of_"); + qxestrcat (symname, mname); + modvars = (void (*)(void)) dll_function (dlhandle, symname); if (modvars == NULL) goto missing_symbol; - strcpy (symname, "docs_of_"); - strcat (symname, mname); - moddocs = (void (*)(void))dll_function (dlhandle, symname); + qxestrcpy_ascii (symname, "docs_of_"); + qxestrcat (symname, mname); + moddocs = (void (*)(void)) dll_function (dlhandle, symname); if (moddocs == NULL) goto missing_symbol; /* Now look for the optional unload function. */ - strcpy (symname, "unload_"); - strcat (symname, mname); - modunld = (void (*)(void))dll_function (dlhandle, symname); + qxestrcpy_ascii (symname, "unload_"); + qxestrcat (symname, mname); + modunld = (void (*)(void)) dll_function (dlhandle, symname); - if (modname && modname[0] && strcmp (modname, mname)) + if (modname && modname[0] && qxestrcmp (modname, mname)) signal_error (Qdll_error, "Module name mismatch", Qunbound); - if (modver && modver[0] && strcmp (modver, mver)) + if (modver && modver[0] && qxestrcmp (modver, mver)) signal_error (Qdll_error, "Module version mismatch", Qunbound); /* @@ -453,7 +464,7 @@ * If that is non-zero, we know that we have a previously loaded module * of the same name and version, and we don't need to go any further. */ - mpx = find_make_module (soname, mname, mver, 0); + mpx = find_make_module (foundname, mname, mver, 0); mp = &modules[mpx]; if (mp->used > 0) { @@ -471,10 +482,10 @@ * module to the list of modules. */ mp->used = emodules_depth + 1; - mp->soname = xstrdup (soname); - mp->modname = xstrdup (mname); - mp->modver = xstrdup (mver); - mp->modtitle = xstrdup (mtitle); + mp->soname = qxestrdup (XSTRING_DATA (foundname)); + mp->modname = qxestrdup (mname); + mp->modver = qxestrdup (mver); + mp->modtitle = qxestrdup (mtitle); mp->dlhandle = dlhandle; mp->unload = modunld; dlhandle = 0; @@ -489,15 +500,15 @@ * startup tasks. */ if (modload != 0) - (*modload)(); + (*modload) (); /* * Now we can get the module to initialize its symbols, and then its * variables, and lastly the documentation strings. */ - (*modsyms)(); - (*modvars)(); - (*moddocs)(); + (*modsyms) (); + (*modvars) (); + (*moddocs) (); if (!load_modules_quietly) message ("Loaded module %s v%s (%s)", mname, mver, mtitle); @@ -521,12 +532,23 @@ } void -emodules_doc_subr(const char *symname, const char *doc) +emodules_doc_subr (const Ascbyte *symname, const Ascbyte *doc) { - Bytecount len = strlen (symname); - Lisp_Object sym = oblookup (Vobarray, (const Ibyte *)symname, len); + Bytecount len; + Lisp_Object sym; Lisp_Subr *subr; + ASSERT_ASCTEXT_ASCII (symname); + len = strlen (symname); + sym = oblookup (Vobarray, (const Ibyte *) symname, len); + + /* We do this assert to avoid the possibility of externally formatted + text ending up in the doc string, where it could cause crashes. + It you need to have a non-ASCII doc string, create another version + emodules_doc_subr_istring() that accepts an Ibyte * and doesn't + assert, or create an emodules_doc_subr_extstring() that takes + an externally_formatted string and a coding system name. */ + ASSERT_ASCTEXT_ASCII (doc); /* Skip autoload cookies */ if (SYMBOLP (sym) && SUBRP (XSYMBOL (sym)->function)) { @@ -534,7 +556,7 @@ subr->doc = xstrdup (doc); } /* - * FIXME: I wish there was some way to avoid the xstrdup(). Is it + * #### FIXME: I wish there was some way to avoid the xstrdup(). Is it * possible to just set a pointer to the string, or somehow create a * symbol whose value we can point to the constant string? Can someone * look into this? @@ -542,17 +564,24 @@ } void -emodules_doc_sym (const char *symname, const char *doc) +emodules_doc_sym (const Ascbyte *symname, const Ascbyte *doc) { - Bytecount len = strlen (symname); - Lisp_Object sym = oblookup (Vobarray, (const Ibyte *)symname, len); + Bytecount len; + Lisp_Object sym; Lisp_Object docstr; struct gcpro gcpro1; - if (SYMBOLP(sym)) + ASSERT_ASCTEXT_ASCII (symname); + len = strlen (symname); + sym = oblookup (Vobarray, (const Ibyte *) symname, len); + + /* See comments above in emodules_doc_subr() about why we assert like + this. */ + ASSERT_ASCTEXT_ASCII (doc); + if (SYMBOLP (sym)) { - docstr = build_string (doc); - GCPRO1(docstr); + docstr = build_ascstring (doc); + GCPRO1 (docstr); Fput (sym, Qvariable_documentation, docstr); UNGCPRO; } @@ -565,9 +594,9 @@ DEFERROR_STANDARD (Qdll_error, Qerror); DEFSYMBOL (Qmodule); DEFSYMBOL (Qunload_module); - DEFSUBR(Fload_module); - DEFSUBR(Flist_modules); - DEFSUBR(Funload_module); + DEFSUBR (Fload_module); + DEFSUBR (Flist_modules); + DEFSUBR (Funload_module); module_tag = Fcons (Qmodule, Qnil); staticpro (&module_tag); Fput (Qunload_module, Qdisabled, Qt); @@ -605,7 +634,7 @@ the dynamic loading technology used in Emacs, if required. It is not a given that this value will be the same as the Emacs version number. */ ); - Vmodule_version = build_string (EMODULES_VERSION); + Vmodule_version = build_cistring (EMODULES_VERSION); DEFVAR_BOOL ("load-modules-quietly", &load_modules_quietly /* *Set to t if module loading is to be silent. @@ -651,9 +680,9 @@ DEFVAR_LISP ("module-extensions", &Vmodule_extensions /* *List of filename extensions to use when searching for dynamic modules. */); - Vmodule_extensions = list5 (build_string (".ell"), - build_string (".so"), - build_string (".dll"), - build_string (".dylib"), - build_string ("")); + Vmodule_extensions = list5 (build_ascstring (".ell"), + build_ascstring (".so"), + build_ascstring (".dll"), + build_ascstring (".dylib"), + build_ascstring ("")); } diff -r d2ec55325515 -r 8f0cf4fd3d2c src/emodules.h --- a/src/emodules.h Sat Feb 06 03:59:18 2010 -0600 +++ b/src/emodules.h Sat Feb 06 04:01:46 2010 -0600 @@ -59,7 +59,8 @@ * specified version before. We also use these as checks when we open the * module to make sure we have the right module. */ -extern void emodules_load (const char *module, const char *name, const char *version); +extern void emodules_load (const Ibyte *module, const Ibyte *modname, + const Ibyte *modver); /* * Because subrs and symbols added by a dynamic module are not part of @@ -70,10 +71,10 @@ * into the right place. These functions will be called by the module * init code, generated by ellcc during initialization mode. */ -EXTERN_C MODULE_API void emodules_doc_subr (const char *objname, - const char *docstr); -EXTERN_C MODULE_API void emodules_doc_sym (const char *objname, - const char *docstr); +EXTERN_C MODULE_API void emodules_doc_subr (const Ascbyte *objname, + const Ascbyte *docstr); +EXTERN_C MODULE_API void emodules_doc_sym (const Ascbyte *objname, + const Ascbyte *docstr); #define CDOCSUBR(Fname, DOC) emodules_doc_subr (Fname, DOC) #define CDOCSYM(Sname, DOC) emodules_doc_sym (Sname, DOC) diff -r d2ec55325515 -r 8f0cf4fd3d2c src/eval.c --- a/src/eval.c Sat Feb 06 03:59:18 2010 -0600 +++ b/src/eval.c Sat Feb 06 04:01:46 2010 -0600 @@ -1,7 +1,7 @@ /* Evaluator for XEmacs Lisp interpreter. Copyright (C) 1985-1987, 1992-1994 Free Software Foundation, Inc. Copyright (C) 1995 Sun Microsystems, Inc. - Copyright (C) 2000, 2001, 2002, 2003, 2004 Ben Wing. + Copyright (C) 2000, 2001, 2002, 2003, 2004, 2010 Ben Wing. This file is part of XEmacs. @@ -426,17 +426,17 @@ print_subr (Lisp_Object obj, Lisp_Object printcharfun, int UNUSED (escapeflag)) { Lisp_Subr *subr = XSUBR (obj); - const CIbyte *header = + const Ascbyte *header = (subr->max_args == UNEVALLED) ? "#prompt ? " (interactive)>" : ">"; + const Ascbyte *name = subr_name (subr); + const Ascbyte *trailer = subr->prompt ? " (interactive)>" : ">"; if (print_readably) printing_unreadable_object ("%s%s%s", header, name, trailer); - write_c_string (printcharfun, header); - write_c_string (printcharfun, name); - write_c_string (printcharfun, trailer); + write_ascstring (printcharfun, header); + write_ascstring (printcharfun, name); + write_ascstring (printcharfun, trailer); } static const struct memory_description subr_description[] = { @@ -738,7 +738,7 @@ specbind (Qstack_trace_on_signal, Qnil); if (!noninteractive) - internal_with_output_to_temp_buffer (build_string ("*Backtrace*"), + internal_with_output_to_temp_buffer (build_ascstring ("*Backtrace*"), backtrace_259, Qnil, Qnil); @@ -780,7 +780,7 @@ specbind (Qstack_trace_on_signal, Qnil); if (!noninteractive) - internal_with_output_to_temp_buffer (build_string ("*Backtrace*"), + internal_with_output_to_temp_buffer (build_ascstring ("*Backtrace*"), backtrace_259, Qnil, Qnil); @@ -2610,8 +2610,7 @@ else if (ERRB_EQ (errb, ERROR_ME_WARN)) warn_when_safe_lispobj (class_, Qwarning, Fcons (sig, data)); else - for (;;) - Fsignal (sig, data); + signal_error_1 (sig, data); } /* Signal a continuable error or display a warning or do nothing, @@ -2654,7 +2653,7 @@ to signal_error_1(). */ Lisp_Object -build_error_data (const CIbyte *reason, Lisp_Object frob) +build_error_data (const Ascbyte *reason, Lisp_Object frob) { if (EQ (frob, Qunbound)) frob = Qnil; @@ -2669,13 +2668,20 @@ } DOESNT_RETURN -signal_error (Lisp_Object type, const CIbyte *reason, Lisp_Object frob) +signal_error (Lisp_Object type, const Ascbyte *reason, Lisp_Object frob) { signal_error_1 (type, build_error_data (reason, frob)); } +/* NOTE NOTE NOTE: If you feel you need signal_ierror() or something + similar when reason is a non-ASCII message, you're probably doing + something wrong. When you have an error message from an external + source, you should put the error message as the first item in FROB and + put a string in REASON indicating what you were doing when the error + message occurred. Use signal_error_2() for such a case. */ + void -maybe_signal_error (Lisp_Object type, const CIbyte *reason, +maybe_signal_error (Lisp_Object type, const Ascbyte *reason, Lisp_Object frob, Lisp_Object class_, Error_Behavior errb) { @@ -2686,14 +2692,14 @@ } Lisp_Object -signal_continuable_error (Lisp_Object type, const CIbyte *reason, +signal_continuable_error (Lisp_Object type, const Ascbyte *reason, Lisp_Object frob) { return Fsignal (type, build_error_data (reason, frob)); } Lisp_Object -maybe_signal_continuable_error (Lisp_Object type, const CIbyte *reason, +maybe_signal_continuable_error (Lisp_Object type, const Ascbyte *reason, Lisp_Object frob, Lisp_Object class_, Error_Behavior errb) { @@ -2715,7 +2721,7 @@ but these are more convenient in this particular case.) */ DOESNT_RETURN -signal_error_2 (Lisp_Object type, const CIbyte *reason, +signal_error_2 (Lisp_Object type, const Ascbyte *reason, Lisp_Object frob0, Lisp_Object frob1) { signal_error_1 (type, list3 (build_msg_string (reason), frob0, @@ -2723,7 +2729,7 @@ } void -maybe_signal_error_2 (Lisp_Object type, const CIbyte *reason, +maybe_signal_error_2 (Lisp_Object type, const Ascbyte *reason, Lisp_Object frob0, Lisp_Object frob1, Lisp_Object class_, Error_Behavior errb) { @@ -2735,7 +2741,7 @@ } Lisp_Object -signal_continuable_error_2 (Lisp_Object type, const CIbyte *reason, +signal_continuable_error_2 (Lisp_Object type, const Ascbyte *reason, Lisp_Object frob0, Lisp_Object frob1) { return Fsignal (type, list3 (build_msg_string (reason), frob0, @@ -2743,7 +2749,7 @@ } Lisp_Object -maybe_signal_continuable_error_2 (Lisp_Object type, const CIbyte *reason, +maybe_signal_continuable_error_2 (Lisp_Object type, const Ascbyte *reason, Lisp_Object frob0, Lisp_Object frob1, Lisp_Object class_, Error_Behavior errb) { @@ -2763,13 +2769,13 @@ is a single string, created using the arguments. */ DOESNT_RETURN -signal_ferror (Lisp_Object type, const CIbyte *fmt, ...) +signal_ferror (Lisp_Object type, const Ascbyte *fmt, ...) { Lisp_Object obj; va_list args; va_start (args, fmt); - obj = emacs_vsprintf_string (CGETTEXT (fmt), args); + obj = emacs_vsprintf_string (GETTEXT (fmt), args); va_end (args); /* Fsignal GC-protects its args */ @@ -2778,7 +2784,7 @@ void maybe_signal_ferror (Lisp_Object type, Lisp_Object class_, Error_Behavior errb, - const CIbyte *fmt, ...) + const Ascbyte *fmt, ...) { Lisp_Object obj; va_list args; @@ -2788,7 +2794,7 @@ return; va_start (args, fmt); - obj = emacs_vsprintf_string (CGETTEXT (fmt), args); + obj = emacs_vsprintf_string (GETTEXT (fmt), args); va_end (args); /* Fsignal GC-protects its args */ @@ -2796,13 +2802,13 @@ } Lisp_Object -signal_continuable_ferror (Lisp_Object type, const CIbyte *fmt, ...) +signal_continuable_ferror (Lisp_Object type, const Ascbyte *fmt, ...) { Lisp_Object obj; va_list args; va_start (args, fmt); - obj = emacs_vsprintf_string (CGETTEXT (fmt), args); + obj = emacs_vsprintf_string (GETTEXT (fmt), args); va_end (args); /* Fsignal GC-protects its args */ @@ -2811,7 +2817,7 @@ Lisp_Object maybe_signal_continuable_ferror (Lisp_Object type, Lisp_Object class_, - Error_Behavior errb, const CIbyte *fmt, ...) + Error_Behavior errb, const Ascbyte *fmt, ...) { Lisp_Object obj; va_list args; @@ -2821,7 +2827,7 @@ return Qnil; va_start (args, fmt); - obj = emacs_vsprintf_string (CGETTEXT (fmt), args); + obj = emacs_vsprintf_string (GETTEXT (fmt), args); va_end (args); /* Fsignal GC-protects its args */ @@ -2844,14 +2850,14 @@ */ DOESNT_RETURN -signal_ferror_with_frob (Lisp_Object type, Lisp_Object frob, const CIbyte *fmt, +signal_ferror_with_frob (Lisp_Object type, Lisp_Object frob, const Ascbyte *fmt, ...) { Lisp_Object obj; va_list args; va_start (args, fmt); - obj = emacs_vsprintf_string (CGETTEXT (fmt), args); + obj = emacs_vsprintf_string (GETTEXT (fmt), args); va_end (args); /* Fsignal GC-protects its args */ @@ -2861,7 +2867,7 @@ void maybe_signal_ferror_with_frob (Lisp_Object type, Lisp_Object frob, Lisp_Object class_, Error_Behavior errb, - const CIbyte *fmt, ...) + const Ascbyte *fmt, ...) { Lisp_Object obj; va_list args; @@ -2871,7 +2877,7 @@ return; va_start (args, fmt); - obj = emacs_vsprintf_string (CGETTEXT (fmt), args); + obj = emacs_vsprintf_string (GETTEXT (fmt), args); va_end (args); /* Fsignal GC-protects its args */ @@ -2881,13 +2887,13 @@ Lisp_Object signal_continuable_ferror_with_frob (Lisp_Object type, Lisp_Object frob, - const CIbyte *fmt, ...) + const Ascbyte *fmt, ...) { Lisp_Object obj; va_list args; va_start (args, fmt); - obj = emacs_vsprintf_string (CGETTEXT (fmt), args); + obj = emacs_vsprintf_string (GETTEXT (fmt), args); va_end (args); /* Fsignal GC-protects its args */ @@ -2898,7 +2904,7 @@ maybe_signal_continuable_ferror_with_frob (Lisp_Object type, Lisp_Object frob, Lisp_Object class_, Error_Behavior errb, - const CIbyte *fmt, ...) + const Ascbyte *fmt, ...) { Lisp_Object obj; va_list args; @@ -2908,7 +2914,7 @@ return Qnil; va_start (args, fmt); - obj = emacs_vsprintf_string (CGETTEXT (fmt), args); + obj = emacs_vsprintf_string (GETTEXT (fmt), args); va_end (args); /* Fsignal GC-protects its args */ @@ -2987,155 +2993,155 @@ /* Called from within emacs_doprnt_1, so REASON is not formatted. */ DOESNT_RETURN -syntax_error (const CIbyte *reason, Lisp_Object frob) +syntax_error (const Ascbyte *reason, Lisp_Object frob) { signal_error (Qsyntax_error, reason, frob); } DOESNT_RETURN -syntax_error_2 (const CIbyte *reason, Lisp_Object frob1, Lisp_Object frob2) +syntax_error_2 (const Ascbyte *reason, Lisp_Object frob1, Lisp_Object frob2) { signal_error_2 (Qsyntax_error, reason, frob1, frob2); } void -maybe_syntax_error (const CIbyte *reason, Lisp_Object frob, +maybe_syntax_error (const Ascbyte *reason, Lisp_Object frob, Lisp_Object class_, Error_Behavior errb) { maybe_signal_error (Qsyntax_error, reason, frob, class_, errb); } DOESNT_RETURN -sferror (const CIbyte *reason, Lisp_Object frob) +sferror (const Ascbyte *reason, Lisp_Object frob) { signal_error (Qstructure_formation_error, reason, frob); } DOESNT_RETURN -sferror_2 (const CIbyte *reason, Lisp_Object frob1, Lisp_Object frob2) +sferror_2 (const Ascbyte *reason, Lisp_Object frob1, Lisp_Object frob2) { signal_error_2 (Qstructure_formation_error, reason, frob1, frob2); } void -maybe_sferror (const CIbyte *reason, Lisp_Object frob, +maybe_sferror (const Ascbyte *reason, Lisp_Object frob, Lisp_Object class_, Error_Behavior errb) { maybe_signal_error (Qstructure_formation_error, reason, frob, class_, errb); } DOESNT_RETURN -invalid_argument (const CIbyte *reason, Lisp_Object frob) +invalid_argument (const Ascbyte *reason, Lisp_Object frob) { signal_error (Qinvalid_argument, reason, frob); } DOESNT_RETURN -invalid_argument_2 (const CIbyte *reason, Lisp_Object frob1, +invalid_argument_2 (const Ascbyte *reason, Lisp_Object frob1, Lisp_Object frob2) { signal_error_2 (Qinvalid_argument, reason, frob1, frob2); } void -maybe_invalid_argument (const CIbyte *reason, Lisp_Object frob, +maybe_invalid_argument (const Ascbyte *reason, Lisp_Object frob, Lisp_Object class_, Error_Behavior errb) { maybe_signal_error (Qinvalid_argument, reason, frob, class_, errb); } DOESNT_RETURN -invalid_constant (const CIbyte *reason, Lisp_Object frob) +invalid_constant (const Ascbyte *reason, Lisp_Object frob) { signal_error (Qinvalid_constant, reason, frob); } DOESNT_RETURN -invalid_constant_2 (const CIbyte *reason, Lisp_Object frob1, +invalid_constant_2 (const Ascbyte *reason, Lisp_Object frob1, Lisp_Object frob2) { signal_error_2 (Qinvalid_constant, reason, frob1, frob2); } void -maybe_invalid_constant (const CIbyte *reason, Lisp_Object frob, +maybe_invalid_constant (const Ascbyte *reason, Lisp_Object frob, Lisp_Object class_, Error_Behavior errb) { maybe_signal_error (Qinvalid_constant, reason, frob, class_, errb); } DOESNT_RETURN -invalid_operation (const CIbyte *reason, Lisp_Object frob) +invalid_operation (const Ascbyte *reason, Lisp_Object frob) { signal_error (Qinvalid_operation, reason, frob); } DOESNT_RETURN -invalid_operation_2 (const CIbyte *reason, Lisp_Object frob1, +invalid_operation_2 (const Ascbyte *reason, Lisp_Object frob1, Lisp_Object frob2) { signal_error_2 (Qinvalid_operation, reason, frob1, frob2); } void -maybe_invalid_operation (const CIbyte *reason, Lisp_Object frob, +maybe_invalid_operation (const Ascbyte *reason, Lisp_Object frob, Lisp_Object class_, Error_Behavior errb) { maybe_signal_error (Qinvalid_operation, reason, frob, class_, errb); } DOESNT_RETURN -invalid_change (const CIbyte *reason, Lisp_Object frob) +invalid_change (const Ascbyte *reason, Lisp_Object frob) { signal_error (Qinvalid_change, reason, frob); } DOESNT_RETURN -invalid_change_2 (const CIbyte *reason, Lisp_Object frob1, Lisp_Object frob2) +invalid_change_2 (const Ascbyte *reason, Lisp_Object frob1, Lisp_Object frob2) { signal_error_2 (Qinvalid_change, reason, frob1, frob2); } void -maybe_invalid_change (const CIbyte *reason, Lisp_Object frob, +maybe_invalid_change (const Ascbyte *reason, Lisp_Object frob, Lisp_Object class_, Error_Behavior errb) { maybe_signal_error (Qinvalid_change, reason, frob, class_, errb); } DOESNT_RETURN -invalid_state (const CIbyte *reason, Lisp_Object frob) +invalid_state (const Ascbyte *reason, Lisp_Object frob) { signal_error (Qinvalid_state, reason, frob); } DOESNT_RETURN -invalid_state_2 (const CIbyte *reason, Lisp_Object frob1, Lisp_Object frob2) +invalid_state_2 (const Ascbyte *reason, Lisp_Object frob1, Lisp_Object frob2) { signal_error_2 (Qinvalid_state, reason, frob1, frob2); } void -maybe_invalid_state (const CIbyte *reason, Lisp_Object frob, +maybe_invalid_state (const Ascbyte *reason, Lisp_Object frob, Lisp_Object class_, Error_Behavior errb) { maybe_signal_error (Qinvalid_state, reason, frob, class_, errb); } DOESNT_RETURN -wtaerror (const CIbyte *reason, Lisp_Object frob) +wtaerror (const Ascbyte *reason, Lisp_Object frob) { signal_error (Qwrong_type_argument, reason, frob); } DOESNT_RETURN -stack_overflow (const CIbyte *reason, Lisp_Object frob) +stack_overflow (const Ascbyte *reason, Lisp_Object frob) { signal_error (Qstack_overflow, reason, frob); } DOESNT_RETURN -out_of_memory (const CIbyte *reason, Lisp_Object frob) +out_of_memory (const Ascbyte *reason, Lisp_Object frob) { signal_error (Qout_of_memory, reason, frob); } @@ -3620,6 +3626,10 @@ { Lisp_Object value = execute_optimized_program ((Opbyte *) XOPAQUE_DATA (f->instructions), +#ifdef ERROR_CHECK_BYTE_CODE + XOPAQUE_SIZE (f->instructions) / + sizeof (Opbyte), +#endif f->stack_depth, XVECTOR_DATA (f->constants)); @@ -4572,7 +4582,7 @@ if (0 == count) { - write_c_string (printcharfun, "#"); + write_msg_string (printcharfun, "#"); } for (index = 0; index < count;) @@ -4594,7 +4604,7 @@ if (count > 1 && index < count) { - write_c_string (printcharfun, " ;\n"); + write_ascstring (printcharfun, " ;\n"); } } } @@ -5713,7 +5723,7 @@ ("%s: Attempt to throw outside of function:" "To catch `%s' with value `%s'\n\nBacktrace follows:\n\n%s", Qnil, 4, - build_msg_string (warning_string ? warning_string : "error"), + build_msg_cistring (warning_string ? warning_string : "error"), p->thrown_tag, p->thrown_value, p->backtrace); warn_when_safe_lispobj (Qerror, current_warning_level (), errstr); } @@ -5728,7 +5738,7 @@ emacs_sprintf_string_lisp ("%s: (%s %s)\n\nBacktrace follows:\n\n%s", Qnil, 4, - build_msg_string (warning_string ? warning_string : "error"), + build_msg_cistring (warning_string ? warning_string : "error"), p->error_conditions, p->data, p->backtrace); warn_when_safe_lispobj (warning_class, current_warning_level (), @@ -6799,7 +6809,7 @@ static Lisp_Object free_pointer (Lisp_Object opaque) { - xfree (get_opaque_ptr (opaque), void *); + xfree (get_opaque_ptr (opaque)); free_opaque_ptr (opaque); return Qnil; } @@ -7000,18 +7010,18 @@ || specpdl[speccount - 1].func == specbind_unwind_local || specpdl[speccount - 1].func == specbind_unwind_wasnt_local) { - write_c_string (stream, !printing_bindings ? " # bind (" : " "); + write_ascstring (stream, !printing_bindings ? " # bind (" : " "); Fprin1 (specpdl[speccount - 1].symbol, stream); printing_bindings = 1; } else { - if (printing_bindings) write_c_string (stream, ")\n"); - write_c_string (stream, " # (unwind-protect ...)\n"); + if (printing_bindings) write_ascstring (stream, ")\n"); + write_ascstring (stream, " # (unwind-protect ...)\n"); printing_bindings = 0; } } - if (printing_bindings) write_c_string (stream, ")\n"); + if (printing_bindings) write_ascstring (stream, ")\n"); } static Lisp_Object @@ -7020,7 +7030,7 @@ if (args) return *args; else - return list1 (build_string ("[internal]")); + return list1 (build_ascstring ("[internal]")); } DEFUN ("backtrace", Fbacktrace, 0, 2, "", /* @@ -7078,15 +7088,15 @@ speccount = catches->pdlcount; if (catchpdl == speccount) { - write_c_string (stream, " # (catch "); + write_ascstring (stream, " # (catch "); Fprin1 (catches->tag, stream); - write_c_string (stream, " ...)\n"); + write_ascstring (stream, " ...)\n"); } else { - write_c_string (stream, " # (condition-case ... . "); + write_ascstring (stream, " # (condition-case ... . "); Fprin1 (Fcdr (Fcar (catches->tag)), stream); - write_c_string (stream, ")\n"); + write_ascstring (stream, ")\n"); } catches = catches->next; } @@ -7099,19 +7109,19 @@ backtrace_specials (speccount, backlist->pdlcount, stream); speccount = backlist->pdlcount; } - write_c_string (stream, backlist->debug_on_exit ? "* " : " "); + write_ascstring (stream, backlist->debug_on_exit ? "* " : " "); if (backlist->nargs == UNEVALLED) { Fprin1 (Fcons (*backlist->function, backtrace_unevalled_args (backlist->args)), stream); - write_c_string (stream, "\n"); /* from FSFmacs 19.30 */ + write_ascstring (stream, "\n"); /* from FSFmacs 19.30 */ } else { Lisp_Object tem = *backlist->function; Fprin1 (tem, stream); /* This can QUIT */ - write_c_string (stream, "("); + write_ascstring (stream, "("); if (backlist->nargs == MANY) { int i; @@ -7123,7 +7133,7 @@ !NILP (tail); tail = Fcdr (tail), i++) { - if (i != 0) write_c_string (stream, " "); + if (i != 0) write_ascstring (stream, " "); Fprin1 (Fcar (tail), stream); } NUNGCPRO; @@ -7135,14 +7145,14 @@ { if (!i && EQ (tem, Qbyte_code)) { - write_c_string (stream, "\"...\""); + write_ascstring (stream, "\"...\""); continue; } - if (i != 0) write_c_string (stream, " "); + if (i != 0) write_ascstring (stream, " "); Fprin1 (backlist->args[i], stream); } } - write_c_string (stream, ")\n"); + write_ascstring (stream, ")\n"); } backlist = backlist->next; } @@ -7234,7 +7244,7 @@ automatically be called when it is safe to do so. */ void -warn_when_safe (Lisp_Object class_, Lisp_Object level, const CIbyte *fmt, ...) +warn_when_safe (Lisp_Object class_, Lisp_Object level, const Ascbyte *fmt, ...) { Lisp_Object obj; va_list args; @@ -7243,7 +7253,7 @@ return; va_start (args, fmt); - obj = emacs_vsprintf_string (CGETTEXT (fmt), args); + obj = emacs_vsprintf_string (GETTEXT (fmt), args); va_end (args); warn_when_safe_lispobj (class_, level, obj); diff -r d2ec55325515 -r 8f0cf4fd3d2c src/event-Xt.c --- a/src/event-Xt.c Sat Feb 06 03:59:18 2010 -0600 +++ b/src/event-Xt.c Sat Feb 06 04:01:46 2010 -0600 @@ -192,7 +192,7 @@ EQ (new_value, Qt))) { maybe_define_x_key_as_self_inserting_character (keysym, sym); - Fputhash (build_ext_string (name, Qbinary), new_value, + Fputhash (build_extstring (name, Qbinary), new_value, hash_table); Fputhash (sym, new_value, hash_table); } @@ -337,46 +337,46 @@ /* Boy, I really wish C had local functions... */ - /* The call to warn_when_safe must be on the same line as the string or - make-msgfile won't pick it up properly (the newline doesn't confuse - it, but the backslash does). */ - -#define modwarn(name,old,other) \ - warn_when_safe (Qkey_mapping, Qwarning, "XEmacs: %s (0x%x) generates %s, which is generated by %s.", \ - name, code, index_to_name (old), other), \ +#define modwarn(name,old,other) \ + warn_when_safe (Qkey_mapping, Qwarning, \ + "XEmacs: %s (0x%x) generates %s, which is generated by %s.", \ + name, code, index_to_name (old), other), \ warned_about_overlapping_modifiers = 1 -#define modbarf(name,other) \ - warn_when_safe (Qkey_mapping, Qwarning, "XEmacs: %s (0x%x) generates %s, which is nonsensical.", \ - name, code, other), \ +#define modbarf(name,other) \ + warn_when_safe (Qkey_mapping, Qwarning, \ + "XEmacs: %s (0x%x) generates %s, which is nonsensical.", \ + name, code, other), \ warned_about_predefined_modifiers = 1 -#define check_modifier(name,mask) \ - if ((1<x_modifier_keymap->max_keypermod; @@ -1750,7 +1750,7 @@ { Lisp_Object console = CDFW_CONSOLE (EVENT_CHANNEL (event)); if (CONSOLE_X_P (XCONSOLE (console))) - write_c_string + write_ascstring (pstream, x_event_name ((EVENT_MAGIC_X_EVENT (event)).type)); } @@ -2189,7 +2189,7 @@ } } XtRemoveInput (closure->id); - xfree (closure, struct what_is_ready_closure *); + xfree (closure); filedesc_to_what_closure[fd] = 0; } @@ -2426,7 +2426,7 @@ static void describe_event (XEvent *event, Lisp_Object pstream) { - char buf[100]; + Ascbyte buf[100]; struct device *d = get_device_from_display (event->xany.display); sprintf (buf, "%s%s", x_event_name (event->type), diff -r d2ec55325515 -r 8f0cf4fd3d2c src/event-gtk.c --- a/src/event-gtk.c Sat Feb 06 03:59:18 2010 -0600 +++ b/src/event-gtk.c Sat Feb 06 04:01:46 2010 -0600 @@ -224,7 +224,7 @@ { Lisp_Object console = CDFW_CONSOLE (EVENT_CHANNEL (emacs_event)); if (CONSOLE_GTK_P (XCONSOLE (console))) - write_c_string + write_cistring (pstream, gtk_event_name (EVENT_MAGIC_GDK_EVENT (emacs_event).type)); } @@ -788,7 +788,7 @@ } } gdk_input_remove (closure->id); - xfree (closure, struct what_is_ready_closure *); + xfree (closure); filedesc_to_what_closure[fd] = 0; } @@ -1015,9 +1015,9 @@ { /* Arbitrary string */ l_type = Qdragdrop_MIME; - l_dndlist = list1 (list3 (list1 (build_string ("text/plain")), - build_string ("8_bit"), - make_ext_string (data->data, + l_dndlist = list1 (list3 (list1 (build_ascstring ("text/plain")), + build_ascstring ("8_bit"), + make_extstring (data->data, strlen ((char *)data->data), Qctext))); } @@ -1029,7 +1029,7 @@ l_dndlist = list1 (make_string ((Ibyte *)hurl, strlen (hurl))); l_type = Qdragdrop_URL; - xfree (hurl, char *); + xfree (hurl); } else if (data->type == preferred_targets[TARGET_NETSCAPE]) { @@ -1044,9 +1044,9 @@ We just pass it up to lisp - we already have a mime type. */ l_type = Qdragdrop_MIME; - l_dndlist = list1 (list3 (list1 (build_string (gdk_atom_name (data->type))), - build_string ("8bit"), - make_ext_string ((Extbyte *) data->data, + l_dndlist = list1 (list3 (list1 (build_cistring (gdk_atom_name (data->type))), + build_ascstring ("8bit"), + make_extstring ((Extbyte *) data->data, data->length, Qbinary))); } @@ -1781,7 +1781,7 @@ Lisp_Object sym = gtk_keysym_to_emacs_keysym (keysym[0], 0); if (name) { - Fputhash (build_ext_string (name, Qx_keysym_encoding), + Fputhash (build_extstring (name, Qx_keysym_encoding), Qsans_modifiers, hashtable); Fputhash (sym, Qsans_modifiers, hashtable); } @@ -1796,7 +1796,7 @@ Lisp_Object sym = gtk_keysym_to_emacs_keysym (keysym[j], 0); if (name && NILP (Fgethash (sym, hashtable, Qnil))) { - Fputhash (build_ext_string (name, Qx_keysym_encoding), + Fputhash (build_extstring (name, Qx_keysym_encoding), Qt, hashtable); Fputhash (sym, Qt, hashtable); } @@ -1870,10 +1870,6 @@ /* Boy, I really wish C had local functions... */ - /* The call to warn_when_safe must be on the same line as the string or - make-msgfile won't pick it up properly (the newline doesn't confuse - it, but the backslash does). */ - #define store_modifier(name,old) \ old = modifier_index; diff -r d2ec55325515 -r 8f0cf4fd3d2c src/event-msw.c --- a/src/event-msw.c Sat Feb 06 03:59:18 2010 -0600 +++ b/src/event-msw.c Sat Feb 06 04:01:46 2010 -0600 @@ -832,7 +832,7 @@ if (str->buffer) { - xfree (str->buffer, void *); + xfree (str->buffer); str->buffer = 0; } @@ -1752,9 +1752,9 @@ * get an error, or finish before the end of the string, * we know the original string had syntax errors. */ - args[0] = build_string ("(progn "); + args[0] = build_ascstring ("(progn "); args[1] = str; - args[2] = build_string (")"); + args[2] = build_ascstring (")"); str = Fconcat (3, args); obj = Fread_from_string (str, Qnil, Qnil); @@ -1811,7 +1811,6 @@ (name)) { Lisp_Object token; - Extbyte *str; HSZ hsz; struct gcpro gcpro1, gcpro2; @@ -1820,18 +1819,17 @@ else { static int num = 0; - char buf[20]; + Ascbyte buf[20]; sprintf (buf, "Tok%d", num); ++num; - name = build_string (buf); + name = build_ascstring (buf); } token = Qnil; GCPRO2 (name, token); token = Fmake_symbol (name); - TO_EXTERNAL_FORMAT (LISP_STRING, name, C_STRING_ALLOCA, str, - Qmswindows_tstr); - hsz = qxeDdeCreateStringHandle (mswindows_dde_mlid, str, + hsz = qxeDdeCreateStringHandle (mswindows_dde_mlid, + LISP_STRING_TO_TSTR (name), XEUNICODE_P ? CP_WINUNICODE : CP_WINANSI); Fput(token, QHSZ, make_float ((int)hsz)); @@ -1989,12 +1987,12 @@ { if (NILP (dde_eval_error)) { - args[0] = build_string ("OK: %s"); + args[0] = build_ascstring ("OK: %s"); args[1] = dde_eval_result; } else { - args[0] = build_string ("ERR: %s"); + args[0] = build_ascstring ("ERR: %s"); args[1] = dde_eval_error; } } @@ -2013,17 +2011,17 @@ if (!DdeCmpStringHandles (hszItem, hsz)) args[1] = Fsymbol_value (elt); } - args[0] = build_string ("%s"); + args[0] = build_ascstring ("%s"); } res = Fformat (2, args); UNGCPRO; bytes = (uFmt == CF_TEXT ? 1 : 2) * (XSTRING_LENGTH (res) + 1); - TO_EXTERNAL_FORMAT (LISP_STRING, res, - C_STRING_ALLOCA, result, - uFmt == CF_TEXT ? Qmswindows_multibyte - : Qmswindows_unicode); + result = + LISP_STRING_TO_EXTERNAL (res, + uFmt == CF_TEXT ? Qmswindows_multibyte + : Qmswindows_unicode); /* If we cannot create the data handle, this passes the null * return back to the client, which signals an error as we wish. @@ -2045,9 +2043,7 @@ /* Grab a pointer to the raw data supplied */ extcmd = DdeAccessData (hdata, &len); - TO_INTERNAL_FORMAT (DATA, (extcmd, len), - LISP_STRING, tmp, - Qmswindows_tstr); + tmp = make_extstring ((Extbyte *) extcmd, len, Qmswindows_tstr); /* Release and free the data handle */ DdeUnaccessData (hdata); @@ -2078,9 +2074,7 @@ DdeGetData (hdata, (LPBYTE) extcmd, len, 0); DdeFreeDataHandle (hdata); - TO_INTERNAL_FORMAT (DATA, (extcmd, len), - C_STRING_ALLOCA, cmd, - Qmswindows_tstr); + cmd = SIZED_EXTERNAL_TO_ITEXT (extcmd, len, Qmswindows_tstr); /* Check syntax & that it's an [Open("foo")] command, which we * treat like a file drop */ @@ -2118,8 +2112,8 @@ they don't allow relative paths at all! this is way bogus. */ cmd = urlify_filename (cmd); - l_dndlist = build_intstring (cmd); - xfree (cmd, Ibyte *); + l_dndlist = build_istring (cmd); + xfree (cmd); } GCPRO2 (emacs_event, l_dndlist); @@ -2734,9 +2728,8 @@ if (XEUNICODE_P) { length = unicode_char_to_text (tranmsg.wParam, extchar); - TO_INTERNAL_FORMAT (DATA, (extchar, length), - C_STRING_ALLOCA, (intchar), - Qmswindows_unicode); + intchar = SIZED_EXTERNAL_TO_ITEXT (extchar, length, + Qmswindows_unicode); ch = itext_ichar (intchar); } else @@ -2750,7 +2743,7 @@ ((LCID) GetKeyboardLayout (0) & 0xFFFF), NULL)); ch = itext_ichar (intchar); - xfree (intchar, Ibyte *); + xfree (intchar); } #ifdef DEBUG_XEMACS @@ -2850,10 +2843,9 @@ { Ibyte *intchar; - TO_INTERNAL_FORMAT - (DATA, - (received_keys + (tounret - 1) * 2, 2), - C_STRING_ALLOCA, intchar, + intchar = + SIZED_EXTERNAL_TO_ITEXT + (received_keys + (tounret - 1) * 2, 2, Qmswindows_unicode); XSET_EVENT_KEY_ALT_KEYCHARS (lastev, i, itext_ichar (intchar)); @@ -2895,7 +2887,7 @@ XSET_EVENT_KEY_ALT_KEYCHARS (lastev, i, itext_ichar (intchar)); - xfree (intchar, Ibyte *); + xfree (intchar); } } } @@ -3199,7 +3191,7 @@ tttextw->hinst = NULL; if (!NILP (btext)) - LISP_STRING_TO_TSTR (btext, btextext); + btextext = LISP_STRING_TO_TSTR (btext); if (btextext) { @@ -3415,8 +3407,7 @@ * recursion here. */ if (FRAME_MSWINDOWS_TARGET_RECT (frame)) { - xfree (FRAME_MSWINDOWS_TARGET_RECT (frame), - XEMACS_RECT_WH *); + xfree (FRAME_MSWINDOWS_TARGET_RECT (frame)); FRAME_MSWINDOWS_TARGET_RECT (frame) = 0; } } @@ -3735,10 +3726,10 @@ { Ibyte *fname2 = urlify_filename (fname); - l_item = build_intstring (fname2); - xfree (fname2, Ibyte *); + l_item = build_istring (fname2); + xfree (fname2); if (freeme) - xfree (fname, Ibyte *); + xfree (fname); l_dndlist = Fcons (l_item, l_dndlist); } } @@ -4274,7 +4265,7 @@ emacs_mswindows_format_magic_event (Lisp_Event *emacs_event, Lisp_Object pstream) { -#define FROB(msg) case msg: write_c_string (pstream, "type=" #msg); break +#define FROB(msg) case msg: write_ascstring (pstream, "type=" #msg); break switch (EVENT_MAGIC_MSWINDOWS_EVENT (emacs_event)) { @@ -4291,7 +4282,7 @@ if (!NILP (EVENT_CHANNEL (emacs_event))) { - write_c_string (pstream, " "); + write_ascstring (pstream, " "); print_internal (EVENT_CHANNEL (emacs_event), pstream, 1); } } @@ -4670,7 +4661,7 @@ struct mswin_message_debug { int mess; - char *string; + const Ascbyte *string; }; #define FROB(val) { val, #val, }, @@ -4961,7 +4952,7 @@ { Lisp_Object frame = mswindows_find_frame (hwnd); int i; - char *str = 0; + const Ascbyte *str = 0; /* struct mswin_message_debug *i_hate_cranking_out_code_like_this; */ for (i = 0; i < countof (debug_mswin_messages); i++) diff -r d2ec55325515 -r 8f0cf4fd3d2c src/event-stream.c --- a/src/event-stream.c Sat Feb 06 03:59:18 2010 -0600 +++ b/src/event-stream.c Sat Feb 06 04:01:46 2010 -0600 @@ -255,13 +255,14 @@ Fixnum debug_emacs_events; static void -external_debugging_print_event (const char *event_description, Lisp_Object event) +external_debugging_print_event (const Ascbyte *event_description, + Lisp_Object event) { - write_c_string (Qexternal_debugging_output, "("); - write_c_string (Qexternal_debugging_output, event_description); - write_c_string (Qexternal_debugging_output, ") "); + write_ascstring (Qexternal_debugging_output, "("); + write_ascstring (Qexternal_debugging_output, event_description); + write_ascstring (Qexternal_debugging_output, ") "); print_internal (event, Qexternal_debugging_output, 1); - write_c_string (Qexternal_debugging_output, "\n"); + write_ascstring (Qexternal_debugging_output, "\n"); } #define DEBUG_PRINT_EMACS_EVENT(event_description, event) do { \ if (debug_emacs_events) \ @@ -362,7 +363,7 @@ struct command_builder *b = (struct command_builder *) header; if (b->echo_buf) { - xfree (b->echo_buf, Ibyte *); + xfree (b->echo_buf); b->echo_buf = 0; } } @@ -462,7 +463,7 @@ { if (builder->echo_buf) { - xfree (builder->echo_buf, Ibyte *); + xfree (builder->echo_buf); builder->echo_buf = NULL; } #ifdef NEW_GC @@ -846,7 +847,7 @@ help = IGNORE_MULTIPLE_VALUES (Feval (Vhelp_form)); if (STRINGP (help)) - internal_with_output_to_temp_buffer (build_string ("*Help*"), + internal_with_output_to_temp_buffer (build_ascstring ("*Help*"), print_help, help, Qnil); Fnext_command_event (event, Qnil); /* Remove the help from the frame */ @@ -4137,7 +4138,7 @@ } static int -is_scrollbar_event (Lisp_Object event) +is_scrollbar_event (Lisp_Object USED_IF_SCROLLBARS (event)) { #ifdef HAVE_SCROLLBARS Lisp_Object fun; @@ -4979,9 +4980,9 @@ last_point_position_buffer = Qnil; staticpro (&last_point_position_buffer); - QSnext_event_internal = build_string ("next_event_internal()"); + QSnext_event_internal = build_ascstring ("next_event_internal()"); staticpro (&QSnext_event_internal); - QSexecute_internal_event = build_string ("execute_internal_event()"); + QSexecute_internal_event = build_ascstring ("execute_internal_event()"); staticpro (&QSexecute_internal_event); DEFVAR_LISP ("echo-keystrokes", &Vecho_keystrokes /* diff -r d2ec55325515 -r 8f0cf4fd3d2c src/event-unixoid.c --- a/src/event-unixoid.c Sat Feb 06 03:59:18 2010 -0600 +++ b/src/event-unixoid.c Sat Feb 06 04:01:46 2010 -0600 @@ -100,12 +100,16 @@ ch = Lstream_get_ichar (XLSTREAM (CONSOLE_TTY_DATA (con)->instream)); else { + Ibyte byte; /* #### Definitely something strange here. We should be setting the stdio handle unbuffered and reading from it instead of mixing stdio and raw io calls. */ - int nread = retry_read (fileno (CONSOLE_STREAM_DATA (con)->in), &ch, 1); + int nread = retry_read (fileno (CONSOLE_STREAM_DATA (con)->in), + &byte, 1); if (nread <= 0) ch = -1; + else + ch = byte; } if (ch < 0) diff -r d2ec55325515 -r 8f0cf4fd3d2c src/events.c --- a/src/events.c Sat Feb 06 03:59:18 2010 -0600 +++ b/src/events.c Sat Feb 06 04:01:46 2010 -0600 @@ -320,10 +320,10 @@ } static void -print_event_1 (const char *str, Lisp_Object obj, Lisp_Object printcharfun) +print_event_1 (const Ascbyte *str, Lisp_Object obj, Lisp_Object printcharfun) { DECLARE_EISTRING_MALLOC (ei); - write_c_string (printcharfun, str); + write_ascstring (printcharfun, str); format_event_object (ei, obj, 0); write_eistring (printcharfun, ei); eifree (ei); @@ -371,7 +371,7 @@ XEVENT_TIMEOUT_OBJECT (obj)); break; case empty_event: - write_c_string (printcharfun, "#"); + write_ascstring (printcharfun, ">"); } static int diff -r d2ec55325515 -r 8f0cf4fd3d2c src/extents.c --- a/src/extents.c Sat Feb 06 03:59:18 2010 -0600 +++ b/src/extents.c Sat Feb 06 04:01:46 2010 -0600 @@ -770,7 +770,7 @@ free_gap_array (Gap_Array *ga) { gap_array_delete_all_markers (ga); - xfree (ga, Gap_Array *); + xfree (ga); } #endif /* not NEW_GC */ @@ -993,7 +993,7 @@ { free_gap_array (el->start); free_gap_array (el->end); - xfree (el, Extent_List *); + xfree (el); } #endif /* not NEW_GC */ @@ -1815,7 +1815,7 @@ free_soe (struct stack_of_extents *soe) { free_extent_list (soe->extents); - xfree (soe, struct stack_of_extents *); + xfree (soe); } #endif /* not NEW_GC */ @@ -2929,7 +2929,7 @@ Dynarr_free (ef->extents); Dynarr_free (ef->begin_glyphs); Dynarr_free (ef->end_glyphs); - xfree (ef, struct extent_fragment *); + xfree (ef); } static int @@ -2971,7 +2971,7 @@ /* But some loser programs mess up and may create a large number of extents overlapping the same spot. This will result in catastrophic behavior if we use the bubble sort above. */ - qsort (Dynarr_atp (extarr, 0), Dynarr_length (extarr), + qsort (Dynarr_begin (extarr), Dynarr_length (extarr), sizeof (EXTENT), extent_priority_sort_function); } @@ -3114,13 +3114,15 @@ if (extent_start (e) == mempos && !NILP (extent_begin_glyph (e))) { Lisp_Object glyph = extent_begin_glyph (e); - if (seen_glyph) { - struct glyph_block gb; - - gb.glyph = glyph; - gb.extent = wrap_extent (e); - Dynarr_add (ef->begin_glyphs, gb); - } + if (seen_glyph) + { + struct glyph_block gb; + + xzero (gb); + gb.glyph = glyph; + gb.extent = wrap_extent (e); + Dynarr_add (ef->begin_glyphs, gb); + } else if (EQ (glyph, last_glyph)) seen_glyph = 1; } @@ -3133,13 +3135,15 @@ if (extent_end (e) == mempos && !NILP (extent_end_glyph (e))) { Lisp_Object glyph = extent_end_glyph (e); - if (seen_glyph) { - struct glyph_block gb; - - gb.glyph = glyph; - gb.extent = wrap_extent (e); - Dynarr_add (ef->end_glyphs, gb); - } + if (seen_glyph) + { + struct glyph_block gb; + + xzero (gb); + gb.glyph = glyph; + gb.extent = wrap_extent (e); + Dynarr_add (ef->end_glyphs, gb); + } else if (EQ (glyph, last_glyph)) seen_glyph = 1; } @@ -3268,7 +3272,7 @@ EXTENT ext = XEXTENT (obj); EXTENT anc = extent_ancestor (ext); Lisp_Object tail; - char buf[64], *bp = buf; + Ascbyte buf[64], *bp = buf; /* Retrieve the ancestor and use it, for faster retrieval of properties */ @@ -3296,7 +3300,7 @@ extent_duplicable_p (anc) || !NILP (extent_invisible (anc))) *bp++ = ' '; *bp = '\0'; - write_c_string (printcharfun, buf); + write_ascstring (printcharfun, buf); tail = extent_plist_slot (anc); @@ -3358,12 +3362,12 @@ } if (!EXTENT_LIVE_P (XEXTENT (obj))) - write_c_string (printcharfun, "#"); - write_c_string (printcharfun, "#"); + write_ascstring (printcharfun, "#"); } static int @@ -3880,14 +3884,14 @@ if (!NILP (parent)) extent_properties (XEXTENT (parent), newprops); - qsort (Dynarr_atp (oldprops, 0), Dynarr_length (oldprops), + qsort (Dynarr_begin (oldprops), Dynarr_length (oldprops), sizeof (Lisp_Object_pair), compare_key_value_pairs); - qsort (Dynarr_atp (newprops, 0), Dynarr_length (newprops), + qsort (Dynarr_begin (newprops), Dynarr_length (newprops), sizeof (Lisp_Object_pair), compare_key_value_pairs); orignewlength = Dynarr_length (newprops); for (i = 0; i < Dynarr_length (oldprops); i++) { - if (!bsearch (Dynarr_atp (oldprops, i), Dynarr_atp (newprops, 0), + if (!bsearch (Dynarr_atp (oldprops, i), Dynarr_begin (newprops), Dynarr_length (newprops), sizeof (Lisp_Object_pair), compare_key_value_pairs)) { @@ -3900,7 +3904,7 @@ for (i = 0; i < orignewlength; i++) { if (!Dynarr_length (oldprops) || !bsearch (Dynarr_atp (newprops, i), - Dynarr_atp (oldprops, 0), + Dynarr_begin (oldprops), Dynarr_length (oldprops), sizeof (Lisp_Object_pair), compare_key_value_pairs)) @@ -3911,9 +3915,9 @@ Dynarr_add (oldprops, new_); } } - qsort (Dynarr_atp (oldprops, 0), Dynarr_length (oldprops), + qsort (Dynarr_begin (oldprops), Dynarr_length (oldprops), sizeof (Lisp_Object_pair), compare_key_value_pairs); - qsort (Dynarr_atp (newprops, 0), Dynarr_length (newprops), + qsort (Dynarr_begin (newprops), Dynarr_length (newprops), sizeof (Lisp_Object_pair), compare_key_value_pairs); for (i = 0; i < Dynarr_length (oldprops); i++) { @@ -7639,6 +7643,6 @@ Vextent_face_reverse_memoize_hash_table = make_lisp_hash_table (100, HASH_TABLE_KEY_WEAK, HASH_TABLE_EQ); - QSin_map_extents_internal = build_msg_string ("(in map-extents-internal)"); + QSin_map_extents_internal = build_defer_string ("(in map-extents-internal)"); staticpro (&QSin_map_extents_internal); } diff -r d2ec55325515 -r 8f0cf4fd3d2c src/faces.c --- a/src/faces.c Sat Feb 06 03:59:18 2010 -0600 +++ b/src/faces.c Sat Feb 06 04:01:46 2010 -0600 @@ -137,7 +137,7 @@ write_fmt_string_lisp (printcharfun, "#name); if (!NILP (face->doc_string)) write_fmt_string_lisp (printcharfun, " %S", 1, face->doc_string); - write_c_string (printcharfun, ">"); + write_ascstring (printcharfun, ">"); } } @@ -2230,7 +2230,7 @@ Vdefault_face = Qnil; /* so that Fmake_face() doesn't set up a bogus default value */ - Vdefault_face = Fmake_face (Qdefault, build_msg_string ("default face"), + Vdefault_face = Fmake_face (Qdefault, build_defer_string ("default face"), Qnil); /* Provide some last-resort fallbacks to avoid utter fuckage if @@ -2240,22 +2240,22 @@ Lisp_Object fg_fb = Qnil, bg_fb = Qnil; #ifdef HAVE_GTK - fg_fb = acons (list1 (Qgtk), build_string ("black"), fg_fb); - bg_fb = acons (list1 (Qgtk), build_string ("white"), bg_fb); + fg_fb = acons (list1 (Qgtk), build_ascstring ("black"), fg_fb); + bg_fb = acons (list1 (Qgtk), build_ascstring ("white"), bg_fb); #endif #ifdef HAVE_X_WINDOWS - fg_fb = acons (list1 (Qx), build_string ("black"), fg_fb); - bg_fb = acons (list1 (Qx), build_string ("gray80"), bg_fb); + fg_fb = acons (list1 (Qx), build_ascstring ("black"), fg_fb); + bg_fb = acons (list1 (Qx), build_ascstring ("gray80"), bg_fb); #endif #ifdef HAVE_TTY fg_fb = acons (list1 (Qtty), Fvector (0, 0), fg_fb); bg_fb = acons (list1 (Qtty), Fvector (0, 0), bg_fb); #endif #ifdef HAVE_MS_WINDOWS - fg_fb = acons (list1 (Qmsprinter), build_string ("black"), fg_fb); - bg_fb = acons (list1 (Qmsprinter), build_string ("white"), bg_fb); - fg_fb = acons (list1 (Qmswindows), build_string ("black"), fg_fb); - bg_fb = acons (list1 (Qmswindows), build_string ("white"), bg_fb); + fg_fb = acons (list1 (Qmsprinter), build_ascstring ("black"), fg_fb); + bg_fb = acons (list1 (Qmsprinter), build_ascstring ("white"), bg_fb); + fg_fb = acons (list1 (Qmswindows), build_ascstring ("black"), fg_fb); + bg_fb = acons (list1 (Qmswindows), build_ascstring ("white"), bg_fb); #endif set_specifier_fallback (Fget (Vdefault_face, Qforeground, Qnil), fg_fb); set_specifier_fallback (Fget (Vdefault_face, Qbackground, Qnil), bg_fb); @@ -2336,7 +2336,7 @@ #ifdef HAVE_XFT for (fontptr = fonts + countof(fonts) - 1; fontptr >= fonts; fontptr--) inst_list = Fcons (Fcons (list1 (device_symbol), - build_string (*fontptr)), + build_cistring (*fontptr)), inst_list); #else /* !HAVE_XFT */ @@ -2346,7 +2346,7 @@ (list1 (device_symbol), /* grrr. This really does need to be "*", not an XLFD. An unspecified XLFD won't pick up stuff like 10x20. */ - build_string ("*")), + build_ascstring ("*")), inst_list); #ifdef MULE @@ -2360,7 +2360,7 @@ Fcons (Fcons (list4(device_symbol, Qtwo_dimensional, Qfinal, Qx_coverage_instantiator), - build_string + build_ascstring ("-misc-fixed-medium-r-normal--15-140-75-75-c-90-iso10646-1")), inst_list); @@ -2372,14 +2372,14 @@ Fcons (Fcons (list4(device_symbol, Qone_dimensional, Qfinal, Qx_coverage_instantiator), - build_string + build_ascstring ("-misc-fixed-medium-r-semicondensed--13-120-75-75-c-60-iso10646-1")), inst_list); for (fontptr = fonts + countof(fonts) - 1; fontptr >= fonts; fontptr--) inst_list = Fcons (Fcons (list3 (device_symbol, Qtwo_dimensional, Qinitial), - build_string (*fontptr)), + build_cistring (*fontptr)), inst_list); /* We need to set the font for the JIT-ucs-charsets separately from the @@ -2392,7 +2392,7 @@ Fcons (Fcons (list4(device_symbol, Qencode_as_utf_8, Qinitial, Qx_coverage_instantiator), - build_string + build_ascstring ("-misc-fixed-medium-r-semicondensed--13-120-75-75-c-60-iso10646-1")), inst_list); @@ -2404,7 +2404,7 @@ Fcons (Fcons (list1 (device_symbol), - build_string ("-*-*-medium-r-*-*-*-120-*-*-c-*-*-*")), + build_ascstring ("-*-*-medium-r-*-*-*-120-*-*-c-*-*-*")), inst_list); /* With a Cygwin XFree86 install, this returns the best (clearest, @@ -2417,7 +2417,7 @@ Fcons (Fcons (list1 (device_symbol), - build_string ("-*-lucidatypewriter-medium-r-*-*-*-120-*-*-*-*-*-*")), + build_ascstring ("-*-lucidatypewriter-medium-r-*-*-*-120-*-*-*-*-*-*")), inst_list); #endif /* !HAVE_XFT */ @@ -2425,7 +2425,7 @@ #endif /* HAVE_X_WINDOWS || HAVE_GTK */ #ifdef HAVE_TTY - inst_list = Fcons (Fcons (list1 (Qtty), build_string ("normal")), + inst_list = Fcons (Fcons (list1 (Qtty), build_ascstring ("normal")), inst_list); #endif /* HAVE_TTY */ @@ -2444,18 +2444,18 @@ { /* display device */ inst_list = Fcons (Fcons (list1 (Qmswindows), - build_string (*mswfontptr)), + build_ascstring (*mswfontptr)), inst_list); /* printer device */ inst_list = Fcons (Fcons (list1 (Qmsprinter), - build_string (*mswfontptr)), + build_ascstring (*mswfontptr)), inst_list); } /* Use Lucida Console rather than Courier New if it exists -- the line spacing is much less, so many more lines fit with the same size font. (And it's specifically designed for screens.) */ inst_list = Fcons (Fcons (list1 (Qmswindows), - build_string ("Lucida Console:Regular:10::")), + build_ascstring ("Lucida Console:Regular:10::")), inst_list); } #endif /* HAVE_MS_WINDOWS */ @@ -2479,7 +2479,7 @@ /* gui-element is the parent face of all gui elements such as modeline, vertical divider and toolbar. */ Vgui_element_face = Fmake_face (Qgui_element, - build_msg_string ("gui element face"), + build_defer_string ("gui element face"), Qnil); /* Provide some last-resort fallbacks for gui-element face which @@ -2493,22 +2493,22 @@ /* We need to put something in there, or error checking gets #%!@#ed up before the styles are set, which override the fallbacks. */ - fg_fb = acons (list1 (Qgtk), build_string ("black"), fg_fb); - bg_fb = acons (list1 (Qgtk), build_string ("Gray80"), bg_fb); + fg_fb = acons (list1 (Qgtk), build_ascstring ("black"), fg_fb); + bg_fb = acons (list1 (Qgtk), build_ascstring ("Gray80"), bg_fb); #endif #ifdef HAVE_X_WINDOWS - fg_fb = acons (list1 (Qx), build_string ("black"), fg_fb); - bg_fb = acons (list1 (Qx), build_string ("Gray80"), bg_fb); + fg_fb = acons (list1 (Qx), build_ascstring ("black"), fg_fb); + bg_fb = acons (list1 (Qx), build_ascstring ("Gray80"), bg_fb); #endif #ifdef HAVE_TTY fg_fb = acons (list1 (Qtty), Fvector (0, 0), fg_fb); bg_fb = acons (list1 (Qtty), Fvector (0, 0), bg_fb); #endif #ifdef HAVE_MS_WINDOWS - fg_fb = acons (list1 (Qmsprinter), build_string ("black"), fg_fb); - bg_fb = acons (list1 (Qmsprinter), build_string ("white"), bg_fb); - fg_fb = acons (list1 (Qmswindows), build_string ("black"), fg_fb); - bg_fb = acons (list1 (Qmswindows), build_string ("Gray75"), bg_fb); + fg_fb = acons (list1 (Qmsprinter), build_ascstring ("black"), fg_fb); + bg_fb = acons (list1 (Qmsprinter), build_ascstring ("white"), bg_fb); + fg_fb = acons (list1 (Qmswindows), build_ascstring ("black"), fg_fb); + bg_fb = acons (list1 (Qmswindows), build_ascstring ("Gray75"), bg_fb); #endif set_specifier_fallback (Fget (Vgui_element_face, Qforeground, Qnil), fg_fb); set_specifier_fallback (Fget (Vgui_element_face, Qbackground, Qnil), bg_fb); @@ -2519,7 +2519,7 @@ way since we need to get them anyway. */ /* modeline is gui element. */ - Vmodeline_face = Fmake_face (Qmodeline, build_msg_string ("modeline face"), + Vmodeline_face = Fmake_face (Qmodeline, build_defer_string ("modeline face"), Qnil); set_specifier_fallback (Fget (Vmodeline_face, Qforeground, Qunbound), @@ -2532,7 +2532,7 @@ /* toolbar is another gui element */ Vtoolbar_face = Fmake_face (Qtoolbar, - build_msg_string ("toolbar face"), + build_defer_string ("toolbar face"), Qnil); set_specifier_fallback (Fget (Vtoolbar_face, Qforeground, Qunbound), Fget (Vgui_element_face, Qforeground, Qunbound)); @@ -2544,7 +2544,7 @@ /* vertical divider is another gui element */ Vvertical_divider_face = Fmake_face (Qvertical_divider, - build_msg_string ("vertical divider face"), + build_defer_string ("vertical divider face"), Qnil); set_specifier_fallback (Fget (Vvertical_divider_face, Qforeground, Qunbound), @@ -2558,7 +2558,7 @@ /* widget is another gui element */ Vwidget_face = Fmake_face (Qwidget, - build_msg_string ("widget face"), + build_defer_string ("widget face"), Qnil); /* #### weird ... the gui-element face doesn't have its own font yet */ set_specifier_fallback (Fget (Vwidget_face, Qfont, Qunbound), @@ -2570,17 +2570,17 @@ /* We don't want widgets to have a default background pixmap. */ Vleft_margin_face = Fmake_face (Qleft_margin, - build_msg_string ("left margin face"), + build_defer_string ("left margin face"), Qnil); Vright_margin_face = Fmake_face (Qright_margin, - build_msg_string ("right margin face"), + build_defer_string ("right margin face"), Qnil); Vtext_cursor_face = Fmake_face (Qtext_cursor, - build_msg_string ("face for text cursor"), + build_defer_string ("face for text cursor"), Qnil); Vpointer_face = Fmake_face (Qpointer, - build_msg_string + build_defer_string ("face for foreground/background colors of mouse pointer"), Qnil); } diff -r d2ec55325515 -r 8f0cf4fd3d2c src/file-coding.c --- a/src/file-coding.c Sat Feb 06 03:59:18 2010 -0600 +++ b/src/file-coding.c Sat Feb 06 04:01:46 2010 -0600 @@ -301,7 +301,7 @@ write_fmt_string_lisp (printcharfun, "#name); print_coding_system_properties (obj, printcharfun); - write_c_string (printcharfun, ">"); + write_ascstring (printcharfun, ">"); } /* Print an abbreviated version of a coding system (but still containing @@ -313,7 +313,7 @@ { write_fmt_string_lisp (printcharfun, "%s[", 1, XCODING_SYSTEM_NAME (cs)); print_coding_system_properties (cs, printcharfun); - write_c_string (printcharfun, "]"); + write_ascstring (printcharfun, "]"); } #ifndef NEW_GC @@ -521,18 +521,12 @@ if (flags & QUERY_METHOD_ERRORP) { - DECLARE_EISTRING (error_details); - - eicpy_ascii (error_details, "Cannot encode "); - eicat_lstr (error_details, - make_string_from_buffer (buf, fail_range_start, - pos - - fail_range_start)); - eicat_ascii (error_details, " using coding system"); - - signal_error (Qtext_conversion_error, - (const CIbyte *)(eidata (error_details)), - XCODING_SYSTEM_NAME (codesys)); + signal_error_2 + (Qtext_conversion_error, + "Cannot encode using coding system", + make_string_from_buffer (buf, fail_range_start, + pos - fail_range_start), + XCODING_SYSTEM_NAME (codesys)); } if (NILP (result)) @@ -679,7 +673,7 @@ } } - coding_system_or_name = intern_int (eidata (desired_base)); + coding_system_or_name = intern_istring (eidata (desired_base)); /* Remove this coding system and its subsidiary coding systems from the hash, to avoid calling this code recursively. */ @@ -697,7 +691,7 @@ /* Keep around the form so it doesn't disappear from under #'eval's feet. */ GCPRO1 (lookup); - call1_trapping_problems ((const CIbyte *)eidata (warning_info), + call1_trapping_problems ((const CIbyte *) eidata (warning_info), Qeval, lookup, 0); UNGCPRO; @@ -1107,14 +1101,14 @@ enum eol_type eol = coding_subsidiary_list[i].eol; qxestrcpy_ascii (codesys_name + len, extension); - codesys_name_sym = intern_int (codesys_name); + codesys_name_sym = intern_istring (codesys_name); if (mlen != -1) qxestrcpy_ascii (codesys_mnemonic + mlen, mnemonic_ext); sub_codesys = Fcopy_coding_system (codesys, codesys_name_sym); if (mlen != -1) XCODING_SYSTEM_MNEMONIC (sub_codesys) = - build_intstring (codesys_mnemonic); + build_istring (codesys_mnemonic); if (eol != EOL_LF) { @@ -1127,7 +1121,7 @@ (sub_codesys, "internal-subsidiary-eol-wrapper", Qchain, Qunbound, mlen != -1 ? - list6 (Qmnemonic, build_intstring (codesys_mnemonic), + list6 (Qmnemonic, build_istring (codesys_mnemonic), Qchain, chain, Qcanonicalize_after_coding, sub_codesys) : list4 (Qchain, chain, @@ -1213,8 +1207,8 @@ XSTRING_DATA (Fsymbol_name (XCODING_SYSTEM_NAME (name_or_existing))), ++coding_system_tick); - name_or_existing = intern_int (newname); - xfree (newname, Ibyte *); + name_or_existing = intern_istring (newname); + xfree (newname); if (UNBOUNDP (description)) { @@ -1222,13 +1216,13 @@ emacs_sprintf_malloc (NULL, "For Internal Use (%s)", XSTRING_DATA (Fsymbol_name (name_or_existing))); - description = build_intstring (newname); - xfree (newname, Ibyte *); + description = build_istring (newname); + xfree (newname); } newname = emacs_sprintf_malloc (NULL, "Int%d", coding_system_tick); - defmnem = build_intstring (newname); - xfree (newname, Ibyte *); + defmnem = build_istring (newname); + xfree (newname); } else CHECK_SYMBOL (name_or_existing); @@ -1248,7 +1242,7 @@ cs->internal_p = !!prefix; if (NILP (description)) - description = build_string (""); + description = build_ascstring (""); else CHECK_STRING (description); CODING_SYSTEM_DESCRIPTION (cs) = description; @@ -1376,9 +1370,9 @@ (NULL, "internal-eol-copy-%s-%d", XSTRING_DATA (Fsymbol_name (name_or_existing)), ++coding_system_tick); - Lisp_Object newnamesym = intern_int (newname); + Lisp_Object newnamesym = intern_istring (newname); Lisp_Object copied = Fcopy_coding_system (csobj, newnamesym); - xfree (newname, Ibyte *); + xfree (newname); XCODING_SYSTEM_CANONICAL (csobj) = make_internal_coding_system @@ -1841,7 +1835,7 @@ { Bytecount chunk = min (size, (Bytecount) Dynarr_length (str->convert_to)); - memcpy (data, Dynarr_atp (str->convert_to, 0), chunk); + memcpy (data, Dynarr_begin (str->convert_to), chunk); Dynarr_delete_many (str->convert_to, 0, chunk); data += chunk; size -= chunk; @@ -1870,7 +1864,7 @@ Dynarr_atp (str->convert_from, rejected), readmore); /* Trim size down to how much we actually got */ - Dynarr_set_size (str->convert_from, rejected + max (0, read_size)); + Dynarr_set_length (str->convert_from, rejected + max (0, read_size)); } if (read_size < 0) /* LSTREAM_ERROR */ @@ -1892,7 +1886,7 @@ /* Convert the data, and save any rejected data in convert_from */ processed = XCODESYSMETH (str->codesys, convert, - (str, Dynarr_atp (str->convert_from, 0), + (str, Dynarr_begin (str->convert_from), str->convert_to, to_process)); if (processed < 0) { @@ -1901,10 +1895,10 @@ } assert (processed <= to_process); if (processed < to_process) - memmove (Dynarr_atp (str->convert_from, 0), + memmove (Dynarr_begin (str->convert_from), Dynarr_atp (str->convert_from, processed), to_process - processed); - Dynarr_set_size (str->convert_from, to_process - processed); + Dynarr_set_length (str->convert_from, to_process - processed); } } @@ -1924,7 +1918,7 @@ Dynarr_reset (str->convert_to); size = XCODESYSMETH (str->codesys, convert, (str, data, str->convert_to, size)); - if (Lstream_write (str->other_end, Dynarr_atp (str->convert_to, 0), + if (Lstream_write (str->other_end, Dynarr_begin (str->convert_to), Dynarr_length (str->convert_to)) < 0) return -1; else @@ -2059,7 +2053,7 @@ MAYBE_XCODESYSMETH (str->codesys, finalize_coding_stream, (str)); if (str->data) { - xfree (str->data, void *); + xfree (str->data); str->data = 0; } str->finalized = 1; @@ -2118,7 +2112,7 @@ if (str->data) { - xfree (str->data, void *); + xfree (str->data); str->data = 0; } if (XCODING_SYSTEM_METHODS (str->codesys)->coding_data_size) @@ -2612,10 +2606,10 @@ { int i; - write_c_string (printcharfun, "("); + write_ascstring (printcharfun, "("); for (i = 0; i < XCODING_SYSTEM_CHAIN_COUNT (cs); i++) { - write_c_string (printcharfun, i == 0 ? "" : "->"); + write_ascstring (printcharfun, i == 0 ? "" : "->"); print_coding_system_in_print_method (XCODING_SYSTEM_CHAIN_CHAIN (cs)[i], printcharfun, escapeflag); } @@ -2624,13 +2618,13 @@ if (!NILP (cac)) { if (i > 0) - write_c_string (printcharfun, " "); - write_c_string (printcharfun, "canonicalize-after-coding="); + write_ascstring (printcharfun, " "); + write_ascstring (printcharfun, "canonicalize-after-coding="); print_coding_system_in_print_method (cac, printcharfun, escapeflag); } } - write_c_string (printcharfun, ")"); + write_ascstring (printcharfun, ")"); } static void @@ -2725,7 +2719,7 @@ for (i = 0; i < data->lstream_count; i++) Lstream_delete (XLSTREAM ((data->lstreams)[i])); } - xfree (data->lstreams, Lisp_Object *); + xfree (data->lstreams); } } @@ -2739,7 +2733,7 @@ chain_finalize (Lisp_Object c) { if (XCODING_SYSTEM_CHAIN_CHAIN (c)) - xfree (XCODING_SYSTEM_CHAIN_CHAIN (c), Lisp_Object *); + xfree (XCODING_SYSTEM_CHAIN_CHAIN (c)); } static int @@ -3270,27 +3264,27 @@ XCODING_SYSTEM_TYPE_DATA (cs, undecided); int need_space = 0; - write_c_string (printcharfun, "("); + write_ascstring (printcharfun, "("); if (data->do_eol) { - write_c_string (printcharfun, "do-eol"); + write_ascstring (printcharfun, "do-eol"); need_space = 1; } if (data->do_coding) { if (need_space) - write_c_string (printcharfun, " "); - write_c_string (printcharfun, "do-coding"); + write_ascstring (printcharfun, " "); + write_ascstring (printcharfun, "do-coding"); need_space = 1; } if (!NILP (data->cs)) { if (need_space) - write_c_string (printcharfun, " "); - write_c_string (printcharfun, "coding-system="); + write_ascstring (printcharfun, " "); + write_ascstring (printcharfun, "coding-system="); print_coding_system_in_print_method (data->cs, printcharfun, escapeflag); } - write_c_string (printcharfun, ")"); + write_ascstring (printcharfun, ")"); } static void @@ -3366,7 +3360,7 @@ (st); } - xfree (st, struct detection_state *); + xfree (st); } static int @@ -3719,9 +3713,9 @@ if (n > 0) { name[n] = '\0'; - /* This call to intern_int() is OK because we already verified that + /* This call to intern_istring() is OK because we already verified that there are only ASCII characters in the string */ - return find_coding_system_for_text_file (intern_int ((Ibyte *) name), 0); + return find_coding_system_for_text_file (intern_istring ((Ibyte *) name), 0); } return Qnil; @@ -4312,12 +4306,12 @@ { struct gzip_coding_system *data = XCODING_SYSTEM_TYPE_DATA (cs, gzip); - write_c_string (printcharfun, "("); + write_ascstring (printcharfun, "("); if (data->level == -1) - write_c_string (printcharfun, "default"); + write_ascstring (printcharfun, "default"); else print_internal (make_int (data->level), printcharfun, 0); - write_c_string (printcharfun, ")"); + write_ascstring (printcharfun, ")"); } static int @@ -4429,7 +4423,7 @@ data->stream.avail_out = reserved; zerr = inflate (&data->stream, Z_NO_FLUSH); /* Lop off the unused portion */ - Dynarr_set_size (dst, Dynarr_length (dst) - data->stream.avail_out); + Dynarr_set_length (dst, Dynarr_length (dst) - data->stream.avail_out); if (zerr != Z_OK) break; } @@ -4489,7 +4483,7 @@ deflate (&data->stream, str->eof ? Z_FINISH : Z_NO_FLUSH); /* Lop off the unused portion */ - Dynarr_set_size (dst, Dynarr_length (dst) - data->stream.avail_out); + Dynarr_set_length (dst, Dynarr_length (dst) - data->stream.avail_out); if (zerr != Z_OK) break; } @@ -4750,7 +4744,7 @@ /* We always have file-coding support */ Fprovide (intern ("file-coding")); - QScoding_system_cookie = build_string (";;;###coding system: "); + QScoding_system_cookie = build_ascstring (";;;###coding system: "); staticpro (&QScoding_system_cookie); #ifdef HAVE_DEFAULT_EOL_DETECTION @@ -4838,12 +4832,12 @@ { Fmake_coding_system_internal (Qconvert_eol_cr, Qconvert_eol, - build_msg_string ("Convert CR to LF"), + build_defer_string ("Convert CR to LF"), nconc2 (list6 (Qdocumentation, - build_msg_string ( + build_defer_string ( "Converts CR (used to mark the end of a line on Macintosh systems) to LF\n" "(used internally and under Unix to mark the end of a line)."), - Qmnemonic, build_string ("CR->LF"), + Qmnemonic, build_ascstring ("CR->LF"), Qsubtype, Qcr), /* VERY IMPORTANT! Tell make-coding-system not to generate subsidiaries -- it needs the coding systems we're creating @@ -4853,11 +4847,11 @@ Fmake_coding_system_internal (Qconvert_eol_lf, Qconvert_eol, - build_msg_string ("Convert LF to LF (do nothing)"), + build_defer_string ("Convert LF to LF (do nothing)"), nconc2 (list6 (Qdocumentation, - build_msg_string ( + build_defer_string ( "Do nothing."), - Qmnemonic, build_string ("LF->LF"), + Qmnemonic, build_ascstring ("LF->LF"), Qsubtype, Qlf), /* VERY IMPORTANT! Tell make-coding-system not to generate subsidiaries -- it needs the coding systems we're creating @@ -4867,12 +4861,12 @@ Fmake_coding_system_internal (Qconvert_eol_crlf, Qconvert_eol, - build_msg_string ("Convert CRLF to LF"), + build_defer_string ("Convert CRLF to LF"), nconc2 (list6 (Qdocumentation, - build_msg_string ( + build_defer_string ( "Converts CR+LF (used to mark the end of a line on Macintosh systems) to LF\n" "(used internally and under Unix to mark the end of a line)."), - Qmnemonic, build_string ("CRLF->LF"), + Qmnemonic, build_ascstring ("CRLF->LF"), Qsubtype, Qcrlf), /* VERY IMPORTANT! Tell make-coding-system not to generate @@ -4883,11 +4877,11 @@ Fmake_coding_system_internal (Qconvert_eol_autodetect, Qconvert_eol, - build_msg_string ("Autodetect EOL type"), + build_defer_string ("Autodetect EOL type"), nconc2 (list6 (Qdocumentation, - build_msg_string ( + build_defer_string ( "Autodetect the end-of-line type."), - Qmnemonic, build_string ("Auto-EOL"), + Qmnemonic, build_ascstring ("Auto-EOL"), Qsubtype, Qnil), /* VERY IMPORTANT! Tell make-coding-system not to generate subsidiaries -- it needs the coding systems we're creating @@ -4897,11 +4891,11 @@ Fmake_coding_system_internal (Qundecided, Qundecided, - build_msg_string ("Undecided (auto-detect)"), + build_defer_string ("Undecided (auto-detect)"), nconc2 (list4 (Qdocumentation, - build_msg_string + build_defer_string ("Automatically detects the correct encoding."), - Qmnemonic, build_string ("Auto")), + Qmnemonic, build_ascstring ("Auto")), list6 (Qdo_eol, Qt, Qdo_coding, Qt, /* We do EOL detection ourselves so we don't need to be wrapped in an EOL detector. (It doesn't actually hurt, @@ -4910,43 +4904,43 @@ Fmake_coding_system_internal (intern ("undecided-dos"), Qundecided, - build_msg_string ("Undecided (auto-detect) (CRLF)"), + build_defer_string ("Undecided (auto-detect) (CRLF)"), nconc2 (list4 (Qdocumentation, - build_msg_string + build_defer_string ("Automatically detects the correct encoding; EOL type of CRLF forced."), - Qmnemonic, build_string ("Auto")), + Qmnemonic, build_ascstring ("Auto")), list4 (Qdo_coding, Qt, Qeol_type, Qcrlf))); Fmake_coding_system_internal (intern ("undecided-unix"), Qundecided, - build_msg_string ("Undecided (auto-detect) (LF)"), + build_defer_string ("Undecided (auto-detect) (LF)"), nconc2 (list4 (Qdocumentation, - build_msg_string + build_defer_string ("Automatically detects the correct encoding; EOL type of LF forced."), - Qmnemonic, build_string ("Auto")), + Qmnemonic, build_ascstring ("Auto")), list4 (Qdo_coding, Qt, Qeol_type, Qlf))); Fmake_coding_system_internal (intern ("undecided-mac"), Qundecided, - build_msg_string ("Undecided (auto-detect) (CR)"), + build_defer_string ("Undecided (auto-detect) (CR)"), nconc2 (list4 (Qdocumentation, - build_msg_string + build_defer_string ("Automatically detects the correct encoding; EOL type of CR forced."), - Qmnemonic, build_string ("Auto")), + Qmnemonic, build_ascstring ("Auto")), list4 (Qdo_coding, Qt, Qeol_type, Qcr))); /* Need to create this here or we're really screwed. */ Fmake_coding_system_internal (Qraw_text, Qno_conversion, - build_msg_string ("Raw Text"), + build_defer_string ("Raw Text"), nconc2 (list4 (Qdocumentation, - build_msg_string ("Raw text converts only line-break " + build_defer_string ("Raw text converts only line-break " "codes, and acts otherwise like " "`binary'."), - Qmnemonic, build_string ("Raw")), + Qmnemonic, build_ascstring ("Raw")), #ifdef MULE list2 (Qsafe_charsets, list3 (Vcharset_ascii, Vcharset_control_1, Vcharset_latin_iso8859_1)))); @@ -4957,9 +4951,9 @@ Fmake_coding_system_internal (Qbinary, Qno_conversion, - build_msg_string ("Binary"), + build_defer_string ("Binary"), nconc2 (list6 (Qdocumentation, - build_msg_string ( + build_defer_string ( "This coding system is as close as it comes to doing no conversion.\n" "On input, each byte is converted directly into the character\n" "with the corresponding code -- i.e. from the `ascii', `control-1',\n" @@ -4967,7 +4961,7 @@ "converted back to the corresponding bytes, and other characters\n" "are converted to the default character, i.e. `~'."), Qeol_type, Qlf, - Qmnemonic, build_string ("Binary")), + Qmnemonic, build_ascstring ("Binary")), #ifdef MULE list2 (Qsafe_charsets, list3 (Vcharset_ascii, Vcharset_control_1, Vcharset_latin_iso8859_1)))); diff -r d2ec55325515 -r 8f0cf4fd3d2c src/fileio.c --- a/src/fileio.c Sat Feb 06 03:59:18 2010 -0600 +++ b/src/fileio.c Sat Feb 06 04:01:46 2010 -0600 @@ -138,36 +138,19 @@ EXFUN (Frunning_temacs_p, 0); -/* DATA can be anything acceptable to signal_error (). - */ - -DOESNT_RETURN -report_file_type_error (Lisp_Object errtype, Lisp_Object oserrmess, - const CIbyte *string, Lisp_Object data) -{ - struct gcpro gcpro1; - Lisp_Object errdata = build_error_data (NULL, data); - - GCPRO1 (errdata); - errdata = Fcons (build_msg_string (string), - Fcons (oserrmess, errdata)); - signal_error_1 (errtype, errdata); - /* UNGCPRO; not reached */ -} - DOESNT_RETURN report_error_with_errno (Lisp_Object errtype, - const CIbyte *string, Lisp_Object data) + const Ascbyte *reason, Lisp_Object data) { - report_file_type_error (errtype, lisp_strerror (errno), string, data); + signal_error_2 (errtype, reason, lisp_strerror (errno), data); } /* signal a file error when errno contains a meaningful value. */ DOESNT_RETURN -report_file_error (const CIbyte *string, Lisp_Object data) +report_file_error (const Ascbyte *reason, Lisp_Object data) { - report_error_with_errno (Qfile_error, string, data); + report_error_with_errno (Qfile_error, reason, data); } @@ -182,9 +165,9 @@ { Ibyte ffff[99]; qxesprintf (ffff, "Unknown error %d", errnum); - return build_intstring (ffff); + return build_istring (ffff); } - return build_ext_string (ret, Qstrerror_encoding); + return build_extstring (ret, Qstrerror_encoding); } static Lisp_Object @@ -416,7 +399,7 @@ return Qnil; } if (wd) - xfree (wd, Ibyte *); + xfree (wd); } #if 0 /* No! This screws up efs, which calls file-name-directory on URL's @@ -429,7 +412,7 @@ qxestrncpy (newbeg, beg, len); newbeg[len] = '\0'; newbeg = mswindows_canonicalize_filename (newbeg); - return build_intstring (newbeg); + return build_istring (newbeg); } #endif #endif /* not WIN32_NATIVE */ @@ -549,7 +532,7 @@ buf = alloca_ibytes (XSTRING_LENGTH (filename) + 10); file_name_as_directory (buf, XSTRING_DATA (filename)); if (qxestrcmp (buf, XSTRING_DATA (filename))) - return build_intstring (buf); + return build_istring (buf); else return filename; } @@ -606,7 +589,7 @@ return call2_check_string (handler, Qdirectory_file_name, directory); buf = alloca_ibytes (XSTRING_LENGTH (directory) + 20); directory_file_name (XSTRING_DATA (directory), buf); - return build_intstring (buf); + return build_istring (buf); } /* Fmake_temp_name used to be a simple wrapper around mktemp(), but it @@ -787,7 +770,7 @@ if (NILP (default_directory)) default_directory = current_buffer->directory; if (! STRINGP (default_directory)) - default_directory = build_string (DEFAULT_DIRECTORY_FALLBACK); + default_directory = build_ascstring (DEFAULT_DIRECTORY_FALLBACK); if (!NILP (default_directory)) { @@ -946,7 +929,7 @@ { newnm = mswindows_canonicalize_filename (nm); if (qxestrcmp (newnm, XSTRING_DATA (name)) != 0) - name = build_intstring (newnm); + name = build_istring (newnm); } else { @@ -954,12 +937,12 @@ newnm = mswindows_canonicalize_filename (nm - 2); if (qxestrcmp (newnm, XSTRING_DATA (name)) != 0) { - name = build_intstring (newnm); + name = build_istring (newnm); XSTRING_DATA (name)[0] = DRIVE_LETTER (drive); XSTRING_DATA (name)[1] = ':'; } } - xfree (newnm, Ibyte *); + xfree (newnm); RETURN_UNGCPRO_EXIT_PROFILING (QSin_expand_file_name, name); } #endif /* WIN32_FILENAMES */ @@ -967,7 +950,7 @@ if (nm == XSTRING_DATA (name)) RETURN_UNGCPRO_EXIT_PROFILING (QSin_expand_file_name, name); RETURN_UNGCPRO_EXIT_PROFILING (QSin_expand_file_name, - build_intstring (nm)); + build_istring (nm)); #endif /* not WIN32_NATIVE */ } } @@ -1072,7 +1055,7 @@ if (newcwd) { IBYTE_STRING_TO_ALLOCA (newcwd, newdir); - xfree (newcwd, Ibyte *); + xfree (newcwd); } else newdir = NULL; @@ -1158,7 +1141,7 @@ if (newcwd) { IBYTE_STRING_TO_ALLOCA (newcwd, newdir); - xfree (newcwd, Ibyte *); + xfree (newcwd); } else #endif @@ -1332,8 +1315,8 @@ { Ibyte *newtarget = mswindows_canonicalize_filename (target); - Lisp_Object result = build_intstring (newtarget); - xfree (newtarget, Ibyte *); + Lisp_Object result = build_istring (newtarget); + xfree (newtarget); RETURN_UNGCPRO_EXIT_PROFILING (QSin_expand_file_name, result); } @@ -1761,7 +1744,7 @@ If the file does not exist, STATPTR->st_mode is set to 0. */ static void -barf_or_query_if_file_exists (Lisp_Object absname, const CIbyte *querystring, +barf_or_query_if_file_exists (Lisp_Object absname, const Ascbyte *querystring, int interactive, struct stat *statptr) { /* This function can call Lisp. GC checked 2000-07-28 ben */ @@ -1780,8 +1763,8 @@ prompt = emacs_sprintf_string - (CGETTEXT ("File %s already exists; %s anyway? "), - XSTRING_DATA (absname), CGETTEXT (querystring)); + (GETTEXT ("File %s already exists; %s anyway? "), + XSTRING_DATA (absname), GETTEXT (querystring)); GCPRO1 (prompt); tem = call1 (Qyes_or_no_p, prompt); @@ -2103,7 +2086,7 @@ NGCPRO1 (*args); ngcpro1.nvars = 3; if (string_byte (newname, XSTRING_LENGTH (newname) - 1) != '/') - args[i++] = build_string ("/"); + args[i++] = build_ascstring ("/"); args[i++] = Ffile_name_nondirectory (filename); newname = Fconcat (i, args); NUNGCPRO; @@ -2270,8 +2253,8 @@ /* netunam, being a strange-o system call only used once, is not encapsulated. */ - LISP_STRING_TO_EXTERNAL (path, path_ext, Qfile_name); - LISP_STRING_TO_EXTERNAL (login, login_ext, Quser_name_encoding); + LISP_PATHNAME_CONVERT_OUT (path, path_ext); + login_ext = LISP_STRING_TO_EXTERNAL (login, Quser_name_encoding); netresult = netunam (path_ext, login_ext); @@ -2569,16 +2552,16 @@ buf, bufsize); if (valsize < bufsize) break; /* Buffer was not long enough */ - xfree (buf, Ibyte *); + xfree (buf); bufsize *= 2; } if (valsize == -1) { - xfree (buf, Ibyte *); + xfree (buf); return Qnil; } val = make_string (buf, valsize); - xfree (buf, Ibyte *); + xfree (buf); return val; #elif defined (WIN32_NATIVE) if (mswindows_shortcuts_are_symlinks) @@ -2607,8 +2590,8 @@ if (!fname) return Qnil; { - Lisp_Object val = build_intstring (fname); - xfree (fname, Ibyte *); + Lisp_Object val = build_istring (fname); + xfree (fname); return val; } } @@ -3858,7 +3841,7 @@ ecb_crypt (raw_key, encrypted_string, rounded_size, DES_ENCRYPT | DES_SW); - return make_ext_string (encrypted_string, rounded_size, Qbinary); + return make_extstring (encrypted_string, rounded_size, Qbinary); } DEFUN ("decrypt-string", Fdecrypt_string, 2, 2, 0, /* @@ -3889,7 +3872,7 @@ ecb_crypt (raw_key, decrypted_string, string_size, D | DES_SW); - return make_ext_string (decrypted_string, string_size - 1, Qbinary); + return make_extstring (decrypted_string, string_size - 1, Qbinary); } #endif /* 0 */ @@ -4249,19 +4232,19 @@ const Extbyte *auto_save_file_name_ext; Bytecount auto_save_file_name_ext_len; - TO_EXTERNAL_FORMAT (LISP_STRING, b->auto_save_file_name, - ALLOCA, (auto_save_file_name_ext, - auto_save_file_name_ext_len), - Qescape_quoted); + LISP_STRING_TO_SIZED_EXTERNAL (b->auto_save_file_name, + auto_save_file_name_ext, + auto_save_file_name_ext_len, + Qescape_quoted); if (!NILP (b->filename)) { const Extbyte *filename_ext; Bytecount filename_ext_len; - TO_EXTERNAL_FORMAT (LISP_STRING, b->filename, - ALLOCA, (filename_ext, - filename_ext_len), - Qescape_quoted); + LISP_STRING_TO_SIZED_EXTERNAL (b->filename, + filename_ext, + filename_ext_len, + Qescape_quoted); retry_write (listdesc, filename_ext, filename_ext_len); } retry_write (listdesc, "\n", 1); @@ -4477,7 +4460,7 @@ vars_of_fileio (void) { QSin_expand_file_name = - build_msg_string ("(in expand-file-name)"); + build_defer_string ("(in expand-file-name)"); staticpro (&QSin_expand_file_name); DEFVAR_LISP ("auto-save-file-format", &Vauto_save_file_format /* @@ -4563,7 +4546,7 @@ Emacs's pid and the system name will be appended to this prefix to create a unique file name. */ ); - Vauto_save_list_file_prefix = build_string ("~/.saves-"); + Vauto_save_list_file_prefix = build_ascstring ("~/.saves-"); DEFVAR_BOOL ("inhibit-auto-save-session", &inhibit_auto_save_session /* When non-nil, inhibit auto save list file creation. diff -r d2ec55325515 -r 8f0cf4fd3d2c src/filelock.c --- a/src/filelock.c Sat Feb 06 03:59:18 2010 -0600 +++ b/src/filelock.c Sat Feb 06 04:01:46 2010 -0600 @@ -1,5 +1,5 @@ /* Copyright (C) 1985, 86, 87, 93, 94, 96 Free Software Foundation, Inc. - Copyright (C) 2001 Ben Wing. + Copyright (C) 2001, 2010 Ben Wing. This file is part of XEmacs. @@ -38,7 +38,7 @@ #ifdef CLASH_DETECTION -/* The strategy: to lock a file FN, create a symlink .#FN in FN's +/* The strategy: to lock a file FN, create a symlink .#FN# in FN's directory, with link data `user@host.pid'. This avoids a single mount (== failure) point for lock files. @@ -67,12 +67,18 @@ file names, because those are all the same systems that don't have symlinks. - This is compatible with the locking scheme used by Interleaf (which - has contributed this implementation for Emacs), and was designed by - Ethan Jacobson, Kimbo Mundy, and others. + Originally we used a name .#FN without the final #; this may have been + compatible with the locking scheme used by Interleaf (which has + contributed this implementation for Emacs), and was designed by Ethan + Jacobson, Kimbo Mundy, and others. --karl@cs.umb.edu/karl@hq.ileaf.com. */ +/* NOTE: We added the final # in the name .#FN# so that programs + that e.g. search for all .c files, such as etags, or try to + byte-compile all .el files in a directory (byte-recompile-directory), + won't get tripped up by the bogus symlink file. --ben */ + /* Here is the structure that stores information about a lock. */ @@ -89,14 +95,15 @@ /* Free the two dynamically-allocated pieces in PTR. */ #define FREE_LOCK_INFO(i) do { \ - xfree ((i).user, Ibyte *); \ - xfree ((i).host, Ibyte *); \ + xfree ((i).user); \ + xfree ((i).host); \ } while (0) -/* Write the name of the lock file for FN into LFNAME. Length will be - that of FN plus two more for the leading `.#' plus one for the null. */ +/* Write the name of the lock file for FN into LFNAME. Length will be that + of FN plus two more for the leading `.#' plus one for the trailing # + plus one for the null. */ #define MAKE_LOCK_NAME(lock, file) \ - (lock = alloca_ibytes (XSTRING_LENGTH (file) + 2 + 1), \ + (lock = alloca_ibytes (XSTRING_LENGTH (file) + 2 + 1 + 1), \ fill_in_lock_file_name (lock, file)) static void @@ -116,7 +123,10 @@ p = lockfile + dirlen; *(p++) = '.'; *(p++) = '#'; - memcpy (p, file_name + dirlen, XSTRING_LENGTH (fn) - dirlen + 1); + memcpy (p, file_name + dirlen, XSTRING_LENGTH (fn) - dirlen); + p += XSTRING_LENGTH (fn) - dirlen; + *(p++) = '#'; + *p = '\0'; } /* Lock the lock file named LFNAME. @@ -183,7 +193,7 @@ /* If nonexistent lock file, all is well; otherwise, got strange error. */ if (len == -1) { - xfree (lfinfo, Ibyte *); + xfree (lfinfo); return errno == ENOENT ? 0 : -1; } @@ -203,7 +213,7 @@ at = qxestrchr (lfinfo, '@'); dot = qxestrrchr (lfinfo, '.'); if (!at || !dot) { - xfree (lfinfo, Ibyte *); + xfree (lfinfo); return -1; } len = at - lfinfo; @@ -221,7 +231,7 @@ owner->host[len] = 0; /* We're done looking at the link info. */ - xfree (lfinfo, Ibyte *); + xfree (lfinfo); /* On current host? */ if (STRINGP (Fsystem_name ()) @@ -358,7 +368,7 @@ attack = call2_in_buffer (BUFFERP (subject_buf) ? XBUFFER (subject_buf) : current_buffer, Qask_user_about_lock , fn, - build_intstring (locker)); + build_istring (locker)); if (!NILP (attack) && current_buffer == XBUFFER (old_current_buffer)) /* User says take the lock */ { @@ -474,7 +484,7 @@ else if (owner == 2) ret = Qt; else - ret = build_intstring (locker.user); + ret = build_istring (locker.user); if (owner > 0) FREE_LOCK_INFO (locker); diff -r d2ec55325515 -r 8f0cf4fd3d2c src/floatfns.c --- a/src/floatfns.c Sat Feb 06 03:59:18 2010 -0600 +++ b/src/floatfns.c Sat Feb 06 04:01:46 2010 -0600 @@ -2454,7 +2454,7 @@ /* if (!strcmp (x->name, "pow")) x->name = "expt"; */ - args = Fcons (build_string (x->name), + args = Fcons (build_extstring (x->name, Qerror_message_encoding), Fcons (make_float (x->arg1), ((in_float == 2) ? Fcons (make_float (x->arg2), Qnil) diff -r d2ec55325515 -r 8f0cf4fd3d2c src/fns.c --- a/src/fns.c Sat Feb 06 03:59:18 2010 -0600 +++ b/src/fns.c Sat Feb 06 04:01:46 2010 -0600 @@ -81,17 +81,17 @@ if (INTP (Vprint_length)) last = min (len, XINT (Vprint_length)); - write_c_string (printcharfun, "#*"); + write_ascstring (printcharfun, "#*"); for (i = 0; i < last; i++) { if (bit_vector_bit (v, i)) - write_c_string (printcharfun, "1"); + write_ascstring (printcharfun, "1"); else - write_c_string (printcharfun, "0"); + write_ascstring (printcharfun, "0"); } if (last != len) - write_c_string (printcharfun, "..."); + write_ascstring (printcharfun, "..."); } static int @@ -3357,7 +3357,7 @@ EMACS_INT i; EMACS_INT nargs = len + len - 1; - if (len == 0) return build_string (""); + if (len == 0) return build_ascstring (""); args = alloca_array (Lisp_Object, nargs); @@ -3468,14 +3468,14 @@ add_suffix_to_symbol (Lisp_Object symbol, const Ascbyte *ascii_string) { return Fintern (concat2 (Fsymbol_name (symbol), - build_string (ascii_string)), + build_ascstring (ascii_string)), Qnil); } Lisp_Object add_prefix_to_symbol (const Ascbyte *ascii_string, Lisp_Object symbol) { - return Fintern (concat2 (build_string (ascii_string), + return Fintern (concat2 (build_ascstring (ascii_string), Fsymbol_name (symbol)), Qnil); } diff -r d2ec55325515 -r 8f0cf4fd3d2c src/font-mgr.c --- a/src/font-mgr.c Sat Feb 06 03:59:18 2010 -0600 +++ b/src/font-mgr.c Sat Feb 06 04:01:46 2010 -0600 @@ -46,6 +46,8 @@ #include "hash.h" #include "font-mgr.h" +#include "sysfile.h" + /* #### TO DO #### . The "x-xft-*" and "x_xft_*" nomenclature is mostly redundant, especially if we separate X fonts from Xft fonts, and use fontconfig more generally. @@ -159,10 +161,10 @@ is a Lisp string. */ #define extract_fcapi_string(str) \ - (NEW_LISP_STRING_TO_EXTERNAL ((str), Qfc_font_name_encoding)) + (LISP_STRING_TO_EXTERNAL ((str), Qfc_font_name_encoding)) #define build_fcapi_string(str) \ - (build_ext_string ((Extbyte *) (str), Qfc_font_name_encoding)) + (build_extstring ((Extbyte *) (str), Qfc_font_name_encoding)) /* #### This homebrew lashup should be replaced with FcConstants. @@ -180,7 +182,7 @@ ourselves; hash.c hashtables do not interpret the value pointers. This array should be FcChar8**, but GCC 4.x bitches about signedness. */ -static Extbyte *fc_standard_properties[] = { +static const Extbyte *fc_standard_properties[] = { /* treated specially, ordered first */ "family", "size", /* remaining are alphabetized by group */ @@ -265,7 +267,7 @@ CHECK_FCPATTERN(pattern); name = FcNameUnparse (XFCPATTERN_PTR (pattern)); result = build_fcapi_string (name); - xfree (name, FcChar8 *); + xfree (name); return result; } @@ -782,7 +784,7 @@ if (FcConfigAppFontAddFile (XFCCONFIG_PTR (config), /* #### FIXME! is Qfile_name right? */ - (FcChar8 *) NEW_LISP_STRING_TO_EXTERNAL (file, Qfile_name)) == FcFalse) + (FcChar8 *) LISP_STRING_TO_EXTERNAL (file, Qfile_name)) == FcFalse) return Qnil; else return Qt; @@ -801,7 +803,7 @@ if (FcConfigAppFontAddDir (XFCCONFIG_PTR (config), /* #### FIXME! is Qfile_name right? */ - (FcChar8 *) NEW_LISP_STRING_TO_EXTERNAL (dir, Qfile_name)) == FcFalse) + (FcChar8 *) LISP_STRING_TO_EXTERNAL (dir, Qfile_name)) == FcFalse) return Qnil; else return Qt; @@ -838,13 +840,13 @@ FC_CONFIG_DIR environment variable. */ (name)) { - char *fcname = ""; + const Ascbyte *fcname = ""; if (!NILP (name)) { CHECK_STRING (name); /* #### FIXME! is Qfile_name right? */ - fcname = NEW_LISP_STRING_TO_EXTERNAL (name, Qfile_name); + LISP_PATHNAME_CONVERT_OUT (name, fcname); } return (build_fcapi_string (FcConfigFilename ((FcChar8 *) fcname))); } @@ -1217,7 +1219,7 @@ unsigned i; Lisp_Object reg = Qnil; const Extbyte *re[] = /* #### This could just be catenated by - cpp and passed to build_ext_string. */ + cpp and passed to build_extstring. */ { /* Regular expression matching XLFDs as defined by XLFD v. 1.5. Matches must be case-insensitive. @@ -1264,7 +1266,7 @@ for (i = 0; i < sizeof(re)/sizeof(Extbyte *); i++) { /* #### Currently this is Host Portable Coding, not ISO 8859-1. */ - reg = concat2(reg, build_ext_string (re[i], Qx_font_name_encoding)); + reg = concat2(reg, build_extstring (re[i], Qx_font_name_encoding)); } RETURN_UNGCPRO (reg); diff -r d2ec55325515 -r 8f0cf4fd3d2c src/frame-gtk.c --- a/src/frame-gtk.c Sat Feb 06 03:59:18 2010 -0600 +++ b/src/frame-gtk.c Sat Feb 06 04:01:46 2010 -0600 @@ -332,8 +332,7 @@ for (ptr = value; *ptr; ptr++) if (!byte_ascii_p (*ptr)) { - char *tmp; - C_STRING_TO_EXTERNAL (value, tmp, Qctext); + char *tmp = ITEXT_TO_EXTERNAL (value, Qctext); the_text = tmp; break; } @@ -812,7 +811,7 @@ #endif if (STRINGP (f->name)) - TO_EXTERNAL_FORMAT (LISP_STRING, f->name, C_STRING_ALLOCA, name, Qctext); + name = LISP_STRING_TO_EXTERNAL (f->name, Qctext); else name = "emacs"; @@ -1159,12 +1158,12 @@ */ (frame)) { - char str[255]; + Ascbyte str[255]; struct frame *f = decode_gtk_frame (frame); /* Arrrrggghhh... this defeats the whole purpose of using Gdk... do we really need this? */ sprintf (str, "%lu", GDK_WINDOW_XWINDOW( GET_GTK_WIDGET_WINDOW (FRAME_GTK_TEXT_WIDGET (f)))); - return build_string (str); + return build_ascstring (str); } #endif @@ -1355,9 +1354,9 @@ gtk_widget_destroy (w); if (FRAME_GTK_GEOM_FREE_ME_PLEASE (f)) - xfree (FRAME_GTK_GEOM_FREE_ME_PLEASE (f), char *); + xfree (FRAME_GTK_GEOM_FREE_ME_PLEASE (f)); #ifndef NEW_GC - xfree (f->frame_data, void *); + xfree (f->frame_data); #endif /* not NEW_GC */ f->frame_data = 0; } diff -r d2ec55325515 -r 8f0cf4fd3d2c src/frame-msw.c --- a/src/frame-msw.c Sat Feb 06 03:59:18 2010 -0600 +++ b/src/frame-msw.c Sat Feb 06 04:01:46 2010 -0600 @@ -252,9 +252,9 @@ const Extbyte *nameext = 0; if (STRINGP (f->name)) - LISP_STRING_TO_TSTR (f->name, nameext); + nameext = LISP_STRING_TO_TSTR (f->name); else if (STRINGP (name)) - LISP_STRING_TO_TSTR (name, nameext); + nameext = LISP_STRING_TO_TSTR (name); else nameext = XETEXT (XEMACS_CLASS); hwnd = qxeCreateWindowEx (exstyle, @@ -365,7 +365,7 @@ ReleaseDC (FRAME_MSWINDOWS_HANDLE (f), FRAME_MSWINDOWS_DC (f)); DestroyWindow (FRAME_MSWINDOWS_HANDLE (f)); #ifndef NEW_GC - xfree (f->frame_data, void *); + xfree (f->frame_data); #endif /* not NEW_GC */ } f->frame_data = 0; @@ -596,7 +596,7 @@ Extbyte *title_ext; FRAME_MSWINDOWS_TITLE_CHECKSUM (f) = new_checksum; - C_STRING_TO_TSTR (title, title_ext); + title_ext = ITEXT_TO_TSTR (title); qxeSetWindowText (FRAME_MSWINDOWS_HANDLE (f), title_ext); } } @@ -608,7 +608,7 @@ struct frame *f = decode_mswindows_frame (frame); qxesprintf (str, "%lu", (unsigned long) FRAME_MSWINDOWS_HANDLE (f)); - return build_intstring (str); + return build_istring (str); } static Lisp_Object @@ -999,7 +999,7 @@ const Extbyte *nameext; if (STRINGP (f->name)) - LISP_STRING_TO_TSTR (f->name, nameext); + nameext = LISP_STRING_TO_TSTR (f->name); else nameext = XETEXT ("XEmacs print document"); di.lpszDocName = (XELPTSTR) nameext; @@ -1034,7 +1034,7 @@ EndPage (hdc); if (FRAME_MSPRINTER_JOB_STARTED (f)) EndDoc (hdc); - xfree (f->frame_data, void *); + xfree (f->frame_data); } f->frame_data = 0; diff -r d2ec55325515 -r 8f0cf4fd3d2c src/frame-x.c --- a/src/frame-x.c Sat Feb 06 03:59:18 2010 -0600 +++ b/src/frame-x.c Sat Feb 06 04:01:46 2010 -0600 @@ -466,7 +466,7 @@ init_x_prop_symbols (void) { #define def(sym, rsrc) \ - Fput (sym, Qx_resource_name, build_string (rsrc)) + Fput (sym, Qx_resource_name, build_ascstring (rsrc)) #define defi(sym,rsrc) \ def (sym, rsrc); Fput (sym, Qintegerp, Qt) @@ -515,7 +515,7 @@ color.pixel = pixel; XQueryColor (XtDisplay (w), w->core.colormap, &color); qxesprintf (buf, "#%04x%04x%04x", color.red, color.green, color.blue); - return build_intstring (buf); + return build_istring (buf); } static void @@ -651,10 +651,8 @@ for (ptr = value; *ptr; ptr++) if (!byte_ascii_p (*ptr)) { - const Extbyte *tmp; encoding = DEVICE_XATOM_COMPOUND_TEXT (XDEVICE (FRAME_DEVICE (f))); - C_STRING_TO_EXTERNAL (value, tmp, Qctext); - new_XtValue = (String) tmp; + new_XtValue = (String) ITEXT_TO_EXTERNAL (value, Qctext); break; } #endif /* MULE */ @@ -762,7 +760,7 @@ if (XSTRING_LENGTH (prop) == 0) continue; - LISP_STRING_TO_EXTERNAL (prop, extprop, Qxt_widget_arg_encoding); + extprop = LISP_STRING_TO_EXTERNAL (prop, Qxt_widget_arg_encoding); if (STRINGP (val)) { const Extbyte *extval; @@ -772,9 +770,8 @@ for the value of a widget argument; it depends on the semantics of the argument. So use of Qxt_widget_arg_encoding is totally bogus. --ben */ - TO_EXTERNAL_FORMAT (LISP_STRING, val, - ALLOCA, (extval, extvallen), - Qxt_widget_arg_encoding); + LISP_STRING_TO_SIZED_EXTERNAL (val, extval, extvallen, + Qxt_widget_arg_encoding); XtVaSetValues (w, XtVaTypedArg, extprop, /* !!#### Verify this + 1 and document as zero-termination */ @@ -854,7 +851,7 @@ internal_border_width_specified = True; } - LISP_STRING_TO_EXTERNAL (str, strext, Qxt_widget_arg_encoding); + strext = LISP_STRING_TO_EXTERNAL (str, Qxt_widget_arg_encoding); if (int_p) { CHECK_INT (val); @@ -874,9 +871,8 @@ Bytecount extvallen; CHECK_STRING (val); - TO_EXTERNAL_FORMAT (LISP_STRING, val, - ALLOCA, (extval, extvallen), - Qxt_widget_arg_encoding); + LISP_STRING_TO_SIZED_EXTERNAL (val, extval, extvallen, + Qxt_widget_arg_encoding); XtVaSetValues (w, XtVaTypedArg, /* XtN... */ strext, @@ -990,9 +986,9 @@ shell->core.widget_class->core_class.class_name, resources, XtNumber (resources), 0, 0); if (results[0]) - Vframe_title_format = build_ext_string (results[0], Qctext); + Vframe_title_format = build_extstring (results[0], Qctext); if (results[1]) - Vframe_icon_title_format = build_ext_string (results[1], Qctext); + Vframe_icon_title_format = build_extstring (results[1], Qctext); } frame_title_format_already_set = 1; @@ -1037,9 +1033,9 @@ (*num_items_out)++; } eicat_ch (ei, '\0'); - SIZED_C_STRING_TO_SIZED_EXTERNAL_MALLOC (eidata (ei), eilen (ei), - dnd_data, *len_out, - encoding); + TO_EXTERNAL_FORMAT (DATA, (eidata (ei), eilen (ei)), + MALLOC, (dnd_data, *len_out), + encoding); } else { @@ -1131,7 +1127,7 @@ } /* free the data string */ - xfree (clientData, XtPointer); + xfree (clientData); CurrentDragWidget = NULL; } @@ -1229,7 +1225,7 @@ dnd_destroy_cb_rec, NULL, 0); - xfree (dnd_data, Extbyte *); + xfree (dnd_data); return num_items ? Qt : Qnil; } @@ -1270,12 +1266,13 @@ Ibyte *fileint; Ibyte *hurl; - EXTERNAL_TO_C_STRING (transferInfo->dropData->data.files[ii], - fileint, Qfile_name); + fileint = + EXTERNAL_TO_ITEXT (transferInfo->dropData->data.files[ii], + Qfile_name); hurl = dnd_url_hexify_string (fileint, "file:"); - l_data = Fcons (build_intstring (hurl), l_data); - xfree (hurl, Ibyte *); + l_data = Fcons (build_istring (hurl), l_data); + xfree (hurl); } } else if (transferInfo->dropData->protocol == DtDND_BUFFER_TRANSFER) @@ -1297,12 +1294,12 @@ /* let us forget this name thing for now... */ /* filePath = transferInfo->dropData->data.buffers[ii].name; path = (filePath == NULL) ? Qnil - : build_ext_string (filePath, Q???); */ + : build_extstring (filePath, Q???); */ /* what, if the data is no text, and how can I tell it? */ l_data = - Fcons (list3 (list1 (build_string ("text/plain")), - build_string ("8bit"), - make_ext_string + Fcons (list3 (list1 (build_ascstring ("text/plain")), + build_ascstring ("8bit"), + make_extstring (transferInfo->dropData->data.buffers[ii].bp, transferInfo->dropData->data.buffers[ii].size, /* !!#### what goes here? */ @@ -1771,7 +1768,7 @@ #endif if (STRINGP (f->name)) - LISP_STRING_TO_EXTERNAL (f->name, name, Qctext); + name = LISP_STRING_TO_EXTERNAL (f->name, Qctext); else name = "emacs"; @@ -2208,7 +2205,7 @@ struct frame *f = decode_x_frame (frame); qxesprintf (str, "%lu", XtWindow (FRAME_X_TEXT_WIDGET (f))); - return build_intstring (str); + return build_istring (str); } @@ -2642,14 +2639,14 @@ if (FRAME_X_GEOM_FREE_ME_PLEASE (f)) { - xfree (FRAME_X_GEOM_FREE_ME_PLEASE (f), Ascbyte *); + xfree (FRAME_X_GEOM_FREE_ME_PLEASE (f)); FRAME_X_GEOM_FREE_ME_PLEASE (f) = 0; } if (f->frame_data) { #ifndef NEW_GC - xfree (f->frame_data, void *); + xfree (f->frame_data); #endif /* not NEW_GC */ f->frame_data = 0; } diff -r d2ec55325515 -r 8f0cf4fd3d2c src/frame.c --- a/src/frame.c Sat Feb 06 03:59:18 2010 -0600 +++ b/src/frame.c Sat Feb 06 04:01:46 2010 -0600 @@ -529,17 +529,17 @@ { /* We leave Vdefault_frame_name alone here so that it'll remain Qnil in the dumped executable, and we can choose it at runtime. */ - name = build_string("XEmacs"); + name = build_ascstring ("XEmacs"); } else if (NILP (Vdefault_frame_name)) { if (egetenv ("USE_EMACS_AS_DEFAULT_APPLICATION_CLASS")) { - Vdefault_frame_name = build_string ("emacs"); + Vdefault_frame_name = build_ascstring ("emacs"); } else { - Vdefault_frame_name = build_string ("XEmacs"); + Vdefault_frame_name = build_ascstring ("XEmacs"); } } @@ -585,6 +585,8 @@ update_frame_window_mirror (f); + /* #### Do we need to be calling reset_face_cachels here, and then again + down below? */ if (initialized && !DEVICE_STREAM_P (d)) { if (!NILP (f->minibuffer_window)) @@ -642,8 +644,19 @@ things. */ init_frame_toolbars (f); #endif + /* Added this assert recently (2-1-10); seems there should be only + two windows, root and minibufer. Probably we should just be + calling reset_*_cachels on the root window directly instead of the + selected window, but I want to make sure they are always the + same. --ben */ + assert (EQ (FRAME_SELECTED_WINDOW (f), f->root_window)); reset_face_cachels (XWINDOW (FRAME_SELECTED_WINDOW (f))); reset_glyph_cachels (XWINDOW (FRAME_SELECTED_WINDOW (f))); + if (!NILP (f->minibuffer_window)) + { + reset_face_cachels (XWINDOW (f->minibuffer_window)); + reset_glyph_cachels (XWINDOW (f->minibuffer_window)); + } change_frame_size (f, f->height, f->width, 0); } @@ -3491,7 +3504,7 @@ return convert_ichar_string_into_malloced_string - (Dynarr_atp (title_string_ichar_dynarr, 0), + (Dynarr_begin (title_string_ichar_dynarr), Dynarr_length (title_string_ichar_dynarr), 0); } @@ -3528,7 +3541,7 @@ if (!EQ (icon_format, title_format) || !title) { if (title) - xfree (title, Ibyte *); + xfree (title); title = generate_title_string (w, icon_format, DEFAULT_INDEX, CURRENT_DISP); @@ -3537,7 +3550,7 @@ } if (title) - xfree (title, Ibyte *); + xfree (title); } @@ -3862,16 +3875,16 @@ /* #### I would change this unilaterally but for the wrath of the Kyles of the world. */ #ifdef WIN32_NATIVE - Vframe_title_format = build_string ("%b - XEmacs"); + Vframe_title_format = build_ascstring ("%b - XEmacs"); #else - Vframe_title_format = build_string ("%S: %b"); + Vframe_title_format = build_ascstring ("%S: %b"); #endif DEFVAR_LISP ("frame-icon-title-format", &Vframe_icon_title_format /* Controls the title of the icon corresponding to the selected frame. See also the variable `frame-title-format'. */ ); - Vframe_icon_title_format = build_string ("%b"); + Vframe_icon_title_format = build_ascstring ("%b"); DEFVAR_LISP ("default-frame-name", &Vdefault_frame_name /* The default name to assign to newly-created frames. diff -r d2ec55325515 -r 8f0cf4fd3d2c src/gc.c --- a/src/gc.c Sat Feb 06 03:59:18 2010 -0600 +++ b/src/gc.c Sat Feb 06 04:01:46 2010 -0600 @@ -1,5 +1,6 @@ /* New incremental garbage collector for XEmacs. Copyright (C) 2005 Marcus Crestani. + Copyright (C) 2010 Ben Wing. This file is part of XEmacs. @@ -1376,7 +1377,7 @@ finalize_elem *temp = rest; Vfinalizers_to_run = Fcons (rest->obj, Vfinalizers_to_run); Vall_finalizable_objs = rest->next; - xfree (temp, finalize_elem *); + xfree (temp); rest = Vall_finalizable_objs; } @@ -1388,7 +1389,7 @@ finalize_elem *temp = rest->next; Vfinalizers_to_run = Fcons (rest->next->obj, Vfinalizers_to_run); rest->next = rest->next->next; - xfree (temp, finalize_elem *); + xfree (temp); } else { @@ -1496,7 +1497,7 @@ Lisp_Object args[2], whole_msg; args[0] = (STRINGP (Vgc_message) ? Vgc_message : build_msg_string (gc_default_message)); - args[1] = build_string ("..."); + args[1] = build_ascstring ("..."); whole_msg = Fconcat (2, args); echo_area_message (f, (Ibyte *) 0, whole_msg, 0, -1, Qgarbage_collecting); @@ -1624,8 +1625,9 @@ { /* staticpro() */ Lisp_Object **p = Dynarr_begin (staticpros); + Elemcount len = Dynarr_length (staticpros); Elemcount count; - for (count = Dynarr_length (staticpros); count; count--, p++) + for (count = 0; count < len; count++, p++) /* Need to check if the pointer in the staticpro array is not NULL. A gc can occur after variable is added to the staticpro array and _before_ it is correctly initialized. In this case @@ -1636,8 +1638,9 @@ { /* staticpro_nodump() */ Lisp_Object **p = Dynarr_begin (staticpros_nodump); + Elemcount len = Dynarr_length (staticpros_nodump); Elemcount count; - for (count = Dynarr_length (staticpros_nodump); count; count--, p++) + for (count = 0; count < len; count++, p++) /* Need to check if the pointer in the staticpro array is not NULL. A gc can occur after variable is added to the staticpro array and _before_ it is correctly initialized. In this case @@ -1649,9 +1652,10 @@ #ifdef NEW_GC { /* mcpro () */ Lisp_Object *p = Dynarr_begin (mcpros); + Elemcount len = Dynarr_length (mcpros); Elemcount count; - for (count = Dynarr_length (mcpros); count; count--) - mark_object (*p++); + for (count = 0; count < len; count++, p++) + mark_object (*p); } #endif /* NEW_GC */ @@ -2098,7 +2102,7 @@ { staticpro_nodump (&pre_gc_cursor); - QSin_garbage_collection = build_msg_string ("(in garbage collection)"); + QSin_garbage_collection = build_defer_string ("(in garbage collection)"); staticpro (&QSin_garbage_collection); DEFVAR_INT ("gc-cons-threshold", &gc_cons_threshold /* @@ -2193,7 +2197,7 @@ image instance) in the domain of the selected frame, the mouse pointer will change instead of this message being printed. */ ); - Vgc_message = build_string (gc_default_message); + Vgc_message = build_defer_string (gc_default_message); DEFVAR_LISP ("gc-pointer-glyph", &Vgc_pointer_glyph /* Pointer glyph used to indicate that a garbage collection is in progress. diff -r d2ec55325515 -r 8f0cf4fd3d2c src/gccache-gtk.c --- a/src/gccache-gtk.c Sat Feb 06 03:59:18 2010 -0600 +++ b/src/gccache-gtk.c Sat Feb 06 04:01:46 2010 -0600 @@ -141,13 +141,13 @@ { gdk_gc_destroy(rest->gc); next = rest->next; - xfree (rest, struct gc_cache_cell *); + xfree (rest); rest = next; } #ifdef GCCACHE_HASH free_hash_table (cache->table); #endif - xfree (cache, struct gc_cache *); + xfree (cache); } GdkGC * diff -r d2ec55325515 -r 8f0cf4fd3d2c src/gccache-x.c --- a/src/gccache-x.c Sat Feb 06 03:59:18 2010 -0600 +++ b/src/gccache-x.c Sat Feb 06 04:01:46 2010 -0600 @@ -138,13 +138,13 @@ { XFreeGC (cache->dpy, rest->gc); next = rest->next; - xfree (rest, struct gc_cache_cell *); + xfree (rest); rest = next; } #ifdef GCCACHE_HASH free_hash_table (cache->table); #endif - xfree (cache, struct gc_cache *); + xfree (cache); } GC diff -r d2ec55325515 -r 8f0cf4fd3d2c src/glade.c --- a/src/glade.c Sat Feb 06 03:59:18 2010 -0600 +++ b/src/glade.c Sat Feb 06 04:01:46 2010 -0600 @@ -59,7 +59,7 @@ if (signal_data && signal_data[0]) { lisp_data - = IGNORE_MULTIPLE_VALUES (Feval (Fread (build_string (signal_data)))); + = IGNORE_MULTIPLE_VALUES (Feval (Fread (build_cistring (signal_data)))); } /* obj, name, func, cb_data, object_signal, after_p */ @@ -132,7 +132,7 @@ #else the_domain = GLADE_XML (XGTK_OBJECT (xml)->object)->textdomain; #endif - return (build_string (the_domain)); + return (build_cistring (the_domain)); } void syms_of_glade (void) diff -r d2ec55325515 -r 8f0cf4fd3d2c src/glyphs-eimage.c --- a/src/glyphs-eimage.c Sat Feb 06 03:59:18 2010 -0600 +++ b/src/glyphs-eimage.c Sat Feb 06 04:01:46 2010 -0600 @@ -173,7 +173,7 @@ retry_fclose (data->instream); if (data->eimage) - xfree (data->eimage, Binbyte *); + xfree (data->eimage); return Qnil; } @@ -321,7 +321,7 @@ /* Create the message */ (*cinfo->err->format_message) (cinfo, buffer); - EXTERNAL_TO_C_STRING (buffer, intbuf, Qjpeg_error_message_encoding); + intbuf = EXTERNAL_TO_ITEXT (buffer, Qjpeg_error_message_encoding); warn_when_safe (Qjpeg, Qinfo, "%s", intbuf); } @@ -375,7 +375,7 @@ /* Create the message */ (*cinfo.err->format_message) ((j_common_ptr) &cinfo, buffer); - errstring = build_ext_string (buffer, Qjpeg_error_message_encoding); + errstring = build_extstring (buffer, Qjpeg_error_message_encoding); signal_image_error_2 ("JPEG decoding error", errstring, instantiator); @@ -396,7 +396,7 @@ /* #### This is a definite problem under Mule due to the amount of stack data it might allocate. Need to be able to convert and write out to a file. */ - TO_EXTERNAL_FORMAT (LISP_STRING, data, ALLOCA, (bytes, len), Qbinary); + LISP_STRING_TO_SIZED_EXTERNAL (data, bytes, len, Qbinary); jpeg_memory_src (&cinfo, (JOCTET *) bytes, len); } @@ -573,7 +573,7 @@ FreeSavedImages(data->giffile); } if (data->eimage) - xfree (data->eimage, Binbyte *); + xfree (data->eimage); return Qnil; } @@ -660,7 +660,7 @@ assert (!NILP (data)); - TO_EXTERNAL_FORMAT (LISP_STRING, data, ALLOCA, (bytes, len), Qbinary); + LISP_STRING_TO_SIZED_EXTERNAL (data, bytes, len, Qbinary); mem_struct.bytes = bytes; mem_struct.len = len; mem_struct.index = 0; @@ -874,7 +874,7 @@ retry_fclose (data->instream); if (data->eimage) - xfree(data->eimage, Binbyte *); + xfree (data->eimage); return Qnil; } @@ -902,7 +902,8 @@ /* Something blew up: just display the error (cleanup happens in the unwind) */ signal_image_error_2 ("Error decoding PNG", - build_string(png_err_stct.err_str), + build_extstring (png_err_stct.err_str, + Qerror_message_encoding), instantiator); } @@ -942,7 +943,7 @@ /* #### This is a definite problem under Mule due to the amount of stack data it might allocate. Need to think about using Lstreams */ - TO_EXTERNAL_FORMAT (LISP_STRING, data, ALLOCA, (bytes, len), Qbinary); + LISP_STRING_TO_SIZED_EXTERNAL (data, bytes, len, Qbinary); tbr.bytes = bytes; tbr.len = len; tbr.index = 0; @@ -1069,7 +1070,7 @@ } } - xfree (row_pointers, Binbyte **); + xfree (row_pointers); } /* now instantiate */ @@ -1129,7 +1130,7 @@ TIFFClose(data->tiff); } if (data->eimage) - xfree (data->eimage, Binbyte *); + xfree (data->eimage); return Qnil; } @@ -1300,7 +1301,8 @@ /* An error was signaled. No clean up is needed, as unwind handles that for us. Just pass the error along. */ signal_image_error_2 ("TIFF decoding error", - build_string(tiff_err_data.err_str), + build_extstring (tiff_err_data.err_str, + Qerror_message_encoding), instantiator); } TIFFSetErrorHandler ((TIFFErrorHandler)tiff_error_func); @@ -1318,9 +1320,7 @@ /* #### This is a definite problem under Mule due to the amount of stack data it might allocate. Think about Lstreams... */ - TO_EXTERNAL_FORMAT (LISP_STRING, data, - ALLOCA, (bytes, len), - Qbinary); + LISP_STRING_TO_SIZED_EXTERNAL (data, bytes, len, Qbinary); mem_struct.bytes = bytes; mem_struct.len = len; mem_struct.index = 0; diff -r d2ec55325515 -r 8f0cf4fd3d2c src/glyphs-gtk.c --- a/src/glyphs-gtk.c Sat Feb 06 03:59:18 2010 -0600 +++ b/src/glyphs-gtk.c Sat Feb 06 04:01:46 2010 -0600 @@ -268,7 +268,7 @@ #endif } } - xfree(qtable, quant_table *); + xfree (qtable); } else { unsigned long rshift,gshift,bshift,rbits,gbits,bbits,junk; junk = vis->red_mask; @@ -362,7 +362,7 @@ if (IMAGE_INSTANCE_GTK_MASK (p)) write_fmt_string (printcharfun, "/0x%lx", (unsigned long) IMAGE_INSTANCE_GTK_MASK (p)); - write_c_string (printcharfun, ")"); + write_ascstring (printcharfun, ")"); break; #ifdef HAVE_SUBWINDOWS case IMAGE_SUBWINDOW: @@ -422,7 +422,7 @@ gdk_pixmap_unref (IMAGE_INSTANCE_GTK_PIXMAP_SLICE (p,i)); IMAGE_INSTANCE_GTK_PIXMAP_SLICE (p, i) = 0; } - xfree (IMAGE_INSTANCE_GTK_PIXMAP_SLICES (p), GdkPixmap **); + xfree (IMAGE_INSTANCE_GTK_PIXMAP_SLICES (p)); IMAGE_INSTANCE_GTK_PIXMAP_SLICES (p) = 0; } @@ -450,11 +450,11 @@ && IMAGE_INSTANCE_TYPE (p) != IMAGE_SUBWINDOW && IMAGE_INSTANCE_GTK_PIXELS (p)) { - xfree (IMAGE_INSTANCE_GTK_PIXELS (p), unsigned long *); + xfree (IMAGE_INSTANCE_GTK_PIXELS (p)); IMAGE_INSTANCE_GTK_PIXELS (p) = 0; } - xfree (p->data, void *); + xfree (p->data); p->data = 0; } @@ -907,7 +907,7 @@ if (!gdk_image) { if (pixtbl) - xfree (pixtbl, unsigned long *); + xfree (pixtbl); signal_image_error("EImage to GdkImage conversion failed", instantiator); } @@ -1089,9 +1089,9 @@ if (!NILP (mask_data)) { - TO_EXTERNAL_FORMAT (LISP_STRING, XCAR (XCDR (XCDR (mask_data))), - C_STRING_ALLOCA, gcc_may_you_rot_in_hell, - Qfile_name); + gcc_may_you_rot_in_hell = + LISP_STRING_TO_EXTERNAL (XCAR (XCDR (XCDR (mask_data))), + Qfile_name); mask = pixmap_from_xbm_inline (IMAGE_INSTANCE_DEVICE (ii), XINT (XCAR (mask_data)), @@ -1116,9 +1116,7 @@ assert (!NILP (data)); - TO_EXTERNAL_FORMAT (LISP_STRING, XCAR (XCDR (XCDR (data))), - C_STRING_ALLOCA, gcc_go_home, - Qbinary); + gcc_go_home = LISP_STRING_TO_EXTERNAL (XCAR (XCDR (XCDR (data))), Qbinary); xbm_instantiate_1 (image_instance, instantiator, pointer_fg, pointer_bg, dest_mask, XINT (XCAR (data)), @@ -1256,7 +1254,7 @@ &nsymbols); assert (!NILP (data)); - LISP_STRING_TO_EXTERNAL(data, dstring, Qbinary); + dstring = LISP_STRING_TO_EXTERNAL (data, Qbinary); /* * GTK only uses the 'c' color entry of an XPM and doesn't use the symbolic @@ -1302,7 +1300,7 @@ } if (color_symbols) - xfree (color_symbols, struct color_symbol *); + xfree (color_symbols); if (!pixmap) signal_image_error ("Error reading pixmap", data); @@ -1383,7 +1381,7 @@ assert (!NILP (data)); - LISP_STRING_TO_EXTERNAL (data, dstring, Qbinary); + dstring = LISP_STRING_TO_EXTERNAL (data, Qbinary); if ((p = strchr (dstring, ':'))) { @@ -1775,7 +1773,7 @@ source = gdk_font_load (source_name); if (! source) gui_error_2 ("couldn't load font", - build_string (source_name), + build_cistring (source_name), data); if (count == 2) mask = 0; @@ -1787,7 +1785,7 @@ if (!mask) /* continuable */ Fsignal (Qgui_error, list3 (build_msg_string ("couldn't load font"), - build_string (mask_name), data)); + build_cistring (mask_name), data)); } if (!mask) mask_char = 0; @@ -1930,9 +1928,7 @@ if (!(dest_mask & IMAGE_POINTER_MASK)) incompatible_image_types (instantiator, dest_mask, IMAGE_POINTER_MASK); - TO_EXTERNAL_FORMAT (LISP_STRING, data, - C_STRING_ALLOCA, name_ext, - Qfile_name); + name_ext = LISP_STRING_TO_EXTERNAL (data, Qfile_name); if ((i = cursor_name_to_index (name_ext)) == -1) invalid_argument ("Unrecognized cursor-font name", data); @@ -2131,7 +2127,7 @@ { char* str; Lisp_Object val = IMAGE_INSTANCE_WIDGET_TEXT (p); - LISP_STRING_TO_EXTERNAL (val, str, Qnative); + str = LISP_STRING_TO_EXTERNAL (val, Qnative); /* #### Need to special case each type of GtkWidget here! */ } @@ -2279,7 +2275,7 @@ if (!NILP (IMAGE_INSTANCE_WIDGET_TEXT (ii))) { - LISP_STRING_TO_EXTERNAL (IMAGE_INSTANCE_WIDGET_TEXT (ii), nm, Qnative); + nm = LISP_STRING_TO_EXTERNAL (IMAGE_INSTANCE_WIDGET_TEXT (ii), Qnative); } ii->data = xnew_and_zero (struct gtk_subwindow_data); @@ -2534,9 +2530,7 @@ name = item; } - TO_EXTERNAL_FORMAT (LISP_STRING, name, - C_STRING_ALLOCA, c_name, - Qctext); + c_name = LISP_STRING_TO_EXTERNAL (name, Qctext); /* Dummy widget that the notbook wants to display when a tab is selected. */ box = gtk_vbox_new (FALSE, 3); @@ -2941,7 +2935,7 @@ vector3 (Qxbm, Q_data, \ list3 (make_int (name##_width), \ make_int (name##_height), \ - make_ext_string ((Extbyte*) name##_bits, \ + make_extstring ((Extbyte*) name##_bits, \ sizeof (name##_bits), \ Qbinary))), \ Qglobal, Qgtk, Qnil) diff -r d2ec55325515 -r 8f0cf4fd3d2c src/glyphs-msw.c --- a/src/glyphs-msw.c Sat Feb 06 03:59:18 2010 -0600 +++ b/src/glyphs-msw.c Sat Feb 06 04:01:46 2010 -0600 @@ -202,7 +202,7 @@ if (!bmp_data) { - xfree (bmp_info, BITMAPINFO *); + xfree (bmp_info); return NULL; } @@ -233,7 +233,7 @@ sizeof(RGBQUAD) * ncolors); if (!bmp_info) { - xfree (qtable, quant_table *); + xfree (qtable); return NULL; } @@ -251,8 +251,8 @@ if (!*bmp_data) { - xfree (qtable, quant_table *); - xfree (bmp_info, BITMAPINFO *); + xfree (qtable); + xfree (bmp_info); return NULL; } @@ -279,7 +279,7 @@ *dp++ = QUANT_GET_COLOR (qtable,rd,gr,bl); } } - xfree (qtable, quant_table *); + xfree (qtable); } /* fix up the standard stuff */ bmp_info->bmiHeader.biWidth = width; @@ -474,8 +474,8 @@ image_instance_add_dibitmap (ii, bmp_info, bmp_data, bmp_bits, slice, instantiator); - xfree (bmp_info, BITMAPINFO *); - xfree (bmp_data, Binbyte *); + xfree (bmp_info); + xfree (bmp_data); } } @@ -543,7 +543,7 @@ (void **) (void *) &and_bits, 0,0))) { - xfree (bmp_info, BITMAPINFO *); + xfree (bmp_info); return; } @@ -570,7 +570,7 @@ bmp_info, DIB_RGB_COLORS) <= 0) { - xfree (bmp_info, BITMAPINFO *); + xfree (bmp_info); return; } @@ -602,8 +602,8 @@ bmp_info, DIB_RGB_COLORS); - xfree (bmp_info, BITMAPINFO *); - xfree (dibits, Binbyte *); + xfree (bmp_info); + xfree (dibits); SelectObject(hcdc, old); @@ -854,7 +854,7 @@ colortbl = xnew_array_and_zero (COLORREF, xpmimage.ncolors); if (!colortbl) { - xfree (*data, Binbyte *); + xfree (*data); XpmFreeXpmImage (&xpmimage); XpmFreeXpmInfo (&xpminfo); return 0; @@ -910,8 +910,8 @@ } label_no_color: - xfree (*data, Binbyte *); - xfree (colortbl, COLORREF *); + xfree (*data); + xfree (colortbl); XpmFreeXpmImage (&xpmimage); XpmFreeXpmInfo (&xpminfo); return 0; @@ -937,7 +937,7 @@ XpmFreeXpmImage (&xpmimage); XpmFreeXpmInfo (&xpminfo); - xfree (colortbl, COLORREF *); + xfree (colortbl); return TRUE; } @@ -968,9 +968,7 @@ assert (!NILP (data)); - TO_EXTERNAL_FORMAT (LISP_STRING, data, - ALLOCA, (bytes, len), - Qbinary); + LISP_STRING_TO_SIZED_EXTERNAL (data, bytes, len, Qbinary); /* in case we have color symbols */ color_symbols = extract_xpm_color_names (device, domain, @@ -988,9 +986,9 @@ { while (nsymbols--) { - xfree (color_symbols[nsymbols].name, Ibyte *); + xfree (color_symbols[nsymbols].name); } - xfree(color_symbols, struct color_symbol *); + xfree (color_symbols); } /* build a bitmap from the eimage */ @@ -1000,15 +998,15 @@ signal_image_error ("XPM to EImage conversion failed", image_instance); } - xfree (eimage, Binbyte *); + xfree (eimage); /* Now create the pixmap and set up the image instance */ init_image_instance_from_dibitmap (ii, bmp_info, dest_mask, bmp_data, bmp_bits, 1, instantiator, x_hot, y_hot, transp); - xfree (bmp_info, BITMAPINFO *); - xfree (bmp_data, Binbyte *); + xfree (bmp_info); + xfree (bmp_data); } #endif /* HAVE_XPM */ @@ -1055,9 +1053,7 @@ assert (!NILP (data)); - TO_EXTERNAL_FORMAT (LISP_STRING, data, - ALLOCA, (bytes, len), - Qbinary); + LISP_STRING_TO_SIZED_EXTERNAL (data, bytes, len, Qbinary); /* Then slurp the image into memory, decoding along the way. The result is the image in a simple one-byte-per-pixel @@ -1101,7 +1097,7 @@ typedef struct { - CIbyte *name; + const Ascbyte *name; int resource_id; } resource_t; @@ -1254,7 +1250,7 @@ type)); if (!resid) - LISP_STRING_TO_TSTR (resource_id, resid); + resid = LISP_STRING_TO_TSTR (resource_id); } } else if (!(resid = MAKEINTRESOURCE (resource_name_to_resource (resource_id, @@ -1361,7 +1357,7 @@ if (!new_data) { - xfree (bmp_info, BITMAPINFO *); + xfree (bmp_info); return NULL; } @@ -1412,17 +1408,17 @@ &bmp_buf, 0,0); - xfree (bmp_info, BITMAPINFO *); + xfree (bmp_info); if (!bitmap || !bmp_buf) { - xfree (new_data, Binbyte *); + xfree (new_data); return NULL; } /* copy in the actual bitmap */ memcpy (bmp_buf, new_data, height * new_width); - xfree (new_data, Binbyte *); + xfree (new_data); return bitmap; } @@ -1573,9 +1569,9 @@ { Binbyte *ext_data; - TO_EXTERNAL_FORMAT (LISP_STRING, XCAR (XCDR (XCDR (mask_data))), - C_STRING_ALLOCA, ext_data, - Qbinary); + ext_data = + (Binbyte *) LISP_STRING_TO_EXTERNAL (XCAR (XCDR (XCDR (mask_data))), + Qbinary); mask = xbm_create_bitmap_from_data (hdc, ext_data, XINT (XCAR (mask_data)), @@ -1603,9 +1599,9 @@ assert (!NILP (data)); - TO_EXTERNAL_FORMAT (LISP_STRING, XCAR (XCDR (XCDR (data))), - C_STRING_ALLOCA, ext_data, - Qbinary); + ext_data = + (const Binbyte *) LISP_STRING_TO_EXTERNAL (XCAR (XCDR (XCDR (data))), + Qbinary); xbm_instantiate_1 (image_instance, instantiator, pointer_fg, pointer_bg, dest_mask, XINT (XCAR (data)), @@ -1650,9 +1646,7 @@ assert (!NILP (data)); - TO_EXTERNAL_FORMAT (LISP_STRING, data, - C_STRING_ALLOCA, dstring, - Qbinary); + dstring = (const Binbyte *) LISP_STRING_TO_EXTERNAL (data, Qbinary); if ((p = (Binbyte *) strchr ((char *) dstring, ':'))) { @@ -1724,7 +1718,7 @@ write_fmt_string (printcharfun, "/0x%lx", (unsigned long) IMAGE_INSTANCE_MSWINDOWS_MASK (p)); } - write_c_string (printcharfun, ")"); + write_ascstring (printcharfun, ")"); break; default: @@ -1784,7 +1778,7 @@ DeleteObject (IMAGE_INSTANCE_MSWINDOWS_BITMAP_SLICE (p, i)); IMAGE_INSTANCE_MSWINDOWS_BITMAP_SLICE (p, i) = 0; } - xfree (IMAGE_INSTANCE_MSWINDOWS_BITMAP_SLICES (p), HBITMAP *); + xfree (IMAGE_INSTANCE_MSWINDOWS_BITMAP_SLICES (p)); IMAGE_INSTANCE_MSWINDOWS_BITMAP_SLICES (p) = 0; } if (IMAGE_INSTANCE_MSWINDOWS_MASK (p)) @@ -1798,7 +1792,7 @@ if (p->data) { - xfree (p->data, void *); + xfree (p->data); p->data = 0; } } @@ -2032,7 +2026,7 @@ && !NILP (IMAGE_INSTANCE_WIDGET_TEXT (p))) { Extbyte *lparam = 0; - LISP_STRING_TO_TSTR (IMAGE_INSTANCE_WIDGET_TEXT (p), lparam); + lparam = LISP_STRING_TO_TSTR (IMAGE_INSTANCE_WIDGET_TEXT (p)); qxeSendMessage (WIDGET_INSTANCE_MSWINDOWS_HANDLE (p), WM_SETTEXT, 0, (LPARAM) lparam); } @@ -2250,7 +2244,7 @@ } if (!NILP (IMAGE_INSTANCE_WIDGET_TEXT (ii))) - LISP_STRING_TO_TSTR (IMAGE_INSTANCE_WIDGET_TEXT (ii), nm); + nm = LISP_STRING_TO_TSTR (IMAGE_INSTANCE_WIDGET_TEXT (ii)); /* allocate space for the clip window and then allocate the clip window */ ii->data = xnew_and_zero (struct mswindows_subwindow_data); @@ -2272,7 +2266,7 @@ gui_error ("window creation failed with code", make_int (GetLastError())); - C_STRING_TO_TSTR (class_, classext); + classext = ITEXT_TO_TSTR (class_); if ((wnd = qxeCreateWindowEx (exflags /* | WS_EX_NOPARENTNOTIFY*/, classext, @@ -2486,10 +2480,11 @@ tvitem.item.lParam = mswindows_register_gui_item (image_instance, item, domain); tvitem.item.mask |= TVIF_PARAM; - LISP_STRING_TO_TSTR (XGUI_ITEM (item)->name, tvitem.item.pszText); + tvitem.item.pszText = + (LPWSTR) LISP_STRING_TO_TSTR (XGUI_ITEM (item)->name); } else - LISP_STRING_TO_TSTR (item, tvitem.item.pszText); + tvitem.item.pszText = (LPWSTR) LISP_STRING_TO_TSTR (item); tvitem.item.cchTextMax = qxetcslen ((Extbyte *) tvitem.item.pszText); @@ -2602,12 +2597,12 @@ tcitem.lParam = mswindows_register_gui_item (image_instance, item, domain); tcitem.mask |= TCIF_PARAM; - LISP_STRING_TO_TSTR (XGUI_ITEM (item)->name, tcitem.pszText); + tcitem.pszText = (XELPTSTR) LISP_STRING_TO_TSTR (XGUI_ITEM (item)->name); } else { CHECK_STRING (item); - LISP_STRING_TO_TSTR (item, tcitem.pszText); + tcitem.pszText = (XELPTSTR) LISP_STRING_TO_TSTR (item); } tcitem.cchTextMax = qxetcslen ((Extbyte *) tcitem.pszText); @@ -2813,7 +2808,7 @@ LIST_LOOP (rest, items) { Extbyte *lparam; - LISP_STRING_TO_TSTR (XCAR (rest), lparam); + lparam = LISP_STRING_TO_TSTR (XCAR (rest)); if (qxeSendMessage (wnd, CB_ADDSTRING, 0, (LPARAM)lparam) == CB_ERR) gui_error ("error adding combo entries", instantiator); } @@ -2930,8 +2925,7 @@ SIZE size; SelectObject (hdc, mswindows_widget_hfont (face, domain, string)); - TO_EXTERNAL_FORMAT (LISP_STRING, string, ALLOCA, (str, len), - Qmswindows_tstr); + LISP_STRING_TO_SIZED_EXTERNAL (string, str, len, Qmswindows_tstr); qxeGetTextExtentPoint32 (hdc, str, len / XETCHAR_SIZE, &size); *width = size.cx; } diff -r d2ec55325515 -r 8f0cf4fd3d2c src/glyphs-x.c --- a/src/glyphs-x.c Sat Feb 06 03:59:18 2010 -0600 +++ b/src/glyphs-x.c Sat Feb 06 04:01:46 2010 -0600 @@ -272,7 +272,7 @@ #endif } } - xfree (qtable, quant_table *); + xfree (qtable); } else { unsigned long rshift,gshift,bshift,rbits,gbits,bbits,junk; junk = vis->red_mask; @@ -370,7 +370,7 @@ write_fmt_string (printcharfun, "/0x%lx", (unsigned long) IMAGE_INSTANCE_X_MASK (p)); } - write_c_string (printcharfun, ")"); + write_ascstring (printcharfun, ")"); break; default: break; @@ -438,7 +438,7 @@ XFreePixmap (dpy, IMAGE_INSTANCE_X_PIXMAP_SLICE (p,i)); IMAGE_INSTANCE_X_PIXMAP_SLICE (p, i) = 0; } - xfree (IMAGE_INSTANCE_X_PIXMAP_SLICES (p), Pixmap *); + xfree (IMAGE_INSTANCE_X_PIXMAP_SLICES (p)); IMAGE_INSTANCE_X_PIXMAP_SLICES (p) = 0; } @@ -466,11 +466,11 @@ && IMAGE_INSTANCE_TYPE (p) != IMAGE_SUBWINDOW && IMAGE_INSTANCE_X_PIXELS (p)) { - xfree (IMAGE_INSTANCE_X_PIXELS (p), unsigned long *); + xfree (IMAGE_INSTANCE_X_PIXELS (p)); IMAGE_INSTANCE_X_PIXELS (p) = 0; } - xfree (p->data, void *); + xfree (p->data); p->data = 0; } @@ -594,15 +594,15 @@ Extbyte *pathext; SubstitutionRec subs[1]; subs[0].match = 'B'; - LISP_STRING_TO_EXTERNAL (name, subs[0].substitution, Qfile_name); - C_STRING_TO_EXTERNAL (path, pathext, Qfile_name); + LISP_PATHNAME_CONVERT_OUT (name, subs[0].substitution); + pathext = ITEXT_TO_EXTERNAL (path, Qfile_name); /* #### Motif uses a big hairy default if $XBMLANGPATH isn't set. We don't. If you want it used, set it. */ if (pathext && (pathext = XtResolvePathname (display, "bitmaps", 0, 0, pathext, subs, XtNumber (subs), 0))) { - name = build_ext_string (pathext, Qfile_name); + name = build_extstring (pathext, Qfile_name); XtFree (pathext); return (name); } @@ -620,7 +620,7 @@ { Ibyte *path; - EXTERNAL_TO_C_STRING (value.addr, path, Qfile_name); + path = EXTERNAL_TO_ITEXT (value.addr, Qfile_name); Vx_bitmap_file_path = split_env_path (0, path); } Vx_bitmap_file_path = nconc2 (Vx_bitmap_file_path, @@ -1033,7 +1033,7 @@ if (!ximage) { if (pixtbl) - xfree (pixtbl, unsigned long *); + xfree (pixtbl); signal_image_error ("EImage to XImage conversion failed", instantiator); } @@ -1051,7 +1051,7 @@ { if (ximage->data) { - xfree (ximage->data, char *); + xfree (ximage->data); ximage->data = 0; } XDestroyImage (ximage); @@ -1228,8 +1228,8 @@ { CBinbyte *ext_data; - LISP_STRING_TO_EXTERNAL (XCAR (XCDR (XCDR (mask_data))), ext_data, - Qbinary); + ext_data = LISP_STRING_TO_EXTERNAL (XCAR (XCDR (XCDR (mask_data))), + Qbinary); mask = pixmap_from_xbm_inline (IMAGE_INSTANCE_DEVICE (ii), XINT (XCAR (mask_data)), XINT (XCAR (XCDR (mask_data))), @@ -1253,7 +1253,7 @@ assert (!NILP (data)); - LISP_STRING_TO_EXTERNAL (XCAR (XCDR (XCDR (data))), ext_data, Qbinary); + ext_data = LISP_STRING_TO_EXTERNAL (XCAR (XCDR (XCDR (data))), Qbinary); xbm_instantiate_1 (image_instance, instantiator, pointer_fg, pointer_bg, dest_mask, XINT (XCAR (data)), @@ -1338,8 +1338,8 @@ if (! XAllocColor (dpy, cmap, &color)) ABORT (); /* it must be allocable since we're just duplicating it */ - TO_EXTERNAL_FORMAT (LISP_STRING, XCAR (cons), C_STRING_MALLOC, - symbols[i].name, Qctext); + + symbols[i].name = LISP_STRING_TO_EXTERNAL_MALLOC (XCAR (cons), Qctext); symbols[i].pixel = color.pixel; symbols[i].value = 0; free_cons (cons); @@ -1460,7 +1460,7 @@ { Extbyte *dataext; - LISP_STRING_TO_EXTERNAL (data, dataext, Qctext); + dataext = LISP_STRING_TO_EXTERNAL (data, Qctext); result = XpmCreatePixmapFromBuffer (dpy, @@ -1474,8 +1474,8 @@ int i; for (i = 0; i < (int) xpmattrs.numsymbols; i++) - xfree (color_symbols[i].name, char *); - xfree (color_symbols, XpmColorSymbol *); + xfree (color_symbols[i].name); + xfree (color_symbols); xpmattrs.colorsymbols = 0; /* in case XpmFreeAttr is too smart... */ xpmattrs.numsymbols = 0; } @@ -1612,9 +1612,7 @@ assert (!NILP (data)); - TO_EXTERNAL_FORMAT (LISP_STRING, data, - C_STRING_ALLOCA, dstring, - Qbinary); + dstring = (const Binbyte *) LISP_STRING_TO_EXTERNAL (data, Qbinary); if ((p = (Binbyte *) strchr ((char *) dstring, ':'))) { @@ -1787,7 +1785,7 @@ if (dest_mask & IMAGE_POINTER_MASK) { const char *name_ext; - LISP_STRING_TO_EXTERNAL (data, name_ext, Qfile_name); + LISP_PATHNAME_CONVERT_OUT (data, name_ext); if (XmuCursorNameToIndex (name_ext) != -1) { result = alist_to_tagged_vector (Qcursor_font, alist); @@ -1851,13 +1849,11 @@ { Font font; int (*old_handler) (Display *, XErrorEvent *); - Extbyte *nameext; XLoadFont_got_error = 0; XSync (dpy, 0); old_handler = XSetErrorHandler (XLoadFont_error_handler); - C_STRING_TO_EXTERNAL (name, nameext, Qfile_name); - font = XLoadFont (dpy, nameext); + font = XLoadFont (dpy, ITEXT_TO_EXTERNAL (name, Qfile_name)); XSync (dpy, 0); XSetErrorHandler (old_handler); if (XLoadFont_got_error) return 0; @@ -1923,7 +1919,7 @@ source = safe_XLoadFont (dpy, source_name); if (! source) signal_error_2 (Qgui_error, - "couldn't load font", build_intstring (source_name), data); + "couldn't load font", build_istring (source_name), data); if (count == 2) mask = 0; else if (!mask_name[0]) @@ -1934,7 +1930,7 @@ if (!mask) signal_continuable_error_2 (Qgui_error, "couldn't load font", - build_intstring (mask_name), data); + build_istring (mask_name), data); } if (!mask) mask_char = 0; @@ -1990,7 +1986,7 @@ if (!(dest_mask & IMAGE_POINTER_MASK)) incompatible_image_types (instantiator, dest_mask, IMAGE_POINTER_MASK); - LISP_STRING_TO_EXTERNAL (data, name_ext, Qfile_name); + LISP_PATHNAME_CONVERT_OUT (data, name_ext); if ((i = XmuCursorNameToIndex (name_ext)) == -1) invalid_argument ("Unrecognized cursor-font name", data); @@ -2201,7 +2197,7 @@ { Extbyte* str; Lisp_Object val = IMAGE_INSTANCE_WIDGET_TEXT (p); - LISP_STRING_TO_EXTERNAL (val, str, Qlwlib_encoding); + str = LISP_STRING_TO_EXTERNAL (val, Qlwlib_encoding); wv->value = str; } @@ -2333,8 +2329,7 @@ (FRAME_DEVICE (XFRAME (sw->frame)))); LISP_TO_EXTERNAL (property, propext, Qctext); - TO_EXTERNAL_FORMAT (LISP_STRING, data, - ALLOCA, (dataext, datalen), Qctext); + LISP_STRING_TO_SIZED_EXTERNAL (data, dataext, datalen, Qctext); property_atom = XInternAtom (dpy, propext, False); XChangeProperty (dpy, sw->subwindow, property_atom, XA_STRING, 8, PropModeReplace, dataext, datalen); @@ -2382,7 +2377,7 @@ if (rf) { /* #### What to do about Motif? */ - lw_add_widget_value_arg (wv, XtNxftFont, (XtArgVal) rf); + lw_add_widget_value_arg (wv, (String) XtNxftFont, (XtArgVal) rf); } #endif @@ -2400,7 +2395,7 @@ if (!rf && !fs) warn_when_safe_lispobj (intern ("xft"), Qdebug, - Fcons (build_string ("missing font in update_widget_face"), + Fcons (build_msg_string ("missing font in update_widget_face"), Fface_name (face))); #endif } @@ -2469,8 +2464,8 @@ IMAGE_INSTANCE_TYPE (ii) = IMAGE_WIDGET; if (!NILP (IMAGE_INSTANCE_WIDGET_TEXT (ii))) - LISP_STRING_TO_EXTERNAL (IMAGE_INSTANCE_WIDGET_TEXT (ii), nm, - Qlwlib_encoding); + nm = LISP_STRING_TO_EXTERNAL (IMAGE_INSTANCE_WIDGET_TEXT (ii), + Qlwlib_encoding); ii->data = xnew_and_zero (struct x_subwindow_data); @@ -2561,7 +2556,7 @@ if (EQ (prop, Q_text)) { widget_value* wv = lw_get_all_values (IMAGE_INSTANCE_X_WIDGET_LWID (ii)); - return build_ext_string (wv->value, Qlwlib_encoding); + return build_extstring (wv->value, Qlwlib_encoding); } return Qunbound; } @@ -2776,8 +2771,9 @@ unsigned int num_children, i; Widget* children; - LISP_STRING_TO_EXTERNAL (XGUI_ITEM (XCAR (rest))->name, - name, Qlwlib_encoding); + name = + LISP_STRING_TO_EXTERNAL (XGUI_ITEM (XCAR (rest))->name, + Qlwlib_encoding); /* The name may contain a `.' which confuses XtNameToWidget, so we do it ourselves. */ children = @@ -3013,7 +3009,7 @@ vector3 (Qxbm, Q_data, \ list3 (make_int (name##_width), \ make_int (name##_height), \ - make_ext_string ((Extbyte *) name##_bits, \ + make_extstring ((Extbyte *) name##_bits, \ sizeof (name##_bits), \ Qbinary))), \ Qglobal, Qx, Qnil) diff -r d2ec55325515 -r 8f0cf4fd3d2c src/glyphs.c --- a/src/glyphs.c Sat Feb 06 03:59:18 2010 -0600 +++ b/src/glyphs.c Sat Feb 06 04:01:46 2010 -0600 @@ -592,7 +592,7 @@ specbind (Qinhibit_quit, Qt); record_unwind_protect (Fset_buffer, Fcurrent_buffer ()); - temp_buffer = Fget_buffer_create (build_string (" *pixmap conversion*")); + temp_buffer = Fget_buffer_create (build_ascstring (" *pixmap conversion*")); GCPRO1 (temp_buffer); set_buffer_internal (XBUFFER (temp_buffer)); Ferase_buffer (Qnil); @@ -1016,7 +1016,7 @@ Lisp_Object filename = IMAGE_INSTANCE_PIXMAP_FILENAME (ii); s = qxestrrchr (XSTRING_DATA (filename), '/'); if (s) - print_internal (build_intstring (s + 1), printcharfun, 1); + print_internal (build_istring (s + 1), printcharfun, 1); else print_internal (filename, printcharfun, 1); } @@ -1032,37 +1032,37 @@ if (!NILP (IMAGE_INSTANCE_PIXMAP_HOTSPOT_X (ii)) || !NILP (IMAGE_INSTANCE_PIXMAP_HOTSPOT_Y (ii))) { - write_c_string (printcharfun, " @"); + write_ascstring (printcharfun, " @"); if (!NILP (IMAGE_INSTANCE_PIXMAP_HOTSPOT_X (ii))) write_fmt_string (printcharfun, "%ld", XINT (IMAGE_INSTANCE_PIXMAP_HOTSPOT_X (ii))); else - write_c_string (printcharfun, "??"); - write_c_string (printcharfun, ","); + write_ascstring (printcharfun, "??"); + write_ascstring (printcharfun, ","); if (!NILP (IMAGE_INSTANCE_PIXMAP_HOTSPOT_Y (ii))) write_fmt_string (printcharfun, "%ld", XINT (IMAGE_INSTANCE_PIXMAP_HOTSPOT_Y (ii))); else - write_c_string (printcharfun, "??"); + write_ascstring (printcharfun, "??"); } if (!NILP (IMAGE_INSTANCE_PIXMAP_FG (ii)) || !NILP (IMAGE_INSTANCE_PIXMAP_BG (ii))) { - write_c_string (printcharfun, " ("); + write_ascstring (printcharfun, " ("); if (!NILP (IMAGE_INSTANCE_PIXMAP_FG (ii))) { print_internal (XCOLOR_INSTANCE (IMAGE_INSTANCE_PIXMAP_FG (ii))->name, printcharfun, 0); } - write_c_string (printcharfun, "/"); + write_ascstring (printcharfun, "/"); if (!NILP (IMAGE_INSTANCE_PIXMAP_BG (ii))) { print_internal (XCOLOR_INSTANCE (IMAGE_INSTANCE_PIXMAP_BG (ii))->name, printcharfun, 0); } - write_c_string (printcharfun, ")"); + write_ascstring (printcharfun, ")"); } break; @@ -1086,17 +1086,17 @@ are specific to a particular frame so we want to print in their description what that frame is. */ - write_c_string (printcharfun, " on #<"); + write_ascstring (printcharfun, " on #<"); { struct frame* f = XFRAME (IMAGE_INSTANCE_FRAME (ii)); if (!FRAME_LIVE_P (f)) - write_c_string (printcharfun, "dead"); + write_ascstring (printcharfun, "dead"); else - write_c_string (printcharfun, + write_ascstring (printcharfun, DEVICE_TYPE_NAME (XDEVICE (FRAME_DEVICE (f)))); } - write_c_string (printcharfun, "-frame>"); + write_ascstring (printcharfun, "-frame>"); write_fmt_string (printcharfun, " 0x%p", IMAGE_INSTANCE_SUBWINDOW_ID (ii)); @@ -2220,34 +2220,35 @@ /* error helpers */ /************************************************************************/ DOESNT_RETURN -signal_image_error (const CIbyte *reason, Lisp_Object frob) +signal_image_error (const Ascbyte *reason, Lisp_Object frob) { signal_error (Qimage_conversion_error, reason, frob); } DOESNT_RETURN -signal_image_error_2 (const CIbyte *reason, Lisp_Object frob0, Lisp_Object frob1) +signal_image_error_2 (const Ascbyte *reason, Lisp_Object frob0, + Lisp_Object frob1) { signal_error_2 (Qimage_conversion_error, reason, frob0, frob1); } DOESNT_RETURN -signal_double_image_error (const CIbyte *string1, const CIbyte *string2, +signal_double_image_error (const Ascbyte *reason1, const Ascbyte *reason2, Lisp_Object data) { signal_error_1 (Qimage_conversion_error, - list3 (build_msg_string (string1), - build_msg_string (string2), + list3 (build_msg_string (reason1), + build_msg_string (reason2), data)); } DOESNT_RETURN -signal_double_image_error_2 (const CIbyte *string1, const CIbyte *string2, +signal_double_image_error_2 (const Ascbyte *reason1, const Ascbyte *reason2, Lisp_Object data1, Lisp_Object data2) { signal_error_1 (Qimage_conversion_error, - list4 (build_msg_string (string1), - build_msg_string (string2), + list4 (build_msg_string (reason1), + build_msg_string (reason2), data1, data2)); } @@ -2696,7 +2697,7 @@ int len = (w + 7) / 8 * h; retval = list3 (make_int (w), make_int (h), - make_ext_string ((Extbyte *) data, len, Qbinary)); + make_extstring ((Extbyte *) data, len, Qbinary)); XFree (data); return retval; } @@ -2749,11 +2750,11 @@ { mask_file = MAYBE_LISP_CONTYPE_METH (decode_console_type(console_type, ERROR_ME), - locate_pixmap_file, (concat2 (file, build_string ("Mask")))); + locate_pixmap_file, (concat2 (file, build_ascstring ("Mask")))); if (NILP (mask_file)) mask_file = MAYBE_LISP_CONTYPE_METH (decode_console_type(console_type, ERROR_ME), - locate_pixmap_file, (concat2 (file, build_string ("msk")))); + locate_pixmap_file, (concat2 (file, build_ascstring ("msk")))); } if (!NILP (mask_file)) @@ -2950,7 +2951,7 @@ Ibyte *resolved; LISP_PATHNAME_RESOLVE_LINKS (name, resolved); - C_STRING_TO_EXTERNAL (resolved, fname, Qfile_name); + fname = ITEXT_TO_EXTERNAL (resolved, Qfile_name); result = XpmReadFileToData (fname, &data); if (result == XpmSuccess) @@ -2958,7 +2959,7 @@ Lisp_Object retval = Qnil; struct buffer *old_buffer = current_buffer; Lisp_Object temp_buffer = - Fget_buffer_create (build_string (" *pixmap conversion*")); + Fget_buffer_create (build_ascstring (" *pixmap conversion*")); int elt; int height, width, ncolors; struct gcpro gcpro1, gcpro2, gcpro3; @@ -2970,19 +2971,19 @@ set_buffer_internal (XBUFFER (temp_buffer)); Ferase_buffer (Qnil); - buffer_insert_c_string (current_buffer, "/* XPM */\r"); - buffer_insert_c_string (current_buffer, "static char *pixmap[] = {\r"); + buffer_insert_ascstring (current_buffer, "/* XPM */\r"); + buffer_insert_ascstring (current_buffer, "static char *pixmap[] = {\r"); sscanf (data[0], "%d %d %d", &height, &width, &ncolors); for (elt = 0; elt <= width + ncolors; elt++) { - buffer_insert_c_string (current_buffer, "\""); - buffer_insert_c_string (current_buffer, data[elt]); + buffer_insert_ascstring (current_buffer, "\""); + buffer_insert_ascstring (current_buffer, data[elt]); if (elt < width + ncolors) - buffer_insert_c_string (current_buffer, "\",\r"); + buffer_insert_ascstring (current_buffer, "\",\r"); else - buffer_insert_c_string (current_buffer, "\"};\r"); + buffer_insert_ascstring (current_buffer, "\"};\r"); } retval = Fbuffer_substring (Qnil, Qnil, Qnil); @@ -4275,9 +4276,19 @@ /***************************************************************************** - * glyph cachel functions * + * glyph cachel functions * *****************************************************************************/ +#define NUM_PRECACHED_GLYPHS 6 +#define LOOP_OVER_PRECACHED_GLYPHS \ + FROB (Vcontinuation_glyph, CONT_GLYPH_INDEX) \ + FROB (Vtruncation_glyph, TRUN_GLYPH_INDEX) \ + FROB (Vhscroll_glyph, HSCROLL_GLYPH_INDEX) \ + FROB (Vcontrol_arrow_glyph, CONTROL_GLYPH_INDEX) \ + FROB (Voctal_escape_glyph, OCT_ESC_GLYPH_INDEX) \ + FROB (Vinvisible_text_glyph, INVIS_GLYPH_INDEX) + + /* #### All of this is 95% copied from face cachels. Consider consolidating. @@ -4351,6 +4362,27 @@ Dynarr_add (w->glyph_cachels, new_cachel); } +#ifdef ERROR_CHECK_GLYPHS + +/* The precached glyphs should always occur in slots 0 - 5, with each glyph in the + slot reserved for it. Meanwhile any other glyphs should always occur in slots + 6 or greater. */ +static void +verify_glyph_index (Lisp_Object glyph, glyph_index idx) +{ + if (0) + ; +#define FROB(glyph_obj, gindex) \ + else if (EQ (glyph, glyph_obj)) \ + assert (gindex == idx); + LOOP_OVER_PRECACHED_GLYPHS + else + assert (idx >= NUM_PRECACHED_GLYPHS); +#undef FROB +} + +#endif /* ERROR_CHECK_GLYPHS */ + glyph_index get_glyph_cachel_index (struct window *w, Lisp_Object glyph) { @@ -4366,6 +4398,9 @@ if (EQ (cachel->glyph, glyph) && !NILP (glyph)) { +#ifdef ERROR_CHECK_GLYPHS + verify_glyph_index (glyph, elt); +#endif /* ERROR_CHECK_GLYPHS */ update_glyph_cachel_data (w, glyph, cachel); return elt; } @@ -4380,12 +4415,10 @@ reset_glyph_cachels (struct window *w) { Dynarr_reset (w->glyph_cachels); - get_glyph_cachel_index (w, Vcontinuation_glyph); - get_glyph_cachel_index (w, Vtruncation_glyph); - get_glyph_cachel_index (w, Vhscroll_glyph); - get_glyph_cachel_index (w, Vcontrol_arrow_glyph); - get_glyph_cachel_index (w, Voctal_escape_glyph); - get_glyph_cachel_index (w, Vinvisible_text_glyph); +#define FROB(glyph_obj, gindex) \ + get_glyph_cachel_index (w, glyph_obj); + LOOP_OVER_PRECACHED_GLYPHS +#undef FROB } void @@ -4393,19 +4426,18 @@ { int elt; + /* A previous bug resulted from the glyph cachels never getting reset + in the minibuffer window after creation, and another glyph added before + we got a chance to add the six normal glyphs that should go first, and + we got called with only one glyph present. */ + assert (Dynarr_length (w->glyph_cachels) >= NUM_PRECACHED_GLYPHS); /* We need to have a dirty flag to tell if the glyph has changed. We can check to see if each glyph variable is actually a completely different glyph, though. */ #define FROB(glyph_obj, gindex) \ update_glyph_cachel_data (w, glyph_obj, \ - Dynarr_atp (w->glyph_cachels, gindex)) - - FROB (Vcontinuation_glyph, CONT_GLYPH_INDEX); - FROB (Vtruncation_glyph, TRUN_GLYPH_INDEX); - FROB (Vhscroll_glyph, HSCROLL_GLYPH_INDEX); - FROB (Vcontrol_arrow_glyph, CONTROL_GLYPH_INDEX); - FROB (Voctal_escape_glyph, OCT_ESC_GLYPH_INDEX); - FROB (Vinvisible_text_glyph, INVIS_GLYPH_INDEX); + Dynarr_atp (w->glyph_cachels, gindex)); + LOOP_OVER_PRECACHED_GLYPHS #undef FROB for (elt = 0; elt < Dynarr_length (w->glyph_cachels); elt++) @@ -4448,7 +4480,7 @@ /***************************************************************************** - * subwindow cachel functions * + * subwindow cachel functions * *****************************************************************************/ /* Subwindows are curious in that you have to physically unmap them to not display them. It is problematic deciding what to do in @@ -4545,7 +4577,7 @@ } /***************************************************************************** - * subwindow exposure ignorance * + * subwindow exposure ignorance * *****************************************************************************/ /* when we unmap subwindows the associated window system will generate expose events. This we do not want as redisplay already copes with diff -r d2ec55325515 -r 8f0cf4fd3d2c src/glyphs.h --- a/src/glyphs.h Sat Feb 06 03:59:18 2010 -0600 +++ b/src/glyphs.h Sat Feb 06 04:01:46 2010 -0600 @@ -386,14 +386,16 @@ DECLARE_DOESNT_RETURN (incompatible_image_types (Lisp_Object instantiator, int given_dest_mask, int desired_dest_mask)); -DECLARE_DOESNT_RETURN (signal_image_error (const char *, Lisp_Object)); -DECLARE_DOESNT_RETURN (signal_image_error_2 (const char *, Lisp_Object, - Lisp_Object)); -DECLARE_DOESNT_RETURN (signal_double_image_error (const char *string1, - const char *string2, +DECLARE_DOESNT_RETURN (signal_image_error (const Ascbyte *reason, + Lisp_Object frob)); +DECLARE_DOESNT_RETURN (signal_image_error_2 (const Ascbyte *reason, + Lisp_Object frob0, + Lisp_Object frob1)); +DECLARE_DOESNT_RETURN (signal_double_image_error (const Ascbyte *reason1, + const Ascbyte *reason2, Lisp_Object data)); -DECLARE_DOESNT_RETURN (signal_double_image_error_2 (const char *string1, - const char *string2, +DECLARE_DOESNT_RETURN (signal_double_image_error_2 (const Ascbyte *reason1, + const Ascbyte *reason2, Lisp_Object data1, Lisp_Object data2)); diff -r d2ec55325515 -r 8f0cf4fd3d2c src/gpmevent.c --- a/src/gpmevent.c Sat Feb 06 03:59:18 2010 -0600 +++ b/src/gpmevent.c Sat Feb 06 04:01:46 2010 -0600 @@ -186,7 +186,7 @@ static void turn_off_gpm (char *process_name) { - Lisp_Object process = Fget_process (build_string (process_name)); + Lisp_Object process = Fget_process (build_cistring (process_name)); int fd = -1; if (NILP (process)) @@ -201,7 +201,7 @@ clear_gpm_state (fd); - Fdelete_process (build_string (process_name)); + Fdelete_process (build_cistring (process_name)); } #ifdef TIOCLINUX @@ -493,7 +493,7 @@ snprintf (process_name, sizeof(process_name) - 1, "gpm for %s", console_name); - proc = Fget_process (build_string (process_name)); + proc = Fget_process (build_cistring (process_name)); if (NILP (proc)) return (Qnil); @@ -585,7 +585,7 @@ set_descriptor_non_blocking (gpm_fd); store_gpm_state (gpm_fd); gpm_process = - connect_to_file_descriptor (build_string (process_name), Qnil, + connect_to_file_descriptor (build_cistring (process_name), Qnil, make_int (gpm_fd), make_int (gpm_fd)); diff -r d2ec55325515 -r 8f0cf4fd3d2c src/gtk-glue.c --- a/src/gtk-glue.c Sat Feb 06 03:59:18 2010 -0600 +++ b/src/gtk-glue.c Sat Feb 06 04:01:46 2010 -0600 @@ -129,7 +129,7 @@ { Lisp_Object *rv = (Lisp_Object *) user_data; - *rv = Fcons (build_string ((char *)data), *rv); + *rv = Fcons (build_cistring ((char *)data), *rv); } static Lisp_Object diff -r d2ec55325515 -r 8f0cf4fd3d2c src/gtk-xemacs.c --- a/src/gtk-xemacs.c Sat Feb 06 03:59:18 2010 -0600 +++ b/src/gtk-xemacs.c Sat Feb 06 04:01:46 2010 -0600 @@ -178,7 +178,7 @@ if (style->rc_style && style->rc_style->bg_pixmap_name[GTK_STATE_NORMAL]) \ { \ FROB (Vdefault_face, Qbackground_pixmap, \ - Fmake_image_instance (build_string (style->rc_style->bg_pixmap_name[GTK_STATE_NORMAL]), \ + Fmake_image_instance (build_cistring (style->rc_style->bg_pixmap_name[GTK_STATE_NORMAL]), \ f->device, Qnil, make_int (5))); \ } \ else \ @@ -436,5 +436,5 @@ sprintf (color_buf, "#%04x%04x%04x", c->red, c->green, c->blue); - return (build_string (color_buf)); + return (build_cistring (color_buf)); } diff -r d2ec55325515 -r 8f0cf4fd3d2c src/gui-x.c --- a/src/gui-x.c Sat Feb 06 03:59:18 2010 -0600 +++ b/src/gui-x.c Sat Feb 06 04:01:46 2010 -0600 @@ -198,9 +198,9 @@ free_popup_widget_value_tree (widget_value *wv) { if (! wv) return; - if (wv->key) xfree (wv->key, char *); - if (wv->value) xfree (wv->value, char *); - if (wv->name) xfree (wv->name, char *); + if (wv->key) xfree (wv->key); + if (wv->value) xfree (wv->value); + if (wv->name) xfree (wv->name); wv->name = wv->value = wv->key = (char *) 0xDEADBEEF; /* -559038737 base 10*/ @@ -360,10 +360,7 @@ : xstrdup ("shadowDoubleEtchedIn")); else if (*p == ':') { - Extbyte *retval; - - C_STRING_TO_EXTERNAL_MALLOC (p + 1, retval, Qlwlib_encoding); - return retval; + return ITEXT_TO_EXTERNAL_MALLOC (p + 1, Qlwlib_encoding); } return NULL; @@ -385,7 +382,7 @@ } if (found_accel) - LISP_STRING_TO_EXTERNAL_MALLOC (string, retval, Qlwlib_encoding); + retval = LISP_STRING_TO_EXTERNAL_MALLOC (string, Qlwlib_encoding); else { Bytecount namelen = XSTRING_LENGTH (string); @@ -393,7 +390,7 @@ chars[0] = '%'; chars[1] = '_'; memcpy (chars + 2, name, namelen + 1); - C_STRING_TO_EXTERNAL_MALLOC (chars, retval, Qlwlib_encoding); + retval = ITEXT_TO_EXTERNAL_MALLOC (chars, Qlwlib_encoding); } return retval; @@ -417,7 +414,7 @@ if (accel_p) wv->name = add_accel_and_to_external (gui_item); else - LISP_STRING_TO_EXTERNAL_MALLOC (gui_item, wv->name, Qlwlib_encoding); + wv->name = LISP_STRING_TO_EXTERNAL_MALLOC (gui_item, Qlwlib_encoding); return 1; } else if (!GUI_ITEMP (gui_item)) @@ -447,7 +444,7 @@ } else { - LISP_STRING_TO_EXTERNAL_MALLOC (pgui->name, wv->name, Qlwlib_encoding); + wv->name = LISP_STRING_TO_EXTERNAL_MALLOC (pgui->name, Qlwlib_encoding); wv->accel = LISP_TO_VOID (Qnil); } @@ -464,7 +461,7 @@ CHECK_STRING (suffix2); } - LISP_STRING_TO_EXTERNAL_MALLOC (suffix2, wv->value, Qlwlib_encoding); + wv->value = LISP_STRING_TO_EXTERNAL_MALLOC (suffix2, Qlwlib_encoding); } wv_set_evalable_slot (wv->enabled, pgui->active); @@ -486,7 +483,7 @@ CHECK_STRING (pgui->keys); pgui->keys = Fsubstitute_command_keys (pgui->keys); if (XSTRING_LENGTH (pgui->keys) > 0) - LISP_STRING_TO_EXTERNAL_MALLOC (pgui->keys, wv->key, Qlwlib_encoding); + wv->key = LISP_STRING_TO_EXTERNAL_MALLOC (pgui->keys, Qlwlib_encoding); else wv->key = 0; } @@ -496,7 +493,7 @@ /* #### Warning, dependency here on current_buffer and point */ where_is_to_char (pgui->callback, buf); if (eilen (buf) > 0) - C_STRING_TO_EXTERNAL_MALLOC (eidata (buf), wv->key, Qlwlib_encoding); + wv->key = ITEXT_TO_EXTERNAL_MALLOC (eidata (buf), Qlwlib_encoding); else wv->key = 0; eifree (buf); diff -r d2ec55325515 -r 8f0cf4fd3d2c src/gui.c --- a/src/gui.c Sat Feb 06 03:59:18 2010 -0600 +++ b/src/gui.c Sat Feb 06 04:01:46 2010 -0600 @@ -516,7 +516,7 @@ CHECK_STRING (suffix); } - retval = concat3 (pgui_item->name, build_string (" "), suffix); + retval = concat3 (pgui_item->name, build_ascstring (" "), suffix); } return retval; diff -r d2ec55325515 -r 8f0cf4fd3d2c src/gutter.c --- a/src/gutter.c Sat Feb 06 03:59:18 2010 -0600 +++ b/src/gutter.c Sat Feb 06 04:01:46 2010 -0600 @@ -302,7 +302,7 @@ { dl = Dynarr_atp (ddla, Dynarr_length (ddla) - 1); size = (dl->ypos + dl->descent - dl->clip) - - (Dynarr_atp (ddla, 0)->ypos - Dynarr_atp (ddla, 0)->ascent); + - (Dynarr_begin (ddla)->ypos - Dynarr_begin (ddla)->ascent); } } /* For left and right we have to do some maths. */ @@ -450,7 +450,7 @@ /* If the number of display lines has shrunk, adjust. */ if (cdla_len > Dynarr_length (ddla)) { - Dynarr_length (cdla) = Dynarr_length (ddla); + Dynarr_set_length (cdla, Dynarr_length (ddla)); } /* grab coordinates of last line and blank after it. */ diff -r d2ec55325515 -r 8f0cf4fd3d2c src/hash.c --- a/src/hash.c Sat Feb 06 03:59:18 2010 -0600 +++ b/src/hash.c Sat Feb 06 04:01:46 2010 -0600 @@ -174,8 +174,8 @@ void free_hash_table (struct hash_table *hash_table) { - xfree (hash_table->harray, hentry *); - xfree (hash_table, struct hash_table *); + xfree (hash_table->harray); + xfree (hash_table); } struct hash_table * @@ -224,7 +224,7 @@ rehash (old_harray, hash_table, old_size); } - xfree (old_harray, hentry *); + xfree (old_harray); } void diff -r d2ec55325515 -r 8f0cf4fd3d2c src/hpplay.c --- a/src/hpplay.c Sat Feb 06 03:59:18 2010 -0600 +++ b/src/hpplay.c Sat Feb 06 04:01:46 2010 -0600 @@ -73,9 +73,9 @@ Ibyte *interr; AGetErrorText (audio, errorCode, errorbuff, 131); - EXTERNAL_TO_C_STRING (errorbuf, interr, Qerror_message_encoding); + interr = EXTERNAL_TO_ITEXT (errorbuf, Qerror_message_encoding); - signal_error (Qsound_error, text, build_string (interr)); + signal_error (Qsound_error, text, build_istring (interr)); } long @@ -148,8 +148,8 @@ Extbyte *server; if (STRINGP (Vhp_play_server)) - LISP_STRING_TO_EXTERNAL (Vhp_play_server, server, - Qunix_host_name_encoding); + server = LISP_STRING_TO_EXTERNAL (Vhp_play_server, + Qunix_host_name_encoding); else server = ""; @@ -202,8 +202,8 @@ if (STRINGP (Vhp_play_server)) - LISP_STRING_TO_EXTERNAL (Vhp_play_server, server, - Qunix_host_name_encoding); + server = LISP_STRING_TO_EXTERNAL (Vhp_play_server, + Qunix_host_name_encoding); else server = ""; diff -r d2ec55325515 -r 8f0cf4fd3d2c src/imgproc.c --- a/src/imgproc.c Sat Feb 06 03:59:18 2010 -0600 +++ b/src/imgproc.c Sat Feb 06 04:01:46 2010 -0600 @@ -536,7 +536,7 @@ qt->num_active_colors = i; /* We're done with the boxes now */ - xfree (box_list, Colorbox *); + xfree (box_list); qt->freeboxes = qt->usedboxes = NULL; /* @@ -551,13 +551,13 @@ /* 5c: done with ColorCells */ for (i = 0; i < C_LEN*C_LEN*C_LEN; i++) if (qt->ColorCells[i]) - xfree (qt->ColorCells[i], C_cell *); - xfree (qt->ColorCells, C_cell **); + xfree (qt->ColorCells[i]); + xfree (qt->ColorCells); if (res) { /* we failed in memory allocation, so clean up and leave */ - xfree(qt, quant_table *); + xfree (qt); return NULL; } diff -r d2ec55325515 -r 8f0cf4fd3d2c src/indent.c --- a/src/indent.c Sat Feb 06 03:59:18 2010 -0600 +++ b/src/indent.c Sat Feb 06 04:01:46 2010 -0600 @@ -663,7 +663,7 @@ if (ret_vpix) *ret_vpix = vpix_motion (w->line_start_cache, 0, elt); /* #### This should be BUF_BEGV (b), right? */ - return Dynarr_atp (w->line_start_cache, 0)->start; + return Dynarr_begin (w->line_start_cache)->start; } else { diff -r d2ec55325515 -r 8f0cf4fd3d2c src/insdel.c --- a/src/insdel.c Sat Feb 06 03:59:18 2010 -0600 +++ b/src/insdel.c Sat Feb 06 04:01:46 2010 -0600 @@ -1305,11 +1305,12 @@ /* Insert the null-terminated string S (in external format). */ Charcount -buffer_insert_c_string_1 (struct buffer *buf, Charbpos pos, const char *s, +buffer_insert_ascstring_1 (struct buffer *buf, Charbpos pos, const Ascbyte *s, int flags) { /* This function can GC */ - const char *translated = GETTEXT (s); + const CIbyte *translated = GETTEXT (s); + ASSERT_ASCTEXT_ASCII (s); return buffer_insert_string_1 (buf, pos, (const Ibyte *) translated, Qnil, 0, strlen (translated), flags); } @@ -1837,9 +1838,9 @@ if (!b->base_buffer) { BUFFER_FREE (b->text->beg); - xfree (b->text->changes, struct buffer_text_change_data *); + xfree (b->text->changes); } - xfree (b->changes, struct each_buffer_change_data *); + xfree (b->changes); #ifdef REGION_CACHE_NEEDS_WORK if (b->newline_cache) diff -r d2ec55325515 -r 8f0cf4fd3d2c src/insdel.h --- a/src/insdel.h Sat Feb 06 03:59:18 2010 -0600 +++ b/src/insdel.h Sat Feb 06 04:01:46 2010 -0600 @@ -46,8 +46,8 @@ Bytecount length, int flags); Charcount buffer_insert_lisp_string_1 (struct buffer *buf, Charbpos pos, Lisp_Object str, int flags); -Charcount buffer_insert_c_string_1 (struct buffer *buf, Charbpos pos, - const char *s, int flags); +Charcount buffer_insert_ascstring_1 (struct buffer *buf, Charbpos pos, + const Ascbyte *s, int flags); Charcount buffer_insert_emacs_char_1 (struct buffer *buf, Charbpos pos, Ichar ch, int flags); Charcount buffer_insert_c_char_1 (struct buffer *buf, Charbpos pos, char c, @@ -63,8 +63,8 @@ buffer_insert_string_1 (buf, -1, nonreloc, reloc, offset, length, 0) #define buffer_insert_raw_string(buf, string, length) \ buffer_insert_raw_string_1 (buf, -1, string, length, 0) -#define buffer_insert_c_string(buf, s) \ - buffer_insert_c_string_1 (buf, -1, s, 0) +#define buffer_insert_ascstring(buf, s) \ + buffer_insert_ascstring_1 (buf, -1, s, 0) #define buffer_insert_lisp_string(buf, str) \ buffer_insert_lisp_string_1 (buf, -1, str, 0) #define buffer_insert_c_char(buf, c) \ diff -r d2ec55325515 -r 8f0cf4fd3d2c src/intl-win32.c --- a/src/intl-win32.c Sat Feb 06 03:59:18 2010 -0600 +++ b/src/intl-win32.c Sat Feb 06 04:01:46 2010 -0600 @@ -1,5 +1,5 @@ /* Win32 internationalization functions. - Copyright (C) 2000, 2001, 2002, 2004 Ben Wing. + Copyright (C) 2000, 2001, 2002, 2004, 2010 Ben Wing. Copyright (C) 2000 IKEYAMA Tomonori. This file is part of XEmacs. @@ -85,7 +85,7 @@ struct lang_to_string { int code; - char *string; + const Ascbyte *string; }; struct lang_to_string lang_to_string_table[] = @@ -650,7 +650,7 @@ for (i = 0; i < table_size; i++) if (code == table[i].code) - return build_string (table[i].string); + return build_ascstring (table[i].string); return Qnil; } @@ -668,7 +668,7 @@ if (!table[i].string) break; if (sublang == table[i].code) - return build_string (table[i].string); + return build_ascstring (table[i].string); } else if (!table[i].string && lang == table[i].code) found_lang = 1; @@ -677,11 +677,11 @@ switch (sublang) { case SUBLANG_NEUTRAL: - return build_string ("NEUTRAL"); + return build_ascstring ("NEUTRAL"); case SUBLANG_DEFAULT: - return build_string ("DEFAULT"); + return build_ascstring ("DEFAULT"); case SUBLANG_SYS_DEFAULT: - return build_string ("SYS_DEFAULT"); + return build_ascstring ("SYS_DEFAULT"); } return Qnil; @@ -1288,8 +1288,8 @@ { int got_abbrev; int got_full; - char abbrev_name[32] = { 0 }; - char full_name[256] = { 0 }; + Extbyte abbrev_name[32] = { 0 }; + Extbyte full_name[256] = { 0 }; CHECK_INT (lcid); @@ -1298,27 +1298,28 @@ if (NILP (longform)) { - got_abbrev = GetLocaleInfo (XINT (lcid), - LOCALE_SABBREVLANGNAME | LOCALE_USE_CP_ACP, - abbrev_name, sizeof (abbrev_name)); + got_abbrev = qxeGetLocaleInfo (XINT (lcid), + LOCALE_SABBREVLANGNAME | + LOCALE_USE_CP_ACP, + abbrev_name, sizeof (abbrev_name)); if (got_abbrev) - return build_string (abbrev_name); + return build_tstr_string (abbrev_name); } else if (EQ (longform, Qt)) { - got_full = GetLocaleInfo (XINT (lcid), - LOCALE_SLANGUAGE | LOCALE_USE_CP_ACP, - full_name, sizeof (full_name)); + got_full = qxeGetLocaleInfo (XINT (lcid), + LOCALE_SLANGUAGE | LOCALE_USE_CP_ACP, + full_name, sizeof (full_name)); if (got_full) - return build_string (full_name); + return build_tstr_string (full_name); } else if (NUMBERP (longform)) { - got_full = GetLocaleInfo (XINT (lcid), - XINT (longform), - full_name, sizeof (full_name)); + got_full = qxeGetLocaleInfo (XINT (lcid), + XINT (longform), + full_name, sizeof (full_name)); if (got_full) - return make_unibyte_string (full_name, got_full); + return build_tstr_string (full_name); } return Qnil; @@ -1703,7 +1704,7 @@ #ifdef MULE return lcid_to_locale (lcid); #else - return Fcons (build_string ("NEUTRAL"), build_string ("DEFAULT")); + return Fcons (build_ascstring ("NEUTRAL"), build_ascstring ("DEFAULT")); #endif } @@ -1866,7 +1867,7 @@ struct mswindows_multibyte_to_unicode_coding_system *data = XCODING_SYSTEM_TYPE_DATA (cs, mswindows_multibyte_to_unicode); - write_c_string (printcharfun, "("); + write_ascstring (printcharfun, "("); if (data->locale_type == MULTIBYTE_SPECIFIED_CODE_PAGE) print_internal (make_int (data->cp), printcharfun, 1); else @@ -1874,7 +1875,7 @@ write_fmt_string_lisp (printcharfun, "%s, ", 1, mswindows_multibyte_to_unicode_getprop (cs, Qlocale)); print_internal (mswindows_multibyte_to_unicode_getprop (cs, Qcode_page), printcharfun, 0); } - write_c_string (printcharfun, ")"); + write_ascstring (printcharfun, ")"); } /* ----------------------------------------------------------------------- */ @@ -1940,7 +1941,7 @@ TO_INTERNAL_FORMAT (DATA, (unidata, size), MALLOC, (intdata, size), Qmswindows_unicode); - xfree (unidata, Extbyte *); + xfree (unidata); if (size_out) *size_out = size; @@ -2351,13 +2352,13 @@ { Fmake_coding_system_internal (Qmswindows_unicode, Qunicode, - build_msg_string ("MS Windows Unicode"), + build_defer_string ("MS Windows Unicode"), nconc2 (list4 (Qdocumentation, - build_msg_string ( + build_defer_string ( "Converts to the Unicode encoding for Windows API calls.\n" "This encoding is equivalent to standard UTF16, little-endian." ), - Qmnemonic, build_string ("MSW-U")), + Qmnemonic, build_ascstring ("MSW-U")), list4 (Qunicode_type, Qutf_16, Qlittle_endian, Qt))); diff -r d2ec55325515 -r 8f0cf4fd3d2c src/intl.c --- a/src/intl.c Sat Feb 06 03:59:18 2010 -0600 +++ b/src/intl.c Sat Feb 06 04:01:46 2010 -0600 @@ -49,7 +49,7 @@ loc = setlocale (LC_CTYPE, NULL); if (!loc) return Qnil; - return build_ext_string (loc, Qctext); + return build_extstring (loc, Qctext); } DEFUN ("set-current-locale", Fset_current_locale, 1, 1, 0, /* @@ -75,7 +75,7 @@ CHECK_STRING (locale); /* RedHat 6.2 contains a locale called "Francais" with the C-cedilla encoded in ISO2022! */ - LISP_STRING_TO_EXTERNAL (locale, loc, Qctext); + loc = LISP_STRING_TO_EXTERNAL (locale, Qctext); loc = setlocale (LC_ALL, loc); if (!loc) return Qnil; @@ -92,8 +92,8 @@ } #endif - str = build_ext_string (loc, Qctext); - xfree (loc, Extbyte *); + str = build_extstring (loc, Qctext); + xfree (loc); return str; } diff -r d2ec55325515 -r 8f0cf4fd3d2c src/keymap.c --- a/src/keymap.c Sat Feb 06 03:59:18 2010 -0600 +++ b/src/keymap.c Sat Feb 06 04:01:46 2010 -0600 @@ -285,7 +285,7 @@ Lisp_Keymap *keymap = XKEYMAP (obj); if (print_readably) printing_unreadable_lcrecord (obj, 0); - write_c_string (printcharfun, "#name)) { write_fmt_string_lisp (printcharfun, "%S ", 1, keymap->name); @@ -464,7 +464,7 @@ Ibyte str [1 + MAX_ICHAR_LEN]; Bytecount count = set_itext_ichar (str, XCHAR (keysym)); str[count] = 0; - keysym = intern_int (str); + keysym = intern_istring (str); } return control_meta_superify (keysym, modifiers); } @@ -1748,17 +1748,17 @@ if (EQ (keys, new_keys)) signal_ferror_with_frob (Qinvalid_operation, mpc_binding, "can't bind %s: %s has a non-keymap binding", - (char *) XSTRING_DATA (Fkey_description (keys)), - (char *) XSTRING_DATA (Fsingle_key_description - (Vmeta_prefix_char))); + (CIbyte *) XSTRING_DATA (Fkey_description (keys)), + (CIbyte *) XSTRING_DATA (Fsingle_key_description + (Vmeta_prefix_char))); else signal_ferror_with_frob (Qinvalid_operation, mpc_binding, "can't bind %s: %s %s has a non-keymap binding", - (char *) XSTRING_DATA (Fkey_description (keys)), - (char *) XSTRING_DATA (Fkey_description - (new_keys)), - (char *) XSTRING_DATA (Fsingle_key_description - (Vmeta_prefix_char))); + (CIbyte *) XSTRING_DATA (Fkey_description (keys)), + (CIbyte *) XSTRING_DATA (Fkey_description + (new_keys)), + (CIbyte *) XSTRING_DATA (Fsingle_key_description + (Vmeta_prefix_char))); } DEFUN ("define-key", Fdefine_key, 3, 3, 0, /* @@ -3285,7 +3285,7 @@ string = s2; else { - /* if (NILP (sep)) Lisp_Object sep = build_string (" ") */; + /* if (NILP (sep)) Lisp_Object sep = build_ascstring (" ") */; string = concat2 (string, concat2 (Vsingle_space_string, s2)); } } @@ -3443,7 +3443,7 @@ } *p = 0; - return build_string ((char *) buf); + return build_istring (buf); } @@ -3739,7 +3739,7 @@ Lisp_Key_Data *new_ = xnew_array (Lisp_Key_Data, size); memcpy ((void *)new_, (const void *)c->keys_so_far, c->keys_so_far_total_size * sizeof (Lisp_Key_Data)); - xfree (c->keys_so_far, Lisp_Key_Data); + xfree (c->keys_so_far); c->keys_so_far = new_; } else @@ -3815,7 +3815,7 @@ result = Fnreverse (result); if (c.keys_so_far_malloced) - xfree (c.keys_so_far, Lisp_Key_Data *); + xfree (c.keys_so_far); return result; } @@ -3938,7 +3938,7 @@ Findent_to (make_int (16), make_int (3), buffer); if (keymapp) - buffer_insert_c_string (XBUFFER (buffer), "<< "); + buffer_insert_ascstring (XBUFFER (buffer), "<< "); if (SYMBOLP (definition)) { @@ -3946,19 +3946,19 @@ } else if (STRINGP (definition) || VECTORP (definition)) { - buffer_insert_c_string (XBUFFER (buffer), "Kbd Macro: "); + buffer_insert_ascstring (XBUFFER (buffer), "Kbd Macro: "); buffer_insert1 (XBUFFER (buffer), Fkey_description (definition)); } else if (COMPILED_FUNCTIONP (definition)) - buffer_insert_c_string (XBUFFER (buffer), "Anonymous Compiled Function"); + buffer_insert_ascstring (XBUFFER (buffer), "Anonymous Compiled Function"); else if (CONSP (definition) && EQ (XCAR (definition), Qlambda)) - buffer_insert_c_string (XBUFFER (buffer), "Anonymous Lambda"); + buffer_insert_ascstring (XBUFFER (buffer), "Anonymous Lambda"); else if (KEYMAPP (definition)) { Lisp_Object name = XKEYMAP (definition)->name; if (STRINGP (name) || (SYMBOLP (name) && !NILP (name))) { - buffer_insert_c_string (XBUFFER (buffer), "Prefix command "); + buffer_insert_ascstring (XBUFFER (buffer), "Prefix command "); if (SYMBOLP (name) && EQ (find_symbol_value (name), definition)) buffer_insert1 (XBUFFER (buffer), Fsymbol_name (name)); @@ -3968,14 +3968,14 @@ } } else - buffer_insert_c_string (XBUFFER (buffer), "Prefix Command"); + buffer_insert_ascstring (XBUFFER (buffer), "Prefix Command"); } else - buffer_insert_c_string (XBUFFER (buffer), "??"); + buffer_insert_ascstring (XBUFFER (buffer), "??"); if (keymapp) - buffer_insert_c_string (XBUFFER (buffer), " >>"); - buffer_insert_c_string (XBUFFER (buffer), "\n"); + buffer_insert_ascstring (XBUFFER (buffer), " >>"); + buffer_insert_ascstring (XBUFFER (buffer), "\n"); UNGCPRO; } @@ -4210,7 +4210,7 @@ if (!NILP (list)) { list = list_sort (list, Qnil, describe_map_sort_predicate); - buffer_insert_c_string (buf, "\n"); + buffer_insert_ascstring (buf, "\n"); while (!NILP (list)) { Lisp_Object elt = XCAR (XCAR (list)); @@ -4221,17 +4221,17 @@ buffer_insert_lisp_string (buf, elt_prefix); if (modifiers & XEMACS_MOD_META) - buffer_insert_c_string (buf, "M-"); + buffer_insert_ascstring (buf, "M-"); if (modifiers & XEMACS_MOD_CONTROL) - buffer_insert_c_string (buf, "C-"); + buffer_insert_ascstring (buf, "C-"); if (modifiers & XEMACS_MOD_SUPER) - buffer_insert_c_string (buf, "S-"); + buffer_insert_ascstring (buf, "S-"); if (modifiers & XEMACS_MOD_HYPER) - buffer_insert_c_string (buf, "H-"); + buffer_insert_ascstring (buf, "H-"); if (modifiers & XEMACS_MOD_ALT) - buffer_insert_c_string (buf, "Alt-"); + buffer_insert_ascstring (buf, "Alt-"); if (modifiers & XEMACS_MOD_SHIFT) - buffer_insert_c_string (buf, "Sh-"); + buffer_insert_ascstring (buf, "Sh-"); if (SYMBOLP (keysym)) { Lisp_Object code = Fget (keysym, Qcharacter_of_keysym, Qnil); @@ -4240,19 +4240,19 @@ /* Calling Fsingle_key_description() would cons more */ #if 0 /* This is bogus */ if (EQ (keysym, QKlinefeed)) - buffer_insert_c_string (buf, "LFD"); + buffer_insert_ascstring (buf, "LFD"); else if (EQ (keysym, QKtab)) - buffer_insert_c_string (buf, "TAB"); + buffer_insert_ascstring (buf, "TAB"); else if (EQ (keysym, QKreturn)) - buffer_insert_c_string (buf, "RET"); + buffer_insert_ascstring (buf, "RET"); else if (EQ (keysym, QKescape)) - buffer_insert_c_string (buf, "ESC"); + buffer_insert_ascstring (buf, "ESC"); else if (EQ (keysym, QKdelete)) - buffer_insert_c_string (buf, "DEL"); + buffer_insert_ascstring (buf, "DEL"); else if (EQ (keysym, QKspace)) - buffer_insert_c_string (buf, "SPC"); + buffer_insert_ascstring (buf, "SPC"); else if (EQ (keysym, QKbackspace)) - buffer_insert_c_string (buf, "BS"); + buffer_insert_ascstring (buf, "BS"); else #endif if (c >= printable_min) @@ -4262,7 +4262,7 @@ else if (CHARP (keysym)) buffer_insert_emacs_char (buf, XCHAR (keysym)); else - buffer_insert_c_string (buf, "---bad keysym---"); + buffer_insert_ascstring (buf, "---bad keysym---"); if (elided) elided = 0; @@ -4278,9 +4278,9 @@ if (k != 0) { if (k == 1) - buffer_insert_c_string (buf, ", "); + buffer_insert_ascstring (buf, ", "); else - buffer_insert_c_string (buf, " .. "); + buffer_insert_ascstring (buf, " .. "); elided = 1; continue; } diff -r d2ec55325515 -r 8f0cf4fd3d2c src/lisp.h --- a/src/lisp.h Sat Feb 06 03:59:18 2010 -0600 +++ b/src/lisp.h Sat Feb 06 04:01:46 2010 -0600 @@ -106,6 +106,10 @@ #include /* offsetof */ #include #include +#ifdef __cplusplus +#include /* necessary for max()/min() under G++ 4 */ +#endif + /* -------------------------- error-checking ------------------------ */ @@ -517,7 +521,8 @@ c) [Ascbyte] pure ASCII text d) [Binbyte] binary data that is not meant to be interpreted as text e) [Rawbyte] general data in memory, where we don't care about whether - it's text or binary + it's text or binary; often used when computing memory- + based/byte-based offsets of pointers f) [Boolbyte] a zero or a one g) [Bitbyte] a byte used for bit fields h) [Chbyte] null-semantics `char *'; used when casting an argument to @@ -1254,7 +1259,7 @@ /* (thanks, Jamie, I feel better now -- ben) */ MODULE_API void assert_failed (const Ascbyte *, int, const Ascbyte *); #define ABORT() assert_failed (__FILE__, __LINE__, "ABORT()") -#define abort_with_msg(msg) assert_failed (__FILE__, __LINE__, msg) +#define abort_with_message(msg) assert_failed (__FILE__, __LINE__, msg) /* This used to be ((void) (0)) but that triggers lots of unused variable warnings. It's pointless to force all that code to be rewritten, with @@ -1262,8 +1267,9 @@ no effects. We keep this abstracted out like this in case we want to change it in the future. */ #define disabled_assert(x) ((void) (x)) -#define disabled_assert_with_message(x, msg) disabled_assert (x) -#define disabled_assert_at_line(x, file, line) disabled_assert (x) +#define disabled_assert_with_message(x, msg) ((void) msg, disabled_assert (x)) +#define disabled_assert_at_line(x, file, line) \ + ((void) file, (void) line, disabled_assert (x)) #ifdef USE_ASSERTIONS # define assert(x) ((x) ? (void) 0 : assert_failed (__FILE__, __LINE__, #x)) @@ -1271,18 +1277,14 @@ ((x) ? (void) 0 : assert_failed (__FILE__, __LINE__, msg)) # define assert_at_line(x, file, line) \ ((x) ? (void) 0 : assert_failed (file, line, #x)) -#elif defined (DEBUG_XEMACS) -# define assert(x) ((x) ? (void) 0 : (void) ABORT ()) -# define assert_with_message(x, msg) assert (x) -# define assert_at_line(x, file, line) assert (x) #else /* This used to be ((void) (0)) but that triggers lots of unused variable warnings. It's pointless to force all that code to be rewritten, with added ifdefs. Any reasonable compiler will eliminate an expression with no effects. */ -# define assert(x) ((void) (x)) -# define assert_with_message(x, msg) assert (x) -# define assert_at_line(x, file, line) assert (x) +# define assert(x) disabled_assert (x) +# define assert_with_message(x, msg) disabled_assert_with_message (x, msg) +# define assert_at_line(x, file, line) disabled_assert_at_line (x, file, line) #endif /************************************************************************/ @@ -1302,16 +1304,15 @@ MODULE_API void xfree_1 (void *); #ifdef ERROR_CHECK_MALLOC -/* This used to use a temporary variable, which both avoided the multiple - evaluation and obviated the need for the TYPE argument. But that triggered +/* This used to use a temporary variable. But that triggered complaints under strict aliasing. #### There should be a better way. */ -#define xfree(lvalue, type) do \ +#define xfree(lvalue) do \ { \ xfree_1 (lvalue); \ VOIDP_CAST (lvalue) = (void *) DEADBEEF_CONSTANT; \ } while (0) #else -#define xfree(lvalue,type) xfree_1 (lvalue) +#define xfree(lvalue) xfree_1 (lvalue) #endif /* ERROR_CHECK_MALLOC */ /* ------------------------ stack allocation -------------------------- */ @@ -1696,71 +1697,64 @@ END_C_DECLS -/************************************************************************/ -/** Definitions of basic Lisp objects **/ +#include "lrecord.h" + /************************************************************************/ - -#include "lrecord.h" +/** Definitions of dynamic arrays (Dynarrs) and other allocators **/ +/************************************************************************/ BEGIN_C_DECLS -/* ------------------------ dynamic arrays ------------------- */ +/************* Dynarr declaration *************/ #ifdef NEW_GC +#define DECLARE_DYNARR_LISP_IMP() \ + const struct lrecord_implementation *lisp_imp; +#else +#define DECLARE_DYNARR_LISP_IMP() +#endif + #ifdef ERROR_CHECK_STRUCTURES -#define Dynarr_declare(type) \ - struct lrecord_header header; \ - type *base; \ - const struct lrecord_implementation *lisp_imp; \ - int locked; \ - int elsize; \ - int len; \ - int largest; \ - int max +#define DECLARE_DYNARR_LOCKED() \ + int locked; #else -#define Dynarr_declare(type) \ - struct lrecord_header header; \ - type *base; \ - const struct lrecord_implementation *lisp_imp; \ - int elsize; \ - int len; \ - int largest; \ - int max -#endif /* ERROR_CHECK_STRUCTURES */ -#else /* not NEW_GC */ -#ifdef ERROR_CHECK_STRUCTURES -#define Dynarr_declare(type) \ - struct lrecord_header header; \ - type *base; \ - int locked; \ - int elsize; \ - int len; \ - int largest; \ - int max -#else -#define Dynarr_declare(type) \ - struct lrecord_header header; \ - type *base; \ - int elsize; \ - int len; \ - int largest; \ - int max -#endif /* ERROR_CHECK_STRUCTURES */ -#endif /* not NEW_GC */ +#define DECLARE_DYNARR_LOCKED() +#endif + +#define Dynarr_declare(type) \ + struct lrecord_header header; \ + type *base; \ + DECLARE_DYNARR_LISP_IMP () \ + DECLARE_DYNARR_LOCKED () \ + int elsize; \ + int len_; \ + int largest_; \ + int max_ typedef struct dynarr { Dynarr_declare (void); } Dynarr; -MODULE_API void *Dynarr_newf (int elsize); -MODULE_API void Dynarr_resize (void *dy, Elemcount size); -MODULE_API void Dynarr_insert_many (void *d, const void *el, int len, - int start); -MODULE_API void Dynarr_delete_many (void *d, int start, int len); -MODULE_API void Dynarr_free (void *d); - -#ifdef ERROR_CHECK_TYPES +#define XD_DYNARR_DESC(base_type, sub_desc) \ + { XD_BLOCK_PTR, offsetof (base_type, base), \ + XD_INDIRECT(1, 0), {sub_desc} }, \ + { XD_INT, offsetof (base_type, len_) }, \ + { XD_INT_RESET, offsetof (base_type, largest_), XD_INDIRECT(1, 0) }, \ + { XD_INT_RESET, offsetof (base_type, max_), XD_INDIRECT(1, 0) } + +#ifdef NEW_GC +#define XD_LISP_DYNARR_DESC(base_type, sub_desc) \ + { XD_LISP_OBJECT_BLOCK_PTR, offsetof (base_type, base), \ + XD_INDIRECT(1, 0), {sub_desc} }, \ + { XD_INT, offsetof (base_type, len_) }, \ + { XD_INT_RESET, offsetof (base_type, largest_), XD_INDIRECT(1, 0) }, \ + { XD_INT_RESET, offsetof (base_type, max_), XD_INDIRECT(1, 0) } +#endif /* NEW_GC */ + +/************* Dynarr verification *************/ + +#ifdef ERROR_CHECK_STRUCTURES DECLARE_INLINE_HEADER ( int Dynarr_verify_pos_at (void *d, int pos, const Ascbyte *file, int line) @@ -1769,14 +1763,10 @@ Dynarr *dy = (Dynarr *) d; /* We use `largest', not `len', because the redisplay code often accesses stuff between len and largest. */ - assert_at_line (pos >= 0 && pos < dy->largest, file, line); + assert_at_line (pos >= 0 && pos < dy->largest_, file, line); return pos; } -#else -#define Dynarr_verify_pos(d, pos, file, line) (pos) -#endif /* ERROR_CHECK_TYPES */ - -#ifdef ERROR_CHECK_TYPES + DECLARE_INLINE_HEADER ( int Dynarr_verify_pos_atp (void *d, int pos, const Ascbyte *file, int line) @@ -1796,7 +1786,7 @@ hence the return value is NULL. But the length of 0 causes the pointer to never get checked. These can occur throughout the code so we put in a special check. */ - if (pos == 0 && dy->len == 0) + if (pos == 0 && dy->len_ == 0) return pos; /* #### It's vaguely possible that some code could legitimately want to retrieve a pointer to the position just past the end of dynarr memory. @@ -1809,7 +1799,7 @@ memory, which is a likely off-by-one problem to occur and will usually not trigger a protection fault (instead, you'll just get random behavior, possibly overwriting other memory, which is bad). */ - assert_at_line (pos >= 0 && pos < dy->largest, file, line); + assert_at_line (pos >= 0 && pos < dy->largest_, file, line); return pos; } @@ -1824,7 +1814,7 @@ accesses stuff between len and largest. We also allow referencing the very end, past the end of allocated legitimately space. See comments in Dynarr_verify_pos_atp.()*/ - assert_at_line (pos >= 0 && pos <= dy->largest, file, line); + assert_at_line (pos >= 0 && pos <= dy->largest_, file, line); return pos; } @@ -1832,7 +1822,53 @@ #define Dynarr_verify_pos_at(d, pos, file, line) (pos) #define Dynarr_verify_pos_atp(d, pos, file, line) (pos) #define Dynarr_verify_pos_atp_allow_end(d, pos, file, line) (pos) -#endif /* ERROR_CHECK_TYPES */ +#endif /* ERROR_CHECK_STRUCTURES */ + +#ifdef ERROR_CHECK_STRUCTURES +DECLARE_INLINE_HEADER ( +Dynarr * +Dynarr_verify_1 (void *d, const Ascbyte *file, int line) +) +{ + Dynarr *dy = (Dynarr *) d; + assert_at_line (dy->len_ >= 0 && dy->len_ <= dy->largest_ && + dy->largest_ <= dy->max_, file, line); + return dy; +} + +DECLARE_INLINE_HEADER ( +Dynarr * +Dynarr_verify_mod_1 (void *d, const Ascbyte *file, int line) +) +{ + Dynarr *dy = (Dynarr *) d; + assert_at_line (!dy->locked, file, line); + return Dynarr_verify_1 (d, file, line); +} + +#define Dynarr_verify(d) Dynarr_verify_1 (d, __FILE__, __LINE__) +#define Dynarr_verify_mod(d) Dynarr_verify_mod_1 (d, __FILE__, __LINE__) +#define Dynarr_lock(d) \ +do { \ + Dynarr *dy = Dynarr_verify_mod (d); \ + dy->locked = 1; \ +} while (0) +#define Dynarr_unlock(d) \ +do { \ + Dynarr *dy = Dynarr_verify (d); \ + dy->locked = 0; \ +} while (0) +#else +#define Dynarr_verify(d) (d) +#define Dynarr_verify_mod(d) (d) +#define Dynarr_lock(d) DO_NOTHING +#define Dynarr_unlock(d) DO_NOTHING +#endif /* ERROR_CHECK_STRUCTURES */ + +/************* Dynarr creation *************/ + +MODULE_API void *Dynarr_newf (int elsize); +MODULE_API void Dynarr_free (void *d); #ifdef NEW_GC MODULE_API void *Dynarr_lisp_newf (int elsize, @@ -1849,57 +1885,117 @@ #define Dynarr_new2(dynarr_type, type) \ ((dynarr_type *) Dynarr_newf (sizeof (type))) +/************* Dynarr access *************/ + +#ifdef ERROR_CHECK_STRUCTURES +/* Enabling this leads to crashes in Cygwin 1.7, gcc 3.4.4 */ #define Dynarr_at(d, pos) \ ((d)->base[Dynarr_verify_pos_at (d, pos, __FILE__, __LINE__)]) #define Dynarr_atp_allow_end(d, pos) \ (&((d)->base[Dynarr_verify_pos_atp_allow_end (d, pos, __FILE__, __LINE__)])) #define Dynarr_atp(d, pos) \ (&((d)->base[Dynarr_verify_pos_atp (d, pos, __FILE__, __LINE__)])) +#else +#define Dynarr_at(d, pos) ((d)->base[pos]) +#define Dynarr_atp(d, pos) (&Dynarr_at (d, pos)) +#define Dynarr_atp_allow_end(d, pos) Dynarr_atp (d, pos) +#endif /* Old #define Dynarr_atp(d, pos) (&Dynarr_at (d, pos)) */ #define Dynarr_begin(d) Dynarr_atp (d, 0) #define Dynarr_lastp(d) Dynarr_atp (d, Dynarr_length (d) - 1) #define Dynarr_past_lastp(d) Dynarr_atp_allow_end (d, Dynarr_length (d)) -#define Dynarr_sizeof(d) ((d)->len * (d)->elsize) - -#ifdef ERROR_CHECK_STRUCTURES -DECLARE_INLINE_HEADER ( -Dynarr * -Dynarr_verify_1 (void *d, const Ascbyte *file, int line) -) -{ - Dynarr *dy = (Dynarr *) d; - assert_at_line (dy->len >= 0 && dy->len <= dy->largest && - dy->largest <= dy->max, file, line); - return dy; -} - -DECLARE_INLINE_HEADER ( -Dynarr * -Dynarr_verify_mod_1 (void *d, const Ascbyte *file, int line) -) -{ - Dynarr *dy = (Dynarr *) d; - assert_at_line (!dy->locked, file, line); - assert_at_line (dy->len >= 0 && dy->len <= dy->largest && - dy->largest <= dy->max, file, line); - return dy; -} - -#define Dynarr_verify(d) Dynarr_verify_1 (d, __FILE__, __LINE__) -#define Dynarr_verify_mod(d) Dynarr_verify_mod_1 (d, __FILE__, __LINE__) -#define Dynarr_lock(d) (Dynarr_verify_mod (d)->locked = 1) -#define Dynarr_unlock(d) ((d)->locked = 0) -#else -#define Dynarr_verify(d) (d) -#define Dynarr_verify_mod(d) (d) -#define Dynarr_lock(d) -#define Dynarr_unlock(d) -#endif /* ERROR_CHECK_STRUCTURES */ - -#define Dynarr_length(d) (Dynarr_verify (d)->len) -#define Dynarr_largest(d) (Dynarr_verify (d)->largest) -#define Dynarr_reset(d) (Dynarr_verify_mod (d)->len = 0) + + +/************* Dynarr length/size retrieval and setting *************/ + +/* Retrieve the length of a Dynarr. The `+ 0' is to ensure that this cannot + be used as an lvalue. */ +#define Dynarr_length(d) (Dynarr_verify (d)->len_ + 0) +/* Retrieve the largest ever length seen of a Dynarr. The `+ 0' is to + ensure that this cannot be used as an lvalue. */ +#define Dynarr_largest(d) (Dynarr_verify (d)->largest_ + 0) +/* Retrieve the number of elements that fit in the currently allocated + space. The `+ 0' is to ensure that this cannot be used as an lvalue. */ +#define Dynarr_max(d) (Dynarr_verify (d)->max_ + 0) +/* Retrieve the advertised memory usage of a Dynarr, i.e. the number of + bytes occupied by the elements in the Dynarr, not counting any overhead. */ +#define Dynarr_sizeof(d) (Dynarr_length (d) * (d)->elsize) +/* Actually set the length of a Dynarr. This is a low-level routine that + should not be directly used; use Dynarr_set_length() instead if you need + to, but be very careful when doing so! */ +#define Dynarr_set_length_1(d, n) \ +do { \ + Elemcount _dsl1_n = (n); \ + structure_checking_assert (_dsl1_n >= 0 && _dsl1_n <= Dynarr_max (d)); \ + (void) Dynarr_verify_mod (d); \ + (d)->len_ = _dsl1_n; \ + /* Use the raw field references here otherwise we get a crash because \ + we've set the length but not yet fixed up the largest value. */ \ + if ((d)->len_ > (d)->largest_) \ + (d)->largest_ = (d)->len_; \ + (void) Dynarr_verify_mod (d); \ +} while (0) + +/* The following two defines will get you into real trouble if you aren't + careful. But they can save a lot of execution time when used wisely. */ +#define Dynarr_set_length(d, n) \ +do { \ + Elemcount _dsl_n = (n); \ + structure_checking_assert (_dsl_n >= 0 && _dsl_n <= Dynarr_largest (d)); \ + Dynarr_set_length_1 (d, _dsl_n); \ +} while (0) +#define Dynarr_increment(d) \ + Dynarr_set_length (d, Dynarr_length (d) + 1) + +/* Reset the Dynarr's length to 0. */ +#define Dynarr_reset(d) Dynarr_set_length (d, 0) + +MODULE_API void Dynarr_resize (void *dy, Elemcount size); + +#define Dynarr_resize_if(d, numels) \ +do { \ + Elemcount _dri_numels = (numels); \ + if (Dynarr_length (d) + _dri_numels > Dynarr_max (d)) \ + Dynarr_resize (d, Dynarr_length (d) + _dri_numels); \ +} while (0) + +#ifdef MEMORY_USAGE_STATS +struct overhead_stats; +Bytecount Dynarr_memory_usage (void *d, struct overhead_stats *stats); +#endif + +/************* Adding/deleting elements to/from a Dynarr *************/ + +#ifdef NEW_GC +#define Dynarr_add(d, el) \ +do { \ + const struct lrecord_implementation *imp = (d)->lisp_imp; \ + (void) Dynarr_verify_mod (d); \ + Dynarr_resize_if (d, 1); \ + ((d)->base)[Dynarr_length (d)] = (el); \ + if (imp) \ + set_lheader_implementation \ + ((struct lrecord_header *)&(((d)->base)[Dynarr_length (d)]), imp); \ + Dynarr_set_length_1 (d, Dynarr_length (d) + 1); \ + (void) Dynarr_verify_mod (d); \ +} while (0) +#else /* not NEW_GC */ +#define Dynarr_add(d, el) \ +do { \ + (void) Dynarr_verify_mod (d); \ + Dynarr_resize_if (d, 1); \ + ((d)->base)[Dynarr_length (d)] = (el); \ + Dynarr_set_length_1 (d, Dynarr_length (d) + 1); \ + (void) Dynarr_verify_mod (d); \ +} while (0) +#endif /* not NEW_GC */ + + +MODULE_API void Dynarr_insert_many (void *d, const void *el, int len, + int start); +MODULE_API void Dynarr_delete_many (void *d, int start, int len); + #define Dynarr_insert_many_at_start(d, el, len) \ Dynarr_insert_many (d, el, len, 0) #define Dynarr_add_literal_string(d, s) Dynarr_add_many (d, s, sizeof (s) - 1) @@ -1915,30 +2011,6 @@ Dynarr_add_many (d, dyna_ls_eb, dyna_ls_bc); \ } while (0) -#ifdef NEW_GC -#define Dynarr_add(d, el) \ -do { \ - const struct lrecord_implementation *imp = (d)->lisp_imp; \ - if (Dynarr_verify_mod (d)->len >= (d)->max) \ - Dynarr_resize ((d), (d)->len+1); \ - ((d)->base)[(d)->len] = (el); \ - \ - if (imp) \ - set_lheader_implementation \ - ((struct lrecord_header *)&(((d)->base)[(d)->len]), imp); \ - \ - (d)->len++; \ - if ((d)->len > (d)->largest) \ - (d)->largest = (d)->len; \ -} while (0) -#else /* not NEW_GC */ -#define Dynarr_add(d, el) ( \ - Dynarr_verify_mod (d)->len >= (d)->max ? Dynarr_resize ((d), (d)->len+1) : \ - (void) 0, \ - ((d)->base)[(d)->len++] = (el), \ - (d)->len > (d)->largest ? (d)->largest = (d)->len : (int) 0) -#endif /* not NEW_GC */ - /* Add LEN contiguous elements to a Dynarr */ DECLARE_INLINE_HEADER ( @@ -1949,33 +2021,20 @@ /* This duplicates Dynarr_insert_many to some extent; but since it is called so often, it seemed useful to remove the unnecessary stuff from that function and to make it inline */ - Dynarr *dy = (Dynarr *) Dynarr_verify (d); - - if (dy->len + len > dy->max) - Dynarr_resize (dy, dy->len + len); + Dynarr *dy = Dynarr_verify_mod (d); + Dynarr_resize_if (dy, len); /* Some functions call us with a value of 0 to mean "reserve space but don't write into it" */ if (el) - memcpy ((char *) dy->base + dy->len*dy->elsize, el, len*dy->elsize); - dy->len += len; - - if (dy->len > dy->largest) - dy->largest = dy->len; + memcpy ((char *) dy->base + Dynarr_sizeof (dy), el, len*dy->elsize); + Dynarr_set_length_1 (dy, Dynarr_length (dy) + len); + (void) Dynarr_verify_mod (dy); } -/* The following defines will get you into real trouble if you aren't - careful. But they can save a lot of execution time when used wisely. */ -#define Dynarr_increment(d) (Dynarr_verify_mod (d)->len++) -#define Dynarr_set_size(d, n) \ -do { \ - Bytecount _dss_n = (n); \ - structure_checking_assert (_dss_n >= 0 && _dss_n <= (d)->largest); \ - Dynarr_verify_mod (d)->len = _dss_n; \ -} while (0) - #define Dynarr_pop(d) \ - (assert ((d)->len > 0), Dynarr_verify_mod (d)->len--, \ - Dynarr_at (d, (d)->len)) + (structure_checking_assert (Dynarr_length (d) > 0), \ + Dynarr_verify_mod (d)->len_--, \ + Dynarr_at (d, Dynarr_length (d))) #define Dynarr_delete(d, i) Dynarr_delete_many (d, i, 1) #define Dynarr_delete_by_pointer(d, p) \ Dynarr_delete_many (d, (p) - ((d)->base), 1) @@ -1991,17 +2050,7 @@ } \ } while (0) -#ifdef MEMORY_USAGE_STATS -struct overhead_stats; -Bytecount Dynarr_memory_usage (void *d, struct overhead_stats *stats); -#endif - -void *stack_like_malloc (Bytecount size); -void stack_like_free (void *val); - -/* ------------------------------- */ -/* Dynarr typedefs */ -/* ------------------------------- */ +/************* Dynarr typedefs *************/ /* Dynarr typedefs -- basic types first */ @@ -2042,6 +2091,15 @@ Dynarr_declare (unsigned long); } unsigned_long_dynarr; +typedef const Ascbyte *const_Ascbyte_ptr; +typedef struct +{ + Dynarr_declare (const Ascbyte *); +} const_Ascbyte_ptr_dynarr; + +extern const struct sized_memory_description const_Ascbyte_ptr_description; +extern const struct sized_memory_description const_Ascbyte_ptr_dynarr_description; + typedef struct { Dynarr_declare (int); @@ -2117,6 +2175,17 @@ Dynarr_declare (Lisp_Object *); } Lisp_Object_ptr_dynarr; + +/************* Stack-like malloc/free: Another allocator *************/ + +void *stack_like_malloc (Bytecount size); +void stack_like_free (void *val); + + +/************************************************************************/ +/** Definitions of other basic Lisp objects **/ +/************************************************************************/ + /*------------------------------ unbound -------------------------------*/ /* Qunbound is a special Lisp_Object (actually of type @@ -3832,22 +3901,100 @@ format it and store it in the `string-translatable' property of the returned string. See Fgettext(). - CGETTEXT() is the same as GETTEXT() but works with char * strings - instead of Ibyte * strings. - - build_msg_string() is a shorthand for build_string (GETTEXT (x)). - build_msg_intstring() is a shorthand for build_intstring (GETTEXT (x)). + The variations IGETTEXT, CIGETTEXT and ASCGETTEXT operate on + Ibyte *, CIbyte *, and Ascbyte * strings, respectively. The + ASCGETTEXT version has an assert check to verify that its string + really is pure-ASCII. Plain GETTEXT is defined as ASCGETTEXT, and + so works the same way. (There are no versions that work for Extbyte *. + Translate to internal format before working on it.) + + There are similar functions for building a Lisp string from a C + string and translating in the process. They again come in three + variants: build_msg_istring(), build_msg_cistring(), and + build_msg_ascstring(). Again, build_msg_ascstring() asserts that + its text is pure-ASCII, and build_msg_string() is the same as + build_msg_ascstring(). */ -#define GETTEXT(x) (x) -#define CGETTEXT(x) (x) -#define LISP_GETTEXT(x) (x) - -/* DEFER_GETTEXT is used to identify strings which are translated when - they are referenced instead of when they are defined. - These include Qerror_messages and initialized arrays of strings. +/* Return value NOT Ascbyte, because the result in general will have been + translated into a foreign language. */ +DECLARE_INLINE_HEADER (const CIbyte *ASCGETTEXT (const Ascbyte *s)) +{ + ASSERT_ASCTEXT_ASCII (s); + return s; +} + +DECLARE_INLINE_HEADER (const Ibyte *IGETTEXT (const Ibyte *s)) +{ + return s; +} + +DECLARE_INLINE_HEADER (const CIbyte *CIGETTEXT (const CIbyte *s)) +{ + return s; +} + +DECLARE_INLINE_HEADER (Lisp_Object LISP_GETTEXT (Lisp_Object s)) +{ + return s; +} + +#define GETTEXT ASCGETTEXT + +MODULE_API Lisp_Object build_msg_istring (const Ibyte *); +MODULE_API Lisp_Object build_msg_cistring (const CIbyte *); +MODULE_API Lisp_Object build_msg_ascstring (const Ascbyte *); +#define build_msg_string build_msg_ascstring + + +/* DEFER_GETTEXT() and variants are used to identify strings which are not + meant to be translated immediately, but instead at some later time. + This is used in strings that are stored somewhere at dump or + initialization time, at a time when the current language environment is + not set. It is the duty of the user of the string to call GETTEXT or + some variant at the appropriate time. DEFER_GETTTEXT() serves only as a + marker that the string is translatable, and will as a result be snarfed + during message snarfing (see above). + + build_defer_string() and variants are the deferred equivalents of + build_msg_string() and variants. Similarly to DEFER_GETTEXT(), they + don't actually do any translation, but serve as place markers for + message snarfing. However, they may do something more than just build + a Lisp string -- in particular, they may store a string property + indicating that the string is translatable (see discussion above about + this property). */ -#define DEFER_GETTEXT(x) (x) + +DECLARE_INLINE_HEADER (const Ascbyte *DEFER_ASCGETTEXT (const Ascbyte *s)) +{ + ASSERT_ASCTEXT_ASCII (s); + return s; +} + +DECLARE_INLINE_HEADER (const Ibyte *DEFER_IGETTEXT (const Ibyte *s)) +{ + return s; +} + +DECLARE_INLINE_HEADER (const CIbyte *DEFER_CIGETTEXT (const CIbyte *s)) +{ + return s; +} + +#define DEFER_GETTEXT DEFER_ASCGETTEXT + +MODULE_API Lisp_Object build_defer_istring (const Ibyte *); +MODULE_API Lisp_Object build_defer_cistring (const CIbyte *); +MODULE_API Lisp_Object build_defer_ascstring (const Ascbyte *); + +#define build_defer_string build_defer_ascstring + + +void write_msg_istring (Lisp_Object stream, const Ibyte *str); +void write_msg_cistring (Lisp_Object stream, const CIbyte *str); +void write_msg_ascstring (Lisp_Object stream, const Ascbyte *str); + +#define write_msg_string write_msg_ascstring /************************************************************************/ @@ -4139,28 +4286,34 @@ /* Help debug crashes gc-marking a staticpro'ed object. */ -MODULE_API void staticpro_1 (Lisp_Object *, Ascbyte *); -MODULE_API void staticpro_nodump_1 (Lisp_Object *, Ascbyte *); -/* g++ 4.3 complains about the conversion of const char to char. - These end up in a dynarray, so we would need to define a whole new class - of dynarray just to handle the const char stuff. - ####Check to see how hard this might be. */ -#define staticpro(ptr) staticpro_1 (ptr, (Ascbyte *) #ptr) -#define staticpro_nodump(ptr) staticpro_nodump_1 (ptr, (Ascbyte *) #ptr) +MODULE_API void staticpro_1 (Lisp_Object *, const Ascbyte *); +MODULE_API void staticpro_nodump_1 (Lisp_Object *, const Ascbyte *); +#define staticpro(ptr) staticpro_1 (ptr, #ptr) +#define staticpro_nodump(ptr) staticpro_nodump_1 (ptr, #ptr) #ifdef HAVE_SHLIB -MODULE_API void unstaticpro_nodump_1 (Lisp_Object *, Ascbyte *); -#define unstaticpro_nodump(ptr) unstaticpro_nodump_1 (ptr, (Ascbyte *) #ptr) +MODULE_API void unstaticpro_nodump_1 (Lisp_Object *, const Ascbyte *); +#define unstaticpro_nodump(ptr) unstaticpro_nodump_1 (ptr, #ptr) #endif #else /* Call staticpro (&var) to protect static variable `var'. */ MODULE_API void staticpro (Lisp_Object *); +/* staticpro_1 (varptr, name) is used when we're not directly calling + staticpro() on the address of a Lisp variable, but on a pointer we + got from elsewhere. In that case, NAME is a string describing the + actual variable in question. NAME is used only for debugging purposes, + and hence when not DEBUG_XEMACS, staticpro_1() just calls staticpro(). + With DEBUG_XEMACS, however, it's the reverse -- staticpro() calls + staticpro_1(), using the ANSI "stringize" operator to construct a string + out of the variable name. */ +#define staticpro_1(ptr, name) staticpro (ptr) /* Call staticpro_nodump (&var) to protect static variable `var'. */ /* var will not be saved at dump time */ MODULE_API void staticpro_nodump (Lisp_Object *); +#define staticpro_nodump_1(ptr, name) staticpro_nodump (ptr) #ifdef HAVE_SHLIB /* Call unstaticpro_nodump (&var) to stop protecting static variable `var'. */ @@ -4173,7 +4326,7 @@ extern Lisp_Object_dynarr *mcpros; #ifdef DEBUG_XEMACS /* Help debug crashes gc-marking a mcpro'ed object. */ -MODULE_API void mcpro_1 (Lisp_Object, char *); +MODULE_API void mcpro_1 (Lisp_Object, const Ascbyte *); #define mcpro(ptr) mcpro_1 (ptr, #ptr) #else /* not DEBUG_XEMACS */ /* Call mcpro (&var) to protect mc variable `var'. */ @@ -4267,13 +4420,12 @@ int c_readonly (Lisp_Object); int lisp_readonly (Lisp_Object); MODULE_API void copy_lisp_object (Lisp_Object dst, Lisp_Object src); -MODULE_API Lisp_Object build_intstring (const Ibyte *); -MODULE_API Lisp_Object build_string (const CIbyte *); -MODULE_API Lisp_Object build_ext_string (const Extbyte *, Lisp_Object); -MODULE_API Lisp_Object build_msg_intstring (const Ibyte *); -MODULE_API Lisp_Object build_msg_string (const CIbyte *); +MODULE_API Lisp_Object build_istring (const Ibyte *); +MODULE_API Lisp_Object build_cistring (const CIbyte *); +MODULE_API Lisp_Object build_ascstring (const Ascbyte *); +MODULE_API Lisp_Object build_extstring (const Extbyte *, Lisp_Object); MODULE_API Lisp_Object make_string (const Ibyte *, Bytecount); -MODULE_API Lisp_Object make_ext_string (const Extbyte *, EMACS_INT, Lisp_Object); +MODULE_API Lisp_Object make_extstring (const Extbyte *, EMACS_INT, Lisp_Object); void init_string_ascii_begin (Lisp_Object string); Lisp_Object make_uninit_string (Bytecount); MODULE_API Lisp_Object make_float (double); @@ -4381,7 +4533,9 @@ EXFUN (Fbyte_code, 3); DECLARE_DOESNT_RETURN (invalid_byte_code - (const CIbyte *reason, Lisp_Object frob)); + (const Ascbyte *reason, Lisp_Object frob)); + +extern Lisp_Object Qbyte_code, Qinvalid_byte_code; /* Defined in callint.c */ EXFUN (Fcall_interactively, 3); @@ -4463,6 +4617,26 @@ Lisp_Object word_to_lisp (unsigned int); unsigned int lisp_to_word (Lisp_Object); +extern Lisp_Object Qarrayp, Qbitp, Qchar_or_string_p, Qcharacterp, + Qerror_conditions, Qerror_message, Qinteger_char_or_marker_p, + Qinteger_or_char_p, Qinteger_or_marker_p, Qlambda, Qlistp, Qnatnump, + Qnonnegativep, Qnumber_char_or_marker_p, Qnumberp, Qquote, Qtrue_list_p; +extern MODULE_API Lisp_Object Qintegerp; + +extern Lisp_Object Qarith_error, Qbeginning_of_buffer, Qbuffer_read_only, + Qcircular_list, Qcircular_property_list, Qconversion_error, + Qcyclic_variable_indirection, Qdomain_error, Qediting_error, + Qend_of_buffer, Qend_of_file, Qerror, Qfile_error, Qinternal_error, + Qinvalid_change, Qinvalid_constant, Qinvalid_function, Qinvalid_operation, + Qinvalid_read_syntax, Qinvalid_state, Qio_error, Qlist_formation_error, + Qmalformed_list, Qmalformed_property_list, Qno_catch, Qout_of_memory, + Qoverflow_error, Qprinting_unreadable_object, Qquit, Qrange_error, + Qsetting_constant, Qsingularity_error, Qstack_overflow, + Qstructure_formation_error, Qtext_conversion_error, Qunderflow_error, + Qvoid_function, Qvoid_variable, Qwrong_number_of_arguments, + Qwrong_type_argument; +extern MODULE_API Lisp_Object Qinvalid_argument, Qsyntax_error; + /* Defined in dired.c */ Lisp_Object make_directory_hash_table (const Ibyte *); Lisp_Object wasteful_word_to_lisp (unsigned int); @@ -4618,38 +4792,38 @@ const CIbyte *, ...) PRINTF_ARGS (4, 5); -Lisp_Object build_error_data (const CIbyte *reason, Lisp_Object frob); -DECLARE_DOESNT_RETURN (signal_error (Lisp_Object, const CIbyte *, +Lisp_Object build_error_data (const Ascbyte *reason, Lisp_Object frob); +DECLARE_DOESNT_RETURN (signal_error (Lisp_Object, const Ascbyte *, Lisp_Object)); -void maybe_signal_error (Lisp_Object, const CIbyte *, Lisp_Object, +void maybe_signal_error (Lisp_Object, const Ascbyte *, Lisp_Object, Lisp_Object, Error_Behavior); -Lisp_Object signal_continuable_error (Lisp_Object, const CIbyte *, +Lisp_Object signal_continuable_error (Lisp_Object, const Ascbyte *, Lisp_Object); -Lisp_Object maybe_signal_continuable_error (Lisp_Object, const CIbyte *, +Lisp_Object maybe_signal_continuable_error (Lisp_Object, const Ascbyte *, Lisp_Object, Lisp_Object, Error_Behavior); DECLARE_DOESNT_RETURN (signal_ferror_with_frob (Lisp_Object, Lisp_Object, - const CIbyte *, ...)) + const Ascbyte *, ...)) PRINTF_ARGS(3, 4); void maybe_signal_ferror_with_frob (Lisp_Object, Lisp_Object, Lisp_Object, Error_Behavior, - const CIbyte *, ...) PRINTF_ARGS (5, 6); + const Ascbyte *, ...) PRINTF_ARGS (5, 6); Lisp_Object signal_continuable_ferror_with_frob (Lisp_Object, Lisp_Object, - const CIbyte *, + const Ascbyte *, ...) PRINTF_ARGS (3, 4); Lisp_Object maybe_signal_continuable_ferror_with_frob (Lisp_Object, Lisp_Object, Lisp_Object, Error_Behavior, - const CIbyte *, ...) + const Ascbyte *, ...) PRINTF_ARGS (5, 6); -DECLARE_DOESNT_RETURN (signal_error_2 (Lisp_Object, const CIbyte *, +DECLARE_DOESNT_RETURN (signal_error_2 (Lisp_Object, const Ascbyte *, Lisp_Object, Lisp_Object)); -void maybe_signal_error_2 (Lisp_Object, const CIbyte *, Lisp_Object, +void maybe_signal_error_2 (Lisp_Object, const Ascbyte *, Lisp_Object, Lisp_Object, Lisp_Object, Error_Behavior); -Lisp_Object signal_continuable_error_2 (Lisp_Object, const CIbyte *, +Lisp_Object signal_continuable_error_2 (Lisp_Object, const Ascbyte *, Lisp_Object, Lisp_Object); -Lisp_Object maybe_signal_continuable_error_2 (Lisp_Object, const CIbyte *, +Lisp_Object maybe_signal_continuable_error_2 (Lisp_Object, const Ascbyte *, Lisp_Object, Lisp_Object, Lisp_Object, Error_Behavior); @@ -4662,57 +4836,57 @@ MODULE_API DECLARE_DOESNT_RETURN (signal_circular_property_list_error (Lisp_Object)); -DECLARE_DOESNT_RETURN (syntax_error (const CIbyte *reason, +DECLARE_DOESNT_RETURN (syntax_error (const Ascbyte *reason, Lisp_Object frob)); -DECLARE_DOESNT_RETURN (syntax_error_2 (const CIbyte *reason, +DECLARE_DOESNT_RETURN (syntax_error_2 (const Ascbyte *reason, Lisp_Object frob1, Lisp_Object frob2)); -void maybe_syntax_error (const CIbyte *, Lisp_Object, Lisp_Object, +void maybe_syntax_error (const Ascbyte *, Lisp_Object, Lisp_Object, Error_Behavior); -DECLARE_DOESNT_RETURN (sferror (const CIbyte *reason, Lisp_Object frob)); -DECLARE_DOESNT_RETURN (sferror_2 (const CIbyte *reason, Lisp_Object frob1, +DECLARE_DOESNT_RETURN (sferror (const Ascbyte *reason, Lisp_Object frob)); +DECLARE_DOESNT_RETURN (sferror_2 (const Ascbyte *reason, Lisp_Object frob1, Lisp_Object frob2)); -void maybe_sferror (const CIbyte *, Lisp_Object, Lisp_Object, +void maybe_sferror (const Ascbyte *, Lisp_Object, Lisp_Object, Error_Behavior); -MODULE_API DECLARE_DOESNT_RETURN (invalid_argument (const CIbyte *reason, +MODULE_API DECLARE_DOESNT_RETURN (invalid_argument (const Ascbyte *reason, Lisp_Object frob)); -MODULE_API DECLARE_DOESNT_RETURN (invalid_argument_2 (const CIbyte *reason, +MODULE_API DECLARE_DOESNT_RETURN (invalid_argument_2 (const Ascbyte *reason, Lisp_Object frob1, Lisp_Object frob2)); -void maybe_invalid_argument (const CIbyte *, Lisp_Object, Lisp_Object, +void maybe_invalid_argument (const Ascbyte *, Lisp_Object, Lisp_Object, Error_Behavior); -MODULE_API DECLARE_DOESNT_RETURN (invalid_operation (const CIbyte *reason, +MODULE_API DECLARE_DOESNT_RETURN (invalid_operation (const Ascbyte *reason, Lisp_Object frob)); -MODULE_API DECLARE_DOESNT_RETURN (invalid_operation_2 (const CIbyte *reason, +MODULE_API DECLARE_DOESNT_RETURN (invalid_operation_2 (const Ascbyte *reason, Lisp_Object frob1, Lisp_Object frob2)); -MODULE_API void maybe_invalid_operation (const CIbyte *, Lisp_Object, +MODULE_API void maybe_invalid_operation (const Ascbyte *, Lisp_Object, Lisp_Object, Error_Behavior); -DECLARE_DOESNT_RETURN (invalid_state (const CIbyte *reason, +DECLARE_DOESNT_RETURN (invalid_state (const Ascbyte *reason, Lisp_Object frob)); -DECLARE_DOESNT_RETURN (invalid_state_2 (const CIbyte *reason, +DECLARE_DOESNT_RETURN (invalid_state_2 (const Ascbyte *reason, Lisp_Object frob1, Lisp_Object frob2)); -void maybe_invalid_state (const CIbyte *, Lisp_Object, Lisp_Object, +void maybe_invalid_state (const Ascbyte *, Lisp_Object, Lisp_Object, Error_Behavior); -DECLARE_DOESNT_RETURN (invalid_change (const CIbyte *reason, +DECLARE_DOESNT_RETURN (invalid_change (const Ascbyte *reason, Lisp_Object frob)); -DECLARE_DOESNT_RETURN (invalid_change_2 (const CIbyte *reason, +DECLARE_DOESNT_RETURN (invalid_change_2 (const Ascbyte *reason, Lisp_Object frob1, Lisp_Object frob2)); -void maybe_invalid_change (const CIbyte *, Lisp_Object, Lisp_Object, +void maybe_invalid_change (const Ascbyte *, Lisp_Object, Lisp_Object, Error_Behavior); -MODULE_API DECLARE_DOESNT_RETURN (invalid_constant (const CIbyte *reason, +MODULE_API DECLARE_DOESNT_RETURN (invalid_constant (const Ascbyte *reason, Lisp_Object frob)); -DECLARE_DOESNT_RETURN (invalid_constant_2 (const CIbyte *reason, +DECLARE_DOESNT_RETURN (invalid_constant_2 (const Ascbyte *reason, Lisp_Object frob1, Lisp_Object frob2)); -void maybe_invalid_constant (const CIbyte *, Lisp_Object, Lisp_Object, +void maybe_invalid_constant (const Ascbyte *, Lisp_Object, Lisp_Object, Error_Behavior); -DECLARE_DOESNT_RETURN (wtaerror (const CIbyte *reason, Lisp_Object frob)); -MODULE_API DECLARE_DOESNT_RETURN (out_of_memory (const CIbyte *reason, +DECLARE_DOESNT_RETURN (wtaerror (const Ascbyte *reason, Lisp_Object frob)); +MODULE_API DECLARE_DOESNT_RETURN (out_of_memory (const Ascbyte *reason, Lisp_Object frob)); -DECLARE_DOESNT_RETURN (stack_overflow (const CIbyte *reason, +DECLARE_DOESNT_RETURN (stack_overflow (const Ascbyte *reason, Lisp_Object frob)); Lisp_Object signal_void_function_error (Lisp_Object); @@ -4886,7 +5060,7 @@ void do_autoload (Lisp_Object, Lisp_Object); /* GCPROs both arguments */ Lisp_Object un_autoload (Lisp_Object); void warn_when_safe_lispobj (Lisp_Object, Lisp_Object, Lisp_Object); -MODULE_API void warn_when_safe (Lisp_Object, Lisp_Object, const CIbyte *, +MODULE_API void warn_when_safe (Lisp_Object, Lisp_Object, const Ascbyte *, ...) PRINTF_ARGS (3, 4); extern int backtrace_with_internal_sections; @@ -5005,13 +5179,9 @@ void record_auto_save (void); void force_auto_save_soon (void); DECLARE_DOESNT_RETURN (report_error_with_errno (Lisp_Object errtype, - const CIbyte *string, + const Ascbyte *reason, Lisp_Object data)); -DECLARE_DOESNT_RETURN (report_file_type_error (Lisp_Object errtype, - Lisp_Object oserrmess, - const CIbyte *string, - Lisp_Object data)); -DECLARE_DOESNT_RETURN (report_file_error (const CIbyte *, Lisp_Object)); +DECLARE_DOESNT_RETURN (report_file_error (const Ascbyte *, Lisp_Object)); Lisp_Object lisp_strerror (int); Lisp_Object expand_and_dir_to_file (Lisp_Object, Lisp_Object); int internal_delete_file (Lisp_Object); @@ -5114,12 +5284,12 @@ int depth); int internal_equal (Lisp_Object, Lisp_Object, int); int internal_equalp (Lisp_Object obj1, Lisp_Object obj2, int depth); +Lisp_Object MODULE_API concat2 (Lisp_Object, Lisp_Object); +Lisp_Object MODULE_API concat3 (Lisp_Object, Lisp_Object, Lisp_Object); +Lisp_Object MODULE_API vconcat2 (Lisp_Object, Lisp_Object); +Lisp_Object MODULE_API vconcat3 (Lisp_Object, Lisp_Object, Lisp_Object); +Lisp_Object MODULE_API nconc2 (Lisp_Object, Lisp_Object); int internal_equal_0 (Lisp_Object, Lisp_Object, int, int); -Lisp_Object concat2 (Lisp_Object, Lisp_Object); -Lisp_Object concat3 (Lisp_Object, Lisp_Object, Lisp_Object); -Lisp_Object vconcat2 (Lisp_Object, Lisp_Object); -Lisp_Object vconcat3 (Lisp_Object, Lisp_Object, Lisp_Object); -Lisp_Object nconc2 (Lisp_Object, Lisp_Object); Lisp_Object bytecode_nconc2 (Lisp_Object *); int bytecode_arithcompare (Lisp_Object obj1, Lisp_Object obj2); void check_losing_bytecode (const char *, Lisp_Object); @@ -5279,9 +5449,11 @@ /* NOTE: Do not call this with the data of a Lisp_String. Use princ. * Note: stream should be defaulted before calling * (eg Qnil means stdout, not Vstandard_output, etc) */ -MODULE_API void write_c_string (Lisp_Object stream, const CIbyte *str); +MODULE_API void write_istring (Lisp_Object stream, const Ibyte *str); /* Same goes for this function. */ -MODULE_API void write_string (Lisp_Object stream, const Ibyte *str); +MODULE_API void write_cistring (Lisp_Object stream, const CIbyte *str); +/* Same goes for this function. */ +MODULE_API void write_ascstring (Lisp_Object stream, const Ascbyte *str); /* Same goes for this function. */ void write_string_1 (Lisp_Object stream, const Ibyte *str, Bytecount size); void write_eistring (Lisp_Object stream, const Eistring *ei); @@ -5359,6 +5531,7 @@ EXFUN (Fskip_chars_backward, 3); EXFUN (Fskip_chars_forward, 3); EXFUN (Fstring_match, 4); +EXFUN (Fregexp_quote, 1); struct re_pattern_buffer; struct re_registers; @@ -5419,7 +5592,7 @@ EXFUN (Fsymbol_value, 1); unsigned int hash_string (const Ibyte *, Bytecount); -Lisp_Object intern_int (const Ibyte *str); +Lisp_Object intern_istring (const Ibyte *str); MODULE_API Lisp_Object intern (const CIbyte *str); Lisp_Object intern_converting_underscores_to_dashes (const CIbyte *str); Lisp_Object oblookup (Lisp_Object, const Ibyte *, Bytecount); @@ -5928,62 +6101,31 @@ */ -extern Lisp_Object Qactivate_menubar_hook, Qand_optional, Qand_rest; -extern Lisp_Object Qarith_error, Qarrayp, Qautoload, Qbackground; -extern Lisp_Object Qbackground_pixmap, Qbeginning_of_buffer, Qbitp, Qblinking; -extern Lisp_Object Qbuffer_glyph_p, Qbuffer_live_p, Qbuffer_read_only; -extern Lisp_Object Qbyte_code, Qcall_interactively, Qcategory_designator_p; -extern Lisp_Object Qcategory_table_value_p, Qcdr, Qchar_or_string_p; -extern Lisp_Object Qcharacterp, Qcircular_list, Qcircular_property_list; -extern Lisp_Object Qcolor_pixmap_image_instance_p, Qcommandp; -extern Lisp_Object Qcompletion_ignore_case, Qconsole_live_p, Qconst_specifier; -extern Lisp_Object Qconversion_error, Qcurrent_menubar; -extern Lisp_Object Qcyclic_variable_indirection, Qdefun, Qdevice_live_p, Qdim; -extern Lisp_Object Qdirection, Qdisabled, Qdisabled_command_hook; -extern Lisp_Object Qdisplay_table, Qdll_error, Qdomain_error, Qediting_error; -extern Lisp_Object Qend_of_buffer, Qend_of_file, Qend_open, Qerror; -extern Lisp_Object Qerror_conditions, Qerror_lacks_explanatory_string; -extern Lisp_Object Qerror_message, Qevent_live_p, Qexit, Qextent_live_p; -extern Lisp_Object Qexternal_debugging_output, Qfeaturep, Qfile_error; -extern Lisp_Object Qfile_name_sans_extension, Qfinal; -extern Lisp_Object Qforeground, Qformat, Qframe_live_p, Qgraphic; -extern Lisp_Object Qgui_error, Qicon_glyph_p, Qidentity, Qinhibit_quit; -extern Lisp_Object Qinhibit_read_only, Qinteger_char_or_marker_p; -extern Lisp_Object Qinteger_or_char_p, Qinteger_or_marker_p; -extern Lisp_Object Qinteractive, Qinternal_error; -extern Lisp_Object Qinvalid_byte_code, Qinvalid_change, Qinvalid_constant; -extern Lisp_Object Qinvalid_function, Qinvalid_operation; -extern Lisp_Object Qinvalid_read_syntax, Qinvalid_state, Qio_error, Qlambda; -extern Lisp_Object Qlayout, Qlist_formation_error, Qlistp, Qload; -extern Lisp_Object Qlong_name, Qmacro, Qmakunbound, Qmalformed_list; -extern Lisp_Object Qmalformed_property_list, Qmark, Qmodule; -extern Lisp_Object Qmono_pixmap_image_instance_p, Qmouse_leave_buffer_hook; -extern Lisp_Object Qnative_layout, Qnatnump, Qnetwork_error, Qno_catch; -extern Lisp_Object Qnonnegativep, Qnothing_image_instance_p; -extern Lisp_Object Qnumber_char_or_marker_p, Qnumberp, Qout_of_memory; -extern Lisp_Object Qoverflow_error, Qpoint, Qpointer_glyph_p; -extern Lisp_Object Qpointer_image_instance_p, Qprint_length; -extern Lisp_Object Qprint_string_length, Qprinting_unreadable_object; -extern Lisp_Object Qprogn, Qquit, Qquote, Qrange_error; -extern Lisp_Object Qread_char, Qread_from_minibuffer; -extern Lisp_Object Qreally_early_error_handler, Qregion_beginning; -extern Lisp_Object Qregion_end, Qregistries, Qreverse_direction_charset; -extern Lisp_Object Qrun_hooks, Qsans_modifiers, Qsave_buffers_kill_emacs; -extern Lisp_Object Qself_insert_command, Qself_insert_defer_undo, Qsequencep; -extern Lisp_Object Qset, Qsetting_constant, Qshort_name, Qsingularity_error; -extern Lisp_Object Qsound_error, Qstack_overflow, Qstandard_input; -extern Lisp_Object Qstandard_output, Qstart_open, Qstring_lessp; -extern Lisp_Object Qstructure_formation_error, Qsubwindow; -extern Lisp_Object Qsubwindow_image_instance_p; -extern Lisp_Object Qtext_conversion_error, Qtext_image_instance_p, Qtop_level; -extern Lisp_Object Qtrue_list_p, Qunderflow_error, Qunderline; -extern Lisp_Object Quser_files_and_directories, Qvalues; -extern Lisp_Object Qvariable_documentation, Qvariable_domain, Qvoid_function; -extern Lisp_Object Qvoid_variable, Qwindow_live_p, Qwrong_number_of_arguments; -extern Lisp_Object Qwrong_type_argument, Qyes_or_no_p; - -extern MODULE_API Lisp_Object Qintegerp, Qinvalid_argument, Qprocess_error; -extern MODULE_API Lisp_Object Qsyntax_error, Qt, Qunbound; +extern Lisp_Object Qactivate_menubar_hook, Qand_optional, Qand_rest, Qautoload, + Qbackground, Qbackground_pixmap, Qblinking, Qbuffer_glyph_p, Qbuffer_live_p, + Qcall_interactively, Qcategory_designator_p, + Qcategory_table_value_p, Qcdr, Qcolor_pixmap_image_instance_p, Qcommandp, + Qcompletion_ignore_case, Qconsole_live_p, Qconst_specifier, Qcurrent_menubar, + Qdefun, Qdevice_live_p, Qdim, Qdirection, Qdisabled, Qdisabled_command_hook, + Qdisplay_table, Qdll_error, Qend_open, Qerror_lacks_explanatory_string, + Qevent_live_p, Qexit, Qextent_live_p, Qexternal_debugging_output, Qfeaturep, + Qfile_error, Qfile_name_sans_extension, Qfinal, Qforeground, Qformat, + Qframe_live_p, Qgraphic, Qgui_error, Qicon_glyph_p, Qidentity, Qinhibit_quit, + Qinhibit_read_only, Qinteractive, Qlayout, Qload, Qlong_name, Qmacro, + Qmakunbound, Qmark, Qmodule, Qmono_pixmap_image_instance_p, + Qmouse_leave_buffer_hook, Qnative_layout, Qnetwork_error, + Qnothing_image_instance_p, Qpoint, Qpointer_glyph_p, + Qpointer_image_instance_p, Qprint_length, Qprint_string_length, Qprogn, + Qread_char, Qread_from_minibuffer, Qreally_early_error_handler, + Qregion_beginning, Qregion_end, Qregistries, Qreverse_direction_charset, + Qrun_hooks, Qsans_modifiers, Qsave_buffers_kill_emacs, Qself_insert_command, + Qself_insert_defer_undo, Qsequencep, Qset, Qshort_name, Qsound_error, + Qstandard_input, Qstandard_output, Qstart_open, Qstring_lessp, Qsubwindow, + Qsubwindow_image_instance_p, Qtext_image_instance_p, Qtop_level, Qunderline, + Quser_files_and_directories, Qvalues, Qvariable_documentation, + Qvariable_domain, Qwindow_live_p, Qyes_or_no_p; + +extern MODULE_API Lisp_Object Qprocess_error, Qt, Qunbound; #define SYMBOL(fou) extern Lisp_Object fou #define SYMBOL_MODULE_API(fou) extern MODULE_API Lisp_Object fou @@ -6009,7 +6151,7 @@ extern Lisp_Object Vcommand_line_args, Vconfigure_info_directory; extern Lisp_Object Vconfigure_site_directory, Vconfigure_site_module_directory; extern Lisp_Object Vconsole_list, Vcontrolling_terminal; -extern Lisp_Object Vcurrent_compiled_function_annotation, Vcurrent_load_list; +extern Lisp_Object Vcurrent_load_list; extern Lisp_Object Vcurrent_mouse_event, Vcurrent_prefix_arg, Vdata_directory; extern Lisp_Object Vdirectory_sep_char, Vdisabled_command_hook; extern Lisp_Object Vdoc_directory, Vinternal_doc_file_name; diff -r d2ec55325515 -r 8f0cf4fd3d2c src/lread.c --- a/src/lread.c Sat Feb 06 03:59:18 2010 -0600 +++ b/src/lread.c Sat Feb 06 04:01:46 2010 -0600 @@ -1,7 +1,7 @@ /* Lisp parsing and input streams. Copyright (C) 1985-1989, 1992-1995 Free Software Foundation, Inc. Copyright (C) 1995 Tinker Systems. - Copyright (C) 1996, 2001, 2002, 2003 Ben Wing. + Copyright (C) 1996, 2001, 2002, 2003, 2010 Ben Wing. This file is part of XEmacs. @@ -148,10 +148,6 @@ /* A resizing-buffer stream used to temporarily hold data while reading */ static Lisp_Object Vread_buffer_stream; -#ifdef COMPILED_FUNCTION_ANNOTATION_HACK -Lisp_Object Vcurrent_compiled_function_annotation; -#endif - static int load_byte_code_version; /* An array describing all known built-in structure types */ @@ -593,7 +589,7 @@ fd = locate_file (Vload_path, file, ((!NILP (nosuffix)) ? Qnil : - build_string (load_ignore_elc_files ? ".el:" : + build_ascstring (load_ignore_elc_files ? ".el:" : ".elc:.el:")), &found, -1); @@ -1097,7 +1093,7 @@ { /* We succeeded; return this descriptor and filename. */ if (closure->storeptr) - *closure->storeptr = build_intstring (fn); + *closure->storeptr = build_istring (fn); return 1; } @@ -1181,7 +1177,7 @@ locate_file_construct_suffixed_files_mapper (Ibyte *fn, void *arg) { Lisp_Object *tail = (Lisp_Object *) arg; - *tail = Fcons (build_intstring (fn), *tail); + *tail = Fcons (build_istring (fn), *tail); return 0; } @@ -1271,7 +1267,7 @@ /* Is it really necessary to gcpro path and str? It shouldn't be unless some caller has fucked up. There are known instances that - call us with build_string("foo:bar") as SUFFIXES, though. */ + call us with build_ascstring("foo:bar") as SUFFIXES, though. */ GCPRO4 (path, str, suffixes, suffixtab); /* if this filename has directory components, it's too complicated @@ -1451,9 +1447,6 @@ internal_bind_lisp_object (&Vcurrent_load_list, Qnil); -#ifdef COMPILED_FUNCTION_ANNOTATION_HACK - Vcurrent_compiled_function_annotation = Qnil; -#endif GCPRO2 (val, sourcename); LOADHIST_ATTACH (sourcename); @@ -1619,9 +1612,6 @@ Vread_objects = Qnil; -#ifdef COMPILED_FUNCTION_ANNOTATION_HACK - Vcurrent_compiled_function_annotation = Qnil; -#endif if (EQ (stream, Qread_char)) { Lisp_Object val = call1 (Qread_from_minibuffer, @@ -1648,9 +1638,6 @@ Lisp_Object lispstream = Qnil; struct gcpro gcpro1; -#ifdef COMPILED_FUNCTION_ANNOTATION_HACK - Vcurrent_compiled_function_annotation = Qnil; -#endif GCPRO1 (lispstream); CHECK_STRING (string); get_string_range_byte (string, start, end, &startval, &endval, @@ -1872,7 +1859,7 @@ else if (c >= 'a' && c <= 'f') i = (i << 4) + (c - 'a') + 10; else if (c >= 'A' && c <= 'F') i = (i << 4) + (c - 'A') + 10; - args[0] = build_string ("?\\x%x"); + args[0] = build_ascstring ("?\\x%x"); args[1] = make_int (i); syntax_error ("Overlong hex character escape", Fformat (2, args)); @@ -2129,7 +2116,7 @@ Dynarr_add (dyn, bit); } - val = make_bit_vector_from_byte_vector (Dynarr_atp (dyn, 0), + val = make_bit_vector_from_byte_vector (Dynarr_begin (dyn), Dynarr_length (dyn)); Dynarr_free (dyn); @@ -2394,34 +2381,36 @@ Ichar c; Ichar permit_unicode = 0; - do { - c = reader_nextchar(readcharfun); - switch (c) { - /* #r:engine"my sexy raw string" -- raw string w/ flags*/ - /* case ':': */ - /* #ru"Hi there\u20AC \U000020AC" -- raw string, honouring Unicode. */ - case 'u': - case 'U': - permit_unicode = c; - continue; - - /* #r"my raw string" -- raw string */ - case '\"': - return read_string(readcharfun, '\"', 1, permit_unicode); - /* invalid syntax */ - default: - { - if (permit_unicode) + do + { + c = reader_nextchar (readcharfun); + switch (c) + { + /* #r:engine"my sexy raw string" -- raw string w/ flags*/ + /* case ':': */ + /* #ru"Hi there\u20AC \U000020AC" -- raw string, honouring Unicode. */ + case 'u': + case 'U': + permit_unicode = c; + continue; + + /* #r"my raw string" -- raw string */ + case '\"': + return read_string (readcharfun, '\"', 1, permit_unicode); + /* invalid syntax */ + default: { - unreadchar(readcharfun, permit_unicode); + if (permit_unicode) + { + unreadchar (readcharfun, permit_unicode); + } + unreadchar (readcharfun, c); + return Fsignal (Qinvalid_read_syntax, + list1 (build_msg_string + ("unrecognized raw string syntax"))); } - unreadchar(readcharfun, c); - return Fsignal(Qinvalid_read_syntax, - list1(build_string - ("unrecognized raw string syntax"))); - } - } - } while (1); + } + } while (1); } /* Read the next Lisp object from the stream READCHARFUN and return it. @@ -2580,7 +2569,7 @@ if (CONSP (tmp) && UNBOUNDP (XCAR (tmp))) free_cons (tmp); return Fsignal (Qinvalid_read_syntax, - list1 (build_string ("#"))); + list1 (build_ascstring ("#"))); } GCPRO1 (tmp); /* Read the intervals and their properties. */ @@ -2738,13 +2727,13 @@ make_int (n))); } return Fsignal (Qinvalid_read_syntax, - list1 (build_string ("#"))); + list1 (build_ascstring ("#"))); } default: { unreadchar (readcharfun, c); return Fsignal (Qinvalid_read_syntax, - list1 (build_string ("#"))); + list1 (build_ascstring ("#"))); } } } @@ -3009,16 +2998,6 @@ } } -#ifdef COMPILED_FUNCTION_ANNOTATION_HACK - if (s->length == 1 && s->allow_dotted_lists && EQ (XCAR (s->head), Qfset)) - { - if (CONSP (elt) && EQ (XCAR (elt), Qquote) && CONSP (XCDR (elt))) - Vcurrent_compiled_function_annotation = XCAR (XCDR (elt)); - else - Vcurrent_compiled_function_annotation = elt; - } -#endif - elt = Fcons (elt, Qnil); if (!NILP (s->tail)) XCDR (s->tail) = elt; @@ -3054,10 +3033,6 @@ { struct read_list_state s; struct gcpro gcpro1, gcpro2; -#ifdef COMPILED_FUNCTION_ANNOTATION_HACK - Lisp_Object old_compiled_function_annotation = - Vcurrent_compiled_function_annotation; -#endif s.head = Qnil; s.tail = Qnil; @@ -3067,9 +3042,6 @@ GCPRO2 (s.head, s.tail); sequence_reader (readcharfun, terminator, &s, read_list_conser); -#ifdef COMPILED_FUNCTION_ANNOTATION_HACK - Vcurrent_compiled_function_annotation = old_compiled_function_annotation; -#endif if ((purify_flag || load_force_doc_strings) && check_for_doc_references) { @@ -3120,7 +3092,7 @@ because that would make the directory absolute now. */ XCAR (XCAR (holding_cons)) = - concat2 (build_string ("../lisp/"), + concat2 (build_ascstring ("../lisp/"), Ffile_name_nondirectory (Vload_file_name_internal)); } @@ -3214,7 +3186,7 @@ make_byte_code_args[iii] = Qzero; else XCAR (make_byte_code_args[iii]) = - concat2 (build_string ("../lisp/"), + concat2 (build_ascstring ("../lisp/"), Ffile_name_nondirectory (Vload_file_name_internal)); } @@ -3255,7 +3227,7 @@ /* kludge: locate-file does not work for a null load-path, even if the file name is absolute. */ - Vload_path = Fcons (build_string (""), Qnil); + Vload_path = Fcons (build_ascstring (""), Qnil); /* This used to get initialized in init_lread because all streams got closed when dumping occurs. This is no longer true -- @@ -3405,7 +3377,7 @@ complex dependencies. Ignoring all elc files with `load-ignore-elc-files' would also be safe, but much slower. */ ); - load_ignore_out_of_date_elc_files = 0; + load_ignore_out_of_date_elc_files = 1; DEFVAR_BOOL ("load-always-display-messages", &load_always_display_messages /* @@ -3477,11 +3449,6 @@ Vload_file_name_internal = Qnil; staticpro (&Vload_file_name_internal); -#ifdef COMPILED_FUNCTION_ANNOTATION_HACK - Vcurrent_compiled_function_annotation = Qnil; - staticpro (&Vcurrent_compiled_function_annotation); -#endif - /* So that early-early stuff will work */ Ffset (Qload, Qload_internal); diff -r d2ec55325515 -r 8f0cf4fd3d2c src/lrecord.h --- a/src/lrecord.h Sat Feb 06 03:59:18 2010 -0600 +++ b/src/lrecord.h Sat Feb 06 04:01:46 2010 -0600 @@ -1,6 +1,6 @@ /* The "lrecord" structure (header of a compound lisp object). Copyright (C) 1993, 1994, 1995 Free Software Foundation, Inc. - Copyright (C) 1996, 2001, 2002, 2004, 2005 Ben Wing. + Copyright (C) 1996, 2001, 2002, 2004, 2005, 2010 Ben Wing. This file is part of XEmacs. @@ -26,36 +26,16 @@ #ifndef INCLUDED_lrecord_h_ #define INCLUDED_lrecord_h_ -#ifdef NEW_GC -/* The "lrecord" type of Lisp object is used for all object types - other than a few simple ones (like char and int). This allows many - types to be implemented but only a few bits required in a Lisp - object for type information. (The tradeoff is that each object has - its type marked in it, thereby increasing its size.) All lrecords - begin with a `struct lrecord_header', which identifies the lisp - object type, by providing an index into a table of `struct - lrecord_implementation', which describes the behavior of the lisp - object. It also contains some other data bits. +/* The "lrecord" type of Lisp object is used for all object types other + than a few simple ones (like char and int). This allows many types to be + implemented but only a few bits required in a Lisp object for type + information. (The tradeoff is that each object has its type marked in + it, thereby increasing its size.) All lrecords begin with a `struct + lrecord_header', which identifies the lisp object type, by providing an + index into a table of `struct lrecord_implementation', which describes + the behavior of the lisp object. It also contains some other data bits. - Creating a new lrecord type is fairly easy; just follow the - lead of some existing type (e.g. hash tables). Note that you - do not need to supply all the methods (see below); reasonable - defaults are provided for many of them. Alternatively, if you're - just looking for a way of encapsulating data (which possibly - could contain Lisp_Objects in it), you may well be able to use - the opaque type. -*/ -#else /* not NEW_GC */ -/* The "lrecord" type of Lisp object is used for all object types - other than a few simple ones. This allows many types to be - implemented but only a few bits required in a Lisp object for type - information. (The tradeoff is that each object has its type marked - in it, thereby increasing its size.) All lrecords begin with a - `struct lrecord_header', which identifies the lisp object type, by - providing an index into a table of `struct lrecord_implementation', - which describes the behavior of the lisp object. It also contains - some other data bits. - +#ifndef NEW_GC Lrecords are of two types: straight lrecords, and lcrecords. Straight lrecords are used for those types of objects that have their own allocation routines (typically allocated out of 2K chunks @@ -70,16 +50,46 @@ Lcrecords have a `struct old_lcrecord_header' at the top, which contains a `struct lrecord_header' and a `next' pointer, and are allocated using old_alloc_lcrecord_type() or its variants. +#endif - Creating a new lcrecord type is fairly easy; just follow the + Creating a new Lisp object type is fairly easy; just follow the lead of some existing type (e.g. hash tables). Note that you do not need to supply all the methods (see below); reasonable defaults are provided for many of them. Alternatively, if you're just looking for a way of encapsulating data (which possibly could contain Lisp_Objects in it), you may well be able to use - the opaque type. --ben + the opaque type. */ -#endif /* not NEW_GC */ + +#ifdef NEW_GC +/* + There are some limitations under New-GC that lead to the creation of a + large number of new internal object types. I'm not completely sure what + all of them are, but they are at least partially related to limitations + on finalizers. Something else must be going on as well, because + non-dumpable, non-finalizable objects like devices and frames also have + their window-system-specific substructures converted into Lisp objects. + It must have something to do with the fact that these substructures + contain pointers to Lisp objects, but it's not completely clear why -- + object descriptions exist to indicate the size of these structures and + the Lisp object pointers within them. + + At least one definite issue is that under New-GC dumpable objects cannot + contain any finalizers (see pdump_register_object()). This means that any + substructures in dumpable objects that are allocated separately and + normally freed in a finalizer need instead to be made into actual Lisp + objects. If those structures are Dynarrs, they need to be made into + Dynarr Lisp objects (e.g. face-cachel-dynarr or glyph-cachel-dynarr), + which are created using Dynarr_lisp_new() or Dynarr_new_new2(). + Furthermore, the objects contained in the Dynarr also need to be Lisp + objects (e.g. face-cachel or glyph-cachel). + + --ben + */ + +#endif + + #ifdef NEW_GC #define ALLOC_LCRECORD_TYPE alloc_lrecord_type @@ -305,6 +315,7 @@ lrecord_type_undefined, /* only used for debugging */ #endif /* not NEW_GC */ #ifdef NEW_GC + /* See comment up top explaining why these extra object types must exist. */ lrecord_type_string_indirect_data, lrecord_type_string_direct_data, lrecord_type_hash_table_entry, @@ -370,14 +381,15 @@ used instead. */ void (*printer) (Lisp_Object, Lisp_Object printcharfun, int escapeflag); - /* `finalizer' is called at GC time when the object is about to - be freed, and at dump time (FOR_DISKSAVE will be non-zero in this - case). It should perform any necessary cleanup (e.g. freeing - malloc()ed memory). This can be NULL, meaning no special - finalization is necessary. + /* `finalizer' is called at GC time when the object is about to be freed, + and at dump time (FOR_DISKSAVE will be non-zero in this case). It + should perform any necessary cleanup (e.g. freeing malloc()ed memory + or releasing objects created in external libraries, such as + window-system windows or file handles). This can be NULL, meaning no + special finalization is necessary. - WARNING: remember that `finalizer' is called at dump time even - though the object is not being freed. */ + WARNING: remember that `finalizer' is called at dump time even though + the object is not being freed -- check the FOR_DISKSAVE argument. */ void (*finalizer) (void *header, int for_disksave); /* This can be NULL, meaning compare objects with EQ(). */ @@ -710,7 +722,7 @@ ... }; - lisp_object_description is declared in alloc.c, like this: + lisp_object_description is declared in gc.c, like this: static const struct memory_description lisp_object_description_1[] = { { XD_LISP_OBJECT, 0 }, @@ -1131,19 +1143,6 @@ #define XD_INDIRECT_VAL(code) ((-1 - (code)) & 255) #define XD_INDIRECT_DELTA(code) ((-1 - (code)) >> 8) -#define XD_DYNARR_DESC(base_type, sub_desc) \ - { XD_BLOCK_PTR, offsetof (base_type, base), XD_INDIRECT(1, 0), {sub_desc} },\ - { XD_INT, offsetof (base_type, len) }, \ - { XD_INT_RESET, offsetof (base_type, max), XD_INDIRECT(1, 0) } \ - -#ifdef NEW_GC -#define XD_LISP_DYNARR_DESC(base_type, sub_desc) \ - { XD_LISP_OBJECT_BLOCK_PTR, offsetof (base_type, base), \ - XD_INDIRECT(1, 0), {sub_desc} }, \ - { XD_INT, offsetof (base_type, len) }, \ - { XD_INT_RESET, offsetof (base_type, max), XD_INDIRECT(1, 0) } -#endif /* not NEW_GC */ - /* DEFINE_LRECORD_IMPLEMENTATION is for objects with constant size. DEFINE_LRECORD_SEQUENCE_IMPLEMENTATION is for objects whose size varies. */ diff -r d2ec55325515 -r 8f0cf4fd3d2c src/lstream.c --- a/src/lstream.c Sat Feb 06 03:59:18 2010 -0600 +++ b/src/lstream.c Sat Feb 06 04:01:46 2010 -0600 @@ -857,17 +857,17 @@ is called more than once on the same object */ if (lstr->out_buffer) { - xfree (lstr->out_buffer, unsigned char *); + xfree (lstr->out_buffer); lstr->out_buffer = 0; } if (lstr->in_buffer) { - xfree (lstr->in_buffer, unsigned char *); + xfree (lstr->in_buffer); lstr->in_buffer = 0; } if (lstr->unget_buffer) { - xfree (lstr->unget_buffer, unsigned char *); + xfree (lstr->unget_buffer); lstr->unget_buffer = 0; } @@ -1555,7 +1555,7 @@ struct resizing_buffer_stream *str = RESIZING_BUFFER_STREAM_DATA (stream); if (str->buf) { - xfree (str->buf, unsigned char *); + xfree (str->buf); str->buf = 0; } return 0; diff -r d2ec55325515 -r 8f0cf4fd3d2c src/make-src-depend --- a/src/make-src-depend Sat Feb 06 03:59:18 2010 -0600 +++ b/src/make-src-depend Sat Feb 06 04:01:46 2010 -0600 @@ -142,8 +142,8 @@ PrintPatternDeps ('-msw\\.', "HAVE_MS_WINDOWS"); PrintPatternDeps ('-xlike', "HAVE_XLIKE"); -# X-specific files: *-x.c *-x-impl.h xgccache.c balloon_help.c x*.h Emacs*.[ch] -PrintPatternDeps ('-x\\.|xgccache|balloon_help|^Emacs', "HAVE_X_WINDOWS"); +# X-specific files: *-x.c *-x-impl.h balloon_help.c x*.h Emacs*.[ch] +PrintPatternDeps ('-x\\.|balloon_help|^Emacs', "HAVE_X_WINDOWS"); PrintPatternDeps ('-tty\\.', "HAVE_TTY"); # GTK-specific files: *-gtk.[ch] *-gtk-*.[ch] gtk-*.[ch] emacs-marshals.c emacs-widget-accessors.c glade.c ui-byhand.c PrintPatternDeps ('gtk|emacs-marshals|emacs-widget-accessors|glade|ui-byhand', "HAVE_GTK"); diff -r d2ec55325515 -r 8f0cf4fd3d2c src/marker.c --- a/src/marker.c Sat Feb 06 03:59:18 2010 -0600 +++ b/src/marker.c Sat Feb 06 04:01:46 2010 -0600 @@ -62,9 +62,9 @@ if (print_readably) printing_unreadable_object ("#", (long) marker); - write_c_string (printcharfun, GETTEXT ("#buffer) - write_c_string (printcharfun, GETTEXT ("in no buffer")); + write_ascstring (printcharfun, GETTEXT ("in no buffer")); else { write_fmt_string (printcharfun, "at %ld in ", @@ -72,7 +72,7 @@ print_internal (marker->buffer->name, printcharfun, 0); } if (marker->insertion_type) - write_c_string (printcharfun, " insertion-type=t"); + write_ascstring (printcharfun, " insertion-type=t"); write_fmt_string (printcharfun, " 0x%lx>", (long) marker); } diff -r d2ec55325515 -r 8f0cf4fd3d2c src/menubar-gtk.c --- a/src/menubar-gtk.c Sat Feb 06 03:59:18 2010 -0600 +++ b/src/menubar-gtk.c Sat Feb 06 04:01:46 2010 -0600 @@ -260,9 +260,7 @@ /* Set the string straight from the object. */ if (STRINGP (keys) && XSTRING_LENGTH (keys)) { - C_STRING_TO_EXTERNAL_MALLOC(XSTRING_DATA (keys), - l->label.accel_string, - Qctext); + l->label.accel_string = ITEXT_TO_EXTERNAL_MALLOC (XSTRING_DATA (keys), Qctext); } else { diff -r d2ec55325515 -r 8f0cf4fd3d2c src/menubar-msw.c --- a/src/menubar-msw.c Sat Feb 06 03:59:18 2010 -0600 +++ b/src/menubar-msw.c Sat Feb 06 04:01:46 2010 -0600 @@ -138,7 +138,7 @@ right = gui_item_display_flush_right (gui_item); if (!NILP (right)) - return concat3 (left, build_string ("\t"), right); + return concat3 (left, build_ascstring ("\t"), right); else return left; } @@ -241,12 +241,9 @@ item_info.fType = MFT_SEPARATOR; else { - Extbyte *itemext; - item_info.fType = MFT_STRING; item_info.fState = MFS_DISABLED; - LISP_STRING_TO_TSTR (item, itemext); - item_info.dwTypeData = (XELPTSTR) itemext; + item_info.dwTypeData = (XELPTSTR) LISP_STRING_TO_TSTR (item); } } else if (CONSP (item)) @@ -257,7 +254,6 @@ Lisp_Gui_Item *pgui_item = XGUI_ITEM (gui_item); struct gcpro gcpro1, gcpro2, gcpro3; Ichar accel; - Extbyte *itemext; GCPRO3 (gui_item, path, *accel_list); @@ -281,9 +277,8 @@ submenu = create_empty_popup_menu (); item_info.fMask |= MIIM_SUBMENU; - LISP_STRING_TO_TSTR (displayable_menu_item (gui_item, bar_p, &accel), - itemext); - item_info.dwTypeData = (XELPTSTR) itemext; + item_info.dwTypeData = (XELPTSTR) + LISP_STRING_TO_TSTR (displayable_menu_item (gui_item, bar_p, &accel)); item_info.hSubMenu = submenu; if (accel && bar_p) @@ -315,7 +310,6 @@ Lisp_Gui_Item *pgui_item = XGUI_ITEM (gui_item); struct gcpro gcpro1, gcpro2; Ichar accel; - Extbyte *itemext; GCPRO2 (gui_item, *accel_list); @@ -348,9 +342,8 @@ item_info.wID = (UINT) XINT (id); item_info.fType |= MFT_STRING; - LISP_STRING_TO_TSTR (displayable_menu_item (gui_item, bar_p, &accel), - itemext); - item_info.dwTypeData = (XELPTSTR) itemext; + item_info.dwTypeData = (XELPTSTR) + LISP_STRING_TO_TSTR (displayable_menu_item (gui_item, bar_p, &accel)); if (accel && bar_p) *accel_list = Fcons (make_char (accel), *accel_list); @@ -449,12 +442,9 @@ two separators in X... In Windows this looks ugly, anyways.) */ if (!bar_p && !deep_p && popup_menu_titles && !NILP (pgui_item->name)) { - Extbyte *nameext; - - LISP_STRING_TO_TSTR (displayable_menu_item (gui_item, bar_p, NULL), - nameext); qxeInsertMenu (menu, 0, MF_BYPOSITION | MF_STRING | MF_DISABLED, - 0, nameext); + 0, LISP_STRING_TO_TSTR (displayable_menu_item + (gui_item, bar_p, NULL))); qxeInsertMenu (menu, 1, MF_BYPOSITION | MF_SEPARATOR, 0, NULL); SetMenuDefaultItem (menu, 0, MF_BYPOSITION); } diff -r d2ec55325515 -r 8f0cf4fd3d2c src/menubar-x.c --- a/src/menubar-x.c Sat Feb 06 03:59:18 2010 -0600 +++ b/src/menubar-x.c Sat Feb 06 04:01:46 2010 -0600 @@ -122,7 +122,7 @@ } else { - LISP_STRING_TO_EXTERNAL_MALLOC (desc, wv->name, Qlwlib_encoding); + wv->name = LISP_STRING_TO_EXTERNAL_MALLOC (desc, Qlwlib_encoding); wv->enabled = 1; /* dverna Dec. 98: command_builder_operate_menu_accelerator will manipulate the accel as a Lisp_Object if the widget has a name. @@ -999,7 +999,7 @@ i++; write_fmt_string (Qexternal_debugging_output, "OPERATE (%d): ",i); print_internal (t, Qexternal_debugging_output, 1); - write_c_string (Qexternal_debugging_output, "\n"); + write_ascstring (Qexternal_debugging_output, "\n"); t = XEVENT_NEXT (t); } } diff -r d2ec55325515 -r 8f0cf4fd3d2c src/menubar.c --- a/src/menubar.c Sat Feb 06 03:59:18 2010 -0600 +++ b/src/menubar.c Sat Feb 06 04:01:46 2010 -0600 @@ -456,8 +456,8 @@ * and this works fine. */ - Vblank_menubar = list1 (list2 (build_msg_string ("No active menubar"), - vector3 (build_string (""), Qnil, Qnil))); + Vblank_menubar = list1 (list2 (build_defer_string ("No active menubar"), + vector3 (build_ascstring (""), Qnil, Qnil))); staticpro (&Vblank_menubar); DEFVAR_BOOL ("popup-menu-titles", &popup_menu_titles /* diff -r d2ec55325515 -r 8f0cf4fd3d2c src/minibuf.c --- a/src/minibuf.c Sat Feb 06 03:59:18 2010 -0600 +++ b/src/minibuf.c Sat Feb 06 04:01:46 2010 -0600 @@ -990,11 +990,9 @@ at runtime instead of at load time. */ #endif Vminibuffer_zero - = Fget_buffer_create - (build_string (DEFER_GETTEXT (" *Minibuf-0*"))); + = Fget_buffer_create (build_ascstring (" *Minibuf-0*")); Vecho_area_buffer - = Fget_buffer_create - (build_string (DEFER_GETTEXT (" *Echo Area*"))); + = Fget_buffer_create (build_ascstring (" *Echo Area*")); } void diff -r d2ec55325515 -r 8f0cf4fd3d2c src/mule-ccl.c --- a/src/mule-ccl.c Sat Feb 06 03:59:18 2010 -0600 +++ b/src/mule-ccl.c Sat Feb 06 04:01:46 2010 -0600 @@ -2366,7 +2366,7 @@ XVECTOR_DATA (status)[8] = make_int (ccl.ic); UNGCPRO; - val = make_string (Dynarr_atp (outbuf, 0), produced); + val = make_string (Dynarr_begin (outbuf), produced); Dynarr_free (outbuf); QUIT; if (ccl.status == CCL_STAT_SUSPEND_BY_DST) diff -r d2ec55325515 -r 8f0cf4fd3d2c src/mule-charset.c --- a/src/mule-charset.c Sat Feb 06 03:59:18 2010 -0600 +++ b/src/mule-charset.c Sat Feb 06 04:01:46 2010 -0600 @@ -625,10 +625,10 @@ Ibyte tempname[80]; qxesprintf (tempname, "___temporary___%d__", id); - name = Fmake_symbol (build_intstring (tempname)); /* Uninterned. */ + name = Fmake_symbol (build_istring (tempname)); /* Uninterned. */ } if (NILP (doc_string)) - doc_string = build_string (""); + doc_string = build_ascstring (""); if (NILP (registries)) registries = make_vector(0, Qnil); if (NILP (short_name)) @@ -1160,185 +1160,185 @@ make_charset (LEADING_BYTE_ASCII, Qascii, 1, CHARSET_TYPE_94, 1, 0, 'B', CHARSET_LEFT_TO_RIGHT, - build_string ("ASCII"), - build_msg_string ("ASCII"), - build_msg_string ("ASCII (ISO646 IRV)"), - vector1(build_string("iso8859-1")), 0, 0); + build_ascstring ("ASCII"), + build_defer_string ("ASCII"), + build_defer_string ("ASCII (ISO646 IRV)"), + vector1(build_ascstring("iso8859-1")), 0, 0); staticpro (&Vcharset_control_1); Vcharset_control_1 = make_charset (LEADING_BYTE_CONTROL_1, Qcontrol_1, 2, CHARSET_TYPE_94, 1, 1, 0, CHARSET_LEFT_TO_RIGHT, - build_string ("C1"), - build_msg_string ("Control characters"), - build_msg_string ("Control characters 128-191"), - vector1(build_string("iso8859-1")), 0, 0); + build_ascstring ("C1"), + build_defer_string ("Control characters"), + build_defer_string ("Control characters 128-191"), + vector1(build_ascstring("iso8859-1")), 0, 0); staticpro (&Vcharset_latin_iso8859_1); Vcharset_latin_iso8859_1 = make_charset (LEADING_BYTE_LATIN_ISO8859_1, Qlatin_iso8859_1, 2, CHARSET_TYPE_96, 1, 1, 'A', CHARSET_LEFT_TO_RIGHT, - build_string ("Latin-1"), - build_msg_string ("ISO8859-1 (Latin-1)"), - build_msg_string ("ISO8859-1 (Latin-1)"), - vector1(build_string("iso8859-1")), 0, 0); + build_ascstring ("Latin-1"), + build_defer_string ("ISO8859-1 (Latin-1)"), + build_defer_string ("ISO8859-1 (Latin-1)"), + vector1(build_ascstring("iso8859-1")), 0, 0); staticpro (&Vcharset_latin_iso8859_2); Vcharset_latin_iso8859_2 = make_charset (LEADING_BYTE_LATIN_ISO8859_2, Qlatin_iso8859_2, 2, CHARSET_TYPE_96, 1, 1, 'B', CHARSET_LEFT_TO_RIGHT, - build_string ("Latin-2"), - build_msg_string ("ISO8859-2 (Latin-2)"), - build_msg_string ("ISO8859-2 (Latin-2)"), - vector1(build_string("iso8859-2")), 0, 0); + build_ascstring ("Latin-2"), + build_defer_string ("ISO8859-2 (Latin-2)"), + build_defer_string ("ISO8859-2 (Latin-2)"), + vector1(build_ascstring("iso8859-2")), 0, 0); staticpro (&Vcharset_latin_iso8859_3); Vcharset_latin_iso8859_3 = make_charset (LEADING_BYTE_LATIN_ISO8859_3, Qlatin_iso8859_3, 2, CHARSET_TYPE_96, 1, 1, 'C', CHARSET_LEFT_TO_RIGHT, - build_string ("Latin-3"), - build_msg_string ("ISO8859-3 (Latin-3)"), - build_msg_string ("ISO8859-3 (Latin-3)"), - vector1(build_string("iso8859-3")), 0, 0); + build_ascstring ("Latin-3"), + build_defer_string ("ISO8859-3 (Latin-3)"), + build_defer_string ("ISO8859-3 (Latin-3)"), + vector1(build_ascstring("iso8859-3")), 0, 0); staticpro (&Vcharset_latin_iso8859_4); Vcharset_latin_iso8859_4 = make_charset (LEADING_BYTE_LATIN_ISO8859_4, Qlatin_iso8859_4, 2, CHARSET_TYPE_96, 1, 1, 'D', CHARSET_LEFT_TO_RIGHT, - build_string ("Latin-4"), - build_msg_string ("ISO8859-4 (Latin-4)"), - build_msg_string ("ISO8859-4 (Latin-4)"), - vector1(build_string("iso8859-4")), 0, 0); + build_ascstring ("Latin-4"), + build_defer_string ("ISO8859-4 (Latin-4)"), + build_defer_string ("ISO8859-4 (Latin-4)"), + vector1(build_ascstring("iso8859-4")), 0, 0); staticpro (&Vcharset_thai_tis620); Vcharset_thai_tis620 = make_charset (LEADING_BYTE_THAI_TIS620, Qthai_tis620, 2, CHARSET_TYPE_96, 1, 1, 'T', CHARSET_LEFT_TO_RIGHT, - build_string ("TIS620"), - build_msg_string ("TIS620 (Thai)"), - build_msg_string ("TIS620.2529 (Thai)"), - vector1(build_string("tis620.2529-1")), 0, 0); + build_ascstring ("TIS620"), + build_defer_string ("TIS620 (Thai)"), + build_defer_string ("TIS620.2529 (Thai)"), + vector1(build_ascstring("tis620.2529-1")), 0, 0); staticpro (&Vcharset_greek_iso8859_7); Vcharset_greek_iso8859_7 = make_charset (LEADING_BYTE_GREEK_ISO8859_7, Qgreek_iso8859_7, 2, CHARSET_TYPE_96, 1, 1, 'F', CHARSET_LEFT_TO_RIGHT, - build_string ("ISO8859-7"), - build_msg_string ("ISO8859-7 (Greek)"), - build_msg_string ("ISO8859-7 (Greek)"), - vector1(build_string("iso8859-7")), 0, 0); + build_ascstring ("ISO8859-7"), + build_defer_string ("ISO8859-7 (Greek)"), + build_defer_string ("ISO8859-7 (Greek)"), + vector1(build_ascstring("iso8859-7")), 0, 0); staticpro (&Vcharset_arabic_iso8859_6); Vcharset_arabic_iso8859_6 = make_charset (LEADING_BYTE_ARABIC_ISO8859_6, Qarabic_iso8859_6, 2, CHARSET_TYPE_96, 1, 1, 'G', CHARSET_RIGHT_TO_LEFT, - build_string ("ISO8859-6"), - build_msg_string ("ISO8859-6 (Arabic)"), - build_msg_string ("ISO8859-6 (Arabic)"), - vector1(build_string ("iso8859-6")), 0, 0); + build_ascstring ("ISO8859-6"), + build_defer_string ("ISO8859-6 (Arabic)"), + build_defer_string ("ISO8859-6 (Arabic)"), + vector1(build_ascstring ("iso8859-6")), 0, 0); staticpro (&Vcharset_hebrew_iso8859_8); Vcharset_hebrew_iso8859_8 = make_charset (LEADING_BYTE_HEBREW_ISO8859_8, Qhebrew_iso8859_8, 2, CHARSET_TYPE_96, 1, 1, 'H', CHARSET_RIGHT_TO_LEFT, - build_string ("ISO8859-8"), - build_msg_string ("ISO8859-8 (Hebrew)"), - build_msg_string ("ISO8859-8 (Hebrew)"), - vector1(build_string ("iso8859-8")), 0, 0); + build_ascstring ("ISO8859-8"), + build_defer_string ("ISO8859-8 (Hebrew)"), + build_defer_string ("ISO8859-8 (Hebrew)"), + vector1(build_ascstring ("iso8859-8")), 0, 0); staticpro (&Vcharset_katakana_jisx0201); Vcharset_katakana_jisx0201 = make_charset (LEADING_BYTE_KATAKANA_JISX0201, Qkatakana_jisx0201, 2, CHARSET_TYPE_94, 1, 1, 'I', CHARSET_LEFT_TO_RIGHT, - build_string ("JISX0201 Kana"), - build_msg_string ("JISX0201.1976 (Japanese Kana)"), - build_msg_string ("JISX0201.1976 Japanese Kana"), - vector1(build_string ("jisx0201.1976-0")), 0, 0); + build_ascstring ("JISX0201 Kana"), + build_defer_string ("JISX0201.1976 (Japanese Kana)"), + build_defer_string ("JISX0201.1976 Japanese Kana"), + vector1(build_ascstring ("jisx0201.1976-0")), 0, 0); staticpro (&Vcharset_latin_jisx0201); Vcharset_latin_jisx0201 = make_charset (LEADING_BYTE_LATIN_JISX0201, Qlatin_jisx0201, 2, CHARSET_TYPE_94, 1, 0, 'J', CHARSET_LEFT_TO_RIGHT, - build_string ("JISX0201 Roman"), - build_msg_string ("JISX0201.1976 (Japanese Roman)"), - build_msg_string ("JISX0201.1976 Japanese Roman"), - vector1(build_string ("jisx0201.1976-0")), 0, 0); + build_ascstring ("JISX0201 Roman"), + build_defer_string ("JISX0201.1976 (Japanese Roman)"), + build_defer_string ("JISX0201.1976 Japanese Roman"), + vector1(build_ascstring ("jisx0201.1976-0")), 0, 0); staticpro (&Vcharset_cyrillic_iso8859_5); Vcharset_cyrillic_iso8859_5 = make_charset (LEADING_BYTE_CYRILLIC_ISO8859_5, Qcyrillic_iso8859_5, 2, CHARSET_TYPE_96, 1, 1, 'L', CHARSET_LEFT_TO_RIGHT, - build_string ("ISO8859-5"), - build_msg_string ("ISO8859-5 (Cyrillic)"), - build_msg_string ("ISO8859-5 (Cyrillic)"), - vector1(build_string ("iso8859-5")), 0, 0); + build_ascstring ("ISO8859-5"), + build_defer_string ("ISO8859-5 (Cyrillic)"), + build_defer_string ("ISO8859-5 (Cyrillic)"), + vector1(build_ascstring ("iso8859-5")), 0, 0); staticpro (&Vcharset_latin_iso8859_9); Vcharset_latin_iso8859_9 = make_charset (LEADING_BYTE_LATIN_ISO8859_9, Qlatin_iso8859_9, 2, CHARSET_TYPE_96, 1, 1, 'M', CHARSET_LEFT_TO_RIGHT, - build_string ("Latin-5"), - build_msg_string ("ISO8859-9 (Latin-5)"), - build_msg_string ("ISO8859-9 (Latin-5)"), - vector1(build_string ("iso8859-9")), 0, 0); + build_ascstring ("Latin-5"), + build_defer_string ("ISO8859-9 (Latin-5)"), + build_defer_string ("ISO8859-9 (Latin-5)"), + vector1(build_ascstring ("iso8859-9")), 0, 0); staticpro (&Vcharset_latin_iso8859_15); Vcharset_latin_iso8859_15 = make_charset (LEADING_BYTE_LATIN_ISO8859_15, Qlatin_iso8859_15, 2, CHARSET_TYPE_96, 1, 1, 'b', CHARSET_LEFT_TO_RIGHT, - build_string ("Latin-9"), - build_msg_string ("ISO8859-15 (Latin-9)"), - build_msg_string ("ISO8859-15 (Latin-9)"), - vector1(build_string ("iso8859-15")), 0, 0); + build_ascstring ("Latin-9"), + build_defer_string ("ISO8859-15 (Latin-9)"), + build_defer_string ("ISO8859-15 (Latin-9)"), + vector1(build_ascstring ("iso8859-15")), 0, 0); staticpro (&Vcharset_japanese_jisx0208_1978); Vcharset_japanese_jisx0208_1978 = make_charset (LEADING_BYTE_JAPANESE_JISX0208_1978, Qjapanese_jisx0208_1978, 3, CHARSET_TYPE_94X94, 2, 0, '@', CHARSET_LEFT_TO_RIGHT, - build_string ("JISX0208.1978"), - build_msg_string ("JISX0208.1978 (Japanese)"), - build_msg_string + build_ascstring ("JISX0208.1978"), + build_defer_string ("JISX0208.1978 (Japanese)"), + build_defer_string ("JISX0208.1978 Japanese Kanji (so called \"old JIS\")"), - vector2(build_string("jisx0208.1978-0"), - build_string("jisc6226.1978-0")), 0, 0); + vector2(build_ascstring("jisx0208.1978-0"), + build_ascstring("jisc6226.1978-0")), 0, 0); staticpro (&Vcharset_chinese_gb2312); Vcharset_chinese_gb2312 = make_charset (LEADING_BYTE_CHINESE_GB2312, Qchinese_gb2312, 3, CHARSET_TYPE_94X94, 2, 0, 'A', CHARSET_LEFT_TO_RIGHT, - build_string ("GB2312"), - build_msg_string ("GB2312)"), - build_msg_string ("GB2312 Chinese simplified"), - vector2(build_string("gb2312.1980-0"), - build_string("gb2312.80&gb8565.88-0")), 0, 0); + build_ascstring ("GB2312"), + build_defer_string ("GB2312)"), + build_defer_string ("GB2312 Chinese simplified"), + vector2(build_ascstring("gb2312.1980-0"), + build_ascstring("gb2312.80&gb8565.88-0")), 0, 0); staticpro (&Vcharset_japanese_jisx0208); Vcharset_japanese_jisx0208 = make_charset (LEADING_BYTE_JAPANESE_JISX0208, Qjapanese_jisx0208, 3, CHARSET_TYPE_94X94, 2, 0, 'B', CHARSET_LEFT_TO_RIGHT, - build_string ("JISX0208"), - build_msg_string ("JISX0208.1983/1990 (Japanese)"), - build_msg_string ("JISX0208.1983/1990 Japanese Kanji"), - vector2(build_string("jisx0208.1983-0"), - build_string("jisx0208.1990-0")), 0, 0); + build_ascstring ("JISX0208"), + build_defer_string ("JISX0208.1983/1990 (Japanese)"), + build_defer_string ("JISX0208.1983/1990 Japanese Kanji"), + vector2(build_ascstring("jisx0208.1983-0"), + build_ascstring("jisx0208.1990-0")), 0, 0); staticpro (&Vcharset_korean_ksc5601); Vcharset_korean_ksc5601 = make_charset (LEADING_BYTE_KOREAN_KSC5601, Qkorean_ksc5601, 3, CHARSET_TYPE_94X94, 2, 0, 'C', CHARSET_LEFT_TO_RIGHT, - build_string ("KSC5601"), - build_msg_string ("KSC5601 (Korean"), - build_msg_string ("KSC5601 Korean Hangul and Hanja"), - vector1(build_string("ksc5601.1987-0")), 0, 0); + build_ascstring ("KSC5601"), + build_defer_string ("KSC5601 (Korean"), + build_defer_string ("KSC5601 Korean Hangul and Hanja"), + vector1(build_ascstring("ksc5601.1987-0")), 0, 0); staticpro (&Vcharset_japanese_jisx0212); Vcharset_japanese_jisx0212 = make_charset (LEADING_BYTE_JAPANESE_JISX0212, Qjapanese_jisx0212, 3, CHARSET_TYPE_94X94, 2, 0, 'D', CHARSET_LEFT_TO_RIGHT, - build_string ("JISX0212"), - build_msg_string ("JISX0212 (Japanese)"), - build_msg_string ("JISX0212 Japanese Supplement"), - vector1(build_string("jisx0212.1990-0")), 0, 0); + build_ascstring ("JISX0212"), + build_defer_string ("JISX0212 (Japanese)"), + build_defer_string ("JISX0212 Japanese Supplement"), + vector1(build_ascstring("jisx0212.1990-0")), 0, 0); #define CHINESE_CNS_PLANE(n) "cns11643.1992-" n staticpro (&Vcharset_chinese_cns11643_1); @@ -1346,41 +1346,41 @@ make_charset (LEADING_BYTE_CHINESE_CNS11643_1, Qchinese_cns11643_1, 3, CHARSET_TYPE_94X94, 2, 0, 'G', CHARSET_LEFT_TO_RIGHT, - build_string ("CNS11643-1"), - build_msg_string ("CNS11643-1 (Chinese traditional)"), - build_msg_string + build_ascstring ("CNS11643-1"), + build_defer_string ("CNS11643-1 (Chinese traditional)"), + build_defer_string ("CNS 11643 Plane 1 Chinese traditional"), - vector1(build_string (CHINESE_CNS_PLANE("1"))), 0, 0); + vector1(build_ascstring (CHINESE_CNS_PLANE("1"))), 0, 0); staticpro (&Vcharset_chinese_cns11643_2); Vcharset_chinese_cns11643_2 = make_charset (LEADING_BYTE_CHINESE_CNS11643_2, Qchinese_cns11643_2, 3, CHARSET_TYPE_94X94, 2, 0, 'H', CHARSET_LEFT_TO_RIGHT, - build_string ("CNS11643-2"), - build_msg_string ("CNS11643-2 (Chinese traditional)"), - build_msg_string + build_ascstring ("CNS11643-2"), + build_defer_string ("CNS11643-2 (Chinese traditional)"), + build_defer_string ("CNS 11643 Plane 2 Chinese traditional"), - vector1(build_string (CHINESE_CNS_PLANE("2"))), 0, 0); + vector1(build_ascstring (CHINESE_CNS_PLANE("2"))), 0, 0); staticpro (&Vcharset_chinese_big5_1); Vcharset_chinese_big5_1 = make_charset (LEADING_BYTE_CHINESE_BIG5_1, Qchinese_big5_1, 3, CHARSET_TYPE_94X94, 2, 0, '0', CHARSET_LEFT_TO_RIGHT, - build_string ("Big5"), - build_msg_string ("Big5 (Level-1)"), - build_msg_string + build_ascstring ("Big5"), + build_defer_string ("Big5 (Level-1)"), + build_defer_string ("Big5 Level-1 Chinese traditional"), - vector1(build_string ("big5.eten-0")), 0, 0); + vector1(build_ascstring ("big5.eten-0")), 0, 0); staticpro (&Vcharset_chinese_big5_2); Vcharset_chinese_big5_2 = make_charset (LEADING_BYTE_CHINESE_BIG5_2, Qchinese_big5_2, 3, CHARSET_TYPE_94X94, 2, 0, '1', CHARSET_LEFT_TO_RIGHT, - build_string ("Big5"), - build_msg_string ("Big5 (Level-2)"), - build_msg_string + build_ascstring ("Big5"), + build_defer_string ("Big5 (Level-2)"), + build_defer_string ("Big5 Level-2 Chinese traditional"), - vector1(build_string ("big5.eten-0")), 0, 0); + vector1(build_ascstring ("big5.eten-0")), 0, 0); #ifdef ENABLE_COMPOSITE_CHARS @@ -1392,10 +1392,10 @@ make_charset (LEADING_BYTE_COMPOSITE, Qcomposite, 3, CHARSET_TYPE_96X96, 2, 0, 0, CHARSET_LEFT_TO_RIGHT, - build_string ("Composite"), - build_msg_string ("Composite characters"), - build_msg_string ("Composite characters"), - vector1(build_string ("")), 0, 0); + build_ascstring ("Composite"), + build_defer_string ("Composite characters"), + build_defer_string ("Composite characters"), + vector1(build_ascstring ("")), 0, 0); #else /* We create a hack so that we have a way of storing ESC 0 and ESC 1 sequences as "characters", so that they will be output correctly. */ @@ -1404,9 +1404,9 @@ make_charset (LEADING_BYTE_COMPOSITE_REPLACEMENT, Qcomposite, 2, CHARSET_TYPE_96, 1, 1, '|', CHARSET_LEFT_TO_RIGHT, - build_string ("Composite hack"), - build_msg_string ("Composite characters hack"), - build_msg_string ("Composite characters hack"), - vector1(build_string ("")), 0, 0); + build_ascstring ("Composite hack"), + build_defer_string ("Composite characters hack"), + build_defer_string ("Composite characters hack"), + vector1(build_ascstring ("")), 0, 0); #endif /* ENABLE_COMPOSITE_CHARS */ } diff -r d2ec55325515 -r 8f0cf4fd3d2c src/mule-coding.c --- a/src/mule-coding.c Sat Feb 06 03:59:18 2010 -0600 +++ b/src/mule-coding.c Sat Feb 06 04:01:46 2010 -0600 @@ -1889,7 +1889,7 @@ { Ibyte comstr[MAX_ICHAR_LEN]; Bytecount len; - Ichar emch = lookup_composite_char (Dynarr_atp (dst, 0), + Ichar emch = lookup_composite_char (Dynarr_begin (dst), Dynarr_length (dst)); dst = real_dst; len = set_itext_ichar (comstr, emch); @@ -2928,16 +2928,16 @@ { int i; - write_c_string (printcharfun, "("); + write_ascstring (printcharfun, "("); for (i = 0; i < 4; i++) { Lisp_Object charset = coding_system_charset (cs, i); if (i > 0) - write_c_string (printcharfun, ", "); + write_ascstring (printcharfun, ", "); write_fmt_string (printcharfun, "g%d=", i); print_internal (CHARSETP (charset) ? XCHARSET_NAME (charset) : charset, printcharfun, 0); if (XCODING_SYSTEM_ISO2022_FORCE_CHARSET_ON_OUTPUT (cs, i)) - write_c_string (printcharfun, "(force)"); + write_ascstring (printcharfun, "(force)"); } #define FROB(prop) \ @@ -2969,7 +2969,7 @@ { write_fmt_string_lisp (printcharfun, ", output-charset-conversion=%s", 1, val); } - write_c_string (printcharfun, ")"); + write_ascstring (printcharfun, ")"); } } @@ -3247,7 +3247,7 @@ { struct iso2022_detector *data = DETECTION_STATE_DATA (st, iso2022); if (data->iso) - xfree (data->iso, struct iso2022_coding_stream *); + xfree (data->iso); } @@ -3740,7 +3740,7 @@ XCODING_SYSTEM_FIXED_WIDTH_QUERY_SKIP_CHARS(codesys)), XCODING_SYSTEM_FIXED_WIDTH_QUERY_SKIP_CHARS(codesys), (flags & QUERY_METHOD_IGNORE_INVALID_SEQUENCES ? - build_string("") : + build_ascstring("") : XCODING_SYSTEM_FIXED_WIDTH_INVALID_SEQUENCES_SKIP_CHARS (codesys)), fastmap, (int)(sizeof (fastmap))); @@ -3801,17 +3801,12 @@ if (flags & QUERY_METHOD_ERRORP) { - DECLARE_EISTRING (error_details); - - eicpy_ascii (error_details, "Cannot encode "); - eicat_lstr (error_details, - make_string_from_buffer (buf, fail_range_start, - pos - fail_range_start)); - eicat_ascii (error_details, " using coding system"); - - signal_error (Qtext_conversion_error, - (const CIbyte *)(eidata (error_details)), - XCODING_SYSTEM_NAME (codesys)); + signal_error_2 + (Qtext_conversion_error, + "Cannot encode using coding system", + make_string_from_buffer (buf, fail_range_start, + pos - fail_range_start), + XCODING_SYSTEM_NAME (codesys)); } if (NILP (result)) diff -r d2ec55325515 -r 8f0cf4fd3d2c src/nas.c --- a/src/nas.c Sat Feb 06 03:59:18 2010 -0600 +++ b/src/nas.c Sat Feb 06 04:01:46 2010 -0600 @@ -187,7 +187,7 @@ { EMACS_SIGNAL (SIGPIPE, old_sigpipe); start_interrupts (); - return "error in NAS"; + return (Extbyte *) "error in NAS"; } #endif @@ -205,7 +205,7 @@ EMACS_SIGNAL (SIGPIPE, old_sigpipe); #endif if (err_message == NULL) - return "Can't connect to audio server"; + return (Extbyte *) "Can't connect to audio server"; else return err_message; } diff -r d2ec55325515 -r 8f0cf4fd3d2c src/nt.c --- a/src/nt.c Sat Feb 06 03:59:18 2010 -0600 +++ b/src/nt.c Sat Feb 06 04:01:46 2010 -0600 @@ -158,7 +158,7 @@ && qxeLookupAccountSid (NULL, sidinfo.User.Sid, name, &length, domain, &dlength, &user_type)) { - TSTR_TO_C_STRING_MALLOC (name, the_passwd.pw_name); + the_passwd.pw_name = TSTR_TO_ITEXT_MALLOC (name); /* Determine a reasonable uid value. */ if (qxestrcasecmp ("administrator", the_passwd.pw_name) == 0) { @@ -202,7 +202,7 @@ are running under Windows 95), fallback to this. */ else if (qxeGetUserName (name, &length)) { - TSTR_TO_C_STRING_MALLOC (name, the_passwd.pw_name); + the_passwd.pw_name = TSTR_TO_ITEXT_MALLOC (name); if (qxestrcasecmp ("administrator", the_passwd.pw_name) == 0) the_passwd.pw_uid = 0; else @@ -223,7 +223,7 @@ DWORD length = UNLEN + 1; Extbyte name[MAX_XETCHAR_SIZE * (UNLEN + 1)]; if (qxeGetUserName (name, &length)) - TSTR_TO_C_STRING_MALLOC (name, the_passwd.pw_name); + the_passwd.pw_name = TSTR_TO_ITEXT_MALLOC (name); else the_passwd.pw_name = "unknown"; #endif @@ -301,7 +301,7 @@ { Ibyte *fileint; - TSTR_TO_C_STRING_MALLOC (find_data.cFileName, fileint); + fileint = TSTR_TO_ITEXT_MALLOC (find_data.cFileName); FindClose (dir_handle); return fileint; } @@ -338,16 +338,16 @@ *p++ = '\\'; eicat_ch (o, '\\'); } - xfree (component, Ibyte *); + xfree (component); } else { - xfree (full, Ibyte *); + xfree (full); return 0; } } - xfree (full, Ibyte *); + xfree (full); return eicpyout_malloc (o, 0); } @@ -377,7 +377,7 @@ DWORD cbData; Extbyte *keyext; - C_STRING_TO_TSTR (key, keyext); + keyext = ITEXT_TO_TSTR (key); /* Check both the current user and the local machine to see if we have any resources. */ @@ -395,7 +395,7 @@ return (lpvalue); if (lpvalue) - xfree (lpvalue, LPBYTE); + xfree (lpvalue); RegCloseKey (hrootkey); } @@ -413,7 +413,7 @@ return (lpvalue); if (lpvalue) - xfree (lpvalue, LPBYTE); + xfree (lpvalue); RegCloseKey (hrootkey); } @@ -488,18 +488,18 @@ cch = qxeExpandEnvironmentStrings ((Extbyte *) lpval, buf, 0); buf = alloca_extbytes (cch * XETCHAR_SIZE); qxeExpandEnvironmentStrings ((Extbyte *) lpval, buf, cch); - TSTR_TO_C_STRING (buf, envval); + envval = TSTR_TO_ITEXT (buf); eputenv (env_vars[i], (CIbyte *) envval); } else if (dwType == REG_SZ) { Ibyte *envval; - TSTR_TO_C_STRING (lpval, envval); + envval = TSTR_TO_ITEXT (lpval); eputenv (env_vars[i], (CIbyte *) envval); } - xfree (lpval, LPBYTE); + xfree (lpval); } } } @@ -635,7 +635,7 @@ rootext = alloca_extbytes (nchars * XETCHAR_SIZE); if (!qxeGetCurrentDirectory (nchars, rootext)) return NULL; - TSTR_TO_C_STRING (rootext, default_root); + default_root = TSTR_TO_ITEXT (rootext); parse_root (default_root, &root_dir); *root_dir = 0; root_dir = default_root; @@ -705,15 +705,15 @@ } else { - xfree (info->name, Ibyte *); - xfree (info->type, Ibyte *); + xfree (info->name); + xfree (info->type); } - TSTR_TO_C_STRING_MALLOC (name, info->name); + info->name = TSTR_TO_ITEXT_MALLOC (name); info->serialnum = serialnum; info->maxcomp = maxcomp; info->flags = flags; - TSTR_TO_C_STRING_MALLOC (type, info->type); + info->type = TSTR_TO_ITEXT_MALLOC (type); info->timestamp = GetTickCount (); } @@ -828,7 +828,7 @@ return NULL; if (dir_pathname) - xfree (dir_pathname, Ibyte *); + xfree (dir_pathname); dir_pathname = qxestrdup (filename); return dirp; @@ -850,7 +850,7 @@ retval = close_unc_volume (wnet_enum_handle); wnet_enum_handle = INVALID_HANDLE_VALUE; } - xfree (dirp, DIR *); + xfree (dirp); return retval; } @@ -885,13 +885,13 @@ if (dir_find_handle == INVALID_HANDLE_VALUE) return NULL; - TSTR_TO_C_STRING (dir_find_data.cFileName, val); + val = TSTR_TO_ITEXT (dir_find_data.cFileName); } else { if (!qxeFindNextFile (dir_find_handle, &dir_find_data)) return NULL; - TSTR_TO_C_STRING (dir_find_data.cFileName, val); + val = TSTR_TO_ITEXT (dir_find_data.cFileName); } /* XEmacs never uses this value, so don't bother making it match @@ -925,7 +925,7 @@ resolved = mswindows_read_link (eidata (linkname)); if (resolved) { - xfree (resolved, Ibyte *); + xfree (resolved); len -= 4; val[len] = '\0'; } @@ -934,7 +934,7 @@ eicpy_rawz (found, val); if (need_to_free) - xfree (val, Ibyte *); + xfree (val); if (!NILP (Vmswindows_downcase_file_names)) eilwr (found); @@ -998,7 +998,7 @@ return NULL; /* WNetEnumResource returns \\resource\share...skip forward to "share". */ - TSTR_TO_C_STRING (((LPNETRESOURCEW) buf)->lpRemoteName, ptr); + ptr = TSTR_TO_ITEXT (((LPNETRESOURCEW) buf)->lpRemoteName); INC_IBYTEPTR (ptr); INC_IBYTEPTR (ptr); while (*ptr && !IS_DIRECTORY_SEP (itext_ichar (ptr))) @@ -1564,7 +1564,7 @@ qxestrcat (name, (Ibyte *) "\\"); /* File has already been resolved and we don't want to do it again in case of lstat() */ - C_STRING_TO_TSTR (name, nameext); + nameext = ITEXT_TO_TSTR (name); if (qxeGetDriveType (nameext) < 2) { SetErrorMode (errm); @@ -1605,7 +1605,7 @@ } else { - C_STRING_TO_TSTR (name, nameext); + nameext = ITEXT_TO_TSTR (name); fh = qxeFindFirstFile (nameext, &wfd); if (fh == INVALID_HANDLE_VALUE) { @@ -1630,7 +1630,7 @@ if (!NILP (Vmswindows_get_true_file_attributes)) /* File has already been resolved and we don't want to do it again in case of lstat() */ - C_STRING_TO_TSTR (name, nameext); + nameext = ITEXT_TO_TSTR (name); if (!NILP (Vmswindows_get_true_file_attributes) /* No access rights required to get info. */ && (fh = qxeCreateFile (nameext, 0, 0, NULL, OPEN_EXISTING, 0, NULL)) @@ -1690,7 +1690,7 @@ Ibyte *resolved = mswindows_read_link (name); if (resolved) { - xfree (resolved, Ibyte *); + xfree (resolved); buf->st_mode = S_IFLNK; } } @@ -1841,8 +1841,8 @@ else cwdext = _getdcwd (drivelet, NULL, 0); if (cwdext == NULL) return NULL; - TSTR_TO_C_STRING_MALLOC (cwdext, cwd); - xfree (cwdext, Extbyte *); + cwd = TSTR_TO_ITEXT_MALLOC (cwdext); + xfree (cwdext); return cwd; } @@ -2052,7 +2052,7 @@ (Extbyte *) RVA_TO_PTR (imports->Name, section, executable); Ibyte *dllname; - EXTERNAL_TO_C_STRING (dllname_ext, dllname, Qbinary); + dllname = EXTERNAL_TO_ITEXT (dllname_ext, Qbinary); /* The exact name of the cygwin dll has changed with various releases, but hopefully this will be reasonably @@ -2106,10 +2106,10 @@ sizeof (shortname) / XETCHAR_SIZE) == 0) return Qnil; - TSTR_TO_C_STRING (shortname, shortint); + shortint = TSTR_TO_ITEXT (shortname); MSWINDOWS_NORMALIZE_FILENAME (shortint); - return build_intstring (shortint); + return build_istring (shortint); } @@ -2132,9 +2132,9 @@ return Qnil; canon = mswindows_canonicalize_filename (longname); - ret = build_intstring (canon); - xfree (canon, Ibyte *); - xfree (longname, Ibyte *); + ret = build_istring (canon); + xfree (canon); + xfree (longname); return ret; } diff -r d2ec55325515 -r 8f0cf4fd3d2c src/ntplay.c --- a/src/ntplay.c Sat Feb 06 03:59:18 2010 -0600 +++ b/src/ntplay.c Sat Feb 06 04:01:46 2010 -0600 @@ -41,7 +41,7 @@ Lisp_Object fname = Ffile_name_nondirectory (path); Extbyte *fnameext; - LISP_STRING_TO_TSTR (fname, fnameext); + fnameext = LISP_STRING_TO_TSTR (fname); if (qxeSearchPath (NULL, fnameext, NULL, 0, NULL, NULL) == 0) { @@ -66,7 +66,7 @@ if (retry_read (ofd, data, size) != size) { retry_close (ofd); - xfree (data, Binbyte *); + xfree (data); return; } retry_close (ofd); @@ -88,7 +88,7 @@ if (sound_data) { qxePlaySound (NULL, NULL, flags); - xfree (sound_data, Binbyte *); + xfree (sound_data); sound_data = 0; } diff -r d2ec55325515 -r 8f0cf4fd3d2c src/number-gmp.c --- a/src/number-gmp.c Sat Feb 06 03:59:18 2010 -0600 +++ b/src/number-gmp.c Sat Feb 06 04:01:46 2010 -0600 @@ -101,7 +101,7 @@ static void gmp_free (void *ptr, size_t UNUSED (size)) { - xfree (ptr, void *); + xfree (ptr); } void diff -r d2ec55325515 -r 8f0cf4fd3d2c src/number-mp.c --- a/src/number-mp.c Sat Feb 06 03:59:18 2010 -0600 +++ b/src/number-mp.c Sat Feb 06 04:01:46 2010 -0600 @@ -87,7 +87,7 @@ for (; i < bufsize - 1; i++) retval[i] = buffer[--index]; retval[bufsize - 1] = '\0'; - xfree (buffer, char *); + xfree (buffer); return retval; } diff -r d2ec55325515 -r 8f0cf4fd3d2c src/number.c --- a/src/number.c Sat Feb 06 03:59:18 2010 -0600 +++ b/src/number.c Sat Feb 06 04:01:46 2010 -0600 @@ -53,9 +53,9 @@ bignum_print (Lisp_Object obj, Lisp_Object printcharfun, int UNUSED (escapeflag)) { - CIbyte *bstr = bignum_to_string (XBIGNUM_DATA (obj), 10); - write_c_string (printcharfun, bstr); - xfree (bstr, CIbyte *); + Ascbyte *bstr = bignum_to_string (XBIGNUM_DATA (obj), 10); + write_ascstring (printcharfun, bstr); + xfree (bstr); } #ifdef NEW_GC @@ -98,7 +98,7 @@ bignum_convfree (const void * UNUSED (object), void *data, Bytecount UNUSED (size)) { - xfree (data, void *); + xfree (data); } static void * @@ -147,8 +147,8 @@ int UNUSED (escapeflag)) { CIbyte *rstr = ratio_to_string (XRATIO_DATA (obj), 10); - write_c_string (printcharfun, rstr); - xfree (rstr, CIbyte *); + write_ascstring (printcharfun, rstr); + xfree (rstr); } #ifdef NEW_GC @@ -251,9 +251,9 @@ bigfloat_print (Lisp_Object obj, Lisp_Object printcharfun, int UNUSED (escapeflag)) { - CIbyte *fstr = bigfloat_to_string (XBIGFLOAT_DATA (obj), 10); - write_c_string (printcharfun, fstr); - xfree (fstr, CIbyte *); + Ascbyte *fstr = bigfloat_to_string (XBIGFLOAT_DATA (obj), 10); + write_ascstring (printcharfun, fstr); + xfree (fstr); } #ifdef NEW_GC diff -r d2ec55325515 -r 8f0cf4fd3d2c src/number.h --- a/src/number.h Sat Feb 06 03:59:18 2010 -0600 +++ b/src/number.h Sat Feb 06 04:01:46 2010 -0600 @@ -130,8 +130,7 @@ /********************************* Integers *********************************/ -extern Lisp_Object Qintegerp; - +/* Qintegerp in lisp.h */ #define INTEGERP(x) (INTP(x) || BIGNUMP(x)) #define CHECK_INTEGER(x) do { \ if (!INTEGERP (x)) \ @@ -285,7 +284,7 @@ EXFUN (Fbigfloatp, 1); /********************************* Floating *********************************/ -extern Lisp_Object Qfloatingp, Qbigfloat; +extern Lisp_Object Qfloatingp; extern Lisp_Object Qread_default_float_format, Vread_default_float_format; #define FLOATINGP(x) (FLOATP (x) || BIGFLOATP (x)) @@ -319,8 +318,7 @@ /********************************* Numbers **********************************/ -extern Lisp_Object Qnumberp; - +/* Qnumberp in lisp.h */ #define NUMBERP(x) REALP (x) #define CHECK_NUMBER(x) do { \ if (!NUMBERP (x)) \ diff -r d2ec55325515 -r 8f0cf4fd3d2c src/objects-gtk.c --- a/src/objects-gtk.c Sat Feb 06 03:59:18 2010 -0600 +++ b/src/objects-gtk.c Sat Feb 06 04:01:46 2010 -0600 @@ -168,7 +168,7 @@ } gdk_color_free (COLOR_INSTANCE_GTK_COLOR (c)); } - xfree (c->data, void *); + xfree (c->data); c->data = 0; } } @@ -208,7 +208,7 @@ GdkColor c; const char *extname; - TO_EXTERNAL_FORMAT (LISP_STRING, color, C_STRING_ALLOCA, extname, Qctext); + extname = LISP_STRING_TO_EXTERNAL (color, Qctext); if (gdk_color_parse (extname, &c) != TRUE) return(0); @@ -237,7 +237,7 @@ XFontStruct *xf; const char *extname; - TO_EXTERNAL_FORMAT (LISP_STRING, f->name, C_STRING_ALLOCA, extname, Qctext); + extname = LISP_STRING_TO_EXTERNAL (f->name, Qctext); gf = gdk_font_load (extname); @@ -340,7 +340,7 @@ { gdk_font_unref (FONT_INSTANCE_GTK_FONT (f)); } - xfree (f->data, void *); + xfree (f->data); f->data = 0; } } @@ -383,7 +383,7 @@ { const char *patternext; - TO_EXTERNAL_FORMAT (LISP_STRING, pattern, C_STRING_ALLOCA, patternext, Qbinary); + patternext = LISP_STRING_TO_EXTERNAL (pattern, Qbinary); return (__gtk_font_list_internal (patternext)); } @@ -472,7 +472,7 @@ if (!expandp) { /* They want the wildcarded version */ - font_name = build_string ((char*) names->data); + font_name = build_cistring ((char*) names->data); } else { @@ -483,7 +483,7 @@ x_font_names = XListFonts (dpy, (char*) names->data, 1, &nnames); if (x_font_names) { - font_name = build_string (x_font_names[0]); + font_name = build_cistring (x_font_names[0]); XFreeFontNames (x_font_names); } } @@ -503,7 +503,7 @@ names = XListFonts (GDK_DISPLAY (), pattern, MAX_FONT_COUNT, &count); while (count--) - result = Fcons (build_ext_string (names [count], Qbinary), result); + result = Fcons (build_extstring (names [count], Qbinary), result); if (names) XFreeFontNames (names); diff -r d2ec55325515 -r 8f0cf4fd3d2c src/objects-msw.c --- a/src/objects-msw.c Sat Feb 06 03:59:18 2010 -0600 +++ b/src/objects-msw.c Sat Feb 06 04:01:46 2010 -0600 @@ -1016,11 +1016,11 @@ for (i = 0; i < countof (mswindows_X_color_map); i++) if (pcolor == (mswindows_X_color_map[i].colorref)) - return build_string (mswindows_X_color_map[i].name); + return build_ascstring (mswindows_X_color_map[i].name); sprintf (buf, "#%02X%02X%02X", GetRValue (color), GetGValue (color), GetBValue (color)); - return build_string (buf); + return build_ascstring (buf); } /* @@ -1109,7 +1109,7 @@ * weights unspecified. This means that we have to weed out duplicates of * those fonts that do get enumerated with different weights. */ - TSTR_TO_C_STRING (lpelfe->elfLogFont.lfFaceName, facename); + facename = TSTR_TO_ITEXT (lpelfe->elfLogFont.lfFaceName); if (itext_ichar (facename) == '@') /* This is a font for writing vertically. We ignore it. */ return 1; @@ -1141,7 +1141,7 @@ return 1; /* Add the font name to the list if not already there */ - fontname_lispstr = build_intstring (fontname); + fontname_lispstr = build_istring (fontname); if (NILP (Fassoc (fontname_lispstr, font_enum->list))) font_enum->list = Fcons (Fcons (fontname_lispstr, @@ -1376,7 +1376,7 @@ { if (c->data) { - xfree (c->data, void *); + xfree (c->data); c->data = 0; } } @@ -1489,7 +1489,7 @@ { Extbyte *extfontname; - C_STRING_TO_TSTR (fontname, extfontname); + extfontname = ITEXT_TO_TSTR (fontname); if (logfont) { qxetcsncpy ((Extbyte *) logfont->lfFaceName, extfontname, @@ -1797,7 +1797,7 @@ ERROR_ME_DEBUG_WARN, &logfont, fontname, weight, points, effects, charset)) signal_error (Qinternal_error, "Bad value in device font list?", - build_intstring (truername)); + build_istring (truername)); } else if (!parse_font_spec (namestr, hdc, name_for_errors, errb, &logfont, fontname, weight, points, @@ -1817,7 +1817,7 @@ qxesprintf (truename, "%s:%s:%s:%s:%s", fontname, weight, points, effects, charset); - *truename_ret = build_intstring (truename); + *truename_ret = build_istring (truename); return hfont; } @@ -1837,6 +1837,8 @@ hfont = create_hfont_from_font_spec (namestr, hdc, name, device_font_list, errb, &truename); + if (!hfont) + return 0; f->truename = truename; f->data = xnew_and_zero (struct mswindows_font_instance_data); FONT_INSTANCE_MSWINDOWS_HFONT_VARIANT (f, 0, 0) = hfont; @@ -1902,7 +1904,7 @@ DeleteObject (FONT_INSTANCE_MSWINDOWS_HFONT_I (f, i)); } - xfree (f->data, void *); + xfree (f->data); f->data = 0; } } @@ -1946,7 +1948,7 @@ if (match_font (XSTRING_DATA (XCAR (XCAR (fonttail))), XSTRING_DATA (pattern), fontname)) - result = Fcons (build_intstring (fontname), result); + result = Fcons (build_istring (fontname), result); } return Fnreverse (result); @@ -2052,7 +2054,7 @@ spec. See if the FONTSIGNATURE data is already cached. If not, get it and cache it. */ if (!STRINGP (reloc) || the_nonreloc != XSTRING_DATA (reloc)) - reloc = build_intstring (the_nonreloc); + reloc = build_istring (the_nonreloc); GCPRO1 (reloc); fontsig = Fgethash (reloc, Vfont_signature_data, Qunbound); @@ -2240,7 +2242,7 @@ int i; for (i = 0; i < countof (mswindows_X_color_map); i++) - result = Fcons (build_string (mswindows_X_color_map[i].name), result); + result = Fcons (build_ascstring (mswindows_X_color_map[i].name), result); return Fnreverse (result); } diff -r d2ec55325515 -r 8f0cf4fd3d2c src/objects-tty.c --- a/src/objects-tty.c Sat Feb 06 03:59:18 2010 -0600 +++ b/src/objects-tty.c Sat Feb 06 04:01:46 2010 -0600 @@ -229,7 +229,7 @@ { #ifndef NEW_GC if (c->data) - xfree (c->data, void *); + xfree (c->data); #endif /* not NEW_GC */ } @@ -276,7 +276,7 @@ if (*str != '/') return 0; str++; - charset = Ffind_charset (intern_int (str)); + charset = Ffind_charset (intern_istring (str)); if (NILP (charset)) return 0; #else @@ -324,7 +324,7 @@ { #ifndef NEW_GC if (f->data) - xfree (f->data, void *); + xfree (f->data); #endif /* not NEW_GC */ } @@ -332,7 +332,7 @@ tty_font_list (Lisp_Object UNUSED (pattern), Lisp_Object UNUSED (device), Lisp_Object UNUSED (maxnumber)) { - return list1 (build_string ("normal")); + return list1 (build_ascstring ("normal")); } #ifdef MULE @@ -388,7 +388,7 @@ if (NILP (charset)) return font; - return concat3 (font, build_string ("/"), + return concat3 (font, build_ascstring ("/"), Fsymbol_name (XCHARSET_NAME (charset))); } diff -r d2ec55325515 -r 8f0cf4fd3d2c src/objects-x.c --- a/src/objects-x.c Sat Feb 06 03:59:18 2010 -0600 +++ b/src/objects-x.c Sat Feb 06 04:01:46 2010 -0600 @@ -67,7 +67,7 @@ { const Extbyte *extname; - LISP_STRING_TO_EXTERNAL (name, extname, Qx_color_name_encoding); + extname = LISP_STRING_TO_EXTERNAL (name, Qx_color_name_encoding); result = XParseColor (dpy, cmap, extname, color); } if (!result) @@ -148,7 +148,7 @@ &COLOR_INSTANCE_X_COLOR (c).pixel, 1, 0); } } - xfree (c->data, void *); + xfree (c->data); c->data = 0; } } @@ -194,7 +194,7 @@ Colormap cmap = DEVICE_X_COLORMAP (d); const Extbyte *extname; - LISP_STRING_TO_EXTERNAL (color, extname, Qx_color_name_encoding); + extname = LISP_STRING_TO_EXTERNAL (color, Qx_color_name_encoding); return XParseColor (dpy, cmap, extname, &c); } @@ -232,10 +232,10 @@ The problem is that the fontconfig/Xft functions work much too hard to ensure that something is returned; but that something need not be at all close to what we asked for. */ - LISP_STRING_TO_EXTERNAL (f->name, extname, Qfc_font_name_encoding); + extname = LISP_STRING_TO_EXTERNAL (f->name, Qfc_font_name_encoding); rf = xft_open_font_by_name (dpy, extname); #endif - LISP_STRING_TO_EXTERNAL (f->name, extname, Qx_font_name_encoding); + extname = LISP_STRING_TO_EXTERNAL (f->name, Qx_font_name_encoding); /* With XFree86 4.0's fonts, XListFonts returns an entry for -isas-fangsong ti-medium-r-normal--16-160-72-72-c-160-gb2312.1980-0 but an XLoadQueryFont on the corresponding XLFD returns NULL. @@ -442,7 +442,7 @@ XftFontClose (dpy, FONT_INSTANCE_X_XFTFONT (f)); #endif } - xfree (f->data, void *); + xfree (f->data); f->data = 0; } } @@ -733,7 +733,7 @@ if (truename) { - Lisp_Object result = build_ext_string (truename, Qx_font_name_encoding); + Lisp_Object result = build_extstring (truename, Qx_font_name_encoding); XFree (truename); return result; } @@ -767,7 +767,7 @@ if (res) { FONT_INSTANCE_TRUENAME (f) = - build_ext_string ((Extbyte *) res, Qfc_font_name_encoding); + build_extstring ((Extbyte *) res, Qfc_font_name_encoding); free (res); return FONT_INSTANCE_TRUENAME (f); } @@ -785,7 +785,7 @@ if (NILP (FONT_INSTANCE_TRUENAME (f)) && FONT_INSTANCE_X_FONT (f)) { - nameext = NEW_LISP_STRING_TO_EXTERNAL (f->name, Qx_font_name_encoding); + nameext = LISP_STRING_TO_EXTERNAL (f->name, Qx_font_name_encoding); FONT_INSTANCE_TRUENAME (f) = x_font_truename (dpy, nameext, FONT_INSTANCE_X_FONT (f)); } @@ -834,7 +834,7 @@ ALLOCA, (name_str, name_len), Qx_atom_name_encoding); - name = (name_str ? intern_int (name_str) : Qnil); + name = (name_str ? intern_istring (name_str) : Qnil); if (name_str && (atom == XA_FONT || atom == DEVICE_XATOM_FOUNDRY (d) || @@ -860,7 +860,7 @@ { Extbyte *val_str = XGetAtomName (dpy, props [i].card32); - value = (val_str ? build_ext_string (val_str, Qx_atom_name_encoding) + value = (val_str ? build_extstring (val_str, Qx_atom_name_encoding) : Qnil); } else @@ -880,7 +880,7 @@ Lisp_Object result = Qnil; const Extbyte *patternext; - LISP_STRING_TO_EXTERNAL (pattern, patternext, Qx_font_name_encoding); + patternext = LISP_STRING_TO_EXTERNAL (pattern, Qx_font_name_encoding); if (!NILP(maxnumber) && INTP(maxnumber)) { @@ -890,7 +890,7 @@ names = XListFonts (DEVICE_X_DISPLAY (XDEVICE (device)), patternext, max_number, &count); while (count--) - result = Fcons (build_ext_string (names[count], Qx_font_name_encoding), + result = Fcons (build_extstring (names[count], Qx_font_name_encoding), result); if (names) XFreeFontNames (names); diff -r d2ec55325515 -r 8f0cf4fd3d2c src/objects-xlike-inc.c --- a/src/objects-xlike-inc.c Sat Feb 06 03:59:18 2010 -0600 +++ b/src/objects-xlike-inc.c Sat Feb 06 04:01:46 2010 -0600 @@ -116,7 +116,7 @@ if (!NILP(reloc)) { the_nonreloc = XSTRING_DATA (reloc); - LISP_STRING_TO_EXTERNAL (reloc, extname, Qx_font_name_encoding); + extname = LISP_STRING_TO_EXTERNAL (reloc, Qx_font_name_encoding); rf = xft_open_font_by_name (dpy, extname); return 0; /* #### maybe this will compile and run ;) */ /* Jesus, Stephen, what the fuck? */ @@ -322,10 +322,10 @@ struct charset_reporter { Lisp_Object *charset; /* This is a debug facility, require ASCII. */ - Extbyte *language; /* ASCII, please */ + const Ascbyte *language; /* ASCII, please */ /* Technically this is FcChar8, but fsckin' GCC 4 bitches. RFC 3066 is a combination of ISO 639 and ISO 3166. */ - Extbyte *rfc3066; /* ASCII, please */ + const Ascbyte *rfc3066; /* ASCII, please */ }; static struct charset_reporter charset_table[] = @@ -419,13 +419,13 @@ FcPattern *fontxft; /* long-lived, freed at end of this block */ FcResult fcresult; FcConfig *fcc; - FcChar8 *lang = (FcChar8 *) "en"; /* #### fix this bogus hack! */ + const Ascbyte *lang = "en"; FcCharSet *fccs = NULL; DECLARE_EISTRING (eistr_shortname); /* user-friendly nickname */ DECLARE_EISTRING (eistr_longname); /* omit FC_LANG and FC_CHARSET */ DECLARE_EISTRING (eistr_fullname); /* everything */ - LISP_STRING_TO_EXTERNAL (font, patternext, Qfc_font_name_encoding); + patternext = LISP_STRING_TO_EXTERNAL (font, Qfc_font_name_encoding); fcc = FcConfigGetCurrent (); /* parse the name, do the substitutions, and match the font */ @@ -536,28 +536,29 @@ { DECLARE_DEBUG_FONTNAME (name); CHECKING_LANG (0, eidata(name), cr->language); - lang = (FcChar8 *) cr->rfc3066; + lang = cr->rfc3066; } else if (cr->charset) { /* what the hey, build 'em on the fly */ /* #### in the case of error this could return NULL! */ fccs = mule_to_fc_charset (charset); - lang = (FcChar8 *) XSTRING_DATA (XSYMBOL - (XCHARSET_NAME (charset))-> name); + /* #### Bad idea here */ + lang = (const Ascbyte *) XSTRING_DATA (XSYMBOL (XCHARSET_NAME + (charset))->name); } else { /* OK, we fell off the end of the table */ warn_when_safe_lispobj (intern ("xft"), intern ("alert"), - list2 (build_string ("unchecked charset"), + list2 (build_ascstring ("unchecked charset"), charset)); /* default to "en" #### THIS IS WRONG, WRONG, WRONG!! It is why we never fall through to XLFD-checking. */ } - ASSERT_ASCTEXT_ASCII((Extbyte *) lang); + ASSERT_ASCTEXT_ASCII (lang); if (fccs) { @@ -616,7 +617,8 @@ FcTypeOfValueToString (v)); result = Qnil; } - else if (FcLangSetHasLang (v.u.l, lang) != FcLangDifferentLang) + else if (FcLangSetHasLang (v.u.l, (FcChar8 *) lang) + != FcLangDifferentLang) { DECLARE_DEBUG_FONTNAME (name); DEBUG_XFT2 (0, "Xft font %s supports %s\n", @@ -810,7 +812,7 @@ Lisp_Object new_registries = make_vector(registries_len + 1, Qnil); XVECTOR_DATA(new_registries)[0] - = build_string(FALLBACK_ASCII_REGISTRY); + = build_ascstring(FALLBACK_ASCII_REGISTRY); memcpy(XVECTOR_DATA(new_registries) + 1, XVECTOR_DATA(registries), diff -r d2ec55325515 -r 8f0cf4fd3d2c src/objects.h --- a/src/objects.h Sat Feb 06 03:59:18 2010 -0600 +++ b/src/objects.h Sat Feb 06 04:01:46 2010 -0600 @@ -76,8 +76,4 @@ void set_face_boolean_attached_to (Lisp_Object obj, Lisp_Object face, Lisp_Object property); -/* Defined in search.c, used in mule-charset.c; slightly ugly to declare it - here, but oh well. */ -EXFUN (Fregexp_quote, 1); - #endif /* INCLUDED_objects_h_ */ diff -r d2ec55325515 -r 8f0cf4fd3d2c src/print.c --- a/src/print.c Sat Feb 06 03:59:18 2010 -0600 +++ b/src/print.c Sat Feb 06 04:01:46 2010 -0600 @@ -655,17 +655,47 @@ } void -write_string (Lisp_Object stream, const Ibyte *str) +write_istring (Lisp_Object stream, const Ibyte *str) { /* This function can GC */ write_string_1 (stream, str, qxestrlen (str)); } void -write_c_string (Lisp_Object stream, const CIbyte *str) +write_cistring (Lisp_Object stream, const CIbyte *str) +{ + /* This function can GC */ + write_istring (stream, (const Ibyte *) str); +} + +void +write_ascstring (Lisp_Object stream, const Ascbyte *str) { /* This function can GC */ - write_string_1 (stream, (const Ibyte *) str, strlen (str)); + ASSERT_ASCTEXT_ASCII (str); + write_istring (stream, (const Ibyte *) str); +} + +void +write_msg_istring (Lisp_Object stream, const Ibyte *str) +{ + /* This function can GC */ + write_istring (stream, IGETTEXT (str)); +} + +void +write_msg_cistring (Lisp_Object stream, const CIbyte *str) +{ + /* This function can GC */ + write_msg_istring (stream, (const Ibyte *) str); +} + +void +write_msg_ascstring (Lisp_Object stream, const Ascbyte *str) +{ + /* This function can GC */ + ASSERT_ASCTEXT_ASCII (str); + write_msg_istring (stream, (const Ibyte *) str); } void @@ -848,7 +878,7 @@ (stream)) { /* This function can GC */ - write_c_string (canonicalize_printcharfun (stream), "\n"); + write_ascstring (canonicalize_printcharfun (stream), "\n"); return Qt; } @@ -945,9 +975,9 @@ GCPRO2 (object, stream); stream = print_prepare (stream, &frame); - write_c_string (stream, "\n"); + write_ascstring (stream, "\n"); print_internal (object, stream, 1); - write_c_string (stream, "\n"); + write_ascstring (stream, "\n"); print_finish (stream, frame); UNGCPRO; return object; @@ -1023,7 +1053,7 @@ } while (!NILP (tail)) { - write_c_string (stream, first ? ": " : ", "); + write_ascstring (stream, first ? ": " : ", "); /* Most errors have an explanatory string as their first argument, and it looks better not to put the quotes around it. */ print_internal (Fcar (tail), stream, @@ -1043,7 +1073,7 @@ error_throw: if (NILP (method)) { - write_c_string (stream, GETTEXT ("Peculiar error ")); + write_ascstring (stream, GETTEXT ("Peculiar error ")); print_internal (error_object, stream, 1); return; } @@ -1327,17 +1357,17 @@ if (max < len) last = max; } - write_c_string (printcharfun, start); + write_cistring (printcharfun, start); for (i = 0; i < last; i++) { Lisp_Object elt = XVECTOR_DATA (obj)[i]; - if (i != 0) write_c_string (printcharfun, " "); + if (i != 0) write_ascstring (printcharfun, " "); print_internal (elt, printcharfun, escapeflag); } UNGCPRO; if (last != len) - write_c_string (printcharfun, " ..."); - write_c_string (printcharfun, end); + write_ascstring (printcharfun, " ..."); + write_cistring (printcharfun, end); } void @@ -1358,14 +1388,14 @@ { obj = XCAR (XCDR (obj)); GCPRO2 (obj, printcharfun); - write_c_string (printcharfun, "\'"); + write_ascstring (printcharfun, "\'"); UNGCPRO; print_internal (obj, printcharfun, escapeflag); return; } GCPRO2 (obj, printcharfun); - write_c_string (printcharfun, "("); + write_ascstring (printcharfun, "("); { int len; @@ -1378,20 +1408,20 @@ obj = XCDR (obj), len++) { if (len > 0) - write_c_string (printcharfun, " "); + write_ascstring (printcharfun, " "); if (EQ (obj, tortoise) && len > 0) { if (print_readably) printing_unreadable_object ("circular list"); else - write_c_string (printcharfun, "... "); + write_ascstring (printcharfun, "... "); break; } if (len & 1) tortoise = XCDR (tortoise); if (len > max) { - write_c_string (printcharfun, "..."); + write_ascstring (printcharfun, "..."); break; } print_internal (XCAR (obj), printcharfun, escapeflag); @@ -1399,12 +1429,12 @@ } if (!LISTP (obj)) { - write_c_string (printcharfun, " . "); + write_ascstring (printcharfun, " . "); print_internal (obj, printcharfun, escapeflag); } UNGCPRO; - write_c_string (printcharfun, ")"); + write_ascstring (printcharfun, ")"); return; } @@ -1442,13 +1472,13 @@ /* This deals with GC-relocation and Mule. */ output_string (printcharfun, 0, obj, 0, bcmax); if (max < size) - write_c_string (printcharfun, " ..."); + write_ascstring (printcharfun, " ..."); } else { Bytecount i, last = 0; - write_c_string (printcharfun, "\""); + write_ascstring (printcharfun, "\""); for (i = 0; i < bcmax; i++) { Ibyte ch = string_byte (obj, i); @@ -1462,17 +1492,17 @@ } if (ch == '\n') { - write_c_string (printcharfun, "\\n"); + write_ascstring (printcharfun, "\\n"); } else { Ibyte temp[2]; - write_c_string (printcharfun, "\\"); + write_ascstring (printcharfun, "\\"); /* This is correct for Mule because the character is either \ or " */ temp[0] = string_byte (obj, i); temp[1] = '\0'; - write_string (printcharfun, temp); + write_istring (printcharfun, temp); } last = i + 1; } @@ -1483,20 +1513,20 @@ bcmax - last); } if (max < size) - write_c_string (printcharfun, " ..."); - write_c_string (printcharfun, "\""); + write_ascstring (printcharfun, " ..."); + write_ascstring (printcharfun, "\""); } UNGCPRO; } DOESNT_RETURN -printing_unreadable_object (const CIbyte *fmt, ...) +printing_unreadable_object (const Ascbyte *fmt, ...) { Lisp_Object obj; va_list args; va_start (args, fmt); - obj = emacs_vsprintf_string (CGETTEXT (fmt), args); + obj = emacs_vsprintf_string (GETTEXT (fmt), args); va_end (args); /* Fsignal GC-protects its args */ @@ -1678,9 +1708,9 @@ case Lisp_Type_Int_Even: case Lisp_Type_Int_Odd: { - char buf[DECIMAL_PRINT_SIZE (EMACS_INT)]; + Ascbyte buf[DECIMAL_PRINT_SIZE (EMACS_INT)]; long_to_string (buf, XINT (obj)); - write_c_string (printcharfun, buf); + write_ascstring (printcharfun, buf); break; } @@ -1884,7 +1914,7 @@ Ascbyte buf[DECIMAL_PRINT_SIZE (long) + 1]; *buf = '#'; long_to_string (buf + 1, i); - write_c_string (printcharfun, buf); + write_ascstring (printcharfun, buf); break; } if (i < print_depth - 1) /* Did we print something? */ @@ -1897,7 +1927,7 @@ if (INTP (Vprint_level) && print_depth > XINT (Vprint_level)) { - write_c_string (printcharfun, "..."); + write_ascstring (printcharfun, "..."); break; } } @@ -1929,10 +1959,10 @@ print_float (Lisp_Object obj, Lisp_Object printcharfun, int UNUSED (escapeflag)) { - char pigbuf[350]; /* see comments in float_to_string */ + Ascbyte pigbuf[350]; /* see comments in float_to_string */ float_to_string (pigbuf, XFLOAT_DATA (obj)); - write_c_string (printcharfun, pigbuf); + write_ascstring (printcharfun, pigbuf); } void @@ -1968,9 +1998,9 @@ Lisp_Object tem = Fassq (obj, Vprint_gensym_alist); if (CONSP (tem)) { - write_c_string (printcharfun, "#"); + write_ascstring (printcharfun, "#"); print_internal (XCDR (tem), printcharfun, escapeflag); - write_c_string (printcharfun, "#"); + write_ascstring (printcharfun, "#"); UNGCPRO; return; } @@ -1988,12 +2018,12 @@ tem = make_int (1); Vprint_gensym_alist = Fcons (Fcons (obj, tem), Vprint_gensym_alist); - write_c_string (printcharfun, "#"); + write_ascstring (printcharfun, "#"); print_internal (tem, printcharfun, escapeflag); - write_c_string (printcharfun, "="); + write_ascstring (printcharfun, "="); } } - write_c_string (printcharfun, "#:"); + write_ascstring (printcharfun, "#:"); } /* Does it look like an integer or a float? */ @@ -2028,7 +2058,7 @@ from FSF. --hniksic */ confusing = isfloat_string ((char *) data); if (confusing) - write_c_string (printcharfun, "\\"); + write_ascstring (printcharfun, "\\"); } { @@ -2053,7 +2083,7 @@ case '[': case ']' : case '?' : if (i > last) output_string (printcharfun, 0, name, last, i - last); - write_c_string (printcharfun, "\\"); + write_ascstring (printcharfun, "\\"); last = i; } } diff -r d2ec55325515 -r 8f0cf4fd3d2c src/process-nt.c --- a/src/process-nt.c Sat Feb 06 03:59:18 2010 -0600 +++ b/src/process-nt.c Sat Feb 06 04:01:46 2010 -0600 @@ -693,11 +693,10 @@ */ static DOESNT_RETURN -mswindows_report_winsock_error (const char *string, Lisp_Object data, +mswindows_report_winsock_error (const Ascbyte *reason, Lisp_Object data, int errnum) { - report_file_type_error (Qnetwork_error, mswindows_lisp_error (errnum), - string, data); + signal_error_2 (Qnetwork_error, reason, mswindows_lisp_error (errnum), data); } static void @@ -861,7 +860,7 @@ args_or_ret); /* #### What about path names, which may be links? */ - LISP_STRING_TO_TSTR (args_or_ret, command_line); + command_line = LISP_STRING_TO_TSTR (args_or_ret); UNGCPRO; /* args_or_ret */ } @@ -1237,7 +1236,7 @@ Extbyte *hostext; unsigned long inaddr; - LISP_STRING_TO_EXTERNAL (host, hostext, Qmswindows_host_name_encoding); + hostext = LISP_STRING_TO_EXTERNAL (host, Qmswindows_host_name_encoding); inaddr = inet_addr (hostext); if (inaddr != INADDR_NONE) { @@ -1255,7 +1254,7 @@ { Extbyte *hostext; - LISP_STRING_TO_EXTERNAL (host, hostext, Qmswindows_host_name_encoding); + hostext = LISP_STRING_TO_EXTERNAL (host, Qmswindows_host_name_encoding); hasync = WSAAsyncGetHostByName (hwnd, XM_SOCKREPLY, hostext, buf, sizeof (buf)); @@ -1313,7 +1312,8 @@ return host; if (address.sin_family == AF_INET) - return build_string (inet_ntoa (address.sin_addr)); + return build_extstring (inet_ntoa (address.sin_addr), + Qunix_host_name_encoding); else return host; } @@ -1348,8 +1348,8 @@ Extbyte *servext; CHECK_STRING (service); - LISP_STRING_TO_EXTERNAL (service, servext, - Qmswindows_service_name_encoding); + servext = LISP_STRING_TO_EXTERNAL (service, + Qmswindows_service_name_encoding); svc_info = getservbyname (servext, "tcp"); if (svc_info == 0) diff -r d2ec55325515 -r 8f0cf4fd3d2c src/process-unix.c --- a/src/process-unix.c Sat Feb 06 03:59:18 2010 -0600 +++ b/src/process-unix.c Sat Feb 06 04:01:46 2010 -0600 @@ -222,8 +222,8 @@ grovelling code in allocate_pty_the_old_fashioned_way(). */ int master_fd = -1; const Extbyte *slave_name = NULL; - const CIbyte *clone = NULL; - static const CIbyte * const clones[] = + const Ascbyte *clone = NULL; + static const Ascbyte * const clones[] = /* Different pty master clone devices */ { "/dev/ptmx", /* Various systems */ @@ -307,7 +307,7 @@ { Ibyte *slaveint; - EXTERNAL_TO_C_STRING (slave_name, slaveint, Qfile_name); + slaveint = EXTERNAL_TO_ITEXT (slave_name, Qfile_name); qxestrncpy (pty_name, slaveint, sizeof (pty_name)); } @@ -334,9 +334,7 @@ struct group *tty_group = getgrnam ("tty"); if (tty_group != NULL) { - Extbyte *ptyout; - - C_STRING_TO_EXTERNAL (pty_name, ptyout, Qfile_name); + Extbyte *ptyout = ITEXT_TO_EXTERNAL (pty_name, Qfile_name); chown (ptyout, (uid_t) -1, tty_group->gr_gid); } } @@ -458,7 +456,7 @@ h_errno = 0; #endif - LISP_STRING_TO_EXTERNAL (host, hostext, Qunix_host_name_encoding); + hostext = LISP_STRING_TO_EXTERNAL (host, Qunix_host_name_encoding); /* Some systems can't handle SIGIO/SIGALARM in gethostbyname. */ slow_down_interrupts (); @@ -482,7 +480,7 @@ Extbyte *hostext; /* Attempt to interpret host as numeric inet address */ - LISP_STRING_TO_EXTERNAL (host, hostext, Qunix_host_name_encoding); + hostext = LISP_STRING_TO_EXTERNAL (host, Qunix_host_name_encoding); numeric_addr = inet_addr (hostext); if (NUMERIC_ADDR_ERROR) { @@ -524,10 +522,9 @@ Extbyte *tailportext; CHECK_STRING (tail_port); - TO_EXTERNAL_FORMAT (LISP_STRING, tail_port, C_STRING_ALLOCA, - tailportext, Qunix_service_name_encoding); - - svc_info = getservbyname (tailportext, proto); + svc_info = getservbyname (LISP_STRING_TO_EXTERNAL + (tail_port, Qunix_service_name_encoding), + proto); if ((svc_info != 0) && (svc_info->s_port == port)) break; else @@ -1300,7 +1297,7 @@ if (separate_err) retry_close (forkerr); - p->tty_name = pty_flag ? build_intstring (pty_name) : Qnil; + p->tty_name = pty_flag ? build_istring (pty_name) : Qnil; /* Notice that SIGCHLD was not blocked. (This is not possible on some systems.) No biggie if SIGCHLD occurs right around the @@ -1816,16 +1813,14 @@ #endif hints.ai_socktype = SOCK_STREAM; hints.ai_protocol = 0; - LISP_STRING_TO_EXTERNAL (host, ext_host, Qunix_host_name_encoding); + ext_host = LISP_STRING_TO_EXTERNAL (host, Qunix_host_name_encoding); retval = getaddrinfo (ext_host, NULL, &hints, &res); if (retval != 0) { - CIbyte *gai_err; - - EXTERNAL_TO_C_STRING (gai_strerror (retval), gai_err, - Qstrerror_encoding); - maybe_signal_error (Qio_error, gai_err, host, - Qprocess, ERROR_ME_DEBUG_WARN); + maybe_signal_error_2 (Qio_error, "Canonicalizing host name", + build_extstring (gai_strerror (retval), + Qstrerror_encoding), + host, Qprocess, ERROR_ME_DEBUG_WARN); canonname = host; } else @@ -1833,7 +1828,7 @@ int gni = getnameinfo (res->ai_addr, res->ai_addrlen, addrbuf, sizeof(addrbuf), NULL, 0, NI_NUMERICHOST); - canonname = gni ? host : build_ext_string (addrbuf, + canonname = gni ? host : build_extstring (addrbuf, Qunix_host_name_encoding); freeaddrinfo (res); @@ -1847,7 +1842,8 @@ return host; if (address.sin_family == AF_INET) - return build_string (inet_ntoa (address.sin_addr)); + return build_extstring (inet_ntoa (address.sin_addr), + Qunix_host_name_encoding); else /* #### any clue what to do here? */ return host; @@ -1900,8 +1896,8 @@ else { CHECK_STRING (service); - LISP_STRING_TO_EXTERNAL (service, portstring, - Qunix_service_name_encoding); + portstring = LISP_STRING_TO_EXTERNAL (service, + Qunix_service_name_encoding); port = 0; } @@ -1913,15 +1909,14 @@ else /* EQ (protocol, Qudp) */ hints.ai_socktype = SOCK_DGRAM; hints.ai_protocol = 0; - LISP_STRING_TO_EXTERNAL (host, ext_host, Qunix_host_name_encoding); + ext_host = LISP_STRING_TO_EXTERNAL (host, Qunix_host_name_encoding); retval = getaddrinfo (ext_host, portstring, &hints, &res); if (retval != 0) { - CIbyte *gai_err; - - EXTERNAL_TO_C_STRING (gai_strerror (retval), gai_err, - Qstrerror_encoding); - signal_error (Qio_error, gai_err, list2 (host, service)); + signal_error_2 (Qio_error, "Converting host name to IP address", + build_extstring (gai_strerror (retval), + Qstrerror_encoding), + list2 (host, service)); } /* address loop */ @@ -1940,8 +1935,8 @@ Extbyte *servext; CHECK_STRING (service); - LISP_STRING_TO_EXTERNAL (service, servext, - Qunix_service_name_encoding); + servext = LISP_STRING_TO_EXTERNAL (service, + Qunix_service_name_encoding); if (EQ (protocol, Qtcp)) svc_info = getservbyname (servext, "tcp"); diff -r d2ec55325515 -r 8f0cf4fd3d2c src/process.c --- a/src/process.c Sat Feb 06 03:59:18 2010 -0600 +++ b/src/process.c Sat Feb 06 04:01:46 2010 -0600 @@ -159,15 +159,15 @@ else { int netp = network_connection_p (obj); - write_c_string (printcharfun, + write_ascstring (printcharfun, netp ? GETTEXT ("#name, printcharfun, 1); - write_c_string (printcharfun, (netp ? " " : " pid ")); + write_ascstring (printcharfun, (netp ? " " : " pid ")); print_internal (process->pid, printcharfun, 1); write_fmt_string_lisp (printcharfun, " state:%S", 1, process->status_symbol); MAYBE_PROCMETH (print_process_data, (process, printcharfun)); - write_c_string (printcharfun, ">"); + write_ascstring (printcharfun, ">"); } } @@ -192,7 +192,7 @@ { MAYBE_PROCMETH (finalize_process_data, (p, for_disksave)); if (!for_disksave) - xfree (p->process_data, void *); + xfree (p->process_data); } } @@ -454,15 +454,15 @@ /************************************************************************/ DOESNT_RETURN -report_process_error (const char *string, Lisp_Object data) +report_process_error (const Ascbyte *reason, Lisp_Object data) { - report_error_with_errno (Qprocess_error, string, data); + report_error_with_errno (Qprocess_error, reason, data); } DOESNT_RETURN -report_network_error (const char *string, Lisp_Object data) +report_network_error (const Ascbyte *reason, Lisp_Object data) { - report_error_with_errno (Qnetwork_error, string, data); + report_error_with_errno (Qnetwork_error, reason, data); } Lisp_Object @@ -479,12 +479,12 @@ name1 = name; for (i = 1; ; i++) { - char suffix[10]; + Ascbyte suffix[10]; Lisp_Object tem = Fget_process (name1); if (NILP (tem)) break; sprintf (suffix, "<%d>", i); - name1 = concat2 (name, build_string (suffix)); + name1 = concat2 (name, build_ascstring (suffix)); } name = name1; p->name = name; @@ -746,7 +746,7 @@ tem = Qnil; NGCPRO1 (tem); - locate_file (list1 (build_string ("")), program, Vlisp_EXEC_SUFFIXES, + locate_file (list1 (build_ascstring ("")), program, Vlisp_EXEC_SUFFIXES, &tem, X_OK); if (NILP (tem)) signal_error (Qprocess_error, "Searching for program", program); @@ -1570,11 +1570,11 @@ if (EQ (symbol, Qsignal) || EQ (symbol, Qstop)) { - string = build_string (signal_name (code)); + string = build_cistring (signal_name (code)); if (coredump) string2 = build_msg_string (" (core dumped)\n"); else - string2 = build_string ("\n"); + string2 = build_ascstring ("\n"); set_string_char (string, 0, DOWNCASE (0, string_ichar (string, 0))); return concat2 (string, string2); @@ -1587,7 +1587,7 @@ if (coredump) string2 = build_msg_string (" (core dumped)\n"); else - string2 = build_string ("\n"); + string2 = build_ascstring ("\n"); return concat2 (build_msg_string ("exited abnormally with code "), concat2 (string, string2)); } @@ -1696,9 +1696,9 @@ int spec = process_setup_for_insertion (process, 0); NGCPRO1 (process); - buffer_insert_c_string (current_buffer, "\nProcess "); + buffer_insert_ascstring (current_buffer, "\nProcess "); Finsert (1, &p->name); - buffer_insert_c_string (current_buffer, " "); + buffer_insert_ascstring (current_buffer, " "); Finsert (1, &msg); Fset_marker (p->mark, make_int (BUF_PT (current_buffer)), p->buffer); @@ -2308,14 +2308,14 @@ ) { XCAR (scan) = concat3 (make_string (var, varlen), - build_string ("="), + build_ascstring ("="), make_string (value, valuelen)); return; } } Vprocess_environment = Fcons (concat3 (make_string (var, varlen), - build_string ("="), + build_ascstring ("="), make_string (value, valuelen)), Vprocess_environment); } @@ -2348,7 +2348,7 @@ */ (var, interactivep)) { - Ibyte *value; + Ibyte *value = NULL; Bytecount valuelen; Lisp_Object v = Qnil; struct gcpro gcpro1; @@ -2434,12 +2434,12 @@ _wgetenv (L""); /* force initialization of _wenviron */ for (envp = (Extbyte **) _wenviron; envp && *envp; envp++) Vprocess_environment = - Fcons (build_ext_string (*envp, Qmswindows_unicode), + Fcons (build_extstring (*envp, Qmswindows_unicode), Vprocess_environment); #else for (envp = environ; envp && *envp; envp++) Vprocess_environment = - Fcons (build_ext_string (*envp, Qenvironment_variable_encoding), + Fcons (build_extstring (*envp, Qenvironment_variable_encoding), Vprocess_environment); #endif /* This gets set back to 0 in disksave_object_finalization() */ @@ -2479,12 +2479,12 @@ { Ibyte *faux_var = alloca_ibytes (7 + qxestrlen (shell)); qxesprintf (faux_var, "SHELL=%s", shell); - Vprocess_environment = Fcons (build_intstring (faux_var), + Vprocess_environment = Fcons (build_istring (faux_var), Vprocess_environment); } #endif /* 0 */ - Vshell_file_name = build_intstring (shell); + Vshell_file_name = build_istring (shell); } } @@ -2605,7 +2605,7 @@ the operations needing this are lower level than what ELisp programs typically do, and in any case no equivalent exists under native MS Windows. */ ); - Vnull_device = build_string (NULL_DEVICE); + Vnull_device = build_ascstring (NULL_DEVICE); DEFVAR_LISP ("process-connection-type", &Vprocess_connection_type /* Control type of device used to communicate with subprocesses. @@ -2685,6 +2685,6 @@ when Emacs starts. */ ); - Vlisp_EXEC_SUFFIXES = build_string (EXEC_SUFFIXES); + Vlisp_EXEC_SUFFIXES = build_ascstring (EXEC_SUFFIXES); staticpro (&Vlisp_EXEC_SUFFIXES); } diff -r d2ec55325515 -r 8f0cf4fd3d2c src/process.h --- a/src/process.h Sat Feb 06 03:59:18 2010 -0600 +++ b/src/process.h Sat Feb 06 04:01:46 2010 -0600 @@ -55,8 +55,8 @@ EXFUN (Fprocess_id, 1); MODULE_API -DECLARE_DOESNT_RETURN (report_process_error (const char *, Lisp_Object)); -DECLARE_DOESNT_RETURN (report_network_error (const char *, Lisp_Object)); +DECLARE_DOESNT_RETURN (report_process_error (const Ascbyte *, Lisp_Object)); +DECLARE_DOESNT_RETURN (report_network_error (const Ascbyte *, Lisp_Object)); extern Lisp_Object Vlisp_EXEC_SUFFIXES; MODULE_API Ibyte *egetenv (const CIbyte *var); diff -r d2ec55325515 -r 8f0cf4fd3d2c src/profile.c --- a/src/profile.c Sat Feb 06 03:59:18 2010 -0600 +++ b/src/profile.c Sat Feb 06 04:01:46 2010 -0600 @@ -683,28 +683,28 @@ profiling_lock = 0; #ifdef DEBUG_XEMACS - QSin_temp_spot_1 = build_msg_string ("(in temp spot 1)"); + QSin_temp_spot_1 = build_defer_string ("(in temp spot 1)"); staticpro (&QSin_temp_spot_1); - QSin_temp_spot_2 = build_msg_string ("(in temp spot 2)"); + QSin_temp_spot_2 = build_defer_string ("(in temp spot 2)"); staticpro (&QSin_temp_spot_2); - QSin_temp_spot_3 = build_msg_string ("(in temp spot 3)"); + QSin_temp_spot_3 = build_defer_string ("(in temp spot 3)"); staticpro (&QSin_temp_spot_3); - QSin_temp_spot_4 = build_msg_string ("(in temp spot 4)"); + QSin_temp_spot_4 = build_defer_string ("(in temp spot 4)"); staticpro (&QSin_temp_spot_4); - QSin_temp_spot_5 = build_msg_string ("(in temp spot 5)"); + QSin_temp_spot_5 = build_defer_string ("(in temp spot 5)"); staticpro (&QSin_temp_spot_5); #endif /* DEBUG_XEMACS */ - QSunknown = build_msg_string ("(unknown)"); + QSunknown = build_defer_string ("(unknown)"); staticpro (&QSunknown); QSprocessing_events_at_top_level = - build_msg_string ("(processing events at top level)"); + build_defer_string ("(processing events at top level)"); staticpro (&QSprocessing_events_at_top_level); - QSprofile_overhead = build_msg_string ("(profile overhead)"); + QSprofile_overhead = build_defer_string ("(profile overhead)"); staticpro (&QSprofile_overhead); DEFSYMBOL (Qtiming); diff -r d2ec55325515 -r 8f0cf4fd3d2c src/rangetab.c --- a/src/rangetab.c Sat Feb 06 03:59:18 2010 -0600 +++ b/src/rangetab.c Sat Feb 06 04:01:46 2010 -0600 @@ -107,13 +107,13 @@ write_fmt_string_lisp (printcharfun, "#s(range-table type %s data (", 1, range_table_type_to_symbol (rt->type)); else - write_c_string (printcharfun, "#entries); i++) { struct range_table_entry *rte = Dynarr_atp (rt->entries, i); int so, ec; if (i > 0) - write_c_string (printcharfun, " "); + write_ascstring (printcharfun, " "); switch (rt->type) { case RANGE_START_CLOSED_END_OPEN: so = 0, ec = 0; break; @@ -131,7 +131,7 @@ print_internal (rte->val, printcharfun, 1); } if (print_readably) - write_c_string (printcharfun, "))"); + write_ascstring (printcharfun, "))"); else write_fmt_string (printcharfun, " 0x%x>", rt->header.uid); } @@ -355,7 +355,7 @@ rtnew->entries = Dynarr_new (range_table_entry); rtnew->type = rt->type; - Dynarr_add_many (rtnew->entries, Dynarr_atp (rt->entries, 0), + Dynarr_add_many (rtnew->entries, Dynarr_begin (rt->entries), Dynarr_length (rt->entries)); return wrap_range_table (rtnew); } @@ -374,7 +374,7 @@ CHECK_INT_COERCE_CHAR (pos); return get_range_table (XINT (pos), Dynarr_length (rt->entries), - Dynarr_atp (rt->entries, 0), default_); + Dynarr_begin (rt->entries), default_); } static void @@ -810,7 +810,7 @@ un = (struct unified_range_table *) new_dest; un->nentries = Dynarr_length (rted); un->type = XRANGE_TABLE (rangetab)->type; - memcpy (&un->first, Dynarr_atp (rted, 0), + memcpy (&un->first, Dynarr_begin (rted), sizeof (struct range_table_entry) * Dynarr_length (rted)); } diff -r d2ec55325515 -r 8f0cf4fd3d2c src/realpath.c --- a/src/realpath.c Sat Feb 06 03:59:18 2010 -0600 +++ b/src/realpath.c Sat Feb 06 04:01:46 2010 -0600 @@ -162,7 +162,7 @@ return -1; } memcpy (buf, tmp, len); - xfree (tmp, Ibyte *); + xfree (tmp); return len; } } @@ -218,7 +218,7 @@ Extbyte *nameext; HANDLE dir_handle; - C_STRING_TO_TSTR (name, nameext); + nameext = ITEXT_TO_TSTR (name); dir_handle = qxeFindFirstFile (nameext, &find_data); if (dir_handle == INVALID_HANDLE_VALUE) { @@ -464,6 +464,6 @@ vars_of_realpath (void) { QSin_qxe_realpath = - build_msg_string ("(in qxe_realpath)"); + build_defer_string ("(in qxe_realpath)"); staticpro (&QSin_qxe_realpath); } diff -r d2ec55325515 -r 8f0cf4fd3d2c src/redisplay-msw.c --- a/src/redisplay-msw.c Sat Feb 06 03:59:18 2010 -0600 +++ b/src/redisplay-msw.c Sat Feb 06 04:01:46 2010 -0600 @@ -469,9 +469,10 @@ #if 0 /* #### FIXME? */ /* We can't work out the width before we've set the font in the DC */ if (width < 0) - width = mswindows_text_width (cachel, Dynarr_atp (buf, 0), Dynarr_length (buf)); + width = mswindows_text_width (w, cachel, Dynarr_begin (buf), + Dynarr_length (buf)); #else - assert(width>=0); + assert (width >= 0); #endif /* Regularize the variables passed in. */ @@ -517,7 +518,7 @@ cachel = WINDOW_FACE_CACHEL (w, findex); } - nruns = separate_textual_runs (&runs, Dynarr_atp (buf, 0), + nruns = separate_textual_runs (&runs, Dynarr_begin (buf), Dynarr_length (buf)); for (i = 0; i < nruns; i++) @@ -1181,9 +1182,10 @@ displayed in the font associated with the face. ****************************************************************************/ static int -mswindows_text_width (struct frame *f, struct face_cachel *cachel, +mswindows_text_width (struct window *w, struct face_cachel *cachel, const Ichar *str, Charcount len) { + struct frame *f = WINDOW_XFRAME (w); HDC hdc = get_frame_dc (f, 0); int width_so_far = 0; textual_run *runs; diff -r d2ec55325515 -r 8f0cf4fd3d2c src/redisplay-output.c --- a/src/redisplay-output.c Sat Feb 06 03:59:18 2010 -0600 +++ b/src/redisplay-output.c Sat Feb 06 04:01:46 2010 -0600 @@ -83,7 +83,7 @@ redisplay performance so avoiding all excess overhead is a good thing. Is all of this true? */ memcpy (cra->base, dra->base, sizeof (struct rune) * max_move); - Dynarr_set_size (cra, max_move); + Dynarr_set_length (cra, max_move); } else Dynarr_reset (cra); @@ -422,7 +422,10 @@ else if (start_pos <= bounds.right_out) *next_start = bounds.right_out; else - ABORT (); + { + ABORT (); + *next_start = 0; + } } for (block = 0; block < Dynarr_length (dba); block++) @@ -715,7 +718,7 @@ block, if present, must always be the first display block. */ assert (Dynarr_length (ddba) != 0); - db = Dynarr_atp (ddba, 0); + db = Dynarr_begin (ddba); assert (db->type == TEXT); get_cursor_size_and_location (w, db, ddl->cursor_elt, &cursor_start, @@ -1026,7 +1029,7 @@ w->last_point_y[CURRENT_DISP] = y; Fset_marker (w->last_point[CURRENT_DISP], Qzero, w->buffer); - rb = Dynarr_atp (db->runes, 0); + rb = Dynarr_begin (db->runes); rb->cursor_type = CURSOR_ON; dl->cursor_elt = 0; @@ -2193,7 +2196,7 @@ if (ddla_len) { - if (ddla_len == 1 && Dynarr_atp (ddla, 0)->modeline) + if (ddla_len == 1 && Dynarr_begin (ddla)->modeline) { ypos1 = WINDOW_TEXT_TOP (w); #ifdef HAVE_SCROLLBARS @@ -2395,9 +2398,9 @@ cdl = ddl = 0; if (cdla_len) - cdl = Dynarr_atp (cdla, 0); + cdl = Dynarr_begin (cdla); if (ddla_len) - ddl = Dynarr_atp (ddla, 0); + ddl = Dynarr_begin (ddla); if (!cdl || !ddl) need_to_clear_bottom = 1; @@ -2461,7 +2464,7 @@ /* If the number of display lines has shrunk, adjust. */ if (cdla_len > ddla_len) { - Dynarr_length (cdla) = ddla_len; + Dynarr_set_length (cdla, ddla_len); } /* Output a vertical divider between windows, if necessary. */ diff -r d2ec55325515 -r 8f0cf4fd3d2c src/redisplay-tty.c --- a/src/redisplay-tty.c Sat Feb 06 03:59:18 2010 -0600 +++ b/src/redisplay-tty.c Sat Feb 06 04:01:46 2010 -0600 @@ -106,10 +106,10 @@ column, so we use ichar_string_displayed_columns(). ****************************************************************************/ static int -tty_text_width (struct frame *f, struct face_cachel *UNUSED (cachel), +tty_text_width (struct window *w, struct face_cachel *UNUSED (cachel), const Ichar *str, Charcount len) { - struct console *c = XCONSOLE(FRAME_CONSOLE (f)); + struct console *c = WINDOW_XCONSOLE (w); if (CONSOLE_TTY_MULTIPLE_WIDTH (c)) { @@ -575,12 +575,12 @@ else Dynarr_reset (tty_output_ichar_dynarr_dynarr); - convert_ichar_string_into_ibyte_dynarr (Dynarr_atp (buf, 0), + convert_ichar_string_into_ibyte_dynarr (Dynarr_begin (buf), Dynarr_length (buf), tty_output_ichar_dynarr_dynarr); tty_output_ibyte_string (w, dl, - Dynarr_atp (tty_output_ichar_dynarr_dynarr, 0), + Dynarr_begin (tty_output_ichar_dynarr_dynarr), Dynarr_length (tty_output_ichar_dynarr_dynarr), xpos, findex, cursor); } @@ -641,7 +641,7 @@ { substitute_in_dynamic_color_string (Vtty_dynamic_color_fg, Fsymbol_name (sym)); - escseq = Dynarr_atp (sidcs_dynarr, 0); + escseq = Dynarr_begin (sidcs_dynarr); escseqlen = Dynarr_length (sidcs_dynarr); } #endif @@ -671,7 +671,7 @@ { substitute_in_dynamic_color_string (Vtty_dynamic_color_bg, Fsymbol_name (sym)); - escseq = Dynarr_atp (sidcs_dynarr, 0); + escseq = Dynarr_begin (sidcs_dynarr); escseqlen = Dynarr_length (sidcs_dynarr); } #endif @@ -1412,7 +1412,7 @@ char *sequence = tgetstr (keys[i].cap, address); if (sequence) Fdefine_key (function_key_map, - build_ext_string (sequence, Qbinary), + build_extstring (sequence, Qbinary), vector1 (intern (keys[i].name))); } @@ -1426,11 +1426,11 @@ const char *k0 = tgetstr ("k0", address); if (k_semi) - Fdefine_key (function_key_map, build_ext_string (k_semi, Qbinary), + Fdefine_key (function_key_map, build_extstring (k_semi, Qbinary), vector1 (intern ("f10"))); if (k0) - Fdefine_key (function_key_map, build_ext_string (k0, Qbinary), + Fdefine_key (function_key_map, build_extstring (k0, Qbinary), vector1 (intern (k_semi ? "f0" : "f10"))); } @@ -1454,7 +1454,7 @@ { sprintf (fkey, "f%d", i); Fdefine_key (function_key_map, - build_ext_string (sequence, Qbinary), + build_extstring (sequence, Qbinary), vector1 (intern (fkey))); } } @@ -1470,7 +1470,7 @@ char *sequence = tgetstr (cap2, address); \ if (sequence) \ Fdefine_key (function_key_map, \ - build_ext_string (sequence, Qbinary), \ + build_extstring (sequence, Qbinary), \ vector1 (intern (keyname))); \ } \ } while (0) diff -r d2ec55325515 -r 8f0cf4fd3d2c src/redisplay-xlike-inc.c --- a/src/redisplay-xlike-inc.c Sat Feb 06 03:59:18 2010 -0600 +++ b/src/redisplay-xlike-inc.c Sat Feb 06 04:01:46 2010 -0600 @@ -519,17 +519,15 @@ when displayed in the fonts associated with the face. */ -/* #### Break me out into a separate header */ -int XLIKE_text_width (struct frame *f, struct face_cachel *cachel, - const Ichar *str, Charcount len); -int -XLIKE_text_width (struct frame *f, struct face_cachel *cachel, +static int +XLIKE_text_width (struct window *w, struct face_cachel *cachel, const Ichar *str, Charcount len) { /* !!#### Needs review */ int width_so_far = 0; unsigned char *text_storage = (unsigned char *) ALLOCA (2 * len); struct textual_run *runs = alloca_array (struct textual_run, len); + struct frame *f = WINDOW_XFRAME (w); int nruns; int i; @@ -1024,7 +1022,7 @@ #endif /* USE_XFT */ if (width < 0) - width = XLIKE_text_width (f, cachel, Dynarr_atp (buf, 0), + width = XLIKE_text_width (w, cachel, Dynarr_begin (buf), Dynarr_length (buf)); /* Regularize the variables passed in. */ @@ -1088,7 +1086,7 @@ height); } - nruns = separate_textual_runs (text_storage, runs, Dynarr_atp (buf, 0), + nruns = separate_textual_runs (text_storage, runs, Dynarr_begin (buf), Dynarr_length (buf), cachel); for (i = 0; i < nruns; i++) diff -r d2ec55325515 -r 8f0cf4fd3d2c src/redisplay.c --- a/src/redisplay.c Sat Feb 06 03:59:18 2010 -0600 +++ b/src/redisplay.c Sat Feb 06 04:01:46 2010 -0600 @@ -1,7 +1,7 @@ /* Display generation from window structure and buffer text. Copyright (C) 1994, 1995, 1996 Board of Trustees, University of Illinois. Copyright (C) 1995 Free Software Foundation, Inc. - Copyright (C) 1995, 1996, 2000, 2001, 2002, 2003, 2005 Ben Wing. + Copyright (C) 1995, 1996, 2000, 2001, 2002, 2003, 2005, 2010 Ben Wing. Copyright (C) 1995 Sun Microsystems, Inc. Copyright (C) 1996 Chuck Thompson. @@ -640,9 +640,9 @@ window = wrap_window (w); ensure_face_cachel_complete (WINDOW_FACE_CACHEL (w, findex), window, charsets); - return DEVMETH (XDEVICE (FRAME_DEVICE (XFRAME (WINDOW_FRAME (w)))), - text_width, (XFRAME (WINDOW_FRAME (w)), - WINDOW_FACE_CACHEL (w, findex), str, len)); + return DEVMETH (WINDOW_XDEVICE (w), + text_width, (w, WINDOW_FACE_CACHEL (w, findex), str, + len)); } static Ichar_dynarr *rtw_ichar_dynarr; @@ -661,7 +661,7 @@ nonreloc = XSTRING_DATA (reloc); convert_ibyte_string_into_ichar_dynarr (nonreloc, len, rtw_ichar_dynarr); return redisplay_window_text_width_ichar_string - (w, findex, Dynarr_atp (rtw_ichar_dynarr, 0), + (w, findex, Dynarr_begin (rtw_ichar_dynarr), Dynarr_length (rtw_ichar_dynarr)); } @@ -690,9 +690,14 @@ NILP (window) ? frame : window, charsets); return DEVMETH (XDEVICE (FRAME_DEVICE (XFRAME (frame))), - text_width, (XFRAME (frame), + /* #### Not clear if we're always passed a window, but + I think so. If not, we will get an abort here, + and then we need to either fix the callers to pass in + a window, or change *text_width() to take a domain + argument. */ + text_width, (XWINDOW (window), &cachel, - Dynarr_atp (rtw_ichar_dynarr, 0), + Dynarr_begin (rtw_ichar_dynarr), Dynarr_length (rtw_ichar_dynarr))); } @@ -1271,7 +1276,7 @@ pb.type = PROP_STRING; pb.data.p_string.str = xnew_array (Ibyte, len); - strncpy ((char *) pb.data.p_string.str, (char *) pos, len); + qxestrncpy (pb.data.p_string.str, pos, len); pb.data.p_string.len = len; Dynarr_add (prop, pb); @@ -1681,7 +1686,7 @@ break; case PROP_STRING: if (pb->data.p_string.str) - xfree (pb->data.p_string.str, Ibyte *); + xfree (pb->data.p_string.str); /* #### bogus bogus -- this doesn't do anything! Should probably call add_ibyte_string_runes(), once that function is fixed. */ @@ -2307,9 +2312,9 @@ works because we always recalculate the extent-fragments for propagated data, we never actually propagate the fragments that still need to be displayed. */ - if (*prop && Dynarr_atp (*prop, 0)->type == PROP_GLYPH) - { - last_glyph = Dynarr_atp (*prop, 0)->data.p_glyph.glyph; + if (*prop && Dynarr_begin (*prop)->type == PROP_GLYPH) + { + last_glyph = Dynarr_begin (*prop)->data.p_glyph.glyph; Dynarr_free (*prop); *prop = 0; } @@ -4014,7 +4019,7 @@ add_blank_rune (data, NULL, 0); end = (Dynarr_length (db->runes) + - bytecount_to_charcount (str, strlen ((const char *) str))); + bytecount_to_charcount (str, qxestrlen (str))); if (max_pos != -1) end = min (max_pos, end); @@ -4077,7 +4082,7 @@ true of max_pixsize. */ #define SET_CURRENT_MODE_CHARS_PIXSIZE \ if (Dynarr_length (data->db->runes)) \ - cur_pixsize = data->pixpos - Dynarr_atp (data->db->runes, 0)->xpos; \ + cur_pixsize = data->pixpos - Dynarr_begin (data->db->runes)->xpos; \ else \ cur_pixsize = 0; @@ -4203,7 +4208,7 @@ decode_mode_spec (w, ch, type); - str = Dynarr_atp (mode_spec_ibyte_string, 0); + str = Dynarr_begin (mode_spec_ibyte_string); size = bytecount_to_charcount /* Skip the null character added by `decode_mode_spec' */ (str, Dynarr_length (mode_spec_ibyte_string)) - 1; @@ -4449,7 +4454,7 @@ { invalid: { - const char *str = GETTEXT ("*invalid*"); + const Ascbyte *str = GETTEXT ("*invalid*"); Charcount size = (Charcount) strlen (str); /* is this ok ?? -- dv */ if (size <= *offset) @@ -4484,11 +4489,11 @@ { display_line_dynarr *dla = window_display_lines (w, DESIRED_DISP); - if (!Dynarr_length (dla) || !Dynarr_atp (dla, 0)->modeline) + if (!Dynarr_length (dla) || !Dynarr_begin (dla)->modeline) return; else { - generate_modeline (w, Dynarr_atp (dla, 0), DESIRED_DISP); + generate_modeline (w, Dynarr_begin (dla), DESIRED_DISP); redisplay_update_line (w, 0, 0, 0); } } @@ -4540,7 +4545,7 @@ /* If we're adding a new place marker go ahead and generate the modeline so that it is available for use by window_modeline_height. */ - generate_modeline (w, Dynarr_atp (dla, 0), type); + generate_modeline (w, Dynarr_begin (dla), type); } return need_modeline; @@ -4559,9 +4564,9 @@ if (Dynarr_length (dla)) { - if (Dynarr_atp (dla, 0)->modeline) - return (Dynarr_atp (dla, 0)->ascent + - Dynarr_atp (dla, 0)->descent); + if (Dynarr_begin (dla)->modeline) + return (Dynarr_begin (dla)->ascent + + Dynarr_begin (dla)->descent); } } return 0; @@ -4776,9 +4781,9 @@ { Lisp_Object last_glyph = Qnil; /* Deal with clipped glyphs that we have already displayed. */ - if (*prop && Dynarr_atp (*prop, 0)->type == PROP_GLYPH) - { - last_glyph = Dynarr_atp (*prop, 0)->data.p_glyph.glyph; + if (*prop && Dynarr_begin (*prop)->type == PROP_GLYPH) + { + last_glyph = Dynarr_begin (*prop)->data.p_glyph.glyph; Dynarr_free (*prop); *prop = 0; } @@ -5466,6 +5471,17 @@ Dynarr_reset (dla); w->max_line_len = 0; + /* Added 2-1-10 -- we should never have empty face or glyph cachels + because we initialized them at startup and the only way to reduce + their number is through calling reset_face_cachels() or + reset_glyph_cachels(), which as a side effect sets up a number of + standard entries */ + assert (Dynarr_length (w->face_cachels)); + assert (Dynarr_length (w->glyph_cachels)); + +#if 0 + /* #### Delete this code sometime later than 2-1-10 when we're sure it's + not needed */ /* Normally these get updated in redisplay_window but it is possible for this function to get called from some other points where that update may not have occurred. This acts as a safety check. */ @@ -5473,6 +5489,7 @@ reset_face_cachels (w); if (!Dynarr_length (w->glyph_cachels)) reset_glyph_cachels (w); +#endif Fset_marker (w->start[type], make_int (start_pos), w->buffer); Fset_marker (w->pointm[type], make_int (point), w->buffer); @@ -5644,7 +5661,7 @@ { /* We know that this is the right thing to use because we put it there when we first started working in this function. */ - generate_modeline (w, Dynarr_atp (dla, 0), type); + generate_modeline (w, Dynarr_begin (dla), type); } if (depth >= 0) @@ -5658,12 +5675,12 @@ return 0; \ else \ { \ - if (Dynarr_atp (cdla, 0)->modeline && Dynarr_atp (ddla, 0)->modeline) \ + if (Dynarr_begin (cdla)->modeline && Dynarr_begin (ddla)->modeline) \ { \ dla_start = 1; \ } \ - else if (!Dynarr_atp (cdla, 0)->modeline \ - && !Dynarr_atp (ddla, 0)->modeline) \ + else if (!Dynarr_begin (cdla)->modeline \ + && !Dynarr_begin (ddla)->modeline) \ { \ dla_start = 0; \ } \ @@ -6097,7 +6114,7 @@ display_line_dynarr *dla = window_display_lines (w, type); int first_line; - if (Dynarr_length (dla) && Dynarr_atp (dla, 0)->modeline) + if (Dynarr_length (dla) && Dynarr_begin (dla)->modeline) first_line = 1; else first_line = 0; @@ -6283,10 +6300,22 @@ } Fset_marker (w->pointm[DESIRED_DISP], make_int (pointm), the_buffer); + /* Added 2-1-10 -- we should never have empty face or glyph cachels + because we initialized them at startup and the only way to reduce + their number is through calling reset_face_cachels() or + reset_glyph_cachels(), which as a side effect sets up a number of + standard entries */ + assert (Dynarr_length (w->face_cachels)); + assert (Dynarr_length (w->glyph_cachels)); + /* If the buffer has changed we have to invalidate all of our face cache elements. */ if ((!echo_active && b != window_display_buffer (w)) +#if 0 + /* #### Delete this code sometime later than 2-1-10 when we're sure it's + not needed */ || !Dynarr_length (w->face_cachels) +#endif || f->faces_changed) reset_face_cachels (w); else @@ -6296,7 +6325,12 @@ the cache purely because glyphs have changed - this is now handled by the dirty flag.*/ if ((!echo_active && b != window_display_buffer (w)) - || !Dynarr_length (w->glyph_cachels) || f->faces_changed) +#if 0 + /* #### Delete this code sometime later than 2-1-10 when we're sure it's + not needed */ + || !Dynarr_length (w->glyph_cachels) +#endif + || f->faces_changed) reset_glyph_cachels (w); else mark_glyph_cachels_as_not_updated (w); @@ -7196,7 +7230,7 @@ line-number-mode is on. The first line in the buffer is counted as 1. If narrowing is in effect, the lines are counted from the beginning of the visible portion of the buffer. */ -static char * +static Ascbyte * window_line_number (struct window *w, int type) { struct device *d = XDEVICE (XFRAME (w->frame)->device); @@ -7216,7 +7250,7 @@ line = buffer_line_number (b, pos, 1); { - static char window_line_number_buf[DECIMAL_PRINT_SIZE (long)]; + static Ascbyte window_line_number_buf[DECIMAL_PRINT_SIZE (long)]; long_to_string (window_line_number_buf, line + 1); @@ -7241,7 +7275,7 @@ decode_mode_spec (struct window *w, Ichar spec, int type) { Lisp_Object obj = Qnil; - const char *str = NULL; + const Ascbyte *str = NULL; struct buffer *b = XBUFFER (w->buffer); Dynarr_reset (mode_spec_ibyte_string); @@ -7265,7 +7299,7 @@ ? BUF_PT (b) : marker_position (w->pointm[type]); int col = column_at_point (b, pt, 1) + !!column_number_start_at_one; - char buf[DECIMAL_PRINT_SIZE (long)]; + Ascbyte buf[DECIMAL_PRINT_SIZE (long)]; long_to_string (buf, col); @@ -7306,7 +7340,7 @@ if (FRAME_TTY_P (f) && f->order_count > 1 && f->order_count <= 99999999) { /* Naughty, naughty */ - char * writable_str = alloca_array (char, 10); + Ascbyte *writable_str = alloca_array (Ascbyte, 10); sprintf (writable_str, "-%d", f->order_count); str = writable_str; } @@ -7388,7 +7422,7 @@ { /* This hard limit is ok since the string it will hold has a fixed maximum length of 3. But just to be safe... */ - char buf[10]; + Ascbyte buf[10]; Charcount chars = pos - BUF_BEGV (b); Charcount total = BUF_ZV (b) - BUF_BEGV (b); @@ -7435,7 +7469,7 @@ { /* This hard limit is ok since the string it will hold has a fixed maximum length of around 6. But just to be safe... */ - char buf[10]; + Ascbyte buf[10]; Charcount chars = botpos - BUF_BEGV (b); Charcount total = BUF_ZV (b) - BUF_BEGV (b); @@ -7592,7 +7626,7 @@ { if (gba) { - glyph_block *gb = Dynarr_atp (gba, 0); + glyph_block *gb = Dynarr_begin (gba); glyph_block *gb_last = Dynarr_past_lastp (gba); for (; gb < gb_last; gb++) @@ -7727,7 +7761,7 @@ if (!Dynarr_length (cache)) return -1; else - return Dynarr_atp (cache, 0)->start; + return Dynarr_begin (cache)->start; } /* Return the very last buffer position contained in the given @@ -8222,7 +8256,7 @@ on that assert. So we have no option but to continue the search if we found point at the top of the line_start_cache again. */ - cur_pos = Dynarr_atp (w->line_start_cache,0)->start; + cur_pos = Dynarr_begin (w->line_start_cache)->start; } prev_pos = cur_pos; } @@ -8399,7 +8433,7 @@ if (!Dynarr_length (cache)) { - Dynarr_add_many (cache, Dynarr_atp (internal_cache, 0), + Dynarr_add_many (cache, Dynarr_begin (internal_cache), Dynarr_length (internal_cache)); w->line_cache_validation_override--; return; @@ -8429,13 +8463,13 @@ if (!(ic_elt >= 0)) { Dynarr_reset (cache); - Dynarr_add_many (cache, Dynarr_atp (internal_cache, 0), + Dynarr_add_many (cache, Dynarr_begin (internal_cache), Dynarr_length (internal_cache)); w->line_cache_validation_override--; return; } - Dynarr_insert_many_at_start (cache, Dynarr_atp (internal_cache, 0), + Dynarr_insert_many_at_start (cache, Dynarr_begin (internal_cache), ic_elt + 1); } @@ -8454,7 +8488,7 @@ if (!(ic_elt < Dynarr_length (internal_cache))) { Dynarr_reset (cache); - Dynarr_add_many (cache, Dynarr_atp (internal_cache, 0), + Dynarr_add_many (cache, Dynarr_begin (internal_cache), Dynarr_length (internal_cache)); w->line_cache_validation_override--; return; @@ -8486,7 +8520,7 @@ to layout a single line. This is not possible since we force at least a single line to be layout for CMOTION_DISP */ assert (Dynarr_length (internal_cache)); - assert (startp == Dynarr_atp (internal_cache, 0)->start); + assert (startp == Dynarr_begin (internal_cache)->start); ic_elt = Dynarr_length (internal_cache) - 1; if (low_bound != -1) @@ -8521,7 +8555,7 @@ if (ic_elt >= 0) /* we still have lines to add.. */ { - Dynarr_insert_many (cache, Dynarr_atp (internal_cache, 0), + Dynarr_insert_many (cache, Dynarr_begin (internal_cache), ic_elt + 1, marker); marker += (ic_elt + 1); } @@ -8556,7 +8590,7 @@ /* See comment above about regenerate_window failing. */ assert (Dynarr_length (internal_cache)); - Dynarr_add_many (cache, Dynarr_atp (internal_cache, 0), + Dynarr_add_many (cache, Dynarr_begin (internal_cache), Dynarr_length (internal_cache)); high_bound = Dynarr_lastp (cache)->end; startp = high_bound + 1; @@ -8601,7 +8635,7 @@ modeline = 0; if (num_disp_lines) { - if (Dynarr_atp (dla, 0)->modeline) + if (Dynarr_begin (dla)->modeline) { num_disp_lines--; modeline = 1; @@ -9058,9 +9092,9 @@ if (x_check <= left_bound) { if (dl->modeline) - *modeline_closest = Dynarr_atp (db->runes, 0)->charpos; + *modeline_closest = Dynarr_begin (db->runes)->charpos; else - *closest = Dynarr_atp (db->runes, 0)->charpos; + *closest = Dynarr_begin (db->runes)->charpos; } else { @@ -9838,7 +9872,7 @@ void vars_of_redisplay (void) { - QSin_redisplay = build_msg_string ("(in redisplay)"); + QSin_redisplay = build_defer_string ("(in redisplay)"); staticpro (&QSin_redisplay); Vpost_redisplay_actions = Qnil; diff -r d2ec55325515 -r 8f0cf4fd3d2c src/regex.c --- a/src/regex.c Sat Feb 06 03:59:18 2010 -0600 +++ b/src/regex.c Sat Feb 06 04:01:46 2010 -0600 @@ -257,7 +257,7 @@ #define ALLOCA alloca #define xmalloc malloc #define xrealloc realloc -#define xfree(x,type) free (x) +#define xfree free #endif #ifdef emacs @@ -363,7 +363,7 @@ #define REGEX_ALLOCATE_STACK xmalloc #define REGEX_REALLOCATE_STACK(source, osize, nsize) xrealloc (source, nsize) -#define REGEX_FREE_STACK(arg) xfree (arg, fail_stack_elt_t *) +#define REGEX_FREE_STACK(arg) xfree (arg) #else /* not REGEX_MALLOC */ @@ -2096,7 +2096,7 @@ #define FREE_STACK_RETURN(value) \ do \ { \ - xfree (compile_stack.stack, compile_stack_elt_t *); \ + xfree (compile_stack.stack); \ return value; \ } while (0) @@ -3399,7 +3399,7 @@ if (syntax & RE_NO_POSIX_BACKTRACKING) BUF_PUSH (succeed); - xfree (compile_stack.stack, compile_stack_elt_t *); + xfree (compile_stack.stack); /* We have succeeded; set the length of the buffer. */ bufp->used = buf_end - bufp->buffer; @@ -6950,8 +6950,8 @@ } /* If we needed the temporary register info, free the space now. */ - xfree (regs.start, regoff_t *); - xfree (regs.end, regoff_t *); + xfree (regs.start); + xfree (regs.end); } /* We want zero return to mean success, unlike `re_search'. */ @@ -7003,19 +7003,19 @@ regfree (regex_t *preg) { if (preg->buffer != NULL) - xfree (preg->buffer, unsigned char *); + xfree (preg->buffer); preg->buffer = NULL; preg->allocated = 0; preg->used = 0; if (preg->fastmap != NULL) - xfree (preg->fastmap, char *); + xfree (preg->fastmap); preg->fastmap = NULL; preg->fastmap_accurate = 0; if (preg->translate != NULL) - xfree (preg->translate, RE_TRANSLATE_TYPE); + xfree (preg->translate); preg->translate = NULL; } diff -r d2ec55325515 -r 8f0cf4fd3d2c src/s/mach-bsd4-3.h --- a/src/s/mach-bsd4-3.h Sat Feb 06 03:59:18 2010 -0600 +++ b/src/s/mach-bsd4-3.h Sat Feb 06 04:01:46 2010 -0600 @@ -1,3 +1,23 @@ +/* Definitions file for XEmacs running on Mach (BSD 4.3) + Copyright (C) 1985, 1986, 1993 Free Software Foundation, 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., 51 Franklin St. - Fifth Floor, +Boston, MA 02110-1301, USA. */ + /* Synched up with: FSF 19.31. */ /* I don't care if this doesn't do more than including bsd4-3.h; diff -r d2ec55325515 -r 8f0cf4fd3d2c src/s/sco7.h --- a/src/s/sco7.h Sat Feb 06 03:59:18 2010 -0600 +++ b/src/s/sco7.h Sat Feb 06 04:01:46 2010 -0600 @@ -1,6 +1,24 @@ -/* Synched up with: FSF 19.31. */ +/* Definitions file for XEmacs running on SCO System V release 4.2 + Copyright (C) 1999 Ron Record + +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. -/* s/ file for System V release 4.2. */ +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., 51 Franklin St. - Fifth Floor, +Boston, MA 02110-1301, USA. */ + +/* Synched up with: FSF 19.31. */ #include "usg5-4.h" diff -r d2ec55325515 -r 8f0cf4fd3d2c src/scrollbar-gtk.c --- a/src/scrollbar-gtk.c Sat Feb 06 03:59:18 2010 -0600 +++ b/src/scrollbar-gtk.c Sat Feb 06 04:01:46 2010 -0600 @@ -64,7 +64,7 @@ gtk_widget_destroy (SCROLLBAR_GTK_WIDGET (instance)); } - xfree (instance->scrollbar_data, void *); + xfree (instance->scrollbar_data); } } diff -r d2ec55325515 -r 8f0cf4fd3d2c src/scrollbar-msw.c --- a/src/scrollbar-msw.c Sat Feb 06 03:59:18 2010 -0600 +++ b/src/scrollbar-msw.c Sat Feb 06 04:01:46 2010 -0600 @@ -101,7 +101,7 @@ ptr = Fremhash (ptr, Vmswindows_scrollbar_instance_table); assert (!NILP (ptr)); DestroyWindow (SCROLLBAR_MSW_HANDLE (sb)); - xfree (sb->scrollbar_data, void *); + xfree (sb->scrollbar_data); } } diff -r d2ec55325515 -r 8f0cf4fd3d2c src/scrollbar-x.c --- a/src/scrollbar-x.c Sat Feb 06 03:59:18 2010 -0600 +++ b/src/scrollbar-x.c Sat Feb 06 04:01:46 2010 -0600 @@ -75,7 +75,7 @@ if (instance->scrollbar_data) { if (SCROLLBAR_X_NAME (instance)) - xfree (SCROLLBAR_X_NAME (instance), char *); + xfree (SCROLLBAR_X_NAME (instance)); if (SCROLLBAR_X_WIDGET (instance)) { @@ -85,7 +85,7 @@ lw_destroy_all_widgets (SCROLLBAR_X_ID (instance)); } - xfree (instance->scrollbar_data, void *); + xfree (instance->scrollbar_data); } } diff -r d2ec55325515 -r 8f0cf4fd3d2c src/search.c --- a/src/search.c Sat Feb 06 03:59:18 2010 -0600 +++ b/src/search.c Sat Feb 06 04:01:46 2010 -0600 @@ -184,7 +184,7 @@ re_set_syntax (old); if (val) { - maybe_signal_error (Qinvalid_regexp, 0, build_string (val), + maybe_signal_error (Qinvalid_regexp, 0, build_cistring (val), Qsearch, errb); return 0; } @@ -2247,7 +2247,7 @@ } if (WORD_SYNTAX_P (syntax_table, string_ichar (string, len - 1))) word_count++; - if (!word_count) return build_string (""); + if (!word_count) return build_ascstring (""); { /* The following value is an upper bound on the amount of storage we @@ -2905,7 +2905,7 @@ /* replacement can be nil. */ if (NILP (replacement)) - replacement = build_string (""); + replacement = build_ascstring (""); if (case_action == all_caps) replacement = Fupcase (replacement, buffer); diff -r d2ec55325515 -r 8f0cf4fd3d2c src/select-common.h --- a/src/select-common.h Sat Feb 06 03:59:18 2010 -0600 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,343 +0,0 @@ -/* Selection processing for XEmacs -- common btwn select-x.c and select-gtk.c - Copyright (C) 1990, 1991, 1992, 1993, 1994 Free Software Foundation, 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: Not synched with FSF. */ - -#ifdef PROCESSING_X_CODE -#define XE_ATOM_TYPE Atom -#define XE_ATOM_TO_SYMBOL x_atom_to_symbol -#define XE_SYMBOL_TO_ATOM symbol_to_x_atom -#else -#define XE_ATOM_TYPE GdkAtom -#define XE_ATOM_TO_SYMBOL atom_to_symbol -#define XE_SYMBOL_TO_ATOM symbol_to_gtk_atom -#endif /* PROCESSING_X_CODE */ - -/* #### These are going to move into Lisp code(!) with the aid of - some new functions I'm working on - ajh */ - -/* These functions convert from the selection data read from the server into - something that we can use from elisp, and vice versa. - - Type: Format: Size: Elisp Type: - ----- ------- ----- ----------- - * 8 * String - ATOM 32 1 Symbol - ATOM 32 > 1 Vector of Symbols - * 16 1 Integer - * 16 > 1 Vector of Integers - * 32 1 if <=16 bits: Integer - if > 16 bits: Cons of top16, bot16 - * 32 > 1 Vector of the above - - NOTE NOTE NOTE: - Format == 32 means that the buffer will be C longs, which need not be - 32-bit quantities. See the note in select-x.c (x_get_window_property). - - When converting a Lisp number to C, it is assumed to be of format 16 if - it is an integer, and of format 32 if it is a cons of two integers. - - When converting a vector of numbers from Elisp to C, it is assumed to be - of format 16 if every element in the vector is an integer, and is assumed - to be of format 32 if any element is a cons of two integers. - - When converting an object to C, it may be of the form (SYMBOL . ) - where SYMBOL is what we should claim that the type is. Format and - representation are as above. - - NOTE: Under Mule, when someone shoves us a string without a type, we - set the type to `COMPOUND_TEXT' and automatically convert to Compound - Text. If the string has a type, we assume that the user wants the - data sent as-is so we just do "binary" conversion. - */ - - -static Lisp_Object -selection_data_to_lisp_data (struct device *d, - Rawbyte *data, - Bytecount size, - XE_ATOM_TYPE type, - int format) -{ -#ifdef PROCESSING_X_CODE - if (type == DEVICE_XATOM_NULL (d)) - return QNULL; - - /* Convert any 8-bit data to a string, for compactness. */ - else if (format == 8) - return make_ext_string ((Extbyte *) data, size, - type == DEVICE_XATOM_TEXT (d) || - type == DEVICE_XATOM_COMPOUND_TEXT (d) - ? Qctext : Qbinary); - - /* Convert a single atom to a Lisp Symbol. - Convert a set of atoms to a vector of symbols. */ - else if (type == XA_ATOM) -#else - if (type == gdk_atom_intern ("NULL", 0)) - return QNULL; - - /* Convert any 8-bit data to a string, for compactness. */ - else if (format == 8) - return make_ext_string ((Extbyte *) data, size, - ((type == gdk_atom_intern ("TEXT", FALSE)) || - (type == gdk_atom_intern ("COMPOUND_TEXT", FALSE))) - ? Qctext : Qbinary); - - /* Convert a single atom to a Lisp Symbol. - Convert a set of atoms to a vector of symbols. */ - else if (type == gdk_atom_intern ("ATOM", FALSE)) -#endif /* PROCESSING_X_CODE */ - { - if (size == sizeof (XE_ATOM_TYPE)) - return XE_ATOM_TO_SYMBOL (d, *((XE_ATOM_TYPE *) data)); - else - { - Elemcount i; - Elemcount len = size / sizeof (XE_ATOM_TYPE); - Lisp_Object v = Fmake_vector (make_int (len), Qzero); - for (i = 0; i < len; i++) - Faset (v, make_int (i), XE_ATOM_TO_SYMBOL (d, ((XE_ATOM_TYPE *) data) [i])); - return v; - } - } - - /* Convert a single 16 or small 32 bit number to a Lisp Int. - If the number is > 16 bits, convert it to a cons of integers, - 16 bits in each half. - */ - else if (format == 32 && size == sizeof (long)) - return word_to_lisp (((unsigned long *) data) [0]); - else if (format == 16 && size == sizeof (short)) - return make_int ((int) (((unsigned short *) data) [0])); - - /* Convert any other kind of data to a vector of numbers, represented - as above (as an integer, or a cons of two 16 bit integers). - - #### Perhaps we should return the actual type to lisp as well. - - (x-get-selection-internal 'PRIMARY 'LINE_NUMBER) - ==> [4 4] - - and perhaps it should be - - (x-get-selection-internal 'PRIMARY 'LINE_NUMBER) - ==> (SPAN . [4 4]) - - Right now the fact that the return type was SPAN is discarded before - lisp code gets to see it. - */ - else if (format == 16) - { - Elemcount i; - Lisp_Object v = make_vector (size / 4, Qzero); - for (i = 0; i < size / 4; i++) - { - int j = (int) ((unsigned short *) data) [i]; - Faset (v, make_int (i), make_int (j)); - } - return v; - } - else - { - Elemcount i; - Lisp_Object v = make_vector (size / 4, Qzero); - for (i = 0; i < size / 4; i++) - { - unsigned long j = ((unsigned long *) data) [i]; - Faset (v, make_int (i), word_to_lisp (j)); - } - return v; - } -} - - -static void -lisp_data_to_selection_data (struct device *d, - Lisp_Object obj, - Rawbyte **data_ret, - XE_ATOM_TYPE *type_ret, - Bytecount *size_ret, - int *format_ret) -{ - Lisp_Object type = Qnil; - - if (CONSP (obj) && SYMBOLP (XCAR (obj))) - { - type = XCAR (obj); - obj = XCDR (obj); - if (CONSP (obj) && NILP (XCDR (obj))) - obj = XCAR (obj); - } - - if (EQ (obj, QNULL) || (EQ (type, QNULL))) - { /* This is not the same as declining */ - *format_ret = 32; - *size_ret = 0; - *data_ret = 0; - type = QNULL; - } - else if (STRINGP (obj)) - { - const Extbyte *extval; - Bytecount extvallen; - - TO_EXTERNAL_FORMAT (LISP_STRING, obj, - ALLOCA, (extval, extvallen), - (NILP (type) ? Qctext : Qbinary)); - *format_ret = 8; - *size_ret = extvallen; - *data_ret = xnew_rawbytes (*size_ret); - memcpy (*data_ret, extval, *size_ret); -#ifdef MULE - if (NILP (type)) type = QCOMPOUND_TEXT; -#else - if (NILP (type)) type = QSTRING; -#endif - } - else if (CHARP (obj)) - { - Ibyte buf[MAX_ICHAR_LEN]; - Bytecount len; - const Extbyte *extval; - Bytecount extvallen; - - *format_ret = 8; - len = set_itext_ichar (buf, XCHAR (obj)); - TO_EXTERNAL_FORMAT (DATA, (buf, len), - ALLOCA, (extval, extvallen), - Qctext); - *size_ret = extvallen; - *data_ret = xnew_rawbytes (*size_ret); - memcpy (*data_ret, extval, *size_ret); -#ifdef MULE - if (NILP (type)) type = QCOMPOUND_TEXT; -#else - if (NILP (type)) type = QSTRING; -#endif - } - else if (SYMBOLP (obj)) - { - *format_ret = 32; - *size_ret = 1; - *data_ret = xnew_rawbytes (sizeof (XE_ATOM_TYPE) + 1); - (*data_ret) [sizeof (XE_ATOM_TYPE)] = 0; - (*(XE_ATOM_TYPE **) data_ret) [0] = XE_SYMBOL_TO_ATOM (d, obj, 0); - if (NILP (type)) type = QATOM; - } - else if (INTP (obj) && - XINT (obj) <= 0x7FFF && - XINT (obj) >= -0x8000) - { - *format_ret = 16; - *size_ret = 1; - *data_ret = xnew_rawbytes (sizeof (short) + 1); - (*data_ret) [sizeof (short)] = 0; - (*(short **) data_ret) [0] = (short) XINT (obj); - if (NILP (type)) type = QINTEGER; - } - else if (INTP (obj) || CONSP (obj)) - { - *format_ret = 32; - *size_ret = 1; - *data_ret = xnew_rawbytes (sizeof (long) + 1); - (*data_ret) [sizeof (long)] = 0; - (*(unsigned long **) data_ret) [0] = lisp_to_word (obj); - if (NILP (type)) type = QINTEGER; - } - else if (VECTORP (obj)) - { - /* Lisp Vectors may represent a set of ATOMs; - a set of 16 or 32 bit INTEGERs; - or a set of ATOM_PAIRs (represented as [[A1 A2] [A3 A4] ...] - */ - Elemcount i; - - if (SYMBOLP (XVECTOR_DATA (obj) [0])) - /* This vector is an ATOM set */ - { - if (NILP (type)) type = QATOM; - *size_ret = XVECTOR_LENGTH (obj); - *format_ret = 32; - *data_ret = xnew_rawbytes ((*size_ret) * sizeof (XE_ATOM_TYPE)); - for (i = 0; i < *size_ret; i++) - if (SYMBOLP (XVECTOR_DATA (obj) [i])) - (*(XE_ATOM_TYPE **) data_ret) [i] = - XE_SYMBOL_TO_ATOM (d, XVECTOR_DATA (obj) [i], 0); - else - syntax_error - ("all elements of the vector must be of the same type", obj); - } -#if 0 /* #### MULTIPLE doesn't work yet */ - else if (VECTORP (XVECTOR_DATA (obj) [0])) - /* This vector is an ATOM_PAIR set */ - { - if (NILP (type)) type = QATOM_PAIR; - *size_ret = XVECTOR_LENGTH (obj); - *format_ret = 32; - *data_ret = - xnew_rawbytes ((*size_ret) * sizeof (XE_ATOM_TYPE) * 2); - for (i = 0; i < *size_ret; i++) - if (VECTORP (XVECTOR_DATA (obj) [i])) - { - Lisp_Object pair = XVECTOR_DATA (obj) [i]; - if (XVECTOR_LENGTH (pair) != 2) - syntax_error - ("elements of the vector must be vectors of exactly two elements", pair); - - (*(XE_ATOM_TYPE **) data_ret) [i * 2] = - XE_SYMBOL_TO_ATOM (d, XVECTOR_DATA (pair) [0], 0); - (*(XE_ATOM_TYPE **) data_ret) [(i * 2) + 1] = - XE_SYMBOL_TO_ATOM (d, XVECTOR_DATA (pair) [1], 0); - } - else - syntax_error - ("all elements of the vector must be of the same type", obj); - } -#endif - else - /* This vector is an INTEGER set, or something like it */ - { - *size_ret = XVECTOR_LENGTH (obj); - if (NILP (type)) type = QINTEGER; - *format_ret = 16; - for (i = 0; i < *size_ret; i++) - if (CONSP (XVECTOR_DATA (obj) [i])) - *format_ret = 32; - else if (!INTP (XVECTOR_DATA (obj) [i])) - syntax_error - ("all elements of the vector must be integers or conses of integers", obj); - - *data_ret = xnew_rawbytes (*size_ret * (*format_ret/8)); - for (i = 0; i < *size_ret; i++) - if (*format_ret == 32) - (*((unsigned long **) data_ret)) [i] = - lisp_to_word (XVECTOR_DATA (obj) [i]); - else - (*((unsigned short **) data_ret)) [i] = - (unsigned short) lisp_to_word (XVECTOR_DATA (obj) [i]); - } - } - else - invalid_argument ("unrecognized selection data", obj); - - *type_ret = XE_SYMBOL_TO_ATOM (d, type, 0); -} - diff -r d2ec55325515 -r 8f0cf4fd3d2c src/select-gtk.c --- a/src/select-gtk.c Sat Feb 06 03:59:18 2010 -0600 +++ b/src/select-gtk.c Sat Feb 06 04:01:46 2010 -0600 @@ -59,7 +59,7 @@ { const Extbyte *nameext; - LISP_STRING_TO_EXTERNAL (Fsymbol_name (sym), nameext, Qctext); + nameext = LISP_STRING_TO_EXTERNAL (Fsymbol_name (sym), Qctext); return gdk_atom_intern (nameext, only_if_exists ? TRUE : FALSE); } } @@ -76,15 +76,15 @@ if (! str) return Qnil; - EXTERNAL_TO_C_STRING (str, intstr, Qctext); + intstr = EXTERNAL_TO_ITEXT (str, Qctext); g_free (str); - return intern_int (intstr); + return intern_istring (intstr); } } -#define PROCESSING_GTK_CODE -#include "select-common.h" -#undef PROCESSING_GTK_CODE +#define THIS_IS_GTK +#include "select-xlike-inc.c" +#undef THIS_IS_GTK /* Set the selection data to GDK_NONE and NULL data, meaning we were @@ -213,7 +213,7 @@ successful_p = Qt; /* Tell x_selection_request_lisp_error() it's cool. */ cl->successful = TRUE; - xfree (data, Rawbyte *); + xfree (data); } unbind_to (count); @@ -221,7 +221,7 @@ DONE_LABEL: if (cl) - xfree (cl, struct _selection_closure *); + xfree (cl); UNGCPRO; diff -r d2ec55325515 -r 8f0cf4fd3d2c src/select-msw.c --- a/src/select-msw.c Sat Feb 06 03:59:18 2010 -0600 +++ b/src/select-msw.c Sat Feb 06 04:01:46 2010 -0600 @@ -109,7 +109,7 @@ if (STRINGP (value)) { Extbyte *valext; - LISP_STRING_TO_TSTR (value, valext); + valext = LISP_STRING_TO_TSTR (value); return qxeRegisterClipboardFormat (valext); } @@ -324,7 +324,7 @@ { CloseClipboard (); - xfree (src, void *); + xfree (src); return Qnil; } @@ -335,12 +335,12 @@ GlobalFree (hValue); CloseClipboard (); - xfree (src, void *); + xfree (src); return Qnil; } memcpy (dst, src, size); - xfree (src, void *); + xfree (src); GlobalUnlock (hValue); @@ -438,7 +438,7 @@ Extbyte *nameext; UINT format; - LISP_STRING_TO_TSTR (type_name, nameext); + nameext = LISP_STRING_TO_TSTR (type_name); format = qxeRegisterClipboardFormat (nameext); if (format) @@ -561,7 +561,7 @@ } /* Place it in a Lisp string */ - ret = make_ext_string ((Extbyte *) data, size, Qbinary); + ret = make_extstring ((Extbyte *) data, size, Qbinary); GlobalUnlock (data); CloseClipboard (); diff -r d2ec55325515 -r 8f0cf4fd3d2c src/select-x.c --- a/src/select-x.c Sat Feb 06 03:59:18 2010 -0600 +++ b/src/select-x.c Sat Feb 06 04:01:46 2010 -0600 @@ -139,7 +139,7 @@ { const Extbyte *nameext; - LISP_STRING_TO_EXTERNAL (Fsymbol_name (sym), nameext, Qctext); + nameext = LISP_STRING_TO_EXTERNAL (Fsymbol_name (sym), Qctext); return XInternAtom (display, nameext, only_if_exists ? True : False); } } @@ -188,17 +188,15 @@ if (! str) return Qnil; - TO_INTERNAL_FORMAT (C_STRING, str, - C_STRING_ALLOCA, intstr, - Qctext); + intstr = EXTERNAL_TO_ITEXT (str, Qctext); XFree (str); - return intern_int (intstr); + return intern_istring (intstr); } } -#define PROCESSING_X_CODE -#include "select-common.h" -#undef PROCESSING_X_CODE +#define THIS_IS_X +#include "select-xlike-inc.c" +#undef THIS_IS_X /* Do protocol to assert ourself as a selection owner. */ @@ -339,14 +337,12 @@ } if (chartypes == LATIN_1) - TO_EXTERNAL_FORMAT (LISP_STRING, selection_value, - ALLOCA, (data, bytes), - Qbinary); + LISP_STRING_TO_SIZED_EXTERNAL (selection_value, data, bytes, + Qbinary); else if (chartypes == WORLD) { - TO_EXTERNAL_FORMAT (LISP_STRING, selection_value, - ALLOCA, (data, bytes), - Qctext); + LISP_STRING_TO_SIZED_EXTERNAL (selection_value, data, bytes, + Qctext); encoding = "COMPOUND_TEXT"; } } @@ -697,7 +693,7 @@ lisp/select.el . */ if ((Rawbyte *)0 != data) { - xfree (data, Rawbyte *); + xfree (data); } } @@ -827,7 +823,7 @@ prev->next = rest->next; else for_whom_the_bell_tolls = rest->next; - xfree (rest, struct prop_location *); + xfree (rest); return; } prev = rest; @@ -868,7 +864,7 @@ prev->next = rest->next; else for_whom_the_bell_tolls = rest->next; - xfree (rest, struct prop_location *); + xfree (rest); return; } prev = rest; @@ -1171,7 +1167,7 @@ #endif unexpect_property_change (prop_id); if (tmp_data) - xfree (tmp_data, Rawbyte *); + xfree (tmp_data); break; } #if 0 @@ -1188,7 +1184,7 @@ } memcpy ((*data_ret) + offset, tmp_data, tmp_size_bytes); offset += tmp_size_bytes; - xfree (tmp_data, Rawbyte *); + xfree (tmp_data); } } @@ -1237,7 +1233,7 @@ Bytecount min_size_bytes = /* careful here. */ (Bytecount) (* ((unsigned int *) data)); - xfree (data, Rawbyte *); + xfree (data); receive_incremental_selection (display, window, property, target_type, min_size_bytes, &data, &bytes, &actual_type, &actual_format, @@ -1249,7 +1245,7 @@ val = selection_data_to_lisp_data (d, data, bytes, actual_type, actual_format); - xfree (data, Rawbyte *); + xfree (data); return val; } @@ -1377,11 +1373,11 @@ COMPOUND_TEXT that we stored there ourselves earlier, in x-store-cutbuffer-internal */ ret = (bytes ? - make_ext_string ((Extbyte *) data, bytes, + make_extstring ((Extbyte *) data, bytes, memchr (data, 0x1b, bytes) ? Qctext : Qbinary) : Qnil); - xfree (data, Rawbyte *); + xfree (data); return ret; } @@ -1442,13 +1438,9 @@ } if (chartypes == LATIN_1) - TO_EXTERNAL_FORMAT (LISP_STRING, string, - ALLOCA, (data, bytes), - Qbinary); + LISP_STRING_TO_SIZED_EXTERNAL (string, data, bytes, Qbinary); else if (chartypes == WORLD) - TO_EXTERNAL_FORMAT (LISP_STRING, string, - ALLOCA, (data, bytes), - Qctext); + LISP_STRING_TO_SIZED_EXTERNAL (string, data, bytes, Qctext); #endif /* MULE */ bytes_remaining = bytes; diff -r d2ec55325515 -r 8f0cf4fd3d2c src/select-xlike-inc.c --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/src/select-xlike-inc.c Sat Feb 06 04:01:46 2010 -0600 @@ -0,0 +1,342 @@ +/* Selection processing for XEmacs -- common btwn select-x.c and select-gtk.c + Copyright (C) 1990, 1991, 1992, 1993, 1994 Free Software Foundation, 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: Not synched with FSF. */ + +#ifdef THIS_IS_X +#define XE_ATOM_TYPE Atom +#define XE_ATOM_TO_SYMBOL x_atom_to_symbol +#define XE_SYMBOL_TO_ATOM symbol_to_x_atom +#else +#define XE_ATOM_TYPE GdkAtom +#define XE_ATOM_TO_SYMBOL atom_to_symbol +#define XE_SYMBOL_TO_ATOM symbol_to_gtk_atom +#endif /* THIS_IS_X */ + +/* #### These are going to move into Lisp code(!) with the aid of + some new functions I'm working on - ajh */ + +/* These functions convert from the selection data read from the server into + something that we can use from elisp, and vice versa. + + Type: Format: Size: Elisp Type: + ----- ------- ----- ----------- + * 8 * String + ATOM 32 1 Symbol + ATOM 32 > 1 Vector of Symbols + * 16 1 Integer + * 16 > 1 Vector of Integers + * 32 1 if <=16 bits: Integer + if > 16 bits: Cons of top16, bot16 + * 32 > 1 Vector of the above + + NOTE NOTE NOTE: + Format == 32 means that the buffer will be C longs, which need not be + 32-bit quantities. See the note in select-x.c (x_get_window_property). + + When converting a Lisp number to C, it is assumed to be of format 16 if + it is an integer, and of format 32 if it is a cons of two integers. + + When converting a vector of numbers from Elisp to C, it is assumed to be + of format 16 if every element in the vector is an integer, and is assumed + to be of format 32 if any element is a cons of two integers. + + When converting an object to C, it may be of the form (SYMBOL . ) + where SYMBOL is what we should claim that the type is. Format and + representation are as above. + + NOTE: Under Mule, when someone shoves us a string without a type, we + set the type to `COMPOUND_TEXT' and automatically convert to Compound + Text. If the string has a type, we assume that the user wants the + data sent as-is so we just do "binary" conversion. + */ + + +static Lisp_Object +selection_data_to_lisp_data (struct device *d, + Rawbyte *data, + Bytecount size, + XE_ATOM_TYPE type, + int format) +{ +#ifdef THIS_IS_X + if (type == DEVICE_XATOM_NULL (d)) + return QNULL; + + /* Convert any 8-bit data to a string, for compactness. */ + else if (format == 8) + return make_extstring ((Extbyte *) data, size, + type == DEVICE_XATOM_TEXT (d) || + type == DEVICE_XATOM_COMPOUND_TEXT (d) + ? Qctext : Qbinary); + + /* Convert a single atom to a Lisp Symbol. + Convert a set of atoms to a vector of symbols. */ + else if (type == XA_ATOM) +#else + if (type == gdk_atom_intern ("NULL", 0)) + return QNULL; + + /* Convert any 8-bit data to a string, for compactness. */ + else if (format == 8) + return make_extstring ((Extbyte *) data, size, + ((type == gdk_atom_intern ("TEXT", FALSE)) || + (type == gdk_atom_intern ("COMPOUND_TEXT", FALSE))) + ? Qctext : Qbinary); + + /* Convert a single atom to a Lisp Symbol. + Convert a set of atoms to a vector of symbols. */ + else if (type == gdk_atom_intern ("ATOM", FALSE)) +#endif /* THIS_IS_X */ + { + if (size == sizeof (XE_ATOM_TYPE)) + return XE_ATOM_TO_SYMBOL (d, *((XE_ATOM_TYPE *) data)); + else + { + Elemcount i; + Elemcount len = size / sizeof (XE_ATOM_TYPE); + Lisp_Object v = Fmake_vector (make_int (len), Qzero); + for (i = 0; i < len; i++) + Faset (v, make_int (i), XE_ATOM_TO_SYMBOL (d, ((XE_ATOM_TYPE *) data) [i])); + return v; + } + } + + /* Convert a single 16 or small 32 bit number to a Lisp Int. + If the number is > 16 bits, convert it to a cons of integers, + 16 bits in each half. + */ + else if (format == 32 && size == sizeof (long)) + return word_to_lisp (((unsigned long *) data) [0]); + else if (format == 16 && size == sizeof (short)) + return make_int ((int) (((unsigned short *) data) [0])); + + /* Convert any other kind of data to a vector of numbers, represented + as above (as an integer, or a cons of two 16 bit integers). + + #### Perhaps we should return the actual type to lisp as well. + + (x-get-selection-internal 'PRIMARY 'LINE_NUMBER) + ==> [4 4] + + and perhaps it should be + + (x-get-selection-internal 'PRIMARY 'LINE_NUMBER) + ==> (SPAN . [4 4]) + + Right now the fact that the return type was SPAN is discarded before + lisp code gets to see it. + */ + else if (format == 16) + { + Elemcount i; + Lisp_Object v = make_vector (size / 4, Qzero); + for (i = 0; i < size / 4; i++) + { + int j = (int) ((unsigned short *) data) [i]; + Faset (v, make_int (i), make_int (j)); + } + return v; + } + else + { + Elemcount i; + Lisp_Object v = make_vector (size / 4, Qzero); + for (i = 0; i < size / 4; i++) + { + unsigned long j = ((unsigned long *) data) [i]; + Faset (v, make_int (i), word_to_lisp (j)); + } + return v; + } +} + + +static void +lisp_data_to_selection_data (struct device *d, + Lisp_Object obj, + Rawbyte **data_ret, + XE_ATOM_TYPE *type_ret, + Bytecount *size_ret, + int *format_ret) +{ + Lisp_Object type = Qnil; + + if (CONSP (obj) && SYMBOLP (XCAR (obj))) + { + type = XCAR (obj); + obj = XCDR (obj); + if (CONSP (obj) && NILP (XCDR (obj))) + obj = XCAR (obj); + } + + if (EQ (obj, QNULL) || (EQ (type, QNULL))) + { /* This is not the same as declining */ + *format_ret = 32; + *size_ret = 0; + *data_ret = 0; + type = QNULL; + } + else if (STRINGP (obj)) + { + const Extbyte *extval; + Bytecount extvallen; + + LISP_STRING_TO_SIZED_EXTERNAL (obj, extval, extvallen, + (NILP (type) ? Qctext : Qbinary)); + *format_ret = 8; + *size_ret = extvallen; + *data_ret = xnew_rawbytes (*size_ret); + memcpy (*data_ret, extval, *size_ret); +#ifdef MULE + if (NILP (type)) type = QCOMPOUND_TEXT; +#else + if (NILP (type)) type = QSTRING; +#endif + } + else if (CHARP (obj)) + { + Ibyte buf[MAX_ICHAR_LEN]; + Bytecount len; + const Extbyte *extval; + Bytecount extvallen; + + *format_ret = 8; + len = set_itext_ichar (buf, XCHAR (obj)); + TO_EXTERNAL_FORMAT (DATA, (buf, len), + ALLOCA, (extval, extvallen), + Qctext); + *size_ret = extvallen; + *data_ret = xnew_rawbytes (*size_ret); + memcpy (*data_ret, extval, *size_ret); +#ifdef MULE + if (NILP (type)) type = QCOMPOUND_TEXT; +#else + if (NILP (type)) type = QSTRING; +#endif + } + else if (SYMBOLP (obj)) + { + *format_ret = 32; + *size_ret = 1; + *data_ret = xnew_rawbytes (sizeof (XE_ATOM_TYPE) + 1); + (*data_ret) [sizeof (XE_ATOM_TYPE)] = 0; + (*(XE_ATOM_TYPE **) data_ret) [0] = XE_SYMBOL_TO_ATOM (d, obj, 0); + if (NILP (type)) type = QATOM; + } + else if (INTP (obj) && + XINT (obj) <= 0x7FFF && + XINT (obj) >= -0x8000) + { + *format_ret = 16; + *size_ret = 1; + *data_ret = xnew_rawbytes (sizeof (short) + 1); + (*data_ret) [sizeof (short)] = 0; + (*(short **) data_ret) [0] = (short) XINT (obj); + if (NILP (type)) type = QINTEGER; + } + else if (INTP (obj) || CONSP (obj)) + { + *format_ret = 32; + *size_ret = 1; + *data_ret = xnew_rawbytes (sizeof (long) + 1); + (*data_ret) [sizeof (long)] = 0; + (*(unsigned long **) data_ret) [0] = lisp_to_word (obj); + if (NILP (type)) type = QINTEGER; + } + else if (VECTORP (obj)) + { + /* Lisp Vectors may represent a set of ATOMs; + a set of 16 or 32 bit INTEGERs; + or a set of ATOM_PAIRs (represented as [[A1 A2] [A3 A4] ...] + */ + Elemcount i; + + if (SYMBOLP (XVECTOR_DATA (obj) [0])) + /* This vector is an ATOM set */ + { + if (NILP (type)) type = QATOM; + *size_ret = XVECTOR_LENGTH (obj); + *format_ret = 32; + *data_ret = xnew_rawbytes ((*size_ret) * sizeof (XE_ATOM_TYPE)); + for (i = 0; i < *size_ret; i++) + if (SYMBOLP (XVECTOR_DATA (obj) [i])) + (*(XE_ATOM_TYPE **) data_ret) [i] = + XE_SYMBOL_TO_ATOM (d, XVECTOR_DATA (obj) [i], 0); + else + syntax_error + ("all elements of the vector must be of the same type", obj); + } +#if 0 /* #### MULTIPLE doesn't work yet */ + else if (VECTORP (XVECTOR_DATA (obj) [0])) + /* This vector is an ATOM_PAIR set */ + { + if (NILP (type)) type = QATOM_PAIR; + *size_ret = XVECTOR_LENGTH (obj); + *format_ret = 32; + *data_ret = + xnew_rawbytes ((*size_ret) * sizeof (XE_ATOM_TYPE) * 2); + for (i = 0; i < *size_ret; i++) + if (VECTORP (XVECTOR_DATA (obj) [i])) + { + Lisp_Object pair = XVECTOR_DATA (obj) [i]; + if (XVECTOR_LENGTH (pair) != 2) + syntax_error + ("elements of the vector must be vectors of exactly two elements", pair); + + (*(XE_ATOM_TYPE **) data_ret) [i * 2] = + XE_SYMBOL_TO_ATOM (d, XVECTOR_DATA (pair) [0], 0); + (*(XE_ATOM_TYPE **) data_ret) [(i * 2) + 1] = + XE_SYMBOL_TO_ATOM (d, XVECTOR_DATA (pair) [1], 0); + } + else + syntax_error + ("all elements of the vector must be of the same type", obj); + } +#endif + else + /* This vector is an INTEGER set, or something like it */ + { + *size_ret = XVECTOR_LENGTH (obj); + if (NILP (type)) type = QINTEGER; + *format_ret = 16; + for (i = 0; i < *size_ret; i++) + if (CONSP (XVECTOR_DATA (obj) [i])) + *format_ret = 32; + else if (!INTP (XVECTOR_DATA (obj) [i])) + syntax_error + ("all elements of the vector must be integers or conses of integers", obj); + + *data_ret = xnew_rawbytes (*size_ret * (*format_ret/8)); + for (i = 0; i < *size_ret; i++) + if (*format_ret == 32) + (*((unsigned long **) data_ret)) [i] = + lisp_to_word (XVECTOR_DATA (obj) [i]); + else + (*((unsigned short **) data_ret)) [i] = + (unsigned short) lisp_to_word (XVECTOR_DATA (obj) [i]); + } + } + else + invalid_argument ("unrecognized selection data", obj); + + *type_ret = XE_SYMBOL_TO_ATOM (d, type, 0); +} + diff -r d2ec55325515 -r 8f0cf4fd3d2c src/sheap.c --- a/src/sheap.c Sat Feb 06 03:59:18 2010 -0600 +++ b/src/sheap.c Sat Feb 06 04:01:46 2010 -0600 @@ -111,7 +111,7 @@ if (stream == NULL) report_file_error ("Opening sheap adjustment file", - build_string ("sheap-adjust.h")); + build_ascstring ("sheap-adjust.h")); fprintf (stream, "/*\tDo not edit this file!\n" diff -r d2ec55325515 -r 8f0cf4fd3d2c src/sound.c --- a/src/sound.c Sat Feb 06 03:59:18 2010 -0600 +++ b/src/sound.c Sat Feb 06 04:01:46 2010 -0600 @@ -98,9 +98,9 @@ Lisp_Object Qsound_error; DOESNT_RETURN -report_sound_error (const Ascbyte *string, Lisp_Object data) +report_sound_error (const Ascbyte *reason, Lisp_Object data) { - report_error_with_errno (Qsound_error, string, data); + report_error_with_errno (Qsound_error, reason, data); } DEFUN ("play-sound-file", Fplay_sound_file, 1, 3, "fSound file name: ", /* @@ -158,7 +158,7 @@ { Extbyte *fileext; - LISP_STRING_TO_EXTERNAL (file, fileext, Qfile_name); + LISP_PATHNAME_CONVERT_OUT (file, fileext); /* #### ALSA code should allow specification of a device. */ if (alsa_play_sound_file (fileext, vol)) return Qnil; @@ -170,7 +170,7 @@ { Extbyte *fileext; - LISP_STRING_TO_EXTERNAL (file, fileext, Qfile_name); + LISP_PATHNAME_CONVERT_OUT (file, fileext); /* #### NAS code should allow specification of a device. */ if (nas_play_sound_file (fileext, vol)) return Qnil; @@ -183,7 +183,7 @@ Extbyte *fileext; int result; - LISP_STRING_TO_EXTERNAL (file, fileext, Qfile_name); + LISP_PATHNAME_CONVERT_OUT (file, fileext); /* #### ESD uses alarm(). But why should we also stop SIGIO? */ stop_interrupts (); @@ -382,9 +382,7 @@ Binbyte *soundext; Bytecount soundextlen; - TO_EXTERNAL_FORMAT (LISP_STRING, sound, - ALLOCA, (soundext, soundextlen), - Qbinary); + LISP_STRING_TO_SIZED_EXTERNAL (sound, soundext, soundextlen, Qbinary); if (alsa_play_sound_data (soundext, soundextlen, vol)) return Qnil; } @@ -396,9 +394,7 @@ Binbyte *soundext; Bytecount soundextlen; - TO_EXTERNAL_FORMAT (LISP_STRING, sound, - ALLOCA, (soundext, soundextlen), - Qbinary); + LISP_STRING_TO_SIZED_EXTERNAL (sound, soundext, soundextlen, Qbinary); if (nas_play_sound_data (soundext, soundextlen, vol)) return Qnil; } @@ -411,8 +407,7 @@ Bytecount soundextlen; int succes; - TO_EXTERNAL_FORMAT (LISP_STRING, sound, ALLOCA, (soundext, soundextlen), - Qbinary); + LISP_STRING_TO_SIZED_EXTERNAL (sound, soundext, soundextlen, Qbinary); /* #### ESD uses alarm(). But why should we also stop SIGIO? */ stop_interrupts (); @@ -432,9 +427,7 @@ Bytecount soundextlen; int succes; - TO_EXTERNAL_FORMAT (LISP_STRING, sound, - ALLOCA, (soundext, soundextlen), - Qbinary); + LISP_STRING_TO_SIZED_EXTERNAL (sound, soundext, soundextlen, Qbinary); /* The sound code doesn't like getting SIGIO interrupts. Unix sucks! */ stop_interrupts (); succes = play_sound_data (soundext, soundextlen, vol); diff -r d2ec55325515 -r 8f0cf4fd3d2c src/sound.h --- a/src/sound.h Sat Feb 06 03:59:18 2010 -0600 +++ b/src/sound.h Sat Feb 06 04:01:46 2010 -0600 @@ -35,13 +35,12 @@ Ibyte *errmess; \ Ibyte *string_int; \ GET_STRERROR (errmess, errno); \ - EXTERNAL_TO_C_STRING (string, string_int, Qerror_message_encoding); \ + string_int = EXTERNAL_TO_ITEXT (string, Qerror_message_encoding); \ warn_when_safe (Qsound, Qerror, "audio: %s, %s", string_int, errmess); \ } while (0) # define sound_warn(string) \ do { \ Ibyte *string_int; \ - EXTERNAL_TO_C_STRING (GETTEXT (string), string_int, \ - Qerror_message_encoding); \ + string_int = EXTERNAL_TO_ITEXT (GETTEXT (string), Qerror_message_encoding); \ warn_when_safe (Qsound, Qwarning, "audio: %s", string_int); \ } while (0) diff -r d2ec55325515 -r 8f0cf4fd3d2c src/specifier.c --- a/src/specifier.c Sat Feb 06 03:59:18 2010 -0600 +++ b/src/specifier.c Sat Feb 06 04:01:46 2010 -0600 @@ -285,7 +285,7 @@ the_specs = Fspecifier_specs (obj, Qglobal, Qnil, Qnil); if (NILP (the_specs)) /* there are no global specs */ - write_c_string (printcharfun, ""); + write_ascstring (printcharfun, ""); else print_internal (the_specs, printcharfun, 1); if (!NILP (sp->fallback)) @@ -304,7 +304,7 @@ /* don't be snafued by the disksave finalization. */ if (!for_disksave && !GHOST_SPECIFIER_P(sp) && sp->caching) { - xfree (sp->caching, struct specifier_caching *); + xfree (sp->caching); sp->caching = 0; } } diff -r d2ec55325515 -r 8f0cf4fd3d2c src/symbols.c --- a/src/symbols.c Sat Feb 06 03:59:18 2010 -0600 +++ b/src/symbols.c Sat Feb 06 04:01:46 2010 -0600 @@ -1,6 +1,6 @@ /* "intern" and friends -- moved here from lread.c and data.c Copyright (C) 1985-1989, 1992-1994 Free Software Foundation, Inc. - Copyright (C) 1995, 2000, 2001, 2002 Ben Wing. + Copyright (C) 1995, 2000, 2001, 2002, 2010 Ben Wing. This file is part of XEmacs. @@ -54,6 +54,8 @@ #include #include "lisp.h" +#include "bytecode.h" /* for COMPILED_FUNCTION_ANNOTATION_HACK, + defined in bytecode.h and used here. */ #include "buffer.h" /* for Vbuffer_defaults */ #include "console-impl.h" #include "elhash.h" @@ -177,7 +179,7 @@ } Lisp_Object -intern_int (const Ibyte *str) +intern_istring (const Ibyte *str) { Bytecount len = qxestrlen (str); Lisp_Object obarray = Vobarray; @@ -197,7 +199,7 @@ Lisp_Object intern (const CIbyte *str) { - return intern_int ((Ibyte *) str); + return intern_istring ((Ibyte *) str); } Lisp_Object @@ -210,7 +212,7 @@ for (i = 0; i < len; i++) if (tmp[i] == '_') tmp[i] = '-'; - return intern_int ((Ibyte *) tmp); + return intern_istring ((Ibyte *) tmp); } DEFUN ("intern", Fintern, 1, 2, 0, /* @@ -716,12 +718,19 @@ DEFUN ("define-function", Fdefine_function, 2, 2, 0, /* Set SYMBOL's function definition to NEWDEF, and return NEWDEF. Associates the function with the current load file, if any. +If NEWDEF is a compiled-function object, stores the function name in +the `annotated' slot of the compiled-function (retrievable using +`compiled-function-annotation'). */ (symbol, newdef)) { /* This function can GC */ Ffset (symbol, newdef); LOADHIST_ATTACH (Fcons (Qdefun, symbol)); +#ifdef COMPILED_FUNCTION_ANNOTATION_HACK + if (COMPILED_FUNCTIONP (newdef)) + XCOMPILED_FUNCTION (newdef)->annotated = symbol; +#endif /* COMPILED_FUNCTION_ANNOTATION_HACK */ return newdef; } @@ -731,7 +740,7 @@ */ (subr)) { - const char *name; + const Ascbyte *name; CHECK_SUBR (subr); name = XSUBR (subr)->name; @@ -774,6 +783,65 @@ /* symbol-value */ /**********************************************************************/ +/* + NOTE NOTE NOTE: + --------------- + + There are various different uses of "magic" with regard to symbols, + and they need to be distinguished: + + 1. `symbol-value-magic' class of objects (struct symbol_value_magic): + A set of Lisp object types used as the value of a variable with any + behavior other than just a plain repository of a value. This + includes buffer-local variables, console-local variables, read-only + variables, variable aliases, variables that are linked to a C + variable, etc. The more specific types are: + + -- `symbol-value-forward': Variables that forward to a C variable. + NOTE:This includes built-in buffer-local and console-local + variables, since they forward to an element in a buffer or + console structure. + + -- `symbol-value-buffer-local': Variables on which + `make-local-variable' or `make-variable-buffer-local' have + been called. + + -- `symbol-value-lisp-magic': See below. + + -- `symbol-value-varalias': Variable aliases. + + 2. `symbol-value-lisp-magic': Variables on which + `dontusethis-set-symbol-value-handler' have been called. These + variables are extra-magic in that operations that would normally + change their value instead get forwarded out to Lisp handlers, + which can do anything they want. (NOTE: Handlers for getting a + variable's value aren't implemented yet.) + + 3. "magicfun" handlers on C-forwarding variables, declared with any + of the following: + + -- DEFVAR_LISP_MAGIC + -- DEFVAR_INT_MAGIC + -- DEFVAR_BOOL_MAGIC, + -- DEFVAR_BUFFER_LOCAL_MAGIC + -- DEFVAR_BUFFER_DEFAULTS_MAGIC + -- DEFVAR_CONSOLE_LOCAL_MAGIC + -- DEFVAR_CONSOLE_DEFAULTS_MAGIC + + Here, the "magic function" is a handler that is notified whenever the + value of a variable is changed, so that some other updating can take + place (e.g. setting redisplay-related dirty bits, updating a cache, + etc.). + + Note that DEFVAR_LISP_MAGIC does *NOT* have anything to do with + `symbol-value-lisp-magic'. The former refers to variables that can + hold an arbitrary Lisp object and forward to a C variable declared + `Lisp_Object foo', and have a "magicfun" as just described; the + latter are variables that have Lisp-level handlers that function + in *PLACE* of normal variable-setting mechanisms, and are established + with `dontusethis-set-symbol-value-handler', as described above. +*/ + /* If the contents of the value cell of a symbol is one of the following three types of objects, then the symbol is "magic" in that setting and retrieving its value doesn't just set or retrieve the raw @@ -1123,29 +1191,29 @@ return *((Lisp_Object *)symbol_value_forward_forward (fwd)); case SYMVAL_DEFAULT_BUFFER_FORWARD: - return (*((Lisp_Object *)((char *) XBUFFER (Vbuffer_defaults) - + ((char *)symbol_value_forward_forward (fwd) - - (char *)&buffer_local_flags)))); + return (*((Lisp_Object *)((Rawbyte *) XBUFFER (Vbuffer_defaults) + + ((Rawbyte *)symbol_value_forward_forward (fwd) + - (Rawbyte *)&buffer_local_flags)))); case SYMVAL_CURRENT_BUFFER_FORWARD: case SYMVAL_CONST_CURRENT_BUFFER_FORWARD: assert (buffer); - return (*((Lisp_Object *)((char *)buffer - + ((char *)symbol_value_forward_forward (fwd) - - (char *)&buffer_local_flags)))); + return (*((Lisp_Object *)((Rawbyte *)buffer + + ((Rawbyte *)symbol_value_forward_forward (fwd) + - (Rawbyte *)&buffer_local_flags)))); case SYMVAL_DEFAULT_CONSOLE_FORWARD: - return (*((Lisp_Object *)((char *) XCONSOLE (Vconsole_defaults) - + ((char *)symbol_value_forward_forward (fwd) - - (char *)&console_local_flags)))); + return (*((Lisp_Object *)((Rawbyte *) XCONSOLE (Vconsole_defaults) + + ((Rawbyte *)symbol_value_forward_forward (fwd) + - (Rawbyte *)&console_local_flags)))); case SYMVAL_SELECTED_CONSOLE_FORWARD: case SYMVAL_CONST_SELECTED_CONSOLE_FORWARD: assert (console); - return (*((Lisp_Object *)((char *)console - + ((char *)symbol_value_forward_forward (fwd) - - (char *)&console_local_flags)))); + return (*((Lisp_Object *)((Rawbyte *)console + + ((Rawbyte *)symbol_value_forward_forward (fwd) + - (Rawbyte *)&console_local_flags)))); case SYMVAL_UNBOUND_MARKER: return valcontents; @@ -1171,13 +1239,13 @@ Lisp_Object valcontents = fetch_value_maybe_past_magic (sym, Qt); const struct symbol_value_forward *fwd = XSYMBOL_VALUE_FORWARD (valcontents); - int offset = ((char *) symbol_value_forward_forward (fwd) - - (char *) &buffer_local_flags); + int offset = ((Rawbyte *) symbol_value_forward_forward (fwd) + - (Rawbyte *) &buffer_local_flags); int mask = XINT (*((Lisp_Object *) symbol_value_forward_forward (fwd))); int (*magicfun) (Lisp_Object simm, Lisp_Object *val, Lisp_Object in_object, int flags) = symbol_value_forward_magicfun (fwd); - *((Lisp_Object *) (offset + (char *) XBUFFER (Vbuffer_defaults))) + *((Lisp_Object *) (offset + (Rawbyte *) XBUFFER (Vbuffer_defaults))) = value; if (mask > 0) /* Not always per-buffer */ @@ -1190,7 +1258,7 @@ { if (magicfun) magicfun (sym, &value, wrap_buffer (b), 0); - *((Lisp_Object *) (offset + (char *) b)) = value; + *((Lisp_Object *) (offset + (Rawbyte *) b)) = value; } } } @@ -1211,13 +1279,13 @@ Lisp_Object valcontents = fetch_value_maybe_past_magic (sym, Qt); const struct symbol_value_forward *fwd = XSYMBOL_VALUE_FORWARD (valcontents); - int offset = ((char *) symbol_value_forward_forward (fwd) - - (char *) &console_local_flags); + int offset = ((Rawbyte *) symbol_value_forward_forward (fwd) + - (Rawbyte *) &console_local_flags); int mask = XINT (*((Lisp_Object *) symbol_value_forward_forward (fwd))); int (*magicfun) (Lisp_Object simm, Lisp_Object *val, Lisp_Object in_object, int flags) = symbol_value_forward_magicfun (fwd); - *((Lisp_Object *) (offset + (char *) XCONSOLE (Vconsole_defaults))) + *((Lisp_Object *) (offset + (Rawbyte *) XCONSOLE (Vconsole_defaults))) = value; if (mask > 0) /* Not always per-console */ @@ -1230,7 +1298,7 @@ { if (magicfun) magicfun (sym, &value, console, 0); - *((Lisp_Object *) (offset + (char *) d)) = value; + *((Lisp_Object *) (offset + (Rawbyte *) d)) = value; } } } @@ -1307,9 +1375,9 @@ case SYMVAL_CURRENT_BUFFER_FORWARD: if (magicfun) magicfun (sym, &newval, wrap_buffer (current_buffer), 0); - *((Lisp_Object *) ((char *) current_buffer - + ((char *) symbol_value_forward_forward (fwd) - - (char *) &buffer_local_flags))) + *((Lisp_Object *) ((Rawbyte *) current_buffer + + ((Rawbyte *) symbol_value_forward_forward (fwd) + - (Rawbyte *) &buffer_local_flags))) = newval; return; @@ -1320,9 +1388,9 @@ case SYMVAL_SELECTED_CONSOLE_FORWARD: if (magicfun) magicfun (sym, &newval, Vselected_console, 0); - *((Lisp_Object *) ((char *) XCONSOLE (Vselected_console) - + ((char *) symbol_value_forward_forward (fwd) - - (char *) &console_local_flags))) + *((Lisp_Object *) ((Rawbyte *) XCONSOLE (Vselected_console) + + ((Rawbyte *) symbol_value_forward_forward (fwd) + - (Rawbyte *) &console_local_flags))) = newval; return; @@ -1999,18 +2067,18 @@ { const struct symbol_value_forward *fwd = XSYMBOL_VALUE_FORWARD (valcontents); - return (*((Lisp_Object *)((char *) XBUFFER (Vbuffer_defaults) - + ((char *)symbol_value_forward_forward (fwd) - - (char *)&buffer_local_flags)))); + return (*((Lisp_Object *)((Rawbyte *) XBUFFER (Vbuffer_defaults) + + ((Rawbyte *)symbol_value_forward_forward (fwd) + - (Rawbyte *)&buffer_local_flags)))); } case SYMVAL_SELECTED_CONSOLE_FORWARD: { const struct symbol_value_forward *fwd = XSYMBOL_VALUE_FORWARD (valcontents); - return (*((Lisp_Object *)((char *) XCONSOLE (Vconsole_defaults) - + ((char *)symbol_value_forward_forward (fwd) - - (char *)&console_local_flags)))); + return (*((Lisp_Object *)((Rawbyte *) XCONSOLE (Vconsole_defaults) + + ((Rawbyte *)symbol_value_forward_forward (fwd) + - (Rawbyte *)&console_local_flags)))); } case SYMVAL_BUFFER_LOCAL: @@ -2446,8 +2514,8 @@ { const struct symbol_value_forward *fwd = XSYMBOL_VALUE_FORWARD (valcontents); - int offset = ((char *) symbol_value_forward_forward (fwd) - - (char *) &buffer_local_flags); + int offset = ((Rawbyte *) symbol_value_forward_forward (fwd) + - (Rawbyte *) &buffer_local_flags); int mask = XINT (*((Lisp_Object *) symbol_value_forward_forward (fwd))); @@ -2457,10 +2525,10 @@ Lisp_Object in_object, int flags) = symbol_value_forward_magicfun (fwd); Lisp_Object oldval = * (Lisp_Object *) - (offset + (char *) XBUFFER (Vbuffer_defaults)); + (offset + (Rawbyte *) XBUFFER (Vbuffer_defaults)); if (magicfun) (magicfun) (variable, &oldval, wrap_buffer (current_buffer), 0); - *(Lisp_Object *) (offset + (char *) current_buffer) + *(Lisp_Object *) (offset + (Rawbyte *) current_buffer) = oldval; current_buffer->local_var_flags &= ~mask; } @@ -2540,8 +2608,8 @@ { const struct symbol_value_forward *fwd = XSYMBOL_VALUE_FORWARD (valcontents); - int offset = ((char *) symbol_value_forward_forward (fwd) - - (char *) &console_local_flags); + int offset = ((Rawbyte *) symbol_value_forward_forward (fwd) + - (Rawbyte *) &console_local_flags); int mask = XINT (*((Lisp_Object *) symbol_value_forward_forward (fwd))); @@ -2551,10 +2619,10 @@ Lisp_Object in_object, int flags) = symbol_value_forward_magicfun (fwd); Lisp_Object oldval = * (Lisp_Object *) - (offset + (char *) XCONSOLE (Vconsole_defaults)); + (offset + (Rawbyte *) XCONSOLE (Vconsole_defaults)); if (magicfun) magicfun (variable, &oldval, Vselected_console, 0); - *(Lisp_Object *) (offset + (char *) XCONSOLE (Vselected_console)) + *(Lisp_Object *) (offset + (Rawbyte *) XCONSOLE (Vselected_console)) = oldval; XCONSOLE (Vselected_console)->local_var_flags &= ~mask; } @@ -3531,8 +3599,8 @@ } static void -defsymbol_massage_name_1 (Lisp_Object *location, const char *name, int dump_p, - int multiword_predicate_p) +defsymbol_massage_name_1 (Lisp_Object *location, const Ascbyte *name, + int dump_p, int multiword_predicate_p) { char temp[500]; int len = strlen (name) - 1; @@ -3553,63 +3621,64 @@ temp[i] = '-'; *location = Fintern (make_string ((const Ibyte *) temp, len), Qnil); if (dump_p) - staticpro (location); + staticpro_1 (location, name); else - staticpro_nodump (location); + staticpro_nodump_1 (location, name); } void -defsymbol_massage_name_nodump (Lisp_Object *location, const char *name) +defsymbol_massage_name_nodump (Lisp_Object *location, const Ascbyte *name) { defsymbol_massage_name_1 (location, name, 0, 0); } void -defsymbol_massage_name (Lisp_Object *location, const char *name) +defsymbol_massage_name (Lisp_Object *location, const Ascbyte *name) { defsymbol_massage_name_1 (location, name, 1, 0); } void defsymbol_massage_multiword_predicate_nodump (Lisp_Object *location, - const char *name) + const Ascbyte *name) { defsymbol_massage_name_1 (location, name, 0, 1); } void -defsymbol_massage_multiword_predicate (Lisp_Object *location, const char *name) +defsymbol_massage_multiword_predicate (Lisp_Object *location, + const Ascbyte *name) { defsymbol_massage_name_1 (location, name, 1, 1); } void -defsymbol_nodump (Lisp_Object *location, const char *name) +defsymbol_nodump (Lisp_Object *location, const Ascbyte *name) { *location = Fintern (make_string_nocopy ((const Ibyte *) name, strlen (name)), Qnil); - staticpro_nodump (location); + staticpro_nodump_1 (location, name); } void -defsymbol (Lisp_Object *location, const char *name) +defsymbol (Lisp_Object *location, const Ascbyte *name) { *location = Fintern (make_string_nocopy ((const Ibyte *) name, strlen (name)), Qnil); - staticpro (location); + staticpro_1 (location, name); } void -defkeyword (Lisp_Object *location, const char *name) +defkeyword (Lisp_Object *location, const Ascbyte *name) { defsymbol (location, name); Fset (*location, *location); } void -defkeyword_massage_name (Lisp_Object *location, const char *name) +defkeyword_massage_name (Lisp_Object *location, const Ascbyte *name) { char temp[500]; int len = strlen (name); @@ -3702,7 +3771,7 @@ \ newsubr = xnew (Lisp_Subr); \ memcpy (newsubr, subr, sizeof (Lisp_Subr)); \ - subr->doc = (const char *)newsubr; \ + subr->doc = (const CIbyte *)newsubr; \ subr = newsubr; \ } \ } while (0) @@ -3789,7 +3858,7 @@ } static void -deferror_1 (Lisp_Object *symbol, const char *name, const char *messuhhj, +deferror_1 (Lisp_Object *symbol, const Ascbyte *name, const Ascbyte *messuhhj, Lisp_Object inherits_from, int massage_p) { Lisp_Object conds; @@ -3804,25 +3873,25 @@ /* NOT build_msg_string (). This function is called at load time and the string needs to get translated at run time. (This happens in the function (display-error) in cmdloop.el.) */ - Fput (*symbol, Qerror_message, build_msg_string (messuhhj)); + Fput (*symbol, Qerror_message, build_defer_string (messuhhj)); } void -deferror (Lisp_Object *symbol, const char *name, const char *messuhhj, +deferror (Lisp_Object *symbol, const Ascbyte *name, const Ascbyte *messuhhj, Lisp_Object inherits_from) { deferror_1 (symbol, name, messuhhj, inherits_from, 0); } void -deferror_massage_name (Lisp_Object *symbol, const char *name, - const char *messuhhj, Lisp_Object inherits_from) +deferror_massage_name (Lisp_Object *symbol, const Ascbyte *name, + const Ascbyte *messuhhj, Lisp_Object inherits_from) { deferror_1 (symbol, name, messuhhj, inherits_from, 1); } void -deferror_massage_name_and_message (Lisp_Object *symbol, const char *name, +deferror_massage_name_and_message (Lisp_Object *symbol, const Ascbyte *name, Lisp_Object inherits_from) { char temp[500]; @@ -3926,7 +3995,8 @@ /* Create and initialize a Lisp variable whose value is forwarded to C data */ void -defvar_magic (const char *symbol_name, const struct symbol_value_forward *magic) +defvar_magic (const Ascbyte *symbol_name, + const struct symbol_value_forward *magic) { Lisp_Object sym; @@ -3938,7 +4008,7 @@ */ if (initialized) { - sym = Fintern (build_string (symbol_name), Qnil); + sym = Fintern (build_ascstring (symbol_name), Qnil); LOADHIST_ATTACH (sym); } else diff -r d2ec55325515 -r 8f0cf4fd3d2c src/symeval.h --- a/src/symeval.h Sat Feb 06 03:59:18 2010 -0600 +++ b/src/symeval.h Sat Feb 06 04:01:46 2010 -0600 @@ -326,16 +326,16 @@ #endif /* not NEW_GC */ MODULE_API void defsymbol_massage_name (Lisp_Object *location, - const char *name); + const Ascbyte *name); MODULE_API void defsymbol_massage_name_nodump (Lisp_Object *location, - const char *name); + const Ascbyte *name); MODULE_API void defsymbol_massage_multiword_predicate (Lisp_Object *location, - const char *name); + const Ascbyte *name); MODULE_API void defsymbol_massage_multiword_predicate_nodump (Lisp_Object *location, - const char *name); -MODULE_API void defsymbol (Lisp_Object *location, const char *name); -MODULE_API void defsymbol_nodump (Lisp_Object *location, const char *name); + const Ascbyte *name); +MODULE_API void defsymbol (Lisp_Object *location, const Ascbyte *name); +MODULE_API void defsymbol_nodump (Lisp_Object *location, const Ascbyte *name); /* Defining symbols: @@ -370,18 +370,18 @@ #define DEFSYMBOL_MULTIWORD_PREDICATE_NO_DUMP(name) \ defsymbol_massage_multiword_predicate_nodump (&name, #name) -MODULE_API void defkeyword (Lisp_Object *location, const char *name); +MODULE_API void defkeyword (Lisp_Object *location, const Ascbyte *name); MODULE_API void defkeyword_massage_name (Lisp_Object *location, - const char *name); + const Ascbyte *name); #define DEFKEYWORD(name) defkeyword_massage_name (&name, #name) -MODULE_API void deferror (Lisp_Object *symbol, const char *name, - const char *message, Lisp_Object inherits_from); -MODULE_API void deferror_massage_name (Lisp_Object *symbol, const char *name, - const char *message, +MODULE_API void deferror (Lisp_Object *symbol, const Ascbyte *name, + const Ascbyte *message, Lisp_Object inherits_from); +MODULE_API void deferror_massage_name (Lisp_Object *symbol, const Ascbyte *name, + const Ascbyte *message, Lisp_Object inherits_from); MODULE_API void deferror_massage_name_and_message (Lisp_Object *symbol, - const char *name, + const Ascbyte *name, Lisp_Object inherits_from); #define DEFERROR(name, message, inherits_from) \ deferror_massage_name (&name, #name, message, inherits_from) @@ -393,7 +393,7 @@ /* Macros we use to define forwarded Lisp variables. These are used in the syms_of_FILENAME functions. */ -MODULE_API void defvar_magic (const char *symbol_name, +MODULE_API void defvar_magic (const Ascbyte *symbol_name, const struct symbol_value_forward *magic); #ifdef NEW_GC @@ -460,7 +460,7 @@ DEFVAR_SYMVAL_FWD (lname, c_location, forward_type, magicfun); \ { \ Lisp_Object *DSF_location = c_location; /* Type check */ \ - staticpro (DSF_location); \ + staticpro_1 (DSF_location, lname); \ if (EQ (*DSF_location, Qnull_pointer)) *DSF_location = Qnil; \ } \ } while (0) diff -r d2ec55325515 -r 8f0cf4fd3d2c src/symsinit.h --- a/src/symsinit.h Sat Feb 06 03:59:18 2010 -0600 +++ b/src/symsinit.h Sat Feb 06 04:01:46 2010 -0600 @@ -333,6 +333,7 @@ void vars_of_buffer (void); void reinit_vars_of_buffer (void); void vars_of_bytecode (void); +void reinit_vars_of_bytecode (void); void vars_of_callint (void); EXTERN_C void vars_of_canna_api (void); void vars_of_chartab (void); diff -r d2ec55325515 -r 8f0cf4fd3d2c src/syntax.c --- a/src/syntax.c Sat Feb 06 03:59:18 2010 -0600 +++ b/src/syntax.c Sat Feb 06 04:01:46 2010 -0600 @@ -551,7 +551,7 @@ uninit_buffer_syntax_cache (struct buffer *UNUSED_IF_NEW_GC (buf)) { #ifndef NEW_GC - xfree (buf->syntax_cache, struct syntax_cache *); + xfree (buf->syntax_cache); buf->syntax_cache = 0; #endif /* not NEW_GC */ } diff -r d2ec55325515 -r 8f0cf4fd3d2c src/sysdep.c --- a/src/sysdep.c Sat Feb 06 03:59:18 2010 -0600 +++ b/src/sysdep.c Sat Feb 06 04:01:46 2010 -0600 @@ -1,7 +1,7 @@ /* Interfaces to system-dependent kernel and library entries. Copyright (C) 1985-1988, 1992-1995 Free Software Foundation, Inc. Copyright (C) 1995 Tinker Systems. - Copyright (C) 2000, 2001, 2002, 2003, 2004 Ben Wing. + Copyright (C) 2000, 2001, 2002, 2003, 2004, 2010 Ben Wing. This file is part of XEmacs. @@ -2037,11 +2037,10 @@ #elif !defined (HAVE_GETHOSTNAME) struct utsname uts; uname (&uts); - Vsystem_name = build_string (uts.nodename); + Vsystem_name = build_extstring (uts.nodename, Qunix_host_name_encoding); #else /* HAVE_GETHOSTNAME */ int hostname_size = 256; - /* !!#### Needs review */ - char *hostname = (char *) ALLOCA (hostname_size); + Extbyte *hostname = alloca_extbytes (hostname_size); /* Try to get the host name; if the buffer is too short, try again. Apparently, the only indication gethostname gives of @@ -2057,17 +2056,17 @@ break; hostname_size <<= 1; - /* !!#### Needs review */ - hostname = (char *) ALLOCA (hostname_size); + hostname = alloca_extbytes (hostname_size); } -# if defined( HAVE_SOCKETS) +# if defined (HAVE_SOCKETS) /* Turn the hostname into the official, fully-qualified hostname. Don't do this if we're going to dump; this can confuse system libraries on some machines and make the dumped emacs core dump. */ if (initialized) + /* !!#### Could fail if we have a 7-bit external encoding */ if (!strchr (hostname, '.')) { -# if !(defined(HAVE_GETADDRINFO) && defined(HAVE_GETNAMEINFO)) +# if !(defined (HAVE_GETADDRINFO) && defined (HAVE_GETNAMEINFO)) struct hostent *hp = NULL; int count; # ifdef TRY_AGAIN @@ -2087,20 +2086,20 @@ # endif if (hp) { - const char *fqdn = (const char *) hp->h_name; - + const Extbyte *fqdn = (const Extbyte *) hp->h_name; + + /* !!#### Could fail if we have a 7-bit external encoding */ if (!strchr (fqdn, '.')) { /* We still don't have a fully qualified domain name. Try to find one in the list of alternate names */ - char **alias = hp->h_aliases; + Extbyte **alias = hp->h_aliases; while (*alias && !strchr (*alias, '.')) alias++; if (*alias) fqdn = *alias; } - /* !!#### Needs review */ - hostname = (char *) ALLOCA (strlen (fqdn) + 1); + hostname = alloca_extbytes (strlen (fqdn) + 1); strcpy (hostname, fqdn); } # else /* !(HAVE_GETADDRINFO && HAVE_GETNAMEINFO) */ @@ -2117,8 +2116,7 @@ hints.ai_protocol = 0; if (!getaddrinfo (hostname, NULL, &hints, &res)) { - /* !!#### Needs review */ - hostname = (char *) ALLOCA (strlen (res->ai_canonname) + 1); + hostname = alloca_extbytes (strlen (res->ai_canonname) + 1); strcpy (hostname, res->ai_canonname); freeaddrinfo (res); @@ -2126,7 +2124,7 @@ # endif /* !(HAVE_GETADDRINFO && HAVE_GETNAMEINFO) */ } # endif /* HAVE_SOCKETS */ - Vsystem_name = build_string (hostname); + Vsystem_name = build_extstring (hostname, Qunix_host_name_encoding); #endif /* HAVE_GETHOSTNAME */ { Ibyte *p; @@ -2775,7 +2773,7 @@ Dynarr_add_many (internal_DIRENTRY, internal_name, internal_len); Dynarr_add (internal_DIRENTRY, '\0'); /* NUL-terminate */ - return (DIRENTRY *) Dynarr_atp (internal_DIRENTRY, 0); + return (DIRENTRY *) Dynarr_begin (internal_DIRENTRY); } } #endif /* MULE */ @@ -2835,8 +2833,8 @@ if (ret) { Ibyte *retin; - TSTR_TO_C_STRING_MALLOC (ret, retin); - xfree (cwd, Extbyte *); + retin = TSTR_TO_ITEXT_MALLOC (ret); + xfree (cwd); return retin; } #else @@ -2844,8 +2842,8 @@ if (ret) { Ibyte *retin; - EXTERNAL_TO_C_STRING_MALLOC (ret, retin, Qfile_name); - xfree (cwd, Extbyte *); + retin = EXTERNAL_TO_ITEXT_MALLOC (ret, Qfile_name); + xfree (cwd); return retin; } #endif /* WIN32_NATIVE */ @@ -2857,7 +2855,7 @@ } else { - xfree (cwd, Extbyte *); + xfree (cwd); return NULL; } } @@ -2867,7 +2865,7 @@ if (!getwd (chingame_limitos_arbitrarios)) return 0; - EXTERNAL_TO_C_STRING_MALLOC (chingame_limitos_arbitrarios, ret2, Qfile_name); + ret2 = EXTERNAL_TO_ITEXT_MALLOC (chingame_limitos_arbitrarios, Qfile_name); return ret2; #endif /* HAVE_GETCWD */ } @@ -2941,7 +2939,7 @@ resolved = mswindows_read_link (eidata (name2)); if (resolved) { - xfree (resolved, Ibyte *); + xfree (resolved); return mswindows_stat (eidata (name2), buf); } } @@ -3092,15 +3090,14 @@ ; new_argv = alloca_array (Extbyte *, argc + 1); for (i = 0; i < argc; i++) - C_STRING_TO_EXTERNAL (argv[i], new_argv[i], Qcommand_argument_encoding); + new_argv[i] = ITEXT_TO_EXTERNAL (argv[i], Qcommand_argument_encoding); new_argv[argc] = NULL; for (envc = 0; envp[envc]; envc++) ; new_envp = alloca_array (Extbyte *, envc + 1); for (i = 0; i < envc; i++) - C_STRING_TO_EXTERNAL (envp[i], new_envp[i], - Qenvironment_variable_encoding); + new_envp[i] = ITEXT_TO_EXTERNAL (envp[i], Qenvironment_variable_encoding); new_envp[envc] = NULL; #if defined (WIN32_NATIVE) @@ -3134,35 +3131,32 @@ return NULL; if (cached_pwd.pw_name) - xfree (cached_pwd.pw_name, char *); + xfree (cached_pwd.pw_name); if (cached_pwd.pw_passwd) - xfree (cached_pwd.pw_passwd, char *); + xfree (cached_pwd.pw_passwd); if (cached_pwd.pw_gecos) - xfree (cached_pwd.pw_gecos, char *); + xfree (cached_pwd.pw_gecos); if (cached_pwd.pw_dir) - xfree (cached_pwd.pw_dir, char *); + xfree (cached_pwd.pw_dir); if (cached_pwd.pw_shell) - xfree (cached_pwd.pw_shell, char *); + xfree (cached_pwd.pw_shell); cached_pwd = *pwd; - if (cached_pwd.pw_name) - TO_INTERNAL_FORMAT (C_STRING, cached_pwd.pw_name, - C_STRING_MALLOC, cached_pwd.pw_name, - Quser_name_encoding); - if (cached_pwd.pw_passwd) - TO_INTERNAL_FORMAT (C_STRING, cached_pwd.pw_passwd, - C_STRING_MALLOC, cached_pwd.pw_passwd, - Quser_name_encoding); - if (cached_pwd.pw_gecos) - TO_INTERNAL_FORMAT (C_STRING, cached_pwd.pw_gecos, - C_STRING_MALLOC, cached_pwd.pw_gecos, - Quser_name_encoding); - if (cached_pwd.pw_dir) - TO_INTERNAL_FORMAT (C_STRING, cached_pwd.pw_dir, - C_STRING_MALLOC, cached_pwd.pw_dir, Qfile_name); - if (cached_pwd.pw_shell) - TO_INTERNAL_FORMAT (C_STRING, cached_pwd.pw_shell, - C_STRING_MALLOC, cached_pwd.pw_shell, Qfile_name); + +#define FROB(field, encoding) \ +do \ +{ \ + if (cached_pwd.field) \ + cached_pwd.field = (CIbyte *) \ + EXTERNAL_TO_ITEXT_MALLOC (cached_pwd.field, encoding); \ +} while (0) + + FROB (pw_name, Quser_name_encoding); + FROB (pw_passwd, Quser_name_encoding); + FROB (pw_gecos, Quser_name_encoding); + FROB (pw_dir, Qfile_name); + FROB (pw_shell, Qfile_name); +#undef FROB return &cached_pwd; } @@ -3173,8 +3167,7 @@ /* Synthetic versions are defined in nt.c and already do conversion. */ return getpwnam (name); #else - Extbyte *nameext; - C_STRING_TO_EXTERNAL (name, nameext, Quser_name_encoding); + Extbyte *nameext = ITEXT_TO_EXTERNAL (name, Quser_name_encoding); return copy_in_passwd (getpwnam (nameext)); #endif /* WIN32_NATIVE */ @@ -3213,8 +3206,8 @@ if (!str) /* can happen on MS Windows */ return (Ibyte *) "Sun Jan 01 00:00:00 1970"; if (ctime_static) - xfree (ctime_static, Ibyte *); - EXTERNAL_TO_C_STRING_MALLOC (str, ctime_static, Qtime_function_encoding); + xfree (ctime_static); + ctime_static = EXTERNAL_TO_ITEXT_MALLOC (str, Qtime_function_encoding); return ctime_static; } @@ -3389,14 +3382,14 @@ Extbyte *filename; utb.actime = EMACS_SECS (atime); utb.modtime = EMACS_SECS (mtime); - LISP_STRING_TO_EXTERNAL (path, filename, Qfile_name); + LISP_PATHNAME_CONVERT_OUT (path, filename); return utime (filename, &utb); #elif defined (HAVE_UTIMES) struct timeval tv[2]; Extbyte *filename; tv[0] = atime; tv[1] = mtime; - LISP_STRING_TO_EXTERNAL (path, filename, Qfile_name); + LISP_PATHNAME_CONVERT_OUT (path, filename); return utimes (filename, tv); #else /* No file times setting function available. */ @@ -3572,7 +3565,7 @@ #if defined(WIN32_NATIVE) || defined(CYGWIN) const char *sys_siglist[] = { - /* $$####begin-snarf */ + /* @@@begin-snarf@@@ */ "bum signal!!", "hangup", "interrupt", @@ -3598,8 +3591,8 @@ "background write attempted from control tty", "input record available at control tty", "exceeded CPU time limit", - "exceeded file size limit" - /* $$####end-snarf */ + "exceeded file size limit", + /* @@@end-snarf@@@ */ }; #endif @@ -3608,83 +3601,85 @@ const char *sys_siglist[NSIG + 1] = { /* AIX has changed the signals a bit */ - DEFER_GETTEXT ("bogus signal"), /* 0 */ - DEFER_GETTEXT ("hangup"), /* 1 SIGHUP */ - DEFER_GETTEXT ("interrupt"), /* 2 SIGINT */ - DEFER_GETTEXT ("quit"), /* 3 SIGQUIT */ - DEFER_GETTEXT ("illegal instruction"), /* 4 SIGILL */ - DEFER_GETTEXT ("trace trap"), /* 5 SIGTRAP */ - DEFER_GETTEXT ("IOT instruction"), /* 6 SIGIOT */ - DEFER_GETTEXT ("crash likely"), /* 7 SIGDANGER */ - DEFER_GETTEXT ("floating point exception"), /* 8 SIGFPE */ - DEFER_GETTEXT ("kill"), /* 9 SIGKILL */ - DEFER_GETTEXT ("bus error"), /* 10 SIGBUS */ - DEFER_GETTEXT ("segmentation violation"), /* 11 SIGSEGV */ - DEFER_GETTEXT ("bad argument to system call"), /* 12 SIGSYS */ - DEFER_GETTEXT ("write on a pipe with no one to read it"), /* 13 SIGPIPE */ - DEFER_GETTEXT ("alarm clock"), /* 14 SIGALRM */ - DEFER_GETTEXT ("software termination signal"), /* 15 SIGTERM */ - DEFER_GETTEXT ("user defined signal 1"), /* 16 SIGUSR1 */ - DEFER_GETTEXT ("user defined signal 2"), /* 17 SIGUSR2 */ - DEFER_GETTEXT ("death of a child"), /* 18 SIGCLD */ - DEFER_GETTEXT ("power-fail restart"), /* 19 SIGPWR */ - DEFER_GETTEXT ("bogus signal"), /* 20 */ - DEFER_GETTEXT ("bogus signal"), /* 21 */ - DEFER_GETTEXT ("bogus signal"), /* 22 */ - DEFER_GETTEXT ("bogus signal"), /* 23 */ - DEFER_GETTEXT ("bogus signal"), /* 24 */ - DEFER_GETTEXT ("LAN I/O interrupt"), /* 25 SIGAIO */ - DEFER_GETTEXT ("PTY I/O interrupt"), /* 26 SIGPTY */ - DEFER_GETTEXT ("I/O intervention required"), /* 27 SIGIOINT */ - /* $$####end-snarf */ + /* @@@begin-snarf@@@ */ + "bogus signal", /* 0 */ + "hangup", /* 1 SIGHUP */ + "interrupt", /* 2 SIGINT */ + "quit", /* 3 SIGQUIT */ + "illegal instruction", /* 4 SIGILL */ + "trace trap", /* 5 SIGTRAP */ + "IOT instruction", /* 6 SIGIOT */ + "crash likely", /* 7 SIGDANGER */ + "floating point exception", /* 8 SIGFPE */ + "kill", /* 9 SIGKILL */ + "bus error", /* 10 SIGBUS */ + "segmentation violation", /* 11 SIGSEGV */ + "bad argument to system call", /* 12 SIGSYS */ + "write on a pipe with no one to read it", /* 13 SIGPIPE */ + "alarm clock", /* 14 SIGALRM */ + "software termination signal", /* 15 SIGTERM */ + "user defined signal 1", /* 16 SIGUSR1 */ + "user defined signal 2", /* 17 SIGUSR2 */ + "death of a child", /* 18 SIGCLD */ + "power-fail restart", /* 19 SIGPWR */ + "bogus signal", /* 20 */ + "bogus signal", /* 21 */ + "bogus signal", /* 22 */ + "bogus signal", /* 23 */ + "bogus signal", /* 24 */ + "LAN I/O interrupt", /* 25 SIGAIO */ + "PTY I/O interrupt", /* 26 SIGPTY */ + "I/O intervention required", /* 27 SIGIOINT */ + /* @@@end-snarf@@@ */ 0 }; #else /* USG, not AIX */ const char *sys_siglist[NSIG + 1] = { - DEFER_GETTEXT ("bogus signal"), /* 0 */ - DEFER_GETTEXT ("hangup"), /* 1 SIGHUP */ - DEFER_GETTEXT ("interrupt"), /* 2 SIGINT */ - DEFER_GETTEXT ("quit"), /* 3 SIGQUIT */ - DEFER_GETTEXT ("illegal instruction"), /* 4 SIGILL */ - DEFER_GETTEXT ("trace trap"), /* 5 SIGTRAP */ - DEFER_GETTEXT ("IOT instruction"), /* 6 SIGIOT */ - DEFER_GETTEXT ("EMT instruction"), /* 7 SIGEMT */ - DEFER_GETTEXT ("floating point exception"), /* 8 SIGFPE */ - DEFER_GETTEXT ("kill"), /* 9 SIGKILL */ - DEFER_GETTEXT ("bus error"), /* 10 SIGBUS */ - DEFER_GETTEXT ("segmentation violation"), /* 11 SIGSEGV */ - DEFER_GETTEXT ("bad argument to system call"), /* 12 SIGSYS */ - DEFER_GETTEXT ("write on a pipe with no one to read it"), /* 13 SIGPIPE */ - DEFER_GETTEXT ("alarm clock"), /* 14 SIGALRM */ - DEFER_GETTEXT ("software termination signal"), /* 15 SIGTERM */ - DEFER_GETTEXT ("user defined signal 1"), /* 16 SIGUSR1 */ - DEFER_GETTEXT ("user defined signal 2"), /* 17 SIGUSR2 */ - DEFER_GETTEXT ("death of a child"), /* 18 SIGCLD */ - DEFER_GETTEXT ("power-fail restart"), /* 19 SIGPWR */ -#ifdef sun - "window size changed", /* 20 SIGWINCH */ - "urgent socket condition", /* 21 SIGURG */ - "pollable event occurred", /* 22 SIGPOLL */ - "stop (cannot be caught or ignored)", /* 23 SIGSTOP */ - "user stop requested from tty", /* 24 SIGTSTP */ - "stopped process has been continued", /* 25 SIGCONT */ - "background tty read attempted", /* 26 SIGTTIN */ - "background tty write attempted", /* 27 SIGTTOU */ - "virtual timer expired", /* 28 SIGVTALRM */ - "profiling timer expired", /* 29 SIGPROF */ - "exceeded cpu limit", /* 30 SIGXCPU */ - "exceeded file size limit", /* 31 SIGXFSZ */ - "process's lwps are blocked", /* 32 SIGWAITING */ - "special signal used by thread library", /* 33 SIGLWP */ + /* @@@begin-snarf@@@ */ + "bogus signal", /* 0 */ + "hangup", /* 1 SIGHUP */ + "interrupt", /* 2 SIGINT */ + "quit", /* 3 SIGQUIT */ + "illegal instruction", /* 4 SIGILL */ + "trace trap", /* 5 SIGTRAP */ + "IOT instruction", /* 6 SIGIOT */ + "EMT instruction", /* 7 SIGEMT */ + "floating point exception", /* 8 SIGFPE */ + "kill", /* 9 SIGKILL */ + "bus error", /* 10 SIGBUS */ + "segmentation violation", /* 11 SIGSEGV */ + "bad argument to system call", /* 12 SIGSYS */ + "write on a pipe with no one to read it", /* 13 SIGPIPE */ + "alarm clock", /* 14 SIGALRM */ + "software termination signal", /* 15 SIGTERM */ + "user defined signal 1", /* 16 SIGUSR1 */ + "user defined signal 2", /* 17 SIGUSR2 */ + "death of a child", /* 18 SIGCLD */ + "power-fail restart", /* 19 SIGPWR */ +#ifdef sun + "window size changed", /* 20 SIGWINCH */ + "urgent socket condition", /* 21 SIGURG */ + "pollable event occurred", /* 22 SIGPOLL */ + "stop (cannot be caught or ignored)", /* 23 SIGSTOP */ + "user stop requested from tty", /* 24 SIGTSTP */ + "stopped process has been continued", /* 25 SIGCONT */ + "background tty read attempted", /* 26 SIGTTIN */ + "background tty write attempted", /* 27 SIGTTOU */ + "virtual timer expired", /* 28 SIGVTALRM */ + "profiling timer expired", /* 29 SIGPROF */ + "exceeded cpu limit", /* 30 SIGXCPU */ + "exceeded file size limit", /* 31 SIGXFSZ */ + "process's lwps are blocked", /* 32 SIGWAITING */ + "special signal used by thread library", /* 33 SIGLWP */ #ifdef SIGFREEZE - "special signal used by CPR", /* 34 SIGFREEZE */ + "special signal used by CPR", /* 34 SIGFREEZE */ #endif #ifdef SIGTHAW - "special signal used by CPR", /* 35 SIGTHAW */ + "special signal used by CPR", /* 35 SIGTHAW */ #endif #endif /* sun */ - /* $$####end-snarf */ + /* @@@end-snarf@@@ */ 0 }; #endif /* not AIX */ @@ -3713,9 +3708,9 @@ in one block. Why in the world are we freeing this ourselves anyway? */ #if ! (defined (sun) && defined (USG5_4)) - xfree (dirp->dd_buf, char *); /* directory block defined in */ + xfree (dirp->dd_buf); /* directory block defined in */ #endif - xfree (dirp, DIR *); + xfree (dirp); return (rtnval); } #endif /* not HAVE_CLOSEDIR */ @@ -3752,7 +3747,7 @@ closedir (DIR *dirp) /* stream from opendir */ { retry_close (dirp->dd_fd); - xfree (dirp, DIR *); + xfree (dirp); } diff -r d2ec55325515 -r 8f0cf4fd3d2c src/sysdll.c --- a/src/sysdll.c Sat Feb 06 03:59:18 2010 -0600 +++ b/src/sysdll.c Sat Feb 06 04:01:46 2010 -0600 @@ -1,5 +1,7 @@ /* sysdll.c --- system dependent support for dynamic linked libraries Copyright (C) 1998 Free Software Foundation, Inc. + Copyright (C) 2010 Ben Wing. + Author: William Perry This file is part of XEmacs. @@ -19,6 +21,8 @@ Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ +/* This file has been Mule-ized, Ben Wing, 1-26-10. */ + #ifdef HAVE_CONFIG_H #include #endif @@ -29,9 +33,9 @@ #ifdef DLSYM_NEEDS_UNDERSCORE #define MAYBE_PREPEND_UNDERSCORE(n) do { \ - CIbyte *buf = alloca_array (CIbyte, strlen (n) + 2); \ + Ibyte *buf = alloca_array (Ibyte, qxestrlen (n) + 2); \ *buf = '_'; \ - strcpy (buf + 1, n); \ + qxestrcpy (buf + 1, n); \ n = buf; \ } while (0) #else @@ -73,7 +77,7 @@ } else { - LISP_STRING_TO_EXTERNAL (fname, soname, Qdll_filename_encoding); + soname = LISP_STRING_TO_EXTERNAL (fname, Qdll_filename_encoding); } return (dll_handle) dlopen (soname, RTLD_NOW); } @@ -85,17 +89,21 @@ } dll_func -dll_function (dll_handle h, const CIbyte *n) +dll_function (dll_handle h, const Ibyte *n) { + Extbyte *next; MAYBE_PREPEND_UNDERSCORE (n); - return (dll_func) dlsym ((void *) h, n); + next = ITEXT_TO_EXTERNAL (n, Qdll_function_name_encoding); + return (dll_func) dlsym ((void *) h, next); } dll_var -dll_variable (dll_handle h, const CIbyte *n) +dll_variable (dll_handle h, const Ibyte *n) { + Extbyte *next; MAYBE_PREPEND_UNDERSCORE (n); - return (dll_var)dlsym ((void *)h, n); + next = ITEXT_TO_EXTERNAL (n, Qdll_variable_name_encoding); + return (dll_var)dlsym ((void *)h, next); } Lisp_Object @@ -109,7 +117,7 @@ #else msg = (const Extbyte *) "Shared library error"; #endif - return build_ext_string (msg, Qerror_message_encoding); + return build_extstring (msg, Qerror_message_encoding); } #elif defined(HAVE_SHL_LOAD) @@ -126,7 +134,7 @@ } else { - LISP_STRING_TO_EXTERNAL (fname, soname, Qdll_filename_encoding); + soname = LISP_STRING_TO_EXTERNAL (fname, Qdll_filename_encoding); } return (dll_handle) shl_load (soname, BIND_DEFERRED, 0L); } @@ -164,8 +172,7 @@ { /* #### WTF?! Shouldn't this at least attempt to get strerror or something? --hniksic */ - return build_string ("Generic shared library error", - Qerror_message_encoding); + return build_ascstring ("Generic shared library error"); } #elif defined (WIN32_NATIVE) || defined (CYGWIN) @@ -196,25 +203,27 @@ } dll_func -dll_function (dll_handle h, const CIbyte *n) +dll_function (dll_handle h, const Ibyte *n) { - return (dll_func) GetProcAddress ((HINSTANCE) h, n); + Extbyte *next = ITEXT_TO_EXTERNAL (n, Qmswindows_multibyte); + return (dll_func) GetProcAddress ((HINSTANCE) h, next); } dll_func -dll_variable (dll_handle h, const CIbyte *n) +dll_variable (dll_handle h, const Ibyte *n) { - return (dll_func) GetProcAddress ((HINSTANCE) h, n); + Extbyte *next = ITEXT_TO_EXTERNAL (n, Qmswindows_multibyte); + return (dll_func) GetProcAddress ((HINSTANCE) h, next); } Lisp_Object dll_error () { - CIbyte err[32]; + Ascbyte err[32]; snprintf (err, 32, "Windows DLL Error %lu", GetLastError ()); - return build_string (err); + return build_ascstring (err); } -#elif defined(HAVE_DYLD) +#elif defined (HAVE_DYLD) /* This section supports MacOSX dynamic libraries. Dynamically loadable libraries must be compiled as bundles, not dynamiclibs. */ @@ -241,23 +250,22 @@ } else { - LISP_STRING_TO_EXTERNAL (fname, soname, Qdll_filename_encoding); + soname = LISP_STRING_TO_EXTERNAL (fname, Qdll_filename_encoding); } - ret = NSCreateObjectFileImageFromFile(soname, &file); - if (ret != NSObjectFileImageSuccess) { + ret = NSCreateObjectFileImageFromFile (soname, &file); + if (ret != NSObjectFileImageSuccess) return NULL; - } - out = NSLinkModule(file, soname, - NSLINKMODULE_OPTION_BINDNOW | - NSLINKMODULE_OPTION_PRIVATE | - NSLINKMODULE_OPTION_RETURN_ON_ERROR); - return (dll_handle)out; + out = NSLinkModule (file, soname, + NSLINKMODULE_OPTION_BINDNOW | + NSLINKMODULE_OPTION_PRIVATE | + NSLINKMODULE_OPTION_RETURN_ON_ERROR); + return (dll_handle) out; } int dll_close (dll_handle h) { - return NSUnLinkModule((NSModule)h, NSUNLINKMODULE_OPTION_NONE); + return NSUnLinkModule ((NSModule) h, NSUNLINKMODULE_OPTION_NONE); } /* Given an address, return the mach_header for the image containing it @@ -268,27 +276,28 @@ * (http://www.opendarwin.org/projects/dlcompat). */ -static const struct mach_header* -image_for_address(void *address) +static const struct mach_header * +image_for_address (void *address) { unsigned long i; - unsigned long count = _dyld_image_count(); + unsigned long count = _dyld_image_count (); const struct mach_header *mh = 0; for (i = 0; i < count; i++) { - unsigned long addr = (unsigned long)address - - _dyld_get_image_vmaddr_slide(i); - mh = _dyld_get_image_header(i); + unsigned long addr = (unsigned long) address - + _dyld_get_image_vmaddr_slide (i); + mh = _dyld_get_image_header (i); if (mh) { struct load_command *lc = - (struct load_command *)((char *)mh + sizeof(struct mach_header)); + (struct load_command *) ((Rawbyte *) mh + + sizeof(struct mach_header)); unsigned long j; for (j = 0; j < mh->ncmds; - j++, lc = (struct load_command *)((char *)lc + lc->cmdsize)) + j++, lc = (struct load_command *) ((Rawbyte *)lc + lc->cmdsize)) { if (LC_SEGMENT == lc->cmd && addr >= ((struct segment_command *)lc)->vmaddr && @@ -308,25 +317,25 @@ return mh; } -static const struct mach_header* -my_find_image(const char *name) +static const struct mach_header * +my_find_image (const char *name) { const struct mach_header *mh = (struct mach_header *) - NSAddImage(name, NSADDIMAGE_OPTION_RETURN_ONLY_IF_LOADED | - NSADDIMAGE_OPTION_RETURN_ON_ERROR); + NSAddImage (name, NSADDIMAGE_OPTION_RETURN_ONLY_IF_LOADED | + NSADDIMAGE_OPTION_RETURN_ON_ERROR); if (!mh) { - int count = _dyld_image_count(); + int count = _dyld_image_count (); int j; for (j = 0; j < count; j++) { - const char *id = _dyld_get_image_name(j); + const char *id = _dyld_get_image_name (j); - if (!strcmp(id, name)) + if (!strcmp (id, name)) { - mh = _dyld_get_image_header(j); + mh = _dyld_get_image_header (j); break; } } @@ -343,32 +352,36 @@ * dependencies, then it probably isn't there. */ static NSSymbol -search_linked_libs(const struct mach_header * mh, const char *symbol) +search_linked_libs (const struct mach_header * mh, const Ibyte *symbol) { unsigned long n; NSSymbol nssym = 0; struct load_command *lc = - (struct load_command *)((char *)mh + sizeof(struct mach_header)); + (struct load_command *) ((Rawbyte *) mh + sizeof (struct mach_header)); for (n = 0; n < mh->ncmds; - n++, lc = (struct load_command *)((char *)lc + lc->cmdsize)) + n++, lc = (struct load_command *) ((Rawbyte *) lc + lc->cmdsize)) { if ((LC_LOAD_DYLIB == lc->cmd) || (LC_LOAD_WEAK_DYLIB == lc->cmd)) { struct mach_header *wh; if ((wh = (struct mach_header *) - my_find_image((char *)(((struct dylib_command *)lc)->dylib.name.offset + - (char *)lc)))) + my_find_image((Rawbyte *) + (((struct dylib_command *) lc)-> + dylib.name.offset + (Rawbyte *) lc)))) { - if (NSIsSymbolNameDefinedInImage(wh, symbol)) + Extbyte *symext = + ITEXT_TO_EXTERNAL (symbol, Qdll_symbol_encoding); + if (NSIsSymbolNameDefinedInImage (wh, symext)) { nssym = - NSLookupSymbolInImage(wh, - symbol, - NSLOOKUPSYMBOLINIMAGE_OPTION_BIND | - NSLOOKUPSYMBOLINIMAGE_OPTION_RETURN_ON_ERROR); + NSLookupSymbolInImage + (wh, + symext, + NSLOOKUPSYMBOLINIMAGE_OPTION_BIND | + NSLOOKUPSYMBOLINIMAGE_OPTION_RETURN_ON_ERROR); break; } } @@ -379,10 +392,13 @@ } dll_func -dll_function (dll_handle h, const CIbyte *n) +dll_function (dll_handle h, const Ibyte *n) { NSSymbol sym = 0; + Extbyte *next; + MAYBE_PREPEND_UNDERSCORE (n); + next = ITEXT_TO_EXTERNAL (n, Qdll_function_name_encoding); /* NULL means the program image and shared libraries, not bundles. */ @@ -390,49 +406,55 @@ { /* NOTE: This assumes that this function is included in the main program and not in a shared library. */ - const struct mach_header* my_mh = image_for_address((void*) &dll_function); + const struct mach_header* my_mh = + image_for_address ((void*) &dll_function); - if (NSIsSymbolNameDefinedInImage(my_mh, n)) + if (NSIsSymbolNameDefinedInImage (my_mh, next)) { sym = - NSLookupSymbolInImage(my_mh, - n, - NSLOOKUPSYMBOLINIMAGE_OPTION_BIND | - NSLOOKUPSYMBOLINIMAGE_OPTION_RETURN_ON_ERROR); + NSLookupSymbolInImage + (my_mh, + next, + NSLOOKUPSYMBOLINIMAGE_OPTION_BIND | + NSLOOKUPSYMBOLINIMAGE_OPTION_RETURN_ON_ERROR); } if (!sym) { - sym = search_linked_libs(my_mh, n); + sym = search_linked_libs (my_mh, n); } } else { - sym = NSLookupSymbolInModule((NSModule)h, n); + sym = NSLookupSymbolInModule ((NSModule)h, next); } if (sym == 0) return 0; - return (dll_func)NSAddressOfSymbol(sym); + return (dll_func) NSAddressOfSymbol (sym); } dll_var -dll_variable (dll_handle h, const CIbyte *n) +dll_variable (dll_handle h, const Ibyte *n) { NSSymbol sym; + Extbyte *next; + MAYBE_PREPEND_UNDERSCORE (n); - sym = NSLookupSymbolInModule((NSModule)h, n); + next = ITEXT_TO_EXTERNAL (n, Qdll_variable_name_encoding); + + sym = NSLookupSymbolInModule ((NSModule) h, n); if (sym == 0) return 0; - return (dll_var)NSAddressOfSymbol(sym); + return (dll_var) NSAddressOfSymbol (sym); } Lisp_Object -dll_error () +dll_error (void) { NSLinkEditErrors c; int errorNumber; - const CIbyte *fileNameWithError, *errorString; - NSLinkEditError(&c, &errorNumber, &fileNameWithError, &errorString); - return build_ext_string (errorString, Qerror_message_encoding); + const Extbyte *fileNameWithError, *errorString; + NSLinkEditError (&c, &errorNumber, &fileNameWithError, &errorString); + return build_extstring (errorString, Qerror_message_encoding); } #elif HAVE_LTDL /* Libtool's libltdl */ @@ -449,7 +471,7 @@ } else { - LISP_STRING_TO_EXTERNAL (fname, soname, Qdll_filename_encoding); + soname = LISP_STRING_TO_EXTERNAL (fname, Qdll_filename_encoding); } return (dll_handle) lt_dlopen (soname); } @@ -461,23 +483,27 @@ } dll_func -dll_function (dll_handle h, const CIbyte *n) +dll_function (dll_handle h, const Ibyte *n) { + Extbyte *next; MAYBE_PREPEND_UNDERSCORE (n); - return (dll_func) lt_dlsym ((lt_dlhandle) h, n); + next = ITEXT_TO_EXTERNAL (n, Qdll_function_name_encoding); + return (dll_func) lt_dlsym ((lt_dlhandle) h, next); } dll_var -dll_variable (dll_handle h, const CIbyte *n) +dll_variable (dll_handle h, const Ibyte *n) { + Extbyte *next; MAYBE_PREPEND_UNDERSCORE (n); - return (dll_var) lt_dlsym ((lt_dlhandle) h, n); + next = ITEXT_TO_EXTERNAL (n, Qdll_variable_name_encoding); + return (dll_var) lt_dlsym ((lt_dlhandle) h, next); } Lisp_Object -dll_error () +dll_error (void) { - return build_ext_string (lt_dlerror (), Qerror_message_encoding); + return build_extstring (lt_dlerror (), Qerror_message_encoding); } #else /* Catchall if we don't know about this system's method of dynamic loading */ @@ -494,21 +520,21 @@ } dll_func -dll_function (dll_handle h, const CIbyte *n) +dll_function (dll_handle h, const Ibyte *n) { return NULL; } dll_func -dll_variable (dll_handle h, const CIbyte *n) +dll_variable (dll_handle h, const Ibyte *n) { return NULL; } Lisp_Object -dll_error () +dll_error (void) { - return build_string ("Shared libraries not implemented on this system"); + return build_ascstring ("Shared libraries not implemented on this system"); } #endif /* System conditionals */ diff -r d2ec55325515 -r 8f0cf4fd3d2c src/sysdll.h --- a/src/sysdll.h Sat Feb 06 03:59:18 2010 -0600 +++ b/src/sysdll.h Sat Feb 06 04:01:46 2010 -0600 @@ -19,6 +19,8 @@ Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ +/* This file has been Mule-ized, Ben Wing, 1-26-10. */ + #ifndef INCLUDED_sysdll_h_ #define INCLUDED_sysdll_h_ @@ -30,15 +32,10 @@ extern dll_handle dll_open (Lisp_Object); extern int dll_close (dll_handle); -extern dll_func dll_function (dll_handle, const CIbyte *); -extern dll_var dll_variable (dll_handle, const CIbyte *); +extern dll_func dll_function (dll_handle, const Ibyte *); +extern dll_var dll_variable (dll_handle, const Ibyte *); extern Lisp_Object dll_error (void); -/* More stand-ins ... */ - -#define Qdll_filename_encoding Qfile_name -#define Qdll_function_name_encoding Qnative - END_C_DECLS #endif /* INCLUDED_sysdll_h_ */ diff -r d2ec55325515 -r 8f0cf4fd3d2c src/sysfile.h --- a/src/sysfile.h Sat Feb 06 03:59:18 2010 -0600 +++ b/src/sysfile.h Sat Feb 06 04:01:46 2010 -0600 @@ -91,7 +91,7 @@ /* # include */ #endif /* WIN32_NATIVE */ -/* Needed for C_STRING_TO_TSTR, MAX_XETCHAR_SIZE below; but syswindows.h +/* Needed for ITEXT_TO_TSTR, MAX_XETCHAR_SIZE below; but syswindows.h depends on lisp.h being previously included. */ #if defined (WIN32_ANY) && defined (emacs) # include "syswindows.h" @@ -497,7 +497,7 @@ } #define DIRECTORY_SEP sysfile_get_directory_sep() -#define DEFAULT_DIRECTORY_FALLBACK ((const CIbyte *)"C:\\") +#define DEFAULT_DIRECTORY_FALLBACK "C:\\" #else /* not emacs */ @@ -511,7 +511,7 @@ #define SEPCHAR ':' #define DEFAULT_DIRECTORY_SEP '/' #define DIRECTORY_SEP '/' -#define DEFAULT_DIRECTORY_FALLBACK ((const CIbyte *)"/") +#define DEFAULT_DIRECTORY_FALLBACK "/" #endif /* WIN32_NATIVE */ @@ -597,23 +597,26 @@ { \ const Ibyte *_pco_path_; \ PATHNAME_RESOLVE_LINKS (path, _pco_path_); \ - C_STRING_TO_TSTR (_pco_path_, pathout); \ + (pathout) = ITEXT_TO_TSTR (_pco_path_); \ } while (0) -#define PATHNAME_CONVERT_OUT_UTF_8(path, pathout) \ -do \ -{ \ - const Ibyte *_pco_path_; \ - PATHNAME_RESOLVE_LINKS (path, _pco_path_); \ - C_STRING_TO_EXTERNAL (_pco_path_, pathout, Qutf_8); \ +#define PATHNAME_CONVERT_OUT_UTF_8(path, pathout) \ +do \ +{ \ + const Ibyte *_pco_path_; \ + PATHNAME_RESOLVE_LINKS (path, _pco_path_); \ + (pathout) = ITEXT_TO_EXTERNAL (_pco_path_, Qutf_8); \ } while (0) #ifdef WIN32_NATIVE #define PATHNAME_CONVERT_OUT(path, pathout) \ PATHNAME_CONVERT_OUT_TSTR (path, pathout) #else -# define PATHNAME_CONVERT_OUT(path, pathout) \ - C_STRING_TO_EXTERNAL (path, pathout, Qfile_name) +# define PATHNAME_CONVERT_OUT(path, pathout) \ +do \ +{ \ + (pathout) = ITEXT_TO_EXTERNAL (path, Qfile_name); \ +} while (0) #endif #define LISP_PATHNAME_CONVERT_OUT(path, pathout) \ diff -r d2ec55325515 -r 8f0cf4fd3d2c src/syswindows.h --- a/src/syswindows.h Sat Feb 06 03:59:18 2010 -0600 +++ b/src/syswindows.h Sat Feb 06 04:01:46 2010 -0600 @@ -844,17 +844,14 @@ (XEUNICODE_P ? (char *) wcsdup ((wchar_t *) s) \ : xstrdup (s)) -#define C_STRING_TO_TSTR(in, out) \ - C_STRING_TO_EXTERNAL (in, out, Qmswindows_tstr) -#define LISP_STRING_TO_TSTR(in, out) \ - LISP_STRING_TO_EXTERNAL (in, out, Qmswindows_tstr) -#define TSTR_TO_C_STRING(in, out) \ - EXTERNAL_TO_C_STRING (in, out, Qmswindows_tstr) -#define TSTR_TO_C_STRING_MALLOC(in, out) \ - EXTERNAL_TO_C_STRING_MALLOC (in, out, Qmswindows_tstr) +#define ITEXT_TO_TSTR(in) ITEXT_TO_EXTERNAL (in, Qmswindows_tstr) +#define LISP_STRING_TO_TSTR(in) LISP_STRING_TO_EXTERNAL (in, Qmswindows_tstr) +#define TSTR_TO_ITEXT(in) EXTERNAL_TO_ITEXT (in, Qmswindows_tstr) +#define TSTR_TO_ITEXT_MALLOC(in) \ + EXTERNAL_TO_ITEXT_MALLOC (in, Qmswindows_tstr) #define build_tstr_string(in) \ - make_ext_string (in, qxetcsbytelen ((Extbyte *) in), Qmswindows_tstr) + make_extstring (in, qxetcsbytelen ((Extbyte *) in), Qmswindows_tstr) #define MAX_ANSI_CHAR_LEN 1 #define MAX_UNICODE_CHAR_LEN 2 @@ -952,8 +949,9 @@ #define LOCAL_FILE_FORMAT_TO_TSTR(path, out) \ do { \ const Ibyte *lfftt = (path); \ + const Extbyte **lffttout = (const Extbyte **) &(out); \ if (isalpha (lfftt[0]) && (IS_DEVICE_SEP (lfftt[1]))) \ - PATHNAME_CONVERT_OUT_TSTR (lfftt, out); \ + PATHNAME_CONVERT_OUT_TSTR (lfftt, *lffttout); \ else \ { \ int lfftt_size; \ @@ -966,7 +964,7 @@ lfftt_tstr_path = alloca_extbytes (lfftt_size); \ cygwin_conv_path (CCP_POSIX_TO_WIN_T | CCP_RELATIVE, \ lfftt_utf8_path, lfftt_tstr_path, lfftt_size); \ - * (const Extbyte **) &(out) = lfftt_tstr_path; \ + *lffttout = lfftt_tstr_path; \ } \ } while (0) #define TSTR_TO_LOCAL_FILE_FORMAT(path, out) \ @@ -980,21 +978,22 @@ ttlff_utf8_path = alloca_extbytes (ttlff_size); \ cygwin_conv_path (CCP_WIN_T_TO_POSIX | CCP_RELATIVE, \ ttlff, ttlff_utf8_path, ttlff_size); \ - EXTERNAL_TO_C_STRING (ttlff_utf8_path, out, Qutf_8); \ + (out) = EXTERNAL_TO_ITEXT (ttlff_utf8_path, Qutf_8); \ } while (0) #else /* not HAVE_CYGWIN_CONV_PATH */ #define LOCAL_FILE_FORMAT_TO_TSTR(path, out) \ do { \ const Ibyte *lfftt; \ + const Extbyte **lffttout = (const Extbyte **) &(out); \ \ LOCAL_FILE_FORMAT_TO_INTERNAL_MSWIN (path, lfftt); \ - PATHNAME_CONVERT_OUT_TSTR (lfftt, out); \ + PATHNAME_CONVERT_OUT_TSTR (lfftt, *lffttout); \ } while (0) #define TSTR_TO_LOCAL_FILE_FORMAT(path, out) \ do { \ const Ibyte *ttlff; \ \ - TSTR_TO_C_STRING (path, ttlff); \ + ttlff = TSTR_TO_ITEXT (path); \ INTERNAL_MSWIN_TO_LOCAL_FILE_FORMAT (ttlff, out); \ } while (0) #endif /* (not) HAVE_CYGWIN_CONV_PATH */ @@ -1023,13 +1022,13 @@ const Extbyte *lfftiwp; \ \ LOCAL_FILE_FORMAT_TO_TSTR (path, lfftiwp); \ - TSTR_TO_C_STRING (lfftiwp, pathout); \ + (pathout) = TSTR_TO_ITEXT (lfftiwp); \ } \ while (0) #define INTERNAL_MSWIN_TO_LOCAL_FILE_FORMAT(path, pathout) \ do { \ const Extbyte *iwtlffp; \ - C_STRING_TO_TSTR (path, iwtlffp); \ + iwtlffp = ITEXT_TO_TSTR (path); \ TSTR_TO_LOCAL_FILE_FORMAT (iwtlffp, pathout); \ } while (0) #elif defined (CYGWIN) @@ -1041,15 +1040,15 @@ conversion functions are *NOT* localized, and will fail if they \ get 7-bit ISO2022-encoded data. We know that our internal format \ is ASCII-compatible, and so these functions will work fine with \ - this data. */ \ + this data (maybe ... not when Cygwin uses UTF-8) */ \ const Ibyte *lfftiwp = (path); \ if (isalpha (lfftiwp[0]) && (IS_DEVICE_SEP (lfftiwp[1]))) \ - pathout = lfftiwp; \ + (pathout) = lfftiwp; \ else \ { \ int lfftiw2 = \ cygwin_posix_to_win32_path_list_buf_size ((char *) lfftiwp); \ - pathout = alloca_ibytes (lfftiw2); \ + (pathout) = alloca_ibytes (lfftiw2); \ cygwin_posix_to_win32_path_list ((char *) lfftiwp, (char *) pathout); \ } \ } while (0) @@ -1106,11 +1105,11 @@ qxestrncpy (lffmutt_path2, lffmutt_pathint, 7); \ qxestrcpy (lffmutt_path2 + 7, lffmutt_path1); \ } \ - C_STRING_TO_TSTR (lffmutt_path2, pathout); \ + (pathout) = ITEXT_TO_TSTR (lffmutt_path2); \ } \ else \ /* A straight URL, just convert */ \ - LISP_STRING_TO_TSTR (lispstr, pathout); \ + (pathout) = LISP_STRING_TO_TSTR (lispstr); \ } \ else \ /* Not URL-style, must be a straight filename. */ \ @@ -1246,8 +1245,8 @@ /* in win32.c */ Extbyte *mswindows_get_module_file_name (void); -void mswindows_output_last_error (char *frob); -DECLARE_DOESNT_RETURN (mswindows_report_process_error (const char *string, +void mswindows_output_last_error (const Ascbyte *frob); +DECLARE_DOESNT_RETURN (mswindows_report_process_error (const Ascbyte *reason, Lisp_Object data, int errnum)); Lisp_Object mswindows_lisp_error (int errnum); diff -r d2ec55325515 -r 8f0cf4fd3d2c src/termcap.c --- a/src/termcap.c Sat Feb 06 03:59:18 2010 -0600 +++ b/src/termcap.c Sat Feb 06 04:01:46 2010 -0600 @@ -411,7 +411,7 @@ /* Free old `term' if appropriate. */ if (term != name) - xfree (term, const char *); + xfree (term); /* If BP is malloc'd by us, make sure it is big enough. */ if (malloc_size) @@ -441,7 +441,7 @@ } retry_close (fd); - xfree (buf.beg, char *); + xfree (buf.beg); if (malloc_size) { @@ -651,7 +651,7 @@ printf ("\\%0o", *y); else putchar (*y); - xfree (x, char *); + xfree (x); } else printf ("none"); diff -r d2ec55325515 -r 8f0cf4fd3d2c src/tests.c --- a/src/tests.c Sat Feb 06 03:59:18 2010 -0600 +++ b/src/tests.c Sat Feb 06 04:01:46 2010 -0600 @@ -148,20 +148,20 @@ #define DFC_CHECK_LENGTH(len1,len2,str1) \ else if ((len1) != (len2)) \ conversion_result = \ - Fcons (list3 (build_string(str1), Qnil, build_string("wrong length")), \ + Fcons (list3 (build_cistring(str1), Qnil, build_ascstring("wrong length")), \ conversion_result) #define DFC_CHECK_CONTENT(str1,str2,len1,str3) \ else if (memcmp (str1, str2, len1)) \ conversion_result = \ - Fcons (list3 (build_string(str3), Qnil, \ - build_string("octet comparison failed")), \ + Fcons (list3 (build_cistring(str3), Qnil, \ + build_ascstring("octet comparison failed")), \ conversion_result) #define DFC_RESULT_PASS(str1) \ else \ conversion_result = \ - Fcons (list3 (build_string(str1), Qt, Qnil), \ + Fcons (list3 (build_cistring(str1), Qt, Qnil), \ conversion_result) #ifdef MULE @@ -191,7 +191,7 @@ MALLOC, (ptr, len), intern ("iso-8859-2")); DFC_CHECK_DATA (ptr, len, ext_latin, "Latin-2 DATA, MALLOC, Latin-2"); - xfree (ptr, void *); + xfree (ptr); TO_EXTERNAL_FORMAT (DATA, (int_latin2, sizeof (int_latin2) - 1), LISP_OPAQUE, opaque, @@ -212,7 +212,7 @@ intern ("iso-latin-2-with-esc")); DFC_CHECK_DATA (ptr, len, int_latin2, "Latin-2/ESC, MALLOC, Latin-1 DATA"); - xfree (ptr, void *); + xfree (ptr); TO_INTERNAL_FORMAT (DATA, (ext_latin, sizeof (ext_latin) - 1), LISP_STRING, string, @@ -309,7 +309,7 @@ Qbinary); DFC_CHECK_DATA_COND_MULE (ptr, len, ext_latin, int_latin1, "Latin-1 DATA, MALLOC, binary"); - xfree (ptr, void *); + xfree (ptr); ptr = NULL, len = rand(); TO_EXTERNAL_FORMAT (DATA, (int_latin2, sizeof (int_latin2)), @@ -317,7 +317,7 @@ Qbinary); DFC_CHECK_DATA_COND_MULE_NUL (ptr, len, ext_tilde, int_latin2, "Latin-2 DATA, MALLOC, binary/NUL"); - xfree (ptr, void *); + xfree (ptr); ptr = NULL, len = rand(); TO_EXTERNAL_FORMAT (DATA, (int_latin1, sizeof (int_latin1) - 1), @@ -325,7 +325,7 @@ intern ("iso-8859-1")); DFC_CHECK_DATA_COND_MULE (ptr, len, ext_latin, int_latin1, "Latin-1 DATA, MALLOC, Latin-1"); - xfree (ptr, void *); + xfree (ptr); TO_EXTERNAL_FORMAT (DATA, (int_latin1, sizeof (int_latin1) - 1), LISP_OPAQUE, opaque, @@ -368,7 +368,7 @@ intern ("iso-8859-1")); DFC_CHECK_DATA_COND_MULE_NUL (ptr, len, int_latin1, ext_latin, "Latin-1 DATA, MALLOC, Latin-1"); - xfree (ptr, void *); + xfree (ptr); ptr = NULL, len = rand(); TO_INTERNAL_FORMAT (DATA, (ext_latin, sizeof (ext_latin)), @@ -376,7 +376,7 @@ Qnil); DFC_CHECK_DATA_COND_MULE_NUL (ptr, len, int_latin1, ext_latin, "Latin-1 DATA, MALLOC, nil"); - xfree (ptr, void *); + xfree (ptr); TO_INTERNAL_FORMAT (DATA, (ext_latin, sizeof (ext_latin) - 1), LISP_STRING, string, @@ -407,7 +407,7 @@ Qbinary); DFC_CHECK_DATA_NUL (ptr, len, ext_unix, "ASCII DATA, MALLOC, binary/LF/NUL"); - xfree (ptr, void *); + xfree (ptr); ptr = NULL, len = rand(); TO_EXTERNAL_FORMAT (DATA, (int_foo, sizeof (int_foo) - 1), @@ -433,7 +433,7 @@ MALLOC, (ptr, len), intern ("no-conversion-mac")); DFC_CHECK_DATA (ptr, len, ext_mac, "ASCII Lisp string, MALLOC, binary/CR"); - xfree (ptr, void *); + xfree (ptr); ptr = NULL, len = rand(); TO_EXTERNAL_FORMAT (DATA, (int_foo, sizeof (int_foo) - 1), @@ -607,17 +607,17 @@ data.sum = 0; elisp_maphash_unsafe (test_hash_tables_mapper, data.hash_table, (void *) &data); - hash_result = Fcons (list3 (build_string ("simple mapper"), + hash_result = Fcons (list3 (build_ascstring ("simple mapper"), (data.sum == 2 + 4) ? Qt : Qnil, - build_string ("sum != 2 + 4")), + build_ascstring ("sum != 2 + 4")), hash_result); data.sum = 0; elisp_maphash (test_hash_tables_modifying_mapper, data.hash_table, (void *) &data); - hash_result = Fcons (list3 (build_string ("modifying mapper"), + hash_result = Fcons (list3 (build_ascstring ("modifying mapper"), (data.sum == 2 + 4) ? Qt : Qnil, - build_string ("sum != 2 + 4")), + build_ascstring ("sum != 2 + 4")), hash_result); /* hash table now contains: (1, 2) (3, 4) (-1, 2*2) (-3, 2*4) */ @@ -625,9 +625,9 @@ data.sum = 0; elisp_maphash_unsafe (test_hash_tables_mapper, data.hash_table, (void *) &data); - hash_result = Fcons (list3 (build_string ("simple mapper"), + hash_result = Fcons (list3 (build_ascstring ("simple mapper"), (data.sum == 3 * (2 + 4)) ? Qt : Qnil, - build_string ("sum != 3 * (2 + 4)")), + build_ascstring ("sum != 3 * (2 + 4)")), hash_result); /* Remove entries with negative keys, added by modifying mapper */ @@ -637,9 +637,9 @@ data.sum = 0; elisp_maphash_unsafe (test_hash_tables_mapper, data.hash_table, (void *) &data); - hash_result = Fcons (list3 (build_string ("remove negatives mapper"), + hash_result = Fcons (list3 (build_ascstring ("remove negatives mapper"), (data.sum == 2 + 4) ? Qt : Qnil, - build_string ("sum != 2 + 4")), + build_ascstring ("sum != 2 + 4")), hash_result); return hash_result; diff -r d2ec55325515 -r 8f0cf4fd3d2c src/text.c --- a/src/text.c Sat Feb 06 03:59:18 2010 -0600 +++ b/src/text.c Sat Feb 06 04:01:46 2010 -0600 @@ -4238,7 +4238,7 @@ /* double zero-extend because we may be dealing with Unicode data */ Dynarr_add (conversion_out_dynarr, '\0'); Dynarr_add (conversion_out_dynarr, '\0'); - sink->data.ptr = Dynarr_atp (conversion_out_dynarr, 0); + sink->data.ptr = Dynarr_begin (conversion_out_dynarr); } PROFILE_RECORD_EXITING_SECTION (QSin_internal_external_conversion); @@ -4470,7 +4470,7 @@ cases. So we add a second zero, just like for external data (in that case, because we may be converting to Unicode). */ Dynarr_add (conversion_in_dynarr, '\0'); - sink->data.ptr = Dynarr_atp (conversion_in_dynarr, 0); + sink->data.ptr = Dynarr_begin (conversion_in_dynarr); } PROFILE_RECORD_EXITING_SECTION (QSin_internal_external_conversion); @@ -4532,8 +4532,8 @@ /* We handle here the cases where SRC is a Lisp_Object, internal data (sized or unsized), or external data (sized or unsized), and return type is unsized alloca() or malloc() data. If the return type is a - Lisp_Object, use build_ext_string() for unsized external data, - make_ext_string() for sized external data. If the return type needs to + Lisp_Object, use build_extstring() for unsized external data, + make_extstring() for sized external data. If the return type needs to be sized data, use the *_TO_SIZED_*() macros, and for other more complicated cases, use the original TO_*_FORMAT() macros. */ @@ -4613,7 +4613,7 @@ vals = Dynarr_atp (active_alloca_convert, i); assert (alloca_data); memcpy (alloca_data, vals->dst, vals->dst_size); - xfree (vals->dst, void *); + xfree (vals->dst); Dynarr_delete (active_alloca_convert, i); return alloca_data; } @@ -5158,10 +5158,10 @@ void vars_of_text (void) { - QSin_char_byte_conversion = build_msg_string ("(in char-byte conversion)"); + QSin_char_byte_conversion = build_defer_string ("(in char-byte conversion)"); staticpro (&QSin_char_byte_conversion); QSin_internal_external_conversion = - build_msg_string ("(in internal-external conversion)"); + build_defer_string ("(in internal-external conversion)"); staticpro (&QSin_internal_external_conversion); #ifdef ENABLE_COMPOSITE_CHARS diff -r d2ec55325515 -r 8f0cf4fd3d2c src/text.h --- a/src/text.h Sat Feb 06 03:59:18 2010 -0600 +++ b/src/text.h Sat Feb 06 04:01:46 2010 -0600 @@ -1,7 +1,7 @@ /* Header file for text manipulation primitives and macros. Copyright (C) 1985-1995 Free Software Foundation, Inc. Copyright (C) 1995 Sun Microsystems, Inc. - Copyright (C) 2000, 2001, 2002, 2003, 2004, 2005 Ben Wing. + Copyright (C) 2000, 2001, 2002, 2003, 2004, 2005, 2010 Ben Wing. This file is part of XEmacs. @@ -538,6 +538,17 @@ #endif /* MULE */ +/* ASSERT_ASCTEXT_ASCII(ptr): Check that an Ascbyte * pointer points to + purely ASCII text. Useful for checking that putatively ASCII strings + (i.e. declared as Ascbyte * or const Ascbyte *) are actually ASCII. + This is important because otherwise we need to worry about what + encoding they are in -- internal or some external encoding. + + ASSERT_ASCTEXT_ASCII_LEN(ptr, len): Same as ASSERT_ASCTEXT_ASCII() + but where the length has been explicitly given. Useful if the string + may contain embedded zeroes. +*/ + #ifdef ERROR_CHECK_TEXT #define ASSERT_ASCTEXT_ASCII_LEN(ptr, len) \ do { \ @@ -1925,14 +1936,15 @@ eicpy_ext_len (ei, ei6, ei6len, Qbinary); \ } while (0) -#define eicpy_ext_len(ei, extdata, extlen, codesys) \ -do { \ - const Extbyte *ei7 = (extdata); \ - int ei7len = (extlen); \ - \ - SIZED_EXTERNAL_TO_SIZED_C_STRING (ei7, ei7len, (ei)->data_, \ - (ei)->bytelen_, codesys); \ - (ei)->max_size_allocated_ = (ei)->bytelen_ + 1; \ +#define eicpy_ext_len(ei, extdata, extlen, codesys) \ +do { \ + const Extbyte *ei7 = (extdata); \ + int ei7len = (extlen); \ + \ + TO_INTERNAL_FORMAT (DATA, (ei7, ei7len), \ + ALLOCA, ((ei)->data_, (ei)->bytelen_), \ + codesys); \ + (ei)->max_size_allocated_ = (ei)->bytelen_ + 1; \ (ei)->charlen_ = bytecount_to_charcount ((ei)->data_, (ei)->bytelen_); \ } while (0) @@ -1998,9 +2010,9 @@ if ((ei)->mallocp_) \ { \ if ((ei)->data_) \ - xfree ((ei)->data_, Ibyte *); \ + xfree ((ei)->data_); \ if ((ei)->extdata_) \ - xfree ((ei)->extdata_, Extbyte *); \ + xfree ((ei)->extdata_); \ eiinit_malloc (ei); \ } \ else \ @@ -2025,7 +2037,7 @@ eifind_large_enough_buffer (0, (ei)->bytelen_ + 1); \ ei13newdata = alloca_ibytes ((ei)->max_size_allocated_); \ memcpy (ei13newdata, (ei)->data_, (ei)->bytelen_ + 1); \ - xfree ((ei)->data_, Ibyte *); \ + xfree ((ei)->data_); \ (ei)->data_ = ei13newdata; \ } \ \ @@ -2037,7 +2049,7 @@ /* Double null-terminate in case of Unicode data */ \ ei13newdata[(ei)->extlen_] = '\0'; \ ei13newdata[(ei)->extlen_ + 1] = '\0'; \ - xfree ((ei)->extdata_, Extbyte *); \ + xfree ((ei)->extdata_); \ (ei)->extdata_ = ei13newdata; \ } \ } while (0) @@ -2239,7 +2251,7 @@ { \ if ((ei)->extdata_) \ { \ - xfree ((ei)->extdata_, Extbyte *); \ + xfree ((ei)->extdata_); \ (ei)->extdata_ = 0; \ } \ TO_EXTERNAL_FORMAT (DATA, ((ei)->data_, (ei)->bytelen_), \ @@ -2420,7 +2432,7 @@ of conversions involving raw data and/or Lisp strings, especially when the output is an alloca()ed string. (When the destination is a Lisp_String, there are other functions that should be used instead -- - build_ext_string() and make_ext_string(), for example.) The convenience + build_extstring() and make_extstring(), for example.) The convenience macros are of two types -- the older kind that store the result into a specified variable, and the newer kind that return the result. The newer kind of macros don't exist when the output is sized data, because that @@ -2800,96 +2812,6 @@ #define DFC_LISP_BUFFER_USE_CONVERTED_DATA(sink) \ Lstream_delete (XLSTREAM (dfc_sink.lisp_object)) -/* #define TEST_NEW_DFC */ - -/* Convenience macros for extremely common invocations */ -#ifdef TEST_NEW_DFC -#define C_STRING_TO_EXTERNAL(in, out, codesys) \ - do { * (Extbyte **) &(out) = \ - NEW_C_STRING_TO_EXTERNAL (in, codesys); } while (0) -#define SIZED_C_STRING_TO_EXTERNAL(in, inlen, out, codesys) \ - do { * (Extbyte **) &(out) = \ - NEW_SIZED_C_STRING_TO_EXTERNAL (in, inlen, codesys); } while (0) -#define EXTERNAL_TO_C_STRING(in, out, codesys) \ - do { * (Ibyte **) &(out) = \ - NEW_EXTERNAL_TO_C_STRING (in, codesys); } while (0) -#define SIZED_EXTERNAL_TO_C_STRING(in, inlen, out, codesys) \ - do { * (Ibyte **) &(out) = \ - NEW_SIZED_EXTERNAL_TO_C_STRING (in, inlen, codesys); } while (0) -#define LISP_STRING_TO_EXTERNAL(in, out, codesys) \ - do { * (Extbyte **) &(out) = \ - NEW_LISP_STRING_TO_EXTERNAL (in, codesys); } while (0) -#else -#define C_STRING_TO_EXTERNAL(in, out, codesys) \ - TO_EXTERNAL_FORMAT (C_STRING, in, C_STRING_ALLOCA, out, codesys) -#define SIZED_C_STRING_TO_EXTERNAL(in, inlen, out, codesys) \ - TO_EXTERNAL_FORMAT (DATA, (in, inlen), C_STRING_ALLOCA, out, codesys) -#define EXTERNAL_TO_C_STRING(in, out, codesys) \ - TO_INTERNAL_FORMAT (C_STRING, in, C_STRING_ALLOCA, out, codesys) -#define SIZED_EXTERNAL_TO_C_STRING(in, inlen, out, codesys) \ - TO_INTERNAL_FORMAT (DATA, (in, inlen), C_STRING_ALLOCA, out, codesys) -#define LISP_STRING_TO_EXTERNAL(in, out, codesys) \ - TO_EXTERNAL_FORMAT (LISP_STRING, in, C_STRING_ALLOCA, out, codesys) -#endif /* TEST_NEW_DFC */ - -#define C_STRING_TO_SIZED_EXTERNAL(in, out, outlen, codesys) \ - TO_EXTERNAL_FORMAT (C_STRING, in, ALLOCA, (out, outlen), codesys) -#define SIZED_C_STRING_TO_SIZED_EXTERNAL(in, inlen, out, outlen, codesys) \ - TO_EXTERNAL_FORMAT (DATA, (in, inlen), ALLOCA, (out, outlen), codesys) -#define EXTERNAL_TO_SIZED_C_STRING(in, out, outlen, codesys) \ - TO_INTERNAL_FORMAT (C_STRING, in, ALLOCA, (out, outlen), codesys) -#define SIZED_EXTERNAL_TO_SIZED_C_STRING(in, inlen, out, outlen, codesys) \ - TO_INTERNAL_FORMAT (DATA, (in, inlen), ALLOCA, (out, outlen), codesys) -#define LISP_STRING_TO_SIZED_EXTERNAL(in, out, outlen, codesys) \ - TO_EXTERNAL_FORMAT (LISP_STRING, in, ALLOCA, (out, outlen), codesys) - -/* In place of EXTERNAL_TO_LISP_STRING(), use build_ext_string() and/or - make_ext_string(). */ - -#ifdef TEST_NEW_DFC -#define C_STRING_TO_EXTERNAL_MALLOC(in, out, codesys) \ - do { * (Extbyte **) &(out) = \ - NEW_C_STRING_TO_EXTERNAL_MALLOC (in, codesys); } while (0) -#define SIZED_C_STRING_TO_EXTERNAL_MALLOC(in, inlen, out, codesys) \ - do { * (Extbyte **) &(out) = \ - NEW_SIZED_C_STRING_TO_EXTERNAL_MALLOC (in, inlen, codesys); } \ - while (0) -#define EXTERNAL_TO_C_STRING_MALLOC(in, out, codesys) \ - do { * (Ibyte **) &(out) = \ - NEW_EXTERNAL_TO_C_STRING_MALLOC (in, codesys); } while (0) -#define SIZED_EXTERNAL_TO_C_STRING_MALLOC(in, inlen, out, codesys) \ - do { * (Ibyte **) &(out) = \ - NEW_SIZED_EXTERNAL_TO_C_STRING_MALLOC (in, inlen, codesys); } \ - while (0) -#define LISP_STRING_TO_EXTERNAL_MALLOC(in, out, codesys) \ - do { * (Extbyte **) &(out) = \ - NEW_LISP_STRING_TO_EXTERNAL_MALLOC (in, codesys); } while (0) -#else -#define C_STRING_TO_EXTERNAL_MALLOC(in, out, codesys) \ - TO_EXTERNAL_FORMAT (C_STRING, in, C_STRING_MALLOC, out, codesys) -#define SIZED_C_STRING_TO_EXTERNAL_MALLOC(in, inlen, out, codesys) \ - TO_EXTERNAL_FORMAT (DATA, (in, inlen), C_STRING_MALLOC, out, codesys) -#define EXTERNAL_TO_C_STRING_MALLOC(in, out, codesys) \ - TO_INTERNAL_FORMAT (C_STRING, in, C_STRING_MALLOC, out, codesys) -#define SIZED_EXTERNAL_TO_C_STRING_MALLOC(in, inlen, out, codesys) \ - TO_INTERNAL_FORMAT (DATA, (in, inlen), C_STRING_MALLOC, out, codesys) -#define LISP_STRING_TO_EXTERNAL_MALLOC(in, out, codesys) \ - TO_EXTERNAL_FORMAT (LISP_STRING, in, C_STRING_MALLOC, out, codesys) -#endif /* TEST_NEW_DFC */ - -#define C_STRING_TO_SIZED_EXTERNAL_MALLOC(in, out, outlen, codesys) \ - TO_EXTERNAL_FORMAT (C_STRING, in, MALLOC, (out, outlen), codesys) -#define SIZED_C_STRING_TO_SIZED_EXTERNAL_MALLOC(in, inlen, out, outlen, \ - codesys) \ - TO_EXTERNAL_FORMAT (DATA, (in, inlen), MALLOC, (out, outlen), codesys) -#define EXTERNAL_TO_SIZED_C_STRING_MALLOC(in, out, outlen, codesys) \ - TO_INTERNAL_FORMAT (C_STRING, in, MALLOC, (out, outlen), codesys) -#define SIZED_EXTERNAL_TO_SIZED_C_STRING_MALLOC(in, inlen, out, outlen, \ - codesys) \ - TO_INTERNAL_FORMAT (DATA, (in, inlen), MALLOC, (out, outlen), codesys) -#define LISP_STRING_TO_SIZED_EXTERNAL_MALLOC(in, out, outlen, codesys) \ - TO_EXTERNAL_FORMAT (LISP_STRING, in, MALLOC, (out, outlen), codesys) - enum new_dfc_src_type { DFC_EXTERNAL, @@ -2912,7 +2834,7 @@ END_C_DECLS -/* Version of EXTERNAL_TO_C_STRING that *RETURNS* the translated string, +/* Version of EXTERNAL_TO_ITEXT that *RETURNS* the translated string, still in alloca() space. Requires some trickiness to do this, but gets it done! */ @@ -2934,48 +2856,36 @@ (#src, ALLOCA_FUNCALL_OK (new_dfc_convert_size (#src, src, src_size, \ type, codesys))) -#define NEW_EXTERNAL_TO_C_STRING(src, codesys) \ - (Ibyte *) NEW_DFC_CONVERT_1_ALLOCA (src, -1, DFC_EXTERNAL, codesys) -#define NEW_EXTERNAL_TO_C_STRING_MALLOC(src, codesys) \ - (Ibyte *) new_dfc_convert_malloc (src, -1, DFC_EXTERNAL, codesys) -#define NEW_SIZED_EXTERNAL_TO_C_STRING(src, len, codesys) \ - (Ibyte *) NEW_DFC_CONVERT_1_ALLOCA (src, len, DFC_SIZED_EXTERNAL, codesys) -#define NEW_SIZED_EXTERNAL_TO_C_STRING_MALLOC(src, len, codesys) \ - (Ibyte *) new_dfc_convert_malloc (src, len, DFC_SIZED_EXTERNAL, codesys) -#define NEW_C_STRING_TO_EXTERNAL(src, codesys) \ - (Extbyte *) NEW_DFC_CONVERT_1_ALLOCA (src, -1, DFC_INTERNAL, codesys) -#define NEW_C_STRING_TO_EXTERNAL_MALLOC(src, codesys) \ - (Extbyte *) new_dfc_convert_malloc (src, -1, DFC_INTERNAL, codesys) -#define NEW_SIZED_C_STRING_TO_EXTERNAL(src, len, codesys) \ - (Extbyte *) NEW_DFC_CONVERT_1_ALLOCA (src, len, DFC_SIZED_INTERNAL, codesys) -#define NEW_SIZED_C_STRING_TO_EXTERNAL_MALLOC(src, len, codesys) \ - (Extbyte *) new_dfc_convert_malloc (src, len, DFC_SIZED_INTERNAL, codesys) -#define NEW_LISP_STRING_TO_EXTERNAL(src, codesys) \ - (Extbyte *) NEW_DFC_CONVERT_1_ALLOCA (LISP_TO_VOID (src), -1, \ - DFC_LISP_STRING, codesys) -#define NEW_LISP_STRING_TO_EXTERNAL_MALLOC(src, codesys) \ - (Extbyte *) new_dfc_convert_malloc (LISP_TO_VOID (src), -1, \ - DFC_LISP_STRING, codesys) - -/* Standins for various encodings. */ -#ifdef WEXTTEXT_IS_WIDE -#define Qcommand_argument_encoding Qmswindows_unicode -#define Qenvironment_variable_encoding Qmswindows_unicode -#else -#define Qcommand_argument_encoding Qnative -#define Qenvironment_variable_encoding Qnative -#endif -#define Qunix_host_name_encoding Qnative -#define Qunix_service_name_encoding Qnative -#define Qtime_function_encoding Qnative -#define Qtime_zone_encoding Qtime_function_encoding -#define Qmswindows_host_name_encoding Qmswindows_multibyte -#define Qmswindows_service_name_encoding Qmswindows_multibyte -#define Quser_name_encoding Qnative -#define Qerror_message_encoding Qnative -#define Qjpeg_error_message_encoding Qerror_message_encoding -#define Qtooltalk_encoding Qnative -#define Qgtk_encoding Qnative +#define EXTERNAL_TO_ITEXT(src, codesys) \ + ((Ibyte *) NEW_DFC_CONVERT_1_ALLOCA (src, -1, DFC_EXTERNAL, codesys)) +#define EXTERNAL_TO_ITEXT_MALLOC(src, codesys) \ + ((Ibyte *) new_dfc_convert_malloc (src, -1, DFC_EXTERNAL, codesys)) +#define SIZED_EXTERNAL_TO_ITEXT(src, len, codesys) \ + ((Ibyte *) NEW_DFC_CONVERT_1_ALLOCA (src, len, DFC_SIZED_EXTERNAL, codesys)) +#define SIZED_EXTERNAL_TO_ITEXT_MALLOC(src, len, codesys) \ + ((Ibyte *) new_dfc_convert_malloc (src, len, DFC_SIZED_EXTERNAL, codesys)) +#define ITEXT_TO_EXTERNAL(src, codesys) \ + ((Extbyte *) NEW_DFC_CONVERT_1_ALLOCA (src, -1, DFC_INTERNAL, codesys)) +#define ITEXT_TO_EXTERNAL_MALLOC(src, codesys) \ + ((Extbyte *) new_dfc_convert_malloc (src, -1, DFC_INTERNAL, codesys)) +#define LISP_STRING_TO_EXTERNAL(src, codesys) \ + ((Extbyte *) NEW_DFC_CONVERT_1_ALLOCA (LISP_TO_VOID (src), -1, \ + DFC_LISP_STRING, codesys)) +#define LISP_STRING_TO_EXTERNAL_MALLOC(src, codesys) \ + ((Extbyte *) new_dfc_convert_malloc (LISP_TO_VOID (src), -1, \ + DFC_LISP_STRING, codesys)) +/* In place of EXTERNAL_TO_LISP_STRING(), use build_extstring() and/or + make_extstring(). */ + +/* The next four have two outputs, so we make both of them be parameters */ +#define ITEXT_TO_SIZED_EXTERNAL(in, out, outlen, codesys) \ + TO_EXTERNAL_FORMAT (C_STRING, in, ALLOCA, (out, outlen), codesys) +#define LISP_STRING_TO_SIZED_EXTERNAL(in, out, outlen, codesys) \ + TO_EXTERNAL_FORMAT (LISP_STRING, in, ALLOCA, (out, outlen), codesys) +#define ITEXT_TO_SIZED_EXTERNAL_MALLOC(in, out, outlen, codesys) \ + TO_EXTERNAL_FORMAT (C_STRING, in, MALLOC, (out, outlen), codesys) +#define LISP_STRING_TO_SIZED_EXTERNAL_MALLOC(in, out, outlen, codesys) \ + TO_EXTERNAL_FORMAT (LISP_STRING, in, MALLOC, (out, outlen), codesys) /* Wexttext functions. The type of Wexttext is selected at compile time and will sometimes be wchar_t, sometimes char. */ @@ -3001,7 +2911,7 @@ #define wext_atol(str) wcstol (str, 0, 10) #define wext_sprintf wsprintfW /* Huh? both wsprintfA and wsprintfW? */ #define wext_getenv _wgetenv -#define build_wext_string(str, cs) build_ext_string ((Extbyte *) str, cs) +#define build_wext_string(str, cs) build_extstring ((Extbyte *) str, cs) #define WEXTTEXT_TO_8_BIT(arg) WEXTTEXT_TO_MULTIBYTE(arg) #ifdef WIN32_NATIVE int XCDECL wext_retry_open (const Wexttext *path, int oflag, ...); @@ -3026,14 +2936,14 @@ #define wext_atol(str) atol (str) #define wext_sprintf sprintf #define wext_getenv getenv -#define build_wext_string build_ext_string +#define build_wext_string build_extstring #define wext_retry_open retry_open #define wext_access access #define wext_stat stat #define WEXTTEXT_TO_8_BIT(arg) ((Extbyte *) arg) #endif -/* Standins for various X encodings. +/* Standins for various encodings. About encodings in X: @@ -3089,6 +2999,31 @@ COMPOUND_TEXT otherwise. */ +#ifdef WEXTTEXT_IS_WIDE +#define Qcommand_argument_encoding Qmswindows_unicode +#define Qenvironment_variable_encoding Qmswindows_unicode +#else +#define Qcommand_argument_encoding Qnative +#define Qenvironment_variable_encoding Qnative +#endif +#define Qunix_host_name_encoding Qnative +#define Qunix_service_name_encoding Qnative +#define Qtime_function_encoding Qnative +#define Qtime_zone_encoding Qtime_function_encoding +#define Qmswindows_host_name_encoding Qmswindows_multibyte +#define Qmswindows_service_name_encoding Qmswindows_multibyte +#define Quser_name_encoding Qnative +#define Qerror_message_encoding Qnative +#define Qjpeg_error_message_encoding Qerror_message_encoding +#define Qtooltalk_encoding Qnative +#define Qgtk_encoding Qnative + +#define Qdll_symbol_encoding Qnative +#define Qdll_function_name_encoding Qdll_symbol_encoding +#define Qdll_variable_name_encoding Qdll_symbol_encoding +#define Qdll_filename_encoding Qfile_name +#define Qemodule_string_encoding Qnative + /* !!#### Need to verify the encoding used in lwlib -- Qnative or Qctext? Almost certainly the former. Use a standin for now. */ #define Qlwlib_encoding Qnative @@ -3130,11 +3065,11 @@ \ if (!__gserr__) \ { \ - var = alloca_ibytes (99); \ + var = alloca_ibytes (99); \ qxesprintf (var, "Unknown error %d", __gsnum__); \ } \ else \ - EXTERNAL_TO_C_STRING (__gserr__, var, Qstrerror_encoding); \ + var = EXTERNAL_TO_ITEXT (__gserr__, Qstrerror_encoding); \ } while (0) #endif /* INCLUDED_text_h_ */ diff -r d2ec55325515 -r 8f0cf4fd3d2c src/toolbar-msw.c --- a/src/toolbar-msw.c Sat Feb 06 03:59:18 2010 -0600 +++ b/src/toolbar-msw.c Sat Feb 06 04:01:46 2010 -0600 @@ -294,7 +294,7 @@ if (! (bitmap = mswindows_create_resized_bitmap (p, f, bmwidth, bmheight))) { - xfree (button_tbl, TBBUTTON *); + xfree (button_tbl); if (ilist) ImageList_Destroy (ilist); gui_error ("Couldn't resize pixmap", instance); } @@ -317,7 +317,7 @@ ? ILC_MASK : 0) | ILC_COLOR24, nbuttons, nbuttons * 2 ))) { - xfree (button_tbl, TBBUTTON *); + xfree (button_tbl); gui_error ("Couldn't create image list", instance); } @@ -332,7 +332,7 @@ mask ? mask : IMAGE_INSTANCE_MSWINDOWS_MASK (p))) < 0) { - xfree (button_tbl, TBBUTTON *); + xfree (button_tbl); if (ilist) ImageList_Destroy (ilist); gui_error @@ -394,7 +394,7 @@ NULL, NULL))==NULL) { - xfree (button_tbl, TBBUTTON *); + xfree (button_tbl); ImageList_Destroy (ilist); gui_error ("couldn't create toolbar", Qunbound); } @@ -468,7 +468,7 @@ mswindows_move_toolbar (f, pos); if (button_tbl) - xfree (button_tbl, TBBUTTON *); + xfree (button_tbl); SET_TOOLBAR_WAS_VISIBLE_FLAG (f, pos, 1); } diff -r d2ec55325515 -r 8f0cf4fd3d2c src/toolbar-xlike.c --- a/src/toolbar-xlike.c Sat Feb 06 03:59:18 2010 -0600 +++ b/src/toolbar-xlike.c Sat Feb 06 04:01:46 2010 -0600 @@ -296,7 +296,7 @@ buf = Dynarr_new (Ichar); convert_ibyte_string_into_ichar_dynarr (XSTRING_DATA (string), XSTRING_LENGTH (string), buf); - find_charsets_in_ichar_string (charsets, Dynarr_atp (buf, 0), + find_charsets_in_ichar_string (charsets, Dynarr_begin (buf), Dynarr_length (buf)); ensure_face_cachel_complete (cachel, window, charsets); face_cachel_charset_font_metric_info (cachel, charsets, &fm); diff -r d2ec55325515 -r 8f0cf4fd3d2c src/tooltalk.c --- a/src/tooltalk.c Sat Feb 06 03:59:18 2010 -0600 +++ b/src/tooltalk.c Sat Feb 06 04:01:46 2010 -0600 @@ -312,7 +312,7 @@ { CIbyte *err; - EXTERNAL_TO_C_STRING (tt_status_message (st), err, Qtooltalk_encoding); + err = EXTERNAL_TO_ITEXT (tt_status_message (st), Qtooltalk_encoding); signal_error (Qtooltalk_error, err, Qunbound); } } @@ -514,27 +514,27 @@ static Lisp_Object tt_build_c_string (char *s) { - return build_string (s ? s : ""); + return build_cistring (s ? s : ""); } static Lisp_Object tt_opnum_string (int n) { - char buf[32]; + Ascbyte buf[32]; sprintf (buf, "%u", n); - return build_string (buf); + return build_ascstring (buf); } static Lisp_Object tt_message_arg_ival_string (Tt_message m, int n) { - char buf[DECIMAL_PRINT_SIZE (long)]; + Ascbyte buf[DECIMAL_PRINT_SIZE (long)]; int value; check_status (tt_message_arg_ival (m, n, &value)); long_to_string (buf, value); - return build_string (buf); + return build_ascstring (buf); } static Lisp_Object @@ -773,9 +773,8 @@ Extbyte *value_ext; Bytecount value_ext_len; CHECK_STRING (value); - TO_EXTERNAL_FORMAT (LISP_STRING, value, - ALLOCA, (value_ext, value_ext_len), - Qtooltalk_encoding); + LISP_STRING_TO_SIZED_EXTERNAL (value, value_ext, value_ext_len, + Qtooltalk_encoding); tt_message_arg_bval_set (m, n, (unsigned char *) value_ext, value_ext_len); } else if (EQ (attribute, Qtt_arg_ival)) @@ -787,7 +786,7 @@ { const char *value_ext; CHECK_STRING (value); - LISP_STRING_TO_EXTERNAL (value, value_ext, Qtooltalk_encoding); + value_ext = LISP_STRING_TO_EXTERNAL (value, Qtooltalk_encoding); tt_message_arg_val_set (m, n, value_ext); } else if (EQ (attribute, Qtt_status)) @@ -812,7 +811,7 @@ { const char *value_ext; CHECK_STRING (value); - LISP_STRING_TO_EXTERNAL (value, value_ext, Qtooltalk_encoding); + value_ext = LISP_STRING_TO_EXTERNAL (value, Qtooltalk_encoding); (*fun_str) (m, value_ext); } @@ -928,13 +927,13 @@ { const char *vtype_ext; - LISP_STRING_TO_EXTERNAL (vtype, vtype_ext, Qtooltalk_encoding); + vtype_ext = LISP_STRING_TO_EXTERNAL (vtype, Qtooltalk_encoding); if (NILP (value)) tt_message_arg_add (m, n, vtype_ext, NULL); else if (STRINGP (value)) { const char *value_ext; - LISP_STRING_TO_EXTERNAL (value, value_ext, Qtooltalk_encoding); + value_ext = LISP_STRING_TO_EXTERNAL (value, Qtooltalk_encoding); tt_message_arg_add (m, n, vtype_ext, value_ext); } else if (INTP (value)) @@ -1039,28 +1038,28 @@ { const char *value_ext; CHECK_STRING (value); - LISP_STRING_TO_EXTERNAL (value, value_ext, Qtooltalk_encoding); + value_ext = LISP_STRING_TO_EXTERNAL (value, Qtooltalk_encoding); tt_pattern_file_add (p, value_ext); } else if (EQ (attribute, Qtt_object)) { const char *value_ext; CHECK_STRING (value); - LISP_STRING_TO_EXTERNAL (value, value_ext, Qtooltalk_encoding); + value_ext = LISP_STRING_TO_EXTERNAL (value, Qtooltalk_encoding); tt_pattern_object_add (p, value_ext); } else if (EQ (attribute, Qtt_op)) { const char *value_ext; CHECK_STRING (value); - LISP_STRING_TO_EXTERNAL (value, value_ext, Qtooltalk_encoding); + value_ext = LISP_STRING_TO_EXTERNAL (value, Qtooltalk_encoding); tt_pattern_op_add (p, value_ext); } else if (EQ (attribute, Qtt_otype)) { const char *value_ext; CHECK_STRING (value); - LISP_STRING_TO_EXTERNAL (value, value_ext, Qtooltalk_encoding); + value_ext = LISP_STRING_TO_EXTERNAL (value, Qtooltalk_encoding); tt_pattern_otype_add (p, value_ext); } else if (EQ (attribute, Qtt_scope)) @@ -1072,21 +1071,21 @@ { const char *value_ext; CHECK_STRING (value); - LISP_STRING_TO_EXTERNAL (value, value_ext, Qtooltalk_encoding); + value_ext = LISP_STRING_TO_EXTERNAL (value, Qtooltalk_encoding); tt_pattern_sender_add (p, value_ext); } else if (EQ (attribute, Qtt_sender_ptype)) { const char *value_ext; CHECK_STRING (value); - LISP_STRING_TO_EXTERNAL (value, value_ext, Qtooltalk_encoding); + value_ext = LISP_STRING_TO_EXTERNAL (value, Qtooltalk_encoding); tt_pattern_sender_ptype_add (p, value_ext); } else if (EQ (attribute, Qtt_session)) { const char *value_ext; CHECK_STRING (value); - LISP_STRING_TO_EXTERNAL (value, value_ext, Qtooltalk_encoding); + value_ext = LISP_STRING_TO_EXTERNAL (value, Qtooltalk_encoding); tt_pattern_session_add (p, value_ext); } else if (EQ (attribute, Qtt_state)) @@ -1127,13 +1126,13 @@ { const char *vtype_ext; - LISP_STRING_TO_EXTERNAL (vtype, vtype_ext, Qtooltalk_encoding); + vtype_ext = LISP_STRING_TO_EXTERNAL (vtype, Qtooltalk_encoding); if (NILP (value)) tt_pattern_arg_add (p, n, vtype_ext, NULL); else if (STRINGP (value)) { const char *value_ext; - LISP_STRING_TO_EXTERNAL (value, value_ext, Qtooltalk_encoding); + value_ext = LISP_STRING_TO_EXTERNAL (value, Qtooltalk_encoding); tt_pattern_arg_add (p, n, vtype_ext, value_ext); } else if (INTP (value)) @@ -1215,8 +1214,8 @@ */ ()) { - char *procid = tt_default_procid (); - return procid ? build_string (procid) : Qnil; + Extbyte *procid = tt_default_procid (); + return procid ? build_extstring (procid, Qtooltalk_encoding) : Qnil; } DEFUN ("tooltalk-default-session", Ftooltalk_default_session, 0, 0, 0, /* @@ -1224,8 +1223,8 @@ */ ()) { - char *session = tt_default_session (); - return session ? build_string (session) : Qnil; + Extbyte *session = tt_default_session (); + return session ? build_extstring (session, Qtooltalk_encoding) : Qnil; } static void @@ -1265,7 +1264,7 @@ tt_session_join (tt_default_session ()); - lp = connect_to_file_descriptor (build_string ("tooltalk"), Qnil, + lp = connect_to_file_descriptor (build_ascstring ("tooltalk"), Qnil, Vtooltalk_fd, Vtooltalk_fd); if (!NILP (lp)) { @@ -1421,8 +1420,8 @@ */ ); Vtooltalk_unprocessed_message_hook = Qnil; - Tooltalk_Message_plist_str = build_msg_string ("Tooltalk Message plist"); - Tooltalk_Pattern_plist_str = build_msg_string ("Tooltalk Pattern plist"); + Tooltalk_Message_plist_str = build_defer_string ("Tooltalk Message plist"); + Tooltalk_Pattern_plist_str = build_defer_string ("Tooltalk Pattern plist"); staticpro(&Tooltalk_Message_plist_str); staticpro(&Tooltalk_Pattern_plist_str); diff -r d2ec55325515 -r 8f0cf4fd3d2c src/ui-byhand.c --- a/src/ui-byhand.c Sat Feb 06 03:59:18 2010 -0600 +++ b/src/ui-byhand.c Sat Feb 06 04:01:46 2010 -0600 @@ -187,7 +187,7 @@ if (text) { - rval = build_string (text); + rval = build_cistring (text); /* NOTE: This is NOT a memory leak. GtkCList returns a pointer to internally used memory, not a copy of it. g_free (text); @@ -274,7 +274,7 @@ return (list3 (pixmap ? build_gtk_boxed (pixmap, GTK_TYPE_GDK_WINDOW) : Qnil, mask ? build_gtk_boxed (mask, GTK_TYPE_GDK_WINDOW) : Qnil, - (text && text[0]) ? build_string (text) : Qnil)); + (text && text[0]) ? build_cistring (text) : Qnil)); } /* void gtk_color_selection_get_color(GtkColorSelection *colorsel, gdouble *color); */ @@ -425,7 +425,7 @@ gtk_label_get (GTK_LABEL (XGTK_OBJECT (label)->object), &string); - return (build_string (string)); + return (build_cistring (string)); } DEFUN ("gtk-notebook-query-tab-label-packing", Fgtk_notebook_query_tab_label_packing, 2, 2, 0, /* diff -r d2ec55325515 -r 8f0cf4fd3d2c src/ui-gtk.c --- a/src/ui-gtk.c Sat Feb 06 03:59:18 2010 -0600 +++ b/src/ui-gtk.c Sat Feb 06 04:01:46 2010 -0600 @@ -93,7 +93,7 @@ /* If the dll name has a directory component in it, then we should expand it. */ - if (!NILP (Fstring_match (build_string ("/"), dll, Qnil, Qnil))) + if (!NILP (Fstring_match (build_ascstring ("/"), dll, Qnil, Qnil))) dll = Fexpand_file_name (dll, Qnil); /* Check if we have already opened it first */ @@ -384,7 +384,7 @@ GTK_VALUE_POINTER (a) = * (void **) v; \ break; \ } \ - if (freep) xfree(v, void *); \ + if (freep) xfree (v); \ } while (0) static gpointer __allocate_object_storage (GtkType t) @@ -462,43 +462,43 @@ switch (GTK_FUNDAMENTAL_TYPE (t)) { case GTK_TYPE_NONE: - return (build_string ("NONE")); + return (build_ascstring ("NONE")); /* flag types */ case GTK_TYPE_CHAR: case GTK_TYPE_UCHAR: - return (build_string ("CHAR")); + return (build_ascstring ("CHAR")); case GTK_TYPE_BOOL: - return (build_string ("BOOL")); + return (build_ascstring ("BOOL")); case GTK_TYPE_ENUM: case GTK_TYPE_FLAGS: case GTK_TYPE_INT: case GTK_TYPE_UINT: - return (build_string ("INT")); + return (build_ascstring ("INT")); case GTK_TYPE_LONG: case GTK_TYPE_ULONG: - return (build_string ("LONG")); + return (build_ascstring ("LONG")); case GTK_TYPE_FLOAT: case GTK_TYPE_DOUBLE: - return (build_string ("FLOAT")); + return (build_ascstring ("FLOAT")); case GTK_TYPE_STRING: - return (build_string ("STRING")); + return (build_ascstring ("STRING")); case GTK_TYPE_BOXED: case GTK_TYPE_POINTER: - return (build_string ("POINTER")); + return (build_ascstring ("POINTER")); case GTK_TYPE_OBJECT: - return (build_string ("OBJECT")); + return (build_ascstring ("OBJECT")); case GTK_TYPE_CALLBACK: - return (build_string ("CALLBACK")); + return (build_ascstring ("CALLBACK")); default: /* I can't put this in the main switch statement because it is a new fundamental type that is not fixed at compile time. *sigh* */ if (IS_XEMACS_GTK_FUNDAMENTAL_TYPE(t, GTK_TYPE_ARRAY)) - return (build_string ("ARRAY")); + return (build_ascstring ("ARRAY")); if (IS_XEMACS_GTK_FUNDAMENTAL_TYPE(t, GTK_TYPE_LISTOF)) - return (build_string ("LIST")); + return (build_ascstring ("LIST")); return (Qnil); } } @@ -642,13 +642,13 @@ { invalid_argument ("Do not know how to marshal", type); } - marshaller = concat3 (marshaller, build_string ("_"), marshaller_type); + marshaller = concat3 (marshaller, build_ascstring ("_"), marshaller_type); n_args++; } } else { - marshaller = concat3 (marshaller, build_string ("_"), type_to_marshaller_type (GTK_TYPE_NONE)); + marshaller = concat3 (marshaller, build_ascstring ("_"), type_to_marshaller_type (GTK_TYPE_NONE)); } rettype = Fsymbol_name (rettype); @@ -661,8 +661,8 @@ import_gtk_type (data->return_type); - marshaller = concat3 (type_to_marshaller_type (data->return_type), build_string ("_"), marshaller); - marshaller = concat2 (build_string ("emacs_gtk_marshal_"), marshaller); + marshaller = concat3 (type_to_marshaller_type (data->return_type), build_ascstring ("_"), marshaller); + marshaller = concat2 (build_ascstring ("emacs_gtk_marshal_"), marshaller); marshaller_func = (ffi_marshalling_function) find_marshaller ((char *) XSTRING_DATA (marshaller)); @@ -797,11 +797,11 @@ if (print_readably) printing_unreadable_lcrecord (obj, 0); - write_c_string (printcharfun, "#alive_p) - write_c_string (printcharfun, gtk_type_name (GTK_OBJECT_TYPE (XGTK_OBJECT (obj)->object))); + write_cistring (printcharfun, gtk_type_name (GTK_OBJECT_TYPE (XGTK_OBJECT (obj)->object))); else - write_c_string (printcharfun, "dead"); + write_ascstring (printcharfun, "dead"); write_fmt_string (printcharfun, ") %p>", (void *) XGTK_OBJECT (obj)->object); } @@ -1116,8 +1116,8 @@ if (print_readably) printing_unreadable_lcrecord (obj, 0); - write_c_string (printcharfun, "#object_type)); + write_ascstring (printcharfun, "#object_type)); write_fmt_string (printcharfun, ") %p>", (void *) XGTK_BOXED (obj)->object); } @@ -1496,7 +1496,7 @@ case GTK_TYPE_DOUBLE: return (make_float (GTK_VALUE_DOUBLE (*arg))); case GTK_TYPE_STRING: - return (build_string (GTK_VALUE_STRING (*arg))); + return (build_cistring (GTK_VALUE_STRING (*arg))); case GTK_TYPE_FLAGS: return (flags_to_list (GTK_VALUE_FLAGS (*arg), arg->type)); case GTK_TYPE_ENUM: @@ -2136,7 +2136,7 @@ if (NILP (alist)) { - invalid_argument ("Unknown enumeration", build_string (gtk_type_name (t))); + invalid_argument ("Unknown enumeration", build_cistring (gtk_type_name (t))); } value = Fassq (obj, alist); @@ -2205,7 +2205,7 @@ if (NILP (alist)) { - invalid_argument ("Unknown enumeration", build_string (gtk_type_name (t))); + invalid_argument ("Unknown enumeration", build_cistring (gtk_type_name (t))); } cell = Frassq (make_int (value), alist); diff -r d2ec55325515 -r 8f0cf4fd3d2c src/unexaix.c --- a/src/unexaix.c Sat Feb 06 03:59:18 2010 -0600 +++ b/src/unexaix.c Sat Feb 06 04:01:46 2010 -0600 @@ -122,7 +122,7 @@ if (fd) close (fd); report_error_with_errno (Qio_error, "Cannot unexec", - build_string (file)); + build_cistring (file)); } #endif /* emacs */ diff -r d2ec55325515 -r 8f0cf4fd3d2c src/unexec.c --- a/src/unexec.c Sat Feb 06 03:59:18 2010 -0600 +++ b/src/unexec.c Sat Feb 06 04:01:46 2010 -0600 @@ -298,7 +298,7 @@ if (fd) close (fd); report_error_with_errno (Qio_error, "Cannot unexec", - build_ext_string (file, Qfile_name)); + build_extstring (file, Qfile_name)); } #endif /* emacs */ diff -r d2ec55325515 -r 8f0cf4fd3d2c src/unicode.c --- a/src/unicode.c Sat Feb 06 03:59:18 2010 -0600 +++ b/src/unicode.c Sat Feb 06 04:01:46 2010 -0600 @@ -508,7 +508,7 @@ } } - xfree (table, void *); + xfree (table); } static void @@ -526,7 +526,7 @@ } } - xfree (table, void *); + xfree (table); } void @@ -1155,7 +1155,7 @@ qxesprintf(setname, "jit-ucs-charset-%d", number_of_jit_charsets); Vcurrent_jit_charset = Fmake_charset - (intern((const CIbyte *)setname), Vcharset_descr, + (intern_istring (setname), Vcharset_descr, /* Set encode-as-utf-8 to t, to have this character set written using UTF-8 escapes in escape-quoted and ctext. This sidesteps the fact that our internal character -> Unicode @@ -2826,10 +2826,10 @@ write_fmt_string_lisp (printcharfun, "(%s", 1, unicode_getprop (cs, Qunicode_type)); if (XCODING_SYSTEM_UNICODE_LITTLE_ENDIAN (cs)) - write_c_string (printcharfun, ", little-endian"); + write_ascstring (printcharfun, ", little-endian"); if (XCODING_SYSTEM_UNICODE_NEED_BOM (cs)) - write_c_string (printcharfun, ", need-bom"); - write_c_string (printcharfun, ")"); + write_ascstring (printcharfun, ", need-bom"); + write_ascstring (printcharfun, ")"); } #ifdef MULE @@ -3048,18 +3048,12 @@ if (flags & QUERY_METHOD_ERRORP) { - DECLARE_EISTRING (error_details); - - eicpy_ascii (error_details, "Cannot encode "); - eicat_lstr (error_details, - make_string_from_buffer (buf, fail_range_start, - pos - - fail_range_start)); - eicat_ascii (error_details, " using coding system"); - - signal_error (Qtext_conversion_error, - (const CIbyte *)(eidata (error_details)), - XCODING_SYSTEM_NAME (codesys)); + signal_error_2 + (Qtext_conversion_error, + "Cannot encode using coding system", + make_string_from_buffer (buf, fail_range_start, + pos - fail_range_start), + XCODING_SYSTEM_NAME (codesys)); } if (NILP (result)) @@ -3219,7 +3213,7 @@ Vlast_jit_charset_final = make_char (0x30); staticpro (&Vcharset_descr); Vcharset_descr - = build_string ("Mule charset for otherwise unknown Unicode code points."); + = build_defer_string ("Mule charset for otherwise unknown Unicode code points."); staticpro (&Vlanguage_unicode_precedence_list); Vlanguage_unicode_precedence_list = Qnil; @@ -3268,7 +3262,7 @@ found (that is, they're probably Mule-specific charsets like Ethiopic or IPA.) */ ); - Qunicode_registries = vector1(build_string("iso10646-1")); + Qunicode_registries = vector1(build_ascstring("iso10646-1")); /* Initialised in lisp/mule/general-late.el, by a call to #'set-unicode-query-skip-chars-args. Or at least they would be, but we @@ -3298,9 +3292,9 @@ Cygwin 1.7 -- used in LOCAL_FILE_FORMAT_TO_TSTR() et al. */ Fmake_coding_system_internal (Qutf_8, Qunicode, - build_msg_string ("UTF-8"), + build_defer_string ("UTF-8"), nconc2 (list4 (Qdocumentation, - build_msg_string ( + build_defer_string ( "UTF-8 Unicode encoding -- ASCII-compatible 8-bit variable-width encoding\n" "sharing the following principles with the Mule-internal encoding:\n" "\n" @@ -3322,6 +3316,6 @@ " -- Given only the leading byte, you know how many following bytes\n" " are present.\n" ), - Qmnemonic, build_string ("UTF8")), + Qmnemonic, build_ascstring ("UTF8")), list2 (Qunicode_type, Qutf_8))); } diff -r d2ec55325515 -r 8f0cf4fd3d2c src/win32.c --- a/src/win32.c Sat Feb 06 03:59:18 2010 -0600 +++ b/src/win32.c Sat Feb 06 04:01:46 2010 -0600 @@ -90,12 +90,10 @@ Lisp_Object tstr_to_local_file_format (Extbyte *path) { - Ibyte *ttlff; + Ibyte *pathint = TSTR_TO_ITEXT (path); + INTERNAL_MSWIN_TO_LOCAL_FILE_FORMAT (pathint, pathint); - TSTR_TO_C_STRING (path, ttlff); - INTERNAL_MSWIN_TO_LOCAL_FILE_FORMAT (ttlff, ttlff); - - return build_intstring (ttlff); + return build_istring (pathint); } /* Normalize filename by converting all path separators to the specified @@ -271,7 +269,7 @@ break; } - TSTR_TO_C_STRING (lpMsgBuf, inres); + inres = TSTR_TO_ITEXT (lpMsgBuf); len = qxestrlen (inres); /* Messages tend to end with a period and newline */ if (len >= 3 && !qxestrcmp_ascii (inres + len - 3, ".\r\n")) @@ -289,7 +287,7 @@ } void -mswindows_output_last_error (char *frob) +mswindows_output_last_error (const Ascbyte *frob) { int errval = GetLastError (); Lisp_Object errmess = mswindows_lisp_error (errval); @@ -299,11 +297,10 @@ } DOESNT_RETURN -mswindows_report_process_error (const char *string, Lisp_Object data, +mswindows_report_process_error (const Ascbyte *reason, Lisp_Object data, int errnum) { - report_file_type_error (Qprocess_error, mswindows_lisp_error (errnum), - string, data); + signal_error_2 (Qprocess_error, reason, mswindows_lisp_error (errnum), data); } DEFUN ("mswindows-shell-execute", Fmswindows_shell_execute, 2, 4, 0, /* @@ -345,10 +342,10 @@ Extbyte *doc = NULL; if (STRINGP (operation)) - LISP_STRING_TO_TSTR (operation, opext); + opext = LISP_STRING_TO_TSTR (operation); /* #### What about path names, which may be links? */ if (STRINGP (parameters)) - LISP_STRING_TO_TSTR (parameters, parmext); + parmext = LISP_STRING_TO_TSTR (parameters); if (STRINGP (current_dir)) LISP_LOCAL_FILE_FORMAT_TO_TSTR (current_dir, path); if (STRINGP (document)) @@ -405,7 +402,7 @@ /* Use mule and cygwin-safe APIs top get at file data. */ LOCAL_FILE_FORMAT_TO_INTERNAL_MSWIN (p, p); - return build_intstring (p); + return build_istring (p); } #endif @@ -435,7 +432,7 @@ if (!mswindows_read_link_hash) mswindows_read_link_hash = make_string_hash_table (1000); - C_STRING_TO_TSTR (fname, fnameext); + fnameext = ITEXT_TO_TSTR (fname); /* See if we can find a cached value. */ @@ -552,7 +549,7 @@ PATH_MAX_TCHAR, &wfd, 0) #endif == S_OK) - TSTR_TO_C_STRING_MALLOC (resolved, retval); + retval = TSTR_TO_ITEXT_MALLOC (resolved); XECOMCALL0 (ppf, Release); } @@ -584,15 +581,14 @@ /* Always Unicode. Not obvious from the IPersistFile documentation, but look under "Shell Link" for example code. */ - C_STRING_TO_EXTERNAL (fname, fname_unicode, - Qmswindows_unicode); + fname_unicode = ITEXT_TO_EXTERNAL (fname, Qmswindows_unicode); if (XECOMCALL2 (ppf, Load, (LPWSTR) fname_unicode, STGM_READ) == S_OK && XECOMCALL4 (psl, GetPath, resolved, PATH_MAX_TCHAR, &wfd, 0) == S_OK) - TSTR_TO_C_STRING_MALLOC (resolved, retval); + retval = TSTR_TO_ITEXT_MALLOC (resolved); XECOMCALL0 (ppf, Release); } @@ -603,7 +599,7 @@ /* Cache newly found value */ if (rlh->resolved) - xfree (rlh->resolved, Ibyte *); + xfree (rlh->resolved); rlh->resolved = retval ? qxestrdup (retval) : NULL; return retval; diff -r d2ec55325515 -r 8f0cf4fd3d2c src/window.c --- a/src/window.c Sat Feb 06 03:59:18 2010 -0600 +++ b/src/window.c Sat Feb 06 04:01:46 2010 -0600 @@ -318,10 +318,10 @@ if (print_readably) printing_unreadable_lcrecord (obj, 0); - write_c_string (printcharfun, "#modeline) - modeline_height = (Dynarr_atp (dla, 0)->ascent + - Dynarr_atp (dla, 0)->descent); + if (dla && Dynarr_length (dla) && Dynarr_begin (dla)->modeline) + modeline_height = (Dynarr_begin (dla)->ascent + + Dynarr_begin (dla)->descent); else { dla = window_display_lines (w, CURRENT_DISP); - if (dla && Dynarr_length (dla) && Dynarr_atp (dla, 0)->modeline) - modeline_height = (Dynarr_atp (dla, 0)->ascent + - Dynarr_atp (dla, 0)->descent); + if (dla && Dynarr_length (dla) && Dynarr_begin (dla)->modeline) + modeline_height = (Dynarr_begin (dla)->ascent + + Dynarr_begin (dla)->descent); else /* This should be an abort except I'm not yet 100% confident that it won't ever get hit (though I @@ -1274,7 +1274,8 @@ } static int -window_left_window_gutter_width (struct window *w, int modeline) +window_left_window_gutter_width (struct window *w, + int USED_IF_SCROLLBARS (modeline)) { if (!NILP (w->hchild) || !NILP (w->vchild)) return 0; @@ -1294,7 +1295,8 @@ } static int -window_right_window_gutter_width (struct window *w, int modeline) +window_right_window_gutter_width (struct window *w, + int USED_IF_SCROLLBARS (modeline)) { int gutter = 0; @@ -1921,7 +1923,7 @@ struct display_line *dl; /* No lines - no clipped lines */ - if (num_lines == 0 || (num_lines == 1 && Dynarr_atp (dla, 0)->modeline)) + if (num_lines == 0 || (num_lines == 1 && Dynarr_begin (dla)->modeline)) return Qnil; dl = Dynarr_atp (dla, num_lines - 1); @@ -4207,7 +4209,7 @@ indicates that end-of-buffer is being displayed. */ if (end_pos == -1) { - struct display_line *dl = Dynarr_atp (dla, 0); + struct display_line *dl = Dynarr_begin (dla); int ypos1 = dl->ypos + dl->descent; int ypos2 = WINDOW_TEXT_BOTTOM (w); Lisp_Object window; @@ -4242,7 +4244,7 @@ } else { - if (num_lines > 1 && Dynarr_atp (dla, 0)->modeline) + if (num_lines > 1 && Dynarr_begin (dla)->modeline) num_lines--; if (scroll_on_clipped_lines @@ -4615,7 +4617,7 @@ default_face_height_and_width (window, &fheight, &fwidth); if (Dynarr_length (dla) >= 1) - modeline = Dynarr_atp (dla, 0)->modeline; + modeline = Dynarr_begin (dla)->modeline; dl = Dynarr_atp (dla, modeline); @@ -5303,7 +5305,7 @@ CHECK_INT (pos); point = XINT (pos); - if (Dynarr_length (dla) && Dynarr_atp (dla, 0)->modeline) + if (Dynarr_length (dla) && Dynarr_begin (dla)->modeline) first_line = 1; else first_line = 0; diff -r d2ec55325515 -r 8f0cf4fd3d2c src/xemacs.def.in.in --- a/src/xemacs.def.in.in Sat Feb 06 03:59:18 2010 -0600 +++ b/src/xemacs.def.in.in Sat Feb 06 04:01:46 2010 -0600 @@ -1,5 +1,6 @@ /* The module API: core symbols that are visible to modules. Copyright (C) 2008 Jerry James + Copyright (C) 2010 Ben Wing. This file is part of XEmacs. @@ -22,8 +23,14 @@ meant to be used directly, but a macro or inline function in the API expands to a form containing the symbol, then the macro or inline function is named in a comment to the right. */ + #define NOT_C_CODE #include + +#if defined (ERROR_CHECK_TYPES) && defined (XEMACS_DEFS_NEEDS_INLINE_DECLS) +#define XEMACS_DEFS_NEEDS_ERROR_CHECK_TYPES_DECLS +#endif + NAME xemacs.exe EXPORTS /* Exported functions */ @@ -43,11 +50,13 @@ #ifdef USE_ASSERTIONS assert_failed /* abort(), assert(), etc. */ #endif -build_ext_string -build_intstring -build_msg_intstring -build_msg_string -build_string +build_extstring +build_istring +build_cistring +build_ascstring +build_msg_istring +build_msg_cistring +build_msg_ascstring #ifdef MULE bytecount_to_charcount_fun /* bytecount_to_charcount */ #endif @@ -65,6 +74,8 @@ #endif check_quit /* QUITP */ check_what_happened /* QUIT */ +concat2 +concat3 cons3 copy_lisp_object dead_wrong_type_argument /* CHECK_xxx */ @@ -102,7 +113,7 @@ #ifdef DEBUG_XEMACS eq_with_ebola_notice /* EQ_WITH_EBOLA_NOTICE */ #endif -#ifdef NEED_ERROR_CHECK_TYPES_INLINES +#ifdef XEMACS_DEFS_NEEDS_ERROR_CHECK_TYPES_DECLS error_check_cons #ifdef HAVE_LDAP error_check_ldap @@ -117,7 +128,7 @@ error_check_string_direct_data error_check_string_indirect_data #endif -#endif /* NEED_ERROR_CHECK_TYPES_INLINES */ +#endif /* XEMACS_DEFS_NEEDS_ERROR_CHECK_TYPES_DECLS */ free_opaque_ptr get_coding_system_for_text_file intern @@ -132,13 +143,14 @@ list4 list5 list6 -make_ext_string +make_extstring make_float make_opaque_ptr make_string make_vector maybe_invalid_operation message +nconc2 new_dfc_convert_copy_data /* C_STRING_TO_EXTERNAL, ... */ new_dfc_convert_malloc /* C_STRING_TO_EXTERNAL_MALLOC, ... */ new_dfc_convert_size /* C_STRING_TO_EXTERNAL, ... */ @@ -150,6 +162,38 @@ #endif out_of_memory /* The postgresql module uses this */ printing_unreadable_object +#ifdef XEMACS_DEFS_NEEDS_INLINE_DECLS +qxestrdup +qxestrlen +qxestrcharlen +qxestrcmp +qxestrcmp_ascii +qxestrncmp +qxestrncmp_ascii +qxestrcpy +qxestrcpy_ascii +qxestrncpy +qxestrncpy_ascii +qxestrcat +qxestrcat_ascii +qxestrncat +qxestrncat_ascii +qxestrchr +qxestrrchr +qxestrstr +qxestrcspn +qxestrspn +qxestrpbrk +qxestrtok +qxestrtod +qxestrtol +qxestrtoul +qxeatoi +qxestrupr +qxestrlwr +qxesprintf +qxesscanf_ascii_1 +#endif /* XEMACS_DEFS_NEEDS_INLINE_DECLS */ record_unwind_protect record_unwind_protect_freeing report_process_error @@ -175,17 +219,20 @@ #else unstaticpro_nodump_1 #endif +vconcat2 +vconcat3 vector1 vector2 vector3 warn_when_safe -#ifdef NEED_ERROR_CHECK_TYPES_INLINES +#ifdef XEMACS_DEFS_NEEDS_ERROR_CHECK_TYPES_DECLS wrap_record_1 #endif -write_c_string +write_cistring write_fmt_string write_fmt_string_lisp -write_string +write_istring +write_ascstring wrong_type_argument /* CONCHECK_xxx */ xemacs_c_alloca /* ALLOCA */ xfree_1 /* xfree */ @@ -225,7 +272,7 @@ Fsignal Fthrow Fvector -#ifdef NEED_ERROR_CHECK_TYPES_INLINES +#ifdef XEMACS_DEFS_NEEDS_ERROR_CHECK_TYPES_DECLS XINT_1 #endif diff -r d2ec55325515 -r 8f0cf4fd3d2c tests/ChangeLog --- a/tests/ChangeLog Sat Feb 06 03:59:18 2010 -0600 +++ b/tests/ChangeLog Sat Feb 06 04:01:46 2010 -0600 @@ -1,3 +1,36 @@ +2010-02-05 Jerry James + + * DLL/dltest.c: Remove old test. Building and using any module now + provides a better test than this. + +2010-02-05 Jerry James + + * frame.el: Martin Buchholz claims ownership. + +2010-01-25 Ben Wing + + * automated/file-tests.el: + New file. + + * automated/mule-tests.el (featurep): + + * automated/test-harness.el (test-harness-from-buffer): + * automated/test-harness.el (batch-test-emacs): + +2010-01-25 Ben Wing + + * automated/file-tests.el: + * automated/mule-tests.el (featurep): + Clean up charsets-in-HELLO test and fix the list of expected + charsets. + + * automated/test-harness.el (test-harness-from-buffer): + Reverse order of "got" and "expected" values so it matches + order of call to comparison. + + * automated/test-harness.el (batch-test-emacs): + Update doc to indicate that a directory is allowed. + 2010-02-01 Ben Wing * automated/case-tests.el: diff -r d2ec55325515 -r 8f0cf4fd3d2c tests/DLL/dltest.c --- a/tests/DLL/dltest.c Sat Feb 06 03:59:18 2010 -0600 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,39 +0,0 @@ -/* -Make a symbolic link to ${blddir}/src/config.h in this directory and do: - -gcc -shared -fPIC -Demacs -DHAVE_CONFIG_H -I. \ - -I/home/xemacs/xemacs-20.0/src -g dltest.c -o dltest -*/ - -# include -# include "lisp.h" - -Lisp_Object Qdltest_counter; - -DEFUN ("dltest", Fdltest, 0, 0, 0, /* -Simple test function. -*/ -()) -{ - Qdltest_counter = make_int(XINT(Qdltest_counter) + 1); - - return Qdltest_counter; -} - -void -vars_of() -{ - DEFVAR_LISP("dltest-counter", &Qdltest_counter /* -counter. -*/ ); - - printf("Ten = %d\n", 10); - - Qdltest_counter = make_int(10); -} - -void -syms_of() -{ - DEFSUBR(Fdltest); -} diff -r d2ec55325515 -r 8f0cf4fd3d2c tests/automated/file-tests.el --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/tests/automated/file-tests.el Sat Feb 06 04:01:46 2010 -0600 @@ -0,0 +1,45 @@ +;;; file-tests.el --- test support for filesystem primitives + +;; Copyright (C) 2010 Ben Wing. + +;; Author: Ben Wing +;; Maintainer: Ben Wing +;; Created: 2010 January 25 +;; Keywords: files, filenames, file names + +;; 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. + +;;; Commentary: + +;; Test file-system support. Opening files, file names, etc. +;; See test-harness.el for instructions on how to run these tests. + +;; Test that `file-truename' is idempotent (same value when called multiple +;; times). Under Cygwin 1.7 as of 1-24-10, not true! +(loop for file in (list (temp-directory) + (file-name-as-directory (temp-directory)) + "/" + (file-name-as-directory "/") + (make-temp-name "foo") + ) + do + (Assert-equal (file-truename (file-truename file)) (file-truename file))) + + diff -r d2ec55325515 -r 8f0cf4fd3d2c tests/automated/mule-tests.el diff -r d2ec55325515 -r 8f0cf4fd3d2c tests/automated/test-harness.el --- a/tests/automated/test-harness.el Sat Feb 06 03:59:18 2010 -0600 +++ b/tests/automated/test-harness.el Sat Feb 06 04:01:46 2010 -0600 @@ -642,7 +642,10 @@ Use this from the command line, with `-batch'; it won't work in an interactive Emacs. Each file is processed even if an error occurred previously. -For example, invoke \"xemacs -batch -f batch-test-emacs tests/*.el\"" +A directory can be given as well, and all files will be processed -- +however, the file test-harness.el, which implements the test harness, +will be skipped. +For example, invoke \"xemacs -batch -f batch-test-emacs tests\"" ;; command-line-args-left is what is left of the command line (from ;; startup.el) (defvar command-line-args-left) ;Avoid 'free variable' warning diff -r d2ec55325515 -r 8f0cf4fd3d2c tests/frame.el --- a/tests/frame.el Sat Feb 06 03:59:18 2010 -0600 +++ b/tests/frame.el Sat Feb 06 04:01:46 2010 -0600 @@ -1,4 +1,24 @@ -;;; Test geometry settings for frames +;;; Test geometry setting for frames. +;;; +;;; Copyright (C) 1997 Martin Buchholz +;;; +;;; 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., 51 Franklin Street, Fifth Floor, +;;; Boston, MA 02110-1301, USA. + (defmacro check-frame-geometry (xx yy) `(loop for frame in (list nil (selected-frame)) do @@ -24,4 +44,3 @@ (check-frame-geometry x (+ y 3)) (set-frame-property frame 'left (+ x 3)) (check-frame-geometry (+ x 3) (+ y 3)))) -