changeset 4957:db2db229ee82

merge
author Ben Wing <ben@xemacs.org>
date Thu, 28 Jan 2010 02:48:45 -0600
parents 3461165c79be (diff) 732c35cdded8 (current diff)
children e4bbe5622a80
files ChangeLog lisp/ChangeLog lisp/mule/cyrillic.el lisp/simple.el man/ChangeLog src/ChangeLog src/bytecode.c src/data.c src/elhash.c src/lisp.h src/number.c src/number.h tests/ChangeLog tests/automated/mule-tests.el tests/automated/test-harness.el
diffstat 159 files changed, 7420 insertions(+), 6375 deletions(-) [+]
line wrap: on
line diff
--- a/ChangeLog	Wed Jan 27 06:00:09 2010 -0600
+++ b/ChangeLog	Thu Jan 28 02:48:45 2010 -0600
@@ -1,3 +1,46 @@
+2010-01-23  Ben Wing  <ben@xemacs.org>
+
+	* 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  <ben@xemacs.org>
+
+	* configure: Rebuild.
+
+2010-01-24  Ben Wing  <ben@xemacs.org>
+
+	* 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-01-14  Ben Wing  <ben@xemacs.org>
 
 	* PROBLEMS:
@@ -8,6 +51,26 @@
 
 	* configure: Regenerate, now we no longer look for rint().
 
+2010-01-20  Ben Wing  <ben@xemacs.org>
+
+	* 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  <kehoea@parhasard.net>
+
+	* configure: Regenerate, now we no longer look for rint().
+
 2010-01-13  Jerry James  <james@xemacs.org>
 
 	* configure.ac: Update comment about Cygwin and pdump.
--- a/Makefile.in.in	Wed Jan 27 06:00:09 2010 -0600
+++ b/Makefile.in.in	Thu Jan 28 02:48:45 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
--- a/aclocal.m4	Wed Jan 27 06:00:09 2010 -0600
+++ b/aclocal.m4	Thu Jan 28 02:48:45 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
--- a/configure	Wed Jan 27 06:00:09 2010 -0600
+++ b/configure	Thu Jan 28 02:48:45 2010 -0600
@@ -1,12 +1,14 @@
 #! /bin/sh
 # Guess values for system-dependent variables and create Makefiles.
-# Generated by GNU Autoconf 2.64 for XEmacs 21.5.
+# Generated by GNU Autoconf 2.65 for XEmacs 21.5.
 #
 # Report bugs to <xemacs-beta@xemacs.org>.
 #
+#
 # Copyright (C) 1992, 1993, 1994, 1995, 1996, 1998, 1999, 2000, 2001,
-# 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009 Free Software
-# Foundation, Inc.
+# 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009 Free Software Foundation,
+# Inc.
+#
 #
 # This configure script is free software; the Free Software Foundation
 # gives unlimited permission to copy, distribute and modify it.
@@ -573,7 +575,8 @@
 as_tr_sh="eval sed 'y%*+%pp%;s%[^_$as_cr_alnum]%_%g'"
 
 
-exec 7<&0 </dev/null 6>&1
+test -n "$DJDIR" || exec 7<&0 </dev/null
+exec 6>&1
 
 # Name of the host.
 # hostname on some systems (SVR3.2, Linux) returns a bogus exit status,
@@ -1949,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.
@@ -1986,7 +2013,7 @@
   LDFLAGS     linker flags, e.g. -L<lib dir> if you have libraries in a
               nonstandard directory <lib dir>
   LIBS        libraries to pass to the linker, e.g. -l<library>
-  CPPFLAGS    C/C++/Objective C preprocessor flags, e.g. -I<include dir> if
+  CPPFLAGS    (Objective) C/C++ preprocessor flags, e.g. -I<include dir> if
               you have headers in a nonstandard directory <include dir>
   CPP         C preprocessor
   YACC        The `Yet Another C Compiler' implementation to use. Defaults to
@@ -2063,7 +2090,7 @@
 if $ac_init_version; then
   cat <<\_ACEOF
 XEmacs configure 21.5
-generated by GNU Autoconf 2.64
+generated by GNU Autoconf 2.65
 
 Copyright (C) 2009 Free Software Foundation, Inc.
 This configure script is free software; the Free Software Foundation
@@ -2156,7 +2183,7 @@
 	ac_retval=1
 fi
   eval $as_lineno_stack; test "x$as_lineno_stack" = x && { as_lineno=; unset as_lineno;}
-  return $ac_retval
+  as_fn_set_status $ac_retval
 
 } # ac_fn_c_try_compile
 
@@ -2193,7 +2220,7 @@
     ac_retval=1
 fi
   eval $as_lineno_stack; test "x$as_lineno_stack" = x && { as_lineno=; unset as_lineno;}
-  return $ac_retval
+  as_fn_set_status $ac_retval
 
 } # ac_fn_c_try_cpp
 
@@ -2328,7 +2355,7 @@
 fi
   rm -rf conftest.dSYM conftest_ipa8_conftest.oo
   eval $as_lineno_stack; test "x$as_lineno_stack" = x && { as_lineno=; unset as_lineno;}
-  return $ac_retval
+  as_fn_set_status $ac_retval
 
 } # ac_fn_c_try_run
 
@@ -2405,7 +2432,7 @@
   # left behind by Apple's compiler.  We do this before executing the actions.
   rm -rf conftest.dSYM conftest_ipa8_conftest.oo
   eval $as_lineno_stack; test "x$as_lineno_stack" = x && { as_lineno=; unset as_lineno;}
-  return $ac_retval
+  as_fn_set_status $ac_retval
 
 } # ac_fn_c_try_link
 
@@ -2800,7 +2827,7 @@
 
   fi
   eval $as_lineno_stack; test "x$as_lineno_stack" = x && { as_lineno=; unset as_lineno;}
-  return $ac_retval
+  as_fn_set_status $ac_retval
 
 } # ac_fn_c_compute_int
 cat >config.log <<_ACEOF
@@ -2808,7 +2835,7 @@
 running configure, to aid debugging if configure makes a mistake.
 
 It was created by XEmacs $as_me 21.5, which was
-generated by GNU Autoconf 2.64.  Invocation command line was
+generated by GNU Autoconf 2.65.  Invocation command line was
 
   $ $0 $@
 
@@ -3061,7 +3088,7 @@
 for ac_site_file in "$ac_site_file1" "$ac_site_file2"
 do
   test "x$ac_site_file" = xNONE && continue
-  if test -r "$ac_site_file"; then
+  if test /dev/null != "$ac_site_file" && test -r "$ac_site_file"; then
     { $as_echo "$as_me:${as_lineno-$LINENO}: loading site script $ac_site_file" >&5
 $as_echo "$as_me: loading site script $ac_site_file" >&6;}
     sed 's/^/| /' "$ac_site_file" >&5
@@ -3070,9 +3097,9 @@
 done
 
 if test -r "$cache_file"; then
-  # Some versions of bash will fail to source /dev/null (special
-  # files actually), so we avoid doing that.
-  if test -f "$cache_file"; then
+  # Some versions of bash will fail to source /dev/null (special files
+  # actually), so we avoid doing that.  DJGPP emulates it as a regular file.
+  if test /dev/null != "$cache_file" && test -f "$cache_file"; then
     { $as_echo "$as_me:${as_lineno-$LINENO}: loading cache $cache_file" >&5
 $as_echo "$as_me: loading cache $cache_file" >&6;}
     case $cache_file in
@@ -5149,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=""
@@ -6295,32 +6325,30 @@
 ... rest of stderr output deleted ...
          10q' conftest.err >conftest.er1
     cat conftest.er1 >&5
-    rm -f conftest.er1 conftest.err
-  fi
+  fi
+  rm -f conftest.er1 conftest.err
   $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5
   test $ac_status = 0; }
 done
 
 cat confdefs.h - <<_ACEOF >conftest.$ac_ext
 /* end confdefs.h.  */
-#include <stdio.h>
-int
-main ()
-{
-FILE *f = fopen ("conftest.out", "w");
- return ferror (f) || fclose (f) != 0;
+
+int
+main ()
+{
 
   ;
   return 0;
 }
 _ACEOF
 ac_clean_files_save=$ac_clean_files
-ac_clean_files="$ac_clean_files a.out a.out.dSYM a.exe b.out conftest.out"
+ac_clean_files="$ac_clean_files a.out a.out.dSYM a.exe b.out"
 # Try to create an executable without -o first, disregard a.out.
 # It will help us diagnose broken compilers, and finding out an intuition
 # of exeext.
-{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for C compiler default output file name" >&5
-$as_echo_n "checking for C compiler default output file name... " >&6; }
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking whether the C compiler works" >&5
+$as_echo_n "checking whether the C compiler works... " >&6; }
 ac_link_default=`$as_echo "$ac_link" | sed 's/ -o *conftest[^ ]*//'`
 
 # The possible output files:
@@ -6382,10 +6410,10 @@
 else
   ac_file=''
 fi
-{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_file" >&5
-$as_echo "$ac_file" >&6; }
 if test -z "$ac_file"; then :
-  $as_echo "$as_me: failed program was:" >&5
+  { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
+$as_echo "no" >&6; }
+$as_echo "$as_me: failed program was:" >&5
 sed 's/^/| /' conftest.$ac_ext >&5
 
 { { $as_echo "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5
@@ -6393,51 +6421,18 @@
 { as_fn_set_status 77
 as_fn_error "C compiler cannot create executables
 See \`config.log' for more details." "$LINENO" 5; }; }
-fi
+else
+  { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5
+$as_echo "yes" >&6; }
+fi
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for C compiler default output file name" >&5
+$as_echo_n "checking for C compiler default output file name... " >&6; }
+{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_file" >&5
+$as_echo "$ac_file" >&6; }
 ac_exeext=$ac_cv_exeext
 
-# Check that the compiler produces executables we can run.  If not, either
-# the compiler is broken, or we cross compile.
-{ $as_echo "$as_me:${as_lineno-$LINENO}: checking whether the C compiler works" >&5
-$as_echo_n "checking whether the C compiler works... " >&6; }
-# If not cross compiling, check that we can run a simple program.
-if test "$cross_compiling" != yes; then
-  if { ac_try='./$ac_file'
-  { { case "(($ac_try" in
-  *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
-  *) ac_try_echo=$ac_try;;
-esac
-eval ac_try_echo="\"\$as_me:${as_lineno-$LINENO}: $ac_try_echo\""
-$as_echo "$ac_try_echo"; } >&5
-  (eval "$ac_try") 2>&5
-  ac_status=$?
-  $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5
-  test $ac_status = 0; }; }; then
-    cross_compiling=no
-  else
-    if test "$cross_compiling" = maybe; then
-	cross_compiling=yes
-    else
-	{ { $as_echo "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5
-$as_echo "$as_me: error: in \`$ac_pwd':" >&2;}
-as_fn_error "cannot run C compiled programs.
-If you meant to cross compile, use \`--host'.
-See \`config.log' for more details." "$LINENO" 5; }
-    fi
-  fi
-fi
-{ $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5
-$as_echo "yes" >&6; }
-
-rm -f -r a.out a.out.dSYM a.exe conftest$ac_cv_exeext b.out conftest.out
+rm -f -r a.out a.out.dSYM a.exe conftest$ac_cv_exeext b.out
 ac_clean_files=$ac_clean_files_save
-# Check that the compiler produces executables we can run.  If not, either
-# the compiler is broken, or we cross compile.
-{ $as_echo "$as_me:${as_lineno-$LINENO}: checking whether we are cross compiling" >&5
-$as_echo_n "checking whether we are cross compiling... " >&6; }
-{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $cross_compiling" >&5
-$as_echo "$cross_compiling" >&6; }
-
 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for suffix of executables" >&5
 $as_echo_n "checking for suffix of executables... " >&6; }
 if { { ac_try="$ac_link"
@@ -6470,13 +6465,72 @@
 as_fn_error "cannot compute suffix of executables: cannot compile and link
 See \`config.log' for more details." "$LINENO" 5; }
 fi
-rm -f conftest$ac_cv_exeext
+rm -f conftest conftest$ac_cv_exeext
 { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_exeext" >&5
 $as_echo "$ac_cv_exeext" >&6; }
 
 rm -f conftest.$ac_ext
 EXEEXT=$ac_cv_exeext
 ac_exeext=$EXEEXT
+cat confdefs.h - <<_ACEOF >conftest.$ac_ext
+/* end confdefs.h.  */
+#include <stdio.h>
+int
+main ()
+{
+FILE *f = fopen ("conftest.out", "w");
+ return ferror (f) || fclose (f) != 0;
+
+  ;
+  return 0;
+}
+_ACEOF
+ac_clean_files="$ac_clean_files conftest.out"
+# Check that the compiler produces executables we can run.  If not, either
+# the compiler is broken, or we cross compile.
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking whether we are cross compiling" >&5
+$as_echo_n "checking whether we are cross compiling... " >&6; }
+if test "$cross_compiling" != yes; then
+  { { ac_try="$ac_link"
+case "(($ac_try" in
+  *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
+  *) ac_try_echo=$ac_try;;
+esac
+eval ac_try_echo="\"\$as_me:${as_lineno-$LINENO}: $ac_try_echo\""
+$as_echo "$ac_try_echo"; } >&5
+  (eval "$ac_link") 2>&5
+  ac_status=$?
+  $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5
+  test $ac_status = 0; }
+  if { ac_try='./conftest$ac_cv_exeext'
+  { { case "(($ac_try" in
+  *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
+  *) ac_try_echo=$ac_try;;
+esac
+eval ac_try_echo="\"\$as_me:${as_lineno-$LINENO}: $ac_try_echo\""
+$as_echo "$ac_try_echo"; } >&5
+  (eval "$ac_try") 2>&5
+  ac_status=$?
+  $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5
+  test $ac_status = 0; }; }; then
+    cross_compiling=no
+  else
+    if test "$cross_compiling" = maybe; then
+	cross_compiling=yes
+    else
+	{ { $as_echo "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5
+$as_echo "$as_me: error: in \`$ac_pwd':" >&2;}
+as_fn_error "cannot run C compiled programs.
+If you meant to cross compile, use \`--host'.
+See \`config.log' for more details." "$LINENO" 5; }
+    fi
+  fi
+fi
+{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $cross_compiling" >&5
+$as_echo "$cross_compiling" >&6; }
+
+rm -f conftest.$ac_ext conftest$ac_cv_exeext conftest.out
+ac_clean_files=$ac_clean_files_save
 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for suffix of object files" >&5
 $as_echo_n "checking for suffix of object files... " >&6; }
 if test "${ac_cv_objext+set}" = set; then :
@@ -7535,8 +7589,8 @@
 ... rest of stderr output deleted ...
          10q' conftest.err >conftest.er1
     cat conftest.er1 >&5
-    rm -f conftest.er1 conftest.err
-  fi
+  fi
+  rm -f conftest.er1 conftest.err
   $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5
   test $ac_status = 0; }
 done
@@ -8083,8 +8137,8 @@
 ... rest of stderr output deleted ...
          10q' conftest.err >conftest.er1
     cat conftest.er1 >&5
-    rm -f conftest.er1 conftest.err
-  fi
+  fi
+  rm -f conftest.er1 conftest.err
   $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5
   test $ac_status = 0; }
 done
@@ -8631,8 +8685,8 @@
 ... rest of stderr output deleted ...
          10q' conftest.err >conftest.er1
     cat conftest.er1 >&5
-    rm -f conftest.er1 conftest.err
-  fi
+  fi
+  rm -f conftest.er1 conftest.err
   $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5
   test $ac_status = 0; }
 done
@@ -8908,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"
@@ -9436,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
 
@@ -9478,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" ;;
@@ -9494,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
@@ -9539,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"
@@ -13882,7 +13943,7 @@
 
 
 
-if test "$with_xemacs_compiler" = "g++"; then
+if test "$XEMACS_CC_GPP" = "yes"; then
   LIBSTDCPP=-lstdc++
 else
   LIBSTDCPP=
@@ -14554,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
@@ -20288,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
@@ -20335,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"
@@ -20646,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
 
 
 
@@ -21531,7 +21595,7 @@
 # values after options handling.
 ac_log="
 This file was extended by XEmacs $as_me 21.5, which was
-generated by GNU Autoconf 2.64.  Invocation command line was
+generated by GNU Autoconf 2.65.  Invocation command line was
 
   CONFIG_FILES    = $CONFIG_FILES
   CONFIG_HEADERS  = $CONFIG_HEADERS
@@ -21571,6 +21635,7 @@
 
   -h, --help       print this help, then exit
   -V, --version    print version number and configuration settings, then exit
+      --config     print configuration, then exit
   -q, --quiet, --silent
                    do not print progress messages
   -d, --debug      don't remove temporary files
@@ -21593,10 +21658,11 @@
 
 _ACEOF
 cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1
+ac_cs_config="`$as_echo "$ac_configure_args" | sed 's/^ //; s/[\\""\`\$]/\\\\&/g'`"
 ac_cs_version="\\
 XEmacs config.status 21.5
-configured by $0, generated by GNU Autoconf 2.64,
-  with options \\"`$as_echo "$ac_configure_args" | sed 's/^ //; s/[\\""\`\$]/\\\\&/g'`\\"
+configured by $0, generated by GNU Autoconf 2.65,
+  with options \\"\$ac_cs_config\\"
 
 Copyright (C) 2009 Free Software Foundation, Inc.
 This config.status script is free software; the Free Software Foundation
@@ -21632,6 +21698,8 @@
     ac_cs_recheck=: ;;
   --version | --versio | --versi | --vers | --ver | --ve | --v | -V )
     $as_echo "$ac_cs_version"; exit ;;
+  --config | --confi | --conf | --con | --co | --c )
+    $as_echo "$ac_cs_config"; exit ;;
   --debug | --debu | --deb | --de | --d | -d )
     debug=: ;;
   --file | --fil | --fi | --f )
@@ -21826,7 +21894,7 @@
 t delim
 :nl
 h
-s/\(.\{148\}\).*/\1/
+s/\(.\{148\}\)..*/\1/
 t more1
 s/["\\]/\\&/g; s/^/"/; s/$/\\n"\\/
 p
@@ -21840,7 +21908,7 @@
 t nl
 :delim
 h
-s/\(.\{148\}\).*/\1/
+s/\(.\{148\}\)..*/\1/
 t more2
 s/["\\]/\\&/g; s/^/"/; s/$/"/
 p
--- a/configure.ac	Wed Jan 27 06:00:09 2010 -0600
+++ b/configure.ac	Thu Jan 28 02:48:45 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)
 
 
 
--- a/etc/gdbinit.in	Wed Jan 27 06:00:09 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
-
--- a/lib-src/ChangeLog	Wed Jan 27 06:00:09 2010 -0600
+++ b/lib-src/ChangeLog	Thu Jan 28 02:48:45 2010 -0600
@@ -1,3 +1,15 @@
+2010-01-26  Ben Wing  <ben@xemacs.org>
+
+	* 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  <ben@xemacs.org>
+
+	* fakemail.c (args_size):
+	* fakemail.c (parse_header):
+	* ootags.c (C_entries):
+	Fix warnings about possible use of uninitialized vars.
+
 2010-01-15  Ben Wing  <ben@xemacs.org>
 
 	* make-mswin-unicode.pl:
--- a/lib-src/fakemail.c	Wed Jan 27 06:00:09 2010 -0600
+++ b/lib-src/fakemail.c	Thu Jan 28 02:48:45 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);
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/lib-src/fix-perms.sh	Thu Jan 28 02:48:45 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
--- a/lib-src/make-msgfile.lex	Wed Jan 27 06:00:09 2010 -0600
+++ b/lib-src/make-msgfile.lex	Thu Jan 28 02:48:45 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!@$%^&*_=+|{}`~,<.>/?])+
 %%
 
 <DO_C>{NT}"GETTEXT"{OpWQ} { snarf (); }
@@ -128,16 +159,17 @@
 <DO_C>{NT}"stdout_out"{OpWQ} { snarf (); }
 <DO_C>{NT}"stderr_out"{OpWQ} { snarf (); }
 <DO_C>{NT}"with_output_to_temp_buffer"{OpWQ} { snarf (); }
+<DO_C>{NT}"weird_doc"{Open}{ArgCm}{Wh}{Q} { snarf (); /* #### FIXME snarf next arg() */}
 
-<DO_C>{NT}"DEFVAR_BOOL"{OpenString}{Arg}{Wh}{Q} { snarf (); }
-<DO_C>{NT}"DEFVAR_LISP"{OpenString}{Arg}{Wh}{Q} { snarf (); }
-<DO_C>{NT}"DEFVAR_SPECIFIER"{OpenString}{Arg}{Wh}{Q} { snarf (); }
-<DO_C>{NT}"DEFVAR_INT"{OpenString}{Arg}{Wh}{Q} { snarf (); }
-<DO_C>{NT}"DEFVAR_BUFFER_LOCAL"{OpenString}{Arg}{Wh}{Q} { snarf (); }
-<DO_C>{NT}"DEFVAR_BUFFER_DEFAULTS"{OpenString}{Arg}{Wh}{Q} { snarf (); }
-<DO_C>{NT}"deferror"{Open}{Arg}{StringArg}{Wh}{Q} { snarf (); }
+<DO_C>{NT}"DEFVAR_BOOL"{OpenString}{ArgCm}{Wh}{Q} { snarf (); }
+<DO_C>{NT}"DEFVAR_LISP"{OpenString}{ArgCm}{Wh}{Q} { snarf (); }
+<DO_C>{NT}"DEFVAR_SPECIFIER"{OpenString}{ArgCm}{Wh}{Q} { snarf (); }
+<DO_C>{NT}"DEFVAR_INT"{OpenString}{ArgCm}{Wh}{Q} { snarf (); }
+<DO_C>{NT}"DEFVAR_BUFFER_LOCAL"{OpenString}{ArgCm}{Wh}{Q} { snarf (); }
+<DO_C>{NT}"DEFVAR_BUFFER_DEFAULTS"{OpenString}{ArgCm}{Wh}{Q} { snarf (); }
+<DO_C>{NT}"deferror"{Open}{ArgCm}{StringArg}{Wh}{Q} { snarf (); }
 
-<DO_C>{NT}"barf_or_query_if_file_exists"{Open}{Arg}{Wh}{Q} {
+<DO_C>{NT}"barf_or_query_if_file_exists"{Open}{ArgCm}{Wh}{Q} {
   /* #### see comment above about use of Arg */
   snarf ();
 }
@@ -153,7 +185,7 @@
 <DO_C>{Q} { BEGIN C_QUOTE; }
 <DO_C>{Any} { }
 
-<DEFUN>{StringArg}{Arg}{Arg}{Arg}{Arg}{Wh} { BEGIN DEFUN2; }
+<DEFUN>{StringArg}{ArgCm}{ArgCm}{ArgCm}{ArgCm}{Wh} { BEGIN DEFUN2; }
 <DEFUN>{Any} { bad_c_defun (); }
 
 <DEFUN2>{Q} {
@@ -163,7 +195,7 @@
 }
 <DEFUN2>[^,]* {
   /* 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;
 }
--- a/lib-src/ootags.c	Wed Jan 27 06:00:09 2010 -0600
+++ b/lib-src/ootags.c	Thu Jan 28 02:48:45 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 */
--- a/lisp/ChangeLog	Wed Jan 27 06:00:09 2010 -0600
+++ b/lisp/ChangeLog	Thu Jan 28 02:48:45 2010 -0600
@@ -1,3 +1,173 @@
+2010-01-17  Ben Wing  <ben@xemacs.org>
+
+	* 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  <ben@xemacs.org>
+
+	* mule/cyrillic.el (koi8-c):
+	Fix bug in #83 mapping.
+	* mule/vietnamese.el (viscii):
+	Fix bug in #A6 mapping.
+
+2010-01-24  Ben Wing  <ben@xemacs.org>
+
+	* simple.el (capitalize-string-as-title):
+	Use `with-string-as-buffer-contents' instead of emulating it.
+
+2010-01-24  Ben Wing  <ben@xemacs.org>
+
+	* syntax.el:
+	* syntax.el (make-syntax-table):
+	Expand doc string.
+
+2010-01-22  Ben Wing  <ben@xemacs.org>
+
+	* 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  <kehoea@parhasard.net>
+
+	* 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  <ben@xemacs.org>
+
+	* 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  <ben@xemacs.org>
+
+	* 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  <ben@xemacs.org>
+
+	* 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  <didier@xemacs.org>
+
+	* 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  <didier@xemacs.org>
+
+	* 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  <didier@xemacs.org>
+
+	* glyphs.el (init-glyphs): Recognize bitmaps/ directory as
+	containing bitmap files.
+
+2010-01-09  Aidan Kehoe  <kehoea@parhasard.net>
+
+	* 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  <kehoea@parhasard.net>
+
+	* 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  <kehoea@parhasard.net>
+
+	* 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  <kehoea@parhasard.net>
+
+	* 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  <didier@xemacs.org>
+
+	* cl-extra.el (get-properties): New.
+
+2009-12-31  Aidan Kehoe  <kehoea@parhasard.net>
+
+	* 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  <james@xemacs.org>
+
+	* 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  <adrian@xemacs.org>
+
+	* 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  <kehoea@parhasard.net>
+
+	* 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  <kehoea@parhasard.net>
+
+	* 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-01-26  Aidan Kehoe  <kehoea@parhasard.net>
 
 	* mule/vietnamese.el (viscii): Correct the mapping here, #xA6 is
--- a/lisp/bytecomp-runtime.el	Wed Jan 27 06:00:09 2010 -0600
+++ b/lisp/bytecomp-runtime.el	Thu Jan 28 02:48:45 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 <jwz@jwz.org>
 ;; Author: Hallvard Furuseth <hbf@ulrik.uio.no>
@@ -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.
 
--- a/lisp/lisp-mode.el	Wed Jan 27 06:00:09 2010 -0600
+++ b/lisp/lisp-mode.el	Thu Jan 28 02:48:45 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,24 @@
 (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)
+;; COUNT is the number of "distinguished" forms (e.g. arguments before the
+;; "body", in a macro taking a body as its last argument).  STATE is
+;; #### DOCUMENT-ME. INDENT-POINT is #### DOCUMENT-ME.  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 +921,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))))
 
--- a/lisp/simple.el	Wed Jan 27 06:00:09 2010 -0600
+++ b/lisp/simple.el	Thu Jan 28 02:48:45 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).
--- a/lisp/syntax.el	Wed Jan 27 06:00:09 2010 -0600
+++ b/lisp/syntax.el	Thu Jan 28 02:48:45 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)
--- a/lwlib/ChangeLog	Wed Jan 27 06:00:09 2010 -0600
+++ b/lwlib/ChangeLog	Thu Jan 28 02:48:45 2010 -0600
@@ -1,3 +1,9 @@
+2010-01-24  Ben Wing  <ben@xemacs.org>
+
+	* xlwgauge.c (GaugeResize):
+	* xlwgauge.c (GaugeSize):
+	Fix warnings about possible use of uninitialized vars.
+
 2009-12-09  Jerry James  <james@xemacs.org>
 
 	* lwlib-Xlw.c: Include needed Xmu headers instead of obsolete xmu.h.
--- a/lwlib/xlwgauge.c	Wed Jan 27 06:00:09 2010 -0600
+++ b/lwlib/xlwgauge.c	Thu Jan 28 02:48:45 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) ;
--- a/man/ChangeLog	Wed Jan 27 06:00:09 2010 -0600
+++ b/man/ChangeLog	Thu Jan 28 02:48:45 2010 -0600
@@ -1,3 +1,25 @@
+2010-01-27  Ben Wing  <ben@xemacs.org>
+
+	* 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-01-23  Aidan Kehoe  <kehoea@parhasard.net>
 
 	Generally: be careful to say fixnum, not integer, when talking
--- a/man/emodules.texi	Wed Jan 27 06:00:09 2010 -0600
+++ b/man/emodules.texi	Thu Jan 28 02:48:45 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
--- a/man/internals/internals.texi	Wed Jan 27 06:00:09 2010 -0600
+++ b/man/internals/internals.texi	Thu Jan 28 02:48:45 2010 -0600
@@ -8643,7 +8643,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
@@ -11802,7 +11802,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
@@ -12864,7 +12864,7 @@
 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()},
+used instead -- @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
@@ -13025,13 +13025,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
@@ -14349,15 +14349,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
@@ -15343,10 +15343,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
@@ -25689,7 +25689,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.
--- a/modules/ChangeLog	Wed Jan 27 06:00:09 2010 -0600
+++ b/modules/ChangeLog	Thu Jan 28 02:48:45 2010 -0600
@@ -1,3 +1,66 @@
+2010-01-27  Ben Wing  <ben@xemacs.org>
+
+	* 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  <ben@xemacs.org>
+
+	* 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  <ben@xemacs.org>
+
+	* ldap/eldap.c (print_ldap):
+	* ldap/eldap.c (allocate_ldap):
+	Use write_ascstring().
+
+2010-01-24  Ben Wing  <ben@xemacs.org>
+
+	* 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  <ben@xemacs.org>
 
 	* common/Makefile.common:
--- a/modules/canna/canna_api.c	Wed Jan 27 06:00:09 2010 -0600
+++ b/modules/canna/canna_api.c	Thu Jan 28 02:48:45 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);
--- a/modules/ldap/eldap.c	Wed Jan 27 06:00:09 2010 -0600
+++ b/modules/ldap/eldap.c	Thu Jan 28 02:48:45 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, "#<ldap %S", 1, ldap->host);
   if (!ldap->ld)
-    write_c_string (printcharfun,"(dead) ");
+    write_ascstring (printcharfun,"(dead) ");
   write_fmt_string (printcharfun, " 0x%lx>", (long)ldap);
 }
 
@@ -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 ();
@@ -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);
--- a/modules/postgresql/postgresql.c	Wed Jan 27 06:00:09 2010 -0600
+++ b/modules/postgresql/postgresql.c	Thu Jan 28 02:48:45 2010 -0600
@@ -118,15 +118,28 @@
 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))				\
+    {									\
+      const Ibyte *err;							\
+									\
+      if (P)								\
+	err = NEW_EXTERNAL_TO_C_STRING (PQerrorMessage (P), PG_OS_CODING); \
+      else								\
+	err = (const Ibyte *) "bad value";				\
+      signal_ferror (Qprocess_error, "dead connection [%s]", err);	\
+    }									\
+}									\
+while (0)
+
+#define PUKE_IF_NULL(p)							\
+do									\
+{									\
+  if (!p) signal_error (Qinvalid_argument, "bad value", Qunbound);	\
+}									\
+while (0)
 
 static Lisp_Object VXPGHOST;
 static Lisp_Object VXPGUSER;
@@ -203,7 +216,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 +244,7 @@
   if (print_readably)
     printing_unreadable_object ("%s", buf);
   else
-    write_c_string (printcharfun, buf);
+    write_cistring (printcharfun, buf);
 }
 
 static Lisp_PGconn *
@@ -338,7 +351,7 @@
 		   PQcmdStatus (res));
 	  break;
 	default:
-notuples:
+	notuples:
 	  /* No counts to print */
 	  sprintf (buf, RESULT_DEFAULT_FMT, /* evil! */
 		   PQresStatus (PQresultStatus (res)),
@@ -352,7 +365,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 +444,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;
@@ -472,35 +487,33 @@
 {
   PGconn *P;
   Lisp_PGconn *lisp_pgconn;
-  char *error_message = "Out of Memory?";
-  char *c_conninfo;
+  const Ascbyte *error_message = "Out of Memory?";
+  Extbyte *c_conninfo;
 
   CHECK_STRING (conninfo);
 
-  TO_EXTERNAL_FORMAT(LISP_STRING, conninfo,
-		     C_STRING_ALLOCA, c_conninfo, Qnative);
+  LISP_STRING_TO_EXTERNAL (conninfo, c_conninfo, PG_OS_CODING);
   P = PQconnectdb (c_conninfo);
   if (P && (PQstatus (P) == CONNECTION_OK))
     {
       (void)PQsetNoticeProcessor (P, xemacs_notice_processor, NULL);
-      lisp_pgconn = allocate_pgconn();
+      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);
+      Ibyte *errmsg = (Ibyte *) 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';
+	  /* so we must temporarily stash it somewhere -- make alloca() copy */
+	  errmsg = NEW_EXTERNAL_TO_C_STRING (PQerrorMessage (P), PG_OS_CODING);
+	  IBYTE_STRING_TO_ALLOCA (errmsg, errmsg);
 	  PQfinish (P);
 	}
-      signal_ferror (Qprocess_error, "libpq: %s", buf);
+      signal_ferror (Qprocess_error, "libpq: %s", errmsg);
     }
 }
 
@@ -517,18 +530,18 @@
 {
   PGconn *P;
   Lisp_PGconn *lisp_pgconn;
-  char *error_message = "Out of Memory?";
-  char *c_conninfo;
+  const Ascbyte *error_message = "Out of Memory?";
+  Extbyte *c_conninfo;
 
   CHECK_STRING (conninfo);
-  TO_EXTERNAL_FORMAT (LISP_STRING, conninfo,
-		      C_STRING_ALLOCA, c_conninfo, Qnative);
+
+  LISP_STRING_TO_EXTERNAL (conninfo, c_conninfo, PG_OS_CODING);
   P = PQconnectStart (c_conninfo);
 
   if (P && (PQstatus (P) != CONNECTION_BAD))
     {
       (void)PQsetNoticeProcessor (P, xemacs_notice_processor, NULL);
-      lisp_pgconn = allocate_pgconn();
+      lisp_pgconn = allocate_pgconn ();
       lisp_pgconn->pgconn = P;
 
       return make_pgconn (lisp_pgconn);
@@ -821,22 +834,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 +865,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 +899,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 +932,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
@@ -992,7 +1006,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 +1059,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 +1076,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 +1091,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 +1149,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 +1234,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 +1284,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 +1298,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 +1392,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;
   }
@@ -1489,7 +1506,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 +1575,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 +1845,7 @@
 
 #define FROB(envvar, var)			\
   if ((p = egetenv (envvar)))			\
-    var = build_intstring (p);	\
+    var = build_istring (p);	\
   else						\
     var = Qnil
 
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/src/.gdbinit.in.in	Thu Jan 28 02:48:45 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
+
--- a/src/ChangeLog	Wed Jan 27 06:00:09 2010 -0600
+++ b/src/ChangeLog	Thu Jan 28 02:48:45 2010 -0600
@@ -1,3 +1,1004 @@
+2010-01-28  Ben Wing  <ben@xemacs.org>
+
+	* 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  <ben@xemacs.org>
+
+	* lread.c (vars_of_lread):
+	Turn on load-ignore-out-of-date-elc-files by default.
+
+2010-01-27  Ben Wing  <ben@xemacs.org>
+
+	* 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  <ben@xemacs.org>
+
+	* .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  <ben@xemacs.org>
+
+	* 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  <ben@xemacs.org>
+
+	* .gdbinit.in.in: Allow an argument to check-xemacs and check-temacs
+	to check a specific file.
+
+2010-01-24  Aidan Kehoe  <kehoea@parhasard.net>
+
+	* number.c (Fnumerator, Fdenominator, Fcanonicalize_number):
+	Be more careful to return integers in their canonical forms here,
+	and to give the same answer all the time when treating a rational
+	that is itself is an integer as a ratio.
+
+2010-01-24  Ben Wing  <ben@xemacs.org>
+
+	* 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 <limits> 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  <ben@xemacs.org>
+
+	* Makefile.in.in:
+	Oops.  Use two hashes for comments in Makefile.in.in.
+
+2010-01-20  Ben Wing  <ben@xemacs.org>
+
+	* 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  <ben@xemacs.org>
+
+	* .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  <ben@xemacs.org>
+
+	* 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  <ben@xemacs.org>
+
+	* 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  <ben@xemacs.org>
+
+	* 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  <ben@xemacs.org>
+
+	* redisplay-gtk.c:
+	* redisplay-gtk.c (gtk_bevel_area):
+	* redisplay-x.c:
+	* redisplay-x.c (THIS_IS_X):
+	* redisplay-xlike-inc.c:
+	* redisplay-xlike-inc.c (XLIKE_text_width_single_run):
+	* redisplay-xlike-inc.c (XLIKE_text_width):
+	* redisplay-xlike-inc.c (XLIKE_output_display_block):
+	* redisplay-xlike-inc.c (XLIKE_get_gc):
+	* redisplay-xlike-inc.c (XLIKE_output_string):
+	* redisplay-xlike-inc.c (XLIKE_OUTPUT_XLIKE_PIXMAP):
+	* redisplay-xlike-inc.c (XLIKE_output_pixmap):
+	* redisplay-xlike-inc.c (XLIKE_output_vertical_divider):
+	* redisplay-xlike-inc.c (XLIKE_output_blank):
+	* redisplay-xlike-inc.c (XLIKE_output_horizontal_line):
+	* redisplay-xlike-inc.c (XLIKE_clear_region):
+	* redisplay-xlike-inc.c (XLIKE_output_eol_cursor):
+	* redisplay-xlike-inc.c (XLIKE_clear_frame_window):
+	* redisplay-xlike-inc.c (XLIKE_clear_frame):
+	* redisplay-xlike-inc.c (XLIKE_flash):
+	* redisplay-xlike-inc.c (console_type_create_redisplay_XLIKE):
+	Move lots more code into redisplay-xlike-inc.c.  Use macros to
+	isolate the code that differs among X vs. GTK, to reduce the need
+	for ifdefs in the middle of the code.  Now, redisplay-x.c and
+	redisplay-gtk.c only contain a few functions whose implementation
+	is completely different from one to the other, or which are not
+	present at all in one of them.
+
+	GTK code not currently tested, but it has bitrotted somewhat
+	any.  Doing this will help keep it less bitrotty.
+
+	* depend: Regenerate.
+
+2010-01-18  Ben Wing  <ben@xemacs.org>
+
+	* redisplay-xlike-inc.c:
+	* redisplay-xlike-inc.c (separate_textual_runs_nomule):
+	* redisplay-xlike-inc.c (separate_textual_runs_xft_nomule):
+	* redisplay-xlike-inc.c (separate_textual_runs_xft_mule):
+	* redisplay-xlike-inc.c (separate_textual_runs_mule):
+	Break separate_textual_runs_* functions from redisplay-x.c.
+	(Code in redisplay-gtk.c should have been identical but was
+	bit-rotted.)
+	
+	* redisplay-gtk.c:
+	* redisplay-x.c:
+	Delete code, replace with include statement.
+
+	* depend: Regenerate.
+
+2010-01-18  Ben Wing  <ben@xemacs.org>
+
+	* lisp.h:
+	* print.c:
+	New variable `in_debug_print'.
+	
+	* alloc.c:
+	* alloc.c (free_managed_lcrecord):
+	If gc_in_progress and in_debug_print, just return instead of
+	crashing. This only happens when the programmer calls debug_print()
+	or a variation inside of a debugger, and is probably already
+	diagnosing a crash.
+	
+	* print.c (struct debug_bindings):
+	* print.c (debug_prin1_exit):
+	* print.c (debug_prin1):
+	At entrance, record the old value of in_debug_print in the
+	debug_bindings, set up an unwind-protect to restore the old value,
+	and set in_debug_print to 1.  In the unwind-protect, restore the
+	old value.
+	
+
+2010-01-16  Ben Wing  <ben@xemacs.org>
+
+	* win32.c (mswindows_read_link_1):
+	Conditionalize COM support on HAVE_MS_WINDOWS because otherwise we
+	haven't linked with the appropriate libraries.
+
+2010-01-15  Ben Wing  <ben@xemacs.org>
+
+	* doprnt.c (emacs_doprnt_1):
+	Cosmetic: Use Qunbound, not Qnil as second arg to call to
+	syntax_error() to get cleaner error message.
+	
+2010-01-15  Ben Wing  <ben@xemacs.org>
+
+	* intl-encap-win32.c:
+	Add `review' lines for all functions seen in the headers that we
+	process but not yet associated with an encapsulation command.
+	These will cause an error to be signaled if these functions are
+	used.
+	* intl-auto-encap-win32.c:
+	* intl-auto-encap-win32.h:
+	Regenerate.
+
+2010-01-15  Ben Wing  <ben@xemacs.org>
+
+	* intl-auto-encap-win32.c:
+	* intl-auto-encap-win32.c (qxeExtractAssociatedIcon):
+	* intl-auto-encap-win32.c (qxeShellExecuteEx):
+	* intl-auto-encap-win32.c (qxeSHFileOperation):
+	* intl-auto-encap-win32.c (qxeSHQueryRecycleBin):
+	* intl-auto-encap-win32.c (qxeSHEmptyRecycleBin):
+	* intl-auto-encap-win32.c (qxeWNetAddConnection):
+	* intl-auto-encap-win32.c (qxeWNetAddConnection2):
+	* intl-auto-encap-win32.c (qxeWNetAddConnection3):
+	* intl-auto-encap-win32.c (qxeWNetCancelConnection):
+	* intl-auto-encap-win32.c (qxeWNetCancelConnection2):
+	* intl-auto-encap-win32.c (qxeWNetGetConnection):
+	* intl-auto-encap-win32.c (qxeWNetUseConnection):
+	* intl-auto-encap-win32.c (qxeWNetConnectionDialog1):
+	* intl-auto-encap-win32.c (qxeWNetDisconnectDialog1):
+	* intl-auto-encap-win32.c (qxeWNetOpenEnum):
+	* intl-auto-encap-win32.c (qxeWNetEnumResource):
+	* intl-auto-encap-win32.c (qxeWNetGetUniversalName):
+	* intl-auto-encap-win32.c (qxeWNetGetUser):
+	* intl-auto-encap-win32.c (qxeWNetGetProviderName):
+	* intl-auto-encap-win32.c (qxeWNetGetNetworkInformation):
+	* intl-auto-encap-win32.c (qxeWNetGetLastError):
+	* intl-auto-encap-win32.c (qxeMultinetGetConnectionPerformance):
+	* intl-auto-encap-win32.c (qxeAppendMenu):
+	* intl-auto-encap-win32.c (qxeCopyAcceleratorTable):
+	* intl-auto-encap-win32.c (qxeDlgDirSelectComboBoxEx):
+	* intl-auto-encap-win32.c (qxeEnumDesktops):
+	* intl-auto-encap-win32.c (qxeEnumWindowStations):
+	* intl-auto-encap-win32.c (qxeGetClassInfo):
+	* intl-auto-encap-win32.c (qxeGetClassLong):
+	* intl-auto-encap-win32.c (qxeGetClassName):
+	* intl-auto-encap-win32.c (qxeGetKeyboardLayoutName):
+	* intl-auto-encap-win32.c (qxeGetWindowLong):
+	* intl-auto-encap-win32.c (qxeGetUserObjectInformation):
+	* intl-auto-encap-win32.c (qxeGetWindowTextLength):
+	* intl-auto-encap-win32.c (qxeGrayString):
+	* intl-auto-encap-win32.c (qxeInsertMenu):
+	* intl-auto-encap-win32.c (qxeSetProp):
+	* intl-auto-encap-win32.c (qxeEnumICMProfiles):
+	* intl-auto-encap-win32.c (qxeExtTextOut):
+	* intl-auto-encap-win32.c (qxeSetICMProfile):
+	* intl-auto-encap-win32.c (qxeTextOut):
+	* intl-auto-encap-win32.c (qxeSHGetPathFromIDList):
+	* intl-auto-encap-win32.c (qxeFindText):
+	* intl-auto-encap-win32.c (qxeReplaceText):
+	* intl-auto-encap-win32.c (qxeImmInstallIME):
+	* intl-auto-encap-win32.c (qxeImmGetDescription):
+	* intl-auto-encap-win32.c (qxeImmGetIMEFileName):
+	* intl-auto-encap-win32.c (qxeImmGetCompositionString):
+	* intl-auto-encap-win32.c (qxeImmGetCandidateListCount):
+	* intl-auto-encap-win32.c (qxeImmGetCandidateList):
+	* intl-auto-encap-win32.c (qxeImmGetGuideLine):
+	* intl-auto-encap-win32.c (qxeImmConfigureIME):
+	* intl-auto-encap-win32.c (qxeImmEscape):
+	* intl-auto-encap-win32.c (qxeImmGetConversionList):
+	* intl-auto-encap-win32.c (qxeImmRegisterWord):
+	* intl-auto-encap-win32.c (qxeImmUnregisterWord):
+	* intl-auto-encap-win32.c (qxeImmEnumRegisterWord):
+	* intl-auto-encap-win32.c (qxesndPlaySound):
+	* intl-auto-encap-win32.c (qxePlaySound):
+	* intl-auto-encap-win32.c (qxewaveOutGetErrorText):
+	* intl-auto-encap-win32.c (qxewaveInGetErrorText):
+	* intl-auto-encap-win32.c (qxemidiOutGetErrorText):
+	* intl-auto-encap-win32.c (qxemidiInGetErrorText):
+	* intl-auto-encap-win32.c (qxemmioStringToFOURCC):
+	* intl-auto-encap-win32.c (qxemmioInstallIOProc):
+	* intl-auto-encap-win32.c (qxemmioOpen):
+	* intl-auto-encap-win32.c (qxemmioRename):
+	* intl-auto-encap-win32.c (qxemciSendCommand):
+	* intl-auto-encap-win32.c (qxemciSendString):
+	* intl-auto-encap-win32.c (qxemciGetDeviceID):
+	* intl-auto-encap-win32.c (qxemciGetErrorString):
+	* intl-auto-encap-win32.h:
+	* intl-auto-encap-win32.h (qxemciGetErrorString):
+	Regenerate these files from Cygwin headers.
+	
+	* intl-encap-win32.c:
+	Bracket more functions in HAVE_MS_WINDOWS, to fix build problems
+	when building --with-msw=no on Cygwin.
+
+	Fixes for Cygwin headers:
+	-- Comment out IME.H, non-existent in Cygwin.
+	-- Make MessageBoxIndirect a `no' (don't encapsulate but generate
+	   error if used) because it has a structure parameter that needs
+	   to be A/W split but is declared as FOO*, and our parser can't
+	   split this.
+
+2010-01-15  Ben Wing  <ben@xemacs.org>
+
+	* Makefile.in.in:
+	Build xemacs-export.o whenever we're on any Windows OS (WIN32_ANY)
+	instead of only when we build support for the GUI portion of
+	MS-Windows (HAVE_MS_WINDOWS).
+
+	Cosmetic: Use WIN32_ANY in place of equivalent
+	(WIN32_NATIVE or CYGWIN).
+
+2010-01-15  Ben Wing  <ben@xemacs.org>
+
+	* emacs.c:
+	* emacs.c (debug_can_access_memory):
+	When checking for bad memory, we need to read all bytes from memory;
+	try even harder to avoid the possibility that a super-optimizing
+	compiler will optimize away the memory reads.
+
+2010-01-15  Ben Wing  <ben@xemacs.org>
+
+	* syswindows.h (LOCAL_FILE_FORMAT_TO_TSTR):
+	* syswindows.h (LOCAL_FILE_FORMAT_TO_INTERNAL_MSWIN):
+	* syswindows.h (INTERNAL_MSWIN_TO_LOCAL_FILE_FORMAT):
+	Declare some temporary pointer variables const to avoid compile
+	errors under C++ and/or Visual Studio 6.
+
 2010-01-27  Ben Wing  <ben@xemacs.org>
 
 	* casetab.c: Typo in comment.
@@ -209,7 +1210,6 @@
 	* number.c (vars_of_number):
 	most-positive-fixnum, most-negative-fixnum are no longer here.
 
->>>>>>> other
 2010-01-17  Vin Shelton  <acs@xemacs.org>
 
 	* fileio.c (check_writable): Remove cast from 2010-01-14
--- a/src/Makefile.in.in	Wed Jan 27 06:00:09 2010 -0600
+++ b/src/Makefile.in.in	Thu Jan 28 02:48:45 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.
 
@@ -917,6 +917,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)
--- a/src/README	Wed Jan 27 06:00:09 2010 -0600
+++ b/src/README	Thu Jan 28 02:48:45 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
--- a/src/abbrev.c	Wed Jan 27 06:00:09 2010 -0600
+++ b/src/abbrev.c	Thu Jan 28 02:48:45 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;
--- a/src/alloc.c	Wed Jan 27 06:00:09 2010 -0600
+++ b/src/alloc.c	Thu Jan 28 02:48:45 2010 -0600
@@ -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	\
@@ -2874,7 +2874,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;
@@ -2885,39 +2885,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
@@ -3243,62 +3297,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);
@@ -3382,42 +3428,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;
@@ -4449,8 +4481,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 != 
@@ -4493,8 +4525,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);
@@ -4936,7 +4968,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
 
@@ -4945,9 +4978,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_1);
 #endif
 #endif /* NEW_GC */
 
@@ -5040,9 +5074,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
@@ -5050,9 +5085,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 ();
--- a/src/buffer.c	Wed Jan 27 06:00:09 2010 -0600
+++ b/src/buffer.c	Thu Jan 28 02:48:45 2010 -0600
@@ -309,7 +309,7 @@
 	printing_unreadable_object ("#<buffer %s>", XSTRING_DATA (b->name));
     }
   else if (!BUFFER_LIVE_P (b))
-    write_c_string (printcharfun, "#<killed buffer>");
+    write_ascstring (printcharfun, "#<killed buffer>");
   else if (escapeflag)
     write_fmt_string_lisp (printcharfun, "#<buffer %S>", 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);
 
@@ -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? */
--- a/src/bytecode.c	Wed Jan 27 06:00:09 2010 -0600
+++ b/src/bytecode.c	Thu Jan 28 02:48:45 2010 -0600
@@ -1746,7 +1746,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);
 }
@@ -2218,7 +2218,7 @@
   struct gcpro gcpro1, gcpro2;
   GCPRO2 (obj, printcharfun);
 
-  write_c_string (printcharfun, print_readably ? "#[" : "#<compiled-function ");
+  write_ascstring (printcharfun, print_readably ? "#[" : "#<compiled-function ");
 #ifdef COMPILED_FUNCTION_ANNOTATION_HACK
   if (!print_readably)
     {
@@ -2231,7 +2231,7 @@
   print_internal (compiled_function_arglist (f), printcharfun, escapeflag);
 
   /* COMPILED_INSTRUCTIONS = 1 */
-  write_c_string (printcharfun, " ");
+  write_ascstring (printcharfun, " ");
   {
     struct gcpro ngcpro1;
     Lisp_Object instructions = compiled_function_instructions (f);
@@ -2248,7 +2248,7 @@
   }
 
   /* COMPILED_CONSTANTS = 2 */
-  write_c_string (printcharfun, " ");
+  write_ascstring (printcharfun, " ");
   print_internal (compiled_function_constants (f), printcharfun, escapeflag);
 
   /* COMPILED_STACK_DEPTH = 3 */
@@ -2257,7 +2257,7 @@
   /* COMPILED_DOC_STRING = 4 */
   if (docp || intp)
     {
-      write_c_string (printcharfun, " ");
+      write_ascstring (printcharfun, " ");
       print_internal (compiled_function_documentation (f), printcharfun,
 		      escapeflag);
     }
@@ -2265,13 +2265,13 @@
   /* COMPILED_INTERACTIVE = 5 */
   if (intp)
     {
-      write_c_string (printcharfun, " ");
+      write_ascstring (printcharfun, " ");
       print_internal (compiled_function_interactive (f), printcharfun,
 		      escapeflag);
     }
 
   UNGCPRO;
-  write_c_string (printcharfun, print_readably ? "]" : ">");
+  write_ascstring (printcharfun, print_readably ? "]" : ">");
 }
 
 
--- a/src/chartab.c	Wed Jan 27 06:00:09 2010 -0600
+++ b/src/chartab.c	Thu Jan 28 02:48:45 2010 -0600
@@ -226,6 +226,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))
@@ -313,7 +314,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);
@@ -337,7 +338,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 */
--- a/src/compiler.h	Wed Jan 27 06:00:09 2010 -0600
+++ b/src/compiler.h	Thu Jan 28 02:48:45 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 */
 
 #ifdef DEBUG_XEMACS
--- a/src/config.h.in	Wed Jan 27 06:00:09 2010 -0600
+++ b/src/config.h.in	Thu Jan 28 02:48:45 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_ */
--- a/src/console-gtk.c	Wed Jan 27 06:00:09 2010 -0600
+++ b/src/console-gtk.c	Thu Jan 28 02:48:45 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);
 }
--- a/src/console-impl.h	Wed Jan 27 06:00:09 2010 -0600
+++ b/src/console-impl.h	Thu Jan 28 02:48:45 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);
--- a/src/console-stream.c	Wed Jan 27 06:00:09 2010 -0600
+++ b/src/console-stream.c	Thu Jan 28 02:48:45 2010 -0600
@@ -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);
 }
 
--- a/src/console-tty.c	Wed Jan 27 06:00:09 2010 -0600
+++ b/src/console-tty.c	Thu Jan 28 02:48:45 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 */
--- a/src/console-x.c	Wed Jan 27 06:00:09 2010 -0600
+++ b/src/console-x.c	Thu Jan 28 02:48:45 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. */
--- a/src/console-x.h	Wed Jan 27 06:00:09 2010 -0600
+++ b/src/console-x.h	Thu Jan 28 02:48:45 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);
--- a/src/data.c	Wed Jan 27 06:00:09 2010 -0600
+++ b/src/data.c	Thu Jan 28 02:48:45 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, Ascbyte *);
       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, Ascbyte *);
       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, Ascbyte *);
       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);
   }
 }
 
--- a/src/database.c	Wed Jan 27 06:00:09 2010 -0600
+++ b/src/database.c	Thu Jan 28 02:48:45 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);
     }
@@ -346,7 +346,7 @@
   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);
 }
@@ -473,7 +473,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
@@ -564,9 +564,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 +583,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);
       }
--- a/src/depend	Wed Jan 27 06:00:09 2010 -0600
+++ b/src/depend	Thu Jan 28 02:48:45 2010 -0600
@@ -33,6 +33,7 @@
 #if defined(HAVE_XLIKE)
 event-xlike-inc.o: 
 objects-xlike-inc.o: 
+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.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 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 sysproc.h syssignal.h systime.h text.h vdb.h window-impl.h window.h winslots.h xgccache.h xintrinsic.h xintrinsicp.h xmotif.h xmprimitivep.h
 #endif
 #if defined(HAVE_X_WINDOWS)
 EmacsFrame.o: $(CONFIG_H) $(LISP_H) $(LWLIB_SRCDIR)/lwlib.h EmacsFrame.h EmacsFrameP.h EmacsManager.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 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.h vdb.h window-impl.h window.h winslots.h xintrinsic.h xintrinsicp.h xmotif.h xmprimitivep.h
@@ -42,23 +43,23 @@
 balloon-x.o: $(CONFIG_H) $(LISP_H) $(LWLIB_SRCDIR)/lwlib.h balloon_help.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 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 xintrinsic.h
 balloon_help.o: $(CONFIG_H) balloon_help.h compiler.h xintrinsic.h
 console-x.o: $(CONFIG_H) $(LISP_H) $(LWLIB_SRCDIR)/lwlib.h buffer.h bufslots.h casetab.h charset.h chartab.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 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 process.h redisplay.h specifier.h symeval.h symsinit.h text.h vdb.h xintrinsic.h
-device-x.o: $(CONFIG_H) $(LISP_H) $(LWLIB_SRCDIR)/lwlib.h buffer.h bufslots.h casetab.h charset.h chartab.h coding-system-slots.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 elhash.h events.h faces.h file-coding.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 process.h redisplay.h scrollbar.h specifier.h symeval.h symsinit.h sysdep.h sysdll.h sysfile.h systime.h text.h vdb.h window-impl.h window.h winslots.h xgccache.h xintrinsic.h xintrinsicp.h
+device-x.o: $(CONFIG_H) $(LISP_H) $(LWLIB_SRCDIR)/lwlib.h buffer.h bufslots.h casetab.h charset.h chartab.h coding-system-slots.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 elhash.h events.h faces.h file-coding.h frame-impl.h frame.h frameslots.h gc.h general-slots.h glyphs-x.h glyphs.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 objects-x.h objects.h process.h redisplay.h scrollbar.h specifier.h symeval.h symsinit.h sysdep.h sysdll.h sysfile.h systime.h syswindows.h text.h vdb.h window-impl.h window.h winslots.h xgccache.h xintrinsic.h xintrinsicp.h
 dialog-x.o: $(CONFIG_H) $(LISP_H) $(LWLIB_SRCDIR)/lwlib.h EmacsFrame.h buffer.h bufslots.h casetab.h charset.h chartab.h commands.h compiler.h conslots.h console-impl.h console-x-impl.h console-x.h console.h dumper.h events.h frame-impl.h frame.h frameslots.h gc.h general-slots.h gui.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 specifier.h symeval.h symsinit.h systime.h text.h vdb.h window.h xintrinsic.h
 frame-x.o: $(CONFIG_H) $(LISP_H) $(LWLIB_SRCDIR)/lwlib.h EmacsFrame.h EmacsFrameP.h EmacsManager.h EmacsShell.h ExternalShell.h buffer.h bufslots.h casetab.h charset.h chartab.h compiler.h conslots.h console-impl.h console-x-impl.h console-x.h console.h device-impl.h device.h devslots.h dragdrop.h dumper.h events.h extents.h faces.h frame-impl.h frame.h frameslots.h gc.h general-slots.h glyphs-x.h glyphs.h gutter.h lisp-disunion.h lisp-union.h lisp.h lrecord.h mc-alloc.h number-gmp.h number-mp.h number.h objects-impl.h objects-x-impl.h objects-x.h objects.h redisplay.h scrollbar-x.h scrollbar.h specifier.h symeval.h symsinit.h systime.h text.h vdb.h window-impl.h window.h winslots.h xintrinsic.h xintrinsicp.h xmotif.h xmprimitivep.h
-glyphs-x.o: $(CONFIG_H) $(LISP_H) $(LWLIB_SRCDIR)/lwlib.h bitmaps.h buffer.h bufslots.h casetab.h charset.h chartab.h coding-system-slots.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 faces.h file-coding.h frame-impl.h frame.h frameslots.h gc.h general-slots.h glyphs-x.h glyphs.h gui.h imgproc.h insdel.h lisp-disunion.h lisp-union.h lisp.h lrecord.h lstream.h mc-alloc.h number-gmp.h number-mp.h number.h objects-impl.h objects-x-impl.h objects-x.h objects.h opaque.h process.h redisplay.h scrollbar.h specifier.h symeval.h symsinit.h sysfile.h sysproc.h syssignal.h systime.h text.h vdb.h window-impl.h window.h winslots.h xintrinsic.h xmotif.h
+glyphs-x.o: $(CONFIG_H) $(LISP_H) $(LWLIB_SRCDIR)/lwlib.h bitmaps.h buffer.h bufslots.h casetab.h charset.h chartab.h coding-system-slots.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 faces.h file-coding.h frame-impl.h frame.h frameslots.h gc.h general-slots.h glyphs-x.h glyphs.h gui.h imgproc.h insdel.h intl-auto-encap-win32.h lisp-disunion.h lisp-union.h lisp.h lrecord.h lstream.h mc-alloc.h number-gmp.h number-mp.h number.h objects-impl.h objects-x-impl.h objects-x.h objects.h opaque.h process.h redisplay.h scrollbar.h specifier.h symeval.h symsinit.h sysfile.h sysproc.h syssignal.h systime.h syswindows.h text.h vdb.h window-impl.h window.h winslots.h xintrinsic.h xmotif.h
 gui-x.o: $(CONFIG_H) $(LISP_H) $(LWLIB_SRCDIR)/lwlib.h buffer.h bufslots.h casetab.h charset.h chartab.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 events.h frame.h gc.h general-slots.h glyphs.h gui.h lisp-disunion.h lisp-union.h lisp.h lrecord.h mc-alloc.h menubar.h number-gmp.h number-mp.h number.h opaque.h redisplay.h scrollbar.h specifier.h symeval.h symsinit.h systime.h text.h vdb.h window-impl.h window.h winslots.h xintrinsic.h xmotif.h
 intl-x.o: $(CONFIG_H) $(LISP_H) $(LWLIB_SRCDIR)/lwlib.h compiler.h console-x.h console.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 xintrinsic.h
 menubar-x.o: $(CONFIG_H) $(LISP_H) $(LWLIB_SRCDIR)/lwlib.h EmacsFrame.h buffer.h bufslots.h casetab.h charset.h chartab.h commands.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 events.h frame-impl.h frame.h frameslots.h gc.h general-slots.h gui.h keymap.h lisp-disunion.h lisp-union.h lisp.h lrecord.h mc-alloc.h menubar.h number-gmp.h number-mp.h number.h opaque.h redisplay.h scrollbar.h specifier.h symeval.h symsinit.h systime.h text.h vdb.h window-impl.h window.h winslots.h xintrinsic.h
 objects-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 elhash.h font-mgr.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 objects-impl.h objects-x-impl.h objects-x.h objects-xlike-inc.c objects.h specifier.h symeval.h symsinit.h text.h vdb.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-impl.h console-x-impl.h console-x.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 general-slots.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-impl.h objects-x-impl.h objects-x.h objects.h redisplay.h scrollbar.h specifier.h symeval.h symsinit.h sysdep.h sysproc.h syssignal.h systime.h text.h vdb.h window-impl.h window.h winslots.h xgccache.h xintrinsic.h xintrinsicp.h xmotif.h xmprimitivep.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.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 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 sysproc.h syssignal.h systime.h text.h vdb.h window-impl.h window.h winslots.h xgccache.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
 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-common.h toolbar.h vdb.h window-impl.h window.h winslots.h xintrinsic.h xintrinsicp.h xmotif.h xmprimitivep.h
 xgccache.o: $(CONFIG_H) $(LISP_H) compiler.h dumper.h gc.h general-slots.h hash.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 xgccache.h
 #endif
 #if defined(HAVE_TTY)
-console-tty.o: $(CONFIG_H) $(LISP_H) charset.h coding-system-slots.h compiler.h conslots.h console-impl.h console-stream.h console-tty-impl.h console-tty.h console.h dumper.h elhash.h faces.h file-coding.h frame.h gc.h general-slots.h glyphs.h lisp-disunion.h lisp-union.h lisp.h lrecord.h lstream.h mc-alloc.h number-gmp.h number-mp.h number.h process.h redisplay.h scrollbar.h specifier.h symeval.h symsinit.h sysdep.h sysfile.h systty.h text.h vdb.h window-impl.h window.h winslots.h
-device-tty.o: $(CONFIG_H) $(LISP_H) charset.h compiler.h conslots.h console-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 faces.h frame.h gc.h general-slots.h lisp-disunion.h lisp-union.h lisp.h lrecord.h lstream.h mc-alloc.h number-gmp.h number-mp.h number.h redisplay.h specifier.h symeval.h symsinit.h sysdep.h sysfile.h syssignal.h systime.h systty.h text.h vdb.h
+console-tty.o: $(CONFIG_H) $(LISP_H) charset.h coding-system-slots.h compiler.h conslots.h console-impl.h console-stream.h console-tty-impl.h console-tty.h console.h dumper.h elhash.h faces.h file-coding.h frame.h gc.h general-slots.h glyphs.h intl-auto-encap-win32.h lisp-disunion.h lisp-union.h lisp.h lrecord.h lstream.h mc-alloc.h number-gmp.h number-mp.h number.h process.h redisplay.h scrollbar.h specifier.h symeval.h symsinit.h sysdep.h sysfile.h systty.h syswindows.h text.h vdb.h window-impl.h window.h winslots.h
+device-tty.o: $(CONFIG_H) $(LISP_H) charset.h compiler.h conslots.h console-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 faces.h frame.h gc.h general-slots.h intl-auto-encap-win32.h lisp-disunion.h lisp-union.h lisp.h lrecord.h lstream.h mc-alloc.h number-gmp.h number-mp.h number.h redisplay.h specifier.h symeval.h symsinit.h sysdep.h sysfile.h syssignal.h systime.h systty.h syswindows.h text.h vdb.h
 event-tty.o: $(CONFIG_H) $(LISP_H) compiler.h conslots.h console-impl.h console-tty-impl.h console-tty.h console.h device.h dumper.h events.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 process.h redisplay.h specifier.h symeval.h symsinit.h sysproc.h syssignal.h systime.h systty.h syswait.h text.h vdb.h
 frame-tty.o: $(CONFIG_H) $(LISP_H) compiler.h conslots.h console-impl.h console-tty-impl.h console-tty.h console.h device-impl.h device.h devslots.h dumper.h events.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 redisplay.h specifier.h symeval.h symsinit.h systime.h systty.h text.h vdb.h
 objects-tty.o: $(CONFIG_H) $(LISP_H) charset.h compiler.h conslots.h console-impl.h console-tty-impl.h console-tty.h console.h device.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 objects-impl.h objects-tty-impl.h objects-tty.h objects.h specifier.h symeval.h symsinit.h systty.h text.h vdb.h
@@ -66,7 +67,7 @@
 #endif
 #if defined(HAVE_GTK)
 console-gtk.o: $(CONFIG_H) $(LISP_H) charset.h compiler.h conslots.h console-gtk-impl.h console-gtk.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 process.h redisplay.h specifier.h symeval.h symsinit.h text.h vdb.h
-device-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 elhash.h events.h faces.h frame-impl.h frame.h frameslots.h gc.h gccache-gtk.h general-slots.h glyphs-gtk.h glyphs.h gtk-xemacs.h lisp-disunion.h lisp-union.h lisp.h lrecord.h mc-alloc.h number-gmp.h number-mp.h number.h objects-gtk.h objects.h redisplay.h scrollbar.h specifier.h symeval.h symsinit.h sysdep.h sysfile.h systime.h text.h vdb.h window-impl.h window.h winslots.h
+device-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 elhash.h events.h faces.h frame-impl.h frame.h frameslots.h gc.h gccache-gtk.h general-slots.h glyphs-gtk.h glyphs.h gtk-xemacs.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 objects-gtk.h objects.h redisplay.h scrollbar.h specifier.h symeval.h symsinit.h sysdep.h sysfile.h systime.h syswindows.h text.h vdb.h window-impl.h window.h winslots.h
 dialog-gtk.o: $(CONFIG_H) $(LISP_H) buffer.h bufslots.h casetab.h charset.h chartab.h commands.h compiler.h conslots.h console-gtk-impl.h console-gtk.h console-impl.h console.h dumper.h events.h frame.h gc.h general-slots.h gui.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 specifier.h symeval.h symsinit.h systime.h text.h vdb.h window.h
 emacs-marshals.o: hash.h
 emacs-widget-accessors.o: 
@@ -74,14 +75,14 @@
 frame-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 dragdrop.h dumper.h elhash.h events.h extents.h faces.h frame-impl.h frame.h frameslots.h gc.h general-slots.h glyphs-gtk.h glyphs.h gtk-xemacs.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-gtk.h scrollbar.h specifier.h symeval.h symsinit.h sysdll.h systime.h text.h ui-gtk.h vdb.h window-impl.h window.h winslots.h
 gccache-gtk.o: $(CONFIG_H) $(LISP_H) compiler.h dumper.h gc.h gccache-gtk.h general-slots.h hash.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
 glade.o: bytecode.h
-glyphs-gtk.o: $(CONFIG_H) $(LISP_H) bitmaps.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.h device-impl.h device.h devslots.h dumper.h elhash.h events.h faces.h file-coding.h frame-impl.h frame.h frameslots.h gc.h general-slots.h glyphs-gtk.h glyphs.h gui.h imgproc.h insdel.h lisp-disunion.h lisp-union.h lisp.h lrecord.h lstream.h mc-alloc.h number-gmp.h number-mp.h number.h objects-gtk-impl.h objects-gtk.h objects-impl.h objects.h opaque.h redisplay.h scrollbar.h specifier.h symeval.h symsinit.h sysdll.h sysfile.h systime.h text.h ui-gtk.h vdb.h window-impl.h window.h winslots.h
+glyphs-gtk.o: $(CONFIG_H) $(LISP_H) bitmaps.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.h device-impl.h device.h devslots.h dumper.h elhash.h events.h faces.h file-coding.h frame-impl.h frame.h frameslots.h gc.h general-slots.h glyphs-gtk.h glyphs.h gui.h imgproc.h insdel.h intl-auto-encap-win32.h lisp-disunion.h lisp-union.h lisp.h lrecord.h lstream.h mc-alloc.h number-gmp.h number-mp.h number.h objects-gtk-impl.h objects-gtk.h objects-impl.h objects.h opaque.h redisplay.h scrollbar.h specifier.h symeval.h symsinit.h sysdll.h sysfile.h systime.h syswindows.h text.h ui-gtk.h vdb.h window-impl.h window.h winslots.h
 gtk-glue.o: objects-gtk-impl.h objects-gtk.h objects-impl.h objects.h specifier.h
 gtk-xemacs.o: $(CONFIG_H) $(LISP_H) charset.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 event-gtk.h faces.h frame-impl.h frame.h frameslots.h gc.h general-slots.h glyphs.h gtk-xemacs.h lisp-disunion.h lisp-union.h lisp.h lrecord.h mc-alloc.h number-gmp.h number-mp.h number.h objects-gtk.h objects.h redisplay.h scrollbar.h specifier.h symeval.h symsinit.h text.h vdb.h window-impl.h window.h winslots.h
 gui-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 frame.h gc.h general-slots.h gui.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 specifier.h symeval.h symsinit.h text.h vdb.h
 menubar-gtk.o: $(CONFIG_H) $(LISP_H) buffer.h bufslots.h casetab.h charset.h chartab.h commands.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-impl.h frame.h frameslots.h gc.h general-slots.h gui.h lisp-disunion.h lisp-union.h lisp.h lrecord.h mc-alloc.h menubar.h number-gmp.h number-mp.h number.h opaque.h redisplay.h scrollbar.h specifier.h symeval.h symsinit.h sysdll.h systime.h text.h ui-gtk.h vdb.h window-impl.h window.h winslots.h
 native-gtk-toolbar.o: $(CONFIG_H) $(LISP_H) charset.h compiler.h console-gtk.h console.h dumper.h faces.h frame.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 objects-gtk.h objects.h redisplay.h scrollbar.h specifier.h symeval.h symsinit.h text.h toolbar.h vdb.h window-impl.h window.h winslots.h
 objects-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 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 objects-gtk-impl.h objects-gtk.h objects-impl.h objects-xlike-inc.c objects.h specifier.h symeval.h symsinit.h text.h vdb.h
-redisplay-gtk.o: $(CONFIG_H) $(LISP_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.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 general-slots.h glyphs-gtk.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.h redisplay.h scrollbar.h specifier.h symeval.h symsinit.h sysdep.h sysproc.h syssignal.h systime.h text.h vdb.h window-impl.h window.h winslots.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.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 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 sysproc.h syssignal.h systime.h text.h vdb.h window-impl.h window.h winslots.h xgccache.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 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 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 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 text.h toolbar-common.h vdb.h
@@ -89,7 +90,7 @@
 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 event-gtk.h events.h faces.h gc.h general-slots.h glade.c glyphs-gtk.h glyphs.h gtk-glue.c gui.h hash.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 systime.h text.h ui-byhand.c ui-gtk.h vdb.h window-impl.h window.h winslots.h
 #endif
 #if defined(HAVE_DATABASE)
-database.o: $(CONFIG_H) $(LISP_H) buffer.h bufslots.h casetab.h charset.h chartab.h coding-system-slots.h compiler.h database.h dumper.h file-coding.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 sysfile.h text.h vdb.h
+database.o: $(CONFIG_H) $(LISP_H) buffer.h bufslots.h casetab.h charset.h chartab.h coding-system-slots.h compiler.h database.h dumper.h file-coding.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 sysfile.h syswindows.h text.h vdb.h
 #endif
 #if defined(MULE)
 mule-ccl.o: $(CONFIG_H) $(LISP_H) buffer.h bufslots.h casetab.h charset.h chartab.h coding-system-slots.h compiler.h dumper.h elhash.h file-coding.h gc.h general-slots.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 symeval.h symsinit.h text.h vdb.h
@@ -105,9 +106,9 @@
 extw-Xt.o: $(CONFIG_H) compiler.h extw-Xlib.h extw-Xt.h
 #endif
 abbrev.o: $(CONFIG_H) $(LISP_H) buffer.h bufslots.h casetab.h charset.h chartab.h commands.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 redisplay.h scrollbar.h symeval.h symsinit.h syntax.h text.h vdb.h window.h
-alloc.o: $(CONFIG_H) $(LISP_H) backtrace.h buffer.h bufslots.h bytecode.h casetab.h charset.h chartab.h coding-system-slots.h compiler.h conslots.h console-impl.h console-stream.h console.h device.h dumper.h elhash.h events.h extents-impl.h extents.h file-coding.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 lstream.h mc-alloc.h number-gmp.h number-mp.h number.h opaque.h process.h profile.h redisplay.h scrollbar.h specifier.h symeval.h symsinit.h sysdep.h sysfile.h systime.h text.h vdb.h window-impl.h window.h winslots.h
+alloc.o: $(CONFIG_H) $(LISP_H) backtrace.h buffer.h bufslots.h bytecode.h casetab.h charset.h chartab.h coding-system-slots.h compiler.h conslots.h console-impl.h console-stream.h console.h device.h dumper.h elhash.h events.h extents-impl.h extents.h file-coding.h frame-impl.h frame.h frameslots.h gc.h general-slots.h glyphs.h intl-auto-encap-win32.h lisp-disunion.h lisp-union.h lisp.h lrecord.h lstream.h mc-alloc.h number-gmp.h number-mp.h number.h opaque.h process.h profile.h redisplay.h scrollbar.h specifier.h symeval.h symsinit.h sysdep.h sysfile.h systime.h syswindows.h text.h vdb.h window-impl.h window.h winslots.h
 alloca.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
-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 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 text.h vdb.h
+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
@@ -118,49 +119,49 @@
 cm.o: $(CONFIG_H) $(LISP_H) compiler.h conslots.h console-impl.h console-tty-impl.h console-tty.h console.h device.h dumper.h frame.h gc.h general-slots.h lisp-disunion.h lisp-union.h lisp.h lrecord.h lstream.h mc-alloc.h number-gmp.h number-mp.h number.h redisplay.h specifier.h symeval.h symsinit.h systty.h text.h vdb.h
 cmdloop.o: $(CONFIG_H) $(LISP_H) buffer.h bufslots.h casetab.h charset.h chartab.h commands.h compiler.h conslots.h console-impl.h console-msw.h console.h device.h dumper.h events.h frame.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 redisplay.h scrollbar.h specifier.h symeval.h symsinit.h systime.h syswindows.h text.h vdb.h window.h
 cmds.o: $(CONFIG_H) $(LISP_H) buffer.h bufslots.h casetab.h charset.h chartab.h commands.h compiler.h dumper.h extents.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
-console-stream.o: $(CONFIG_H) $(LISP_H) compiler.h conslots.h console-impl.h console-stream-impl.h console-stream.h console-tty.h console.h device-impl.h device.h devslots.h dumper.h events.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 redisplay.h scrollbar.h specifier.h symeval.h symsinit.h sysdep.h sysfile.h systime.h systty.h text.h vdb.h window.h
+console-stream.o: $(CONFIG_H) $(LISP_H) compiler.h conslots.h console-impl.h console-stream-impl.h console-stream.h console-tty.h console.h device-impl.h device.h devslots.h dumper.h events.h frame-impl.h frame.h frameslots.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 redisplay.h scrollbar.h specifier.h symeval.h symsinit.h sysdep.h sysfile.h systime.h systty.h syswindows.h text.h vdb.h window.h
 console.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-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 redisplay.h scrollbar.h specifier.h symeval.h symsinit.h sysdep.h systime.h systty.h text.h vdb.h window.h
 data.o: $(CONFIG_H) $(LISP_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 symeval.h symsinit.h sysfloat.h syssignal.h text.h vdb.h
 debug.o: $(CONFIG_H) $(LISP_H) bytecode.h compiler.h debug.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
 device.o: $(CONFIG_H) $(LISP_H) buffer.h bufslots.h casetab.h charset.h chartab.h compiler.h conslots.h console-impl.h console.h device-impl.h device.h devslots.h dumper.h elhash.h events.h faces.h frame-impl.h frame.h frameslots.h gc.h general-slots.h keymap.h lisp-disunion.h lisp-union.h lisp.h lrecord.h mc-alloc.h number-gmp.h number-mp.h number.h objects.h redisplay.h scrollbar.h specifier.h symeval.h symsinit.h sysdep.h syssignal.h systime.h text.h toolbar.h vdb.h window.h
 dialog.o: $(CONFIG_H) $(LISP_H) compiler.h conslots.h console-impl.h console.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 redisplay.h specifier.h symeval.h symsinit.h text.h vdb.h
 dired.o: $(CONFIG_H) $(LISP_H) buffer.h bufslots.h casetab.h charset.h chartab.h commands.h compiler.h dumper.h elhash.h gc.h general-slots.h intl-auto-encap-win32.h lisp-disunion.h lisp-union.h lisp.h lrecord.h mc-alloc.h ndir.h number-gmp.h number-mp.h number.h opaque.h regex.h symeval.h symsinit.h syntax.h sysdep.h sysdir.h sysfile.h syspwd.h systime.h syswindows.h text.h vdb.h
-doc.o: $(CONFIG_H) $(LISP_H) buffer.h bufslots.h bytecode.h casetab.h charset.h chartab.h coding-system-slots.h compiler.h dumper.h file-coding.h gc.h general-slots.h insdel.h keymap.h lisp-disunion.h lisp-union.h lisp.h lrecord.h lstream.h mc-alloc.h number-gmp.h number-mp.h number.h symeval.h symsinit.h sysfile.h text.h vdb.h
+doc.o: $(CONFIG_H) $(LISP_H) buffer.h bufslots.h bytecode.h casetab.h charset.h chartab.h coding-system-slots.h compiler.h dumper.h file-coding.h gc.h general-slots.h insdel.h intl-auto-encap-win32.h keymap.h lisp-disunion.h lisp-union.h lisp.h lrecord.h lstream.h mc-alloc.h number-gmp.h number-mp.h number.h symeval.h symsinit.h sysfile.h syswindows.h text.h vdb.h
 doprnt.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 lstream.h mc-alloc.h number-gmp.h number-mp.h number.h symeval.h symsinit.h text.h vdb.h
 dragdrop.o: $(CONFIG_H) $(LISP_H) compiler.h dragdrop.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
 dump-data.o: $(CONFIG_H) $(LISP_H) compiler.h dump-data.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
 dumper.o: $(CONFIG_H) $(LISP_H) coding-system-slots.h compiler.h console-stream.h console.h dump-data.h dumper.h elhash.h file-coding.h gc.h general-slots.h intl-auto-encap-win32.h lisp-disunion.h lisp-union.h lisp.h lrecord.h lstream.h mc-alloc.h number-gmp.h number-mp.h number.h specifier.h symeval.h symsinit.h sysfile.h syswindows.h text.h vdb.h
 dynarr.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
 ecrt0.o: $(CONFIG_H)
-editfns.o: $(CONFIG_H) $(LISP_H) buffer.h bufslots.h casetab.h charset.h chartab.h commands.h compiler.h console.h device.h dumper.h events.h frame.h gc.h general-slots.h insdel.h line-number.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 symeval.h symsinit.h sysdep.h sysdir.h sysfile.h sysproc.h syspwd.h syssignal.h systime.h text.h vdb.h window.h
+editfns.o: $(CONFIG_H) $(LISP_H) buffer.h bufslots.h casetab.h charset.h chartab.h commands.h compiler.h console.h device.h dumper.h events.h frame.h gc.h general-slots.h insdel.h intl-auto-encap-win32.h line-number.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 symeval.h symsinit.h sysdep.h sysdir.h sysfile.h sysproc.h syspwd.h syssignal.h systime.h syswindows.h text.h vdb.h window.h
 elhash.o: $(CONFIG_H) $(LISP_H) bytecode.h compiler.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 opaque.h symeval.h symsinit.h text.h vdb.h
 emacs.o: $(CONFIG_H) $(LISP_H) backtrace.h buffer.h bufslots.h casetab.h charset.h chartab.h commands.h compiler.h console-msw.h console.h dump-data.h dumper.h frame.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 paths.h process.h redisplay.h symeval.h symsinit.h sysdep.h sysdll.h sysfile.h sysproc.h syssignal.h systime.h systty.h syswindows.h text.h vdb.h
 emodules.o: $(CONFIG_H) $(LISP_H) buffer.h bufslots.h casetab.h charset.h chartab.h coding-system-slots.h compiler.h console.h dumper.h emodules.h file-coding.h frame.h gc.h general-slots.h insdel.h lisp-disunion.h lisp-union.h lisp.h lrecord.h lstream.h mc-alloc.h number-gmp.h number-mp.h number.h redisplay.h scrollbar.h symeval.h symsinit.h sysdep.h sysdll.h text.h vdb.h window.h
-esd.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 miscplay.h number-gmp.h number-mp.h number.h sound.h symeval.h symsinit.h sysfile.h text.h vdb.h
+esd.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 miscplay.h number-gmp.h number-mp.h number.h sound.h symeval.h symsinit.h sysfile.h syswindows.h text.h vdb.h
 eval.o: $(CONFIG_H) $(LISP_H) backtrace.h buffer.h bufslots.h bytecode.h casetab.h charset.h chartab.h commands.h compiler.h conslots.h console-impl.h console.h device.h dumper.h frame.h gc.h general-slots.h lisp-disunion.h lisp-union.h lisp.h lrecord.h lstream.h mc-alloc.h number-gmp.h number-mp.h number.h opaque.h profile.h redisplay.h scrollbar.h specifier.h symeval.h symsinit.h text.h vdb.h window.h
 event-Xt.o: $(CONFIG_H) $(LISP_H) $(LWLIB_SRCDIR)/lwlib.h Emacs.ad.h EmacsFrame.h blocktype.h charset.h coding-system-slots.h compiler.h conslots.h console-impl.h console-tty.h console-x-impl.h console-x.h console.h device-impl.h device.h devslots.h dragdrop.h dumper.h elhash.h event-xlike-inc.c events.h file-coding.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 lstream.h mc-alloc.h number-gmp.h number-mp.h number.h objects-x.h objects.h process.h redisplay.h scrollbar.h specifier.h symeval.h symsinit.h sysproc.h syssignal.h systime.h systty.h text.h vdb.h window-impl.h window.h winslots.h xintrinsic.h xintrinsicp.h xmotif.h
-event-stream.o: $(CONFIG_H) $(LISP_H) backtrace.h blocktype.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 events.h file-coding.h frame-impl.h frame.h frameslots.h gc.h general-slots.h gui.h insdel.h keymap.h lisp-disunion.h lisp-union.h lisp.h lrecord.h lstream.h macros.h mc-alloc.h menubar.h number-gmp.h number-mp.h number.h process.h profile.h redisplay.h scrollbar.h specifier.h symeval.h symsinit.h sysdep.h sysfile.h syssignal.h systime.h text.h vdb.h window-impl.h window.h winslots.h
-event-unixoid.o: $(CONFIG_H) $(LISP_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 gc.h general-slots.h lisp-disunion.h lisp-union.h lisp.h lrecord.h lstream.h mc-alloc.h number-gmp.h number-mp.h number.h process.h specifier.h symeval.h symsinit.h sysdep.h sysfile.h sysproc.h syssignal.h systime.h systty.h text.h vdb.h
+event-stream.o: $(CONFIG_H) $(LISP_H) backtrace.h blocktype.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 events.h file-coding.h frame-impl.h frame.h frameslots.h gc.h general-slots.h gui.h insdel.h intl-auto-encap-win32.h keymap.h lisp-disunion.h lisp-union.h lisp.h lrecord.h lstream.h macros.h mc-alloc.h menubar.h number-gmp.h number-mp.h number.h process.h profile.h redisplay.h scrollbar.h specifier.h symeval.h symsinit.h sysdep.h sysfile.h syssignal.h systime.h syswindows.h text.h vdb.h window-impl.h window.h winslots.h
+event-unixoid.o: $(CONFIG_H) $(LISP_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 gc.h general-slots.h intl-auto-encap-win32.h lisp-disunion.h lisp-union.h lisp.h lrecord.h lstream.h mc-alloc.h number-gmp.h number-mp.h number.h process.h specifier.h symeval.h symsinit.h sysdep.h sysfile.h sysproc.h syssignal.h systime.h systty.h syswindows.h text.h vdb.h
 events.o: $(CONFIG_H) $(LISP_H) buffer.h bufslots.h casetab.h charset.h chartab.h compiler.h conslots.h console-impl.h console-tty-impl.h console-tty.h console.h device.h dumper.h events.h extents.h frame-impl.h frame.h frameslots.h gc.h general-slots.h glyphs.h keymap.h lisp-disunion.h lisp-union.h lisp.h lrecord.h lstream.h mc-alloc.h number-gmp.h number-mp.h number.h redisplay.h scrollbar.h specifier.h symeval.h symsinit.h systime.h systty.h text.h toolbar.h vdb.h window-impl.h window.h winslots.h
 extents.o: $(CONFIG_H) $(LISP_H) backtrace.h buffer.h bufslots.h casetab.h charset.h chartab.h compiler.h console.h debug.h device.h dumper.h elhash.h extents-impl.h extents.h faces.h frame.h gc.h general-slots.h glyphs.h gutter.h insdel.h keymap.h lisp-disunion.h lisp-union.h lisp.h lrecord.h mc-alloc.h number-gmp.h number-mp.h number.h opaque.h process.h profile.h redisplay.h scrollbar.h specifier.h symeval.h symsinit.h text.h vdb.h window-impl.h window.h winslots.h
 faces.o: $(CONFIG_H) $(LISP_H) buffer.h bufslots.h casetab.h charset.h chartab.h compiler.h conslots.h console-impl.h console.h device-impl.h device.h devslots.h dumper.h elhash.h extents-impl.h extents.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 objects-impl.h objects.h redisplay.h scrollbar.h specifier.h symeval.h symsinit.h text.h vdb.h window-impl.h window.h winslots.h
 file-coding.o: $(CONFIG_H) $(LISP_H) buffer.h bufslots.h casetab.h charset.h chartab.h coding-system-slots.h compiler.h dumper.h elhash.h extents.h file-coding.h gc.h general-slots.h insdel.h lisp-disunion.h lisp-union.h lisp.h lrecord.h lstream.h mc-alloc.h number-gmp.h number-mp.h number.h opaque.h rangetab.h symeval.h symsinit.h text.h vdb.h
 fileio.o: $(CONFIG_H) $(LISP_H) backtrace.h buffer.h bufslots.h casetab.h charset.h chartab.h coding-system-slots.h compiler.h console.h device.h dumper.h events.h file-coding.h frame.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 profile.h redisplay.h scrollbar.h symeval.h symsinit.h sysdep.h sysdir.h sysfile.h sysproc.h syspwd.h syssignal.h systime.h syswindows.h text.h vdb.h window-impl.h window.h winslots.h
-filelock.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 ndir.h number-gmp.h number-mp.h number.h paths.h symeval.h symsinit.h sysdir.h sysfile.h sysproc.h syspwd.h syssignal.h systime.h text.h vdb.h
-filemode.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 sysfile.h text.h vdb.h
+filelock.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 ndir.h number-gmp.h number-mp.h number.h paths.h symeval.h symsinit.h sysdir.h sysfile.h sysproc.h syspwd.h syssignal.h systime.h syswindows.h text.h vdb.h
+filemode.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 sysfile.h syswindows.h text.h vdb.h
 floatfns.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 sysfloat.h syssignal.h text.h vdb.h
-fns.o: $(CONFIG_H) $(LISP_H) buffer.h bufslots.h bytecode.h casetab.h charset.h chartab.h compiler.h console.h device.h dumper.h events.h extents.h frame.h gc.h general-slots.h insdel.h lisp-disunion.h lisp-union.h lisp.h lrecord.h lstream.h mc-alloc.h number-gmp.h number-mp.h number.h opaque.h process.h redisplay.h symeval.h symsinit.h sysfile.h sysproc.h syssignal.h systime.h text.h vdb.h
+fns.o: $(CONFIG_H) $(LISP_H) buffer.h bufslots.h bytecode.h casetab.h charset.h chartab.h compiler.h console.h device.h dumper.h events.h extents.h frame.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 number-gmp.h number-mp.h number.h opaque.h process.h redisplay.h symeval.h symsinit.h sysfile.h sysproc.h syssignal.h systime.h syswindows.h text.h vdb.h
 font-lock.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
 font-mgr.o: $(CONFIG_H) $(LISP_H) $(LWLIB_SRCDIR)/lwlib.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 font-mgr.h gc.h general-slots.h hash.h lisp-disunion.h lisp-union.h lisp.h lrecord.h mc-alloc.h number-gmp.h number-mp.h number.h objects-impl.h objects-x-impl.h objects-x.h objects.h specifier.h symeval.h symsinit.h text.h vdb.h xintrinsic.h
 frame.o: $(CONFIG_H) $(LISP_H) buffer.h bufslots.h casetab.h charset.h chartab.h compiler.h conslots.h console-impl.h console.h device-impl.h device.h devslots.h dumper.h events.h extents.h faces.h frame-impl.h frame.h frameslots.h gc.h general-slots.h glyphs.h gui.h gutter.h lisp-disunion.h lisp-union.h lisp.h lrecord.h mc-alloc.h menubar.h number-gmp.h number-mp.h number.h process.h redisplay.h scrollbar.h specifier.h symeval.h symsinit.h systime.h text.h toolbar.h vdb.h window-impl.h window.h winslots.h
 free-hook.o: $(CONFIG_H) $(LISP_H) compiler.h dumper.h gc.h general-slots.h hash.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
-gc.o: $(CONFIG_H) $(LISP_H) backtrace.h buffer.h bufslots.h bytecode.h casetab.h charset.h chartab.h coding-system-slots.h compiler.h conslots.h console-impl.h console-stream.h console.h device.h dumper.h elhash.h events.h extents-impl.h extents.h file-coding.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 lstream.h mc-alloc.h number-gmp.h number-mp.h number.h opaque.h process.h profile.h redisplay.h scrollbar.h specifier.h symeval.h symsinit.h sysdep.h sysfile.h systime.h text.h vdb.h window-impl.h window.h winslots.h
+gc.o: $(CONFIG_H) $(LISP_H) backtrace.h buffer.h bufslots.h bytecode.h casetab.h charset.h chartab.h coding-system-slots.h compiler.h conslots.h console-impl.h console-stream.h console.h device.h dumper.h elhash.h events.h extents-impl.h extents.h file-coding.h frame-impl.h frame.h frameslots.h gc.h general-slots.h glyphs.h intl-auto-encap-win32.h lisp-disunion.h lisp-union.h lisp.h lrecord.h lstream.h mc-alloc.h number-gmp.h number-mp.h number.h opaque.h process.h profile.h redisplay.h scrollbar.h specifier.h symeval.h symsinit.h sysdep.h sysfile.h systime.h syswindows.h text.h vdb.h window-impl.h window.h winslots.h
 general.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
-getloadavg.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 sysfile.h text.h vdb.h
-glyphs-eimage.o: $(CONFIG_H) $(LISP_H) buffer.h bufslots.h casetab.h charset.h chartab.h coding-system-slots.h compiler.h conslots.h console-impl.h console.h device-impl.h device.h devslots.h dumper.h faces.h file-coding.h frame.h gc.h general-slots.h glyphs.h lisp-disunion.h lisp-union.h lisp.h lrecord.h lstream.h mc-alloc.h number-gmp.h number-mp.h number.h objects-impl.h objects.h opaque.h redisplay.h scrollbar.h specifier.h symeval.h symsinit.h sysfile.h text.h vdb.h window-impl.h window.h winslots.h
-glyphs-shared.o: $(CONFIG_H) $(LISP_H) buffer.h bufslots.h casetab.h charset.h chartab.h compiler.h console.h dumper.h elhash.h faces.h frame.h gc.h general-slots.h glyphs.h imgproc.h insdel.h lisp-disunion.h lisp-union.h lisp.h lrecord.h lstream.h mc-alloc.h number-gmp.h number-mp.h number.h opaque.h redisplay.h scrollbar.h specifier.h symeval.h symsinit.h sysdep.h sysfile.h text.h vdb.h window-impl.h window.h winslots.h
+getloadavg.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 sysfile.h syswindows.h text.h vdb.h
+glyphs-eimage.o: $(CONFIG_H) $(LISP_H) buffer.h bufslots.h casetab.h charset.h chartab.h coding-system-slots.h compiler.h conslots.h console-impl.h console.h device-impl.h device.h devslots.h dumper.h faces.h file-coding.h frame.h gc.h general-slots.h glyphs.h intl-auto-encap-win32.h lisp-disunion.h lisp-union.h lisp.h lrecord.h lstream.h mc-alloc.h number-gmp.h number-mp.h number.h objects-impl.h objects.h opaque.h redisplay.h scrollbar.h specifier.h symeval.h symsinit.h sysfile.h syswindows.h text.h vdb.h window-impl.h window.h winslots.h
+glyphs-shared.o: $(CONFIG_H) $(LISP_H) buffer.h bufslots.h casetab.h charset.h chartab.h compiler.h console.h dumper.h elhash.h faces.h frame.h gc.h general-slots.h glyphs.h imgproc.h insdel.h intl-auto-encap-win32.h lisp-disunion.h lisp-union.h lisp.h lrecord.h lstream.h mc-alloc.h number-gmp.h number-mp.h number.h opaque.h redisplay.h scrollbar.h specifier.h symeval.h symsinit.h sysdep.h sysfile.h syswindows.h text.h vdb.h window-impl.h window.h winslots.h
 glyphs-widget.o: $(CONFIG_H) $(LISP_H) bytecode.h charset.h compiler.h conslots.h console-impl.h console.h device-impl.h device.h devslots.h dumper.h faces.h frame.h gc.h general-slots.h glyphs.h gui.h insdel.h lisp-disunion.h lisp-union.h lisp.h lrecord.h lstream.h mc-alloc.h number-gmp.h number-mp.h number.h objects.h opaque.h redisplay.h scrollbar.h specifier.h symeval.h symsinit.h text.h vdb.h window-impl.h window.h winslots.h
-glyphs.o: $(CONFIG_H) $(LISP_H) blocktype.h buffer.h bufslots.h casetab.h charset.h chartab.h compiler.h conslots.h console-impl.h console.h device-impl.h device.h devslots.h dumper.h elhash.h faces.h frame-impl.h frame.h frameslots.h gc.h general-slots.h glyphs.h gui.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-impl.h objects.h opaque.h rangetab.h redisplay.h scrollbar.h specifier.h symeval.h symsinit.h sysfile.h text.h vdb.h window-impl.h window.h winslots.h
+glyphs.o: $(CONFIG_H) $(LISP_H) blocktype.h buffer.h bufslots.h casetab.h charset.h chartab.h compiler.h conslots.h console-impl.h console.h device-impl.h device.h devslots.h dumper.h elhash.h faces.h frame-impl.h frame.h frameslots.h gc.h general-slots.h glyphs.h gui.h insdel.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 objects-impl.h objects.h opaque.h rangetab.h redisplay.h scrollbar.h specifier.h symeval.h symsinit.h sysfile.h syswindows.h text.h vdb.h window-impl.h window.h winslots.h
 gmalloc.o: $(CONFIG_H) $(LISP_H) compiler.h dumper.h gc.h general-slots.h getpagesize.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 sysdep.h text.h vdb.h
 gpmevent.o: $(CONFIG_H) $(LISP_H) commands.h compiler.h conslots.h console-impl.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 gpmevent.h lisp-disunion.h lisp-union.h lisp.h lrecord.h lstream.h mc-alloc.h number-gmp.h number-mp.h number.h process.h redisplay.h specifier.h symeval.h symsinit.h sysdep.h sysproc.h syssignal.h systime.h systty.h text.h vdb.h
 gui.o: $(CONFIG_H) $(LISP_H) buffer.h bufslots.h bytecode.h casetab.h charset.h chartab.h compiler.h dumper.h elhash.h gc.h general-slots.h gui.h lisp-disunion.h lisp-union.h lisp.h lrecord.h mc-alloc.h menubar.h number-gmp.h number-mp.h number.h redisplay.h symeval.h symsinit.h text.h vdb.h
@@ -180,18 +181,18 @@
 keymap.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 events.h extents.h frame.h gc.h general-slots.h insdel.h keymap.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 systime.h text.h vdb.h window.h
 lastfile.o: $(CONFIG_H)
 libinterface.o: $(CONFIG_H) $(LISP_H) compiler.h dumper.h gc.h general-slots.h libinterface.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
-libsst.o: $(CONFIG_H) $(LISP_H) buffer.h bufslots.h casetab.h charset.h chartab.h compiler.h dumper.h gc.h general-slots.h libsst.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 text.h vdb.h
+libsst.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 libsst.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
 line-number.o: $(CONFIG_H) $(LISP_H) buffer.h bufslots.h casetab.h charset.h chartab.h compiler.h dumper.h gc.h general-slots.h line-number.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
-linuxplay.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 miscplay.h number-gmp.h number-mp.h number.h sound.h symeval.h symsinit.h sysfile.h syssignal.h systty.h text.h vdb.h
+linuxplay.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 miscplay.h number-gmp.h number-mp.h number.h sound.h symeval.h symsinit.h sysfile.h syssignal.h systty.h syswindows.h text.h vdb.h
 lread.o: $(CONFIG_H) $(LISP_H) backtrace.h buffer.h bufslots.h bytecode.h casetab.h charset.h chartab.h coding-system-slots.h compiler.h dumper.h elhash.h file-coding.h gc.h general-slots.h intl-auto-encap-win32.h lisp-disunion.h lisp-union.h lisp.h lrecord.h lstream.h mc-alloc.h number-gmp.h number-mp.h number.h opaque.h profile.h symeval.h symsinit.h sysfile.h sysfloat.h syswindows.h text.h vdb.h
-lstream.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 lstream.h mc-alloc.h number-gmp.h number-mp.h number.h symeval.h symsinit.h sysfile.h text.h vdb.h
+lstream.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 intl-auto-encap-win32.h lisp-disunion.h lisp-union.h lisp.h lrecord.h lstream.h mc-alloc.h number-gmp.h number-mp.h number.h symeval.h symsinit.h sysfile.h syswindows.h text.h vdb.h
 macros.o: $(CONFIG_H) $(LISP_H) buffer.h bufslots.h casetab.h charset.h chartab.h commands.h compiler.h conslots.h console-impl.h console.h device.h dumper.h events.h frame.h gc.h general-slots.h keymap.h lisp-disunion.h lisp-union.h lisp.h lrecord.h macros.h mc-alloc.h number-gmp.h number-mp.h number.h redisplay.h scrollbar.h specifier.h symeval.h symsinit.h systime.h text.h vdb.h window.h
 marker.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 symeval.h symsinit.h text.h vdb.h
 mc-alloc.o: $(CONFIG_H) $(LISP_H) blocktype.h compiler.h dumper.h gc.h general-slots.h getpagesize.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
 md5.o: $(CONFIG_H) $(LISP_H) buffer.h bufslots.h casetab.h charset.h chartab.h coding-system-slots.h compiler.h dumper.h file-coding.h gc.h general-slots.h lisp-disunion.h lisp-union.h lisp.h lrecord.h lstream.h mc-alloc.h number-gmp.h number-mp.h number.h symeval.h symsinit.h text.h vdb.h
 menubar.o: $(CONFIG_H) $(LISP_H) buffer.h bufslots.h casetab.h charset.h chartab.h compiler.h conslots.h console-impl.h console.h device-impl.h device.h devslots.h dumper.h frame-impl.h frame.h frameslots.h gc.h general-slots.h gui.h keymap.h lisp-disunion.h lisp-union.h lisp.h lrecord.h mc-alloc.h menubar.h number-gmp.h number-mp.h number.h redisplay.h scrollbar.h specifier.h symeval.h symsinit.h text.h vdb.h window-impl.h window.h winslots.h
 minibuf.o: $(CONFIG_H) $(LISP_H) buffer.h bufslots.h casetab.h charset.h chartab.h commands.h compiler.h conslots.h console-impl.h console-stream.h console.h dumper.h events.h frame-impl.h frame.h frameslots.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 redisplay.h scrollbar.h specifier.h symeval.h symsinit.h systime.h text.h vdb.h window-impl.h window.h winslots.h
-miscplay.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 miscplay.h number-gmp.h number-mp.h number.h sound.h symeval.h symsinit.h sysfile.h syssignal.h text.h vdb.h
+miscplay.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 miscplay.h number-gmp.h number-mp.h number.h sound.h symeval.h symsinit.h sysfile.h syssignal.h syswindows.h text.h vdb.h
 nas.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 sound.h symeval.h symsinit.h sysdep.h syssignal.h text.h vdb.h
 nt.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 ndir.h number-gmp.h number-mp.h number.h process.h symeval.h symsinit.h sysdir.h sysfile.h sysproc.h syspwd.h syssignal.h systime.h syswindows.h text.h vdb.h
 ntheap.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 sysdep.h syswindows.h text.h vdb.h
@@ -203,26 +204,26 @@
 opaque.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 opaque.h symeval.h symsinit.h text.h vdb.h
 print.o: $(CONFIG_H) $(LISP_H) backtrace.h buffer.h bufslots.h bytecode.h casetab.h charset.h chartab.h compiler.h conslots.h console-impl.h console-msw.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 extents.h frame.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 number-gmp.h number-mp.h number.h opaque.h redisplay.h specifier.h symeval.h symsinit.h sysfile.h systty.h syswindows.h text.h vdb.h
 process-nt.o: $(CONFIG_H) $(LISP_H) compiler.h console-msw.h console.h dumper.h events.h gc.h general-slots.h hash.h intl-auto-encap-win32.h lisp-disunion.h lisp-union.h lisp.h lrecord.h lstream.h mc-alloc.h number-gmp.h number-mp.h number.h process-slots.h process.h procimpl.h symeval.h symsinit.h sysfile.h sysproc.h syssignal.h systime.h syswindows.h text.h vdb.h
-process-unix.o: $(CONFIG_H) $(LISP_H) buffer.h bufslots.h casetab.h charset.h chartab.h coding-system-slots.h compiler.h console.h dumper.h events.h file-coding.h frame.h gc.h general-slots.h hash.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 opaque.h process-slots.h process.h procimpl.h redisplay.h scrollbar.h symeval.h symsinit.h sysdep.h sysdir.h sysfile.h sysproc.h syssignal.h systime.h systty.h syswait.h text.h vdb.h window.h
+process-unix.o: $(CONFIG_H) $(LISP_H) buffer.h bufslots.h casetab.h charset.h chartab.h coding-system-slots.h compiler.h console.h dumper.h events.h file-coding.h frame.h gc.h general-slots.h hash.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 opaque.h process-slots.h process.h procimpl.h redisplay.h scrollbar.h symeval.h symsinit.h sysdep.h sysdir.h sysfile.h sysproc.h syssignal.h systime.h systty.h syswait.h syswindows.h text.h vdb.h window.h
 process.o: $(CONFIG_H) $(LISP_H) buffer.h bufslots.h casetab.h charset.h chartab.h coding-system-slots.h commands.h compiler.h console.h device.h dumper.h events.h file-coding.h frame.h gc.h general-slots.h hash.h insdel.h intl-auto-encap-win32.h lisp-disunion.h lisp-union.h lisp.h lrecord.h lstream.h mc-alloc.h number-gmp.h number-mp.h number.h opaque.h process-slots.h process.h procimpl.h redisplay.h scrollbar.h symeval.h symsinit.h sysdep.h sysfile.h sysproc.h syssignal.h systime.h systty.h syswait.h syswindows.h text.h vdb.h window.h
 profile.o: $(CONFIG_H) $(LISP_H) backtrace.h bytecode.h compiler.h dumper.h elhash.h gc.h general-slots.h hash.h lisp-disunion.h lisp-union.h lisp.h lrecord.h mc-alloc.h number-gmp.h number-mp.h number.h profile.h symeval.h symsinit.h syssignal.h systime.h text.h vdb.h
 ralloc.o: $(CONFIG_H) $(LISP_H) compiler.h dumper.h gc.h general-slots.h getpagesize.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
 rangetab.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 rangetab.h symeval.h symsinit.h text.h vdb.h
 realpath.o: $(CONFIG_H) $(LISP_H) backtrace.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 ndir.h number-gmp.h number-mp.h number.h profile.h symeval.h symsinit.h sysdir.h sysfile.h syswindows.h text.h vdb.h
 redisplay-output.o: $(CONFIG_H) $(LISP_H) buffer.h bufslots.h casetab.h charset.h chartab.h compiler.h conslots.h console-impl.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 gutter.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 text.h vdb.h window-impl.h window.h winslots.h
-redisplay.o: $(CONFIG_H) $(LISP_H) backtrace.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-tty.h console.h debug.h device-impl.h device.h devslots.h dumper.h elhash.h events.h extents-impl.h extents.h faces.h file-coding.h frame-impl.h frame.h frameslots.h gc.h general-slots.h glyphs.h gui.h gutter.h insdel.h line-number.h lisp-disunion.h lisp-union.h lisp.h lrecord.h mc-alloc.h menubar.h number-gmp.h number-mp.h number.h objects-impl.h objects.h opaque.h process.h profile.h redisplay.h scrollbar.h specifier.h symeval.h symsinit.h sysfile.h systime.h systty.h text.h toolbar.h vdb.h window-impl.h window.h winslots.h
+redisplay.o: $(CONFIG_H) $(LISP_H) backtrace.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-tty.h console.h debug.h device-impl.h device.h devslots.h dumper.h elhash.h events.h extents-impl.h extents.h faces.h file-coding.h frame-impl.h frame.h frameslots.h gc.h general-slots.h glyphs.h gui.h gutter.h insdel.h intl-auto-encap-win32.h line-number.h lisp-disunion.h lisp-union.h lisp.h lrecord.h mc-alloc.h menubar.h number-gmp.h number-mp.h number.h objects-impl.h objects.h opaque.h process.h profile.h redisplay.h scrollbar.h specifier.h symeval.h symsinit.h sysfile.h systime.h systty.h syswindows.h text.h toolbar.h vdb.h window-impl.h window.h winslots.h
 regex.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 regex.h symeval.h symsinit.h syntax.h text.h vdb.h
 scrollbar.o: $(CONFIG_H) $(LISP_H) buffer.h bufslots.h casetab.h charset.h chartab.h commands.h compiler.h conslots.h console-impl.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.h gutter.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 text.h vdb.h window-impl.h window.h winslots.h
 search.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 opaque.h regex.h symeval.h symsinit.h syntax.h text.h vdb.h
 select.o: $(CONFIG_H) $(LISP_H) buffer.h bufslots.h casetab.h charset.h chartab.h compiler.h conslots.h console-impl.h console.h device-impl.h device.h devslots.h dumper.h extents.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 objects.h opaque.h redisplay.h select.h specifier.h symeval.h symsinit.h text.h vdb.h
-sgiplay.o: $(CONFIG_H) $(LISP_H) buffer.h bufslots.h casetab.h charset.h chartab.h compiler.h dumper.h gc.h general-slots.h libst.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 sysproc.h syssignal.h systime.h text.h vdb.h
-sheap.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 sheap-adjust.h symeval.h symsinit.h sysfile.h text.h vdb.h
-signal.o: $(CONFIG_H) $(LISP_H) compiler.h conslots.h console-impl.h console.h device-impl.h device.h devslots.h dumper.h events.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 process.h redisplay.h specifier.h symeval.h symsinit.h sysdep.h sysfile.h syssignal.h systime.h text.h vdb.h
+sgiplay.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 libst.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 sysproc.h syssignal.h systime.h syswindows.h text.h vdb.h
+sheap.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 sheap-adjust.h symeval.h symsinit.h sysfile.h syswindows.h text.h vdb.h
+signal.o: $(CONFIG_H) $(LISP_H) compiler.h conslots.h console-impl.h console.h device-impl.h device.h devslots.h dumper.h events.h frame-impl.h frame.h frameslots.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 process.h redisplay.h specifier.h symeval.h symsinit.h sysdep.h sysfile.h syssignal.h systime.h syswindows.h text.h vdb.h
 sound.o: $(CONFIG_H) $(LISP_H) $(LWLIB_SRCDIR)/lwlib.h buffer.h bufslots.h casetab.h charset.h chartab.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 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 redisplay.h sound.h specifier.h symeval.h symsinit.h sysdep.h sysfile.h sysproc.h syssignal.h systime.h syswindows.h text.h vdb.h xintrinsic.h
 specifier.o: $(CONFIG_H) $(LISP_H) buffer.h bufslots.h casetab.h charset.h chartab.h compiler.h conslots.h console-impl.h console.h device-impl.h device.h devslots.h dumper.h frame.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 opaque.h rangetab.h redisplay.h scrollbar.h specifier.h symeval.h symsinit.h text.h vdb.h window-impl.h window.h winslots.h
 strcat.o: $(CONFIG_H)
 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 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 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
 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
@@ -245,7 +246,7 @@
 unexhp9k800.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
 unexnt.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 sysfile.h syswindows.h text.h vdb.h
 unexsol2-6.o: compiler.h
-unicode.o: $(CONFIG_H) $(LISP_H) buffer.h bufslots.h casetab.h charset.h chartab.h coding-system-slots.h compiler.h dumper.h extents.h file-coding.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 rangetab.h symeval.h symsinit.h sysfile.h text.h vdb.h
+unicode.o: $(CONFIG_H) $(LISP_H) buffer.h bufslots.h casetab.h charset.h chartab.h coding-system-slots.h compiler.h dumper.h extents.h file-coding.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 opaque.h rangetab.h symeval.h symsinit.h sysfile.h syswindows.h text.h vdb.h
 vdb-fake.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
 vdb-mach.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
 vdb-posix.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
--- a/src/device-gtk.c	Wed Jan 27 06:00:09 2010 -0600
+++ b/src/device-gtk.c	Thu Jan 28 02:48:45 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;
 
@@ -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,
--- a/src/device-msw.c	Wed Jan 27 06:00:09 2010 -0600
+++ b/src/device-msw.c	Thu Jan 28 02:48:45 2010 -0600
@@ -507,7 +507,7 @@
      name[] or ALLOCA ()ed */
   qxestrtok (nameint, ",");
 
-  return build_intstring (nameint);
+  return build_istring (nameint);
 }
 
 
@@ -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;
 
@@ -1155,7 +1155,7 @@
   Lisp_Devmode *dm = XDEVMODE (obj);
   if (print_readably)
     printing_unreadable_lcrecord (obj, 0);
-  write_c_string (printcharfun, "#<msprinter-settings");
+  write_ascstring (printcharfun, "#<msprinter-settings");
   if (!NILP (dm->printer_name))
     write_fmt_string_lisp (printcharfun, " for %S", 1, dm->printer_name);
   if (!NILP (dm->device))
--- a/src/device-x.c	Wed Jan 27 06:00:09 2010 -0600
+++ b/src/device-x.c	Thu Jan 28 02:48:45 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;
@@ -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)
@@ -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 ();
@@ -1005,10 +1006,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 +1199,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;
@@ -1605,7 +1606,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 +1619,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 +1630,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);
@@ -1803,7 +1804,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, /*
@@ -2048,7 +2049,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);
 
--- a/src/dialog-msw.c	Wed Jan 27 06:00:09 2010 -0600
+++ b/src/dialog-msw.c	Thu Jan 28 02:48:45 2010 -0600
@@ -297,7 +297,7 @@
 static struct
 {
   DWORD errmess;
-  Ascbyte *errname;
+  const Ascbyte *errname;
 } common_dialog_errors[] =
 {
   { CDERR_DIALOGFAILURE, "CDERR_DIALOGFAILURE" },
@@ -394,7 +394,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);
   
   {
@@ -468,7 +468,7 @@
   ofn.nMaxFile = sizeof (fnbuf) / XETCHAR_SIZE;
   qxetcscpy (fnbuf, XETEXT (""));
   
-  LISP_LOCAL_FILE_FORMAT_TO_TSTR (Fexpand_file_name (build_string (""), Qnil),
+  LISP_LOCAL_FILE_FORMAT_TO_TSTR (Fexpand_file_name (build_ascstring (""), Qnil),
 			     ofn.lpstrInitialDir);
   
   {
@@ -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 ("*.*")));
 }
--- a/src/dialog-x.c	Wed Jan 27 06:00:09 2010 -0600
+++ b/src/dialog-x.c	Thu Jan 28 02:48:45 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);
--- a/src/doc.c	Wed Jan 27 06:00:09 2010 -0600
+++ b/src/doc.c	Thu Jan 28 02:48:45 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));
@@ -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;
 	      }
@@ -1315,6 +1313,6 @@
 */ );
   Vinternal_doc_file_name = Qnil;
 
-  QSsubstitute = build_string (" *substitute*");
+  QSsubstitute = build_ascstring (" *substitute*");
   staticpro (&QSsubstitute);
 }
--- a/src/dumper.c	Wed Jan 27 06:00:09 2010 -0600
+++ b/src/dumper.c	Thu Jan 28 02:48:45 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);
--- a/src/dynarr.c	Wed Jan 27 06:00:09 2010 -0600
+++ b/src/dynarr.c	Thu Jan 28 02:48:45 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 <config.h>
 #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
--- a/src/editfns.c	Wed Jan 27 06:00:09 2010 -0600
+++ b/src/editfns.c	Thu Jan 28 02:48:45 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, /*
@@ -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);
 }
 
@@ -1078,7 +1078,7 @@
 			       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;
     }
@@ -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);
     }
--- a/src/elhash.c	Wed Jan 27 06:00:09 2010 -0600
+++ b/src/elhash.c	Thu Jan 28 02:48:45 2010 -0600
@@ -331,16 +331,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);
@@ -348,7 +348,7 @@
 	count++;
       }
 
-  write_c_string (printcharfun, ")");
+  write_ascstring (printcharfun, ")");
 }
 
 static void
@@ -358,16 +358,16 @@
   Lisp_Hash_Table *ht = XHASH_TABLE (obj);
   Ascbyte pigbuf[350];
 
-  write_c_string (printcharfun,
+  write_ascstring (printcharfun,
 		  print_readably ? "#s(hash-table" : "#<hash-table");
 
   /* These checks have a kludgy look to them, but they are safe.
      Due to nature of hashing, you cannot use arbitrary
      test functions anyway.  */
   if (!ht->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
@@ -411,7 +411,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);
 }
--- a/src/emacs.c	Wed Jan 27 06:00:09 2010 -0600
+++ b/src/emacs.c	Thu Jan 28 02:48:45 2010 -0600
@@ -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 ".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 <argc; j++)
 	    new_[j + 1] = argv[j];
@@ -1262,7 +1262,7 @@
       /* Change --display to -d, when its arg is separate.  */
       else if (dpy != 0 && skip_args > 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()
@@ -2632,7 +2633,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;
 
@@ -4208,7 +4209,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 +4217,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 +4283,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 +4296,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 +4308,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 +4477,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 +4504,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 +4520,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 +4536,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 +4552,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 +4612,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 +4634,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 +4650,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 +4667,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 +4678,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 +4689,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 +4702,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
--- a/src/emodules.c	Wed Jan 27 06:00:09 2010 -0600
+++ b/src/emodules.c	Thu Jan 28 02:48:45 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, Ibyte *);
+      xfree (modules[mod].modname, Ibyte *);
+      xfree (modules[mod].modver, Ibyte *);
+      xfree (modules[mod].modtitle, Ibyte *);
       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 = NEW_EXTERNAL_TO_C_STRING (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 = NEW_EXTERNAL_TO_C_STRING (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 = NEW_EXTERNAL_TO_C_STRING (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 (""));
 }
--- a/src/emodules.h	Wed Jan 27 06:00:09 2010 -0600
+++ b/src/emodules.h	Thu Jan 28 02:48:45 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)
--- a/src/eval.c	Wed Jan 27 06:00:09 2010 -0600
+++ b/src/eval.c	Thu Jan 28 02:48:45 2010 -0600
@@ -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) ? "#<special-form " : "#<subr ";
-  const CIbyte *name = subr_name (subr);
-  const CIbyte *trailer = subr->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);
@@ -2654,7 +2654,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 +2669,13 @@
 }
 
 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));
 }
 
 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 +2686,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 +2715,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 +2723,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 +2735,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 +2743,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 +2763,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 +2778,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 +2788,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 +2796,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 +2811,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 +2821,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 +2844,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 +2861,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 +2871,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 +2881,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 +2898,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 +2908,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 +2987,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);
 }
@@ -4572,7 +4572,7 @@
 
   if (0 == count)
     {
-      write_c_string (printcharfun, "#<zero-length multiple value>");
+      write_msg_string (printcharfun, "#<zero-length multiple value>");
     }
 
   for (index = 0; index < count;)
@@ -4594,7 +4594,7 @@
 
       if (count > 1 && index < count)
         {
-          write_c_string (printcharfun, " ;\n");
+          write_ascstring (printcharfun, " ;\n");
         }
     }
 }
@@ -5713,7 +5713,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 +5728,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 (),
@@ -7000,18 +7000,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 +7020,7 @@
   if (args)
     return *args;
   else
-    return list1 (build_string ("[internal]"));
+    return list1 (build_ascstring ("[internal]"));
 }
 
 DEFUN ("backtrace", Fbacktrace, 0, 2, "", /*
@@ -7078,15 +7078,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 +7099,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 +7123,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 +7135,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 +7234,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 +7243,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);
--- a/src/event-Xt.c	Wed Jan 27 06:00:09 2010 -0600
+++ b/src/event-Xt.c	Thu Jan 28 02:48:45 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<<modifier_index) != mask)					      \
-    warn_when_safe (Qkey_mapping, Qwarning, "XEmacs:  %s (0x%x) generates %s, which is nonsensical.", \
-		    name, code, index_to_name (modifier_index)),	      \
+#define check_modifier(name,mask)					\
+  if ((1<<modifier_index) != mask)					\
+    warn_when_safe (Qkey_mapping, Qwarning,				\
+ "XEmacs:  %s (0x%x) generates %s, which is nonsensical.",		\
+		    name, code, index_to_name (modifier_index)),	\
     warned_about_predefined_modifiers = 1
 
-#define store_modifier(name,old)					   \
-  if (old && old != modifier_index)					   \
-    warn_when_safe (Qkey_mapping, Qwarning, "XEmacs:  %s (0x%x) generates both %s and %s, which is nonsensical.",\
-		    name, code, index_to_name (old),			   \
-		    index_to_name (modifier_index)),			   \
-    warned_about_duplicate_modifiers = 1;				   \
-  if (modifier_index == ShiftMapIndex) modbarf (name,"ModShift");	   \
-  else if (modifier_index == LockMapIndex) modbarf (name,"ModLock");	   \
+#define store_modifier(name,old)					\
+  if (old && old != modifier_index)					\
+    warn_when_safe (Qkey_mapping, Qwarning,				\
+ "XEmacs:  %s (0x%x) generates both %s and %s, which is nonsensical.",	\
+		    name, code, index_to_name (old),			\
+		    index_to_name (modifier_index)),			\
+    warned_about_duplicate_modifiers = 1;				\
+  if (modifier_index == ShiftMapIndex) modbarf (name,"ModShift");	\
+  else if (modifier_index == LockMapIndex) modbarf (name,"ModLock");	\
   else if (modifier_index == ControlMapIndex) modbarf (name,"ModControl"); \
-  else if (sym == XK_Mode_switch)					   \
-    mode_bit = modifier_index; /* Mode_switch is special, see below... */  \
-  else if (modifier_index == meta_bit && old != meta_bit)		   \
-    modwarn (name, meta_bit, "Meta");					   \
-  else if (modifier_index == super_bit && old != super_bit)		   \
-    modwarn (name, super_bit, "Super");					   \
-  else if (modifier_index == hyper_bit && old != hyper_bit)		   \
-    modwarn (name, hyper_bit, "Hyper");					   \
-  else if (modifier_index == alt_bit && old != alt_bit)			   \
-    modwarn (name, alt_bit, "Alt");					   \
-  else									   \
+  else if (sym == XK_Mode_switch)					\
+    mode_bit = modifier_index; /* Mode_switch is special, see below... */ \
+  else if (modifier_index == meta_bit && old != meta_bit)		\
+    modwarn (name, meta_bit, "Meta");					\
+  else if (modifier_index == super_bit && old != super_bit)		\
+    modwarn (name, super_bit, "Super");					\
+  else if (modifier_index == hyper_bit && old != hyper_bit)		\
+    modwarn (name, hyper_bit, "Hyper");					\
+  else if (modifier_index == alt_bit && old != alt_bit)			\
+    modwarn (name, alt_bit, "Alt");					\
+  else									\
     old = modifier_index;
 
   mkpm = xd->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));
 }
 
@@ -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),
--- a/src/event-gtk.c	Wed Jan 27 06:00:09 2010 -0600
+++ b/src/event-gtk.c	Thu Jan 28 02:48:45 2010 -0600
@@ -228,7 +228,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));
 }
@@ -1019,9 +1019,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)));
     }
@@ -1048,9 +1048,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)));
     }
 
@@ -1787,7 +1787,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);
 	  }
@@ -1802,7 +1802,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);
 		}
@@ -1876,10 +1876,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;
 
--- a/src/event-msw.c	Wed Jan 27 06:00:09 2010 -0600
+++ b/src/event-msw.c	Thu Jan 28 02:48:45 2010 -0600
@@ -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);
@@ -1820,10 +1820,10 @@
   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;
@@ -1989,12 +1989,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,7 +2013,7 @@
 		if (!DdeCmpStringHandles (hszItem, hsz))
 		  args[1] = Fsymbol_value (elt);
 	      }
-	    args[0] = build_string ("%s");
+	    args[0] = build_ascstring ("%s");
 	  }
 
 	res = Fformat (2, args);
@@ -2118,7 +2118,7 @@
 
 	       they don't allow relative paths at all!  this is way bogus. */
 	    cmd = urlify_filename (cmd);
-	    l_dndlist = build_intstring (cmd);
+	    l_dndlist = build_istring (cmd);
 	    xfree (cmd, Ibyte *);
 	  }
 	  GCPRO2 (emacs_event, l_dndlist);
@@ -3735,7 +3735,7 @@
 
 	    {
 	      Ibyte *fname2 = urlify_filename (fname);
-	      l_item = build_intstring (fname2);
+	      l_item = build_istring (fname2);
 	      xfree (fname2, Ibyte *);
 	      if (freeme)
 		xfree (fname, Ibyte *);
@@ -4274,7 +4274,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 +4291,7 @@
   
   if (!NILP (EVENT_CHANNEL (emacs_event)))
     {
-      write_c_string (pstream, " ");
+      write_ascstring (pstream, " ");
       print_internal (EVENT_CHANNEL (emacs_event), pstream, 1);
     }
 }
@@ -4670,7 +4670,7 @@
 struct mswin_message_debug
 {
   int mess;
-  char *string;
+  const Ascbyte *string;
 };
 
 #define FROB(val) { val, #val, },
@@ -4961,7 +4961,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++)
--- a/src/event-stream.c	Wed Jan 27 06:00:09 2010 -0600
+++ b/src/event-stream.c	Thu Jan 28 02:48:45 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)					\
@@ -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 /*
--- a/src/event-unixoid.c	Wed Jan 27 06:00:09 2010 -0600
+++ b/src/event-unixoid.c	Thu Jan 28 02:48:45 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)
--- a/src/events.c	Wed Jan 27 06:00:09 2010 -0600
+++ b/src/events.c	Thu Jan 28 02:48:45 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, "#<empty-event");
+	write_ascstring (printcharfun, "#<empty-event");
 	break;
     case misc_user_event:
 	write_fmt_string_lisp (printcharfun, "#<misc-user-event (%S", 1,
@@ -386,13 +386,13 @@
 			       XEVENT_EVAL_OBJECT (obj));
 	break;
     case dead_event:
-	write_c_string (printcharfun, "#<DEALLOCATED-EVENT");
+	write_ascstring (printcharfun, "#<DEALLOCATED-EVENT");
 	break;
     default:
-	write_c_string (printcharfun, "#<UNKNOWN-EVENT-TYPE");
+	write_ascstring (printcharfun, "#<UNKNOWN-EVENT-TYPE");
 	break;
       }
-  write_c_string (printcharfun, ">");
+  write_ascstring (printcharfun, ">");
 }
 
 static int
--- a/src/extents.c	Wed Jan 27 06:00:09 2010 -0600
+++ b/src/extents.c	Thu Jan 28 02:48:45 2010 -0600
@@ -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, "#<destroyed extent");
+	write_ascstring (printcharfun, "#<destroyed extent");
       else
 	{
-	  write_c_string (printcharfun, "#<extent ");
+	  write_ascstring (printcharfun, "#<extent ");
 	  print_extent_1 (obj, printcharfun, escapeflag);
-	  write_c_string (printcharfun, extent_detached_p (XEXTENT (obj))
+	  write_ascstring (printcharfun, extent_detached_p (XEXTENT (obj))
 			  ? " from " : " in ");
 	  write_fmt_string (printcharfun, "%s%s%s", title, name, posttitle);
 	}
@@ -3372,9 +3376,9 @@
     {
       if (print_readably)
 	printing_unreadable_object ("#<extent>");
-      write_c_string (printcharfun, "#<extent");
-    }
-  write_c_string (printcharfun, ">");
+      write_ascstring (printcharfun, "#<extent");
+    }
+  write_ascstring (printcharfun, ">");
 }
 
 static int
@@ -7638,6 +7642,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);
 }
--- a/src/faces.c	Wed Jan 27 06:00:09 2010 -0600
+++ b/src/faces.c	Thu Jan 28 02:48:45 2010 -0600
@@ -137,7 +137,7 @@
       write_fmt_string_lisp (printcharfun, "#<face %S", 1, face->name);
       if (!NILP (face->doc_string))
 	write_fmt_string_lisp (printcharfun, " %S", 1, face->doc_string);
-      write_c_string (printcharfun, ">");
+      write_ascstring (printcharfun, ">");
     }
 }
 
@@ -2229,7 +2229,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
@@ -2239,22 +2239,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);
@@ -2335,7 +2335,7 @@
 #ifdef USE_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 /* !USE_XFT */
@@ -2345,7 +2345,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
 
@@ -2359,7 +2359,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);
 
@@ -2371,14 +2371,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
@@ -2391,7 +2391,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);
 
@@ -2403,7 +2403,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,
@@ -2416,7 +2416,7 @@
       Fcons
       (Fcons
        (list1 (device_symbol),
-	build_string ("-*-lucidatypewriter-medium-r-*-*-*-120-*-*-*-*-*-*")),
+	build_ascstring ("-*-lucidatypewriter-medium-r-*-*-*-120-*-*-*-*-*-*")),
        inst_list);
 
 #endif /* !USE_XFT */
@@ -2424,7 +2424,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 */
 
@@ -2443,18 +2443,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 */
@@ -2478,7 +2478,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
@@ -2492,22 +2492,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);
@@ -2518,7 +2518,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),
@@ -2531,7 +2531,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));
@@ -2543,7 +2543,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),
@@ -2557,7 +2557,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),
@@ -2569,17 +2569,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);
 }
--- a/src/file-coding.c	Wed Jan 27 06:00:09 2010 -0600
+++ b/src/file-coding.c	Thu Jan 28 02:48:45 2010 -0600
@@ -301,7 +301,7 @@
 
   write_fmt_string_lisp (printcharfun, "#<coding-system %s ", 1, c->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,7 +1207,7 @@
 			      XSTRING_DATA (Fsymbol_name (XCODING_SYSTEM_NAME
 							  (name_or_existing))),
 			      ++coding_system_tick);
-      name_or_existing = intern_int (newname);
+      name_or_existing = intern_istring (newname);
       xfree (newname, Ibyte *);
       
       if (UNBOUNDP (description))
@@ -1222,12 +1216,12 @@
 	    emacs_sprintf_malloc
 	      (NULL, "For Internal Use (%s)",
 	       XSTRING_DATA (Fsymbol_name (name_or_existing)));
-	  description = build_intstring (newname);
+	  description = build_istring (newname);
 	  xfree (newname, Ibyte *);
 	}
 
       newname = emacs_sprintf_malloc (NULL, "Int%d", coding_system_tick);
-      defmnem = build_intstring (newname);
+      defmnem = build_istring (newname);
       xfree (newname, Ibyte *);
     }
   else
@@ -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,7 +1370,7 @@
 	    (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 *);
 	
@@ -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
@@ -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
@@ -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
@@ -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))));
--- a/src/fileio.c	Wed Jan 27 06:00:09 2010 -0600
+++ b/src/fileio.c	Thu Jan 28 02:48:45 2010 -0600
@@ -143,13 +143,13 @@
 
 DOESNT_RETURN
 report_file_type_error (Lisp_Object errtype, Lisp_Object oserrmess,
-			const CIbyte *string, Lisp_Object data)
+			const Ascbyte *reason, Lisp_Object data)
 {
   struct gcpro gcpro1;
   Lisp_Object errdata = build_error_data (NULL, data);
 
   GCPRO1 (errdata);
-  errdata = Fcons (build_msg_string (string),
+  errdata = Fcons (build_msg_string (reason),
 		   Fcons (oserrmess, errdata));
   signal_error_1 (errtype, errdata);
   /* UNGCPRO; not reached */
@@ -157,17 +157,17 @@
 
 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);
+  report_file_type_error (errtype, lisp_strerror (errno), reason, 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 +182,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
@@ -429,7 +429,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 +549,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 +606,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 +787,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 +946,7 @@
 		{
 		  newnm = mswindows_canonicalize_filename (nm);
 		  if (qxestrcmp (newnm, XSTRING_DATA (name)) != 0)
-		    name = build_intstring (newnm);
+		    name = build_istring (newnm);
 		}
 	      else
 		{
@@ -954,7 +954,7 @@
 		  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] = ':';
 		    }
@@ -967,7 +967,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 */
 	}
     }
@@ -1332,7 +1332,7 @@
 
   {
     Ibyte *newtarget = mswindows_canonicalize_filename (target);
-    Lisp_Object result = build_intstring (newtarget);
+    Lisp_Object result = build_istring (newtarget);
     xfree (newtarget, Ibyte *);
 
     RETURN_UNGCPRO_EXIT_PROFILING (QSin_expand_file_name, result);
@@ -1761,7 +1761,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 +1780,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 +2103,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;
@@ -2607,7 +2607,7 @@
       if (!fname)
 	return Qnil;
       {
-	Lisp_Object val = build_intstring (fname);
+	Lisp_Object val = build_istring (fname);
 	xfree (fname, Ibyte *);
 	return val;
       }
@@ -3858,7 +3858,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 +3889,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 */
 
@@ -4477,7 +4477,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 +4563,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.
--- a/src/filelock.c	Wed Jan 27 06:00:09 2010 -0600
+++ b/src/filelock.c	Thu Jan 28 02:48:45 2010 -0600
@@ -358,7 +358,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 +474,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);
--- a/src/floatfns.c	Wed Jan 27 06:00:09 2010 -0600
+++ b/src/floatfns.c	Thu Jan 28 02:48:45 2010 -0600
@@ -2453,7 +2453,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)
--- a/src/fns.c	Wed Jan 27 06:00:09 2010 -0600
+++ b/src/fns.c	Thu Jan 28 02:48:45 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
@@ -3288,7 +3288,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);
 
@@ -3399,14 +3399,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);
 }
--- a/src/font-mgr.c	Wed Jan 27 06:00:09 2010 -0600
+++ b/src/font-mgr.c	Thu Jan 28 02:48:45 2010 -0600
@@ -162,7 +162,7 @@
   (NEW_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 +180,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 */
@@ -838,7 +838,7 @@
      FC_CONFIG_DIR environment variable. */
       (name))
 {
-  char *fcname = "";
+  const Ascbyte *fcname = "";
 
   if (!NILP (name))
     {
@@ -1217,7 +1217,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 +1264,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);
--- a/src/frame-gtk.c	Wed Jan 27 06:00:09 2010 -0600
+++ b/src/frame-gtk.c	Thu Jan 28 02:48:45 2010 -0600
@@ -1157,12 +1157,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
 
--- a/src/frame-msw.c	Wed Jan 27 06:00:09 2010 -0600
+++ b/src/frame-msw.c	Thu Jan 28 02:48:45 2010 -0600
@@ -607,7 +607,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
--- a/src/frame-x.c	Wed Jan 27 06:00:09 2010 -0600
+++ b/src/frame-x.c	Thu Jan 28 02:48:45 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
@@ -990,9 +990,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;
@@ -1274,7 +1274,7 @@
 				fileint, Qfile_name);
 
 	  hurl = dnd_url_hexify_string (fileint, "file:");
-	  l_data = Fcons (build_intstring (hurl), l_data);
+	  l_data = Fcons (build_istring (hurl), l_data);
 	  xfree (hurl, Ibyte *);
 	}
     }
@@ -1297,12 +1297,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? */
@@ -2208,7 +2208,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);
 }
 
 
--- a/src/frame.c	Wed Jan 27 06:00:09 2010 -0600
+++ b/src/frame.c	Thu Jan 28 02:48:45 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");
 	}
     }
 
@@ -3862,16 +3862,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.
--- a/src/gc.c	Wed Jan 27 06:00:09 2010 -0600
+++ b/src/gc.c	Thu Jan 28 02:48:45 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.
 
@@ -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.
--- a/src/glade.c	Wed Jan 27 06:00:09 2010 -0600
+++ b/src/glade.c	Thu Jan 28 02:48:45 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)
--- a/src/glyphs-eimage.c	Wed Jan 27 06:00:09 2010 -0600
+++ b/src/glyphs-eimage.c	Thu Jan 28 02:48:45 2010 -0600
@@ -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);
@@ -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);
     }
 
@@ -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);
--- a/src/glyphs-gtk.c	Wed Jan 27 06:00:09 2010 -0600
+++ b/src/glyphs-gtk.c	Thu Jan 28 02:48:45 2010 -0600
@@ -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:
@@ -1775,7 +1775,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 +1787,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;
@@ -2941,7 +2941,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)
--- a/src/glyphs-msw.c	Wed Jan 27 06:00:09 2010 -0600
+++ b/src/glyphs-msw.c	Thu Jan 28 02:48:45 2010 -0600
@@ -1101,7 +1101,7 @@
 
 typedef struct
 {
-  CIbyte *name;
+  const Ascbyte *name;
   int	resource_id;
 } resource_t;
 
@@ -1724,7 +1724,7 @@
 	  write_fmt_string (printcharfun, "/0x%lx",
 			    (unsigned long) IMAGE_INSTANCE_MSWINDOWS_MASK (p));
 	}
-      write_c_string (printcharfun, ")");
+      write_ascstring (printcharfun, ")");
       break;
 
     default:
--- a/src/glyphs-x.c	Wed Jan 27 06:00:09 2010 -0600
+++ b/src/glyphs-x.c	Thu Jan 28 02:48:45 2010 -0600
@@ -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;
@@ -602,7 +602,7 @@
 	    (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);
 	  }
@@ -1923,7 +1923,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 +1934,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;
@@ -2382,7 +2382,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 +2400,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
   }
@@ -2561,7 +2561,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;
 }
@@ -3013,7 +3013,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)
--- a/src/glyphs.c	Wed Jan 27 06:00:09 2010 -0600
+++ b/src/glyphs.c	Thu Jan 28 02:48:45 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));
 
@@ -2219,34 +2219,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));
 }
 
@@ -2695,7 +2696,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;
     }
@@ -2748,11 +2749,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))
@@ -2957,7 +2958,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;
@@ -2969,19 +2970,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);
--- a/src/glyphs.h	Wed Jan 27 06:00:09 2010 -0600
+++ b/src/glyphs.h	Thu Jan 28 02:48:45 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));
 
--- a/src/gpmevent.c	Wed Jan 27 06:00:09 2010 -0600
+++ b/src/gpmevent.c	Thu Jan 28 02:48:45 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));
 
--- a/src/gtk-glue.c	Wed Jan 27 06:00:09 2010 -0600
+++ b/src/gtk-glue.c	Thu Jan 28 02:48:45 2010 -0600
@@ -128,7 +128,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
--- a/src/gtk-xemacs.c	Wed Jan 27 06:00:09 2010 -0600
+++ b/src/gtk-xemacs.c	Thu Jan 28 02:48:45 2010 -0600
@@ -179,7 +179,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										\
@@ -437,5 +437,5 @@
 
   sprintf (color_buf, "#%04x%04x%04x", c->red, c->green, c->blue);
 
-  return (build_string (color_buf));
+  return (build_cistring (color_buf));
 }
--- a/src/gui.c	Wed Jan 27 06:00:09 2010 -0600
+++ b/src/gui.c	Thu Jan 28 02:48:45 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;
--- a/src/hpplay.c	Wed Jan 27 06:00:09 2010 -0600
+++ b/src/hpplay.c	Thu Jan 28 02:48:45 2010 -0600
@@ -75,7 +75,7 @@
   AGetErrorText (audio, errorCode, errorbuff, 131);
   EXTERNAL_TO_C_STRING (errorbuf, interr, Qerror_message_encoding);
   
-  signal_error (Qsound_error, text, build_string (interr));
+  signal_error (Qsound_error, text, build_istring (interr));
 }
 
 long
--- a/src/insdel.c	Wed Jan 27 06:00:09 2010 -0600
+++ b/src/insdel.c	Thu Jan 28 02:48:45 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);
 }
--- a/src/insdel.h	Wed Jan 27 06:00:09 2010 -0600
+++ b/src/insdel.h	Thu Jan 28 02:48:45 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) \
--- a/src/intl-win32.c	Wed Jan 27 06:00:09 2010 -0600
+++ b/src/intl-win32.c	Thu Jan 28 02:48:45 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, ")");
 }
 
 /* ----------------------------------------------------------------------- */
@@ -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)));
 
--- a/src/intl.c	Wed Jan 27 06:00:09 2010 -0600
+++ b/src/intl.c	Thu Jan 28 02:48:45 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, /*
@@ -92,7 +92,7 @@
     }
 #endif
 
-  str = build_ext_string (loc, Qctext);
+  str = build_extstring (loc, Qctext);
   xfree (loc, Extbyte *);
   return str;
 }
--- a/src/keymap.c	Wed Jan 27 06:00:09 2010 -0600
+++ b/src/keymap.c	Thu Jan 28 02:48:45 2010 -0600
@@ -290,7 +290,7 @@
   Lisp_Keymap *keymap = XKEYMAP (obj);
   if (print_readably)
     printing_unreadable_lcrecord (obj, 0);
-  write_c_string (printcharfun, "#<keymap ");
+  write_ascstring (printcharfun, "#<keymap ");
   if (!NILP (keymap->name))
     {
       write_fmt_string_lisp (printcharfun, "%S ", 1, keymap->name);
@@ -474,7 +474,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);
 }
@@ -1960,17 +1960,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, /*
@@ -3497,7 +3497,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));
 	    }
 	}
@@ -3655,7 +3655,7 @@
     }
 
   *p = 0;
-  return build_string ((char *) buf);
+  return build_istring (buf);
 }
 
 
@@ -4150,7 +4150,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))
     {
@@ -4158,19 +4158,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));
@@ -4180,14 +4180,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;
 }
 
@@ -4470,7 +4470,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));
@@ -4481,17 +4481,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);
@@ -4500,19 +4500,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)
@@ -4522,7 +4522,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;
@@ -4538,9 +4538,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;
 		}
--- a/src/lisp.h	Wed Jan 27 06:00:09 2010 -0600
+++ b/src/lisp.h	Thu Jan 28 02:48:45 2010 -0600
@@ -106,6 +106,10 @@
 #include <stddef.h>		/* offsetof */
 #include <sys/types.h>
 #include <limits.h>
+#ifdef __cplusplus
+#include <limits>		/* 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
@@ -1261,8 +1266,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))
@@ -1270,18 +1276,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
 
 /************************************************************************/
@@ -1771,11 +1773,7 @@
   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)
@@ -1848,12 +1846,19 @@
 #define Dynarr_new2(dynarr_type, type) \
   ((dynarr_type *) Dynarr_newf (sizeof (type)))
 
+#ifdef ERROR_CHECK_TYPES_GCC_NOT_BROKEN
+/* 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)
@@ -2041,6 +2046,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);
@@ -3831,22 +3845,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
 
 
 /************************************************************************/
@@ -4138,18 +4230,14 @@
 
 /* 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
@@ -4172,7 +4260,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'. */
@@ -4266,13 +4354,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);
@@ -4380,7 +4467,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);
@@ -4461,6 +4550,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);
@@ -4616,38 +4725,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);
@@ -4660,57 +4769,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);
@@ -4884,7 +4993,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;
 
@@ -5003,13 +5112,13 @@
 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,
+					       const Ascbyte *reason,
 					       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);
@@ -5110,11 +5219,11 @@
 				      int depth);
 int internal_equal (Lisp_Object, Lisp_Object, int);
 int internal_equalp (Lisp_Object obj1, Lisp_Object obj2, int depth);
-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 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);
 Lisp_Object bytecode_nconc2 (Lisp_Object *);
 void check_losing_bytecode (const char *, Lisp_Object);
 
@@ -5273,9 +5382,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);
@@ -5413,7 +5524,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);
@@ -5922,62 +6033,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
--- a/src/lread.c	Wed Jan 27 06:00:09 2010 -0600
+++ b/src/lread.c	Thu Jan 28 02:48:45 2010 -0600
@@ -593,7 +593,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 +1097,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 +1181,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 +1271,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
@@ -1872,7 +1872,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));
@@ -2394,34 +2394,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 +2582,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 +2740,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 ("#")));
 	    }
 	  }
       }
@@ -3120,7 +3122,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 +3216,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 +3257,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 +3407,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 /*
--- a/src/lrecord.h	Wed Jan 27 06:00:09 2010 -0600
+++ b/src/lrecord.h	Thu Jan 28 02:48:45 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(). */
@@ -709,7 +721,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 },
@@ -1130,18 +1142,21 @@
 #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) }	      \
+#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 /* not NEW_GC */
+#endif /* NEW_GC */
 
 /* DEFINE_LRECORD_IMPLEMENTATION is for objects with constant size.
    DEFINE_LRECORD_SEQUENCE_IMPLEMENTATION is for objects whose size varies.
--- a/src/marker.c	Wed Jan 27 06:00:09 2010 -0600
+++ b/src/marker.c	Thu Jan 28 02:48:45 2010 -0600
@@ -62,9 +62,9 @@
   if (print_readably)
     printing_unreadable_object ("#<marker 0x%lx>", (long) marker);
 
-  write_c_string (printcharfun, GETTEXT ("#<marker "));
+  write_ascstring (printcharfun, GETTEXT ("#<marker "));
   if (!marker->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);
 }
 
--- a/src/menubar-msw.c	Wed Jan 27 06:00:09 2010 -0600
+++ b/src/menubar-msw.c	Thu Jan 28 02:48:45 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;
 }
--- a/src/menubar-x.c	Wed Jan 27 06:00:09 2010 -0600
+++ b/src/menubar-x.c	Thu Jan 28 02:48:45 2010 -0600
@@ -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);
       }
   }
--- a/src/menubar.c	Wed Jan 27 06:00:09 2010 -0600
+++ b/src/menubar.c	Thu Jan 28 02:48:45 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 /*
--- a/src/minibuf.c	Wed Jan 27 06:00:09 2010 -0600
+++ b/src/minibuf.c	Thu Jan 28 02:48:45 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
--- a/src/mule-charset.c	Wed Jan 27 06:00:09 2010 -0600
+++ b/src/mule-charset.c	Thu Jan 28 02:48:45 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 */
 }
--- a/src/mule-coding.c	Wed Jan 27 06:00:09 2010 -0600
+++ b/src/mule-coding.c	Thu Jan 28 02:48:45 2010 -0600
@@ -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, ")");
   }
 }
 
@@ -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))
--- a/src/nas.c	Wed Jan 27 06:00:09 2010 -0600
+++ b/src/nas.c	Thu Jan 28 02:48:45 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;
     }
--- a/src/nt.c	Wed Jan 27 06:00:09 2010 -0600
+++ b/src/nt.c	Thu Jan 28 02:48:45 2010 -0600
@@ -2109,7 +2109,7 @@
   TSTR_TO_C_STRING (shortname, shortint);
   MSWINDOWS_NORMALIZE_FILENAME (shortint);
 
-  return build_intstring (shortint);
+  return build_istring (shortint);
 }
 
 
@@ -2132,7 +2132,7 @@
     return Qnil;
 
   canon = mswindows_canonicalize_filename (longname);
-  ret = build_intstring (canon);
+  ret = build_istring (canon);
   xfree (canon, Ibyte *);
   xfree (longname, Ibyte *);
   return ret;
--- a/src/number.c	Wed Jan 27 06:00:09 2010 -0600
+++ b/src/number.c	Thu Jan 28 02:48:45 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, Ascbyte *);
 }
 
 #ifdef NEW_GC
@@ -146,7 +146,7 @@
 	     int UNUSED (escapeflag))
 {
   CIbyte *rstr = ratio_to_string (XRATIO_DATA (obj), 10);
-  write_c_string (printcharfun, rstr);
+  write_ascstring (printcharfun, rstr);
   xfree (rstr, CIbyte *);
 }
 
@@ -238,7 +238,7 @@
       return Fcanonicalize_number (make_bignum_bg
 				   (XRATIO_DENOMINATOR (rational)));
     }
-#else
+#endif
   return make_int (1);
 }
 
@@ -249,8 +249,8 @@
 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);
+  Ascbyte *fstr = bigfloat_to_string (XBIGFLOAT_DATA (obj), 10);
+  write_ascstring (printcharfun, fstr);
   xfree (fstr, CIbyte *);
 }
 
--- a/src/number.h	Wed Jan 27 06:00:09 2010 -0600
+++ b/src/number.h	Thu Jan 28 02:48:45 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))				\
--- a/src/objects-gtk.c	Wed Jan 27 06:00:09 2010 -0600
+++ b/src/objects-gtk.c	Thu Jan 28 02:48:45 2010 -0600
@@ -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);
 
--- a/src/objects-msw.c	Wed Jan 27 06:00:09 2010 -0600
+++ b/src/objects-msw.c	Thu Jan 28 02:48:45 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);
 }
 
 /*
@@ -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,
@@ -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;
@@ -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);
 }
--- a/src/objects-tty.c	Wed Jan 27 06:00:09 2010 -0600
+++ b/src/objects-tty.c	Thu Jan 28 02:48:45 2010 -0600
@@ -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
@@ -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)));
 }
 
--- a/src/objects-x.c	Wed Jan 27 06:00:09 2010 -0600
+++ b/src/objects-x.c	Thu Jan 28 02:48:45 2010 -0600
@@ -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);
 	}
@@ -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
@@ -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);
--- a/src/objects-xlike-inc.c	Wed Jan 27 06:00:09 2010 -0600
+++ b/src/objects-xlike-inc.c	Thu Jan 28 02:48:45 2010 -0600
@@ -327,10 +327,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[] =
@@ -424,7 +424,7 @@
       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 */
@@ -541,28 +541,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)
 	{
@@ -621,7 +622,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",
@@ -820,7 +822,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),
--- a/src/print.c	Wed Jan 27 06:00:09 2010 -0600
+++ b/src/print.c	Thu Jan 28 02:48:45 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 */
+  return write_istring (stream, IGETTEXT (str));
+}
+
+void
+write_msg_cistring (Lisp_Object stream, const CIbyte *str)
+{
+  /* This function can GC */
+  return 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);
+  return 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, "... <circular list>");
+	      write_ascstring (printcharfun, "... <circular list>");
 	    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;
 	  }
       }
--- a/src/process-nt.c	Wed Jan 27 06:00:09 2010 -0600
+++ b/src/process-nt.c	Thu Jan 28 02:48:45 2010 -0600
@@ -693,11 +693,11 @@
  */
 
 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);
+			  reason, data);
 }
 
 static void
@@ -1313,7 +1313,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;
 }
--- a/src/process-unix.c	Wed Jan 27 06:00:09 2010 -0600
+++ b/src/process-unix.c	Thu Jan 28 02:48:45 2010 -0600
@@ -1300,7 +1300,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
@@ -1833,7 +1833,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 +1847,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;
--- a/src/process.c	Wed Jan 27 06:00:09 2010 -0600
+++ b/src/process.c	Thu Jan 28 02:48:45 2010 -0600
@@ -159,15 +159,15 @@
   else
     {
       int netp = network_connection_p (obj);
-      write_c_string (printcharfun,
+      write_ascstring (printcharfun,
 		      netp ? GETTEXT ("#<network connection ") :
 		      GETTEXT ("#<process "));
       print_internal (process->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, ">");
     }
 }
 
@@ -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);
 }
--- a/src/process.h	Wed Jan 27 06:00:09 2010 -0600
+++ b/src/process.h	Thu Jan 28 02:48:45 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);
--- a/src/profile.c	Wed Jan 27 06:00:09 2010 -0600
+++ b/src/profile.c	Thu Jan 28 02:48:45 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);
--- a/src/rangetab.c	Wed Jan 27 06:00:09 2010 -0600
+++ b/src/rangetab.c	Thu Jan 28 02:48:45 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, "#<range-table ");
+    write_ascstring (printcharfun, "#<range-table ");
   for (i = 0; i < Dynarr_length (rt->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);
 }
--- a/src/realpath.c	Wed Jan 27 06:00:09 2010 -0600
+++ b/src/realpath.c	Thu Jan 28 02:48:45 2010 -0600
@@ -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);
 }
--- a/src/redisplay-gtk.c	Wed Jan 27 06:00:09 2010 -0600
+++ b/src/redisplay-gtk.c	Thu Jan 28 02:48:45 2010 -0600
@@ -23,491 +23,7 @@
 
 /* Synched up with:  Not in FSF. */
 
-/* Author: Chuck Thompson */
-/* Gtk flavor by William Perry */
-
-/* Lots of work done by Ben Wing for Mule */
-
-#include <config.h>
-#include "lisp.h"
-
-#include "buffer.h"
-#include "debug.h"
-#include "device-impl.h"
-#include "faces.h"
-#include "file-coding.h"
-#include "frame-impl.h"
-#include "gutter.h"
-#include "redisplay.h"
-#include "sysdep.h"
-#include "window.h"
-
-#include "console-gtk-impl.h"
-#include "gccache-gtk.h"
-#include "glyphs-gtk.h"
-#include "objects-gtk-impl.h"
-
-#include "sysproc.h" /* for select() */
-
-#ifdef MULE
-#include "mule-ccl.h"
-#endif
-
-#define CONST const
-
-#define EOL_CURSOR_WIDTH	5
-
-static void gtk_output_pixmap (struct window *w,
-			       Lisp_Object image_instance,
-			       struct display_box *db,
-			       struct display_glyph_area *dga,
-			       face_index findex,
-			       int cursor_start,
-			       int cursor_width,
-			       int cursor_height,
-			       int bgpixmap);
-static void gtk_output_vertical_divider (struct window *w, int clear);
-static void gtk_output_blank (struct window *w, struct display_line *dl,
-			      struct rune *rb, int start_pixpos,
-			      int cursor_start, int cursor_width);
-static void gtk_output_horizontal_line (struct window *w,
-					struct display_line *dl,
-					struct rune *rb);
-static void gtk_clear_region (Lisp_Object locale, struct device* d, struct frame* f,
-			      face_index findex, int x, int y,
-			      int width, int height, Lisp_Object fcolor, Lisp_Object bcolor,
-			      Lisp_Object background_pixmap);
-static void gtk_output_eol_cursor (struct window *w, struct display_line *dl,
-				   int xpos, face_index findex);
-static void gtk_clear_frame (struct frame *f);
-static void gtk_clear_frame_windows (Lisp_Object window);
-static void gtk_bevel_modeline (struct window *w, struct display_line *dl);
-
-#if 0
-static void __describe_gc (GdkGC *);
-#endif
-
-struct textual_run
-{
-  Lisp_Object charset;
-  unsigned char *ptr;
-  int len;
-  int dimension;
-};
-
-/* Separate out the text in DYN into a series of textual runs of a
-   particular charset.  Also convert the characters as necessary into
-   the format needed by XDrawImageString(), XDrawImageString16(), et
-   al.  (This means converting to one or two byte format, possibly
-   tweaking the high bits, and possibly running a CCL program.) You
-   must pre-allocate the space used and pass it in. (This is done so
-   you can ALLOCA () the space.)  You need to allocate (2 * len) bytes
-   of TEXT_STORAGE and (len * sizeof (struct textual_run)) bytes of
-   RUN_STORAGE, where LEN is the length of the dynarr.
-
-   Returns the number of runs actually used. */
-
-static int
-separate_textual_runs (unsigned char *text_storage,
-		       struct textual_run *run_storage,
-		       CONST Ichar *str, Charcount len)
-{
-  Lisp_Object prev_charset = Qunbound; /* not Qnil because that is a
-					  possible valid charset when
-					  MULE is not defined */
-  int runs_so_far = 0;
-  int i;
-#ifdef MULE
-  struct ccl_program char_converter;
-  int need_ccl_conversion = 0;
-#endif
-
-  for (i = 0; i < len; i++)
-    {
-      Ichar ch = str[i];
-      Lisp_Object charset;
-      int byte1, byte2;
-      int dimension;
-      int graphic;
-
-      BREAKUP_ICHAR (ch, charset, byte1, byte2);
-      dimension = XCHARSET_DIMENSION (charset);
-      graphic   = XCHARSET_GRAPHIC   (charset);
-
-      if (!EQ (charset, prev_charset))
-	{
-	  run_storage[runs_so_far].ptr       = text_storage;
-	  run_storage[runs_so_far].charset   = charset;
-	  run_storage[runs_so_far].dimension = dimension;
-
-	  if (runs_so_far)
-	    {
-	      run_storage[runs_so_far - 1].len =
-		text_storage - run_storage[runs_so_far - 1].ptr;
-	      if (run_storage[runs_so_far - 1].dimension == 2)
-		run_storage[runs_so_far - 1].len >>= 1;
-	    }
-	  runs_so_far++;
-	  prev_charset = charset;
-#ifdef MULE
-	  {
-	    Lisp_Object ccl_prog = XCHARSET_CCL_PROGRAM (charset);
-	    need_ccl_conversion = !NILP (ccl_prog);
-	    if (need_ccl_conversion)
-	      setup_ccl_program (&char_converter, ccl_prog);
-	  }
-#endif
-	}
-
-      if (graphic == 0)
-	{
-	  byte1 &= 0x7F;
-	  byte2 &= 0x7F;
-	}
-      else if (graphic == 1)
-	{
-	  byte1 |= 0x80;
-	  byte2 |= 0x80;
-	}
-#ifdef MULE
-      if (need_ccl_conversion)
-	{
-	  char_converter.reg[0] = XCHARSET_ID (charset);
-	  char_converter.reg[1] = byte1;
-	  char_converter.reg[2] = byte2;
-	  ccl_driver (&char_converter, 0, 0, 0, 0, CCL_MODE_ENCODING);
-	  byte1 = char_converter.reg[1];
-	  byte2 = char_converter.reg[2];
-	}
-#endif
-      *text_storage++ = (unsigned char) byte1;
-      if (dimension == 2)
-	*text_storage++ = (unsigned char) byte2;
-    }
-
-  if (runs_so_far)
-    {
-      run_storage[runs_so_far - 1].len =
-	text_storage - run_storage[runs_so_far - 1].ptr;
-      if (run_storage[runs_so_far - 1].dimension == 2)
-	run_storage[runs_so_far - 1].len >>= 1;
-    }
-
-  return runs_so_far;
-}
-
-/****************************************************************************/
-/*                                                                          */
-/*                          Gtk output routines                             */
-/*                                                                          */
-/****************************************************************************/
-
-static int
-gtk_text_width_single_run (struct face_cachel *cachel, struct textual_run *run)
-{
-  Lisp_Object font_inst = FACE_CACHEL_FONT (cachel, run->charset);
-  struct Lisp_Font_Instance *fi = XFONT_INSTANCE (font_inst);
-
-  if (!fi->proportional_p)
-  {
-    return fi->width * run->len;
-  }
-  else
-    {
-      if (run->dimension == 2)
-	{
-	  stderr_out ("Measuring wide characters\n");
-	  return gdk_text_width_wc (FONT_INSTANCE_GTK_FONT (fi),
-				    (GdkWChar *) run->ptr, run->len);
-	}
-      else
-	{
-	  return gdk_text_width (FONT_INSTANCE_GTK_FONT (fi),
-				 (char *) run->ptr, run->len);
-	}
-    }
-}
-
-/*
-   gtk_text_width
-
-   Given a string and a face, return the string's length in pixels when
-   displayed in the font associated with the face.
-   */
-
-static int
-gtk_text_width (struct frame *UNUSED (f), struct face_cachel *cachel,
-		CONST Ichar *str, Charcount len)
-{
-  /* !!#### */
-  int width_so_far = 0;
-  unsigned char *text_storage = (unsigned char *) ALLOCA (2 * len);
-  struct textual_run *runs = alloca_array (struct textual_run, len);
-  int nruns;
-  int i;
-
-  nruns = separate_textual_runs (text_storage, runs, str, len);
-
-  for (i = 0; i < nruns; i++)
-    width_so_far += gtk_text_width_single_run (cachel, runs + i);
-
-  return width_so_far;
-}
-
-/*****************************************************************************
- gtk_divider_height
-
- Return the height of the horizontal divider.  This is a function because
- divider_height is a device method.
-
- #### If we add etched horizontal divider lines this will have to get
- smarter.
- ****************************************************************************/
-static int
-gtk_divider_height (void)
-{
-  return 2;
-}
-
-/*****************************************************************************
- gtk_eol_cursor_width
-
- Return the width of the end-of-line cursor.  This is a function
- because eol_cursor_width is a device method.
- ****************************************************************************/
-static int
-gtk_eol_cursor_width (void)
-{
-  return EOL_CURSOR_WIDTH;
-}
-
-/*****************************************************************************
- gtk_output_display_block
-
- Given a display line, a block number for that start line, output all
- runes between start and end in the specified display block.
- ****************************************************************************/
-static void
-gtk_output_display_block (struct window *w, struct display_line *dl, int block,
-			  int start, int end, int start_pixpos, int cursor_start,
-			  int cursor_width, int cursor_height)
-{
-  struct frame *f = XFRAME (w->frame);
-  Ichar_dynarr *buf;
-  Lisp_Object window;
-
-  struct display_block *db = Dynarr_atp (dl->display_blocks, block);
-  rune_dynarr *rba = db->runes;
-  struct rune *rb;
-
-  int elt = start;
-  face_index findex;
-  int xpos, width;
-  Lisp_Object charset = Qunbound; /* Qnil is a valid charset when
-				     MULE is not defined */
-
-  window = wrap_window (w);
-  rb = Dynarr_atp (rba, start);
-
-  if (!rb)
-    {
-      /* Nothing to do so don't do anything. */
-      return;
-    }
-  else
-    {
-      findex = rb->findex;
-      xpos = rb->xpos;
-      width = 0;
-      if (rb->type == RUNE_CHAR)
-	charset = ichar_charset (rb->object.chr.ch);
-    }
-
-  if (end < 0)
-    end = Dynarr_length (rba);
-  buf = Dynarr_new (Ichar);
-
-  while (elt < end)
-    {
-      rb = Dynarr_atp (rba, elt);
-
-      if (rb->findex == findex && rb->type == RUNE_CHAR
-	  && rb->object.chr.ch != '\n' && rb->cursor_type != CURSOR_ON
-	  && EQ (charset, ichar_charset (rb->object.chr.ch)))
-	{
-	  Dynarr_add (buf, rb->object.chr.ch);
-	  width += rb->width;
-	  elt++;
-	}
-      else
-	{
-	  if (Dynarr_length (buf))
-	    {
-	      gtk_output_string (w, dl, buf, xpos, 0, start_pixpos, width,
-				 findex, 0, cursor_start, cursor_width,
-				 cursor_height);
-	      xpos = rb->xpos;
-	      width = 0;
-	    }
-	  Dynarr_reset (buf);
-	  width = 0;
-
-	  if (rb->type == RUNE_CHAR)
-	    {
-	      findex = rb->findex;
-	      xpos = rb->xpos;
-	      charset = ichar_charset (rb->object.chr.ch);
-
-	      if (rb->cursor_type == CURSOR_ON)
-		{
-		  if (rb->object.chr.ch == '\n')
-		    {
-		      gtk_output_eol_cursor (w, dl, xpos, findex);
-		    }
-		  else
-		    {
-		      Dynarr_add (buf, rb->object.chr.ch);
-		      gtk_output_string (w, dl, buf, xpos, 0, start_pixpos,
-					 rb->width, findex, 1,
-					 cursor_start, cursor_width,
-					 cursor_height);
-		      Dynarr_reset (buf);
-		    }
-
-		  xpos += rb->width;
-		  elt++;
-		}
-	      else if (rb->object.chr.ch == '\n')
-		{
-		  /* Clear in case a cursor was formerly here. */
-		  int height = dl->ascent + dl->descent - dl->clip;
-
-		  redisplay_clear_region (window, findex, xpos, dl->ypos - dl->ascent,
-					  rb->width, height);
-		  elt++;
-		}
-	    }
-	  else if (rb->type == RUNE_BLANK || rb->type == RUNE_HLINE)
-	    {
-	      if (rb->type == RUNE_BLANK)
-		gtk_output_blank (w, dl, rb, start_pixpos, cursor_start,
-				  cursor_width);
-	      else
-		{
-		  /* #### Our flagging of when we need to redraw the
-                     modeline shadows sucks.  Since RUNE_HLINE is only used
-                     by the modeline at the moment it is a good bet
-                     that if it gets redrawn then we should also
-                     redraw the shadows.  This won't be true forever.
-                     We borrow the shadow_thickness_changed flag for
-                     now. */
-		  w->shadow_thickness_changed = 1;
-		  gtk_output_horizontal_line (w, dl, rb);
-		}
-
-	      elt++;
-	      if (elt < end)
-		{
-		  rb = Dynarr_atp (rba, elt);
-
-		  findex = rb->findex;
-		  xpos = rb->xpos;
-		}
-	    }
-	  else if (rb->type == RUNE_DGLYPH)
-	    {
-	      Lisp_Object instance;
-	      struct display_box dbox;
-	      struct display_glyph_area dga;
-	      redisplay_calculate_display_boxes (dl, rb->xpos, rb->object.dglyph.xoffset,
-						 rb->object.dglyph.yoffset ,start_pixpos,
-                                                 rb->width, &dbox, &dga);
-
-	      window = wrap_window (w);
-	      instance = glyph_image_instance (rb->object.dglyph.glyph,
-					       window, ERROR_ME_DEBUG_WARN, 1);
-	      findex = rb->findex;
-
-	      if (IMAGE_INSTANCEP (instance))
-		switch (XIMAGE_INSTANCE_TYPE (instance))
-		  {
-		  case IMAGE_TEXT:
-		    {
-		      /* #### This is way losing.  See the comment in
-			 add_glyph_rune(). */
-		      Lisp_Object string =
-			XIMAGE_INSTANCE_TEXT_STRING (instance);
-		      convert_ibyte_string_into_ichar_dynarr
-			(XSTRING_DATA (string), XSTRING_LENGTH (string), buf);
-
-		      gtk_output_string (w, dl, buf, xpos,
-					 rb->object.dglyph.xoffset,
-					 start_pixpos, -1, findex,
-					 (rb->cursor_type == CURSOR_ON),
-					 cursor_start, cursor_width,
-					 cursor_height);
-		      Dynarr_reset (buf);
-		    }
-		    break;
-
-		  case IMAGE_MONO_PIXMAP:
-		  case IMAGE_COLOR_PIXMAP:
-		    redisplay_output_pixmap (w, instance, &dbox, &dga,
-					     findex,cursor_start,
-					     cursor_width, cursor_height, 0);
-		    break;
-
-		  case IMAGE_POINTER:
-		    ABORT ();
-
-		  case IMAGE_WIDGET:
-		      if (EQ (XIMAGE_INSTANCE_WIDGET_TYPE (instance),
-			      Qlayout))
-			{
-			  redisplay_output_layout (window, instance, &dbox,
-						   &dga, findex,
-						   cursor_start, cursor_width,
-						   cursor_height);
-			  break;
-			}
-
-		  case IMAGE_SUBWINDOW:
-		    redisplay_output_subwindow (w, instance, &dbox, &dga,
-						findex, cursor_start,
-						cursor_width, cursor_height);
-		    break;
-
-		  case IMAGE_NOTHING:
-		    /* nothing is as nothing does */
-		    break;
-
-		  default:
-		    ABORT ();
-		  }
-
-	      xpos += rb->width;
-	      elt++;
-	    }
-	  else
-	    ABORT ();
-	}
-    }
-
-  if (Dynarr_length (buf))
-    gtk_output_string (w, dl, buf, xpos, 0, start_pixpos, width, findex,
-		       0, cursor_start, cursor_width, cursor_height);
-
-  /* #### This is really conditionalized well for optimized
-     performance. */
-  if (dl->modeline
-      && !EQ (Qzero, w->modeline_shadow_thickness)
-      && (f->clear
-	  || f->windows_structure_changed
-	  || w->shadow_thickness_changed))
-    gtk_bevel_modeline (w, dl);
-
-  Dynarr_free (buf);
-}
+#include "redisplay-xlike-inc.c"
 
 /*****************************************************************************
  gtk_bevel_modeline
@@ -530,866 +46,6 @@
 }
 
 /*****************************************************************************
- gtk_get_gc
-
- Given a number of parameters return a GC with those properties.
- ****************************************************************************/
-GdkGC *
-gtk_get_gc (struct device *d, Lisp_Object font, Lisp_Object fg, Lisp_Object bg,
-	    Lisp_Object bg_pmap, Lisp_Object lwidth)
-{
-  GdkGCValues gcv;
-  unsigned long mask;
-
-  memset (&gcv, ~0, sizeof (gcv));
-  gcv.graphics_exposures = FALSE;
-  /* Make absolutely sure that we don't pick up a clipping region in
-     the GC returned by this function. */
-  gcv.clip_mask = 0;
-  gcv.clip_x_origin = 0;
-  gcv.clip_y_origin = 0;
-  gcv.fill = GDK_SOLID;
-  mask = GDK_GC_EXPOSURES | GDK_GC_CLIP_MASK | GDK_GC_CLIP_X_ORIGIN | GDK_GC_CLIP_Y_ORIGIN;
-  mask |= GDK_GC_FILL;
-
-  if (!NILP (font))
-    {
-      gcv.font = FONT_INSTANCE_GTK_FONT (XFONT_INSTANCE (font));
-      mask |= GDK_GC_FONT;
-    }
-
-  /* evil kludge! */
-  if (!NILP (fg) && !COLOR_INSTANCEP (fg) && !INTP (fg))
-    {
-      /* #### I fixed once case where this was getting it.  It was a
-         bad macro expansion (compiler bug). */
-      fprintf (stderr, "Help! gtk_get_gc got a bogus fg value! fg = ");
-      debug_print (fg);
-      fg = Qnil;
-    }
-
-  if (!NILP (fg))
-    {
-      if (COLOR_INSTANCEP (fg))
-	gcv.foreground = * COLOR_INSTANCE_GTK_COLOR (XCOLOR_INSTANCE (fg));
-      else
-	gcv.foreground.pixel = XINT (fg);
-      mask |= GDK_GC_FOREGROUND;
-    }
-
-  if (!NILP (bg))
-    {
-      if (COLOR_INSTANCEP (bg))
-	gcv.background = * COLOR_INSTANCE_GTK_COLOR (XCOLOR_INSTANCE (bg));
-      else
-	gcv.background.pixel = XINT (fg);
-      mask |= GDK_GC_BACKGROUND;
-    }
-
-  if (IMAGE_INSTANCEP (bg_pmap)
-      && IMAGE_INSTANCE_PIXMAP_TYPE_P (XIMAGE_INSTANCE (bg_pmap)))
-    {
-      if (XIMAGE_INSTANCE_PIXMAP_DEPTH (bg_pmap) == 0)
-	{
-	  gcv.fill = GDK_OPAQUE_STIPPLED;
-	  gcv.stipple = XIMAGE_INSTANCE_GTK_PIXMAP (bg_pmap);
-	  mask |= (GDK_GC_STIPPLE | GDK_GC_FILL);
-	}
-      else
-	{
-	  gcv.fill = GDK_TILED;
-	  gcv.tile = XIMAGE_INSTANCE_GTK_PIXMAP (bg_pmap);
-	  mask |= (GDK_GC_TILE | GDK_GC_FILL);
-	}
-    }
-
-  if (!NILP (lwidth))
-    {
-      gcv.line_width = XINT (lwidth);
-      mask |= GDK_GC_LINE_WIDTH;
-    }
-
-  return gc_cache_lookup (DEVICE_GTK_GC_CACHE (d), &gcv, (GdkGCValuesMask) mask);
-}
-
-/*****************************************************************************
- gtk_output_string
-
- Given a string and a starting position, output that string in the
- given face.  If cursor is true, draw a cursor around the string.
- Correctly handles multiple charsets in the string.
-
- The meaning of the parameters is something like this:
-
- W		Window that the text is to be displayed in.
- DL		Display line that this text is on.  The values in the
- 		structure are used to determine the vertical position and
-		clipping range of the text.
- BUF		Dynamic array of Ichars specifying what is actually to be
-		drawn.
- XPOS		X position in pixels where the text should start being drawn.
- XOFFSET	Number of pixels to be chopped off the left side of the
- 		text.  The effect is as if the text were shifted to the
-		left this many pixels and clipped at XPOS.
- CLIP_START	Clip everything left of this X position.
- WIDTH		Clip everything right of XPOS + WIDTH.
- FINDEX		Index for the face cache element describing how to display
- 		the text.
- CURSOR		#### I don't understand this.  There's something
- 		strange and overcomplexified with this variable.
-		Chuck, explain please?
- CURSOR_START	Starting X position of cursor.
- CURSOR_WIDTH	Width of cursor in pixels.
- CURSOR_HEIGHT	Height of cursor in pixels.
-
- Starting Y position of cursor is the top of the text line.
- The cursor is drawn sometimes whether or not CURSOR is set. ???
- ****************************************************************************/
-static
-void gdk_draw_text_image (GdkDrawable *drawable,
-			  GdkFont     *font,
-			  GdkGC       *gc,
-			  gint         x,
-			  gint         y,
-			  const gchar *text,
-			  gint         text_length);
-
-void
-gtk_output_string (struct window *w, struct display_line *dl,
-		   Ichar_dynarr *buf, int xpos, int xoffset, int clip_start,
-		   int width, face_index findex, int cursor,
-		   int cursor_start, int cursor_width, int cursor_height)
-{
-  /* !!#### Needs review */
-  /* General variables */
-  struct frame *f = XFRAME (w->frame);
-  struct device *d = XDEVICE (f->device);
-  Lisp_Object device;
-  Lisp_Object window;
-  GdkWindow *x_win = GET_GTK_WIDGET_WINDOW (FRAME_GTK_TEXT_WIDGET (f));
-
-  int clip_end;
-
-  /* Cursor-related variables */
-  int focus = EQ (w->frame, DEVICE_FRAME_WITH_FOCUS_REAL (d));
-  int cursor_clip;
-  Lisp_Object bar_cursor_value = symbol_value_in_buffer (Qbar_cursor,
-							 WINDOW_BUFFER (w));
-  struct face_cachel *cursor_cachel = 0;
-
-  /* Text-related variables */
-  Lisp_Object bg_pmap;
-  GdkGC *bgc, *gc;
-  int height;
-  int len = Dynarr_length (buf);
-  unsigned char *text_storage = (unsigned char *) ALLOCA (2 * len);
-  struct textual_run *runs = alloca_array (struct textual_run, len);
-  int nruns;
-  int i;
-  struct face_cachel *cachel = WINDOW_FACE_CACHEL (w, findex);
-
-  device = wrap_device (d);
-  window = wrap_window (w);
-
-  if (width < 0)
-    width = gtk_text_width (f, cachel, Dynarr_atp (buf, 0), Dynarr_length (buf));
-  height = dl->ascent + dl->descent - dl->clip;
-
-  /* Regularize the variables passed in. */
-
-  if (clip_start < xpos)
-    clip_start = xpos;
-  clip_end = xpos + width;
-  if (clip_start >= clip_end)
-    /* It's all clipped out. */
-    return;
-
-  xpos -= xoffset;
-
-  nruns = separate_textual_runs (text_storage, runs, Dynarr_atp (buf, 0),
-				 Dynarr_length (buf));
-
-  cursor_clip = (cursor_start >= clip_start &&
-		 cursor_start < clip_end);
-
-  /* This cursor code is really a mess. */
-  if (!NILP (w->text_cursor_visible_p)
-      && (cursor
-	  || cursor_clip
-	  || (cursor_width
-	      && (cursor_start + cursor_width >= clip_start)
-	      && !NILP (bar_cursor_value))))
-    {
-      /* These have to be in separate statements in order to avoid a
-         compiler bug. */
-      face_index sucks = get_builtin_face_cache_index (w, Vtext_cursor_face);
-      cursor_cachel = WINDOW_FACE_CACHEL (w, sucks);
-
-      /* We have to reset this since any call to WINDOW_FACE_CACHEL
-         may cause the cache to resize and any pointers to it to
-         become invalid. */
-      cachel = WINDOW_FACE_CACHEL (w, findex);
-    }
-
-  bg_pmap = cachel->background_pixmap;
-  if (!IMAGE_INSTANCEP (bg_pmap)
-      || !IMAGE_INSTANCE_PIXMAP_TYPE_P (XIMAGE_INSTANCE (bg_pmap)))
-    bg_pmap = Qnil;
-
-  if ((cursor && focus && NILP (bar_cursor_value)
-       && !NILP (w->text_cursor_visible_p)) || NILP (bg_pmap))
-    bgc = 0;
-  else
-    bgc = gtk_get_gc (d, Qnil, cachel->foreground, cachel->background,
-		      bg_pmap, Qnil);
-
-  if (bgc)
-    gdk_draw_rectangle (GDK_DRAWABLE (x_win), bgc, TRUE, clip_start,
-			dl->ypos - dl->ascent, clip_end - clip_start,
-			height);
-
-  for (i = 0; i < nruns; i++)
-    {
-      Lisp_Object font = FACE_CACHEL_FONT (cachel, runs[i].charset);
-      struct Lisp_Font_Instance *fi = XFONT_INSTANCE (font);
-      GdkFont *gdk_font = FONT_INSTANCE_GTK_FONT (fi);
-      int this_width;
-      int need_clipping;
-
-      if (EQ (font, Vthe_null_font_instance))
-	continue;
-
-      this_width = gtk_text_width_single_run (cachel, runs + i);
-      need_clipping = (dl->clip || clip_start > xpos ||
-		       clip_end < xpos + this_width);
-
-      /* XDrawImageString only clears the area equal to the height of
-	 the given font.  It is possible that a font is being displayed
-	 on a line taller than it is, so this would cause us to fail to
-	 clear some areas. */
-      if ((int) fi->height < (int) (height + dl->clip))
-	{
-	  int clear_start = max (xpos, clip_start);
-	  int clear_end = min (xpos + this_width, clip_end);
-
-	  if (cursor)
-	    {
-	      int ypos1_line, ypos1_string, ypos2_line, ypos2_string;
-
-	      ypos1_string = dl->ypos - fi->ascent;
-	      ypos2_string = dl->ypos + fi->descent;
-	      ypos1_line = dl->ypos - dl->ascent;
-	      ypos2_line = dl->ypos + dl->descent - dl->clip;
-
-	      /* Make sure we don't clear below the real bottom of the
-		 line. */
-	      if (ypos1_string > ypos2_line)
-		ypos1_string = ypos2_line;
-	      if (ypos2_string > ypos2_line)
-		ypos2_string = ypos2_line;
-
-	      if (ypos1_line < ypos1_string)
-		{
-		  redisplay_clear_region (window, findex, clear_start, ypos1_line,
-				    clear_end - clear_start,
-				    ypos1_string - ypos1_line);
-		}
-
-	      if (ypos2_line > ypos2_string)
-		{
-		  redisplay_clear_region (window, findex, clear_start, ypos2_string,
-					  clear_end - clear_start,
-					  ypos2_line - ypos2_string);
-		}
-	    }
-	  else
-	    {
-	      redisplay_clear_region (window, findex, clear_start,
-				      dl->ypos - dl->ascent, clear_end - clear_start,
-				      height);
-	    }
-	}
-
-      if (cursor && cursor_cachel && focus && NILP (bar_cursor_value))
-      {
-	gc = gtk_get_gc (d, font, cursor_cachel->foreground,
-			 cursor_cachel->background, Qnil, Qnil);
-      }
-      else
-      {
-	gc = gtk_get_gc (d, font, cachel->foreground, cachel->background,
-			 Qnil, Qnil);
-      }
-
-      if (need_clipping)
-	{
-	  GdkRectangle clip_box;
-
-	  clip_box.x = 0;
-	  clip_box.y = 0;
-	  clip_box.width = clip_end - clip_start;
-	  clip_box.height = height;
-
-	  gdk_gc_set_clip_rectangle (gc, &clip_box);
-	  gdk_gc_set_clip_origin (gc, clip_start, dl->ypos - dl->ascent);
-	}
-
-      /* The X specific called different functions (XDraw*String
-         vs. XDraw*String16), but apparently gdk_draw_text takes care
-         of that for us.
-
-	 BUT, gdk_draw_text also does too much, by dividing the length
-	 by 2.  So we fake them out my multiplying the length by the
-	 dimension of the text.  This will do the right thing for
-	 single-dimension runs as well of course.
-      */
-      (bgc ? gdk_draw_text : gdk_draw_text_image) (GDK_DRAWABLE (x_win), gdk_font, gc, xpos,
-						   dl->ypos, (char *) runs[i].ptr,
-						   runs[i].len * runs[i].dimension);
-
-      /* We draw underlines in the same color as the text. */
-      if (cachel->underline)
-	{
-	  int upos, uthick;
-
-	  /* Cannot get at font properties in Gtk, so we resort to
-             guessing */
-	  upos = dl->descent / 2;
-	  uthick = 1;
-
-	  if ((dl->ypos + upos) < (dl->ypos + dl->descent - dl->clip))
-	    {
-	      if (dl->ypos + upos + uthick > dl->ypos + dl->descent - dl->clip)
-		uthick = dl->descent - dl->clip - upos;
-
-	      if (uthick == 1)
-		{
-		  gdk_draw_line (GDK_DRAWABLE (x_win), gc, xpos, dl->ypos + upos,
-			     xpos + this_width, dl->ypos + upos);
-		}
-	      else if (uthick > 1)
-		{
-		    gdk_draw_rectangle (GDK_DRAWABLE (x_win), gc, TRUE, xpos,
-					dl->ypos + upos, this_width, uthick);
-		}
-	    }
-	}
-
-      if (cachel->strikethru) {
-	gint ascent,descent,upos, uthick;
-	GdkFont *gfont = FONT_INSTANCE_GTK_FONT (XFONT_INSTANCE (font));
-
-	/* Cannot get at font properties in Gtk, so we resort to
-           guessing */
-
-	ascent = gfont->ascent;
-	descent = gfont->descent;
-	uthick = 1;
-
-	upos = ascent - ((ascent + descent) / 2) + 1;
-
-	/* Generally, upos will be positive (above the baseline),so subtract */
-	if (dl->ypos - upos < dl->ypos + dl->descent - dl->clip)
-	  {
-	    if (dl->ypos - upos + uthick > dl->ypos + dl->descent - dl->clip)
-	      uthick = dl->descent - dl->clip + upos;
-
-	    if (uthick == 1)
-	      {
-		  gdk_draw_line (GDK_DRAWABLE (x_win), gc, xpos, dl->ypos - upos,
-				 xpos + this_width, dl->ypos - upos);
-	      }
-	    else if (uthick > 1)
-	      {
-		  gdk_draw_rectangle (GDK_DRAWABLE (x_win), gc, TRUE, xpos, dl->ypos + upos,
-				      this_width, uthick);
-	      }
-	  }
-      }
-
-      /* Restore the GC */
-      if (need_clipping)
-	{
-	    gdk_gc_set_clip_rectangle (gc, NULL);
-	    gdk_gc_set_clip_origin (gc, 0, 0);
-	}
-
-      /* If we are actually superimposing the cursor then redraw with just
-	 the appropriate section highlighted. */
-      if (cursor_clip && !cursor && focus && cursor_cachel)
-	{
-	  GdkGC *cgc;
-	  GdkRectangle clip_box;
-
-	  cgc = gtk_get_gc (d, font, cursor_cachel->foreground,
-			    cursor_cachel->background, Qnil, Qnil);
-
-	  clip_box.x = 0;
-	  clip_box.y = 0;
-	  clip_box.width = cursor_width;
-	  clip_box.height = height;
-
-	  gdk_gc_set_clip_rectangle (cgc, &clip_box);
-	  gdk_gc_set_clip_origin (cgc, cursor_start, dl->ypos - dl->ascent);
-
-	  /* The X specific called different functions (XDraw*String
-	     vs. XDraw*String16), but apparently gdk_draw_text takes care
-	     of that for us.
-
-	     BUT, gdk_draw_text also does too much, by dividing the
-	     length by 2.  So we fake them out my multiplying the
-	     length by the dimension of the text.  This will do the
-	     right thing for single-dimension runs as well of course.
-	  */
-	  gdk_draw_text_image (GDK_DRAWABLE (x_win), gdk_font, cgc, xpos,
-			       dl->ypos, (char *) runs[i].ptr,
-			       runs[i].len * runs[i].dimension);
-
-	  gdk_gc_set_clip_rectangle (cgc, NULL);
-	  gdk_gc_set_clip_origin (cgc, 0, 0);
-	}
-
-      xpos += this_width;
-    }
-
-  /* Draw the non-focus box or bar-cursor as needed. */
-  /* Can't this logic be simplified? */
-  if (cursor_cachel
-      && ((cursor && !focus && NILP (bar_cursor_value))
-	  || (cursor_width
-	      && (cursor_start + cursor_width >= clip_start)
-	      && !NILP (bar_cursor_value))))
-    {
-      int tmp_height, tmp_y;
-      int bar_width = EQ (bar_cursor_value, Qt) ? 1 : 2;
-      int need_clipping = (cursor_start < clip_start
-			   || clip_end < cursor_start + cursor_width);
-
-      /* #### This value is correct (as far as I know) because
-	 all of the times we need to draw this cursor, we will
-	 be called with exactly one character, so we know we
-	 can always use runs[0].
-
-	 This is bogus as all hell, however.  The cursor handling in
-	 this function is way bogus and desperately needs to be
-	 cleaned up. (In particular, the drawing of the cursor should
-	 really really be separated out of this function.  This may be
-	 a bit tricky now because this function itself does way too
-	 much stuff, a lot of which needs to be moved into
-	 redisplay.c) This is the only way to be able to easily add
-	 new cursor types or (e.g.) make the bar cursor be able to
-	 span two characters instead of overlaying just one. */
-      int bogusly_obtained_ascent_value =
-	XFONT_INSTANCE (FACE_CACHEL_FONT (cachel, runs[0].charset))->ascent;
-
-      if (!NILP (bar_cursor_value))
-	{
-	  gc = gtk_get_gc (d, Qnil, cursor_cachel->background, Qnil, Qnil,
-			   make_int (bar_width));
-	}
-      else
-	{
-	  gc = gtk_get_gc (d, Qnil, cursor_cachel->background,
-			   Qnil, Qnil, Qnil);
-	}
-
-      tmp_y = dl->ypos - bogusly_obtained_ascent_value;
-      tmp_height = cursor_height;
-      if (tmp_y + tmp_height > (int) (dl->ypos - dl->ascent + height))
-	{
-	  tmp_y = dl->ypos - dl->ascent + height - tmp_height;
-	  if (tmp_y < (int) (dl->ypos - dl->ascent))
-	    tmp_y = dl->ypos - dl->ascent;
-	  tmp_height = dl->ypos - dl->ascent + height - tmp_y;
-	}
-
-      if (need_clipping)
-	{
-	  GdkRectangle clip_box;
-	  clip_box.x = 0;
-	  clip_box.y = 0;
-	  clip_box.width = clip_end - clip_start;
-	  clip_box.height = tmp_height;
-
-	  gdk_gc_set_clip_rectangle (gc, &clip_box);
-	  gdk_gc_set_clip_origin (gc, clip_start, tmp_y);
-	}
-
-      if (!focus && NILP (bar_cursor_value))
-	{
-	    gdk_draw_rectangle (GDK_DRAWABLE (x_win), gc, FALSE,
-				cursor_start, tmp_y,
-				cursor_width - 1, tmp_height - 1);
-	}
-      else if (focus && !NILP (bar_cursor_value))
-	{
-	    gdk_draw_line (GDK_DRAWABLE (x_win), gc,
-			   cursor_start + bar_width - 1, tmp_y,
-			   cursor_start + bar_width - 1, tmp_y + tmp_height - 1);
-	}
-
-      /* Restore the GC */
-      if (need_clipping)
-	{
-	    gdk_gc_set_clip_rectangle (gc, NULL);
-	    gdk_gc_set_clip_origin (gc, 0, 0);
-	}
-    }
-}
-
-static void
-our_draw_bitmap (GdkDrawable *drawable,
-		 GdkGC       *gc,
-		 GdkPixmap   *src,
-		 gint         xsrc,
-		 gint         ysrc,
-		 gint         xdest,
-		 gint         ydest,
-		 gint         width,
-		 gint         height);
-
-static void
-gtk_output_gdk_pixmap (struct frame *f, struct Lisp_Image_Instance *p, int x,
-		       int y, int xoffset, int yoffset,
-		       int width, int height, 
-		       GdkColor *fg, GdkColor *bg, GdkGC *override_gc)
-{
-  struct device *d = XDEVICE (f->device);
-  GdkWindow *x_win = GET_GTK_WIDGET_WINDOW (FRAME_GTK_TEXT_WIDGET (f));
-
-  GdkGC *gc;
-  GdkGCValues gcv;
-  unsigned long pixmap_mask;
-
-  if (!override_gc)
-    {
-      memset (&gcv, ~0, sizeof (gcv));
-      gcv.graphics_exposures = FALSE;
-      gcv.foreground = *fg;
-      gcv.background = *bg;
-      pixmap_mask = GDK_GC_FOREGROUND | GDK_GC_BACKGROUND | GDK_GC_EXPOSURES;
-
-      if (IMAGE_INSTANCE_GTK_MASK (p))
-	{
-	  gcv.function = GDK_COPY;
-	  gcv.clip_mask = IMAGE_INSTANCE_GTK_MASK (p);
-	  gcv.clip_x_origin = x - xoffset;
-	  gcv.clip_y_origin = y - yoffset;
-	  pixmap_mask |= (GDK_GC_FUNCTION | GDK_GC_CLIP_MASK | GDK_GC_CLIP_X_ORIGIN |
-			  GDK_GC_CLIP_Y_ORIGIN);
-	  /* Can't set a clip rectangle below because we already have a mask.
-	     We could conceivably create a new clipmask by zeroing out
-	     everything outside the clip region.  Is it worth it?
-	     Is it possible to get an equivalent effect by changing the
-	     args to XCopyArea below rather than messing with a clip box?
-	     - dkindred@cs.cmu.edu
-	     Yes. We don't clip at all now - andy@xemacs.org
-          */
-	}
-
-      gc = gc_cache_lookup (DEVICE_GTK_GC_CACHE (d), &gcv, pixmap_mask);
-    }
-  else
-    {
-      gc = override_gc;
-      /* override_gc might have a mask already--we don't want to nuke it.
-	 Maybe we can insist that override_gc have no mask, or use
-	 one of the suggestions above. */
-    }
-
-  if (IMAGE_INSTANCE_PIXMAP_DEPTH (p) > 0)
-    {
-      gdk_draw_pixmap (GDK_DRAWABLE (x_win), gc,
-		       IMAGE_INSTANCE_GTK_PIXMAP (p),
-		       xoffset, yoffset, x, y, width, height);
-    }
-  else
-    {
-      our_draw_bitmap (GDK_DRAWABLE (x_win), gc,
-		       IMAGE_INSTANCE_GTK_PIXMAP (p),
-		       xoffset, yoffset, x, y, width, height);
-    }
-}
-
-static void
-gtk_output_pixmap (struct window *w,
-		   Lisp_Object image_instance,
-		   struct display_box *db,
-		   struct display_glyph_area *dga,
-		   face_index findex,
-		   int cursor_start,
-		   int cursor_width,
-		   int cursor_height,
-		   int UNUSED (bg_pixmap))
-{
-  struct frame *f = XFRAME (w->frame);
-  struct device *d = XDEVICE (f->device);
-  struct Lisp_Image_Instance *p = XIMAGE_INSTANCE (image_instance);
-  Lisp_Object window;
-
-  GdkWindow *x_win = GET_GTK_WIDGET_WINDOW (FRAME_GTK_TEXT_WIDGET (f));
-
-  window = wrap_window (w);
-
-  /* Output the pixmap. */
-  {
-    Lisp_Object tmp_pixel;
-    GdkColor *tmp_bcolor, *tmp_fcolor;
-
-    tmp_pixel = WINDOW_FACE_CACHEL_FOREGROUND (w, findex);
-    tmp_fcolor = COLOR_INSTANCE_GTK_COLOR (XCOLOR_INSTANCE (tmp_pixel));
-    tmp_pixel = WINDOW_FACE_CACHEL_BACKGROUND (w, findex);
-    tmp_bcolor = COLOR_INSTANCE_GTK_COLOR (XCOLOR_INSTANCE (tmp_pixel));
-
-    gtk_output_gdk_pixmap (f, p, db->xpos, db->ypos,
-			   dga->xoffset, dga->yoffset,
-			   dga->width, dga->height,
-			   tmp_fcolor, tmp_bcolor, NULL);
-  }
-
-  /* Draw a cursor over top of the pixmap. */
-  if (cursor_width && cursor_height && (cursor_start >= db->xpos)
-      && !NILP (w->text_cursor_visible_p)
-      && (cursor_start < (db->xpos + dga->width)))
-    {
-      GdkGC *gc;
-      int focus = EQ (w->frame, DEVICE_FRAME_WITH_FOCUS_REAL (d));
-      struct face_cachel *cursor_cachel =
-	WINDOW_FACE_CACHEL (w,
-			    get_builtin_face_cache_index
-			    (w, Vtext_cursor_face));
-
-      gc = gtk_get_gc (d, Qnil, cursor_cachel->background, Qnil, Qnil, Qnil);
-
-      if (cursor_width > db->xpos + dga->width - cursor_start)
-	cursor_width = db->xpos + dga->width - cursor_start;
-
-      gdk_draw_rectangle (GDK_DRAWABLE (x_win), gc, focus ? TRUE : FALSE,
-			  cursor_start, db->ypos, cursor_width,
-			  cursor_height);
-    }
-}
-
-/*****************************************************************************
- gtk_output_vertical_divider
-
- Draw a vertical divider down the right side of the given window.
- ****************************************************************************/
-static void
-gtk_output_vertical_divider (struct window *w, int UNUSED(clear))
-{
-  struct frame *f = XFRAME (w->frame);
-  struct device *d = XDEVICE (f->device);
-  GdkWindow *x_win = GET_GTK_WIDGET_WINDOW (FRAME_GTK_TEXT_WIDGET (f));
-  GdkGC *background_gc;
-  Lisp_Object tmp_pixel;
-  GdkGCValues gcv;
-  unsigned long mask;
-  int x, y1, y2, width, shadow_thickness, spacing, line_width;
-  face_index div_face = get_builtin_face_cache_index (w, Vvertical_divider_face);
-  
-  width = window_divider_width (w);
-  shadow_thickness = XINT (w->vertical_divider_shadow_thickness);
-  spacing = XINT (w->vertical_divider_spacing);
-  line_width = XINT (w->vertical_divider_line_width);
-  x = WINDOW_RIGHT (w) - width;
-  y1 = WINDOW_TOP (w);
-  y2 = WINDOW_BOTTOM (w);
-  
-  memset (&gcv, ~0, sizeof (gcv));
-  
-  tmp_pixel = WINDOW_FACE_CACHEL_BACKGROUND (w, div_face);
-  
-  gcv.background = * COLOR_INSTANCE_GTK_COLOR (XCOLOR_INSTANCE (tmp_pixel));
-  gcv.foreground = gcv.background;
-  gcv.graphics_exposures = FALSE;
-  mask = GDK_GC_FOREGROUND | GDK_GC_BACKGROUND | GDK_GC_EXPOSURES;
-
-  background_gc = gc_cache_lookup (DEVICE_GTK_GC_CACHE (d), &gcv, mask);
-
-  /* Clear the divider area first.  This needs to be done when a
-     window split occurs. */
-  /* if (clear) */
-  gdk_draw_rectangle (GDK_DRAWABLE (x_win), background_gc, TRUE,
-		      x, y1, width, y2 - y1);
-
-#if 0
-  /* Draw the divider line. */
-  gdk_draw_rectangle (GDK_DRAWABLE (x_win), background_gc, TRUE,
-		      x + spacing + shadow_thickness, y1,
-		      line_width, y2 - y1);
-#endif
-  
-  /* Draw the shadows around the divider line */
-  gtk_output_shadows (f, x + spacing, y1, 
-		      width - 2 * spacing, y2 - y1,
-		      shadow_thickness);
-}
-
-/*****************************************************************************
- gtk_output_blank
-
- Output a blank by clearing the area it covers in the foreground color
- of its face.
- ****************************************************************************/
-static void
-gtk_output_blank (struct window *w, struct display_line *dl, struct rune *rb,
-		  int start_pixpos, int cursor_start, int cursor_width)
-{
-  struct frame *f = XFRAME (w->frame);
-  struct device *d = XDEVICE (f->device);
-
-  GdkWindow *x_win = GET_GTK_WIDGET_WINDOW (FRAME_GTK_TEXT_WIDGET (f));
-  GdkGC *gc;
-  struct face_cachel *cursor_cachel =
-    WINDOW_FACE_CACHEL (w,
-			get_builtin_face_cache_index
-			(w, Vtext_cursor_face));
-  Lisp_Object bg_pmap;
-  Lisp_Object buffer = WINDOW_BUFFER (w);
-  Lisp_Object bar_cursor_value = symbol_value_in_buffer (Qbar_cursor,
-							 buffer);
-
-  int x = rb->xpos;
-  int y = dl->ypos - dl->ascent;
-  int width = rb->width;
-  int height = dl->ascent + dl->descent - dl->clip;
-
-  if (start_pixpos > x)
-    {
-      if (start_pixpos >= (x + width))
-	return;
-      else
-	{
-	  width -= (start_pixpos - x);
-	  x = start_pixpos;
-	}
-    }
-
-  bg_pmap = WINDOW_FACE_CACHEL_BACKGROUND_PIXMAP (w, rb->findex);
-  if (!IMAGE_INSTANCEP (bg_pmap)
-      || !IMAGE_INSTANCE_PIXMAP_TYPE_P (XIMAGE_INSTANCE (bg_pmap)))
-    bg_pmap = Qnil;
-
-  if (NILP (bg_pmap))
-    gc = gtk_get_gc (d, Qnil, WINDOW_FACE_CACHEL_BACKGROUND (w, rb->findex),
-		     Qnil, Qnil, Qnil);
-  else
-    gc = gtk_get_gc (d, Qnil, WINDOW_FACE_CACHEL_FOREGROUND (w, rb->findex),
-		     WINDOW_FACE_CACHEL_BACKGROUND (w, rb->findex), bg_pmap,
-		     Qnil);
-
-  gdk_draw_rectangle (GDK_DRAWABLE (x_win), gc, TRUE, x, y, width, height);
-
-  /* If this rune is marked as having the cursor, then it is actually
-     representing a tab. */
-  if (!NILP (w->text_cursor_visible_p)
-      && (rb->cursor_type == CURSOR_ON
-	  || (cursor_width
-	      && (cursor_start + cursor_width > x)
-	      && cursor_start < (x + width))))
-    {
-      int cursor_height, cursor_y;
-      int focus = EQ (w->frame, DEVICE_FRAME_WITH_FOCUS_REAL (d));
-      struct Lisp_Font_Instance *fi;
-
-      fi = XFONT_INSTANCE (FACE_CACHEL_FONT
-			   (WINDOW_FACE_CACHEL (w, rb->findex),
-			    Vcharset_ascii));
-
-      gc = gtk_get_gc (d, Qnil, cursor_cachel->background, Qnil, Qnil, Qnil);
-
-      cursor_y = dl->ypos - fi->ascent;
-      cursor_height = fi->height;
-      if (cursor_y + cursor_height > y + height)
-	cursor_height = y + height - cursor_y;
-
-      if (focus)
-	{
-	  if (NILP (bar_cursor_value))
-	    {
-		gdk_draw_rectangle (GDK_DRAWABLE (x_win), gc, TRUE,
-				    cursor_start, cursor_y,
-				    fi->width, cursor_height);
-	    }
-	  else
-	    {
-	      int bar_width = EQ (bar_cursor_value, Qt) ? 1 : 2;
-
-	      gc = gtk_get_gc (d, Qnil, cursor_cachel->background, Qnil, Qnil,
-			       make_int (bar_width));
-	      gdk_draw_line (GDK_DRAWABLE (x_win), gc, cursor_start + bar_width - 1,
-			     cursor_y, cursor_start + bar_width - 1,
-			     cursor_y + cursor_height - 1);
-	    }
-	}
-      else if (NILP (bar_cursor_value))
-	{
-	    gdk_draw_rectangle (GDK_DRAWABLE (x_win), gc, FALSE,
-				cursor_start, cursor_y,
-				fi->width - 1, cursor_height - 1);
-	}
-    }
-}
-
-/*****************************************************************************
- gtk_output_horizontal_line
-
- Output a horizontal line in the foreground of its face.
- ****************************************************************************/
-static void
-gtk_output_horizontal_line (struct window *w,
-			    struct display_line *dl,
-			    struct rune *rb)
-{
-  struct frame *f = XFRAME (w->frame);
-  struct device *d = XDEVICE (f->device);
-  GtkStyle *style = FRAME_GTK_TEXT_WIDGET (f)->style;
-
-  GdkWindow *x_win = GET_GTK_WIDGET_WINDOW (FRAME_GTK_TEXT_WIDGET (f));
-  GdkGC *gc;
-
-  int x = rb->xpos;
-  int width = rb->width;
-  int height = dl->ascent + dl->descent - dl->clip;
-
-  int ypos1, ypos2, ypos3, ypos4;
-
-  ypos1 = dl->ypos - dl->ascent;
-  ypos2 = ypos1 + rb->object.hline.yoffset;
-  ypos3 = ypos2 + rb->object.hline.thickness;
-  ypos4 = dl->ypos + dl->descent - dl->clip;
-
-  /* First clear the area not covered by the line. */
-  if (height - rb->object.hline.thickness > 0)
-    {
-      gc = gtk_get_gc (d, Qnil, WINDOW_FACE_CACHEL_FOREGROUND (w, rb->findex),
-		     Qnil, Qnil, Qnil);
-
-      if (ypos2 - ypos1 > 0)
-	  gdk_draw_rectangle (GDK_DRAWABLE (x_win), gc, TRUE, x, ypos1, width, ypos2 - ypos1);
-      if (ypos4 - ypos3 > 0)
-	  gdk_draw_rectangle (GDK_DRAWABLE (x_win), gc, TRUE, x, ypos1, width, ypos2 - ypos1);
-    }
-
-  gtk_paint_hline (style, x_win, GTK_STATE_NORMAL, NULL, FRAME_GTK_TEXT_WIDGET (f),
-		   "hline", x, x + width, ypos2);
-#if 0
-  /* Now draw the line. */
-  gc = gtk_get_gc (d, Qnil, WINDOW_FACE_CACHEL_BACKGROUND (w, rb->findex),
-		   Qnil, Qnil, Qnil);
-
-  if (ypos2 < ypos1)
-    ypos2 = ypos1;
-  if (ypos3 > ypos4)
-    ypos3 = ypos4;
-
-  if (ypos3 - ypos2 > 0)
-      gdk_draw_rectangle (GDK_DRAWABLE (x_win), gc, TRUE, x, ypos2, width, ypos3 - ypos2);
-#endif
-}
-
-/*****************************************************************************
  gtk_output_shadows
 
  Draw a shadow around the given area using the standard theme engine routines.
@@ -1419,271 +75,6 @@
 		    x, y, width, height);
 }
 
-/*****************************************************************************
- gtk_clear_to_window_end
-
- Clear the area between ypos1 and ypos2.  Each margin area and the
- text area is handled separately since they may each have their own
- background color.
- ****************************************************************************/
-static void
-gtk_clear_to_window_end (struct window *w, int ypos1, int ypos2)
-{
-  int height = ypos2 - ypos1;
-
-  if (height)
-    {
-      struct frame *f = XFRAME (w->frame);
-      Lisp_Object window;
-      int bflag = (window_needs_vertical_divider (w) ? 0 : 1);
-      layout_bounds bounds;
-
-      bounds = calculate_display_line_boundaries (w, bflag);
-      window = wrap_window (w);
-
-      if (window_is_leftmost (w))
-	redisplay_clear_region (window, DEFAULT_INDEX, FRAME_LEFT_BORDER_START (f),
-				ypos1, FRAME_BORDER_WIDTH (f), height);
-
-      if (bounds.left_in - bounds.left_out > 0)
-	redisplay_clear_region (window,
-				get_builtin_face_cache_index (w, Vleft_margin_face),
-				bounds.left_out, ypos1,
-				bounds.left_in - bounds.left_out, height);
-
-      if (bounds.right_in - bounds.left_in > 0)
-	redisplay_clear_region (window, DEFAULT_INDEX, bounds.left_in, ypos1,
-				bounds.right_in - bounds.left_in, height);
-
-      if (bounds.right_out - bounds.right_in > 0)
-	redisplay_clear_region (window,
-				get_builtin_face_cache_index (w, Vright_margin_face),
-				bounds.right_in, ypos1,
-				bounds.right_out - bounds.right_in, height);
-
-      if (window_is_rightmost (w))
-	redisplay_clear_region (window, DEFAULT_INDEX, FRAME_RIGHT_BORDER_START (f),
-				ypos1, FRAME_BORDER_WIDTH (f), height);
-    }
-}
-
-/****************************************************************************
- gtk_clear_region
-
- Clear the area in the box defined by the given parameters using the
- given face.
- ****************************************************************************/
-static void
-gtk_clear_region (Lisp_Object UNUSED (locale), struct device* d,
-		  struct frame* f, face_index UNUSED (findex), int x, int y,
-		  int width, int height, Lisp_Object fcolor, Lisp_Object bcolor,
-		  Lisp_Object background_pixmap)
-{
-  GdkWindow *x_win;
-  GdkGC *gc = NULL;
-
-  x_win = GET_GTK_WIDGET_WINDOW (FRAME_GTK_TEXT_WIDGET (f));
-
-  if (!UNBOUNDP (background_pixmap))
-    {
-      gc = gtk_get_gc (d, Qnil, fcolor, bcolor, background_pixmap, Qnil);
-    }
-
-  if (gc)
-    {
-      gdk_draw_rectangle (GDK_DRAWABLE (x_win), gc,TRUE,
-			  x, y, width, height);
-    }
-  else
-    {
-      gdk_window_clear_area (x_win, x, y, width, height);
-    }
-}
-
-/*****************************************************************************
- gtk_output_eol_cursor
-
- Draw a cursor at the end of a line.  The end-of-line cursor is
- narrower than the normal cursor.
- ****************************************************************************/
-static void
-gtk_output_eol_cursor (struct window *w, struct display_line *dl, int xpos,
-		       face_index findex)
-{
-  struct frame *f = XFRAME (w->frame);
-  struct device *d = XDEVICE (f->device);
-  Lisp_Object window;
-
-  GdkWindow *x_win = GET_GTK_WIDGET_WINDOW (FRAME_GTK_TEXT_WIDGET (f));
-  GdkGC *gc;
-  face_index elt = get_builtin_face_cache_index (w, Vtext_cursor_face);
-  struct face_cachel *cursor_cachel = WINDOW_FACE_CACHEL (w, elt);
-
-  int focus = EQ (w->frame, DEVICE_FRAME_WITH_FOCUS_REAL (d));
-  Lisp_Object bar_cursor_value = symbol_value_in_buffer (Qbar_cursor,
-							 WINDOW_BUFFER (w));
-
-  int x = xpos;
-  int y = dl->ypos - dl->ascent;
-  int width = EOL_CURSOR_WIDTH;
-  int height = dl->ascent + dl->descent - dl->clip;
-  int cursor_height, cursor_y;
-  int defheight, defascent;
-
-  window = wrap_window (w);
-  redisplay_clear_region (window, findex, x, y, width, height);
-
-  if (NILP (w->text_cursor_visible_p))
-    return;
-
-  gc = gtk_get_gc (d, Qnil, cursor_cachel->background, Qnil, Qnil, Qnil);
-
-  default_face_font_info (window, &defascent, 0, &defheight, 0, 0);
-
-  /* make sure the cursor is entirely contained between y and y+height */
-  cursor_height = min (defheight, height);
-  cursor_y = max (y, min (y + height - cursor_height,
-			  dl->ypos - defascent));
-
-  if (focus)
-    {
-      if (NILP (bar_cursor_value))
-	{
-	    gdk_draw_rectangle (GDK_DRAWABLE (x_win), gc, TRUE, x, cursor_y, width, cursor_height);
-	}
-      else
-	{
-	  int bar_width = EQ (bar_cursor_value, Qt) ? 1 : 2;
-
-	  gc = gtk_get_gc (d, Qnil, cursor_cachel->background, Qnil, Qnil,
-			   make_int (bar_width));
-	  gdk_draw_line (GDK_DRAWABLE (x_win), gc, x + bar_width - 1, cursor_y,
-			 x + bar_width - 1, cursor_y + cursor_height - 1);
-	}
-    }
-  else if (NILP (bar_cursor_value))
-    {
-	gdk_draw_rectangle (GDK_DRAWABLE (x_win), gc, FALSE, x, cursor_y, width - 1,
-			    cursor_height - 1);
-    }
-}
-
-static void
-gtk_clear_frame_window (Lisp_Object window)
-{
-  struct window *w = XWINDOW (window);
-
-  if (!NILP (w->vchild))
-    {
-      gtk_clear_frame_windows (w->vchild);
-      return;
-    }
-
-  if (!NILP (w->hchild))
-    {
-      gtk_clear_frame_windows (w->hchild);
-      return;
-    }
-
-  gtk_clear_to_window_end (w, WINDOW_TEXT_TOP (w), WINDOW_TEXT_BOTTOM (w));
-}
-
-static void
-gtk_clear_frame_windows (Lisp_Object window)
-{
-  for (; !NILP (window); window = XWINDOW (window)->next)
-    gtk_clear_frame_window (window);
-}
-
-static void
-gtk_clear_frame (struct frame *f)
-{
-  GdkWindow *x_win = GET_GTK_WIDGET_WINDOW (FRAME_GTK_TEXT_WIDGET (f));
-  int x, y, width, height;
-  Lisp_Object frame;
-
-  x = FRAME_LEFT_BORDER_START (f);
-  width = (FRAME_PIXWIDTH (f) - FRAME_REAL_LEFT_TOOLBAR_WIDTH (f) -
-	   FRAME_REAL_RIGHT_TOOLBAR_WIDTH (f) -
-	   2 * FRAME_REAL_LEFT_TOOLBAR_BORDER_WIDTH (f) -
-	   2 * FRAME_REAL_RIGHT_TOOLBAR_BORDER_WIDTH (f));
-  /* #### This adjustment by 1 should be being done in the macros.
-     There is some small differences between when the menubar is on
-     and off that we still need to deal with. */
-  y = FRAME_TOP_BORDER_START (f) - 1;
-  height = (FRAME_PIXHEIGHT (f) - FRAME_REAL_TOP_TOOLBAR_HEIGHT (f) -
-	    FRAME_REAL_BOTTOM_TOOLBAR_HEIGHT (f) -
-	    2 * FRAME_REAL_TOP_TOOLBAR_BORDER_WIDTH (f) -
-	    2 * FRAME_REAL_BOTTOM_TOOLBAR_BORDER_WIDTH (f)) + 1;
-
-  gdk_window_clear_area (x_win, x, y, width, height);
-
-  frame = wrap_frame (f);
-
-  if (!UNBOUNDP (FACE_BACKGROUND_PIXMAP (Vdefault_face, frame))
-      || !UNBOUNDP (FACE_BACKGROUND_PIXMAP (Vleft_margin_face, frame))
-      || !UNBOUNDP (FACE_BACKGROUND_PIXMAP (Vright_margin_face, frame)))
-    {
-      gtk_clear_frame_windows (f->root_window);
-    }
-}
-
-static int
-gtk_flash (struct device *d)
-{
-  GdkGCValues gcv;
-  GdkGC *gc;
-  GdkColor tmp_fcolor, tmp_bcolor;
-  Lisp_Object tmp_pixel, frame;
-  struct frame *f = device_selected_frame (d);
-  struct window *w = XWINDOW (FRAME_ROOT_WINDOW (f));
-
-  frame = wrap_frame (f);
-
-  tmp_pixel = FACE_FOREGROUND (Vdefault_face, frame);
-  tmp_fcolor = * (COLOR_INSTANCE_GTK_COLOR (XCOLOR_INSTANCE (tmp_pixel)));
-  tmp_pixel = FACE_BACKGROUND (Vdefault_face, frame);
-  tmp_bcolor = * (COLOR_INSTANCE_GTK_COLOR (XCOLOR_INSTANCE (tmp_pixel)));
-
-  memset (&gcv, ~0, sizeof (gcv)); /* initialize all slots to ~0 */
-  gcv.foreground.pixel  = (tmp_fcolor.pixel ^ tmp_bcolor.pixel);
-  gcv.function = GDK_XOR;
-  gcv.graphics_exposures = FALSE;
-  gc = gc_cache_lookup (DEVICE_GTK_GC_CACHE (XDEVICE (f->device)), &gcv,
-			GDK_GC_FOREGROUND | GDK_GC_FUNCTION | GDK_GC_EXPOSURES);
-
-  gdk_draw_rectangle (GDK_DRAWABLE (GET_GTK_WIDGET_WINDOW (FRAME_GTK_SHELL_WIDGET (f))),
-		      gc, TRUE, w->pixel_left, w->pixel_top,
-		      w->pixel_width, w->pixel_height);
-
-  gdk_flush ();
-
-#ifdef HAVE_SELECT
-  {
-    int usecs = 100000;
-    struct timeval tv;
-    tv.tv_sec  = usecs / 1000000L;
-    tv.tv_usec = usecs % 1000000L;
-    /* I'm sure someone is going to complain about this... */
-    select (0, 0, 0, 0, &tv);
-  }
-#else
-#ifdef HAVE_POLL
-  poll (0, 0, 100);
-#else
-  bite me
-#endif
-#endif
-
-  gdk_draw_rectangle (GDK_DRAWABLE (GET_GTK_WIDGET_WINDOW (FRAME_GTK_SHELL_WIDGET (f))),
-		      gc, TRUE, w->pixel_left, w->pixel_top,
-		      w->pixel_width, w->pixel_height);
-
-  gdk_flush ();
-
-  return 1;
-}
-
 static void
 gtk_bevel_area (struct window *w, face_index UNUSED (findex),
 		int x, int y, int width, int height,
@@ -1710,29 +101,6 @@
 }
 
 
-/************************************************************************/
-/*                            initialization                            */
-/************************************************************************/
-
-void
-console_type_create_redisplay_gtk (void)
-{
-  /* redisplay methods */
-  CONSOLE_HAS_METHOD (gtk, text_width);
-  CONSOLE_HAS_METHOD (gtk, output_display_block);
-  CONSOLE_HAS_METHOD (gtk, divider_height);
-  CONSOLE_HAS_METHOD (gtk, eol_cursor_width);
-  CONSOLE_HAS_METHOD (gtk, output_vertical_divider);
-  CONSOLE_HAS_METHOD (gtk, clear_to_window_end);
-  CONSOLE_HAS_METHOD (gtk, clear_region);
-  CONSOLE_HAS_METHOD (gtk, clear_frame);
-  CONSOLE_HAS_METHOD (gtk, flash);
-  CONSOLE_HAS_METHOD (gtk, ring_bell);
-  CONSOLE_HAS_METHOD (gtk, bevel_area);
-  CONSOLE_HAS_METHOD (gtk, output_string);
-  CONSOLE_HAS_METHOD (gtk, output_pixmap);
-}
-
 /* This makes me feel incredibly dirty... but there is no other way to
    get this done right other than calling clear_area before every
    single $#!%@ing piece of text, which I do NOT want to do. */
--- a/src/redisplay-msw.c	Wed Jan 27 06:00:09 2010 -0600
+++ b/src/redisplay-msw.c	Thu Jan 28 02:48:45 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_atp (buf, 0),
+				  Dynarr_length (buf));
 #else
-  assert(width>=0);
+  assert (width >= 0);
 #endif
 
   /* Regularize the variables passed in. */
@@ -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;
--- a/src/redisplay-output.c	Wed Jan 27 06:00:09 2010 -0600
+++ b/src/redisplay-output.c	Thu Jan 28 02:48:45 2010 -0600
@@ -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++)
--- a/src/redisplay-tty.c	Wed Jan 27 06:00:09 2010 -0600
+++ b/src/redisplay-tty.c	Thu Jan 28 02:48:45 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))
     {
@@ -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)
--- a/src/redisplay-x.c	Wed Jan 27 06:00:09 2010 -0600
+++ b/src/redisplay-x.c	Thu Jan 28 02:48:45 2010 -0600
@@ -27,485 +27,13 @@
 
 /* Lots of work done by Ben Wing for Mule */
 
-#include <config.h>
-#include "lisp.h"
-
-#include "buffer.h"
-#include "debug.h"
-#include "device-impl.h"
-#include "faces.h"
-#include "file-coding.h"
-#include "frame-impl.h"
-#include "gutter.h"
-#include "redisplay.h"
-#include "sysdep.h"
-#include "window.h"
-
-#include "mule-ccl.h"
-#include "charset.h"
-
-#include "console-x-impl.h"
-#include "glyphs-x.h"
-#include "objects-x-impl.h"
-#include "xgccache.h"
-
-#include "EmacsFrame.h"
-#include "EmacsFrameP.h"
-
-#include "sysproc.h" /* for select() */
-
-#include <X11/bitmaps/gray>
 
 /* Number of pixels below each line. */
 int x_interline_space; /* #### this needs to be implemented, but per-font */
 
-#define EOL_CURSOR_WIDTH	5
-
-static void x_output_vertical_divider (struct window *w, int clear);
-static void x_output_blank (struct window *w, struct display_line *dl,
-			    struct rune *rb, int start_pixpos,
-			    int cursor_start, int cursor_width);
-static void x_output_hline (struct window *w, struct display_line *dl,
-			    struct rune *rb);
-static void x_output_eol_cursor (struct window *w, struct display_line *dl,
-				 int xpos, face_index findex);
-static void x_clear_frame (struct frame *f);
-static void x_clear_frame_windows (Lisp_Object window);
-
-#ifdef USE_XFT
-#define MINL(x,y) ((((unsigned long) (x)) < ((unsigned long) (y))) \
-		   ? ((unsigned long) (x)) : ((unsigned long) (y)))
-#endif /* USE_XFT */
-
-
-     /* Note: We do not use the Xmb*() functions and XFontSets, nor the
-	Motif XFontLists and CompoundStrings.
-	Those functions are generally losing for a number of reasons.
-	Most important, they only support one locale (e.g. you could
-	display Japanese and ASCII text, but not mixed Japanese/Chinese
-	text).  You could maybe call setlocale() frequently to try to deal
-	with this, but that would generally fail because an XFontSet is
-	tied to one locale and won't have the other character sets in it.
-
-	fontconfig (the font database for Xft) has some specifier-like
-	properties, but it's not sufficient (witness the existence of
-	Pango).  Pango might do the trick, but it's not a cross-platform
-	solution; it would need significant advantages to be worth the
-	effort.
-     */
-
-/* #### Break me out into a separate header */
-struct textual_run
-{
-  Lisp_Object charset;
-  unsigned char *ptr;
-  int len;
-  int dimension;
-};
-
-/* Separate out the text in DYN into a series of textual runs of a
-   particular charset.  Also convert the characters as necessary into
-   the format needed by XDrawImageString(), XDrawImageString16(), et
-   al.  This means converting to one or two byte format, possibly
-   tweaking the high bits, and possibly running a CCL program. You
-   must pre-allocate the space used and pass it in. (This is done so
-   you can ALLOCA () the space.)  (sizeof(bufchar) * len) bytes must be
-   allocated for TEXT_STORAGE and (len * sizeof (struct textual_run))
-   bytes of RUN_STORAGE, where LEN is the length of the dynarr.
-
-   bufchar might not be fixed width (in the case of UTF-8).
-
-   Returns the number of runs actually used. */
-
-/* Notes on Xft implementation
-
-   - With Unicode, we're no longer going to have repertoires reified as
-   charsets.  (Not that we ever really did, what with corporate variants,
-   and so on.)  So we really should be querying the face for the desired
-   font, rather than the character for the charset, and that's what would
-   determine the separation into runs.
-   - The widechar versions of fontconfig (and therefore Xft) functions
-   seem to be just bigendian Unicode.  So there's actually no need to use
-   the 8-bit versions in computing runs and runes, it would seem.
-*/
-
-#if !defined(USE_XFT) && !defined(MULE)
-static int
-separate_textual_runs_nomule (unsigned char *text_storage,
-			      struct textual_run *run_storage,
-			      const Ichar *str, Charcount len,
-			      struct face_cachel *UNUSED(cachel))
-{
-  if (!len)
-    return 0;
-
-  run_storage[0].ptr = text_storage;
-  run_storage[0].len = len;
-  run_storage[0].dimension = 1;
-  run_storage[0].charset = Qnil;
-
-  while (len--)
-    *text_storage++ = *str++;
-  return 1;
-}
-#endif
-
-#if defined(USE_XFT) && !defined(MULE)
-/*
-  Note that in this configuration the "Croatian hack" of using an 8-bit,
-  non-Latin-1 font to get localized display without Mule simply isn't
-  available.  That's by design -- Unicode does not aid or abet that kind
-  of punning.
-  This means that the cast to XftChar16 gives the correct "conversion" to
-  UCS-2.
-  #### Is there an alignment issue with text_storage?
-*/
-static int
-separate_textual_runs_xft_nomule (unsigned char *text_storage,
-				  struct textual_run *run_storage,
-				  const Ichar *str, Charcount len,
-				  struct face_cachel *UNUSED(cachel))
-{
-  int i;
-  if (!len)
-    return 0;
-
-  run_storage[0].ptr = text_storage;
-  run_storage[0].len = len;
-  run_storage[0].dimension = 2;
-  run_storage[0].charset = Qnil;
-
-  for (i = 0; i < len; i++)
-    {
-      *(XftChar16 *)text_storage = str[i];
-      text_storage += sizeof(XftChar16);
-    }
-  return 1;
-}
-#endif
-
-#if defined(USE_XFT) && defined(MULE)
-static int
-separate_textual_runs_xft_mule (unsigned char *text_storage,
-				struct textual_run *run_storage,
-				const Ichar *str, Charcount len,
-				struct face_cachel *UNUSED(cachel))
-{
-  Lisp_Object prev_charset = Qunbound;
-  int runs_so_far = 0, i;
-
-  run_storage[0].ptr = text_storage;
-  run_storage[0].len = len;
-  run_storage[0].dimension = 2;
-  run_storage[0].charset = Qnil;
-
-  for (i = 0; i < len; i++)
-    {
-      Ichar ch = str[i];
-      Lisp_Object charset = ichar_charset(ch);
-      int ucs = ichar_to_unicode(ch);
-
-      /* If UCS is less than zero or greater than 0xFFFF, set ucs2 to
-	 REPLACMENT CHARACTER. */
-      /* That means we can't handle characters outside of the BMP for now */
-      ucs = (ucs & ~0xFFFF) ? 0xFFFD : ucs;
-
-      if (!EQ (charset, prev_charset))
-	{
-	  if (runs_so_far)
-	    run_storage[runs_so_far-1].len = (text_storage - run_storage[runs_so_far-1].ptr) >> 1;
-	  run_storage[runs_so_far].ptr = text_storage;
-	  run_storage[runs_so_far].dimension = 2;
-	  run_storage[runs_so_far].charset = charset;
-	  prev_charset = charset;
-	  runs_so_far++;
-	}
-
-      *(XftChar16 *)text_storage = ucs;
-      text_storage += sizeof(XftChar16);
-    }
-
-  if (runs_so_far)
-    run_storage[runs_so_far-1].len = (text_storage - run_storage[runs_so_far-1].ptr) >> 1;
-  return runs_so_far;
-}
-#endif
-
-#if !defined(USE_XFT) && defined(MULE)
-/*
-  This is the most complex function of this group, due to the various
-  indexing schemes used by different fonts.  For our purposes, they
-  fall into three classes.  Some fonts are indexed compatibly with ISO
-  2022; those fonts just use the Mule internal representation directly
-  (typically the high bit must be reset; this is determined by the `graphic'
-  flag).  Some fonts are indexed by Unicode, specifically by UCS-2.  These
-  are all translated using `ichar_to_unicode'.  Finally some fonts have
-  irregular indexes, and must be translated ad hoc.  In XEmacs ad hoc
-  translations are accomplished with CCL programs. */
-static int
-separate_textual_runs_mule (unsigned char *text_storage,
-			    struct textual_run *run_storage,
-			    const Ichar *str, Charcount len,
-			    struct face_cachel *cachel)
-{
-  Lisp_Object prev_charset = Qunbound;
-  int runs_so_far = 0, i;
-  Ibyte charset_leading_byte = LEADING_BYTE_ASCII;
-  int dimension = 1, graphic = 0, need_ccl_conversion = 0;
-  Lisp_Object ccl_prog;
-  struct ccl_program char_converter;
-
-  int translate_to_ucs_2 = 0;
-
-  for (i = 0; i < len; i++)
-    {
-      Ichar ch = str[i];
-      Lisp_Object charset;
-      int byte1, byte2;		/* BREAKUP_ICHAR dereferences the addresses
-				   of its arguments as pointer to int. */
-      BREAKUP_ICHAR (ch, charset, byte1, byte2);
-
-      if (!EQ (charset, prev_charset))
-	{
-	  /* At this point, dimension' and `prev_charset' refer to just-
-	     completed run.  `runs_so_far' and `text_storage' refer to the
-	     run about to start. */
-	  if (runs_so_far)
-	    {
-	      /* Update metadata for previous run. */
-	      run_storage[runs_so_far - 1].len =
-		text_storage - run_storage[runs_so_far - 1].ptr;
-	      if (2 == dimension) run_storage[runs_so_far - 1].len >>= 1;
-	    }
+#define THIS_IS_X
 
-	  /* Compute metadata for current run.
-	     First, classify font.
-	     If the font is indexed by UCS-2, set `translate_to_ucs_2'.
-	     Else if the charset has a CCL program, set `need_ccl_conversion'.
-	     Else if the font is indexed by an ISO 2022 "graphic register",
-	         set `graphic'.
-	     These flags are almost mutually exclusive, but we're sloppy
-	     about resetting "shadowed" flags.  So the flags must be checked
-	     in the proper order in computing byte1 and byte2, below. */
-	  charset_leading_byte = XCHARSET_LEADING_BYTE(charset);
-	  translate_to_ucs_2 =
-	    bit_vector_bit (FACE_CACHEL_FONT_FINAL_STAGE (cachel),
-			    charset_leading_byte - MIN_LEADING_BYTE);
-	  if (translate_to_ucs_2)
-	    {
-	      dimension = 2;
-	    }
-	  else
-	    {
-	      dimension = XCHARSET_DIMENSION (charset);
-
-	      /* Check for CCL charset.
-		 If setup_ccl_program fails, we'll get a garbaged display.
-		 This should never happen, and even if it does, it should
-		 be harmless (unless the X server has buggy handling of
-		 characters undefined in the font).  It may be marginally
-		 more useful to users and debuggers than substituting a
-		 fixed replacement character. */
-	      ccl_prog = XCHARSET_CCL_PROGRAM (charset);
-	      if ((!NILP (ccl_prog))
-		  && (setup_ccl_program (&char_converter, ccl_prog) >= 0))
-		{
-		  need_ccl_conversion = 1;
-		}
-	      else 
-		{
-		  /* The charset must have an ISO 2022-compatible font index.
-		     There are 2 "registers" (what such fonts use as index).
-		     GL (graphic == 0) has the high bit of each octet reset,
-		     GR (graphic == 1) has it set. */
-		  graphic   = XCHARSET_GRAPHIC (charset);
-		  need_ccl_conversion = 0;
-		}
-	    }
-
-	  /* Initialize metadata for current run. */
-	  run_storage[runs_so_far].ptr       = text_storage;
-	  run_storage[runs_so_far].charset   = charset;
-	  run_storage[runs_so_far].dimension = dimension;
-
-	  /* Update loop variables. */
-	  prev_charset = charset;
-	  runs_so_far++;
-	} 
-
-      /* Must check flags in this order.  See comment above. */
-      if (translate_to_ucs_2)
-	{
-	  int ucs = ichar_to_unicode(ch);
-	  /* If UCS is less than zero or greater than 0xFFFF, set ucs2 to
-	     REPLACMENT CHARACTER. */
-	  ucs = (ucs & ~0xFFFF) ? 0xFFFD : ucs;
-
-	  byte1 = ucs >> 8;
-	  byte2 = ucs;
-	}
-      else if (need_ccl_conversion)
-	{
-	  char_converter.reg[0] = charset_leading_byte;
-	  char_converter.reg[1] = byte1;
-	  char_converter.reg[2] = byte2;
-	  ccl_driver (&char_converter, 0, 0, 0, 0, CCL_MODE_ENCODING);
-	  byte1 = char_converter.reg[1];
-	  byte2 = char_converter.reg[2];
-	}
-      else if (graphic == 0)
-	{
-	  byte1 &= 0x7F;
-	  byte2 &= 0x7F;
-	}
-      else
-	{
-	  byte1 |= 0x80;
-	  byte2 |= 0x80;
-	}
-
-      *text_storage++ = (unsigned char)byte1;
-
-      if (2 == dimension) *text_storage++ = (unsigned char)byte2;
-    }
-
-  if (runs_so_far)
-    {
-      run_storage[runs_so_far - 1].len =
-	text_storage - run_storage[runs_so_far - 1].ptr;
-      /* Dimension retains the relevant value for the run before it. */
-      if (2 == dimension)
-	run_storage[runs_so_far - 1].len >>= 1;
-    }
-
-  return runs_so_far;
-}
-#endif
-
-static int
-separate_textual_runs (unsigned char *text_storage,
-		       struct textual_run *run_storage,
-		       const Ichar *str, Charcount len,
-		       struct face_cachel *cachel)
-{
-#if defined(USE_XFT) && defined(MULE)
-  return separate_textual_runs_xft_mule(text_storage, run_storage, str, len, cachel);
-#endif
-#if defined(USE_XFT) && !defined(MULE)
-  return separate_textual_runs_xft_nomule(text_storage, run_storage, str, len, cachel);
-#endif
-#if !defined(USE_XFT) && defined(MULE)
-  return separate_textual_runs_mule(text_storage, run_storage, str, len, cachel);
-#endif
-#if !defined(USE_XFT) && !defined(MULE)
-  return separate_textual_runs_nomule(text_storage, run_storage, str, len, cachel);
-#endif
-}
-
-/****************************************************************************/
-/*                                                                          */
-/*                           X output routines                              */
-/*                                                                          */
-/****************************************************************************/
-
-static int
-x_text_width_single_run (struct frame * USED_IF_XFT (f),
-			 struct face_cachel *cachel, struct textual_run *run)
-{
-  Lisp_Object font_inst = FACE_CACHEL_FONT (cachel, run->charset);
-  Lisp_Font_Instance *fi = XFONT_INSTANCE (font_inst);
-  if (!fi->proportional_p)
-    return fi->width * run->len;
-#ifdef USE_XFT
-  else if (FONT_INSTANCE_X_XFTFONT(fi))
-    {
-      static XGlyphInfo glyphinfo;
-      struct device *d = XDEVICE (f->device);
-      Display *dpy = DEVICE_X_DISPLAY (d);
-
-      if (run->dimension == 2) {
-	XftTextExtents16 (dpy,
-			  FONT_INSTANCE_X_XFTFONT(fi),
-			  (XftChar16 *) run->ptr, run->len, &glyphinfo);
-      } else {
-	XftTextExtents8 (dpy,
-			 FONT_INSTANCE_X_XFTFONT(fi),
-			 run->ptr, run->len, &glyphinfo);
-      }
-    
-      return glyphinfo.xOff;
-    }
-#endif
-  else if (FONT_INSTANCE_X_FONT (fi))
-    {
-      if (run->dimension == 2)
-	return XTextWidth16 (FONT_INSTANCE_X_FONT (fi),
-			     (XChar2b *) run->ptr, run->len);
-      else
-	return XTextWidth (FONT_INSTANCE_X_FONT (fi),
-			   (char *) run->ptr, run->len);
-    }
-  else
-    abort();
-  return 0;			/* shut up GCC */
-}
-
-/*
-   x_text_width
-
-   Given a string and a merged face, return the string's length in pixels
-   when displayed in the fonts associated with the face.
-   */
-
-/* #### Break me out into a separate header */
-int x_text_width (struct frame *f, struct face_cachel *cachel,
-		  const Ichar *str, Charcount len);
-int
-x_text_width (struct frame *f, 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);
-  int nruns;
-  int i;
-
-  nruns = separate_textual_runs (text_storage, runs, str, len, 
-				 cachel);
-
-  for (i = 0; i < nruns; i++)
-    width_so_far += x_text_width_single_run (f, cachel, runs + i);
-
-  return width_so_far;
-}
-
-/*****************************************************************************
- x_divider_height
-
- Return the height of the horizontal divider.  This is a function because
- divider_height is a device method.
-
- #### If we add etched horizontal divider lines this will have to get
- smarter.
- ****************************************************************************/
-static int
-x_divider_height (void)
-{
-  return 1;
-}
-
-/*****************************************************************************
- x_eol_cursor_width
-
- Return the width of the end-of-line cursor.  This is a function
- because eol_cursor_width is a device method.
- ****************************************************************************/
-static int
-x_eol_cursor_width (void)
-{
-  return EOL_CURSOR_WIDTH;
-}
+#include "redisplay-xlike-inc.c"
 
 /*****************************************************************************
  x_window_output_begin
@@ -530,218 +58,6 @@
 }
 
 /*****************************************************************************
- x_output_display_block
-
- Given a display line, a block number for that start line, output all
- runes between start and end in the specified display block.
- ****************************************************************************/
-static void
-x_output_display_block (struct window *w, struct display_line *dl, int block,
-			int start, int end, int start_pixpos, int cursor_start,
-			int cursor_width, int cursor_height)
-{
-#ifndef USE_XFT
-  struct frame *f = XFRAME (w->frame);
-#endif
-  Ichar_dynarr *buf;
-  Lisp_Object window;
-
-  struct display_block *db = Dynarr_atp (dl->display_blocks, block);
-  rune_dynarr *rba = db->runes;
-  struct rune *rb;
-
-  int elt = start;
-  face_index findex;
-  int xpos, width = 0;
-  Lisp_Object charset = Qunbound; /* Qnil is a valid charset when
-				     MULE is not defined */
-
-  window = wrap_window (w);
-  rb = Dynarr_atp (rba, start);
-
-  if (!rb)
-    /* Nothing to do so don't do anything. */
-    return;
-
-  findex = rb->findex;
-  xpos = rb->xpos;
-  if (rb->type == RUNE_CHAR)
-    charset = ichar_charset (rb->object.chr.ch);
-
-  if (end < 0)
-    end = Dynarr_length (rba);
-  buf = Dynarr_new (Ichar);
-
-  while (elt < end)
-    {
-      rb = Dynarr_atp (rba, elt);
-
-      if (rb->findex == findex && rb->type == RUNE_CHAR
-	  && rb->object.chr.ch != '\n' && rb->cursor_type != CURSOR_ON
-	  && EQ (charset, ichar_charset (rb->object.chr.ch)))
-	{
-	  Dynarr_add (buf, rb->object.chr.ch);
-	  width += rb->width;
-	  elt++;
-	}
-      else
-	{
-	  if (Dynarr_length (buf))
-	    {
-	      x_output_string (w, dl, buf, xpos, 0, start_pixpos, width,
-			       findex, 0, cursor_start, cursor_width,
-			       cursor_height);
-	      xpos = rb->xpos;
-	      width = 0;
-	    }
-	  Dynarr_reset (buf);
-	  width = 0;
-
-	  if (rb->type == RUNE_CHAR)
-	    {
-	      findex = rb->findex;
-	      xpos = rb->xpos;
-	      charset = ichar_charset (rb->object.chr.ch);
-
-	      if (rb->cursor_type == CURSOR_ON)
-		{
-		  if (rb->object.chr.ch == '\n')
-		    {
-		      x_output_eol_cursor (w, dl, xpos, findex);
-		    }
-		  else
-		    {
-		      Dynarr_add (buf, rb->object.chr.ch);
-		      x_output_string (w, dl, buf, xpos, 0, start_pixpos,
-				       rb->width, findex, 1,
-				       cursor_start, cursor_width,
-				       cursor_height);
-		      Dynarr_reset (buf);
-		    }
-
-		  xpos += rb->width;
-		  elt++;
-		}
-	      else if (rb->object.chr.ch == '\n')
-		{
-		  /* Clear in case a cursor was formerly here. */
-		  redisplay_clear_region (window, findex, xpos,
-					  DISPLAY_LINE_YPOS (dl),
-					  rb->width,
-					  DISPLAY_LINE_HEIGHT (dl));
-		  elt++;
-		}
-	    }
-	  else if (rb->type == RUNE_BLANK || rb->type == RUNE_HLINE)
-	    {
-	      if (rb->type == RUNE_BLANK)
-		x_output_blank (w, dl, rb, start_pixpos, cursor_start,
-				cursor_width);
-	      else
-		{
-		  /* #### Our flagging of when we need to redraw the
-                     modeline shadows sucks.  Since RUNE_HLINE is only used
-                     by the modeline at the moment it is a good bet
-                     that if it gets redrawn then we should also
-                     redraw the shadows.  This won't be true forever.
-                     We borrow the shadow_thickness_changed flag for
-                     now. */
-		  w->shadow_thickness_changed = 1;
-		  x_output_hline (w, dl, rb);
-		}
-
-	      elt++;
-	      if (elt < end)
-		{
-		  rb = Dynarr_atp (rba, elt);
-
-		  findex = rb->findex;
-		  xpos = rb->xpos;
-		}
-	    }
-	  else if (rb->type == RUNE_DGLYPH)
-	    {
-	      Lisp_Object instance;
-	      struct display_box dbox;
-	      struct display_glyph_area dga;
-
-	      redisplay_calculate_display_boxes (dl, rb->xpos, rb->object.dglyph.xoffset,
-						 rb->object.dglyph.yoffset, start_pixpos,
-                                                 rb->width, &dbox, &dga);
-
-	      window = wrap_window (w);
-	      instance = glyph_image_instance (rb->object.dglyph.glyph,
-					       window, ERROR_ME_DEBUG_WARN, 1);
-	      findex = rb->findex;
-
-	      if (IMAGE_INSTANCEP (instance))
-		{
-		  switch (XIMAGE_INSTANCE_TYPE (instance))
-		    {
-		    case IMAGE_MONO_PIXMAP:
-		    case IMAGE_COLOR_PIXMAP:
-		      redisplay_output_pixmap (w, instance, &dbox, &dga, findex,
-					       cursor_start, cursor_width,
-					       cursor_height, 0);
-		      break;
-
-		    case IMAGE_WIDGET:
-		      if (EQ (XIMAGE_INSTANCE_WIDGET_TYPE (instance),
-			      Qlayout))
-			{
-			  redisplay_output_layout (window, instance, &dbox, &dga, findex,
-						   cursor_start, cursor_width,
-						   cursor_height);
-			  break;
-			}
-		    case IMAGE_SUBWINDOW:
-		      redisplay_output_subwindow (w, instance, &dbox, &dga, findex,
-						  cursor_start, cursor_width,
-						  cursor_height);
-		      break;
-
-		    case IMAGE_NOTHING:
-		      /* nothing is as nothing does */
-		      break;
-
-		    case IMAGE_TEXT:
-		    case IMAGE_POINTER:
-		    default:
-		      ABORT ();
-		    }
-		  IMAGE_INSTANCE_OPTIMIZE_OUTPUT
-		    (XIMAGE_INSTANCE (instance)) = 0;
-		}
-
-	      xpos += rb->width;
-	      elt++;
-	    }
-	  else
-	    ABORT ();
-	}
-    }
-
-  if (Dynarr_length (buf))
-    x_output_string (w, dl, buf, xpos, 0, start_pixpos, width, findex,
-		     0, cursor_start, cursor_width, cursor_height);
-
-  if (dl->modeline
-      && !EQ (Qzero, w->modeline_shadow_thickness)
-#ifndef USE_XFT
-      /* This optimization doesn't work right with some Xft fonts, which
-	 leave antialiasing turds at the boundary.  I don't know if this
-	 is an Xft bug or not, but I think it is.   See x_output_string. */
-      && (f->clear
-	  || f->windows_structure_changed
-	  || w->shadow_thickness_changed)
-#endif
-      )
-    bevel_modeline (w, dl);
-
-  Dynarr_free (buf);
-}
-
-/*****************************************************************************
  x_bevel_area
 
  Draw shadows for the given area in the given face.
@@ -867,1072 +183,6 @@
 }
 
 /*****************************************************************************
- x_get_gc
-
- Given a number of parameters return a GC with those properties.
- ****************************************************************************/
-static GC
-x_get_gc (struct device *d, Lisp_Object font, Lisp_Object fg, Lisp_Object bg,
-	  Lisp_Object bg_pmap, Lisp_Object lwidth)
-{
-  XGCValues gcv;
-  unsigned long mask;
-
-  memset (&gcv, ~0, sizeof (XGCValues));
-  gcv.graphics_exposures = False;
-  /* Make absolutely sure that we don't pick up a clipping region in
-     the GC returned by this function. */
-  gcv.clip_mask = None;
-  gcv.clip_x_origin = 0;
-  gcv.clip_y_origin = 0;
-  gcv.fill_style = FillSolid;
-  mask = GCGraphicsExposures | GCClipMask | GCClipXOrigin | GCClipYOrigin;
-  mask |= GCFillStyle;
-
-  if (!NILP (font)
-#ifdef USE_XFT
-      /* Only set the font if it's a core font */
-      /* the renderfont will be set elsewhere (not part of gc) */
-      && !FONT_INSTANCE_X_XFTFONT (XFONT_INSTANCE (font))
-#endif
-      )
-    {
-      gcv.font = FONT_INSTANCE_X_FONT (XFONT_INSTANCE (font))->fid;
-      mask |= GCFont;
-    }
-
-  /* evil kludge! */
-  if (!NILP (fg) && !COLOR_INSTANCEP (fg) && !INTP (fg))
-    {
-      /* #### I fixed one case where this was getting hit.  It was a
-         bad macro expansion (compiler bug). */
-      stderr_out ("Help! x_get_gc got a bogus fg value! fg = ");
-      debug_print (fg);
-      fg = Qnil;
-    }
-
-  if (!NILP (fg))
-    {
-      if (COLOR_INSTANCEP (fg))
-	gcv.foreground = COLOR_INSTANCE_X_COLOR (XCOLOR_INSTANCE (fg)).pixel;
-      else
-	gcv.foreground = XINT (fg);
-      mask |= GCForeground;
-    }
-
-  if (!NILP (bg))
-    {
-      if (COLOR_INSTANCEP (bg))
-	gcv.background = COLOR_INSTANCE_X_COLOR (XCOLOR_INSTANCE (bg)).pixel;
-      else
-	gcv.background = XINT (bg);
-      mask |= GCBackground;
-    }
-
-  /* This special case comes from a request to draw text with a face which has
-     the dim property. We'll use a stippled foreground GC. */
-  if (EQ (bg_pmap, Qdim))
-    {
-      assert (DEVICE_X_GRAY_PIXMAP (d) != None);
-
-      gcv.fill_style = FillStippled;
-      gcv.stipple = DEVICE_X_GRAY_PIXMAP (d);
-      mask |= (GCFillStyle | GCStipple);
-    }
-  else  if (IMAGE_INSTANCEP (bg_pmap)
-	    && IMAGE_INSTANCE_PIXMAP_TYPE_P (XIMAGE_INSTANCE (bg_pmap)))
-    {
-      if (XIMAGE_INSTANCE_PIXMAP_DEPTH (bg_pmap) == 0)
-	{
-	  gcv.fill_style = FillOpaqueStippled;
-	  gcv.stipple = XIMAGE_INSTANCE_X_PIXMAP (bg_pmap);
-	  mask |= (GCStipple | GCFillStyle);
-	}
-      else
-	{
-	  gcv.fill_style = FillTiled;
-	  gcv.tile = XIMAGE_INSTANCE_X_PIXMAP (bg_pmap);
-	  mask |= (GCTile | GCFillStyle);
-	}
-    }
-
-  if (!NILP (lwidth))
-    {
-      gcv.line_width = XINT (lwidth);
-      mask |= GCLineWidth;
-    }
-
-#if 0
-  debug_out ("\nx_get_gc: calling gc_cache_lookup\n");
-#endif
-  return gc_cache_lookup (DEVICE_X_GC_CACHE (d), &gcv, mask);
-}
-
-/*****************************************************************************
- x_output_string
-
- Given a string and a starting position, output that string in the
- given face.  If cursor is true, draw a cursor around the string.
- Correctly handles multiple charsets in the string.
-
- The meaning of the parameters is something like this:
-
- W		Window that the text is to be displayed in.
- DL		Display line that this text is on.  The values in the
- 		structure are used to determine the vertical position and
-		clipping range of the text.
- BUF		Dynamic array of Ichars specifying what is actually to be
-		drawn.
- XPOS		X position in pixels where the text should start being drawn.
- XOFFSET	Number of pixels to be chopped off the left side of the
- 		text.  The effect is as if the text were shifted to the
-		left this many pixels and clipped at XPOS.
- CLIP_START	Clip everything left of this X position.
- WIDTH		Clip everything right of XPOS + WIDTH.
- FINDEX		Index for the face cache element describing how to display
- 		the text.
- CURSOR		#### I don't understand this.  There's something
- 		strange and overcomplexified with this variable.
-		Chuck, explain please?
- CURSOR_START	Starting X position of cursor.
- CURSOR_WIDTH	Width of cursor in pixels.
- CURSOR_HEIGHT	Height of cursor in pixels.
-
- Starting Y position of cursor is the top of the text line.
- The cursor is drawn sometimes whether or not CURSOR is set. ???
- ****************************************************************************/
-void
-x_output_string (struct window *w, struct display_line *dl,
-		 Ichar_dynarr *buf, int xpos, int xoffset, int clip_start,
-		 int width, face_index findex, int cursor,
-		 int cursor_start, int cursor_width, int cursor_height)
-{
-  /* General variables */
-  struct frame *f = XFRAME (w->frame);
-  struct device *d = XDEVICE (f->device);
-  Lisp_Object window = wrap_window (w);
-  Display *dpy = DEVICE_X_DISPLAY (d);
-  Window x_win = XtWindow (FRAME_X_TEXT_WIDGET (f));
-
-  int clip_end;
-
-  /* Cursor-related variables */
-  int focus = EQ (w->frame, DEVICE_FRAME_WITH_FOCUS_REAL (d));
-  int cursor_clip;
-  Lisp_Object bar_cursor_value = symbol_value_in_buffer (Qbar_cursor,
-							 WINDOW_BUFFER (w));
-  struct face_cachel *cursor_cachel = 0;
-
-  /* Text-related variables */
-  Lisp_Object bg_pmap;
-  GC bgc, gc;
-  int height = DISPLAY_LINE_HEIGHT (dl);
-  int ypos = DISPLAY_LINE_YPOS (dl);
-  int len = Dynarr_length (buf);
-  unsigned char *text_storage = (unsigned char *) ALLOCA (2 * len);
-  struct textual_run *runs = alloca_array (struct textual_run, len);
-  int nruns;
-  int i;
-  struct face_cachel *cachel = WINDOW_FACE_CACHEL (w, findex);
-
-  int use_x_font = 1;		/* #### bogus!!
-				   The logic of this function needs review! */
-#ifdef USE_XFT
-  Colormap cmap = DEVICE_X_COLORMAP (d);
-  Visual *visual = DEVICE_X_VISUAL (d);
-  static XftColor fg, bg;
-  XftDraw *xftDraw;
-
-  /* Lazily initialize frame's xftDraw member. */
-  if (!FRAME_X_XFTDRAW (f)) {
-    FRAME_X_XFTDRAW (f) = XftDrawCreate (dpy, x_win, visual, cmap);
-  }
-  xftDraw = FRAME_X_XFTDRAW (f);
-
-  /* #### This will probably cause asserts when passed a Lisp integer for a
-     color.  See ca. line 759 this file.
-     #### Maybe xft_convert_color should take an XColor, not a pixel. */
-#define XFT_FROB_LISP_COLOR(color, dim) \
-  xft_convert_color (dpy, cmap, visual, \
-		     COLOR_INSTANCE_X_COLOR (XCOLOR_INSTANCE (color)).pixel, \
-		     (dim))
-#endif
-
-  if (width < 0)
-    width = x_text_width (f, cachel, Dynarr_atp (buf, 0), Dynarr_length (buf));
-
-  /* Regularize the variables passed in. */
-
-  if (clip_start < xpos)
-    clip_start = xpos;
-  clip_end = xpos + width;
-  if (clip_start >= clip_end)
-    /* It's all clipped out. */
-    return;
-
-  xpos -= xoffset;
-
-  /* make sure the area we are about to display is subwindow free. */
-  redisplay_unmap_subwindows_maybe (f, clip_start, ypos,
-				    clip_end - clip_start, height);
-
-  cursor_clip = (cursor_start >= clip_start &&
-		 cursor_start < clip_end);
-
-  /* This cursor code is really a mess. */
-  if (!NILP (w->text_cursor_visible_p)
-      && (cursor
-	  || cursor_clip
-	  || (cursor_width
-	      && (cursor_start + cursor_width >= clip_start)
-	      && !NILP (bar_cursor_value))))
-    {
-      /* These have to be in separate statements in order to avoid a
-         compiler bug. */
-      face_index sucks = get_builtin_face_cache_index (w, Vtext_cursor_face);
-      cursor_cachel = WINDOW_FACE_CACHEL (w, sucks);
-
-      /* We have to reset this since any call to WINDOW_FACE_CACHEL
-         may cause the cache to resize and any pointers to it to
-         become invalid. */
-      cachel = WINDOW_FACE_CACHEL (w, findex);
-    }
-
-#ifdef HAVE_XIM
-  if (cursor && focus && (cursor_start == clip_start) && cursor_height)
-    XIM_SetSpotLocation (f, xpos - 2, dl->ypos + dl->descent - 2);
-#endif /* HAVE_XIM */
-
-  bg_pmap = cachel->background_pixmap;
-  if (!IMAGE_INSTANCEP (bg_pmap)
-      || !IMAGE_INSTANCE_PIXMAP_TYPE_P (XIMAGE_INSTANCE (bg_pmap)))
-    bg_pmap = Qnil;
-
-  if ((cursor && focus && NILP (bar_cursor_value)
-       && !NILP (w->text_cursor_visible_p)) || NILP (bg_pmap))
-    bgc = 0;
-  else
-    {
-      bgc = x_get_gc (d, Qnil, cachel->foreground, cachel->background,
-		      bg_pmap, Qnil);
-    }
-
-  if (bgc)
-    {
-      XFillRectangle (dpy, x_win, bgc, clip_start,
-		      ypos, clip_end - clip_start,
-		      height);
-    }
-
-  nruns = separate_textual_runs (text_storage, runs, Dynarr_atp (buf, 0),
-				 Dynarr_length (buf), cachel);
-
-  for (i = 0; i < nruns; i++)
-    {
-      Lisp_Object font = FACE_CACHEL_FONT (cachel, runs[i].charset);
-      Lisp_Font_Instance *fi = XFONT_INSTANCE (font);
-      int this_width;
-      int need_clipping;
-
-      if (EQ (font, Vthe_null_font_instance))
-	continue;
-
-      this_width = x_text_width_single_run (f, cachel, runs + i);
-      need_clipping = (dl->clip || clip_start > xpos ||
-		       clip_end < xpos + this_width);
-
-      /* XDrawImageString only clears the area equal to the height of
-	 the given font.  It is possible that a font is being displayed
-	 on a line taller than it is, so this would cause us to fail to
-	 clear some areas. */
-      if ((int) fi->height < (int) (height + dl->clip + dl->top_clip))
-	{
-	  int clear_start = max (xpos, clip_start);
-	  int clear_end = min (xpos + this_width, clip_end);
-
-	  if (cursor)
-	    {
-	      int ypos1_line, ypos1_string, ypos2_line, ypos2_string;
-
-	      ypos1_string = dl->ypos - fi->ascent;
-	      ypos2_string = dl->ypos + fi->descent;
-	      ypos1_line = ypos;
-	      ypos2_line = ypos1_line + height;
-
-	      /* Make sure we don't clear below the real bottom of the
-		 line. */
-	      if (ypos1_string > ypos2_line)
-		ypos1_string = ypos2_line;
-	      if (ypos2_string > ypos2_line)
-		ypos2_string = ypos2_line;
-
-	      if (ypos1_line < ypos1_string)
-		{
-		  redisplay_clear_region (window, findex, clear_start, ypos1_line,
-				  clear_end - clear_start,
-				  ypos1_string - ypos1_line);
-		}
-
-	      if (ypos2_line > ypos2_string)
-		{
-		  redisplay_clear_region (window, findex, clear_start, ypos2_string,
-				  clear_end - clear_start,
-				  ypos2_line - ypos2_string);
-		}
-	    }
-	  else
-	    {
-	      redisplay_clear_region (window, findex, clear_start,
-			      ypos, clear_end - clear_start,
-			      height);
-	    }
-	}
-
-      if (cursor && cursor_cachel && focus && NILP (bar_cursor_value))
-	{
-#ifdef USE_XFT
-	  fg = XFT_FROB_LISP_COLOR (cursor_cachel->foreground, 0);
-	  bg = XFT_FROB_LISP_COLOR (cursor_cachel->background, 0);
-#endif
-	  gc = x_get_gc (d, font, cursor_cachel->foreground,
-			 cursor_cachel->background, Qnil, Qnil);
-	}
-      else if (cachel->dim)
-	{
-	  /* Ensure the gray bitmap exists */
-	  if (DEVICE_X_GRAY_PIXMAP (d) == None)
-	    DEVICE_X_GRAY_PIXMAP (d) =
-	      XCreateBitmapFromData (dpy, x_win, (char *)gray_bits,
-				     gray_width, gray_height);
-
-	  /* Request a GC with the gray stipple pixmap to draw dimmed text */
-#ifdef USE_XFT
-	  fg = XFT_FROB_LISP_COLOR (cachel->foreground, 1);
-	  bg = XFT_FROB_LISP_COLOR (cachel->background, 0);
-#endif
-	  gc = x_get_gc (d, font, cachel->foreground, cachel->background,
-			 Qdim, Qnil);
-	}
-      else
-	{
-#ifdef USE_XFT
-	  fg = XFT_FROB_LISP_COLOR (cachel->foreground, 0);
-	  bg = XFT_FROB_LISP_COLOR (cachel->background, 0);
-#endif
-	  gc = x_get_gc (d, font, cachel->foreground, cachel->background,
-			 Qnil, Qnil);
-	}
-#ifdef USE_XFT
-      {
-	XftFont *rf = FONT_INSTANCE_X_XFTFONT (fi);
-
-	if (rf)
-	  {
-	    use_x_font = 0;
-	    if (need_clipping)
-	      {
-		Region clip_reg = XCreateRegion();
-		XRectangle clip_box = { clip_start, ypos,
-					clip_end - clip_start, height };
-
-		XUnionRectWithRegion (&clip_box, clip_reg, clip_reg); 
-		XftDrawSetClip(xftDraw, clip_reg);
-		XDestroyRegion(clip_reg);
-	      }
-
-	    if (!bgc)
-	      {
-		/* #### Neither rect_height nor XftTextExtents as computed
-		   below handles the vertical space taken up by antialiasing,
-		   which for some fonts (eg, Bitstream Vera Sans Mono-16 on
-		   my Mac PowerBook G4) leaves behind orphaned dots on
-		   insertion or deletion earlier in the line, especially in
-		   the case of the underscore character.
-		   Interestingly, insertion or deletion of a single character
-		   immediately after a refresh does not leave any droppings,
-		   but any further insertions or deletions do.
-		   While adding a pixel to rect_height (mostly) takes care of
-		   this, it trashes aggressively laid-out elements like the
-		   modeline (overwriting part of the bevel).
-		   OK, unconditionally redraw the bevel, and increment
-		   rect_height by 1.  See x_output_display_block. -- sjt */
-		struct textual_run *run = &runs[i];
-		int rect_width = x_text_width_single_run (f, cachel, run);
-#ifndef USE_XFTTEXTENTS_TO_AVOID_FONT_DROPPINGS
-		int rect_height = FONT_INSTANCE_ASCENT(fi)
-				  + FONT_INSTANCE_DESCENT(fi) + 1;
-#else
-		int rect_height = FONT_INSTANCE_ASCENT(fi)
-				  + FONT_INSTANCE_DESCENT(fi);
-		XGlyphInfo gi;
-		if (run->dimension == 2) {
-		  XftTextExtents16 (dpy,
-				    FONT_INSTANCE_X_XFTFONT(fi),
-				    (XftChar16 *) run->ptr, run->len, &gi);
-		} else {
-		  XftTextExtents8 (dpy,
-				   FONT_INSTANCE_X_XFTFONT(fi),
-				   run->ptr, run->len, &gi);
-		}
-		rect_height = rect_height > gi.height
-			      ? rect_height : gi.height;
-#endif
-
-		XftDrawRect (xftDraw, &bg,
-			     xpos, ypos, rect_width, rect_height);
-	      }
-	
-	    if (runs[i].dimension == 1)
-	      XftDrawString8 (xftDraw, &fg, rf, xpos, dl->ypos,
-			      runs[i].ptr, runs[i].len);
-	    else
-	      XftDrawString16 (xftDraw, &fg, rf, xpos, dl->ypos,
-			       (XftChar16 *) runs[i].ptr, runs[i].len);
-	  }
-      }
-#endif
-      {
-	if (use_x_font)
-	  {
-	    if (need_clipping)
-	      {
-		XRectangle clip_box[1];
-
-		clip_box[0].x = 0;
-		clip_box[0].y = 0;
-		clip_box[0].width = clip_end - clip_start;
-		clip_box[0].height = height;
-
-		XSetClipRectangles (dpy, gc, clip_start, ypos,
-				    clip_box, 1, YXBanded);
-	      }
-
-	    if (runs[i].dimension == 1)
-	      (bgc ? XDrawString : XDrawImageString)
-		(dpy, x_win, gc, xpos, dl->ypos,
-		 (char *) runs[i].ptr, runs[i].len);
-	    else
-	      (bgc ? XDrawString16 : XDrawImageString16)
-		(dpy, x_win, gc, xpos, dl->ypos,
-		 (XChar2b *) runs[i].ptr, runs[i].len);
-	  }
-      }
-
-      /* We draw underlines in the same color as the text. */
-      if (cachel->underline)
-	{
-	  int upos, uthick;
-	  unsigned long upos_ext, uthick_ext;
-	  XFontStruct *fs =
-	    use_x_font ? FONT_INSTANCE_X_FONT (XFONT_INSTANCE (font)) : 0;
-	  /* #### the logic of the next two may be suboptimal: we may want
-	     to use the POSITION and/or THICKNESS information with Xft */
-	  if (fs && XGetFontProperty (fs, XA_UNDERLINE_POSITION, &upos_ext))
-	    upos = (int) upos_ext;
-	  else
-	    upos = dl->descent / 2;
-	  if (fs && XGetFontProperty (fs, XA_UNDERLINE_THICKNESS, &uthick_ext))
-	    uthick = (int) uthick_ext;
-	  else
-	    uthick = 1;
-	  if (dl->ypos + upos < dl->ypos + dl->descent - dl->clip)
-	    {
-	      if (dl->ypos + upos + uthick > dl->ypos + dl->descent - dl->clip)
-		uthick = dl->descent - dl->clip - upos;
-
-	      if (uthick == 1)
-		{
-		  XDrawLine (dpy, x_win, gc, xpos, dl->ypos + upos,
-			     xpos + this_width, dl->ypos + upos);
-		}
-	      else if (uthick > 1)
-		{
-		  XFillRectangle (dpy, x_win, gc, xpos,
-				  dl->ypos + upos, this_width, uthick);
-		}
-	    }
-	}
-
-      if (cachel->strikethru)
-	{
-	  int ascent, descent, upos, uthick;
-	  unsigned long ascent_ext, descent_ext, uthick_ext;
-	  XFontStruct *fs = FONT_INSTANCE_X_FONT (fi);
-	  
-	  if (!use_x_font)
-	    {
-	      ascent = dl->ascent;
-	      descent = dl->descent;
-	      uthick = 1;
-	    }
-	  else
-	    {
-	      if (!XGetFontProperty (fs, XA_STRIKEOUT_ASCENT, &ascent_ext))
-		ascent = fs->ascent;
-	      else
-		ascent = (int) ascent_ext;
-	      if (!XGetFontProperty (fs, XA_STRIKEOUT_DESCENT, &descent_ext))
-		descent = fs->descent;
-	      else
-		descent = (int) descent_ext;
-	      if (!XGetFontProperty (fs, XA_UNDERLINE_THICKNESS, &uthick_ext))
-		uthick = 1;
-	      else
-		uthick = (int) uthick_ext;
-	    }
-
-	  upos = ascent - ((ascent + descent) / 2) + 1;
-
-	  /* Generally, upos will be positive (above the baseline),so
-             subtract */
-	  if (dl->ypos - upos < dl->ypos + dl->descent - dl->clip)
-	    {
-	      if (dl->ypos - upos + uthick > dl->ypos + dl->descent - dl->clip)
-		uthick = dl->descent - dl->clip + upos;
-
-	      if (uthick == 1)
-		XDrawLine (dpy, x_win, gc, xpos, dl->ypos - upos,
-			   xpos + this_width, dl->ypos - upos);
-	      else if (uthick > 1)
-		XFillRectangle (dpy, x_win, gc, xpos, dl->ypos + upos,
-				this_width, uthick);
-	    }
-	}
-
-      /* Restore the GC */
-      if (need_clipping)
-	{
-#ifdef USE_XFT
-	  if (!use_x_font)
-	    {
-	      XftDrawSetClip(xftDraw, 0);
-	    }
-	  else
-	    {
-#endif
-	      XSetClipMask (dpy, gc, None);
-	      XSetClipOrigin (dpy, gc, 0, 0);
-#ifdef USE_XFT
-	    }
-#endif
-	}
-
-      /* If we are actually superimposing the cursor then redraw with just
-	 the appropriate section highlighted. */
-      if (cursor_clip && !cursor && focus && cursor_cachel)
-	{
-#ifdef USE_XFT
-	  if (!use_x_font)	/* Xft */
-	    {
-	      XftFont *rf = FONT_INSTANCE_X_XFTFONT (fi);
-	  
-	      { /* set up clipping */
-		Region clip_reg = XCreateRegion();
-		XRectangle clip_box = { cursor_start, ypos,
-					cursor_width, height };
-	    
-		XUnionRectWithRegion (&clip_box, clip_reg, clip_reg); 
-		XftDrawSetClip(xftDraw, clip_reg);
-		XDestroyRegion(clip_reg);
-	      }
-	      { /* draw background rectangle & draw text */
-		int rect_height = FONT_INSTANCE_ASCENT(fi)
-				  + FONT_INSTANCE_DESCENT(fi);
-		int rect_width = x_text_width_single_run(f, cachel, &runs[i]);
-		XftColor xft_color;
-
-		xft_color = XFT_FROB_LISP_COLOR (cursor_cachel->background, 0);
-		XftDrawRect (xftDraw, &xft_color,
-			     xpos, ypos, rect_width, rect_height);
-
-		xft_color = XFT_FROB_LISP_COLOR (cursor_cachel->foreground, 0);
-		if (runs[i].dimension == 1)
-		  XftDrawString8 (xftDraw, &xft_color, rf, xpos, dl->ypos,
-				  runs[i].ptr, runs[i].len);
-		else
-		  XftDrawString16 (xftDraw, &xft_color, rf, xpos, dl->ypos,
-				   (XftChar16 *) runs[i].ptr, runs[i].len);
-	      }
-
-	      XftDrawSetClip(xftDraw, 0);
-	    }
-	  else			/* core font, not Xft */
-	    {
-#endif
-	      GC cgc;
-	      XRectangle clip_box[1];
-	
-	      cgc = x_get_gc (d, font, cursor_cachel->foreground,
-			      cursor_cachel->background, Qnil, Qnil);
-
-	      clip_box[0].x = 0;
-	      clip_box[0].y = 0;
-	      clip_box[0].width = cursor_width;
-	      clip_box[0].height = height;
-	
-	      XSetClipRectangles (dpy, cgc, cursor_start, ypos,
-				  clip_box, 1, YXBanded);
-	      if (runs[i].dimension == 1)
-		XDrawImageString (dpy, x_win, cgc, xpos, dl->ypos,
-				  (char *) runs[i].ptr, runs[i].len);
-	      else
-		XDrawImageString16 (dpy, x_win, cgc, xpos, dl->ypos,
-				    (XChar2b *) runs[i].ptr, runs[i].len);
-	
-	      XSetClipMask (dpy, cgc, None);
-	      XSetClipOrigin (dpy, cgc, 0, 0);
-#ifdef USE_XFT
-	    }
-#endif
-	}
-
-      xpos += this_width;
-    }
-
-  /* Draw the non-focus box or bar-cursor as needed. */
-  /* Can't this logic be simplified? */
-  if (cursor_cachel
-      && ((cursor && !focus && NILP (bar_cursor_value))
-	  || (cursor_width
-	      && (cursor_start + cursor_width >= clip_start)
-	      && !NILP (bar_cursor_value))))
-    {
-      int tmp_height, tmp_y;
-      int bar_width = EQ (bar_cursor_value, Qt) ? 1 : 2;
-      int need_clipping = (cursor_start < clip_start
-			   || clip_end < cursor_start + cursor_width);
-
-      /* #### This value is correct (as far as I know) because
-	 all of the times we need to draw this cursor, we will
-	 be called with exactly one character, so we know we
-	 can always use runs[0].
-
-	 This is bogus as all hell, however.  The cursor handling in
-	 this function is way bogus and desperately needs to be
-	 cleaned up.  (In particular, the drawing of the cursor should
-	 really really be separated out of this function.  This may be
-	 a bit tricky now because this function itself does way too
-	 much stuff, a lot of which needs to be moved into
-	 redisplay.c.)  This is the only way to be able to easily add
-	 new cursor types or (e.g.) make the bar cursor be able to
-	 span two characters instead of overlaying just one. */
-      int bogusly_obtained_ascent_value =
-	XFONT_INSTANCE (FACE_CACHEL_FONT (cachel, runs[0].charset))->ascent;
-
-      if (!NILP (bar_cursor_value))
-	{
-	  gc = x_get_gc (d, Qnil, cursor_cachel->background, Qnil, Qnil,
-			 make_int (bar_width));
-	}
-      else
-	{
-	  gc = x_get_gc (d, Qnil, cursor_cachel->background,
-			 Qnil, Qnil, Qnil);
-	}
-
-      tmp_y = dl->ypos - bogusly_obtained_ascent_value;
-      tmp_height = cursor_height;
-      if (tmp_y + tmp_height > (int) (ypos + height))
-	{
-	  tmp_y = ypos + height - tmp_height;
-	  if (tmp_y < (int) ypos)
-	    tmp_y = ypos;
-	  tmp_height = ypos + height - tmp_y;
-	}
-
-      if (need_clipping)
-	{
-	  XRectangle clip_box[1];
-	  clip_box[0].x = 0;
-	  clip_box[0].y = 0;
-	  clip_box[0].width = clip_end - clip_start;
-	  clip_box[0].height = tmp_height;
-	  XSetClipRectangles (dpy, gc, clip_start, tmp_y,
-			      /* #### why not Unsorted? */
-			      clip_box, 1, YXBanded);
-	}
-
-      if (!focus && NILP (bar_cursor_value))
-	{
-	  XDrawRectangle (dpy, x_win, gc, cursor_start, tmp_y,
-			  cursor_width - 1, tmp_height - 1);
-	}
-      else if (focus && !NILP (bar_cursor_value))
-	{
-	  XDrawLine (dpy, x_win, gc, cursor_start + bar_width - 1, tmp_y,
-		     cursor_start + bar_width - 1, tmp_y + tmp_height - 1);
-	}
-
-      /* Restore the GC */
-      if (need_clipping)
-	{
-	  XSetClipMask (dpy, gc, None);
-	  XSetClipOrigin (dpy, gc, 0, 0);
-	}
-    }
-
-#ifdef USE_XFT
-#undef XFT_FROB_LISP_COLOR
-#endif
-
-}
-
-void
-x_output_x_pixmap (struct frame *f, Lisp_Image_Instance *p, int x,
-		   int y, int xoffset, int yoffset,
-		   int width, int height, unsigned long fg, unsigned long bg,
-		   GC override_gc)
-{
-  struct device *d = XDEVICE (f->device);
-  Display *dpy = DEVICE_X_DISPLAY (d);
-  Window x_win = XtWindow (FRAME_X_TEXT_WIDGET (f));
-
-  GC gc;
-  XGCValues gcv;
-  unsigned long pixmap_mask;
-
-  if (!override_gc)
-    {
-      memset (&gcv, ~0, sizeof (XGCValues));
-      gcv.graphics_exposures = False;
-      gcv.foreground = fg;
-      gcv.background = bg;
-      pixmap_mask = GCForeground | GCBackground | GCGraphicsExposures;
-
-      if (IMAGE_INSTANCE_X_MASK (p))
-	{
-	  gcv.function = GXcopy;
-	  gcv.clip_mask = IMAGE_INSTANCE_X_MASK (p);
-	  gcv.clip_x_origin = x - xoffset;
-	  gcv.clip_y_origin = y - yoffset;
-	  pixmap_mask |= (GCFunction | GCClipMask | GCClipXOrigin |
-			  GCClipYOrigin);
-	  /* Can't set a clip rectangle because we already have a mask.
-	     Is it possible to get an equivalent effect by changing the
-	     args to XCopyArea below rather than messing with a clip box?
-	     - dkindred@cs.cmu.edu
-	     Yes. We don't clip at all now - andy@xemacs.org
-	  */
-	}
-
-      gc = gc_cache_lookup (DEVICE_X_GC_CACHE (d), &gcv, pixmap_mask);
-    }
-  else
-    {
-      gc = override_gc;
-      /* override_gc might have a mask already--we don't want to nuke it.
-	 Maybe we can insist that override_gc have no mask, or use
-	 one of the suggestions above. */
-    }
-
-  /* depth of 0 means it's a bitmap, not a pixmap, and we should use
-     XCopyPlane (1 = current foreground color, 0 = background) instead
-     of XCopyArea, which means that the bits in the pixmap are actual
-     pixel values, instead of symbolic of fg/bg. */
-  if (IMAGE_INSTANCE_PIXMAP_DEPTH (p) > 0)
-    {
-      XCopyArea (dpy,
-		 IMAGE_INSTANCE_X_PIXMAP_SLICE
-		 (p, IMAGE_INSTANCE_PIXMAP_SLICE (p)), x_win, gc, xoffset,
-		 yoffset, width,
-		 height, x, y);
-    }
-  else
-    {
-      XCopyPlane (dpy, IMAGE_INSTANCE_X_PIXMAP_SLICE
-		  (p, IMAGE_INSTANCE_PIXMAP_SLICE (p)), x_win, gc,
-		  xoffset, yoffset, width, height, x, y, 1L);
-    }
-}
-
-static void
-x_output_pixmap (struct window *w, Lisp_Object image_instance,
-		 struct display_box *db, struct display_glyph_area *dga,
-		 face_index findex, int cursor_start, int cursor_width,
-		 int cursor_height, int UNUSED (bg_pixmap))
-{
-  struct frame *f = XFRAME (w->frame);
-  struct device *d = XDEVICE (f->device);
-  Lisp_Image_Instance *p = XIMAGE_INSTANCE (image_instance);
-
-  Display *dpy = DEVICE_X_DISPLAY (d);
-  Window x_win = XtWindow (FRAME_X_TEXT_WIDGET (f));
-
-  /* Output the pixmap. */
-  {
-    Lisp_Object tmp_pixel;
-    XColor tmp_bcolor, tmp_fcolor;
-
-    tmp_pixel = WINDOW_FACE_CACHEL_FOREGROUND (w, findex);
-    tmp_fcolor = COLOR_INSTANCE_X_COLOR (XCOLOR_INSTANCE (tmp_pixel));
-    tmp_pixel = WINDOW_FACE_CACHEL_BACKGROUND (w, findex);
-    tmp_bcolor = COLOR_INSTANCE_X_COLOR (XCOLOR_INSTANCE (tmp_pixel));
-
-    x_output_x_pixmap (f, p, db->xpos, db->ypos,
-		       dga->xoffset, dga->yoffset,
-		       dga->width, dga->height,
-		       tmp_fcolor.pixel, tmp_bcolor.pixel, 0);
-  }
-
-  /* Draw a cursor over top of the pixmap. */
-  if (cursor_width && cursor_height && (cursor_start >= db->xpos)
-      && !NILP (w->text_cursor_visible_p)
-      && (cursor_start < db->xpos + dga->width))
-    {
-      GC gc;
-      int focus = EQ (w->frame, DEVICE_FRAME_WITH_FOCUS_REAL (d));
-      struct face_cachel *cursor_cachel =
-	WINDOW_FACE_CACHEL (w,
-			    get_builtin_face_cache_index
-			    (w, Vtext_cursor_face));
-
-      gc = x_get_gc (d, Qnil, cursor_cachel->background, Qnil, Qnil, Qnil);
-
-      if (cursor_width > db->xpos + dga->width - cursor_start)
-	cursor_width = db->xpos + dga->width - cursor_start;
-
-      if (focus)
-	{
-	  XFillRectangle (dpy, x_win, gc, cursor_start, db->ypos, cursor_width,
-			  cursor_height);
-	}
-      else
-	{
-	  XDrawRectangle (dpy, x_win, gc, cursor_start, db->ypos, cursor_width,
-			  cursor_height);
-	}
-    }
-}
-
-/*****************************************************************************
- x_output_vertical_divider
-
- Draw a vertical divider down the right side of the given window.
- ****************************************************************************/
-static void
-x_output_vertical_divider (struct window *w, int clear)
-{
-  struct frame *f = XFRAME (w->frame);
-  struct device *d = XDEVICE (f->device);
-
-  Display *dpy = DEVICE_X_DISPLAY (d);
-  Window x_win = XtWindow (FRAME_X_TEXT_WIDGET (f));
-  Lisp_Object tmp_pixel;
-  XColor tmp_color;
-  XGCValues gcv;
-  GC background_gc;
-  enum edge_style style;
-
-  unsigned long mask;
-  int x, y1, y2, width, shadow_thickness, spacing, line_width;
-  face_index div_face =
-    get_builtin_face_cache_index (w, Vvertical_divider_face);
-
-  width = window_divider_width (w);
-  shadow_thickness = XINT (w->vertical_divider_shadow_thickness);
-  spacing = XINT (w->vertical_divider_spacing);
-  line_width = XINT (w->vertical_divider_line_width);
-  x = WINDOW_RIGHT (w) - width;
-  y1 = WINDOW_TOP (w);
-  y2 = WINDOW_BOTTOM (w);
-
-  memset (&gcv, ~0, sizeof (XGCValues));
-
-  tmp_pixel = WINDOW_FACE_CACHEL_BACKGROUND (w, div_face);
-  tmp_color = COLOR_INSTANCE_X_COLOR (XCOLOR_INSTANCE (tmp_pixel));
-
-  /* First, get the GC's. */
-  gcv.background = tmp_color.pixel;
-  gcv.foreground = tmp_color.pixel;
-  gcv.graphics_exposures = False;
-  mask = GCForeground | GCBackground | GCGraphicsExposures;
-  background_gc = gc_cache_lookup (DEVICE_X_GC_CACHE (d), &gcv, mask);
-
-  /* Clear the divider area first.  This needs to be done when a
-     window split occurs. */
-  if (clear)
-    XClearArea (dpy, x_win, x, y1, width, y2 - y1, False);
-
-  /* Draw the divider line. */
-  XFillRectangle (dpy, x_win, background_gc,
-		  x + spacing + shadow_thickness, y1,
-		  line_width, y2 - y1);
-
-  if (shadow_thickness < 0)
-    {
-      shadow_thickness = -shadow_thickness;
-      style = EDGE_BEVEL_IN;
-    }
-  else
-    {
-      style = EDGE_BEVEL_OUT;
-    }
-
-  /* Draw the shadows around the divider line */
-  x_bevel_area (w, div_face, x + spacing, y1,
-		width - 2 * spacing, y2 - y1,
-		shadow_thickness, EDGE_ALL, style);
-}
-
-/*****************************************************************************
- x_output_blank
-
- Output a blank by clearing the area it covers in the foreground color
- of its face.
- ****************************************************************************/
-static void
-x_output_blank (struct window *w, struct display_line *dl, struct rune *rb,
-		int start_pixpos, int cursor_start, int cursor_width)
-{
-  struct frame *f = XFRAME (w->frame);
-  struct device *d = XDEVICE (f->device);
-
-  Display *dpy = DEVICE_X_DISPLAY (d);
-  Window x_win = XtWindow (FRAME_X_TEXT_WIDGET (f));
-  GC gc;
-  struct face_cachel *cursor_cachel =
-    WINDOW_FACE_CACHEL (w,
-			get_builtin_face_cache_index
-			(w, Vtext_cursor_face));
-  Lisp_Object bg_pmap;
-  Lisp_Object buffer = WINDOW_BUFFER (w);
-  Lisp_Object bar_cursor_value = symbol_value_in_buffer (Qbar_cursor,
-							 buffer);
-
-  int x = rb->xpos;
-  int y = DISPLAY_LINE_YPOS (dl);
-  int width = rb->width;
-  int height = DISPLAY_LINE_HEIGHT (dl);
-
-  /* Unmap all subwindows in the area we are going to blank. */
-  redisplay_unmap_subwindows_maybe (f, x, y, width, height);
-
-  if (start_pixpos > x)
-    {
-      if (start_pixpos >= (x + width))
-	return;
-      else
-	{
-	  width -= (start_pixpos - x);
-	  x = start_pixpos;
-	}
-    }
-
-  bg_pmap = WINDOW_FACE_CACHEL_BACKGROUND_PIXMAP (w, rb->findex);
-  if (!IMAGE_INSTANCEP (bg_pmap)
-      || !IMAGE_INSTANCE_PIXMAP_TYPE_P (XIMAGE_INSTANCE (bg_pmap)))
-    bg_pmap = Qnil;
-
-  if (NILP (bg_pmap))
-    gc = x_get_gc (d, Qnil, WINDOW_FACE_CACHEL_BACKGROUND (w, rb->findex),
-		   Qnil, Qnil, Qnil);
-  else
-    gc = x_get_gc (d, Qnil, WINDOW_FACE_CACHEL_FOREGROUND (w, rb->findex),
-		   WINDOW_FACE_CACHEL_BACKGROUND (w, rb->findex), bg_pmap,
-		   Qnil);
-
-  XFillRectangle (dpy, x_win, gc, x, y, width, height);
-
-  /* If this rune is marked as having the cursor, then it is actually
-     representing a tab. */
-  if (!NILP (w->text_cursor_visible_p)
-      && (rb->cursor_type == CURSOR_ON
-	  || (cursor_width
-	      && (cursor_start + cursor_width > x)
-	      && cursor_start < (x + width))))
-    {
-      int cursor_height, cursor_y;
-      int focus = EQ (w->frame, DEVICE_FRAME_WITH_FOCUS_REAL (d));
-      Lisp_Font_Instance *fi;
-
-      fi = XFONT_INSTANCE (FACE_CACHEL_FONT
-			   (WINDOW_FACE_CACHEL (w, rb->findex),
-			    Vcharset_ascii));
-
-      gc = x_get_gc (d, Qnil, cursor_cachel->background, Qnil, Qnil, Qnil);
-
-      cursor_y = dl->ypos - fi->ascent;
-      cursor_height = fi->height;
-      if (cursor_y + cursor_height > y + height)
-	cursor_height = y + height - cursor_y;
-
-      if (focus)
-	{
-	  if (NILP (bar_cursor_value))
-	    {
-	      XFillRectangle (dpy, x_win, gc, cursor_start, cursor_y,
-			      fi->width, cursor_height);
-	    }
-	  else
-	    {
-	      int bar_width = EQ (bar_cursor_value, Qt) ? 1 : 2;
-
-	      gc = x_get_gc (d, Qnil, cursor_cachel->background, Qnil, Qnil,
-			     make_int (bar_width));
-	      XDrawLine (dpy, x_win, gc, cursor_start + bar_width - 1,
-			 cursor_y, cursor_start + bar_width - 1,
-			 cursor_y + cursor_height - 1);
-	    }
-	}
-      else if (NILP (bar_cursor_value))
-	{
-	  XDrawRectangle (dpy, x_win, gc, cursor_start, cursor_y,
-			  fi->width - 1, cursor_height - 1);
-	}
-    }
-}
-
-/*****************************************************************************
- x_output_hline
-
- Output a horizontal line in the foreground of its face.
- ****************************************************************************/
-static void
-x_output_hline (struct window *w, struct display_line *dl, struct rune *rb)
-{
-  struct frame *f = XFRAME (w->frame);
-  struct device *d = XDEVICE (f->device);
-
-  Display *dpy = DEVICE_X_DISPLAY (d);
-  Window x_win = XtWindow (FRAME_X_TEXT_WIDGET (f));
-  GC gc;
-
-  int x = rb->xpos;
-  int width = rb->width;
-  int height = DISPLAY_LINE_HEIGHT (dl);
-  int ypos1, ypos2, ypos3, ypos4;
-
-  ypos1 = DISPLAY_LINE_YPOS (dl);
-  ypos2 = ypos1 + rb->object.hline.yoffset;
-  ypos3 = ypos2 + rb->object.hline.thickness;
-  ypos4 = dl->ypos + dl->descent - dl->clip;
-
-  /* First clear the area not covered by the line. */
-  if (height - rb->object.hline.thickness > 0)
-    {
-      gc = x_get_gc (d, Qnil, WINDOW_FACE_CACHEL_FOREGROUND (w, rb->findex),
-		     Qnil, Qnil, Qnil);
-
-      if (ypos2 - ypos1 > 0)
-	XFillRectangle (dpy, x_win, gc, x, ypos1, width, ypos2 - ypos1);
-      if (ypos4 - ypos3 > 0)
-	XFillRectangle (dpy, x_win, gc, x, ypos1, width, ypos2 - ypos1);
-    }
-
-  /* Now draw the line. */
-  gc = x_get_gc (d, Qnil, WINDOW_FACE_CACHEL_BACKGROUND (w, rb->findex),
-		 Qnil, Qnil, Qnil);
-
-  if (ypos2 < ypos1)
-    ypos2 = ypos1;
-  if (ypos3 > ypos4)
-    ypos3 = ypos4;
-
-  if (ypos3 - ypos2 > 0)
-    XFillRectangle (dpy, x_win, gc, x, ypos2, width, ypos3 - ypos2);
-}
-
-/*****************************************************************************
  x_output_shadows
 
  Draw a shadow around the given area using the given GC's.  It is the
@@ -2084,261 +334,6 @@
     }
 }
 
-/****************************************************************************
- x_clear_region
-
- Clear the area in the box defined by the given parameters using the
- given face.
- ****************************************************************************/
-static void
-x_clear_region (Lisp_Object UNUSED (locale), struct device* d,
-		struct frame* f, face_index UNUSED (findex),
-		int x, int y,
-		int width, int height, Lisp_Object fcolor, Lisp_Object bcolor,
-		Lisp_Object background_pixmap)
-{
-  Display *dpy;
-  Window x_win;
-  GC gc = NULL;
-
-  dpy = DEVICE_X_DISPLAY (d);
-  x_win = XtWindow (FRAME_X_TEXT_WIDGET (f));
-
-    if (!UNBOUNDP (background_pixmap))
-    {
-      gc = x_get_gc (d, Qnil, fcolor, bcolor, background_pixmap, Qnil);
-    }
-
-  if (gc)
-    XFillRectangle (dpy, x_win, gc, x, y, width, height);
-  else
-    XClearArea (dpy, x_win, x, y, width, height, False);
-}
-
-/*****************************************************************************
- x_output_eol_cursor
-
- Draw a cursor at the end of a line.  The end-of-line cursor is
- narrower than the normal cursor.
- ****************************************************************************/
-static void
-x_output_eol_cursor (struct window *w, struct display_line *dl, int xpos,
-		     face_index findex)
-{
-  struct frame *f = XFRAME (w->frame);
-  struct device *d = XDEVICE (f->device);
-  Lisp_Object window;
-
-  Display *dpy = DEVICE_X_DISPLAY (d);
-  Window x_win = XtWindow (FRAME_X_TEXT_WIDGET (f));
-  GC gc;
-  face_index elt = get_builtin_face_cache_index (w, Vtext_cursor_face);
-  struct face_cachel *cursor_cachel = WINDOW_FACE_CACHEL (w, elt);
-
-  int focus = EQ (w->frame, DEVICE_FRAME_WITH_FOCUS_REAL (d));
-  Lisp_Object bar_cursor_value = symbol_value_in_buffer (Qbar_cursor,
-							 WINDOW_BUFFER (w));
-
-  int x = xpos;
-  int y = DISPLAY_LINE_YPOS (dl);
-  int width = EOL_CURSOR_WIDTH;
-  int height = DISPLAY_LINE_HEIGHT (dl);
-  int cursor_height, cursor_y;
-  int defheight, defascent;
-
-  window = wrap_window (w);
-  redisplay_clear_region (window, findex, x, y, width, height);
-
-  if (NILP (w->text_cursor_visible_p))
-    return;
-
-  gc = x_get_gc (d, Qnil, cursor_cachel->background, Qnil, Qnil, Qnil);
-
-  default_face_font_info (window, &defascent, 0, &defheight, 0, 0);
-
-  /* make sure the cursor is entirely contained between y and y+height */
-  cursor_height = min (defheight, height);
-  cursor_y = max (y, min (y + height - cursor_height,
-			  dl->ypos - defascent));
-
-  if (focus)
-    {
-#ifdef HAVE_XIM
-      XIM_SetSpotLocation (f, x - 2 , cursor_y + cursor_height - 2);
-#endif /* HAVE_XIM */
-
-      if (NILP (bar_cursor_value))
-	{
-	  XFillRectangle (dpy, x_win, gc, x, cursor_y, width, cursor_height);
-	}
-      else
-	{
-	  int bar_width = EQ (bar_cursor_value, Qt) ? 1 : 2;
-
-	  gc = x_get_gc (d, Qnil, cursor_cachel->background, Qnil, Qnil,
-			 make_int (bar_width));
-	  XDrawLine (dpy, x_win, gc, x + bar_width - 1, cursor_y,
-		     x + bar_width - 1, cursor_y + cursor_height - 1);
-	}
-    }
-  else if (NILP (bar_cursor_value))
-    {
-      XDrawRectangle (dpy, x_win, gc, x, cursor_y, width - 1,
-		      cursor_height - 1);
-    }
-}
-
-static void
-x_clear_frame_window (Lisp_Object window)
-{
-  struct window *w = XWINDOW (window);
-
-  if (!NILP (w->vchild))
-    {
-      x_clear_frame_windows (w->vchild);
-      return;
-    }
-
-  if (!NILP (w->hchild))
-    {
-      x_clear_frame_windows (w->hchild);
-      return;
-    }
-
-  redisplay_clear_to_window_end (w, WINDOW_TEXT_TOP (w),
-				 WINDOW_TEXT_BOTTOM (w));
-}
-
-static void
-x_clear_frame_windows (Lisp_Object window)
-{
-  for (; !NILP (window); window = XWINDOW (window)->next)
-    x_clear_frame_window (window);
-}
-
-static void
-x_clear_frame (struct frame *f)
-{
-  struct device *d = XDEVICE (f->device);
-  Display *dpy = DEVICE_X_DISPLAY (d);
-  Window x_win = XtWindow (FRAME_X_TEXT_WIDGET (f));
-  int x, y, width, height;
-  Lisp_Object frame;
-
-  x = FRAME_LEFT_BORDER_START (f);
-  width = (FRAME_PIXWIDTH (f) - FRAME_REAL_LEFT_TOOLBAR_WIDTH (f) -
-	   FRAME_REAL_RIGHT_TOOLBAR_WIDTH (f) -
-	   2 * FRAME_REAL_LEFT_TOOLBAR_BORDER_WIDTH (f) -
-	   2 * FRAME_REAL_RIGHT_TOOLBAR_BORDER_WIDTH (f));
-  /* #### This adjustment by 1 should be being done in the macros.
-     There is some small differences between when the menubar is on
-     and off that we still need to deal with. */
-  y = FRAME_TOP_BORDER_START (f) - 1;
-  height = (FRAME_PIXHEIGHT (f) - FRAME_REAL_TOP_TOOLBAR_HEIGHT (f) -
-	    FRAME_REAL_BOTTOM_TOOLBAR_HEIGHT (f) -
-	    2 * FRAME_REAL_TOP_TOOLBAR_BORDER_WIDTH (f) -
-	    2 * FRAME_REAL_BOTTOM_TOOLBAR_BORDER_WIDTH (f)) + 1;
-
-  XClearArea (dpy, x_win, x, y, width, height, False);
-
-  frame = wrap_frame (f);
-
-  if (!UNBOUNDP (FACE_BACKGROUND_PIXMAP (Vdefault_face, frame))
-      || !UNBOUNDP (FACE_BACKGROUND_PIXMAP (Vleft_margin_face, frame))
-      || !UNBOUNDP (FACE_BACKGROUND_PIXMAP (Vright_margin_face, frame)))
-    {
-      x_clear_frame_windows (f->root_window);
-    }
-
-  if (!(check_if_pending_expose_event (d)))
-    XFlush (DEVICE_X_DISPLAY (d));
-}
-
-/* briefly swap the foreground and background colors.
- */
-
-static int
-x_flash (struct device *d)
-{
-  Display *dpy;
-  Window win;
-  XGCValues gcv;
-  GC gc;
-  XColor tmp_fcolor, tmp_bcolor;
-  Lisp_Object tmp_pixel, frame;
-  struct frame *f = device_selected_frame (d);
-  struct window *w = XWINDOW (FRAME_ROOT_WINDOW (f));
-  Widget shell = FRAME_X_SHELL_WIDGET (f);
-  int flash_height;
-
-  frame = wrap_frame (f);
-
-  tmp_pixel = FACE_FOREGROUND (Vdefault_face, frame);
-  tmp_fcolor = COLOR_INSTANCE_X_COLOR (XCOLOR_INSTANCE (tmp_pixel));
-  tmp_pixel = FACE_BACKGROUND (Vdefault_face, frame);
-  tmp_bcolor = COLOR_INSTANCE_X_COLOR (XCOLOR_INSTANCE (tmp_pixel));
-
-  dpy = XtDisplay (shell);
-  win = XtWindow (FRAME_X_TEXT_WIDGET (f));
-  memset (&gcv, ~0, sizeof (XGCValues)); /* initialize all slots to ~0 */
-  gcv.foreground = (tmp_fcolor.pixel ^ tmp_bcolor.pixel);
-  gcv.function = GXxor;
-  gcv.graphics_exposures = False;
-  gc = gc_cache_lookup (DEVICE_X_GC_CACHE (XDEVICE (f->device)), &gcv,
-			(GCForeground | GCFunction | GCGraphicsExposures));
-  default_face_height_and_width (frame, &flash_height, 0);
-
-  /* If window is tall, flash top and bottom line.  */
-  if (EQ (Vvisible_bell, Qtop_bottom) && w->pixel_height > 3 * flash_height)
-    {
-      XFillRectangle (dpy, win, gc, w->pixel_left, w->pixel_top,
-		      w->pixel_width, flash_height);
-      XFillRectangle (dpy, win, gc, w->pixel_left,
-		      w->pixel_top + w->pixel_height - flash_height,
-		      w->pixel_width, flash_height);
-    }
-  else
-    /* If it is short, flash it all.  */
-    XFillRectangle (dpy, win, gc, w->pixel_left, w->pixel_top,
-		    w->pixel_width, w->pixel_height);
-
-  XSync (dpy, False);
-
-#ifdef HAVE_SELECT
-  {
-    int usecs = 100000;
-    struct timeval tv;
-    tv.tv_sec  = usecs / 1000000L;
-    tv.tv_usec = usecs % 1000000L;
-    /* I'm sure someone is going to complain about this... */
-    select (0, 0, 0, 0, &tv);
-  }
-#else
-#ifdef HAVE_POLL
-  poll (0, 0, 100);
-#else /* !HAVE_POLL */
-  bite me
-#endif /* HAVE_POLL */
-#endif /* HAVE_SELECT */
-
-  /* If window is tall, flash top and bottom line.  */
-  if (EQ (Vvisible_bell, Qtop_bottom) && w->pixel_height > 3 * flash_height)
-    {
-      XFillRectangle (dpy, win, gc, w->pixel_left, w->pixel_top,
-		      w->pixel_width, flash_height);
-      XFillRectangle (dpy, win, gc, w->pixel_left,
-		      w->pixel_top + w->pixel_height - flash_height,
-		      w->pixel_width, flash_height);
-    }
-  else
-    /* If it is short, flash it all.  */
-    XFillRectangle (dpy, win, gc, w->pixel_left, w->pixel_top,
-		    w->pixel_width, w->pixel_height);
-
-  XSync (dpy, False);
-
-  return 1;
-}
 
 /* Make audible bell.  */
 
@@ -2376,28 +371,3 @@
       XSync (display, 0);
     }
 }
-
-
-/************************************************************************/
-/*                            initialization                            */
-/************************************************************************/
-
-void
-console_type_create_redisplay_x (void)
-{
-  /* redisplay methods */
-  CONSOLE_HAS_METHOD (x, text_width);
-  CONSOLE_HAS_METHOD (x, output_display_block);
-  CONSOLE_HAS_METHOD (x, divider_height);
-  CONSOLE_HAS_METHOD (x, eol_cursor_width);
-  CONSOLE_HAS_METHOD (x, output_vertical_divider);
-  CONSOLE_HAS_METHOD (x, clear_region);
-  CONSOLE_HAS_METHOD (x, clear_frame);
-  CONSOLE_HAS_METHOD (x, window_output_begin);
-  CONSOLE_HAS_METHOD (x, window_output_end);
-  CONSOLE_HAS_METHOD (x, flash);
-  CONSOLE_HAS_METHOD (x, ring_bell);
-  CONSOLE_HAS_METHOD (x, bevel_area);
-  CONSOLE_HAS_METHOD (x, output_string);
-  CONSOLE_HAS_METHOD (x, output_pixmap);
-}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/src/redisplay-xlike-inc.c	Thu Jan 28 02:48:45 2010 -0600
@@ -0,0 +1,2531 @@
+/* Common code between X and GTK.
+   Copyright (C) 1994, 1995 Board of Trustees, University of Illinois.
+   Copyright (C) 1994 Lucid, Inc.
+   Copyright (C) 1995 Sun Microsystems, Inc.
+   Copyright (C) 2002, 2003, 2005, 2009, 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:  Not in FSF. */
+
+/* Author: Chuck Thompson */
+/* Gtk flavor by William Perry */
+/* X and GTK code merged by Ben Wing, 1-10 */
+
+/* Lots of work done by Ben Wing for Mule */
+
+#include <config.h>
+#include "lisp.h"
+
+#include "buffer.h"
+#include "debug.h"
+#include "device-impl.h"
+#include "faces.h"
+#include "file-coding.h"
+#include "frame-impl.h"
+#include "gutter.h"
+#include "redisplay.h"
+#include "sysdep.h"
+#include "window.h"
+
+#ifdef MULE
+#include "mule-ccl.h"
+#endif
+#include "charset.h"
+
+#ifdef THIS_IS_X
+#include "console-x-impl.h"
+#include "glyphs-x.h"
+#include "objects-x-impl.h"
+#include "xgccache.h"
+#else /* THIS_IS_GTK */
+#include "console-gtk-impl.h"
+#include "gccache-gtk.h"
+#include "glyphs-gtk.h"
+#include "objects-gtk-impl.h"
+#endif /* THIS_IS_GTK */
+
+#include "EmacsFrame.h"
+#include "EmacsFrameP.h"
+
+#include "sysproc.h" /* for select() */
+
+#ifdef THIS_IS_X
+#include <X11/bitmaps/gray>
+#endif /* THIS_IS_X */
+
+#define EOL_CURSOR_WIDTH	5
+
+/* About some of the types below:
+
+   X has two ways of representing a color: (a) as an unsigned long
+   representing a color pixel value, i.e. the actual value stored in memory
+   or a file at a particular pixel location to indicate that the pixel
+   takes on a specific color; and (b) an XColor structure, which
+   encapsulates both the RGB components of a color and the associated color
+   pixel value.
+
+   We call the former type XLIKE_PIXCOLOR and the latter XLIKE_COLOR.
+   GTK uses the same GdkColor structure for both, and normally passes in
+   a pointer.  We provide routines to handle the two logical color types.  */
+
+#ifdef THIS_IS_X
+
+/***************************************************************************/
+/*               Definitions implementing X flavor of XLIKE                */
+/***************************************************************************/
+
+#define XLIKE_NAME x
+#define USED_IF_X(var) var
+
+/* types */
+#define XLIKE_DISPLAY Display *
+#define XLIKE_WINDOW Window
+#define XLIKE_GC GC
+#define XLIKE_RECTANGLE XRectangle
+#define XLIKE_GCVALUES XGCValues
+#define XLIKE_COLOR XColor
+#define XLIKE_PIXCOLOR unsigned long
+
+/* constants */
+#define XLIKE_NONE None
+#define XLIKE_FALSE False
+
+#define XLIKE_GC_BACKGROUND GCBackground
+#define XLIKE_GC_CLIP_MASK GCClipMask
+#define XLIKE_GC_CLIP_X_ORIGIN GCClipXOrigin
+#define XLIKE_GC_CLIP_Y_ORIGIN GCClipYOrigin
+#define XLIKE_GC_EXPOSURES GCGraphicsExposures
+#define XLIKE_GC_FILL GCFillStyle
+#define XLIKE_GC_FONT GCFont
+#define XLIKE_GC_FOREGROUND GCForeground
+#define XLIKE_GC_FUNCTION GCFunction
+#define XLIKE_GC_LINE_WIDTH GCLineWidth
+#define XLIKE_GC_STIPPLE GCStipple
+#define XLIKE_GC_TILE GCTile
+
+#define XLIKE_GX_COPY GXcopy
+#define XLIKE_GX_XOR GXxor
+
+#define XLIKE_FILL_MEMBER fill_style
+#define XLIKE_FILL_STIPPLED FillStippled
+#define XLIKE_FILL_OPAQUE_STIPPLED FillOpaqueStippled
+#define XLIKE_FILL_TILED FillTiled
+#define XLIKE_FILL_SOLID FillSolid
+
+/* functions */
+#define GET_XLIKE_DISPLAY(d) DEVICE_X_DISPLAY (d)
+#define GET_XLIKE_WINDOW(w) XtWindow (FRAME_X_TEXT_WIDGET (f))
+#define XLIKE_FILL_RECTANGLE(dpy, x_win, gc, x, y, width, height) \
+  XFillRectangle (dpy, x_win, gc, x, y, width, height)
+#define XLIKE_DRAW_RECTANGLE(dpy, x_win, gc, x, y, width, height) \
+  XDrawRectangle (dpy, x_win, gc, x, y, width, height)
+#define XLIKE_DRAW_LINE(dpy, x_win, gc, x1, y1, x2, y2) \
+  XDrawLine (dpy, x_win, gc, x1, y1, x2, y2)
+#define XLIKE_OUTPUT_XLIKE_PIXMAP x_output_x_pixmap
+
+#define XLIKE_DISPLAY_LINE_HEIGHT(dl) DISPLAY_LINE_HEIGHT (dl)
+#define XLIKE_DISPLAY_LINE_YPOS(dl) DISPLAY_LINE_YPOS (dl)
+#define XLIKE_DISPLAY_LINE_TOP_CLIP(dl) ((dl)->top_clip)
+#define XLIKE_SET_CLIP_RECTANGLE(dpy, gc, xorig, yorig, prect)		\
+  /* #### why not Unsorted? */						\
+  XSetClipRectangles (dpy, gc, xorig, yorig, prect, 1, YXBanded)
+#define XLIKE_CLEAR_CLIP_MASK(dpy, gc)		\
+do						\
+  {						\
+    XSetClipMask (dpy, gc, None);		\
+    XSetClipOrigin (dpy, gc, 0, 0);		\
+  }						\
+while (0)
+#define XLIKE_FLUSH(dpy) XSync (dpy, False)
+#define XLIKE_CLEAR_AREA(dpy, win, x, y, width, height) \
+  XClearArea (dpy, win, x, y, width, height, False)
+ 
+#define IMAGE_INSTANCE_XLIKE_MASK IMAGE_INSTANCE_X_MASK
+#define XIMAGE_INSTANCE_XLIKE_PIXMAP XIMAGE_INSTANCE_X_PIXMAP
+#define COLOR_INSTANCE_XLIKE_COLOR COLOR_INSTANCE_X_COLOR
+#define FONT_INSTANCE_XLIKE_FONT FONT_INSTANCE_X_FONT
+#define DEVICE_XLIKE_GC_CACHE DEVICE_X_GC_CACHE
+#define DEVICE_XLIKE_GRAY_PIXMAP DEVICE_X_GRAY_PIXMAP
+#define XLIKE_COLOR_TO_PIXCOLOR(ci) ((ci).pixel)
+#define XLIKE_SET_PIXCOLOR_COPY(lval, rval) ((lval) = (rval))
+#define XLIKE_SET_PIXCOLOR_NUM(lval, rval) ((lval) = (rval))
+#define XLIKE_FONT_NUM(val) ((val)->fid)
+
+#define XLIKE_OUTPUT_XLIKE_PIXMAP x_output_x_pixmap
+
+/************ End X flavor of XLIKE **********/
+
+
+
+
+#else /* THIS_IS_GTK */
+
+/***************************************************************************/
+/*              Definitions implementing GTK flavor of XLIKE               */
+/***************************************************************************/
+
+#define XLIKE_NAME gtk
+#define USED_IF_X(var) UNUSED (var)
+
+/*types */
+#define XLIKE_DISPLAY void *
+#define XLIKE_WINDOW GdkWindow *
+#define XLIKE_GC GdkGC *
+#define XLIKE_RECTANGLE GdkRectangle
+#define XLIKE_GCVALUES GdkGCValues
+#define XLIKE_COLOR GdkColor *
+#define XLIKE_PIXCOLOR GdkColor *
+
+/* constants */
+#define XLIKE_NONE 0
+#define XLIKE_FALSE FALSE
+
+#define XLIKE_GC_BACKGROUND GDK_GC_BACKGROUND
+#define XLIKE_GC_CLIP_MASK GDK_GC_CLIP_MASK
+#define XLIKE_GC_CLIP_X_ORIGIN GDK_GC_CLIP_X_ORIGIN
+#define XLIKE_GC_CLIP_Y_ORIGIN GDK_GC_CLIP_Y_ORIGIN
+#define XLIKE_GC_EXPOSURES GDK_GC_EXPOSURES
+#define XLIKE_GC_FILL GDK_GC_FILL
+#define XLIKE_GC_FONT GDK_GC_FONT
+#define XLIKE_GC_FOREGROUND GDK_GC_FOREGROUND
+#define XLIKE_GC_FUNCTION GDK_GC_FUNCTION
+#define XLIKE_GC_LINE_WIDTH GDK_GC_LINE_WIDTH
+#define XLIKE_GC_STIPPLE GDK_GC_STIPPLE
+#define XLIKE_GC_TILE GDK_GC_TILE
+
+#define XLIKE_GX_COPY GDK_COPY
+#define XLIKE_GX_XOR GDK_XOR
+
+#define XLIKE_FILL_MEMBER fill
+#define XLIKE_FILL_STIPPLED GDK_STIPPLED
+#define XLIKE_FILL_OPAQUE_STIPPLED GDK_OPAQUE_STIPPLED
+#define XLIKE_FILL_TILED GDK_TILED
+#define XLIKE_FILL_SOLID GDK_SOLID
+
+/* functions */
+
+#define GET_XLIKE_DISPLAY(d) NULL
+#define GET_XLIKE_WINDOW(w) GET_GTK_WIDGET_WINDOW (FRAME_GTK_TEXT_WIDGET (w))
+#define XLIKE_FILL_RECTANGLE(dpy, x_win, gc, x, y, width, height) \
+  gdk_draw_rectangle (GDK_DRAWABLE (x_win), gc, TRUE, x, y, width, height)
+#define XLIKE_DRAW_RECTANGLE(dpy, x_win, gc, x, y, width, height) \
+  gdk_draw_rectangle (GDK_DRAWABLE (x_win), gc, FALSE, x, y, width, height)
+#define XLIKE_DRAW_LINE(dpy, x_win, gc, x1, y1, x2, y2) \
+  gdk_draw_line (GDK_DRAWABLE (x_win), gc, x1, y1, x2, y2)
+#define XLIKE_OUTPUT_XLIKE_PIXMAP gtk_output_gdk_pixmap
+
+/* FIXME: This is totally bogus.  It removes dl->top_clip from the
+   equations.  If there is a bug involving this, fix it properly!
+   Or just ensure that top_clip is 0. */
+#define XLIKE_DISPLAY_LINE_HEIGHT(dl) \
+  ((dl)->ascent + ((dl)->descent - (dl)->clip)
+#define XLIKE_DISPLAY_LINE_YPOS(dl) ((dl)->ypos - (dl)->ascent)
+#define XLIKE_DISPLAY_LINE_TOP_CLIP(dl) ((0)
+#define XLIKE_SET_CLIP_RECTANGLE(dpy, gc, xorig, yorig, prect)	\
+do								\
+  {								\
+    gdk_gc_set_clip_rectangle (gc, prect);			\
+    gdk_gc_set_clip_origin (gc, xorig, yorig);			\
+  }								\
+while (0)
+#define XLIKE_CLEAR_CLIP_MASK(dpy, gc)		\
+do						\
+  {						\
+    gdk_gc_set_clip_rectangle (gc, NULL);	\
+    gdk_gc_set_clip_origin (gc, 0, 0);		\
+  }						\
+while (0)
+#define XLIKE_FLUSH(dpy) gdk_flush ()
+#define XLIKE_CLEAR_AREA(dpy, win, x, y, width, height) \
+  gdk_window_clear_area (win, x, y, width, height)
+
+#define IMAGE_INSTANCE_XLIKE_MASK IMAGE_INSTANCE_GTK_MASK
+#define XIMAGE_INSTANCE_XLIKE_PIXMAP XIMAGE_INSTANCE_GTK_PIXMAP
+#define COLOR_INSTANCE_XLIKE_COLOR COLOR_INSTANCE_GTK_COLOR
+#define FONT_INSTANCE_XLIKE_FONT FONT_INSTANCE_GTK_FONT
+#define DEVICE_XLIKE_GRAY_PIXMAP DEVICE_GTK_GRAY_PIXMAP
+#define DEVICE_XLIKE_GC_CACHE DEVICE_GTK_GC_CACHE
+#define XLIKE_COLOR_TO_PIXCOLOR(ci) (ci)
+#define XLIKE_SET_PIXCOLOR_COPY(lval, rval) ((lval) = *(rval))
+#define XLIKE_SET_PIXCOLOR_NUM(lval, rval) ((lval).pixel = (rval))
+#define XLIKE_FONT_NUM(val) (val)
+
+#define XLIKE_OUTPUT_XLIKE_PIXMAP gtk_output_gdk_pixmap
+
+static void gtk_output_pixmap (struct window *w,
+			       Lisp_Object image_instance,
+			       struct display_box *db,
+			       struct display_glyph_area *dga,
+			       face_index findex,
+			       int cursor_start,
+			       int cursor_width,
+			       int cursor_height,
+			       int bgpixmap);
+static void gtk_clear_region (Lisp_Object locale, struct device* d,
+			      struct frame* f, face_index findex, int x, int y,
+			      int width, int height, Lisp_Object fcolor,
+			      Lisp_Object bcolor,
+			      Lisp_Object background_pixmap);
+static void gtk_bevel_modeline (struct window *w, struct display_line *dl);
+
+#if 0
+static void __describe_gc (GdkGC *);
+#endif
+
+/************ End GTK flavor of XLIKE **********/
+
+#endif /* (not) THIS_IS_X */
+
+
+
+/***************************************************************************/
+/*                           Common definitions                            */
+/***************************************************************************/
+
+#define XCOLOR_INSTANCE_XLIKE_COLOR(x) \
+  COLOR_INSTANCE_XLIKE_COLOR (XCOLOR_INSTANCE (x))
+
+#define XLIKE_PASTE_1(a,b) a##_##b
+#define XLIKE_PASTE(a,b) XLIKE_PASTE_1(a,b)
+#define XLIKE_CONSOLE_HAS_METHOD_1(xlike, name) CONSOLE_HAS_METHOD (xlike, name)
+#define XLIKE_CONSOLE_HAS_METHOD(name) \
+  XLIKE_CONSOLE_HAS_METHOD_1 (XLIKE_NAME, name)
+
+/* Device methods */
+
+#define XLIKE_text_width XLIKE_PASTE (XLIKE_NAME, text_width)
+#define XLIKE_output_display_block XLIKE_PASTE (XLIKE_NAME, output_display_block)
+#define XLIKE_divider_height XLIKE_PASTE (XLIKE_NAME, divider_height)
+#define XLIKE_eol_cursor_width XLIKE_PASTE (XLIKE_NAME, eol_cursor_width)
+#define XLIKE_output_vertical_divider XLIKE_PASTE (XLIKE_NAME, output_vertical_divider)
+#define XLIKE_clear_region XLIKE_PASTE (XLIKE_NAME, clear_region)
+#define XLIKE_clear_frame XLIKE_PASTE (XLIKE_NAME, clear_frame)
+#define XLIKE_flash XLIKE_PASTE (XLIKE_NAME, flash)
+#define XLIKE_ring_bell XLIKE_PASTE (XLIKE_NAME, ring_bell)
+#define XLIKE_bevel_area XLIKE_PASTE (XLIKE_NAME, bevel_area)
+#define XLIKE_output_string XLIKE_PASTE (XLIKE_NAME, output_string)
+#define XLIKE_output_pixmap XLIKE_PASTE (XLIKE_NAME, output_pixmap)
+#define XLIKE_window_output_begin XLIKE_PASTE (XLIKE_NAME, window_output_begin)
+#define XLIKE_window_output_end XLIKE_PASTE (XLIKE_NAME, window_output_end)
+
+/* Miscellaneous split functions */
+
+#define console_type_create_redisplay_XLIKE XLIKE_PASTE (console_type_create_redisplay, XLIKE_NAME)
+#define XLIKE_get_gc XLIKE_PASTE (XLIKE_NAME, get_gc)
+#define XLIKE_output_blank XLIKE_PASTE (XLIKE_NAME, output_blank)
+#define XLIKE_text_width_single_run XLIKE_PASTE (XLIKE_NAME, text_width_single_run)
+
+static void XLIKE_output_blank (struct window *w, struct display_line *dl,
+				struct rune *rb, int start_pixpos,
+				int cursor_start, int cursor_width);
+static void XLIKE_output_horizontal_line (struct window *w,
+					  struct display_line *dl,
+					  struct rune *rb);
+
+static void XLIKE_output_vertical_divider (struct window *w, int clear);
+
+static void XLIKE_output_eol_cursor (struct window *w,
+				     struct display_line *dl,
+				     int xpos, face_index findex);
+static void XLIKE_clear_frame (struct frame *f);
+static void XLIKE_clear_frame_windows (Lisp_Object window);
+static void XLIKE_window_output_begin (struct window *w);
+static void XLIKE_window_output_end (struct window *w);
+static void XLIKE_bevel_area (struct window *w, face_index findex,
+			      int x, int y, int width, int height,
+			      int shadow_thickness, int edges,
+			      enum edge_style style);
+static void XLIKE_ring_bell (struct device *d, int volume, int pitch,
+			     int duration);
+
+/****************************************************************************/
+/*                                                                          */
+/*                           Separate textual runs                          */
+/*                                                                          */
+/****************************************************************************/
+
+
+     /* Note: We do not use the Xmb*() functions and XFontSets, nor the
+	Motif XFontLists and CompoundStrings.
+	Those functions are generally losing for a number of reasons.
+	Most important, they only support one locale (e.g. you could
+	display Japanese and ASCII text, but not mixed Japanese/Chinese
+	text).  You could maybe call setlocale() frequently to try to deal
+	with this, but that would generally fail because an XFontSet is
+	tied to one locale and won't have the other character sets in it.
+
+	fontconfig (the font database for Xft) has some specifier-like
+	properties, but it's not sufficient (witness the existence of
+	Pango).  Pango might do the trick, but it's not a cross-platform
+	solution; it would need significant advantages to be worth the
+	effort.
+     */
+
+struct textual_run
+{
+  Lisp_Object charset;
+  unsigned char *ptr;
+  int len;
+  int dimension;
+};
+
+/* Separate out the text in STR (an array of Ichars, not a string
+   representation) of length LEN into a series of runs, stored in
+   RUN_STORAGE.  RUN_STORAGE is guaranteed to hold enough space for all
+   runs that could be generated from this text.  Each run points to the a
+   stretch of text given simply by the position codes TEXT_STORAGE into a
+   series of textual runs of a particular charset.  Also convert the
+   characters as necessary into the format needed by XDrawImageString(),
+   XDrawImageString16(), et al.  This means converting to one or two byte
+   format, possibly tweaking the high bits, and possibly running a CCL
+   program.  You must pre-allocate the space used and pass it in. (This is
+   done so you can ALLOCA () the space.) (2 * len) bytes must be allocated
+   for TEXT_STORAGE and (len * sizeof (struct textual_run)) bytes of
+   RUN_STORAGE, where LEN is the length of the dynarr.
+
+   bufchar might not be fixed width (in the case of UTF-8).
+
+   Returns the number of runs actually used. */
+
+/* Notes on Xft implementation
+
+   - With Unicode, we're no longer going to have repertoires reified as
+   charsets.  (Not that we ever really did, what with corporate variants,
+   and so on.)  So we really should be querying the face for the desired
+   font, rather than the character for the charset, and that's what would
+   determine the separation into runs.
+   - The widechar versions of fontconfig (and therefore Xft) functions
+   seem to be just bigendian Unicode.  So there's actually no need to use
+   the 8-bit versions in computing runs and runes, it would seem.
+*/
+
+#if !defined(USE_XFT) && !defined(MULE)
+static int
+separate_textual_runs_nomule (unsigned char *text_storage,
+			      struct textual_run *run_storage,
+			      const Ichar *str, Charcount len,
+			      struct face_cachel *UNUSED(cachel))
+{
+  if (!len)
+    return 0;
+
+  run_storage[0].ptr = text_storage;
+  run_storage[0].len = len;
+  run_storage[0].dimension = 1;
+  run_storage[0].charset = Qnil;
+
+  while (len--)
+    *text_storage++ = *str++;
+  return 1;
+}
+#endif
+
+#if defined(USE_XFT) && !defined(MULE)
+/*
+  Note that in this configuration the "Croatian hack" of using an 8-bit,
+  non-Latin-1 font to get localized display without Mule simply isn't
+  available.  That's by design -- Unicode does not aid or abet that kind
+  of punning.
+  This means that the cast to XftChar16 gives the correct "conversion" to
+  UCS-2.
+  #### Is there an alignment issue with text_storage?
+*/
+static int
+separate_textual_runs_xft_nomule (unsigned char *text_storage,
+				  struct textual_run *run_storage,
+				  const Ichar *str, Charcount len,
+				  struct face_cachel *UNUSED(cachel))
+{
+  int i;
+  if (!len)
+    return 0;
+
+  run_storage[0].ptr = text_storage;
+  run_storage[0].len = len;
+  run_storage[0].dimension = 2;
+  run_storage[0].charset = Qnil;
+
+  for (i = 0; i < len; i++)
+    {
+      *(XftChar16 *)text_storage = str[i];
+      text_storage += sizeof(XftChar16);
+    }
+  return 1;
+}
+#endif
+
+#if defined(USE_XFT) && defined(MULE)
+static int
+separate_textual_runs_xft_mule (unsigned char *text_storage,
+				struct textual_run *run_storage,
+				const Ichar *str, Charcount len,
+				struct face_cachel *UNUSED(cachel))
+{
+  Lisp_Object prev_charset = Qunbound;
+  int runs_so_far = 0, i;
+
+  run_storage[0].ptr = text_storage;
+  run_storage[0].len = len;
+  run_storage[0].dimension = 2;
+  run_storage[0].charset = Qnil;
+
+  for (i = 0; i < len; i++)
+    {
+      Ichar ch = str[i];
+      Lisp_Object charset = ichar_charset(ch);
+      int ucs = ichar_to_unicode(ch);
+
+      /* If UCS is less than zero or greater than 0xFFFF, set ucs2 to
+	 REPLACMENT CHARACTER. */
+      /* That means we can't handle characters outside of the BMP for now */
+      ucs = (ucs & ~0xFFFF) ? 0xFFFD : ucs;
+
+      if (!EQ (charset, prev_charset))
+	{
+	  if (runs_so_far)
+	    run_storage[runs_so_far-1].len = (text_storage - run_storage[runs_so_far-1].ptr) >> 1;
+	  run_storage[runs_so_far].ptr = text_storage;
+	  run_storage[runs_so_far].dimension = 2;
+	  run_storage[runs_so_far].charset = charset;
+	  prev_charset = charset;
+	  runs_so_far++;
+	}
+
+      *(XftChar16 *)text_storage = ucs;
+      text_storage += sizeof(XftChar16);
+    }
+
+  if (runs_so_far)
+    run_storage[runs_so_far-1].len = (text_storage - run_storage[runs_so_far-1].ptr) >> 1;
+  return runs_so_far;
+}
+#endif
+
+#if !defined(USE_XFT) && defined(MULE)
+/*
+  This is the most complex function of this group, due to the various
+  indexing schemes used by different fonts.  For our purposes, they
+  fall into three classes.  Some fonts are indexed compatibly with ISO
+  2022; those fonts just use the Mule internal representation directly
+  (typically the high bit must be reset; this is determined by the `graphic'
+  flag).  Some fonts are indexed by Unicode, specifically by UCS-2.  These
+  are all translated using `ichar_to_unicode'.  Finally some fonts have
+  irregular indexes, and must be translated ad hoc.  In XEmacs ad hoc
+  translations are accomplished with CCL programs. */
+static int
+separate_textual_runs_mule (unsigned char *text_storage,
+			    struct textual_run *run_storage,
+			    const Ichar *str, Charcount len,
+			    struct face_cachel *cachel)
+{
+  Lisp_Object prev_charset = Qunbound;
+  int runs_so_far = 0, i;
+  Ibyte charset_leading_byte = LEADING_BYTE_ASCII;
+  int dimension = 1, graphic = 0, need_ccl_conversion = 0;
+  Lisp_Object ccl_prog;
+  struct ccl_program char_converter;
+
+  int translate_to_ucs_2 = 0;
+
+  for (i = 0; i < len; i++)
+    {
+      Ichar ch = str[i];
+      Lisp_Object charset;
+      int byte1, byte2;		/* BREAKUP_ICHAR dereferences the addresses
+				   of its arguments as pointer to int. */
+      BREAKUP_ICHAR (ch, charset, byte1, byte2);
+
+      if (!EQ (charset, prev_charset))
+	{
+	  /* At this point, dimension' and `prev_charset' refer to just-
+	     completed run.  `runs_so_far' and `text_storage' refer to the
+	     run about to start. */
+	  if (runs_so_far)
+	    {
+	      /* Update metadata for previous run. */
+	      run_storage[runs_so_far - 1].len =
+		text_storage - run_storage[runs_so_far - 1].ptr;
+	      if (2 == dimension) run_storage[runs_so_far - 1].len >>= 1;
+	    }
+
+	  /* Compute metadata for current run.
+	     First, classify font.
+	     If the font is indexed by UCS-2, set `translate_to_ucs_2'.
+	     Else if the charset has a CCL program, set `need_ccl_conversion'.
+	     Else if the font is indexed by an ISO 2022 "graphic register",
+	         set `graphic'.
+	     These flags are almost mutually exclusive, but we're sloppy
+	     about resetting "shadowed" flags.  So the flags must be checked
+	     in the proper order in computing byte1 and byte2, below. */
+	  charset_leading_byte = XCHARSET_LEADING_BYTE(charset);
+	  translate_to_ucs_2 =
+	    bit_vector_bit (FACE_CACHEL_FONT_FINAL_STAGE (cachel),
+			    charset_leading_byte - MIN_LEADING_BYTE);
+	  if (translate_to_ucs_2)
+	    {
+	      dimension = 2;
+	    }
+	  else
+	    {
+	      dimension = XCHARSET_DIMENSION (charset);
+
+	      /* Check for CCL charset.
+		 If setup_ccl_program fails, we'll get a garbaged display.
+		 This should never happen, and even if it does, it should
+		 be harmless (unless the X server has buggy handling of
+		 characters undefined in the font).  It may be marginally
+		 more useful to users and debuggers than substituting a
+		 fixed replacement character. */
+	      ccl_prog = XCHARSET_CCL_PROGRAM (charset);
+	      if ((!NILP (ccl_prog))
+		  && (setup_ccl_program (&char_converter, ccl_prog) >= 0))
+		{
+		  need_ccl_conversion = 1;
+		}
+	      else 
+		{
+		  /* The charset must have an ISO 2022-compatible font index.
+		     There are 2 "registers" (what such fonts use as index).
+		     GL (graphic == 0) has the high bit of each octet reset,
+		     GR (graphic == 1) has it set. */
+		  graphic   = XCHARSET_GRAPHIC (charset);
+		  need_ccl_conversion = 0;
+		}
+	    }
+
+	  /* Initialize metadata for current run. */
+	  run_storage[runs_so_far].ptr       = text_storage;
+	  run_storage[runs_so_far].charset   = charset;
+	  run_storage[runs_so_far].dimension = dimension;
+
+	  /* Update loop variables. */
+	  prev_charset = charset;
+	  runs_so_far++;
+	} 
+
+      /* Must check flags in this order.  See comment above. */
+      if (translate_to_ucs_2)
+	{
+	  int ucs = ichar_to_unicode(ch);
+	  /* If UCS is less than zero or greater than 0xFFFF, set ucs2 to
+	     REPLACMENT CHARACTER. */
+	  ucs = (ucs & ~0xFFFF) ? 0xFFFD : ucs;
+
+	  byte1 = ucs >> 8;
+	  byte2 = ucs;
+	}
+      else if (need_ccl_conversion)
+	{
+	  char_converter.reg[0] = charset_leading_byte;
+	  char_converter.reg[1] = byte1;
+	  char_converter.reg[2] = byte2;
+	  ccl_driver (&char_converter, 0, 0, 0, 0, CCL_MODE_ENCODING);
+	  byte1 = char_converter.reg[1];
+	  byte2 = char_converter.reg[2];
+	}
+      else if (graphic == 0)
+	{
+	  byte1 &= 0x7F;
+	  byte2 &= 0x7F;
+	}
+      else
+	{
+	  byte1 |= 0x80;
+	  byte2 |= 0x80;
+	}
+
+      *text_storage++ = (unsigned char)byte1;
+
+      if (2 == dimension) *text_storage++ = (unsigned char)byte2;
+    }
+
+  if (runs_so_far)
+    {
+      run_storage[runs_so_far - 1].len =
+	text_storage - run_storage[runs_so_far - 1].ptr;
+      /* Dimension retains the relevant value for the run before it. */
+      if (2 == dimension)
+	run_storage[runs_so_far - 1].len >>= 1;
+    }
+
+  return runs_so_far;
+}
+#endif
+
+static int
+separate_textual_runs (unsigned char *text_storage,
+		       struct textual_run *run_storage,
+		       const Ichar *str, Charcount len,
+		       struct face_cachel *cachel)
+{
+#if defined(USE_XFT) && defined(MULE)
+  return separate_textual_runs_xft_mule (text_storage, run_storage,
+					 str, len, cachel);
+#endif
+#if defined(USE_XFT) && !defined(MULE)
+  return separate_textual_runs_xft_nomule (text_storage, run_storage,
+					   str, len, cachel);
+#endif
+#if !defined(USE_XFT) && defined(MULE)
+  return separate_textual_runs_mule (text_storage, run_storage,
+				     str, len, cachel);
+#endif
+#if !defined(USE_XFT) && !defined(MULE)
+  return separate_textual_runs_nomule (text_storage, run_storage,
+				       str, len, cachel);
+#endif
+}
+
+/****************************************************************************/
+/*                                                                          */
+/*                           Xlike output routines                          */
+/*                                                                          */
+/****************************************************************************/
+
+static int
+XLIKE_text_width_single_run (struct frame * USED_IF_XFT (f),
+			     struct face_cachel *cachel,
+			     struct textual_run *run)
+{
+  Lisp_Object font_inst = FACE_CACHEL_FONT (cachel, run->charset);
+  Lisp_Font_Instance *fi = XFONT_INSTANCE (font_inst);
+
+  if (!fi->proportional_p)
+    return fi->width * run->len;
+#ifdef USE_XFT
+  else if (FONT_INSTANCE_X_XFTFONT (fi))
+    {
+      static XGlyphInfo glyphinfo;
+      struct device *d = XDEVICE (f->device);
+      Display *dpy = DEVICE_X_DISPLAY (d);
+
+      if (run->dimension == 2)
+	{
+	  XftTextExtents16 (dpy,
+			    FONT_INSTANCE_X_XFTFONT (fi),
+			    (XftChar16 *) run->ptr, run->len, &glyphinfo);
+	}
+      else
+	{
+	  XftTextExtents8 (dpy,
+			   FONT_INSTANCE_X_XFTFONT (fi),
+			   run->ptr, run->len, &glyphinfo);
+	}
+    
+      return glyphinfo.xOff;
+    }
+#endif
+  else if (FONT_INSTANCE_XLIKE_FONT (fi))
+    {
+      if (run->dimension == 2)
+	{	
+#ifdef THIS_IS_X
+	  return XTextWidth16 (FONT_INSTANCE_X_FONT (fi),
+			       (XChar2b *) run->ptr, run->len);
+#else /* THIS_IS_GTK */
+	  /* stderr_out ("Measuring wide characters\n"); */
+	  return gdk_text_width_wc (FONT_INSTANCE_GTK_FONT (fi),
+				    (GdkWChar *) run->ptr, run->len);
+#endif /* THIS_IS_GTK */
+	}
+      else
+	{
+#ifdef THIS_IS_X
+	  return XTextWidth (FONT_INSTANCE_X_FONT (fi),
+			     (char *) run->ptr, run->len);
+#else /* THIS_IS_GTK */
+	  return gdk_text_width (FONT_INSTANCE_GTK_FONT (fi),
+				 (char *) run->ptr, run->len);
+#endif /* THIS_IS_GTK */
+	}
+    }
+  else
+    abort();
+  return 0;			/* shut up GCC */
+}
+
+/*
+   XLIKE_text_width
+
+   Given a string and a merged face, return the string's length in pixels
+   when displayed in the fonts associated with the face.
+   */
+
+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;
+
+  nruns = separate_textual_runs (text_storage, runs, str, len, 
+				 cachel);
+
+  for (i = 0; i < nruns; i++)
+    width_so_far += XLIKE_text_width_single_run (f, cachel, runs + i);
+
+  return width_so_far;
+}
+
+/*****************************************************************************
+ XLIKE_divider_height
+
+ Return the height of the horizontal divider.  This is a function because
+ divider_height is a device method.
+
+ #### If we add etched horizontal divider lines this will have to get
+ smarter.
+ ****************************************************************************/
+static int
+XLIKE_divider_height (void)
+{
+#ifdef THIS_IS_X
+  return 1;
+#else /* THIS_IS_GTK */
+  return 2;
+#endif /* THIS_IS_GTK */
+}
+
+/*****************************************************************************
+ XLIKE_eol_cursor_width
+
+ Return the width of the end-of-line cursor.  This is a function
+ because eol_cursor_width is a device method.
+ ****************************************************************************/
+static int
+XLIKE_eol_cursor_width (void)
+{
+  return EOL_CURSOR_WIDTH;
+}
+
+/*****************************************************************************
+ XLIKE_output_display_block
+
+ Given a display line, a block number for that start line, output all
+ runes between start and end in the specified display block.
+ ****************************************************************************/
+static void
+XLIKE_output_display_block (struct window *w, struct display_line *dl,
+			    int block, int start, int end, int start_pixpos,
+			    int cursor_start, int cursor_width,
+			    int cursor_height)
+{
+#ifndef USE_XFT
+  struct frame *f = XFRAME (w->frame);
+#endif
+  Ichar_dynarr *buf;
+  Lisp_Object window;
+
+  struct display_block *db = Dynarr_atp (dl->display_blocks, block);
+  rune_dynarr *rba = db->runes;
+  struct rune *rb;
+
+  int elt = start;
+  face_index findex;
+  int xpos, width = 0;
+  Lisp_Object charset = Qunbound; /* Qnil is a valid charset when
+				     MULE is not defined */
+
+  window = wrap_window (w);
+  rb = Dynarr_atp (rba, start);
+
+  if (!rb)
+    /* Nothing to do so don't do anything. */
+    return;
+
+  findex = rb->findex;
+  xpos = rb->xpos;
+  if (rb->type == RUNE_CHAR)
+    charset = ichar_charset (rb->object.chr.ch);
+
+  if (end < 0)
+    end = Dynarr_length (rba);
+  buf = Dynarr_new (Ichar);
+
+  while (elt < end)
+    {
+      rb = Dynarr_atp (rba, elt);
+
+      if (rb->findex == findex && rb->type == RUNE_CHAR
+	  && rb->object.chr.ch != '\n' && rb->cursor_type != CURSOR_ON
+	  && EQ (charset, ichar_charset (rb->object.chr.ch)))
+	{
+	  Dynarr_add (buf, rb->object.chr.ch);
+	  width += rb->width;
+	  elt++;
+	}
+      else
+	{
+	  if (Dynarr_length (buf))
+	    {
+	      XLIKE_output_string (w, dl, buf, xpos, 0, start_pixpos, width,
+				   findex, 0, cursor_start, cursor_width,
+				   cursor_height);
+	      xpos = rb->xpos;
+	      width = 0;
+	    }
+	  Dynarr_reset (buf);
+	  width = 0;
+
+	  if (rb->type == RUNE_CHAR)
+	    {
+	      findex = rb->findex;
+	      xpos = rb->xpos;
+	      charset = ichar_charset (rb->object.chr.ch);
+
+	      if (rb->cursor_type == CURSOR_ON)
+		{
+		  if (rb->object.chr.ch == '\n')
+		    {
+		      XLIKE_output_eol_cursor (w, dl, xpos, findex);
+		    }
+		  else
+		    {
+		      Dynarr_add (buf, rb->object.chr.ch);
+		      XLIKE_output_string (w, dl, buf, xpos, 0, start_pixpos,
+					   rb->width, findex, 1,
+					   cursor_start, cursor_width,
+					   cursor_height);
+		      Dynarr_reset (buf);
+		    }
+
+		  xpos += rb->width;
+		  elt++;
+		}
+	      else if (rb->object.chr.ch == '\n')
+		{
+		  /* Clear in case a cursor was formerly here. */
+		  redisplay_clear_region (window, findex, xpos,
+					  XLIKE_DISPLAY_LINE_YPOS (dl),
+					  rb->width,
+					  XLIKE_DISPLAY_LINE_HEIGHT (dl));
+		  elt++;
+		}
+	    }
+	  else if (rb->type == RUNE_BLANK || rb->type == RUNE_HLINE)
+	    {
+	      if (rb->type == RUNE_BLANK)
+		XLIKE_output_blank (w, dl, rb, start_pixpos, cursor_start,
+				    cursor_width);
+	      else
+		{
+		  /* #### Our flagging of when we need to redraw the
+                     modeline shadows sucks.  Since RUNE_HLINE is only used
+                     by the modeline at the moment it is a good bet
+                     that if it gets redrawn then we should also
+                     redraw the shadows.  This won't be true forever.
+                     We borrow the shadow_thickness_changed flag for
+                     now. */
+		  w->shadow_thickness_changed = 1;
+		  XLIKE_output_horizontal_line (w, dl, rb);
+		}
+
+	      elt++;
+	      if (elt < end)
+		{
+		  rb = Dynarr_atp (rba, elt);
+
+		  findex = rb->findex;
+		  xpos = rb->xpos;
+		}
+	    }
+	  else if (rb->type == RUNE_DGLYPH)
+	    {
+	      Lisp_Object instance;
+	      struct display_box dbox;
+	      struct display_glyph_area dga;
+
+	      redisplay_calculate_display_boxes (dl, rb->xpos, rb->object.dglyph.xoffset,
+						 rb->object.dglyph.yoffset, start_pixpos,
+                                                 rb->width, &dbox, &dga);
+
+	      window = wrap_window (w);
+	      instance = glyph_image_instance (rb->object.dglyph.glyph,
+					       window, ERROR_ME_DEBUG_WARN, 1);
+	      findex = rb->findex;
+
+	      if (IMAGE_INSTANCEP (instance))
+		{
+		  switch (XIMAGE_INSTANCE_TYPE (instance))
+		    {
+		    case IMAGE_TEXT:
+#ifdef THIS_IS_GTK
+		      {
+			/* !!#### Examine for Mule-izing */
+			/* #### This is way losing.  See the comment in
+			   add_glyph_rune(). */
+			Lisp_Object string =
+			  XIMAGE_INSTANCE_TEXT_STRING (instance);
+			convert_ibyte_string_into_ichar_dynarr
+			  (XSTRING_DATA (string), XSTRING_LENGTH (string),
+			   buf);
+
+			gtk_output_string (w, dl, buf, xpos,
+					   rb->object.dglyph.xoffset,
+					   start_pixpos, -1, findex,
+					   (rb->cursor_type == CURSOR_ON),
+					   cursor_start, cursor_width,
+					   cursor_height);
+			Dynarr_reset (buf);
+		      }
+		      break;
+#else
+		      ABORT ();
+#endif /* THIS_IS_GTK */
+		    case IMAGE_MONO_PIXMAP:
+		    case IMAGE_COLOR_PIXMAP:
+		      redisplay_output_pixmap (w, instance, &dbox, &dga,
+					       findex, cursor_start,
+					       cursor_width,
+					       cursor_height, 0);
+		      break;
+
+		    case IMAGE_WIDGET:
+		      if (EQ (XIMAGE_INSTANCE_WIDGET_TYPE (instance),
+			      Qlayout))
+			{
+			  redisplay_output_layout (window, instance, &dbox,
+						   &dga, findex,
+						   cursor_start, cursor_width,
+						   cursor_height);
+			  break;
+			}
+
+		    case IMAGE_SUBWINDOW:
+		      redisplay_output_subwindow (w, instance, &dbox, &dga,
+						  findex, cursor_start,
+						  cursor_width, cursor_height);
+		      break;
+
+		    case IMAGE_NOTHING:
+		      /* nothing is as nothing does */
+		      break;
+
+		    case IMAGE_POINTER:
+		    default:
+		      ABORT ();
+		    }
+		  IMAGE_INSTANCE_OPTIMIZE_OUTPUT
+		    (XIMAGE_INSTANCE (instance)) = 0;
+		}
+
+	      xpos += rb->width;
+	      elt++;
+	    }
+	  else
+	    ABORT ();
+	}
+    }
+
+  if (Dynarr_length (buf))
+    XLIKE_output_string (w, dl, buf, xpos, 0, start_pixpos, width, findex,
+			 0, cursor_start, cursor_width, cursor_height);
+
+  if (dl->modeline
+      && !EQ (Qzero, w->modeline_shadow_thickness)
+#ifndef USE_XFT
+      /* This optimization doesn't work right with some Xft fonts, which
+	 leave antialiasing turds at the boundary.  I don't know if this
+	 is an Xft bug or not, but I think it is.   See x_output_string. */
+      && (f->clear
+	  || f->windows_structure_changed
+	  || w->shadow_thickness_changed)
+#endif
+      )
+    bevel_modeline (w, dl);
+
+  Dynarr_free (buf);
+}
+
+/*****************************************************************************
+ XLIKE_get_gc
+
+ Given a number of parameters return a GC with those properties.
+ ****************************************************************************/
+static XLIKE_GC
+XLIKE_get_gc (struct device *d, Lisp_Object font, Lisp_Object fg, 
+	      Lisp_Object bg, Lisp_Object bg_pmap, Lisp_Object lwidth)
+{
+  XLIKE_GCVALUES gcv;
+  unsigned long mask;
+
+  memset (&gcv, ~0, sizeof (gcv));
+  gcv.graphics_exposures = XLIKE_FALSE;
+  /* Make absolutely sure that we don't pick up a clipping region in
+     the GC returned by this function. */
+  gcv.clip_mask = XLIKE_NONE;
+  gcv.clip_x_origin = 0;
+  gcv.clip_y_origin = 0;
+  gcv.XLIKE_FILL_MEMBER = XLIKE_FILL_SOLID;
+  mask = XLIKE_GC_EXPOSURES | XLIKE_GC_CLIP_MASK | XLIKE_GC_CLIP_X_ORIGIN | XLIKE_GC_CLIP_Y_ORIGIN;
+  mask |= XLIKE_GC_FILL;
+
+  if (!NILP (font)
+#ifdef USE_XFT
+      /* Only set the font if it's a core font */
+      /* the renderfont will be set elsewhere (not part of gc) */
+      && !FONT_INSTANCE_X_XFTFONT (XFONT_INSTANCE (font))
+#endif
+      )
+    {
+      gcv.font =
+	XLIKE_FONT_NUM (FONT_INSTANCE_XLIKE_FONT (XFONT_INSTANCE (font)));
+      mask |= XLIKE_GC_FONT;
+    }
+
+  /* evil kludge! */
+  if (!NILP (fg) && !COLOR_INSTANCEP (fg) && !INTP (fg))
+    {
+      /* #### I fixed one case where this was getting hit.  It was a
+         bad macro expansion (compiler bug). */
+      stderr_out ("Help! x_get_gc got a bogus fg value! fg = ");
+      debug_print (fg);
+      fg = Qnil;
+    }
+
+  if (!NILP (fg))
+    {
+      if (COLOR_INSTANCEP (fg))
+	XLIKE_SET_PIXCOLOR_COPY
+	  (gcv.foreground,
+	   XLIKE_COLOR_TO_PIXCOLOR (XCOLOR_INSTANCE_XLIKE_COLOR (fg)));
+      else
+	XLIKE_SET_PIXCOLOR_NUM (gcv.foreground, XINT (fg));
+      mask |= XLIKE_GC_FOREGROUND;
+    }
+
+  if (!NILP (bg))
+    {
+      if (COLOR_INSTANCEP (bg))
+	XLIKE_SET_PIXCOLOR_COPY
+	  (gcv.background,
+	   XLIKE_COLOR_TO_PIXCOLOR (XCOLOR_INSTANCE_XLIKE_COLOR (bg)));
+      else
+	XLIKE_SET_PIXCOLOR_NUM (gcv.background, XINT (bg));
+      mask |= XLIKE_GC_BACKGROUND;
+    }
+
+  /* This special case comes from a request to draw text with a face which has
+     the dim property. We'll use a stippled foreground GC. */
+  if (EQ (bg_pmap, Qdim))
+    {
+      assert (DEVICE_XLIKE_GRAY_PIXMAP (d) != XLIKE_NONE);
+
+      gcv.XLIKE_FILL_MEMBER = XLIKE_FILL_STIPPLED;
+      gcv.stipple = DEVICE_XLIKE_GRAY_PIXMAP (d);
+      mask |= (XLIKE_GC_FILL | XLIKE_GC_STIPPLE);
+    }
+  else if (IMAGE_INSTANCEP (bg_pmap)
+	   && IMAGE_INSTANCE_PIXMAP_TYPE_P (XIMAGE_INSTANCE (bg_pmap)))
+    {
+      if (XIMAGE_INSTANCE_PIXMAP_DEPTH (bg_pmap) == 0)
+	{
+	  gcv.XLIKE_FILL_MEMBER = XLIKE_FILL_OPAQUE_STIPPLED;
+	  gcv.stipple = XIMAGE_INSTANCE_XLIKE_PIXMAP (bg_pmap);
+	  mask |= (XLIKE_GC_STIPPLE | XLIKE_GC_FILL);
+	}
+      else
+	{
+	  gcv.XLIKE_FILL_MEMBER = XLIKE_FILL_TILED;
+	  gcv.tile = XIMAGE_INSTANCE_XLIKE_PIXMAP (bg_pmap);
+	  mask |= (XLIKE_GC_TILE | XLIKE_GC_FILL);
+	}
+    }
+
+  if (!NILP (lwidth))
+    {
+      gcv.line_width = XINT (lwidth);
+      mask |= XLIKE_GC_LINE_WIDTH;
+    }
+
+#if 0
+  debug_out ("\nx_get_gc: calling gc_cache_lookup\n");
+#endif
+  return gc_cache_lookup (DEVICE_XLIKE_GC_CACHE (d), &gcv, mask);
+}
+
+/*****************************************************************************
+ XLIKE_output_string
+
+ Given a string and a starting position, output that string in the
+ given face.  If cursor is true, draw a cursor around the string.
+ Correctly handles multiple charsets in the string.
+
+ The meaning of the parameters is something like this:
+
+ W		Window that the text is to be displayed in.
+ DL		Display line that this text is on.  The values in the
+ 		structure are used to determine the vertical position and
+		clipping range of the text.
+ BUF		Dynamic array of Ichars specifying what is actually to be
+		drawn.
+ XPOS		X position in pixels where the text should start being drawn.
+ XOFFSET	Number of pixels to be chopped off the left side of the
+ 		text.  The effect is as if the text were shifted to the
+		left this many pixels and clipped at XPOS.
+ CLIP_START	Clip everything left of this X position.
+ WIDTH		Clip everything right of XPOS + WIDTH.
+ FINDEX		Index for the face cache element describing how to display
+ 		the text.
+ CURSOR		#### I don't understand this.  There's something
+ 		strange and overcomplexified with this variable.
+		Chuck, explain please?
+ CURSOR_START	Starting X position of cursor.
+ CURSOR_WIDTH	Width of cursor in pixels.
+ CURSOR_HEIGHT	Height of cursor in pixels.
+
+ Starting Y position of cursor is the top of the text line.
+ The cursor is drawn sometimes whether or not CURSOR is set. ???
+ ****************************************************************************/
+#ifdef THIS_IS_GTK
+static
+void gdk_draw_text_image (GdkDrawable *drawable,
+			  GdkFont     *font,
+			  GdkGC       *gc,
+			  gint         x,
+			  gint         y,
+			  const gchar *text,
+			  gint         text_length);
+
+#endif /* THIS_IS_GTK */
+void
+XLIKE_output_string (struct window *w, struct display_line *dl,
+		     Ichar_dynarr *buf, int xpos, int xoffset, int clip_start,
+		     int width, face_index findex, int cursor,
+		     int cursor_start, int cursor_width, int cursor_height)
+{
+  /* General variables */
+  struct frame *f = XFRAME (w->frame);
+  struct device *d = XDEVICE (f->device);
+  XLIKE_DISPLAY dpy = GET_XLIKE_DISPLAY (d);
+  XLIKE_WINDOW x_win = GET_XLIKE_WINDOW (f);
+  Lisp_Object window = wrap_window (w);
+
+  int clip_end;
+
+  /* Cursor-related variables */
+  int focus = EQ (w->frame, DEVICE_FRAME_WITH_FOCUS_REAL (d));
+  int cursor_clip;
+  Lisp_Object bar_cursor_value = symbol_value_in_buffer (Qbar_cursor,
+							 WINDOW_BUFFER (w));
+  struct face_cachel *cursor_cachel = 0;
+
+  /* Text-related variables */
+  Lisp_Object bg_pmap;
+  XLIKE_GC bgc, gc;
+  int height = XLIKE_DISPLAY_LINE_HEIGHT (dl);
+  int ypos = XLIKE_DISPLAY_LINE_YPOS (dl);
+  int len = Dynarr_length (buf);
+  unsigned char *text_storage = (unsigned char *) ALLOCA (2 * len);
+  struct textual_run *runs = alloca_array (struct textual_run, len);
+  int nruns;
+  int i;
+  struct face_cachel *cachel = WINDOW_FACE_CACHEL (w, findex);
+
+#ifdef THIS_IS_X
+  int use_x_font = 1;		/* #### bogus!!
+				   The logic of this function needs review! */
+#endif
+#ifdef USE_XFT
+  Colormap cmap = DEVICE_X_COLORMAP (d);
+  Visual *visual = DEVICE_X_VISUAL (d);
+  static XftColor fg, bg;
+  XftDraw *xftDraw;
+
+  /* Lazily initialize frame's xftDraw member. */
+  if (!FRAME_X_XFTDRAW (f)) {
+    FRAME_X_XFTDRAW (f) = XftDrawCreate (dpy, x_win, visual, cmap);
+  }
+  xftDraw = FRAME_X_XFTDRAW (f);
+
+  /* #### This will probably cause asserts when passed a Lisp integer for a
+     color.  See ca. line 759 this file.
+     #### Maybe xft_convert_color should take an XColor, not a pixel. */
+#define XFT_FROB_LISP_COLOR(color, dim) \
+  xft_convert_color (dpy, cmap, visual, \
+		     COLOR_INSTANCE_X_COLOR (XCOLOR_INSTANCE (color)).pixel, \
+		     (dim))
+#endif /* USE_XFT */
+
+  if (width < 0)
+    width = XLIKE_text_width (w, cachel, Dynarr_atp (buf, 0),
+			      Dynarr_length (buf));
+
+  /* Regularize the variables passed in. */
+
+  if (clip_start < xpos)
+    clip_start = xpos;
+  clip_end = xpos + width;
+  if (clip_start >= clip_end)
+    /* It's all clipped out. */
+    return;
+
+  xpos -= xoffset;
+
+  /* make sure the area we are about to display is subwindow free. */
+  redisplay_unmap_subwindows_maybe (f, clip_start, ypos,
+				    clip_end - clip_start, height);
+
+  cursor_clip = (cursor_start >= clip_start &&
+		 cursor_start < clip_end);
+
+  /* This cursor code is really a mess. */
+  if (!NILP (w->text_cursor_visible_p)
+      && (cursor
+	  || cursor_clip
+	  || (cursor_width
+	      && (cursor_start + cursor_width >= clip_start)
+	      && !NILP (bar_cursor_value))))
+    {
+      /* These have to be in separate statements in order to avoid a
+         compiler bug. */
+      face_index sucks = get_builtin_face_cache_index (w, Vtext_cursor_face);
+      cursor_cachel = WINDOW_FACE_CACHEL (w, sucks);
+
+      /* We have to reset this since any call to WINDOW_FACE_CACHEL
+         may cause the cache to resize and any pointers to it to
+         become invalid. */
+      cachel = WINDOW_FACE_CACHEL (w, findex);
+    }
+
+#ifdef HAVE_XIM
+  if (cursor && focus && (cursor_start == clip_start) && cursor_height)
+    XIM_SetSpotLocation (f, xpos - 2, dl->ypos + dl->descent - 2);
+#endif /* HAVE_XIM */
+
+  bg_pmap = cachel->background_pixmap;
+  if (!IMAGE_INSTANCEP (bg_pmap)
+      || !IMAGE_INSTANCE_PIXMAP_TYPE_P (XIMAGE_INSTANCE (bg_pmap)))
+    bg_pmap = Qnil;
+
+  if ((cursor && focus && NILP (bar_cursor_value)
+       && !NILP (w->text_cursor_visible_p)) || NILP (bg_pmap))
+    bgc = 0;
+  else
+    bgc = XLIKE_get_gc (d, Qnil, cachel->foreground, cachel->background,
+			bg_pmap, Qnil);
+
+  if (bgc)
+    {
+      XLIKE_FILL_RECTANGLE (dpy, x_win, bgc, clip_start,
+			    ypos, clip_end - clip_start,
+			    height);
+    }
+
+  nruns = separate_textual_runs (text_storage, runs, Dynarr_atp (buf, 0),
+				 Dynarr_length (buf), cachel);
+
+  for (i = 0; i < nruns; i++)
+    {
+      Lisp_Object font = FACE_CACHEL_FONT (cachel, runs[i].charset);
+      Lisp_Font_Instance *fi = XFONT_INSTANCE (font);
+      int this_width;
+      int need_clipping;
+
+      if (EQ (font, Vthe_null_font_instance))
+	continue;
+
+      this_width = XLIKE_text_width_single_run (f, cachel, runs + i);
+      need_clipping = (dl->clip || clip_start > xpos ||
+		       clip_end < xpos + this_width);
+
+      /* XDrawImageString only clears the area equal to the height of
+	 the given font.  It is possible that a font is being displayed
+	 on a line taller than it is, so this would cause us to fail to
+	 clear some areas. */
+      if ((int) fi->height < (int) (height + dl->clip +
+				    XLIKE_DISPLAY_LINE_TOP_CLIP (dl)))
+	{
+	  int clear_start = max (xpos, clip_start);
+	  int clear_end = min (xpos + this_width, clip_end);
+
+	  if (cursor)
+	    {
+	      int ypos1_line, ypos1_string, ypos2_line, ypos2_string;
+
+	      ypos1_string = dl->ypos - fi->ascent;
+	      ypos2_string = dl->ypos + fi->descent;
+	      ypos1_line = ypos;
+	      ypos2_line = ypos1_line + height;
+
+	      /* Make sure we don't clear below the real bottom of the
+		 line. */
+	      if (ypos1_string > ypos2_line)
+		ypos1_string = ypos2_line;
+	      if (ypos2_string > ypos2_line)
+		ypos2_string = ypos2_line;
+
+	      if (ypos1_line < ypos1_string)
+		{
+		  redisplay_clear_region (window, findex, clear_start, ypos1_line,
+				  clear_end - clear_start,
+				  ypos1_string - ypos1_line);
+		}
+
+	      if (ypos2_line > ypos2_string)
+		{
+		  redisplay_clear_region (window, findex, clear_start, ypos2_string,
+				  clear_end - clear_start,
+				  ypos2_line - ypos2_string);
+		}
+	    }
+	  else
+	    {
+	      redisplay_clear_region (window, findex, clear_start,
+			      ypos, clear_end - clear_start,
+			      height);
+	    }
+	}
+
+      if (cursor && cursor_cachel && focus && NILP (bar_cursor_value))
+	{
+#ifdef USE_XFT
+	  fg = XFT_FROB_LISP_COLOR (cursor_cachel->foreground, 0);
+	  bg = XFT_FROB_LISP_COLOR (cursor_cachel->background, 0);
+#endif
+	  gc = XLIKE_get_gc (d, font, cursor_cachel->foreground,
+			     cursor_cachel->background, Qnil, Qnil);
+	}
+      else if (cachel->dim)
+	{
+	  /* Ensure the gray bitmap exists */
+	  if (DEVICE_XLIKE_GRAY_PIXMAP (d) == XLIKE_NONE)
+	    DEVICE_XLIKE_GRAY_PIXMAP (d) =
+#ifdef THIS_IS_X
+	      XCreateBitmapFromData (dpy, x_win, (char *)gray_bits,
+				     gray_width, gray_height)
+#else
+	      /* #### FIXME! Implement me! */
+	      XLIKE_NONE
+#endif
+	      ;
+
+	  /* Request a GC with the gray stipple pixmap to draw dimmed text */
+#ifdef USE_XFT
+	  fg = XFT_FROB_LISP_COLOR (cachel->foreground, 1);
+	  bg = XFT_FROB_LISP_COLOR (cachel->background, 0);
+#endif
+	  gc = XLIKE_get_gc (d, font, cachel->foreground, cachel->background,
+			     Qdim, Qnil);
+	}
+      else
+	{
+#ifdef USE_XFT
+	  fg = XFT_FROB_LISP_COLOR (cachel->foreground, 0);
+	  bg = XFT_FROB_LISP_COLOR (cachel->background, 0);
+#endif
+	  gc = XLIKE_get_gc (d, font, cachel->foreground, cachel->background,
+			     Qnil, Qnil);
+	}
+#ifdef USE_XFT
+      {
+	XftFont *rf = FONT_INSTANCE_X_XFTFONT (fi);
+
+	if (rf)
+	  {
+	    use_x_font = 0;
+	    if (need_clipping)
+	      {
+		Region clip_reg = XCreateRegion();
+		XRectangle clip_box = { clip_start, ypos,
+					clip_end - clip_start, height };
+
+		XUnionRectWithRegion (&clip_box, clip_reg, clip_reg); 
+		XftDrawSetClip(xftDraw, clip_reg);
+		XDestroyRegion(clip_reg);
+	      }
+
+	    if (!bgc)
+	      {
+		/* #### Neither rect_height nor XftTextExtents as computed
+		   below handles the vertical space taken up by antialiasing,
+		   which for some fonts (eg, Bitstream Vera Sans Mono-16 on
+		   my Mac PowerBook G4) leaves behind orphaned dots on
+		   insertion or deletion earlier in the line, especially in
+		   the case of the underscore character.
+		   Interestingly, insertion or deletion of a single character
+		   immediately after a refresh does not leave any droppings,
+		   but any further insertions or deletions do.
+		   While adding a pixel to rect_height (mostly) takes care of
+		   this, it trashes aggressively laid-out elements like the
+		   modeline (overwriting part of the bevel).
+		   OK, unconditionally redraw the bevel, and increment
+		   rect_height by 1.  See x_output_display_block. -- sjt */
+		struct textual_run *run = &runs[i];
+		int rect_width = x_text_width_single_run (f, cachel, run);
+#ifndef USE_XFTTEXTENTS_TO_AVOID_FONT_DROPPINGS
+		int rect_height = FONT_INSTANCE_ASCENT(fi)
+				  + FONT_INSTANCE_DESCENT(fi) + 1;
+#else
+		int rect_height = FONT_INSTANCE_ASCENT(fi)
+				  + FONT_INSTANCE_DESCENT(fi);
+		XGlyphInfo gi;
+		if (run->dimension == 2) {
+		  XftTextExtents16 (dpy,
+				    FONT_INSTANCE_X_XFTFONT(fi),
+				    (XftChar16 *) run->ptr, run->len, &gi);
+		} else {
+		  XftTextExtents8 (dpy,
+				   FONT_INSTANCE_X_XFTFONT(fi),
+				   run->ptr, run->len, &gi);
+		}
+		rect_height = rect_height > gi.height
+			      ? rect_height : gi.height;
+#endif
+
+		XftDrawRect (xftDraw, &bg,
+			     xpos, ypos, rect_width, rect_height);
+	      }
+	
+	    if (runs[i].dimension == 1)
+	      XftDrawString8 (xftDraw, &fg, rf, xpos, dl->ypos,
+			      runs[i].ptr, runs[i].len);
+	    else
+	      XftDrawString16 (xftDraw, &fg, rf, xpos, dl->ypos,
+			       (XftChar16 *) runs[i].ptr, runs[i].len);
+	  }
+      }
+#endif /* USE_XFT */
+
+#ifdef THIS_IS_X
+      if (use_x_font)
+#endif
+	{
+	  if (need_clipping)
+	    {
+	      XLIKE_RECTANGLE clip_box;
+
+	      clip_box.x = 0;
+	      clip_box.y = 0;
+	      clip_box.width = clip_end - clip_start;
+	      clip_box.height = height;
+
+	      XLIKE_SET_CLIP_RECTANGLE (dpy, gc, clip_start, ypos, &clip_box);
+	    }
+
+#ifdef THIS_IS_X
+	  if (runs[i].dimension == 1)
+	    (bgc ? XDrawString : XDrawImageString)
+	      (dpy, x_win, gc, xpos, dl->ypos,
+	       (char *) runs[i].ptr, runs[i].len);
+	  else
+	    (bgc ? XDrawString16 : XDrawImageString16)
+	      (dpy, x_win, gc, xpos, dl->ypos,
+	       (XChar2b *) runs[i].ptr, runs[i].len);
+#else /* THIS_IS_GTK */
+
+      /* The X specific called different functions (XDraw*String
+         vs. XDraw*String16), but apparently gdk_draw_text takes care
+         of that for us.
+
+	 BUT, gdk_draw_text also does too much, by dividing the length
+	 by 2.  So we fake them out my multiplying the length by the
+	 dimension of the text.  This will do the right thing for
+	 single-dimension runs as well of course.
+      */
+      (bgc ? gdk_draw_text : gdk_draw_text_image)
+	(GDK_DRAWABLE (x_win), FONT_INSTANCE_GTK_FONT (fi), gc, xpos,
+	 dl->ypos, (char *) runs[i].ptr, runs[i].len * runs[i].dimension);
+#endif /* (not) THIS_IS_X */
+	}
+
+      /* We draw underlines in the same color as the text. */
+      if (cachel->underline)
+	{
+	  int upos, uthick;
+#ifdef THIS_IS_X
+	  unsigned long upos_ext, uthick_ext;
+	  XFontStruct *fs =
+	    use_x_font ? FONT_INSTANCE_X_FONT (XFONT_INSTANCE (font)) : 0;
+	  /* #### the logic of the next two may be suboptimal: we may want
+	     to use the POSITION and/or THICKNESS information with Xft */
+	  if (fs && XGetFontProperty (fs, XA_UNDERLINE_POSITION, &upos_ext))
+	    upos = (int) upos_ext;
+	  else
+#else /* THIS_IS_GTK */
+	  /* Cannot get at font properties in Gtk, so we resort to
+             guessing */
+#endif /* THIS_IS_GTK */
+	    upos = dl->descent / 2;
+#ifdef THIS_IS_X
+	  if (fs && XGetFontProperty (fs, XA_UNDERLINE_THICKNESS, &uthick_ext))
+	    uthick = (int) uthick_ext;
+	  else
+#endif /* THIS_IS_X */
+	    uthick = 1;
+	  if (dl->ypos + upos < dl->ypos + dl->descent - dl->clip)
+	    {
+	      if (dl->ypos + upos + uthick > dl->ypos + dl->descent - dl->clip)
+		uthick = dl->descent - dl->clip - upos;
+
+	      if (uthick == 1)
+		{
+		  XLIKE_DRAW_LINE (dpy, x_win, gc, xpos, dl->ypos + upos,
+				   xpos + this_width, dl->ypos + upos);
+		}
+	      else if (uthick > 1)
+		{
+		  XLIKE_FILL_RECTANGLE (dpy, x_win, gc, xpos,
+					dl->ypos + upos, this_width, uthick);
+		}
+	    }
+	}
+
+      if (cachel->strikethru)
+	{
+#ifdef THIS_IS_X
+	  int ascent, descent, upos, uthick;
+	  unsigned long ascent_ext, descent_ext, uthick_ext;
+	  XFontStruct *fs = FONT_INSTANCE_X_FONT (fi);
+#else /* THIS_IS_GTK */
+	  gint ascent, descent, upos, uthick;
+	  GdkFont *gfont = FONT_INSTANCE_GTK_FONT (fi);
+#endif /* THIS_IS_GTK */
+	  
+#ifdef THIS_IS_X
+	  if (!use_x_font)
+	    {
+	      ascent = dl->ascent;
+	      descent = dl->descent;
+	      uthick = 1;
+	    }
+	  else
+	    {
+	      if (!XGetFontProperty (fs, XA_STRIKEOUT_ASCENT, &ascent_ext))
+		ascent = fs->ascent;
+	      else
+		ascent = (int) ascent_ext;
+	      if (!XGetFontProperty (fs, XA_STRIKEOUT_DESCENT, &descent_ext))
+		descent = fs->descent;
+	      else
+		descent = (int) descent_ext;
+	      if (!XGetFontProperty (fs, XA_UNDERLINE_THICKNESS, &uthick_ext))
+		uthick = 1;
+	      else
+		uthick = (int) uthick_ext;
+	    }
+#else /* THIS_IS_GTK */
+	/* Cannot get at font properties in Gtk, so we resort to
+           guessing */
+
+	  ascent = gfont->ascent;
+	  descent = gfont->descent;
+	  uthick = 1;
+#endif /* THIS_IS_GTK */
+
+	  upos = ascent - ((ascent + descent) / 2) + 1;
+
+	  /* Generally, upos will be positive (above the baseline),so
+             subtract */
+	  if (dl->ypos - upos < dl->ypos + dl->descent - dl->clip)
+	    {
+	      if (dl->ypos - upos + uthick > dl->ypos + dl->descent - dl->clip)
+		uthick = dl->descent - dl->clip + upos;
+
+	      if (uthick == 1)
+		XLIKE_DRAW_LINE (dpy, x_win, gc, xpos, dl->ypos - upos,
+				 xpos + this_width, dl->ypos - upos);
+	      else if (uthick > 1)
+		XLIKE_FILL_RECTANGLE (dpy, x_win, gc, xpos, dl->ypos + upos,
+				      this_width, uthick);
+	    }
+	}
+
+      /* Restore the GC */
+      if (need_clipping)
+	{
+#ifdef USE_XFT
+	  if (!use_x_font)
+	    {
+	      XftDrawSetClip (xftDraw, 0);
+	    }
+	  else
+#endif
+	    XLIKE_CLEAR_CLIP_MASK (dpy, gc);
+	}
+
+      /* If we are actually superimposing the cursor then redraw with just
+	 the appropriate section highlighted. */
+      if (cursor_clip && !cursor && focus && cursor_cachel)
+	{
+#ifdef USE_XFT
+	  if (!use_x_font)	/* Xft */
+	    {
+	      XftFont *rf = FONT_INSTANCE_X_XFTFONT (fi);
+	  
+	      { /* set up clipping */
+		Region clip_reg = XCreateRegion();
+		XRectangle clip_box = { cursor_start, ypos,
+					cursor_width, height };
+	    
+		XUnionRectWithRegion (&clip_box, clip_reg, clip_reg); 
+		XftDrawSetClip(xftDraw, clip_reg);
+		XDestroyRegion(clip_reg);
+	      }
+	      { /* draw background rectangle & draw text */
+		int rect_height = FONT_INSTANCE_ASCENT(fi)
+				  + FONT_INSTANCE_DESCENT(fi);
+		int rect_width = x_text_width_single_run(f, cachel, &runs[i]);
+		XftColor xft_color;
+
+		xft_color = XFT_FROB_LISP_COLOR (cursor_cachel->background, 0);
+		XftDrawRect (xftDraw, &xft_color,
+			     xpos, ypos, rect_width, rect_height);
+
+		xft_color = XFT_FROB_LISP_COLOR (cursor_cachel->foreground, 0);
+		if (runs[i].dimension == 1)
+		  XftDrawString8 (xftDraw, &xft_color, rf, xpos, dl->ypos,
+				  runs[i].ptr, runs[i].len);
+		else
+		  XftDrawString16 (xftDraw, &xft_color, rf, xpos, dl->ypos,
+				   (XftChar16 *) runs[i].ptr, runs[i].len);
+	      }
+
+	      XftDrawSetClip(xftDraw, 0);
+	    }
+	  else			/* core font, not Xft */
+#endif /* USE_XFT */
+	    {
+	      XLIKE_RECTANGLE clip_box;
+	      XLIKE_GC cgc;
+	      cgc = XLIKE_get_gc (d, font, cursor_cachel->foreground,
+				  cursor_cachel->background, Qnil, Qnil);
+
+	      clip_box.x = 0;
+	      clip_box.y = 0;
+	      clip_box.width = cursor_width;
+	      clip_box.height = height;
+
+	      XLIKE_SET_CLIP_RECTANGLE (dpy, cgc, cursor_start, ypos,
+					&clip_box);
+#ifdef THIS_IS_X
+	      if (runs[i].dimension == 1)
+		XDrawImageString (dpy, x_win, cgc, xpos, dl->ypos,
+				  (char *) runs[i].ptr, runs[i].len);
+	      else
+		XDrawImageString16 (dpy, x_win, cgc, xpos, dl->ypos,
+				    (XChar2b *) runs[i].ptr, runs[i].len);
+#else
+	      /* The X specific called different functions (XDraw*String
+		 vs. XDraw*String16), but apparently gdk_draw_text takes care
+		 of that for us.
+
+		 BUT, gdk_draw_text also does too much, by dividing the
+		 length by 2.  So we fake them out my multiplying the
+		 length by the dimension of the text.  This will do the
+		 right thing for single-dimension runs as well of course.
+	      */
+	      gdk_draw_text_image (GDK_DRAWABLE (x_win),
+				   FONT_INSTANCE_GTK_FONT (fi), cgc, xpos,
+				   dl->ypos, (char *) runs[i].ptr,
+				   runs[i].len * runs[i].dimension);
+#endif /* (not) THIS_IS_X */
+
+	      XLIKE_CLEAR_CLIP_MASK (dpy, cgc);
+	    }
+	}
+
+      xpos += this_width;
+    }
+
+  /* Draw the non-focus box or bar-cursor as needed. */
+  /* Can't this logic be simplified? */
+  if (cursor_cachel
+      && ((cursor && !focus && NILP (bar_cursor_value))
+	  || (cursor_width
+	      && (cursor_start + cursor_width >= clip_start)
+	      && !NILP (bar_cursor_value))))
+    {
+      int tmp_height, tmp_y;
+      int bar_width = EQ (bar_cursor_value, Qt) ? 1 : 2;
+      int need_clipping = (cursor_start < clip_start
+			   || clip_end < cursor_start + cursor_width);
+
+      /* #### This value is correct (as far as I know) because
+	 all of the times we need to draw this cursor, we will
+	 be called with exactly one character, so we know we
+	 can always use runs[0].
+
+	 This is bogus as all hell, however.  The cursor handling in
+	 this function is way bogus and desperately needs to be
+	 cleaned up.  (In particular, the drawing of the cursor should
+	 really really be separated out of this function.  This may be
+	 a bit tricky now because this function itself does way too
+	 much stuff, a lot of which needs to be moved into
+	 redisplay.c.)  This is the only way to be able to easily add
+	 new cursor types or (e.g.) make the bar cursor be able to
+	 span two characters instead of overlaying just one. */
+      int bogusly_obtained_ascent_value =
+	XFONT_INSTANCE (FACE_CACHEL_FONT (cachel, runs[0].charset))->ascent;
+
+      if (!NILP (bar_cursor_value))
+	{
+	  gc = XLIKE_get_gc (d, Qnil, cursor_cachel->background, Qnil, Qnil,
+			     make_int (bar_width));
+	}
+      else
+	{
+	  gc = XLIKE_get_gc (d, Qnil, cursor_cachel->background,
+			     Qnil, Qnil, Qnil);
+	}
+
+      tmp_y = dl->ypos - bogusly_obtained_ascent_value;
+      tmp_height = cursor_height;
+      if (tmp_y + tmp_height > (int) (ypos + height))
+	{
+	  tmp_y = ypos + height - tmp_height;
+	  if (tmp_y < (int) ypos)
+	    tmp_y = ypos;
+	  tmp_height = ypos + height - tmp_y;
+	}
+
+      if (need_clipping)
+	{
+	  XLIKE_RECTANGLE clip_box;
+	  clip_box.x = 0;
+	  clip_box.y = 0;
+	  clip_box.width = clip_end - clip_start;
+	  clip_box.height = tmp_height;
+	  XLIKE_SET_CLIP_RECTANGLE (dpy, gc, clip_start, tmp_y, &clip_box);
+	}
+
+      if (!focus && NILP (bar_cursor_value))
+	{
+	  XLIKE_DRAW_RECTANGLE (dpy, x_win, gc, cursor_start, tmp_y,
+				cursor_width - 1, tmp_height - 1);
+	}
+      else if (focus && !NILP (bar_cursor_value))
+	{
+	  XLIKE_DRAW_LINE (dpy, x_win, gc, cursor_start + bar_width - 1, tmp_y,
+			   cursor_start + bar_width - 1,
+			   tmp_y + tmp_height - 1);
+	}
+
+      /* Restore the GC */
+      if (need_clipping)
+	{
+	  XLIKE_CLEAR_CLIP_MASK (dpy, gc);
+	}
+    }
+
+#ifdef USE_XFT
+#undef XFT_FROB_LISP_COLOR
+#endif
+}
+
+#ifdef THIS_IS_GTK
+static void
+our_draw_bitmap (GdkDrawable *drawable,
+		 GdkGC       *gc,
+		 GdkPixmap   *src,
+		 gint         xsrc,
+		 gint         ysrc,
+		 gint         xdest,
+		 gint         ydest,
+		 gint         width,
+		 gint         height);
+#endif /* THIS_IS_GTK */
+
+
+void
+XLIKE_OUTPUT_XLIKE_PIXMAP (struct frame *f, Lisp_Image_Instance *p, int x,
+			   int y, int xoffset, int yoffset,
+			   int width, int height,
+			   XLIKE_PIXCOLOR fg, XLIKE_PIXCOLOR bg,
+			   XLIKE_GC override_gc)
+{
+  struct device *d = XDEVICE (f->device);
+  XLIKE_DISPLAY dpy = GET_XLIKE_DISPLAY (d);
+  XLIKE_WINDOW x_win = GET_XLIKE_WINDOW (f);
+  XLIKE_GC gc;
+  XLIKE_GCVALUES gcv;
+  unsigned long pixmap_mask;
+
+  if (!override_gc)
+    {
+      memset (&gcv, ~0, sizeof (gcv));
+      gcv.graphics_exposures = XLIKE_FALSE;
+      XLIKE_SET_PIXCOLOR_COPY (gcv.foreground, fg);
+      XLIKE_SET_PIXCOLOR_COPY (gcv.background, bg);
+      pixmap_mask = XLIKE_GC_FOREGROUND | XLIKE_GC_BACKGROUND | XLIKE_GC_EXPOSURES;
+
+      if (IMAGE_INSTANCE_XLIKE_MASK (p))
+	{
+	  gcv.function = XLIKE_GX_COPY;
+	  gcv.clip_mask = IMAGE_INSTANCE_XLIKE_MASK (p);
+	  gcv.clip_x_origin = x - xoffset;
+	  gcv.clip_y_origin = y - yoffset;
+	  pixmap_mask |= (XLIKE_GC_FUNCTION | XLIKE_GC_CLIP_MASK |
+			  XLIKE_GC_CLIP_X_ORIGIN |
+			  XLIKE_GC_CLIP_Y_ORIGIN);
+	  /* Can't set a clip rectangle below because we already have a mask.
+	     We could conceivably create a new clipmask by zeroing out
+	     everything outside the clip region.  Is it worth it?
+	     Is it possible to get an equivalent effect by changing the
+	     args to XCopyArea below rather than messing with a clip box?
+	     - dkindred@cs.cmu.edu
+	     Yes. We don't clip at all now - andy@xemacs.org
+	  */
+	}
+
+      gc = gc_cache_lookup (DEVICE_XLIKE_GC_CACHE (d), &gcv, pixmap_mask);
+    }
+  else
+    {
+      gc = override_gc;
+      /* override_gc might have a mask already--we don't want to nuke it.
+	 Maybe we can insist that override_gc have no mask, or use
+	 one of the suggestions above. */
+    }
+
+#ifdef THIS_IS_X
+  /* depth of 0 means it's a bitmap, not a pixmap, and we should use
+     XCopyPlane (1 = current foreground color, 0 = background) instead
+     of XCopyArea, which means that the bits in the pixmap are actual
+     pixel values, instead of symbolic of fg/bg. */
+#endif /* THIS_IS_X */
+  if (IMAGE_INSTANCE_PIXMAP_DEPTH (p) > 0)
+    {
+#ifdef THIS_IS_X
+      XCopyArea (dpy,
+		 IMAGE_INSTANCE_X_PIXMAP_SLICE
+		 (p, IMAGE_INSTANCE_PIXMAP_SLICE (p)), x_win, gc, xoffset,
+		 yoffset, width,
+		 height, x, y);
+#else /* THIS_IS_GTK */
+      gdk_draw_pixmap (GDK_DRAWABLE (x_win), gc,
+		       IMAGE_INSTANCE_GTK_PIXMAP (p),
+		       xoffset, yoffset, x, y, width, height);
+#endif /* THIS_IS_GTK */
+    }
+  else
+    {
+#ifdef THIS_IS_X
+      XCopyPlane (dpy, IMAGE_INSTANCE_X_PIXMAP_SLICE
+		  (p, IMAGE_INSTANCE_PIXMAP_SLICE (p)), x_win, gc,
+		  xoffset, yoffset, width, height, x, y, 1L);
+#else /* THIS_IS_GTK */
+      our_draw_bitmap (GDK_DRAWABLE (x_win), gc,
+		       IMAGE_INSTANCE_GTK_PIXMAP (p),
+		       xoffset, yoffset, x, y, width, height);
+#endif /* THIS_IS_GTK */
+    }
+}
+
+static void
+XLIKE_output_pixmap (struct window *w, Lisp_Object image_instance,
+		     struct display_box *db, struct display_glyph_area *dga,
+		     face_index findex, int cursor_start, int cursor_width,
+		     int cursor_height, int UNUSED (bg_pixmap))
+{
+  struct frame *f = XFRAME (w->frame);
+  struct device *d = XDEVICE (f->device);
+  Lisp_Image_Instance *p = XIMAGE_INSTANCE (image_instance);
+  XLIKE_DISPLAY dpy = GET_XLIKE_DISPLAY (d);
+  XLIKE_WINDOW x_win = GET_XLIKE_WINDOW (f);
+
+  /* Output the pixmap. */
+  {
+    Lisp_Object tmp_pixel;
+    XLIKE_COLOR tmp_bcolor, tmp_fcolor;
+
+    tmp_pixel = WINDOW_FACE_CACHEL_FOREGROUND (w, findex);
+    tmp_fcolor = XCOLOR_INSTANCE_XLIKE_COLOR (tmp_pixel);
+    tmp_pixel = WINDOW_FACE_CACHEL_BACKGROUND (w, findex);
+    tmp_bcolor = XCOLOR_INSTANCE_XLIKE_COLOR (tmp_pixel);
+
+    XLIKE_OUTPUT_XLIKE_PIXMAP (f, p, db->xpos, db->ypos,
+			       dga->xoffset, dga->yoffset,
+			       dga->width, dga->height,
+			       XLIKE_COLOR_TO_PIXCOLOR (tmp_fcolor),
+			       XLIKE_COLOR_TO_PIXCOLOR (tmp_bcolor), 0);
+  }
+
+  /* Draw a cursor over top of the pixmap. */
+  if (cursor_width && cursor_height && (cursor_start >= db->xpos)
+      && !NILP (w->text_cursor_visible_p)
+      && (cursor_start < db->xpos + dga->width))
+    {
+      XLIKE_GC gc;
+      int focus = EQ (w->frame, DEVICE_FRAME_WITH_FOCUS_REAL (d));
+      struct face_cachel *cursor_cachel =
+	WINDOW_FACE_CACHEL (w,
+			    get_builtin_face_cache_index
+			    (w, Vtext_cursor_face));
+
+      gc = XLIKE_get_gc (d, Qnil, cursor_cachel->background, Qnil, Qnil, Qnil);
+
+      if (cursor_width > db->xpos + dga->width - cursor_start)
+	cursor_width = db->xpos + dga->width - cursor_start;
+
+      if (focus)
+	  XLIKE_FILL_RECTANGLE (dpy, x_win, gc, cursor_start, db->ypos,
+				cursor_width, cursor_height);
+      else
+	{
+	  XLIKE_DRAW_RECTANGLE (dpy, x_win, gc, cursor_start, db->ypos,
+				cursor_width, cursor_height);
+	}
+    }
+}
+
+/*****************************************************************************
+ XLIKE_output_vertical_divider
+
+ Draw a vertical divider down the right side of the given window.
+ ****************************************************************************/
+static void
+XLIKE_output_vertical_divider (struct window *w, int USED_IF_X(clear))
+{
+  struct frame *f = XFRAME (w->frame);
+  struct device *d = XDEVICE (f->device);
+
+  XLIKE_DISPLAY dpy = GET_XLIKE_DISPLAY (d);
+  XLIKE_WINDOW x_win = GET_XLIKE_WINDOW (f);
+  Lisp_Object tmp_pixel;
+  XLIKE_GCVALUES gcv;
+  XLIKE_GC background_gc;
+#ifdef THIS_IS_X
+  enum edge_style style;
+#endif /* THIS_IS_X */
+  unsigned long mask;
+  int x, y1, y2, width, shadow_thickness, spacing, line_width;
+  face_index div_face =
+    get_builtin_face_cache_index (w, Vvertical_divider_face);
+
+  width = window_divider_width (w);
+  shadow_thickness = XINT (w->vertical_divider_shadow_thickness);
+  spacing = XINT (w->vertical_divider_spacing);
+  line_width = XINT (w->vertical_divider_line_width);
+  x = WINDOW_RIGHT (w) - width;
+  y1 = WINDOW_TOP (w);
+  y2 = WINDOW_BOTTOM (w);
+
+  memset (&gcv, ~0, sizeof (gcv));
+
+  tmp_pixel = WINDOW_FACE_CACHEL_BACKGROUND (w, div_face);
+
+  /* First, get the GC's. */
+  XLIKE_SET_PIXCOLOR_COPY
+    (gcv.background,
+     XLIKE_COLOR_TO_PIXCOLOR (XCOLOR_INSTANCE_XLIKE_COLOR (tmp_pixel)));
+  gcv.foreground = gcv.background;
+  gcv.graphics_exposures = XLIKE_FALSE;
+  mask = XLIKE_GC_FOREGROUND | XLIKE_GC_BACKGROUND | XLIKE_GC_EXPOSURES;
+
+  background_gc = gc_cache_lookup (DEVICE_XLIKE_GC_CACHE (d), &gcv, mask);
+
+  /* Clear the divider area first.  This needs to be done when a
+     window split occurs. */
+#ifdef THIS_IS_X
+  if (clear)
+    XClearArea (dpy, x_win, x, y1, width, y2 - y1, False);
+#else /* THIS_IS_GTK */
+  /* if (clear) */
+  gdk_draw_rectangle (GDK_DRAWABLE (x_win), background_gc, TRUE,
+		      x, y1, width, y2 - y1);
+#endif /* THIS_IS_GTK */
+
+#ifndef THIS_IS_GTK
+   /* #### FIXME Why not? Formerly '#if 0' in the GDK code */
+  /* Draw the divider line. */
+  XLIKE_FILL_RECTANGLE (dpy, x_win, background_gc,
+			x + spacing + shadow_thickness, y1,
+			line_width, y2 - y1);
+
+  /* This code not formerly present in GTK version, maybe the omittal
+     is intentional? */
+  if (shadow_thickness < 0)
+    {
+      shadow_thickness = -shadow_thickness;
+      style = EDGE_BEVEL_IN;
+    }
+  else
+    {
+      style = EDGE_BEVEL_OUT;
+    }
+#endif /* not THIS_IS_GTK */
+
+  /* Draw the shadows around the divider line */
+#ifdef THIS_IS_X
+  x_bevel_area (w, div_face, x + spacing, y1,
+		width - 2 * spacing, y2 - y1,
+		shadow_thickness, EDGE_ALL, style);
+#else /* THIS_IS_GTK */
+  gtk_output_shadows (f, x + spacing, y1, 
+		      width - 2 * spacing, y2 - y1,
+		      shadow_thickness);
+#endif /* THIS_IS_GTK */
+}
+
+/*****************************************************************************
+ XLIKE_output_blank
+
+ Output a blank by clearing the area it covers in the foreground color
+ of its face.
+ ****************************************************************************/
+static void
+XLIKE_output_blank (struct window *w, struct display_line *dl, struct rune *rb,
+		    int start_pixpos, int cursor_start, int cursor_width)
+{
+  struct frame *f = XFRAME (w->frame);
+  struct device *d = XDEVICE (f->device);
+
+  XLIKE_DISPLAY dpy = GET_XLIKE_DISPLAY (d);
+  XLIKE_WINDOW x_win = GET_XLIKE_WINDOW (f);
+  XLIKE_GC gc;
+  struct face_cachel *cursor_cachel =
+    WINDOW_FACE_CACHEL (w,
+			get_builtin_face_cache_index
+			(w, Vtext_cursor_face));
+  Lisp_Object bg_pmap;
+  Lisp_Object buffer = WINDOW_BUFFER (w);
+  Lisp_Object bar_cursor_value = symbol_value_in_buffer (Qbar_cursor,
+							 buffer);
+
+  int x = rb->xpos;
+  int y = XLIKE_DISPLAY_LINE_YPOS (dl);
+  int height = XLIKE_DISPLAY_LINE_HEIGHT (dl);
+  int width = rb->width;
+
+  /* Unmap all subwindows in the area we are going to blank. */
+  redisplay_unmap_subwindows_maybe (f, x, y, width, height);
+
+  if (start_pixpos > x)
+    {
+      if (start_pixpos >= (x + width))
+	return;
+      else
+	{
+	  width -= (start_pixpos - x);
+	  x = start_pixpos;
+	}
+    }
+
+  bg_pmap = WINDOW_FACE_CACHEL_BACKGROUND_PIXMAP (w, rb->findex);
+  if (!IMAGE_INSTANCEP (bg_pmap)
+      || !IMAGE_INSTANCE_PIXMAP_TYPE_P (XIMAGE_INSTANCE (bg_pmap)))
+    bg_pmap = Qnil;
+
+  if (NILP (bg_pmap))
+    gc = XLIKE_get_gc (d, Qnil, WINDOW_FACE_CACHEL_BACKGROUND (w, rb->findex),
+		       Qnil, Qnil, Qnil);
+  else
+    gc = XLIKE_get_gc (d, Qnil, WINDOW_FACE_CACHEL_FOREGROUND (w, rb->findex),
+		       WINDOW_FACE_CACHEL_BACKGROUND (w, rb->findex), bg_pmap,
+		       Qnil);
+
+  XLIKE_FILL_RECTANGLE (dpy, x_win, gc, x, y, width, height);
+
+  /* If this rune is marked as having the cursor, then it is actually
+     representing a tab. */
+  if (!NILP (w->text_cursor_visible_p)
+      && (rb->cursor_type == CURSOR_ON
+	  || (cursor_width
+	      && (cursor_start + cursor_width > x)
+	      && cursor_start < (x + width))))
+    {
+      int cursor_height, cursor_y;
+      int focus = EQ (w->frame, DEVICE_FRAME_WITH_FOCUS_REAL (d));
+      Lisp_Font_Instance *fi;
+
+      fi = XFONT_INSTANCE (FACE_CACHEL_FONT
+			   (WINDOW_FACE_CACHEL (w, rb->findex),
+			    Vcharset_ascii));
+
+      gc = XLIKE_get_gc (d, Qnil, cursor_cachel->background, Qnil, Qnil, Qnil);
+
+      cursor_y = dl->ypos - fi->ascent;
+      cursor_height = fi->height;
+      if (cursor_y + cursor_height > y + height)
+	cursor_height = y + height - cursor_y;
+
+      if (focus)
+	{
+	  if (NILP (bar_cursor_value))
+	    {
+	      XLIKE_FILL_RECTANGLE (dpy, x_win, gc, cursor_start, cursor_y,
+				    fi->width, cursor_height);
+	    }
+	  else
+	    {
+	      int bar_width = EQ (bar_cursor_value, Qt) ? 1 : 2;
+
+	      gc = XLIKE_get_gc (d, Qnil, cursor_cachel->background,
+				 Qnil, Qnil, make_int (bar_width));
+	      XLIKE_DRAW_LINE (dpy, x_win, gc, cursor_start + bar_width - 1,
+			       cursor_y, cursor_start + bar_width - 1,
+			       cursor_y + cursor_height - 1);
+	    }
+	}
+      else if (NILP (bar_cursor_value))
+	{
+	  XLIKE_DRAW_RECTANGLE (dpy, x_win, gc, cursor_start, cursor_y,
+				fi->width - 1, cursor_height - 1);
+	}
+    }
+}
+
+/*****************************************************************************
+ XLIKE_output_horizontal_line
+
+ Output a horizontal line in the foreground of its face.
+ ****************************************************************************/
+static void
+XLIKE_output_horizontal_line (struct window *w, struct display_line *dl,
+			      struct rune *rb)
+{
+  struct frame *f = XFRAME (w->frame);
+  struct device *d = XDEVICE (f->device);
+
+  XLIKE_DISPLAY dpy = GET_XLIKE_DISPLAY (d);
+  XLIKE_WINDOW x_win = GET_XLIKE_WINDOW (f);
+  XLIKE_GC gc;
+
+  int x = rb->xpos;
+  int width = rb->width;
+  int height = XLIKE_DISPLAY_LINE_HEIGHT (dl);
+  int ypos1, ypos2, ypos3, ypos4;
+
+  ypos1 = XLIKE_DISPLAY_LINE_YPOS (dl);
+  ypos2 = ypos1 + rb->object.hline.yoffset;
+  ypos3 = ypos2 + rb->object.hline.thickness;
+  ypos4 = dl->ypos + dl->descent - dl->clip;
+
+  /* First clear the area not covered by the line. */
+  if (height - rb->object.hline.thickness > 0)
+    {
+      gc = XLIKE_get_gc (d, Qnil,
+			 WINDOW_FACE_CACHEL_FOREGROUND (w, rb->findex),
+			 Qnil, Qnil, Qnil);
+
+      if (ypos2 - ypos1 > 0)
+	XLIKE_FILL_RECTANGLE (dpy, x_win, gc, x, ypos1, width, ypos2 - ypos1);
+      if (ypos4 - ypos3 > 0)
+	XLIKE_FILL_RECTANGLE (dpy, x_win, gc, x, ypos1, width, ypos2 - ypos1);
+    }
+
+#ifdef THIS_IS_GTK
+  {
+    GtkStyle *style = FRAME_GTK_TEXT_WIDGET (f)->style;
+    gtk_paint_hline (style, x_win, GTK_STATE_NORMAL, NULL,
+		     FRAME_GTK_TEXT_WIDGET (f), "hline", x, x + width, ypos2);
+  }
+#else /* THIS_IS_X */
+  /* Now draw the line. */
+  gc = XLIKE_get_gc (d, Qnil, WINDOW_FACE_CACHEL_BACKGROUND (w, rb->findex),
+		     Qnil, Qnil, Qnil);
+
+  if (ypos2 < ypos1)
+    ypos2 = ypos1;
+  if (ypos3 > ypos4)
+    ypos3 = ypos4;
+
+  if (ypos3 - ypos2 > 0)
+    XLIKE_FILL_RECTANGLE (dpy, x_win, gc, x, ypos2, width, ypos3 - ypos2);
+#endif /* THIS_IS_X */
+}
+
+/****************************************************************************
+ XLIKE_clear_region
+
+ Clear the area in the box defined by the given parameters using the
+ given face.
+ ****************************************************************************/
+static void
+XLIKE_clear_region (Lisp_Object UNUSED (locale), struct device* d,
+		    struct frame* f, face_index UNUSED (findex), int x, int y,
+		    int width, int height, Lisp_Object fcolor,
+		    Lisp_Object bcolor, Lisp_Object background_pixmap)
+{
+  XLIKE_DISPLAY dpy = GET_XLIKE_DISPLAY (d);
+  XLIKE_WINDOW x_win = GET_XLIKE_WINDOW (f);
+  XLIKE_GC gc = NULL;
+
+  if (!UNBOUNDP (background_pixmap))
+    {
+      gc = XLIKE_get_gc (d, Qnil, fcolor, bcolor, background_pixmap, Qnil);
+    }
+
+  if (gc)
+    XLIKE_FILL_RECTANGLE (dpy, x_win, gc, x, y, width, height);
+  else
+    XLIKE_CLEAR_AREA (dpy, x_win, x, y, width, height);
+}
+
+/*****************************************************************************
+ xlike_output_eol_cursor
+
+ Draw a cursor at the end of a line.  The end-of-line cursor is
+ narrower than the normal cursor.
+ ****************************************************************************/
+static void
+XLIKE_output_eol_cursor (struct window *w, struct display_line *dl, int xpos,
+			 face_index findex)
+{
+  struct frame *f = XFRAME (w->frame);
+  struct device *d = XDEVICE (f->device);
+  Lisp_Object window;
+
+  XLIKE_DISPLAY dpy = GET_XLIKE_DISPLAY (d);
+  XLIKE_WINDOW x_win = GET_XLIKE_WINDOW (f);
+  XLIKE_GC gc = NULL;
+  face_index elt = get_builtin_face_cache_index (w, Vtext_cursor_face);
+  struct face_cachel *cursor_cachel = WINDOW_FACE_CACHEL (w, elt);
+
+  int focus = EQ (w->frame, DEVICE_FRAME_WITH_FOCUS_REAL (d));
+  Lisp_Object bar_cursor_value = symbol_value_in_buffer (Qbar_cursor,
+							 WINDOW_BUFFER (w));
+
+  int x = xpos;
+  int y = XLIKE_DISPLAY_LINE_YPOS (dl);
+  int width = EOL_CURSOR_WIDTH;
+  int height = XLIKE_DISPLAY_LINE_HEIGHT (dl);
+  int cursor_height, cursor_y;
+  int defheight, defascent;
+
+  window = wrap_window (w);
+  redisplay_clear_region (window, findex, x, y, width, height);
+
+  if (NILP (w->text_cursor_visible_p))
+    return;
+
+  gc = XLIKE_get_gc (d, Qnil, cursor_cachel->background, Qnil, Qnil, Qnil);
+
+  default_face_font_info (window, &defascent, 0, &defheight, 0, 0);
+
+  /* make sure the cursor is entirely contained between y and y+height */
+  cursor_height = min (defheight, height);
+  cursor_y = max (y, min (y + height - cursor_height,
+			  dl->ypos - defascent));
+
+  if (focus)
+    {
+#ifdef HAVE_XIM
+      XIM_SetSpotLocation (f, x - 2 , cursor_y + cursor_height - 2);
+#endif /* HAVE_XIM */
+
+      if (NILP (bar_cursor_value))
+	{
+	  XLIKE_FILL_RECTANGLE (dpy, x_win, gc, x, cursor_y, width,
+				cursor_height);
+	}
+      else
+	{
+	  int bar_width = EQ (bar_cursor_value, Qt) ? 1 : 2;
+
+	  gc = XLIKE_get_gc (d, Qnil, cursor_cachel->background, Qnil, Qnil,
+			     make_int (bar_width));
+	  XLIKE_DRAW_LINE (dpy, x_win, gc, x + bar_width - 1, cursor_y,
+			   x + bar_width - 1, cursor_y + cursor_height - 1);
+	}
+    }
+  else if (NILP (bar_cursor_value))
+    {
+      XLIKE_DRAW_RECTANGLE (dpy, x_win, gc, x, cursor_y, width - 1,
+			    cursor_height - 1);
+    }
+}
+
+static void
+XLIKE_clear_frame_window (Lisp_Object window)
+{
+  struct window *w = XWINDOW (window);
+
+  if (!NILP (w->vchild))
+    {
+      XLIKE_clear_frame_windows (w->vchild);
+      return;
+    }
+
+  if (!NILP (w->hchild))
+    {
+      XLIKE_clear_frame_windows (w->hchild);
+      return;
+    }
+
+  redisplay_clear_to_window_end (w, WINDOW_TEXT_TOP (w),
+				 WINDOW_TEXT_BOTTOM (w));
+}
+
+static void
+XLIKE_clear_frame_windows (Lisp_Object window)
+{
+  for (; !NILP (window); window = XWINDOW (window)->next)
+    XLIKE_clear_frame_window (window);
+}
+
+static void
+XLIKE_clear_frame (struct frame *f)
+{
+  XLIKE_DISPLAY dpy = GET_XLIKE_DISPLAY (XDEVICE (f->device));
+  XLIKE_WINDOW x_win = GET_XLIKE_WINDOW (f);
+  int x, y, width, height;
+  Lisp_Object frame;
+
+  x = FRAME_LEFT_BORDER_START (f);
+  width = (FRAME_PIXWIDTH (f) - FRAME_REAL_LEFT_TOOLBAR_WIDTH (f) -
+	   FRAME_REAL_RIGHT_TOOLBAR_WIDTH (f) -
+	   2 * FRAME_REAL_LEFT_TOOLBAR_BORDER_WIDTH (f) -
+	   2 * FRAME_REAL_RIGHT_TOOLBAR_BORDER_WIDTH (f));
+  /* #### This adjustment by 1 should be being done in the macros.
+     There is some small differences between when the menubar is on
+     and off that we still need to deal with. */
+  y = FRAME_TOP_BORDER_START (f) - 1;
+  height = (FRAME_PIXHEIGHT (f) - FRAME_REAL_TOP_TOOLBAR_HEIGHT (f) -
+	    FRAME_REAL_BOTTOM_TOOLBAR_HEIGHT (f) -
+	    2 * FRAME_REAL_TOP_TOOLBAR_BORDER_WIDTH (f) -
+	    2 * FRAME_REAL_BOTTOM_TOOLBAR_BORDER_WIDTH (f)) + 1;
+
+  XLIKE_CLEAR_AREA (dpy, x_win, x, y, width, height);
+
+  frame = wrap_frame (f);
+
+  if (!UNBOUNDP (FACE_BACKGROUND_PIXMAP (Vdefault_face, frame))
+      || !UNBOUNDP (FACE_BACKGROUND_PIXMAP (Vleft_margin_face, frame))
+      || !UNBOUNDP (FACE_BACKGROUND_PIXMAP (Vright_margin_face, frame)))
+    {
+      XLIKE_clear_frame_windows (f->root_window);
+    }
+#ifdef THIS_IS_X
+  {
+    struct device *d = XDEVICE (f->device);
+    if (!(check_if_pending_expose_event (d)))
+      XFlush (DEVICE_X_DISPLAY (d));
+  }
+#endif /* THIS_IS_X */
+}
+
+/* briefly swap the foreground and background colors.
+ */
+
+static int
+XLIKE_flash (struct device *d)
+{
+  struct frame *f = device_selected_frame (d);
+  XLIKE_DISPLAY dpy = GET_XLIKE_DISPLAY (d);
+  XLIKE_WINDOW win = GET_XLIKE_WINDOW (f);
+  XLIKE_GC gc = NULL;
+  XLIKE_GCVALUES gcv;
+  XLIKE_COLOR tmp_fcolor, tmp_bcolor;
+  Lisp_Object tmp_pixel, frame;
+  struct window *w = XWINDOW (FRAME_ROOT_WINDOW (f));
+  int flash_height;
+
+  frame = wrap_frame (f);
+
+  tmp_pixel = FACE_FOREGROUND (Vdefault_face, frame);
+  XLIKE_SET_PIXCOLOR_COPY (tmp_fcolor,
+			   XCOLOR_INSTANCE_XLIKE_COLOR (tmp_pixel));
+  tmp_pixel = FACE_BACKGROUND (Vdefault_face, frame);
+  XLIKE_SET_PIXCOLOR_COPY (tmp_bcolor,
+			   XCOLOR_INSTANCE_XLIKE_COLOR (tmp_pixel));
+  memset (&gcv, ~0, sizeof (gcv)); /* initialize all slots to ~0 */
+  XLIKE_SET_PIXCOLOR_NUM (gcv.foreground,
+			  (tmp_fcolor.pixel ^ tmp_bcolor.pixel));
+  gcv.function = XLIKE_GX_XOR;
+  gcv.graphics_exposures = XLIKE_FALSE;
+  gc = gc_cache_lookup (DEVICE_XLIKE_GC_CACHE (XDEVICE (f->device)), &gcv,
+			XLIKE_GC_FOREGROUND | XLIKE_GC_FUNCTION | XLIKE_GC_EXPOSURES);
+  default_face_height_and_width (frame, &flash_height, 0);
+
+  /* If window is tall, flash top and bottom line.  */
+  if (EQ (Vvisible_bell, Qtop_bottom) && w->pixel_height > 3 * flash_height)
+    {
+      XLIKE_FILL_RECTANGLE (dpy, win, gc, w->pixel_left, w->pixel_top,
+			    w->pixel_width, flash_height);
+      XLIKE_FILL_RECTANGLE (dpy, win, gc, w->pixel_left,
+			    w->pixel_top + w->pixel_height - flash_height,
+			    w->pixel_width, flash_height);
+    }
+  else
+    /* If it is short, flash it all.  */
+    XLIKE_FILL_RECTANGLE (dpy, win, gc, w->pixel_left, w->pixel_top,
+			  w->pixel_width, w->pixel_height);
+
+  XLIKE_FLUSH (dpy);
+
+#ifdef HAVE_SELECT
+  {
+    int usecs = 100000;
+    struct timeval tv;
+    tv.tv_sec  = usecs / 1000000L;
+    tv.tv_usec = usecs % 1000000L;
+    /* I'm sure someone is going to complain about this... */
+    select (0, 0, 0, 0, &tv);
+  }
+#else
+#ifdef HAVE_POLL
+  poll (0, 0, 100);
+#else /* !HAVE_POLL */
+#error bite me
+#endif /* HAVE_POLL */
+#endif /* HAVE_SELECT */
+
+  /* If window is tall, flash top and bottom line.  */
+  if (EQ (Vvisible_bell, Qtop_bottom) && w->pixel_height > 3 * flash_height)
+    {
+      XLIKE_FILL_RECTANGLE (dpy, win, gc, w->pixel_left, w->pixel_top,
+			    w->pixel_width, flash_height);
+      XLIKE_FILL_RECTANGLE (dpy, win, gc, w->pixel_left,
+			    w->pixel_top + w->pixel_height - flash_height,
+			    w->pixel_width, flash_height);
+    }
+  else
+    /* If it is short, flash it all.  */
+    XLIKE_FILL_RECTANGLE (dpy, win, gc, w->pixel_left, w->pixel_top,
+			  w->pixel_width, w->pixel_height);
+
+  XLIKE_FLUSH (dpy);
+
+  return 1;
+}
+
+
+/************************************************************************/
+/*                            initialization                            */
+/************************************************************************/
+
+void
+console_type_create_redisplay_XLIKE (void)
+{
+  /* redisplay methods */
+  XLIKE_CONSOLE_HAS_METHOD (text_width);
+  XLIKE_CONSOLE_HAS_METHOD (output_display_block);
+  XLIKE_CONSOLE_HAS_METHOD (divider_height);
+  XLIKE_CONSOLE_HAS_METHOD (eol_cursor_width);
+  XLIKE_CONSOLE_HAS_METHOD (output_vertical_divider);
+  XLIKE_CONSOLE_HAS_METHOD (clear_region);
+  XLIKE_CONSOLE_HAS_METHOD (clear_frame);
+  XLIKE_CONSOLE_HAS_METHOD (flash);
+  XLIKE_CONSOLE_HAS_METHOD (ring_bell);
+  XLIKE_CONSOLE_HAS_METHOD (bevel_area);
+  XLIKE_CONSOLE_HAS_METHOD (output_string);
+  XLIKE_CONSOLE_HAS_METHOD (output_pixmap);
+
+#ifdef THIS_IS_X
+  XLIKE_CONSOLE_HAS_METHOD (window_output_begin);
+  XLIKE_CONSOLE_HAS_METHOD (window_output_end);
+#endif
+}
--- a/src/redisplay.c	Wed Jan 27 06:00:09 2010 -0600
+++ b/src/redisplay.c	Thu Jan 28 02:48:45 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;
@@ -690,7 +690,12 @@
 			       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_length (rtw_ichar_dynarr)));
@@ -9838,7 +9843,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;
--- a/src/search.c	Wed Jan 27 06:00:09 2010 -0600
+++ b/src/search.c	Thu Jan 28 02:48:45 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;
     }
@@ -2199,7 +2199,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
@@ -2857,7 +2857,7 @@
 
       /* replacement can be nil. */
       if (NILP (replacement))
-	replacement = build_string ("");
+	replacement = build_ascstring ("");
 
       if (case_action == all_caps)
 	replacement = Fupcase (replacement, buffer);
--- a/src/select-common.h	Wed Jan 27 06:00:09 2010 -0600
+++ b/src/select-common.h	Thu Jan 28 02:48:45 2010 -0600
@@ -82,7 +82,7 @@
 
   /* Convert any 8-bit data to a string, for compactness. */
   else if (format == 8)
-    return make_ext_string ((Extbyte *) data, size,
+    return make_extstring ((Extbyte *) data, size,
 			    type == DEVICE_XATOM_TEXT (d) ||
 			    type == DEVICE_XATOM_COMPOUND_TEXT (d)
 			    ? Qctext : Qbinary);
@@ -96,7 +96,7 @@
 
   /* Convert any 8-bit data to a string, for compactness. */
   else if (format == 8)
-    return make_ext_string ((Extbyte *) data, size,
+    return make_extstring ((Extbyte *) data, size,
 			    ((type == gdk_atom_intern ("TEXT", FALSE)) ||
 			     (type == gdk_atom_intern ("COMPOUND_TEXT", FALSE)))
 			    ? Qctext : Qbinary);
--- a/src/select-gtk.c	Wed Jan 27 06:00:09 2010 -0600
+++ b/src/select-gtk.c	Thu Jan 28 02:48:45 2010 -0600
@@ -78,7 +78,7 @@
 
     EXTERNAL_TO_C_STRING (str, intstr, Qctext);
     g_free (str);
-    return intern_int (intstr);
+    return intern_istring (intstr);
   }
 }
 
--- a/src/select-msw.c	Wed Jan 27 06:00:09 2010 -0600
+++ b/src/select-msw.c	Thu Jan 28 02:48:45 2010 -0600
@@ -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 ();
--- a/src/select-x.c	Wed Jan 27 06:00:09 2010 -0600
+++ b/src/select-x.c	Thu Jan 28 02:48:45 2010 -0600
@@ -192,7 +192,7 @@
 			C_STRING_ALLOCA, intstr,
 			Qctext);
     XFree (str);
-    return intern_int (intstr);
+    return intern_istring (intstr);
   }
 }
 
@@ -1377,7 +1377,7 @@
      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);
--- a/src/sheap.c	Wed Jan 27 06:00:09 2010 -0600
+++ b/src/sheap.c	Thu Jan 28 02:48:45 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"
--- a/src/sound.c	Wed Jan 27 06:00:09 2010 -0600
+++ b/src/sound.c	Thu Jan 28 02:48:45 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: ", /*
--- a/src/specifier.c	Wed Jan 27 06:00:09 2010 -0600
+++ b/src/specifier.c	Thu Jan 28 02:48:45 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, "<unspecified>");
+    write_ascstring (printcharfun, "<unspecified>");
   else
     print_internal (the_specs, printcharfun, 1);
   if (!NILP (sp->fallback))
--- a/src/symbols.c	Wed Jan 27 06:00:09 2010 -0600
+++ b/src/symbols.c	Thu Jan 28 02:48:45 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.
 
@@ -177,7 +177,7 @@
 }
 
 Lisp_Object
-intern_int (const Ibyte *str)
+intern_istring (const Ibyte *str)
 {
   Bytecount len = qxestrlen (str);
   Lisp_Object obarray = Vobarray;
@@ -197,7 +197,7 @@
 Lisp_Object
 intern (const CIbyte *str)
 {
-  return intern_int ((Ibyte *) str);
+  return intern_istring ((Ibyte *) str);
 }
 
 Lisp_Object
@@ -210,7 +210,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, /*
@@ -731,7 +731,7 @@
 */
        (subr))
 {
-  const char *name;
+  const Ascbyte *name;
   CHECK_SUBR (subr);
 
   name = XSUBR (subr)->name;
@@ -774,6 +774,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 +1182,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 +1230,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 +1249,7 @@
 	    {
 	      if (magicfun)
 		magicfun (sym, &value, wrap_buffer (b), 0);
-	      *((Lisp_Object *) (offset + (char *) b)) = value;
+	      *((Lisp_Object *) (offset + (Rawbyte *) b)) = value;
 	    }
 	}
     }
@@ -1211,13 +1270,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 +1289,7 @@
 	    {
 	      if (magicfun)
 		magicfun (sym, &value, console, 0);
-	      *((Lisp_Object *) (offset + (char *) d)) = value;
+	      *((Lisp_Object *) (offset + (Rawbyte *) d)) = value;
 	    }
 	}
     }
@@ -1307,9 +1366,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 +1379,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 +2058,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 +2505,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 +2516,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 +2599,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 +2610,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,7 +3590,7 @@
 }
 
 static void
-defsymbol_massage_name_1 (Lisp_Object *location, const char *name, int dump_p,
+defsymbol_massage_name_1 (Lisp_Object *location, const Ascbyte *name, int dump_p,
 			  int multiword_predicate_p)
 {
   char temp[500];
@@ -3559,32 +3618,32 @@
 }
 
 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)),
@@ -3593,7 +3652,7 @@
 }
 
 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)),
@@ -3602,14 +3661,14 @@
 }
 
 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 +3761,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 +3848,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 +3863,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 +3985,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 +3998,7 @@
    */
   if (initialized)
     {
-      sym = Fintern (build_string (symbol_name), Qnil);
+      sym = Fintern (build_ascstring (symbol_name), Qnil);
       LOADHIST_ATTACH (sym);
     }
   else
--- a/src/symeval.h	Wed Jan 27 06:00:09 2010 -0600
+++ b/src/symeval.h	Thu Jan 28 02:48:45 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
--- a/src/sysdep.c	Wed Jan 27 06:00:09 2010 -0600
+++ b/src/sysdep.c	Thu Jan 28 02:48:45 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;
@@ -3572,7 +3570,7 @@
 #if defined(WIN32_NATIVE) || defined(CYGWIN)
 const char *sys_siglist[] =
   {
-    /* $$####begin-snarf */
+    /* @@@begin-snarf@@@ */
     "bum signal!!",
     "hangup",
     "interrupt",
@@ -3598,8 +3596,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 +3606,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 */
--- a/src/sysdll.c	Wed Jan 27 06:00:09 2010 -0600
+++ b/src/sysdll.c	Thu Jan 28 02:48:45 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 <wmperry@aventail.com>
 
 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 <config.h>
 #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
@@ -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);
+  C_STRING_TO_EXTERNAL (n, next, 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);
+  C_STRING_TO_EXTERNAL (n, next, 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)
@@ -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 = NEW_C_STRING_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 = NEW_C_STRING_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.
 */
@@ -243,21 +252,20 @@
     {
       LISP_STRING_TO_EXTERNAL (fname, soname, 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 =
+		NEW_C_STRING_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);
+  C_STRING_TO_EXTERNAL (n, next, 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);
+  C_STRING_TO_EXTERNAL (n, next, 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 */
@@ -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);
+  C_STRING_TO_EXTERNAL (n, next, 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);
+  C_STRING_TO_EXTERNAL (n, next, 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 */
 
--- a/src/sysdll.h	Wed Jan 27 06:00:09 2010 -0600
+++ b/src/sysdll.h	Thu Jan 28 02:48:45 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_ */
--- a/src/sysfile.h	Wed Jan 27 06:00:09 2010 -0600
+++ b/src/sysfile.h	Thu Jan 28 02:48:45 2010 -0600
@@ -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 */
 
--- a/src/syswindows.h	Wed Jan 27 06:00:09 2010 -0600
+++ b/src/syswindows.h	Thu Jan 28 02:48:45 2010 -0600
@@ -846,7 +846,7 @@
   EXTERNAL_TO_C_STRING_MALLOC (in, out, 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
@@ -1238,8 +1238,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);
--- a/src/tests.c	Wed Jan 27 06:00:09 2010 -0600
+++ b/src/tests.c	Thu Jan 28 02:48:45 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
@@ -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;
--- a/src/text.c	Wed Jan 27 06:00:09 2010 -0600
+++ b/src/text.c	Thu Jan 28 02:48:45 2010 -0600
@@ -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. */
 
@@ -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
--- a/src/text.h	Wed Jan 27 06:00:09 2010 -0600
+++ b/src/text.h	Thu Jan 28 02:48:45 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 {								\
@@ -2420,7 +2431,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
@@ -2843,8 +2854,8 @@
 #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(). */
+/* In place of EXTERNAL_TO_LISP_STRING(), use build_extstring() and/or
+   make_extstring(). */
 
 #ifdef TEST_NEW_DFC
 #define C_STRING_TO_EXTERNAL_MALLOC(in, out, codesys)			\
@@ -2957,26 +2968,6 @@
   (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
-
 /* Wexttext functions.  The type of Wexttext is selected at compile time
    and will sometimes be wchar_t, sometimes char. */
 
@@ -3001,7 +2992,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 +3017,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 +3080,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
--- a/src/tooltalk.c	Wed Jan 27 06:00:09 2010 -0600
+++ b/src/tooltalk.c	Thu Jan 28 02:48:45 2010 -0600
@@ -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
@@ -1215,8 +1215,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 +1224,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 +1265,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 +1421,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);
--- a/src/ui-byhand.c	Wed Jan 27 06:00:09 2010 -0600
+++ b/src/ui-byhand.c	Thu Jan 28 02:48:45 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, /*
--- a/src/ui-gtk.c	Wed Jan 27 06:00:09 2010 -0600
+++ b/src/ui-gtk.c	Thu Jan 28 02:48:45 2010 -0600
@@ -94,7 +94,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 */
@@ -463,43 +463,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);
     }
 }
@@ -643,13 +643,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);
@@ -662,8 +662,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));
 
@@ -798,11 +798,11 @@
   if (print_readably)
     printing_unreadable_lcrecord (obj, 0);
 
-  write_c_string (printcharfun, "#<GtkObject (");
+  write_ascstring (printcharfun, "#<GtkObject (");
   if (XGTK_OBJECT (obj)->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);
 }
 
@@ -1117,8 +1117,8 @@
   if (print_readably)
     printing_unreadable_lcrecord (obj, 0);
 
-  write_c_string (printcharfun, "#<GtkBoxed (");
-  write_c_string (printcharfun, gtk_type_name (XGTK_BOXED (obj)->object_type));
+  write_ascstring (printcharfun, "#<GtkBoxed (");
+  write_cistring (printcharfun, gtk_type_name (XGTK_BOXED (obj)->object_type));
   write_fmt_string (printcharfun, ") %p>", (void *) XGTK_BOXED (obj)->object);
 }
 
@@ -1497,7 +1497,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:
@@ -2137,7 +2137,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);
@@ -2206,7 +2206,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);
--- a/src/unexaix.c	Wed Jan 27 06:00:09 2010 -0600
+++ b/src/unexaix.c	Thu Jan 28 02:48:45 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 */
 
--- a/src/unexec.c	Wed Jan 27 06:00:09 2010 -0600
+++ b/src/unexec.c	Thu Jan 28 02:48:45 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 */
 
--- a/src/unicode.c	Wed Jan 27 06:00:09 2010 -0600
+++ b/src/unicode.c	Thu Jan 28 02:48:45 2010 -0600
@@ -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)));
 }
--- a/src/win32.c	Wed Jan 27 06:00:09 2010 -0600
+++ b/src/win32.c	Thu Jan 28 02:48:45 2010 -0600
@@ -95,7 +95,7 @@
   TSTR_TO_C_STRING (path, ttlff);
   INTERNAL_MSWIN_TO_LOCAL_FILE_FORMAT (ttlff, ttlff);
 
-  return build_intstring (ttlff);
+  return build_istring (ttlff);
 }
 
 /* Normalize filename by converting all path separators to the specified
@@ -289,7 +289,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 +299,11 @@
 }
 
 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);
+			  reason, data);
 }
 
 DEFUN ("mswindows-shell-execute", Fmswindows_shell_execute, 2, 4, 0, /*
@@ -405,7 +405,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
 
--- a/src/window.c	Wed Jan 27 06:00:09 2010 -0600
+++ b/src/window.c	Thu Jan 28 02:48:45 2010 -0600
@@ -318,10 +318,10 @@
   if (print_readably)
     printing_unreadable_lcrecord (obj, 0);
 
-  write_c_string (printcharfun, "#<window");
+  write_ascstring (printcharfun, "#<window");
   buf = XWINDOW_BUFFER (obj);
   if (EQ (buf, Qt))
-    write_c_string (printcharfun, " during creation");
+    write_ascstring (printcharfun, " during creation");
   else if (!NILP (buf))
     {
       
@@ -1048,7 +1048,7 @@
 }
 
 int
-window_scrollbar_width (struct window *w)
+window_scrollbar_width (struct window * USED_IF_SCROLLBARS (w))
 {
 #ifdef HAVE_SCROLLBARS
   if (!WINDOW_WIN_P (w)
@@ -1067,7 +1067,7 @@
 /* Horizontal scrollbars are only active on windows with truncation
    turned on. */
 int
-window_scrollbar_height (struct window *w)
+window_scrollbar_height (struct window * USED_IF_SCROLLBARS (w))
 {
 #ifdef HAVE_SCROLLBARS
   if (!WINDOW_WIN_P (w)
@@ -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;
 
--- a/src/xemacs.def.in.in	Wed Jan 27 06:00:09 2010 -0600
+++ b/src/xemacs.def.in.in	Thu Jan 28 02:48:45 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 <config.h>
+
+#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
 
--- a/tests/ChangeLog	Wed Jan 27 06:00:09 2010 -0600
+++ b/tests/ChangeLog	Thu Jan 28 02:48:45 2010 -0600
@@ -1,3 +1,27 @@
+2010-01-25  Ben Wing  <ben@xemacs.org>
+
+	* 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  <ben@xemacs.org>
+
+	* 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-01-27  Ben Wing  <ben@xemacs.org>
 
 	* automated/test-harness.el (test-harness-from-buffer):
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/tests/automated/file-tests.el	Thu Jan 28 02:48:45 2010 -0600
@@ -0,0 +1,45 @@
+;;; file-tests.el --- test support for filesystem primitives
+
+;; Copyright (C) 2010 Ben Wing.
+
+;; Author: Ben Wing <ben@xemacs.org>
+;; Maintainer: Ben Wing <ben@xemacs.org>
+;; 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)))
+
+
--- a/tests/automated/test-harness.el	Wed Jan 27 06:00:09 2010 -0600
+++ b/tests/automated/test-harness.el	Thu Jan 28 02:48:45 2010 -0600
@@ -651,7 +651,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