changeset 2421:ab71ad6ff3dd

[xemacs-hg @ 2004-12-06 03:50:53 by ben] (none) README.packages: Document use of --package-prefix. Fix error in specifying standard package location. make-docfile.c: Use QXE_PATH_MAX. info.el: Correct doc string giving example package path. menubar-items.el: Move Prefix Rectangle command up one level. xemacs/packages.texi: Add long form of Lisp Reference Manual to links. Add links pointing to Lisp Reference Manual for more detailed package discussion. lispref/range-tables.texi: Document range-table changes. internals/internals.texi: Update history section. elhash.c, elhash.h, profile.c: Create inchash_eq() to allow direct incrementing of hash-table entry. Use in profile.c to try to reduce profiling overhead. Increase initial size of profile hash tables to reduce profiling overhead. buffer.c, device-msw.c, dialog-msw.c, dired-msw.c, editfns.c, event-msw.c, events.c, glyphs-msw.c, keymap.c, objects-msw.c, process-nt.c, syswindows.h, text.c, text.h, unexnt.c: Rename xetcs* -> qxetcs* for consistency with qxestr*. Rename ei*_c(_*) -> ei*_ascii(_*) since they work with ASCII-only strings not "C strings", whatever those are. This is the last place where "c" was incorrectly being used for "ascii". dialog-msw.c, dumper.c, event-msw.c, fileio.c, glyphs-gtk.c, glyphs-x.c, nt.c, process-nt.c, realpath.c, sysdep.c, sysfile.h, unexcw.c, unexnext.c, unexnt.c: Try to avoid differences in systems that do or do not include final null byte in PATH_MAX. Create PATH_MAX_INTERNAL and PATH_MAX_EXTERNAL and use them everywhere. Rewrite code in dumper.c to avoid use of PATH_MAX. When necessary in nt.c, use _MAX_PATH instead of MAX_PATH to be consistent with other places. text.c: Code to short-circuit when binary or Unicode was not working due to EOL wrapping. Fix this code to work when either no EOL autodetection or no CR's or LF's in the text. lisp.h, rangetab.c, rangetab.h, regex.c, search.c: Implement different types of ranges (open/closed start and end). Change default to be start-closed, end-open.
author ben
date Mon, 06 Dec 2004 03:52:23 +0000
parents ad56e5a6d09f
children 39c1377df3a0
files lib-src/ChangeLog lib-src/make-docfile.c lisp/ChangeLog lisp/info.el lisp/menubar-items.el man/ChangeLog man/internals/internals.texi man/lispref/range-tables.texi man/xemacs-faq.texi man/xemacs/packages.texi nt/installer/Wise/ChangeLog src/ChangeLog src/buffer.c src/device-msw.c src/dialog-msw.c src/dired-msw.c src/dumper.c src/editfns.c src/elhash.c src/elhash.h src/eval.c src/event-msw.c src/events.c src/fileio.c src/glyphs-gtk.c src/glyphs-msw.c src/glyphs-x.c src/keymap.c src/lisp.h src/nt.c src/objects-msw.c src/process-nt.c src/profile.c src/rangetab.c src/rangetab.h src/realpath.c src/regex.c src/search.c src/symbols.c src/sysdep.c src/sysfile.h src/syswindows.h src/text.c src/text.h src/unexcw.c src/unexnext.c src/unexnt.c
diffstat 47 files changed, 1053 insertions(+), 302 deletions(-) [+]
line wrap: on
line diff
--- a/lib-src/ChangeLog	Mon Dec 06 03:46:07 2004 +0000
+++ b/lib-src/ChangeLog	Mon Dec 06 03:52:23 2004 +0000
@@ -1,3 +1,9 @@
+2004-12-05  Ben Wing  <ben@xemacs.org>
+
+	* make-docfile.c (main):
+	* make-docfile.c (scan_c_file):
+	Use QXE_PATH_MAX.
+
 2004-11-08  Stephen J. Turnbull  <stephen@xemacs.org>
 
 	* ellcc.h.in: Use XE_CFLAGS, not CFLAGS.
--- a/lib-src/make-docfile.c	Mon Dec 06 03:46:07 2004 +0000
+++ b/lib-src/make-docfile.c	Mon Dec 06 03:52:23 2004 +0000
@@ -220,11 +220,11 @@
 	  /* Allow a file containing files to process, for use w/MS Windows
 	     (where command-line length limits are more problematic) */
 	  FILE *argfile = fopen (argv[i] + 1, READ_TEXT);
-	  char arg[PATH_MAX];
+	  char arg[QXE_PATH_MAX];
 
 	  if (!argfile)
 	    fatal ("Unable to open argument file %s", argv[i] + 1);
-	  while (fgets (arg, PATH_MAX, argfile))
+	  while (fgets (arg, QXE_PATH_MAX, argfile))
 	    {
 	      if (arg[strlen (arg) - 1] == '\n')
 		arg[strlen (arg) - 1] = '\0'; /* chop \n */
@@ -640,10 +640,10 @@
   register int defvarflag;
   int minargs, maxargs;
   int l = strlen (filename);
-  char f[PATH_MAX];
+  char f[QXE_PATH_MAX];
 
   /* XEmacs change: different method for checking filename extension */
-  if (l > PATH_MAX - 1)
+  if (l > QXE_PATH_MAX - 1)
     {
 #ifdef ENAMETOOLONG
       errno = ENAMETOOLONG;
--- a/lisp/ChangeLog	Mon Dec 06 03:46:07 2004 +0000
+++ b/lisp/ChangeLog	Mon Dec 06 03:52:23 2004 +0000
@@ -1,3 +1,11 @@
+2004-12-05  Ben Wing  <ben@xemacs.org>
+
+	* info.el (Info-additional-search-directory-list):
+	Correct doc string giving example package path.
+	
+	* menubar-items.el (default-menubar):
+	Move Prefix Rectangle command up one level.
+
 2004-11-14  Adrian Aichner  <adrian@xemacs.org>
 
 	* mule/devan-util.el (devanagari-composite-glyph-unit): doctring
--- a/lisp/info.el	Mon Dec 06 03:46:07 2004 +0000
+++ b/lisp/info.el	Mon Dec 06 03:52:23 2004 +0000
@@ -392,7 +392,7 @@
   "*List of additional directories to search for Info documentation
 files.  These directories are not searched for merging the `dir'
 file. An example might be something like:
-\"/usr/local/lib/xemacs/packages/lisp/calc/\""
+\"/usr/local/lib/xemacs/xemacs-packages/lisp/calc/\""
   :type '(repeat directory)
   :group 'info)
 
--- a/lisp/menubar-items.el	Mon Dec 06 03:46:07 2004 +0000
+++ b/lisp/menubar-items.el	Mon Dec 06 03:52:23 2004 +0000
@@ -504,13 +504,13 @@
        )
 	"---"
       ["%_Cut Rectangle" kill-rectangle]
+      ["%_Prefix Rectangle..." string-rectangle]
       ("Other %_Rectangles/Register"
        ["%_Yank Rectangle" yank-rectangle]
        ["Rectangle %_to Register" copy-rectangle-to-register]
        ["Rectangle %_from Register" insert-register]
        ["%_Delete Rectangle" clear-rectangle]
        ["%_Open Rectangle" open-rectangle]
-       ["%_Prefix Rectangle..." string-rectangle]
        ["Rectangle %_Mousing"
 	(customize-set-variable	'mouse-track-rectangle-p
 				(not mouse-track-rectangle-p))
@@ -555,7 +555,7 @@
 	["Edit Ta%_b Stops" edit-tab-stops]
 	)
 	"---"
-       ("S%_pell-Check"
+       ("Spell-Chec%_k"
 	["%_Buffer" ispell-buffer
 	 :active (fboundp 'ispell-buffer)]
 	"---"
--- a/man/ChangeLog	Mon Dec 06 03:46:07 2004 +0000
+++ b/man/ChangeLog	Mon Dec 06 03:52:23 2004 +0000
@@ -1,3 +1,310 @@
+2004-12-05  Ben Wing  <ben@xemacs.org>
+
+	* xemacs/packages.texi (Packages):
+	* xemacs/packages.texi (Manually):
+	* xemacs/packages.texi (Building Packages):
+	* xemacs/packages.texi (Local.rules File):
+	* xemacs/packages.texi (Available Packages):
+	Add long form of Lisp Reference Manual to links.
+	Add links pointing to Lisp Reference Manual for more detailed
+	package discussion.
+	
+2004-12-05  Ben Wing  <ben@xemacs.org>
+
+	* lispref/range-tables.texi (Range Tables):
+	* lispref/range-tables.texi (Introduction to Range Tables):
+	* lispref/range-tables.texi (Working With Range Tables):
+	Document range-table changes.
+
+2004-12-05  Ben Wing  <ben@xemacs.org>
+
+	* internals/internals.texi (A History of Emacs):
+	Update history section.
+
+2004-12-05  Ben Wing  <ben@xemacs.org>
+
+	* xemacs-faq.texi:
+	* xemacs-faq.texi (fix-main-menu): New.
+	* xemacs-faq.texi (fix-omitted-menu-lines): New.
+	* xemacs-faq.texi (Top):
+	* xemacs-faq.texi (Introduction):
+	* xemacs-faq.texi (Q1.0.1):
+	* xemacs-faq.texi (Q1.0.2):
+	* xemacs-faq.texi (Q1.0.4):
+	* xemacs-faq.texi (Q1.0.5):
+	* xemacs-faq.texi (Q1.0.6):
+	* xemacs-faq.texi (Q1.0.7):
+	* xemacs-faq.texi (Q1.0.8):
+	* xemacs-faq.texi (Q1.0.9):
+	* xemacs-faq.texi (Q1.0.10):
+	* xemacs-faq.texi (Q1.0.11):
+	* xemacs-faq.texi (Q1.0.12):
+	* xemacs-faq.texi (Q1.0.13):
+	* xemacs-faq.texi (Q1.0.14):
+	* xemacs-faq.texi (Q1.1.1):
+	* xemacs-faq.texi (Q1.1.2):
+	* xemacs-faq.texi (Q1.1.3):
+	* xemacs-faq.texi (Q1.1.4):
+	* xemacs-faq.texi (Q1.1.5):
+	* xemacs-faq.texi (Q1.1.6):
+	* xemacs-faq.texi (Q1.1.7):
+	* xemacs-faq.texi (Q1.1.8):
+	* xemacs-faq.texi (Q1.1.9):
+	* xemacs-faq.texi (Q1.2.1):
+	* xemacs-faq.texi (Q1.2.2):
+	* xemacs-faq.texi (Q1.2.3):
+	* xemacs-faq.texi (Q1.3.1):
+	* xemacs-faq.texi (Q1.3.2):
+	* xemacs-faq.texi (Q1.3.3):
+	* xemacs-faq.texi (Q1.4.1):
+	* xemacs-faq.texi (Q1.4.2):
+	* xemacs-faq.texi (Q1.4.3):
+	* xemacs-faq.texi (Q1.4.4):
+	* xemacs-faq.texi (Q1.4.5):
+	* xemacs-faq.texi (Q1.4.6):
+	* xemacs-faq.texi (Q1.4.7):
+	* xemacs-faq.texi (Q1.4.8):
+	* xemacs-faq.texi (Q1.4.9):
+	* xemacs-faq.texi (Q1.5.1):
+	* xemacs-faq.texi (Q1.5.2):
+	* xemacs-faq.texi (Q1.5.3):
+	* xemacs-faq.texi (Q1.5.4):
+	* xemacs-faq.texi (Q1.5.5):
+	* xemacs-faq.texi (Q1.5.6):
+	* xemacs-faq.texi (Q1.5.7):
+	* xemacs-faq.texi (Q1.5.8):
+	* xemacs-faq.texi (Installation):
+	* xemacs-faq.texi (Q2.0.1):
+	* xemacs-faq.texi (Q2.0.2):
+	* xemacs-faq.texi (Q2.0.3):
+	* xemacs-faq.texi (Q2.0.4):
+	* xemacs-faq.texi (Q2.0.5):
+	* xemacs-faq.texi (Q2.0.6):
+	* xemacs-faq.texi (Q2.0.7):
+	* xemacs-faq.texi (Q2.1.1):
+	* xemacs-faq.texi (Q2.1.2):
+	* xemacs-faq.texi (Q2.1.3):
+	* xemacs-faq.texi (Q2.1.4):
+	* xemacs-faq.texi (Q2.2.1):
+	* xemacs-faq.texi (Q2.2.2):
+	* xemacs-faq.texi (Q2.2.3):
+	* xemacs-faq.texi (Q2.2.4):
+	* xemacs-faq.texi (Q2.2.5):
+	* xemacs-faq.texi (Q2.2.6):
+	* xemacs-faq.texi (Q2.2.7):
+	* xemacs-faq.texi (Q2.2.8):
+	* xemacs-faq.texi (Q2.3.1):
+	* xemacs-faq.texi (Q2.3.2):
+	* xemacs-faq.texi (Q2.3.3):
+	* xemacs-faq.texi (Q2.3.4):
+	* xemacs-faq.texi (Q2.3.5):
+	* xemacs-faq.texi (Q2.3.6):
+	* xemacs-faq.texi (Q2.3.7):
+	* xemacs-faq.texi (Q2.3.8):
+	* xemacs-faq.texi (Q2.3.9):
+	* xemacs-faq.texi (Q2.3.10):
+	* xemacs-faq.texi (Q2.3.11):
+	* xemacs-faq.texi (Q2.4.1):
+	* xemacs-faq.texi (Q2.4.2):
+	* xemacs-faq.texi (Q2.4.3):
+	* xemacs-faq.texi (Q2.4.4):
+	* xemacs-faq.texi (Q2.4.5):
+	* xemacs-faq.texi (Q2.4.6):
+	* xemacs-faq.texi (Display Subsystems):
+	* xemacs-faq.texi (running-xemacs): Removed.
+	* xemacs-faq.texi (Q3.0.1):
+	* xemacs-faq.texi (Q3.0.2):
+	* xemacs-faq.texi (Q3.0.3):
+	* xemacs-faq.texi (Q3.0.4):
+	* xemacs-faq.texi (Q3.0.5):
+	* xemacs-faq.texi (Q3.0.6):
+	* xemacs-faq.texi (foo-old-losing-code-p): Removed.
+	* xemacs-faq.texi (Q3.0.7):
+	* xemacs-faq.texi (Q3.0.8):
+	* xemacs-faq.texi (Q3.0.9):
+	* xemacs-faq.texi (Q3.0.10):
+	* xemacs-faq.texi (Q3.1.1):
+	* xemacs-faq.texi (Q3.1.2):
+	* xemacs-faq.texi (Q3.1.3):
+	* xemacs-faq.texi (Q3.1.4):
+	* xemacs-faq.texi (Q3.1.5):
+	* xemacs-faq.texi (Q3.2.1):
+	* xemacs-faq.texi (Q3.2.2):
+	* xemacs-faq.texi (Q3.2.3):
+	* xemacs-faq.texi (Q3.2.4):
+	* xemacs-faq.texi (Q3.2.5):
+	* xemacs-faq.texi (Q3.2.6):
+	* xemacs-faq.texi (Q3.2.7):
+	* xemacs-faq.texi (Q3.2.8):
+	* xemacs-faq.texi (Q3.2.9):
+	* xemacs-faq.texi (Q3.3.1):
+	* xemacs-faq.texi (Q3.3.2):
+	* xemacs-faq.texi (Q3.3.3):
+	* xemacs-faq.texi (Q3.3.4):
+	* xemacs-faq.texi (Q3.3.5):
+	* xemacs-faq.texi (Q3.3.6):
+	* xemacs-faq.texi (Q3.4.1):
+	* xemacs-faq.texi (Q3.4.2):
+	* xemacs-faq.texi (Q3.4.3):
+	* xemacs-faq.texi (Q3.4.4):
+	* xemacs-faq.texi (Q3.4.5):
+	* xemacs-faq.texi (Q3.4.6):
+	* xemacs-faq.texi (Q3.5.1):
+	* xemacs-faq.texi (Q3.5.2):
+	* xemacs-faq.texi (Q3.5.3):
+	* xemacs-faq.texi (Q3.5.4):
+	* xemacs-faq.texi (Q3.6.1):
+	* xemacs-faq.texi (Q3.6.2):
+	* xemacs-faq.texi (Q3.6.3):
+	* xemacs-faq.texi (Q3.7.1):
+	* xemacs-faq.texi (Q3.7.2):
+	* xemacs-faq.texi (Q3.7.3):
+	* xemacs-faq.texi (Q3.7.4):
+	* xemacs-faq.texi (Q3.7.5):
+	* xemacs-faq.texi (Q3.7.6):
+	* xemacs-faq.texi (Q3.7.7):
+	* xemacs-faq.texi (Q3.7.8):
+	* xemacs-faq.texi (Q3.8.1):
+	* xemacs-faq.texi (Q3.8.2):
+	* xemacs-faq.texi (Q3.8.3):
+	* xemacs-faq.texi (my-toggle-toolbar): New.
+	* xemacs-faq.texi (Q3.8.4):
+	* xemacs-faq.texi (scroll-one-line-up): Removed.
+	* xemacs-faq.texi (scroll-one-line-down): Removed.
+	* xemacs-faq.texi (Q3.8.5):
+	* xemacs-faq.texi (Q3.9.1):
+	* xemacs-faq.texi (Q3.9.2):
+	* xemacs-faq.texi (Q3.9.3):
+	* xemacs-faq.texi (Q3.9.4):
+	* xemacs-faq.texi (Q3.9.5):
+	* xemacs-faq.texi (External Subsystems):
+	* xemacs-faq.texi (Q4.0.1):
+	* xemacs-faq.texi (Q4.0.2):
+	* xemacs-faq.texi (Q4.0.3):
+	* xemacs-faq.texi (Q4.0.4):
+	* xemacs-faq.texi (Q4.0.5):
+	* xemacs-faq.texi (Q4.0.6):
+	* xemacs-faq.texi (global-map): Removed.
+	* xemacs-faq.texi (Q4.1.1):
+	* xemacs-faq.texi (Q4.1.2):
+	* xemacs-faq.texi (Q4.2.1):
+	* xemacs-faq.texi (Q4.2.2):
+	* xemacs-faq.texi (Q4.2.3):
+	* xemacs-faq.texi (Q4.2.4):
+	* xemacs-faq.texi (Q4.3.1):
+	* xemacs-faq.texi (Q4.3.2):
+	* xemacs-faq.texi (Q4.3.3):
+	* xemacs-faq.texi (Q4.3.4):
+	* xemacs-faq.texi (Q4.4.1):
+	* xemacs-faq.texi (Q4.4.2):
+	* xemacs-faq.texi (Q4.4.3):
+	* xemacs-faq.texi (Q4.4.4):
+	* xemacs-faq.texi (Q4.4.5):
+	* xemacs-faq.texi (Q4.5.1):
+	* xemacs-faq.texi (Q4.5.2):
+	* xemacs-faq.texi (Q4.5.3):
+	* xemacs-faq.texi (Q4.5.4):
+	* xemacs-faq.texi (Q4.5.5):
+	* xemacs-faq.texi (Q4.6.1):
+	* xemacs-faq.texi (Q4.6.2):
+	* xemacs-faq.texi (Q4.6.3):
+	* xemacs-faq.texi (Q4.6.4):
+	* xemacs-faq.texi (Q4.7.1):
+	* xemacs-faq.texi (Q4.7.2):
+	* xemacs-faq.texi (Q4.7.3):
+	* xemacs-faq.texi (Q4.8.1):
+	* xemacs-faq.texi (Q4.8.2):
+	* xemacs-faq.texi (Q4.8.3):
+	* xemacs-faq.texi (Q4.8.4):
+	* xemacs-faq.texi (Internet):
+	* xemacs-faq.texi (Q5.0.1):
+	* xemacs-faq.texi (Q5.0.2):
+	* xemacs-faq.texi (Q5.0.3):
+	* xemacs-faq.texi (Q5.0.4):
+	* xemacs-faq.texi (Q5.0.5):
+	* xemacs-faq.texi (Q5.0.6):
+	* xemacs-faq.texi (Q5.0.7):
+	* xemacs-faq.texi (Q5.0.8):
+	* xemacs-faq.texi (Q5.0.9):
+	* xemacs-faq.texi (Q5.0.10):
+	* xemacs-faq.texi (Q5.0.11):
+	* xemacs-faq.texi (Q5.1.1):
+	* xemacs-faq.texi (Q5.1.2):
+	* xemacs-faq.texi (Q5.1.3):
+	* xemacs-faq.texi (Q5.1.4):
+	* xemacs-faq.texi (Q5.1.5):
+	* xemacs-faq.texi (Q5.1.6):
+	* xemacs-faq.texi (Q5.2.1):
+	* xemacs-faq.texi (Q5.2.2):
+	* xemacs-faq.texi (Q5.3.1):
+	* xemacs-faq.texi (Q5.3.2):
+	* xemacs-faq.texi (Q5.4.1):
+	* xemacs-faq.texi (Q5.4.2):
+	* xemacs-faq.texi (Q5.4.3):
+	* xemacs-faq.texi (Advanced):
+	* xemacs-faq.texi (Q6.0.1):
+	* xemacs-faq.texi (Q6.0.2):
+	* xemacs-faq.texi (Q6.1.1):
+	* xemacs-faq.texi (Q6.1.2):
+	* xemacs-faq.texi (Q6.1.3):
+	* xemacs-faq.texi (Q6.1.4):
+	* xemacs-faq.texi (Q6.1.5):
+	* xemacs-faq.texi (Q6.1.6):
+	* xemacs-faq.texi (Q6.2.1):
+	* xemacs-faq.texi (Q6.2.2):
+	* xemacs-faq.texi (Q6.2.3):
+	* xemacs-faq.texi (Q6.2.4):
+	* xemacs-faq.texi (Q6.2.5):
+	* xemacs-faq.texi (Q6.2.6):
+	* xemacs-faq.texi (Q6.2.7):
+	* xemacs-faq.texi (Q6.2.8):
+	* xemacs-faq.texi (Q6.2.9):
+	* xemacs-faq.texi (Q6.2.10):
+	* xemacs-faq.texi (Q6.2.11):
+	* xemacs-faq.texi (Q6.3.1):
+	* xemacs-faq.texi (Q6.3.2):
+	* xemacs-faq.texi (Q6.3.3):
+	* xemacs-faq.texi (Q6.3.4):
+	* xemacs-faq.texi (Current Events):
+	* xemacs-faq.texi (Q7.0.1):
+	* xemacs-faq.texi (Q7.0.2):
+	* xemacs-faq.texi (Q7.0.3):
+	* xemacs-faq.texi (Q7.0.5):
+	* xemacs-faq.texi (Q7.0.6):
+	* xemacs-faq.texi (Legacy Versions):
+	* xemacs-faq.texi (my-function): Removed.
+	* xemacs-faq.texi (Q8.0.1):
+
+	The section on Troubleshooting (now 2.3) has been completely
+	written and includes a lot of stuff that is not properly
+	documented anywhere else.  A fair amount of obsolete info has been
+	deleted and I've incorporated the comments that people (mostly
+	Stephen T) made.  Former chapter 3 has been split up in two, one
+	pertaining to basic I/O and the other to external I/O.  What were
+	formerly chapters 5 and 6 no longer exist as such; the info in
+	them has been distributed across various other chapters.  Old
+	chapter 4 got split up, part going to the new chapter 4 on
+	external I/O and part going to the new chapter 5 on the Internet.
+	In this new chapter, stuff not pertaining to a specific package
+	(e.g. VM or GNUS) was taken out of package-specific sections and a
+	general mail section was constituted.  Part of old chapter 5
+	remains in a new chapter 6 devoted to Emacs Lisp and other
+	advanced stuff, and a section from old chapter 3 on basic
+	init-file Lisp and some stuff from old chapter 5 on Info.  The
+	rest of chapter 5 was just "misc" and has gotten scattered to the
+	winds (mostly in chapters 3 and 4).  Old chapter 6 has also gotten
+	quite scattered; there is no longer any section specifically
+	devoted to Windows except one of the Installation sections (along
+	with a section specfically devoted to Unix), and the rest has
+	moved to join the appropriate non-Windows-specific section
+	elsewhere.  A lot of chapters had their sections rearranged and
+	likewise for sections having entries rearranged, with the
+	intention that the new arrangement should be more natural.  In
+	general I hope that stuff should be much easier to locate.  I also
+	rewrote the entries on the relation between XEmacs and GNU Emacs
+	on the authors of XEmacs, including lots of info on who wrote
+	specific subsections.
+
 2004-12-05  Adrian Aichner  <adrian@xemacs.org>
 
 	* Makefile (TEXI2HTML): Changed to produce unsplit output.
--- a/man/internals/internals.texi	Mon Dec 06 03:46:07 2004 +0000
+++ b/man/internals/internals.texi	Mon Dec 06 03:52:23 2004 +0000
@@ -964,21 +964,34 @@
 @cindex Free Software Foundation
 
   XEmacs is a powerful, customizable text editor and development
-environment.  It began as Lucid Emacs, which was in turn derived from
-GNU Emacs, a program written by Richard Stallman of the Free Software
-Foundation.  GNU Emacs dates back to the 1970's, and was modelled
-after a package called ``Emacs'', written in 1976, that was a set of
-macros on top of TECO, an old, old text editor written at MIT on the
-DEC PDP 10 under one of the earliest time-sharing operating systems,
-ITS (Incompatible Timesharing System). (ITS dates back well before
-Unix.) ITS, TECO, and Emacs were products of a group of people at MIT
-who called themselves ``hackers'', who shared an idealistic belief
-system about the free exchange of information and were fanatical in
-their devotion to and time spent with computers. (The hacker
-subculture dates back to the late 1950's at MIT and is described in
-detail in Steven Levy's book @cite{Hackers}.  This book also includes
-a lot of information about Stallman himself and the development of
-Lisp, a programming language developed at MIT that underlies Emacs.)
+environment.  It began in 1991 as Lucid Emacs, which was in turn
+derived from GNU Emacs, a program written by Richard Stallman of the
+Free Software Foundation.  GNU Emacs dates back to 1985 and was
+modelled after Unipress Emacs, an editor written by James Gosling in
+1981 and based on a series of other "Emacs"-like editors, including
+EINE (EINE Is Not EMACS), c. 1976, by Dan Weinreb, which run on the
+MIT Lisp Machine and was the first Emacs written in Lisp; ZWEI (ZWEI
+Was EINE Initially), c. 1978, by Dan Weinreb and Mike McMahon; Multics
+Emacs, c. 1978, by Bernie Greenberg, which was written in MacLisp and
+also used Lisp as its extension language; and ZMACS, c. 1980, a direct
+descendant of ZWEI that on ran the Symbolics LM-2, LMI LispM, and
+later, TI Explorer (1983-1989).  These in turn were inspired by the
+first Emacs, a package called EMACS, written in 1976 by Richard
+Stallman, Guy Steele, and Dave Moon.  This was a merger of TECMAC and
+TMACS, a pair of "TECO-macro realtime editors" written by Guy Steele,
+Dave Moon, Richard Greenblatt, Charles Frankston, et al., and added a
+dynamic loader and Meta-key cmds.  It ran under ITS (the Incompatible
+Timesharing System) on a DEC PDP 10 and under TWENEX on a Tops-20 and
+was written in TECO and PDP 10 assembly.  ITS was one of the first
+time-sharing operating systems and dates back well before Unix.  ITS,
+TECO, and Emacs were products of a group of people at MIT who called
+themselves ``hackers'', who shared an idealistic belief system about
+the free exchange of information and were fanatical in their devotion
+to and time spent with computers. (The hacker subculture dates back to
+the late 1950's at MIT and is described in detail in Steven Levy's
+book @cite{Hackers}.  This book also includes a lot of information
+about Stallman himself and the development of Lisp, a programming
+language developed at MIT that underlies Emacs.)
 
 @menu
 * Through Version 18::          Unification prevails.
--- a/man/lispref/range-tables.texi	Mon Dec 06 03:46:07 2004 +0000
+++ b/man/lispref/range-tables.texi	Mon Dec 06 03:52:23 2004 +0000
@@ -13,11 +13,16 @@
 Note that range tables have a read syntax, like this:
 
 @example
-#s(range-table data ((-3 2) foo (5 20) bar))
+#s(range-table type start-closed-end-open data ((-3 2) foo (5 20) bar))
 @end example
 
-This maps integers in the range (-3, 2) to @code{foo} and integers
-in the range (5, 20) to @code{bar}.
+This maps integers in the range [-3, 2) to @code{foo} and integers
+in the range [5, 20) to @code{bar}.
+
+By default, range tables have a @var{type} of
+@code{start-closed-end-open}. (@strong{NOTE}: This is a change from
+21.4 and earlier, where there was no @var{type} and range tables were always
+closed on both ends.) This makes them work like text properties.
 
 @defun range-table-p object
 Return non-@code{nil} if @var{object} is a range table.
@@ -32,8 +37,35 @@
 @node Introduction to Range Tables
 @section Introduction to Range Tables
 
-@defun make-range-table
+@defun make-range-table &optional type
 Make a new, empty range table.
+
+@var{type} is a symbol indicating how ranges are assumed to function
+at their ends.  It can be one of
+
+@example
+SYMBOL                                     RANGE-START         RANGE-END
+------                                     -----------         ---------
+`start-closed-end-open'  (the default)     closed              open
+`start-closed-end-closed'                  closed              closed
+`start-open-end-open'                      open                open
+`start-open-end-closed'                    open                closed
+@end example
+
+A @dfn{closed} endpoint of a range means that the number at that end
+is included in the range.  For an @dfn{open} endpoint, the number
+would not be included.
+
+For example, a closed-open range from 5 to 20 would be indicated as
+@samp{[5, 20)} where a bracket indicates a closed end and a
+parenthesis an open end, and would mean `all the numbers between 5 and
+20', including 5 but not 20.  This seems a little strange at first but
+is in fact extremely common in the outside world as well as in
+computers and makes things work sensibly.  For example, if I say
+"there are seven days between today and next week today", I'm
+including today but not next week today; if I included both, there
+would be eight days.  Similarly, there are 15 (= 20 - 5) elements in
+the range @samp{[5, 20)}, but 16 in the range @samp{[5, 20]}.
 @end defun
 
 @defun copy-range-table range-table
@@ -49,11 +81,20 @@
 This function finds value for position @var{pos} in @var{range-table}.
 If there is no corresponding value, return @var{default} (defaults to
 @code{nil}).
+
+@strong{NOTE}: If you are working with ranges that are closed at the
+start and open at the end (the default), and you put a value for a
+range with @var{start} equal to @var{end}, @code{get-range-table} will
+@strong{not} return that value!  You would need to set @var{end} one
+greater than @var{start}.
 @end defun
 
 @defun put-range-table start end value range-table
 This function sets the value for range (@var{start}, @var{end}) to be
 @var{value} in @var{range-table}.
+
+@strong{NOTE}: Unless you are working with ranges that are closed at
+both ends, nothing will happen if @var{start} equals @var{end}.
 @end defun
 
 @defun remove-range-table start end range-table
--- a/man/xemacs-faq.texi	Mon Dec 06 03:46:07 2004 +0000
+++ b/man/xemacs-faq.texi	Mon Dec 06 03:52:23 2004 +0000
@@ -7,7 +7,7 @@
 @finalout
 @titlepage
 @title XEmacs FAQ
-@subtitle Frequently asked questions about XEmacs @* Last Modified: $Date: 2004/12/05 22:30:40 $
+@subtitle Frequently asked questions about XEmacs @* Last Modified: $Date: 2004/12/06 03:51:29 $
 @sp 1
 @author Ben Wing <ben@@xemacs.org>
 @author Tony Rossini <rossini@@u.washington.edu>
@@ -1255,9 +1255,9 @@
 
 There is also a port of XEmacs 19.14 that works on all recent versions
 of MacOS, from 8.1 through MacOS X, by @email{pjarvis@@ispchannel.com,
-Pitts Jarvis}.  It runs in an equivalent of TTY mode only (one single
-Macintosh window, 25 colors), but has a large number of Mac-specific
-additions.  It's available at
+Pitts Jarvis} (recently deceased).  It runs in an equivalent of TTY
+mode only (one single Macintosh window, 25 colors), but has a large
+number of Mac-specific additions.  It's available at
 @uref{http://homepage.mac.com/pjarvis/xemacs.html}.
 
 @node Q1.1.7, Q1.1.8, Q1.1.6, Introduction
--- a/man/xemacs/packages.texi	Mon Dec 06 03:46:07 2004 +0000
+++ b/man/xemacs/packages.texi	Mon Dec 06 03:52:23 2004 +0000
@@ -15,6 +15,9 @@
 This gives an installer the ability to tailor an XEmacs installation for
 local needs with safe removal of unnecessary code.
 
+@emph{NOTE}: For detailed information about how the package
+hierarchies work, @xref{Package Overview,,,lispref, XEmacs Lisp Reference Manual}.
+
 @menu
 * Package Terminology:: Understanding different kinds of packages.
 * Installing Packages:: How to install packages.
@@ -301,7 +304,7 @@
 a fresh install it is sufficient to untar the file at the top of the
 package hierarchy. 
 
-Note: If you are upgrading packages already installed, it's best to
+@emph{NOTE}: If you are upgrading packages already installed, it's best to
 remove the old package first @ref{Removing Packages}.
 
 For example if we are installing the @file{xemacs-base}
@@ -330,6 +333,9 @@
    tar zxvf /path/to/mule-base-1.37-pkg.tar.gz RET
 @end example
 
+@emph{NOTE}: For more detailed information about how the package
+hierarchies work, @xref{Package Overview,,,lispref, XEmacs Lisp Reference Manual}.
+
 @node Sumo, Which Packages, Manually, Installing Packages
 @comment  node-name,  next,  previous,  up
 @cindex sumo package install
@@ -431,7 +437,7 @@
 distributing to others.
 
 For a list and description of the different @file{Makefile} targets,
-@xref{Makefile Targets,,,lispref}.
+@xref{Makefile Targets,,,lispref, XEmacs Lisp Reference Manual}.
 
 @node Local.rules File, Available Packages, Building Packages, Packages
 @comment  node-name,  next,  previous,  up
@@ -443,7 +449,7 @@
 @file{Local.rules} and edit it to suit your needs.
 
 For a complete discussion of the @file{Local.rules} file,
-@xref{Local.rules File,,,lispref}.
+@xref{Local.rules File,,,lispref, XEmacs Lisp Reference Manual}.
 
 @node Available Packages,  , Local.rules File, Packages
 @comment  node-name,  next,  previous,  up
--- a/nt/installer/Wise/ChangeLog	Mon Dec 06 03:46:07 2004 +0000
+++ b/nt/installer/Wise/ChangeLog	Mon Dec 06 03:52:23 2004 +0000
@@ -1,3 +1,7 @@
+2004-11-16  Ben Wing  <ben@xemacs.org>
+
+	* display-readme.dlg:
+
 2004-10-22  Stephen J. Turnbull  <stephen@xemacs.org>
 
 	* XEmacs 21.5.18 "chestnut" is released.
--- a/src/ChangeLog	Mon Dec 06 03:46:07 2004 +0000
+++ b/src/ChangeLog	Mon Dec 06 03:52:23 2004 +0000
@@ -1,3 +1,101 @@
+2004-12-05  Ben Wing  <ben@xemacs.org>
+
+	* elhash.c:
+	* elhash.c (find_htentry):
+	* elhash.c (inchash_eq):
+	* elhash.h:
+	* profile.c (create_profile_tables):
+	* profile.c (profile_record_consing):
+	* profile.c (profile_record_about_to_call):
+	Create inchash_eq() to allow direct incrementing of hash-table
+	entry.  Use in profile.c to try to reduce profiling overhead.
+	Increase initial size of profile hash tables to reduce profiling
+	overhead.
+	
+	* buffer.c (init_initial_directory):
+	* device-msw.c (mswindows_handle_page_setup_dialog_box):
+	* dialog-msw.c (handle_directory_proc):
+	* dialog-msw.c (handle_file_dialog_box):
+	* dialog-msw.c:
+	* dired-msw.c (mswindows_format_file):
+	* dired-msw.c (mswindows_get_files):
+	* editfns.c (Ftemp_directory):
+	* event-msw.c (mswindows_wnd_proc):
+	* events.c (format_event_object):
+	* glyphs-msw.c (add_tab_item):
+	* glyphs-msw.c (add_tree_item):
+	* keymap.c (Fsingle_key_description):
+	* keymap.c (format_raw_keys):
+	* objects-msw.c (parse_font_spec):
+	* process-nt.c (nt_create_process):
+	* syswindows.h (build_tstr_string):
+	* syswindows.h (qxetcslen):
+	* text.c (eicmp_1):
+	* text.h (eicat_ascii):
+	* text.h (eicmp_ascii):
+	* text.h (eicpy_ascii):
+	* text.h (eicpy_ascii_len):
+	* text.h (eistr_ascii):
+	* text.h (eisub_ascii):
+	* text.h:
+	* unexnt.c (_start):
+	Rename xetcs* -> qxetcs* for consistency with qxestr*.
+	Rename ei*_c(_*) -> ei*_ascii(_*) since they work with ASCII-only
+	strings not "C strings", whatever those are.  This is the last
+	place where "c" was incorrectly being used for "ascii".
+
+	* dialog-msw.c (handle_directory_proc):
+	* dialog-msw.c (handle_directory_dialog_box):
+	* dumper.c:
+	* event-msw.c (mswindows_wnd_proc):
+	* fileio.c (Ffile_truename):
+	* glyphs-gtk.c (font_instantiate):
+	* glyphs-x.c (font_instantiate):
+	* nt.c (Fmswindows_short_file_name):
+	* nt.c (mswindows_link):
+	* process-nt.c (nt_create_process):
+	* realpath.c (readlink_and_correct_case):
+	* realpath.c (qxe_realpath):
+	* sysdep.c (qxe_allocating_getcwd):
+	* sysfile.h:
+	* unexcw.c (unexec):
+	* unexnext.c (unexec):
+	* unexnt.c (_start):
+	Try to avoid differences in systems that do or do not include
+	final null byte in PATH_MAX.  Create PATH_MAX_INTERNAL and
+	PATH_MAX_EXTERNAL and use them everywhere.  Rewrite code in
+	dumper.c to avoid use of PATH_MAX.  When necessary in nt.c,
+	use _MAX_PATH instead of MAX_PATH to be consistent with
+	other places.
+	
+	* text.c (dfc_convert_to_internal_format):
+	Code to short-circuit when binary or Unicode was not working
+	due to EOL wrapping.  Fix this code to work when either no
+	EOL autodetection or no CR's or LF's in the text.
+
+	* lisp.h:
+	* rangetab.c:
+	* rangetab.c (range_table_symbol_to_type):
+	* rangetab.c (range_table_type_to_symbol):
+	* rangetab.c (print_range_table):
+	* rangetab.c (verify_range_table):
+	* rangetab.c (get_range_table):
+	* rangetab.c (Frange_table_type):
+	* rangetab.c (Fcopy_range_table):
+	* rangetab.c (put_range_table):
+	* rangetab.c (Fput_range_table):
+	* rangetab.c (Fremove_range_table):
+	* rangetab.c (rangetab_type_validate):
+	* rangetab.c (rangetab_instantiate):
+	* rangetab.c (syms_of_rangetab):
+	* rangetab.c (structure_type_create_rangetab):
+	* rangetab.h:
+	* rangetab.h (enum range_table_type):
+	* regex.c (vars_of_regex):
+	* search.c (vars_of_search):
+	Implement different types of ranges (open/closed start and end).
+	Change default to be start-closed, end-open.
+
 2004-11-12  Marcus Crestani  <crestani@informatik.uni-tuebingen.de>
 
 	* Makefile.in.in: Fix pdump build for Cygwin.
--- a/src/buffer.c	Mon Dec 06 03:46:07 2004 +0000
+++ b/src/buffer.c	Mon Dec 06 03:52:23 2004 +0000
@@ -2912,7 +2912,7 @@
     Extbyte *modname = mswindows_get_module_file_name ();
       
     assert (modname);
-    p = xetcsrchr (modname, '\\');
+    p = qxetcsrchr (modname, '\\');
     assert (p);
     XECOPY_TCHAR (p, '\0');
   
--- a/src/device-msw.c	Mon Dec 06 03:46:07 2004 +0000
+++ b/src/device-msw.c	Mon Dec 06 03:52:23 2004 +0000
@@ -916,7 +916,7 @@
 
     qxeGetLocaleInfo (LOCALE_USER_DEFAULT, LOCALE_IMEASURE,
 		      measure, sizeof (measure) / XETCHAR_SIZE);
-    data = xetcscmp (measure, XETEXT ("0"));
+    data = qxetcscmp (measure, XETEXT ("0"));
 
     memset (&pd, 0, sizeof (pd));
     pd.lStructSize = sizeof (pd);
--- a/src/dialog-msw.c	Mon Dec 06 03:46:07 2004 +0000
+++ b/src/dialog-msw.c	Mon Dec 06 03:52:23 2004 +0000
@@ -1,6 +1,6 @@
 /* Implements elisp-programmable dialog boxes -- MS Windows interface.
    Copyright (C) 1998 Kirill M. Katsnelson <kkm@kis.ru>
-   Copyright (C) 2000, 2001, 2002, 2003 Ben Wing.
+   Copyright (C) 2000, 2001, 2002, 2003, 2004 Ben Wing.
 
 This file is part of XEmacs.
 
@@ -344,7 +344,7 @@
 CALLBACK handle_directory_proc (HWND hwnd, UINT msg,
 				LPARAM lParam, LPARAM lpData)
 {
-  Extbyte szDir[MAX_PATH * MAX_XETCHAR_SIZE];
+  Extbyte szDir[PATH_MAX_EXTERNAL];
   struct param_data *pd = (struct param_data *) lpData;
   
   switch (msg)
@@ -365,7 +365,7 @@
       if (pd->validate)
 	return TRUE;
       else
-	pd->unknown_fname = xetcsdup ((Extbyte *) lParam);
+	pd->unknown_fname = qxetcsdup ((Extbyte *) lParam);
       break;
       
     default:
@@ -430,7 +430,7 @@
       pidl = qxeSHBrowseForFolder (&bi);
       if (pidl)
 	{
-	  Extbyte *szDir = alloca_extbytes (MAX_PATH * MAX_XETCHAR_SIZE);
+	  Extbyte *szDir = alloca_extbytes (PATH_MAX_EXTERNAL);
 	  
 	  if (qxeSHGetPathFromIDList (pidl, szDir))
 	    ret = tstr_to_local_file_format (szDir);
@@ -466,7 +466,7 @@
   ofn.hwndOwner = FRAME_MSWINDOWS_HANDLE (f);
   ofn.lpstrFile = (XELPTSTR) fnbuf;
   ofn.nMaxFile = sizeof (fnbuf) / XETCHAR_SIZE;
-  xetcscpy (fnbuf, XETEXT (""));
+  qxetcscpy (fnbuf, XETEXT (""));
   
   LOCAL_FILE_FORMAT_TO_TSTR (Fexpand_file_name (build_string (""), Qnil),
 			     ofn.lpstrInitialDir);
@@ -480,7 +480,7 @@
 	    
 	    CHECK_STRING (value);
 	    LOCAL_FILE_FORMAT_TO_TSTR (value, fnout);
-	    xetcscpy (fnbuf, fnout);
+	    qxetcscpy (fnbuf, fnout);
 	  }
 	else if (EQ (key, Q_title))
 	  {
--- a/src/dired-msw.c	Mon Dec 06 03:46:07 2004 +0000
+++ b/src/dired-msw.c	Mon Dec 06 03:52:23 2004 +0000
@@ -212,8 +212,8 @@
 	{
 	  Charcount len = eicharlen (win32pattern) - 1;
 	  if (!IS_DIRECTORY_SEP (eigetch_char (win32pattern, len)))
-	    eicat_c (win32pattern, "\\");
-	  eicat_c (win32pattern, "*");
+	    eicat_ascii (win32pattern, "\\");
+	  eicat_ascii (win32pattern, "*");
 	}
       eito_external (win32pattern, Qmswindows_tstr);
 
@@ -312,17 +312,17 @@
   file_size =
     file->nFileSizeHigh * (double)UINT_MAX + file->nFileSizeLow;
 #if INDENT_LISTING
-  eicat_c (puta, "  ");
+  eicat_ascii (puta, "  ");
 #endif
   if (display_size)
     {
       sprintf (buf, "%6d ", (int)((file_size + 1023.) / 1024.));
-      eicat_c (puta, buf);
+      eicat_ascii (puta, buf);
     }
   if (file->dwFileAttributes & FILE_ATTRIBUTE_DIRECTORY)
-    eicat_c (puta, "d");
+    eicat_ascii (puta, "d");
   else
-    eicat_c (puta, "-");
+    eicat_ascii (puta, "-");
   buf[0] = buf[3] = buf[6] = 'r';
   if (file->dwFileAttributes & FILE_ATTRIBUTE_READONLY)
     buf[1] = buf[4] = buf[7] = '-';
@@ -355,11 +355,11 @@
       buf[2] = buf[5] = buf[8] = '-';
   }
   buf[9] = '\0';
-  eicat_c (puta, buf);
+  eicat_ascii (puta, buf);
   if (file->dwFileAttributes & FILE_ATTRIBUTE_DIRECTORY)
-      eicat_c (puta, "   2 ");
+      eicat_ascii (puta, "   2 ");
   else
-      eicat_c (puta, "   1 ");
+      eicat_ascii (puta, "   1 ");
   luser = Fuser_login_name (Qnil);
   if (!STRINGP (luser))
     sprintf (buf, "%-9d", 0);
@@ -427,10 +427,10 @@
     }
   }
 
-  eicat_c (puta, buf);
+  eicat_ascii (puta, buf);
   eicat_raw (puta, file->cFileName, qxestrlen (file->cFileName));
   if (add_newline)
-    eicat_c (puta, "\n");
+    eicat_ascii (puta, "\n");
 
   return eimake_string (puta);
 }
--- a/src/dumper.c	Mon Dec 06 03:46:07 2004 +0000
+++ b/src/dumper.c	Mon Dec 06 03:52:23 2004 +0000
@@ -1873,15 +1873,32 @@
 int
 pdump_load (const Wexttext *argv0)
 {
-  Wexttext exe_path[PATH_MAX];
 #ifdef WIN32_NATIVE
-  qxeGetModuleFileName (NULL, (Extbyte *) exe_path, PATH_MAX);
+  Wexttext *exe_path = NULL;
+  int bufsize = 4096;
+  int cchpathsize;
+
+  /* Copied from mswindows_get_module_file_name ().  Not clear if it's
+     kosher to malloc() yet. */
+  while (1)
+    {
+      exe_path = alloca_array (Wexttext, bufsize);
+      cchpathsize = qxeGetModuleFileName (NULL, (Extbyte *) exe_path,
+					  bufsize);
+      if (!cchpathsize)
+	goto fail;
+      if (cchpathsize + 1 <= bufsize)
+	break;
+      bufsize *= 2;
+    }
+
   if (!XEUNICODE_P)
     {
       Wexttext *wexe = MULTIBYTE_TO_WEXTTEXT ((Extbyte *) exe_path);
       wext_strcpy (exe_path, wexe);
     }
 #else /* !WIN32_NATIVE */
+  Wexttext *exe_path;
   Wexttext *w;
   const Wexttext *dir, *p;
 
@@ -1914,6 +1931,7 @@
     {
       /* invocation-name includes a directory component -- presumably it
 	 is relative to cwd, not $PATH */
+      exe_path = alloca_array (Wexttext, 1 + wext_strlen (dir));
       wext_strcpy (exe_path, dir);
     }
   else
@@ -1921,6 +1939,9 @@
       const Wexttext *path = wext_getenv ("PATH"); /* not egetenv --
 						     not yet init. */
       const Wexttext *name = p;
+      exe_path = alloca_array (Wexttext,
+			       10 + max (wext_strlen (name),
+					 wext_strlen (path)));
       for (;;)
 	{
 	  p = path;
@@ -1954,7 +1975,7 @@
 	      wext_sprintf (exe_path, "./%s", name);
 	      break;
 	    }
-	  path = p+1;
+	  path = p + 1;
 	}
     }
 #endif /* WIN32_NATIVE */
@@ -1977,6 +1998,8 @@
 	}
       pdump_free ();
     }
+
+fail:
 #endif
 
   in_pdump = 0;
--- a/src/editfns.c	Mon Dec 06 03:46:07 2004 +0000
+++ b/src/editfns.c	Mon Dec 06 03:52:23 2004 +0000
@@ -607,7 +607,7 @@
       DECLARE_EISTRING (eipath);
       Ibyte *path;
 
-      eicpy_c (eipath, "/tmp/");
+      eicpy_ascii (eipath, "/tmp/");
       eicat_rawz (eipath, login_name);
       path = eidata (eipath);
       if (qxe_lstat (path, &st) < 0 && errno == ENOENT)
@@ -618,7 +618,7 @@
       else
 	{
 	  eicpy_rawz (eipath, egetenv ("HOME"));
-	  eicat_c (eipath, "/tmp/");
+	  eicat_ascii (eipath, "/tmp/");
 	  path = eidata (eipath);
 	  if (qxe_stat (path, &st) < 0 && errno == ENOENT)
 	    {
@@ -627,7 +627,7 @@
 
 	      qxe_mkdir (path, 0700);	/* ignore retvals */
 	      eicpy_ei (eiwarnpath, eipath);
-	      eicat_c (eiwarnpath, ".created_by_xemacs");
+	      eicat_ascii (eiwarnpath, ".created_by_xemacs");
 	      if ((fd = qxe_open (eidata (eiwarnpath),
 				  O_WRONLY | O_CREAT, 0644)) > 0)
 		{
--- a/src/elhash.c	Mon Dec 06 03:46:07 2004 +0000
+++ b/src/elhash.c	Mon Dec 06 03:52:23 2004 +0000
@@ -1,6 +1,6 @@
 /* Implementation of the hash table lisp object type.
    Copyright (C) 1992, 1993, 1994 Free Software Foundation, Inc.
-   Copyright (C) 1995, 1996, 2002 Ben Wing.
+   Copyright (C) 1995, 1996, 2002, 2004 Ben Wing.
    Copyright (C) 1997 Free Software Foundation, Inc.
 
 This file is part of XEmacs.
@@ -402,9 +402,7 @@
   if (print_readably)
     write_c_string (printcharfun, ")");
   else
-    {
-      write_fmt_string (printcharfun, " 0x%x>", ht->header.uid);
-    }
+    write_fmt_string (printcharfun, " 0x%x>", ht->header.uid);
 }
 
 static void
@@ -790,12 +788,8 @@
   Lisp_Object weakness	       = Qnil;
   Lisp_Object data	       = Qnil;
 
-  while (!NILP (plist))
+  PROPERTY_LIST_LOOP_3 (key, value, plist)
     {
-      Lisp_Object key, value;
-      key   = XCAR (plist); plist = XCDR (plist);
-      value = XCAR (plist); plist = XCDR (plist);
-
       if      (EQ (key, Qtest))		    test	     = value;
       else if (EQ (key, Qsize))		    size	     = value;
       else if (EQ (key, Qrehash_size))	    rehash_size	     = value;
@@ -1065,6 +1059,35 @@
   return probe;
 }
 
+/* A version of Fputhash() that increments the value by the specified
+   amount and dispenses will all error checks.  Assumes that tables does
+   comparison using EQ.  Used by the profiling routines to avoid
+   overhead -- profiling overhead was being recorded at up to 15% of the
+   total time. */
+
+void
+inchash_eq (Lisp_Object key, Lisp_Object table, EMACS_INT offset)
+{
+  Lisp_Hash_Table *ht = XHASH_TABLE (table);
+  htentry *entries = ht->hentries;
+  htentry *probe = entries + HASHCODE (key, ht);
+
+  LINEAR_PROBING_LOOP (probe, entries, ht->size)
+    if (EQ (probe->key, key))
+      break;
+
+  if (!HTENTRY_CLEAR_P (probe))
+    probe->value = make_int (XINT (probe->value) + offset);
+  else
+    {
+      probe->key   = key;
+      probe->value = make_int (offset);
+
+      if (++ht->count >= ht->rehash_count)
+	enlarge_hash_table (ht);
+    }
+}
+
 DEFUN ("gethash", Fgethash, 2, 3, 0, /*
 Find hash value for KEY in HASH-TABLE.
 If there is no corresponding value, return DEFAULT (which defaults to nil).
--- a/src/elhash.h	Mon Dec 06 03:46:07 2004 +0000
+++ b/src/elhash.h	Mon Dec 06 03:52:23 2004 +0000
@@ -97,4 +97,6 @@
 
 void pdump_reorganize_hash_table (Lisp_Object);
 
+void inchash_eq (Lisp_Object key, Lisp_Object table, EMACS_INT offset);
+
 #endif /* INCLUDED_elhash_h_ */
--- a/src/eval.c	Mon Dec 06 03:46:07 2004 +0000
+++ b/src/eval.c	Mon Dec 06 03:52:23 2004 +0000
@@ -1,7 +1,7 @@
 /* Evaluator for XEmacs Lisp interpreter.
    Copyright (C) 1985-1987, 1992-1994 Free Software Foundation, Inc.
    Copyright (C) 1995 Sun Microsystems, Inc.
-   Copyright (C) 2000, 2001, 2002, 2003 Ben Wing.
+   Copyright (C) 2000, 2001, 2002, 2003, 2004 Ben Wing.
 
 This file is part of XEmacs.
 
@@ -1154,25 +1154,24 @@
        (args))
 {
   /* This function can GC */
-  Lisp_Object symbol, tail, val = Qnil;
   int nargs;
-  struct gcpro gcpro1;
+  Lisp_Object retval = Qnil;
 
   GET_LIST_LENGTH (args, nargs);
 
   if (nargs & 1)		/* Odd number of arguments? */
     Fsignal (Qwrong_number_of_arguments, list2 (Qsetq, make_int (nargs)));
 
-  GCPRO1 (val);
-
-  PROPERTY_LIST_LOOP (tail, symbol, val, args)
+  GC_PROPERTY_LIST_LOOP_3 (symbol, val, args)
     {
       val = Feval (val);
       Fset (symbol, val);
+      retval = val;
     }
 
-  UNGCPRO;
-  return val;
+  END_GC_PROPERTY_LIST_LOOP (symbol);
+
+  return retval;
 }
 
 DEFUN ("quote", Fquote, 1, UNEVALLED, 0, /*
@@ -4825,7 +4824,8 @@
     (struct call_trapping_problems *) get_opaque_ptr (opaque);
 
   if (!(inhibit_flags & INHIBIT_WARNING_ISSUE)
-      && !warning_will_be_discarded (current_warning_level ()))
+      && !warning_will_be_discarded (current_warning_level ())
+      && !EQ (error_conditions, Qquit))
     {
       struct gcpro gcpro1;
       Lisp_Object lstream = Qnil;
@@ -4898,7 +4898,7 @@
 	     p->thrown_tag, p->thrown_value);
 	  warn_when_safe_lispobj (Qerror, current_warning_level (), errstr);
 	}
-      else if (p->caught_error)
+      else if (p->caught_error && !EQ (p->error_conditions, Qquit))
 	{
 	  Lisp_Object errstr;
 	  /* #### This should call
--- a/src/event-msw.c	Mon Dec 06 03:46:07 2004 +0000
+++ b/src/event-msw.c	Mon Dec 06 03:52:23 2004 +0000
@@ -3207,7 +3207,7 @@
                    may be copying an ANSI string into it.  Easiest to just
                    zero the whole thing. */
 		xzero (*tttextw->szText);
-		xetcsncpy ((Extbyte *) tttextw->szText, btextext, 79);
+		qxetcsncpy ((Extbyte *) tttextw->szText, btextext, 79);
 	      }
 	    else
 	      tttextw->lpszText = NULL;
@@ -3782,7 +3782,7 @@
 			    Extbyte *fname_unicode;
 			    WIN32_FIND_DATAW wfd;
 			    LPWSTR resolved =
-			      alloca_array (WCHAR, PATH_MAX + 1);
+			      alloca_array (WCHAR, PATH_MAX_EXTERNAL + 1);
 
 			    TO_EXTERNAL_FORMAT (DATA, (fname, fnamelen),
 						C_STRING_ALLOCA,
@@ -3806,10 +3806,10 @@
 				/* Another Cygwin prototype error,
 				   fixed in v2.2 of w32api */
 				XECOMCALL4 (psl, GetPath, (LPSTR) resolved,
-					    PATH_MAX, &wfd, 0)
+					    PATH_MAX_EXTERNAL, &wfd, 0)
 #else
 				XECOMCALL4 (psl, GetPath, resolved,
-					    PATH_MAX, &wfd, 0)
+					    PATH_MAX_EXTERNAL, &wfd, 0)
 #endif
 				== S_OK)
 			      TO_INTERNAL_FORMAT (C_STRING, resolved,
@@ -3842,7 +3842,7 @@
 			    Extbyte *fname_unicode;
 			    WIN32_FIND_DATAA wfd;
 			    LPSTR resolved =
-			      alloca_array (CHAR, PATH_MAX + 1);
+			      alloca_array (CHAR, PATH_MAX_EXTERNAL + 1);
 
 			    /* Always Unicode.  Not obvious from the
                                IPersistFile documentation, but look under
@@ -3856,7 +3856,7 @@
 					    (LPWSTR) fname_unicode,
 					    STGM_READ) == S_OK
 				&& XECOMCALL4 (psl, GetPath, resolved,
-					       PATH_MAX, &wfd, 0) == S_OK)
+					       PATH_MAX_EXTERNAL, &wfd, 0) == S_OK)
 			      TO_INTERNAL_FORMAT (C_STRING, resolved,
 						  ALLOCA, (fname, fnamelen),
 						  Qmswindows_tstr);
--- a/src/events.c	Mon Dec 06 03:46:07 2004 +0000
+++ b/src/events.c	Mon Dec 06 03:52:23 2004 +0000
@@ -1542,20 +1542,20 @@
 	UNGCPRO;
 	return;
       }
-    case magic_eval_event:	eicat_c (buf, "magic-eval"); return;
-    case pointer_motion_event:	eicat_c (buf, "motion");     return;
-    case misc_user_event:	eicat_c (buf, "misc-user");  return;
-    case eval_event:		eicat_c (buf, "eval");	     return;
-    case process_event:		eicat_c (buf, "process");    return;
-    case timeout_event:		eicat_c (buf, "timeout");    return;
-    case empty_event:		eicat_c (buf, "empty");	     return;
-    case dead_event:		eicat_c (buf, "DEAD-EVENT"); return;
+    case magic_eval_event:	eicat_ascii (buf, "magic-eval"); return;
+    case pointer_motion_event:	eicat_ascii (buf, "motion");     return;
+    case misc_user_event:	eicat_ascii (buf, "misc-user");  return;
+    case eval_event:		eicat_ascii (buf, "eval");	     return;
+    case process_event:		eicat_ascii (buf, "process");    return;
+    case timeout_event:		eicat_ascii (buf, "timeout");    return;
+    case empty_event:		eicat_ascii (buf, "empty");	     return;
+    case dead_event:		eicat_ascii (buf, "DEAD-EVENT"); return;
     default:
       abort ();
       return;
     }
 #define modprint(x,y) \
-  do { if (brief) eicat_c (buf, (y)); else eicat_c (buf, (x)); } while (0)
+  do { if (brief) eicat_ascii (buf, (y)); else eicat_ascii (buf, (x)); } while (0)
   if (mod & XEMACS_MOD_CONTROL) modprint ("control-", "C-");
   if (mod & XEMACS_MOD_META)    modprint ("meta-",    "M-");
   if (mod & XEMACS_MOD_SUPER)   modprint ("super-",   "S-");
@@ -1564,7 +1564,7 @@
   if (mod & XEMACS_MOD_SHIFT)   modprint ("shift-",   "Sh-");
   if (mouse_p)
     {
-      eicat_c (buf, "button");
+      eicat_ascii (buf, "button");
       --mouse_p;
     }
 
@@ -1586,14 +1586,14 @@
 	  else if (EQ (key, QKbackspace)) str = "BS";
 	}
       if (str)
-	eicat_c (buf, str);
+	eicat_ascii (buf, str);
       else
 	eicat_lstr (buf, XSYMBOL (key)->name);
     }
   else
     abort ();
   if (mouse_p)
-    eicat_c (buf, "up");
+    eicat_ascii (buf, "up");
 }
 
 void
--- a/src/fileio.c	Mon Dec 06 03:46:07 2004 +0000
+++ b/src/fileio.c	Mon Dec 06 03:52:23 2004 +0000
@@ -1341,7 +1341,7 @@
   }
 
   {
-    Ibyte resolved_path[PATH_MAX];
+    Ibyte resolved_path[PATH_MAX_INTERNAL];
     Bytecount elen = XSTRING_LENGTH (expanded_name);
     Ibyte *path;
     Ibyte *p;
--- a/src/glyphs-gtk.c	Mon Dec 06 03:46:07 2004 +0000
+++ b/src/glyphs-gtk.c	Mon Dec 06 03:52:23 2004 +0000
@@ -1701,7 +1701,7 @@
   Lisp_Object device = IMAGE_INSTANCE_DEVICE (ii);
   GdkColor fg, bg;
   GdkFont *source, *mask;
-  char source_name[PATH_MAX], mask_name[PATH_MAX], dummy;
+  char source_name[PATH_MAX_INTERNAL], mask_name[PATH_MAX_INTERNAL], dummy;
   int source_char, mask_char;
   int count;
   Lisp_Object foreground, background;
--- a/src/glyphs-msw.c	Mon Dec 06 03:46:07 2004 +0000
+++ b/src/glyphs-msw.c	Mon Dec 06 03:52:23 2004 +0000
@@ -2486,7 +2486,7 @@
   else
     LISP_STRING_TO_TSTR (item, tvitem.item.pszText);
       
-  tvitem.item.cchTextMax = xetcslen ((Extbyte *) tvitem.item.pszText);
+  tvitem.item.cchTextMax = qxetcslen ((Extbyte *) tvitem.item.pszText);
       
   if ((ret = (HTREEITEM) qxeSendMessage (wnd, TVM_INSERTITEM,
 					 0, (LPARAM) &tvitem)) == 0)
@@ -2605,7 +2605,7 @@
       LISP_STRING_TO_TSTR (item, tcitem.pszText);
     }
 
-  tcitem.cchTextMax = xetcslen ((Extbyte *) tcitem.pszText);
+  tcitem.cchTextMax = qxetcslen ((Extbyte *) tcitem.pszText);
 
   if ((ret = qxeSendMessage (wnd, TCM_INSERTITEM, i, (LPARAM) &tcitem)) < 0)
     gui_error ("error adding tab entry", item);
--- a/src/glyphs-x.c	Mon Dec 06 03:46:07 2004 +0000
+++ b/src/glyphs-x.c	Mon Dec 06 03:52:23 2004 +0000
@@ -1838,7 +1838,7 @@
   Display *dpy;
   XColor fg, bg;
   Font source, mask;
-  Ibyte source_name[PATH_MAX], mask_name[PATH_MAX], dummy;
+  Ibyte source_name[PATH_MAX_INTERNAL], mask_name[PATH_MAX_INTERNAL], dummy;
   int source_char, mask_char;
   int count;
   Lisp_Object foreground, background;
--- a/src/keymap.c	Mon Dec 06 03:46:07 2004 +0000
+++ b/src/keymap.c	Mon Dec 06 03:52:23 2004 +0000
@@ -3335,26 +3335,26 @@
       LIST_LOOP (rest, key)
 	{
 	  Lisp_Object keysym = XCAR (rest);
-	  if (EQ (keysym, Qcontrol))    eicat_c (bufp, "C-");
-	  else if (EQ (keysym, Qctrl))  eicat_c (bufp, "C-");
-	  else if (EQ (keysym, Qmeta))  eicat_c (bufp, "M-");
-	  else if (EQ (keysym, Qsuper)) eicat_c (bufp, "S-");
-	  else if (EQ (keysym, Qhyper)) eicat_c (bufp, "H-");
-	  else if (EQ (keysym, Qalt))	eicat_c (bufp, "A-");
-	  else if (EQ (keysym, Qshift)) eicat_c (bufp, "Sh-");
+	  if (EQ (keysym, Qcontrol))    eicat_ascii (bufp, "C-");
+	  else if (EQ (keysym, Qctrl))  eicat_ascii (bufp, "C-");
+	  else if (EQ (keysym, Qmeta))  eicat_ascii (bufp, "M-");
+	  else if (EQ (keysym, Qsuper)) eicat_ascii (bufp, "S-");
+	  else if (EQ (keysym, Qhyper)) eicat_ascii (bufp, "H-");
+	  else if (EQ (keysym, Qalt))	eicat_ascii (bufp, "A-");
+	  else if (EQ (keysym, Qshift)) eicat_ascii (bufp, "Sh-");
 	  else if (CHAR_OR_CHAR_INTP (keysym))
 	    eicat_ch (bufp, XCHAR_OR_CHAR_INT (keysym));
 	  else
 	    {
 	      CHECK_SYMBOL (keysym);
 #if 0                           /* This is bogus */
-	      if (EQ (keysym, QKlinefeed))	 eicat_c (bufp, "LFD");
-	      else if (EQ (keysym, QKtab))	 eicat_c (bufp, "TAB");
-	      else if (EQ (keysym, QKreturn))	 eicat_c (bufp, "RET");
-	      else if (EQ (keysym, QKescape))	 eicat_c (bufp, "ESC");
-	      else if (EQ (keysym, QKdelete))	 eicat_c (bufp, "DEL");
-	      else if (EQ (keysym, QKspace))	 eicat_c (bufp, "SPC");
-	      else if (EQ (keysym, QKbackspace)) eicat_c (bufp, "BS");
+	      if (EQ (keysym, QKlinefeed))	 eicat_ascii (bufp, "LFD");
+	      else if (EQ (keysym, QKtab))	 eicat_ascii (bufp, "TAB");
+	      else if (EQ (keysym, QKreturn))	 eicat_ascii (bufp, "RET");
+	      else if (EQ (keysym, QKescape))	 eicat_ascii (bufp, "ESC");
+	      else if (EQ (keysym, QKdelete))	 eicat_ascii (bufp, "DEL");
+	      else if (EQ (keysym, QKspace))	 eicat_ascii (bufp, "SPC");
+	      else if (EQ (keysym, QKbackspace)) eicat_ascii (bufp, "BS");
 	      else
 #endif
 		eicat_lstr (bufp, XSYMBOL (keysym)->name);
@@ -3567,7 +3567,7 @@
       XSET_EVENT_KEY_MODIFIERS (event, KEY_DATA_MODIFIERS (&keys[i]));
       format_event_object (buf, event, 1);
       if (i < count - 1)
-	eicat_c (buf, " ");
+	eicat_ascii (buf, " ");
     }
   Fdeallocate_event (event);
 }
--- a/src/lisp.h	Mon Dec 06 03:46:07 2004 +0000
+++ b/src/lisp.h	Mon Dec 06 03:52:23 2004 +0000
@@ -2205,13 +2205,29 @@
 	    ((void) signal_circular_property_list_error (list)) :	\
 	    ((void) 0)))))
 
-#define PROPERTY_LIST_LOOP(tail, key, value, plist)	\
-  for (tail = plist;					\
-       NILP (tail) ? 0 :				\
-	 (key   = XCAR (tail), tail = XCDR (tail),	\
-	  value = XCAR (tail), tail = XCDR (tail), 1);	\
+#define PRIVATE_PROPERTY_LIST_LOOP_4(tail, key, value, plist)	\
+  for (tail = plist;						\
+       NILP (tail) ? 0 :					\
+	 (key   = XCAR (tail), tail = XCDR (tail),		\
+	  value = XCAR (tail), tail = XCDR (tail), 1);		\
        )
 
+#define PROPERTY_LIST_LOOP_3(key, value, plist)			\
+  Lisp_Object key, value, tail_##key;				\
+  PRIVATE_PROPERTY_LIST_LOOP_4 (tail_##key, key, value, plist)
+
+#define GC_PROPERTY_LIST_LOOP_3(key, value, plist)		\
+do {								\
+  XGCDECL3 (key);						\
+  Lisp_Object key, value, tail_##key;				\
+  XGCPRO3 (key, key, value, tail_##key);			\
+  PRIVATE_PROPERTY_LIST_LOOP_4 (tail_##key, key, value, plist)
+
+#define END_GC_PROPERTY_LIST_LOOP(key)		\
+  XUNGCPRO (key);				\
+}						\
+while (0)
+
 /* Return 1 if LIST is properly acyclic and nil-terminated, else 0. */
 DECLARE_INLINE_HEADER (
 int
@@ -4595,9 +4611,14 @@
 /* Defined in rangetab.c */
 EXFUN (Fclear_range_table, 1);
 EXFUN (Fget_range_table, 3);
-EXFUN (Fmake_range_table, 0);
+EXFUN (Fmake_range_table, 1);
 EXFUN (Fput_range_table, 4);
 
+extern Lisp_Object Qstart_closed_end_open;
+extern Lisp_Object Qstart_open_end_open;
+extern Lisp_Object Qstart_closed_end_closed;
+extern Lisp_Object Qstart_open_end_closed;
+
 void put_range_table (Lisp_Object, EMACS_INT, EMACS_INT, Lisp_Object);
 int unified_range_table_bytes_needed (Lisp_Object);
 int unified_range_table_bytes_used (void *);
--- a/src/nt.c	Mon Dec 06 03:46:07 2004 +0000
+++ b/src/nt.c	Mon Dec 06 03:52:23 2004 +0000
@@ -1084,12 +1084,12 @@
       struct
 	{
 	  WIN32_STREAM_ID wid;
-	  WCHAR wbuffer[MAX_PATH];	/* extra space for link name */
+	  WCHAR wbuffer[_MAX_PATH];	/* extra space for link name */
 	} data;
 
       TO_EXTERNAL_FORMAT (C_STRING, new,
 			  ALLOCA, (newuni, wlen), Qmswindows_unicode);
-      if (wlen / sizeof (WCHAR) < MAX_PATH)
+      if (wlen / sizeof (WCHAR) < _MAX_PATH)
 	{
 	  LPVOID context = NULL;
 	  DWORD wbytes = 0;
@@ -1998,7 +1998,7 @@
 */
        (filename))
 {
-  Extbyte shortname[MAX_PATH * MAX_XETCHAR_SIZE];
+  Extbyte shortname[PATH_MAX_EXTERNAL];
   Extbyte *fileext;
   Ibyte *shortint;
 
--- a/src/objects-msw.c	Mon Dec 06 03:46:07 2004 +0000
+++ b/src/objects-msw.c	Mon Dec 06 03:52:23 2004 +0000
@@ -1492,7 +1492,7 @@
       C_STRING_TO_TSTR (fontname, extfontname);
       if (logfont)
 	{
-          xetcsncpy ((Extbyte *) logfont->lfFaceName, extfontname,
+          qxetcsncpy ((Extbyte *) logfont->lfFaceName, extfontname,
 	             LF_FACESIZE - 1);
 	  logfont->lfFaceName[LF_FACESIZE - 1] = 0;
 	}
--- a/src/process-nt.c	Mon Dec 06 03:46:07 2004 +0000
+++ b/src/process-nt.c	Mon Dec 06 03:52:23 2004 +0000
@@ -771,7 +771,7 @@
       {
 	DECLARE_EISTRING (progext);
 	eicpy_lstr (progext, program);
-	eicat_c (progext, ".exe");
+	eicat_ascii (progext, ".exe");
 	eito_external (progext, Qmswindows_tstr);
 	image_type = qxeSHGetFileInfo (eiextdata (progext), 0, NULL, 0,
 				       SHGFI_EXETYPE);
@@ -950,7 +950,7 @@
        while leaving the real app name as argv[0].  */
     if (is_dos_app)
       {
-	cmdname = alloca_ibytes (PATH_MAX);
+	cmdname = alloca_ibytes (PATH_MAX_INTERNAL);
 	if (egetenv ("CMDPROXY"))
 	  qxestrcpy (cmdname, egetenv ("CMDPROXY"));
 	else
--- a/src/profile.c	Mon Dec 06 03:46:07 2004 +0000
+++ b/src/profile.c	Mon Dec 06 03:52:23 2004 +0000
@@ -128,16 +128,16 @@
   create_timing_profile_table ();
   if (NILP (Vtotal_timing_profile_table))
     Vtotal_timing_profile_table =
-      make_lisp_hash_table (100, HASH_TABLE_NON_WEAK, HASH_TABLE_EQ);
+      make_lisp_hash_table (1000, HASH_TABLE_NON_WEAK, HASH_TABLE_EQ);
   if (NILP (Vcall_count_profile_table))
     Vcall_count_profile_table =
-      make_lisp_hash_table (100, HASH_TABLE_NON_WEAK, HASH_TABLE_EQ);
+      make_lisp_hash_table (1000, HASH_TABLE_NON_WEAK, HASH_TABLE_EQ);
   if (NILP (Vgc_usage_profile_table))
     Vgc_usage_profile_table =
-      make_lisp_hash_table (100, HASH_TABLE_NON_WEAK, HASH_TABLE_EQ);
+      make_lisp_hash_table (1000, HASH_TABLE_NON_WEAK, HASH_TABLE_EQ);
   if (NILP (Vtotal_gc_usage_profile_table))
     Vtotal_gc_usage_profile_table =
-      make_lisp_hash_table (100, HASH_TABLE_NON_WEAK, HASH_TABLE_EQ);
+      make_lisp_hash_table (1000, HASH_TABLE_NON_WEAK, HASH_TABLE_EQ);
 }
 
 static Lisp_Object
@@ -178,13 +178,8 @@
 void
 profile_record_consing (EMACS_INT size)
 {
-  Lisp_Object fun;
-  Lisp_Object count;
-
   in_profiling++;
-  fun = current_profile_function ();
-  count = Fgethash (fun, Vgc_usage_profile_table, Qzero);
-  Fputhash (fun, make_int (size + XINT (count)), Vgc_usage_profile_table);
+  inchash_eq (current_profile_function (), Vgc_usage_profile_table, size);
   in_profiling--;
 }
 
@@ -228,11 +223,7 @@
   /* See comments in create_timing_profile_table(). */
   pregrow_hash_table_if_necessary (big_profile_table, EXTRA_BREATHING_ROOM);
   profiling_lock = 0;
-  Fputhash (*bt->function,
-	    make_int (1 + XINT (Fgethash (*bt->function,
-					  Vcall_count_profile_table,
-					  Qzero))),
-	    Vcall_count_profile_table);
+  inchash_eq (*bt->function, Vcall_count_profile_table, 1);
   /* This may be set if the function was in its preamble at the time that
      `start-profiling' was called.  If so, we shouldn't reset the values
      because we may get inconsistent results, since we have already started
--- a/src/rangetab.c	Mon Dec 06 03:46:07 2004 +0000
+++ b/src/rangetab.c	Mon Dec 06 03:52:23 2004 +0000
@@ -1,6 +1,6 @@
 /* XEmacs routines to deal with range tables.
    Copyright (C) 1995 Sun Microsystems, Inc.
-   Copyright (C) 1995, 2002 Ben Wing.
+   Copyright (C) 1995, 2002, 2004 Ben Wing.
 
 This file is part of XEmacs.
 
@@ -30,11 +30,55 @@
 Lisp_Object Qrange_tablep;
 Lisp_Object Qrange_table;
 
+Lisp_Object Qstart_closed_end_open;
+Lisp_Object Qstart_open_end_open;
+Lisp_Object Qstart_closed_end_closed;
+Lisp_Object Qstart_open_end_closed;
+
 
 /************************************************************************/
 /*                            Range table object                        */
 /************************************************************************/
 
+static enum range_table_type
+range_table_symbol_to_type (Lisp_Object symbol)
+{
+  if (NILP (symbol))
+    return RANGE_START_CLOSED_END_OPEN;
+
+  CHECK_SYMBOL (symbol);
+  if (EQ (symbol, Qstart_closed_end_open))
+    return RANGE_START_CLOSED_END_OPEN;
+  if (EQ (symbol, Qstart_closed_end_closed))
+    return RANGE_START_CLOSED_END_CLOSED;
+  if (EQ (symbol, Qstart_open_end_open))
+    return RANGE_START_OPEN_END_OPEN;
+  if (EQ (symbol, Qstart_open_end_closed))
+    return RANGE_START_OPEN_END_CLOSED;
+
+  invalid_constant ("Unknown range table type", symbol);
+  RETURN_NOT_REACHED (RANGE_START_CLOSED_END_OPEN);
+}
+
+static Lisp_Object
+range_table_type_to_symbol (enum range_table_type type)
+{
+  switch (type)
+    {
+    case RANGE_START_CLOSED_END_OPEN:
+      return Qstart_closed_end_open;
+    case RANGE_START_CLOSED_END_CLOSED:
+      return Qstart_closed_end_closed;
+    case RANGE_START_OPEN_END_OPEN:
+      return Qstart_open_end_open;
+    case RANGE_START_OPEN_END_CLOSED:
+      return Qstart_open_end_closed;
+    }
+
+  abort ();
+  return Qnil;
+}
+
 /* We use a sorted array of ranges.
 
    #### We should be using the gap array stuff from extents.c.  This
@@ -58,20 +102,37 @@
   Lisp_Range_Table *rt = XRANGE_TABLE (obj);
   int i;
 
-  write_c_string (printcharfun, "#s(range-table data (");
+  if (print_readably)
+    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 ");
   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, " ");
-      if (rte->first == rte->last)
-	write_fmt_string (printcharfun, "%ld ", (long) (rte->first));
-      else
-	write_fmt_string (printcharfun, "(%ld %ld) ", (long) (rte->first),
-			  (long) (rte->last));
+      switch (rt->type)
+	{
+	case RANGE_START_CLOSED_END_OPEN: so = 0, ec = 0; break;
+	case RANGE_START_CLOSED_END_CLOSED: so = 0, ec = 1; break;
+	case RANGE_START_OPEN_END_OPEN: so = 1, ec = 0; break;
+	case RANGE_START_OPEN_END_CLOSED: so = 1; ec = 1; break;
+	default: abort (); so = 0, ec = 0; break;
+	}
+      write_fmt_string (printcharfun, "%c%ld %ld%c ",
+			print_readably ? '(' : so ? '(' : '[',
+			(long) (rte->first - so),
+			(long) (rte->last - ec),
+			print_readably ? ')' : ec ? ']' : ')'
+			);
       print_internal (rte->val, printcharfun, 1);
     }
-  write_c_string (printcharfun, "))");
+  if (print_readably)
+    write_c_string (printcharfun, "))");
+  else
+    write_fmt_string (printcharfun, " 0x%x>", rt->header.uid);
 }
 
 static int
@@ -180,7 +241,7 @@
       struct range_table_entry *rte = Dynarr_atp (rt->entries, i);
       assert (rte->last >= rte->first);
       if (i > 0)
-	assert (Dynarr_at (rt->entries, i - 1).last < rte->first);
+	assert (Dynarr_at (rt->entries, i - 1).last <= rte->first);
     }
 }
 
@@ -207,8 +268,8 @@
 	 of the list), so NEWPOS must round down. */
       int newpos = (left + right) >> 1;
       struct range_table_entry *entry = tab + newpos;
-      if (pos > entry->last)
-	left = newpos+1;
+      if (pos >= entry->last)
+	left = newpos + 1;
       else if (pos < entry->first)
 	right = newpos;
       else
@@ -226,16 +287,50 @@
   return RANGE_TABLEP (object) ? Qt : Qnil;
 }
 
-DEFUN ("make-range-table", Fmake_range_table, 0, 0, 0, /*
+DEFUN ("range-table-type", Frange_table_type, 1, 1, 0, /*
+Return non-nil if OBJECT is a range table.
+*/
+       (range_table))
+{
+  CHECK_RANGE_TABLE (range_table);
+  return range_table_type_to_symbol (XRANGE_TABLE (range_table)->type);
+}
+
+DEFUN ("make-range-table", Fmake_range_table, 0, 1, 0, /*
 Return a new, empty range table.
 You can manipulate it using `put-range-table', `get-range-table',
 `remove-range-table', and `clear-range-table'.
+Range tables allow you to efficiently set values for ranges of integers.
+
+ TYPE is a symbol indicating how ranges are assumed to function at their
+ ends.  It can be one of
+ 
+ SYMBOL                                     RANGE-START         RANGE-END
+ ------                                     -----------         ---------
+ `start-closed-end-open'  (the default)     closed              open
+ `start-closed-end-closed'                  closed              closed
+ `start-open-end-open'                      open                open
+ `start-open-end-closed'                    open                closed
+ 
+ A `closed' endpoint of a range means that the number at that end is included
+ in the range.  For an `open' endpoint, the number would not be included.
+ 
+ For example, a closed-open range from 5 to 20 would be indicated as [5,
+ 20) where a bracket indicates a closed end and a parenthesis an open end,
+ and would mean `all the numbers between 5 and 20', including 5 but not 20.
+ This seems a little strange at first but is in fact extremely common in
+ the outside world as well as in computers and makes things work sensibly.
+ For example, if I say "there are seven days between today and next week
+ today", I'm including today but not next week today; if I included both,
+ there would be eight days.  Similarly, there are 15 (= 20 - 5) elements in
+ the range [5, 20), but 16 in the range [5, 20].
 */
-       ())
+       (type))
 {
   Lisp_Range_Table *rt = alloc_lcrecord_type (Lisp_Range_Table,
 					      &lrecord_range_table);
   rt->entries = Dynarr_new (range_table_entry);
+  rt->type = range_table_symbol_to_type (type);
   return wrap_range_table (rt);
 }
 
@@ -253,6 +348,7 @@
 
   rtnew = alloc_lcrecord_type (Lisp_Range_Table, &lrecord_range_table);
   rtnew->entries = Dynarr_new (range_table_entry);
+  rtnew->type = rt->type;
 
   Dynarr_add_many (rtnew->entries, Dynarr_atp (rt->entries, 0),
 		   Dynarr_length (rt->entries));
@@ -284,6 +380,24 @@
   int insert_me_here = -1;
   Lisp_Range_Table *rt = XRANGE_TABLE (table);
 
+  /* Fix up the numbers in accordance with the open/closedness to make
+     them behave like default open/closed. */
+
+  switch (rt->type)
+    {
+    case RANGE_START_CLOSED_END_OPEN: break;
+    case RANGE_START_CLOSED_END_CLOSED: last++; break;
+    case RANGE_START_OPEN_END_OPEN: first++; break;
+    case RANGE_START_OPEN_END_CLOSED: first++, last++; break;
+    }
+
+  if (first == last)
+    return;
+  if (first > last)
+    /* This will happen if originally first == last and both ends are
+       open. #### Should we signal an error? */
+    return;
+
   /* Now insert in the proper place.  This gets tricky because
      we may be overlapping one or more existing ranges and need
      to fix them up. */
@@ -304,44 +418,55 @@
 	/* completely after the new range.  No more possibilities of
 	   finding overlapping ranges. */
 	break;
+      /* At this point the existing ENTRY overlaps or touches the new one. */
       if (entry->first < first && entry->last <= last)
 	{
 	  /* looks like:
 
-	                 [ NEW ]
-	         [ EXISTING ]
+	                 [ NEW )
+                [ EXISTING )
+
+	     or
+
+	                 [ NEW )
+              [ EXISTING )
 
 	   */
 	  /* truncate the end off of it. */
-	  entry->last = first - 1;
+	  entry->last = first;
 	}
       else if (entry->first < first && entry->last > last)
 	/* looks like:
 
-	         [ NEW ]
-	       [ EXISTING ]
+	         [ NEW )
+	       [ EXISTING )
 
 	 */
 	/* need to split this one in two. */
 	{
 	  struct range_table_entry insert_me_too;
 
-	  insert_me_too.first = last + 1;
+	  insert_me_too.first = last;
 	  insert_me_too.last = entry->last;
 	  insert_me_too.val = entry->val;
-	  entry->last = first - 1;
+	  entry->last = first;
 	  Dynarr_insert_many (rt->entries, &insert_me_too, 1, i + 1);
 	}
-      else if (entry->last > last)
+      else if (entry->last >= last)
 	{
 	  /* looks like:
 
-	       [ NEW ]
-	         [ EXISTING ]
+	       [ NEW )
+                   [ EXISTING )
+
+             or
+
+	       [ NEW )
+	             [ EXISTING )
 
 	   */
 	  /* truncate the start off of it. */
-	  entry->first = last + 1;
+	  entry->first = last;
 	}
       else
 	{
@@ -377,7 +502,7 @@
     {
       struct range_table_entry *entry = Dynarr_atp (rt->entries,
 						    insert_me_here - 1);
-      if (EQ (val, entry->val) && entry->last == first - 1)
+      if (EQ (val, entry->val) && entry->last == first)
 	{
 	  entry->last = last;
 	  Dynarr_delete_many (rt->entries, insert_me_here, 1);
@@ -392,7 +517,7 @@
     {
       struct range_table_entry *entry = Dynarr_atp (rt->entries,
 						    insert_me_here + 1);
-      if (EQ (val, entry->val) && entry->first == last + 1)
+      if (EQ (val, entry->val) && entry->first == last)
 	{
 	  entry->first = first;
 	  Dynarr_delete_many (rt->entries, insert_me_here, 1);
@@ -401,7 +526,7 @@
 }
 
 DEFUN ("put-range-table", Fput_range_table, 4, 4, 0, /*
-Set the value for range (START, END) to be VALUE in RANGE-TABLE.
+Set the value for range START .. END to be VALUE in RANGE-TABLE.
 */
        (start, end, value, range_table))
 {
@@ -421,7 +546,7 @@
 }
 
 DEFUN ("remove-range-table", Fremove_range_table, 3, 3, 0, /*
-Remove the value for range (START, END) in RANGE-TABLE.
+Remove the value for range START .. END in RANGE-TABLE.
 */
        (start, end, range_table))
 {
@@ -491,6 +616,15 @@
 /************************************************************************/
 
 static int
+rangetab_type_validate (Lisp_Object UNUSED (keyword), Lisp_Object value,
+			Error_Behavior UNUSED (errb))
+{
+  /* #### should deal with ERRB */
+  range_table_symbol_to_type (value);
+  return 1;
+}
+
+static int
 rangetab_data_validate (Lisp_Object UNUSED (keyword), Lisp_Object value,
 			Error_Behavior UNUSED (errb))
 {
@@ -509,26 +643,30 @@
 }
 
 static Lisp_Object
-rangetab_instantiate (Lisp_Object data)
+rangetab_instantiate (Lisp_Object plist)
 {
-  Lisp_Object rangetab = Fmake_range_table ();
+  Lisp_Object data = Qnil, type = Qnil;
 
-  if (!NILP (data))
+  PROPERTY_LIST_LOOP_3 (key, value, plist)
     {
-      data = Fcar (Fcdr (data)); /* skip over 'data keyword */
-      while (!NILP (data))
-	{
-	  Lisp_Object range = Fcar (data);
-	  Lisp_Object val = Fcar (Fcdr (data));
+      if (EQ (key, Qtype)) type = value;
+      else if (EQ (key, Qdata)) data = value;
+      else
+	abort ();
+    }
+
+  Lisp_Object rangetab = Fmake_range_table (type);
 
-	  data = Fcdr (Fcdr (data));
-	  if (CONSP (range))
-	    Fput_range_table (Fcar (range), Fcar (Fcdr (range)), val,
-			      rangetab);
-	  else
-	    Fput_range_table (range, range, val, rangetab);
-	}
-    }
+  {
+    PROPERTY_LIST_LOOP_3 (range, val, data)
+      {
+	if (CONSP (range))
+	  Fput_range_table (Fcar (range), Fcar (Fcdr (range)), val,
+			    rangetab);
+	else
+	  Fput_range_table (range, range, val, rangetab);
+      }
+  }
 
   return rangetab;
 }
@@ -733,7 +871,13 @@
   DEFSYMBOL_MULTIWORD_PREDICATE (Qrange_tablep);
   DEFSYMBOL (Qrange_table);
 
+  DEFSYMBOL (Qstart_closed_end_open);
+  DEFSYMBOL (Qstart_open_end_open);
+  DEFSYMBOL (Qstart_closed_end_closed);
+  DEFSYMBOL (Qstart_open_end_closed);
+
   DEFSUBR (Frange_table_p);
+  DEFSUBR (Frange_table_type);
   DEFSUBR (Fmake_range_table);
   DEFSUBR (Fcopy_range_table);
   DEFSUBR (Fget_range_table);
@@ -751,4 +895,5 @@
   st = define_structure_type (Qrange_table, 0, rangetab_instantiate);
 
   define_structure_type_keyword (st, Qdata, rangetab_data_validate);
+  define_structure_type_keyword (st, Qtype, rangetab_type_validate);
 }
--- a/src/rangetab.h	Mon Dec 06 03:46:07 2004 +0000
+++ b/src/rangetab.h	Mon Dec 06 03:52:23 2004 +0000
@@ -1,6 +1,6 @@
 /* XEmacs routines to deal with range tables.
    Copyright (C) 1995 Sun Microsystems, Inc.
-   Copyright (C) 1995 Ben Wing.
+   Copyright (C) 1995, 2004 Ben Wing.
 
 This file is part of XEmacs.
 
@@ -39,10 +39,19 @@
   Dynarr_declare (range_table_entry);
 } range_table_entry_dynarr;
 
+enum range_table_type
+{
+  RANGE_START_CLOSED_END_OPEN,
+  RANGE_START_CLOSED_END_CLOSED,
+  RANGE_START_OPEN_END_CLOSED,
+  RANGE_START_OPEN_END_OPEN
+};
+
 struct Lisp_Range_Table
 {
   struct lcrecord_header header;
   range_table_entry_dynarr *entries;
+  enum range_table_type type;
 };
 typedef struct Lisp_Range_Table Lisp_Range_Table;
 
--- a/src/realpath.c	Mon Dec 06 03:46:07 2004 +0000
+++ b/src/realpath.c	Mon Dec 06 03:52:23 2004 +0000
@@ -105,7 +105,7 @@
 	errno = ENOENT;
 	return -1;
       }
-    else if (qxestrlen (name) >= PATH_MAX)
+    else if (qxestrlen (name) >= PATH_MAX_INTERNAL)
       {
 	errno = ENAMETOOLONG;
 	return -1;
@@ -170,12 +170,12 @@
 Ibyte *
 qxe_realpath (const Ibyte *path, Ibyte *resolved_path)
 {
-  Ibyte copy_path[PATH_MAX];
+  Ibyte copy_path[PATH_MAX_INTERNAL];
   Ibyte *new_path = resolved_path;
   Ibyte *max_path;
 #if defined (HAVE_READLINK) || defined (WIN32_ANY)
   int readlinks = 0;
-  Ibyte link_path[PATH_MAX];
+  Ibyte link_path[PATH_MAX_INTERNAL];
   int n;
   int abslen = abs_start (path);
 #endif
@@ -185,7 +185,7 @@
   /* Make a copy of the source path since we may need to modify it. */
   qxestrcpy (copy_path, path);
   path = copy_path;
-  max_path = copy_path + PATH_MAX - 2;
+  max_path = copy_path + PATH_MAX_INTERNAL - 2;
 
   if (0)
     ;
@@ -216,14 +216,14 @@
   /* No drive letter, but a beginning slash? Prepend drive letter. */
   else if (abslen == 1)
     {
-      get_initial_directory (new_path, PATH_MAX - 1);
+      get_initial_directory (new_path, PATH_MAX_INTERNAL - 1);
       new_path += 3;
       path++;
     }
   /* Just a path name, prepend the current directory */
   else
     {
-      get_initial_directory (new_path, PATH_MAX - 1);
+      get_initial_directory (new_path, PATH_MAX_INTERNAL - 1);
       new_path += qxestrlen (new_path);
       if (!IS_DIRECTORY_SEP (new_path[-1]))
 	*new_path++ = DIRECTORY_SEP;
@@ -232,7 +232,7 @@
   /* If it's a relative pathname use get_initial_directory for starters. */
   else if (abslen == 0)
     {
-      get_initial_directory (new_path, PATH_MAX - 1);
+      get_initial_directory (new_path, PATH_MAX_INTERNAL - 1);
       new_path += qxestrlen (new_path);
       if (!IS_DIRECTORY_SEP (new_path[-1]))
 	*new_path++ = DIRECTORY_SEP;
@@ -297,7 +297,7 @@
       /* See if latest pathname component is a symlink or needs case
 	 correction. */
       *new_path = '\0';
-      n = readlink_and_correct_case (resolved_path, link_path, PATH_MAX - 1);
+      n = readlink_and_correct_case (resolved_path, link_path, PATH_MAX_INTERNAL - 1);
 
       if (n < 0)
 	{
@@ -337,7 +337,7 @@
 	    assert (new_path > resolved_path);
 
 	  /* Safe sex check. */
-	  if (qxestrlen (path) + n >= PATH_MAX)
+	  if (qxestrlen (path) + n >= PATH_MAX_INTERNAL)
 	    {
 	      errno = ENAMETOOLONG;
 	      return NULL;
--- a/src/regex.c	Mon Dec 06 03:46:07 2004 +0000
+++ b/src/regex.c	Mon Dec 06 03:52:23 2004 +0000
@@ -419,7 +419,7 @@
 void
 vars_of_regex (void)
 {
-  Vthe_lisp_rangetab = Fmake_range_table ();
+  Vthe_lisp_rangetab = Fmake_range_table (Qstart_closed_end_closed);
   staticpro (&Vthe_lisp_rangetab);
 }
 
--- a/src/search.c	Mon Dec 06 03:46:07 2004 +0000
+++ b/src/search.c	Mon Dec 06 03:52:23 2004 +0000
@@ -3173,6 +3173,6 @@
 */ );
   warn_about_possibly_incompatible_back_references = 1;
 
-  Vskip_chars_range_table = Fmake_range_table ();
+  Vskip_chars_range_table = Fmake_range_table (Qstart_closed_end_closed);
   staticpro (&Vskip_chars_range_table);
 }
--- a/src/symbols.c	Mon Dec 06 03:46:07 2004 +0000
+++ b/src/symbols.c	Mon Dec 06 03:52:23 2004 +0000
@@ -2100,9 +2100,8 @@
        (args))
 {
   /* This function can GC */
-  Lisp_Object symbol, tail, val = Qnil;
   int nargs;
-  struct gcpro gcpro1;
+  Lisp_Object retval = Qnil;
 
   GET_LIST_LENGTH (args, nargs);
 
@@ -2110,16 +2109,15 @@
     Fsignal (Qwrong_number_of_arguments,
 	     list2 (Qsetq_default, make_int (nargs)));
 
-  GCPRO1 (val);
-
-  PROPERTY_LIST_LOOP (tail, symbol, val, args)
+  GC_PROPERTY_LIST_LOOP_3 (symbol, val, args)
     {
       val = Feval (val);
       Fset_default (symbol, val);
+      retval = val;
     }
 
-  UNGCPRO;
-  return val;
+  END_GC_PROPERTY_LIST_LOOP (symbol);
+  return retval;
 }
 
 /* Lisp functions for creating and removing buffer-local variables.  */
--- a/src/sysdep.c	Mon Dec 06 03:46:07 2004 +0000
+++ b/src/sysdep.c	Mon Dec 06 03:52:23 2004 +0000
@@ -3139,7 +3139,7 @@
 	}
     }
 #else
-  Extbyte chingame_limitos_arbitrarios[PATH_MAX];
+  Extbyte chingame_limitos_arbitrarios[PATH_MAX_EXTERNAL];
   Ibyte *ret2;
 
   if (!getwd (chingame_limitos_arbitrarios))
--- a/src/sysfile.h	Mon Dec 06 03:46:07 2004 +0000
+++ b/src/sysfile.h	Mon Dec 06 03:52:23 2004 +0000
@@ -1,6 +1,6 @@
 /*
    Copyright (C) 1995 Free Software Foundation, Inc.
-   Copyright (C) 2000, 2001, 2002 Ben Wing.
+   Copyright (C) 2000, 2001, 2002, 2004 Ben Wing.
 
 This file is part of XEmacs.
 
@@ -267,20 +267,43 @@
 #define S_ISNWK(m) (((m) & S_IFMT) == S_IFNWK)
 #endif
 
-/* Client .c files should simply use `PATH_MAX'. */
-#ifndef PATH_MAX
-# if defined (_MAX_PATH)
+/* Determining the maximum pathname length.
+
+   NOTE: IN GENERAL, YOU SHOULD NOT USE THIS.
+   If at all possible, avoid using fixed-length buffers of any sort.
+   You cannot guarantee on many systems that pathnames won't exceed
+   these limits for one reason or another.
+
+   Unfortunately, there is no universal agreement over whether these
+   values should include a final null-terminator or not.  Even recent
+   versions of Linux (circa 2002) are switching from the not-including-
+   terminator kind to the including-terminator kind.  So we assume that
+   the including-terminator kind will be even (usually is), and round
+   up as necessary. */
+    
+#define ROUND_UP_TO_EVEN_NUMBER(val) (((val + 1) >> 1) << 1)
+#ifdef PATH_MAX
+# define QXE_PATH_MAX ROUND_UP_TO_EVEN_NUMBER (PATH_MAX)
+#elif defined (_MAX_PATH)
 /* MS Win -- and preferable to _POSIX_PATH_MAX, which is also defined */
-#  define PATH_MAX _MAX_PATH
-# elif defined (_POSIX_PATH_MAX)
-#  define PATH_MAX _POSIX_PATH_MAX
-# elif defined (MAXPATHLEN)
-#  define PATH_MAX MAXPATHLEN
-# else
-#  define PATH_MAX 1024
-# endif
+# define QXE_PATH_MAX ROUND_UP_TO_EVEN_NUMBER (_MAX_PATH)
+#elif defined (_POSIX_PATH_MAX)
+# define QXE_PATH_MAX ROUND_UP_TO_EVEN_NUMBER (_POSIX_PATH_MAX)
+#elif defined (MAXPATHLEN)
+# define QXE_PATH_MAX ROUND_UP_TO_EVEN_NUMBER (MAXPATHLEN)
+#else
+# define QXE_PATH_MAX 1024
 #endif
 
+/* Client .c files should use PATH_MAX_INTERNAL or PATH_MAX_EXTERNAL
+   if they must use either one at all. */
+
+/* Use for internally formatted text, which can potentially have up to
+   four bytes per character */
+#define PATH_MAX_INTERNAL (QXE_PATH_MAX * MAX_ICHAR_LEN)
+/* Use for externally formatted text. */
+#define PATH_MAX_EXTERNAL (QXE_PATH_MAX * MAX_XETCHAR_SIZE)
+
 /* The following definitions are needed under Windows, at least */
 #ifndef X_OK
 # define X_OK 1
--- a/src/syswindows.h	Mon Dec 06 03:46:07 2004 +0000
+++ b/src/syswindows.h	Mon Dec 06 03:52:23 2004 +0000
@@ -760,26 +760,26 @@
 #define XETEXT(arg) XETEXT1(arg)
 #define XECOPY_TCHAR(ptr, ch) \
   (XEUNICODE_P ? (* (LPWSTR) (ptr) = L##ch) : (* (LPSTR) (ptr) = (ch)))
-#define xetcslen(arg) \
+#define qxetcslen(arg) \
   (XEUNICODE_P ? wcslen ((wchar_t *) arg) : strlen (arg))
-#define xetcsbytelen(arg) \
+#define qxetcsbytelen(arg) \
   (XEUNICODE_P ? wcslen ((wchar_t *) arg) * XETCHAR_SIZE : strlen (arg))
-#define xetcscmp(s1, s2) \
+#define qxetcscmp(s1, s2) \
   (XEUNICODE_P ? wcscmp ((wchar_t *) s1, (wchar_t *) s2) \
    : strcmp (s1, s2))
-#define xetcscpy(s1, s2) \
+#define qxetcscpy(s1, s2) \
   (XEUNICODE_P ? (char *) wcscpy ((wchar_t *) s1, (wchar_t *) s2) \
    : strcpy (s1, s2))
-#define xetcsncpy(s1, s2, n) \
+#define qxetcsncpy(s1, s2, n) \
   (XEUNICODE_P ? (char *) wcsncpy ((wchar_t *) s1, (wchar_t *) s2, n) \
    : strncpy (s1, s2, n))
-#define xetcschr(s, ch) \
+#define qxetcschr(s, ch) \
   (XEUNICODE_P ? (char *) wcschr ((wchar_t *) s, (WCHAR) ch) \
    : strchr (s, ch))
-#define xetcsrchr(s, ch) \
+#define qxetcsrchr(s, ch) \
   (XEUNICODE_P ? (char *) wcsrchr ((wchar_t *) s, (WCHAR) ch) \
    : strrchr (s, ch))
-#define xetcsdup(s) \
+#define qxetcsdup(s) \
   (XEUNICODE_P ? (char *) wcsdup ((wchar_t *) s) \
    : xstrdup (s))
 
@@ -793,7 +793,7 @@
   EXTERNAL_TO_C_STRING_MALLOC (in, out, Qmswindows_tstr)
 
 #define build_tstr_string(in) \
-  make_ext_string (in, xetcsbytelen ((Extbyte *) in), Qmswindows_tstr)
+  make_ext_string (in, qxetcsbytelen ((Extbyte *) in), Qmswindows_tstr)
 
 #define MAX_ANSI_CHAR_LEN 1
 #define MAX_UNICODE_CHAR_LEN 2
--- a/src/text.c	Mon Dec 06 03:46:07 2004 +0000
+++ b/src/text.c	Mon Dec 06 03:52:23 2004 +0000
@@ -2136,7 +2136,7 @@
 int
 eicmp_1 (Eistring *ei, Bytecount off, Charcount charoff,
 	 Bytecount len, Charcount charlen, const Ibyte *data,
-	 const Eistring *ei2, int is_c, int fold_case)
+	 const Eistring *ei2, int is_ascii, int fold_case)
 {
   assert ((off < 0) != (charoff < 0));
   if (off < 0)
@@ -2153,7 +2153,7 @@
   assert (off >= 0 && off <= ei->bytelen_);
   assert (len >= 0 && off + len <= ei->bytelen_);
   assert ((data == 0) != (ei == 0)); 
-  assert ((is_c != 0) == (data != 0));
+  assert ((is_ascii != 0) == (data != 0));
   assert (fold_case >= 0 && fold_case <= 2);
 
   {
@@ -2171,7 +2171,7 @@
 	dstlen = ei2->bytelen_;
       }
 
-    if (is_c)
+    if (is_ascii)
       ASSERT_ASCTEXT_ASCII_LEN ((Ascbyte *) dst, dstlen);
 
     return (fold_case == 0 ? qxememcmp4 (src, len, dst, dstlen) :
@@ -4253,6 +4253,7 @@
      places. */
   int count;
   Ibyte_dynarr *conversion_in_dynarr;
+  Lisp_Object underlying_cs;
   PROFILE_DECLARE ();
 
   assert (!inhibit_non_essential_conversion_operations);
@@ -4277,18 +4278,37 @@
   internal_bind_int (&dfc_convert_to_internal_format_in_use,
 		     dfc_convert_to_internal_format_in_use + 1);
 
-  coding_system = get_coding_system_for_text_file (coding_system, 1);
+  /* The second call does the equivalent of both calls, but we need
+     the result after the first call (which wraps just a to-text
+     converter) as well as the result after the second call (which
+     also wraps an EOL-detection converter). */
+  underlying_cs = get_coding_system_for_text_file (coding_system, 0);
+  coding_system = get_coding_system_for_text_file (underlying_cs, 1);
 
   if (source_type != DFC_TYPE_LISP_LSTREAM &&
       sink_type   != DFC_TYPE_LISP_LSTREAM &&
-      coding_system_is_binary (coding_system))
+      coding_system_is_binary (underlying_cs))
     {
 #ifdef MULE
-      const Ibyte *ptr = (const Ibyte *) source->data.ptr;
+      const Ibyte *ptr;
       Bytecount len = source->data.len;
-      const Ibyte *end = ptr + len;
-
-      for (; ptr < end; ptr++)
+      const Ibyte *end;
+
+      /* Make sure no EOL conversion is needed.  With a little work we
+	 could handle EOL conversion as well but it may not be needed as an
+	 optimization. */
+      if (!EQ (coding_system, underlying_cs))
+	{
+	  for (ptr = (const Ibyte *) source->data.ptr, end = ptr + len;
+	       ptr < end; ptr++)
+	    {
+	      if (*ptr == '\r' || *ptr == '\n')
+		goto the_hard_way;
+	    }
+	}
+
+      for (ptr = (const Ibyte *) source->data.ptr, end = ptr + len;
+	   ptr < end; ptr++)
         {
           Ibyte c = *ptr;
 
@@ -4314,25 +4334,38 @@
      involved */
   else if (source_type != DFC_TYPE_LISP_LSTREAM &&
 	   sink_type   != DFC_TYPE_LISP_LSTREAM &&
-	   dfc_coding_system_is_unicode (coding_system))
+	   dfc_coding_system_is_unicode (underlying_cs))
     {
-      const Ibyte *ptr = (const Ibyte *) source->data.ptr + 1;
+      const Ibyte *ptr;
       Bytecount len = source->data.len;
-      const Ibyte *end = ptr + len;
+      const Ibyte *end;
 
       if (len & 1)
 	goto the_hard_way;
 
-      for (; ptr < end; ptr += 2)
+      /* Make sure only ASCII/Latin-1 is involved */
+      for (ptr = (const Ibyte *) source->data.ptr + 1, end = ptr + len;
+	   ptr < end; ptr += 2)
 	{
 	  if (*ptr)
 	    goto the_hard_way;
 	}
 
-      ptr = (const Ibyte *) source->data.ptr;
-      end = ptr + len;
-
-      for (; ptr < end; ptr += 2)
+      /* Make sure no EOL conversion is needed.  With a little work we
+	 could handle EOL conversion as well but it may not be needed as an
+	 optimization. */
+      if (!EQ (coding_system, underlying_cs))
+	{
+	  for (ptr = (const Ibyte *) source->data.ptr, end = ptr + len;
+	       ptr < end; ptr += 2)
+	    {
+	      if (*ptr == '\r' || *ptr == '\n')
+		goto the_hard_way;
+	    }
+	}
+
+      for (ptr = (const Ibyte *) source->data.ptr, end = ptr + len;
+	   ptr < end; ptr += 2)
 	{
           Ibyte c = *ptr;
 
@@ -4360,9 +4393,9 @@
       Lisp_Object instream, outstream;
       Lstream *reader, *writer;
 
-#ifdef WIN32_ANY
+#if defined (WIN32_ANY) || defined (MULE)
     the_hard_way:
-#endif /* WIN32_ANY */
+#endif
       delete_count = 0;
       if (source_type == DFC_TYPE_LISP_LSTREAM)
 	instream = source->lisp_object;
--- a/src/text.h	Mon Dec 06 03:46:07 2004 +0000
+++ b/src/text.h	Mon Dec 06 03:52:23 2004 +0000
@@ -1420,10 +1420,10 @@
         ... from raw internal-format data in the specified format that is
         "null-terminated" (the meaning of this depends on the nature of
         the specific format).
-   void eicpy_c (Eistring *eistr, const Ascbyte *c_string);
+   void eicpy_ascii (Eistring *eistr, const Ascbyte *ascstr);
         ... from an ASCII null-terminated string.  Non-ASCII characters in
 	the string are *ILLEGAL* (read abort() with error-checking defined).
-   void eicpy_c_len (Eistring *eistr, const Ascbyte *c_string, len);
+   void eicpy_ascii_len (Eistring *eistr, const Ascbyte *ascstr, len);
         ... from an ASCII string, with length specified.  Non-ASCII characters
 	in the string are *ILLEGAL* (read abort() with error-checking defined).
    void eicpy_ext (Eistring *eistr, const Extbyte *extdata,
@@ -1563,7 +1563,7 @@
 
    void eicat_ei (Eistring *eistr, Eistring *eistr2);
         ... from another Eistring.
-   void eicat_c (Eistring *eistr, Ascbyte *c_string);
+   void eicat_ascii (Eistring *eistr, Ascbyte *ascstr);
         ... from an ASCII null-terminated string.  Non-ASCII characters in
 	the string are *ILLEGAL* (read abort() with error-checking defined).
    void eicat_raw (ei, const Ibyte *data, Bytecount len);
@@ -1592,8 +1592,8 @@
    void eisub_ei (Eistring *eistr, Bytecount off, Charcount charoff,
 		  Bytecount len, Charcount charlen, Eistring *eistr2);
         ... with another Eistring.
-   void eisub_c (Eistring *eistr, Bytecount off, Charcount charoff,
-		 Bytecount len, Charcount charlen, Ascbyte *c_string);
+   void eisub_ascii (Eistring *eistr, Bytecount off, Charcount charoff,
+		 Bytecount len, Charcount charlen, Ascbyte *ascstr);
         ... with an ASCII null-terminated string.  Non-ASCII characters in
 	the string are *ILLEGAL* (read abort() with error-checking defined).
    void eisub_ch (Eistring *eistr, Bytecount off, Charcount charoff,
@@ -1660,17 +1660,17 @@
    Charcount eirstr_ei_off_char (Eistring *eistr, Eistring *eistr2,
 				 Bytecount off, Charcount charoff);
 
-   Bytecount eistr_c (Eistring *eistr, Ascbyte *c_string);
-   Charcount eistr_c_char (Eistring *eistr, Ascbyte *c_string);
-   Bytecount eistr_c_off (Eistring *eistr, Ascbyte *c_string, Bytecount off,
+   Bytecount eistr_ascii (Eistring *eistr, Ascbyte *ascstr);
+   Charcount eistr_ascii_char (Eistring *eistr, Ascbyte *ascstr);
+   Bytecount eistr_ascii_off (Eistring *eistr, Ascbyte *ascstr, Bytecount off,
 			   Charcount charoff);
-   Charcount eistr_c_off_char (Eistring *eistr, Ascbyte *c_string,
+   Charcount eistr_ascii_off_char (Eistring *eistr, Ascbyte *ascstr,
 			       Bytecount off, Charcount charoff);
-   Bytecount eirstr_c (Eistring *eistr, Ascbyte *c_string);
-   Charcount eirstr_c_char (Eistring *eistr, Ascbyte *c_string);
-   Bytecount eirstr_c_off (Eistring *eistr, Ascbyte *c_string,
+   Bytecount eirstr_ascii (Eistring *eistr, Ascbyte *ascstr);
+   Charcount eirstr_ascii_char (Eistring *eistr, Ascbyte *ascstr);
+   Bytecount eirstr_ascii_off (Eistring *eistr, Ascbyte *ascstr,
 			   Bytecount off, Charcount charoff);
-   Charcount eirstr_c_off_char (Eistring *eistr, Ascbyte *c_string,
+   Charcount eirstr_ascii_off_char (Eistring *eistr, Ascbyte *ascstr,
 				Bytecount off, Charcount charoff);
 
 
@@ -1711,17 +1711,17 @@
 			      Charcount charoff, Bytecount len,
 			      Charcount charlen, Eistring *eistr2);
 
-   int eicmp_c (Eistring *eistr, Ascbyte *c_string);
-   int eicmp_off_c (Eistring *eistr, Bytecount off, Charcount charoff,
-                    Bytecount len, Charcount charlen, Ascbyte *c_string);
-   int eicasecmp_c (Eistring *eistr, Ascbyte *c_string);
-   int eicasecmp_off_c (Eistring *eistr, Bytecount off, Charcount charoff,
+   int eicmp_ascii (Eistring *eistr, Ascbyte *ascstr);
+   int eicmp_off_ascii (Eistring *eistr, Bytecount off, Charcount charoff,
+                    Bytecount len, Charcount charlen, Ascbyte *ascstr);
+   int eicasecmp_ascii (Eistring *eistr, Ascbyte *ascstr);
+   int eicasecmp_off_ascii (Eistring *eistr, Bytecount off, Charcount charoff,
                         Bytecount len, Charcount charlen,
-                        Ascbyte *c_string);
-   int eicasecmp_i18n_c (Eistring *eistr, Ascbyte *c_string);
-   int eicasecmp_i18n_off_c (Eistring *eistr, Bytecount off, Charcount charoff,
+                        Ascbyte *ascstr);
+   int eicasecmp_i18n_ascii (Eistring *eistr, Ascbyte *ascstr);
+   int eicasecmp_i18n_off_ascii (Eistring *eistr, Bytecount off, Charcount charoff,
                              Bytecount len, Charcount charlen,
-                             Ascbyte *c_string);
+                             Ascbyte *ascstr);
 
 
     ********************************************** 
@@ -1982,17 +1982,17 @@
   EI_ALLOC_AND_COPY (ei, ei12p2, ei12p2len, 1);		\
 } while (0)
 
-#define eicpy_c(ei, c_string)			\
+#define eicpy_ascii(ei, ascstr)			\
 do {						\
-  const Ascbyte *ei4 = (c_string);		\
+  const Ascbyte *ei4 = (ascstr);		\
 						\
   ASSERT_ASCTEXT_ASCII (ei4);			\
   eicpy_ext (ei, ei4, Qbinary);			\
 } while (0)
 
-#define eicpy_c_len(ei, c_string, c_len)	\
+#define eicpy_ascii_len(ei, ascstr, c_len)	\
 do {						\
-  const Ascbyte *ei6 = (c_string);		\
+  const Ascbyte *ei6 = (ascstr);		\
   int ei6len = (c_len);				\
 						\
   ASSERT_ASCTEXT_ASCII_LEN (ei6, ei6len);	\
@@ -2207,9 +2207,9 @@
   eicat_1 (ei, ei9->data_, ei9->bytelen_, ei9->charlen_);	\
 } while (0)
 
-#define eicat_c(ei, c_string)					\
+#define eicat_ascii(ei, ascstr)					\
 do {								\
-  const Ascbyte *ei15 = (c_string);				\
+  const Ascbyte *ei15 = (ascstr);				\
   int ei15len = strlen (ei15);					\
 								\
   ASSERT_ASCTEXT_ASCII_LEN (ei15, ei15len);			\
@@ -2286,9 +2286,9 @@
 	   ei19->charlen_);						\
 } while (0)
 
-#define eisub_c(ei, off, charoff, len, charlen, c_string)	\
+#define eisub_ascii(ei, off, charoff, len, charlen, ascstr)	\
 do {								\
-  const Ascbyte *ei20 = (c_string);				\
+  const Ascbyte *ei20 = (ascstr);				\
   int ei20len = strlen (ei20);					\
   ASSERT_ASCTEXT_ASCII_LEN (ei20, ei20len);			\
   eisub_1 (ei, off, charoff, len, charlen, ei20, ei20len, -1);	\
@@ -2369,21 +2369,21 @@
 #define eirstr_ei_off_char(eistr, eistr2, off, charoff) \
   NOT YET IMPLEMENTED
 
-#define eistr_c(eistr, c_string) \
+#define eistr_ascii(eistr, ascstr) \
   NOT YET IMPLEMENTED
-#define eistr_c_char(eistr, c_string) \
+#define eistr_ascii_char(eistr, ascstr) \
   NOT YET IMPLEMENTED
-#define eistr_c_off(eistr, c_string, off, charoff) \
+#define eistr_ascii_off(eistr, ascstr, off, charoff) \
   NOT YET IMPLEMENTED
-#define eistr_c_off_char(eistr, c_string, off, charoff) \
+#define eistr_ascii_off_char(eistr, ascstr, off, charoff) \
   NOT YET IMPLEMENTED
-#define eirstr_c(eistr, c_string) \
+#define eirstr_ascii(eistr, ascstr) \
   NOT YET IMPLEMENTED
-#define eirstr_c_char(eistr, c_string) \
+#define eirstr_ascii_char(eistr, ascstr) \
   NOT YET IMPLEMENTED
-#define eirstr_c_off(eistr, c_string, off, charoff) \
+#define eirstr_ascii_off(eistr, ascstr, off, charoff) \
   NOT YET IMPLEMENTED
-#define eirstr_c_off_char(eistr, c_string, off, charoff) \
+#define eirstr_ascii_off_char(eistr, ascstr, off, charoff) \
   NOT YET IMPLEMENTED
 
 
@@ -2406,18 +2406,18 @@
 #define eicasecmp_i18n_off_ei(eistr, off, charoff, len, charlen, eistr2) \
   eicmp_1 (eistr, off, charoff, len, charlen, 0, eistr2, 0, 2)
 
-#define eicmp_c(eistr, c_string) \
-  eicmp_1 (eistr, 0, -1, -1, -1, c_string, 0, 1, 0)
-#define eicmp_off_c(eistr, off, charoff, len, charlen, c_string) \
-  eicmp_1 (eistr, off, charoff, len, charlen, c_string, 0, 1, 0)
-#define eicasecmp_c(eistr, c_string) \
-  eicmp_1 (eistr, 0, -1, -1, -1, c_string, 0, 1, 1)
-#define eicasecmp_off_c(eistr, off, charoff, len, charlen, c_string) \
-  eicmp_1 (eistr, off, charoff, len, charlen, c_string, 0, 1, 1)
-#define eicasecmp_i18n_c(eistr, c_string) \
-  eicmp_1 (eistr, 0, -1, -1, -1, c_string, 0, 1, 2)
-#define eicasecmp_i18n_off_c(eistr, off, charoff, len, charlen, c_string) \
-  eicmp_1 (eistr, off, charoff, len, charlen, c_string, 0, 1, 2)
+#define eicmp_ascii(eistr, ascstr) \
+  eicmp_1 (eistr, 0, -1, -1, -1, (const Ibyte *) ascstr, 0, 1, 0)
+#define eicmp_off_ascii(eistr, off, charoff, len, charlen, ascstr) \
+  eicmp_1 (eistr, off, charoff, len, charlen, (const Ibyte *) ascstr, 0, 1, 0)
+#define eicasecmp_ascii(eistr, ascstr) \
+  eicmp_1 (eistr, 0, -1, -1, -1, (const Ibyte *) ascstr, 0, 1, 1)
+#define eicasecmp_off_ascii(eistr, off, charoff, len, charlen, ascstr) \
+  eicmp_1 (eistr, off, charoff, len, charlen, (const Ibyte *) ascstr, 0, 1, 1)
+#define eicasecmp_i18n_ascii(eistr, ascstr) \
+  eicmp_1 (eistr, 0, -1, -1, -1, (const Ibyte *) ascstr, 0, 1, 2)
+#define eicasecmp_i18n_off_ascii(eistr, off, charoff, len, charlen, ascstr) \
+  eicmp_1 (eistr, off, charoff, len, charlen, (const Ibyte *) ascstr, 0, 1, 2)
 
 
 /*   ----- Case-changing the Eistring -----   */
--- a/src/unexcw.c	Mon Dec 06 03:46:07 2004 +0000
+++ b/src/unexcw.c	Mon Dec 06 03:52:23 2004 +0000
@@ -102,7 +102,7 @@
 {
   /* ugly nt hack - should be in lisp */
   int a_new, a_out = -1;
-  char new_name[PATH_MAX], a_name[PATH_MAX];
+  char new_name[PATH_MAX_EXTERNAL], a_name[PATH_MAX_EXTERNAL];
   char *ptr;
   
   /* Make sure that the input and output filenames have the
--- a/src/unexnext.c	Mon Dec 06 03:46:07 2004 +0000
+++ b/src/unexnext.c	Mon Dec 06 03:52:23 2004 +0000
@@ -279,7 +279,7 @@
 
 void unexec(char *outfile,char *infile)
    {
-   char tmpfile[PATH_MAX];
+   char tmpfile[PATH_MAX_EXTERNAL];
    int infd,outfd;
    
    if ((infd=open(infile, O_RDONLY, 0))<0)
--- a/src/unexnt.c	Mon Dec 06 03:46:07 2004 +0000
+++ b/src/unexnt.c	Mon Dec 06 03:52:23 2004 +0000
@@ -133,11 +133,11 @@
      won't work.)  */
   if (heap_state == HEAP_UNLOADED) 
     {
-      Extbyte executable_path[MAX_PATH * MAX_XETCHAR_SIZE];
+      Extbyte executable_path[PATH_MAX_EXTERNAL];
 
       /* Don't use mswindows_get_module_file_name() because it uses
 	 xmalloc() */
-      if (qxeGetModuleFileName (NULL, executable_path, MAX_PATH) == 0)
+      if (qxeGetModuleFileName (NULL, executable_path, _MAX_PATH) == 0)
 	{
 	  exit (1);
 	}
@@ -150,8 +150,8 @@
 	
 	/* To allow profiling, make sure executable_path names the .exe
 	   file, not the file created by the profiler */
-	p = xetcsrchr (executable_path, '\\');
-	xetcscpy (p + 1, XETEXT (PATH_PROGNAME ".exe"));
+	p = qxetcsrchr (executable_path, '\\');
+	qxetcscpy (p + 1, XETEXT (PATH_PROGNAME ".exe"));
       }
 #endif