changeset 665:fdefd0186b75

[xemacs-hg @ 2001-09-20 06:28:42 by ben] The great integral types renaming. The purpose of this is to rationalize the names used for various integral types, so that they match their intended uses and follow consist conventions, and eliminate types that were not semantically different from each other. The conventions are: -- All integral types that measure quantities of anything are signed. Some people disagree vociferously with this, but their arguments are mostly theoretical, and are vastly outweighed by the practical headaches of mixing signed and unsigned values, and more importantly by the far increased likelihood of inadvertent bugs: Because of the broken "viral" nature of unsigned quantities in C (operations involving mixed signed/unsigned are done unsigned, when exactly the opposite is nearly always wanted), even a single error in declaring a quantity unsigned that should be signed, or even the even more subtle error of comparing signed and unsigned values and forgetting the necessary cast, can be catastrophic, as comparisons will yield wrong results. -Wsign-compare is turned on specifically to catch this, but this tends to result in a great number of warnings when mixing signed and unsigned, and the casts are annoying. More has been written on this elsewhere. -- All such quantity types just mentioned boil down to EMACS_INT, which is 32 bits on 32-bit machines and 64 bits on 64-bit machines. This is guaranteed to be the same size as Lisp objects of type `int', and (as far as I can tell) of size_t (unsigned!) and ssize_t. The only type below that is not an EMACS_INT is Hashcode, which is an unsigned value of the same size as EMACS_INT. -- Type names should be relatively short (no more than 10 characters or so), with the first letter capitalized and no underscores if they can at all be avoided. -- "count" == a zero-based measurement of some quantity. Includes sizes, offsets, and indexes. -- "bpos" == a one-based measurement of a position in a buffer. "Charbpos" and "Bytebpos" count text in the buffer, rather than bytes in memory; thus Bytebpos does not directly correspond to the memory representation. Use "Membpos" for this. -- "Char" refers to internal-format characters, not to the C type "char", which is really a byte. -- For the actual name changes, see the script below. I ran the following script to do the conversion. (NOTE: This script is idempotent. You can safely run it multiple times and it will not screw up previous results -- in fact, it will do nothing if nothing has changed. Thus, it can be run repeatedly as necessary to handle patches coming in from old workspaces, or old branches.) There are two tags, just before and just after the change: `pre-integral-type-rename' and `post-integral-type-rename'. When merging code from the main trunk into a branch, the best thing to do is first merge up to `pre-integral-type-rename', then apply the script and associated changes, then merge from `post-integral-type-change' to the present. (Alternatively, just do the merging in one operation; but you may then have a lot of conflicts needing to be resolved by hand.) Script `fixtypes.sh' follows: ----------------------------------- cut ------------------------------------ files="*.[ch] s/*.h m/*.h config.h.in ../configure.in Makefile.in.in ../lib-src/*.[ch] ../lwlib/*.[ch]" gr Memory_Count Bytecount $files gr Lstream_Data_Count Bytecount $files gr Element_Count Elemcount $files gr Hash_Code Hashcode $files gr extcount bytecount $files gr bufpos charbpos $files gr bytind bytebpos $files gr memind membpos $files gr bufbyte intbyte $files gr Extcount Bytecount $files gr Bufpos Charbpos $files gr Bytind Bytebpos $files gr Memind Membpos $files gr Bufbyte Intbyte $files gr EXTCOUNT BYTECOUNT $files gr BUFPOS CHARBPOS $files gr BYTIND BYTEBPOS $files gr MEMIND MEMBPOS $files gr BUFBYTE INTBYTE $files gr MEMORY_COUNT BYTECOUNT $files gr LSTREAM_DATA_COUNT BYTECOUNT $files gr ELEMENT_COUNT ELEMCOUNT $files gr HASH_CODE HASHCODE $files ----------------------------------- cut ------------------------------------ `fixtypes.sh' is a Bourne-shell script; it uses 'gr': ----------------------------------- cut ------------------------------------ #!/bin/sh # Usage is like this: # gr FROM TO FILES ... # globally replace FROM with TO in FILES. FROM and TO are regular expressions. # backup files are stored in the `backup' directory. from="$1" to="$2" shift 2 echo ${1+"$@"} | xargs global-replace "s/$from/$to/g" ----------------------------------- cut ------------------------------------ `gr' in turn uses a Perl script to do its real work, `global-replace', which follows: ----------------------------------- cut ------------------------------------ : #-*- Perl -*- ### global-modify --- modify the contents of a file by a Perl expression ## Copyright (C) 1999 Martin Buchholz. ## Copyright (C) 2001 Ben Wing. ## Authors: Martin Buchholz <martin@xemacs.org>, Ben Wing <ben@xemacs.org> ## Maintainer: Ben Wing <ben@xemacs.org> ## Current Version: 1.0, May 5, 2001 # This program is free software; you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by # the Free Software Foundation; either version 2, or (at your option) # any later version. # # This program is distributed in the hope that it will be useful, but # WITHOUT ANY WARRANTY; without even the implied warranty of # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU # General Public License for more details. # # You should have received a copy of the GNU General Public License # along with XEmacs; see the file COPYING. If not, write to the Free # Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA # 02111-1307, USA. eval 'exec perl -w -S $0 ${1+"$@"}' if 0; use strict; use FileHandle; use Carp; use Getopt::Long; use File::Basename; (my $myName = $0) =~ s@.*/@@; my $usage=" Usage: $myName [--help] [--backup-dir=DIR] [--line-mode] [--hunk-mode] PERLEXPR FILE ... Globally modify a file, either line by line or in one big hunk. Typical usage is like this: [with GNU print, GNU xargs: guaranteed to handle spaces, quotes, etc. in file names] find . -name '*.[ch]' -print0 | xargs -0 $0 's/\bCONST\b/const/g'\n [with non-GNU print, xargs] find . -name '*.[ch]' -print | xargs $0 's/\bCONST\b/const/g'\n The file is read in, either line by line (with --line-mode specified) or in one big hunk (with --hunk-mode specified; it's the default), and the Perl expression is then evalled with \$_ set to the line or hunk of text, including the terminating newline if there is one. It should destructively modify the value there, storing the changed result in \$_. Files in which any modifications are made are backed up to the directory specified using --backup-dir, or to `backup' by default. To disable this, use --backup-dir= with no argument. Hunk mode is the default because it is MUCH MUCH faster than line-by-line. Use line-by-line only when it matters, e.g. you want to do a replacement only once per line (the default without the `g' argument). Conversely, when using hunk mode, *ALWAYS* use `g'; otherwise, you will only make one replacement in the entire file! "; my %options = (); $Getopt::Long::ignorecase = 0; &GetOptions ( \%options, 'help', 'backup-dir=s', 'line-mode', 'hunk-mode', ); die $usage if $options{"help"} or @ARGV <= 1; my $code = shift; die $usage if grep (-d || ! -w, @ARGV); sub SafeOpen { open ((my $fh = new FileHandle), $_[0]); confess "Can't open $_[0]: $!" if ! defined $fh; return $fh; } sub SafeClose { close $_[0] or confess "Can't close $_[0]: $!"; } sub FileContents { my $fh = SafeOpen ("< $_[0]"); my $olddollarslash = $/; local $/ = undef; my $contents = <$fh>; $/ = $olddollarslash; return $contents; } sub WriteStringToFile { my $fh = SafeOpen ("> $_[0]"); binmode $fh; print $fh $_[1] or confess "$_[0]: $!\n"; SafeClose $fh; } foreach my $file (@ARGV) { my $changed_p = 0; my $new_contents = ""; if ($options{"line-mode"}) { my $fh = SafeOpen $file; while (<$fh>) { my $save_line = $_; eval $code; $changed_p = 1 if $save_line ne $_; $new_contents .= $_; } } else { my $orig_contents = $_ = FileContents $file; eval $code; if ($_ ne $orig_contents) { $changed_p = 1; $new_contents = $_; } } if ($changed_p) { my $backdir = $options{"backup-dir"}; $backdir = "backup" if !defined ($backdir); if ($backdir) { my ($name, $path, $suffix) = fileparse ($file, ""); my $backfulldir = $path . $backdir; my $backfile = "$backfulldir/$name"; mkdir $backfulldir, 0755 unless -d $backfulldir; print "modifying $file (original saved in $backfile)\n"; rename $file, $backfile; } WriteStringToFile ($file, $new_contents); } } ----------------------------------- cut ------------------------------------ In addition to those programs, I needed to fix up a few other things, particularly relating to the duplicate definitions of types, now that some types merged with others. Specifically: 1. in lisp.h, removed duplicate declarations of Bytecount. The changed code should now look like this: (In each code snippet below, the first and last lines are the same as the original, as are all lines outside of those lines. That allows you to locate the section to be replaced, and replace the stuff in that section, verifying that there isn't anything new added that would need to be kept.) --------------------------------- snip ------------------------------------- /* Counts of bytes or chars */ typedef EMACS_INT Bytecount; typedef EMACS_INT Charcount; /* Counts of elements */ typedef EMACS_INT Elemcount; /* Hash codes */ typedef unsigned long Hashcode; /* ------------------------ dynamic arrays ------------------- */ --------------------------------- snip ------------------------------------- 2. in lstream.h, removed duplicate declaration of Bytecount. Rewrote the comment about this type. The changed code should now look like this: --------------------------------- snip ------------------------------------- #endif /* The have been some arguments over the what the type should be that specifies a count of bytes in a data block to be written out or read in, using Lstream_read(), Lstream_write(), and related functions. Originally it was long, which worked fine; Martin "corrected" these to size_t and ssize_t on the grounds that this is theoretically cleaner and is in keeping with the C standards. Unfortunately, this practice is horribly error-prone due to design flaws in the way that mixed signed/unsigned arithmetic happens. In fact, by doing this change, Martin introduced a subtle but fatal error that caused the operation of sending large mail messages to the SMTP server under Windows to fail. By putting all values back to be signed, avoiding any signed/unsigned mixing, the bug immediately went away. The type then in use was Lstream_Data_Count, so that it be reverted cleanly if a vote came to that. Now it is Bytecount. Some earlier comments about why the type must be signed: This MUST BE SIGNED, since it also is used in functions that return the number of bytes actually read to or written from in an operation, and these functions can return -1 to signal error. Note that the standard Unix read() and write() functions define the count going in as a size_t, which is UNSIGNED, and the count going out as an ssize_t, which is SIGNED. This is a horrible design flaw. Not only is it highly likely to lead to logic errors when a -1 gets interpreted as a large positive number, but operations are bound to fail in all sorts of horrible ways when a number in the upper-half of the size_t range is passed in -- this number is unrepresentable as an ssize_t, so code that checks to see how many bytes are actually written (which is mandatory if you are dealing with certain types of devices) will get completely screwed up. --ben */ typedef enum lstream_buffering --------------------------------- snip ------------------------------------- 3. in dumper.c, there are four places, all inside of switch() statements, where XD_BYTECOUNT appears twice as a case tag. In each case, the two case blocks contain identical code, and you should *REMOVE THE SECOND* and leave the first.
author ben
date Thu, 20 Sep 2001 06:31:11 +0000
parents 6e99cc8c6ca5
children 146d342ff859
files ChangeLog configure configure.in lisp/auto-autoloads.el src/ChangeLog src/abbrev.c src/alloc.c src/blocktype.c src/blocktype.h src/buffer.c src/buffer.h src/bytecode.c src/callint.c src/callproc.c src/casefiddle.c src/chartab.c src/cmds.c src/config.h.in src/console-msw.c src/console-msw.h src/console-x.c src/console.c src/console.h src/data.c src/database.c src/device-msw.c src/device-x.c src/device.h src/dialog-msw.c src/dired.c src/doc.c src/doprnt.c src/dumper.c src/dynarr.c src/editfns.c src/eldap.c src/elhash.c src/elhash.h src/emacs.c src/emodules.c src/eval.c src/event-Xt.c src/event-gtk.c src/event-msw.c src/event-stream.c src/event-unixoid.c src/events.c src/events.h src/extents.c src/extents.h src/faces.c src/file-coding.c src/file-coding.h src/fileio.c src/filelock.c src/floatfns.c src/fns.c src/font-lock.c src/frame-gtk.c src/frame-msw.c src/frame-x.c src/frame.c src/gif_io.c src/gifrlib.h src/glyphs-eimage.c src/glyphs-msw.c src/glyphs-x.c src/glyphs.c src/glyphs.h src/gpmevent.c src/gui-x.c src/gui-x.h src/gui.c src/gui.h src/gutter.c src/gutter.h src/hash.c src/hash.h src/hpplay.c src/indent.c src/insdel.c src/insdel.h src/keymap.c src/line-number.c src/line-number.h src/lisp.h src/lread.c src/lrecord.h src/lstream.c src/lstream.h src/malloc.c src/marker.c src/md5.c src/menubar-msw.c src/menubar-x.c src/menubar.c src/minibuf.c src/mule-ccl.c src/mule-charset.c src/mule-charset.h src/mule-wnnfns.c src/objects-gtk.c src/objects-gtk.h src/objects-msw.c src/objects-tty.c src/objects-x.c src/objects.c src/objects.h src/opaque.c src/opaque.h src/print.c src/process-nt.c src/process-unix.c src/process.c src/procimpl.h src/redisplay-gtk.c src/redisplay-output.c src/redisplay-tty.c src/redisplay.c src/redisplay.h src/regex.c src/regex.h src/scrollbar-gtk.h src/scrollbar-msw.c src/scrollbar-x.h src/scrollbar.c src/search.c src/select-common.h src/select-gtk.c src/select-x.c src/sheap.c src/sound.c src/sound.h src/specifier.c src/symbols.c src/syntax.c src/syntax.h src/sysdep.c src/sysdep.h src/syswindows.h src/tests.c src/toolbar-gtk.c src/toolbar-x.c src/tooltalk.c src/tparam.c src/undo.c src/win32.c src/window.c src/window.h
diffstat 149 files changed, 4255 insertions(+), 2905 deletions(-) [+]
line wrap: on
line diff
--- a/ChangeLog	Tue Sep 18 05:06:57 2001 +0000
+++ b/ChangeLog	Thu Sep 20 06:31:11 2001 +0000
@@ -1,3 +1,13 @@
+2001-09-19  Ben Wing  <ben@xemacs.org>
+
+	* configure.in (USAGE_ERROR):
+	* configure.in (CANONICALIZE_PATH):
+	* configure.in (XE_COMPUTE_RUNPATH):
+
+	The great integral types renaming.
+
+	Please see the 2001-09-19 entry in src/ChangeLog for the full details.
+
 2001-09-17  Ben Wing  <ben@xemacs.org>
 
 	* configure.in (TAB):
--- a/configure	Tue Sep 18 05:06:57 2001 +0000
+++ b/configure	Thu Sep 20 06:31:11 2001 +0000
@@ -534,8 +534,8 @@
 	      typecheck )     error_check_typecheck=yes ;;
 	      notypecheck )   error_check_typecheck=no ;;
 
-	      bufpos )	      error_check_bufpos=yes ;;
-	      nobufpos )      error_check_bufpos=no ;;
+	      charbpos )	      error_check_charbpos=yes ;;
+	      nocharbpos )      error_check_charbpos=no ;;
 
 	      gc )	      error_check_gc=yes ;;
 	      nogc )          error_check_gc=no ;;
@@ -554,9 +554,9 @@
 	    if test "$bogus_error_check" -o \
 	         \( -n "$new_default" -a -n "$echeck_notfirst" \) ; then
 		if test "$error_check_default" = yes ; then
-		  types="\`all' (default), \`none', \`noextents', \`notypecheck', \`nobufpos', \`nogc', \`nomalloc', \`noglyphs' and \`nobyte-code'."
+		  types="\`all' (default), \`none', \`noextents', \`notypecheck', \`nocharbpos', \`nogc', \`nomalloc', \`noglyphs' and \`nobyte-code'."
 		else
-		  types="\`all', \`none' (default), \`extents', \`typecheck', \`bufpos', \`gc', \`malloc', \`glyphs' and \`byte-code'."
+		  types="\`all', \`none' (default), \`extents', \`typecheck', \`charbpos', \`gc', \`malloc', \`glyphs' and \`byte-code'."
 		fi
 		(echo "$progname: Usage error:"
 echo " " "Valid types for the \`--$optname' option are:
@@ -565,7 +565,7 @@
 	    elif test -n "$new_default" ; then
 		error_check_extents=$new_default
 		error_check_typecheck=$new_default
-		error_check_bufpos=$new_default
+		error_check_charbpos=$new_default
 		error_check_gc=$new_default
 		error_check_malloc=$new_default
 		error_check_byte_code=$new_default
@@ -1032,11 +1032,11 @@
 EOF
 }
 
-test "${error_check_bufpos=$beta}"    = yes && { test "$extra_verbose" = "yes" && cat << \EOF
-    Defining ERROR_CHECK_BUFPOS
-EOF
-cat >> confdefs.h <<\EOF
-#define ERROR_CHECK_BUFPOS 1
+test "${error_check_charbpos=$beta}"    = yes && { test "$extra_verbose" = "yes" && cat << \EOF
+    Defining ERROR_CHECK_CHARBPOS
+EOF
+cat >> confdefs.h <<\EOF
+#define ERROR_CHECK_CHARBPOS 1
 EOF
 }
 
@@ -15990,7 +15990,7 @@
 test "$pdump" = yes && echo "  Using the new portable dumper."
 test "$debug" = yes && echo "  Compiling in support for extra debugging code."
 test "$usage_tracking" = yes && echo "  Compiling in support for active usage tracking (Sun internal)."
-if test "$error_check_extents $error_check_typecheck $error_check_bufpos $error_check_gc $error_check_malloc $error_check_glyphs" \
+if test "$error_check_extents $error_check_typecheck $error_check_charbpos $error_check_gc $error_check_malloc $error_check_glyphs" \
   != "no no no no no no"; then
   echo "  WARNING: ---------------------------------------------------------"
   echo "  WARNING: Compiling in support for runtime error checking."
--- a/configure.in	Tue Sep 18 05:06:57 2001 +0000
+++ b/configure.in	Thu Sep 20 06:31:11 2001 +0000
@@ -673,7 +673,7 @@
         dnl Has the user requested error-checking?
 	"error_checking" )
 	  dnl value can be all, none, and/or a list of categories to check.
-	  dnl Example: --error-checking=all,noextents,nobufpos
+	  dnl Example: --error-checking=all,noextents,nocharbpos
 	  dnl Example: --error-checking=none,malloc,gc
 
 	  for x in `echo "$val" | sed -e 's/,/ /g'` ; do
@@ -688,8 +688,8 @@
 	      typecheck )     error_check_typecheck=yes ;;
 	      notypecheck )   error_check_typecheck=no ;;
 
-	      bufpos )	      error_check_bufpos=yes ;;
-	      nobufpos )      error_check_bufpos=no ;;
+	      charbpos )	      error_check_charbpos=yes ;;
+	      nocharbpos )      error_check_charbpos=no ;;
 
 	      gc )	      error_check_gc=yes ;;
 	      nogc )          error_check_gc=no ;;
@@ -708,16 +708,16 @@
 	    if test "$bogus_error_check" -o \
 	         \( -n "$new_default" -a -n "$echeck_notfirst" \) ; then
 		if test "$error_check_default" = yes ; then
-		  types="\`all' (default), \`none', \`noextents', \`notypecheck', \`nobufpos', \`nogc', \`nomalloc', \`noglyphs' and \`nobyte-code'."
+		  types="\`all' (default), \`none', \`noextents', \`notypecheck', \`nocharbpos', \`nogc', \`nomalloc', \`noglyphs' and \`nobyte-code'."
 		else
-		  types="\`all', \`none' (default), \`extents', \`typecheck', \`bufpos', \`gc', \`malloc', \`glyphs' and \`byte-code'."
+		  types="\`all', \`none' (default), \`extents', \`typecheck', \`charbpos', \`gc', \`malloc', \`glyphs' and \`byte-code'."
 		fi
 		USAGE_ERROR(["Valid types for the \`--$optname' option are:
   $types."])
 	    elif test -n "$new_default" ; then
 		error_check_extents=$new_default
 		error_check_typecheck=$new_default
-		error_check_bufpos=$new_default
+		error_check_charbpos=$new_default
 		error_check_gc=$new_default
 		error_check_malloc=$new_default
 		error_check_byte_code=$new_default
@@ -1010,7 +1010,7 @@
 if test -n "$emacs_is_beta"; then beta=yes; else beta=no; fi
 test "${error_check_extents=$beta}"   = yes && AC_DEFINE(ERROR_CHECK_EXTENTS)
 test "${error_check_typecheck=$beta}" = yes && AC_DEFINE(ERROR_CHECK_TYPECHECK)
-test "${error_check_bufpos=$beta}"    = yes && AC_DEFINE(ERROR_CHECK_BUFPOS)
+test "${error_check_charbpos=$beta}"    = yes && AC_DEFINE(ERROR_CHECK_CHARBPOS)
 test "${error_check_gc=$beta}"        = yes && AC_DEFINE(ERROR_CHECK_GC)
 test "${error_check_malloc=$beta}"    = yes && AC_DEFINE(ERROR_CHECK_MALLOC)
 test "${error_check_byte_code=$beta}" = yes && AC_DEFINE(ERROR_CHECK_BYTE_CODE)
@@ -4997,7 +4997,7 @@
 test "$pdump" = yes && echo "  Using the new portable dumper."
 test "$debug" = yes && echo "  Compiling in support for extra debugging code."
 test "$usage_tracking" = yes && echo "  Compiling in support for active usage tracking (Sun internal)."
-if test "$error_check_extents $error_check_typecheck $error_check_bufpos $error_check_gc $error_check_malloc $error_check_glyphs" \
+if test "$error_check_extents $error_check_typecheck $error_check_charbpos $error_check_gc $error_check_malloc $error_check_glyphs" \
   != "no no no no no no"; then
   echo "  WARNING: ---------------------------------------------------------"
   echo "  WARNING: Compiling in support for runtime error checking."
--- a/lisp/auto-autoloads.el	Tue Sep 18 05:06:57 2001 +0000
+++ b/lisp/auto-autoloads.el	Thu Sep 20 06:31:11 2001 +0000
@@ -2015,7 +2015,11 @@
 when they are selected for the first time.  If you add fonts to your system, 
 or if you change your font path, you can call this to re-initialize the menus." nil nil)
 
+<<<<<<< auto-autoloads.el
+(defun* x-font-menu-font-data (face dcache) (let* ((case-fold-search t) (domain (if font-menu-this-frame-only-p (selected-frame) (selected-device))) (name (font-instance-name (face-font-instance face domain))) (truename (font-instance-truename (face-font-instance face domain (if (featurep 'mule) 'ascii)))) family size weight entry slant) (when (string-match x-font-regexp-foundry-and-family name) (setq family (capitalize (match-string 1 name))) (setq entry (vassoc family (aref dcache 0)))) (when (and (null entry) (string-match x-font-regexp-foundry-and-family truename)) (setq family (capitalize (match-string 1 truename))) (setq entry (vassoc family (aref dcache 0)))) (when (null entry) (return-from x-font-menu-font-data (make-vector 5 nil))) (when (string-match x-font-regexp name) (setq weight (capitalize (match-string 1 name))) (setq size (string-to-int (match-string 6 name)))) (when (string-match x-font-regexp truename) (when (not (member weight (aref entry 1))) (setq weight (capitalize (match-string 1 truename)))) (when (not (member size (aref entry 2))) (setq size (string-to-int (match-string 6 truename)))) (setq slant (capitalize (match-string 2 truename)))) (vector entry family size weight slant)))
+=======
 (autoload 'x-font-menu-font-data "x-font-menu" nil nil nil)
+>>>>>>> 1.33
 
 ;;;***
 
--- a/src/ChangeLog	Tue Sep 18 05:06:57 2001 +0000
+++ b/src/ChangeLog	Thu Sep 20 06:31:11 2001 +0000
@@ -1,3 +1,1318 @@
+2001-09-19  Ben Wing  <ben@xemacs.org>
+
+	* abbrev.c (abbrev_match_mapper):
+	* abbrev.c (abbrev_oblookup):
+	* abbrev.c (obarray_has_blank_p):
+	* abbrev.c (abbrev_count_case):
+	* abbrev.c (Fexpand_abbrev):
+	* alloc.c (xmalloc):
+	* alloc.c (xcalloc):
+	* alloc.c (xmalloc_and_zero):
+	* alloc.c (xrealloc):
+	* alloc.c (deadbeef_memory):
+	* alloc.c (allocate_lisp_storage):
+	* alloc.c (alloc_lcrecord):
+	* alloc.c (size_vector):
+	* alloc.c (vector_hash):
+	* alloc.c (make_vector_internal):
+	* alloc.c (make_vector):
+	* alloc.c (make_bit_vector_internal):
+	* alloc.c (make_bit_vector):
+	* alloc.c (make_bit_vector_from_byte_vector):
+	* alloc.c (Fmake_marker):
+	* alloc.c (noseeum_make_marker):
+	* alloc.c (make_uninit_string):
+	* alloc.c (resize_string):
+	* alloc.c (set_string_char):
+	* alloc.c (Fmake_string):
+	* alloc.c (Fstring):
+	* alloc.c (make_string):
+	* alloc.c (build_string):
+	* alloc.c (build_translated_string):
+	* alloc.c (make_string_nocopy):
+	* alloc.c (make_lcrecord_list):
+	* alloc.c (tick_lcrecord_stats):
+	* alloc.c (garbage_collect_1):
+	* alloc.c (malloced_storage_size):
+	* alloc.c (fixed_type_block_overhead):
+	* blocktype.c (Blocktype_newf):
+	* blocktype.h:
+	* blocktype.h (Blocktype_declare):
+	* buffer.c:
+	* buffer.c (Fkill_buffer):
+	* buffer.c (compute_buffer_text_usage):
+	* buffer.c (struct):
+	* buffer.c (reinit_vars_of_buffer):
+	* buffer.c (directory_is_current_directory):
+	* buffer.h:
+	* buffer.h (struct buffer_text):
+	* buffer.h (struct buffer):
+	* buffer.h (VALID_CHARPTR_P):
+	* buffer.h (REAL_INC_CHARBYTEBPOS):
+	* buffer.h (INC_CHARBYTEBPOS):
+	* buffer.h (DEC_CHARPTR):
+	* buffer.h (VALIDATE_CHARPTR_FORWARD):
+	* buffer.h (charptr_n_addr):
+	* buffer.h (simple_set_charptr_emchar):
+	* buffer.h (charptr_emchar):
+	* buffer.h (set_charptr_emchar):
+	* buffer.h (charptr_copy_char):
+	* buffer.h (BI_BUF_BEG):
+	* buffer.h (BI_BUF_PTR_BYTE_POS):
+	* buffer.h (BUF_PTR_BYTE_POS):
+	* buffer.h (BI_BUF_BYTE_ADDRESS):
+	* buffer.h (BUF_BYTE_ADDRESS):
+	* buffer.h (BI_BUF_BYTE_ADDRESS_BEFORE):
+	* buffer.h (BUF_BYTE_ADDRESS_BEFORE):
+	* buffer.h (valid_membpos_p):
+	* buffer.h (bytebpos_to_membpos):
+	* buffer.h (membpos_to_bytebpos):
+	* buffer.h (membpos_to_charbpos):
+	* buffer.h (buffer_or_string_bytebpos_to_membpos):
+	* buffer.h (buffer_or_string_membpos_to_bytebpos):
+	* buffer.h (buffer_or_string_charbpos_to_bytebpos):
+	* buffer.h (VALID_BYTEBPOS_P):
+	* buffer.h (ASSERT_VALID_BYTEBPOS_UNSAFE):
+	* buffer.h (VALIDATE_BYTEBPOS_BACKWARD):
+	* buffer.h (VALIDATE_BYTEBPOS_FORWARD):
+	* buffer.h (INC_BYTEBPOS):
+	* buffer.h (DEC_BYTEBPOS):
+	* buffer.h (prev_bytebpos):
+	* buffer.h (next_bytebpos):
+	* buffer.h (BYTEBPOS_INVALID):
+	* buffer.h (real_charbpos_to_bytebpos):
+	* buffer.h (real_bytebpos_to_charbpos):
+	* buffer.h (charbpos_to_bytebpos):
+	* buffer.h (make_charbpos):
+	* buffer.h (BUF_FETCH_CHAR):
+	* buffer.h (BUF_CHARPTR_COPY_CHAR):
+	* buffer.h (union):
+	* buffer.h (DFC_LISP_STRING_USE_CONVERTED_DATA):
+	* buffer.h (BUF_CEILING_OF):
+	* buffer.h (BUF_FLOOR_OF):
+	* buffer.h (BUF_CEILING_OF_IGNORE_ACCESSIBLE):
+	* buffer.h (BUF_FLOOR_OF_IGNORE_ACCESSIBLE):
+	* buffer.h (BUFFER_ALLOC):
+	* buffer.h (intbyte_strcmp):
+	* buffer.h (intbyte_memcmp):
+	* bytecode.c (invalid_byte_code):
+	* bytecode.c (optimize_byte_code):
+	* bytecode.c (compiled_function_hash):
+	* bytecode.c (compiled_function_instructions):
+	* callint.c (check_mark):
+	* callint.c (callint_prompt):
+	* callint.c (PROMPT):
+	* callint.c (Fcall_interactively):
+	* callproc.c (Fold_call_process_internal):
+	* callproc.c (getenv_internal):
+	* callproc.c (Fgetenv):
+	* callproc.c (egetenv):
+	* callproc.c (init_callproc):
+	* casefiddle.c (casify_object):
+	* casefiddle.c (casify_region_internal):
+	* casefiddle.c (casify_word):
+	* chartab.c (char_table_entry_hash):
+	* chartab.c (char_table_hash):
+	* cmds.c (Fforward_char):
+	* cmds.c (Fforward_line):
+	* cmds.c (Fdelete_char):
+	* config.h.in:
+	* console-msw.c (mswindows_output_console_string):
+	* console-msw.c (Fmswindows_debugging_output):
+	* console-msw.c (DSTRING):
+	* console-msw.c (DSYMNAME):
+	* console-msw.c (mswindows_lisp_error):
+	* console-msw.h:
+	* console-x.c (split_up_display_spec):
+	* console-x.c (x_semi_canonicalize_console_connection):
+	* console.c (stuff_buffered_input):
+	* console.h (struct console_methods):
+	* data.c (weak_list_hash):
+	* database.c (berkdb_get):
+	* database.c (berkdb_map):
+	* device-msw.c (msprinter_default_printer):
+	* device-msw.c (hash_devmode):
+	* device-msw.c (Fmswindows_printer_list):
+	* device-x.c (validify_resource_component):
+	* device-x.c (Fx_get_resource_prefix):
+	* device.h (struct pixel_to_glyph_translation_cache):
+	* dialog-msw.c (push_intbyte_string_as_unicode):
+	* dialog-msw.c (handle_question_dialog_box):
+	* dired.c (Fdirectory_files):
+	* dired.c (file_name_completion):
+	* dired.c (struct user_name):
+	* dired.c (user_name_completion):
+	* dired.c (make_directory_hash_table):
+	* dired.c (Ffile_attributes):
+	* doc.c (string_join):
+	* doc.c (Fsnarf_documentation):
+	* doc.c (Fsubstitute_command_keys):
+	* doprnt.c (union printf_arg):
+	* doprnt.c (doprnt_1):
+	* doprnt.c (parse_off_posnum):
+	* doprnt.c (parse_doprnt_spec):
+	* doprnt.c (get_doprnt_args):
+	* doprnt.c (emacs_doprnt_1):
+	* doprnt.c (emacs_doprnt_2):
+	* doprnt.c (emacs_doprnt_c):
+	* doprnt.c (emacs_doprnt_va):
+	* doprnt.c (emacs_doprnt_lisp):
+	* doprnt.c (emacs_doprnt_lisp_2):
+	* doprnt.c (emacs_doprnt_string_c):
+	* doprnt.c (emacs_doprnt_string_va):
+	* doprnt.c (emacs_doprnt_string_lisp):
+	* doprnt.c (emacs_doprnt_string_lisp_2):
+	* dumper.c:
+	* dumper.c (struct):
+	* dumper.c (dump_add_opaque):
+	* dumper.c (pdump_align_stream):
+	* dumper.c (pdump_size_to_align):
+	* dumper.c (pdump_entry_list_elt):
+	* dumper.c (pdump_add_entry):
+	* dumper.c (pdump_get_indirect_count):
+	* dumper.c (pdump_register_sub):
+	* dumper.c (pdump_dump_data):
+	* dumper.c (pdump_reloc_one):
+	* dumper.c (pdump_allocate_offset):
+	* dumper.c (pdump_dump_root_struct_ptrs):
+	* dumper.c (pdump_dump_root_objects):
+	* dumper.c (pdump_load_finish):
+	* dumper.c (pdump_resource_get):
+	* dumper.c (pdump_file_get):
+	* dynarr.c (Dynarr_memory_usage):
+	* editfns.c (Fchar_to_string):
+	* editfns.c (buildmark):
+	* editfns.c (charbpos_clip_to_bounds):
+	* editfns.c (bytebpos_clip_to_bounds):
+	* editfns.c (Fgoto_char):
+	* editfns.c (save_excursion_save):
+	* editfns.c (beginning_of_line_p):
+	* editfns.c (Fchar_after):
+	* editfns.c (Fchar_before):
+	* editfns.c (Fformat_time_string):
+	* editfns.c (Fcurrent_time_string):
+	* editfns.c (Finsert_char):
+	* editfns.c (Fbuffer_substring):
+	* editfns.c (Fbuffer_substring_no_properties):
+	* editfns.c (Finsert_buffer_substring):
+	* editfns.c (Fcompare_buffer_substrings):
+	* editfns.c (Fsubst_char_in_region):
+	* editfns.c (Ftranslate_region):
+	* editfns.c (Fdelete_region):
+	* editfns.c (Fnarrow_to_region):
+	* editfns.c (save_restriction_restore):
+	* editfns.c (transpose_markers):
+	* editfns.c (Ftranspose_regions):
+	* eldap.c (Fldap_open):
+	* eldap.c (Fldap_add):
+	* eldap.c (Fldap_modify):
+	* elhash.c:
+	* elhash.c (struct Lisp_Hash_Table):
+	* elhash.c (HASHCODE):
+	* elhash.c (hash_table_size):
+	* elhash.c (lisp_string_hash):
+	* elhash.c (lisp_object_eql_hash):
+	* elhash.c (lisp_object_equal_hash):
+	* elhash.c (hash_table_hash):
+	* elhash.c (compute_hash_table_derived_values):
+	* elhash.c (make_standard_lisp_hash_table):
+	* elhash.c (make_general_lisp_hash_table):
+	* elhash.c (make_lisp_hash_table):
+	* elhash.c (decode_hash_table_size):
+	* elhash.c (resize_hash_table):
+	* elhash.c (pdump_reorganize_hash_table):
+	* elhash.c (enlarge_hash_table):
+	* elhash.c (find_hentry):
+	* elhash.c (remhash_1):
+	* elhash.c (internal_array_hash):
+	* elhash.c (internal_hash):
+	* elhash.h:
+	* emacs.c (split_string_by_emchar_1):
+	* emacs.c (decode_path):
+	* emacs.c (vars_of_emacs):
+	* emodules.c (emodules_load):
+	* emodules.c (emodules_doc_subr):
+	* emodules.c (emodules_doc_sym):
+	* eval.c (print_subr):
+	* eval.c (build_error_data):
+	* eval.c (signal_error):
+	* eval.c (maybe_signal_error):
+	* eval.c (signal_continuable_error):
+	* eval.c (maybe_signal_continuable_error):
+	* eval.c (signal_error_2):
+	* eval.c (maybe_signal_error_2):
+	* eval.c (signal_continuable_error_2):
+	* eval.c (maybe_signal_continuable_error_2):
+	* eval.c (signal_ferror):
+	* eval.c (maybe_signal_ferror):
+	* eval.c (signal_continuable_ferror):
+	* eval.c (maybe_signal_continuable_ferror):
+	* eval.c (signal_ferror_with_frob):
+	* eval.c (maybe_signal_ferror_with_frob):
+	* eval.c (signal_continuable_ferror_with_frob):
+	* eval.c (maybe_signal_continuable_ferror_with_frob):
+	* eval.c (syntax_error):
+	* eval.c (syntax_error_2):
+	* eval.c (maybe_syntax_error):
+	* eval.c (sferror):
+	* eval.c (sferror_2):
+	* eval.c (maybe_sferror):
+	* eval.c (invalid_argument):
+	* eval.c (invalid_argument_2):
+	* eval.c (maybe_invalid_argument):
+	* eval.c (invalid_constant):
+	* eval.c (invalid_constant_2):
+	* eval.c (maybe_invalid_constant):
+	* eval.c (invalid_operation):
+	* eval.c (invalid_operation_2):
+	* eval.c (maybe_invalid_operation):
+	* eval.c (invalid_change):
+	* eval.c (invalid_change_2):
+	* eval.c (maybe_invalid_change):
+	* eval.c (invalid_state):
+	* eval.c (invalid_state_2):
+	* eval.c (maybe_invalid_state):
+	* eval.c (wtaerror):
+	* eval.c (stack_overflow):
+	* eval.c (out_of_memory):
+	* eval.c (printing_unreadable_object):
+	* eval.c (caught_a_squirmer):
+	* eval.c (eval_in_buffer_trapping_errors):
+	* eval.c (run_hook_trapping_errors):
+	* eval.c (safe_run_hook_trapping_errors):
+	* eval.c (call0_trapping_errors):
+	* eval.c (call1_trapping_errors):
+	* eval.c (call2_trapping_errors):
+	* eval.c (warn_when_safe):
+	* event-Xt.c (x_event_to_emacs_event):
+	* event-Xt.c (describe_event_window):
+	* event-gtk.c (dragndrop_data_received):
+	* event-msw.c (ntpipe_slurp_reader):
+	* event-msw.c (ntpipe_shove_writer):
+	* event-msw.c (struct winsock_stream):
+	* event-msw.c (winsock_initiate_read):
+	* event-msw.c (winsock_reader):
+	* event-msw.c (winsock_writer):
+	* event-msw.c (emacs_mswindows_create_stream_pair):
+	* event-stream.c:
+	* event-stream.c (allocate_command_builder):
+	* event-stream.c (echo_key_event):
+	* event-stream.c (lookup_command_event):
+	* event-stream.c (dribble_out_event):
+	* event-unixoid.c (event_stream_unixoid_create_stream_pair):
+	* events.c (event_hash):
+	* events.c (format_event_object):
+	* events.c (event_pixel_translation):
+	* events.c (Fevent_point):
+	* events.c (Fevent_closest_point):
+	* events.h (struct command_builder):
+	* extents.c:
+	* extents.c (stack_of_extents):
+	* extents.c (membpos_to_startind):
+	* extents.c (bytebpos_to_startind):
+	* extents.c (buffer_or_string_bytebpos_to_startind):
+	* extents.c (buffer_or_string_bytebpos_to_endind):
+	* extents.c (gap_array_adjust_markers):
+	* extents.c (gap_array_move_gap):
+	* extents.c (extent_list_locate_from_pos):
+	* extents.c (extent_list_at):
+	* extents.c (soe_dump):
+	* extents.c (soe_move):
+	* extents.c (extent_endpoint_bytebpos):
+	* extents.c (extent_endpoint_charbpos):
+	* extents.c (extent_changed_for_redisplay):
+	* extents.c (extent_in_region_p):
+	* extents.c (map_extents_bytebpos):
+	* extents.c (map_extents):
+	* extents.c (adjust_extents):
+	* extents.c (adjust_extents_for_deletion):
+	* extents.c (extent_find_end_of_run):
+	* extents.c (extent_find_beginning_of_run):
+	* extents.c (extent_fragment_update):
+	* extents.c (extent_hash):
+	* extents.c (extent_endpoint_external):
+	* extents.c (Fextent_length):
+	* extents.c (Fnext_extent_change):
+	* extents.c (Fprevious_extent_change):
+	* extents.c (set_extent_endpoints_1):
+	* extents.c (set_extent_endpoints):
+	* extents.c (make_extent_internal):
+	* extents.c (copy_extent):
+	* extents.c (Fmake_extent):
+	* extents.c (Fset_extent_endpoints):
+	* extents.c (Fextent_in_region_p):
+	* extents.c (Fmap_extents):
+	* extents.c (struct slow_map_extent_children_arg):
+	* extents.c (slow_map_extent_children_function):
+	* extents.c (Fmap_extent_children):
+	* extents.c (struct extent_at_arg):
+	* extents.c (extent_at_bytebpos):
+	* extents.c (Fextent_at):
+	* extents.c (Fextents_at):
+	* extents.c (struct verify_extents_arg):
+	* extents.c (verify_extent_modification):
+	* extents.c (struct process_extents_for_insertion_arg):
+	* extents.c (process_extents_for_insertion_mapper):
+	* extents.c (process_extents_for_insertion):
+	* extents.c (struct process_extents_for_deletion_arg):
+	* extents.c (process_extents_for_deletion):
+	* extents.c (report_extent_modification_mapper):
+	* extents.c (report_extent_modification):
+	* extents.c (run_extent_copy_paste_internal):
+	* extents.c (run_extent_copy_function):
+	* extents.c (run_extent_paste_function):
+	* extents.c (update_extent):
+	* extents.c (insert_extent):
+	* extents.c (Finsert_extent):
+	* extents.c (struct add_string_extents_arg):
+	* extents.c (add_string_extents_mapper):
+	* extents.c (add_string_extents):
+	* extents.c (struct splice_in_string_extents_arg):
+	* extents.c (splice_in_string_extents_mapper):
+	* extents.c (splice_in_string_extents):
+	* extents.c (copy_string_extents_mapper):
+	* extents.c (copy_string_extents):
+	* extents.c (get_text_property_bytebpos):
+	* extents.c (get_text_property_1):
+	* extents.c (struct put_text_prop_arg):
+	* extents.c (put_text_prop_mapper):
+	* extents.c (put_text_prop_openness_mapper):
+	* extents.c (put_text_prop):
+	* extents.c (Fput_text_property):
+	* extents.c (Fadd_text_properties):
+	* extents.c (Fremove_text_properties):
+	* extents.h:
+	* extents.h (struct extent):
+	* faces.c (face_hash):
+	* file-coding.c:
+	* file-coding.c (detect_eol_type):
+	* file-coding.c (detect_coding_type):
+	* file-coding.c (determine_real_coding_system):
+	* file-coding.c (Fdetect_coding_region):
+	* file-coding.c (decoding_reader):
+	* file-coding.c (decoding_writer):
+	* file-coding.c (mule_decode):
+	* file-coding.c (Fdecode_coding_region):
+	* file-coding.c (encoding_reader):
+	* file-coding.c (encoding_writer):
+	* file-coding.c (mule_encode):
+	* file-coding.c (Fencode_coding_region):
+	* file-coding.c (detect_coding_sjis):
+	* file-coding.c (decode_coding_sjis):
+	* file-coding.c (encode_coding_sjis):
+	* file-coding.c (detect_coding_big5):
+	* file-coding.c (decode_coding_big5):
+	* file-coding.c (encode_coding_big5):
+	* file-coding.c (decode_ucs4):
+	* file-coding.c (detect_coding_ucs4):
+	* file-coding.c (decode_coding_ucs4):
+	* file-coding.c (encode_coding_ucs4):
+	* file-coding.c (detect_coding_utf8):
+	* file-coding.c (decode_coding_utf8):
+	* file-coding.c (encode_coding_utf8):
+	* file-coding.c (detect_coding_iso2022):
+	* file-coding.c (decode_coding_iso2022):
+	* file-coding.c (encode_coding_iso2022):
+	* file-coding.c (decode_coding_no_conversion):
+	* file-coding.c (encode_coding_no_conversion):
+	* file-coding.h (INTBYTE_FIRST_BYTE_P):
+	* fileio.c (normalize_filename):
+	* fileio.c (report_file_type_error):
+	* fileio.c (report_error_with_errno):
+	* fileio.c (report_file_error):
+	* fileio.c (read_allowing_quit):
+	* fileio.c (write_allowing_quit):
+	* fileio.c (Ffile_name_directory):
+	* fileio.c (Ffile_name_nondirectory):
+	* fileio.c (Fmake_temp_name):
+	* fileio.c (Fexpand_file_name):
+	* fileio.c (Ffile_truename):
+	* fileio.c (Fsubstitute_in_file_name):
+	* fileio.c (barf_or_query_if_file_exists):
+	* fileio.c (Ffile_name_absolute_p):
+	* fileio.c (Ffile_symlink_p):
+	* fileio.c (Fdo_auto_save):
+	* filelock.c (MAKE_LOCK_NAME):
+	* filelock.c (fill_in_lock_file_name):
+	* floatfns.c (float_hash):
+	* fns.c (print_bit_vector):
+	* fns.c (bit_vector_hash):
+	* fns.c (size_bit_vector):
+	* fns.c (Flength):
+	* fns.c (Fsafe_length):
+	* fns.c (Fstring_lessp):
+	* fns.c (copy_list):
+	* fns.c (concat):
+	* fns.c (Ffillarray):
+	* fns.c (bytecode_nconc2):
+	* fns.c (Fnconc):
+	* fns.c (mapcar1):
+	* fns.c (Fmapcar):
+	* fns.c (Fmapvector):
+	* fns.c (ADVANCE_INPUT):
+	* fns.c (base64_encode_1):
+	* fns.c (base64_decode_1):
+	* fns.c (XMALLOC_OR_ALLOCA):
+	* fns.c (Fbase64_encode_region):
+	* fns.c (Fbase64_encode_string):
+	* fns.c (Fbase64_decode_region):
+	* fns.c (Fbase64_decode_string):
+	* font-lock.c (struct context_cache):
+	* font-lock.c (font_lock_maybe_update_syntactic_caches):
+	* font-lock.c (beginning_of_defun):
+	* font-lock.c (end_of_defun):
+	* font-lock.c (setup_context_cache):
+	* font-lock.c (find_context):
+	* font-lock.c (Fsyntactically_sectionize):
+	* frame-gtk.c (gtk_set_frame_text_value):
+	* frame-gtk.c (gtk_set_title_from_intbyte):
+	* frame-gtk.c (gtk_set_icon_name_from_intbyte):
+	* frame-gtk.c (console_type_create_frame_gtk):
+	* frame-msw.c (mswindows_set_title_from_intbyte):
+	* frame-msw.c (console_type_create_frame_mswindows):
+	* frame-x.c (x_set_frame_text_value):
+	* frame-x.c (x_set_title_from_intbyte):
+	* frame-x.c (x_set_icon_name_from_intbyte):
+	* frame-x.c (x_set_frame_properties):
+	* frame-x.c (x_cde_transfer_callback):
+	* frame-x.c (console_type_create_frame_x):
+	* frame.c (Fmake_frame):
+	* frame.c (Fmouse_position):
+	* frame.c (generate_title_string):
+	* frame.c (update_frame_title):
+	* gif_io.c (GifStdRead):
+	* gif_io.c (GifStdWrite):
+	* gif_io.c (GifRead):
+	* gif_io.c (GifWrite):
+	* gifrlib.h:
+	* glyphs-eimage.c (jpeg_memory_src):
+	* glyphs-eimage.c (jpeg_instantiate):
+	* glyphs-eimage.c (gif_memory_storage):
+	* glyphs-eimage.c (gif_read_from_memory):
+	* glyphs-eimage.c (gif_instantiate):
+	* glyphs-eimage.c (struct png_memory_storage):
+	* glyphs-eimage.c (png_read_from_memory):
+	* glyphs-eimage.c (png_instantiate):
+	* glyphs-eimage.c (tiff_memory_storage):
+	* glyphs-eimage.c (tiff_memory_read):
+	* glyphs-eimage.c (tiff_instantiate):
+	* glyphs-msw.c (mswindows_xpm_instantiate):
+	* glyphs-msw.c (bmp_instantiate):
+	* glyphs-msw.c (mswindows_xface_instantiate):
+	* glyphs-msw.c (mswindows_image_instance_hash):
+	* glyphs-msw.c (mswindows_widget_property):
+	* glyphs-msw.c (mswindows_combo_box_property):
+	* glyphs-x.c (x_image_instance_hash):
+	* glyphs-x.c (write_lisp_string_to_temp_file):
+	* glyphs.c (image_instance_hash):
+	* glyphs.c (incompatible_image_types):
+	* glyphs.c (query_string_geometry):
+	* glyphs.c (query_string_font):
+	* glyphs.c (instantiator_eq_hash):
+	* glyphs.c (glyph_hash):
+	* glyphs.h (struct Lisp_Image_Instance):
+	* gpmevent.c (tty_get_foreign_selection):
+	* gui-x.c (menu_separator_style_and_to_external):
+	* gui-x.c (add_accel_and_to_external):
+	* gui-x.c (button_item_to_widget_value):
+	* gui-x.h:
+	* gui.c (separator_string_p):
+	* gui.c (gui_name_accelerator):
+	* gui.c (gui_item_hash):
+	* gui.h:
+	* gutter.c (gutter_extent_signal_changed_region_maybe):
+	* gutter.h:
+	* hash.c:
+	* hash.c (memory_hash):
+	* hash.c (string_hash):
+	* hash.c (hash_table_size):
+	* hash.c (gethash):
+	* hash.c (make_hash_table):
+	* hash.c (make_general_hash_table):
+	* hash.c (grow_hash_table):
+	* hash.c (puthash):
+	* hash.c (rehash):
+	* hash.c (remhash):
+	* hash.h:
+	* hash.h (struct hash_table):
+	* hpplay.c (player_error_internal):
+	* indent.c:
+	* indent.c (last_visible_position):
+	* indent.c (column_at_point):
+	* indent.c (string_column_at_point):
+	* indent.c (Findent_to):
+	* indent.c (bi_spaces_at_point):
+	* indent.c (Fcurrent_indentation):
+	* indent.c (Fmove_to_column):
+	* indent.c (vmotion_1):
+	* indent.c (vmotion):
+	* indent.c (vertical_motion_1):
+	* indent.c (vmotion_pixels):
+	* indent.c (Fvertical_motion_pixels):
+	* insdel.c:
+	* insdel.c (MAX_CHARBPOS_GAP_SIZE_3):
+	* insdel.c (bytecount_to_charcount):
+	* insdel.c (charcount_to_bytecount):
+	* insdel.c (charbpos_to_bytebpos_func):
+	* insdel.c (bytebpos_to_charbpos_func):
+	* insdel.c (buffer_mule_signal_inserted_region):
+	* insdel.c (buffer_mule_signal_deleted_region):
+	* insdel.c (charbpos_to_bytebpos):
+	* insdel.c (bytebpos_to_charbpos):
+	* insdel.c (get_buffer_pos_char):
+	* insdel.c (get_buffer_pos_byte):
+	* insdel.c (get_buffer_range_char):
+	* insdel.c (get_buffer_range_byte):
+	* insdel.c (get_string_range_char):
+	* insdel.c (get_buffer_or_string_pos_char):
+	* insdel.c (get_buffer_or_string_pos_byte):
+	* insdel.c (get_buffer_or_string_range_char):
+	* insdel.c (get_buffer_or_string_range_byte):
+	* insdel.c (buffer_or_string_accessible_begin_char):
+	* insdel.c (buffer_or_string_accessible_end_char):
+	* insdel.c (buffer_or_string_accessible_begin_byte):
+	* insdel.c (buffer_or_string_accessible_end_byte):
+	* insdel.c (buffer_or_string_absolute_begin_char):
+	* insdel.c (buffer_or_string_absolute_end_char):
+	* insdel.c (buffer_or_string_absolute_begin_byte):
+	* insdel.c (buffer_or_string_absolute_end_byte):
+	* insdel.c (JUST_SET_POINT):
+	* insdel.c (set_buffer_point):
+	* insdel.c (do_marker_adjustment):
+	* insdel.c (adjust_markers):
+	* insdel.c (adjust_markers_for_insert):
+	* insdel.c (gap_left):
+	* insdel.c (gap_right):
+	* insdel.c (move_gap):
+	* insdel.c (merge_gap_with_end_gap):
+	* insdel.c (make_gap):
+	* insdel.c (buffer_signal_changed_region):
+	* insdel.c (buffer_extent_signal_changed_region):
+	* insdel.c (cancel_multiple_change):
+	* insdel.c (begin_multiple_change):
+	* insdel.c (signal_before_change):
+	* insdel.c (signal_after_change):
+	* insdel.c (prepare_to_modify_buffer):
+	* insdel.c (fixup_internal_substring):
+	* insdel.c (buffer_insert_string_1):
+	* insdel.c (buffer_insert_raw_string_1):
+	* insdel.c (buffer_insert_lisp_string_1):
+	* insdel.c (buffer_insert_c_string_1):
+	* insdel.c (buffer_insert_emacs_char_1):
+	* insdel.c (buffer_insert_c_char_1):
+	* insdel.c (buffer_insert_from_buffer_1):
+	* insdel.c (buffer_delete_range):
+	* insdel.c (buffer_replace_char):
+	* insdel.c (make_string_from_buffer_1):
+	* insdel.c (make_string_from_buffer):
+	* insdel.c (make_string_from_buffer_no_extents):
+	* insdel.c (barf_if_buffer_read_only):
+	* insdel.c (find_charsets_in_intbyte_string):
+	* insdel.c (intbyte_string_displayed_columns):
+	* insdel.c (convert_intbyte_string_into_emchar_dynarr):
+	* insdel.c (convert_intbyte_string_into_emchar_string):
+	* insdel.c (convert_emchar_string_into_intbyte_dynarr):
+	* insdel.c (convert_emchar_string_into_malloced_string):
+	* insdel.c (reinit_vars_of_insdel):
+	* insdel.c (init_buffer_text):
+	* insdel.h:
+	* insdel.h (struct buffer_text_change_data):
+	* keymap.c (make_key_description):
+	* keymap.c (make_keymap):
+	* keymap.c (define_key_check_and_coerce_keysym):
+	* keymap.c (Fsingle_key_description):
+	* keymap.c (Ftext_char_description):
+	* keymap.c (vars_of_keymap):
+	* line-number.c (invalidate_line_number_cache):
+	* line-number.c (insert_invalidate_line_number_cache):
+	* line-number.c (delete_invalidate_line_number_cache):
+	* line-number.c (get_nearest_line_number):
+	* line-number.c (add_position_to_cache):
+	* line-number.c (buffer_line_number):
+	* line-number.h:
+	* line-number.h (buffer_line_number):
+	* lisp.h:
+	* lisp.h (DO_REALLOC):
+	* lisp.h (struct):
+	* lisp.h (struct Lisp_Buffer_Cons):
+	* lisp.h (struct Lisp_String):
+	* lisp.h (set_string_char):
+	* lisp.h (struct Lisp_Bit_Vector):
+	* lisp.h (bit_vector_bit):
+	* lisp.h (set_bit_vector_bit):
+	* lisp.h (struct Lisp_Marker):
+	* lisp.h (struct lcrecord_list):
+	* lisp.h (struct overhead_stats):
+	* lread.c:
+	* lread.c (readchar):
+	* lread.c (Fload_internal):
+	* lread.c (read_atom):
+	* lread.c (parse_integer):
+	* lread.c (isfloat_string):
+	* lrecord.h:
+	* lrecord.h (struct lrecord_implementation):
+	* lrecord.h (lrecord_description_type):
+	* lrecord.h (struct struct_description):
+	* lstream.c:
+	* lstream.c (aligned_sizeof_lstream):
+	* lstream.c (sizeof_lstream):
+	* lstream.c (Lstream_flush_out):
+	* lstream.c (Lstream_adding):
+	* lstream.c (Lstream_write_1):
+	* lstream.c (Lstream_write):
+	* lstream.c (Lstream_raw_read):
+	* lstream.c (Lstream_read_more):
+	* lstream.c (Lstream_read):
+	* lstream.c (Lstream_unread):
+	* lstream.c (Lstream_fputc):
+	* lstream.c (stdio_reader):
+	* lstream.c (stdio_writer):
+	* lstream.c (struct filedesc_stream):
+	* lstream.c (filedesc_reader):
+	* lstream.c (filedesc_writer):
+	* lstream.c (filedesc_stream_set_pty_flushing):
+	* lstream.c (lisp_string_reader):
+	* lstream.c (lisp_string_rewinder):
+	* lstream.c (struct fixed_buffer_stream):
+	* lstream.c (make_fixed_buffer_input_stream):
+	* lstream.c (make_fixed_buffer_output_stream):
+	* lstream.c (fixed_buffer_reader):
+	* lstream.c (fixed_buffer_writer):
+	* lstream.c (struct resizing_buffer_stream):
+	* lstream.c (resizing_buffer_writer):
+	* lstream.c (dynarr_writer):
+	* lstream.c (make_lisp_buffer_stream_1):
+	* lstream.c (make_lisp_buffer_input_stream):
+	* lstream.c (make_lisp_buffer_output_stream):
+	* lstream.c (lisp_buffer_reader):
+	* lstream.c (lisp_buffer_writer):
+	* lstream.c (lisp_buffer_stream_startpos):
+	* lstream.h:
+	* lstream.h (lstream_implementation):
+	* lstream.h (struct lstream):
+	* malloc.c:
+	* marker.c (marker_equal):
+	* marker.c (marker_hash):
+	* marker.c (set_marker_internal):
+	* marker.c (bi_marker_position):
+	* marker.c (marker_position):
+	* marker.c (set_bi_marker_position):
+	* marker.c (set_marker_position):
+	* md5.c (Fmd5):
+	* menubar-msw.c (mswindows_translate_menu_or_dialog_item):
+	* menubar-msw.c (displayable_menu_item):
+	* menubar-x.c (menu_item_descriptor_to_widget_value_1):
+	* menubar-x.c (menu_accelerator_junk_on_error):
+	* menubar.c (Fnormalize_menu_item_name):
+	* minibuf.c (scmp_1):
+	* minibuf.c (regexp_ignore_completion_p):
+	* minibuf.c (clear_echo_area_internal):
+	* minibuf.c (echo_area_append):
+	* minibuf.c (echo_area_message):
+	* minibuf.c (message_internal):
+	* minibuf.c (message_append_internal):
+	* minibuf.c (message_1):
+	* minibuf.c (message_append_1):
+	* mule-ccl.c (CCL_WRITE_CHAR):
+	* mule-ccl.c (CCL_WRITE_STRING):
+	* mule-charset.c (non_ascii_set_charptr_emchar):
+	* mule-charset.c (non_ascii_charptr_emchar):
+	* mule-charset.c (non_ascii_charptr_copy_char):
+	* mule-charset.c (Lstream_get_emchar_1):
+	* mule-charset.c (Lstream_fput_emchar):
+	* mule-charset.c (Lstream_funget_emchar):
+	* mule-charset.c (make_charset):
+	* mule-charset.c (lookup_composite_char):
+	* mule-charset.h:
+	* mule-charset.h (LEADING_BYTE_PREFIX_P):
+	* mule-charset.h (INTBYTE_FIRST_BYTE_P):
+	* mule-charset.h (INTBYTE_LEADING_BYTE_P):
+	* mule-charset.h (struct Lisp_Charset):
+	* mule-charset.h (CHARSET_LEADING_BYTE):
+	* mule-charset.h (CHARSET_BY_LEADING_BYTE):
+	* mule-charset.h (REP_BYTES_BY_FIRST_BYTE):
+	* mule-charset.h (CHAR_LEADING_BYTE):
+	* mule-wnnfns.c (Fwnn_dict_list):
+	* mule-wnnfns.c (Fwnn_fuzokugo_get):
+	* mule-wnnfns.c (m2w):
+	* objects-gtk.c (gtk_parse_nearest_color):
+	* objects-gtk.c (gtk_font_spec_matches_charset):
+	* objects-gtk.c (gtk_find_charset_font):
+	* objects-gtk.h:
+	* objects-msw.c (mswindows_font_spec_matches_charset):
+	* objects-tty.c (tty_initialize_font_instance):
+	* objects-tty.c (tty_font_spec_matches_charset):
+	* objects-tty.c (tty_find_charset_font):
+	* objects-x.c (x_font_instance_properties):
+	* objects-x.c (x_font_spec_matches_charset):
+	* objects-x.c (x_find_charset_font):
+	* objects.c (font_spec_matches_charset):
+	* objects.h:
+	* opaque.c (aligned_sizeof_opaque):
+	* opaque.c (sizeof_opaque):
+	* opaque.c (make_opaque):
+	* opaque.c (equal_opaque):
+	* opaque.h:
+	* opaque.h (Lisp_Opaque):
+	* print.c (std_handle_out_external):
+	* print.c (std_handle_out_va):
+	* print.c (write_string_to_stdio_stream):
+	* print.c (output_string):
+	* print.c (write_char_internal):
+	* print.c (write_string_1):
+	* print.c (write_c_string):
+	* print.c (Fwrite_char):
+	* print.c (float_to_string):
+	* print.c (print_string):
+	* print.c (print_internal):
+	* print.c (print_symbol):
+	* print.c (Falternate_debugging_output):
+	* print.c (Fexternal_debugging_output):
+	* process-nt.c (alloc_process_memory):
+	* process-nt.c (run_in_other_process):
+	* process-nt.c (nt_send_process):
+	* process-unix.c (unix_send_process):
+	* process-unix.c (unix_process_send_eof):
+	* process-unix.c (unix_kill_child_process):
+	* process-unix.c (unix_canonicalize_host_name):
+	* process-unix.c (unix_open_network_stream):
+	* process.c:
+	* process.c (read_process_output):
+	* process.c (send_process):
+	* process.c (Fprocess_send_region):
+	* process.c (status_notify):
+	* process.c (decode_signal):
+	* procimpl.h:
+	* redisplay-gtk.c (gtk_output_display_block):
+	* redisplay-output.c:
+	* redisplay-output.c (compare_runes):
+	* redisplay-output.c (ADJ_CHARBPOS):
+	* redisplay-output.c (redisplay_move_cursor):
+	* redisplay-output.c (redisplay_output_layout):
+	* redisplay-output.c (redisplay_update_line):
+	* redisplay-tty.c:
+	* redisplay-tty.c (tty_output_intbyte_string):
+	* redisplay-tty.c (tty_output_emchar_dynarr):
+	* redisplay-tty.c (substitute_in_dynamic_color_string):
+	* redisplay-tty.c (set_foreground_to):
+	* redisplay-tty.c (set_background_to):
+	* redisplay.c:
+	* redisplay.c (position_redisplay_data_type):
+	* redisplay.c (struct prop_block):
+	* redisplay.c (redisplay_text_width_string):
+	* redisplay.c (redisplay_frame_text_width_string):
+	* redisplay.c (generate_display_line):
+	* redisplay.c (add_hscroll_rune):
+	* redisplay.c (add_emchar_rune):
+	* redisplay.c (add_intbyte_string_runes):
+	* redisplay.c (add_blank_rune):
+	* redisplay.c (add_disp_table_entry_runes_1):
+	* redisplay.c (add_propagation_runes):
+	* redisplay.c (add_glyph_rune):
+	* redisplay.c (create_text_block):
+	* redisplay.c (create_overlay_glyph_block):
+	* redisplay.c (add_margin_blank):
+	* redisplay.c (generate_formatted_string_db):
+	* redisplay.c (generate_modeline):
+	* redisplay.c (add_string_to_fstring_db_runes):
+	* redisplay.c (generate_fstring_runes):
+	* redisplay.c (create_string_text_block):
+	* redisplay.c (generate_string_display_line):
+	* redisplay.c (generate_displayable_area):
+	* redisplay.c (regenerate_window):
+	* redisplay.c (REGEN_INC_FIND_START_END):
+	* redisplay.c (regenerate_window_extents_only_changed):
+	* redisplay.c (regenerate_window_incrementally):
+	* redisplay.c (regenerate_window_point_center):
+	* redisplay.c (point_visible):
+	* redisplay.c (line_at_center):
+	* redisplay.c (point_at_center):
+	* redisplay.c (redisplay_window):
+	* redisplay.c (call_redisplay_end_triggers):
+	* redisplay.c (window_line_number):
+	* redisplay.c (decode_mode_spec):
+	* redisplay.c (update_internal_cache_list):
+	* redisplay.c (line_start_cache_start):
+	* redisplay.c (line_start_cache_end):
+	* redisplay.c (point_in_line_start_cache):
+	* redisplay.c (point_would_be_visible):
+	* redisplay.c (start_end_of_last_line):
+	* redisplay.c (start_of_last_line):
+	* redisplay.c (end_of_last_line):
+	* redisplay.c (end_of_last_line_may_error):
+	* redisplay.c (start_with_line_at_pixpos):
+	* redisplay.c (start_with_point_on_display_line):
+	* redisplay.c (update_line_start_cache):
+	* redisplay.c (UPDATE_CACHE_RETURN):
+	* redisplay.c (pixel_to_glyph_translation):
+	* redisplay.c (init_redisplay):
+	* redisplay.h:
+	* redisplay.h (struct line_start_cache):
+	* redisplay.h (struct rune):
+	* redisplay.h (struct display_line):
+	* redisplay.h (struct extent_fragment):
+	* regex.c (struct):
+	* regex.c (PATFETCH_EXTENDED):
+	* regex.c (PATFETCH_RAW_EXTENDED):
+	* regex.c (regex_compile):
+	* regex.c (compile_extended_range):
+	* regex.c (re_compile_fastmap):
+	* regex.c (re_match_2_internal):
+	* regex.c (regerror):
+	* regex.h (Elemcount):
+	* scrollbar-gtk.h (struct gtk_scrollbar_data):
+	* scrollbar-msw.c (mswindows_handle_mousewheel_event):
+	* scrollbar-x.h (struct x_scrollbar_data):
+	* scrollbar.c (scrollbar_point):
+	* scrollbar.c (update_scrollbar_instance):
+	* scrollbar.c (scrollbar_reset_cursor):
+	* scrollbar.c (Fscrollbar_page_up):
+	* scrollbar.c (Fscrollbar_vertical_drag):
+	* search.c:
+	* search.c (fixup_search_regs_for_buffer):
+	* search.c (looking_at_1):
+	* search.c (fast_string_match):
+	* search.c (bi_scan_buffer):
+	* search.c (scan_buffer):
+	* search.c (bi_find_next_newline_no_quit):
+	* search.c (find_next_newline_no_quit):
+	* search.c (find_next_newline):
+	* search.c (bi_find_next_emchar_in_string):
+	* search.c (find_before_next_newline):
+	* search.c (skip_chars):
+	* search.c (search_command):
+	* search.c (trivial_regexp_p):
+	* search.c (search_buffer):
+	* search.c (simple_search):
+	* search.c (boyer_moore):
+	* search.c (set_search_regs):
+	* search.c (wordify):
+	* search.c (Freplace_match):
+	* search.c (Fmatch_data):
+	* search.c (Fregexp_quote):
+	* select-common.h (selection_data_to_lisp_data):
+	* select-common.h (lisp_data_to_selection_data):
+	* select-gtk.c (atom_to_symbol):
+	* select-gtk.c (emacs_gtk_selection_handle):
+	* select-x.c (hack_motif_clipboard_selection):
+	* select-x.c (x_reply_selection_request):
+	* select-x.c (x_handle_selection_request):
+	* select-x.c (copy_multiple_data):
+	* select-x.c (x_get_window_property):
+	* select-x.c (receive_incremental_selection):
+	* select-x.c (x_get_window_property_as_lisp_data):
+	* select-x.c (Fx_get_cutbuffer_internal):
+	* select-x.c (Fx_store_cutbuffer_internal):
+	* sheap.c (report_sheap_usage):
+	* sound.c (Fplay_sound):
+	* sound.h (sound_perror):
+	* sound.h (sound_warn):
+	* specifier.c (aligned_sizeof_specifier):
+	* specifier.c (sizeof_specifier):
+	* specifier.c (make_specifier_internal):
+	* symbols.c (intern):
+	* symbols.c (oblookup):
+	* symbols.c (hash_string):
+	* symbols.c (init_symbols_once_early):
+	* symbols.c (defsymbol_massage_name_1):
+	* symbols.c (defsymbol_nodump):
+	* symbols.c (defsymbol):
+	* symbols.c (defvar_magic):
+	* syntax.c:
+	* syntax.c (struct lisp_parse_state):
+	* syntax.c (find_defun_start):
+	* syntax.c (scan_words):
+	* syntax.c (Fforward_word):
+	* syntax.c (find_start_of_comment):
+	* syntax.c (find_end_of_comment):
+	* syntax.c (Fforward_comment):
+	* syntax.c (scan_lists):
+	* syntax.c (char_quoted):
+	* syntax.c (Fbackward_prefix_chars):
+	* syntax.c (scan_sexps_forward):
+	* syntax.c (Fparse_partial_sexp):
+	* syntax.h:
+	* syntax.h (struct syntax_cache):
+	* syntax.h (SYNTAX_CACHE_BYTE_TO_CHAR):
+	* syntax.h (SYNTAX_CACHE_OBJECT_BYTE_TO_CHAR):
+	* sysdep.c (get_eof_char):
+	* sysdep.c (init_system_name):
+	* sysdep.c (sys_readdir):
+	* sysdep.h:
+	* syswindows.h:
+	* syswindows.h (LOCAL_FILE_FORMAT_TO_TSTR):
+	* syswindows.h (LOCAL_TO_WIN32_FILE_FORMAT):
+	* syswindows.h (WIN32_TO_LOCAL_FILE_FORMAT):
+	* tests.c (Ftest_data_format_conversion):
+	* toolbar-gtk.c (gtk_output_toolbar_button):
+	* toolbar-x.c (x_output_toolbar_button):
+	* tooltalk.c (check_status):
+	* tooltalk.c (tt_message_arg_bval_vector):
+	* tparam.c:
+	* undo.c:
+	* undo.c (record_insert):
+	* undo.c (record_delete):
+	* undo.c (record_change):
+	* undo.c (record_property_change):
+	* undo.c (Fprimitive_undo):
+	* win32.c (tstr_to_local_file_format):
+	* window.c (Fpos_visible_in_window_p):
+	* window.c (Fwindow_end):
+	* window.c (unshow_buffer):
+	* window.c (Fdelete_other_windows):
+	* window.c (Fselect_window):
+	* window.c (window_scroll):
+	* window.c (Fcenter_to_window_line):
+	* window.c (Fmove_to_window_line):
+	* window.c (sizeof_window_config_for_n_windows):
+	* window.c (sizeof_window_config):
+	* window.c (Fcurrent_pixel_column):
+	* window.h (struct window):
+
+	The great integral types renaming.
+
+	The purpose of this is to rationalize the names used for various
+	integral types, so that they match their intended uses and follow
+	consist conventions, and eliminate types that were not semantically
+	different from each other.
+
+	The conventions are:
+
+	-- All integral types that measure quantities of anything are
+	   signed.  Some people disagree vociferously with this, but their
+	   arguments are mostly theoretical, and are vastly outweighed by
+	   the practical headaches of mixing signed and unsigned values,
+	   and more importantly by the far increased likelihood of
+	   inadvertent bugs: Because of the broken "viral" nature of
+	   unsigned quantities in C (operations involving mixed
+	   signed/unsigned are done unsigned, when exactly the opposite is
+	   nearly always wanted), even a single error in declaring a
+	   quantity unsigned that should be signed, or even the even more
+	   subtle error of comparing signed and unsigned values and
+	   forgetting the necessary cast, can be catastrophic, as
+	   comparisons will yield wrong results.  -Wsign-compare is turned
+	   on specifically to catch this, but this tends to result in a
+	   great number of warnings when mixing signed and unsigned, and
+	   the casts are annoying.  More has been written on this
+	   elsewhere.
+	
+	-- All such quantity types just mentioned boil down to EMACS_INT,
+	   which is 32 bits on 32-bit machines and 64 bits on 64-bit
+	   machines.  This is guaranteed to be the same size as Lisp
+	   objects of type `int', and (as far as I can tell) of size_t
+	   (unsigned!) and ssize_t.  The only type below that is not an
+	   EMACS_INT is Hashcode, which is an unsigned value of the same
+	   size as EMACS_INT.
+	
+	-- Type names should be relatively short (no more than 10
+	   characters or so), with the first letter capitalized and no
+	   underscores if they can at all be avoided.
+	
+	-- "count" == a zero-based measurement of some quantity.  Includes
+	   sizes, offsets, and indexes.
+	
+	-- "bpos" == a one-based measurement of a position in a buffer.
+	   "Charbpos" and "Bytebpos" count text in the buffer, rather than
+	   bytes in memory; thus Bytebpos does not directly correspond to
+	   the memory representation.  Use "Membpos" for this.
+	
+	-- "Char" refers to internal-format characters, not to the C type
+	   "char", which is really a byte.
+	
+	-- For the actual name changes, see the script below.
+	
+	I ran the following script to do the conversion. (NOTE: This script
+	is idempotent.  You can safely run it multiple times and it will
+	not screw up previous results -- in fact, it will do nothing if
+	nothing has changed.  Thus, it can be run repeatedly as necessary
+	to handle patches coming in from old workspaces, or old branches.) 
+	There are two tags, just before and just after the change:
+	`pre-integral-type-rename' and `post-integral-type-rename'.  When
+	merging code from the main trunk into a branch, the best thing to
+	do is first merge up to `pre-integral-type-rename', then apply the
+	script and associated changes, then merge from
+	`post-integral-type-change' to the present. (Alternatively, just do
+	the merging in one operation; but you may then have a lot of
+	conflicts needing to be resolved by hand.)
+
+	Script `fixtypes.sh' follows:
+
+
+----------------------------------- cut ------------------------------------
+files="*.[ch] s/*.h m/*.h config.h.in ../configure.in Makefile.in.in ../lib-src/*.[ch] ../lwlib/*.[ch]"
+gr Memory_Count Bytecount $files
+gr Lstream_Data_Count Bytecount $files
+gr Element_Count Elemcount $files
+gr Hash_Code Hashcode $files
+gr extcount bytecount $files
+gr bufpos charbpos $files
+gr bytind bytebpos $files
+gr memind membpos $files
+gr bufbyte intbyte $files
+gr Extcount Bytecount $files
+gr Bufpos Charbpos $files
+gr Bytind Bytebpos $files
+gr Memind Membpos $files
+gr Bufbyte Intbyte $files
+gr EXTCOUNT BYTECOUNT $files
+gr BUFPOS CHARBPOS $files
+gr BYTIND BYTEBPOS $files
+gr MEMIND MEMBPOS $files
+gr BUFBYTE INTBYTE $files
+gr MEMORY_COUNT BYTECOUNT $files
+gr LSTREAM_DATA_COUNT BYTECOUNT $files
+gr ELEMENT_COUNT ELEMCOUNT $files
+gr HASH_CODE HASHCODE $files
+----------------------------------- cut ------------------------------------
+
+
+	`fixtypes.sh' is a Bourne-shell script; it uses 'gr':
+
+
+----------------------------------- cut ------------------------------------
+#!/bin/sh
+
+# Usage is like this:
+
+# gr FROM TO FILES ...
+
+# globally replace FROM with TO in FILES.  FROM and TO are regular expressions.
+# backup files are stored in the `backup' directory.
+from="$1"
+to="$2"
+shift 2
+echo ${1+"$@"} | xargs global-replace "s/$from/$to/g"
+----------------------------------- cut ------------------------------------
+
+
+	`gr' in turn uses a Perl script to do its real work,
+	`global-replace', which follows:
+
+
+----------------------------------- cut ------------------------------------
+: #-*- Perl -*-
+
+### global-modify --- modify the contents of a file by a Perl expression
+
+## Copyright (C) 1999 Martin Buchholz.
+## Copyright (C) 2001 Ben Wing.
+
+## Authors: Martin Buchholz <martin@xemacs.org>, Ben Wing <ben@xemacs.org>
+## Maintainer: Ben Wing <ben@xemacs.org>
+## Current Version: 1.0, May 5, 2001
+
+# This program is free software; you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as published by
+# the Free Software Foundation; either version 2, or (at your option)
+# any later version.
+#
+# This program is distributed in the hope that it will be useful, but
+# WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+# General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with XEmacs; see the file COPYING.  If not, write to the Free
+# Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
+# 02111-1307, USA.
+
+eval 'exec perl -w -S $0 ${1+"$@"}'
+    if 0;
+
+use strict;
+use FileHandle;
+use Carp;
+use Getopt::Long;
+use File::Basename;
+
+(my $myName = $0) =~ s@.*/@@; my $usage="
+Usage: $myName [--help] [--backup-dir=DIR] [--line-mode] [--hunk-mode]
+       PERLEXPR FILE ...
+
+Globally modify a file, either line by line or in one big hunk.
+
+Typical usage is like this:
+
+[with GNU print, GNU xargs: guaranteed to handle spaces, quotes, etc.
+ in file names]
+
+find . -name '*.[ch]' -print0 | xargs -0 $0 's/\bCONST\b/const/g'\n
+
+[with non-GNU print, xargs]
+
+find . -name '*.[ch]' -print | xargs $0 's/\bCONST\b/const/g'\n
+
+
+The file is read in, either line by line (with --line-mode specified)
+or in one big hunk (with --hunk-mode specified; it's the default), and
+the Perl expression is then evalled with \$_ set to the line or hunk of
+text, including the terminating newline if there is one.  It should
+destructively modify the value there, storing the changed result in \$_.
+
+Files in which any modifications are made are backed up to the directory
+specified using --backup-dir, or to `backup' by default.  To disable this,
+use --backup-dir= with no argument.
+
+Hunk mode is the default because it is MUCH MUCH faster than line-by-line.
+Use line-by-line only when it matters, e.g. you want to do a replacement
+only once per line (the default without the `g' argument).  Conversely,
+when using hunk mode, *ALWAYS* use `g'; otherwise, you will only make one
+replacement in the entire file!
+";
+
+my %options = ();
+$Getopt::Long::ignorecase = 0;
+&GetOptions (
+	     \%options,
+	     'help', 'backup-dir=s', 'line-mode', 'hunk-mode',
+);
+
+
+die $usage if $options{"help"} or @ARGV <= 1;
+my $code = shift;
+
+die $usage if grep (-d || ! -w, @ARGV);
+
+sub SafeOpen {
+  open ((my $fh = new FileHandle), $_[0]);
+  confess "Can't open $_[0]: $!" if ! defined $fh;
+  return $fh;
+}
+
+sub SafeClose {
+  close $_[0] or confess "Can't close $_[0]: $!";
+}
+
+sub FileContents {
+  my $fh = SafeOpen ("< $_[0]");
+  my $olddollarslash = $/;
+  local $/ = undef;
+  my $contents = <$fh>;
+  $/ = $olddollarslash;
+  return $contents;
+}
+
+sub WriteStringToFile {
+  my $fh = SafeOpen ("> $_[0]");
+  binmode $fh;
+  print $fh $_[1] or confess "$_[0]: $!\n";
+  SafeClose $fh;
+}
+
+foreach my $file (@ARGV) {
+  my $changed_p = 0;
+  my $new_contents = "";
+  if ($options{"line-mode"}) {
+    my $fh = SafeOpen $file;
+    while (<$fh>) {
+      my $save_line = $_;
+      eval $code;
+      $changed_p = 1 if $save_line ne $_;
+      $new_contents .= $_;
+    }
+  } else {
+    my $orig_contents = $_ = FileContents $file;
+    eval $code;
+    if ($_ ne $orig_contents) {
+      $changed_p = 1;
+      $new_contents = $_;
+    }
+  }
+
+  if ($changed_p) {
+    my $backdir = $options{"backup-dir"};
+    $backdir = "backup" if !defined ($backdir);
+    if ($backdir) {
+      my ($name, $path, $suffix) = fileparse ($file, "");
+      my $backfulldir = $path . $backdir;
+      my $backfile = "$backfulldir/$name";
+      mkdir $backfulldir, 0755 unless -d $backfulldir;
+      print "modifying $file (original saved in $backfile)\n";
+      rename $file, $backfile;
+    }
+    WriteStringToFile ($file, $new_contents);
+  }
+}
+----------------------------------- cut ------------------------------------
+
+
+	In addition to those programs, I needed to fix up a few other
+	things, particularly relating to the duplicate definitions of
+	types, now that some types merged with others.  Specifically:
+
+	1. in lisp.h, removed duplicate declarations of Bytecount.  The
+	   changed code should now look like this: (In each code snippet
+	   below, the first and last lines are the same as the original, as
+	   are all lines outside of those lines.  That allows you to locate
+	   the section to be replaced, and replace the stuff in that
+	   section, verifying that there isn't anything new added that
+	   would need to be kept.)
+
+--------------------------------- snip -------------------------------------
+/* Counts of bytes or chars */
+typedef EMACS_INT Bytecount;
+typedef EMACS_INT Charcount;
+
+/* Counts of elements */
+typedef EMACS_INT Elemcount;
+
+/* Hash codes */
+typedef unsigned long Hashcode;
+
+/* ------------------------ dynamic arrays ------------------- */
+--------------------------------- snip -------------------------------------
+
+	2. in lstream.h, removed duplicate declaration of Bytecount.
+	   Rewrote the comment about this type.  The changed code should
+	   now look like this:
+
+
+--------------------------------- snip -------------------------------------
+#endif
+
+/* The have been some arguments over the what the type should be that
+   specifies a count of bytes in a data block to be written out or read in,
+   using Lstream_read(), Lstream_write(), and related functions.
+   Originally it was long, which worked fine; Martin "corrected" these to
+   size_t and ssize_t on the grounds that this is theoretically cleaner and
+   is in keeping with the C standards.  Unfortunately, this practice is
+   horribly error-prone due to design flaws in the way that mixed
+   signed/unsigned arithmetic happens.  In fact, by doing this change,
+   Martin introduced a subtle but fatal error that caused the operation of
+   sending large mail messages to the SMTP server under Windows to fail.
+   By putting all values back to be signed, avoiding any signed/unsigned
+   mixing, the bug immediately went away.  The type then in use was
+   Lstream_Data_Count, so that it be reverted cleanly if a vote came to
+   that.  Now it is Bytecount.
+
+   Some earlier comments about why the type must be signed: This MUST BE
+   SIGNED, since it also is used in functions that return the number of
+   bytes actually read to or written from in an operation, and these
+   functions can return -1 to signal error.
+   
+   Note that the standard Unix read() and write() functions define the
+   count going in as a size_t, which is UNSIGNED, and the count going
+   out as an ssize_t, which is SIGNED.  This is a horrible design
+   flaw.  Not only is it highly likely to lead to logic errors when a
+   -1 gets interpreted as a large positive number, but operations are
+   bound to fail in all sorts of horrible ways when a number in the
+   upper-half of the size_t range is passed in -- this number is
+   unrepresentable as an ssize_t, so code that checks to see how many
+   bytes are actually written (which is mandatory if you are dealing
+   with certain types of devices) will get completely screwed up.
+
+   --ben
+*/
+
+typedef enum lstream_buffering
+--------------------------------- snip -------------------------------------
+
+
+	3. in dumper.c, there are four places, all inside of switch()
+	   statements, where XD_BYTECOUNT appears twice as a case tag.  In
+	   each case, the two case blocks contain identical code, and you
+	   should *REMOVE THE SECOND* and leave the first.
+
 2001-09-17  Ben Wing  <ben@xemacs.org>
 
 	* fileio.c (normalize_filename):
--- a/src/abbrev.c	Tue Sep 18 05:06:57 2001 +0000
+++ b/src/abbrev.c	Thu Sep 20 06:31:11 2001 +0000
@@ -121,7 +121,7 @@
     }
   /* Match abbreviation string against buffer text.  */
   {
-    Bufbyte *ptr = string_data (abbrev);
+    Intbyte *ptr = string_data (abbrev);
     Charcount idx;
 
     for (idx = 0; idx < abbrev_length; idx++)
@@ -178,8 +178,8 @@
 static Lisp_Symbol *
 abbrev_oblookup (struct buffer *buf, Lisp_Object obarray)
 {
-  Bufpos wordstart, wordend;
-  Bufbyte *word, *p;
+  Charbpos wordstart, wordend;
+  Intbyte *word, *p;
   Bytecount idx;
   Lisp_Object lookup;
 
@@ -204,7 +204,7 @@
     }
   else
     {
-      Bufpos point = BUF_PT (buf);
+      Charbpos point = BUF_PT (buf);
 
       wordstart = scan_words (buf, point, -1);
       if (!wordstart)
@@ -227,7 +227,7 @@
   if (wordend <= wordstart)
     return 0;
 
-  p = word = (Bufbyte *) alloca (MAX_EMCHAR_LEN * (wordend - wordstart));
+  p = word = (Intbyte *) alloca (MAX_EMCHAR_LEN * (wordend - wordstart));
   for (idx = wordstart; idx < wordend; idx++)
     {
       Emchar c = BUF_FETCH_CHAR (buf, idx);
@@ -246,12 +246,12 @@
 static int
 obarray_has_blank_p (Lisp_Object obarray)
 {
-  return !ZEROP (oblookup (obarray, (Bufbyte *)" ", 1));
+  return !ZEROP (oblookup (obarray, (Intbyte *)" ", 1));
 }
 
 /* Analyze case in the buffer substring, and report it.  */
 static void
-abbrev_count_case (struct buffer *buf, Bufpos pos, Charcount length,
+abbrev_count_case (struct buffer *buf, Charbpos pos, Charcount length,
 		   int *lccount, int *uccount)
 {
   *lccount = *uccount = 0;
@@ -279,8 +279,8 @@
   struct buffer *buf = current_buffer;
   int oldmodiff = BUF_MODIFF (buf);
   Lisp_Object pre_modiff_p;
-  Bufpos point;			/* position of point */
-  Bufpos abbrev_start;		/* position of abbreviation beginning */
+  Charbpos point;			/* position of point */
+  Charbpos abbrev_start;		/* position of abbreviation beginning */
 
   Lisp_Symbol *(*fun) (struct buffer *, Lisp_Object);
 
@@ -382,7 +382,7 @@
   else if (uccount)
     {
       /* Abbrev included some caps.  Cap first initial of expansion */
-      Bufpos pos = abbrev_start;
+      Charbpos pos = abbrev_start;
       /* Find the initial.  */
       while (pos < point
 	     && !WORD_SYNTAX_P (XCHAR_TABLE (buf->mirror_syntax_table),
--- a/src/alloc.c	Tue Sep 18 05:06:57 2001 +0000
+++ b/src/alloc.c	Thu Sep 20 06:31:11 2001 +0000
@@ -243,7 +243,7 @@
 
 #undef xmalloc
 void *
-xmalloc (Memory_Count size)
+xmalloc (Bytecount size)
 {
   void *val = malloc (size);
 
@@ -253,7 +253,7 @@
 
 #undef xcalloc
 static void *
-xcalloc (Element_Count nelem, Memory_Count elsize)
+xcalloc (Elemcount nelem, Bytecount elsize)
 {
   void *val = calloc (nelem, elsize);
 
@@ -262,14 +262,14 @@
 }
 
 void *
-xmalloc_and_zero (Memory_Count size)
+xmalloc_and_zero (Bytecount size)
 {
   return xcalloc (size, sizeof (char));
 }
 
 #undef xrealloc
 void *
-xrealloc (void *block, Memory_Count size)
+xrealloc (void *block, Bytecount size)
 {
   block = realloc (block, size);
 
@@ -307,10 +307,10 @@
 #endif
 
 static void
-deadbeef_memory (void *ptr, Memory_Count size)
+deadbeef_memory (void *ptr, Bytecount size)
 {
   four_byte_t *ptr4 = (four_byte_t *) ptr;
-  Memory_Count beefs = size >> 2;
+  Bytecount beefs = size >> 2;
 
   /* In practice, size will always be a multiple of four.  */
   while (beefs--)
@@ -345,7 +345,7 @@
 
 
 static void *
-allocate_lisp_storage (Memory_Count size)
+allocate_lisp_storage (Bytecount size)
 {
   return xmalloc (size);
 }
@@ -357,7 +357,7 @@
 static struct lcrecord_header *all_lcrecords;
 
 void *
-alloc_lcrecord (Memory_Count size, const struct lrecord_implementation *implementation)
+alloc_lcrecord (Bytecount size, const struct lrecord_implementation *implementation)
 {
   struct lcrecord_header *lcheader;
 
@@ -1052,7 +1052,7 @@
   return (len > 0) ? ptr->contents[len - 1] : Qnil;
 }
 
-static Memory_Count
+static Bytecount
 size_vector (const void *lheader)
 {
   return FLEXIBLE_ARRAY_STRUCT_SIZEOF (Lisp_Vector, Lisp_Object, contents,
@@ -1076,7 +1076,7 @@
   return 1;
 }
 
-static Hash_Code
+static Hashcode
 vector_hash (Lisp_Object obj, int depth)
 {
   return HASH2 (XVECTOR_LENGTH (obj),
@@ -1100,10 +1100,10 @@
 
 /* #### should allocate `small' vectors from a frob-block */
 static Lisp_Vector *
-make_vector_internal (Element_Count sizei)
+make_vector_internal (Elemcount sizei)
 {
   /* no vector_next */
-  Memory_Count sizem = FLEXIBLE_ARRAY_STRUCT_SIZEOF (Lisp_Vector, Lisp_Object,
+  Bytecount sizem = FLEXIBLE_ARRAY_STRUCT_SIZEOF (Lisp_Vector, Lisp_Object,
 					       contents, sizei);
   Lisp_Vector *p = (Lisp_Vector *) alloc_lcrecord (sizem, &lrecord_vector);
 
@@ -1112,7 +1112,7 @@
 }
 
 Lisp_Object
-make_vector (Element_Count length, Lisp_Object object)
+make_vector (Elemcount length, Lisp_Object object)
 {
   Lisp_Vector *vecp = make_vector_internal (length);
   Lisp_Object *p = vector_data (vecp);
@@ -1264,10 +1264,10 @@
 
 /* #### should allocate `small' bit vectors from a frob-block */
 static Lisp_Bit_Vector *
-make_bit_vector_internal (Element_Count sizei)
+make_bit_vector_internal (Elemcount sizei)
 {
-  Element_Count num_longs = BIT_VECTOR_LONG_STORAGE (sizei);
-  Memory_Count sizem = FLEXIBLE_ARRAY_STRUCT_SIZEOF (Lisp_Bit_Vector,
+  Elemcount num_longs = BIT_VECTOR_LONG_STORAGE (sizei);
+  Bytecount sizem = FLEXIBLE_ARRAY_STRUCT_SIZEOF (Lisp_Bit_Vector,
 						     unsigned long,
 						     bits, num_longs);
   Lisp_Bit_Vector *p = (Lisp_Bit_Vector *) allocate_lisp_storage (sizem);
@@ -1285,10 +1285,10 @@
 }
 
 Lisp_Object
-make_bit_vector (Element_Count length, Lisp_Object bit)
+make_bit_vector (Elemcount length, Lisp_Object bit)
 {
   Lisp_Bit_Vector *p = make_bit_vector_internal (length);
-  Element_Count num_longs = BIT_VECTOR_LONG_STORAGE (length);
+  Elemcount num_longs = BIT_VECTOR_LONG_STORAGE (length);
 
   CHECK_BIT (bit);
 
@@ -1296,7 +1296,7 @@
     memset (p->bits, 0, num_longs * sizeof (long));
   else
     {
-      Element_Count bits_in_last = length & (LONGBITS_POWER_OF_2 - 1);
+      Elemcount bits_in_last = length & (LONGBITS_POWER_OF_2 - 1);
       memset (p->bits, ~0, num_longs * sizeof (long));
       /* But we have to make sure that the unused bits in the
 	 last long are 0, so that equal/hash is easy. */
@@ -1312,9 +1312,9 @@
 }
 
 Lisp_Object
-make_bit_vector_from_byte_vector (unsigned char *bytevec, Element_Count length)
+make_bit_vector_from_byte_vector (unsigned char *bytevec, Elemcount length)
 {
-  Element_Count i;
+  Elemcount i;
   Lisp_Bit_Vector *p = make_bit_vector_internal (length);
 
   for (i = 0; i < length; i++)
@@ -1601,7 +1601,7 @@
   ALLOCATE_FIXED_TYPE (marker, Lisp_Marker, p);
   set_lheader_implementation (&p->lheader, &lrecord_marker);
   p->buffer = 0;
-  p->memind = 0;
+  p->membpos = 0;
   marker_next (p) = 0;
   marker_prev (p) = 0;
   p->insertion_type = 0;
@@ -1618,7 +1618,7 @@
   NOSEEUM_ALLOCATE_FIXED_TYPE (marker, Lisp_Marker, p);
   set_lheader_implementation (&p->lheader, &lrecord_marker);
   p->buffer = 0;
-  p->memind = 0;
+  p->membpos = 0;
   marker_next (p) = 0;
   marker_prev (p) = 0;
   p->insertion_type = 0;
@@ -1842,7 +1842,7 @@
   set_lheader_implementation (&s->lheader, &lrecord_string);
 
   set_string_data (s, BIG_STRING_FULLSIZE_P (fullsize)
-		   ? xnew_array (Bufbyte, length + 1)
+		   ? xnew_array (Intbyte, length + 1)
 		   : allocate_string_chars_struct (s, fullsize)->chars);
 
   set_string_length (s, length);
@@ -1872,7 +1872,7 @@
   verify_string_chars_integrity ();
 #endif
 
-#ifdef ERROR_CHECK_BUFPOS
+#ifdef ERROR_CHECK_CHARBPOS
   if (pos >= 0)
     {
       assert (pos <= string_length (s));
@@ -1884,7 +1884,7 @@
       if (delta < 0)
 	assert ((-delta) <= string_length (s));
     }
-#endif /* ERROR_CHECK_BUFPOS */
+#endif /* ERROR_CHECK_CHARBPOS */
 
   if (delta == 0)
     /* simplest case: no size change. */
@@ -1912,16 +1912,16 @@
 
 	  if (delta < 0 && pos >= 0)
 	    memmove (string_data (s) + pos + delta, string_data (s) + pos, len);
-	  set_string_data (s, (Bufbyte *) xrealloc (string_data (s),
+	  set_string_data (s, (Intbyte *) xrealloc (string_data (s),
 						    string_length (s) + delta + 1));
 	  if (delta > 0 && pos >= 0)
 	    memmove (string_data (s) + pos + delta, string_data (s) + pos, len);
 	}
       else /* String has been demoted from BIG_STRING. */
 	{
-	  Bufbyte *new_data =
+	  Intbyte *new_data =
 	    allocate_string_chars_struct (s, newfullsize)->chars;
-	  Bufbyte *old_data = string_data (s);
+	  Intbyte *old_data = string_data (s);
 
 	  if (pos >= 0)
 	    {
@@ -1944,7 +1944,7 @@
 	     constraints). */
 	  if (pos >= 0)
 	    {
-	      Bufbyte *addroff = pos + string_data (s);
+	      Intbyte *addroff = pos + string_data (s);
 
 	      memmove (addroff + delta, addroff,
 		       /* +1 due to zero-termination. */
@@ -1953,10 +1953,10 @@
 	}
       else
 	{
-	  Bufbyte *old_data = string_data (s);
-	  Bufbyte *new_data =
+	  Intbyte *old_data = string_data (s);
+	  Intbyte *new_data =
 	    BIG_STRING_FULLSIZE_P (newfullsize)
-	    ? xnew_array (Bufbyte, string_length (s) + delta + 1)
+	    ? xnew_array (Intbyte, string_length (s) + delta + 1)
 	    : allocate_string_chars_struct (s, newfullsize)->chars;
 
 	  if (pos >= 0)
@@ -2011,7 +2011,7 @@
 void
 set_string_char (Lisp_String *s, Charcount i, Emchar c)
 {
-  Bufbyte newstr[MAX_EMCHAR_LEN];
+  Intbyte newstr[MAX_EMCHAR_LEN];
   Bytecount bytoff = charcount_to_bytecount (string_data (s), i);
   Bytecount oldlen = charcount_to_bytecount (string_data (s) + bytoff, 1);
   Bytecount newlen = set_charptr_emchar (newstr, c);
@@ -2033,7 +2033,7 @@
   CHECK_NATNUM (length);
   CHECK_CHAR_COERCE_INT (character);
   {
-    Bufbyte init_str[MAX_EMCHAR_LEN];
+    Intbyte init_str[MAX_EMCHAR_LEN];
     int len = set_charptr_emchar (init_str, XCHAR (character));
     Lisp_Object val = make_uninit_string (len * XINT (length));
 
@@ -2043,11 +2043,11 @@
     else
       {
 	EMACS_INT i;
-	Bufbyte *ptr = XSTRING_DATA (val);
+	Intbyte *ptr = XSTRING_DATA (val);
 
 	for (i = XINT (length); i; i--)
 	  {
-	    Bufbyte *init_ptr = init_str;
+	    Intbyte *init_ptr = init_str;
 	    switch (len)
 	      {
 	      case 4: *ptr++ = *init_ptr++;
@@ -2066,8 +2066,8 @@
 */
        (int nargs, Lisp_Object *args))
 {
-  Bufbyte *storage = alloca_array (Bufbyte, nargs * MAX_EMCHAR_LEN);
-  Bufbyte *p = storage;
+  Intbyte *storage = alloca_array (Intbyte, nargs * MAX_EMCHAR_LEN);
+  Intbyte *p = storage;
 
   for (; nargs; nargs--, args++)
     {
@@ -2082,12 +2082,12 @@
 /* Take some raw memory, which MUST already be in internal format,
    and package it up into a Lisp string. */
 Lisp_Object
-make_string (const Bufbyte *contents, Bytecount length)
+make_string (const Intbyte *contents, Bytecount length)
 {
   Lisp_Object val;
 
   /* Make sure we find out about bad make_string's when they happen */
-#if defined (ERROR_CHECK_BUFPOS) && defined (MULE)
+#if defined (ERROR_CHECK_CHARBPOS) && defined (MULE)
   bytecount_to_charcount (contents, length); /* Just for the assertions */
 #endif
 
@@ -2110,10 +2110,10 @@
 }
 
 Lisp_Object
-build_string (const CBufbyte *str)
+build_string (const CIntbyte *str)
 {
   /* Some strlen's crash and burn if passed null. */
-  return make_string ((const Bufbyte *) str, (str ? strlen(str) : 0));
+  return make_string ((const Intbyte *) str, (str ? strlen(str) : 0));
 }
 
 Lisp_Object
@@ -2125,19 +2125,19 @@
 }
 
 Lisp_Object
-build_translated_string (const CBufbyte *str)
+build_translated_string (const CIntbyte *str)
 {
   return build_string (GETTEXT (str));
 }
 
 Lisp_Object
-make_string_nocopy (const Bufbyte *contents, Bytecount length)
+make_string_nocopy (const Intbyte *contents, Bytecount length)
 {
   Lisp_String *s;
   Lisp_Object val;
 
   /* Make sure we find out about bad make_string_nocopy's when they happen */
-#if defined (ERROR_CHECK_BUFPOS) && defined (MULE)
+#if defined (ERROR_CHECK_CHARBPOS) && defined (MULE)
   bytecount_to_charcount (contents, length); /* Just for the assertions */
 #endif
 
@@ -2146,7 +2146,7 @@
   set_lheader_implementation (&s->lheader, &lrecord_string);
   SET_C_READONLY_RECORD_HEADER (&s->lheader);
   s->plist = Qnil;
-  set_string_data (s, (Bufbyte *)contents);
+  set_string_data (s, (Intbyte *)contents);
   set_string_length (s, length);
 
   XSETSTRING (val, s);
@@ -2227,7 +2227,7 @@
 			       mark_lcrecord_list, internal_object_printer,
 			       0, 0, 0, 0, struct lcrecord_list);
 Lisp_Object
-make_lcrecord_list (Element_Count size,
+make_lcrecord_list (Elemcount size,
 		    const struct lrecord_implementation *implementation)
 {
   struct lcrecord_list *p = alloc_lcrecord_type (struct lcrecord_list,
@@ -2489,7 +2489,7 @@
       const struct lrecord_implementation *implementation =
 	LHEADER_IMPLEMENTATION (h);
 
-      Memory_Count sz = (implementation->size_in_bytes_method ?
+      Bytecount sz = (implementation->size_in_bytes_method ?
 		   implementation->size_in_bytes_method (h) :
 		   implementation->static_size);
       if (free_p)
@@ -3378,7 +3378,7 @@
 				  GETTEXT ((const char *) gc_default_message));
 	  args[1] = build_string ("...");
 	  whole_msg = Fconcat (2, args);
-	  echo_area_message (f, (Bufbyte *) 0, whole_msg, 0, -1,
+	  echo_area_message (f, (Intbyte *) 0, whole_msg, 0, -1,
 			     Qgarbage_collecting);
 	}
     }
@@ -3396,10 +3396,10 @@
     {
       /* Static buffer in which we save a copy of the C stack at each GC.  */
       static char *stack_copy;
-      static Memory_Count stack_copy_size;
+      static Bytecount stack_copy_size;
 
       ptrdiff_t stack_diff = &stack_top_variable - stack_bottom;
-      Memory_Count stack_size = (stack_diff > 0 ? stack_diff : -stack_diff);
+      Bytecount stack_size = (stack_diff > 0 ? stack_diff : -stack_diff);
       if (stack_size < MAX_SAVE_STACK)
 	{
 	  if (stack_copy_size < stack_size)
@@ -3424,14 +3424,14 @@
 
   { /* staticpro() */
     Lisp_Object **p = Dynarr_begin (staticpros);
-    Element_Count count;
+    Elemcount count;
     for (count = Dynarr_length (staticpros); count; count--)
       mark_object (**p++);
   }
 
   { /* staticpro_nodump() */
     Lisp_Object **p = Dynarr_begin (staticpros_nodump);
-    Element_Count count;
+    Elemcount count;
     for (count = Dynarr_length (staticpros_nodump); count; count--)
       mark_object (**p++);
   }
@@ -3538,7 +3538,7 @@
 					       gc_default_message));
 	      args[1] = build_string ("... done");
 	      whole_msg = Fconcat (2, args);
-	      echo_area_message (selected_frame (), (Bufbyte *) 0,
+	      echo_area_message (selected_frame (), (Intbyte *) 0,
 				 whole_msg, 0, -1,
 				 Qgarbage_collecting);
 	    }
@@ -3764,14 +3764,14 @@
        blocks are allocated in the minimum required size except
        that some minimum block size is imposed (e.g. 16 bytes). */
 
-Memory_Count
-malloced_storage_size (void *ptr, Memory_Count claimed_size,
+Bytecount
+malloced_storage_size (void *ptr, Bytecount claimed_size,
 		       struct overhead_stats *stats)
 {
-  Memory_Count orig_claimed_size = claimed_size;
+  Bytecount orig_claimed_size = claimed_size;
 
 #ifdef GNU_MALLOC
-  if (claimed_size < (Memory_Count) (2 * sizeof (void *)))
+  if (claimed_size < (Bytecount) (2 * sizeof (void *)))
     claimed_size = 2 * sizeof (void *);
 # ifdef SUNOS_LOCALTIME_BUG
   if (claimed_size < 16)
@@ -3796,7 +3796,7 @@
         }
       /* We have to come up with some average about the amount of
 	 blocks used. */
-      if ((Memory_Count) (rand () & 4095) < claimed_size)
+      if ((Bytecount) (rand () & 4095) < claimed_size)
 	claimed_size += 3 * sizeof (void *);
     }
   else
@@ -3847,12 +3847,12 @@
   return claimed_size;
 }
 
-Memory_Count
-fixed_type_block_overhead (Memory_Count size)
+Bytecount
+fixed_type_block_overhead (Bytecount size)
 {
-  Memory_Count per_block = TYPE_ALLOC_SIZE (cons, unsigned char);
-  Memory_Count overhead = 0;
-  Memory_Count storage_size = malloced_storage_size (0, per_block, 0);
+  Bytecount per_block = TYPE_ALLOC_SIZE (cons, unsigned char);
+  Bytecount overhead = 0;
+  Bytecount storage_size = malloced_storage_size (0, per_block, 0);
   while (size >= per_block)
     {
       size -= per_block;
--- a/src/blocktype.c	Tue Sep 18 05:06:57 2001 +0000
+++ b/src/blocktype.c	Thu Sep 20 06:31:11 2001 +0000
@@ -77,10 +77,10 @@
 };
 
 void *
-Blocktype_newf (Memory_Count elsize)
+Blocktype_newf (Bytecount elsize)
 {
   Blocktype *b = xnew (Blocktype);
-  b->elsize = max (elsize, (Memory_Count) sizeof (void *));
+  b->elsize = max (elsize, (Bytecount) sizeof (void *));
   b->free = 0;
   return (void *) b;
 }
--- a/src/blocktype.h	Tue Sep 18 05:06:57 2001 +0000
+++ b/src/blocktype.h	Thu Sep 20 06:31:11 2001 +0000
@@ -31,10 +31,10 @@
 
 #define Blocktype_declare(type)                                      \
   type *free;                                                        \
-  Memory_Count elsize;                                               \
+  Bytecount elsize;                                               \
   type *tempel
 
-void *Blocktype_newf (Memory_Count elsize);
+void *Blocktype_newf (Bytecount elsize);
 void Blocktype_allocf (void *b);
 void Blocktype_free (void *bbb, void *el);
 
--- a/src/buffer.c	Tue Sep 18 05:06:57 2001 +0000
+++ b/src/buffer.c	Thu Sep 20 06:31:11 2001 +0000
@@ -1134,7 +1134,7 @@
       killp = call1
 	(Qyes_or_no_p,
 	 (emacs_doprnt_string_c
-	  ((const Bufbyte *) GETTEXT ("Buffer %s modified; kill anyway? "),
+	  ((const Intbyte *) GETTEXT ("Buffer %s modified; kill anyway? "),
 	   Qnil, -1, XSTRING_DATA (b->name))));
       UNGCPRO;
       if (NILP (killp))
@@ -1299,7 +1299,7 @@
     uninit_buffer_extents (b);
     if (b->base_buffer)
       {
-#ifdef ERROR_CHECK_BUFPOS
+#ifdef ERROR_CHECK_CHARBPOS
 	assert (!NILP (memq_no_quit (buf, b->base_buffer->indirect_children)));
 #endif
 	b->base_buffer->indirect_children =
@@ -1518,7 +1518,7 @@
        (buffer, start, end))
 {
   struct buffer *b = decode_buffer (buffer, 0);
-  Bufpos s, e;
+  Charbpos s, e;
 
   if (NILP (start))
     s = e = -1;
@@ -1672,12 +1672,12 @@
   int other;
 };
 
-static Memory_Count
+static Bytecount
 compute_buffer_text_usage (struct buffer *b, struct overhead_stats *ovstats)
 {
   int was_requested = b->text->z - 1;
-  Memory_Count gap = b->text->gap_size + b->text->end_gap_size;
-  Memory_Count malloc_use = malloced_storage_size (b->text->beg, was_requested + gap, 0);
+  Bytecount gap = b->text->gap_size + b->text->end_gap_size;
+  Bytecount malloc_use = malloced_storage_size (b->text->beg, was_requested + gap, 0);
 
   ovstats->gap_overhead    += gap;
   ovstats->was_requested   += was_requested;
@@ -1765,8 +1765,8 @@
 
 typedef struct
 {
-  Dynarr_declare (Bufbyte_dynarr *);
-} Bufbyte_dynarr_dynarr;
+  Dynarr_declare (Intbyte_dynarr *);
+} Intbyte_dynarr_dynarr;
 
 typedef struct
 {
@@ -1774,7 +1774,7 @@
 } Extbyte_dynarr_dynarr;
 
 static Extbyte_dynarr_dynarr *conversion_out_dynarr_list;
-static Bufbyte_dynarr_dynarr *conversion_in_dynarr_list;
+static Intbyte_dynarr_dynarr *conversion_in_dynarr_list;
 
 static int dfc_convert_to_external_format_in_use;
 static int dfc_convert_to_internal_format_in_use;
@@ -1836,7 +1836,7 @@
       sink_type   != DFC_TYPE_LISP_LSTREAM &&
       coding_system_is_binary (coding_system))
     {
-      const Bufbyte *ptr;
+      const Intbyte *ptr;
       Bytecount len;
 
       if (source_type == DFC_TYPE_LISP_STRING)
@@ -1846,16 +1846,16 @@
 	}
       else
 	{
-	  ptr = (Bufbyte *) source->data.ptr;
+	  ptr = (Intbyte *) source->data.ptr;
 	  len = source->data.len;
 	}
 
 #ifdef MULE
       {
-	const Bufbyte *end;
+	const Intbyte *end;
 	for (end = ptr + len; ptr < end;)
 	  {
-	    Bufbyte c =
+	    Intbyte c =
 	      (BYTE_ASCII_P (*ptr))		   ? *ptr :
 	      (*ptr == LEADING_BYTE_CONTROL_1)	   ? (*(ptr+1) - 0x20) :
 	      (*ptr == LEADING_BYTE_LATIN_ISO8859_1) ? (*(ptr+1)) :
@@ -1864,7 +1864,7 @@
 	    Dynarr_add (conversion_out_dynarr, (Extbyte) c);
 	    INC_CHARPTR (ptr);
 	  }
-	bufpos_checking_assert (ptr == end);
+	charbpos_checking_assert (ptr == end);
       }
 #else
       Dynarr_add_many (conversion_out_dynarr, ptr, len);
@@ -1913,7 +1913,7 @@
 
       while (1)
         {
-          Lstream_Data_Count size_in_bytes;
+          Bytecount size_in_bytes;
 	  char tempbuf[1024]; /* some random amount */
 
 	  size_in_bytes = Lstream_read (reader, tempbuf, sizeof (tempbuf));
@@ -1959,7 +1959,7 @@
 				dfc_conversion_data *sink)
 {
   int count = specpdl_depth ();
-  Bufbyte_dynarr *conversion_in_dynarr;
+  Intbyte_dynarr *conversion_in_dynarr;
 
   type_checking_assert
     ((source_type == DFC_TYPE_DATA ||
@@ -1972,7 +1972,7 @@
 			 make_int (dfc_convert_to_internal_format_in_use));
   if (Dynarr_length (conversion_in_dynarr_list) <=
       dfc_convert_to_internal_format_in_use)
-    Dynarr_add (conversion_in_dynarr_list, Dynarr_new (Bufbyte));
+    Dynarr_add (conversion_in_dynarr_list, Dynarr_new (Intbyte));
   conversion_in_dynarr = Dynarr_at (conversion_in_dynarr_list,
 				    dfc_convert_to_internal_format_in_use);
   dfc_convert_to_internal_format_in_use++;
@@ -1987,13 +1987,13 @@
       coding_system_is_binary (coding_system))
     {
 #ifdef MULE
-      const Bufbyte *ptr = (const Bufbyte *) source->data.ptr;
+      const Intbyte *ptr = (const Intbyte *) source->data.ptr;
       Bytecount len = source->data.len;
-      const Bufbyte *end = ptr + len;
+      const Intbyte *end = ptr + len;
 
       for (; ptr < end; ptr++)
         {
-          Bufbyte c = *ptr;
+          Intbyte c = *ptr;
 
 	  if (BYTE_ASCII_P (c))
 	    Dynarr_add (conversion_in_dynarr, c);
@@ -2051,7 +2051,7 @@
 
       while (1)
         {
-          Lstream_Data_Count size_in_bytes;
+          Bytecount size_in_bytes;
 	  char tempbuf[1024]; /* some random amount */
 
 	  size_in_bytes = Lstream_read (reader, tempbuf, sizeof (tempbuf));
@@ -2161,8 +2161,8 @@
 void
 reinit_vars_of_buffer (void)
 {
-  conversion_in_dynarr_list = Dynarr_new2 (Bufbyte_dynarr_dynarr,
-					   Bufbyte_dynarr *);
+  conversion_in_dynarr_list = Dynarr_new2 (Intbyte_dynarr_dynarr,
+					   Intbyte_dynarr *);
   conversion_out_dynarr_list = Dynarr_new2 (Extbyte_dynarr_dynarr,
 					    Extbyte_dynarr *);
 
@@ -3038,7 +3038,7 @@
 static int
 directory_is_current_directory (Extbyte *pwd)
 {
-  Bufbyte *pwd_internal;
+  Intbyte *pwd_internal;
   Bytecount pwd_internal_len;
   struct stat dotstat, pwdstat;
 
--- a/src/buffer.h	Tue Sep 18 05:06:57 2001 +0000
+++ b/src/buffer.h	Thu Sep 20 06:31:11 2001 +0000
@@ -45,10 +45,10 @@
 /*                                                                      */
 /************************************************************************/
 
-/* Note: we keep both Bytind and Bufpos versions of some of the
+/* Note: we keep both Bytebpos and Charbpos versions of some of the
    important buffer positions because they are accessed so much.
    If we didn't do this, we would constantly be invalidating the
-   bufpos<->bytind cache under Mule.
+   charbpos<->bytebpos cache under Mule.
 
    Note that under non-Mule, both versions will always be the
    same so we don't really need to keep track of them.  But it
@@ -79,12 +79,12 @@
 
 struct buffer_text
 {
-  Bufbyte *beg;		/* Actual address of buffer contents. */
-  Bytind gpt;		/* Index of gap in buffer. */
-  Bytind z;		/* Index of end of buffer. */
-  Bufpos bufz;		/* Equivalent as a Bufpos. */
-  Memory_Count gap_size;/* Size of buffer's gap */
-  Memory_Count end_gap_size;/* Size of buffer's end gap */
+  Intbyte *beg;		/* Actual address of buffer contents. */
+  Bytebpos gpt;		/* Index of gap in buffer. */
+  Bytebpos z;		/* Index of end of buffer. */
+  Charbpos bufz;		/* Equivalent as a Charbpos. */
+  Bytecount gap_size;/* Size of buffer's gap */
+  Bytecount end_gap_size;/* Size of buffer's end gap */
   long modiff;		/* This counts buffer-modification events
 			   for this buffer.  It is incremented for
 			   each such event, and never otherwise
@@ -95,14 +95,14 @@
 #ifdef MULE
   /* We keep track of a "known" region for very fast access.
      This information is text-only so it goes here. */
-  Bufpos mule_bufmin, mule_bufmax;
-  Bytind mule_bytmin, mule_bytmax;
+  Charbpos mule_bufmin, mule_bufmax;
+  Bytebpos mule_bytmin, mule_bytmax;
   int mule_shifter, mule_three_p;
 
   /* And we also cache 16 positions for fairly fast access near those
      positions. */
-  Bufpos mule_bufpos_cache[16];
-  Bytind mule_bytind_cache[16];
+  Charbpos mule_charbpos_cache[16];
+  Bytebpos mule_bytebpos_cache[16];
 #endif
 
   /* Similar to the above, we keep track of positions for which line
@@ -127,12 +127,12 @@
      In an indirect buffer, this is the own_text field of another buffer.  */
   struct buffer_text *text;
 
-  Bytind pt;		/* Position of point in buffer. */
-  Bufpos bufpt;		/* Equivalent as a Bufpos. */
-  Bytind begv;		/* Index of beginning of accessible range. */
-  Bufpos bufbegv;	/* Equivalent as a Bufpos. */
-  Bytind zv;		/* Index of end of accessible range. */
-  Bufpos bufzv;		/* Equivalent as a Bufpos. */
+  Bytebpos pt;		/* Position of point in buffer. */
+  Charbpos bufpt;		/* Equivalent as a Charbpos. */
+  Bytebpos begv;		/* Index of beginning of accessible range. */
+  Charbpos bufbegv;	/* Equivalent as a Charbpos. */
+  Bytebpos zv;		/* Index of end of accessible range. */
+  Charbpos bufzv;		/* Equivalent as a Charbpos. */
 
   int face_change;	/* This is set when a change in how the text should
 			   be displayed (e.g., font, color) is made. */
@@ -394,12 +394,12 @@
 /* ---------------------------------------------------------------------- */
 
 #ifdef MULE
-# define VALID_CHARPTR_P(ptr) BUFBYTE_FIRST_BYTE_P (* (unsigned char *) ptr)
+# define VALID_CHARPTR_P(ptr) INTBYTE_FIRST_BYTE_P (* (unsigned char *) ptr)
 #else
 # define VALID_CHARPTR_P(ptr) 1
 #endif
 
-#ifdef ERROR_CHECK_BUFPOS
+#ifdef ERROR_CHECK_CHARBPOS
 # define ASSERT_VALID_CHARPTR(ptr) assert (VALID_CHARPTR_P (ptr))
 #else
 # define ASSERT_VALID_CHARPTR(ptr)
@@ -415,38 +415,38 @@
 #define REAL_INC_CHARPTR(ptr) \
   ((void) ((ptr) += REP_BYTES_BY_FIRST_BYTE (* (unsigned char *) (ptr))))
 
-#define REAL_INC_CHARBYTIND(ptr, pos) \
+#define REAL_INC_CHARBYTEBPOS(ptr, pos) \
   (pos += REP_BYTES_BY_FIRST_BYTE (* (unsigned char *) (ptr)))
 
 #define REAL_DEC_CHARPTR(ptr) do {	\
   (ptr)--;				\
 } while (!VALID_CHARPTR_P (ptr))
 
-#ifdef ERROR_CHECK_BUFPOS
+#ifdef ERROR_CHECK_CHARBPOS
 #define INC_CHARPTR(ptr) do {		\
   ASSERT_VALID_CHARPTR (ptr);		\
   REAL_INC_CHARPTR (ptr);		\
 } while (0)
 
-#define INC_CHARBYTIND(ptr, pos) do {		\
+#define INC_CHARBYTEBPOS(ptr, pos) do {		\
   ASSERT_VALID_CHARPTR (ptr);			\
-  REAL_INC_CHARBYTIND (ptr, pos);		\
+  REAL_INC_CHARBYTEBPOS (ptr, pos);		\
 } while (0)
 
 #define DEC_CHARPTR(ptr) do {			\
-  const Bufbyte *dc_ptr1 = (ptr);		\
-  const Bufbyte *dc_ptr2 = dc_ptr1;		\
+  const Intbyte *dc_ptr1 = (ptr);		\
+  const Intbyte *dc_ptr2 = dc_ptr1;		\
   REAL_DEC_CHARPTR (dc_ptr2);			\
   assert (dc_ptr1 - dc_ptr2 ==			\
 	  REP_BYTES_BY_FIRST_BYTE (*dc_ptr2));	\
-  (ptr) = (Bufbyte *) dc_ptr2;			\
+  (ptr) = (Intbyte *) dc_ptr2;			\
 } while (0)
 
-#else /* ! ERROR_CHECK_BUFPOS */
-#define INC_CHARBYTIND(ptr, pos) REAL_INC_CHARBYTIND (ptr, pos)
+#else /* ! ERROR_CHECK_CHARBPOS */
+#define INC_CHARBYTEBPOS(ptr, pos) REAL_INC_CHARBYTEBPOS (ptr, pos)
 #define INC_CHARPTR(ptr) REAL_INC_CHARPTR (ptr)
 #define DEC_CHARPTR(ptr) REAL_DEC_CHARPTR (ptr)
-#endif /* ! ERROR_CHECK_BUFPOS */
+#endif /* ! ERROR_CHECK_CHARBPOS */
 
 #ifdef MULE
 
@@ -458,7 +458,7 @@
    the end of the string. */
 
 #define VALIDATE_CHARPTR_FORWARD(ptr) do {	\
-  Bufbyte *vcf_ptr = (ptr);			\
+  Intbyte *vcf_ptr = (ptr);			\
   VALIDATE_CHARPTR_BACKWARD (vcf_ptr);		\
   if (vcf_ptr != (ptr))				\
     {						\
@@ -477,10 +477,10 @@
 /*     section of internally-formatted text 			  */
 /* -------------------------------------------------------------- */
 
-INLINE_HEADER const Bufbyte *
-charptr_n_addr (const Bufbyte *ptr, Charcount offset);
-INLINE_HEADER const Bufbyte *
-charptr_n_addr (const Bufbyte *ptr, Charcount offset)
+INLINE_HEADER const Intbyte *
+charptr_n_addr (const Intbyte *ptr, Charcount offset);
+INLINE_HEADER const Intbyte *
+charptr_n_addr (const Intbyte *ptr, Charcount offset)
 {
   return ptr + charcount_to_bytecount (ptr, offset);
 }
@@ -490,27 +490,27 @@
 /* -------------------------------------------------------------------- */
 
 #define simple_charptr_emchar(ptr)		((Emchar) (ptr)[0])
-#define simple_set_charptr_emchar(ptr, x)	((ptr)[0] = (Bufbyte) (x), 1)
+#define simple_set_charptr_emchar(ptr, x)	((ptr)[0] = (Intbyte) (x), 1)
 #define simple_charptr_copy_char(ptr, ptr2)	((ptr2)[0] = *(ptr), 1)
 
 #ifdef MULE
 
-Emchar non_ascii_charptr_emchar (const Bufbyte *ptr);
-Bytecount non_ascii_set_charptr_emchar (Bufbyte *ptr, Emchar c);
-Bytecount non_ascii_charptr_copy_char (const Bufbyte *src, Bufbyte *dst);
+Emchar non_ascii_charptr_emchar (const Intbyte *ptr);
+Bytecount non_ascii_set_charptr_emchar (Intbyte *ptr, Emchar c);
+Bytecount non_ascii_charptr_copy_char (const Intbyte *src, Intbyte *dst);
 
-INLINE_HEADER Emchar charptr_emchar (const Bufbyte *ptr);
+INLINE_HEADER Emchar charptr_emchar (const Intbyte *ptr);
 INLINE_HEADER Emchar
-charptr_emchar (const Bufbyte *ptr)
+charptr_emchar (const Intbyte *ptr)
 {
   return BYTE_ASCII_P (*ptr) ?
     simple_charptr_emchar (ptr) :
     non_ascii_charptr_emchar (ptr);
 }
 
-INLINE_HEADER Bytecount set_charptr_emchar (Bufbyte *ptr, Emchar x);
+INLINE_HEADER Bytecount set_charptr_emchar (Intbyte *ptr, Emchar x);
 INLINE_HEADER Bytecount
-set_charptr_emchar (Bufbyte *ptr, Emchar x)
+set_charptr_emchar (Intbyte *ptr, Emchar x)
 {
   return !CHAR_MULTIBYTE_P (x) ?
     simple_set_charptr_emchar (ptr, x) :
@@ -520,9 +520,9 @@
 /* Copy the character pointed to by SRC into DST.
    Return the number of bytes copied.  */
 INLINE_HEADER Bytecount
-charptr_copy_char (const Bufbyte *src, Bufbyte *dst);
+charptr_copy_char (const Intbyte *src, Intbyte *dst);
 INLINE_HEADER Bytecount
-charptr_copy_char (const Bufbyte *src, Bufbyte *dst)
+charptr_copy_char (const Intbyte *src, Intbyte *dst)
 {
   return BYTE_ASCII_P (*src) ?
     simple_charptr_copy_char (src, dst) :
@@ -600,8 +600,8 @@
    the positions. */
 
 /* Beginning of buffer.  */
-#define BI_BUF_BEG(buf) ((Bytind) 1)
-#define BUF_BEG(buf) ((Bufpos) 1)
+#define BI_BUF_BEG(buf) ((Bytebpos) 1)
+#define BUF_BEG(buf) ((Charbpos) 1)
 
 /* Beginning of accessible range of buffer.  */
 #define BI_BUF_BEGV(buf) ((buf)->begv + 0)
@@ -624,9 +624,9 @@
 /*----------------------------------------------------------------------*/
 
 /* Convert the address of a byte in the buffer into a position.  */
-INLINE_HEADER Bytind BI_BUF_PTR_BYTE_POS (struct buffer *buf, Bufbyte *ptr);
-INLINE_HEADER Bytind
-BI_BUF_PTR_BYTE_POS (struct buffer *buf, Bufbyte *ptr)
+INLINE_HEADER Bytebpos BI_BUF_PTR_BYTE_POS (struct buffer *buf, Intbyte *ptr);
+INLINE_HEADER Bytebpos
+BI_BUF_PTR_BYTE_POS (struct buffer *buf, Intbyte *ptr)
 {
   return (ptr - buf->text->beg + 1
 	  - ((ptr - buf->text->beg + 1) > buf->text->gpt
@@ -634,12 +634,12 @@
 }
 
 #define BUF_PTR_BYTE_POS(buf, ptr) \
-  bytind_to_bufpos (buf, BI_BUF_PTR_BYTE_POS (buf, ptr))
+  bytebpos_to_charbpos (buf, BI_BUF_PTR_BYTE_POS (buf, ptr))
 
 /* Address of byte at position POS in buffer. */
-INLINE_HEADER Bufbyte * BI_BUF_BYTE_ADDRESS (struct buffer *buf, Bytind pos);
-INLINE_HEADER Bufbyte *
-BI_BUF_BYTE_ADDRESS (struct buffer *buf, Bytind pos)
+INLINE_HEADER Intbyte * BI_BUF_BYTE_ADDRESS (struct buffer *buf, Bytebpos pos);
+INLINE_HEADER Intbyte *
+BI_BUF_BYTE_ADDRESS (struct buffer *buf, Bytebpos pos)
 {
   return (buf->text->beg +
 	  ((pos >= buf->text->gpt ? (pos + buf->text->gap_size) : pos)
@@ -647,12 +647,12 @@
 }
 
 #define BUF_BYTE_ADDRESS(buf, pos) \
-  BI_BUF_BYTE_ADDRESS (buf, bufpos_to_bytind (buf, pos))
+  BI_BUF_BYTE_ADDRESS (buf, charbpos_to_bytebpos (buf, pos))
 
 /* Address of byte before position POS in buffer. */
-INLINE_HEADER Bufbyte * BI_BUF_BYTE_ADDRESS_BEFORE (struct buffer *buf, Bytind pos);
-INLINE_HEADER Bufbyte *
-BI_BUF_BYTE_ADDRESS_BEFORE (struct buffer *buf, Bytind pos)
+INLINE_HEADER Intbyte * BI_BUF_BYTE_ADDRESS_BEFORE (struct buffer *buf, Bytebpos pos);
+INLINE_HEADER Intbyte *
+BI_BUF_BYTE_ADDRESS_BEFORE (struct buffer *buf, Bytebpos pos)
 {
   return (buf->text->beg +
 	  ((pos > buf->text->gpt ? (pos + buf->text->gap_size) : pos)
@@ -660,79 +660,79 @@
 }
 
 #define BUF_BYTE_ADDRESS_BEFORE(buf, pos) \
-  BI_BUF_BYTE_ADDRESS_BEFORE (buf, bufpos_to_bytind (buf, pos))
+  BI_BUF_BYTE_ADDRESS_BEFORE (buf, charbpos_to_bytebpos (buf, pos))
 
 /*----------------------------------------------------------------------*/
 /*	    Converting between byte indices and memory indices		*/
 /*----------------------------------------------------------------------*/
 
-INLINE_HEADER int valid_memind_p (struct buffer *buf, Memind x);
+INLINE_HEADER int valid_membpos_p (struct buffer *buf, Membpos x);
 INLINE_HEADER int
-valid_memind_p (struct buffer *buf, Memind x)
+valid_membpos_p (struct buffer *buf, Membpos x)
 {
-  return ((x >= 1 && x <= (Memind) buf->text->gpt) ||
-	  (x  > (Memind) (buf->text->gpt + buf->text->gap_size) &&
-	   x <= (Memind) (buf->text->z   + buf->text->gap_size)));
+  return ((x >= 1 && x <= (Membpos) buf->text->gpt) ||
+	  (x  > (Membpos) (buf->text->gpt + buf->text->gap_size) &&
+	   x <= (Membpos) (buf->text->z   + buf->text->gap_size)));
 }
 
-INLINE_HEADER Memind bytind_to_memind (struct buffer *buf, Bytind x);
-INLINE_HEADER Memind
-bytind_to_memind (struct buffer *buf, Bytind x)
+INLINE_HEADER Membpos bytebpos_to_membpos (struct buffer *buf, Bytebpos x);
+INLINE_HEADER Membpos
+bytebpos_to_membpos (struct buffer *buf, Bytebpos x)
 {
-  return (Memind) ((x > buf->text->gpt) ? (x + buf->text->gap_size) : x);
+  return (Membpos) ((x > buf->text->gpt) ? (x + buf->text->gap_size) : x);
 }
 
 
-INLINE_HEADER Bytind memind_to_bytind (struct buffer *buf, Memind x);
-INLINE_HEADER Bytind
-memind_to_bytind (struct buffer *buf, Memind x)
+INLINE_HEADER Bytebpos membpos_to_bytebpos (struct buffer *buf, Membpos x);
+INLINE_HEADER Bytebpos
+membpos_to_bytebpos (struct buffer *buf, Membpos x)
 {
-#ifdef ERROR_CHECK_BUFPOS
-  assert (valid_memind_p (buf, x));
+#ifdef ERROR_CHECK_CHARBPOS
+  assert (valid_membpos_p (buf, x));
 #endif
-  return (Bytind) ((x > (Memind) buf->text->gpt) ?
+  return (Bytebpos) ((x > (Membpos) buf->text->gpt) ?
 		   x - buf->text->gap_size :
 		   x);
 }
 
-#define memind_to_bufpos(buf, x) \
-  bytind_to_bufpos (buf, memind_to_bytind (buf, x))
-#define bufpos_to_memind(buf, x) \
-  bytind_to_memind (buf, bufpos_to_bytind (buf, x))
+#define membpos_to_charbpos(buf, x) \
+  bytebpos_to_charbpos (buf, membpos_to_bytebpos (buf, x))
+#define charbpos_to_membpos(buf, x) \
+  bytebpos_to_membpos (buf, charbpos_to_bytebpos (buf, x))
 
 /* These macros generalize many standard buffer-position functions to
    either a buffer or a string. */
 
-/* Converting between Meminds and Bytinds, for a buffer-or-string.
+/* Converting between Membposs and Bytebposs, for a buffer-or-string.
    For strings, this is a no-op.  For buffers, this resolves
-   to the standard memind<->bytind converters. */
+   to the standard membpos<->bytebpos converters. */
 
-#define buffer_or_string_bytind_to_memind(obj, ind) \
-  (BUFFERP (obj) ? bytind_to_memind (XBUFFER (obj), ind) : (Memind) ind)
+#define buffer_or_string_bytebpos_to_membpos(obj, ind) \
+  (BUFFERP (obj) ? bytebpos_to_membpos (XBUFFER (obj), ind) : (Membpos) ind)
 
-#define buffer_or_string_memind_to_bytind(obj, ind) \
-  (BUFFERP (obj) ? memind_to_bytind (XBUFFER (obj), ind) : (Bytind) ind)
+#define buffer_or_string_membpos_to_bytebpos(obj, ind) \
+  (BUFFERP (obj) ? membpos_to_bytebpos (XBUFFER (obj), ind) : (Bytebpos) ind)
 
-/* Converting between Bufpos's and Bytinds, for a buffer-or-string.
+/* Converting between Charbpos's and Bytebposs, for a buffer-or-string.
    For strings, this maps to the bytecount<->charcount converters. */
 
-#define buffer_or_string_bufpos_to_bytind(obj, pos)		\
-  (BUFFERP (obj) ? bufpos_to_bytind (XBUFFER (obj), pos) :	\
-   (Bytind) charcount_to_bytecount (XSTRING_DATA (obj), pos))
+#define buffer_or_string_charbpos_to_bytebpos(obj, pos)		\
+  (BUFFERP (obj) ? charbpos_to_bytebpos (XBUFFER (obj), pos) :	\
+   (Bytebpos) charcount_to_bytecount (XSTRING_DATA (obj), pos))
 
-#define buffer_or_string_bytind_to_bufpos(obj, ind)		\
-  (BUFFERP (obj) ? bytind_to_bufpos (XBUFFER (obj), ind) :	\
-   (Bufpos) bytecount_to_charcount (XSTRING_DATA (obj), ind))
+#define buffer_or_string_bytebpos_to_charbpos(obj, ind)		\
+  (BUFFERP (obj) ? bytebpos_to_charbpos (XBUFFER (obj), ind) :	\
+   (Charbpos) bytecount_to_charcount (XSTRING_DATA (obj), ind))
 
-/* Similar for Bufpos's and Meminds. */
+/* Similar for Charbpos's and Membposs. */
 
-#define buffer_or_string_bufpos_to_memind(obj, pos)		\
-  (BUFFERP (obj) ? bufpos_to_memind (XBUFFER (obj), pos) :	\
-   (Memind) charcount_to_bytecount (XSTRING_DATA (obj), pos))
+#define buffer_or_string_charbpos_to_membpos(obj, pos)		\
+  (BUFFERP (obj) ? charbpos_to_membpos (XBUFFER (obj), pos) :	\
+   (Membpos) charcount_to_bytecount (XSTRING_DATA (obj), pos))
 
-#define buffer_or_string_memind_to_bufpos(obj, ind)		\
-  (BUFFERP (obj) ? memind_to_bufpos (XBUFFER (obj), ind) :	\
-   (Bufpos) bytecount_to_charcount (XSTRING_DATA (obj), ind))
+#define buffer_or_string_membpos_to_charbpos(obj, ind)		\
+  (BUFFERP (obj) ? membpos_to_charbpos (XBUFFER (obj), ind) :	\
+   (Charbpos) bytecount_to_charcount (XSTRING_DATA (obj), ind))
 
 /************************************************************************/
 /*                                                                      */
@@ -745,68 +745,68 @@
    (A) Working with byte indices:
    ------------------------------
 
-   VALID_BYTIND_P(buf, bi):
+   VALID_BYTEBPOS_P(buf, bi):
 	Given a byte index, does it point to the beginning of a character?
 
-   ASSERT_VALID_BYTIND_UNSAFE(buf, bi):
+   ASSERT_VALID_BYTEBPOS_UNSAFE(buf, bi):
 	If error-checking is enabled, assert that the given byte index
 	is within range and points to the beginning of a character
 	or to the end of the buffer.  Otherwise, do nothing.
 
-   ASSERT_VALID_BYTIND_BACKWARD_UNSAFE(buf, bi):
+   ASSERT_VALID_BYTEBPOS_BACKWARD_UNSAFE(buf, bi):
 	If error-checking is enabled, assert that the given byte index
-	is within range and satisfies ASSERT_VALID_BYTIND() and also
+	is within range and satisfies ASSERT_VALID_BYTEBPOS() and also
         does not refer to the beginning of the buffer. (i.e. movement
 	backwards is OK.) Otherwise, do nothing.
 
-   ASSERT_VALID_BYTIND_FORWARD_UNSAFE(buf, bi):
+   ASSERT_VALID_BYTEBPOS_FORWARD_UNSAFE(buf, bi):
 	If error-checking is enabled, assert that the given byte index
-	is within range and satisfies ASSERT_VALID_BYTIND() and also
+	is within range and satisfies ASSERT_VALID_BYTEBPOS() and also
         does not refer to the end of the buffer. (i.e. movement
 	forwards is OK.) Otherwise, do nothing.
 
-   VALIDATE_BYTIND_BACKWARD(buf, bi):
+   VALIDATE_BYTEBPOS_BACKWARD(buf, bi):
 	Make sure that the given byte index is pointing to the beginning
 	of a character.  If not, back up until this is the case.  Note
 	that there are not too many places where it is legitimate to do
 	this sort of thing.  It's an error if you're passed an "invalid"
 	byte index.
 
-   VALIDATE_BYTIND_FORWARD(buf, bi):
+   VALIDATE_BYTEBPOS_FORWARD(buf, bi):
 	Make sure that the given byte index is pointing to the beginning
 	of a character.  If not, move forward until this is the case.
 	Note that there are not too many places where it is legitimate
 	to do this sort of thing.  It's an error if you're passed an
 	"invalid" byte index.
 
-   INC_BYTIND(buf, bi):
+   INC_BYTEBPOS(buf, bi):
 	Given a byte index (assumed to point at the beginning of a
 	character), modify that value so it points to the beginning
 	of the next character.
 
-   DEC_BYTIND(buf, bi):
+   DEC_BYTEBPOS(buf, bi):
 	Given a byte index (assumed to point at the beginning of a
 	character), modify that value so it points to the beginning
 	of the previous character.  Unlike for DEC_CHARPTR(), we can
 	do all the assert()s because there are sentinels at the
 	beginning of the gap and the end of the buffer.
 
-   BYTIND_INVALID:
-	A constant representing an invalid Bytind.  Valid Bytinds
+   BYTEBPOS_INVALID:
+	A constant representing an invalid Bytebpos.  Valid Bytebposs
 	can never have this value.
 
 
-   (B) Converting between Bufpos's and Bytinds:
+   (B) Converting between Charbpos's and Bytebposs:
    --------------------------------------------
 
-    bufpos_to_bytind(buf, bu):
-	Given a Bufpos, return the equivalent Bytind.
+    charbpos_to_bytebpos(buf, bu):
+	Given a Charbpos, return the equivalent Bytebpos.
 
-    bytind_to_bufpos(buf, bi):
-	Given a Bytind, return the equivalent Bufpos.
+    bytebpos_to_charbpos(buf, bi):
+	Given a Bytebpos, return the equivalent Charbpos.
 
-    make_bufpos(buf, bi):
-	Given a Bytind, return the equivalent Bufpos as a Lisp Object.
+    make_charbpos(buf, bi):
+	Given a Bytebpos, return the equivalent Charbpos as a Lisp Object.
  */
 
 
@@ -815,36 +815,36 @@
 /*----------------------------------------------------------------------*/
 
 #ifdef MULE
-# define VALID_BYTIND_P(buf, x) \
-  BUFBYTE_FIRST_BYTE_P (*BI_BUF_BYTE_ADDRESS (buf, x))
+# define VALID_BYTEBPOS_P(buf, x) \
+  INTBYTE_FIRST_BYTE_P (*BI_BUF_BYTE_ADDRESS (buf, x))
 #else
-# define VALID_BYTIND_P(buf, x) 1
+# define VALID_BYTEBPOS_P(buf, x) 1
 #endif
 
-#ifdef ERROR_CHECK_BUFPOS
+#ifdef ERROR_CHECK_CHARBPOS
 
-# define ASSERT_VALID_BYTIND_UNSAFE(buf, x) do {		\
+# define ASSERT_VALID_BYTEBPOS_UNSAFE(buf, x) do {		\
   assert (BUFFER_LIVE_P (buf));					\
   assert ((x) >= BI_BUF_BEG (buf) && x <= BI_BUF_Z (buf));	\
-  assert (VALID_BYTIND_P (buf, x));				\
+  assert (VALID_BYTEBPOS_P (buf, x));				\
 } while (0)
-# define ASSERT_VALID_BYTIND_BACKWARD_UNSAFE(buf, x) do {	\
+# define ASSERT_VALID_BYTEBPOS_BACKWARD_UNSAFE(buf, x) do {	\
   assert (BUFFER_LIVE_P (buf));					\
   assert ((x) > BI_BUF_BEG (buf) && x <= BI_BUF_Z (buf));	\
-  assert (VALID_BYTIND_P (buf, x));				\
+  assert (VALID_BYTEBPOS_P (buf, x));				\
 } while (0)
-# define ASSERT_VALID_BYTIND_FORWARD_UNSAFE(buf, x) do {	\
+# define ASSERT_VALID_BYTEBPOS_FORWARD_UNSAFE(buf, x) do {	\
   assert (BUFFER_LIVE_P (buf));					\
   assert ((x) >= BI_BUF_BEG (buf) && x < BI_BUF_Z (buf));	\
-  assert (VALID_BYTIND_P (buf, x));				\
+  assert (VALID_BYTEBPOS_P (buf, x));				\
 } while (0)
 
-#else /* not ERROR_CHECK_BUFPOS */
-# define ASSERT_VALID_BYTIND_UNSAFE(buf, x)
-# define ASSERT_VALID_BYTIND_BACKWARD_UNSAFE(buf, x)
-# define ASSERT_VALID_BYTIND_FORWARD_UNSAFE(buf, x)
+#else /* not ERROR_CHECK_CHARBPOS */
+# define ASSERT_VALID_BYTEBPOS_UNSAFE(buf, x)
+# define ASSERT_VALID_BYTEBPOS_BACKWARD_UNSAFE(buf, x)
+# define ASSERT_VALID_BYTEBPOS_FORWARD_UNSAFE(buf, x)
 
-#endif /* not ERROR_CHECK_BUFPOS */
+#endif /* not ERROR_CHECK_CHARBPOS */
 
 /* Note that, although the Mule version will work fine for non-Mule
    as well (it should reduce down to nothing), we provide a separate
@@ -852,13 +852,13 @@
    results with stupid compilers. */
 
 #ifdef MULE
-# define VALIDATE_BYTIND_BACKWARD(buf, x) do {		\
-  Bufbyte *VBB_ptr = BI_BUF_BYTE_ADDRESS (buf, x);	\
-  while (!BUFBYTE_FIRST_BYTE_P (*VBB_ptr))		\
+# define VALIDATE_BYTEBPOS_BACKWARD(buf, x) do {		\
+  Intbyte *VBB_ptr = BI_BUF_BYTE_ADDRESS (buf, x);	\
+  while (!INTBYTE_FIRST_BYTE_P (*VBB_ptr))		\
     VBB_ptr--, (x)--;					\
 } while (0)
 #else
-# define VALIDATE_BYTIND_BACKWARD(buf, x)
+# define VALIDATE_BYTEBPOS_BACKWARD(buf, x)
 #endif
 
 /* Note that, although the Mule version will work fine for non-Mule
@@ -867,60 +867,60 @@
    results with stupid compilers. */
 
 #ifdef MULE
-# define VALIDATE_BYTIND_FORWARD(buf, x) do {		\
-  Bufbyte *VBF_ptr = BI_BUF_BYTE_ADDRESS (buf, x);	\
-  while (!BUFBYTE_FIRST_BYTE_P (*VBF_ptr))		\
+# define VALIDATE_BYTEBPOS_FORWARD(buf, x) do {		\
+  Intbyte *VBF_ptr = BI_BUF_BYTE_ADDRESS (buf, x);	\
+  while (!INTBYTE_FIRST_BYTE_P (*VBF_ptr))		\
     VBF_ptr++, (x)++;					\
 } while (0)
 #else
-# define VALIDATE_BYTIND_FORWARD(buf, x)
+# define VALIDATE_BYTEBPOS_FORWARD(buf, x)
 #endif
 
-/* Note that in the simplest case (no MULE, no ERROR_CHECK_BUFPOS),
+/* Note that in the simplest case (no MULE, no ERROR_CHECK_CHARBPOS),
    this crap reduces down to simply (x)++. */
 
-#define INC_BYTIND(buf, x) do				\
+#define INC_BYTEBPOS(buf, x) do				\
 {							\
-  ASSERT_VALID_BYTIND_FORWARD_UNSAFE (buf, x);		\
+  ASSERT_VALID_BYTEBPOS_FORWARD_UNSAFE (buf, x);		\
   /* Note that we do the increment first to		\
      make sure that the pointer in			\
-     VALIDATE_BYTIND_FORWARD() ends up on		\
+     VALIDATE_BYTEBPOS_FORWARD() ends up on		\
      the correct side of the gap */			\
   (x)++;						\
-  VALIDATE_BYTIND_FORWARD (buf, x);			\
+  VALIDATE_BYTEBPOS_FORWARD (buf, x);			\
 } while (0)
 
-/* Note that in the simplest case (no MULE, no ERROR_CHECK_BUFPOS),
+/* Note that in the simplest case (no MULE, no ERROR_CHECK_CHARBPOS),
    this crap reduces down to simply (x)--. */
 
-#define DEC_BYTIND(buf, x) do				\
+#define DEC_BYTEBPOS(buf, x) do				\
 {							\
-  ASSERT_VALID_BYTIND_BACKWARD_UNSAFE (buf, x);		\
+  ASSERT_VALID_BYTEBPOS_BACKWARD_UNSAFE (buf, x);		\
   /* Note that we do the decrement first to		\
      make sure that the pointer in			\
-     VALIDATE_BYTIND_BACKWARD() ends up on		\
+     VALIDATE_BYTEBPOS_BACKWARD() ends up on		\
      the correct side of the gap */			\
   (x)--;						\
-  VALIDATE_BYTIND_BACKWARD (buf, x);			\
+  VALIDATE_BYTEBPOS_BACKWARD (buf, x);			\
 } while (0)
 
-INLINE_HEADER Bytind prev_bytind (struct buffer *buf, Bytind x);
-INLINE_HEADER Bytind
-prev_bytind (struct buffer *buf, Bytind x)
+INLINE_HEADER Bytebpos prev_bytebpos (struct buffer *buf, Bytebpos x);
+INLINE_HEADER Bytebpos
+prev_bytebpos (struct buffer *buf, Bytebpos x)
 {
-  DEC_BYTIND (buf, x);
+  DEC_BYTEBPOS (buf, x);
   return x;
 }
 
-INLINE_HEADER Bytind next_bytind (struct buffer *buf, Bytind x);
-INLINE_HEADER Bytind
-next_bytind (struct buffer *buf, Bytind x)
+INLINE_HEADER Bytebpos next_bytebpos (struct buffer *buf, Bytebpos x);
+INLINE_HEADER Bytebpos
+next_bytebpos (struct buffer *buf, Bytebpos x)
 {
-  INC_BYTIND (buf, x);
+  INC_BYTEBPOS (buf, x);
   return x;
 }
 
-#define BYTIND_INVALID ((Bytind) -1)
+#define BYTEBPOS_INVALID ((Bytebpos) -1)
 
 /*----------------------------------------------------------------------*/
 /*	   Converting between buffer positions and byte indices		*/
@@ -928,13 +928,13 @@
 
 #ifdef MULE
 
-Bytind bufpos_to_bytind_func (struct buffer *buf, Bufpos x);
-Bufpos bytind_to_bufpos_func (struct buffer *buf, Bytind x);
+Bytebpos charbpos_to_bytebpos_func (struct buffer *buf, Charbpos x);
+Charbpos bytebpos_to_charbpos_func (struct buffer *buf, Bytebpos x);
 
 /* The basic algorithm we use is to keep track of a known region of
    characters in each buffer, all of which are of the same width.  We
-   keep track of the boundaries of the region in both Bufpos and
-   Bytind coordinates and also keep track of the char width, which
+   keep track of the boundaries of the region in both Charbpos and
+   Bytebpos coordinates and also keep track of the char width, which
    is 1 - 4 bytes.  If the position we're translating is not in
    the known region, then we invoke a function to update the known
    region to surround the position in question.  This assumes
@@ -947,7 +947,7 @@
    shortcuts to catch all-ASCII buffers. (Note that this will
    thrash with bad locality of reference.) A smarter method would
    be to keep some sort of pseudo-extent layer over the buffer;
-   maybe keep track of the bufpos/bytind correspondence at the
+   maybe keep track of the charbpos/bytebpos correspondence at the
    beginning of each line, which would allow us to do a binary
    search over the pseudo-extents to narrow things down to the
    correct line, at which point you could use a linear movement
@@ -975,21 +975,21 @@
 
 extern short three_to_one_table[];
 
-INLINE_HEADER int real_bufpos_to_bytind (struct buffer *buf, Bufpos x);
+INLINE_HEADER int real_charbpos_to_bytebpos (struct buffer *buf, Charbpos x);
 INLINE_HEADER int
-real_bufpos_to_bytind (struct buffer *buf, Bufpos x)
+real_charbpos_to_bytebpos (struct buffer *buf, Charbpos x)
 {
   if (x >= buf->text->mule_bufmin && x <= buf->text->mule_bufmax)
     return (buf->text->mule_bytmin +
 	    ((x - buf->text->mule_bufmin) << buf->text->mule_shifter) +
 	    (buf->text->mule_three_p ? (x - buf->text->mule_bufmin) : 0));
   else
-    return bufpos_to_bytind_func (buf, x);
+    return charbpos_to_bytebpos_func (buf, x);
 }
 
-INLINE_HEADER int real_bytind_to_bufpos (struct buffer *buf, Bytind x);
+INLINE_HEADER int real_bytebpos_to_charbpos (struct buffer *buf, Bytebpos x);
 INLINE_HEADER int
-real_bytind_to_bufpos (struct buffer *buf, Bytind x)
+real_bytebpos_to_charbpos (struct buffer *buf, Bytebpos x)
 {
   if (x >= buf->text->mule_bytmin && x <= buf->text->mule_bytmax)
     return (buf->text->mule_bufmin +
@@ -997,29 +997,29 @@
 	      ? three_to_one_table[x - buf->text->mule_bytmin]
 	      : (x - buf->text->mule_bytmin) >> buf->text->mule_shifter)));
   else
-    return bytind_to_bufpos_func (buf, x);
+    return bytebpos_to_charbpos_func (buf, x);
 }
 
 #else /* not MULE */
 
-# define real_bufpos_to_bytind(buf, x)	((Bytind) x)
-# define real_bytind_to_bufpos(buf, x)	((Bufpos) x)
+# define real_charbpos_to_bytebpos(buf, x)	((Bytebpos) x)
+# define real_bytebpos_to_charbpos(buf, x)	((Charbpos) x)
 
 #endif /* not MULE */
 
-#ifdef ERROR_CHECK_BUFPOS
+#ifdef ERROR_CHECK_CHARBPOS
 
-Bytind bufpos_to_bytind (struct buffer *buf, Bufpos x);
-Bufpos bytind_to_bufpos (struct buffer *buf, Bytind x);
+Bytebpos charbpos_to_bytebpos (struct buffer *buf, Charbpos x);
+Charbpos bytebpos_to_charbpos (struct buffer *buf, Bytebpos x);
 
-#else /* not ERROR_CHECK_BUFPOS */
+#else /* not ERROR_CHECK_CHARBPOS */
 
-#define bufpos_to_bytind real_bufpos_to_bytind
-#define bytind_to_bufpos real_bytind_to_bufpos
+#define charbpos_to_bytebpos real_charbpos_to_bytebpos
+#define bytebpos_to_charbpos real_bytebpos_to_charbpos
 
-#endif /* not ERROR_CHECK_BUFPOS */
+#endif /* not ERROR_CHECK_CHARBPOS */
 
-#define make_bufpos(buf, ind) make_int (bytind_to_bufpos (buf, ind))
+#define make_charbpos(buf, ind) make_int (bytebpos_to_charbpos (buf, ind))
 
 /*----------------------------------------------------------------------*/
 /*         Converting between buffer bytes and Emacs characters         */
@@ -1029,7 +1029,7 @@
 #define BI_BUF_FETCH_CHAR(buf, pos) \
   charptr_emchar (BI_BUF_BYTE_ADDRESS (buf, pos))
 #define BUF_FETCH_CHAR(buf, pos) \
-  BI_BUF_FETCH_CHAR (buf, bufpos_to_bytind (buf, pos))
+  BI_BUF_FETCH_CHAR (buf, charbpos_to_bytebpos (buf, pos))
 
 /* The character at position POS in buffer, as a string.  This is
    equivalent to set_charptr_emchar (str, BUF_FETCH_CHAR (buf, pos))
@@ -1038,7 +1038,7 @@
 # define BI_BUF_CHARPTR_COPY_CHAR(buf, pos, str) \
   charptr_copy_char (BI_BUF_BYTE_ADDRESS (buf, pos), str)
 #define BUF_CHARPTR_COPY_CHAR(buf, pos, str) \
-  BI_BUF_CHARPTR_COPY_CHAR (buf, bufpos_to_bytind (buf, pos), str)
+  BI_BUF_CHARPTR_COPY_CHAR (buf, charbpos_to_bytebpos (buf, pos), str)
 
 
 /************************************************************************/
@@ -1169,7 +1169,7 @@
 
 typedef union
 {
-  struct { const void *ptr; Memory_Count len; } data;
+  struct { const void *ptr; Bytecount len; } data;
   Lisp_Object lisp_object;
 } dfc_conversion_data;
 
@@ -1293,7 +1293,7 @@
   ((dfc_aliasing_voidpp) &(sink))->p = dfc_sink_ret;			\
 } while (0)
 #define DFC_LISP_STRING_USE_CONVERTED_DATA(sink) \
-  sink = make_string ((Bufbyte *) dfc_sink.data.ptr, dfc_sink.data.len)
+  sink = make_string ((Intbyte *) dfc_sink.data.ptr, dfc_sink.data.len)
 #define DFC_LISP_OPAQUE_USE_CONVERTED_DATA(sink) \
   sink = make_opaque (dfc_sink.data.ptr, dfc_sink.data.len)
 #define DFC_LISP_LSTREAM_USE_CONVERTED_DATA(sink) /* data already used */
@@ -1393,15 +1393,15 @@
 
 /* Set point. */
 /* Since BEGV and ZV are almost never set, it's reasonable to enforce
-   the restriction that the Bufpos and Bytind values must both be
+   the restriction that the Charbpos and Bytebpos values must both be
    specified.  However, point is set in lots and lots of places.  So
    we provide the ability to specify both (for efficiency) or just
    one. */
 #define BOTH_BUF_SET_PT(buf, val, bival) set_buffer_point (buf, val, bival)
 #define BI_BUF_SET_PT(buf, bival) \
-  BOTH_BUF_SET_PT (buf, bytind_to_bufpos (buf, bival), bival)
+  BOTH_BUF_SET_PT (buf, bytebpos_to_charbpos (buf, bival), bival)
 #define BUF_SET_PT(buf, value) \
-  BOTH_BUF_SET_PT (buf, value, bufpos_to_bytind (buf, value))
+  BOTH_BUF_SET_PT (buf, value, charbpos_to_bytebpos (buf, value))
 
 
 #if 0 /* FSFmacs */
@@ -1483,7 +1483,7 @@
   ((n) < (b)->text->gpt && (b)->text->gpt < BI_BUF_ZV (b) ?		\
    (b)->text->gpt : BI_BUF_ZV (b))
 #define BUF_CEILING_OF(b, n)						\
-  bytind_to_bufpos (b, BI_BUF_CEILING_OF (b, bufpos_to_bytind (b, n)))
+  bytebpos_to_charbpos (b, BI_BUF_CEILING_OF (b, charbpos_to_bytebpos (b, n)))
 
 /*  Return the minimum index in the buffer it is safe to scan backwards
     past N to.  All characters between FLOOR_OF(N) and N are located
@@ -1493,21 +1493,21 @@
         (BI_BUF_BEGV (b) < (b)->text->gpt && (b)->text->gpt < (n) ?	\
 	 (b)->text->gpt : BI_BUF_BEGV (b))
 #define BUF_FLOOR_OF(b, n)						\
-  bytind_to_bufpos (b, BI_BUF_FLOOR_OF (b, bufpos_to_bytind (b, n)))
+  bytebpos_to_charbpos (b, BI_BUF_FLOOR_OF (b, charbpos_to_bytebpos (b, n)))
 
 #define BI_BUF_CEILING_OF_IGNORE_ACCESSIBLE(b, n)			\
   ((n) < (b)->text->gpt && (b)->text->gpt < BI_BUF_Z (b) ?		\
    (b)->text->gpt : BI_BUF_Z (b))
 #define BUF_CEILING_OF_IGNORE_ACCESSIBLE(b, n) 				\
-  bytind_to_bufpos							\
-   (b, BI_BUF_CEILING_OF_IGNORE_ACCESSIBLE (b, bufpos_to_bytind (b, n)))
+  bytebpos_to_charbpos							\
+   (b, BI_BUF_CEILING_OF_IGNORE_ACCESSIBLE (b, charbpos_to_bytebpos (b, n)))
 
 #define BI_BUF_FLOOR_OF_IGNORE_ACCESSIBLE(b, n)				\
         (BI_BUF_BEG (b) < (b)->text->gpt && (b)->text->gpt < (n) ?	\
 	 (b)->text->gpt : BI_BUF_BEG (b))
 #define BUF_FLOOR_OF_IGNORE_ACCESSIBLE(b, n) 				\
-  bytind_to_bufpos							\
-   (b, BI_BUF_FLOOR_OF_IGNORE_ACCESSIBLE (b, bufpos_to_bytind (b, n)))
+  bytebpos_to_charbpos							\
+   (b, BI_BUF_FLOOR_OF_IGNORE_ACCESSIBLE (b, charbpos_to_bytebpos (b, n)))
 
 
 extern struct buffer *current_buffer;
@@ -1566,18 +1566,18 @@
 void r_alloc_free (unsigned char **);
 
 #define BUFFER_ALLOC(data, size) \
-  ((Bufbyte *) r_alloc ((unsigned char **) &data, (size) * sizeof(Bufbyte)))
+  ((Intbyte *) r_alloc ((unsigned char **) &data, (size) * sizeof(Intbyte)))
 #define BUFFER_REALLOC(data, size) \
-  ((Bufbyte *) r_re_alloc ((unsigned char **) &data, (size) * sizeof(Bufbyte)))
+  ((Intbyte *) r_re_alloc ((unsigned char **) &data, (size) * sizeof(Intbyte)))
 #define BUFFER_FREE(data) r_alloc_free ((unsigned char **) &(data))
 #define R_ALLOC_DECLARE(var,data) r_alloc_declare (&(var), data)
 
 #else /* !REL_ALLOC */
 
 #define BUFFER_ALLOC(data,size)\
-	(data = xnew_array (Bufbyte, size))
+	(data = xnew_array (Intbyte, size))
 #define BUFFER_REALLOC(data,size)\
-	((Bufbyte *) xrealloc (data, (size) * sizeof(Bufbyte)))
+	((Intbyte *) xrealloc (data, (size) * sizeof(Intbyte)))
 /* Avoid excess parentheses, or syntax errors may rear their heads. */
 #define BUFFER_FREE(data) xfree (data)
 #define R_ALLOC_DECLARE(var,data)
@@ -1590,27 +1590,27 @@
 
 /* from editfns.c */
 void widen_buffer (struct buffer *b, int no_clip);
-int beginning_of_line_p (struct buffer *b, Bufpos pt);
+int beginning_of_line_p (struct buffer *b, Charbpos pt);
 
 /* from insdel.c */
-void set_buffer_point (struct buffer *buf, Bufpos pos, Bytind bipos);
-void find_charsets_in_bufbyte_string (unsigned char *charsets,
-				      const Bufbyte *str,
+void set_buffer_point (struct buffer *buf, Charbpos pos, Bytebpos bipos);
+void find_charsets_in_intbyte_string (unsigned char *charsets,
+				      const Intbyte *str,
 				      Bytecount len);
 void find_charsets_in_emchar_string (unsigned char *charsets,
 				     const Emchar *str,
 				     Charcount len);
-int bufbyte_string_displayed_columns (const Bufbyte *str, Bytecount len);
+int intbyte_string_displayed_columns (const Intbyte *str, Bytecount len);
 int emchar_string_displayed_columns (const Emchar *str, Charcount len);
-void convert_bufbyte_string_into_emchar_dynarr (const Bufbyte *str,
+void convert_intbyte_string_into_emchar_dynarr (const Intbyte *str,
 						Bytecount len,
 						Emchar_dynarr *dyn);
-Charcount convert_bufbyte_string_into_emchar_string (const Bufbyte *str,
+Charcount convert_intbyte_string_into_emchar_string (const Intbyte *str,
 						     Bytecount len,
 						     Emchar *arr);
-void convert_emchar_string_into_bufbyte_dynarr (Emchar *arr, int nels,
-						Bufbyte_dynarr *dyn);
-Bufbyte *convert_emchar_string_into_malloced_string (Emchar *arr, int nels,
+void convert_emchar_string_into_intbyte_dynarr (Emchar *arr, int nels,
+						Intbyte_dynarr *dyn);
+Intbyte *convert_emchar_string_into_malloced_string (Emchar *arr, int nels,
 						    Bytecount *len_out);
 /* from marker.c */
 void init_buffer_markers (struct buffer *b);
@@ -1629,15 +1629,15 @@
 #define GB_NEGATIVE_FROM_END		(1 << 5)
 #define GB_HISTORICAL_STRING_BEHAVIOR	(GB_NEGATIVE_FROM_END | GB_ALLOW_NIL)
 
-Bufpos get_buffer_pos_char (struct buffer *b, Lisp_Object pos,
+Charbpos get_buffer_pos_char (struct buffer *b, Lisp_Object pos,
 			    unsigned int flags);
-Bytind get_buffer_pos_byte (struct buffer *b, Lisp_Object pos,
+Bytebpos get_buffer_pos_byte (struct buffer *b, Lisp_Object pos,
 			    unsigned int flags);
 void get_buffer_range_char (struct buffer *b, Lisp_Object from, Lisp_Object to,
-			    Bufpos *from_out, Bufpos *to_out,
+			    Charbpos *from_out, Charbpos *to_out,
 			    unsigned int flags);
 void get_buffer_range_byte (struct buffer *b, Lisp_Object from, Lisp_Object to,
-			    Bytind *from_out, Bytind *to_out,
+			    Bytebpos *from_out, Bytebpos *to_out,
 			    unsigned int flags);
 Charcount get_string_pos_char (Lisp_Object string, Lisp_Object pos,
 			       unsigned int flags);
@@ -1649,24 +1649,24 @@
 void get_string_range_byte (Lisp_Object string, Lisp_Object from,
 			    Lisp_Object to, Bytecount *from_out,
 			    Bytecount *to_out, unsigned int flags);
-Bufpos get_buffer_or_string_pos_char (Lisp_Object object, Lisp_Object pos,
+Charbpos get_buffer_or_string_pos_char (Lisp_Object object, Lisp_Object pos,
 				      unsigned int flags);
-Bytind get_buffer_or_string_pos_byte (Lisp_Object object, Lisp_Object pos,
+Bytebpos get_buffer_or_string_pos_byte (Lisp_Object object, Lisp_Object pos,
 				      unsigned int flags);
 void get_buffer_or_string_range_char (Lisp_Object object, Lisp_Object from,
-				      Lisp_Object to, Bufpos *from_out,
-				      Bufpos *to_out, unsigned int flags);
+				      Lisp_Object to, Charbpos *from_out,
+				      Charbpos *to_out, unsigned int flags);
 void get_buffer_or_string_range_byte (Lisp_Object object, Lisp_Object from,
-				      Lisp_Object to, Bytind *from_out,
-				      Bytind *to_out, unsigned int flags);
-Bufpos buffer_or_string_accessible_begin_char (Lisp_Object object);
-Bufpos buffer_or_string_accessible_end_char (Lisp_Object object);
-Bytind buffer_or_string_accessible_begin_byte (Lisp_Object object);
-Bytind buffer_or_string_accessible_end_byte (Lisp_Object object);
-Bufpos buffer_or_string_absolute_begin_char (Lisp_Object object);
-Bufpos buffer_or_string_absolute_end_char (Lisp_Object object);
-Bytind buffer_or_string_absolute_begin_byte (Lisp_Object object);
-Bytind buffer_or_string_absolute_end_byte (Lisp_Object object);
+				      Lisp_Object to, Bytebpos *from_out,
+				      Bytebpos *to_out, unsigned int flags);
+Charbpos buffer_or_string_accessible_begin_char (Lisp_Object object);
+Charbpos buffer_or_string_accessible_end_char (Lisp_Object object);
+Bytebpos buffer_or_string_accessible_begin_byte (Lisp_Object object);
+Bytebpos buffer_or_string_accessible_end_byte (Lisp_Object object);
+Charbpos buffer_or_string_absolute_begin_char (Lisp_Object object);
+Charbpos buffer_or_string_absolute_end_char (Lisp_Object object);
+Bytebpos buffer_or_string_absolute_begin_byte (Lisp_Object object);
+Bytebpos buffer_or_string_absolute_end_byte (Lisp_Object object);
 void record_buffer (Lisp_Object buf);
 Lisp_Object get_buffer (Lisp_Object name,
 			int error_if_deleted_or_does_not_exist);
@@ -1771,22 +1771,22 @@
 /************************************************************************/
 /* Because the representation of internally formatted data is subject to change,
    It's bad style to do something like strcmp (XSTRING_DATA (s), "foo")
-   Instead, use the portable: bufbyte_strcmp (XSTRING_DATA (s), "foo")
-   or bufbyte_memcmp (XSTRING_DATA (s), "foo", 3) */
+   Instead, use the portable: intbyte_strcmp (XSTRING_DATA (s), "foo")
+   or intbyte_memcmp (XSTRING_DATA (s), "foo", 3) */
 
 /* Like strcmp, except first arg points at internally formatted data,
    while the second points at a string of only ASCII chars. */
 INLINE_HEADER int
-bufbyte_strcmp (const Bufbyte *bp, const char *ascii_string);
+intbyte_strcmp (const Intbyte *bp, const char *ascii_string);
 INLINE_HEADER int
-bufbyte_strcmp (const Bufbyte *bp, const char *ascii_string)
+intbyte_strcmp (const Intbyte *bp, const char *ascii_string)
 {
 #ifdef MULE
   while (1)
     {
       int diff;
       type_checking_assert (BYTE_ASCII_P (*ascii_string));
-      if ((diff = charptr_emchar (bp) - *(Bufbyte *) ascii_string) != 0)
+      if ((diff = charptr_emchar (bp) - *(Intbyte *) ascii_string) != 0)
 	return diff;
       if (*ascii_string == '\0')
 	return 0;
@@ -1802,14 +1802,14 @@
 /* Like memcmp, except first arg points at internally formatted data,
    while the second points at a string of only ASCII chars. */
 INLINE_HEADER int
-bufbyte_memcmp (const Bufbyte *bp, const char *ascii_string, Memory_Count len);
+intbyte_memcmp (const Intbyte *bp, const char *ascii_string, Bytecount len);
 INLINE_HEADER int
-bufbyte_memcmp (const Bufbyte *bp, const char *ascii_string, Memory_Count len)
+intbyte_memcmp (const Intbyte *bp, const char *ascii_string, Bytecount len)
 {
 #ifdef MULE
   while (len--)
     {
-      int diff = charptr_emchar (bp) - *(Bufbyte *) ascii_string;
+      int diff = charptr_emchar (bp) - *(Intbyte *) ascii_string;
       type_checking_assert (BYTE_ASCII_P (*ascii_string));
       if (diff != 0)
 	return diff;
--- a/src/bytecode.c	Tue Sep 18 05:06:57 2001 +0000
+++ b/src/bytecode.c	Thu Sep 20 06:31:11 2001 +0000
@@ -1480,7 +1480,7 @@
 
 
 DOESNT_RETURN
-invalid_byte_code (const CBufbyte *reason, Lisp_Object frob)
+invalid_byte_code (const CIntbyte *reason, Lisp_Object frob)
 {
   signal_error (Qinvalid_byte_code, reason, frob);
 }
@@ -1600,7 +1600,7 @@
 		    int * const varbind_count)
 {
   Bytecount instructions_length = XSTRING_LENGTH (instructions);
-  Element_Count comfy_size = (Element_Count) (2 * instructions_length);
+  Elemcount comfy_size = (Elemcount) (2 * instructions_length);
 
   int * const icounts = alloca_array (int, comfy_size);
   int * icounts_ptr = icounts;
@@ -1616,8 +1616,8 @@
 
   Opbyte *program_ptr = program;
 
-  const Bufbyte *ptr = XSTRING_DATA (instructions);
-  const Bufbyte * const end = ptr + instructions_length;
+  const Intbyte *ptr = XSTRING_DATA (instructions);
+  const Intbyte * const end = ptr + instructions_length;
 
   *varbind_count = 0;
 
@@ -1996,7 +1996,7 @@
 		     f2->doc_and_interactive, depth + 1));
 }
 
-static Hash_Code
+static Hashcode
 compiled_function_hash (Lisp_Object obj, int depth)
 {
   Lisp_Compiled_Function *f = XCOMPILED_FUNCTION (obj);
@@ -2054,9 +2054,9 @@
     /* Invert action performed by optimize_byte_code() */
     Lisp_Opaque *opaque = XOPAQUE (f->instructions);
 
-    Bufbyte * const buffer =
-      alloca_array (Bufbyte, OPAQUE_SIZE (opaque) * MAX_EMCHAR_LEN);
-    Bufbyte *bp = buffer;
+    Intbyte * const buffer =
+      alloca_array (Intbyte, OPAQUE_SIZE (opaque) * MAX_EMCHAR_LEN);
+    Intbyte *bp = buffer;
 
     const Opbyte * const program = (const Opbyte *) OPAQUE_DATA (opaque);
     const Opbyte *program_ptr = program;
--- a/src/callint.c	Tue Sep 18 05:06:57 2001 +0000
+++ b/src/callint.c	Thu Sep 20 06:31:11 2001 +0000
@@ -248,7 +248,7 @@
   return expr;
 }
 
-static Bufpos
+static Charbpos
 check_mark (void)
 {
   Lisp_Object tem;
@@ -264,7 +264,7 @@
 }
 
 static Lisp_Object
-callint_prompt (const Bufbyte *prompt_start, Bytecount prompt_length,
+callint_prompt (const Intbyte *prompt_start, Bytecount prompt_length,
                 const Lisp_Object *args, int nargs)
 {
   Lisp_Object s = make_string (prompt_start, prompt_length);
@@ -651,7 +651,7 @@
 	   prompts with "Set key C-x C-f to command: "instead of printing
 	   event objects in there.
 	 */
-#define PROMPT() callint_prompt ((const Bufbyte *) prompt_start, prompt_length, visargs, argnum)
+#define PROMPT() callint_prompt ((const Intbyte *) prompt_start, prompt_length, visargs, argnum)
 	switch (prompt_data[prompt_index])
 	  {
 	  case 'a':		/* Symbol defined as a function */
@@ -857,7 +857,7 @@
             }
 	  case 'r':		/* Region, point and mark as 2 args. */
 	    {
-	      Bufpos tem = check_mark ();
+	      Charbpos tem = check_mark ();
 	      args[argnum] = (BUF_PT (current_buffer) < tem
 			      ? Fcopy_marker (current_buffer->point_marker, Qt)
 			      : current_buffer->mark);
--- a/src/callproc.c	Tue Sep 18 05:06:57 2001 +0000
+++ b/src/callproc.c	Thu Sep 20 06:31:11 2001 +0000
@@ -478,7 +478,7 @@
 	nread = 0;
 	while (nread < bufsize - 1024)
 	  {
-	    Lstream_Data_Count this_read
+	    Bytecount this_read
 	      = Lstream_read (XLSTREAM (instream), bufptr + nread,
 			      bufsize - nread);
 
@@ -515,7 +515,7 @@
 	total_read += nread;
 
 	if (!NILP (buffer))
-	  buffer_insert_raw_string (XBUFFER (buffer), (Bufbyte *) bufptr,
+	  buffer_insert_raw_string (XBUFFER (buffer), (Intbyte *) bufptr,
 				    nread);
 
 	/* Make the buffer bigger as we continue to read more data,
@@ -795,9 +795,9 @@
 }
 
 static int
-getenv_internal (const Bufbyte *var,
+getenv_internal (const Intbyte *var,
 		 Bytecount varlen,
-		 Bufbyte **value,
+		 Intbyte **value,
 		 Bytecount *valuelen)
 {
   Lisp_Object scan;
@@ -833,7 +833,7 @@
 */
        (var, interactivep))
 {
-  Bufbyte *value;
+  Intbyte *value;
   Bytecount valuelen;
   Lisp_Object v = Qnil;
   struct gcpro gcpro1;
@@ -861,10 +861,10 @@
 egetenv (const char *var)
 {
   /* This cannot GC -- 7-28-00 ben */
-  Bufbyte *value;
+  Intbyte *value;
   Bytecount valuelen;
 
-  if (getenv_internal ((const Bufbyte *) var, strlen (var), &value, &valuelen))
+  if (getenv_internal ((const Intbyte *) var, strlen (var), &value, &valuelen))
     return (char *) value;
   else
     return 0;
@@ -916,7 +916,7 @@
     
     if (!egetenv ("SHELL"))
       {
-	CBufbyte *faux_var = alloca_array (CBufbyte, 7 + strlen (shell));
+	CIntbyte *faux_var = alloca_array (CIntbyte, 7 + strlen (shell));
 	sprintf (faux_var, "SHELL=%s", shell);
 	Vprocess_environment = Fcons (build_string (faux_var),
 				      Vprocess_environment);
--- a/src/casefiddle.c	Tue Sep 18 05:06:57 2001 +0000
+++ b/src/casefiddle.c	Thu Sep 20 06:31:11 2001 +0000
@@ -49,10 +49,10 @@
   if (STRINGP (string_or_char))
     {
       Lisp_Char_Table *syntax_table = XCHAR_TABLE (buf->mirror_syntax_table);
-      Bufbyte *storage =
-	alloca_array (Bufbyte, XSTRING_LENGTH (string_or_char) * MAX_EMCHAR_LEN);
-      Bufbyte *newp = storage;
-      Bufbyte *oldp = XSTRING_DATA (string_or_char);
+      Intbyte *storage =
+	alloca_array (Intbyte, XSTRING_LENGTH (string_or_char) * MAX_EMCHAR_LEN);
+      Intbyte *newp = storage;
+      Intbyte *oldp = XSTRING_DATA (string_or_char);
       int wordp = 0, wordp_prev;
 
       while (*oldp)
@@ -154,7 +154,7 @@
 			Lisp_Object end, struct buffer *buf)
 {
   /* This function can GC */
-  Bufpos pos, s, e;
+  Charbpos pos, s, e;
   Lisp_Char_Table *syntax_table = XCHAR_TABLE (buf->mirror_syntax_table);
   int mccount;
   int wordp = 0, wordp_prev;
@@ -273,7 +273,7 @@
 static Lisp_Object
 casify_word (enum case_action flag, Lisp_Object arg, Lisp_Object buffer)
 {
-  Bufpos farend;
+  Charbpos farend;
   struct buffer *buf = decode_buffer (buffer, 1);
 
   CHECK_INT (arg);
--- a/src/chartab.c	Tue Sep 18 05:06:57 2001 +0000
+++ b/src/chartab.c	Thu Sep 20 06:31:11 2001 +0000
@@ -121,7 +121,7 @@
   return 1;
 }
 
-static Hash_Code
+static Hashcode
 char_table_entry_hash (Lisp_Object obj, int depth)
 {
   Lisp_Char_Table_Entry *cte = XCHAR_TABLE_ENTRY (obj);
@@ -413,11 +413,11 @@
   return 1;
 }
 
-static Hash_Code
+static Hashcode
 char_table_hash (Lisp_Object obj, int depth)
 {
   Lisp_Char_Table *ct = XCHAR_TABLE (obj);
-  Hash_Code hashval = internal_array_hash (ct->ascii, NUM_ASCII_CHARS,
+  Hashcode hashval = internal_array_hash (ct->ascii, NUM_ASCII_CHARS,
 					   depth);
 #ifdef MULE
   hashval = HASH2 (hashval,
--- a/src/cmds.c	Tue Sep 18 05:06:57 2001 +0000
+++ b/src/cmds.c	Thu Sep 20 06:31:11 2001 +0000
@@ -75,7 +75,7 @@
      hooks, etcetera), that's not a good approach.  So we validate the
      proposed position, then set point.  */
   {
-    Bufpos new_point = BUF_PT (buf) + n;
+    Charbpos new_point = BUF_PT (buf) + n;
 
     if (new_point < BUF_BEGV (buf))
       {
@@ -136,8 +136,8 @@
        (count, buffer))
 {
   struct buffer *buf = decode_buffer (buffer, 1);
-  Bufpos pos2 = BUF_PT (buf);
-  Bufpos pos;
+  Charbpos pos2 = BUF_PT (buf);
+  Charbpos pos;
   EMACS_INT n, shortage, negp;
 
   if (NILP (count))
@@ -258,7 +258,7 @@
        (count, killp))
 {
   /* This function can GC */
-  Bufpos pos;
+  Charbpos pos;
   struct buffer *buf = current_buffer;
   EMACS_INT n;
 
--- a/src/config.h.in	Tue Sep 18 05:06:57 2001 +0000
+++ b/src/config.h.in	Thu Sep 20 06:31:11 2001 +0000
@@ -450,11 +450,11 @@
 #endif
 
 /* Make sure valid buffer positions are passed to BUF_* macros. */
-#undef ERROR_CHECK_BUFPOS
-#ifdef ERROR_CHECK_BUFPOS
-#define bufpos_checking_assert(assertion) assert (assertion)
+#undef ERROR_CHECK_CHARBPOS
+#ifdef ERROR_CHECK_CHARBPOS
+#define charbpos_checking_assert(assertion) assert (assertion)
 #else
-#define bufpos_checking_assert(assertion)
+#define charbpos_checking_assert(assertion)
 #endif
 
 /* Attempt to catch bugs related to garbage collection (e.g. not GCPRO'ing). */
--- a/src/console-msw.c	Tue Sep 18 05:06:57 2001 +0000
+++ b/src/console-msw.c	Thu Sep 20 06:31:11 2001 +0000
@@ -218,7 +218,7 @@
 int mswindows_message_outputted;
 
 int
-mswindows_output_console_string (CONST Extbyte *str, Extcount len)
+mswindows_output_console_string (CONST Extbyte *str, Bytecount len)
 {
   DWORD num_written;
 
@@ -252,7 +252,7 @@
     }
   else
     {
-      Bufbyte str[MAX_EMCHAR_LEN + 1];
+      Intbyte str[MAX_EMCHAR_LEN + 1];
       Bytecount len;
 
       CHECK_CHAR_COERCE_INT (char_or_string);
@@ -309,8 +309,8 @@
   return (CONSP (obj) && CONSP (XCDR (obj))) ? XCONS (XCDR (obj)) : 0;
 }
 
-Bufbyte *DSTRING (Lisp_Object obj);
-Bufbyte *
+Intbyte *DSTRING (Lisp_Object obj);
+Intbyte *
 DSTRING (Lisp_Object obj)
 {
   return STRINGP (obj) ? XSTRING_DATA (obj) : NULL;
@@ -330,8 +330,8 @@
   return SYMBOLP (obj) ? XSYMBOL (obj) : NULL;
 }
 
-Bufbyte *DSYMNAME (Lisp_Object obj);
-Bufbyte *
+Intbyte *DSYMNAME (Lisp_Object obj);
+Intbyte *
 DSYMNAME (Lisp_Object obj)
 {
   return SYMBOLP (obj) ? string_data (XSYMBOL (obj)->name) : NULL;
@@ -561,7 +561,7 @@
 {
   LPTSTR lpMsgBuf;
   Lisp_Object result;
-  Bufbyte *inres;
+  Intbyte *inres;
   Bytecount len;
   
   FormatMessage (FORMAT_MESSAGE_ALLOCATE_BUFFER
@@ -578,7 +578,7 @@
   TO_INTERNAL_FORMAT (C_STRING, lpMsgBuf, ALLOCA, (inres, len),
 		      Qmswindows_tstr);
   /* Messages tend to end with a period and newline */
-  if (len >= 3 && !bufbyte_strcmp (inres + len - 3, ".\r\n"))
+  if (len >= 3 && !intbyte_strcmp (inres + len - 3, ".\r\n"))
     len -= 3;
   result = make_string (inres, len);
   
--- a/src/console-msw.h	Tue Sep 18 05:06:57 2001 +0000
+++ b/src/console-msw.h	Thu Sep 20 06:31:11 2001 +0000
@@ -351,12 +351,12 @@
 HWND mswindows_get_console_hwnd (void);
 void mswindows_hide_console (void);
 void mswindows_show_console (void);
-int mswindows_output_console_string (CONST Extbyte *str, Extcount len);
+int mswindows_output_console_string (CONST Extbyte *str, Bytecount len);
 
 Lisp_Object mswindows_enumerate_fonts (HDC hdc);
 
 int mswindows_char_is_accelerator (struct frame *f, Emchar ch);
-Bytecount mswindows_translate_menu_or_dialog_item (Bufbyte *item, Bytecount len,
+Bytecount mswindows_translate_menu_or_dialog_item (Intbyte *item, Bytecount len,
 					     Bytecount maxlen, Emchar *accel,
 					     Lisp_Object error_name);
 
--- a/src/console-x.c	Tue Sep 18 05:06:57 2001 +0000
+++ b/src/console-x.c	Thu Sep 20 06:31:11 2001 +0000
@@ -48,9 +48,9 @@
 split_up_display_spec (Lisp_Object display, int *hostname_length,
 		       int *display_length, int *screen_length)
 {
-  Bufbyte *beg = XSTRING_DATA (display);
-  Bufbyte *end = beg + XSTRING_LENGTH (display);
-  Bufbyte *p = end;
+  Intbyte *beg = XSTRING_DATA (display);
+  Intbyte *end = beg + XSTRING_LENGTH (display);
+  Intbyte *p = end;
 
   while (p > beg)
     {
@@ -198,8 +198,8 @@
   else
     {
       /* connection =~ s/^unix:/localhost:/; */
-      const Bufbyte *p   = XSTRING_DATA (connection);
-      const Bufbyte *end = XSTRING_DATA (connection) + XSTRING_LENGTH (connection);
+      const Intbyte *p   = XSTRING_DATA (connection);
+      const Intbyte *end = XSTRING_DATA (connection) + XSTRING_LENGTH (connection);
       int i;
 
       for (i = 0; i < (int) sizeof ("unix:") - 1; i++)
--- a/src/console.c	Tue Sep 18 05:06:57 2001 +0000
+++ b/src/console.c	Thu Sep 20 06:31:11 2001 +0000
@@ -905,7 +905,7 @@
 
   if (STRINGP (stuffstring))
     {
-      Extcount count;
+      Bytecount count;
       Extbyte *p;
 
       TO_EXTERNAL_FORMAT (LISP_STRING, stuffstring,
--- a/src/console.h	Tue Sep 18 05:06:57 2001 +0000
+++ b/src/console.h	Thu Sep 20 06:31:11 2001 +0000
@@ -161,8 +161,8 @@
   int (*frame_visible_p_method) (struct frame *f);
   int (*frame_totally_visible_p_method) (struct frame *f);
   int (*frame_iconified_p_method) (struct frame *f);
-  void (*set_title_from_bufbyte_method) (struct frame *f, Bufbyte *title);
-  void (*set_icon_name_from_bufbyte_method) (struct frame *f, Bufbyte *title);
+  void (*set_title_from_intbyte_method) (struct frame *f, Intbyte *title);
+  void (*set_icon_name_from_intbyte_method) (struct frame *f, Intbyte *title);
   void (*set_frame_pointer_method) (struct frame *f);
   void (*set_frame_icon_method) (struct frame *f);
   void (*popup_menu_method) (Lisp_Object menu, Lisp_Object event);
@@ -219,7 +219,7 @@
   int (*color_instance_equal_method) (Lisp_Color_Instance *,
 				      Lisp_Color_Instance *,
 				      int depth);
-  Hash_Code (*color_instance_hash_method) (Lisp_Color_Instance *,
+  Hashcode (*color_instance_hash_method) (Lisp_Color_Instance *,
 					   int depth);
   Lisp_Object (*color_instance_rgb_components_method) (Lisp_Color_Instance *);
   int (*valid_color_name_p_method) (struct device *, Lisp_Object color);
@@ -244,7 +244,7 @@
 					   Lisp_Object charset);
   int (*font_spec_matches_charset_method) (struct device *d,
 					   Lisp_Object charset,
-					   const Bufbyte *nonreloc,
+					   const Intbyte *nonreloc,
 					   Lisp_Object reloc,
 					   Bytecount offset,
 					   Bytecount length);
@@ -264,7 +264,7 @@
   int (*image_instance_equal_method) (Lisp_Image_Instance *,
 				      Lisp_Image_Instance *,
 				      int depth);
-  Hash_Code (*image_instance_hash_method) (Lisp_Image_Instance *,
+  Hashcode (*image_instance_hash_method) (Lisp_Image_Instance *,
 					   int depth);
   void (*init_image_instance_from_eimage_method) (Lisp_Image_Instance *ii,
 						  int width, int height,
--- a/src/data.c	Tue Sep 18 05:06:57 2001 +0000
+++ b/src/data.c	Thu Sep 20 06:31:11 2001 +0000
@@ -1611,12 +1611,12 @@
 	  internal_equal (w1->list, w2->list, depth + 1));
 }
 
-static Hash_Code
+static Hashcode
 weak_list_hash (Lisp_Object obj, int depth)
 {
   struct weak_list *w = XWEAK_LIST (obj);
 
-  return HASH2 ((Hash_Code) w->type,
+  return HASH2 ((Hashcode) w->type,
 		internal_hash (w->list, depth + 1));
 }
 
--- a/src/database.c	Tue Sep 18 05:06:57 2001 +0000
+++ b/src/database.c	Thu Sep 20 06:31:11 2001 +0000
@@ -406,7 +406,7 @@
 
   if (!status)
     /* #### Not mule-ized! will crash! */
-    return make_string ((Bufbyte *) valdatum.data, valdatum.size);
+    return make_string ((Intbyte *) valdatum.data, valdatum.size);
 
 #if DB_VERSION_MAJOR == 1
   db->dberrno = (status == 1) ? -1 : errno;
@@ -494,8 +494,8 @@
        status = dbp->seq (dbp, &keydatum, &valdatum, R_NEXT))
     {
       /* #### Needs mule-izing */
-      key = make_string ((Bufbyte *) keydatum.data, keydatum.size);
-      val = make_string ((Bufbyte *) valdatum.data, valdatum.size);
+      key = make_string ((Intbyte *) keydatum.data, keydatum.size);
+      val = make_string ((Intbyte *) valdatum.data, valdatum.size);
       call2 (func, key, val);
     }
 #else
@@ -512,8 +512,8 @@
 	 status = dbcp->c_get (dbcp, &keydatum, &valdatum, DB_NEXT))
       {
 	/* #### Needs mule-izing */
-	key = make_string ((Bufbyte *) keydatum.data, keydatum.size);
-	val = make_string ((Bufbyte *) valdatum.data, valdatum.size);
+	key = make_string ((Intbyte *) keydatum.data, keydatum.size);
+	val = make_string ((Intbyte *) valdatum.data, valdatum.size);
 	call2 (func, key, val);
       }
     dbcp->c_close (dbcp);
--- a/src/device-msw.c	Tue Sep 18 05:06:57 2001 +0000
+++ b/src/device-msw.c	Thu Sep 20 06:31:11 2001 +0000
@@ -427,7 +427,7 @@
 msprinter_default_printer (void)
 {
   Extbyte name[666];
-  Bufbyte *nameint;
+  Intbyte *nameint;
 
   if (GetProfileString (XETEXT ("windows"), XETEXT ("device"), NULL, name,
 			sizeof (name) / XETCHAR_SIZE) <= 0)
@@ -1112,7 +1112,7 @@
   return stricmp (dm1->printer_name, dm2->printer_name) == 0;
 }
 
-static Hash_Code
+static Hashcode
 hash_devmode (Lisp_Object obj, int depth)
 {
   Lisp_Devmode *dm = XDEVMODE (obj);
@@ -1224,7 +1224,7 @@
 {
   int have_nt, ok;
   BYTE *data_buf, dummy_byte;
-  Memory_Count enum_entry_size;
+  Bytecount enum_entry_size;
   DWORD enum_flags, enum_level, bytes_needed, num_printers;
   struct gcpro gcpro1, gcpro2;
   Lisp_Object result = Qnil, def_printer = Qnil;
--- a/src/device-x.c	Tue Sep 18 05:06:57 2001 +0000
+++ b/src/device-x.c	Thu Sep 20 06:31:11 2001 +0000
@@ -309,7 +309,7 @@
 
 /* #### not just char * here; may be fixed in my Mule ws */
 static void
-validify_resource_component (char *str, Memory_Count len)
+validify_resource_component (char *str, Bytecount len)
 {
   for (; len; len--, str++)
     if (!valid_resource_char_p[(unsigned char) (*str)])
@@ -1562,9 +1562,9 @@
   if (!display)
     return Qnil;
 
-  return Fcons (make_string ((Bufbyte *) Dynarr_atp (name_char_dynarr, 0),
+  return Fcons (make_string ((Intbyte *) Dynarr_atp (name_char_dynarr, 0),
 			     Dynarr_length (name_char_dynarr)),
-		make_string ((Bufbyte *) Dynarr_atp (class_char_dynarr, 0),
+		make_string ((Intbyte *) Dynarr_atp (class_char_dynarr, 0),
 			     Dynarr_length (class_char_dynarr)));
 }
 
--- a/src/device.h	Tue Sep 18 05:06:57 2001 +0000
+++ b/src/device.h	Thu Sep 20 06:31:11 2001 +0000
@@ -39,8 +39,8 @@
   int low_x_coord, high_x_coord, col, obj_x;
   int low_y_coord, high_y_coord, row, obj_y;
   struct window *w;
-  Bufpos bufpos;
-  Bufpos closest;
+  Charbpos charbpos;
+  Charbpos closest;
   Charcount modeline_closest;
   Lisp_Object obj1, obj2;
   int retval;
--- a/src/dialog-msw.c	Tue Sep 18 05:06:57 2001 +0000
+++ b/src/dialog-msw.c	Thu Sep 20 06:31:11 2001 +0000
@@ -253,7 +253,7 @@
 /* Helper function which converts the supplied string STRING into Unicode and
    pushes it at the end of DYNARR */
 static void
-push_bufbyte_string_as_unicode (unsigned_char_dynarr* dynarr, Bufbyte *string,
+push_intbyte_string_as_unicode (unsigned_char_dynarr* dynarr, Intbyte *string,
 				Bytecount len)
 {
   Extbyte *mbcs_string;
@@ -474,7 +474,7 @@
 
   /* Determine the final width layout */
   {
-    Bufbyte *p = XSTRING_DATA (question);
+    Intbyte *p = XSTRING_DATA (question);
     Charcount string_max = 0, this_length = 0;
     while (1)
       {
@@ -504,7 +504,7 @@
   
   /* Now calculate the height for the text control */
   {
-    Bufbyte *p = XSTRING_DATA (question);
+    Intbyte *p = XSTRING_DATA (question);
     Charcount break_at = text_width / X_DLU_PER_CHAR;
     Charcount char_pos = 0;
     int num_lines = 1;
@@ -612,7 +612,7 @@
 	{
 	  Lisp_Object ctext = pgui_item->name;
 	  Emchar accel_unused;
-	  Bufbyte *trans = (Bufbyte *) alloca (2 * XSTRING_LENGTH (ctext) + 3);
+	  Intbyte *trans = (Intbyte *) alloca (2 * XSTRING_LENGTH (ctext) + 3);
 	  Bytecount translen;
 
 	  memcpy (trans, XSTRING_DATA (ctext), XSTRING_LENGTH (ctext) + 1);
@@ -622,7 +622,7 @@
 					       2 * XSTRING_LENGTH (ctext) + 3,
 					       &accel_unused,
 					       ctext);
-	  push_bufbyte_string_as_unicode (template_, trans, translen);
+	  push_intbyte_string_as_unicode (template_, trans, translen);
 	}
 
 	/* Specify 0 length creation data. */
--- a/src/dired.c	Tue Sep 18 05:06:57 2001 +0000
+++ b/src/dired.c	Thu Sep 20 06:31:11 2001 +0000
@@ -166,7 +166,7 @@
 
 	  {
 	    Lisp_Object name =
-	      make_string ((Bufbyte *)dp->d_name, len);
+	      make_string ((Intbyte *)dp->d_name, len);
 	    if (!NILP (full))
 	      name = concat2 (directory, name);
 
@@ -356,13 +356,13 @@
 	  Charcount cclen;
           int directoryp;
           int ignored_extension_p = 0;
-	  Bufbyte *d_name;
+	  Intbyte *d_name;
 
 	  dp = readdir (d);
 	  if (!dp) break;
 
-	  /* Cast to Bufbyte* is OK, as readdir() Mule-encapsulates.  */
-	  d_name = (Bufbyte *) dp->d_name;
+	  /* Cast to Intbyte* is OK, as readdir() Mule-encapsulates.  */
+	  d_name = (Intbyte *) dp->d_name;
 	  len = NAMLEN (dp);
 	  cclen = bytecount_to_charcount (d_name, len);
 
@@ -450,8 +450,8 @@
           else
             {
               Charcount compare = min (bestmatchsize, cclen);
-              Bufbyte *p1 = XSTRING_DATA (bestmatch);
-              Bufbyte *p2 = d_name;
+              Intbyte *p1 = XSTRING_DATA (bestmatch);
+              Intbyte *p2 = d_name;
               Charcount matchsize = scmp (p1, p2, compare);
 
               if (matchsize < 0)
@@ -562,7 +562,7 @@
 
 struct user_name
 {
-  Bufbyte *ptr;
+  Intbyte *ptr;
   Bytecount len;
 };
 
@@ -729,7 +729,7 @@
 
   for (i = 0; i < user_cache.length; i++)
     {
-      Bufbyte *u_name = user_cache.user_names[i].ptr;
+      Intbyte *u_name = user_cache.user_names[i].ptr;
       Bytecount len   = user_cache.user_names[i].len;
       /* scmp() works in chars, not bytes, so we have to compute this: */
       Charcount cclen = bytecount_to_charcount (u_name, len);
@@ -763,8 +763,8 @@
       else
         {
           Charcount compare = min (bestmatchsize, cclen);
-          Bufbyte *p1 = XSTRING_DATA (bestmatch);
-          Bufbyte *p2 = u_name;
+          Intbyte *p1 = XSTRING_DATA (bestmatch);
+          Intbyte *p2 = u_name;
           Charcount matchsize = scmp_1 (p1, p2, compare, 0);
 
           if (matchsize < 0)
@@ -801,8 +801,8 @@
 	{
 	  Bytecount len = NAMLEN (dp);
 	  if (DIRENTRY_NONEMPTY (dp))
-	    /* Cast to Bufbyte* is OK, as readdir() Mule-encapsulates.  */
-	    Fputhash (make_string ((Bufbyte *) dp->d_name, len), Qt, hash);
+	    /* Cast to Intbyte* is OK, as readdir() Mule-encapsulates.  */
+	    Fputhash (make_string ((Intbyte *) dp->d_name, len), Qt, hash);
 	}
       closedir (d);
       return hash;
@@ -915,7 +915,7 @@
   if (XINT (values[7]) != s.st_size)
     values[7] = make_int (-1);
   filemodestring (&s, modes);
-  values[8] = make_string ((Bufbyte *) modes, 10);
+  values[8] = make_string ((Intbyte *) modes, 10);
 #if defined (BSD4_2) || defined (BSD4_3)	/* file gid will be dir gid */
   {
     struct stat sdir;
--- a/src/doc.c	Tue Sep 18 05:06:57 2001 +0000
+++ b/src/doc.c	Thu Sep 20 06:31:11 2001 +0000
@@ -148,7 +148,7 @@
 
 #define string_join(dest, s1, s2) \
   memcpy ((void *) dest, (void *) XSTRING_DATA (s1), XSTRING_LENGTH (s1)); \
-  memcpy ((void *) ((Bufbyte *) dest + XSTRING_LENGTH (s1)), \
+  memcpy ((void *) ((Intbyte *) dest + XSTRING_LENGTH (s1)), \
           (void *) XSTRING_DATA (s2), XSTRING_LENGTH (s2));  \
           dest[XSTRING_LENGTH (s1) + XSTRING_LENGTH (s2)] = '\0'
 
@@ -466,7 +466,7 @@
       if (p != end)
 	{
 	  end = strchr (p, '\n');
-	  sym = oblookup (Vobarray, (Bufbyte *) p + 2, end - p - 2);
+	  sym = oblookup (Vobarray, (Intbyte *) p + 2, end - p - 2);
 	  if (SYMBOLP (sym))
 	    {
               Lisp_Object offset = make_int (pos + end + 1 - buf);
@@ -748,18 +748,18 @@
        (string))
 {
   /* This function can GC */
-  Bufbyte *buf;
+  Intbyte *buf;
   int changed = 0;
-  REGISTER Bufbyte *strdata;
-  REGISTER Bufbyte *bufp;
+  REGISTER Intbyte *strdata;
+  REGISTER Intbyte *bufp;
   Bytecount strlength;
   Bytecount idx;
   Bytecount bsize;
-  Bufbyte *new;
+  Intbyte *new;
   Lisp_Object tem = Qnil;
   Lisp_Object keymap = Qnil;
   Lisp_Object name = Qnil;
-  Bufbyte *start;
+  Intbyte *start;
   Bytecount length;
   struct gcpro gcpro1, gcpro2, gcpro3, gcpro4;
 
@@ -794,14 +794,14 @@
 
   strlength = XSTRING_LENGTH (string);
   bsize = 1 + strlength;
-  buf = (Bufbyte *) xmalloc (bsize);
+  buf = (Intbyte *) xmalloc (bsize);
   bufp = buf;
 
   /* Have to reset strdata every time GC might be called */
   strdata = XSTRING_DATA (string);
   for (idx = 0; idx < strlength; )
     {
-      Bufbyte *strp = strdata + idx;
+      Intbyte *strp = strdata + idx;
 
       if (strp[0] != '\\')
 	{
@@ -866,7 +866,7 @@
 
 	    if (NILP (tem))	/* but not on any keys */
 	      {
-		new = (Bufbyte *) xrealloc (buf, bsize += 4);
+		new = (Intbyte *) xrealloc (buf, bsize += 4);
 		bufp += new - buf;
 		buf = new;
 		memcpy (bufp, "M-x ", 4);
@@ -940,7 +940,7 @@
 	  length = XSTRING_LENGTH (tem);
 	subst:
 	  bsize += length;
-	  new = (Bufbyte *) xrealloc (buf, bsize);
+	  new = (Intbyte *) xrealloc (buf, bsize);
 	  bufp += new - buf;
 	  buf = new;
 	  memcpy (bufp, start, length);
--- a/src/doprnt.c	Tue Sep 18 05:06:57 2001 +0000
+++ b/src/doprnt.c	Thu Sep 20 06:31:11 2001 +0000
@@ -68,7 +68,7 @@
   long l;
   unsigned long ul;
   double d;
-  Bufbyte *bp;
+  Intbyte *bp;
 };
 
 /* We maintain a list of all the % specs in the specification,
@@ -98,7 +98,7 @@
    Note that MINLEN and MAXLEN are Charcounts but LEN is a Bytecount. */
 
 static void
-doprnt_1 (Lisp_Object stream, const Bufbyte *string, Bytecount len,
+doprnt_1 (Lisp_Object stream, const Intbyte *string, Bytecount len,
 	  Charcount minlen, Charcount maxlen, int minus_flag, int zero_flag)
 {
   Lstream *lstr = XLSTREAM (stream);
@@ -120,11 +120,11 @@
       Lstream_putc (lstr, zero_flag ? '0' : ' ');
 }
 
-static const Bufbyte *
-parse_off_posnum (const Bufbyte *start, const Bufbyte *end, int *returned_num)
+static const Intbyte *
+parse_off_posnum (const Intbyte *start, const Intbyte *end, int *returned_num)
 {
-  Bufbyte arg_convert[100];
-  REGISTER Bufbyte *arg_ptr = arg_convert;
+  Intbyte arg_convert[100];
+  REGISTER Intbyte *arg_ptr = arg_convert;
 
   *returned_num = -1;
   while (start != end && isdigit (*start))
@@ -158,23 +158,23 @@
   } while (0)
 
 static printf_spec_dynarr *
-parse_doprnt_spec (const Bufbyte *format, Bytecount format_length)
+parse_doprnt_spec (const Intbyte *format, Bytecount format_length)
 {
-  const Bufbyte *fmt = format;
-  const Bufbyte *fmt_end = format + format_length;
+  const Intbyte *fmt = format;
+  const Intbyte *fmt_end = format + format_length;
   printf_spec_dynarr *specs = Dynarr_new (printf_spec);
   int prev_argnum = 0;
 
   while (1)
     {
       struct printf_spec spec;
-      const Bufbyte *text_end;
-      Bufbyte ch;
+      const Intbyte *text_end;
+      Intbyte ch;
 
       xzero (spec);
       if (fmt == fmt_end)
 	return specs;
-      text_end = (Bufbyte *) memchr (fmt, '%', fmt_end - fmt);
+      text_end = (Intbyte *) memchr (fmt, '%', fmt_end - fmt);
       if (!text_end)
 	text_end = fmt_end;
       spec.text_before = fmt - format;
@@ -196,7 +196,7 @@
 
 	  /* Is there a field number specifier? */
 	  {
-	    const Bufbyte *ptr;
+	    const Intbyte *ptr;
 	    int fieldspec;
 
 	    ptr = parse_off_posnum (fmt, fmt_end, &fieldspec);
@@ -382,7 +382,7 @@
       else if (strchr (double_converters, ch))
 	arg.d = va_arg (vargs, double);
       else if (strchr (string_converters, ch))
-	arg.bp = va_arg (vargs, Bufbyte *);
+	arg.bp = va_arg (vargs, Intbyte *);
       else abort ();
 
       Dynarr_add (args, arg);
@@ -401,7 +401,7 @@
    to the arguments. */
 
 static Bytecount
-emacs_doprnt_1 (Lisp_Object stream, const Bufbyte *format_nonreloc,
+emacs_doprnt_1 (Lisp_Object stream, const Intbyte *format_nonreloc,
 		Lisp_Object format_reloc, Bytecount format_length,
 		int nargs,
 		/* #### Gag me, gag me, gag me */
@@ -455,7 +455,7 @@
 
       if (ch == '%')
 	{
-	  doprnt_1 (stream, (Bufbyte *) &ch, 1, 0, -1, 0, 0);
+	  doprnt_1 (stream, (Intbyte *) &ch, 1, 0, -1, 0, 0);
 	  continue;
 	}
 
@@ -497,7 +497,7 @@
 
       else if (ch == 'S' || ch == 's')
 	{
-	  Bufbyte *string;
+	  Intbyte *string;
 	  Bytecount string_len;
 
 	  if (!largs)
@@ -511,7 +511,7 @@
                  empty string?  -dkindred@cs.cmu.edu 8/1997
 	      */
 	      if (!string)
-		string = (Bufbyte *) "(null)";
+		string = (Intbyte *) "(null)";
 	      string_len = strlen ((char *) string);
 	    }
 	  else
@@ -580,7 +580,7 @@
 	    {
 	      Emchar a;
 	      Bytecount charlen;
-	      Bufbyte charbuf[MAX_EMCHAR_LEN];
+	      Intbyte charbuf[MAX_EMCHAR_LEN];
 
 	      a = (Emchar) arg.l;
 
@@ -644,7 +644,7 @@
 		    sprintf (text_to_print, constructed_spec, arg.l);
 		}
 
-	      doprnt_1 (stream, (Bufbyte *) text_to_print,
+	      doprnt_1 (stream, (Intbyte *) text_to_print,
 			strlen (text_to_print), 0, -1, 0, 0);
 	    }
 	}
@@ -660,7 +660,7 @@
 
 /* You really don't want to know why this is necessary... */
 static Bytecount
-emacs_doprnt_2 (Lisp_Object stream, const Bufbyte *format_nonreloc,
+emacs_doprnt_2 (Lisp_Object stream, const Intbyte *format_nonreloc,
 		Lisp_Object format_reloc, Bytecount format_length, int nargs,
 		const Lisp_Object *largs, ...)
 {
@@ -695,7 +695,7 @@
    parameter, because this function can cause GC. */
 
 Bytecount
-emacs_doprnt_c (Lisp_Object stream, const Bufbyte *format_nonreloc,
+emacs_doprnt_c (Lisp_Object stream, const Intbyte *format_nonreloc,
 		Lisp_Object format_reloc, Bytecount format_length,
 		...)
 {
@@ -712,7 +712,7 @@
 /* Like emacs_doprnt_c but the args come in va_list format. */
 
 Bytecount
-emacs_doprnt_va (Lisp_Object stream, const Bufbyte *format_nonreloc,
+emacs_doprnt_va (Lisp_Object stream, const Intbyte *format_nonreloc,
 		 Lisp_Object format_reloc, Bytecount format_length,
 		 va_list vargs)
 {
@@ -726,7 +726,7 @@
    See `format' for a description of this behavior. */
 
 Bytecount
-emacs_doprnt_lisp (Lisp_Object stream, const Bufbyte *format_nonreloc,
+emacs_doprnt_lisp (Lisp_Object stream, const Intbyte *format_nonreloc,
 		   Lisp_Object format_reloc, Bytecount format_length,
 		   int nargs, const Lisp_Object *largs)
 {
@@ -737,7 +737,7 @@
 /* Like the previous function but takes a variable number of arguments. */
 
 Bytecount
-emacs_doprnt_lisp_2 (Lisp_Object stream, const Bufbyte *format_nonreloc,
+emacs_doprnt_lisp_2 (Lisp_Object stream, const Intbyte *format_nonreloc,
 		     Lisp_Object format_reloc, Bytecount format_length,
 		     int nargs, ...)
 {
@@ -759,7 +759,7 @@
    to a stream. */
 
 Lisp_Object
-emacs_doprnt_string_c (const Bufbyte *format_nonreloc,
+emacs_doprnt_string_c (const Intbyte *format_nonreloc,
 		       Lisp_Object format_reloc, Bytecount format_length,
 		       ...)
 {
@@ -782,7 +782,7 @@
 }
 
 Lisp_Object
-emacs_doprnt_string_va (const Bufbyte *format_nonreloc,
+emacs_doprnt_string_va (const Intbyte *format_nonreloc,
 			Lisp_Object format_reloc, Bytecount format_length,
 			va_list vargs)
 {
@@ -805,7 +805,7 @@
 }
 
 Lisp_Object
-emacs_doprnt_string_lisp (const Bufbyte *format_nonreloc,
+emacs_doprnt_string_lisp (const Intbyte *format_nonreloc,
 			  Lisp_Object format_reloc, Bytecount format_length,
 			  int nargs, const Lisp_Object *largs)
 {
@@ -825,7 +825,7 @@
 }
 
 Lisp_Object
-emacs_doprnt_string_lisp_2 (const Bufbyte *format_nonreloc,
+emacs_doprnt_string_lisp_2 (const Intbyte *format_nonreloc,
 			    Lisp_Object format_reloc, Bytecount format_length,
 			    int nargs, ...)
 {
--- a/src/dumper.c	Tue Sep 18 05:06:57 2001 +0000
+++ b/src/dumper.c	Thu Sep 20 06:31:11 2001 +0000
@@ -45,7 +45,7 @@
 typedef struct
 {
   const void *varaddress;
-  Memory_Count size;
+  Bytecount size;
 } pdump_opaque;
 
 typedef struct
@@ -84,7 +84,7 @@
 /* Mark SIZE bytes at non-heap address VARADDRESS for dumping as is,
    without any bit-twiddling. */
 void
-dump_add_opaque (const void *varaddress, Memory_Count size)
+dump_add_opaque (const void *varaddress, Bytecount size)
 {
   pdump_opaque info;
   info.varaddress = varaddress;
@@ -129,7 +129,7 @@
 
 
 inline static void
-pdump_align_stream (FILE *stream, Memory_Count alignment)
+pdump_align_stream (FILE *stream, Bytecount alignment)
 {
   long offset = ftell (stream);
   long adjustment = ALIGN_SIZE (offset, alignment) - offset;
@@ -215,7 +215,7 @@
 
 char *pdump_start;
 char *pdump_end;
-static Memory_Count pdump_length;
+static Bytecount pdump_length;
 
 #ifdef WIN32_NATIVE
 /* Handle for the dump file */
@@ -235,7 +235,7 @@
 };
 
 static inline int
-pdump_size_to_align (Memory_Count size)
+pdump_size_to_align (Bytecount size)
 {
   return pdump_align_table[size % countof (pdump_align_table)];
 }
@@ -244,7 +244,7 @@
 {
   struct pdump_entry_list_elt *next;
   const void *obj;
-  Memory_Count size;
+  Bytecount size;
   int count;
   EMACS_INT save_offset;
 } pdump_entry_list_elt;
@@ -276,7 +276,7 @@
 static int *pdump_alert_undump_object;
 
 static unsigned long cur_offset;
-static Memory_Count max_size;
+static Bytecount max_size;
 static int pdump_fd;
 static void *pdump_buf;
 static FILE *pdump_out;
@@ -313,7 +313,7 @@
 }
 
 static void
-pdump_add_entry (pdump_entry_list *list, const void *obj, Memory_Count size,
+pdump_add_entry (pdump_entry_list *list, const void *obj, Bytecount size,
 		 int count)
 {
   pdump_entry_list_elt *e;
@@ -423,14 +423,14 @@
   irdata = ((char *)idata) + idesc[line].offset;
   switch (idesc[line].type)
     {
-    case XD_MEMORY_COUNT:
-      count = *(Memory_Count *)irdata;
+    case XD_BYTECOUNT:
+      count = *(Bytecount *)irdata;
       break;
-    case XD_ELEMENT_COUNT:
-      count = *(Element_Count *)irdata;
+    case XD_ELEMCOUNT:
+      count = *(Elemcount *)irdata;
       break;
-    case XD_HASH_CODE:
-      count = *(Hash_Code *)irdata;
+    case XD_HASHCODE:
+      count = *(Hashcode *)irdata;
       break;
     case XD_INT:
       count = *(int *)irdata;
@@ -438,9 +438,6 @@
     case XD_LONG:
       count = *(long *)irdata;
       break;
-    case XD_BYTECOUNT:
-      count = *(Bytecount *)irdata;
-      break;
     default:
       stderr_out ("Unsupported count type : %d (line = %d, code=%ld)\n",
 		  idesc[line].type, line, (long)code);
@@ -471,12 +468,11 @@
 	  pos = 0;
 	  desc = ((const Lisp_Specifier *)data)->methods->extra_description;
 	  goto restart;
-	case XD_MEMORY_COUNT:
-	case XD_ELEMENT_COUNT:
-	case XD_HASH_CODE:
+	case XD_BYTECOUNT:
+	case XD_ELEMCOUNT:
+	case XD_HASHCODE:
 	case XD_INT:
 	case XD_LONG:
-	case XD_BYTECOUNT:
 	case XD_INT_RESET:
 	case XD_LO_LINK:
 	  break;
@@ -634,7 +630,7 @@
 pdump_dump_data (pdump_entry_list_elt *elt,
 		 const struct lrecord_description *desc)
 {
-  Memory_Count size = elt->size;
+  Bytecount size = elt->size;
   int count = elt->count;
   if (desc)
     {
@@ -653,12 +649,11 @@
 		case XD_SPECIFIER_END:
 		  desc = ((const Lisp_Specifier *)(elt->obj))->methods->extra_description;
 		  goto restart;
-		case XD_MEMORY_COUNT:
-		case XD_ELEMENT_COUNT:
-		case XD_HASH_CODE:
+		case XD_BYTECOUNT:
+		case XD_ELEMCOUNT:
+		case XD_HASHCODE:
 		case XD_INT:
 		case XD_LONG:
-		case XD_BYTECOUNT:
 		  break;
 		case XD_INT_RESET:
 		  {
@@ -751,12 +746,11 @@
 	  pos = 0;
 	  desc = ((const Lisp_Specifier *)data)->methods->extra_description;
 	  goto restart;
-	case XD_MEMORY_COUNT:
-	case XD_ELEMENT_COUNT:
-	case XD_HASH_CODE:
+	case XD_BYTECOUNT:
+	case XD_ELEMCOUNT:
+	case XD_HASHCODE:
 	case XD_INT:
 	case XD_LONG:
-	case XD_BYTECOUNT:
 	case XD_INT_RESET:
 	  break;
 	case XD_OPAQUE_DATA_PTR:
@@ -816,7 +810,7 @@
 pdump_allocate_offset (pdump_entry_list_elt *elt,
 		       const struct lrecord_description *desc)
 {
-  Memory_Count size = elt->count * elt->size;
+  Bytecount size = elt->count * elt->size;
   elt->save_offset = cur_offset;
   if (size>max_size)
     max_size = size;
@@ -857,7 +851,7 @@
 pdump_dump_root_struct_ptrs (void)
 {
   int i;
-  Element_Count count = Dynarr_length (pdump_root_struct_ptrs);
+  Elemcount count = Dynarr_length (pdump_root_struct_ptrs);
   pdump_static_pointer *data = alloca_array (pdump_static_pointer, count);
   for (i = 0; i < count; i++)
     {
@@ -933,11 +927,11 @@
 static void
 pdump_dump_root_objects (void)
 {
-  Element_Count count = (Dynarr_length (pdump_root_objects) +
+  Elemcount count = (Dynarr_length (pdump_root_objects) +
 			 Dynarr_length (pdump_weak_object_chains));
-  Element_Count i;
+  Elemcount i;
 
-  PDUMP_WRITE_ALIGNED (Element_Count, count);
+  PDUMP_WRITE_ALIGNED (Elemcount, count);
   PDUMP_ALIGN_OUTPUT (pdump_static_Lisp_Object);
 
   for (i = 0; i < Dynarr_length (pdump_root_objects); i++)
@@ -1155,7 +1149,7 @@
     }
 
   /* Put the pdump_root_objects variables in place */
-  i = PDUMP_READ_ALIGNED (p, Element_Count);
+  i = PDUMP_READ_ALIGNED (p, Elemcount);
   p = (char *) ALIGN_PTR (p, ALIGNOF (pdump_static_Lisp_Object));
   while (i--)
     {
@@ -1271,7 +1265,7 @@
 
   pdump_free = pdump_resource_free;
   pdump_length = SizeofResource (NULL, hRes);
-  if (pdump_length <= (Memory_Count) sizeof (pdump_header))
+  if (pdump_length <= (Bytecount) sizeof (pdump_header))
     {
       pdump_start = 0;
       return 0;
@@ -1304,7 +1298,7 @@
     return 0;
 
   pdump_length = lseek (fd, 0, SEEK_END);
-  if (pdump_length < (Memory_Count) sizeof (pdump_header))
+  if (pdump_length < (Bytecount) sizeof (pdump_header))
     {
       close (fd);
       return 0;
--- a/src/dynarr.c	Tue Sep 18 05:06:57 2001 +0000
+++ b/src/dynarr.c	Thu Sep 20 06:31:11 2001 +0000
@@ -214,10 +214,10 @@
    what was requested of it is returned in MALLOC_OVERHEAD in STATS.
    See the comment above the definition of this structure. */
 
-Memory_Count
+Bytecount
 Dynarr_memory_usage (void *d, struct overhead_stats *stats)
 {
-  Memory_Count total = 0;
+  Bytecount total = 0;
   Dynarr *dy = (Dynarr *) d;
 
   /* We have to be a bit tricky here because not all of the
@@ -226,7 +226,7 @@
 
   if (dy->base)
     {
-      Memory_Count malloc_used = malloced_storage_size (dy->base,
+      Bytecount malloc_used = malloced_storage_size (dy->base,
 						  dy->elsize * dy->max, 0);
       /* #### This may or may not be correct.  Some Dynarrs would
 	 prefer that we use dy->cur instead of dy->largest here. */
--- a/src/editfns.c	Tue Sep 18 05:06:57 2001 +0000
+++ b/src/editfns.c	Thu Sep 20 06:31:11 2001 +0000
@@ -105,7 +105,7 @@
        (character))
 {
   Bytecount len;
-  Bufbyte str[MAX_EMCHAR_LEN];
+  Intbyte str[MAX_EMCHAR_LEN];
 
   if (EVENTP (character))
     {
@@ -142,7 +142,7 @@
 
 
 static Lisp_Object
-buildmark (Bufpos val, Lisp_Object buffer)
+buildmark (Charbpos val, Lisp_Object buffer)
 {
   Lisp_Object mark = Fmake_marker ();
   Fset_marker (mark, make_int (val), buffer);
@@ -180,16 +180,16 @@
 /* The following two functions end up being identical but it's
    cleaner to declare them separately. */
 
-Bufpos
-bufpos_clip_to_bounds (Bufpos lower, Bufpos num, Bufpos upper)
+Charbpos
+charbpos_clip_to_bounds (Charbpos lower, Charbpos num, Charbpos upper)
 {
   return (num < lower ? lower :
 	  num > upper ? upper :
 	  num);
 }
 
-Bytind
-bytind_clip_to_bounds (Bytind lower, Bytind num, Bytind upper)
+Bytebpos
+bytebpos_clip_to_bounds (Bytebpos lower, Bytebpos num, Bytebpos upper)
 {
   return (num < lower ? lower :
 	  num > upper ? upper :
@@ -216,7 +216,7 @@
        (position, buffer))
 {
   struct buffer *b = decode_buffer (buffer, 1);
-  Bufpos n = get_buffer_pos_char (b, position, GB_COERCE_RANGE);
+  Charbpos n = get_buffer_pos_char (b, position, GB_COERCE_RANGE);
   BUF_SET_PT (b, n);
   atomic_extent_goto_char_p = 1;
   return make_int (n);
@@ -332,7 +332,7 @@
   /* #### Huh?  --hniksic */
   /*if (preparing_for_armageddon) return Qnil;*/
 
-#ifdef ERROR_CHECK_BUFPOS
+#ifdef ERROR_CHECK_CHARBPOS
   assert (XINT (Fpoint (Qnil)) ==
 	  XINT (Fmarker_position (Fpoint_marker (Qt, Qnil))));
 #endif
@@ -534,7 +534,7 @@
 }
 
 int
-beginning_of_line_p (struct buffer *b, Bufpos pt)
+beginning_of_line_p (struct buffer *b, Charbpos pt)
 {
   return pt <= BUF_BEGV (b) || BUF_FETCH_CHAR (b, pt - 1) == '\n';
 }
@@ -572,7 +572,7 @@
        (pos, buffer))
 {
   struct buffer *b = decode_buffer (buffer, 1);
-  Bufpos n = (NILP (pos) ? BUF_PT (b) :
+  Charbpos n = (NILP (pos) ? BUF_PT (b) :
 	      get_buffer_pos_char (b, pos, GB_NO_ERROR_IF_BAD));
 
   if (n < 0 || n == BUF_ZV (b))
@@ -590,7 +590,7 @@
        (pos, buffer))
 {
   struct buffer *b = decode_buffer (buffer, 1);
-  Bufpos n = (NILP (pos) ? BUF_PT (b) :
+  Charbpos n = (NILP (pos) ? BUF_PT (b) :
 	      get_buffer_pos_char (b, pos, GB_NO_ERROR_IF_BAD));
 
   n--;
@@ -1106,7 +1106,7 @@
        (format_string, time_))
 {
   time_t value;
-  Memory_Count size;
+  Bytecount size;
 
   CHECK_STRING (format_string);
 
@@ -1270,7 +1270,7 @@
   time_t value;
   char *the_ctime;
   EMACS_INT len; /* this is what make_ext_string() accepts; ####
-		    should it be an Extcount? */
+		    should it be an Bytecount? */
 
   if (! lisp_to_time (specified_time, &value))
     value = -1;
@@ -1591,12 +1591,12 @@
        (character, count, ignored, buffer))
 {
   /* This function can GC */
-  REGISTER Bufbyte *string;
+  REGISTER Intbyte *string;
   REGISTER int slen;
   REGISTER int i, j;
   REGISTER Bytecount n;
   REGISTER Bytecount charlen;
-  Bufbyte str[MAX_EMCHAR_LEN];
+  Intbyte str[MAX_EMCHAR_LEN];
   struct buffer *b = decode_buffer (buffer, 1);
   int cou;
 
@@ -1614,7 +1614,7 @@
   if (n <= 0)
     return Qnil;
   slen = min (n, 768);
-  string = alloca_array (Bufbyte, slen);
+  string = alloca_array (Intbyte, slen);
   /* Write as many copies of the character into the temp string as will fit. */
   for (i = 0; i + charlen <= slen; i += charlen)
     for (j = 0; j < charlen; j++)
@@ -1655,7 +1655,7 @@
        (start, end, buffer))
 {
   /* This function can GC */
-  Bufpos begv, zv;
+  Charbpos begv, zv;
   struct buffer *b = decode_buffer (buffer, 1);
 
   get_buffer_range_char (b, start, end, &begv, &zv, GB_ALLOW_NIL);
@@ -1672,7 +1672,7 @@
        (start, end, buffer))
 {
   /* This function can GC */
-  Bufpos begv, zv;
+  Charbpos begv, zv;
   struct buffer *b = decode_buffer (buffer, 1);
 
   get_buffer_range_char (b, start, end, &begv, &zv, GB_ALLOW_NIL);
@@ -1688,7 +1688,7 @@
        (buffer, start, end))
 {
   /* This function can GC */
-  Bufpos b, e;
+  Charbpos b, e;
   struct buffer *bp;
 
   bp = XBUFFER (get_buffer (buffer, 1));
@@ -1712,7 +1712,7 @@
 */
        (buffer1, start1, end1, buffer2, start2, end2))
 {
-  Bufpos begp1, endp1, begp2, endp2;
+  Charbpos begp1, endp1, begp2, endp2;
   REGISTER Charcount len1, len2, length, i;
   struct buffer *bp1, *bp2;
   Lisp_Object trt = ((!NILP (current_buffer->case_fold_search)) ?
@@ -1783,7 +1783,7 @@
   (start, end, fromchar, tochar, noundo))
 {
   /* This function can GC */
-  Bufpos pos, stop;
+  Charbpos pos, stop;
   Emchar fromc, toc;
   int mc_count;
   struct buffer *buf = current_buffer;
@@ -1861,7 +1861,7 @@
        (start, end, table))
 {
   /* This function can GC */
-  Bufpos pos, stop;	/* Limits of the region. */
+  Charbpos pos, stop;	/* Limits of the region. */
   int cnt = 0;		/* Number of changes made. */
   int mc_count;
   struct buffer *buf = current_buffer;
@@ -1879,7 +1879,7 @@
       if (size * (stop - pos) > 65536)
 	{
 	  Emchar *etable = alloca_array (Emchar, size);
-	  convert_bufbyte_string_into_emchar_string
+	  convert_intbyte_string_into_emchar_string
 	    (string_data (stable), string_length (stable), etable);
 	  for (; pos < stop && (oc = BUF_FETCH_CHAR (buf, pos), 1); pos++)
 	    {
@@ -1997,7 +1997,7 @@
        (start, end, buffer))
 {
   /* This function can GC */
-  Bufpos bp_start, bp_end;
+  Charbpos bp_start, bp_end;
   struct buffer *buf = decode_buffer (buffer, 1);
 
   get_buffer_range_char (buf, start, end, &bp_start, &bp_end, 0);
@@ -2054,14 +2054,14 @@
 */
        (start, end, buffer))
 {
-  Bufpos bp_start, bp_end;
+  Charbpos bp_start, bp_end;
   struct buffer *buf = decode_buffer (buffer, 1);
-  Bytind bi_start, bi_end;
+  Bytebpos bi_start, bi_end;
 
   get_buffer_range_char (buf, start, end, &bp_start, &bp_end,
 			 GB_ALLOW_PAST_ACCESSIBLE);
-  bi_start = bufpos_to_bytind (buf, bp_start);
-  bi_end = bufpos_to_bytind (buf, bp_end);
+  bi_start = charbpos_to_bytebpos (buf, bp_start);
+  bi_end = charbpos_to_bytebpos (buf, bp_end);
 
   SET_BOTH_BUF_BEGV (buf, bp_start, bi_start);
   SET_BOTH_BUF_ZV (buf, bp_end, bi_end);
@@ -2119,14 +2119,14 @@
     }
 
   {
-    Bufpos start, end;
-    Bytind bi_start, bi_end;
+    Charbpos start, end;
+    Bytebpos bi_start, bi_end;
 
     start = BUF_BEG (buf) + newhead;
     end = BUF_Z (buf) - newtail;
 
-    bi_start = bufpos_to_bytind (buf, start);
-    bi_end = bufpos_to_bytind (buf, end);
+    bi_start = charbpos_to_bytebpos (buf, start);
+    bi_end = charbpos_to_bytebpos (buf, end);
 
     if (BUF_BEGV (buf) != start)
       {
@@ -2145,7 +2145,7 @@
 
   /* If point is outside the new visible range, move it inside. */
   BUF_SET_PT (buf,
-              bufpos_clip_to_bounds (BUF_BEGV (buf),
+              charbpos_clip_to_bounds (BUF_BEGV (buf),
 				     BUF_PT (buf),
 				     BUF_ZV (buf)));
 
@@ -2307,7 +2307,7 @@
    It's the caller's job to see that (start1 <= end1 <= start2 <= end2).  */
 
 void
-transpose_markers (Bufpos start1, Bufpos end1, Bufpos start2, Bufpos end2)
+transpose_markers (Charbpos start1, Charbpos end1, Charbpos start2, Charbpos end2)
 {
   Charcount amt1, amt2, diff;
   Lisp_Object marker;
@@ -2343,7 +2343,7 @@
   for (marker = BUF_MARKERS (buf); !NILP (marker);
        marker = XMARKER (marker)->chain)
     {
-      Bufpos mpos = marker_position (marker);
+      Charbpos mpos = marker_position (marker);
       if (mpos >= start1 && mpos < end2)
 	{
 	  if (mpos < end1)
@@ -2372,7 +2372,7 @@
 */
   (start1, end1, start2, end2, leave_markers))
 {
-  Bufpos startr1, endr1, startr2, endr2;
+  Charbpos startr1, endr1, startr2, endr2;
   Charcount len1, len2;
   Lisp_Object string1, string2;
   struct buffer *buf = current_buffer;
--- a/src/eldap.c	Tue Sep 18 05:06:57 2001 +0000
+++ b/src/eldap.c	Thu Sep 20 06:31:11 2001 +0000
@@ -330,7 +330,7 @@
   err = ldap_bind_s (ld, ldap_binddn, ldap_passwd, ldap_auth);
   if (err != LDAP_SUCCESS)
     {
-      Bufbyte *interrmess;
+      Intbyte *interrmess;
       EXTERNAL_TO_C_STRING (ldap_err2string (err), interrmess, Qnative);
       signal_error (Qprocess_error, "Failed binding to the server",
 		    build_string (interrmess));
@@ -601,7 +601,7 @@
   struct berval *bervals;
   int rc;
   int i, j;
-  Element_Count len;
+  Elemcount len;
 
   Lisp_Object current = Qnil;
   Lisp_Object values  = Qnil;
@@ -622,7 +622,7 @@
     invalid_operation ("Cannot add void entry", entry);
 
   /* Build the ldap_mods array */
-  len = (Element_Count) XINT (Flength (entry));
+  len = (Elemcount) XINT (Flength (entry));
   ldap_mods = alloca_array (LDAPMod, len);
   ldap_mods_ptrs = alloca_array (LDAPMod *, 1 + len);
   i = 0;
@@ -637,7 +637,7 @@
       values = XCDR (current);
       if (CONSP (values))
         {
-	  len = (Element_Count) XINT (Flength (values));
+	  len = (Elemcount) XINT (Flength (values));
           bervals = alloca_array (struct berval, len);
           ldap_mods[i].mod_vals.modv_bvals =
             alloca_array (struct berval *, 1 + len);
@@ -695,7 +695,7 @@
   struct berval *bervals;
   int i, j, rc;
   Lisp_Object mod_op;
-  Element_Count len;
+  Elemcount len;
 
   Lisp_Object current = Qnil;
   Lisp_Object values  = Qnil;
@@ -714,7 +714,7 @@
     return Qnil;
 
   /* Build the ldap_mods array */
-  len = (Element_Count) XINT (Flength (mods));
+  len = (Elemcount) XINT (Flength (mods));
   ldap_mods = alloca_array (LDAPMod, len);
   ldap_mods_ptrs = alloca_array (LDAPMod *, 1 + len);
   i = 0;
@@ -740,7 +740,7 @@
       CHECK_STRING (XCAR (current));
       LISP_STRING_TO_EXTERNAL (XCAR (current), ldap_mods[i].mod_type, Qnative);
       values = XCDR (current);
-      len = (Element_Count) XINT (Flength (values));
+      len = (Elemcount) XINT (Flength (values));
       bervals = alloca_array (struct berval, len);
       ldap_mods[i].mod_vals.modv_bvals =
         alloca_array (struct berval *, 1 + len);
--- a/src/elhash.c	Tue Sep 18 05:06:57 2001 +0000
+++ b/src/elhash.c	Thu Sep 20 06:31:11 2001 +0000
@@ -82,12 +82,12 @@
 struct Lisp_Hash_Table
 {
   struct lcrecord_header header;
-  Element_Count size;
-  Element_Count count;
-  Element_Count rehash_count;
+  Elemcount size;
+  Elemcount count;
+  Elemcount rehash_count;
   double rehash_size;
   double rehash_threshold;
-  Element_Count golden_ratio;
+  Elemcount golden_ratio;
   hash_table_hash_function_t hash_function;
   hash_table_test_function_t test_function;
   hentry *hentries;
@@ -105,7 +105,7 @@
 #define HASH_TABLE_DEFAULT_REHASH_SIZE 1.3
 #define HASH_TABLE_MIN_SIZE 10
 
-#define HASH_CODE(key, ht)						\
+#define HASHCODE(key, ht)						\
   ((((ht)->hash_function ? (ht)->hash_function (key) : LISP_HASH (key))	\
     * (ht)->golden_ratio)						\
    % (ht)->size)
@@ -143,13 +143,13 @@
 #endif
 
 /* Return a suitable size for a hash table, with at least SIZE slots. */
-static Element_Count
-hash_table_size (Element_Count requested_size)
+static Elemcount
+hash_table_size (Elemcount requested_size)
 {
   /* Return some prime near, but greater than or equal to, SIZE.
      Decades from the time of writing, someone will have a system large
      enough that the list below will be too short... */
-  static const Element_Count primes [] =
+  static const Elemcount primes [] =
   {
     19, 29, 41, 59, 79, 107, 149, 197, 263, 347, 457, 599, 787, 1031,
     1361, 1777, 2333, 3037, 3967, 5167, 6719, 8737, 11369, 14783,
@@ -188,7 +188,7 @@
   return !strcmp ((char *) XSTRING_DATA (str1), (char *) XSTRING_DATA (str2));
 }
 
-static Hash_Code
+static Hashcode
 lisp_string_hash (Lisp_Object obj)
 {
   return hash_string (XSTRING_DATA (str), XSTRING_LENGTH (str));
@@ -202,7 +202,7 @@
   return EQ (obj1, obj2) || (FLOATP (obj1) && internal_equal (obj1, obj2, 0));
 }
 
-static Hash_Code
+static Hashcode
 lisp_object_eql_hash (Lisp_Object obj)
 {
   return FLOATP (obj) ? internal_hash (obj, 0) : LISP_HASH (obj);
@@ -214,7 +214,7 @@
   return internal_equal (obj1, obj2, 0);
 }
 
-static Hash_Code
+static Hashcode
 lisp_object_equal_hash (Lisp_Object obj)
 {
   return internal_hash (obj, 0);
@@ -283,7 +283,7 @@
 /* This is not a great hash function, but it _is_ correct and fast.
    Examining all entries is too expensive, and examining a random
    subset does not yield a correct hash function. */
-static Hash_Code
+static Hashcode
 hash_table_hash (Lisp_Object hash_table, int depth)
 {
   return XHASH_TABLE (hash_table)->count;
@@ -434,7 +434,7 @@
 };
 
 const struct lrecord_description hash_table_description[] = {
-  { XD_ELEMENT_COUNT,     offsetof (Lisp_Hash_Table, size) },
+  { XD_ELEMCOUNT,     offsetof (Lisp_Hash_Table, size) },
   { XD_STRUCT_PTR, offsetof (Lisp_Hash_Table, hentries), XD_INDIRECT(0, 1), &hentry_description },
   { XD_LO_LINK,    offsetof (Lisp_Hash_Table, next_weak) },
   { XD_END }
@@ -465,15 +465,15 @@
 static void
 compute_hash_table_derived_values (Lisp_Hash_Table *ht)
 {
-  ht->rehash_count = (Element_Count)
+  ht->rehash_count = (Elemcount)
     ((double) ht->size * ht->rehash_threshold);
-  ht->golden_ratio = (Element_Count)
+  ht->golden_ratio = (Elemcount)
     ((double) ht->size * (.6180339887 / (double) sizeof (Lisp_Object)));
 }
 
 Lisp_Object
 make_standard_lisp_hash_table (enum hash_table_test test,
-			       Element_Count size,
+			       Elemcount size,
 			       double rehash_size,
 			       double rehash_threshold,
 			       enum hash_table_weakness weakness)
@@ -510,7 +510,7 @@
 Lisp_Object
 make_general_lisp_hash_table (hash_table_hash_function_t hash_function,
 			      hash_table_test_function_t test_function,
-			      Element_Count size,
+			      Elemcount size,
 			      double rehash_size,
 			      double rehash_threshold,
 			      enum hash_table_weakness weakness)
@@ -531,7 +531,7 @@
 
   if (size < HASH_TABLE_MIN_SIZE)
     size = HASH_TABLE_MIN_SIZE;
-  ht->size = hash_table_size ((Element_Count) (((double) size / ht->rehash_threshold)
+  ht->size = hash_table_size ((Elemcount) (((double) size / ht->rehash_threshold)
 					+ 1.0));
   ht->count = 0;
 
@@ -551,7 +551,7 @@
 }
 
 Lisp_Object
-make_lisp_hash_table (Element_Count size,
+make_lisp_hash_table (Elemcount size,
 		      enum hash_table_weakness weakness,
 		      enum hash_table_test test)
 {
@@ -581,7 +581,7 @@
   return 0;
 }
 
-static Element_Count
+static Elemcount
 decode_hash_table_size (Lisp_Object obj)
 {
   return NILP (obj) ? HASH_TABLE_DEFAULT_SIZE : XINT (obj);
@@ -956,10 +956,10 @@
 }
 
 static void
-resize_hash_table (Lisp_Hash_Table *ht, Element_Count new_size)
+resize_hash_table (Lisp_Hash_Table *ht, Elemcount new_size)
 {
   hentry *old_entries, *new_entries, *sentinel, *e;
-  Element_Count old_size;
+  Elemcount old_size;
 
   old_size = ht->size;
   ht->size = new_size;
@@ -974,7 +974,7 @@
   for (e = old_entries, sentinel = e + old_size; e < sentinel; e++)
     if (!HENTRY_CLEAR_P (e))
       {
-	hentry *probe = new_entries + HASH_CODE (e->key, ht);
+	hentry *probe = new_entries + HASHCODE (e->key, ht);
 	LINEAR_PROBING_LOOP (probe, new_entries, new_size)
 	  ;
 	*probe = *e;
@@ -985,7 +985,7 @@
 
 /* After a hash table has been saved to disk and later restored by the
    portable dumper, it contains the same objects, but their addresses
-   and thus their HASH_CODEs have changed. */
+   and thus their HASHCODEs have changed. */
 void
 pdump_reorganize_hash_table (Lisp_Object hash_table)
 {
@@ -996,7 +996,7 @@
   for (e = ht->hentries, sentinel = e + ht->size; e < sentinel; e++)
     if (!HENTRY_CLEAR_P (e))
       {
-	hentry *probe = new_entries + HASH_CODE (e->key, ht);
+	hentry *probe = new_entries + HASHCODE (e->key, ht);
 	LINEAR_PROBING_LOOP (probe, new_entries, ht->size)
 	  ;
 	*probe = *e;
@@ -1010,8 +1010,8 @@
 static void
 enlarge_hash_table (Lisp_Hash_Table *ht)
 {
-  Element_Count new_size =
-    hash_table_size ((Element_Count) ((double) ht->size * ht->rehash_size));
+  Elemcount new_size =
+    hash_table_size ((Elemcount) ((double) ht->size * ht->rehash_size));
   resize_hash_table (ht, new_size);
 }
 
@@ -1020,7 +1020,7 @@
 {
   hash_table_test_function_t test_function = ht->test_function;
   hentry *entries = ht->hentries;
-  hentry *probe = entries + HASH_CODE (key, ht);
+  hentry *probe = entries + HASHCODE (key, ht);
 
   LINEAR_PROBING_LOOP (probe, entries, ht->size)
     if (KEYS_EQUAL_P (probe->key, key, test_function))
@@ -1067,7 +1067,7 @@
 static void
 remhash_1 (Lisp_Hash_Table *ht, hentry *entries, hentry *probe)
 {
-  Element_Count size = ht->size;
+  Elemcount size = ht->size;
   CLEAR_HENTRY (probe);
   probe++;
   ht->count--;
@@ -1075,7 +1075,7 @@
   LINEAR_PROBING_LOOP (probe, entries, size)
     {
       Lisp_Object key = probe->key;
-      hentry *probe2 = entries + HASH_CODE (key, ht);
+      hentry *probe2 = entries + HASHCODE (key, ht);
       LINEAR_PROBING_LOOP (probe2, entries, size)
 	if (EQ (probe2->key, key))
 	  /* hentry at probe doesn't need to move. */
@@ -1550,11 +1550,11 @@
 
 /* Return a hash value for an array of Lisp_Objects of size SIZE. */
 
-Hash_Code
+Hashcode
 internal_array_hash (Lisp_Object *arr, int size, int depth)
 {
   int i;
-  Hash_Code hash = 0;
+  Hashcode hash = 0;
   depth++;
 
   if (size <= 5)
@@ -1585,7 +1585,7 @@
    we could still take 5^5 time (a big big number) to compute a
    hash, but practically this won't ever happen. */
 
-Hash_Code
+Hashcode
 internal_hash (Lisp_Object obj, int depth)
 {
   if (depth > 5)
@@ -1629,7 +1629,7 @@
        (object))
 {
   /* This function is pretty 32bit-centric. */
-  Hash_Code hash = internal_hash (object, 0);
+  Hashcode hash = internal_hash (object, 0);
   return Fcons (hash >> 16, hash & 0xffff);
 }
 #endif
--- a/src/elhash.h	Tue Sep 18 05:06:57 2001 +0000
+++ b/src/elhash.h	Thu Sep 20 06:31:11 2001 +0000
@@ -68,19 +68,19 @@
 				   void* extra_arg);
 
 Lisp_Object make_standard_lisp_hash_table (enum hash_table_test test,
-					   Element_Count size,
+					   Elemcount size,
 					   double rehash_size,
 					   double rehash_threshold,
 					   enum hash_table_weakness weakness);
 
 Lisp_Object make_general_lisp_hash_table (hash_table_hash_function_t hash_function,
 					  hash_table_test_function_t test_function,
-					  Element_Count size,
+					  Elemcount size,
 					  double rehash_size,
 					  double rehash_threshold,
 					  enum hash_table_weakness weakness);
 
-Lisp_Object make_lisp_hash_table (Element_Count size,
+Lisp_Object make_lisp_hash_table (Elemcount size,
 				  enum hash_table_weakness weakness,
 				  enum hash_table_test test);
 
--- a/src/emacs.c	Tue Sep 18 05:06:57 2001 +0000
+++ b/src/emacs.c	Thu Sep 20 06:31:11 2001 +0000
@@ -3135,15 +3135,15 @@
 /* Split STRING into a list of substrings.  The substrings are the
    parts of original STRING separated by SEPCHAR.  */
 static Lisp_Object
-split_string_by_emchar_1 (const Bufbyte *string, Bytecount size,
+split_string_by_emchar_1 (const Intbyte *string, Bytecount size,
 			  Emchar sepchar)
 {
   Lisp_Object result = Qnil;
-  const Bufbyte *end = string + size;
+  const Intbyte *end = string + size;
 
   while (1)
     {
-      const Bufbyte *p = string;
+      const Intbyte *p = string;
       while (p < end)
 	{
 	  if (charptr_emchar (p) == sepchar)
@@ -3169,7 +3169,7 @@
 decode_path (const char *path)
 {
   Bytecount newlen;
-  Bufbyte *newpath;
+  Intbyte *newpath;
   if (!path)
     return Qnil;
 
@@ -3584,7 +3584,7 @@
 typecheck	- check types strictly, aborting in case of error;
 malloc		- check operation of malloc;
 gc		- check garbage collection;
-bufpos		- check buffer positions.
+charbpos		- check buffer positions.
 
 quick-build     - user has requested the "quick-build" configure option.
 */ );
@@ -3605,8 +3605,8 @@
   Vinternal_error_checking = Fcons (intern ("gc"),
 				    Vinternal_error_checking);
 #endif
-#ifdef ERROR_CHECK_BUFPOS
-  Vinternal_error_checking = Fcons (intern ("bufpos"),
+#ifdef ERROR_CHECK_CHARBPOS
+  Vinternal_error_checking = Fcons (intern ("charbpos"),
 				    Vinternal_error_checking);
 #endif
 #ifdef QUICK_BUILD
@@ -3659,7 +3659,7 @@
 */ );
   {
     char c = SEPCHAR;
-    Vpath_separator = make_string ((Bufbyte *)&c, 1);
+    Vpath_separator = make_string ((Intbyte *)&c, 1);
   }
 }
 
--- a/src/emodules.c	Tue Sep 18 05:06:57 2001 +0000
+++ b/src/emodules.c	Thu Sep 20 06:31:11 2001 +0000
@@ -351,7 +351,7 @@
   dlhandle = dll_open (soname);
   if (dlhandle == (dll_handle)0)
     {
-      CBufbyte *dllerrint;
+      CIntbyte *dllerrint;
 
       EXTERNAL_TO_C_STRING (dll_error (dlhandle), dllerrint, Qnative);
       signal_error (Qdll_error, "Opening dynamic module",
@@ -492,7 +492,7 @@
 emodules_doc_subr(const char *symname, const char *doc)
 {
   Bytecount len = strlen (symname);
-  Lisp_Object sym = oblookup (Vobarray, (const Bufbyte *)symname, len);
+  Lisp_Object sym = oblookup (Vobarray, (const Intbyte *)symname, len);
   Lisp_Subr *subr;
 
   if (SYMBOLP(sym))
@@ -512,7 +512,7 @@
 emodules_doc_sym (const char *symname, const char *doc)
 {
   Bytecount len = strlen (symname);
-  Lisp_Object sym = oblookup (Vobarray, (const Bufbyte *)symname, len);
+  Lisp_Object sym = oblookup (Vobarray, (const Intbyte *)symname, len);
   Lisp_Object docstr;
   struct gcpro gcpro1;
 
--- a/src/eval.c	Tue Sep 18 05:06:57 2001 +0000
+++ b/src/eval.c	Thu Sep 20 06:31:11 2001 +0000
@@ -284,10 +284,10 @@
 print_subr (Lisp_Object obj, Lisp_Object printcharfun, int escapeflag)
 {
   Lisp_Subr *subr = XSUBR (obj);
-  const CBufbyte *header =
+  const CIntbyte *header =
     (subr->max_args == UNEVALLED) ? "#<special-form " : "#<subr ";
-  const CBufbyte *name = subr_name (subr);
-  const CBufbyte *trailer = subr->prompt ? " (interactive)>" : ">";
+  const CIntbyte *name = subr_name (subr);
+  const CIntbyte *trailer = subr->prompt ? " (interactive)>" : ">";
 
   if (print_readably)
     printing_unreadable_object ("%s%s%s", header, name, trailer);
@@ -2317,7 +2317,7 @@
    to signal_error_1(). */
 
 Lisp_Object
-build_error_data (const CBufbyte *reason, Lisp_Object frob)
+build_error_data (const CIntbyte *reason, Lisp_Object frob)
 {
   if (EQ (frob, Qunbound))
     frob = Qnil;
@@ -2332,13 +2332,13 @@
 }
 
 DOESNT_RETURN
-signal_error (Lisp_Object type, const CBufbyte *reason, Lisp_Object frob)
+signal_error (Lisp_Object type, const CIntbyte *reason, Lisp_Object frob)
 {
   signal_error_1 (type, build_error_data (reason, frob));
 }
 
 void
-maybe_signal_error (Lisp_Object type, const CBufbyte *reason,
+maybe_signal_error (Lisp_Object type, const CIntbyte *reason,
 		    Lisp_Object frob, Lisp_Object class,
 		    Error_Behavior errb)
 {
@@ -2349,14 +2349,14 @@
 }
 
 Lisp_Object
-signal_continuable_error (Lisp_Object type, const CBufbyte *reason,
+signal_continuable_error (Lisp_Object type, const CIntbyte *reason,
 			  Lisp_Object frob)
 {
   return Fsignal (type, build_error_data (reason, frob));
 }
 
 Lisp_Object
-maybe_signal_continuable_error (Lisp_Object type, const CBufbyte *reason,
+maybe_signal_continuable_error (Lisp_Object type, const CIntbyte *reason,
 				Lisp_Object frob, Lisp_Object class,
 				Error_Behavior errb)
 {
@@ -2378,7 +2378,7 @@
    but these are more convenient in this particular case.) */
 
 DOESNT_RETURN
-signal_error_2 (Lisp_Object type, const CBufbyte *reason,
+signal_error_2 (Lisp_Object type, const CIntbyte *reason,
 		Lisp_Object frob0, Lisp_Object frob1)
 {
   signal_error_1 (type, list3 (build_translated_string (reason), frob0,
@@ -2386,7 +2386,7 @@
 }
 
 void
-maybe_signal_error_2 (Lisp_Object type, const CBufbyte *reason,
+maybe_signal_error_2 (Lisp_Object type, const CIntbyte *reason,
 		      Lisp_Object frob0, Lisp_Object frob1,
 		      Lisp_Object class, Error_Behavior errb)
 {
@@ -2398,7 +2398,7 @@
 }
 
 Lisp_Object
-signal_continuable_error_2 (Lisp_Object type, const CBufbyte *reason,
+signal_continuable_error_2 (Lisp_Object type, const CIntbyte *reason,
 			    Lisp_Object frob0, Lisp_Object frob1)
 {
   return Fsignal (type, list3 (build_translated_string (reason), frob0,
@@ -2406,7 +2406,7 @@
 }
 
 Lisp_Object
-maybe_signal_continuable_error_2 (Lisp_Object type, const CBufbyte *reason,
+maybe_signal_continuable_error_2 (Lisp_Object type, const CIntbyte *reason,
 				  Lisp_Object frob0, Lisp_Object frob1,
 				  Lisp_Object class, Error_Behavior errb)
 {
@@ -2426,13 +2426,13 @@
    is a single string, created using the arguments. */
 
 DOESNT_RETURN
-signal_ferror (Lisp_Object type, const CBufbyte *fmt, ...)
+signal_ferror (Lisp_Object type, const CIntbyte *fmt, ...)
 {
   Lisp_Object obj;
   va_list args;
 
   va_start (args, fmt);
-  obj = emacs_doprnt_string_va ((const Bufbyte *) GETTEXT (fmt), Qnil, -1,
+  obj = emacs_doprnt_string_va ((const Intbyte *) GETTEXT (fmt), Qnil, -1,
 				args);
   va_end (args);
 
@@ -2442,7 +2442,7 @@
 
 void
 maybe_signal_ferror (Lisp_Object type, Lisp_Object class, Error_Behavior errb,
-		     const CBufbyte *fmt, ...)
+		     const CIntbyte *fmt, ...)
 {
   Lisp_Object obj;
   va_list args;
@@ -2452,7 +2452,7 @@
     return;
 
   va_start (args, fmt);
-  obj = emacs_doprnt_string_va ((const Bufbyte *) GETTEXT (fmt), Qnil, -1,
+  obj = emacs_doprnt_string_va ((const Intbyte *) GETTEXT (fmt), Qnil, -1,
 				args);
   va_end (args);
 
@@ -2461,13 +2461,13 @@
 }
 
 Lisp_Object
-signal_continuable_ferror (Lisp_Object type, const CBufbyte *fmt, ...)
+signal_continuable_ferror (Lisp_Object type, const CIntbyte *fmt, ...)
 {
   Lisp_Object obj;
   va_list args;
 
   va_start (args, fmt);
-  obj = emacs_doprnt_string_va ((const Bufbyte *) GETTEXT (fmt), Qnil, -1,
+  obj = emacs_doprnt_string_va ((const Intbyte *) GETTEXT (fmt), Qnil, -1,
 				args);
   va_end (args);
 
@@ -2477,7 +2477,7 @@
 
 Lisp_Object
 maybe_signal_continuable_ferror (Lisp_Object type, Lisp_Object class,
-				 Error_Behavior errb, const CBufbyte *fmt, ...)
+				 Error_Behavior errb, const CIntbyte *fmt, ...)
 {
   Lisp_Object obj;
   va_list args;
@@ -2487,7 +2487,7 @@
     return Qnil;
 
   va_start (args, fmt);
-  obj = emacs_doprnt_string_va ((const Bufbyte *) GETTEXT (fmt), Qnil, -1,
+  obj = emacs_doprnt_string_va ((const Intbyte *) GETTEXT (fmt), Qnil, -1,
 				args);
   va_end (args);
 
@@ -2511,14 +2511,14 @@
 */
 
 DOESNT_RETURN
-signal_ferror_with_frob (Lisp_Object type, Lisp_Object frob, const CBufbyte *fmt,
+signal_ferror_with_frob (Lisp_Object type, Lisp_Object frob, const CIntbyte *fmt,
 			 ...)
 {
   Lisp_Object obj;
   va_list args;
 
   va_start (args, fmt);
-  obj = emacs_doprnt_string_va ((const Bufbyte *) GETTEXT (fmt), Qnil, -1,
+  obj = emacs_doprnt_string_va ((const Intbyte *) GETTEXT (fmt), Qnil, -1,
 				args);
   va_end (args);
 
@@ -2529,7 +2529,7 @@
 void
 maybe_signal_ferror_with_frob (Lisp_Object type, Lisp_Object frob,
 			       Lisp_Object class, Error_Behavior errb,
-			       const CBufbyte *fmt, ...)
+			       const CIntbyte *fmt, ...)
 {
   Lisp_Object obj;
   va_list args;
@@ -2539,7 +2539,7 @@
     return;
 
   va_start (args, fmt);
-  obj = emacs_doprnt_string_va ((const Bufbyte *) GETTEXT (fmt), Qnil, -1,
+  obj = emacs_doprnt_string_va ((const Intbyte *) GETTEXT (fmt), Qnil, -1,
 				args);
   va_end (args);
 
@@ -2550,13 +2550,13 @@
 
 Lisp_Object
 signal_continuable_ferror_with_frob (Lisp_Object type, Lisp_Object frob,
-				     const CBufbyte *fmt, ...)
+				     const CIntbyte *fmt, ...)
 {
   Lisp_Object obj;
   va_list args;
 
   va_start (args, fmt);
-  obj = emacs_doprnt_string_va ((const Bufbyte *) GETTEXT (fmt), Qnil, -1,
+  obj = emacs_doprnt_string_va ((const Intbyte *) GETTEXT (fmt), Qnil, -1,
 				args);
   va_end (args);
 
@@ -2568,7 +2568,7 @@
 maybe_signal_continuable_ferror_with_frob (Lisp_Object type, Lisp_Object frob,
 					   Lisp_Object class,
 					   Error_Behavior errb,
-					   const CBufbyte *fmt, ...)
+					   const CIntbyte *fmt, ...)
 {
   Lisp_Object obj;
   va_list args;
@@ -2578,7 +2578,7 @@
     return Qnil;
 
   va_start (args, fmt);
-  obj = emacs_doprnt_string_va ((const Bufbyte *) GETTEXT (fmt), Qnil, -1,
+  obj = emacs_doprnt_string_va ((const Intbyte *) GETTEXT (fmt), Qnil, -1,
 				args);
   va_end (args);
 
@@ -2650,167 +2650,167 @@
 }
 
 DOESNT_RETURN
-syntax_error (const CBufbyte *reason, Lisp_Object frob)
+syntax_error (const CIntbyte *reason, Lisp_Object frob)
 {
   signal_error (Qsyntax_error, reason, frob);
 }
 
 DOESNT_RETURN
-syntax_error_2 (const CBufbyte *reason, Lisp_Object frob1, Lisp_Object frob2)
+syntax_error_2 (const CIntbyte *reason, Lisp_Object frob1, Lisp_Object frob2)
 {
   signal_error_2 (Qsyntax_error, reason, frob1, frob2);
 }
 
 void
-maybe_syntax_error (const CBufbyte *reason, Lisp_Object frob,
+maybe_syntax_error (const CIntbyte *reason, Lisp_Object frob,
 		    Lisp_Object class, Error_Behavior errb)
 {
   maybe_signal_error (Qsyntax_error, reason, frob, class, errb);
 }
 
 DOESNT_RETURN
-sferror (const CBufbyte *reason, Lisp_Object frob)
+sferror (const CIntbyte *reason, Lisp_Object frob)
 {
   signal_error (Qstructure_formation_error, reason, frob);
 }
 
 DOESNT_RETURN
-sferror_2 (const CBufbyte *reason, Lisp_Object frob1, Lisp_Object frob2)
+sferror_2 (const CIntbyte *reason, Lisp_Object frob1, Lisp_Object frob2)
 {
   signal_error_2 (Qstructure_formation_error, reason, frob1, frob2);
 }
 
 void
-maybe_sferror (const CBufbyte *reason, Lisp_Object frob,
+maybe_sferror (const CIntbyte *reason, Lisp_Object frob,
 	       Lisp_Object class, Error_Behavior errb)
 {
   maybe_signal_error (Qstructure_formation_error, reason, frob, class, errb);
 }
 
 DOESNT_RETURN
-invalid_argument (const CBufbyte *reason, Lisp_Object frob)
+invalid_argument (const CIntbyte *reason, Lisp_Object frob)
 {
   signal_error (Qinvalid_argument, reason, frob);
 }
 
 DOESNT_RETURN
-invalid_argument_2 (const CBufbyte *reason, Lisp_Object frob1,
+invalid_argument_2 (const CIntbyte *reason, Lisp_Object frob1,
 		    Lisp_Object frob2)
 {
   signal_error_2 (Qinvalid_argument, reason, frob1, frob2);
 }
 
 void
-maybe_invalid_argument (const CBufbyte *reason, Lisp_Object frob,
+maybe_invalid_argument (const CIntbyte *reason, Lisp_Object frob,
 			Lisp_Object class, Error_Behavior errb)
 {
   maybe_signal_error (Qinvalid_argument, reason, frob, class, errb);
 }
 
 DOESNT_RETURN
-invalid_constant (const CBufbyte *reason, Lisp_Object frob)
+invalid_constant (const CIntbyte *reason, Lisp_Object frob)
 {
   signal_error (Qinvalid_constant, reason, frob);
 }
 
 DOESNT_RETURN
-invalid_constant_2 (const CBufbyte *reason, Lisp_Object frob1,
+invalid_constant_2 (const CIntbyte *reason, Lisp_Object frob1,
 		    Lisp_Object frob2)
 {
   signal_error_2 (Qinvalid_constant, reason, frob1, frob2);
 }
 
 void
-maybe_invalid_constant (const CBufbyte *reason, Lisp_Object frob,
+maybe_invalid_constant (const CIntbyte *reason, Lisp_Object frob,
 			Lisp_Object class, Error_Behavior errb)
 {
   maybe_signal_error (Qinvalid_constant, reason, frob, class, errb);
 }
 
 DOESNT_RETURN
-invalid_operation (const CBufbyte *reason, Lisp_Object frob)
+invalid_operation (const CIntbyte *reason, Lisp_Object frob)
 {
   signal_error (Qinvalid_operation, reason, frob);
 }
 
 DOESNT_RETURN
-invalid_operation_2 (const CBufbyte *reason, Lisp_Object frob1,
+invalid_operation_2 (const CIntbyte *reason, Lisp_Object frob1,
 		     Lisp_Object frob2)
 {
   signal_error_2 (Qinvalid_operation, reason, frob1, frob2);
 }
 
 void
-maybe_invalid_operation (const CBufbyte *reason, Lisp_Object frob,
+maybe_invalid_operation (const CIntbyte *reason, Lisp_Object frob,
 			 Lisp_Object class, Error_Behavior errb)
 {
   maybe_signal_error (Qinvalid_operation, reason, frob, class, errb);
 }
 
 DOESNT_RETURN
-invalid_change (const CBufbyte *reason, Lisp_Object frob)
+invalid_change (const CIntbyte *reason, Lisp_Object frob)
 {
   signal_error (Qinvalid_change, reason, frob);
 }
 
 DOESNT_RETURN
-invalid_change_2 (const CBufbyte *reason, Lisp_Object frob1, Lisp_Object frob2)
+invalid_change_2 (const CIntbyte *reason, Lisp_Object frob1, Lisp_Object frob2)
 {
   signal_error_2 (Qinvalid_change, reason, frob1, frob2);
 }
 
 void
-maybe_invalid_change (const CBufbyte *reason, Lisp_Object frob,
+maybe_invalid_change (const CIntbyte *reason, Lisp_Object frob,
 		      Lisp_Object class, Error_Behavior errb)
 {
   maybe_signal_error (Qinvalid_change, reason, frob, class, errb);
 }
 
 DOESNT_RETURN
-invalid_state (const CBufbyte *reason, Lisp_Object frob)
+invalid_state (const CIntbyte *reason, Lisp_Object frob)
 {
   signal_error (Qinvalid_state, reason, frob);
 }
 
 DOESNT_RETURN
-invalid_state_2 (const CBufbyte *reason, Lisp_Object frob1, Lisp_Object frob2)
+invalid_state_2 (const CIntbyte *reason, Lisp_Object frob1, Lisp_Object frob2)
 {
   signal_error_2 (Qinvalid_state, reason, frob1, frob2);
 }
 
 void
-maybe_invalid_state (const CBufbyte *reason, Lisp_Object frob,
+maybe_invalid_state (const CIntbyte *reason, Lisp_Object frob,
 		     Lisp_Object class, Error_Behavior errb)
 {
   maybe_signal_error (Qinvalid_state, reason, frob, class, errb);
 }
 
 DOESNT_RETURN
-wtaerror (const CBufbyte *reason, Lisp_Object frob)
+wtaerror (const CIntbyte *reason, Lisp_Object frob)
 {
   signal_error (Qwrong_type_argument, reason, frob);
 }
 
 DOESNT_RETURN
-stack_overflow (const CBufbyte *reason, Lisp_Object frob)
+stack_overflow (const CIntbyte *reason, Lisp_Object frob)
 {
   signal_error (Qstack_overflow, reason, frob);
 }
 
 DOESNT_RETURN
-out_of_memory (const CBufbyte *reason, Lisp_Object frob)
+out_of_memory (const CIntbyte *reason, Lisp_Object frob)
 {
   signal_error (Qout_of_memory, reason, frob);
 }
 
 DOESNT_RETURN
-printing_unreadable_object (const CBufbyte *fmt, ...)
+printing_unreadable_object (const CIntbyte *fmt, ...)
 {
   Lisp_Object obj;
   va_list args;
 
   va_start (args, fmt);
-  obj = emacs_doprnt_string_va ((const Bufbyte *) GETTEXT (fmt), Qnil, -1,
+  obj = emacs_doprnt_string_va ((const Intbyte *) GETTEXT (fmt), Qnil, -1,
 				args);
   va_end (args);
 
@@ -4435,7 +4435,7 @@
 
       if (!NILP (arg))
         {
-          CBufbyte *str = (CBufbyte *) get_opaque_ptr (arg);
+          CIntbyte *str = (CIntbyte *) get_opaque_ptr (arg);
           args[0] = build_string (str);
         }
       else
@@ -4446,7 +4446,7 @@
       args[1] = errordata;
       warn_when_safe_lispobj
 	(Qerror, Qwarning,
-	 emacs_doprnt_string_lisp ((const Bufbyte *) "%s: %s",
+	 emacs_doprnt_string_lisp ((const Intbyte *) "%s: %s",
 				   Qnil, -1, 2, args));
     }
   return Qunbound;
@@ -4489,7 +4489,7 @@
 }
 
 Lisp_Object
-eval_in_buffer_trapping_errors (const CBufbyte *warning_string,
+eval_in_buffer_trapping_errors (const CIntbyte *warning_string,
 				struct buffer *buf, Lisp_Object form)
 {
   int speccount = specpdl_depth();
@@ -4529,7 +4529,7 @@
 }
 
 Lisp_Object
-run_hook_trapping_errors (const CBufbyte *warning_string,
+run_hook_trapping_errors (const CIntbyte *warning_string,
 			  Lisp_Object hook_symbol)
 {
   int speccount;
@@ -4563,7 +4563,7 @@
    if an error occurs. */
 
 Lisp_Object
-safe_run_hook_trapping_errors (const CBufbyte *warning_string,
+safe_run_hook_trapping_errors (const CIntbyte *warning_string,
 			       Lisp_Object hook_symbol,
 			       int allow_quit)
 {
@@ -4609,7 +4609,7 @@
 }
 
 Lisp_Object
-call0_trapping_errors (const CBufbyte *warning_string, Lisp_Object function)
+call0_trapping_errors (const CIntbyte *warning_string, Lisp_Object function)
 {
   int speccount;
   Lisp_Object tem;
@@ -4656,7 +4656,7 @@
 }
 
 Lisp_Object
-call1_trapping_errors (const CBufbyte *warning_string, Lisp_Object function,
+call1_trapping_errors (const CIntbyte *warning_string, Lisp_Object function,
 		       Lisp_Object object)
 {
   int speccount = specpdl_depth();
@@ -4693,7 +4693,7 @@
 }
 
 Lisp_Object
-call2_trapping_errors (const CBufbyte *warning_string, Lisp_Object function,
+call2_trapping_errors (const CIntbyte *warning_string, Lisp_Object function,
 		       Lisp_Object object1, Lisp_Object object2)
 {
   int speccount = specpdl_depth();
@@ -5250,13 +5250,13 @@
    automatically be called when it is safe to do so. */
 
 void
-warn_when_safe (Lisp_Object class, Lisp_Object level, const CBufbyte *fmt, ...)
+warn_when_safe (Lisp_Object class, Lisp_Object level, const CIntbyte *fmt, ...)
 {
   Lisp_Object obj;
   va_list args;
 
   va_start (args, fmt);
-  obj = emacs_doprnt_string_va ((const Bufbyte *) GETTEXT (fmt),
+  obj = emacs_doprnt_string_va ((const Intbyte *) GETTEXT (fmt),
 				Qnil, -1, args);
   va_end (args);
 
--- a/src/event-Xt.c	Tue Sep 18 05:06:57 2001 +0000
+++ b/src/event-Xt.c	Thu Sep 20 06:31:11 2001 +0000
@@ -1399,7 +1399,7 @@
 		    {
 		      len = strlen ((char*)data);
 		      hurl = dnd_url_hexify_string ((char *)data, "file:");
-		      l_item = make_string ((Bufbyte *)hurl, strlen (hurl));
+		      l_item = make_string ((Intbyte *)hurl, strlen (hurl));
 		      l_dndlist = Fcons (l_item, l_dndlist);
 		      data += len + 1;
 		      xfree (hurl);
@@ -1409,8 +1409,8 @@
 		break;
 	      case DndText:
 		l_type = Qdragdrop_MIME;
-		l_dndlist = list1 ( list3 ( list1 ( make_string ((Bufbyte *)"text/plain", 10) ),
-					    make_string ((Bufbyte *)"8bit", 4),
+		l_dndlist = list1 ( list3 ( list1 ( make_string ((Intbyte *)"text/plain", 10) ),
+					    make_string ((Intbyte *)"8bit", 4),
 					    make_ext_string ((Extbyte *)data,
 							     strlen((char *)data),
 							     Qctext) ) );
@@ -1435,7 +1435,7 @@
 		{
 		  char *hurl = dnd_url_hexify_string ((char *) data, "file:");
 
-		  l_dndlist = list1 ( make_string ((Bufbyte *)hurl,
+		  l_dndlist = list1 ( make_string ((Intbyte *)hurl,
 						   strlen (hurl)) );
 		  l_type = Qdragdrop_URL;
 
@@ -1451,8 +1451,8 @@
 		l_type = Qdragdrop_URL;
 		break;
 	      default: /* Unknown, RawData and any other type */
-		l_dndlist = list1 ( list3 ( list1 ( make_string ((Bufbyte *)"application/octet-stream", 24) ),
-					    make_string ((Bufbyte *)"8bit", 4),
+		l_dndlist = list1 ( list3 ( list1 ( make_string ((Intbyte *)"application/octet-stream", 24) ),
+					    make_string ((Intbyte *)"8bit", 4),
 					    make_ext_string ((Extbyte *)data,
 							     size,
 							     Qbinary) ) );
@@ -2448,7 +2448,7 @@
     {
       char *buf = alloca_array (char, XSTRING_LENGTH (f->name) + 4);
       sprintf (buf, " \"%s\"", XSTRING_DATA (f->name));
-      write_string_to_stdio_stream (stderr, 0, (Bufbyte *) buf, 0,
+      write_string_to_stdio_stream (stderr, 0, (Intbyte *) buf, 0,
 				    strlen (buf), Qterminal, 1);
     }
   stderr_out ("\n");
--- a/src/event-gtk.c	Tue Sep 18 05:06:57 2001 +0000
+++ b/src/event-gtk.c	Thu Sep 20 06:31:11 2001 +0000
@@ -976,7 +976,7 @@
       /* Random filename */
       char *hurl = dnd_url_hexify_string (data->data, "file:");
 
-      l_dndlist = list1 (make_string ((Bufbyte *)hurl, strlen (hurl)));
+      l_dndlist = list1 (make_string ((Intbyte *)hurl, strlen (hurl)));
       l_type = Qdragdrop_URL;
 
       xfree (hurl);
--- a/src/event-msw.c	Tue Sep 18 05:06:57 2001 +0000
+++ b/src/event-msw.c	Thu Sep 20 06:31:11 2001 +0000
@@ -367,9 +367,9 @@
   return s->thread_data->hev_caller;
 }
 
-static Lstream_Data_Count
+static Bytecount
 ntpipe_slurp_reader (Lstream *stream, unsigned char *data,
-		     Lstream_Data_Count size)
+		     Bytecount size)
 {
   /* This function must be called from the main thread only */
   struct ntpipe_slurp_stream_shared_data* s =
@@ -582,9 +582,9 @@
 }
 #endif
 
-static Lstream_Data_Count
+static Bytecount
 ntpipe_shove_writer (Lstream *stream, const unsigned char *data,
-		     Lstream_Data_Count size)
+		     Bytecount size)
 {
   struct ntpipe_shove_stream* s = NTPIPE_SHOVE_STREAM_DATA(stream);
 
@@ -668,7 +668,7 @@
   OVERLAPPED ov;		/* Overlapped I/O structure		     */
   void *buffer;			/* Buffer.                                   */
   DWORD bufsize;		/* Number of bytes last read		     */
-  DWORD bufpos;			/* Position in buffer for next fetch	     */
+  DWORD charbpos;			/* Position in buffer for next fetch	     */
   unsigned int error_p :1;	/* I/O Error seen			     */
   unsigned int eof_p :1;	/* EOF Error seen			     */
   unsigned int pending_p :1;	/* There is a pending I/O operation	     */
@@ -684,7 +684,7 @@
 winsock_initiate_read (struct winsock_stream *str)
 {
   ResetEvent (str->ov.hEvent);
-  str->bufpos = 0;
+  str->charbpos = 0;
 
   if (!ReadFile ((HANDLE)str->s, str->buffer, WINSOCK_READ_BUFFER_SIZE,
 		 &str->bufsize, &str->ov))
@@ -700,8 +700,8 @@
     str->eof_p = 1;
 }
 
-static Lstream_Data_Count
-winsock_reader (Lstream *stream, unsigned char *data, Lstream_Data_Count size)
+static Bytecount
+winsock_reader (Lstream *stream, unsigned char *data, Bytecount size)
 {
   struct winsock_stream *str = WINSOCK_STREAM_DATA (stream);
 
@@ -735,20 +735,20 @@
     return -1;
 
   /* Return as much of buffer as we have */
-  size = min (size, (Lstream_Data_Count) (str->bufsize - str->bufpos));
-  memcpy (data, (void*)((BYTE*)str->buffer + str->bufpos), size);
-  str->bufpos += size;
+  size = min (size, (Bytecount) (str->bufsize - str->charbpos));
+  memcpy (data, (void*)((BYTE*)str->buffer + str->charbpos), size);
+  str->charbpos += size;
 
   /* Read more if buffer is exhausted */
-  if (str->bufsize == str->bufpos)
+  if (str->bufsize == str->charbpos)
     winsock_initiate_read (str);
 
   return size;
 }
 
-static Lstream_Data_Count
+static Bytecount
 winsock_writer (Lstream *stream, const unsigned char *data,
-		Lstream_Data_Count size)
+		Bytecount size)
 {
   struct winsock_stream *str = WINSOCK_STREAM_DATA (stream);
 
@@ -3612,7 +3612,7 @@
   /* FLAGS is process->pty_flag for UNIX_PROCESSES */
   if ((flags & STREAM_PTY_FLUSHING) && fdo >= 0)
     {
-      Bufbyte eof_char = get_eof_char (fdo);
+      Intbyte eof_char = get_eof_char (fdo);
       int pty_max_bytes = get_pty_max_bytes (fdo);
       filedesc_stream_set_pty_flushing (XLSTREAM(*outstream), pty_max_bytes, eof_char);
     }
--- a/src/event-stream.c	Tue Sep 18 05:06:57 2001 +0000
+++ b/src/event-stream.c	Thu Sep 20 06:31:11 2001 +0000
@@ -181,7 +181,7 @@
 Lisp_Object Vthis_command_properties;
 
 /* The value of point when the last command was executed.  */
-Bufpos last_point_position;
+Charbpos last_point_position;
 
 /* The frame that was current when the last command was started. */
 Lisp_Object Vlast_selected_frame;
@@ -366,7 +366,7 @@
   builder->console = console;
   reset_command_builder_event_chain (builder);
   builder->echo_buf_length = 300; /* #### Kludge */
-  builder->echo_buf = xnew_array (Bufbyte, builder->echo_buf_length);
+  builder->echo_buf = xnew_array (Intbyte, builder->echo_buf_length);
   builder->echo_buf[0] = 0;
   builder->echo_buf_index = -1;
   builder->echo_buf_index = -1;
@@ -620,7 +620,7 @@
   /* This function can GC */
   char buf[255];
   Bytecount buf_index = command_builder->echo_buf_index;
-  Bufbyte *e;
+  Intbyte *e;
   Bytecount len;
 
   if (buf_index < 0)
@@ -3706,7 +3706,7 @@
 
 		if (len + buf_index + 1 <= command_builder->echo_buf_length)
 		  {
-		    Bufbyte *echo = command_builder->echo_buf + buf_index;
+		    Intbyte *echo = command_builder->echo_buf + buf_index;
 		    memcpy (echo, XSTRING_DATA (prompt), len);
 		    echo[len] = 0;
 		  }
@@ -4388,7 +4388,7 @@
       if (CHARP (XEVENT (event)->event.key.keysym))
 	{
 	  Emchar ch = XCHAR (keysym);
-	  Bufbyte str[MAX_EMCHAR_LEN];
+	  Intbyte str[MAX_EMCHAR_LEN];
 	  Bytecount len = set_charptr_emchar (str, ch);
 	  Lstream_write (XLSTREAM (Vdribble_file), str, len);
 	}
--- a/src/event-unixoid.c	Tue Sep 18 05:06:57 2001 +0000
+++ b/src/event-unixoid.c	Thu Sep 20 06:31:11 2001 +0000
@@ -292,7 +292,7 @@
   /* FLAGS is process->pty_flag for UNIX_PROCESSES */
   if ((flags & STREAM_PTY_FLUSHING) && outfd >= 0)
     {
-      Bufbyte eof_char = get_eof_char (outfd);
+      Intbyte eof_char = get_eof_char (outfd);
       int pty_max_bytes = get_pty_max_bytes (outfd);
       filedesc_stream_set_pty_flushing (XLSTREAM(*outstream), pty_max_bytes, eof_char);
     }
--- a/src/events.c	Tue Sep 18 05:06:57 2001 +0000
+++ b/src/events.c	Thu Sep 20 06:31:11 2001 +0000
@@ -300,11 +300,11 @@
     }
 }
 
-static Hash_Code
+static Hashcode
 event_hash (Lisp_Object obj, int depth)
 {
   Lisp_Event *e = XEVENT (obj);
-  Hash_Code hash;
+  Hashcode hash;
 
   hash = HASH2 (e->event_type, LISP_HASH (e->channel));
   switch (e->event_type)
@@ -338,7 +338,7 @@
 
     case magic_eval_event:
       return HASH3 (hash,
-		    (Hash_Code) e->event.magic_eval.internal_function,
+		    (Hashcode) e->event.magic_eval.internal_function,
 		    internal_hash (e->event.magic_eval.object, depth + 1));
 
     case magic_event:
@@ -1329,7 +1329,7 @@
 
   if (CHARP (key))
     {
-      buf += set_charptr_emchar ((Bufbyte *) buf, XCHAR (key));
+      buf += set_charptr_emchar ((Intbyte *) buf, XCHAR (key));
       *buf = 0;
     }
   else if (SYMBOLP (key))
@@ -1797,7 +1797,7 @@
 static int
 event_pixel_translation (Lisp_Object event, int *char_x, int *char_y,
 			 int *obj_x, int *obj_y,
-			 struct window **w, Bufpos *bufp, Bufpos *closest,
+			 struct window **w, Charbpos *bufp, Charbpos *closest,
 			 Charcount *modeline_closest,
 			 Lisp_Object *obj1, Lisp_Object *obj2)
 {
@@ -1808,7 +1808,7 @@
 
   int ret_x, ret_y, ret_obj_x, ret_obj_y;
   struct window *ret_w;
-  Bufpos ret_bufp, ret_closest;
+  Charbpos ret_bufp, ret_closest;
   Charcount ret_modeline_closest;
   Lisp_Object ret_obj1, ret_obj2;
 
@@ -1988,7 +1988,7 @@
 */
        (event))
 {
-  Bufpos bufp;
+  Charbpos bufp;
   struct window *w;
 
   event_pixel_translation (event, 0, 0, 0, 0, &w, &bufp, 0, 0, 0, 0);
@@ -2010,7 +2010,7 @@
 */
        (event))
 {
-  Bufpos bufp;
+  Charbpos bufp;
 
   event_pixel_translation (event, 0, 0, 0, 0, 0, 0, &bufp, 0, 0, 0);
 
--- a/src/events.h	Tue Sep 18 05:06:57 2001 +0000
+++ b/src/events.h	Thu Sep 20 06:31:11 2001 +0000
@@ -734,7 +734,7 @@
     Lisp_Object first_mungeable_event;
   } munge_me[2];
 
-  Bufbyte *echo_buf;
+  Intbyte *echo_buf;
   Bytecount echo_buf_length;          /* size of echo_buf */
   Bytecount echo_buf_index;           /* index into echo_buf
 				       * -1 before doing echoing for new cmd */
--- a/src/extents.c	Tue Sep 18 05:06:57 2001 +0000
+++ b/src/extents.c	Thu Sep 20 06:31:11 2001 +0000
@@ -265,7 +265,7 @@
 
 /* Convert a "memory position" (i.e. taking the gap into account) into
    the address of the element at (i.e. after) that position.  "Memory
-   positions" are only used internally and are of type Memind.
+   positions" are only used internally and are of type Membpos.
    "Array positions" are used externally and are of type int. */
 #define GAP_ARRAY_MEMEL_ADDR(ga, memel) ((ga)->array + (ga)->elsize*(memel))
 
@@ -358,7 +358,7 @@
 typedef struct stack_of_extents
 {
   Extent_List *extents;
-  Memind pos; /* Position of stack of extents.  EXTENTS is the list of
+  Membpos pos; /* Position of stack of extents.  EXTENTS is the list of
 		 all extents that overlap this position.  This position
 		 can be -1 if the stack of extents is invalid (this
 		 happens when a buffer is first created or a string's
@@ -372,29 +372,29 @@
 
 typedef int Endpoint_Index;
 
-#define memind_to_startind(x, start_open) \
+#define membpos_to_startind(x, start_open) \
   ((Endpoint_Index) (((x) << 1) + !!(start_open)))
-#define memind_to_endind(x, end_open) \
+#define membpos_to_endind(x, end_open) \
   ((Endpoint_Index) (((x) << 1) - !!(end_open)))
 
 /* Combination macros */
-#define bytind_to_startind(buf, x, start_open) \
-  memind_to_startind (bytind_to_memind (buf, x), start_open)
-#define bytind_to_endind(buf, x, end_open) \
-  memind_to_endind (bytind_to_memind (buf, x), end_open)
+#define bytebpos_to_startind(buf, x, start_open) \
+  membpos_to_startind (bytebpos_to_membpos (buf, x), start_open)
+#define bytebpos_to_endind(buf, x, end_open) \
+  membpos_to_endind (bytebpos_to_membpos (buf, x), end_open)
 
 /* ------------------------------- */
 /*    buffer-or-string primitives  */
 /* ------------------------------- */
 
-/* Similar for Bytinds and start/end indices. */
-
-#define buffer_or_string_bytind_to_startind(obj, ind, start_open)	\
-  memind_to_startind (buffer_or_string_bytind_to_memind (obj, ind),	\
+/* Similar for Bytebposs and start/end indices. */
+
+#define buffer_or_string_bytebpos_to_startind(obj, ind, start_open)	\
+  membpos_to_startind (buffer_or_string_bytebpos_to_membpos (obj, ind),	\
 		      start_open)
 
-#define buffer_or_string_bytind_to_endind(obj, ind, end_open)		\
-  memind_to_endind (buffer_or_string_bytind_to_memind (obj, ind),	\
+#define buffer_or_string_bytebpos_to_endind(obj, ind, end_open)		\
+  membpos_to_endind (buffer_or_string_bytebpos_to_membpos (obj, ind),	\
 		    end_open)
 
 /* ------------------------------- */
@@ -487,8 +487,8 @@
    adjust_markers() in insdel.c. */
 
 static void
-gap_array_adjust_markers (Gap_Array *ga, Memind from,
-			  Memind to, int amount)
+gap_array_adjust_markers (Gap_Array *ga, Membpos from,
+			  Membpos to, int amount)
 {
   Gap_Array_Marker *m;
 
@@ -511,7 +511,7 @@
       memmove (GAP_ARRAY_MEMEL_ADDR (ga, pos + gapsize),
 	       GAP_ARRAY_MEMEL_ADDR (ga, pos),
 	       (gap - pos)*ga->elsize);
-      gap_array_adjust_markers (ga, (Memind) pos, (Memind) gap,
+      gap_array_adjust_markers (ga, (Membpos) pos, (Membpos) gap,
 				gapsize);
     }
   else if (pos > gap)
@@ -519,8 +519,8 @@
       memmove (GAP_ARRAY_MEMEL_ADDR (ga, gap),
 	       GAP_ARRAY_MEMEL_ADDR (ga, gap + gapsize),
 	       (pos - gap)*ga->elsize);
-      gap_array_adjust_markers (ga, (Memind) (gap + gapsize),
-				(Memind) (pos + gapsize), - gapsize);
+      gap_array_adjust_markers (ga, (Membpos) (gap + gapsize),
+				(Membpos) (pos + gapsize), - gapsize);
     }
   ga->gap = pos;
 }
@@ -775,7 +775,7 @@
    position at the beginning or end of the extent list is returned. */
 
 static int
-extent_list_locate_from_pos (Extent_List *el, Memind pos, int endp)
+extent_list_locate_from_pos (Extent_List *el, Membpos pos, int endp)
 {
   struct extent fake_extent;
   /*
@@ -799,7 +799,7 @@
 /* Return the extent at POS. */
 
 static EXTENT
-extent_list_at (Extent_List *el, Memind pos, int endp)
+extent_list_at (Extent_List *el, Membpos pos, int endp)
 {
   Gap_Array *ga = endp ? el->end : el->start;
 
@@ -1298,9 +1298,9 @@
       return;
     }
   sel = soe->extents;
-  printf ("SOE pos is %d (memind %d)\n",
+  printf ("SOE pos is %d (membpos %d)\n",
 	  soe->pos < 0 ? soe->pos :
-	  buffer_or_string_memind_to_bytind (obj, soe->pos),
+	  buffer_or_string_membpos_to_bytebpos (obj, soe->pos),
 	  soe->pos);
   for (endp = 0; endp < 2; endp++)
     {
@@ -1375,7 +1375,7 @@
 /* Move OBJ's stack of extents to lie over the specified position. */
 
 static void
-soe_move (Lisp_Object obj, Memind pos)
+soe_move (Lisp_Object obj, Membpos pos)
 {
   Stack_Of_Extents *soe = buffer_or_string_stack_of_extents_force (obj);
   Extent_List *sel = soe->extents;
@@ -1389,10 +1389,10 @@
 #endif
 
 #ifdef SOE_DEBUG
-  printf ("Moving SOE from %d (memind %d) to %d (memind %d)\n",
+  printf ("Moving SOE from %d (membpos %d) to %d (membpos %d)\n",
 	  soe->pos < 0 ? soe->pos :
-	  buffer_or_string_memind_to_bytind (obj, soe->pos), soe->pos,
-	  buffer_or_string_memind_to_bytind (obj, pos), pos);
+	  buffer_or_string_membpos_to_bytebpos (obj, soe->pos), soe->pos,
+	  buffer_or_string_membpos_to_bytebpos (obj, pos), pos);
 #endif
   if (soe->pos < pos)
     {
@@ -1533,29 +1533,29 @@
 /* Return the start (endp == 0) or end (endp == 1) of an extent as
    a byte index.  If you want the value as a memory index, use
    extent_endpoint().  If you want the value as a buffer position,
-   use extent_endpoint_bufpos(). */
-
-static Bytind
-extent_endpoint_bytind (EXTENT extent, int endp)
+   use extent_endpoint_charbpos(). */
+
+static Bytebpos
+extent_endpoint_bytebpos (EXTENT extent, int endp)
 {
   assert (EXTENT_LIVE_P (extent));
   assert (!extent_detached_p (extent));
   {
-    Memind i = endp ? extent_end (extent) : extent_start (extent);
+    Membpos i = endp ? extent_end (extent) : extent_start (extent);
     Lisp_Object obj = extent_object (extent);
-    return buffer_or_string_memind_to_bytind (obj, i);
+    return buffer_or_string_membpos_to_bytebpos (obj, i);
   }
 }
 
-static Bufpos
-extent_endpoint_bufpos (EXTENT extent, int endp)
+static Charbpos
+extent_endpoint_charbpos (EXTENT extent, int endp)
 {
   assert (EXTENT_LIVE_P (extent));
   assert (!extent_detached_p (extent));
   {
-    Memind i = endp ? extent_end (extent) : extent_start (extent);
+    Membpos i = endp ? extent_end (extent) : extent_start (extent);
     Lisp_Object obj = extent_object (extent);
-    return buffer_or_string_memind_to_bufpos (obj, i);
+    return buffer_or_string_membpos_to_charbpos (obj, i);
   }
 }
 
@@ -1619,8 +1619,8 @@
       if (!in_modeline_generation)
 	MARK_EXTENTS_CHANGED;
       gutter_extent_signal_changed_region_maybe (object,
-						 extent_endpoint_bufpos (extent, 0),
-						 extent_endpoint_bufpos (extent, 1));
+						 extent_endpoint_charbpos (extent, 0),
+						 extent_endpoint_charbpos (extent, 1));
     }
   else if (BUFFERP (object))
     {
@@ -1631,8 +1631,8 @@
       if (invisibility_change)
 	MARK_CLIP_CHANGED;
       buffer_extent_signal_changed_region (b,
-					   extent_endpoint_bufpos (extent, 0),
-					   extent_endpoint_bufpos (extent, 1));
+					   extent_endpoint_charbpos (extent, 0),
+					   extent_endpoint_charbpos (extent, 1));
     }
 }
 
@@ -1827,7 +1827,7 @@
    already been performed (see Fextent_in_region_p ()).
  */
 static int
-extent_in_region_p (EXTENT extent, Bytind from, Bytind to,
+extent_in_region_p (EXTENT extent, Bytebpos from, Bytebpos to,
 		    unsigned int flags)
 {
   Lisp_Object obj = extent_object (extent);
@@ -1863,11 +1863,11 @@
       default: abort(); return 0;
       }
 
-  start = buffer_or_string_bytind_to_startind (obj, from,
+  start = buffer_or_string_bytebpos_to_startind (obj, from,
 					       flags & ME_START_OPEN);
-  end = buffer_or_string_bytind_to_endind (obj, to, ! (flags & ME_END_CLOSED));
-  exs = memind_to_startind (extent_start (extent), start_open);
-  exe = memind_to_endind   (extent_end   (extent), end_open);
+  end = buffer_or_string_bytebpos_to_endind (obj, to, ! (flags & ME_END_CLOSED));
+  exs = membpos_to_startind (extent_start (extent), start_open);
+  exe = membpos_to_endind   (extent_end   (extent), end_open);
 
   /* It's easy to determine whether an extent lies *outside* the
      region -- just determine whether it's completely before
@@ -1947,10 +1947,10 @@
 
 
 static void
-map_extents_bytind (Bytind from, Bytind to, map_extents_fun fn, void *arg,
+map_extents_bytebpos (Bytebpos from, Bytebpos to, map_extents_fun fn, void *arg,
 		    Lisp_Object obj, EXTENT after, unsigned int flags)
 {
-  Memind st, en; /* range we're mapping over */
+  Membpos st, en; /* range we're mapping over */
   EXTENT range = 0; /* extent for this, if ME_MIGHT_MODIFY_TEXT */
   Extent_List *el = 0; /* extent list we're iterating over */
   Extent_List_Marker *posm = 0; /* marker for extent list,
@@ -1978,8 +1978,8 @@
     return;
   el = 0;
 
-  st = buffer_or_string_bytind_to_memind (obj, from);
-  en = buffer_or_string_bytind_to_memind (obj, to);
+  st = buffer_or_string_bytebpos_to_membpos (obj, from);
+  en = buffer_or_string_bytebpos_to_membpos (obj, to);
 
   if (flags & ME_MIGHT_MODIFY_TEXT)
     {
@@ -2248,9 +2248,9 @@
 
 	    obj2 = extent_object (e);
 	    if (extent_in_region_p (e,
-				    buffer_or_string_memind_to_bytind (obj2,
+				    buffer_or_string_membpos_to_bytebpos (obj2,
 								       st),
-				    buffer_or_string_memind_to_bytind (obj2,
+				    buffer_or_string_membpos_to_bytebpos (obj2,
 								       en),
 				    flags))
 	      {
@@ -2280,11 +2280,11 @@
 }
 
 void
-map_extents (Bufpos from, Bufpos to, map_extents_fun fn,
+map_extents (Charbpos from, Charbpos to, map_extents_fun fn,
 	     void *arg, Lisp_Object obj, EXTENT after, unsigned int flags)
 {
-  map_extents_bytind (buffer_or_string_bufpos_to_bytind (obj, from),
-		      buffer_or_string_bufpos_to_bytind (obj, to), fn, arg,
+  map_extents_bytebpos (buffer_or_string_charbpos_to_bytebpos (obj, from),
+		      buffer_or_string_charbpos_to_bytebpos (obj, to), fn, arg,
 		      obj, after, flags);
 }
 
@@ -2309,7 +2309,7 @@
    so for safety we make it just look at the extent lists directly. */
 
 void
-adjust_extents (Lisp_Object obj, Memind from, Memind to, int amount)
+adjust_extents (Lisp_Object obj, Membpos from, Membpos to, int amount)
 {
   int endp;
   int pos;
@@ -2385,15 +2385,15 @@
  */
 
 void
-adjust_extents_for_deletion (Lisp_Object object, Bytind from,
-			     Bytind to, int gapsize, int numdel,
+adjust_extents_for_deletion (Lisp_Object object, Bytebpos from,
+			     Bytebpos to, int gapsize, int numdel,
 			     int movegapsize)
 {
   struct adjust_extents_for_deletion_arg closure;
   int i;
-  Memind adjust_to = (Memind) (to + gapsize);
+  Membpos adjust_to = (Membpos) (to + gapsize);
   Bytecount amount = - numdel - movegapsize;
-  Memind oldsoe = 0, newsoe = 0;
+  Membpos oldsoe = 0, newsoe = 0;
   Stack_Of_Extents *soe = buffer_or_string_stack_of_extents (object);
 
 #ifdef ERROR_CHECK_EXTENTS
@@ -2406,7 +2406,7 @@
      to muck with.  If we do the mapping and adjusting together, things can
      get all screwed up. */
 
-  map_extents_bytind (from, to, adjust_extents_for_deletion_mapper,
+  map_extents_bytebpos (from, to, adjust_extents_for_deletion_mapper,
 		      (void *) &closure, object, 0,
 		      /* extent endpoints move like markers regardless
 			 of their open/closeness. */
@@ -2432,8 +2432,8 @@
   for (i = 0; i < Dynarr_length (closure.list); i++)
     {
       EXTENT extent = Dynarr_at (closure.list, i);
-      Memind new_start = extent_start (extent);
-      Memind new_end = extent_end (extent);
+      Membpos new_start = extent_start (extent);
+      Membpos new_end = extent_end (extent);
 
       /* do_marker_adjustment() will not adjust values that should not be
 	 adjusted.  We're passing the same funky arguments to
@@ -2513,15 +2513,15 @@
    the first run that begins after POS, or returns POS if
    there are no such runs. */
 
-static Bytind
-extent_find_end_of_run (Lisp_Object obj, Bytind pos, int outside_accessible)
+static Bytebpos
+extent_find_end_of_run (Lisp_Object obj, Bytebpos pos, int outside_accessible)
 {
   Extent_List *sel;
   Extent_List *bel = buffer_or_string_extent_list (obj);
-  Bytind pos1, pos2;
+  Bytebpos pos1, pos2;
   int elind1, elind2;
-  Memind mempos = buffer_or_string_bytind_to_memind (obj, pos);
-  Bytind limit = outside_accessible ?
+  Membpos mempos = buffer_or_string_bytebpos_to_membpos (obj, pos);
+  Bytebpos limit = outside_accessible ?
     buffer_or_string_absolute_end_byte (obj) :
       buffer_or_string_accessible_end_byte (obj);
 
@@ -2534,7 +2534,7 @@
   /* Find the first start position after POS. */
   elind1 = extent_list_locate_from_pos (bel, mempos+1, 0);
   if (elind1 < extent_list_num_els (bel))
-    pos1 = buffer_or_string_memind_to_bytind
+    pos1 = buffer_or_string_membpos_to_bytebpos
       (obj, extent_start (extent_list_at (bel, elind1, 0)));
   else
     pos1 = limit;
@@ -2544,7 +2544,7 @@
      equal to POS1, so we just have to look in the SOE. */
   elind2 = extent_list_locate_from_pos (sel, mempos+1, 1);
   if (elind2 < extent_list_num_els (sel))
-    pos2 = buffer_or_string_memind_to_bytind
+    pos2 = buffer_or_string_membpos_to_bytebpos
       (obj, extent_end (extent_list_at (sel, elind2, 1)));
   else
     pos2 = limit;
@@ -2552,16 +2552,16 @@
   return min (min (pos1, pos2), limit);
 }
 
-static Bytind
-extent_find_beginning_of_run (Lisp_Object obj, Bytind pos,
+static Bytebpos
+extent_find_beginning_of_run (Lisp_Object obj, Bytebpos pos,
 			      int outside_accessible)
 {
   Extent_List *sel;
   Extent_List *bel = buffer_or_string_extent_list (obj);
-  Bytind pos1, pos2;
+  Bytebpos pos1, pos2;
   int elind1, elind2;
-  Memind mempos = buffer_or_string_bytind_to_memind (obj, pos);
-  Bytind limit = outside_accessible ?
+  Membpos mempos = buffer_or_string_bytebpos_to_membpos (obj, pos);
+  Bytebpos limit = outside_accessible ?
     buffer_or_string_absolute_begin_byte (obj) :
       buffer_or_string_accessible_begin_byte (obj);
 
@@ -2574,7 +2574,7 @@
   /* Find the first end position before POS. */
   elind1 = extent_list_locate_from_pos (bel, mempos, 1);
   if (elind1 > 0)
-    pos1 = buffer_or_string_memind_to_bytind
+    pos1 = buffer_or_string_membpos_to_bytebpos
       (obj, extent_end (extent_list_at (bel, elind1 - 1, 1)));
   else
     pos1 = limit;
@@ -2584,7 +2584,7 @@
      equal to POS1, so we just have to look in the SOE. */
   elind2 = extent_list_locate_from_pos (sel, mempos, 0);
   if (elind2 > 0)
-    pos2 = buffer_or_string_memind_to_bytind
+    pos2 = buffer_or_string_membpos_to_bytebpos
       (obj, extent_start (extent_list_at (sel, elind2 - 1, 0)));
   else
     pos2 = limit;
@@ -2753,14 +2753,14 @@
 
 face_index
 extent_fragment_update (struct window *w, struct extent_fragment *ef,
-			Bytind pos)
+			Bytebpos pos)
 {
   int i;
   Extent_List *sel =
     buffer_or_string_stack_of_extents_force (ef->object)->extents;
   EXTENT lhe = 0;
   struct extent dummy_lhe_extent;
-  Memind mempos = buffer_or_string_bytind_to_memind (ef->object, pos);
+  Membpos mempos = buffer_or_string_bytebpos_to_membpos (ef->object, pos);
 
 #ifdef ERROR_CHECK_EXTENTS
   assert (pos >= buffer_or_string_accessible_begin_byte (ef->object)
@@ -3104,7 +3104,7 @@
 		       depth));
 }
 
-static Hash_Code
+static Hashcode
 extent_hash (Lisp_Object obj, int depth)
 {
   struct extent *e = XEXTENT (obj);
@@ -3262,7 +3262,7 @@
   if (extent_detached_p (extent))
     return Qnil;
   else
-    return make_int (extent_endpoint_bufpos (extent, endp));
+    return make_int (extent_endpoint_charbpos (extent, endp));
 }
 
 DEFUN ("extentp", Fextentp, 1, 1, 0, /*
@@ -3319,8 +3319,8 @@
        (extent))
 {
   EXTENT e = decode_extent (extent, DE_MUST_BE_ATTACHED);
-  return make_int (extent_endpoint_bufpos (e, 1)
-		   - extent_endpoint_bufpos (e, 0));
+  return make_int (extent_endpoint_charbpos (e, 1)
+		   - extent_endpoint_charbpos (e, 0));
 }
 
 DEFUN ("next-extent", Fnext_extent, 1, 1, 0, /*
@@ -3431,11 +3431,11 @@
        (pos, object))
 {
   Lisp_Object obj = decode_buffer_or_string (object);
-  Bytind bpos;
+  Bytebpos bpos;
 
   bpos = get_buffer_or_string_pos_byte (obj, pos, GB_ALLOW_PAST_ACCESSIBLE);
   bpos = extent_find_end_of_run (obj, bpos, 1);
-  return make_int (buffer_or_string_bytind_to_bufpos (obj, bpos));
+  return make_int (buffer_or_string_bytebpos_to_charbpos (obj, bpos));
 }
 
 DEFUN ("previous-extent-change", Fprevious_extent_change, 1, 2, 0, /*
@@ -3447,11 +3447,11 @@
        (pos, object))
 {
   Lisp_Object obj = decode_buffer_or_string (object);
-  Bytind bpos;
+  Bytebpos bpos;
 
   bpos = get_buffer_or_string_pos_byte (obj, pos, GB_ALLOW_PAST_ACCESSIBLE);
   bpos = extent_find_beginning_of_run (obj, bpos, 1);
-  return make_int (buffer_or_string_bytind_to_bufpos (obj, bpos));
+  return make_int (buffer_or_string_bytebpos_to_charbpos (obj, bpos));
 }
 
 
@@ -3575,7 +3575,7 @@
  */
 
 static void
-set_extent_endpoints_1 (EXTENT extent, Memind start, Memind end)
+set_extent_endpoints_1 (EXTENT extent, Membpos start, Membpos end)
 {
 #ifdef ERROR_CHECK_EXTENTS
   Lisp_Object obj = extent_object (extent);
@@ -3583,8 +3583,8 @@
   assert (start <= end);
   if (BUFFERP (obj))
     {
-      assert (valid_memind_p (XBUFFER (obj), start));
-      assert (valid_memind_p (XBUFFER (obj), end));
+      assert (valid_membpos_p (XBUFFER (obj), start));
+      assert (valid_membpos_p (XBUFFER (obj), end));
     }
 #endif
 
@@ -3615,9 +3615,9 @@
    OBJECT. (If OBJECT is nil, do not change the extent's object.) */
 
 void
-set_extent_endpoints (EXTENT extent, Bytind s, Bytind e, Lisp_Object object)
-{
-  Memind start, end;
+set_extent_endpoints (EXTENT extent, Bytebpos s, Bytebpos e, Lisp_Object object)
+{
+  Membpos start, end;
 
   if (NILP (object))
     {
@@ -3631,9 +3631,9 @@
     }
 
   start = s < 0 ? extent_start (extent) :
-    buffer_or_string_bytind_to_memind (object, s);
+    buffer_or_string_bytebpos_to_membpos (object, s);
   end = e < 0 ? extent_end (extent) :
-    buffer_or_string_bytind_to_memind (object, e);
+    buffer_or_string_bytebpos_to_membpos (object, e);
   set_extent_endpoints_1 (extent, start, end);
 }
 
@@ -3649,7 +3649,7 @@
 }
 
 static EXTENT
-make_extent_internal (Lisp_Object object, Bytind from, Bytind to)
+make_extent_internal (Lisp_Object object, Bytebpos from, Bytebpos to)
 {
   EXTENT extent;
 
@@ -3659,7 +3659,7 @@
 }
 
 static EXTENT
-copy_extent (EXTENT original, Bytind from, Bytind to, Lisp_Object object)
+copy_extent (EXTENT original, Bytebpos from, Bytebpos to, Lisp_Object object)
 {
   EXTENT e;
 
@@ -3741,7 +3741,7 @@
     }
   else
     {
-      Bytind start, end;
+      Bytebpos start, end;
 
       get_buffer_or_string_range_byte (obj, from, to, &start, &end,
 				       GB_ALLOW_PAST_ACCESSIBLE);
@@ -3824,7 +3824,7 @@
        (extent, start, end, buffer_or_string))
 {
   EXTENT ext;
-  Bytind s, e;
+  Bytebpos s, e;
 
   ext = decode_extent (extent, 0);
 
@@ -3916,7 +3916,7 @@
 */
        (extent, from, to, flags))
 {
-  Bytind start, end;
+  Bytebpos start, end;
   EXTENT ext = decode_extent (extent, DE_MUST_BE_ATTACHED);
   Lisp_Object obj = extent_object (ext);
 
@@ -4040,7 +4040,7 @@
   /* This function can GC */
   struct slow_map_extents_arg closure;
   unsigned int me_flags;
-  Bytind start, end;
+  Bytebpos start, end;
   struct gcpro gcpro1, gcpro2, gcpro3, gcpro4, gcpro5;
   EXTENT after = 0;
 
@@ -4075,7 +4075,7 @@
   closure.property = property;
   closure.value = value;
 
-  map_extents_bytind (start, end, slow_map_extents_function,
+  map_extents_bytebpos (start, end, slow_map_extents_function,
 		      (void *) &closure, object, after,
 		      /* You never know what the user might do ... */
 		      me_flags | ME_MIGHT_CALL_ELISP);
@@ -4100,9 +4100,9 @@
   Lisp_Object result;
   Lisp_Object property;
   Lisp_Object value;
-  Bytind start_min;
-  Bytind prev_start;
-  Bytind prev_end;
+  Bytebpos start_min;
+  Bytebpos prev_start;
+  Bytebpos prev_end;
 };
 
 static int
@@ -4112,8 +4112,8 @@
   struct slow_map_extent_children_arg *closure =
     (struct slow_map_extent_children_arg *) arg;
   Lisp_Object extent_obj;
-  Bytind start = extent_endpoint_bytind (extent, 0);
-  Bytind end = extent_endpoint_bytind (extent, 1);
+  Bytebpos start = extent_endpoint_bytebpos (extent, 0);
+  Bytebpos end = extent_endpoint_bytebpos (extent, 1);
   /* Make sure the extent starts inside the region of interest,
      rather than just overlaps it.
      */
@@ -4156,8 +4156,8 @@
      buffer positions here.
      */
   closure->start_min = -1;	/* no need for this any more */
-  closure->prev_start = extent_endpoint_bytind (extent, 0);
-  closure->prev_end = extent_endpoint_bytind (extent, 1);
+  closure->prev_start = extent_endpoint_bytebpos (extent, 0);
+  closure->prev_end = extent_endpoint_bytebpos (extent, 1);
 
   return !NILP (closure->result);
 }
@@ -4181,7 +4181,7 @@
   /* This function can GC */
   struct slow_map_extent_children_arg closure;
   unsigned int me_flags;
-  Bytind start, end;
+  Bytebpos start, end;
   struct gcpro gcpro1, gcpro2, gcpro3, gcpro4, gcpro5;
   EXTENT after = 0;
 
@@ -4218,7 +4218,7 @@
   closure.start_min = start;
   closure.prev_start = -1;
   closure.prev_end = -1;
-  map_extents_bytind (start, end, slow_map_extent_children_function,
+  map_extents_bytebpos (start, end, slow_map_extent_children_function,
 		      (void *) &closure, object, after,
 		      /* You never know what the user might do ... */
 		      me_flags | ME_MIGHT_CALL_ELISP);
@@ -4241,8 +4241,8 @@
 struct extent_at_arg
 {
   Lisp_Object best_match; /* or list of extents */
-  Memind best_start;
-  Memind best_end;
+  Membpos best_start;
+  Membpos best_end;
   Lisp_Object prop;
   EXTENT before;
   int all_extents;
@@ -4325,7 +4325,7 @@
 }
 
 static Lisp_Object
-extent_at_bytind (Bytind position, Lisp_Object object, Lisp_Object property,
+extent_at_bytebpos (Bytebpos position, Lisp_Object object, Lisp_Object property,
 		  EXTENT before, enum extent_at_flag at_flag, int all_extents)
 {
   struct extent_at_arg closure;
@@ -4353,7 +4353,7 @@
   closure.all_extents = all_extents;
 
   GCPRO1 (closure.best_match);
-  map_extents_bytind (at_flag == EXTENT_AT_BEFORE ? position - 1 : position,
+  map_extents_bytebpos (at_flag == EXTENT_AT_BEFORE ? position - 1 : position,
 		      at_flag == EXTENT_AT_AFTER ? position + 1 : position,
 		      extent_at_mapper, (void *) &closure, object, 0,
 		      ME_START_OPEN | ME_ALL_EXTENTS_CLOSED);
@@ -4394,7 +4394,7 @@
 */
      (pos, object, property, before, at_flag))
 {
-  Bytind position;
+  Bytebpos position;
   EXTENT before_extent;
   enum extent_at_flag fl;
 
@@ -4408,7 +4408,7 @@
     invalid_argument ("extent not in specified buffer or string", object);
   fl = decode_extent_at_flag (at_flag);
 
-  return extent_at_bytind (position, object, property, before_extent, fl, 0);
+  return extent_at_bytebpos (position, object, property, before_extent, fl, 0);
 }
 
 DEFUN ("extents-at", Fextents_at, 1, 5, 0, /*
@@ -4444,7 +4444,7 @@
 */
      (pos, object, property, before, at_flag))
 {
-  Bytind position;
+  Bytebpos position;
   EXTENT before_extent;
   enum extent_at_flag fl;
 
@@ -4458,7 +4458,7 @@
     invalid_argument ("extent not in specified buffer or string", object);
   fl = decode_extent_at_flag (at_flag);
 
-  return extent_at_bytind (position, object, property, before_extent, fl, 1);
+  return extent_at_bytebpos (position, object, property, before_extent, fl, 1);
 }
 
 /* ------------------------------- */
@@ -4473,8 +4473,8 @@
 struct verify_extents_arg
 {
   Lisp_Object object;
-  Memind start;
-  Memind end;
+  Membpos start;
+  Membpos end;
   Lisp_Object iro; /* value of inhibit-read-only */
 };
 
@@ -4514,7 +4514,7 @@
    efficiency */
 
 void
-verify_extent_modification (Lisp_Object object, Bytind from, Bytind to,
+verify_extent_modification (Lisp_Object object, Bytebpos from, Bytebpos to,
 			    Lisp_Object inhibit_read_only_value)
 {
   int closed;
@@ -4529,11 +4529,11 @@
      As far as I know, this doesn't currently occur in XEmacs. --ben */
   closed = (from==to);
   closure.object = object;
-  closure.start = buffer_or_string_bytind_to_memind (object, from);
-  closure.end = buffer_or_string_bytind_to_memind (object, to);
+  closure.start = buffer_or_string_bytebpos_to_membpos (object, from);
+  closure.end = buffer_or_string_bytebpos_to_membpos (object, to);
   closure.iro = inhibit_read_only_value;
 
-  map_extents_bytind (from, to, verify_extent_mapper, (void *) &closure,
+  map_extents_bytebpos (from, to, verify_extent_mapper, (void *) &closure,
 		      object, 0, closed ? ME_END_CLOSED : ME_START_OPEN);
 }
 
@@ -4543,7 +4543,7 @@
 
 struct process_extents_for_insertion_arg
 {
-  Bytind opoint;
+  Bytebpos opoint;
   int length;
   Lisp_Object object;
 };
@@ -4558,7 +4558,7 @@
 {
   struct process_extents_for_insertion_arg *closure =
     (struct process_extents_for_insertion_arg *) arg;
-  Memind indice = buffer_or_string_bytind_to_memind (closure->object,
+  Membpos indice = buffer_or_string_bytebpos_to_membpos (closure->object,
 						      closure->opoint);
 
   /* When this function is called, one end of the newly-inserted text should
@@ -4594,8 +4594,8 @@
      it. */
 
   {
-    Memind new_start = extent_start (extent);
-    Memind new_end   = extent_end (extent);
+    Membpos new_start = extent_start (extent);
+    Membpos new_end   = extent_end (extent);
 
     if (indice == extent_start (extent) && extent_start_open_p (extent)
 	/* zero-length () extents are exempt; see comment above. */
@@ -4612,7 +4612,7 @@
 }
 
 void
-process_extents_for_insertion (Lisp_Object object, Bytind opoint,
+process_extents_for_insertion (Lisp_Object object, Bytebpos opoint,
 			       Bytecount length)
 {
   struct process_extents_for_insertion_arg closure;
@@ -4621,7 +4621,7 @@
   closure.length = length;
   closure.object = object;
 
-  map_extents_bytind (opoint, opoint + length,
+  map_extents_bytebpos (opoint, opoint + length,
 		      process_extents_for_insertion_mapper,
 		      (void *) &closure, object, 0,
 		      ME_END_CLOSED | ME_MIGHT_MODIFY_EXTENTS |
@@ -4634,7 +4634,7 @@
 
 struct process_extents_for_deletion_arg
 {
-  Memind start, end;
+  Membpos start, end;
   int destroy_included_extents;
 };
 
@@ -4672,16 +4672,16 @@
    be a function process_extents_for_destruction(), #if 0'd out,
    that did the equivalent). */
 void
-process_extents_for_deletion (Lisp_Object object, Bytind from,
-			      Bytind to, int destroy_them)
+process_extents_for_deletion (Lisp_Object object, Bytebpos from,
+			      Bytebpos to, int destroy_them)
 {
   struct process_extents_for_deletion_arg closure;
 
-  closure.start = buffer_or_string_bytind_to_memind (object, from);
-  closure.end = buffer_or_string_bytind_to_memind (object, to);
+  closure.start = buffer_or_string_bytebpos_to_membpos (object, from);
+  closure.end = buffer_or_string_bytebpos_to_membpos (object, to);
   closure.destroy_included_extents = destroy_them;
 
-  map_extents_bytind (from, to, process_extents_for_deletion_mapper,
+  map_extents_bytebpos (from, to, process_extents_for_deletion_mapper,
 		      (void *) &closure, object, 0,
 		      ME_END_CLOSED | ME_MIGHT_MODIFY_EXTENTS);
 }
@@ -4691,7 +4691,7 @@
 /* ------------------------------- */
 struct report_extent_modification_closure {
   Lisp_Object buffer;
-  Bufpos start, end;
+  Charbpos start, end;
   int afterp;
   int speccount;
 };
@@ -4727,7 +4727,7 @@
 
      One confusing thing here is that our caller never actually calls
      unbind_to (closure.speccount, Qnil).  This is because
-     map_extents_bytind() unbinds before, and with a smaller
+     map_extents_bytebpos() unbinds before, and with a smaller
      speccount.  The additional unbind_to() in
      report_extent_modification() would cause XEmacs to abort.  */
   if (closure->speccount == -1)
@@ -4764,7 +4764,7 @@
 }
 
 void
-report_extent_modification (Lisp_Object buffer, Bufpos start, Bufpos end,
+report_extent_modification (Lisp_Object buffer, Charbpos start, Charbpos end,
 			    int afterp)
 {
   struct report_extent_modification_closure closure;
@@ -5670,7 +5670,7 @@
 /* copy/paste hooks */
 
 static int
-run_extent_copy_paste_internal (EXTENT e, Bufpos from, Bufpos to,
+run_extent_copy_paste_internal (EXTENT e, Charbpos from, Charbpos to,
 				Lisp_Object object,
 				Lisp_Object prop)
 {
@@ -5697,29 +5697,29 @@
 }
 
 static int
-run_extent_copy_function (EXTENT e, Bytind from, Bytind to)
+run_extent_copy_function (EXTENT e, Bytebpos from, Bytebpos to)
 {
   Lisp_Object object = extent_object (e);
   /* This function can GC */
   return run_extent_copy_paste_internal
-    (e, buffer_or_string_bytind_to_bufpos (object, from),
-     buffer_or_string_bytind_to_bufpos (object, to), object,
+    (e, buffer_or_string_bytebpos_to_charbpos (object, from),
+     buffer_or_string_bytebpos_to_charbpos (object, to), object,
      Qcopy_function);
 }
 
 static int
-run_extent_paste_function (EXTENT e, Bytind from, Bytind to,
+run_extent_paste_function (EXTENT e, Bytebpos from, Bytebpos to,
 			   Lisp_Object object)
 {
   /* This function can GC */
   return run_extent_copy_paste_internal
-    (e, buffer_or_string_bytind_to_bufpos (object, from),
-     buffer_or_string_bytind_to_bufpos (object, to), object,
+    (e, buffer_or_string_bytebpos_to_charbpos (object, from),
+     buffer_or_string_bytebpos_to_charbpos (object, to), object,
      Qpaste_function);
 }
 
 static void
-update_extent (EXTENT extent, Bytind from, Bytind to)
+update_extent (EXTENT extent, Bytebpos from, Bytebpos to)
 {
   set_extent_endpoints (extent, from, to, Qnil);
 }
@@ -5729,7 +5729,7 @@
    This code does not handle the case of undo.
    */
 static Lisp_Object
-insert_extent (EXTENT extent, Bytind new_start, Bytind new_end,
+insert_extent (EXTENT extent, Bytebpos new_start, Bytebpos new_end,
 	       Lisp_Object object, int run_hooks)
 {
   /* This function can GC */
@@ -5749,8 +5749,8 @@
     }
   else
     {
-      Bytind exstart = extent_endpoint_bytind (extent, 0);
-      Bytind exend = extent_endpoint_bytind (extent, 1);
+      Bytebpos exstart = extent_endpoint_bytebpos (extent, 0);
+      Bytebpos exend = extent_endpoint_bytebpos (extent, 1);
 
       if (exend < new_start || exstart > new_end)
 	goto copy_it;
@@ -5793,7 +5793,7 @@
 {
   EXTENT ext = decode_extent (extent, 0);
   Lisp_Object copy;
-  Bytind s, e;
+  Bytebpos s, e;
 
   buffer_or_string = decode_buffer_or_string (buffer_or_string);
   get_buffer_or_string_range_byte (buffer_or_string, start, end, &s, &e,
@@ -5813,7 +5813,7 @@
 
 struct add_string_extents_arg
 {
-  Bytind from;
+  Bytebpos from;
   Bytecount length;
   Lisp_Object string;
 };
@@ -5824,8 +5824,8 @@
   /* This function can GC */
   struct add_string_extents_arg *closure =
     (struct add_string_extents_arg *) arg;
-  Bytecount start = extent_endpoint_bytind (extent, 0) - closure->from;
-  Bytecount end   = extent_endpoint_bytind (extent, 1) - closure->from;
+  Bytecount start = extent_endpoint_bytebpos (extent, 0) - closure->from;
+  Bytecount end   = extent_endpoint_bytebpos (extent, 1) - closure->from;
 
   if (extent_duplicable_p (extent))
     {
@@ -5848,7 +5848,7 @@
 /* Add the extents in buffer BUF from OPOINT to OPOINT+LENGTH to
    the string STRING. */
 void
-add_string_extents (Lisp_Object string, struct buffer *buf, Bytind opoint,
+add_string_extents (Lisp_Object string, struct buffer *buf, Bytebpos opoint,
 		    Bytecount length)
 {
   /* This function can GC */
@@ -5861,7 +5861,7 @@
   closure.string = string;
   buffer = make_buffer (buf);
   GCPRO2 (buffer, string);
-  map_extents_bytind (opoint, opoint + length, add_string_extents_mapper,
+  map_extents_bytebpos (opoint, opoint + length, add_string_extents_mapper,
 		      (void *) &closure, buffer, 0,
 		      /* ignore extents that just abut the region */
 		      ME_END_CLOSED | ME_ALL_EXTENTS_OPEN |
@@ -5875,7 +5875,7 @@
 {
   Bytecount pos;
   Bytecount length;
-  Bytind opoint;
+  Bytebpos opoint;
   Lisp_Object buffer;
 };
 
@@ -5890,11 +5890,11 @@
 
      NEW_START and NEW_END are the prospective buffer positions of the
      extent that is going into the buffer. */
-  Bytind base_start = closure->opoint;
-  Bytind base_end = base_start + closure->length;
-  Bytind new_start = (base_start + extent_endpoint_bytind (extent, 0) -
+  Bytebpos base_start = closure->opoint;
+  Bytebpos base_end = base_start + closure->length;
+  Bytebpos new_start = (base_start + extent_endpoint_bytebpos (extent, 0) -
 		      closure->pos);
-  Bytind new_end = (base_start + extent_endpoint_bytind (extent, 1) -
+  Bytebpos new_end = (base_start + extent_endpoint_bytebpos (extent, 1) -
 		    closure->pos);
 
   if (new_start < base_start)
@@ -5922,7 +5922,7 @@
 
 void
 splice_in_string_extents (Lisp_Object string, struct buffer *buf,
-			  Bytind opoint, Bytecount length, Bytecount pos)
+			  Bytebpos opoint, Bytecount length, Bytecount pos)
 {
   struct splice_in_string_extents_arg closure;
   struct gcpro gcpro1, gcpro2;
@@ -5934,7 +5934,7 @@
   closure.length = length;
   closure.buffer = buffer;
   GCPRO2 (buffer, string);
-  map_extents_bytind (pos, pos + length,
+  map_extents_bytebpos (pos, pos + length,
 		      splice_in_string_extents_mapper,
 		      (void *) &closure, string, 0,
 		      /* ignore extents that just abut the region */
@@ -5966,8 +5966,8 @@
     (struct copy_string_extents_arg *) arg;
   Bytecount old_start, old_end, new_start, new_end;
 
-  old_start = extent_endpoint_bytind (extent, 0);
-  old_end   = extent_endpoint_bytind (extent, 1);
+  old_start = extent_endpoint_bytebpos (extent, 0);
+  old_end   = extent_endpoint_bytebpos (extent, 1);
 
   old_start = max (closure->old_pos, old_start);
   old_end   = min (closure->old_pos + closure->length, old_end);
@@ -6000,7 +6000,7 @@
   closure.new_string = new_string;
   closure.length = length;
   GCPRO2 (new_string, old_string);
-  map_extents_bytind (old_pos, old_pos + length,
+  map_extents_bytebpos (old_pos, old_pos + length,
 		      copy_string_extents_mapper,
 		      (void *) &closure, old_string, 0,
 		      /* ignore extents that just abut the region */
@@ -6030,7 +6030,7 @@
 Lisp_Object Qtext_prop_extent_paste_function;
 
 static Lisp_Object
-get_text_property_bytind (Bytind position, Lisp_Object prop,
+get_text_property_bytebpos (Bytebpos position, Lisp_Object prop,
 			  Lisp_Object object, enum extent_at_flag fl,
 			  int text_props_only)
 {
@@ -6039,13 +6039,13 @@
   /* text_props_only specifies whether we only consider text-property
      extents (those with the 'text-prop property set) or all extents. */
   if (!text_props_only)
-    extent = extent_at_bytind (position, object, prop, 0, fl, 0);
+    extent = extent_at_bytebpos (position, object, prop, 0, fl, 0);
   else
     {
       EXTENT prior = 0;
       while (1)
 	{
-	  extent = extent_at_bytind (position, object, Qtext_prop, prior,
+	  extent = extent_at_bytebpos (position, object, Qtext_prop, prior,
 				     fl, 0);
 	  if (NILP (extent))
 	    return Qnil;
@@ -6066,7 +6066,7 @@
 get_text_property_1 (Lisp_Object pos, Lisp_Object prop, Lisp_Object object,
 		     Lisp_Object at_flag, int text_props_only)
 {
-  Bytind position;
+  Bytebpos position;
   int invert = 0;
 
   object = decode_buffer_or_string (object);
@@ -6090,7 +6090,7 @@
 
   {
     Lisp_Object val =
-      get_text_property_bytind (position, prop, object,
+      get_text_property_bytebpos (position, prop, object,
 				decode_extent_at_flag (at_flag),
 				text_props_only);
     if (invert)
@@ -6156,7 +6156,7 @@
 struct put_text_prop_arg
 {
   Lisp_Object prop, value;	/* The property and value we are storing */
-  Bytind start, end;	/* The region into which we are storing it */
+  Bytebpos start, end;	/* The region into which we are storing it */
   Lisp_Object object;
   Lisp_Object the_extent;	/* Our chosen extent; this is used for
 				   communication between subsequent passes. */
@@ -6170,9 +6170,9 @@
 
   Lisp_Object object = closure->object;
   Lisp_Object value = closure->value;
-  Bytind e_start, e_end;
-  Bytind start = closure->start;
-  Bytind end   = closure->end;
+  Bytebpos e_start, e_end;
+  Bytebpos start = closure->start;
+  Bytebpos end   = closure->end;
   Lisp_Object extent, e_val;
   int is_eq;
 
@@ -6186,8 +6186,8 @@
     /* It's not for this property; do nothing. */
     return 0;
 
-  e_start = extent_endpoint_bytind (e, 0);
-  e_end   = extent_endpoint_bytind (e, 1);
+  e_start = extent_endpoint_bytebpos (e, 0);
+  e_end   = extent_endpoint_bytebpos (e, 1);
   e_val = Fextent_property (extent, closure->prop, Qnil);
   is_eq = EQ (value, e_val);
 
@@ -6201,17 +6201,17 @@
        */
       if (e_start != start || e_end != end)
 	{
-	  Bytind new_start = min (e_start, start);
-	  Bytind new_end = max (e_end, end);
+	  Bytebpos new_start = min (e_start, start);
+	  Bytebpos new_end = max (e_end, end);
 	  set_extent_endpoints (e, new_start, new_end, Qnil);
 	  /* If we changed the endpoint, then we need to set its
 	     openness. */
 	  set_extent_openness (e, new_start != e_start
-			       ? !NILP (get_text_property_bytind
+			       ? !NILP (get_text_property_bytebpos
 					(start, Qstart_open, object,
 					 EXTENT_AT_AFTER, 1)) : -1,
 			       new_end != e_end
-			       ? NILP (get_text_property_bytind
+			       ? NILP (get_text_property_bytebpos
 				       (end - 1, Qend_closed, object,
 					EXTENT_AT_AFTER, 1))
 			       : -1);
@@ -6253,8 +6253,8 @@
 	 the-extent to cover it, resulting in the minimum number of extents in
 	 the buffer.
        */
-      Bytind the_start = extent_endpoint_bytind (te, 0);
-      Bytind the_end = extent_endpoint_bytind (te, 1);
+      Bytebpos the_start = extent_endpoint_bytebpos (te, 0);
+      Bytebpos the_end = extent_endpoint_bytebpos (te, 1);
       if (e_start != the_start &&  /* note AND not OR -- hmm, why is this
 				      the case? I think it's because the
 				      assumption that the text-property
@@ -6264,8 +6264,8 @@
 				      falsely marked.  Is this bad? */
 	  e_end   != the_end)
 	{
-	  Bytind new_start = min (e_start, the_start);
-	  Bytind new_end = max (e_end, the_end);
+	  Bytebpos new_start = min (e_start, the_start);
+	  Bytebpos new_end = max (e_end, the_end);
 	  set_extent_endpoints (te, new_start, new_end, Qnil);
 	  /* If we changed the endpoint, then we need to set its
 	     openness.  We are setting the endpoint to be the same as
@@ -6288,7 +6288,7 @@
       if (e_end != start)
 	{
 	  set_extent_endpoints (e, e_start, start, Qnil);
-	  set_extent_openness (e, -1, NILP (get_text_property_bytind
+	  set_extent_openness (e, -1, NILP (get_text_property_bytebpos
 				       (start - 1, Qend_closed, object,
 					EXTENT_AT_AFTER, 1)));
 	  closure->changed_p = 1;
@@ -6302,7 +6302,7 @@
       if (e_start != end)
 	{
 	  set_extent_endpoints (e, end, e_end, Qnil);
-	  set_extent_openness (e, !NILP (get_text_property_bytind
+	  set_extent_openness (e, !NILP (get_text_property_bytebpos
 					(end, Qstart_open, object,
 					 EXTENT_AT_AFTER, 1)), -1);
 	  closure->changed_p = 1;
@@ -6313,11 +6313,11 @@
       /* Otherwise, `extent' straddles the region.  We need to split it.
        */
       set_extent_endpoints (e, e_start, start, Qnil);
-      set_extent_openness (e, -1, NILP (get_text_property_bytind
+      set_extent_openness (e, -1, NILP (get_text_property_bytebpos
 					(start - 1, Qend_closed, object,
 					 EXTENT_AT_AFTER, 1)));
       set_extent_openness (copy_extent (e, end, e_end, extent_object (e)),
-			   !NILP (get_text_property_bytind
+			   !NILP (get_text_property_bytebpos
 				  (end, Qstart_open, object,
 				   EXTENT_AT_AFTER, 1)), -1);
       closure->changed_p = 1;
@@ -6330,13 +6330,13 @@
 put_text_prop_openness_mapper (EXTENT e, void *arg)
 {
   struct put_text_prop_arg *closure = (struct put_text_prop_arg *) arg;
-  Bytind e_start, e_end;
-  Bytind start = closure->start;
-  Bytind end   = closure->end;
+  Bytebpos e_start, e_end;
+  Bytebpos start = closure->start;
+  Bytebpos end   = closure->end;
   Lisp_Object extent;
   XSETEXTENT (extent, e);
-  e_start = extent_endpoint_bytind (e, 0);
-  e_end   = extent_endpoint_bytind (e, 1);
+  e_start = extent_endpoint_bytebpos (e, 0);
+  e_end   = extent_endpoint_bytebpos (e, 1);
 
   if (NILP (Fextent_property (extent, Qtext_prop, Qnil)))
     {
@@ -6355,7 +6355,7 @@
 }
 
 static int
-put_text_prop (Bytind start, Bytind end, Lisp_Object object,
+put_text_prop (Bytebpos start, Bytebpos end, Lisp_Object object,
 	       Lisp_Object prop, Lisp_Object value,
 	       int duplicable_p)
 {
@@ -6388,7 +6388,7 @@
   closure.changed_p = 0;
   closure.the_extent = Qnil;
 
-  map_extents_bytind (start, end,
+  map_extents_bytebpos (start, end,
 		      put_text_prop_mapper,
 		      (void *) &closure, object, 0,
 		      /* get all extents that abut the region */
@@ -6397,7 +6397,7 @@
 			 fucked with the extent plist. */
 		      /* #### dmoore - I think this should include
 			 ME_MIGHT_MOVE_SOE, since the callback function
-			 might recurse back into map_extents_bytind. */
+			 might recurse back into map_extents_bytebpos. */
 		      ME_MIGHT_THROW |
 		      ME_MIGHT_MODIFY_EXTENTS);
 
@@ -6419,17 +6419,17 @@
 				Qtext_prop_extent_paste_function);
 	}
       set_extent_openness (XEXTENT (extent),
-			   !NILP (get_text_property_bytind
+			   !NILP (get_text_property_bytebpos
 				  (start, Qstart_open, object,
 				   EXTENT_AT_AFTER, 1)),
-			   NILP (get_text_property_bytind
+			   NILP (get_text_property_bytebpos
 				 (end - 1, Qend_closed, object,
 				  EXTENT_AT_AFTER, 1)));
     }
 
   if (EQ (prop, Qstart_open) || EQ (prop, Qend_closed))
     {
-      map_extents_bytind (start, end,
+      map_extents_bytebpos (start, end,
 			  put_text_prop_openness_mapper,
 			  (void *) &closure, object, 0,
 			  /* get all extents that abut the region */
@@ -6450,7 +6450,7 @@
        (start, end, prop, value, object))
 {
   /* This function can GC */
-  Bytind s, e;
+  Bytebpos s, e;
 
   object = decode_buffer_or_string (object);
   get_buffer_or_string_range_byte (object, start, end, &s, &e, 0);
@@ -6470,7 +6470,7 @@
        (start, end, prop, value, object))
 {
   /* This function can GC */
-  Bytind s, e;
+  Bytebpos s, e;
 
   object = decode_buffer_or_string (object);
   get_buffer_or_string_range_byte (object, start, end, &s, &e, 0);
@@ -6489,7 +6489,7 @@
 {
   /* This function can GC */
   int changed = 0;
-  Bytind s, e;
+  Bytebpos s, e;
 
   object = decode_buffer_or_string (object);
   get_buffer_or_string_range_byte (object, start, end, &s, &e, 0);
@@ -6517,7 +6517,7 @@
 {
   /* This function can GC */
   int changed = 0;
-  Bytind s, e;
+  Bytebpos s, e;
 
   object = decode_buffer_or_string (object);
   get_buffer_or_string_range_byte (object, start, end, &s, &e, 0);
@@ -6542,7 +6542,7 @@
 {
   /* This function can GC */
   int changed = 0;
-  Bytind s, e;
+  Bytebpos s, e;
 
   object = decode_buffer_or_string (object);
   get_buffer_or_string_range_byte (object, start, end, &s, &e, 0);
@@ -6619,8 +6619,8 @@
 */
        (pos, prop, object, limit))
 {
-  Bufpos bpos;
-  Bufpos blim;
+  Charbpos bpos;
+  Charbpos blim;
   Lisp_Object extent, value;
   int limit_was_nil;
 
@@ -6686,8 +6686,8 @@
 */
        (pos, prop, object, limit))
 {
-  Bufpos bpos;
-  Bufpos blim;
+  Charbpos bpos;
+  Charbpos blim;
   Lisp_Object extent, value;
   int limit_was_nil;
 
--- a/src/extents.h	Tue Sep 18 05:06:57 2001 +0000
+++ b/src/extents.h	Thu Sep 20 06:31:11 2001 +0000
@@ -44,8 +44,8 @@
 {
   struct lrecord_header lheader;
 
-  Memind start;
-  Memind end;
+  Membpos start;
+  Membpos end;
   Lisp_Object object; /* A buffer, string, Qnil (extent detached from no
 			 buffer), Qt (destroyed extent) */
 
@@ -351,8 +351,8 @@
 					     struct frame *frm);
 face_index extent_fragment_update (struct window *w,
 				   struct extent_fragment *ef,
-				   /* Note this is in Bytinds */
-				   Bytind pos);
+				   /* Note this is in Bytebposs */
+				   Bytebpos pos);
 void extent_fragment_delete (struct extent_fragment *ef);
 
 
@@ -378,32 +378,32 @@
 void init_buffer_extents (struct buffer *b);
 void uninit_buffer_extents (struct buffer *b);
 typedef int (*map_extents_fun) (EXTENT extent, void *arg);
-void map_extents (Bufpos from, Bufpos to, map_extents_fun fn,
+void map_extents (Charbpos from, Charbpos to, map_extents_fun fn,
 		  void *arg, Lisp_Object obj, EXTENT after,
 		  unsigned int flags);
 
-/* Note the following five functions are NOT in Bufpos's */
-void adjust_extents (Lisp_Object object, Memind from,
-		     Memind to, int amount);
-void adjust_extents_for_deletion (Lisp_Object object, Bytind from,
-				  Bytind to, int gapsize,
+/* Note the following five functions are NOT in Charbpos's */
+void adjust_extents (Lisp_Object object, Membpos from,
+		     Membpos to, int amount);
+void adjust_extents_for_deletion (Lisp_Object object, Bytebpos from,
+				  Bytebpos to, int gapsize,
 				  int numdel, int movegapsize);
-void verify_extent_modification (Lisp_Object object, Bytind from,
-				 Bytind to,
+void verify_extent_modification (Lisp_Object object, Bytebpos from,
+				 Bytebpos to,
 				 Lisp_Object inhibit_read_only_value);
 void process_extents_for_insertion (Lisp_Object object,
-				    Bytind opoint, Bytecount length);
-void process_extents_for_deletion (Lisp_Object object, Bytind from,
-				   Bytind to, int destroy_them);
-void report_extent_modification (Lisp_Object, Bufpos, Bufpos, int);
+				    Bytebpos opoint, Bytecount length);
+void process_extents_for_deletion (Lisp_Object object, Bytebpos from,
+				   Bytebpos to, int destroy_them);
+void report_extent_modification (Lisp_Object, Charbpos, Charbpos, int);
 
 void set_extent_glyph (EXTENT extent, Lisp_Object glyph, int endp,
 		       glyph_layout layout);
 
 void add_string_extents (Lisp_Object string, struct buffer *buf,
-			 Bytind opoint, Bytecount length);
+			 Bytebpos opoint, Bytecount length);
 void splice_in_string_extents (Lisp_Object string, struct buffer *buf,
-			       Bytind opoint, Bytecount length,
+			       Bytebpos opoint, Bytecount length,
 			       Bytecount pos);
 void copy_string_extents (Lisp_Object new_string,
 			  Lisp_Object old_string,
@@ -411,7 +411,7 @@
 			  Bytecount length);
 
 void detach_all_extents (Lisp_Object object);
-void set_extent_endpoints (EXTENT extent, Bytind s, Bytind e,
+void set_extent_endpoints (EXTENT extent, Bytebpos s, Bytebpos e,
 			   Lisp_Object object);
 
 #ifdef ERROR_CHECK_EXTENTS
--- a/src/faces.c	Tue Sep 18 05:06:57 2001 +0000
+++ b/src/faces.c	Thu Sep 20 06:31:11 2001 +0000
@@ -150,7 +150,7 @@
      ! plists_differ (f1->plist, f2->plist, 0, 0, depth + 1));
 }
 
-static Hash_Code
+static Hashcode
 face_hash (Lisp_Object obj, int depth)
 {
   Lisp_Face *f = XFACE (obj);
--- a/src/file-coding.c	Tue Sep 18 05:06:57 2001 +0000
+++ b/src/file-coding.c	Thu Sep 20 06:31:11 2001 +0000
@@ -174,47 +174,47 @@
 #ifdef MULE
 struct detection_state;
 static int detect_coding_sjis (struct detection_state *st,
-			       const Extbyte *src, Lstream_Data_Count n);
+			       const Extbyte *src, Bytecount n);
 static void decode_coding_sjis (Lstream *decoding, const Extbyte *src,
-				unsigned_char_dynarr *dst, Lstream_Data_Count n);
-static void encode_coding_sjis (Lstream *encoding, const Bufbyte *src,
-				unsigned_char_dynarr *dst, Lstream_Data_Count n);
+				unsigned_char_dynarr *dst, Bytecount n);
+static void encode_coding_sjis (Lstream *encoding, const Intbyte *src,
+				unsigned_char_dynarr *dst, Bytecount n);
 static int detect_coding_big5 (struct detection_state *st,
-			       const Extbyte *src, Lstream_Data_Count n);
+			       const Extbyte *src, Bytecount n);
 static void decode_coding_big5 (Lstream *decoding, const Extbyte *src,
-				unsigned_char_dynarr *dst, Lstream_Data_Count n);
-static void encode_coding_big5 (Lstream *encoding, const Bufbyte *src,
-				unsigned_char_dynarr *dst, Lstream_Data_Count n);
+				unsigned_char_dynarr *dst, Bytecount n);
+static void encode_coding_big5 (Lstream *encoding, const Intbyte *src,
+				unsigned_char_dynarr *dst, Bytecount n);
 static int detect_coding_ucs4 (struct detection_state *st,
-			       const Extbyte *src, Lstream_Data_Count n);
+			       const Extbyte *src, Bytecount n);
 static void decode_coding_ucs4 (Lstream *decoding, const Extbyte *src,
-				unsigned_char_dynarr *dst, Lstream_Data_Count n);
-static void encode_coding_ucs4 (Lstream *encoding, const Bufbyte *src,
-				unsigned_char_dynarr *dst, Lstream_Data_Count n);
+				unsigned_char_dynarr *dst, Bytecount n);
+static void encode_coding_ucs4 (Lstream *encoding, const Intbyte *src,
+				unsigned_char_dynarr *dst, Bytecount n);
 static int detect_coding_utf8 (struct detection_state *st,
-			       const Extbyte *src, Lstream_Data_Count n);
+			       const Extbyte *src, Bytecount n);
 static void decode_coding_utf8 (Lstream *decoding, const Extbyte *src,
-				unsigned_char_dynarr *dst, Lstream_Data_Count n);
-static void encode_coding_utf8 (Lstream *encoding, const Bufbyte *src,
-				unsigned_char_dynarr *dst, Lstream_Data_Count n);
+				unsigned_char_dynarr *dst, Bytecount n);
+static void encode_coding_utf8 (Lstream *encoding, const Intbyte *src,
+				unsigned_char_dynarr *dst, Bytecount n);
 static int postprocess_iso2022_mask (int mask);
 static void reset_iso2022 (Lisp_Object coding_system,
 			   struct iso2022_decoder *iso);
 static int detect_coding_iso2022 (struct detection_state *st,
-				  const Extbyte *src, Lstream_Data_Count n);
+				  const Extbyte *src, Bytecount n);
 static void decode_coding_iso2022 (Lstream *decoding, const Extbyte *src,
-				   unsigned_char_dynarr *dst, Lstream_Data_Count n);
-static void encode_coding_iso2022 (Lstream *encoding, const Bufbyte *src,
-				   unsigned_char_dynarr *dst, Lstream_Data_Count n);
+				   unsigned_char_dynarr *dst, Bytecount n);
+static void encode_coding_iso2022 (Lstream *encoding, const Intbyte *src,
+				   unsigned_char_dynarr *dst, Bytecount n);
 #endif /* MULE */
 static void decode_coding_no_conversion (Lstream *decoding, const Extbyte *src,
-					 unsigned_char_dynarr *dst, Lstream_Data_Count n);
-static void encode_coding_no_conversion (Lstream *encoding, const Bufbyte *src,
-					 unsigned_char_dynarr *dst, Lstream_Data_Count n);
+					 unsigned_char_dynarr *dst, Bytecount n);
+static void encode_coding_no_conversion (Lstream *encoding, const Intbyte *src,
+					 unsigned_char_dynarr *dst, Bytecount n);
 static void mule_decode (Lstream *decoding, const Extbyte *src,
-			 unsigned_char_dynarr *dst, Lstream_Data_Count n);
-static void mule_encode (Lstream *encoding, const Bufbyte *src,
-			 unsigned_char_dynarr *dst, Lstream_Data_Count n);
+			 unsigned_char_dynarr *dst, Bytecount n);
+static void mule_encode (Lstream *encoding, const Intbyte *src,
+			 unsigned_char_dynarr *dst, Bytecount n);
 
 typedef struct codesys_prop codesys_prop;
 struct codesys_prop
@@ -1617,7 +1617,7 @@
 
 static eol_type_t
 detect_eol_type (struct detection_state *st, const Extbyte *src,
-		 Lstream_Data_Count n)
+		 Bytecount n)
 {
   while (n--)
     {
@@ -1660,7 +1660,7 @@
 
 static int
 detect_coding_type (struct detection_state *st, const Extbyte *src,
-		    Lstream_Data_Count n, int just_do_eol)
+		    Bytecount n, int just_do_eol)
 {
   if (st->eol_type == EOL_AUTODETECT)
     st->eol_type = detect_eol_type (st, src, n);
@@ -1791,7 +1791,7 @@
       Extbyte buf[4096];
       Lisp_Object coding_system = Qnil;
       Extbyte *p;
-      Lstream_Data_Count nread = Lstream_read (stream, buf, sizeof (buf));
+      Bytecount nread = Lstream_read (stream, buf, sizeof (buf));
       Extbyte *scan_end;
 
       /* Look for initial "-*-"; mode line prefix */
@@ -1907,7 +1907,7 @@
 {
   Lisp_Object val = Qnil;
   struct buffer *buf = decode_buffer (buffer, 0);
-  Bufpos b, e;
+  Charbpos b, e;
   Lisp_Object instream, lb_instream;
   Lstream *istr, *lb_istr;
   struct detection_state decst;
@@ -1925,7 +1925,7 @@
   while (1)
     {
       Extbyte random_buffer[4096];
-      Lstream_Data_Count nread = Lstream_read (istr, random_buffer, sizeof (random_buffer));
+      Bytecount nread = Lstream_read (istr, random_buffer, sizeof (random_buffer));
 
       if (!nread)
 	break;
@@ -2092,10 +2092,10 @@
   struct detection_state decst;
 };
 
-static Lstream_Data_Count decoding_reader (Lstream *stream,
-				unsigned char *data, Lstream_Data_Count size);
-static Lstream_Data_Count decoding_writer (Lstream *stream,
-				const unsigned char *data, Lstream_Data_Count size);
+static Bytecount decoding_reader (Lstream *stream,
+				unsigned char *data, Bytecount size);
+static Bytecount decoding_writer (Lstream *stream,
+				const unsigned char *data, Bytecount size);
 static int decoding_rewinder   (Lstream *stream);
 static int decoding_seekable_p (Lstream *stream);
 static int decoding_flusher    (Lstream *stream);
@@ -2127,12 +2127,12 @@
 /* Read SIZE bytes of data and store it into DATA.  We are a decoding stream
    so we read data from the other end, decode it, and store it into DATA. */
 
-static Lstream_Data_Count
-decoding_reader (Lstream *stream, unsigned char *data, Lstream_Data_Count size)
+static Bytecount
+decoding_reader (Lstream *stream, unsigned char *data, Bytecount size)
 {
   struct decoding_stream *str = DECODING_STREAM_DATA (stream);
   unsigned char *orig_data = data;
-  Lstream_Data_Count read_size;
+  Bytecount read_size;
   int error_occurred = 0;
 
   /* We need to interface to mule_decode(), which expects to take some
@@ -2148,7 +2148,7 @@
 	 most SIZE bytes, and delete the data from the runoff. */
       if (Dynarr_length (str->runoff) > 0)
 	{
-	  Lstream_Data_Count chunk = min (size, (Lstream_Data_Count) Dynarr_length (str->runoff));
+	  Bytecount chunk = min (size, (Bytecount) Dynarr_length (str->runoff));
 	  memcpy (data, Dynarr_atp (str->runoff, 0), chunk);
 	  Dynarr_delete_many (str->runoff, 0, chunk);
 	  data += chunk;
@@ -2189,11 +2189,11 @@
     return data - orig_data;
 }
 
-static Lstream_Data_Count
-decoding_writer (Lstream *stream, const unsigned char *data, Lstream_Data_Count size)
+static Bytecount
+decoding_writer (Lstream *stream, const unsigned char *data, Bytecount size)
 {
   struct decoding_stream *str = DECODING_STREAM_DATA (stream);
-  Lstream_Data_Count retval;
+  Bytecount retval;
 
   /* Decode all our data into the runoff, and then attempt to write
      it all out to the other end.  Remove whatever chunk we succeeded
@@ -2351,7 +2351,7 @@
 
 static void
 mule_decode (Lstream *decoding, const Extbyte *src,
-	     unsigned_char_dynarr *dst, Lstream_Data_Count n)
+	     unsigned_char_dynarr *dst, Bytecount n)
 {
   struct decoding_stream *str = DECODING_STREAM_DATA (decoding);
 
@@ -2439,7 +2439,7 @@
 */
        (start, end, coding_system, buffer))
 {
-  Bufpos b, e;
+  Charbpos b, e;
   struct buffer *buf = decode_buffer (buffer, 0);
   Lisp_Object instream, lb_outstream, de_outstream, outstream;
   Lstream *istr, *ostr;
@@ -2471,9 +2471,9 @@
   while (1)
     {
       char tempbuf[1024]; /* some random amount */
-      Bufpos newpos, even_newer_pos;
-      Bufpos oldpos = lisp_buffer_stream_startpos (istr);
-      Lstream_Data_Count size_in_bytes = Lstream_read (istr, tempbuf, sizeof (tempbuf));
+      Charbpos newpos, even_newer_pos;
+      Charbpos oldpos = lisp_buffer_stream_startpos (istr);
+      Bytecount size_in_bytes = Lstream_read (istr, tempbuf, sizeof (tempbuf));
 
       if (!size_in_bytes)
 	break;
@@ -2558,9 +2558,9 @@
 #endif /* MULE */
 };
 
-static Lstream_Data_Count encoding_reader (Lstream *stream, unsigned char *data, Lstream_Data_Count size);
-static Lstream_Data_Count encoding_writer (Lstream *stream, const unsigned char *data,
-				Lstream_Data_Count size);
+static Bytecount encoding_reader (Lstream *stream, unsigned char *data, Bytecount size);
+static Bytecount encoding_writer (Lstream *stream, const unsigned char *data,
+				Bytecount size);
 static int encoding_rewinder   (Lstream *stream);
 static int encoding_seekable_p (Lstream *stream);
 static int encoding_flusher    (Lstream *stream);
@@ -2592,12 +2592,12 @@
 /* Read SIZE bytes of data and store it into DATA.  We are a encoding stream
    so we read data from the other end, encode it, and store it into DATA. */
 
-static Lstream_Data_Count
-encoding_reader (Lstream *stream, unsigned char *data, Lstream_Data_Count size)
+static Bytecount
+encoding_reader (Lstream *stream, unsigned char *data, Bytecount size)
 {
   struct encoding_stream *str = ENCODING_STREAM_DATA (stream);
   unsigned char *orig_data = data;
-  Lstream_Data_Count read_size;
+  Bytecount read_size;
   int error_occurred = 0;
 
   /* We need to interface to mule_encode(), which expects to take some
@@ -2654,11 +2654,11 @@
     return data - orig_data;
 }
 
-static Lstream_Data_Count
-encoding_writer (Lstream *stream, const unsigned char *data, Lstream_Data_Count size)
+static Bytecount
+encoding_writer (Lstream *stream, const unsigned char *data, Bytecount size)
 {
   struct encoding_stream *str = ENCODING_STREAM_DATA (stream);
-  Lstream_Data_Count retval;
+  Bytecount retval;
 
   /* Encode all our data into the runoff, and then attempt to write
      it all out to the other end.  Remove whatever chunk we succeeded
@@ -2797,8 +2797,8 @@
    Store the encoded data into DST. */
 
 static void
-mule_encode (Lstream *encoding, const Bufbyte *src,
-	     unsigned_char_dynarr *dst, Lstream_Data_Count n)
+mule_encode (Lstream *encoding, const Intbyte *src,
+	     unsigned_char_dynarr *dst, Bytecount n)
 {
   struct encoding_stream *str = ENCODING_STREAM_DATA (encoding);
 
@@ -2852,7 +2852,7 @@
 */
        (start, end, coding_system, buffer))
 {
-  Bufpos b, e;
+  Charbpos b, e;
   struct buffer *buf = decode_buffer (buffer, 0);
   Lisp_Object instream, lb_outstream, de_outstream, outstream;
   Lstream *istr, *ostr;
@@ -2882,9 +2882,9 @@
   while (1)
     {
       char tempbuf[1024]; /* some random amount */
-      Bufpos newpos, even_newer_pos;
-      Bufpos oldpos = lisp_buffer_stream_startpos (istr);
-      Lstream_Data_Count size_in_bytes = Lstream_read (istr, tempbuf, sizeof (tempbuf));
+      Charbpos newpos, even_newer_pos;
+      Charbpos oldpos = lisp_buffer_stream_startpos (istr);
+      Bytecount size_in_bytes = Lstream_read (istr, tempbuf, sizeof (tempbuf));
 
       if (!size_in_bytes)
 	break;
@@ -2947,7 +2947,7 @@
   ((c) >= 0xA1 && (c) <= 0xDF)
 
 static int
-detect_coding_sjis (struct detection_state *st, const Extbyte *src, Lstream_Data_Count n)
+detect_coding_sjis (struct detection_state *st, const Extbyte *src, Bytecount n)
 {
   while (n--)
     {
@@ -2970,7 +2970,7 @@
 
 static void
 decode_coding_sjis (Lstream *decoding, const Extbyte *src,
-		    unsigned_char_dynarr *dst, Lstream_Data_Count n)
+		    unsigned_char_dynarr *dst, Bytecount n)
 {
   struct decoding_stream *str = DECODING_STREAM_DATA (decoding);
   unsigned int flags  = str->flags;
@@ -3025,8 +3025,8 @@
 /* Convert internally-formatted data to Shift-JIS. */
 
 static void
-encode_coding_sjis (Lstream *encoding, const Bufbyte *src,
-		    unsigned_char_dynarr *dst, Lstream_Data_Count n)
+encode_coding_sjis (Lstream *encoding, const Intbyte *src,
+		    unsigned_char_dynarr *dst, Bytecount n)
 {
   struct encoding_stream *str = ENCODING_STREAM_DATA (encoding);
   unsigned int flags  = str->flags;
@@ -3035,7 +3035,7 @@
 
   while (n--)
     {
-      Bufbyte c = *src++;
+      Intbyte c = *src++;
       if (c == '\n')
 	{
 	  if (eol_type != EOL_LF && eol_type != EOL_AUTODETECT)
@@ -3049,7 +3049,7 @@
 	  Dynarr_add (dst, c);
 	  ch = 0;
 	}
-      else if (BUFBYTE_LEADING_BYTE_P (c))
+      else if (INTBYTE_LEADING_BYTE_P (c))
 	ch = (c == LEADING_BYTE_KATAKANA_JISX0201 ||
 	      c == LEADING_BYTE_JAPANESE_JISX0208_1978 ||
 	      c == LEADING_BYTE_JAPANESE_JISX0208) ? c : 0;
@@ -3228,7 +3228,7 @@
 } while (0)
 
 static int
-detect_coding_big5 (struct detection_state *st, const Extbyte *src, Lstream_Data_Count n)
+detect_coding_big5 (struct detection_state *st, const Extbyte *src, Bytecount n)
 {
   while (n--)
     {
@@ -3252,7 +3252,7 @@
 
 static void
 decode_coding_big5 (Lstream *decoding, const Extbyte *src,
-		    unsigned_char_dynarr *dst, Lstream_Data_Count n)
+		    unsigned_char_dynarr *dst, Bytecount n)
 {
   struct decoding_stream *str = DECODING_STREAM_DATA (decoding);
   unsigned int flags  = str->flags;
@@ -3300,8 +3300,8 @@
 /* Convert internally-formatted data to Big5. */
 
 static void
-encode_coding_big5 (Lstream *encoding, const Bufbyte *src,
-		    unsigned_char_dynarr *dst, Lstream_Data_Count n)
+encode_coding_big5 (Lstream *encoding, const Intbyte *src,
+		    unsigned_char_dynarr *dst, Bytecount n)
 {
   unsigned char c;
   struct encoding_stream *str = ENCODING_STREAM_DATA (encoding);
@@ -3324,7 +3324,7 @@
 	  /* ASCII. */
 	  Dynarr_add (dst, c);
 	}
-      else if (BUFBYTE_LEADING_BYTE_P (c))
+      else if (INTBYTE_LEADING_BYTE_P (c))
 	{
 	  if (c == LEADING_BYTE_CHINESE_BIG5_1 ||
 	      c == LEADING_BYTE_CHINESE_BIG5_2)
@@ -3505,7 +3505,7 @@
 
   if (! NILP (chr))
     {
-      Bufbyte work[MAX_EMCHAR_LEN];
+      Intbyte work[MAX_EMCHAR_LEN];
       int len;
 
       ch = XCHAR (chr);
@@ -3567,7 +3567,7 @@
 }
 
 static int
-detect_coding_ucs4 (struct detection_state *st, const Extbyte *src, Lstream_Data_Count n)
+detect_coding_ucs4 (struct detection_state *st, const Extbyte *src, Bytecount n)
 {
   while (n--)
     {
@@ -3592,7 +3592,7 @@
 
 static void
 decode_coding_ucs4 (Lstream *decoding, const Extbyte *src,
-		    unsigned_char_dynarr *dst, Lstream_Data_Count n)
+		    unsigned_char_dynarr *dst, Bytecount n)
 {
   struct decoding_stream *str = DECODING_STREAM_DATA (decoding);
   unsigned int flags = str->flags;
@@ -3627,8 +3627,8 @@
 }
 
 static void
-encode_coding_ucs4 (Lstream *encoding, const Bufbyte *src,
-		    unsigned_char_dynarr *dst, Lstream_Data_Count n)
+encode_coding_ucs4 (Lstream *encoding, const Intbyte *src,
+		    unsigned_char_dynarr *dst, Bytecount n)
 {
   struct encoding_stream *str = ENCODING_STREAM_DATA (encoding);
   unsigned int flags = str->flags;
@@ -3639,7 +3639,7 @@
 #ifdef ENABLE_COMPOSITE_CHARS
   /* flags for handling composite chars.  We do a little switcharoo
      on the source while we're outputting the composite char. */
-  Lstream_Data_Count saved_n = 0;
+  Bytecount saved_n = 0;
   const unsigned char *saved_src = NULL;
   int in_composite = 0;
 
@@ -3656,7 +3656,7 @@
 	  encode_ucs4 (Vcharset_ascii, c, 0, dst);
 	  char_boundary = 1;
 	}
-      else if (BUFBYTE_LEADING_BYTE_P (c) || BUFBYTE_LEADING_BYTE_P (ch))
+      else if (INTBYTE_LEADING_BYTE_P (c) || INTBYTE_LEADING_BYTE_P (ch))
 	{ /* Processing Leading Byte */
 	  ch = 0;
 	  charset = CHARSET_BY_LEADING_BYTE (c);
@@ -3766,7 +3766,7 @@
 /************************************************************************/
 
 static int
-detect_coding_utf8 (struct detection_state *st, const Extbyte *src, Lstream_Data_Count n)
+detect_coding_utf8 (struct detection_state *st, const Extbyte *src, Bytecount n)
 {
   while (n--)
     {
@@ -3801,7 +3801,7 @@
 
 static void
 decode_coding_utf8 (Lstream *decoding, const Extbyte *src,
-		    unsigned_char_dynarr *dst, Lstream_Data_Count n)
+		    unsigned_char_dynarr *dst, Bytecount n)
 {
   struct decoding_stream *str = DECODING_STREAM_DATA (decoding);
   unsigned int flags  = str->flags;
@@ -3914,8 +3914,8 @@
 }
 
 static void
-encode_coding_utf8 (Lstream *encoding, const Bufbyte *src,
-		    unsigned_char_dynarr *dst, Lstream_Data_Count n)
+encode_coding_utf8 (Lstream *encoding, const Intbyte *src,
+		    unsigned_char_dynarr *dst, Bytecount n)
 {
   struct encoding_stream *str = ENCODING_STREAM_DATA (encoding);
   unsigned int flags  = str->flags;
@@ -3927,7 +3927,7 @@
 #ifdef ENABLE_COMPOSITE_CHARS
   /* flags for handling composite chars.  We do a little switcharoo
      on the source while we're outputting the composite char. */
-  Lstream_Data_Count saved_n = 0;
+  Bytecount saved_n = 0;
   const unsigned char *saved_src = NULL;
   int in_composite = 0;
 
@@ -3952,7 +3952,7 @@
 	    encode_utf8 (Vcharset_ascii, c, 0, dst);
 	  char_boundary = 1;
 	}
-      else if (BUFBYTE_LEADING_BYTE_P (c) || BUFBYTE_LEADING_BYTE_P (ch))
+      else if (INTBYTE_LEADING_BYTE_P (c) || INTBYTE_LEADING_BYTE_P (ch))
 	{ /* Processing Leading Byte */
 	  ch = 0;
 	  charset = CHARSET_BY_LEADING_BYTE (c);
@@ -4674,7 +4674,7 @@
 }
 
 static int
-detect_coding_iso2022 (struct detection_state *st, const Extbyte *src, Lstream_Data_Count n)
+detect_coding_iso2022 (struct detection_state *st, const Extbyte *src, Bytecount n)
 {
   int mask;
 
@@ -4865,7 +4865,7 @@
 
 static void
 decode_coding_iso2022 (Lstream *decoding, const Extbyte *src,
-		       unsigned_char_dynarr *dst, Lstream_Data_Count n)
+		       unsigned_char_dynarr *dst, Bytecount n)
 {
   struct decoding_stream *str = DECODING_STREAM_DATA (decoding);
   unsigned int flags  = str->flags;
@@ -4905,7 +4905,7 @@
 		  break;
 		case ISO_ESC_END_COMPOSITE:
 		  {
-		    Bufbyte comstr[MAX_EMCHAR_LEN];
+		    Intbyte comstr[MAX_EMCHAR_LEN];
 		    Bytecount len;
 		    Emchar emch = lookup_composite_char (Dynarr_atp (dst, 0),
 							 Dynarr_length (dst));
@@ -5190,8 +5190,8 @@
 /* Convert internally-formatted data to ISO2022 format. */
 
 static void
-encode_coding_iso2022 (Lstream *encoding, const Bufbyte *src,
-		       unsigned_char_dynarr *dst, Lstream_Data_Count n)
+encode_coding_iso2022 (Lstream *encoding, const Intbyte *src,
+		       unsigned_char_dynarr *dst, Bytecount n)
 {
   unsigned char charmask, c;
   unsigned char char_boundary;
@@ -5207,7 +5207,7 @@
 #ifdef ENABLE_COMPOSITE_CHARS
   /* flags for handling composite chars.  We do a little switcharoo
      on the source while we're outputting the composite char. */
-  Lstream_Data_Count saved_n = 0;
+  Bytecount saved_n = 0;
   const unsigned char *saved_src = NULL;
   int in_composite = 0;
 #endif /* ENABLE_COMPOSITE_CHARS */
@@ -5270,7 +5270,7 @@
 	  char_boundary = 1;
 	}
 
-      else if (BUFBYTE_LEADING_BYTE_P (c) || BUFBYTE_LEADING_BYTE_P (ch))
+      else if (INTBYTE_LEADING_BYTE_P (c) || INTBYTE_LEADING_BYTE_P (ch))
 	{ /* Processing Leading Byte */
 	  ch = 0;
 	  charset = CHARSET_BY_LEADING_BYTE (c);
@@ -5500,7 +5500,7 @@
    interpreted as being in any particular decoding. */
 static void
 decode_coding_no_conversion (Lstream *decoding, const Extbyte *src,
-			     unsigned_char_dynarr *dst, Lstream_Data_Count n)
+			     unsigned_char_dynarr *dst, Bytecount n)
 {
   struct decoding_stream *str = DECODING_STREAM_DATA (decoding);
   unsigned int flags  = str->flags;
@@ -5523,8 +5523,8 @@
 }
 
 static void
-encode_coding_no_conversion (Lstream *encoding, const Bufbyte *src,
-			     unsigned_char_dynarr *dst, Lstream_Data_Count n)
+encode_coding_no_conversion (Lstream *encoding, const Intbyte *src,
+			     unsigned_char_dynarr *dst, Bytecount n)
 {
   unsigned char c;
   struct encoding_stream *str = ENCODING_STREAM_DATA (encoding);
@@ -5548,7 +5548,7 @@
 	  assert (ch == 0);
 	  Dynarr_add (dst, c);
 	}
-      else if (BUFBYTE_LEADING_BYTE_P (c))
+      else if (INTBYTE_LEADING_BYTE_P (c))
 	{
 	  assert (ch == 0);
 	  if (c == LEADING_BYTE_LATIN_ISO8859_1 ||
--- a/src/file-coding.h	Tue Sep 18 05:06:57 2001 +0000
+++ b/src/file-coding.h	Thu Sep 20 06:31:11 2001 +0000
@@ -535,8 +535,8 @@
 #define LEADING_BYTE_CONTROL_1		0x8F /* represent normal 80-9F */
 #define LEADING_BYTE_LATIN_ISO8859_1	0x81 /* Right half of ISO 8859-1 */
 #define BYTE_C1_P(c) ((unsigned int) ((unsigned int) (c) - 0x80) < 0x20)
-#define BUFBYTE_FIRST_BYTE_P(c) ((c) < 0xA0)
-#define BUFBYTE_LEADING_BYTE_P(c) BYTE_C1_P (c)
+#define INTBYTE_FIRST_BYTE_P(c) ((c) < 0xA0)
+#define INTBYTE_LEADING_BYTE_P(c) BYTE_C1_P (c)
 #endif /* not MULE */
 
 #endif /* INCLUDED_file_coding_h_ */
--- a/src/fileio.c	Tue Sep 18 05:06:57 2001 +0000
+++ b/src/fileio.c	Thu Sep 20 06:31:11 2001 +0000
@@ -68,7 +68,7 @@
   normalize_filename(s, DIRECTORY_SEP)
 /* Default implementation that coerces a file to use path_sep. */
 static void
-normalize_filename (Bufbyte *fp, Bufbyte path_sep)
+normalize_filename (Intbyte *fp, Intbyte path_sep)
 {
   /* Always lower-case drive letters a-z, even if the filesystem
      preserves case in filenames.
@@ -161,7 +161,7 @@
 
 DOESNT_RETURN
 report_file_type_error (Lisp_Object errtype, Lisp_Object oserrmess,
-			const CBufbyte *string, Lisp_Object data)
+			const CIntbyte *string, Lisp_Object data)
 {
   struct gcpro gcpro1;
   Lisp_Object errdata = build_error_data (NULL, data);
@@ -175,7 +175,7 @@
 
 DOESNT_RETURN
 report_error_with_errno (Lisp_Object errtype,
-			 const CBufbyte *string, Lisp_Object data)
+			 const CIntbyte *string, Lisp_Object data)
 {
   report_file_type_error (errtype, lisp_strerror (errno), string, data);
 }
@@ -183,7 +183,7 @@
 /* signal a file error when errno contains a meaningful value. */
 
 DOESNT_RETURN
-report_file_error (const CBufbyte *string, Lisp_Object data)
+report_file_error (const CIntbyte *string, Lisp_Object data)
 {
   report_error_with_errno (Qfile_error, string, data);
 }
@@ -237,15 +237,15 @@
    (#### Actually, longjmp()ing out of the signal handler may not be
    as losing as I thought.  See qxe_reliable_signal() in sysdep.c.) */
 
-Memory_Count
-read_allowing_quit (int fildes, void *buf, Memory_Count size)
+Bytecount
+read_allowing_quit (int fildes, void *buf, Bytecount size)
 {
   QUIT;
   return sys_read_1 (fildes, buf, size, 1);
 }
 
-Memory_Count
-write_allowing_quit (int fildes, const void *buf, Memory_Count size)
+Bytecount
+write_allowing_quit (int fildes, const void *buf, Bytecount size)
 {
   QUIT;
   return sys_write_1 (fildes, buf, size, 1);
@@ -369,8 +369,8 @@
        (filename))
 {
   /* This function can GC.  GC checked 2000-07-28 ben */
-  Bufbyte *beg;
-  Bufbyte *p;
+  Intbyte *beg;
+  Intbyte *p;
   Lisp_Object handler;
 
   CHECK_STRING (filename);
@@ -402,7 +402,7 @@
   if (p == beg + 2 && beg[1] == ':')
     {
       /* MAXPATHLEN+1 is guaranteed to be enough space for getdefdir.  */
-      Bufbyte *res = (Bufbyte*) alloca (MAXPATHLEN + 1);
+      Intbyte *res = (Intbyte*) alloca (MAXPATHLEN + 1);
       if (_getdcwd (toupper (*beg) - 'A' + 1, (char *)res, MAXPATHLEN))
 	{
 	  char *c=((char *) res) + strlen ((char *) res);
@@ -428,7 +428,7 @@
        (filename))
 {
   /* This function can GC.  GC checked 2000-07-28 ben */
-  Bufbyte *beg, *p, *end;
+  Intbyte *beg, *p, *end;
   Lisp_Object handler;
 
   CHECK_STRING (filename);
@@ -620,7 +620,7 @@
 
   Lisp_Object val;
   Bytecount len;
-  Bufbyte *p, *data;
+  Intbyte *p, *data;
 
   CHECK_STRING (prefix);
 
@@ -711,11 +711,11 @@
        (name, default_directory))
 {
   /* This function can GC.  GC-checked 2000-11-18 */
-  Bufbyte *nm;
-
-  Bufbyte *newdir, *p, *o;
+  Intbyte *nm;
+
+  Intbyte *newdir, *p, *o;
   int tlen;
-  Bufbyte *target;
+  Intbyte *target;
 #ifdef WIN32_FILENAMES
   int drive = 0;
   int collapse_newdir = 1;
@@ -798,13 +798,13 @@
 #ifdef WIN32_FILENAMES
   /* We will force directory separators to be either all \ or /, so make
      a local copy to modify, even if there ends up being no change. */
-  nm = (Bufbyte *) strcpy ((char *) alloca (strlen ((char *) nm) + 1),
+  nm = (Intbyte *) strcpy ((char *) alloca (strlen ((char *) nm) + 1),
 			   (char *) nm);
 
   /* Find and remove drive specifier if present; this makes nm absolute
      even if the rest of the name appears to be relative. */
   {
-    Bufbyte *colon = (Bufbyte *) strrchr ((char *)nm, ':');
+    Intbyte *colon = (Intbyte *) strrchr ((char *)nm, ':');
 
     if (colon)
       {
@@ -884,7 +884,7 @@
 	      if (IS_DIRECTORY_SEP (nm[1]))
 		{
 		  if (strcmp ((char *) nm, (char *) XSTRING_DATA (name)) != 0)
-		    name = build_string ((CBufbyte *) nm);
+		    name = build_string ((CIntbyte *) nm);
 		}
 	      /* drive must be set, so this is okay */
 	      else if (strcmp ((char *) nm - 2,
@@ -931,7 +931,7 @@
 	  Extbyte *newdir_external = get_home_directory ();
 
 	  if (newdir_external == NULL)
-	    newdir = (Bufbyte *) "";
+	    newdir = (Intbyte *) "";
 	  else
 	    TO_INTERNAL_FORMAT (C_STRING, newdir_external,
 				C_STRING_ALLOCA, (* ((char **) &newdir)),
@@ -946,7 +946,7 @@
 	{
 	  for (p = nm; *p && (!IS_DIRECTORY_SEP (*p)); p++)
 	    DO_NOTHING;
-	  o = (Bufbyte *) alloca (p - nm + 1);
+	  o = (Intbyte *) alloca (p - nm + 1);
 	  memcpy (o, (char *) nm, p - nm);
 	  o [p - nm] = 0;
 
@@ -961,7 +961,7 @@
 	      /* Does the user login name match the ~name? */
 	      if (strcmp (user, (char *) o + 1) == 0)
 	        {
-		  newdir = (Bufbyte *) get_home_directory();
+		  newdir = (Intbyte *) get_home_directory();
 	          nm = p;
 		}
 	    }
@@ -975,7 +975,7 @@
 	  speed_up_interrupts ();
 	  if (pw)
 	    {
-	      newdir = (Bufbyte *) pw -> pw_dir;
+	      newdir = (Intbyte *) pw -> pw_dir;
 	      nm = p;
 	    }
 #ifdef CYGWIN
@@ -997,7 +997,7 @@
       /* Get default directory if needed to make nm absolute. */
       if (!IS_DIRECTORY_SEP (nm[0]))
 	{
-	  newdir = (Bufbyte *) alloca (MAXPATHLEN + 1);
+	  newdir = (Intbyte *) alloca (MAXPATHLEN + 1);
 	  if (!_getdcwd (toupper (drive) - 'A' + 1, newdir, MAXPATHLEN))
 	    newdir = NULL;
 	}
@@ -1005,7 +1005,7 @@
       if (!newdir)
 	{
 	  /* Either nm starts with /, or drive isn't mounted. */
-	  newdir = (Bufbyte *) alloca (4);
+	  newdir = (Intbyte *) alloca (4);
 	  newdir[0] = DRIVE_LETTER (drive);
 	  newdir[1] = ':';
 	  newdir[2] = '/';
@@ -1061,19 +1061,19 @@
 	    }
 	  if (!IS_DIRECTORY_SEP (nm[0]))
 	    {
-	      Bufbyte *tmp = (Bufbyte *) alloca (strlen ((char *) newdir) +
+	      Intbyte *tmp = (Intbyte *) alloca (strlen ((char *) newdir) +
 						 strlen ((char *) nm) + 2);
 	      file_name_as_directory ((char *) tmp, (char *) newdir);
 	      strcat ((char *) tmp, (char *) nm);
 	      nm = tmp;
 	    }
-	  newdir = (Bufbyte *) alloca (MAXPATHLEN + 1);
+	  newdir = (Intbyte *) alloca (MAXPATHLEN + 1);
 	  if (drive)
 	    {
 #ifdef WIN32_NATIVE
 	      if (!_getdcwd (toupper (drive) - 'A' + 1, newdir, MAXPATHLEN))
 #endif
-		newdir = (Bufbyte *) "/";
+		newdir = (Intbyte *) "/";
 	    }
 	  else
 	    getcwd ((char *) newdir, MAXPATHLEN);
@@ -1097,7 +1097,7 @@
 	  if (IS_DIRECTORY_SEP (newdir[0]) && IS_DIRECTORY_SEP (newdir[1]))
 	    {
 	      newdir =
-		(Bufbyte *)
+		(Intbyte *)
 		  strcpy ((char *) alloca (strlen ((char *) newdir) + 1),
 			  (char *) newdir);
 	      p = newdir + 2;
@@ -1107,7 +1107,7 @@
 	      *p = 0;
 	    }
 	  else
-	    newdir = (Bufbyte *) "";
+	    newdir = (Intbyte *) "";
 	}
     }
 #endif /* WIN32_FILENAMES */
@@ -1123,7 +1123,7 @@
 #endif
 	  )
 	{
-	  Bufbyte *temp = (Bufbyte *) alloca (length);
+	  Intbyte *temp = (Intbyte *) alloca (length);
 	  memcpy (temp, newdir, length - 1);
 	  temp[length - 1] = 0;
 	  newdir = temp;
@@ -1138,10 +1138,10 @@
 #ifdef WIN32_FILENAMES
   /* Add reserved space for drive name.  (The Microsoft x86 compiler
      produces incorrect code if the following two lines are combined.)  */
-  target = (Bufbyte *) alloca (tlen + 2);
+  target = (Intbyte *) alloca (tlen + 2);
   target += 2;
 #else  /* not WIN32_FILENAMES */
-  target = (Bufbyte *) alloca (tlen);
+  target = (Intbyte *) alloca (tlen);
 #endif /* not WIN32_FILENAMES */
   *target = 0;
 
@@ -1260,7 +1260,7 @@
     char resolved_path[MAXPATHLEN];
     Extbyte *path;
     Extbyte *p;
-    Extcount elen;
+    Bytecount elen;
 
     TO_EXTERNAL_FORMAT (LISP_STRING, expanded_name,
 			ALLOCA, (path, elen),
@@ -1390,13 +1390,13 @@
        (filename))
 {
   /* This function can GC.  GC checked 2000-07-28 ben. */
-  Bufbyte *nm;
-
-  Bufbyte *s, *p, *o, *x, *endp;
-  Bufbyte *target = 0;
+  Intbyte *nm;
+
+  Intbyte *s, *p, *o, *x, *endp;
+  Intbyte *target = 0;
   int total = 0;
   int substituted = 0;
-  Bufbyte *xnm;
+  Intbyte *xnm;
   Lisp_Object handler;
 
   CHECK_STRING (filename);
@@ -1474,7 +1474,7 @@
 	  }
 
 	/* Copy out the variable name */
-	target = (Bufbyte *) alloca (s - o + 1);
+	target = (Intbyte *) alloca (s - o + 1);
 	strncpy ((char *) target, (char *) o, s - o);
 	target[s - o] = 0;
 #ifdef WIN32_NATIVE
@@ -1482,7 +1482,7 @@
 #endif /* WIN32_NATIVE */
 
 	/* Get variable value */
-	o = (Bufbyte *) egetenv ((char *) target);
+	o = (Intbyte *) egetenv ((char *) target);
 	if (!o) goto badvar;
 	total += strlen ((char *) o);
 	substituted = 1;
@@ -1493,7 +1493,7 @@
 
   /* If substitution required, recopy the filename and do it */
   /* Make space in stack frame for the new copy */
-  xnm = (Bufbyte *) alloca (XSTRING_LENGTH (filename) + total + 1);
+  xnm = (Intbyte *) alloca (XSTRING_LENGTH (filename) + total + 1);
   x = xnm;
 
   /* Copy the rest of the name through, replacing $ constructs with values */
@@ -1525,7 +1525,7 @@
 	  }
 
 	/* Copy out the variable name */
-	target = (Bufbyte *) alloca (s - o + 1);
+	target = (Intbyte *) alloca (s - o + 1);
 	strncpy ((char *) target, (char *) o, s - o);
 	target[s - o] = 0;
 #ifdef WIN32_NATIVE
@@ -1533,7 +1533,7 @@
 #endif /* WIN32_NATIVE */
 
 	/* Get variable value */
-	o = (Bufbyte *) egetenv ((char *) target);
+	o = (Intbyte *) egetenv ((char *) target);
 	if (!o)
 	  goto badvar;
 
@@ -1627,7 +1627,7 @@
 	  struct gcpro gcpro1;
 
 	  prompt = emacs_doprnt_string_c
-	    ((const Bufbyte *) GETTEXT ("File %s already exists; %s anyway? "),
+	    ((const Intbyte *) GETTEXT ("File %s already exists; %s anyway? "),
 	     Qnil, -1, XSTRING_DATA (absname),
 	     GETTEXT (querystring));
 
@@ -2148,7 +2148,7 @@
        (filename))
 {
   /* This function does not GC */
-  Bufbyte *ptr;
+  Intbyte *ptr;
 
   CHECK_STRING (filename);
   ptr = XSTRING_DATA (filename);
@@ -2373,7 +2373,7 @@
       xfree (buf);
       return Qnil;
     }
-  val = make_string ((Bufbyte *) buf, valsize);
+  val = make_string ((Intbyte *) buf, valsize);
   xfree (buf);
   return val;
 #else /* not S_IFLNK */
@@ -2675,7 +2675,7 @@
   struct gcpro gcpro1, gcpro2, gcpro3, gcpro4, gcpro5;
   Lisp_Object handler = Qnil, val;
   int total;
-  Bufbyte read_buf[READ_BUF_SIZE];
+  Intbyte read_buf[READ_BUF_SIZE];
   int mc_count;
   struct buffer *buf = current_buffer;
   Lisp_Object curbuf;
@@ -2814,8 +2814,8 @@
   if (!NILP (replace))
     {
       char buffer[1 << 14];
-      Bufpos same_at_start = BUF_BEGV (buf);
-      Bufpos same_at_end = BUF_ZV (buf);
+      Charbpos same_at_start = BUF_BEGV (buf);
+      Charbpos same_at_end = BUF_ZV (buf);
       int overlap;
 
       /* Count how many chars at the start of the file
@@ -2823,19 +2823,19 @@
       while (1)
 	{
 	  int nread;
-	  Bufpos bufpos;
+	  Charbpos charbpos;
 	  nread = read_allowing_quit (fd, buffer, sizeof (buffer));
 	  if (nread < 0)
 	    report_file_error ("Reading", filename);
 	  else if (nread == 0)
 	    break;
-	  bufpos = 0;
-	  while (bufpos < nread && same_at_start < BUF_ZV (buf)
-		 && BUF_FETCH_CHAR (buf, same_at_start) == buffer[bufpos])
-	    same_at_start++, bufpos++;
+	  charbpos = 0;
+	  while (charbpos < nread && same_at_start < BUF_ZV (buf)
+		 && BUF_FETCH_CHAR (buf, same_at_start) == buffer[charbpos])
+	    same_at_start++, charbpos++;
 	  /* If we found a discrepancy, stop the scan.
 	     Otherwise loop around and scan the next bufferful.  */
-	  if (bufpos != nread)
+	  if (charbpos != nread)
 	    break;
 	}
       /* If the file matches the buffer completely,
@@ -2854,7 +2854,7 @@
       while (1)
 	{
 	  int total_read, nread;
-	  Bufpos bufpos, curpos, trial;
+	  Charbpos charbpos, curpos, trial;
 
 	  /* At what file position are we now scanning?  */
 	  curpos = st.st_size - (BUF_ZV (buf) - same_at_end);
@@ -2862,7 +2862,7 @@
 	  if (curpos == 0)
 	    break;
 	  /* How much can we scan in the next step?  */
-	  trial = min (curpos, (Bufpos) sizeof (buffer));
+	  trial = min (curpos, (Charbpos) sizeof (buffer));
 	  if (lseek (fd, curpos - trial, 0) < 0)
 	    report_file_error ("Setting file position", filename);
 
@@ -2877,16 +2877,16 @@
 	    }
 	  /* Scan this bufferful from the end, comparing with
 	     the Emacs buffer.  */
-	  bufpos = total_read;
+	  charbpos = total_read;
 	  /* Compare with same_at_start to avoid counting some buffer text
 	     as matching both at the file's beginning and at the end.  */
-	  while (bufpos > 0 && same_at_end > same_at_start
+	  while (charbpos > 0 && same_at_end > same_at_start
 		 && BUF_FETCH_CHAR (buf, same_at_end - 1) ==
-		 buffer[bufpos - 1])
-	    same_at_end--, bufpos--;
+		 buffer[charbpos - 1])
+	    same_at_end--, charbpos--;
 	  /* If we found a discrepancy, stop the scan.
 	     Otherwise loop around and scan the preceding bufferful.  */
-	  if (bufpos != 0)
+	  if (charbpos != 0)
 	    break;
 	  /* If display current starts at beginning of line,
 	     keep it that way.  */
@@ -2939,7 +2939,7 @@
     }
 
   {
-    Bufpos cur_point = BUF_PT (buf);
+    Charbpos cur_point = BUF_PT (buf);
     struct gcpro ngcpro1;
     Lisp_Object stream = make_filedesc_input_stream (fd, 0, total,
 						     LSTR_ALLOW_QUIT);
@@ -2960,7 +2960,7 @@
        occurs inside of the filedesc stream. */
     while (1)
       {
-	Lstream_Data_Count this_len;
+	Bytecount this_len;
 	Charcount cc_inserted;
 
 	QUIT;
@@ -3128,7 +3128,7 @@
   Lisp_Object visit_file = Qnil;
   Lisp_Object annotations = Qnil;
   struct buffer *given_buffer;
-  Bufpos start1, end1;
+  Charbpos start1, end1;
   struct gcpro gcpro1, gcpro2, gcpro3, gcpro4, gcpro5;
   struct gcpro ngcpro1, ngcpro2;
   Lisp_Object curbuf;
@@ -3998,7 +3998,7 @@
 	      if (listdesc >= 0)
 		{
 		  const Extbyte *auto_save_file_name_ext;
-		  Extcount auto_save_file_name_ext_len;
+		  Bytecount auto_save_file_name_ext_len;
 
 		  TO_EXTERNAL_FORMAT (LISP_STRING, b->auto_save_file_name,
 				      ALLOCA, (auto_save_file_name_ext,
@@ -4007,7 +4007,7 @@
 		  if (!NILP (b->filename))
 		    {
 		      const Extbyte *filename_ext;
-		      Extcount filename_ext_len;
+		      Bytecount filename_ext_len;
 
 		      TO_EXTERNAL_FORMAT (LISP_STRING, b->filename,
 					  ALLOCA, (filename_ext,
--- a/src/filelock.c	Tue Sep 18 05:06:57 2001 +0000
+++ b/src/filelock.c	Thu Sep 20 06:31:11 2001 +0000
@@ -95,13 +95,13 @@
    that of FN plus two more for the leading `.#' plus one for the null.  */
 #define MAKE_LOCK_NAME(lock, file) \
   (lock = (char *) alloca (XSTRING_LENGTH (file) + 2 + 1), \
-   fill_in_lock_file_name ((Bufbyte *) (lock), (file)))
+   fill_in_lock_file_name ((Intbyte *) (lock), (file)))
 
 static void
-fill_in_lock_file_name (Bufbyte *lockfile, Lisp_Object fn)
+fill_in_lock_file_name (Intbyte *lockfile, Lisp_Object fn)
 {
-  Bufbyte *file_name = XSTRING_DATA (fn);
-  Bufbyte *p;
+  Intbyte *file_name = XSTRING_DATA (fn);
+  Intbyte *p;
   Bytecount dirlen;
 
   for (p = file_name + XSTRING_LENGTH (fn) - 1;
--- a/src/floatfns.c	Tue Sep 18 05:06:57 2001 +0000
+++ b/src/floatfns.c	Thu Sep 20 06:31:11 2001 +0000
@@ -175,7 +175,7 @@
   return (extract_float (obj1) == extract_float (obj2));
 }
 
-static Hash_Code
+static Hashcode
 float_hash (Lisp_Object obj, int depth)
 {
   /* mod the value down to 32-bit range */
--- a/src/fns.c	Tue Sep 18 05:06:57 2001 +0000
+++ b/src/fns.c	Thu Sep 20 06:31:11 2001 +0000
@@ -69,10 +69,10 @@
 static void
 print_bit_vector (Lisp_Object obj, Lisp_Object printcharfun, int escapeflag)
 {
-  Element_Count i;
+  Elemcount i;
   Lisp_Bit_Vector *v = XBIT_VECTOR (obj);
-  Element_Count len = bit_vector_length (v);
-  Element_Count last = len;
+  Elemcount len = bit_vector_length (v);
+  Elemcount last = len;
 
   if (INTP (Vprint_length))
     last = min (len, XINT (Vprint_length));
@@ -101,7 +101,7 @@
 		   sizeof (long)));
 }
 
-static Hash_Code
+static Hashcode
 bit_vector_hash (Lisp_Object obj, int depth)
 {
   Lisp_Bit_Vector *v = XBIT_VECTOR (obj);
@@ -111,7 +111,7 @@
 			     sizeof (long)));
 }
 
-static Memory_Count
+static Bytecount
 size_bit_vector (const void *lheader)
 {
   Lisp_Bit_Vector *v = (Lisp_Bit_Vector *) lheader;
@@ -223,7 +223,7 @@
     return make_int (XSTRING_CHAR_LENGTH (sequence));
   else if (CONSP (sequence))
     {
-      Element_Count len;
+      Elemcount len;
       GET_EXTERNAL_LIST_LENGTH (sequence, len);
       return make_int (len);
     }
@@ -250,7 +250,7 @@
        (list))
 {
   Lisp_Object hare, tortoise;
-  Element_Count len;
+  Elemcount len;
 
   for (hare = tortoise = list, len = 0;
        CONSP (hare) && (! EQ (hare, tortoise) || len == 0);
@@ -371,8 +371,8 @@
   }
 #else /* not I18N2, or MULE */
   {
-    Bufbyte *ptr1 = string_data (p1);
-    Bufbyte *ptr2 = string_data (p2);
+    Intbyte *ptr1 = string_data (p1);
+    Intbyte *ptr2 = string_data (p2);
 
     /* #### It is not really necessary to do this: We could compare
        byte-by-byte and still get a reasonable comparison, since this
@@ -530,7 +530,7 @@
   Lisp_Object list_copy = Fcons (XCAR (list), XCDR (list));
   Lisp_Object last = list_copy;
   Lisp_Object hare, tortoise;
-  Element_Count len;
+  Elemcount len;
 
   for (tortoise = hare = XCDR (list), len = 1;
        CONSP (hare);
@@ -603,8 +603,8 @@
   Lisp_Object last_tail;
   Lisp_Object prev;
   struct merge_string_extents_struct *args_mse = 0;
-  Bufbyte *string_result = 0;
-  Bufbyte *string_result_ptr = 0;
+  Intbyte *string_result = 0;
+  Intbyte *string_result_ptr = 0;
   struct gcpro gcpro1;
 
   /* The modus operandi in Emacs is "caller gc-protects args".
@@ -709,7 +709,7 @@
 	   realloc()ing in order to make the char fit properly.
 	   O(N^2) yuckage. */
         val = Qnil;
-	string_result = (Bufbyte *) alloca (total_length * MAX_EMCHAR_LEN);
+	string_result = (Intbyte *) alloca (total_length * MAX_EMCHAR_LEN);
 	string_result_ptr = string_result;
         break;
       default:
@@ -732,8 +732,8 @@
       Charcount thisleni = 0;
       Charcount thisindex = 0;
       Lisp_Object seq = args[argnum];
-      Bufbyte *string_source_ptr = 0;
-      Bufbyte *string_prev_result_ptr = string_result_ptr;
+      Intbyte *string_source_ptr = 0;
+      Intbyte *string_prev_result_ptr = string_result_ptr;
 
       if (!CONSP (seq))
 	{
@@ -2728,9 +2728,9 @@
       Bytecount old_bytecount = string_length (s);
       Bytecount new_bytecount;
       Bytecount item_bytecount;
-      Bufbyte item_buf[MAX_EMCHAR_LEN];
-      Bufbyte *p;
-      Bufbyte *end;
+      Intbyte item_buf[MAX_EMCHAR_LEN];
+      Intbyte *p;
+      Intbyte *end;
 
       CHECK_CHAR_COERCE_INT (item);
       CHECK_LISP_WRITEABLE (array);
@@ -2751,7 +2751,7 @@
   else if (VECTORP (array))
     {
       Lisp_Object *p = XVECTOR_DATA (array);
-      Element_Count len = XVECTOR_LENGTH (array);
+      Elemcount len = XVECTOR_LENGTH (array);
       CHECK_LISP_WRITEABLE (array);
       while (len--)
 	*p++ = item;
@@ -2759,7 +2759,7 @@
   else if (BIT_VECTORP (array))
     {
       Lisp_Bit_Vector *v = XBIT_VECTOR (array);
-      Element_Count len = bit_vector_length (v);
+      Elemcount len = bit_vector_length (v);
       int bit;
       CHECK_BIT (item);
       bit = XINT (item);
@@ -2798,7 +2798,7 @@
     {
       /* (setcdr (last args[0]) args[1]) */
       Lisp_Object tortoise, hare;
-      Element_Count count;
+      Elemcount count;
 
       for (hare = tortoise = args[0], count = 0;
 	   CONSP (XCDR (hare));
@@ -2867,7 +2867,7 @@
 	      if (CONSP (next) || argnum == nargs -1)
 		{
 		  /* (setcdr (last val) next) */
-		  Element_Count count;
+		  Elemcount count;
 
 		  for (count = 0;
 		       CONSP (XCDR (last_cons));
@@ -2916,7 +2916,7 @@
    If VALS is a null pointer, do not accumulate the results. */
 
 static void
-mapcar1 (Element_Count leni, Lisp_Object *vals,
+mapcar1 (Elemcount leni, Lisp_Object *vals,
 	 Lisp_Object function, Lisp_Object sequence)
 {
   Lisp_Object result;
@@ -2950,7 +2950,7 @@
       if (vals)
 	{
 	  Lisp_Object *val = vals;
-	  Element_Count i;
+	  Elemcount i;
 
 	  LIST_LOOP_2 (elt, sequence)
 	      *val++ = elt;
@@ -2985,7 +2985,7 @@
   else if (VECTORP (sequence))
     {
       Lisp_Object *objs = XVECTOR_DATA (sequence);
-      Element_Count i;
+      Elemcount i;
       for (i = 0; i < leni; i++)
 	{
 	  args[1] = *objs++;
@@ -2997,8 +2997,8 @@
     {
       /* The string data of `sequence' might be relocated during GC. */
       Bytecount slen = XSTRING_LENGTH (sequence);
-      Bufbyte *p = alloca_array (Bufbyte, slen);
-      Bufbyte *end = p + slen;
+      Intbyte *p = alloca_array (Intbyte, slen);
+      Intbyte *end = p + slen;
 
       memcpy (p, XSTRING_DATA (sequence), slen);
 
@@ -3013,7 +3013,7 @@
   else if (BIT_VECTORP (sequence))
     {
       Lisp_Bit_Vector *v = XBIT_VECTOR (sequence);
-      Element_Count i;
+      Elemcount i;
       for (i = 0; i < leni; i++)
 	{
 	  args[1] = make_int (bit_vector_bit (v, i));
@@ -3063,7 +3063,7 @@
 */
        (function, sequence))
 {
-  Element_Count len = XINT (Flength (sequence));
+  Elemcount len = XINT (Flength (sequence));
   Lisp_Object *args = alloca_array (Lisp_Object, len);
 
   mapcar1 (len, args, function, sequence);
@@ -3078,7 +3078,7 @@
 */
        (function, sequence))
 {
-  Element_Count len = XINT (Flength (sequence));
+  Elemcount len = XINT (Flength (sequence));
   Lisp_Object result = make_vector (len, Qnil);
   struct gcpro gcpro1;
 
@@ -3432,19 +3432,19 @@
   ((ec > 255) ?								\
    (base64_conversion_error ("Non-ascii character in base64 input",	\
     make_char (ec)), 0)							\
-   : (c = (Bufbyte)ec), 1))
-
-static Bytind
-base64_encode_1 (Lstream *istream, Bufbyte *to, int line_break)
+   : (c = (Intbyte)ec), 1))
+
+static Bytebpos
+base64_encode_1 (Lstream *istream, Intbyte *to, int line_break)
 {
   EMACS_INT counter = 0;
-  Bufbyte *e = to;
+  Intbyte *e = to;
   Emchar ec;
   unsigned int value;
 
   while (1)
     {
-      Bufbyte c;
+      Intbyte c;
       if (!ADVANCE_INPUT (c, istream))
 	break;
 
@@ -3509,11 +3509,11 @@
   ++ccnt;								\
 } while (0)
 
-static Bytind
-base64_decode_1 (Lstream *istream, Bufbyte *to, Charcount *ccptr)
+static Bytebpos
+base64_decode_1 (Lstream *istream, Intbyte *to, Charcount *ccptr)
 {
   Charcount ccnt = 0;
-  Bufbyte *e = to;
+  Intbyte *e = to;
   EMACS_INT streampos = 0;
 
   while (1)
@@ -3599,7 +3599,7 @@
    ways these functions can blow up, and we don't want to have memory
    leaks in those cases.  */
 #define XMALLOC_OR_ALLOCA(ptr, len, type) do {			\
-  Element_Count XOA_len = (len);				\
+  Elemcount XOA_len = (len);				\
   if (XOA_len > MAX_ALLOCA)					\
     {								\
       ptr = xnew_array (type, XOA_len);				\
@@ -3623,11 +3623,11 @@
 */
        (start, end, no_line_break))
 {
-  Bufbyte *encoded;
-  Bytind encoded_length;
+  Intbyte *encoded;
+  Bytebpos encoded_length;
   Charcount allength, length;
   struct buffer *buf = current_buffer;
-  Bufpos begv, zv, old_pt = BUF_PT (buf);
+  Charbpos begv, zv, old_pt = BUF_PT (buf);
   Lisp_Object input;
   int speccount = specpdl_depth();
 
@@ -3644,7 +3644,7 @@
   input = make_lisp_buffer_input_stream (buf, begv, zv, 0);
   /* We needn't multiply allength with MAX_EMCHAR_LEN because all the
      base64 characters will be single-byte.  */
-  XMALLOC_OR_ALLOCA (encoded, allength, Bufbyte);
+  XMALLOC_OR_ALLOCA (encoded, allength, Intbyte);
   encoded_length = base64_encode_1 (XLSTREAM (input), encoded,
 				    NILP (no_line_break));
   if (encoded_length > allength)
@@ -3674,8 +3674,8 @@
        (string, no_line_break))
 {
   Charcount allength, length;
-  Bytind encoded_length;
-  Bufbyte *encoded;
+  Bytebpos encoded_length;
+  Intbyte *encoded;
   Lisp_Object input, result;
   int speccount = specpdl_depth();
 
@@ -3686,7 +3686,7 @@
   allength += allength / MIME_LINE_LENGTH + 1 + 6;
 
   input = make_lisp_string_input_stream (string, 0, -1);
-  XMALLOC_OR_ALLOCA (encoded, allength, Bufbyte);
+  XMALLOC_OR_ALLOCA (encoded, allength, Intbyte);
   encoded_length = base64_encode_1 (XLSTREAM (input), encoded,
 				    NILP (no_line_break));
   if (encoded_length > allength)
@@ -3706,9 +3706,9 @@
        (start, end))
 {
   struct buffer *buf = current_buffer;
-  Bufpos begv, zv, old_pt = BUF_PT (buf);
-  Bufbyte *decoded;
-  Bytind decoded_length;
+  Charbpos begv, zv, old_pt = BUF_PT (buf);
+  Intbyte *decoded;
+  Bytebpos decoded_length;
   Charcount length, cc_decoded_length;
   Lisp_Object input;
   int speccount = specpdl_depth();
@@ -3720,7 +3720,7 @@
 
   input = make_lisp_buffer_input_stream (buf, begv, zv, 0);
   /* We need to allocate enough room for decoding the text. */
-  XMALLOC_OR_ALLOCA (decoded, length * MAX_EMCHAR_LEN, Bufbyte);
+  XMALLOC_OR_ALLOCA (decoded, length * MAX_EMCHAR_LEN, Intbyte);
   decoded_length = base64_decode_1 (XLSTREAM (input), decoded, &cc_decoded_length);
   if (decoded_length > length * MAX_EMCHAR_LEN)
     abort ();
@@ -3748,8 +3748,8 @@
 */
        (string))
 {
-  Bufbyte *decoded;
-  Bytind decoded_length;
+  Intbyte *decoded;
+  Bytebpos decoded_length;
   Charcount length, cc_decoded_length;
   Lisp_Object input, result;
   int speccount = specpdl_depth();
@@ -3758,7 +3758,7 @@
 
   length = XSTRING_CHAR_LENGTH (string);
   /* We need to allocate enough room for decoding the text. */
-  XMALLOC_OR_ALLOCA (decoded, length * MAX_EMCHAR_LEN, Bufbyte);
+  XMALLOC_OR_ALLOCA (decoded, length * MAX_EMCHAR_LEN, Intbyte);
 
   input = make_lisp_string_input_stream (string, 0, -1);
   decoded_length = base64_decode_1 (XLSTREAM (input), decoded,
--- a/src/font-lock.c	Tue Sep 18 05:06:57 2001 +0000
+++ b/src/font-lock.c	Thu Sep 20 06:31:11 2001 +0000
@@ -81,9 +81,9 @@
 
 struct context_cache
 {
-  Bufpos start_point;			/* beginning of defun */
-  Bufpos cur_point;			/* cache location */
-  Bufpos end_point;			/* end of defun */
+  Charbpos start_point;			/* beginning of defun */
+  Charbpos cur_point;			/* cache location */
+  Charbpos end_point;			/* end of defun */
   struct buffer *buffer;		/* does this need to be staticpro'd? */
   enum syntactic_context context;	/* single-char-syntax state */
   enum block_comment_context ccontext;	/* block-comment state */
@@ -145,8 +145,8 @@
 
 
 void
-font_lock_maybe_update_syntactic_caches (struct buffer *buf, Bufpos start,
-					 Bufpos orig_end, Bufpos new_end)
+font_lock_maybe_update_syntactic_caches (struct buffer *buf, Charbpos start,
+					 Charbpos orig_end, Charbpos new_end)
 {
   /* Note: either both context_cache and bol_context_cache are valid and
      point to the same buffer, or both are invalid.  If we have to
@@ -238,11 +238,11 @@
     }
 }
 
-static Bufpos
-beginning_of_defun (struct buffer *buf, Bufpos pt)
+static Charbpos
+beginning_of_defun (struct buffer *buf, Charbpos pt)
 {
   /* This function can GC */
-  Bufpos opt = BUF_PT (buf);
+  Charbpos opt = BUF_PT (buf);
   if (pt == BUF_BEGV (buf))
     return pt;
   BUF_SET_PT (buf, pt);
@@ -256,8 +256,8 @@
   return pt;
 }
 
-static Bufpos
-end_of_defun (struct buffer *buf, Bufpos pt)
+static Charbpos
+end_of_defun (struct buffer *buf, Charbpos pt)
 {
   Lisp_Object retval = scan_lists (buf, pt, 1, 0, 0, 1);
   if (NILP (retval))
@@ -270,7 +270,7 @@
    in buffer BUF at point PT. */
 
 static void
-setup_context_cache (struct buffer *buf, Bufpos pt)
+setup_context_cache (struct buffer *buf, Charbpos pt)
 {
   int recomputed_start_point = 0;
   /* This function can GC */
@@ -361,7 +361,7 @@
     }
   {
     /* OK, we're past the end of the top-level form. */
-    Bufpos maxpt = max (context_cache.end_point, context_cache.cur_point);
+    Charbpos maxpt = max (context_cache.end_point, context_cache.cur_point);
 #if 0
     int shortage;
 #endif
@@ -421,7 +421,7 @@
 /* Set up context_cache for position PT in BUF. */
 
 static void
-find_context (struct buffer *buf, Bufpos pt)
+find_context (struct buffer *buf, Charbpos pt)
 {
   /* This function can GC */
 #ifndef emacs
@@ -430,7 +430,7 @@
 #endif
   Emchar prev_c, c;
   int prev_syncode, syncode;
-  Bufpos target = pt;
+  Charbpos target = pt;
   setup_context_cache (buf, pt);
   pt = context_cache.cur_point;
 
@@ -746,7 +746,7 @@
        (function, start, end, buffer))
 {
   /* This function can GC */
-  Bufpos s, pt, e;
+  Charbpos s, pt, e;
   int edepth;
   enum syntactic_context this_context;
   Lisp_Object extent = Qnil;
@@ -761,7 +761,7 @@
   GCPRO1 (extent);
   while (pt < e)
     {
-      Bufpos estart, eend;
+      Charbpos estart, eend;
       /* skip over "blank" areas, and bug out at end-of-buffer. */
       while (context_cache.context == context_none)
 	{
--- a/src/frame-gtk.c	Tue Sep 18 05:06:57 2001 +0000
+++ b/src/frame-gtk.c	Thu Sep 20 06:31:11 2001 +0000
@@ -275,7 +275,7 @@
    individual properties. */
 
 static void
-gtk_set_frame_text_value (struct frame *f, Bufbyte *value,
+gtk_set_frame_text_value (struct frame *f, Intbyte *value,
 			  void (*func) (gpointer, gchar *),
 			  gpointer arg)
 {
@@ -286,7 +286,7 @@
 
 #ifdef MULE
   {
-    Bufbyte *ptr;
+    Intbyte *ptr;
     
     /* Optimize for common ASCII case */
     for (ptr = value; *ptr; ptr++)
@@ -304,7 +304,7 @@
 }
 
 static void
-gtk_set_title_from_bufbyte (struct frame *f, Bufbyte *name)
+gtk_set_title_from_intbyte (struct frame *f, Intbyte *name)
 {
   if (GTK_IS_WINDOW (FRAME_GTK_SHELL_WIDGET (f)))
     gtk_set_frame_text_value (f, name,
@@ -313,7 +313,7 @@
 }
 
 static void
-gtk_set_icon_name_from_bufbyte (struct frame *f, Bufbyte *name)
+gtk_set_icon_name_from_intbyte (struct frame *f, Intbyte *name)
 {
   gtk_set_frame_text_value (f, name,
 			    (void (*)(gpointer, gchar *))
@@ -1430,8 +1430,8 @@
   CONSOLE_HAS_METHOD (gtk, internal_frame_property_p);
   CONSOLE_HAS_METHOD (gtk, frame_properties);
   CONSOLE_HAS_METHOD (gtk, set_frame_properties);
-  CONSOLE_HAS_METHOD (gtk, set_title_from_bufbyte);
-  CONSOLE_HAS_METHOD (gtk, set_icon_name_from_bufbyte);
+  CONSOLE_HAS_METHOD (gtk, set_title_from_intbyte);
+  CONSOLE_HAS_METHOD (gtk, set_icon_name_from_intbyte);
   CONSOLE_HAS_METHOD (gtk, frame_visible_p);
   CONSOLE_HAS_METHOD (gtk, frame_totally_visible_p);
   CONSOLE_HAS_METHOD (gtk, frame_iconified_p);
--- a/src/frame-msw.c	Tue Sep 18 05:06:57 2001 +0000
+++ b/src/frame-msw.c	Thu Sep 20 06:31:11 2001 +0000
@@ -516,7 +516,7 @@
 }
 
 static void
-mswindows_set_title_from_bufbyte (struct frame *f, Bufbyte *title)
+mswindows_set_title_from_intbyte (struct frame *f, Intbyte *title)
 {
   unsigned int new_checksum = hash_string (title, strlen ((char *) title));
   if (new_checksum != FRAME_MSWINDOWS_TITLE_CHECKSUM (f))
@@ -1086,8 +1086,8 @@
   CONSOLE_HAS_METHOD (mswindows, internal_frame_property_p);
   CONSOLE_HAS_METHOD (mswindows, frame_properties);
   CONSOLE_HAS_METHOD (mswindows, set_frame_properties);
-  CONSOLE_HAS_METHOD (mswindows, set_title_from_bufbyte);
-/*  CONSOLE_HAS_METHOD (mswindows, set_icon_name_from_bufbyte); */
+  CONSOLE_HAS_METHOD (mswindows, set_title_from_intbyte);
+/*  CONSOLE_HAS_METHOD (mswindows, set_icon_name_from_intbyte); */
   CONSOLE_HAS_METHOD (mswindows, frame_visible_p);
   CONSOLE_HAS_METHOD (mswindows, frame_totally_visible_p);
   CONSOLE_HAS_METHOD (mswindows, frame_iconified_p);
--- a/src/frame-x.c	Tue Sep 18 05:06:57 2001 +0000
+++ b/src/frame-x.c	Thu Sep 20 06:31:11 2001 +0000
@@ -651,7 +651,7 @@
    individual properties. */
 
 static void
-x_set_frame_text_value (struct frame *f, Bufbyte *value,
+x_set_frame_text_value (struct frame *f, Intbyte *value,
 			String Xt_resource_name,
 			String Xt_resource_encoding_name)
 {
@@ -660,7 +660,7 @@
   String old_XtValue = NULL;
 
 #ifdef MULE
-  Bufbyte *ptr;
+  Intbyte *ptr;
   /* Optimize for common ASCII case */
   for (ptr = value; *ptr; ptr++)
     if (!BYTE_ASCII_P (*ptr))
@@ -685,13 +685,13 @@
 }
 
 static void
-x_set_title_from_bufbyte (struct frame *f, Bufbyte *name)
+x_set_title_from_intbyte (struct frame *f, Intbyte *name)
 {
   x_set_frame_text_value (f, name, XtNtitle, XtNtitleEncoding);
 }
 
 static void
-x_set_icon_name_from_bufbyte (struct frame *f, Bufbyte *name)
+x_set_icon_name_from_intbyte (struct frame *f, Intbyte *name)
 {
   x_set_frame_text_value (f, name, XtNiconName, XtNiconNameEncoding);
 }
@@ -773,7 +773,7 @@
 	  if (STRINGP (val))
 	    {
 	      const Extbyte *extval;
-	      Extcount extvallen;
+	      Bytecount extvallen;
 
 	      TO_EXTERNAL_FORMAT (LISP_STRING, val,
 				  ALLOCA, (extval, extvallen),
@@ -1264,7 +1264,7 @@
 	  filePath = transferInfo->dropData->data.files[ii];
 	  hurl = dnd_url_hexify_string ((char *)filePath, "file:");
           /* #### Mule-izing required */
-	  l_data = Fcons (make_string ((Bufbyte* )hurl,
+	  l_data = Fcons (make_string ((Intbyte* )hurl,
 				       strlen (hurl)),
 			  l_data);
 	  xfree (hurl);
@@ -1286,11 +1286,11 @@
 	  /* let us forget this name thing for now... */
  	  /* filePath = transferInfo->dropData->data.buffers[ii].name;
 	     path = (filePath == NULL) ? Qnil
-	     : make_string ((Bufbyte *)filePath, strlen (filePath)); */
+	     : make_string ((Intbyte *)filePath, strlen (filePath)); */
 	  /* what, if the data is no text, and how can I tell it? */
-	  l_data = Fcons ( list3 ( list1 ( make_string ((Bufbyte *)"text/plain", 10) ),
-				   make_string ((Bufbyte *)"8bit", 4),
-				   make_string ((Bufbyte *)transferInfo->dropData->data.buffers[ii].bp,
+	  l_data = Fcons ( list3 ( list1 ( make_string ((Intbyte *)"text/plain", 10) ),
+				   make_string ((Intbyte *)"8bit", 4),
+				   make_string ((Intbyte *)transferInfo->dropData->data.buffers[ii].bp,
 						transferInfo->dropData->data.buffers[ii].size) ),
 			   l_data );
  	}
@@ -2819,8 +2819,8 @@
   CONSOLE_HAS_METHOD (x, internal_frame_property_p);
   CONSOLE_HAS_METHOD (x, frame_properties);
   CONSOLE_HAS_METHOD (x, set_frame_properties);
-  CONSOLE_HAS_METHOD (x, set_title_from_bufbyte);
-  CONSOLE_HAS_METHOD (x, set_icon_name_from_bufbyte);
+  CONSOLE_HAS_METHOD (x, set_title_from_intbyte);
+  CONSOLE_HAS_METHOD (x, set_icon_name_from_intbyte);
   CONSOLE_HAS_METHOD (x, frame_visible_p);
   CONSOLE_HAS_METHOD (x, frame_totally_visible_p);
   CONSOLE_HAS_METHOD (x, frame_iconified_p);
--- a/src/frame.c	Tue Sep 18 05:06:57 2001 +0000
+++ b/src/frame.c	Thu Sep 20 06:31:11 2001 +0000
@@ -402,7 +402,7 @@
   else
     name = build_string ("emacs");
 
-  if (!NILP (Fstring_match (make_string ((const Bufbyte *) "\\.", 2), name,
+  if (!NILP (Fstring_match (make_string ((const Intbyte *) "\\.", 2), name,
 			    Qnil, Qnil)))
     syntax_error (". not allowed in frame names", name);
 
@@ -1804,14 +1804,14 @@
   struct window *w;
   Lisp_Object frame, window = Qnil, lisp_x = Qnil, lisp_y = Qnil;
   int x, y, obj_x, obj_y;
-  Bufpos bufpos, closest;
+  Charbpos charbpos, closest;
   Charcount modeline_closest;
   Lisp_Object obj1, obj2;
 
   if (mouse_pixel_position_1 (d, &frame, &x, &y) > 0)
     {
       int res = pixel_to_glyph_translation (XFRAME (frame), x, y, &x, &y,
-					    &obj_x, &obj_y, &w, &bufpos,
+					    &obj_x, &obj_y, &w, &charbpos,
 					    &closest, &modeline_closest,
 					    &obj1, &obj2);
       if (res == OVER_TEXT)
@@ -3070,7 +3070,7 @@
 
 
 /* The caller is responsible for freeing the returned string. */
-static Bufbyte *
+static Intbyte *
 generate_title_string (struct window *w, Lisp_Object format_str,
 		       face_index findex, int type)
 {
@@ -3106,7 +3106,7 @@
   struct window *w = XWINDOW (FRAME_SELECTED_WINDOW (f));
   Lisp_Object title_format;
   Lisp_Object icon_format;
-  Bufbyte *title;
+  Intbyte *title;
 
   /* We don't change the title for the minibuffer unless the frame
      only has a minibuffer. */
@@ -3121,14 +3121,14 @@
   title_format = symbol_value_in_buffer (Qframe_title_format,      w->buffer);
   icon_format  = symbol_value_in_buffer (Qframe_icon_title_format, w->buffer);
 
-  if (HAS_FRAMEMETH_P (f, set_title_from_bufbyte))
+  if (HAS_FRAMEMETH_P (f, set_title_from_intbyte))
     {
       title = generate_title_string (w, title_format,
 				     DEFAULT_INDEX, CURRENT_DISP);
-      FRAMEMETH (f, set_title_from_bufbyte, (f, title));
+      FRAMEMETH (f, set_title_from_intbyte, (f, title));
     }
 
-  if (HAS_FRAMEMETH_P (f, set_icon_name_from_bufbyte))
+  if (HAS_FRAMEMETH_P (f, set_icon_name_from_intbyte))
     {
       if (!EQ (icon_format, title_format) || !title)
 	{
@@ -3138,7 +3138,7 @@
 	  title = generate_title_string (w, icon_format,
 					 DEFAULT_INDEX, CURRENT_DISP);
 	}
-      FRAMEMETH (f, set_icon_name_from_bufbyte, (f, title));
+      FRAMEMETH (f, set_icon_name_from_intbyte, (f, title));
     }
 
   if (title)
--- a/src/gif_io.c	Tue Sep 18 05:06:57 2001 +0000
+++ b/src/gif_io.c	Thu Sep 20 06:31:11 2001 +0000
@@ -98,13 +98,13 @@
     GifSetCloseFunc(GifFile, GifStdFileClose, IOData);
 }
 
-Memory_Count GifStdRead(GifByteType *buf, Memory_Count size, VoidPtr method_data)
+Bytecount GifStdRead(GifByteType *buf, Bytecount size, VoidPtr method_data)
 {
   GifStdIODataType *IOtype = (GifStdIODataType*)method_data;
   return (fread(buf, 1, size, IOtype->File));
 }
 
-Memory_Count GifStdWrite(GifByteType *buf, Memory_Count size, VoidPtr method_data)
+Bytecount GifStdWrite(GifByteType *buf, Bytecount size, VoidPtr method_data)
 {
   GifStdIODataType *IOtype = (GifStdIODataType*)method_data;
   return (fwrite(buf, 1, size, IOtype->File));  
@@ -120,14 +120,14 @@
   return ret;
 }
 
-void GifRead(GifByteType *buf, Memory_Count size, GifFileType *GifFile)
+void GifRead(GifByteType *buf, Bytecount size, GifFileType *GifFile)
 {
   GifIODataType *GifIO = (GifIODataType*)GifFile->GifIO;
   if ((*(GifIO->ReadFunc))(buf, size, GifIO->ReadFunc_data) != size)
     GifError(GifFile, "Read error!");
 }
 
-void GifWrite(GifByteType *buf, Memory_Count size, GifFileType *GifFile)
+void GifWrite(GifByteType *buf, Bytecount size, GifFileType *GifFile)
 {
   GifIODataType *GifIO = (GifIODataType*)GifFile->GifIO;
   if ((*(GifIO->WriteFunc))(buf, size, GifIO->WriteFunc_data) != size)
--- a/src/gifrlib.h	Tue Sep 18 05:06:57 2001 +0000
+++ b/src/gifrlib.h	Thu Sep 20 06:31:11 2001 +0000
@@ -58,7 +58,7 @@
 
 /* I/O operations.  If you roll your own, they need to be semantically equivilent to
    fread/fwrite, with an additional paramater to hold data local to your method. */
-typedef Memory_Count (*Gif_rw_func)(GifByteType *buffer, Memory_Count size, VoidPtr method_data);
+typedef Bytecount (*Gif_rw_func)(GifByteType *buffer, Bytecount size, VoidPtr method_data);
 /* Finish up stream. Non-zero return indicates failure */
 typedef int (*Gif_close_func)(VoidPtr close_data);
 /* Error handling function */
@@ -252,13 +252,13 @@
 void GifStdIOInit(GifFileType *GifFile, FILE *file, int filehandle);
 
 /* Error checking reads, writes and closes */
-void GifRead(GifByteType *buf, Memory_Count size, GifFileType *GifFile);
-void GifWrite(GifByteType *buf, Memory_Count size, GifFileType *GifFile);
+void GifRead(GifByteType *buf, Bytecount size, GifFileType *GifFile);
+void GifWrite(GifByteType *buf, Bytecount size, GifFileType *GifFile);
 int GifClose(GifFileType *GifFile);
 
 /* The default Read and Write functions for files */
-Memory_Count GifStdRead(GifByteType *buf, Memory_Count size, VoidPtr method_data);
-Memory_Count GifStdWrite(GifByteType *buf, Memory_Count size, VoidPtr method_data);
+Bytecount GifStdRead(GifByteType *buf, Bytecount size, VoidPtr method_data);
+Bytecount GifStdWrite(GifByteType *buf, Bytecount size, VoidPtr method_data);
 int GifStdFileClose(VoidPtr method_data);
 
 ColorMapObject *MakeMapObject(int ColorCount, GifColorType *ColorMap);
--- a/src/glyphs-eimage.c	Tue Sep 18 05:06:57 2001 +0000
+++ b/src/glyphs-eimage.c	Thu Sep 20 06:31:11 2001 +0000
@@ -260,7 +260,7 @@
 } our_jpeg_source_mgr;
 
 static void
-jpeg_memory_src (j_decompress_ptr cinfo, JOCTET *data, Memory_Count len)
+jpeg_memory_src (j_decompress_ptr cinfo, JOCTET *data, Bytecount len)
 {
   struct jpeg_source_mgr *src;
 
@@ -376,7 +376,7 @@
   {
     Lisp_Object data = find_keyword_in_vector (instantiator, Q_data);
     const UChar_Binary *bytes;
-    Memory_Count len;
+    Bytecount len;
 
     /* #### This is a definite problem under Mule due to the amount of
        stack data it might allocate.  Need to be able to convert and
@@ -561,12 +561,12 @@
 typedef struct gif_memory_storage
 {
   UChar_Binary *bytes;		/* The data       */
-  Memory_Count len;		/* How big is it? */
-  Memory_Count index;		/* Where are we?  */
+  Bytecount len;		/* How big is it? */
+  Bytecount index;		/* Where are we?  */
 } gif_memory_storage;
 
-static Memory_Count
-gif_read_from_memory (GifByteType *buf, Memory_Count size, VoidPtr data)
+static Bytecount
+gif_read_from_memory (GifByteType *buf, Bytecount size, VoidPtr data)
 {
   gif_memory_storage *mem = (gif_memory_storage *) data;
 
@@ -613,7 +613,7 @@
   gif_memory_storage mem_struct;
   struct gif_error_struct gif_err;
   UChar_Binary *bytes;
-  Memory_Count len;
+  Bytecount len;
   int height = 0;
   int width = 0;
 
@@ -776,8 +776,8 @@
 struct png_memory_storage
 {
   const UChar_Binary *bytes;	/* The data       */
-  Memory_Count len;		/* How big is it? */
-  Memory_Count index;		/* Where are we?  */
+  Bytecount len;		/* How big is it? */
+  Bytecount index;		/* Where are we?  */
 };
 
 static void
@@ -787,7 +787,7 @@
    struct png_memory_storage *tbr =
      (struct png_memory_storage *) png_get_io_ptr (png_ptr);
 
-   if ((Memory_Count) length > (tbr->len - tbr->index))
+   if ((Bytecount) length > (tbr->len - tbr->index))
      png_error (png_ptr, (png_const_charp) "Read Error");
    memcpy (data, tbr->bytes + tbr->index,length);
    tbr->index = tbr->index + length;
@@ -900,7 +900,7 @@
   {
     Lisp_Object data = find_keyword_in_vector (instantiator, Q_data);
     const UChar_Binary *bytes;
-    Memory_Count len;
+    Bytecount len;
 
     assert (!NILP (data));
 
@@ -1087,8 +1087,8 @@
 typedef struct tiff_memory_storage
 {
   UChar_Binary *bytes;		/* The data       */
-  Memory_Count len;		/* How big is it? */
-  Memory_Count index;		/* Where are we?  */
+  Bytecount len;		/* How big is it? */
+  Bytecount index;		/* Where are we?  */
 } tiff_memory_storage;
 
 static size_t
@@ -1096,7 +1096,7 @@
 {
   tiff_memory_storage *mem = (tiff_memory_storage *) data;
 
-  if ((Memory_Count) size > (mem->len - mem->index))
+  if ((Bytecount) size > (mem->len - mem->index))
     return (size_t) -1;
   memcpy (buf, mem->bytes + mem->index, size);
   mem->index = mem->index + size;
@@ -1248,7 +1248,7 @@
   {
     Lisp_Object data = find_keyword_in_vector (instantiator, Q_data);
     UChar_Binary *bytes;
-    Memory_Count len;
+    Bytecount len;
 
     uint32 *raster;
     unsigned char *ep;
--- a/src/glyphs-msw.c	Tue Sep 18 05:06:57 2001 +0000
+++ b/src/glyphs-msw.c	Thu Sep 20 06:31:11 2001 +0000
@@ -942,7 +942,7 @@
   Lisp_Image_Instance *ii = XIMAGE_INSTANCE (image_instance);
   Lisp_Object device = IMAGE_INSTANCE_DEVICE (ii);
   const Extbyte		*bytes;
-  Extcount 		len;
+  Bytecount 		len;
   UChar_Binary		*eimage;
   int			width, height, x_hot, y_hot;
   BITMAPINFO*		bmp_info;
@@ -1034,7 +1034,7 @@
   Lisp_Image_Instance *ii = XIMAGE_INSTANCE (image_instance);
   Lisp_Object device = IMAGE_INSTANCE_DEVICE (ii);
   const Extbyte		*bytes;
-  Extcount 		len;
+  Bytecount 		len;
   BITMAPFILEHEADER*	bmp_file_header;
   BITMAPINFO*		bmp_info;
   void*			bmp_data;
@@ -1682,7 +1682,7 @@
   Lisp_Object data = find_keyword_in_vector (instantiator, Q_data);
   int i, stattis;
   UChar_Binary *p, *bits, *bp;
-  const CBufbyte * volatile emsg = 0;
+  const CIntbyte * volatile emsg = 0;
   const UChar_Binary * volatile dstring;
 
   assert (!NILP (data));
@@ -2151,7 +2151,7 @@
   return 1;
 }
 
-static Hash_Code
+static Hashcode
 mswindows_image_instance_hash (Lisp_Image_Instance *p, int depth)
 {
   switch (IMAGE_INSTANCE_TYPE (p))
@@ -2159,7 +2159,7 @@
     case IMAGE_MONO_PIXMAP:
     case IMAGE_COLOR_PIXMAP:
     case IMAGE_POINTER:
-      return (Hash_Code) IMAGE_INSTANCE_MSWINDOWS_BITMAP (p);
+      return (Hashcode) IMAGE_INSTANCE_MSWINDOWS_BITMAP (p);
 
     default:
       return 0;
@@ -2817,7 +2817,7 @@
   /* get the text from a control */
   if (EQ (prop, Q_text))
     {
-      Extcount len = SendMessage (wnd, WM_GETTEXTLENGTH, 0, 0);
+      Bytecount len = SendMessage (wnd, WM_GETTEXTLENGTH, 0, 0);
       Extbyte *buf = (Extbyte*) alloca (len+1);
 
       SendMessage (wnd, WM_GETTEXT, (WPARAM)len+1, (LPARAM) buf);
@@ -2853,7 +2853,7 @@
   if (EQ (prop, Q_text))
     {
       long item = SendMessage (wnd, CB_GETCURSEL, 0, 0);
-      Extcount len = SendMessage (wnd, CB_GETLBTEXTLEN, (WPARAM)item, 0);
+      Bytecount len = SendMessage (wnd, CB_GETLBTEXTLEN, (WPARAM)item, 0);
       Extbyte* buf = (Extbyte*) alloca (len+1);
       SendMessage (wnd, CB_GETLBTEXT, (WPARAM)item, (LPARAM)buf);
       return build_ext_string (buf, Qnative);
--- a/src/glyphs-x.c	Tue Sep 18 05:06:57 2001 +0000
+++ b/src/glyphs-x.c	Thu Sep 20 06:31:11 2001 +0000
@@ -506,7 +506,7 @@
   return 1;
 }
 
-static Hash_Code
+static Hashcode
 x_image_instance_hash (Lisp_Image_Instance *p, int depth)
 {
   switch (IMAGE_INSTANCE_TYPE (p))
@@ -704,7 +704,7 @@
   /* Get the data while doing the conversion */
   while (1)
     {
-      Lstream_Data_Count size_in_bytes = Lstream_read (istr, tempbuf, sizeof (tempbuf));
+      Bytecount size_in_bytes = Lstream_read (istr, tempbuf, sizeof (tempbuf));
       if (!size_in_bytes)
 	break;
       /* It does seem the flushes are necessary... */
--- a/src/glyphs.c	Tue Sep 18 05:06:57 2001 +0000
+++ b/src/glyphs.c	Thu Sep 20 06:31:11 2001 +0000
@@ -1189,11 +1189,11 @@
   return DOMAIN_LIVE_P (XIMAGE_INSTANCE_DOMAIN (instance));
 }
 
-static Hash_Code
+static Hashcode
 image_instance_hash (Lisp_Object obj, int depth)
 {
   Lisp_Image_Instance *i = XIMAGE_INSTANCE (obj);
-  Hash_Code hash = HASH5 (LISP_HASH (IMAGE_INSTANCE_DOMAIN (i)),
+  Hashcode hash = HASH5 (LISP_HASH (IMAGE_INSTANCE_DOMAIN (i)),
 			  IMAGE_INSTANCE_WIDTH (i),
 			  IMAGE_INSTANCE_MARGIN_WIDTH (i),
 			  IMAGE_INSTANCE_HEIGHT (i),
@@ -1381,7 +1381,7 @@
     (Qinvalid_argument,
      list2
      (emacs_doprnt_string_lisp_2
-      ((const Bufbyte *)
+      ((const Intbyte *)
        "No compatible image-instance types given: wanted one of %s, got %s",
        Qnil, -1, 2,
        encode_image_instance_type_list (desired_dest_mask),
@@ -2293,7 +2293,7 @@
   if (height)
     {
       /* Compute string metric info */
-      find_charsets_in_bufbyte_string (charsets,
+      find_charsets_in_intbyte_string (charsets,
 				       XSTRING_DATA   (string),
 				       XSTRING_LENGTH (string));
 
@@ -2343,7 +2343,7 @@
   Lisp_Object frame = DOMAIN_FRAME (domain);
 
   /* Compute string font info */
-  find_charsets_in_bufbyte_string (charsets,
+  find_charsets_in_intbyte_string (charsets,
 				   XSTRING_DATA   (string),
 				   XSTRING_LENGTH (string));
 
@@ -3088,7 +3088,7 @@
   return 0;
 }
 
-static Hash_Code
+static Hashcode
 instantiator_eq_hash (Lisp_Object obj)
 {
   if (CONSP (obj))
@@ -3610,7 +3610,7 @@
 	  !plists_differ (g1->plist,     g2->plist, 0, 0, depth + 1));
 }
 
-static Hash_Code
+static Hashcode
 glyph_hash (Lisp_Object obj, int depth)
 {
   depth++;
--- a/src/glyphs.h	Tue Sep 18 05:06:57 2001 +0000
+++ b/src/glyphs.h	Thu Sep 20 06:31:11 2001 +0000
@@ -550,7 +550,7 @@
   enum image_instance_type type;
   int x_offset, y_offset;	/* for layout purposes */
   int width, height, margin_width;
-  Hash_Code display_hash; /* Hash value representing the structure
+  Hashcode display_hash; /* Hash value representing the structure
 			     of the image_instance when it was
 			     last displayed. */
   unsigned int dirty : 1;
--- a/src/gpmevent.c	Tue Sep 18 05:06:57 2001 +0000
+++ b/src/gpmevent.c	Thu Sep 20 06:31:11 2001 +0000
@@ -266,9 +266,9 @@
 
 	while (1)
 	{
-		Bufbyte tempbuf[1024]; /* some random amount */
-		Lstream_Data_Count i;
-		Lstream_Data_Count size_in_bytes =
+		Intbyte tempbuf[1024]; /* some random amount */
+		Bytecount i;
+		Bytecount size_in_bytes =
 		  Lstream_read (XLSTREAM (terminal_stream),
 				tempbuf, sizeof (tempbuf));
 
--- a/src/gui-x.c	Tue Sep 18 05:06:57 2001 +0000
+++ b/src/gui-x.c	Thu Sep 20 06:31:11 2001 +0000
@@ -319,10 +319,10 @@
 #endif
 
 Extbyte *
-menu_separator_style_and_to_external (const Bufbyte *s)
+menu_separator_style_and_to_external (const Intbyte *s)
 {
-  const Bufbyte *p;
-  Bufbyte first;
+  const Intbyte *p;
+  Intbyte first;
 
   if (!s || s[0] == '\0')
     return NULL;
@@ -358,7 +358,7 @@
   int i;
   int found_accel = 0;
   Extbyte *retval;
-  Bufbyte *name = XSTRING_DATA (string);
+  Intbyte *name = XSTRING_DATA (string);
 
   for (i = 0; name[i]; ++i)
     if (name[i] == '%' && name[i+1] == '_')
@@ -372,7 +372,7 @@
   else
     {
       Bytecount namelen = XSTRING_LENGTH (string);
-      Bufbyte *chars = (Bufbyte *) alloca (namelen + 3);
+      Intbyte *chars = (Intbyte *) alloca (namelen + 3);
       chars[0] = '%';
       chars[1] = '_';
       memcpy (chars + 2, name, namelen + 1);
@@ -488,7 +488,7 @@
   CHECK_SYMBOL (pgui->style);
   if (NILP (pgui->style))
     {
-      Bufbyte *intname;
+      Intbyte *intname;
       Bytecount intlen;
       /* If the callback is nil, treat this item like unselectable text.
 	 This way, dashes will show up as a separator. */
--- a/src/gui-x.h	Tue Sep 18 05:06:57 2001 +0000
+++ b/src/gui-x.h	Thu Sep 20 06:31:11 2001 +0000
@@ -78,7 +78,7 @@
 				 int menu_entry_p, int accel_p);
 widget_value * gui_items_to_widget_values (Lisp_Object gui_object_instance,
 					   Lisp_Object items, int accel_p);
-Extbyte *menu_separator_style_and_to_external (const Bufbyte *s);
+Extbyte *menu_separator_style_and_to_external (const Intbyte *s);
 Lisp_Object widget_value_unwind (Lisp_Object closure);
 
 #endif /* INCLUDED_gui_x_h_ */
--- a/src/gui.c	Tue Sep 18 05:06:57 2001 +0000
+++ b/src/gui.c	Thu Sep 20 06:31:11 2001 +0000
@@ -57,10 +57,10 @@
 #endif /* HAVE_POPUPS */
 
 int
-separator_string_p (const Bufbyte *s)
+separator_string_p (const Intbyte *s)
 {
-  const Bufbyte *p;
-  Bufbyte first;
+  const Intbyte *p;
+  Intbyte first;
 
   if (!s || s[0] == '\0')
     return 0;
@@ -412,7 +412,7 @@
 Lisp_Object
 gui_name_accelerator (Lisp_Object nm)
 {
-  Bufbyte *name = XSTRING_DATA (nm);
+  Intbyte *name = XSTRING_DATA (nm);
 
   while (*name)
     {
@@ -616,7 +616,7 @@
   return Qnil;
 }
 
-static Hash_Code
+static Hashcode
 gui_item_hash (Lisp_Object obj, int depth)
 {
   Lisp_Gui_Item *p = XGUI_ITEM (obj);
--- a/src/gui.h	Tue Sep 18 05:06:57 2001 +0000
+++ b/src/gui.h	Thu Sep 20 06:31:11 2001 +0000
@@ -27,7 +27,7 @@
 #ifndef INCLUDED_gui_h_
 #define INCLUDED_gui_h_
 
-int separator_string_p (const Bufbyte *s);
+int separator_string_p (const Intbyte *s);
 void get_gui_callback (Lisp_Object, Lisp_Object *, Lisp_Object *);
 int gui_item_equal_sans_selected (Lisp_Object obj1, Lisp_Object obj2, int depth);
 
--- a/src/gutter.c	Tue Sep 18 05:06:57 2001 +0000
+++ b/src/gutter.c	Thu Sep 20 06:31:11 2001 +0000
@@ -552,7 +552,7 @@
    knows exactly what extents have changed. */
 void
 gutter_extent_signal_changed_region_maybe (Lisp_Object obj,
-					   Bufpos start, Bufpos end)
+					   Charbpos start, Charbpos end)
 {
   /* #### Start and end are currently ignored but could be used by a
      more optimal gutter redisplay. We currently loop over all frames
--- a/src/gutter.h	Tue Sep 18 05:06:57 2001 +0000
+++ b/src/gutter.h	Thu Sep 20 06:31:11 2001 +0000
@@ -64,7 +64,7 @@
 			     int height);
 void reset_gutter_display_lines (struct frame* f);
 void gutter_extent_signal_changed_region_maybe (Lisp_Object obj,
-						Bufpos start, Bufpos end);
+						Charbpos start, Charbpos end);
 int display_boxes_in_gutter_p (struct frame *f, struct display_box* db,
 			       struct display_glyph_area* dga);
 
--- a/src/hash.c	Tue Sep 18 05:06:57 2001 +0000
+++ b/src/hash.c	Thu Sep 20 06:31:11 2001 +0000
@@ -31,19 +31,19 @@
 #define KEYS_DIFFER_P(old, new, testfun) \
   (((old) != (new)) && (!(testfun) || !(testfun) ((old),(new))))
 
-static void rehash (hentry *harray, struct hash_table *ht, Element_Count size);
+static void rehash (hentry *harray, struct hash_table *ht, Elemcount size);
 
-Hash_Code
-memory_hash (const void *xv, Memory_Count size)
+Hashcode
+memory_hash (const void *xv, Bytecount size)
 {
-  Hash_Code h = 0;
+  Hashcode h = 0;
   unsigned const char *x = (unsigned const char *) xv;
 
   if (!x) return 0;
 
   while (size--)
     {
-      Hash_Code g;
+      Hashcode g;
       h = (h << 4) + *x++;
       if ((g = h & 0xf0000000) != 0)
 	h = (h ^ (g >> 24)) ^ g;
@@ -52,17 +52,17 @@
   return h;
 }
 
-Hash_Code
+Hashcode
 string_hash (const char *xv)
 {
-  Hash_Code h = 0;
+  Hashcode h = 0;
   unsigned const char *x = (unsigned const char *) xv;
 
   if (!x) return 0;
 
   while (*x)
     {
-      Hash_Code g;
+      Hashcode g;
       h = (h << 4) + *x++;
       if ((g = h & 0xf0000000) != 0)
 	h = (h ^ (g >> 24)) ^ g;
@@ -72,13 +72,13 @@
 }
 
 /* Return a suitable size for a hash table, with at least SIZE slots. */
-static Element_Count
-hash_table_size (Element_Count requested_size)
+static Elemcount
+hash_table_size (Elemcount requested_size)
 {
   /* Return some prime near, but greater than or equal to, SIZE.
      Decades from the time of writing, someone will have a system large
      enough that the list below will be too short... */
-  static const Element_Count primes [] =
+  static const Elemcount primes [] =
   {
     19, 29, 41, 59, 79, 107, 149, 197, 263, 347, 457, 599, 787, 1031,
     1361, 1777, 2333, 3037, 3967, 5167, 6719, 8737, 11369, 14783,
@@ -116,12 +116,12 @@
     {
       hentry *harray = hash_table->harray;
       hash_table_test_function test_function = hash_table->test_function;
-      Element_Count size = hash_table->size;
-      Hash_Code hcode_initial =
+      Elemcount size = hash_table->size;
+      Hashcode hcode_initial =
 	hash_table->hash_function ?
 	hash_table->hash_function (key) :
-	(Hash_Code) key;
-      Element_Count hcode = (Element_Count) (hcode_initial % size);
+	(Hashcode) key;
+      Elemcount hcode = (Elemcount) (hcode_initial % size);
       hentry *e = &harray [hcode];
       const void *e_key = e->key;
 
@@ -129,8 +129,8 @@
 	  KEYS_DIFFER_P (e_key, key, test_function) :
 	  e->contents == NULL_ENTRY)
 	{
-	  Element_Count h2 = size - 2;
-	  Element_Count incr = (Element_Count) (1 + (hcode_initial % h2));
+	  Elemcount h2 = size - 2;
+	  Elemcount incr = (Elemcount) (1 + (hcode_initial % h2));
 	  do
 	    {
 	      hcode += incr; if (hcode >= size) hcode -= size;
@@ -164,7 +164,7 @@
 }
 
 struct hash_table*
-make_hash_table (Element_Count size)
+make_hash_table (Elemcount size)
 {
   struct hash_table *hash_table = xnew_and_zero (struct hash_table);
   hash_table->size = hash_table_size (COMFORTABLE_SIZE (size));
@@ -174,7 +174,7 @@
 }
 
 struct hash_table *
-make_general_hash_table (Element_Count size,
+make_general_hash_table (Elemcount size,
 			hash_table_hash_function hash_function,
 			hash_table_test_function test_function)
 {
@@ -185,9 +185,9 @@
 }
 
 static void
-grow_hash_table (struct hash_table *hash_table, Element_Count new_size)
+grow_hash_table (struct hash_table *hash_table, Elemcount new_size)
 {
-  Element_Count old_size   = hash_table->size;
+  Elemcount old_size   = hash_table->size;
   hentry     *old_harray = hash_table->harray;
 
   hash_table->size   = hash_table_size (new_size);
@@ -217,15 +217,15 @@
   else
     {
       hash_table_test_function test_function = hash_table->test_function;
-      Element_Count size = hash_table->size;
+      Elemcount size = hash_table->size;
       hentry *harray   = hash_table->harray;
-      Hash_Code hcode_initial =
+      Hashcode hcode_initial =
 	hash_table->hash_function ?
 	hash_table->hash_function (key) :
-	(Hash_Code) key;
-      Element_Count hcode = (Element_Count) (hcode_initial % size);
-      Element_Count h2 = size - 2;
-      Element_Count incr = (Element_Count) (1 + (hcode_initial % h2));
+	(Hashcode) key;
+      Elemcount hcode = (Elemcount) (hcode_initial % size);
+      Elemcount h2 = size - 2;
+      Elemcount incr = (Elemcount) (1 + (hcode_initial % h2));
       const void *e_key = harray [hcode].key;
       const void *oldcontents;
 
@@ -268,7 +268,7 @@
       /* only increment the fullness when we used up a new hentry */
       if (!e_key || KEYS_DIFFER_P (e_key, key, test_function))
 	{
-	  Element_Count comfortable_size = COMFORTABLE_SIZE (++(hash_table->fullness));
+	  Elemcount comfortable_size = COMFORTABLE_SIZE (++(hash_table->fullness));
 	  if (hash_table->size < comfortable_size)
 	    grow_hash_table (hash_table, comfortable_size + 1);
 	}
@@ -276,7 +276,7 @@
 }
 
 static void
-rehash (hentry *harray, struct hash_table *hash_table, Element_Count size)
+rehash (hentry *harray, struct hash_table *hash_table, Elemcount size)
 {
   hentry *limit = harray + size;
   hentry *e;
@@ -299,12 +299,12 @@
     {
       hentry *harray = hash_table->harray;
       hash_table_test_function test_function = hash_table->test_function;
-      Element_Count size = hash_table->size;
-      Hash_Code hcode_initial =
+      Elemcount size = hash_table->size;
+      Hashcode hcode_initial =
 	(hash_table->hash_function) ?
 	(hash_table->hash_function (key)) :
-	((Hash_Code) key);
-      Element_Count hcode = (Element_Count) (hcode_initial % size);
+	((Hashcode) key);
+      Elemcount hcode = (Elemcount) (hcode_initial % size);
       hentry *e = &harray [hcode];
       const void *e_key = e->key;
 
@@ -312,8 +312,8 @@
 	  KEYS_DIFFER_P (e_key, key, test_function) :
 	  e->contents == NULL_ENTRY)
 	{
-	  Element_Count h2 = size - 2;
-	  Element_Count incr = (Element_Count) (1 + (hcode_initial % h2));
+	  Elemcount h2 = size - 2;
+	  Elemcount incr = (Elemcount) (1 + (hcode_initial % h2));
 	  do
 	    {
 	      hcode += incr; if (hcode >= size) hcode -= size;
--- a/src/hash.h	Tue Sep 18 05:06:57 2001 +0000
+++ b/src/hash.h	Thu Sep 20 06:31:11 2001 +0000
@@ -27,25 +27,25 @@
 } hentry;
 
 typedef int           (*hash_table_test_function) (const void *, const void *);
-typedef Hash_Code     (*hash_table_hash_function) (const void *);
+typedef Hashcode     (*hash_table_hash_function) (const void *);
 
 struct hash_table
 {
   hentry	*harray;
   long		zero_set;
   void		*zero_entry;
-  Element_Count	size;		/* size of the hasharray */
-  Element_Count	fullness;	/* number of entries in the hash table */
+  Elemcount	size;		/* size of the hasharray */
+  Elemcount	fullness;	/* number of entries in the hash table */
   hash_table_hash_function hash_function;
   hash_table_test_function test_function;
 };
 
 /* SIZE is the number of initial entries. The hash table will be grown
    automatically if the number of entries approaches the size */
-struct hash_table *make_hash_table (Element_Count size);
+struct hash_table *make_hash_table (Elemcount size);
 
 struct hash_table *
-make_general_hash_table (Element_Count size,
+make_general_hash_table (Elemcount size,
 			 hash_table_hash_function hash_function,
 			 hash_table_test_function test_function);
 
--- a/src/hpplay.c	Tue Sep 18 05:06:57 2001 +0000
+++ b/src/hpplay.c	Thu Sep 20 06:31:11 2001 +0000
@@ -75,7 +75,7 @@
 player_error_internal (Audio * audio, Char_ASCII * text, long errorCode)
 {
   Extbyte errorbuff[132];
-  Bufbyte *interr;
+  Intbyte *interr;
 
   AGetErrorText (audio, errorCode, errorbuff, 131);
   EXTERNAL_TO_C_STRING (errorbuf, interr, Qnative);
--- a/src/indent.c	Tue Sep 18 05:06:57 2001 +0000
+++ b/src/indent.c	Thu Sep 20 06:31:11 2001 +0000
@@ -58,13 +58,13 @@
 static struct buffer *last_known_column_buffer;
 
 /* Value of point when current_column was called */
-static Bufpos last_known_column_point;
+static Charbpos last_known_column_point;
 
 /* Value of MODIFF when current_column was called */
 static int last_known_column_modified;
 
-static Bufpos
-last_visible_position (Bufpos pos, struct buffer *buf)
+static Charbpos
+last_visible_position (Charbpos pos, struct buffer *buf)
 {
   Lisp_Object buffer;
   Lisp_Object value;
@@ -124,13 +124,13 @@
 }
 
 int
-column_at_point (struct buffer *buf, Bufpos init_pos, int cur_col)
+column_at_point (struct buffer *buf, Charbpos init_pos, int cur_col)
 {
   int col;
   int tab_seen;
   int tab_width = XINT (buf->tab_width);
   int post_tab;
-  Bufpos pos = init_pos;
+  Charbpos pos = init_pos;
   Emchar c;
 
   if (tab_width <= 0 || tab_width > 1000) tab_width = 8;
@@ -161,7 +161,7 @@
 	  /* #### FSFmacs looks at ctl_arrow, display tables.
 	     We need to do similar. */
 #if 0
-	  displayed_glyphs = glyphs_from_bufpos (sel_frame, buf,
+	  displayed_glyphs = glyphs_from_charbpos (sel_frame, buf,
 						 XWINDOW (selected_window),
 						 pos, dp, 0, col, 0, 0, 0);
 	  col += (displayed_glyphs->columns
@@ -195,12 +195,12 @@
 }
 
 int
-string_column_at_point (Lisp_String* s, Bufpos init_pos, int tab_width)
+string_column_at_point (Lisp_String* s, Charbpos init_pos, int tab_width)
 {
   int col;
   int tab_seen;
   int post_tab;
-  Bufpos pos = init_pos;
+  Charbpos pos = init_pos;
   Emchar c;
 
   if (tab_width <= 0 || tab_width > 1000) tab_width = 8;
@@ -283,7 +283,7 @@
   int fromcol;
   struct buffer *buf = decode_buffer (buffer, 0);
   int tab_width = XINT (buf->tab_width);
-  Bufpos opoint = 0;
+  Charbpos opoint = 0;
 
   CHECK_INT (column);
   if (NILP (minimum))
@@ -305,7 +305,7 @@
   if (!NILP (Fextent_at (make_int (BUF_PT (buf)), buffer, Qinvisible,
 			 Qnil, Qnil)))
     {
-      Bufpos last_visible = last_visible_position (BUF_PT (buf), buf);
+      Charbpos last_visible = last_visible_position (BUF_PT (buf), buf);
 
       opoint = BUF_PT (buf);
       if (last_visible >= BUF_BEGV (buf))
@@ -340,9 +340,9 @@
 }
 
 int
-bi_spaces_at_point (struct buffer *b, Bytind bi_pos)
+bi_spaces_at_point (struct buffer *b, Bytebpos bi_pos)
 {
-  Bytind bi_end = BI_BUF_ZV (b);
+  Bytebpos bi_end = BI_BUF_ZV (b);
   int col = 0;
   Emchar c;
   int tab_width = XINT (b->tab_width);
@@ -355,7 +355,7 @@
 	  (c == '\t'
 	   ? (col += tab_width - col % tab_width)
 	   : (c == ' ' ? ++col : 0))))
-    INC_BYTIND (b, bi_pos);
+    INC_BYTEBPOS (b, bi_pos);
 
   return col;
 }
@@ -369,14 +369,14 @@
        (buffer))
 {
   struct buffer *buf = decode_buffer (buffer, 0);
-  Bufpos pos = find_next_newline (buf, BUF_PT (buf), -1);
+  Charbpos pos = find_next_newline (buf, BUF_PT (buf), -1);
 
   XSETBUFFER (buffer, buf);
 
   if (!NILP (Fextent_at (make_int (pos), buffer, Qinvisible, Qnil, Qnil)))
     return Qzero;
 
-  return make_int (bi_spaces_at_point (buf, bufpos_to_bytind (buf, pos)));
+  return make_int (bi_spaces_at_point (buf, charbpos_to_bytebpos (buf, pos)));
 }
 
 
@@ -401,11 +401,11 @@
        (column, force, buffer))
 {
   /* This function can GC */
-  Bufpos pos;
+  Charbpos pos;
   struct buffer *buf = decode_buffer (buffer, 0);
   int col = current_column (buf);
   int goal;
-  Bufpos end;
+  Charbpos end;
   int tab_width = XINT (buf->tab_width);
 
   int prev_col = 0;
@@ -447,7 +447,7 @@
 	  /* #### FSFmacs looks at ctl_arrow, display tables.
 	     We need to do similar. */
 #if 0
-	  displayed_glyphs = glyphs_from_bufpos (selected_frame (),
+	  displayed_glyphs = glyphs_from_charbpos (selected_frame (),
 						 buf,
 						 XWINDOW (Fselected_window (Qnil)),
 						 pos, dp, 0, col, 0, 0, 0);
@@ -538,7 +538,7 @@
 */
 	 (from, frompos, to, topos, width, offsets, window))
 {
-  Lisp_Object bufpos, hpos, vpos, prevhpos, contin;
+  Lisp_Object charbpos, hpos, vpos, prevhpos, contin;
   struct position *pos;
   int hscroll, tab_offset;
   struct window *w = decode_window (window);
@@ -569,12 +569,12 @@
 			XINT (XCAR (topos)),
 			XINT (width), hscroll, tab_offset, w);
 
-  XSETINT (bufpos, pos->bufpos);
+  XSETINT (charbpos, pos->charbpos);
   XSETINT (hpos, pos->hpos);
   XSETINT (vpos, pos->vpos);
   XSETINT (prevhpos, pos->prevhpos);
 
-  return list5 (bufpos, hpos, vpos, prevhpos,
+  return list5 (charbpos, hpos, vpos, prevhpos,
 		pos->contin ? Qt : Qnil);
 }
 
@@ -610,8 +610,8 @@
  pointer to an int and the vertical pixel height of the motion which
  took place is returned in it.
  ****************************************************************************/
-static Bufpos
-vmotion_1 (struct window *w, Bufpos orig, int vtarget,
+static Charbpos
+vmotion_1 (struct window *w, Charbpos orig, int vtarget,
            int *ret_vpos, int *ret_vpix)
 {
   struct buffer *b = XBUFFER (w->buffer);
@@ -631,7 +631,7 @@
   if (vtarget > 0)
     {
       int cur_line = Dynarr_length (w->line_start_cache) - 1 - elt;
-      Bufpos ret_pt;
+      Charbpos ret_pt;
 
       if (cur_line > vtarget)
 	cur_line = vtarget;
@@ -694,8 +694,8 @@
  taken to be a pointer to an int and the number of lines actually moved is
  returned in it.
  ****************************************************************************/
-Bufpos
-vmotion (struct window *w, Bufpos orig, int vtarget, int *ret_vpos)
+Charbpos
+vmotion (struct window *w, Charbpos orig, int vtarget, int *ret_vpos)
 {
   return vmotion_1 (w, orig, vtarget, ret_vpos, NULL);
 }
@@ -706,8 +706,8 @@
 Lisp_Object vertical_motion_1 (Lisp_Object lines, Lisp_Object window,
                                int pixels)
 {
-  Bufpos bufpos;
-  Bufpos orig;
+  Charbpos charbpos;
+  Charbpos orig;
   int selected;
   int *vpos, *vpix;
   int value=0;
@@ -729,14 +729,14 @@
   vpos = pixels ? NULL   : &value;
   vpix = pixels ? &value : NULL;
 
-  bufpos = vmotion_1 (w, orig, XINT (lines), vpos, vpix);
+  charbpos = vmotion_1 (w, orig, XINT (lines), vpos, vpix);
 
   /* Note that the buffer's point is set, not the window's point. */
   if (selected)
-    BUF_SET_PT (XBUFFER (w->buffer), bufpos);
+    BUF_SET_PT (XBUFFER (w->buffer), charbpos);
   else
     set_marker_restricted (w->pointm[CURRENT_DISP],
-			   make_int(bufpos),
+			   make_int(charbpos),
 			   w->buffer);
 
   return make_int (value);
@@ -771,12 +771,12 @@
  * HOW specifies the stopping condition.  Positive means move at least
  * PIXELS.  Negative means at most.  Zero means as close as possible.
  */
-Bufpos
-vmotion_pixels (Lisp_Object window, Bufpos start, int pixels, int how,
+Charbpos
+vmotion_pixels (Lisp_Object window, Charbpos start, int pixels, int how,
                 int *motion)
 {
   struct window *w;
-  Bufpos eobuf, bobuf;
+  Charbpos eobuf, bobuf;
   int defheight;
   int needed;
   int line, next;
@@ -883,8 +883,8 @@
 */
        (pixels, window, how))
 {
-  Bufpos bufpos;
-  Bufpos orig;
+  Charbpos charbpos;
+  Charbpos orig;
   int selected;
   int motion;
   int howto;
@@ -905,13 +905,13 @@
 
   howto = INTP (how) ? XINT (how) : 0;
 
-  bufpos = vmotion_pixels (window, orig, XINT (pixels), howto, &motion);
+  charbpos = vmotion_pixels (window, orig, XINT (pixels), howto, &motion);
 
   if (selected)
-    BUF_SET_PT (XBUFFER (w->buffer), bufpos);
+    BUF_SET_PT (XBUFFER (w->buffer), charbpos);
   else
     set_marker_restricted (w->pointm[CURRENT_DISP],
-			   make_int(bufpos),
+			   make_int(charbpos),
 			   w->buffer);
 
   return make_int (motion);
--- a/src/insdel.c	Tue Sep 18 05:06:57 2001 +0000
+++ b/src/insdel.c	Thu Sep 20 06:31:11 2001 +0000
@@ -31,7 +31,7 @@
    of these are one-based: the beginning of the buffer is position or
    index 1, and 0 is not a valid position.
 
-   As a "buffer position" (typedef Bufpos):
+   As a "buffer position" (typedef Charbpos):
 
       This is an index specifying an offset in characters from the
       beginning of the buffer.  Note that buffer positions are
@@ -40,7 +40,7 @@
       characters between those positions.  Buffer positions are the
       only kind of position externally visible to the user.
 
-   As a "byte index" (typedef Bytind):
+   As a "byte index" (typedef Bytebpos):
 
       This is an index over the bytes used to represent the characters
       in the buffer.  If there is no Mule support, this is identical
@@ -50,7 +50,7 @@
       byte index may be greater than the corresponding buffer
       position.
 
-   As a "memory index" (typedef Memind):
+   As a "memory index" (typedef Membpos):
 
       This is the byte index adjusted for the gap.  For positions
       before the gap, this is identical to the byte index.  For
@@ -91,19 +91,19 @@
 	This means that Emchar values are upwardly compatible with
 	the standard 8-bit representation of ASCII/ISO-8859-1.
 
-      Bufbyte:
+      Intbyte:
       --------
-        The data in a buffer or string is logically made up of Bufbyte
-	objects, where a Bufbyte takes up the same amount of space as a
+        The data in a buffer or string is logically made up of Intbyte
+	objects, where a Intbyte takes up the same amount of space as a
 	char. (It is declared differently, though, to catch invalid
-	usages.) Strings stored using Bufbytes are said to be in
+	usages.) Strings stored using Intbytes are said to be in
 	"internal format".  The important characteristics of internal
 	format are
 
-	  -- ASCII characters are represented as a single Bufbyte,
+	  -- ASCII characters are represented as a single Intbyte,
 	     in the range 0 - 0x7f.
-	  -- All other characters are represented as a Bufbyte in
-	     the range 0x80 - 0x9f followed by one or more Bufbytes
+	  -- All other characters are represented as a Intbyte in
+	     the range 0x80 - 0x9f followed by one or more Intbytes
 	     in the range 0xa0 to 0xff.
 
 	This leads to a number of desirable properties:
@@ -152,14 +152,14 @@
         This typedef represents a count of characters, such as
 	a character offset into a string or the number of
 	characters between two positions in a buffer.  The
-	difference between two Bufpos's is a Charcount, and
+	difference between two Charbpos's is a Charcount, and
 	character positions in a string are represented using
 	a Charcount.
 
       Bytecount:
       ----------
         Similar to a Charcount but represents a count of bytes.
-	The difference between two Bytind's is a Bytecount.
+	The difference between two Bytebpos's is a Bytecount.
 
 
    Usage of the various representations:
@@ -211,14 +211,14 @@
 #include "line-number.h"
 
 /* We write things this way because it's very important the
-   MAX_BYTIND_GAP_SIZE_3 is a multiple of 3. (As it happens,
+   MAX_BYTEBPOS_GAP_SIZE_3 is a multiple of 3. (As it happens,
    65535 is a multiple of 3, but this may not always be the
    case.) */
 
-#define MAX_BUFPOS_GAP_SIZE_3 (65535/3)
-#define MAX_BYTIND_GAP_SIZE_3 (3 * MAX_BUFPOS_GAP_SIZE_3)
-
-short three_to_one_table[1 + MAX_BYTIND_GAP_SIZE_3];
+#define MAX_CHARBPOS_GAP_SIZE_3 (65535/3)
+#define MAX_BYTEBPOS_GAP_SIZE_3 (3 * MAX_CHARBPOS_GAP_SIZE_3)
+
+short three_to_one_table[1 + MAX_BYTEBPOS_GAP_SIZE_3];
 
 /* Various macros modelled along the lines of those in buffer.h.
    Purposefully omitted from buffer.h because files other than this
@@ -303,10 +303,10 @@
    the equivalent length in characters. */
 
 Charcount
-bytecount_to_charcount (const Bufbyte *ptr, Bytecount len)
+bytecount_to_charcount (const Intbyte *ptr, Bytecount len)
 {
   Charcount count = 0;
-  const Bufbyte *end = ptr + len;
+  const Intbyte *end = ptr + len;
 
 #if SIZEOF_LONG == 8
 # define STRIDE_TYPE long
@@ -339,29 +339,29 @@
 		(const unsigned STRIDE_TYPE *) ptr;
 	      /* This loop screams, because we can typically
 		 detect ASCII characters 8 at a time. */
-	      while ((const Bufbyte *) ascii_end + STRIDE <= end
+	      while ((const Intbyte *) ascii_end + STRIDE <= end
 		     && !(*ascii_end & HIGH_BIT_MASK))
 		ascii_end++;
-	      if ((Bufbyte *) ascii_end == ptr)
+	      if ((Intbyte *) ascii_end == ptr)
 		ptr++, count++;
 	      else
 		{
-		  count += (Bufbyte *) ascii_end - ptr;
-		  ptr = (Bufbyte *) ascii_end;
+		  count += (Intbyte *) ascii_end - ptr;
+		  ptr = (Intbyte *) ascii_end;
 		}
 	    }
 	}
       else
 	{
 	  /* optimize for successive characters from the same charset */
-	  Bufbyte leading_byte = *ptr;
-	  Memory_Count bytes = REP_BYTES_BY_FIRST_BYTE (leading_byte);
+	  Intbyte leading_byte = *ptr;
+	  Bytecount bytes = REP_BYTES_BY_FIRST_BYTE (leading_byte);
 	  while ((ptr < end) && (*ptr == leading_byte))
 	    ptr += bytes, count++;
 	}
     }
 
-#ifdef ERROR_CHECK_BUFPOS
+#ifdef ERROR_CHECK_CHARBPOS
   /* Bomb out if the specified substring ends in the middle
      of a character.  Note that we might have already gotten
      a core dump above from an invalid reference, but at least
@@ -376,9 +376,9 @@
    the equivalent length in bytes. */
 
 Bytecount
-charcount_to_bytecount (const Bufbyte *ptr, Charcount len)
+charcount_to_bytecount (const Intbyte *ptr, Charcount len)
 {
-  const Bufbyte *newptr = ptr;
+  const Intbyte *newptr = ptr;
 
   while (len > 0)
     {
@@ -389,14 +389,14 @@
 }
 
 /* The next two functions are the actual meat behind the
-   bufpos-to-bytind and bytind-to-bufpos conversions.  Currently
+   charbpos-to-bytebpos and bytebpos-to-charbpos conversions.  Currently
    the method they use is fairly unsophisticated; see buffer.h.
 
-   Note that bufpos_to_bytind_func() is probably the most-called
+   Note that charbpos_to_bytebpos_func() is probably the most-called
    function in all of XEmacs.  Therefore, it must be FAST FAST FAST.
    This is the reason why so much of the code is duplicated.
 
-   Similar considerations apply to bytind_to_bufpos_func(), although
+   Similar considerations apply to bytebpos_to_charbpos_func(), although
    less so because the function is not called so often.
 
    #### At some point this should use a more sophisticated method;
@@ -404,16 +404,16 @@
 
 static int not_very_random_number;
 
-Bytind
-bufpos_to_bytind_func (struct buffer *buf, Bufpos x)
+Bytebpos
+charbpos_to_bytebpos_func (struct buffer *buf, Charbpos x)
 {
-  Bufpos bufmin;
-  Bufpos bufmax;
-  Bytind bytmin;
-  Bytind bytmax;
+  Charbpos bufmin;
+  Charbpos bufmax;
+  Bytebpos bytmin;
+  Bytebpos bytmax;
   int size;
   int forward_p;
-  Bytind retval;
+  Bytebpos retval;
   int diff_so_far;
   int add_to_cache = 0;
 
@@ -445,9 +445,9 @@
 
   if (x > bufmax)
     {
-      Bufpos diffmax = x - bufmax;
-      Bufpos diffpt = x - BUF_PT (buf);
-      Bufpos diffzv = BUF_ZV (buf) - x;
+      Charbpos diffmax = x - bufmax;
+      Charbpos diffpt = x - BUF_PT (buf);
+      Charbpos diffzv = BUF_ZV (buf) - x;
       /* #### This value could stand some more exploration. */
       Charcount heuristic_hack = (bufmax - bufmin) >> 2;
 
@@ -487,15 +487,15 @@
 	  size = 1;
 	}
     }
-#ifdef ERROR_CHECK_BUFPOS
+#ifdef ERROR_CHECK_CHARBPOS
   else if (x >= bufmin)
     abort ();
 #endif
   else
     {
-      Bufpos diffmin = bufmin - x;
-      Bufpos diffpt = BUF_PT (buf) - x;
-      Bufpos diffbegv = x - BUF_BEGV (buf);
+      Charbpos diffmin = bufmin - x;
+      Charbpos diffpt = BUF_PT (buf) - x;
+      Charbpos diffbegv = x - BUF_BEGV (buf);
       /* #### This value could stand some more exploration. */
       Charcount heuristic_hack = (bufmax - bufmin) >> 2;
 
@@ -545,7 +545,7 @@
 	 it doesn't seem like it would really matter. */
       for (i = 0; i < 16; i++)
 	{
-	  int diff = buf->text->mule_bufpos_cache[i] - x;
+	  int diff = buf->text->mule_charbpos_cache[i] - x;
 
 	  if (diff < 0)
 	    diff = -diff;
@@ -558,8 +558,8 @@
 
       if (minval < diff_so_far)
 	{
-	  bufmax = bufmin = buf->text->mule_bufpos_cache[found];
-	  bytmax = bytmin = buf->text->mule_bytind_cache[found];
+	  bufmax = bufmin = buf->text->mule_charbpos_cache[found];
+	  bytmax = bytmin = buf->text->mule_bytebpos_cache[found];
 	  size = 1;
 	}
     }
@@ -568,7 +568,7 @@
      the same as one of the range edges. */
   if (x >= bufmax)
     {
-      Bytind newmax;
+      Bytebpos newmax;
       Bytecount newsize;
 
       forward_p = 1;
@@ -576,7 +576,7 @@
 	{
 	  newmax = bytmax;
 
-	  INC_BYTIND (buf, newmax);
+	  INC_BYTEBPOS (buf, newmax);
 	  newsize = newmax - bytmax;
 	  if (newsize != size)
 	    {
@@ -594,7 +594,7 @@
     }
   else /* x < bufmin */
     {
-      Bytind newmin;
+      Bytebpos newmin;
       Bytecount newsize;
 
       forward_p = 0;
@@ -602,7 +602,7 @@
 	{
 	  newmin = bytmin;
 
-	  DEC_BYTIND (buf, newmin);
+	  DEC_BYTEBPOS (buf, newmin);
 	  newsize = bytmin - newmin;
 	  if (newsize != size)
 	    {
@@ -630,17 +630,17 @@
       buf->text->mule_three_p = 1;
       buf->text->mule_shifter = 1;
 
-      if (gap > MAX_BYTIND_GAP_SIZE_3)
+      if (gap > MAX_BYTEBPOS_GAP_SIZE_3)
 	{
 	  if (forward_p)
 	    {
-	      bytmin = bytmax - MAX_BYTIND_GAP_SIZE_3;
-	      bufmin = bufmax - MAX_BUFPOS_GAP_SIZE_3;
+	      bytmin = bytmax - MAX_BYTEBPOS_GAP_SIZE_3;
+	      bufmin = bufmax - MAX_CHARBPOS_GAP_SIZE_3;
 	    }
 	  else
 	    {
-	      bytmax = bytmin + MAX_BYTIND_GAP_SIZE_3;
-	      bufmax = bufmin + MAX_BUFPOS_GAP_SIZE_3;
+	      bytmax = bytmin + MAX_BYTEBPOS_GAP_SIZE_3;
+	      bufmax = bufmin + MAX_CHARBPOS_GAP_SIZE_3;
 	    }
 	}
     }
@@ -671,8 +671,8 @@
 	 it's worth it to go to the trouble of maintaining that. */
       not_very_random_number += 621;
       replace_loc = not_very_random_number & 15;
-      buf->text->mule_bufpos_cache[replace_loc] = x;
-      buf->text->mule_bytind_cache[replace_loc] = retval;
+      buf->text->mule_charbpos_cache[replace_loc] = x;
+      buf->text->mule_bytebpos_cache[replace_loc] = retval;
     }
 
   return retval;
@@ -681,16 +681,16 @@
 /* The logic in this function is almost identical to the logic in
    the previous function. */
 
-Bufpos
-bytind_to_bufpos_func (struct buffer *buf, Bytind x)
+Charbpos
+bytebpos_to_charbpos_func (struct buffer *buf, Bytebpos x)
 {
-  Bufpos bufmin;
-  Bufpos bufmax;
-  Bytind bytmin;
-  Bytind bytmax;
+  Charbpos bufmin;
+  Charbpos bufmax;
+  Bytebpos bytmin;
+  Bytebpos bytmax;
   int size;
   int forward_p;
-  Bufpos retval;
+  Charbpos retval;
   int diff_so_far;
   int add_to_cache = 0;
 
@@ -722,9 +722,9 @@
 
   if (x > bytmax)
     {
-      Bytind diffmax = x - bytmax;
-      Bytind diffpt = x - BI_BUF_PT (buf);
-      Bytind diffzv = BI_BUF_ZV (buf) - x;
+      Bytebpos diffmax = x - bytmax;
+      Bytebpos diffpt = x - BI_BUF_PT (buf);
+      Bytebpos diffzv = BI_BUF_ZV (buf) - x;
       /* #### This value could stand some more exploration. */
       Bytecount heuristic_hack = (bytmax - bytmin) >> 2;
 
@@ -764,15 +764,15 @@
 	  size = 1;
 	}
     }
-#ifdef ERROR_CHECK_BUFPOS
+#ifdef ERROR_CHECK_CHARBPOS
   else if (x >= bytmin)
     abort ();
 #endif
   else
     {
-      Bytind diffmin = bytmin - x;
-      Bytind diffpt = BI_BUF_PT (buf) - x;
-      Bytind diffbegv = x - BI_BUF_BEGV (buf);
+      Bytebpos diffmin = bytmin - x;
+      Bytebpos diffpt = BI_BUF_PT (buf) - x;
+      Bytebpos diffbegv = x - BI_BUF_BEGV (buf);
       /* #### This value could stand some more exploration. */
       Bytecount heuristic_hack = (bytmax - bytmin) >> 2;
 
@@ -822,7 +822,7 @@
 	 it doesn't seem like it would really matter. */
       for (i = 0; i < 16; i++)
 	{
-	  int diff = buf->text->mule_bytind_cache[i] - x;
+	  int diff = buf->text->mule_bytebpos_cache[i] - x;
 
 	  if (diff < 0)
 	    diff = -diff;
@@ -835,8 +835,8 @@
 
       if (minval < diff_so_far)
 	{
-	  bufmax = bufmin = buf->text->mule_bufpos_cache[found];
-	  bytmax = bytmin = buf->text->mule_bytind_cache[found];
+	  bufmax = bufmin = buf->text->mule_charbpos_cache[found];
+	  bytmax = bytmin = buf->text->mule_bytebpos_cache[found];
 	  size = 1;
 	}
     }
@@ -845,7 +845,7 @@
      the same as one of the range edges. */
   if (x >= bytmax)
     {
-      Bytind newmax;
+      Bytebpos newmax;
       Bytecount newsize;
 
       forward_p = 1;
@@ -853,7 +853,7 @@
 	{
 	  newmax = bytmax;
 
-	  INC_BYTIND (buf, newmax);
+	  INC_BYTEBPOS (buf, newmax);
 	  newsize = newmax - bytmax;
 	  if (newsize != size)
 	    {
@@ -871,7 +871,7 @@
     }
   else /* x <= bytmin */
     {
-      Bytind newmin;
+      Bytebpos newmin;
       Bytecount newsize;
 
       forward_p = 0;
@@ -879,7 +879,7 @@
 	{
 	  newmin = bytmin;
 
-	  DEC_BYTIND (buf, newmin);
+	  DEC_BYTEBPOS (buf, newmin);
 	  newsize = bytmin - newmin;
 	  if (newsize != size)
 	    {
@@ -907,17 +907,17 @@
       buf->text->mule_three_p = 1;
       buf->text->mule_shifter = 1;
 
-      if (gap > MAX_BYTIND_GAP_SIZE_3)
+      if (gap > MAX_BYTEBPOS_GAP_SIZE_3)
 	{
 	  if (forward_p)
 	    {
-	      bytmin = bytmax - MAX_BYTIND_GAP_SIZE_3;
-	      bufmin = bufmax - MAX_BUFPOS_GAP_SIZE_3;
+	      bytmin = bytmax - MAX_BYTEBPOS_GAP_SIZE_3;
+	      bufmin = bufmax - MAX_CHARBPOS_GAP_SIZE_3;
 	    }
 	  else
 	    {
-	      bytmax = bytmin + MAX_BYTIND_GAP_SIZE_3;
-	      bufmax = bufmin + MAX_BUFPOS_GAP_SIZE_3;
+	      bytmax = bytmin + MAX_BYTEBPOS_GAP_SIZE_3;
+	      bufmax = bufmin + MAX_CHARBPOS_GAP_SIZE_3;
 	    }
 	}
     }
@@ -948,18 +948,18 @@
 	 it's worth it to go to the trouble of maintaining that. */
       not_very_random_number += 621;
       replace_loc = not_very_random_number & 15;
-      buf->text->mule_bufpos_cache[replace_loc] = retval;
-      buf->text->mule_bytind_cache[replace_loc] = x;
+      buf->text->mule_charbpos_cache[replace_loc] = retval;
+      buf->text->mule_bytebpos_cache[replace_loc] = x;
     }
 
   return retval;
 }
 
 /* Text of length BYTELENGTH and CHARLENGTH (in different units)
-   was inserted at bufpos START. */
+   was inserted at charbpos START. */
 
 static void
-buffer_mule_signal_inserted_region (struct buffer *buf, Bufpos start,
+buffer_mule_signal_inserted_region (struct buffer *buf, Charbpos start,
 				    Bytecount bytelength,
 				    Charcount charlength)
 {
@@ -970,10 +970,10 @@
   for (i = 0; i < 16; i++)
     {
 
-      if (buf->text->mule_bufpos_cache[i] > start)
+      if (buf->text->mule_charbpos_cache[i] > start)
 	{
-	  buf->text->mule_bufpos_cache[i] += charlength;
-	  buf->text->mule_bytind_cache[i] += bytelength;
+	  buf->text->mule_charbpos_cache[i] += charlength;
+	  buf->text->mule_bytebpos_cache[i] += bytelength;
 	}
     }
 
@@ -994,21 +994,21 @@
     }
   else
     {
-      Bufpos end = start + charlength;
+      Charbpos end = start + charlength;
       /* the insertion point divides the known region in two.
 	 Keep the longer half, at least, and expand into the
 	 inserted chunk as much as possible. */
 
       if (start - buf->text->mule_bufmin > buf->text->mule_bufmax - start)
 	{
-	  Bytind bytestart = (buf->text->mule_bytmin
+	  Bytebpos bytestart = (buf->text->mule_bytmin
 			      + size * (start - buf->text->mule_bufmin));
-	  Bytind bytenew;
+	  Bytebpos bytenew;
 
 	  while (start < end)
 	    {
 	      bytenew = bytestart;
-	      INC_BYTIND (buf, bytenew);
+	      INC_BYTEBPOS (buf, bytenew);
 	      if (bytenew - bytestart != size)
 		break;
 	      start++;
@@ -1027,10 +1027,10 @@
 	}
       else
 	{
-	  Bytind byteend = (buf->text->mule_bytmin
+	  Bytebpos byteend = (buf->text->mule_bytmin
 			    + size * (start - buf->text->mule_bufmin)
 			    + bytelength);
-	  Bytind bytenew;
+	  Bytebpos bytenew;
 
 	  buf->text->mule_bufmax += charlength;
 	  buf->text->mule_bytmax += bytelength;
@@ -1038,7 +1038,7 @@
 	  while (end > start)
 	    {
 	      bytenew = byteend;
-	      DEC_BYTIND (buf, bytenew);
+	      DEC_BYTEBPOS (buf, bytenew);
 	      if (byteend - bytenew != size)
 		break;
 	      end--;
@@ -1053,13 +1053,13 @@
     }
 }
 
-/* Text from START to END (equivalent in Bytinds: from BI_START to
+/* Text from START to END (equivalent in Bytebposs: from BI_START to
    BI_END) was deleted. */
 
 static void
-buffer_mule_signal_deleted_region (struct buffer *buf, Bufpos start,
-				   Bufpos end, Bytind bi_start,
-				   Bytind bi_end)
+buffer_mule_signal_deleted_region (struct buffer *buf, Charbpos start,
+				   Charbpos end, Bytebpos bi_start,
+				   Bytebpos bi_end)
 {
   int i;
 
@@ -1067,16 +1067,16 @@
   for (i = 0; i < 16; i++)
     {
       /* After the end; gets shoved backward */
-      if (buf->text->mule_bufpos_cache[i] > end)
+      if (buf->text->mule_charbpos_cache[i] > end)
 	{
-	  buf->text->mule_bufpos_cache[i] -= end - start;
-	  buf->text->mule_bytind_cache[i] -= bi_end - bi_start;
+	  buf->text->mule_charbpos_cache[i] -= end - start;
+	  buf->text->mule_bytebpos_cache[i] -= bi_end - bi_start;
 	}
       /* In the range; moves to start of range */
-      else if (buf->text->mule_bufpos_cache[i] > start)
+      else if (buf->text->mule_charbpos_cache[i] > start)
 	{
-	  buf->text->mule_bufpos_cache[i] = start;
-	  buf->text->mule_bytind_cache[i] = bi_start;
+	  buf->text->mule_charbpos_cache[i] = start;
+	  buf->text->mule_bytebpos_cache[i] = bi_start;
 	}
     }
 
@@ -1106,24 +1106,24 @@
 
 #endif /* MULE */
 
-#ifdef ERROR_CHECK_BUFPOS
-
-Bytind
-bufpos_to_bytind (struct buffer *buf, Bufpos x)
+#ifdef ERROR_CHECK_CHARBPOS
+
+Bytebpos
+charbpos_to_bytebpos (struct buffer *buf, Charbpos x)
 {
-  Bytind retval = real_bufpos_to_bytind (buf, x);
-  ASSERT_VALID_BYTIND_UNSAFE (buf, retval);
+  Bytebpos retval = real_charbpos_to_bytebpos (buf, x);
+  ASSERT_VALID_BYTEBPOS_UNSAFE (buf, retval);
   return retval;
 }
 
-Bufpos
-bytind_to_bufpos (struct buffer *buf, Bytind x)
+Charbpos
+bytebpos_to_charbpos (struct buffer *buf, Bytebpos x)
 {
-  ASSERT_VALID_BYTIND_UNSAFE (buf, x);
-  return real_bytind_to_bufpos (buf, x);
+  ASSERT_VALID_BYTEBPOS_UNSAFE (buf, x);
+  return real_bytebpos_to_charbpos (buf, x);
 }
 
-#endif /* ERROR_CHECK_BUFPOS */
+#endif /* ERROR_CHECK_CHARBPOS */
 
 
 /************************************************************************/
@@ -1132,7 +1132,7 @@
 
 /* Functions below are tagged with either _byte or _char indicating
    whether they return byte or character positions.  For a buffer,
-   a character position is a "Bufpos" and a byte position is a "Bytind".
+   a character position is a "Charbpos" and a byte position is a "Bytebpos".
    For strings, these are sometimes typed using "Charcount" and
    "Bytecount". */
 
@@ -1191,12 +1191,12 @@
 
 */
 
-Bufpos
+Charbpos
 get_buffer_pos_char (struct buffer *b, Lisp_Object pos, unsigned int flags)
 {
   /* Does not GC */
-  Bufpos ind;
-  Bufpos min_allowed, max_allowed;
+  Charbpos ind;
+  Charbpos min_allowed, max_allowed;
 
   CHECK_INT_COERCE_MARKER (pos);
   ind = XINT (pos);
@@ -1220,13 +1220,13 @@
   return ind;
 }
 
-Bytind
+Bytebpos
 get_buffer_pos_byte (struct buffer *b, Lisp_Object pos, unsigned int flags)
 {
-  Bufpos bpos = get_buffer_pos_char (b, pos, flags);
+  Charbpos bpos = get_buffer_pos_char (b, pos, flags);
   if (bpos < 0) /* could happen with GB_NO_ERROR_IF_BAD */
     return -1;
-  return bufpos_to_bytind (b, bpos);
+  return charbpos_to_bytebpos (b, bpos);
 }
 
 /* Return a pair of buffer positions representing a range of text,
@@ -1242,10 +1242,10 @@
 
 void
 get_buffer_range_char (struct buffer *b, Lisp_Object from, Lisp_Object to,
-		       Bufpos *from_out, Bufpos *to_out, unsigned int flags)
+		       Charbpos *from_out, Charbpos *to_out, unsigned int flags)
 {
   /* Does not GC */
-  Bufpos min_allowed, max_allowed;
+  Charbpos min_allowed, max_allowed;
 
   min_allowed = (flags & GB_ALLOW_PAST_ACCESSIBLE) ?
     BUF_BEG (b) : BUF_BEGV (b);
@@ -1275,7 +1275,7 @@
 	invalid_argument_2 ("start greater than end", from, to);
       else
 	{
-	  Bufpos temp = *from_out;
+	  Charbpos temp = *from_out;
 	  *from_out = *to_out;
 	  *to_out = temp;
 	}
@@ -1284,17 +1284,17 @@
 
 void
 get_buffer_range_byte (struct buffer *b, Lisp_Object from, Lisp_Object to,
-		       Bytind *from_out, Bytind *to_out, unsigned int flags)
+		       Bytebpos *from_out, Bytebpos *to_out, unsigned int flags)
 {
-  Bufpos s, e;
+  Charbpos s, e;
 
   get_buffer_range_char (b, from, to, &s, &e, flags);
   if (s >= 0)
-    *from_out = bufpos_to_bytind (b, s);
+    *from_out = charbpos_to_bytebpos (b, s);
   else /* could happen with GB_NO_ERROR_IF_BAD */
     *from_out = -1;
   if (e >= 0)
-    *to_out = bufpos_to_bytind (b, e);
+    *to_out = charbpos_to_bytebpos (b, e);
   else
     *to_out = -1;
 }
@@ -1374,7 +1374,7 @@
 	invalid_argument_2 ("start greater than end", from, to);
       else
 	{
-	  Bufpos temp = *from_out;
+	  Charbpos temp = *from_out;
 	  *from_out = *to_out;
 	  *to_out = temp;
 	}
@@ -1400,7 +1400,7 @@
 
 }
 
-Bufpos
+Charbpos
 get_buffer_or_string_pos_char (Lisp_Object object, Lisp_Object pos,
 			       unsigned int flags)
 {
@@ -1409,7 +1409,7 @@
     get_buffer_pos_char (XBUFFER (object), pos, flags);
 }
 
-Bytind
+Bytebpos
 get_buffer_or_string_pos_byte (Lisp_Object object, Lisp_Object pos,
 			       unsigned int flags)
 {
@@ -1420,8 +1420,8 @@
 
 void
 get_buffer_or_string_range_char (Lisp_Object object, Lisp_Object from,
-				 Lisp_Object to, Bufpos *from_out,
-				 Bufpos *to_out, unsigned int flags)
+				 Lisp_Object to, Charbpos *from_out,
+				 Charbpos *to_out, unsigned int flags)
 {
   if (STRINGP (object))
     get_string_range_char (object, from, to, from_out, to_out, flags);
@@ -1431,8 +1431,8 @@
 
 void
 get_buffer_or_string_range_byte (Lisp_Object object, Lisp_Object from,
-				 Lisp_Object to, Bytind *from_out,
-				 Bytind *to_out, unsigned int flags)
+				 Lisp_Object to, Bytebpos *from_out,
+				 Bytebpos *to_out, unsigned int flags)
 {
   if (STRINGP (object))
     get_string_range_byte (object, from, to, from_out, to_out, flags);
@@ -1440,52 +1440,52 @@
     get_buffer_range_byte (XBUFFER (object), from, to, from_out, to_out, flags);
 }
 
-Bufpos
+Charbpos
 buffer_or_string_accessible_begin_char (Lisp_Object object)
 {
   return STRINGP (object) ? 0 : BUF_BEGV (XBUFFER (object));
 }
 
-Bufpos
+Charbpos
 buffer_or_string_accessible_end_char (Lisp_Object object)
 {
   return STRINGP (object) ?
     XSTRING_CHAR_LENGTH (object) : BUF_ZV (XBUFFER (object));
 }
 
-Bytind
+Bytebpos
 buffer_or_string_accessible_begin_byte (Lisp_Object object)
 {
   return STRINGP (object) ? 0 : BI_BUF_BEGV (XBUFFER (object));
 }
 
-Bytind
+Bytebpos
 buffer_or_string_accessible_end_byte (Lisp_Object object)
 {
   return STRINGP (object) ?
     XSTRING_LENGTH (object) : BI_BUF_ZV (XBUFFER (object));
 }
 
-Bufpos
+Charbpos
 buffer_or_string_absolute_begin_char (Lisp_Object object)
 {
   return STRINGP (object) ? 0 : BUF_BEG (XBUFFER (object));
 }
 
-Bufpos
+Charbpos
 buffer_or_string_absolute_end_char (Lisp_Object object)
 {
   return STRINGP (object) ?
     XSTRING_CHAR_LENGTH (object) : BUF_Z (XBUFFER (object));
 }
 
-Bytind
+Bytebpos
 buffer_or_string_absolute_begin_byte (Lisp_Object object)
 {
   return STRINGP (object) ? 0 : BI_BUF_BEG (XBUFFER (object));
 }
 
-Bytind
+Bytebpos
 buffer_or_string_absolute_end_byte (Lisp_Object object)
 {
   return STRINGP (object) ?
@@ -1514,26 +1514,26 @@
 
 /* This gets called more than enough to make the function call
    overhead a significant factor so we've turned it into a macro. */
-#define JUST_SET_POINT(buf, bufpos, ind)	\
+#define JUST_SET_POINT(buf, charbpos, ind)	\
 do						\
 {						\
-  buf->bufpt = (bufpos);			\
+  buf->bufpt = (charbpos);			\
   buf->pt = (ind);				\
 } while (0)
 
 /* Set a buffer's point. */
 
 void
-set_buffer_point (struct buffer *buf, Bufpos bufpos, Bytind bytpos)
+set_buffer_point (struct buffer *buf, Charbpos charbpos, Bytebpos bytpos)
 {
   assert (bytpos >= BI_BUF_BEGV (buf) && bytpos <= BI_BUF_ZV (buf));
   if (bytpos == BI_BUF_PT (buf))
     return;
-  JUST_SET_POINT (buf, bufpos, bytpos);
+  JUST_SET_POINT (buf, charbpos, bytpos);
   MARK_POINT_CHANGED;
   assert (MARKERP (buf->point_marker));
-  XMARKER (buf->point_marker)->memind =
-    bytind_to_memind (buf, bytpos);
+  XMARKER (buf->point_marker)->membpos =
+    bytebpos_to_membpos (buf, bytpos);
 
   /* FSF makes sure that PT is not being set within invisible text.
      However, this is the wrong place for that check.  The check
@@ -1558,9 +1558,9 @@
 /* Do the correct marker-like adjustment on MPOS (see below).  FROM, TO,
    and AMOUNT are as in adjust_markers().  If MPOS doesn't need to be
    adjusted, nothing will happen. */
-Memind
-do_marker_adjustment (Memind mpos, Memind from,
-		      Memind to, Bytecount amount)
+Membpos
+do_marker_adjustment (Membpos mpos, Membpos from,
+		      Membpos to, Bytecount amount)
 {
   if (amount > 0)
     {
@@ -1602,27 +1602,27 @@
 */
 
 static void
-adjust_markers (struct buffer *buf, Memind from, Memind to,
+adjust_markers (struct buffer *buf, Membpos from, Membpos to,
 		Bytecount amount)
 {
   Lisp_Marker *m;
 
   for (m = BUF_MARKERS (buf); m; m = marker_next (m))
-    m->memind = do_marker_adjustment (m->memind, from, to, amount);
+    m->membpos = do_marker_adjustment (m->membpos, from, to, amount);
 }
 
 /* Adjust markers whose insertion-type is t
    for an insertion of AMOUNT characters at POS.  */
 
 static void
-adjust_markers_for_insert (struct buffer *buf, Memind ind, Bytecount amount)
+adjust_markers_for_insert (struct buffer *buf, Membpos ind, Bytecount amount)
 {
   Lisp_Marker *m;
 
   for (m = BUF_MARKERS (buf); m; m = marker_next (m))
     {
-      if (m->insertion_type && m->memind == ind)
-	m->memind += amount;
+      if (m->insertion_type && m->membpos == ind)
+	m->membpos += amount;
     }
 }
 
@@ -1640,11 +1640,11 @@
 /* Move the gap to POS, which is less than the current GPT. */
 
 static void
-gap_left (struct buffer *buf, Bytind pos)
+gap_left (struct buffer *buf, Bytebpos pos)
 {
-  Bufbyte *to, *from;
+  Intbyte *to, *from;
   Bytecount i;
-  Bytind new_s1;
+  Bytebpos new_s1;
   struct buffer *mbuf;
   Lisp_Object bufcons;
 
@@ -1711,11 +1711,11 @@
 }
 
 static void
-gap_right (struct buffer *buf, Bytind pos)
+gap_right (struct buffer *buf, Bytebpos pos)
 {
-  Bufbyte *to, *from;
+  Intbyte *to, *from;
   Bytecount i;
-  Bytind new_s1;
+  Bytebpos new_s1;
   struct buffer *mbuf;
   Lisp_Object bufcons;
 
@@ -1794,7 +1794,7 @@
    Note that this can quit!  */
 
 static void
-move_gap (struct buffer *buf, Bytind pos)
+move_gap (struct buffer *buf, Bytebpos pos)
 {
   if (! BUF_BEG_ADDR (buf))
     abort ();
@@ -1810,7 +1810,7 @@
 merge_gap_with_end_gap (struct buffer *buf)
 {
   Lisp_Object tem;
-  Bytind real_gap_loc;
+  Bytebpos real_gap_loc;
   Bytecount old_gap_size;
   Bytecount increment;
 
@@ -1852,9 +1852,9 @@
 static void
 make_gap (struct buffer *buf, Bytecount increment)
 {
-  Bufbyte *result;
+  Intbyte *result;
   Lisp_Object tem;
-  Bytind real_gap_loc;
+  Bytebpos real_gap_loc;
   Bytecount old_gap_size;
 
   /* If we have to get more space, get enough to last a while.  We use
@@ -1920,8 +1920,8 @@
 /* Those magic changes ... */
 
 static void
-buffer_signal_changed_region (struct buffer *buf, Bufpos start,
-			      Bufpos end)
+buffer_signal_changed_region (struct buffer *buf, Charbpos start,
+			      Charbpos end)
 {
   /* The changed region is recorded as the number of unchanged
      characters from the beginning and from the end of the
@@ -1937,8 +1937,8 @@
 }
 
 void
-buffer_extent_signal_changed_region (struct buffer *buf, Bufpos start,
-				     Bufpos end)
+buffer_extent_signal_changed_region (struct buffer *buf, Charbpos start,
+				     Charbpos end)
 {
   if (buf->changes->begin_extent_unchanged < 0 ||
       buf->changes->begin_extent_unchanged > start - BUF_BEG (buf))
@@ -1959,8 +1959,8 @@
 }
 
 static void
-signal_after_change (struct buffer *buf, Bufpos start, Bufpos orig_end,
-		     Bufpos new_end);
+signal_after_change (struct buffer *buf, Charbpos start, Charbpos orig_end,
+		     Charbpos new_end);
 
 
 /* Call the after-change-functions according to the changes made so far
@@ -1984,7 +1984,7 @@
   if (buf->text->changes->mc_begin != 0 &&
       buf->text->changes->mc_begin_signaled)
     {
-      Bufpos real_mc_begin = buf->text->changes->mc_begin;
+      Charbpos real_mc_begin = buf->text->changes->mc_begin;
       buf->text->changes->mc_begin = 0;
 
       signal_after_change (buf, real_mc_begin, buf->text->changes->mc_orig_end,
@@ -2037,7 +2037,7 @@
    whether we want to introduce a similar Lisp form.  */
 
 int
-begin_multiple_change (struct buffer *buf, Bufpos start, Bufpos end)
+begin_multiple_change (struct buffer *buf, Charbpos start, Charbpos end)
 {
   /* This function can GC */
   int count = -1;
@@ -2124,7 +2124,7 @@
    START and END are the bounds of the text to be changed. */
 
 static void
-signal_before_change (struct buffer *buf, Bufpos start, Bufpos end)
+signal_before_change (struct buffer *buf, Charbpos start, Charbpos end)
 {
   /* This function can GC */
   struct buffer *mbuf;
@@ -2212,14 +2212,14 @@
 }
 
 /* Signal a change immediately after it happens.
-   START is the bufpos of the start of the changed text.
-   ORIG_END is the bufpos of the end of the before-changed text.
-   NEW_END is the bufpos of the end of the after-changed text.
+   START is the charbpos of the start of the changed text.
+   ORIG_END is the charbpos of the end of the before-changed text.
+   NEW_END is the charbpos of the end of the after-changed text.
  */
 
 static void
-signal_after_change (struct buffer *buf, Bufpos start, Bufpos orig_end,
-		     Bufpos new_end)
+signal_after_change (struct buffer *buf, Charbpos start, Charbpos orig_end,
+		     Charbpos new_end)
 {
   /* This function can GC */
   struct buffer *mbuf;
@@ -2301,7 +2301,7 @@
    it should pay attention to that area.  */
 
 static void
-prepare_to_modify_buffer (struct buffer *buf, Bufpos start, Bufpos end,
+prepare_to_modify_buffer (struct buffer *buf, Charbpos start, Charbpos end,
 			  int lockit)
 {
   /* This function can GC */
@@ -2370,7 +2370,7 @@
 /************************************************************************/
 
 void
-fixup_internal_substring (const Bufbyte *nonreloc, Lisp_Object reloc,
+fixup_internal_substring (const Intbyte *nonreloc, Lisp_Object reloc,
 			  Bytecount offset, Bytecount *len)
 {
   assert ((nonreloc && NILP (reloc)) || (!nonreloc && STRINGP (reloc)));
@@ -2382,7 +2382,7 @@
       else
 	*len = XSTRING_LENGTH (reloc) - offset;
     }
-#ifdef ERROR_CHECK_BUFPOS
+#ifdef ERROR_CHECK_CHARBPOS
   assert (*len >= 0);
   if (STRINGP (reloc))
     {
@@ -2392,7 +2392,7 @@
 #endif
 }
 
-/* Insert a string into BUF at Bufpos POS.  The string data comes
+/* Insert a string into BUF at Charbpos POS.  The string data comes
    from one of two sources: constant, non-relocatable data (specified
    in NONRELOC), or a Lisp string object (specified in RELOC), which
    is relocatable and may have extent data that needs to be copied
@@ -2411,14 +2411,14 @@
    in the higher-level Lisp functions calling insert-file-contents. */
 
 Charcount
-buffer_insert_string_1 (struct buffer *buf, Bufpos pos,
-			const Bufbyte *nonreloc, Lisp_Object reloc,
+buffer_insert_string_1 (struct buffer *buf, Charbpos pos,
+			const Intbyte *nonreloc, Lisp_Object reloc,
 			Bytecount offset, Bytecount length,
 			int flags)
 {
   /* This function can GC */
   struct gcpro gcpro1;
-  Bytind ind;
+  Bytebpos ind;
   Charcount cclen;
   int move_point = 0;
   struct buffer *mbuf;
@@ -2472,7 +2472,7 @@
   if (STRINGP (reloc))
     nonreloc = XSTRING_DATA (reloc);
 
-  ind = bufpos_to_bytind (buf, pos);
+  ind = charbpos_to_bytebpos (buf, pos);
   cclen = bytecount_to_charcount (nonreloc + offset, length);
 
   if (ind != BI_BUF_GPT (buf))
@@ -2525,7 +2525,7 @@
   MAP_INDIRECT_BUFFERS (buf, mbuf, bufcons)
     {
       /* We know the gap is at IND so the cast is OK. */
-      adjust_markers_for_insert (mbuf, (Memind) ind, length);
+      adjust_markers_for_insert (mbuf, (Membpos) ind, length);
     }
 
   /* Point logically doesn't move, but may need to be adjusted because
@@ -2555,7 +2555,7 @@
       MAP_INDIRECT_BUFFERS (buf, mbuf, bufcons)
 	{
 	  /* ind - 1 is correct because the FROM argument is exclusive.
-	     I formerly used DEC_BYTIND() but that caused problems at the
+	     I formerly used DEC_BYTEBPOS() but that caused problems at the
 	     beginning of the buffer. */
 	  adjust_markers (mbuf, ind - 1, ind, length);
 	}
@@ -2576,8 +2576,8 @@
    moves forward past the text.) FLAGS is as above. */
 
 Charcount
-buffer_insert_raw_string_1 (struct buffer *buf, Bufpos pos,
-			    const Bufbyte *nonreloc, Bytecount length,
+buffer_insert_raw_string_1 (struct buffer *buf, Charbpos pos,
+			    const Intbyte *nonreloc, Bytecount length,
 			    int flags)
 {
   /* This function can GC */
@@ -2586,7 +2586,7 @@
 }
 
 Charcount
-buffer_insert_lisp_string_1 (struct buffer *buf, Bufpos pos, Lisp_Object str,
+buffer_insert_lisp_string_1 (struct buffer *buf, Charbpos pos, Lisp_Object str,
 			     int flags)
 {
   /* This function can GC */
@@ -2601,27 +2601,27 @@
 /* Insert the null-terminated string S (in external format). */
 
 Charcount
-buffer_insert_c_string_1 (struct buffer *buf, Bufpos pos, const char *s,
+buffer_insert_c_string_1 (struct buffer *buf, Charbpos pos, const char *s,
 			  int flags)
 {
   /* This function can GC */
   const char *translated = GETTEXT (s);
-  return buffer_insert_string_1 (buf, pos, (const Bufbyte *) translated, Qnil,
+  return buffer_insert_string_1 (buf, pos, (const Intbyte *) translated, Qnil,
 				 0, strlen (translated), flags);
 }
 
 Charcount
-buffer_insert_emacs_char_1 (struct buffer *buf, Bufpos pos, Emchar ch,
+buffer_insert_emacs_char_1 (struct buffer *buf, Charbpos pos, Emchar ch,
 			    int flags)
 {
   /* This function can GC */
-  Bufbyte str[MAX_EMCHAR_LEN];
+  Intbyte str[MAX_EMCHAR_LEN];
   Bytecount len = set_charptr_emchar (str, ch);
   return buffer_insert_string_1 (buf, pos, str, Qnil, 0, len, flags);
 }
 
 Charcount
-buffer_insert_c_char_1 (struct buffer *buf, Bufpos pos, char c,
+buffer_insert_c_char_1 (struct buffer *buf, Charbpos pos, char c,
 			int flags)
 {
   /* This function can GC */
@@ -2630,8 +2630,8 @@
 }
 
 Charcount
-buffer_insert_from_buffer_1 (struct buffer *buf, Bufpos pos,
-			     struct buffer *buf2, Bufpos pos2,
+buffer_insert_from_buffer_1 (struct buffer *buf, Charbpos pos,
+			     struct buffer *buf2, Charbpos pos2,
 			     Charcount length, int flags)
 {
   /* This function can GC */
@@ -2648,11 +2648,11 @@
 /* Delete characters in buffer from FROM up to (but not including) TO.  */
 
 void
-buffer_delete_range (struct buffer *buf, Bufpos from, Bufpos to, int flags)
+buffer_delete_range (struct buffer *buf, Charbpos from, Charbpos to, int flags)
 {
   /* This function can GC */
   Charcount numdel;
-  Bytind bi_from, bi_to;
+  Bytebpos bi_from, bi_to;
   Bytecount bc_numdel;
   EMACS_INT shortage;
   struct buffer *mbuf;
@@ -2702,8 +2702,8 @@
 	}
     }
 
-  bi_from = bufpos_to_bytind (buf, from);
-  bi_to = bufpos_to_bytind (buf, to);
+  bi_from = charbpos_to_bytebpos (buf, from);
+  bi_to = charbpos_to_bytebpos (buf, to);
   bc_numdel = bi_to - bi_from;
 
   delete_invalidate_line_number_cache (buf, from, to);
@@ -2721,10 +2721,10 @@
       MARK_BUFFERS_CHANGED;
 
       /* #### Point used to be modified here, but this causes problems
-	 with MULE, as point is used to calculate bytinds, and if the
+	 with MULE, as point is used to calculate bytebposs, and if the
 	 offset in bc_numdel causes point to move to a non first-byte
 	 location, causing some other function to throw an assertion
-	 in ASSERT_VALID_BYTIND. I've moved the code to right after
+	 in ASSERT_VALID_BYTEBPOS. I've moved the code to right after
 	 the other movements and adjustments, but before the gap is
 	 moved.  -- jh 970813 */
 
@@ -2796,10 +2796,10 @@
       MARK_BUFFERS_CHANGED;
 
       /* #### Point used to be modified here, but this causes problems
-	 with MULE, as point is used to calculate bytinds, and if the
+	 with MULE, as point is used to calculate bytebposs, and if the
 	 offset in bc_numdel causes point to move to a non first-byte
 	 location, causing some other function to throw an assertion
-	 in ASSERT_VALID_BYTIND. I've moved the code to right after
+	 in ASSERT_VALID_BYTEBPOS. I've moved the code to right after
 	 the other movements and adjustments, but before the gap is
 	 moved.  -- jh 970813 */
 
@@ -2878,12 +2878,12 @@
 /* Replace the character at POS in buffer B with CH. */
 
 void
-buffer_replace_char (struct buffer *buf, Bufpos pos, Emchar ch,
+buffer_replace_char (struct buffer *buf, Charbpos pos, Emchar ch,
 		     int not_real_change, int force_lock_check)
 {
   /* This function can GC */
-  Bufbyte curstr[MAX_EMCHAR_LEN];
-  Bufbyte newstr[MAX_EMCHAR_LEN];
+  Intbyte curstr[MAX_EMCHAR_LEN];
+  Intbyte newstr[MAX_EMCHAR_LEN];
   Bytecount curlen, newlen;
 
   /* Defensive steps just in case a buffer gets deleted and a calling
@@ -2986,12 +2986,12 @@
    and add any necessary extents from the buffer. */
 
 static Lisp_Object
-make_string_from_buffer_1 (struct buffer *buf, Bufpos pos, Charcount length,
+make_string_from_buffer_1 (struct buffer *buf, Charbpos pos, Charcount length,
 			   int no_extents)
 {
   /* This function can GC */
-  Bytind    bi_ind = bufpos_to_bytind (buf, pos);
-  Bytecount bi_len = bufpos_to_bytind (buf, pos + length) - bi_ind;
+  Bytebpos    bi_ind = charbpos_to_bytebpos (buf, pos);
+  Bytecount bi_len = charbpos_to_bytebpos (buf, pos + length) - bi_ind;
   Lisp_Object  val = make_uninit_string (bi_len);
 
   struct gcpro gcpro1;
@@ -3002,8 +3002,8 @@
 
   {
     Bytecount len1 = BI_BUF_GPT (buf) - bi_ind;
-    Bufbyte *start1 = BI_BUF_BYTE_ADDRESS (buf, bi_ind);
-    Bufbyte *dest = XSTRING_DATA (val);
+    Intbyte *start1 = BI_BUF_BYTE_ADDRESS (buf, bi_ind);
+    Intbyte *dest = XSTRING_DATA (val);
 
     if (len1 < 0)
       {
@@ -3018,8 +3018,8 @@
     else
       {
 	/* Spans gap */
-	Bytind pos2 = bi_ind + len1;
-	Bufbyte *start2 = BI_BUF_BYTE_ADDRESS (buf, pos2);
+	Bytebpos pos2 = bi_ind + len1;
+	Intbyte *start2 = BI_BUF_BYTE_ADDRESS (buf, pos2);
 
 	memcpy (dest, start1, len1);
 	memcpy (dest + len1, start2, bi_len - len1);
@@ -3031,20 +3031,20 @@
 }
 
 Lisp_Object
-make_string_from_buffer (struct buffer *buf, Bufpos pos, Charcount length)
+make_string_from_buffer (struct buffer *buf, Charbpos pos, Charcount length)
 {
   return make_string_from_buffer_1 (buf, pos, length, 0);
 }
 
 Lisp_Object
-make_string_from_buffer_no_extents (struct buffer *buf, Bufpos pos,
+make_string_from_buffer_no_extents (struct buffer *buf, Charbpos pos,
 				    Charcount length)
 {
   return make_string_from_buffer_1 (buf, pos, length, 1);
 }
 
 void
-barf_if_buffer_read_only (struct buffer *buf, Bufpos from, Bufpos to)
+barf_if_buffer_read_only (struct buffer *buf, Charbpos from, Charbpos to)
 {
   Lisp_Object buffer;
   Lisp_Object iro;
@@ -3065,21 +3065,21 @@
       if (to < 0)
 	to = from;
       verify_extent_modification (buffer,
-				  bufpos_to_bytind (buf, from),
-				  bufpos_to_bytind (buf, to),
+				  charbpos_to_bytebpos (buf, from),
+				  charbpos_to_bytebpos (buf, to),
 				  iro);
     }
 }
 
 void
-find_charsets_in_bufbyte_string (unsigned char *charsets, const Bufbyte *str,
+find_charsets_in_intbyte_string (unsigned char *charsets, const Intbyte *str,
 				 Bytecount len)
 {
 #ifndef MULE
   /* Telescope this. */
   charsets[0] = 1;
 #else
-  const Bufbyte *strend = str + len;
+  const Intbyte *strend = str + len;
   memset (charsets, 0, NUM_LEADING_BYTES);
 
   /* #### SJT doesn't like this. */
@@ -3124,10 +3124,10 @@
 }
 
 int
-bufbyte_string_displayed_columns (const Bufbyte *str, Bytecount len)
+intbyte_string_displayed_columns (const Intbyte *str, Bytecount len)
 {
   int cols = 0;
-  const Bufbyte *end = str + len;
+  const Intbyte *end = str + len;
 
   while (str < end)
     {
@@ -3162,10 +3162,10 @@
 /* NOTE: Does not reset the Dynarr. */
 
 void
-convert_bufbyte_string_into_emchar_dynarr (const Bufbyte *str, Bytecount len,
+convert_intbyte_string_into_emchar_dynarr (const Intbyte *str, Bytecount len,
 					   Emchar_dynarr *dyn)
 {
-  const Bufbyte *strend = str + len;
+  const Intbyte *strend = str + len;
 
   while (str < strend)
     {
@@ -3176,10 +3176,10 @@
 }
 
 Charcount
-convert_bufbyte_string_into_emchar_string (const Bufbyte *str, Bytecount len,
+convert_intbyte_string_into_emchar_string (const Intbyte *str, Bytecount len,
 					   Emchar *arr)
 {
-  const Bufbyte *strend = str + len;
+  const Intbyte *strend = str + len;
   Charcount newlen = 0;
   while (str < strend)
     {
@@ -3191,14 +3191,14 @@
 }
 
 /* Convert an array of Emchars into the equivalent string representation.
-   Store into the given Bufbyte dynarr.  Does not reset the dynarr.
+   Store into the given Intbyte dynarr.  Does not reset the dynarr.
    Does not add a terminating zero. */
 
 void
-convert_emchar_string_into_bufbyte_dynarr (Emchar *arr, int nels,
-					  Bufbyte_dynarr *dyn)
+convert_emchar_string_into_intbyte_dynarr (Emchar *arr, int nels,
+					  Intbyte_dynarr *dyn)
 {
-  Bufbyte str[MAX_EMCHAR_LEN];
+  Intbyte str[MAX_EMCHAR_LEN];
   int i;
 
   for (i = 0; i < nels; i++)
@@ -3210,17 +3210,17 @@
 
 /* Convert an array of Emchars into the equivalent string representation.
    Malloc the space needed for this and return it.  If LEN_OUT is not a
-   NULL pointer, store into LEN_OUT the number of Bufbytes in the
-   malloc()ed string.  Note that the actual number of Bufbytes allocated
+   NULL pointer, store into LEN_OUT the number of Intbytes in the
+   malloc()ed string.  Note that the actual number of Intbytes allocated
    is one more than this: the returned string is zero-terminated. */
 
-Bufbyte *
+Intbyte *
 convert_emchar_string_into_malloced_string (Emchar *arr, int nels,
 					   Bytecount *len_out)
 {
   /* Damn zero-termination. */
-  Bufbyte *str = (Bufbyte *) alloca (nels * MAX_EMCHAR_LEN + 1);
-  Bufbyte *strorig = str;
+  Intbyte *str = (Intbyte *) alloca (nels * MAX_EMCHAR_LEN + 1);
+  Intbyte *strorig = str;
   Bytecount len;
 
   int i;
@@ -3229,7 +3229,7 @@
     str += set_charptr_emchar (str, arr[i]);
   *str = '\0';
   len = str - strorig;
-  str = (Bufbyte *) xmalloc (1 + len);
+  str = (Intbyte *) xmalloc (1 + len);
   memcpy (str, strorig, 1 + len);
   if (len_out)
     *len_out = len;
@@ -3249,7 +3249,7 @@
   inside_change_hook = 0;
   in_first_change = 0;
 
-  for (i = 0; i <= MAX_BYTIND_GAP_SIZE_3; i++)
+  for (i = 0; i <= MAX_BYTEBPOS_GAP_SIZE_3; i++)
     three_to_one_table[i] = i / 3;
 }
 
@@ -3285,8 +3285,8 @@
 
 	for (i = 0; i < 16; i++)
 	  {
-	    b->text->mule_bufpos_cache[i] = 1;
-	    b->text->mule_bytind_cache[i] = 1;
+	    b->text->mule_charbpos_cache[i] = 1;
+	    b->text->mule_bytebpos_cache[i] = 1;
 	  }
       }
 #endif /* MULE */
--- a/src/insdel.h	Tue Sep 18 05:06:57 2001 +0000
+++ b/src/insdel.h	Thu Sep 20 06:31:11 2001 +0000
@@ -29,7 +29,7 @@
 /*                        changing a buffer's text                      */
 /************************************************************************/
 
-int begin_multiple_change (struct buffer *buf, Bufpos start, Bufpos end);
+int begin_multiple_change (struct buffer *buf, Charbpos start, Charbpos end);
 void end_multiple_change (struct buffer *buf, int count);
 
 /* flags for functions below */
@@ -37,23 +37,23 @@
 #define INSDEL_BEFORE_MARKERS 1
 #define INSDEL_NO_LOCKING 2
 
-Charcount buffer_insert_string_1 (struct buffer *buf, Bufpos pos,
-				  const Bufbyte *nonreloc, Lisp_Object reloc,
+Charcount buffer_insert_string_1 (struct buffer *buf, Charbpos pos,
+				  const Intbyte *nonreloc, Lisp_Object reloc,
 				  Bytecount offset, Bytecount length,
 				  int flags);
-Charcount buffer_insert_raw_string_1 (struct buffer *buf, Bufpos pos,
-				      const Bufbyte *nonreloc,
+Charcount buffer_insert_raw_string_1 (struct buffer *buf, Charbpos pos,
+				      const Intbyte *nonreloc,
 				      Bytecount length, int flags);
-Charcount buffer_insert_lisp_string_1 (struct buffer *buf, Bufpos pos,
+Charcount buffer_insert_lisp_string_1 (struct buffer *buf, Charbpos pos,
 				       Lisp_Object str, int flags);
-Charcount buffer_insert_c_string_1 (struct buffer *buf, Bufpos pos,
+Charcount buffer_insert_c_string_1 (struct buffer *buf, Charbpos pos,
 				    const char *s, int flags);
-Charcount buffer_insert_emacs_char_1 (struct buffer *buf, Bufpos pos,
+Charcount buffer_insert_emacs_char_1 (struct buffer *buf, Charbpos pos,
 				      Emchar ch, int flags);
-Charcount buffer_insert_c_char_1 (struct buffer *buf, Bufpos pos, char c,
+Charcount buffer_insert_c_char_1 (struct buffer *buf, Charbpos pos, char c,
 				  int flags);
-Charcount buffer_insert_from_buffer_1 (struct buffer *buf, Bufpos pos,
-				       struct buffer *buf2, Bufpos pos2,
+Charcount buffer_insert_from_buffer_1 (struct buffer *buf, Charbpos pos,
+				       struct buffer *buf2, Charbpos pos2,
 				       Charcount length, int flags);
 
 /* Macros for insertion functions that insert at point after markers.
@@ -74,9 +74,9 @@
 #define buffer_insert_from_buffer(buf, b, index, length) \
   buffer_insert_from_buffer_1 (buf, -1, b, index, length, 0)
 
-void buffer_delete_range (struct buffer *buf, Bufpos from, Bufpos to,
+void buffer_delete_range (struct buffer *buf, Charbpos from, Charbpos to,
 			  int flags);
-void buffer_replace_char (struct buffer *b, Bufpos pos, Emchar ch,
+void buffer_replace_char (struct buffer *b, Charbpos pos, Emchar ch,
 			  int not_real_change, int force_lock_check);
 
 
@@ -91,7 +91,7 @@
 {
   /* multiple change stuff */
   int in_multiple_change;
-  Bufpos mc_begin, mc_orig_end, mc_new_end;
+  Charbpos mc_begin, mc_orig_end, mc_new_end;
   int mc_begin_signaled;
 };
 
@@ -129,8 +129,8 @@
   ((buf)->changes->newline_was_deleted)
 
 void buffer_extent_signal_changed_region (struct buffer *buf,
-					  Bufpos start,
-					  Bufpos end);
+					  Charbpos start,
+					  Charbpos end);
 void buffer_reset_changes (struct buffer *buf);
 
 
@@ -139,22 +139,22 @@
 /*                        other related functions                       */
 /************************************************************************/
 
-Memind do_marker_adjustment (Memind mpos, Memind from,
-			     Memind to, Bytecount amount);
+Membpos do_marker_adjustment (Membpos mpos, Membpos from,
+			     Membpos to, Bytecount amount);
 
-void fixup_internal_substring (const Bufbyte *nonreloc,
+void fixup_internal_substring (const Intbyte *nonreloc,
 			       Lisp_Object reloc,
 			       Bytecount offset, Bytecount *len);
 
 /* In font-lock.c */
 void font_lock_maybe_update_syntactic_caches (struct buffer *buf,
-					      Bufpos start,
-					      Bufpos orig_end,
-					      Bufpos new_end);
+					      Charbpos start,
+					      Charbpos orig_end,
+					      Charbpos new_end);
 void font_lock_buffer_was_killed (struct buffer *buf);
 
-void barf_if_buffer_read_only (struct buffer *buf, Bufpos from,
-			       Bufpos to);
+void barf_if_buffer_read_only (struct buffer *buf, Charbpos from,
+			       Charbpos to);
 
 void init_buffer_text (struct buffer *b);
 void uninit_buffer_text (struct buffer *b);
--- a/src/keymap.c	Tue Sep 18 05:06:57 2001 +0000
+++ b/src/keymap.c	Thu Sep 20 06:31:11 2001 +0000
@@ -440,7 +440,7 @@
 	 "9" as its name.
        */
       /* !!#### I'm not sure how correct this is. */
-      Bufbyte str [1 + MAX_EMCHAR_LEN];
+      Intbyte str [1 + MAX_EMCHAR_LEN];
       Bytecount count = set_charptr_emchar (str, XCHAR (keysym));
       str[count] = 0;
       keysym = intern ((char *) str);
@@ -751,7 +751,7 @@
 /************************************************************************/
 
 static Lisp_Object
-make_keymap (Element_Count size)
+make_keymap (Elemcount size)
 {
   Lisp_Object result;
   Lisp_Keymap *keymap = alloc_lcrecord_type (Lisp_Keymap, &lrecord_keymap);
@@ -1341,7 +1341,7 @@
 	strncpy(temp, name, sizeof (temp));
 	temp[sizeof (temp) - 1] = '\0';
 	temp[2] = '-';
-	*keysym = Fintern_soft(make_string((Bufbyte *)temp,
+	*keysym = Fintern_soft(make_string((Intbyte *)temp,
 					   strlen(temp)),
 			       Qnil);
       } else if (EQ (*keysym, QLFD))
@@ -3259,7 +3259,7 @@
 	  else if (EQ (keysym, Qshift)) strcpy (bufp, "Sh-"), bufp += 3;
 	  else if (CHAR_OR_CHAR_INTP (keysym))
 	    {
-	      bufp += set_charptr_emchar ((Bufbyte *) bufp,
+	      bufp += set_charptr_emchar ((Intbyte *) bufp,
 					  XCHAR_OR_CHAR_INT (keysym));
 	      *bufp = 0;
 	    }
@@ -3297,8 +3297,8 @@
 */
        (chr))
 {
-  Bufbyte buf[200];
-  Bufbyte *p;
+  Intbyte buf[200];
+  Intbyte *p;
   Emchar c;
   Lisp_Object ctl_arrow = current_buffer->ctl_arrow;
   int ctl_p = !NILP (ctl_arrow);
@@ -4362,7 +4362,7 @@
 
   staticpro (&Vcurrent_global_map);
 
-  Vsingle_space_string = make_string ((const Bufbyte *) " ", 1);
+  Vsingle_space_string = make_string ((const Intbyte *) " ", 1);
   staticpro (&Vsingle_space_string);
 }
 
--- a/src/line-number.c	Tue Sep 18 05:06:57 2001 +0000
+++ b/src/line-number.c	Thu Sep 20 06:31:11 2001 +0000
@@ -118,7 +118,7 @@
 
 /* Invalidate the line number cache positions that lie after POS. */
 static void
-invalidate_line_number_cache (struct buffer *b, Bufpos pos)
+invalidate_line_number_cache (struct buffer *b, Charbpos pos)
 {
   EMACS_INT i, j;
   Lisp_Object *ring = XVECTOR_DATA (LINE_NUMBER_RING (b));
@@ -157,8 +157,8 @@
 
    This will do nothing if the cache is uninitialized.  */
 void
-insert_invalidate_line_number_cache (struct buffer *b, Bufpos pos,
-				     const Bufbyte *nonreloc, Bytecount length)
+insert_invalidate_line_number_cache (struct buffer *b, Charbpos pos,
+				     const Intbyte *nonreloc, Bytecount length)
 {
   if (NILP (b->text->line_number_cache))
     return;
@@ -179,7 +179,7 @@
 
    This will do nothing if the cache is uninitialized.  */
 void
-delete_invalidate_line_number_cache (struct buffer *b, Bufpos from, Bufpos to)
+delete_invalidate_line_number_cache (struct buffer *b, Charbpos from, Charbpos to)
 {
   if (NILP (b->text->line_number_cache))
     return;
@@ -204,7 +204,7 @@
    BEG will be BUF_BEGV, and *LINE will be XINT (LINE_NUMBER_BEGV).
    This will initialize the cache, if necessary.  */
 static void
-get_nearest_line_number (struct buffer *b, Bufpos *beg, Bufpos pos,
+get_nearest_line_number (struct buffer *b, Charbpos *beg, Charbpos pos,
 			 EMACS_INT *line)
 {
   EMACS_INT i;
@@ -217,7 +217,7 @@
   /* Find the ring entry closest to POS, if it is closer than BEG. */
   for (i = 0; i < LINE_NUMBER_RING_SIZE && CONSP (ring[i]); i++)
     {
-      Bufpos newpos = marker_position (XCAR (ring[i]));
+      Charbpos newpos = marker_position (XCAR (ring[i]));
       Charcount howfar = newpos - pos;
       if (howfar < 0)
 	howfar = -howfar;
@@ -232,7 +232,7 @@
 
 /* Add a (POS . LINE) pair to the ring, and rotate it. */
 static void
-add_position_to_cache (struct buffer *b, Bufpos pos, EMACS_INT line)
+add_position_to_cache (struct buffer *b, Charbpos pos, EMACS_INT line)
 {
   Lisp_Object *ring = XVECTOR_DATA (LINE_NUMBER_RING (b));
   int i = LINE_NUMBER_RING_SIZE - 1;
@@ -268,9 +268,9 @@
    If the calculation (with or without the cache lookup) required more
    than LINE_NUMBER_FAR characters of traversal, update the cache.  */
 EMACS_INT
-buffer_line_number (struct buffer *b, Bufpos pos, int cachep)
+buffer_line_number (struct buffer *b, Charbpos pos, int cachep)
 {
-  Bufpos beg = BUF_BEGV (b);
+  Charbpos beg = BUF_BEGV (b);
   EMACS_INT cached_lines = 0;
   EMACS_INT shortage, line;
 
--- a/src/line-number.h	Tue Sep 18 05:06:57 2001 +0000
+++ b/src/line-number.h	Thu Sep 20 06:31:11 2001 +0000
@@ -23,10 +23,10 @@
 /* Synched up with: Not in FSF. */
 
 void narrow_line_number_cache (struct buffer *);
-void insert_invalidate_line_number_cache (struct buffer *, Bufpos,
-					  const Bufbyte *, Bytecount);
-void delete_invalidate_line_number_cache (struct buffer *, Bufpos, Bufpos);
+void insert_invalidate_line_number_cache (struct buffer *, Charbpos,
+					  const Intbyte *, Bytecount);
+void delete_invalidate_line_number_cache (struct buffer *, Charbpos, Charbpos);
 
-EMACS_INT buffer_line_number (struct buffer *, Bufpos, int);
+EMACS_INT buffer_line_number (struct buffer *, Charbpos, int);
 
 #endif /* INCLUDED_line_number_h_ */
--- a/src/lisp.h	Tue Sep 18 05:06:57 2001 +0000
+++ b/src/lisp.h	Thu Sep 20 06:31:11 2001 +0000
@@ -96,20 +96,20 @@
    functions declared as such. */
 
 /* The data representing the text in a buffer is logically a set
-   of Bufbytes, declared as follows. */
-
-typedef unsigned char Bufbyte;
+   of Intbytes, declared as follows. */
+
+typedef unsigned char Intbyte;
 
 /* The following should be used when you are working with internal data
    but for whatever reason need to have it declared a "char *".  Examples
    are function arguments whose values are most commonly literal strings,
    or where you have to apply a stdlib string function to internal data.
 
-   In general, you should avoid this where possible and use Bufbyte instead,
+   In general, you should avoid this where possible and use Intbyte instead,
    for consistency.  For example, the new Mule workspace contains
-   Bufbyte versions of the stdlib string functions. */
-
-typedef char CBufbyte;
+   Intbyte versions of the stdlib string functions. */
+
+typedef char CIntbyte;
 
 /* The data representing a string in "external" format (binary or any
    external encoding) is logically a set of Extbytes, declared as
@@ -132,9 +132,9 @@
 
 
 /* To the user, a buffer is made up of characters, declared as follows.
-   In the non-Mule world, characters and Bufbytes are equivalent.
+   In the non-Mule world, characters and Intbytes are equivalent.
    In the Mule world, a character requires (typically) 1 to 4
-   Bufbytes for its representation in a buffer. */
+   Intbytes for its representation in a buffer. */
 
 typedef int Emchar;
 
@@ -145,23 +145,19 @@
    buffer.h (where they rightfully belong) to avoid syntax errors
    in function prototypes. */
 
-typedef EMACS_INT Bufpos;
-typedef EMACS_INT Bytind;
-typedef EMACS_INT Memind;
+typedef EMACS_INT Charbpos;
+typedef EMACS_INT Bytebpos;
+typedef EMACS_INT Membpos;
 
 /* Counts of bytes or chars */
-
 typedef EMACS_INT Bytecount;
 typedef EMACS_INT Charcount;
 
-/* Length in bytes of a string in external format */
-typedef EMACS_INT Extcount;
-
-/* General counts of bytes or elements */
-typedef EMACS_INT Memory_Count;
-typedef EMACS_INT Element_Count;
-
-typedef unsigned long Hash_Code;
+/* Counts of elements */
+typedef EMACS_INT Elemcount;
+
+/* Hash codes */
+typedef unsigned long Hashcode;
 
 /* ------------------------ dynamic arrays ------------------- */
 
@@ -216,7 +212,7 @@
 
 #ifdef MEMORY_USAGE_STATS
 struct overhead_stats;
-Memory_Count Dynarr_memory_usage (void *d, struct overhead_stats *stats);
+Bytecount Dynarr_memory_usage (void *d, struct overhead_stats *stats);
 #endif
 
 /* Also define min() and max(). (Some compilers put them in strange
@@ -232,9 +228,9 @@
 
 /* Memory allocation */
 void malloc_warning (const char *);
-void *xmalloc (Memory_Count size);
-void *xmalloc_and_zero (Memory_Count size);
-void *xrealloc (void *, Memory_Count size);
+void *xmalloc (Bytecount size);
+void *xmalloc_and_zero (Bytecount size);
+void *xrealloc (void *, Bytecount size);
 char *xstrdup (const char *);
 /* generally useful */
 #define countof(x) ((int) (sizeof(x)/sizeof((x)[0])))
@@ -254,7 +250,7 @@
    least NEEDED_SIZE objects.  The reallocing is done by doubling,
    which ensures constant amortized time per element. */
 #define DO_REALLOC(basevar, sizevar, needed_size, type)	do {	\
-  Memory_Count do_realloc_needed_size = (needed_size);		\
+  Bytecount do_realloc_needed_size = (needed_size);		\
   if ((sizevar) < do_realloc_needed_size)			\
     {								\
       if ((sizevar) < 32)					\
@@ -443,8 +439,8 @@
 
 typedef struct
 {
-  Dynarr_declare (Bufbyte);
-} Bufbyte_dynarr;
+  Dynarr_declare (Intbyte);
+} Intbyte_dynarr;
 
 typedef struct
 {
@@ -480,13 +476,13 @@
 
 typedef struct
 {
-  Dynarr_declare (Bufpos);
-} Bufpos_dynarr;
+  Dynarr_declare (Charbpos);
+} Charbpos_dynarr;
 
 typedef struct
 {
-  Dynarr_declare (Bytind);
-} Bytind_dynarr;
+  Dynarr_declare (Bytebpos);
+} Bytebpos_dynarr;
 
 typedef struct
 {
@@ -673,7 +669,7 @@
 {
   Lisp_Object car, cdr;
   struct buffer *buffer;
-  int bufpos;
+  int charbpos;
 };
 #endif
 
@@ -1160,7 +1156,7 @@
 {
   struct lrecord_header lheader;
   Bytecount size;
-  Bufbyte *data;
+  Intbyte *data;
   Lisp_Object plist;
 };
 typedef struct Lisp_String Lisp_String;
@@ -1175,8 +1171,8 @@
 
 #ifdef MULE
 
-Charcount bytecount_to_charcount (const Bufbyte *ptr, Bytecount len);
-Bytecount charcount_to_bytecount (const Bufbyte *ptr, Charcount len);
+Charcount bytecount_to_charcount (const Intbyte *ptr, Bytecount len);
+Bytecount charcount_to_bytecount (const Intbyte *ptr, Charcount len);
 
 #else /* not MULE */
 
@@ -1217,7 +1213,7 @@
 # define string_char_length(s) string_length (s)
 # define string_char(s, i) ((Emchar) string_byte (s, i))
 # define string_char_addr(s, i) string_byte_addr (s, i)
-# define set_string_char(s, i, c) set_string_byte (s, i, (Bufbyte)c)
+# define set_string_char(s, i, c) set_string_byte (s, i, (Intbyte)c)
 
 #endif /* not MULE */
 
@@ -1291,7 +1287,7 @@
 {
   struct lrecord_header lheader;
   Lisp_Object next;
-  Element_Count size;
+  Elemcount size;
   unsigned long bits[1];
 };
 typedef struct Lisp_Bit_Vector Lisp_Bit_Vector;
@@ -1319,17 +1315,17 @@
 #define bit_vector_length(v) ((v)->size)
 #define bit_vector_next(v) ((v)->next)
 
-INLINE_HEADER int bit_vector_bit (Lisp_Bit_Vector *v, Element_Count n);
+INLINE_HEADER int bit_vector_bit (Lisp_Bit_Vector *v, Elemcount n);
 INLINE_HEADER int
-bit_vector_bit (Lisp_Bit_Vector *v, Element_Count n)
+bit_vector_bit (Lisp_Bit_Vector *v, Elemcount n)
 {
   return ((v->bits[n >> LONGBITS_LOG2] >> (n & (LONGBITS_POWER_OF_2 - 1)))
 	  & 1);
 }
 
-INLINE_HEADER void set_bit_vector_bit (Lisp_Bit_Vector *v, Element_Count n, int value);
+INLINE_HEADER void set_bit_vector_bit (Lisp_Bit_Vector *v, Elemcount n, int value);
 INLINE_HEADER void
-set_bit_vector_bit (Lisp_Bit_Vector *v, Element_Count n, int value)
+set_bit_vector_bit (Lisp_Bit_Vector *v, Elemcount n, int value)
 {
   if (value)
     v->bits[n >> LONGBITS_LOG2] |= (1UL << (n & (LONGBITS_POWER_OF_2 - 1)));
@@ -1415,7 +1411,7 @@
   Lisp_Marker *next;
   Lisp_Marker *prev;
   struct buffer *buffer;
-  Memind memind;
+  Membpos membpos;
   char insertion_type;
 };
 
@@ -1695,7 +1691,7 @@
 {
   struct lcrecord_header header;
   Lisp_Object free;
-  Element_Count size;
+  Elemcount size;
   const struct lrecord_implementation *implementation;
 };
 
@@ -1708,7 +1704,7 @@
    Lcrecord lists should never escape to the Lisp level, so
    functions should not be doing this. */
 
-Lisp_Object make_lcrecord_list (Element_Count size,
+Lisp_Object make_lcrecord_list (Elemcount size,
 				const struct lrecord_implementation
 				*implementation);
 Lisp_Object allocate_managed_lcrecord (Lisp_Object lcrecord_list);
@@ -1889,7 +1885,7 @@
 
 #define LISP_HASH(obj) ((unsigned long) LISP_TO_VOID (obj))
 unsigned long string_hash (const char *xv);
-unsigned long memory_hash (const void *xv, Memory_Count size);
+unsigned long memory_hash (const void *xv, Bytecount size);
 unsigned long internal_hash (Lisp_Object obj, int depth);
 unsigned long internal_array_hash (Lisp_Object *arr, int size, int depth);
 
@@ -2190,7 +2186,7 @@
 
 /* dump_add_opaque (&var, size) dumps the opaque static structure `var'. */
 #ifdef PDUMP
-void dump_add_opaque (const void *, Memory_Count);
+void dump_add_opaque (const void *, Bytecount);
 #else
 #define dump_add_opaque(varaddr,size) DO_NOTHING
 #endif
@@ -2258,10 +2254,10 @@
 
 struct overhead_stats
 {
-  Memory_Count was_requested;
-  Memory_Count malloc_overhead;
-  Memory_Count dynarr_overhead;
-  Memory_Count gap_overhead;
+  Bytecount was_requested;
+  Bytecount malloc_overhead;
+  Bytecount dynarr_overhead;
+  Bytecount gap_overhead;
 };
 
 #endif /* MEMORY_USAGE_STATS */
@@ -2323,12 +2319,12 @@
 /* Defined in alloc.c */
 void release_breathing_space (void);
 Lisp_Object noseeum_cons (Lisp_Object, Lisp_Object);
-Lisp_Object make_vector (Element_Count, Lisp_Object);
+Lisp_Object make_vector (Elemcount, Lisp_Object);
 Lisp_Object vector1 (Lisp_Object);
 Lisp_Object vector2 (Lisp_Object, Lisp_Object);
 Lisp_Object vector3 (Lisp_Object, Lisp_Object, Lisp_Object);
-Lisp_Object make_bit_vector (Element_Count, Lisp_Object);
-Lisp_Object make_bit_vector_from_byte_vector (unsigned char *, Element_Count);
+Lisp_Object make_bit_vector (Elemcount, Lisp_Object);
+Lisp_Object make_bit_vector_from_byte_vector (unsigned char *, Elemcount);
 Lisp_Object noseeum_make_marker (void);
 void garbage_collect_1 (void);
 Lisp_Object acons (Lisp_Object, Lisp_Object, Lisp_Object);
@@ -2349,14 +2345,14 @@
 extern EMACS_INT gc_generation_number[1];
 int c_readonly (Lisp_Object);
 int lisp_readonly (Lisp_Object);
-Lisp_Object build_string (const CBufbyte *);
+Lisp_Object build_string (const CIntbyte *);
 Lisp_Object build_ext_string (const Extbyte *, Lisp_Object);
-Lisp_Object build_translated_string (const CBufbyte *);
-Lisp_Object make_string (const Bufbyte *, Bytecount);
+Lisp_Object build_translated_string (const CIntbyte *);
+Lisp_Object make_string (const Intbyte *, Bytecount);
 Lisp_Object make_ext_string (const Extbyte *, EMACS_INT, Lisp_Object);
 Lisp_Object make_uninit_string (Bytecount);
 Lisp_Object make_float (double);
-Lisp_Object make_string_nocopy (const Bufbyte *, Bytecount);
+Lisp_Object make_string_nocopy (const Intbyte *, Bytecount);
 void free_cons (Lisp_Cons *);
 void free_list (Lisp_Object);
 void free_alist (Lisp_Object);
@@ -2367,8 +2363,8 @@
 int marked_p (Lisp_Object obj);
 
 #ifdef MEMORY_USAGE_STATS
-Memory_Count malloced_storage_size (void *, Memory_Count, struct overhead_stats *);
-Memory_Count fixed_type_block_overhead (Memory_Count);
+Bytecount malloced_storage_size (void *, Bytecount, struct overhead_stats *);
+Bytecount fixed_type_block_overhead (Bytecount);
 #endif
 #ifdef PDUMP
 void pdump (void);
@@ -2389,7 +2385,7 @@
 
 /* Defined in bytecode.c */
 DECLARE_DOESNT_RETURN (invalid_byte_code
-		       (const CBufbyte *reason, Lisp_Object frob));
+		       (const CIntbyte *reason, Lisp_Object frob));
 
 /* Defined in callproc.c */
 char *egetenv (const char *);
@@ -2432,32 +2428,32 @@
 Lisp_Object read_doc_string (Lisp_Object);
 
 /* Defined in doprnt.c */
-Bytecount emacs_doprnt_c (Lisp_Object, const Bufbyte *, Lisp_Object,
+Bytecount emacs_doprnt_c (Lisp_Object, const Intbyte *, Lisp_Object,
 			  Bytecount, ...);
-Bytecount emacs_doprnt_va (Lisp_Object, const Bufbyte *, Lisp_Object,
+Bytecount emacs_doprnt_va (Lisp_Object, const Intbyte *, Lisp_Object,
 			   Bytecount, va_list);
-Bytecount emacs_doprnt_lisp (Lisp_Object, const Bufbyte *, Lisp_Object,
+Bytecount emacs_doprnt_lisp (Lisp_Object, const Intbyte *, Lisp_Object,
 			     Bytecount, int, const Lisp_Object *);
-Bytecount emacs_doprnt_lisp_2 (Lisp_Object, const Bufbyte *, Lisp_Object,
+Bytecount emacs_doprnt_lisp_2 (Lisp_Object, const Intbyte *, Lisp_Object,
 			       Bytecount, int, ...);
-Lisp_Object emacs_doprnt_string_c (const Bufbyte *, Lisp_Object,
+Lisp_Object emacs_doprnt_string_c (const Intbyte *, Lisp_Object,
 				   Bytecount, ...);
-Lisp_Object emacs_doprnt_string_va (const Bufbyte *, Lisp_Object,
+Lisp_Object emacs_doprnt_string_va (const Intbyte *, Lisp_Object,
 				    Bytecount, va_list);
-Lisp_Object emacs_doprnt_string_lisp (const Bufbyte *, Lisp_Object,
+Lisp_Object emacs_doprnt_string_lisp (const Intbyte *, Lisp_Object,
 				      Bytecount, int, const Lisp_Object *);
-Lisp_Object emacs_doprnt_string_lisp_2 (const Bufbyte *, Lisp_Object,
+Lisp_Object emacs_doprnt_string_lisp_2 (const Intbyte *, Lisp_Object,
 					Bytecount, int, ...);
 
 /* Defined in editfns.c */
 void uncache_home_directory (void);
 Extbyte *get_home_directory (void);
 char *user_login_name (uid_t *);
-Bufpos bufpos_clip_to_bounds (Bufpos, Bufpos, Bufpos);
-Bytind bytind_clip_to_bounds (Bytind, Bytind, Bytind);
+Charbpos charbpos_clip_to_bounds (Charbpos, Charbpos, Charbpos);
+Bytebpos bytebpos_clip_to_bounds (Bytebpos, Bytebpos, Bytebpos);
 void buffer_insert1 (struct buffer *, Lisp_Object);
-Lisp_Object make_string_from_buffer (struct buffer *, Bufpos, Charcount);
-Lisp_Object make_string_from_buffer_no_extents (struct buffer *, Bufpos, Charcount);
+Lisp_Object make_string_from_buffer (struct buffer *, Charbpos, Charcount);
+Lisp_Object make_string_from_buffer_no_extents (struct buffer *, Charbpos, Charcount);
 Lisp_Object save_excursion_save (void);
 Lisp_Object save_restriction_save (void);
 Lisp_Object save_excursion_restore (Lisp_Object);
@@ -2493,50 +2489,50 @@
 					      Lisp_Object, Error_Behavior);
 DECLARE_DOESNT_RETURN_GCC_ATTRIBUTE_SYNTAX_SUCKS (signal_ferror
 						  (Lisp_Object,
-						   const CBufbyte *,
+						   const CIntbyte *,
 						   ...), 2, 3);
 void maybe_signal_ferror (Lisp_Object, Lisp_Object, Error_Behavior,
-			  const CBufbyte *, ...) PRINTF_ARGS (4, 5);
-Lisp_Object signal_continuable_ferror (Lisp_Object, const CBufbyte *, ...)
+			  const CIntbyte *, ...) PRINTF_ARGS (4, 5);
+Lisp_Object signal_continuable_ferror (Lisp_Object, const CIntbyte *, ...)
      PRINTF_ARGS (2, 3);
 Lisp_Object maybe_signal_continuable_ferror (Lisp_Object, Lisp_Object,
 					     Error_Behavior,
-					     const CBufbyte *, ...)
+					     const CIntbyte *, ...)
      PRINTF_ARGS (4, 5);
 
-Lisp_Object build_error_data (const CBufbyte *reason, Lisp_Object frob);
-DECLARE_DOESNT_RETURN (signal_error (Lisp_Object, const CBufbyte *,
+Lisp_Object build_error_data (const CIntbyte *reason, Lisp_Object frob);
+DECLARE_DOESNT_RETURN (signal_error (Lisp_Object, const CIntbyte *,
 				     Lisp_Object));
-void maybe_signal_error (Lisp_Object, const CBufbyte *, Lisp_Object,
+void maybe_signal_error (Lisp_Object, const CIntbyte *, Lisp_Object,
 			 Lisp_Object, Error_Behavior);
-Lisp_Object signal_continuable_error (Lisp_Object, const CBufbyte *,
+Lisp_Object signal_continuable_error (Lisp_Object, const CIntbyte *,
 				      Lisp_Object);
-Lisp_Object maybe_signal_continuable_error (Lisp_Object, const CBufbyte *,
+Lisp_Object maybe_signal_continuable_error (Lisp_Object, const CIntbyte *,
 					    Lisp_Object,
 					    Lisp_Object, Error_Behavior);
 DECLARE_DOESNT_RETURN_GCC_ATTRIBUTE_SYNTAX_SUCKS (signal_ferror_with_frob
 						  (Lisp_Object, Lisp_Object,
-						   const CBufbyte *,
+						   const CIntbyte *,
 						   ...), 3, 4);
 void maybe_signal_ferror_with_frob (Lisp_Object, Lisp_Object, Lisp_Object,
 				    Error_Behavior,
-				    const CBufbyte *, ...) PRINTF_ARGS (5, 6);
+				    const CIntbyte *, ...) PRINTF_ARGS (5, 6);
 Lisp_Object signal_continuable_ferror_with_frob (Lisp_Object, Lisp_Object,
-						 const CBufbyte *,
+						 const CIntbyte *,
 						 ...) PRINTF_ARGS (3, 4);
 Lisp_Object maybe_signal_continuable_ferror_with_frob (Lisp_Object,
 						       Lisp_Object,
 						       Lisp_Object,
 						       Error_Behavior,
-						       const CBufbyte *, ...)
+						       const CIntbyte *, ...)
      PRINTF_ARGS (5, 6);
-DECLARE_DOESNT_RETURN (signal_error_2 (Lisp_Object, const CBufbyte *,
+DECLARE_DOESNT_RETURN (signal_error_2 (Lisp_Object, const CIntbyte *,
 				       Lisp_Object, Lisp_Object));
-void maybe_signal_error_2 (Lisp_Object, const CBufbyte *, Lisp_Object,
+void maybe_signal_error_2 (Lisp_Object, const CIntbyte *, Lisp_Object,
 			   Lisp_Object, Lisp_Object, Error_Behavior);
-Lisp_Object signal_continuable_error_2 (Lisp_Object, const CBufbyte *,
+Lisp_Object signal_continuable_error_2 (Lisp_Object, const CIntbyte *,
 					Lisp_Object, Lisp_Object);
-Lisp_Object maybe_signal_continuable_error_2 (Lisp_Object, const CBufbyte *,
+Lisp_Object maybe_signal_continuable_error_2 (Lisp_Object, const CIntbyte *,
 					      Lisp_Object, Lisp_Object,
 					      Lisp_Object,
 					      Error_Behavior);
@@ -2547,60 +2543,60 @@
 DECLARE_DOESNT_RETURN (signal_circular_list_error (Lisp_Object));
 DECLARE_DOESNT_RETURN (signal_circular_property_list_error (Lisp_Object));
 
-DECLARE_DOESNT_RETURN (syntax_error (const CBufbyte *reason,
+DECLARE_DOESNT_RETURN (syntax_error (const CIntbyte *reason,
 				     Lisp_Object frob));
-DECLARE_DOESNT_RETURN (syntax_error_2 (const CBufbyte *reason,
+DECLARE_DOESNT_RETURN (syntax_error_2 (const CIntbyte *reason,
 				       Lisp_Object frob1,
 				       Lisp_Object frob2));
-void maybe_syntax_error (const CBufbyte *, Lisp_Object, Lisp_Object,
+void maybe_syntax_error (const CIntbyte *, Lisp_Object, Lisp_Object,
 			 Error_Behavior);
-DECLARE_DOESNT_RETURN (sferror (const CBufbyte *reason, Lisp_Object frob));
-DECLARE_DOESNT_RETURN (sferror_2 (const CBufbyte *reason, Lisp_Object frob1,
+DECLARE_DOESNT_RETURN (sferror (const CIntbyte *reason, Lisp_Object frob));
+DECLARE_DOESNT_RETURN (sferror_2 (const CIntbyte *reason, Lisp_Object frob1,
 				  Lisp_Object frob2));
-void maybe_sferror (const CBufbyte *, Lisp_Object, Lisp_Object,
+void maybe_sferror (const CIntbyte *, Lisp_Object, Lisp_Object,
 		    Error_Behavior);
-DECLARE_DOESNT_RETURN (invalid_argument (const CBufbyte *reason,
+DECLARE_DOESNT_RETURN (invalid_argument (const CIntbyte *reason,
 					 Lisp_Object frob));
-DECLARE_DOESNT_RETURN (invalid_argument_2 (const CBufbyte *reason,
+DECLARE_DOESNT_RETURN (invalid_argument_2 (const CIntbyte *reason,
 					   Lisp_Object frob1,
 					   Lisp_Object frob2));
-void maybe_invalid_argument (const CBufbyte *, Lisp_Object, Lisp_Object,
+void maybe_invalid_argument (const CIntbyte *, Lisp_Object, Lisp_Object,
 			     Error_Behavior);
-DECLARE_DOESNT_RETURN (invalid_operation (const CBufbyte *reason,
+DECLARE_DOESNT_RETURN (invalid_operation (const CIntbyte *reason,
 					 Lisp_Object frob));
-DECLARE_DOESNT_RETURN (invalid_operation_2 (const CBufbyte *reason,
+DECLARE_DOESNT_RETURN (invalid_operation_2 (const CIntbyte *reason,
 					   Lisp_Object frob1,
 					   Lisp_Object frob2));
-void maybe_invalid_operation (const CBufbyte *, Lisp_Object, Lisp_Object,
+void maybe_invalid_operation (const CIntbyte *, Lisp_Object, Lisp_Object,
 			     Error_Behavior);
-DECLARE_DOESNT_RETURN (invalid_state (const CBufbyte *reason,
+DECLARE_DOESNT_RETURN (invalid_state (const CIntbyte *reason,
 					 Lisp_Object frob));
-DECLARE_DOESNT_RETURN (invalid_state_2 (const CBufbyte *reason,
+DECLARE_DOESNT_RETURN (invalid_state_2 (const CIntbyte *reason,
 					   Lisp_Object frob1,
 					   Lisp_Object frob2));
-void maybe_invalid_state (const CBufbyte *, Lisp_Object, Lisp_Object,
+void maybe_invalid_state (const CIntbyte *, Lisp_Object, Lisp_Object,
 			  Error_Behavior);
-DECLARE_DOESNT_RETURN (invalid_change (const CBufbyte *reason,
+DECLARE_DOESNT_RETURN (invalid_change (const CIntbyte *reason,
 					 Lisp_Object frob));
-DECLARE_DOESNT_RETURN (invalid_change_2 (const CBufbyte *reason,
+DECLARE_DOESNT_RETURN (invalid_change_2 (const CIntbyte *reason,
 					   Lisp_Object frob1,
 					   Lisp_Object frob2));
-void maybe_invalid_change (const CBufbyte *, Lisp_Object, Lisp_Object,
+void maybe_invalid_change (const CIntbyte *, Lisp_Object, Lisp_Object,
 			   Error_Behavior);
-DECLARE_DOESNT_RETURN (invalid_constant (const CBufbyte *reason,
+DECLARE_DOESNT_RETURN (invalid_constant (const CIntbyte *reason,
 					 Lisp_Object frob));
-DECLARE_DOESNT_RETURN (invalid_constant_2 (const CBufbyte *reason,
+DECLARE_DOESNT_RETURN (invalid_constant_2 (const CIntbyte *reason,
 					   Lisp_Object frob1,
 					   Lisp_Object frob2));
-void maybe_invalid_constant (const CBufbyte *, Lisp_Object, Lisp_Object,
+void maybe_invalid_constant (const CIntbyte *, Lisp_Object, Lisp_Object,
 			     Error_Behavior);
-DECLARE_DOESNT_RETURN (wtaerror (const CBufbyte *reason, Lisp_Object frob));
-DECLARE_DOESNT_RETURN (out_of_memory (const CBufbyte *reason,
+DECLARE_DOESNT_RETURN (wtaerror (const CIntbyte *reason, Lisp_Object frob));
+DECLARE_DOESNT_RETURN (out_of_memory (const CIntbyte *reason,
 				      Lisp_Object frob));
-DECLARE_DOESNT_RETURN (stack_overflow (const CBufbyte *reason,
+DECLARE_DOESNT_RETURN (stack_overflow (const CIntbyte *reason,
 				       Lisp_Object frob));
 DECLARE_DOESNT_RETURN_GCC_ATTRIBUTE_SYNTAX_SUCKS (printing_unreadable_object
-						  (const CBufbyte *,
+						  (const CIntbyte *,
 						   ...), 1, 2);
 
 Lisp_Object signal_void_function_error (Lisp_Object);
@@ -2646,13 +2642,13 @@
 Lisp_Object eval_in_buffer (struct buffer *, Lisp_Object);
 Lisp_Object call0_with_handler (Lisp_Object, Lisp_Object);
 Lisp_Object call1_with_handler (Lisp_Object, Lisp_Object, Lisp_Object);
-Lisp_Object eval_in_buffer_trapping_errors (const CBufbyte *, struct buffer *,
+Lisp_Object eval_in_buffer_trapping_errors (const CIntbyte *, struct buffer *,
 					    Lisp_Object);
-Lisp_Object run_hook_trapping_errors (const CBufbyte *, Lisp_Object);
-Lisp_Object safe_run_hook_trapping_errors (const CBufbyte *, Lisp_Object, int);
-Lisp_Object call0_trapping_errors (const CBufbyte *, Lisp_Object);
-Lisp_Object call1_trapping_errors (const CBufbyte *, Lisp_Object, Lisp_Object);
-Lisp_Object call2_trapping_errors (const CBufbyte *,
+Lisp_Object run_hook_trapping_errors (const CIntbyte *, Lisp_Object);
+Lisp_Object safe_run_hook_trapping_errors (const CIntbyte *, Lisp_Object, int);
+Lisp_Object call0_trapping_errors (const CIntbyte *, Lisp_Object);
+Lisp_Object call1_trapping_errors (const CIntbyte *, Lisp_Object, Lisp_Object);
+Lisp_Object call2_trapping_errors (const CIntbyte *,
 				   Lisp_Object, Lisp_Object, Lisp_Object);
 Lisp_Object call_with_suspended_errors (lisp_fn_t, volatile Lisp_Object, Lisp_Object,
 					Error_Behavior, int, ...);
@@ -2671,7 +2667,7 @@
 void do_autoload (Lisp_Object, Lisp_Object);
 Lisp_Object un_autoload (Lisp_Object);
 void warn_when_safe_lispobj (Lisp_Object, Lisp_Object, Lisp_Object);
-void warn_when_safe (Lisp_Object, Lisp_Object, const CBufbyte *,
+void warn_when_safe (Lisp_Object, Lisp_Object, const CIntbyte *,
 		     ...) PRINTF_ARGS (3, 4);
 
 
@@ -2697,18 +2693,18 @@
 void record_auto_save (void);
 void force_auto_save_soon (void);
 DECLARE_DOESNT_RETURN (report_error_with_errno (Lisp_Object errtype,
-						const CBufbyte *string,
+						const CIntbyte *string,
 						Lisp_Object data));
 DECLARE_DOESNT_RETURN (report_file_type_error (Lisp_Object errtype,
 					       Lisp_Object oserrmess,
-					       const CBufbyte *string,
+					       const CIntbyte *string,
 					       Lisp_Object data));
-DECLARE_DOESNT_RETURN (report_file_error (const CBufbyte *, Lisp_Object));
+DECLARE_DOESNT_RETURN (report_file_error (const CIntbyte *, Lisp_Object));
 Lisp_Object lisp_strerror (int);
 Lisp_Object expand_and_dir_to_file (Lisp_Object, Lisp_Object);
-Memory_Count read_allowing_quit (int fildes, void *buf, Memory_Count size);
-Memory_Count write_allowing_quit (int fildes, const void *buf,
-				  Memory_Count size);
+Bytecount read_allowing_quit (int fildes, void *buf, Bytecount size);
+Bytecount write_allowing_quit (int fildes, const void *buf,
+				  Bytecount size);
 int internal_delete_file (Lisp_Object);
 
 /* Defined in filelock.c */
@@ -2775,13 +2771,13 @@
 DECLARE_DOESNT_RETURN (gui_error_2 (const char *reason,
 				    Lisp_Object frob0, Lisp_Object frob1));
 /* Defined in indent.c */
-int bi_spaces_at_point (struct buffer *, Bytind);
-int column_at_point (struct buffer *, Bufpos, int);
-int string_column_at_point (Lisp_String *, Bufpos, int);
+int bi_spaces_at_point (struct buffer *, Bytebpos);
+int column_at_point (struct buffer *, Charbpos, int);
+int string_column_at_point (Lisp_String *, Charbpos, int);
 int current_column (struct buffer *);
 void invalidate_current_column (void);
-Bufpos vmotion (struct window *, Bufpos, int, int *);
-Bufpos vmotion_pixels (Lisp_Object, Bufpos, int, int, int *);
+Charbpos vmotion (struct window *, Charbpos, int, int *);
+Charbpos vmotion_pixels (Lisp_Object, Charbpos, int, int, int *);
 
 /* Defined in keymap.c */
 void where_is_to_char (Lisp_Object, char *);
@@ -2810,10 +2806,10 @@
 #endif /*! LOADHIST */
 
 /* Defined in marker.c */
-Bytind bi_marker_position (Lisp_Object);
-Bufpos marker_position (Lisp_Object);
-void set_bi_marker_position (Lisp_Object, Bytind);
-void set_marker_position (Lisp_Object, Bufpos);
+Bytebpos bi_marker_position (Lisp_Object);
+Charbpos marker_position (Lisp_Object);
+void set_bi_marker_position (Lisp_Object, Bytebpos);
+void set_marker_position (Lisp_Object, Charbpos);
 void unchain_marker (Lisp_Object);
 Lisp_Object noseeum_copy_marker (Lisp_Object, Lisp_Object);
 Lisp_Object set_marker_restricted (Lisp_Object, Lisp_Object, Lisp_Object);
@@ -2828,22 +2824,22 @@
 
 /* Defined in minibuf.c */
 extern int minibuf_level;
-Charcount scmp_1 (const Bufbyte *, const Bufbyte *, Charcount, int);
+Charcount scmp_1 (const Intbyte *, const Intbyte *, Charcount, int);
 #define scmp(s1, s2, len) scmp_1 (s1, s2, len, completion_ignore_case)
 extern int completion_ignore_case;
-int regexp_ignore_completion_p (const Bufbyte *, Lisp_Object,
+int regexp_ignore_completion_p (const Intbyte *, Lisp_Object,
 				Bytecount, Bytecount);
 Lisp_Object clear_echo_area (struct frame *, Lisp_Object, int);
 Lisp_Object clear_echo_area_from_print (struct frame *, Lisp_Object, int);
-void echo_area_append (struct frame *, const Bufbyte *, Lisp_Object,
+void echo_area_append (struct frame *, const Intbyte *, Lisp_Object,
 		       Bytecount, Bytecount, Lisp_Object);
-void echo_area_message (struct frame *, const Bufbyte *, Lisp_Object,
+void echo_area_message (struct frame *, const Intbyte *, Lisp_Object,
 			Bytecount, Bytecount, Lisp_Object);
 Lisp_Object echo_area_status (struct frame *);
 int echo_area_active (struct frame *);
 Lisp_Object echo_area_contents (struct frame *);
-void message_internal (const Bufbyte *, Lisp_Object, Bytecount, Bytecount);
-void message_append_internal (const Bufbyte *, Lisp_Object,
+void message_internal (const Intbyte *, Lisp_Object, Bytecount, Bytecount);
+void message_append_internal (const Intbyte *, Lisp_Object,
 			      Bytecount, Bytecount);
 void message (const char *, ...) PRINTF_ARGS (1, 2);
 void message_append (const char *, ...) PRINTF_ARGS (1, 2);
@@ -2852,7 +2848,7 @@
 
 /* Defined in print.c */
 void write_string_to_stdio_stream (FILE *, struct console *,
-				   const Bufbyte *, Bytecount, Bytecount,
+				   const Intbyte *, Bytecount, Bytecount,
 				   Lisp_Object, int);
 void debug_print (Lisp_Object);
 void debug_short_backtrace (int);
@@ -2863,7 +2859,7 @@
  *  (eg Qnil means stdout, not Vstandard_output, etc) */
 void write_c_string (const char *, Lisp_Object);
 /* Same goes for this function. */
-void write_string_1 (const Bufbyte *, Bytecount, Lisp_Object);
+void write_string_1 (const Intbyte *, Bytecount, Lisp_Object);
 void print_cons (Lisp_Object, Lisp_Object, int);
 void print_vector (Lisp_Object, Lisp_Object, int);
 void print_string (Lisp_Object, Lisp_Object, int);
@@ -2914,15 +2910,15 @@
 /* Defined in search.c */
 struct re_pattern_buffer;
 struct re_registers;
-Bufpos scan_buffer (struct buffer *, Emchar, Bufpos, Bufpos, EMACS_INT, EMACS_INT *, int);
-Bufpos find_next_newline (struct buffer *, Bufpos, int);
-Bufpos find_next_newline_no_quit (struct buffer *, Bufpos, int);
-Bytind bi_find_next_newline_no_quit (struct buffer *, Bytind, int);
-Bytind bi_find_next_emchar_in_string (Lisp_String*, Emchar, Bytind, EMACS_INT);
-Bufpos find_before_next_newline (struct buffer *, Bufpos, Bufpos, int);
+Charbpos scan_buffer (struct buffer *, Emchar, Charbpos, Charbpos, EMACS_INT, EMACS_INT *, int);
+Charbpos find_next_newline (struct buffer *, Charbpos, int);
+Charbpos find_next_newline_no_quit (struct buffer *, Charbpos, int);
+Bytebpos bi_find_next_newline_no_quit (struct buffer *, Bytebpos, int);
+Bytebpos bi_find_next_emchar_in_string (Lisp_String*, Emchar, Bytebpos, EMACS_INT);
+Charbpos find_before_next_newline (struct buffer *, Charbpos, Charbpos, int);
 struct re_pattern_buffer *compile_pattern (Lisp_Object, struct re_registers *,
 					   Lisp_Object, int, Error_Behavior);
-Bytecount fast_string_match (Lisp_Object,  const Bufbyte *,
+Bytecount fast_string_match (Lisp_Object,  const Intbyte *,
 			     Lisp_Object, Bytecount,
 			     Bytecount, int, Error_Behavior, int);
 Bytecount fast_lisp_string_match (Lisp_Object, Lisp_Object);
@@ -2947,9 +2943,9 @@
 					Error_Behavior, int, Lisp_Object);
 
 /* Defined in symbols.c */
-unsigned int hash_string (const Bufbyte *, Bytecount);
+unsigned int hash_string (const Intbyte *, Bytecount);
 Lisp_Object intern (const char *);
-Lisp_Object oblookup (Lisp_Object, const Bufbyte *, Bytecount);
+Lisp_Object oblookup (Lisp_Object, const Intbyte *, Bytecount);
 void map_obarray (Lisp_Object, int (*) (Lisp_Object, void *), void *);
 Lisp_Object indirect_function (Lisp_Object, int);
 Lisp_Object symbol_value_in_buffer (Lisp_Object, Lisp_Object);
@@ -2963,14 +2959,14 @@
 			      Lisp_Object follow_past_lisp_magic);
 
 /* Defined in syntax.c */
-Bufpos scan_words (struct buffer *, Bufpos, int);
+Charbpos scan_words (struct buffer *, Charbpos, int);
 
 /* Defined in undo.c */
 Lisp_Object truncate_undo_list (Lisp_Object, int, int);
 void record_extent (Lisp_Object, int);
-void record_insert (struct buffer *, Bufpos, Charcount);
-void record_delete (struct buffer *, Bufpos, Charcount);
-void record_change (struct buffer *, Bufpos, Charcount);
+void record_insert (struct buffer *, Charbpos, Charcount);
+void record_delete (struct buffer *, Charbpos, Charcount);
+void record_change (struct buffer *, Charbpos, Charcount);
 
 /* Defined in unex*.c */
 int unexec (char *, char *, uintptr_t, uintptr_t, uintptr_t);
--- a/src/lread.c	Tue Sep 18 05:06:57 2001 +0000
+++ b/src/lread.c	Thu Sep 20 06:31:11 2001 +0000
@@ -268,7 +268,7 @@
   else if (MARKERP (readcharfun))
     {
       Emchar c;
-      Bufpos mpos = marker_position (readcharfun);
+      Charbpos mpos = marker_position (readcharfun);
       struct buffer *inbuffer = XMARKER (readcharfun)->buffer;
 
       if (mpos >= BUF_ZV (inbuffer))
@@ -626,7 +626,7 @@
 	      if (result >= 0 &&
 		  (unsigned) s1.st_mtime < (unsigned) s2.st_mtime)
               {
-		Lisp_Object newer_name = make_string ((Bufbyte *) foundstr,
+		Lisp_Object newer_name = make_string ((Intbyte *) foundstr,
 						      foundlen - 1);
                 struct gcpro nngcpro1;
                 NNGCPRO1 (newer_name);
@@ -1868,7 +1868,7 @@
   return Lstream_byte_count (XLSTREAM (Vread_buffer_stream)) - 1;
 }
 
-static Lisp_Object parse_integer (const Bufbyte *buf, Bytecount len, int base);
+static Lisp_Object parse_integer (const Intbyte *buf, Bytecount len, int base);
 
 static Lisp_Object
 read_atom (Lisp_Object readcharfun,
@@ -1923,7 +1923,7 @@
 		return make_int (number);
 	      }
 #else
-              return parse_integer ((Bufbyte *) read_ptr, len, 10);
+              return parse_integer ((Intbyte *) read_ptr, len, 10);
 #endif
 	    }
 	}
@@ -1936,10 +1936,10 @@
   {
     Lisp_Object sym;
     if (uninterned_symbol)
-      sym = Fmake_symbol ( make_string ((Bufbyte *) read_ptr, len));
+      sym = Fmake_symbol ( make_string ((Intbyte *) read_ptr, len));
     else
       {
-	Lisp_Object name = make_string ((Bufbyte *) read_ptr, len);
+	Lisp_Object name = make_string ((Intbyte *) read_ptr, len);
 	sym = Fintern (name, Qnil);
       }
     return sym;
@@ -1948,10 +1948,10 @@
 
 
 static Lisp_Object
-parse_integer (const Bufbyte *buf, Bytecount len, int base)
+parse_integer (const Intbyte *buf, Bytecount len, int base)
 {
-  const Bufbyte *lim = buf + len;
-  const Bufbyte *p = buf;
+  const Intbyte *lim = buf + len;
+  const Intbyte *p = buf;
   EMACS_UINT num = 0;
   int negativland = 0;
 
@@ -2701,7 +2701,7 @@
 isfloat_string (const char *cp)
 {
   int state = 0;
-  const Bufbyte *ucp = (const Bufbyte *) cp;
+  const Intbyte *ucp = (const Intbyte *) cp;
 
   if (*ucp == '+' || *ucp == '-')
     ucp++;
--- a/src/lrecord.h	Tue Sep 18 05:06:57 2001 +0000
+++ b/src/lrecord.h	Thu Sep 20 06:31:11 2001 +0000
@@ -256,8 +256,8 @@
 
   /* Only one of `static_size' and `size_in_bytes_method' is non-0.
      If both are 0, this type is not instantiable by alloc_lcrecord(). */
-  Memory_Count static_size;
-  Memory_Count (*size_in_bytes_method) (const void *header);
+  Bytecount static_size;
+  Bytecount (*size_in_bytes_method) (const void *header);
 
   /* The (constant) index into lrecord_implementations_table */
   enum lrecord_type lrecord_type_index;
@@ -359,15 +359,18 @@
     XD_INT_RESET
   An integer which will be reset to a given value in the dump file.
 
-
-    XD_ELEMENT_COUNT
-  Element_Count value.  Used for counts.
+  
+    XD_CHARCOUNT
+  Charcount value.  Used for counts.
+  
+    XD_ELEMCOUNT
+  Elemcount value.  Used for counts.
 
-    XD_MEMORY_COUNT
-  Memory_Count value.  Used for counts.
+    XD_BYTECOUNT
+  Bytecount value.  Used for counts.
 
-    XD_HASH_CODE
-  Hash_Code value.  Used for the results of hashing functions.
+    XD_HASHCODE
+  Hashcode value.  Used for the results of hashing functions.
 
     XD_INT
   int value.  Used for counts.
@@ -375,9 +378,6 @@
     XD_LONG
   long value.  Used for counts.
 
-    XD_BYTECOUNT
-  bytecount value.  Used for counts.
-
     XD_END
   Special type indicating the end of the array.
 
@@ -404,12 +404,12 @@
   XD_C_STRING,
   XD_DOC_STRING,
   XD_INT_RESET,
-  XD_MEMORY_COUNT,
-  XD_ELEMENT_COUNT,
-  XD_HASH_CODE,
+  XD_CHARCOUNT,
+  XD_BYTECOUNT,
+  XD_ELEMCOUNT,
+  XD_HASHCODE,
   XD_INT,
   XD_LONG,
-  XD_BYTECOUNT,
   XD_END,
   XD_SPECIFIER_END
 };
@@ -424,7 +424,7 @@
 
 struct struct_description
 {
-  Memory_Count size;
+  Bytecount size;
   const struct lrecord_description *description;
 };
 
@@ -778,7 +778,7 @@
    dead_wrong_type_argument (predicate, x);		\
  } while (0)
 
-void *alloc_lcrecord (Memory_Count size,
+void *alloc_lcrecord (Bytecount size,
 		      const struct lrecord_implementation *);
 
 #define alloc_lcrecord_type(type, lrecord_implementation) \
--- a/src/lstream.c	Tue Sep 18 05:06:57 2001 +0000
+++ b/src/lstream.c	Thu Sep 20 06:31:11 2001 +0000
@@ -95,19 +95,19 @@
 void Lstream_fungetc (Lstream *stream, int c)
 	Function equivalents of the above macros.
 
-Lstream_Data_Count Lstream_read (Lstream *stream, void *data,
-                                 Lstream_Data_Count size)
+Bytecount Lstream_read (Lstream *stream, void *data,
+                                 Bytecount size)
 	Read SIZE bytes of DATA from the stream.  Return the number of
 	bytes read.  0 means EOF. -1 means an error occurred and no
 	bytes were read.
 
-Lstream_Data_Count Lstream_write (Lstream *stream, void *data,
-                                  Lstream_Data_Count size)
+Bytecount Lstream_write (Lstream *stream, void *data,
+                                  Bytecount size)
 	Write SIZE bytes of DATA to the stream.  Return the number of
 	bytes written.  -1 means an error occurred and no bytes were
 	written.
 
-void Lstream_unread (Lstream *stream, void *data, Lstream_Data_Count size)
+void Lstream_unread (Lstream *stream, void *data, Bytecount size)
 	Push back SIZE bytes of DATA onto the input queue.  The
 	next call to Lstream_read() with the same size will read the
 	same bytes back.  Note that this will be the case even if
@@ -181,14 +181,14 @@
     }
 }
 
-inline static Memory_Count
-aligned_sizeof_lstream (Memory_Count lstream_type_specific_size)
+inline static Bytecount
+aligned_sizeof_lstream (Bytecount lstream_type_specific_size)
 {
   return ALIGN_SIZE (offsetof (Lstream, data) + lstream_type_specific_size,
 		     ALIGNOF (max_align_t));
 }
 
-static Memory_Count
+static Bytecount
 sizeof_lstream (const void *header)
 {
   return aligned_sizeof_lstream (((const Lstream *) header)->imp->size);
@@ -303,11 +303,11 @@
 int
 Lstream_flush_out (Lstream *lstr)
 {
-  Lstream_Data_Count num_written;
+  Bytecount num_written;
 
   while (lstr->out_buffer_ind > 0)
     {
-      Lstream_Data_Count size = lstr->out_buffer_ind;
+      Bytecount size = lstr->out_buffer_ind;
       if (! (lstr->flags & LSTREAM_FL_IS_OPEN))
 	Lstream_internal_error ("lstream not open", lstr);
       if (! (lstr->flags & LSTREAM_FL_WRITE))
@@ -390,10 +390,10 @@
    if it's getting EWOULDBLOCK errors.   We have to keep stocking them
    up until they can be written, so as to avoid losing data. */
 
-static Lstream_Data_Count
-Lstream_adding (Lstream *lstr, Lstream_Data_Count num, int force)
+static Bytecount
+Lstream_adding (Lstream *lstr, Bytecount num, int force)
 {
-  Lstream_Data_Count size = num + lstr->out_buffer_ind;
+  Bytecount size = num + lstr->out_buffer_ind;
 
   if (size <= lstr->out_buffer_size)
     return num;
@@ -415,11 +415,11 @@
 
 /* Like Lstream_write(), but does not handle line-buffering correctly. */
 
-static Lstream_Data_Count
-Lstream_write_1 (Lstream *lstr, const void *data, Lstream_Data_Count size)
+static Bytecount
+Lstream_write_1 (Lstream *lstr, const void *data, Bytecount size)
 {
   const unsigned char *p = (const unsigned char *) data;
-  Lstream_Data_Count off = 0;
+  Bytecount off = 0;
   if (! (lstr->flags & LSTREAM_FL_IS_OPEN))
     Lstream_internal_error ("lstream not open", lstr);
   if (! (lstr->flags & LSTREAM_FL_WRITE))
@@ -430,7 +430,7 @@
     while (1)
       {
 	/* Figure out how much we can add to the buffer */
-	Lstream_Data_Count chunk = Lstream_adding (lstr, size, 0);
+	Bytecount chunk = Lstream_adding (lstr, size, 0);
 	if (chunk == 0)
 	  {
 	    if (couldnt_write_last_time)
@@ -475,10 +475,10 @@
    repeatedly call Lstream_putc(), which knows how to handle
    line buffering.  Returns number of bytes written. */
 
-Lstream_Data_Count
-Lstream_write (Lstream *lstr, const void *data, Lstream_Data_Count size)
+Bytecount
+Lstream_write (Lstream *lstr, const void *data, Bytecount size)
 {
-  Lstream_Data_Count i;
+  Bytecount i;
   const unsigned char *p = (const unsigned char *) data;
 
   if (size == 0)
@@ -499,9 +499,9 @@
   return lstr->imp->was_blocked_p ? lstr->imp->was_blocked_p (lstr) : 0;
 }
 
-static Lstream_Data_Count
+static Bytecount
 Lstream_raw_read (Lstream *lstr, unsigned char *buffer,
-		  Lstream_Data_Count size)
+		  Bytecount size)
 {
   if (! (lstr->flags & LSTREAM_FL_IS_OPEN))
     Lstream_internal_error ("lstream not open", lstr);
@@ -515,18 +515,18 @@
 
 /* Assuming the buffer is empty, fill it up again. */
 
-static Lstream_Data_Count
+static Bytecount
 Lstream_read_more (Lstream *lstr)
 {
 #if 0
-  Lstream_Data_Count size_needed 
+  Bytecount size_needed 
     = max (1, min (MAX_READ_SIZE, lstr->buffering_size));
 #else
   /* If someone requested a larger buffer size, so be it! */
-  Lstream_Data_Count size_needed =
+  Bytecount size_needed =
     max (1, lstr->buffering_size);
 #endif
-  Lstream_Data_Count size_gotten;
+  Bytecount size_gotten;
 
   DO_REALLOC (lstr->in_buffer, lstr->in_buffer_size,
 	      size_needed, unsigned char);
@@ -536,12 +536,12 @@
   return size_gotten < 0 ? -1 : size_gotten;
 }
 
-Lstream_Data_Count
-Lstream_read (Lstream *lstr, void *data, Lstream_Data_Count size)
+Bytecount
+Lstream_read (Lstream *lstr, void *data, Bytecount size)
 {
   unsigned char *p = (unsigned char *) data;
-  Lstream_Data_Count off = 0;
-  Lstream_Data_Count chunk;
+  Bytecount off = 0;
+  Bytecount chunk;
   int error_occurred = 0;
 
   if (size == 0)
@@ -574,7 +574,7 @@
       /* If we need some more, try to get some more from the stream's end */
       if (size > 0)
 	{
-	  Lstream_Data_Count retval = Lstream_read_more (lstr);
+	  Bytecount retval = Lstream_read_more (lstr);
 	  if (retval < 0)
 	    error_occurred = 1;
 	  if (retval <= 0)
@@ -598,7 +598,7 @@
 	  VALIDATE_CHARPTR_BACKWARD (dataend);
 	  if (dataend + REP_BYTES_BY_FIRST_BYTE (*dataend) != p + off)
 	    {
-	      Lstream_Data_Count newoff = dataend - p;
+	      Bytecount newoff = dataend - p;
 	      /* If not, chop the size down to ignore the last char
 		 and stash it away for next time. */
 	      Lstream_unread (lstr, dataend, off - newoff);
@@ -611,7 +611,7 @@
 }
 
 void
-Lstream_unread (Lstream *lstr, const void *data, Lstream_Data_Count size)
+Lstream_unread (Lstream *lstr, const void *data, Bytecount size)
 {
   const unsigned char *p = (const unsigned char *) data;
 
@@ -730,7 +730,7 @@
 Lstream_fputc (Lstream *lstr, int c)
 {
   unsigned char ch = (unsigned char) c;
-  Lstream_Data_Count retval = Lstream_write_1 (lstr, &ch, 1);
+  Bytecount retval = Lstream_write_1 (lstr, &ch, 1);
   if (retval >= 0 && lstr->buffering == LSTREAM_LINE_BUFFERED && ch == '\n')
     return Lstream_flush_out (lstr);
   return retval < 0 ? -1 : 0;
@@ -811,22 +811,22 @@
    code (it could even be argued that the error might have fixed
    itself, so we should do the fread() again.  */
 
-static Lstream_Data_Count
-stdio_reader (Lstream *stream, unsigned char *data, Lstream_Data_Count size)
+static Bytecount
+stdio_reader (Lstream *stream, unsigned char *data, Bytecount size)
 {
   struct stdio_stream *str = STDIO_STREAM_DATA (stream);
-  Lstream_Data_Count val = fread (data, 1, size, str->file);
+  Bytecount val = fread (data, 1, size, str->file);
   if (!val && ferror (str->file))
     return -1;
   return val;
 }
 
-static Lstream_Data_Count
+static Bytecount
 stdio_writer (Lstream *stream, const unsigned char *data,
-	      Lstream_Data_Count size)
+	      Bytecount size)
 {
   struct stdio_stream *str = STDIO_STREAM_DATA (stream);
-  Lstream_Data_Count val = fwrite (data, 1, size, str->file);
+  Bytecount val = fwrite (data, 1, size, str->file);
   if (!val && ferror (str->file))
     return -1;
   return val;
@@ -879,7 +879,7 @@
 {
   int fd;
   int pty_max_bytes;
-  Bufbyte eof_char;
+  Intbyte eof_char;
   int starting_pos;
   int current_pos;
   int end_pos;
@@ -937,13 +937,13 @@
   return make_filedesc_stream_1 (filedesc, offset, count, flags, "w");
 }
 
-static Lstream_Data_Count
-filedesc_reader (Lstream *stream, unsigned char *data, Lstream_Data_Count size)
+static Bytecount
+filedesc_reader (Lstream *stream, unsigned char *data, Bytecount size)
 {
-  Lstream_Data_Count nread;
+  Bytecount nread;
   struct filedesc_stream *str = FILEDESC_STREAM_DATA (stream);
   if (str->end_pos >= 0)
-    size = min (size, (Lstream_Data_Count) (str->end_pos - str->current_pos));
+    size = min (size, (Bytecount) (str->end_pos - str->current_pos));
   nread = str->allow_quit ?
     read_allowing_quit (str->fd, data, size) :
     read (str->fd, data, size);
@@ -966,12 +966,12 @@
   return 0;
 }
 
-static Lstream_Data_Count
+static Bytecount
 filedesc_writer (Lstream *stream, const unsigned char *data,
-		 Lstream_Data_Count size)
+		 Bytecount size)
 {
   struct filedesc_stream *str = FILEDESC_STREAM_DATA (stream);
-  Lstream_Data_Count retval;
+  Bytecount retval;
   int need_newline = 0;
 
   /* This function would be simple if it were not for the blasted
@@ -1025,7 +1025,7 @@
 	 out for EWOULDBLOCK. */
       if (str->chars_sans_newline >= str->pty_max_bytes)
 	{
-	  Lstream_Data_Count retval2 = str->allow_quit ?
+	  Bytecount retval2 = str->allow_quit ?
 	    write_allowing_quit (str->fd, &str->eof_char, 1) :
 	    write (str->fd, &str->eof_char, 1);
 
@@ -1057,8 +1057,8 @@
      in pty-flushing mode. */
   if (need_newline)
     {
-      Bufbyte nl = '\n';
-      Lstream_Data_Count retval2 = str->allow_quit ?
+      Intbyte nl = '\n';
+      Bytecount retval2 = str->allow_quit ?
 	write_allowing_quit (str->fd, &nl, 1) :
 	write (str->fd, &nl, 1);
 
@@ -1140,7 +1140,7 @@
 
 void
 filedesc_stream_set_pty_flushing (Lstream *stream, int pty_max_bytes,
-				  Bufbyte eof_char)
+				  Intbyte eof_char)
 {
   struct filedesc_stream *str = FILEDESC_STREAM_DATA (stream);
   str->pty_max_bytes = pty_max_bytes;
@@ -1194,15 +1194,15 @@
   return obj;
 }
 
-static Lstream_Data_Count
+static Bytecount
 lisp_string_reader (Lstream *stream, unsigned char *data,
-		    Lstream_Data_Count size)
+		    Bytecount size)
 {
   struct lisp_string_stream *str = LISP_STRING_STREAM_DATA (stream);
   /* Don't lose if the string shrank past us ... */
   Bytecount offset = min (str->offset, XSTRING_LENGTH (str->obj));
-  Bufbyte *strstart = XSTRING_DATA (str->obj);
-  Bufbyte *start = strstart + offset;
+  Intbyte *strstart = XSTRING_DATA (str->obj);
+  Intbyte *start = strstart + offset;
 
   /* ... or if someone changed the string and we ended up in the
      middle of a character. */
@@ -1211,7 +1211,7 @@
   if (stream->flags & LSTREAM_FL_NO_PARTIAL_CHARS)
     VALIDATE_CHARPTR_BACKWARD (start);
   offset = start - strstart;
-  size = min (size, (Lstream_Data_Count) (str->end - offset));
+  size = min (size, (Bytecount) (str->end - offset));
   memcpy (data, start, size);
   str->offset = offset + size;
   return size;
@@ -1229,8 +1229,8 @@
   /* ... or if someone changed the string and we ended up in the
      middle of a character. */
   {
-    Bufbyte *strstart = XSTRING_DATA (str->obj);
-    Bufbyte *start = strstart + pos;
+    Intbyte *strstart = XSTRING_DATA (str->obj);
+    Intbyte *start = strstart + pos;
     VALIDATE_CHARPTR_BACKWARD (start);
     pos = start - strstart;
   }
@@ -1254,15 +1254,15 @@
 {
   const unsigned char *inbuf;
   unsigned char *outbuf;
-  Lstream_Data_Count size;
-  Lstream_Data_Count offset;
+  Bytecount size;
+  Bytecount offset;
 };
 
 DEFINE_LSTREAM_IMPLEMENTATION ("fixed-buffer", lstream_fixed_buffer,
 			       sizeof (struct fixed_buffer_stream));
 
 Lisp_Object
-make_fixed_buffer_input_stream (const void *buf, Lstream_Data_Count size)
+make_fixed_buffer_input_stream (const void *buf, Bytecount size)
 {
   Lisp_Object obj;
   Lstream *lstr = Lstream_new (lstream_fixed_buffer, "r");
@@ -1274,7 +1274,7 @@
 }
 
 Lisp_Object
-make_fixed_buffer_output_stream (void *buf, Lstream_Data_Count size)
+make_fixed_buffer_output_stream (void *buf, Bytecount size)
 {
   Lisp_Object obj;
   Lstream *lstr = Lstream_new (lstream_fixed_buffer, "w");
@@ -1285,9 +1285,9 @@
   return obj;
 }
 
-static Lstream_Data_Count
+static Bytecount
 fixed_buffer_reader (Lstream *stream, unsigned char *data,
-		     Lstream_Data_Count size)
+		     Bytecount size)
 {
   struct fixed_buffer_stream *str = FIXED_BUFFER_STREAM_DATA (stream);
   size = min (size, str->size - str->offset);
@@ -1296,9 +1296,9 @@
   return size;
 }
 
-static Lstream_Data_Count
+static Bytecount
 fixed_buffer_writer (Lstream *stream, const unsigned char *data,
-		     Lstream_Data_Count size)
+		     Bytecount size)
 {
   struct fixed_buffer_stream *str = FIXED_BUFFER_STREAM_DATA (stream);
   if (str->offset == str->size)
@@ -1343,7 +1343,7 @@
 struct resizing_buffer_stream
 {
   unsigned char *buf;
-  Lstream_Data_Count allocked;
+  Bytecount allocked;
   int max_stored;
   int stored;
 };
@@ -1359,9 +1359,9 @@
   return obj;
 }
 
-static Lstream_Data_Count
+static Bytecount
 resizing_buffer_writer (Lstream *stream, const unsigned char *data,
-			Lstream_Data_Count size)
+			Bytecount size)
 {
   struct resizing_buffer_stream *str = RESIZING_BUFFER_STREAM_DATA (stream);
   DO_REALLOC (str->buf, str->allocked, str->stored + size, unsigned char);
@@ -1400,7 +1400,7 @@
 
 /* Note: If you have a dynarr whose type is not unsigned_char_dynarr
    but which is really just an unsigned_char_dynarr (e.g. its type
-   is Bufbyte or Extbyte), just cast to unsigned_char_dynarr. */
+   is Intbyte or Extbyte), just cast to unsigned_char_dynarr. */
 
 #define DYNARR_STREAM_DATA(stream) \
   LSTREAM_TYPE_DATA (stream, dynarr)
@@ -1422,9 +1422,9 @@
   return obj;
 }
 
-static Lstream_Data_Count
+static Bytecount
 dynarr_writer (Lstream *stream, const unsigned char *data,
-	       Lstream_Data_Count size)
+	       Bytecount size)
 {
   struct dynarr_stream *str = DYNARR_STREAM_DATA (stream);
   Dynarr_add_many (str->dyn, data, size);
@@ -1466,13 +1466,13 @@
 			       sizeof (struct lisp_buffer_stream));
 
 static Lisp_Object
-make_lisp_buffer_stream_1 (struct buffer *buf, Bufpos start, Bufpos end,
+make_lisp_buffer_stream_1 (struct buffer *buf, Charbpos start, Charbpos end,
 			   int flags, const char *mode)
 {
   Lisp_Object obj;
   Lstream *lstr;
   struct lisp_buffer_stream *str;
-  Bufpos bmin, bmax;
+  Charbpos bmin, bmax;
   int reading = !strcmp (mode, "r");
 
   /* Make sure the luser didn't pass "w" in. */
@@ -1532,14 +1532,14 @@
 }
 
 Lisp_Object
-make_lisp_buffer_input_stream (struct buffer *buf, Bufpos start, Bufpos end,
+make_lisp_buffer_input_stream (struct buffer *buf, Charbpos start, Charbpos end,
 			       int flags)
 {
   return make_lisp_buffer_stream_1 (buf, start, end, flags, "r");
 }
 
 Lisp_Object
-make_lisp_buffer_output_stream (struct buffer *buf, Bufpos pos, int flags)
+make_lisp_buffer_output_stream (struct buffer *buf, Charbpos pos, int flags)
 {
   Lisp_Object lstr = make_lisp_buffer_stream_1 (buf, pos, 0, flags, "wc");
 
@@ -1547,40 +1547,40 @@
   return lstr;
 }
 
-static Lstream_Data_Count
+static Bytecount
 lisp_buffer_reader (Lstream *stream, unsigned char *data,
-		    Lstream_Data_Count size)
+		    Bytecount size)
 {
   struct lisp_buffer_stream *str = LISP_BUFFER_STREAM_DATA (stream);
   unsigned char *orig_data = data;
-  Bytind start;
-  Bytind end;
+  Bytebpos start;
+  Bytebpos end;
   struct buffer *buf = XBUFFER (str->buffer);
 
   if (!BUFFER_LIVE_P (buf))
     return 0; /* Fut. */
 
-  /* NOTE: We do all our operations in Bytind's.
+  /* NOTE: We do all our operations in Bytebpos's.
      Keep in mind that SIZE is a value in bytes, not chars. */
 
   start = bi_marker_position (str->start);
   end = bi_marker_position (str->end);
   if (!(str->flags & LSTR_IGNORE_ACCESSIBLE))
     {
-      start = bytind_clip_to_bounds (BI_BUF_BEGV (buf), start,
+      start = bytebpos_clip_to_bounds (BI_BUF_BEGV (buf), start,
 				     BI_BUF_ZV (buf));
-      end = bytind_clip_to_bounds (BI_BUF_BEGV (buf), end,
+      end = bytebpos_clip_to_bounds (BI_BUF_BEGV (buf), end,
 				   BI_BUF_ZV (buf));
     }
 
-  size = min (size, (Lstream_Data_Count) (end - start));
+  size = min (size, (Bytecount) (end - start));
   end = start + size;
   /* We cannot return a partial character. */
-  VALIDATE_BYTIND_BACKWARD (buf, end);
+  VALIDATE_BYTEBPOS_BACKWARD (buf, end);
 
   while (start < end)
     {
-      Bytind ceil;
+      Bytebpos ceil;
       Bytecount chunk;
 
       if (str->flags & LSTR_IGNORE_ACCESSIBLE)
@@ -1606,12 +1606,12 @@
   return data - orig_data;
 }
 
-static Lstream_Data_Count
+static Bytecount
 lisp_buffer_writer (Lstream *stream, const unsigned char *data,
-		    Lstream_Data_Count size)
+		    Bytecount size)
 {
   struct lisp_buffer_stream *str = LISP_BUFFER_STREAM_DATA (stream);
-  Bufpos pos;
+  Charbpos pos;
   struct buffer *buf = XBUFFER (str->buffer);
 
   if (!BUFFER_LIVE_P (buf))
@@ -1653,7 +1653,7 @@
   return str->buffer;
 }
 
-Bufpos
+Charbpos
 lisp_buffer_stream_startpos (Lstream *stream)
 {
   return marker_position (LISP_BUFFER_STREAM_DATA (stream)->start);
--- a/src/lstream.h	Tue Sep 18 05:06:57 2001 +0000
+++ b/src/lstream.h	Thu Sep 20 06:31:11 2001 +0000
@@ -43,11 +43,25 @@
 #define EOF (-1)
 #endif
 
-/* Typedef specifying a count of bytes in a data block to be written
-   out or read in, using Lstream_read(), Lstream_write(), and related
-   functions.  This MUST BE SIGNED, since it also is used in functions
-   that return the number of bytes actually read to or written from in
-   an operation, and these functions can return -1 to signal error.
+/* The have been some arguments over the what the type should be that
+   specifies a count of bytes in a data block to be written out or read in,
+   using Lstream_read(), Lstream_write(), and related functions.
+   Originally it was long, which worked fine; Martin "corrected" these to
+   size_t and ssize_t on the grounds that this is theoretically cleaner and
+   is in keeping with the C standards.  Unfortunately, this practice is
+   horribly error-prone due to design flaws in the way that mixed
+   signed/unsigned arithmetic happens.  In fact, by doing this change,
+   Martin introduced a subtle but fatal error that caused the operation of
+   sending large mail messages to the SMTP server under Windows to fail.
+   By putting all values back to be signed, avoiding any signed/unsigned
+   mixing, the bug immediately went away.  The type then in use was
+   Lstream_Data_Count, so that it be reverted cleanly if a vote came to
+   that.  Now it is Bytecount.
+
+   Some earlier comments about why the type must be signed: This MUST BE
+   SIGNED, since it also is used in functions that return the number of
+   bytes actually read to or written from in an operation, and these
+   functions can return -1 to signal error.
    
    Note that the standard Unix read() and write() functions define the
    count going in as a size_t, which is UNSIGNED, and the count going
@@ -59,10 +73,10 @@
    unrepresentable as an ssize_t, so code that checks to see how many
    bytes are actually written (which is mandatory if you are dealing
    with certain types of devices) will get completely screwed up.
+
+   --ben
 */
 
-typedef EMACS_INT Lstream_Data_Count;
-
 typedef enum lstream_buffering
 {
   /* No buffering. */
@@ -96,7 +110,7 @@
 typedef struct lstream_implementation
 {
   const char *name;
-  Lstream_Data_Count size; /* Number of additional bytes to be
+  Bytecount size; /* Number of additional bytes to be
 			      allocated with this stream.  Access this
 			      data using Lstream_data(). */
   /* Read some data from the stream's end and store it into DATA, which
@@ -117,8 +131,8 @@
   /* The omniscient mly, blinded by the irresistible thrall of Common
      Lisp, thinks that it is bogus that the types and implementations
      of input and output streams are the same. */
-  Lstream_Data_Count (*reader) (Lstream *stream, unsigned char *data,
-				Lstream_Data_Count size);
+  Bytecount (*reader) (Lstream *stream, unsigned char *data,
+				Bytecount size);
   /* Send some data to the stream's end.  Data to be sent is in DATA
      and is SIZE bytes.  Return the number of bytes sent.  This
      function can send and return fewer bytes than is passed in; in
@@ -129,8 +143,8 @@
      data. (This is useful, e.g., of you're dealing with a
      non-blocking file descriptor and are getting EWOULDBLOCK errors.)
      This function can be NULL if the stream is input-only. */
-  Lstream_Data_Count (*writer) (Lstream *stream, const unsigned char *data,
-				Lstream_Data_Count size);
+  Bytecount (*writer) (Lstream *stream, const unsigned char *data,
+				Bytecount size);
   /* Return non-zero if the last write operation on the stream resulted
      in an attempt to block (EWOULDBLOCK). If this method does not
      exists, the implementation returns 0 */
@@ -171,17 +185,17 @@
   struct lcrecord_header header;
   const Lstream_implementation *imp; /* methods for this stream */
   Lstream_buffering buffering; /* type of buffering in use */
-  Lstream_Data_Count buffering_size; /* number of bytes buffered */
+  Bytecount buffering_size; /* number of bytes buffered */
 
   unsigned char *in_buffer; /* holds characters read from stream end */
-  Lstream_Data_Count in_buffer_size; /* allocated size of buffer */
-  Lstream_Data_Count in_buffer_current; /* number of characters in buffer */
-  Lstream_Data_Count in_buffer_ind; /* pointer to next character to
+  Bytecount in_buffer_size; /* allocated size of buffer */
+  Bytecount in_buffer_current; /* number of characters in buffer */
+  Bytecount in_buffer_ind; /* pointer to next character to
 				       take from buffer */
 
   unsigned char *out_buffer; /* holds characters to write to stream end */
-  Lstream_Data_Count out_buffer_size; /* allocated size of buffer */
-  Lstream_Data_Count out_buffer_ind; /* pointer to next buffer spot to
+  Bytecount out_buffer_size; /* allocated size of buffer */
+  Bytecount out_buffer_ind; /* pointer to next buffer spot to
 					write a character */
 
   /* The unget buffer is more or less a stack -- things get pushed
@@ -189,11 +203,11 @@
      basically reads backwards from the end to get stuff; Lstream_unread()
      similarly has to push the data on backwards. */
   unsigned char *unget_buffer; /* holds characters pushed back onto input */
-  Lstream_Data_Count unget_buffer_size; /* allocated size of buffer */
-  Lstream_Data_Count unget_buffer_ind; /* pointer to next buffer spot
+  Bytecount unget_buffer_size; /* allocated size of buffer */
+  Bytecount unget_buffer_ind; /* pointer to next buffer spot
 					  to write a character */
 
-  Lstream_Data_Count byte_count;
+  Bytecount byte_count;
   int flags;
   max_align_t data[1];
 };
@@ -236,12 +250,12 @@
 int Lstream_fputc (Lstream *lstr, int c);
 int Lstream_fgetc (Lstream *lstr);
 void Lstream_fungetc (Lstream *lstr, int c);
-Lstream_Data_Count Lstream_read (Lstream *lstr, void *data,
-				 Lstream_Data_Count size);
-Lstream_Data_Count Lstream_write (Lstream *lstr, const void *data,
-				  Lstream_Data_Count size);
+Bytecount Lstream_read (Lstream *lstr, void *data,
+				 Bytecount size);
+Bytecount Lstream_write (Lstream *lstr, const void *data,
+				  Bytecount size);
 int Lstream_was_blocked_p (Lstream *lstr);
-void Lstream_unread (Lstream *lstr, const void *data, Lstream_Data_Count size);
+void Lstream_unread (Lstream *lstr, const void *data, Bytecount size);
 int Lstream_rewind (Lstream *lstr);
 int Lstream_seekable_p (Lstream *lstr);
 int Lstream_close (Lstream *lstr);
@@ -364,15 +378,15 @@
 					 int flags);
 void filedesc_stream_set_pty_flushing (Lstream *stream,
 				       int pty_max_bytes,
-				       Bufbyte eof_char);
+				       Intbyte eof_char);
 int filedesc_stream_fd (Lstream *stream);
 Lisp_Object make_lisp_string_input_stream (Lisp_Object string,
 					   Bytecount offset,
 					   Bytecount len);
 Lisp_Object make_fixed_buffer_input_stream (const void *buf,
-					    Lstream_Data_Count size);
+					    Bytecount size);
 Lisp_Object make_fixed_buffer_output_stream (void *buf,
-					     Lstream_Data_Count size);
+					     Bytecount size);
 const unsigned char *fixed_buffer_input_stream_ptr (Lstream *stream);
 unsigned char *fixed_buffer_output_stream_ptr (Lstream *stream);
 Lisp_Object make_resizing_buffer_output_stream (void);
@@ -380,10 +394,10 @@
 Lisp_Object make_dynarr_output_stream (unsigned_char_dynarr *dyn);
 #define LSTR_SELECTIVE 1
 #define LSTR_IGNORE_ACCESSIBLE 2
-Lisp_Object make_lisp_buffer_input_stream (struct buffer *buf, Bufpos start,
-					   Bufpos end, int flags);
-Lisp_Object make_lisp_buffer_output_stream (struct buffer *buf, Bufpos pos,
+Lisp_Object make_lisp_buffer_input_stream (struct buffer *buf, Charbpos start,
+					   Charbpos end, int flags);
+Lisp_Object make_lisp_buffer_output_stream (struct buffer *buf, Charbpos pos,
 					    int flags);
-Bufpos lisp_buffer_stream_startpos (Lstream *stream);
+Charbpos lisp_buffer_stream_startpos (Lstream *stream);
 
 #endif /* INCLUDED_lstream_h_ */
--- a/src/malloc.c	Tue Sep 18 05:06:57 2001 +0000
+++ b/src/malloc.c	Thu Sep 20 06:31:11 2001 +0000
@@ -220,8 +220,8 @@
 
 /* These two are for user programs to look at, when they are interested.  */
 
-Memory_Count malloc_sbrk_used;       /* amount of data space used now */
-Memory_Count malloc_sbrk_unused;     /* amount more we can have */
+Bytecount malloc_sbrk_used;       /* amount of data space used now */
+Bytecount malloc_sbrk_unused;     /* amount more we can have */
 
 /* start of data space; can be changed by calling init_malloc */
 static char *data_space_start;
--- a/src/marker.c	Tue Sep 18 05:06:57 2001 +0000
+++ b/src/marker.c	Thu Sep 20 06:31:11 2001 +0000
@@ -81,7 +81,7 @@
   Lisp_Marker *marker2 = XMARKER (obj2);
 
   return ((marker1->buffer == marker2->buffer) &&
-	  (marker1->memind == marker2->memind ||
+	  (marker1->membpos == marker2->membpos ||
 	  /* All markers pointing nowhere are equal */
 	   !marker1->buffer));
 }
@@ -91,7 +91,7 @@
 {
   unsigned long hash = (unsigned long) XMARKER (obj)->buffer;
   if (hash)
-    hash = HASH2 (hash, XMARKER (obj)->memind);
+    hash = HASH2 (hash, XMARKER (obj)->membpos);
   return hash;
 }
 
@@ -171,7 +171,7 @@
 set_marker_internal (Lisp_Object marker, Lisp_Object position,
 		     Lisp_Object buffer, int restricted_p)
 {
-  Bufpos charno;
+  Charbpos charno;
   struct buffer *b;
   Lisp_Marker *m;
   int point_p;
@@ -237,7 +237,7 @@
     }
   else
     {
-      m->memind = bufpos_to_memind (b, charno);
+      m->membpos = charbpos_to_membpos (b, charno);
     }
 
   if (m->buffer != b)
@@ -319,12 +319,12 @@
   marker->buffer = 0;
 }
 
-Bytind
+Bytebpos
 bi_marker_position (Lisp_Object marker)
 {
   Lisp_Marker *m = XMARKER (marker);
   struct buffer *buf = m->buffer;
-  Bytind pos;
+  Bytebpos pos;
 
   if (!buf)
     invalid_argument ("Marker does not point anywhere", Qunbound);
@@ -335,9 +335,9 @@
      shit, I don't think this can happen.  In any case, the following
      macro has an assert() in it that will catch these denormalized
      positions. */
-  pos = memind_to_bytind (buf, m->memind);
+  pos = membpos_to_bytebpos (buf, m->membpos);
 
-#ifdef ERROR_CHECK_BUFPOS
+#ifdef ERROR_CHECK_CHARBPOS
   if (pos < BI_BUF_BEG (buf) || pos > BI_BUF_Z (buf))
     abort ();
 #endif
@@ -345,7 +345,7 @@
   return pos;
 }
 
-Bufpos
+Charbpos
 marker_position (Lisp_Object marker)
 {
   struct buffer *buf = XMARKER (marker)->buffer;
@@ -353,11 +353,11 @@
   if (!buf)
     invalid_argument ("Marker does not point anywhere", Qunbound);
 
-  return bytind_to_bufpos (buf, bi_marker_position (marker));
+  return bytebpos_to_charbpos (buf, bi_marker_position (marker));
 }
 
 void
-set_bi_marker_position (Lisp_Object marker, Bytind pos)
+set_bi_marker_position (Lisp_Object marker, Bytebpos pos)
 {
   Lisp_Marker *m = XMARKER (marker);
   struct buffer *buf = m->buffer;
@@ -365,23 +365,23 @@
   if (!buf)
     invalid_argument ("Marker does not point anywhere", Qunbound);
 
-#ifdef ERROR_CHECK_BUFPOS
+#ifdef ERROR_CHECK_CHARBPOS
   if (pos < BI_BUF_BEG (buf) || pos > BI_BUF_Z (buf))
     abort ();
 #endif
 
-  m->memind = bytind_to_memind (buf, pos);
+  m->membpos = bytebpos_to_membpos (buf, pos);
 }
 
 void
-set_marker_position (Lisp_Object marker, Bufpos pos)
+set_marker_position (Lisp_Object marker, Charbpos pos)
 {
   struct buffer *buf = XMARKER (marker)->buffer;
 
   if (!buf)
     invalid_argument ("Marker does not point anywhere", Qunbound);
 
-  set_bi_marker_position (marker, bufpos_to_bytind (buf, pos));
+  set_bi_marker_position (marker, charbpos_to_bytebpos (buf, pos));
 }
 
 static Lisp_Object
@@ -467,11 +467,11 @@
        (position))
 {
   Lisp_Marker *marker;
-  Memind pos;
+  Membpos pos;
 
-  /* A small optimization trick: convert POS to memind now, rather
-     than converting every marker's memory index to bufpos.  */
-  pos = bytind_to_memind (current_buffer,
+  /* A small optimization trick: convert POS to membpos now, rather
+     than converting every marker's memory index to charbpos.  */
+  pos = bytebpos_to_membpos (current_buffer,
 			  get_buffer_pos_byte (current_buffer, position,
 					       GB_COERCE_RANGE));
 
@@ -479,10 +479,10 @@
        marker;
        marker = marker_next (marker))
     {
-      /* We use marker->memind, so we don't have to go through the
+      /* We use marker->membpos, so we don't have to go through the
          unwieldy operation of creating a Lisp_Object for
          marker_position() every time around.  */
-      if (marker->memind == pos)
+      if (marker->membpos == pos)
 	return Qt;
     }
 
--- a/src/md5.c	Tue Sep 18 05:06:57 2001 +0000
+++ b/src/md5.c	Thu Sep 20 06:31:11 2001 +0000
@@ -546,7 +546,7 @@
   if (BUFFERP (object))
     {
       struct buffer *b;
-      Bufpos begv, endv;
+      Charbpos begv, endv;
       CHECK_LIVE_BUFFER (object);
       b = XBUFFER (object);
       /* Figure out where we need to get info from */
@@ -578,8 +578,8 @@
   /* Get the data while doing the conversion.  */
   while (1)
     {
-      Bufbyte tempbuf[1024];	/* some random amount */
-      Lstream_Data_Count size_in_bytes =
+      Intbyte tempbuf[1024];	/* some random amount */
+      Bytecount size_in_bytes =
 	Lstream_read (XLSTREAM (instream), tempbuf, sizeof (tempbuf));
       if (!size_in_bytes)
 	break;
--- a/src/menubar-msw.c	Tue Sep 18 05:06:57 2001 +0000
+++ b/src/menubar-msw.c	Thu Sep 20 06:31:11 2001 +0000
@@ -136,18 +136,18 @@
  * of not hitting an error, maxlen should be >= 2*len + 3.
  */
 Bytecount
-mswindows_translate_menu_or_dialog_item (Bufbyte *item, Bytecount len,
+mswindows_translate_menu_or_dialog_item (Intbyte *item, Bytecount len,
 					 Bytecount maxlen, Emchar *accel,
 					 Lisp_Object error_name)
 {
-  Bufbyte *ptr;
+  Intbyte *ptr;
 
   if (accel)
     *accel = '\0';
 
   /* Escape '&' as '&&' */
   ptr = item;
-  while ((ptr = (Bufbyte *) memchr (ptr, '&', len - (ptr - item))) != NULL)
+  while ((ptr = (Intbyte *) memchr (ptr, '&', len - (ptr - item))) != NULL)
     {
       if (len + 2 > maxlen)
 	invalid_argument ("Menu item produces too long displayable string",
@@ -160,7 +160,7 @@
   /* Replace XEmacs accelerator '%_' with Windows accelerator '&'
      and `%%' with `%'. */
   ptr = item;
-  while ((ptr = (Bufbyte *) memchr (ptr, '%', len - (ptr - item))) != NULL)
+  while ((ptr = (Intbyte *) memchr (ptr, '%', len - (ptr - item))) != NULL)
     {
       if (*(ptr + 1) == '_')
 	{
@@ -214,7 +214,7 @@
  * "Left Flush\tRight Flush"
  */
 
-/* #### This is junk.  Need correct handling of sizes.  Use a Bufbyte_dynarr,
+/* #### This is junk.  Need correct handling of sizes.  Use a Intbyte_dynarr,
    not a static buffer. */
 static char*
 displayable_menu_item (Lisp_Object gui_item, int bar_p, Emchar *accel)
@@ -230,7 +230,7 @@
   /* Left flush part of the string */
   ll = gui_item_display_flush_left (gui_item, buf, MAX_MENUITEM_LENGTH);
 
-  ll = mswindows_translate_menu_or_dialog_item ((Bufbyte *) buf, ll,
+  ll = mswindows_translate_menu_or_dialog_item ((Intbyte *) buf, ll,
 					  MAX_MENUITEM_LENGTH, accel,
 					  XGUI_ITEM (gui_item)->name);
 
--- a/src/menubar-x.c	Tue Sep 18 05:06:57 2001 +0000
+++ b/src/menubar-x.c	Thu Sep 20 06:31:11 2001 +0000
@@ -115,7 +115,7 @@
 
   if (STRINGP (desc))
     {
-      Bufbyte *string_chars = XSTRING_DATA (desc);
+      Intbyte *string_chars = XSTRING_DATA (desc);
       wv->type = (separator_string_p (string_chars) ? SEPARATOR_TYPE :
 		  TEXT_TYPE);
       if (wv->type == SEPARATOR_TYPE)
@@ -251,7 +251,7 @@
 	      title_wv->enabled = 1;
 	      title_wv->next = sep_wv;
 	      sep_wv->type = SEPARATOR_TYPE;
-	      sep_wv->value = menu_separator_style_and_to_external ((Bufbyte *) "==");
+	      sep_wv->value = menu_separator_style_and_to_external ((Intbyte *) "==");
 	      sep_wv->next = 0;
 
 	      wv->contents = title_wv;
@@ -1164,7 +1164,7 @@
       args[1] = errordata;
       warn_when_safe_lispobj
 	(Qerror, Qwarning,
-	 emacs_doprnt_string_lisp ((const Bufbyte *) "%s: %s",
+	 emacs_doprnt_string_lisp ((const Intbyte *) "%s: %s",
 				   Qnil, -1, 2, args));
     }
 
--- a/src/menubar.c	Tue Sep 18 05:06:57 2001 +0000
+++ b/src/menubar.c	Thu Sep 20 06:31:11 2001 +0000
@@ -330,9 +330,9 @@
   Lisp_String *n;
   Charcount end;
   int i;
-  Bufbyte *name_data;
-  Bufbyte *string_result;
-  Bufbyte *string_result_ptr;
+  Intbyte *name_data;
+  Intbyte *string_result;
+  Intbyte *string_result_ptr;
   Emchar elt;
   int expecting_underscore = 0;
 
@@ -342,7 +342,7 @@
   end = string_char_length (n);
   name_data = string_data (n);
 
-  string_result = (Bufbyte *) alloca (end * MAX_EMCHAR_LEN);
+  string_result = (Intbyte *) alloca (end * MAX_EMCHAR_LEN);
   string_result_ptr = string_result;
   for (i = 0; i < end; i++)
     {
--- a/src/minibuf.c	Tue Sep 18 05:06:57 2001 +0000
+++ b/src/minibuf.c	Thu Sep 20 06:31:11 2001 +0000
@@ -205,7 +205,7 @@
    if IGNORE_CASE is true. */
 
 Charcount
-scmp_1 (const Bufbyte *s1, const Bufbyte *s2, Charcount len,
+scmp_1 (const Intbyte *s1, const Intbyte *s2, Charcount len,
 	int ignore_case)
 {
   Charcount l = len;
@@ -244,7 +244,7 @@
 
 
 int
-regexp_ignore_completion_p (const Bufbyte *nonreloc,
+regexp_ignore_completion_p (const Intbyte *nonreloc,
 			    Lisp_Object reloc, Bytecount offset,
 			    Bytecount length)
 {
@@ -688,7 +688,7 @@
     }
   else
     {
-      write_string_to_stdio_stream (stderr, 0, (const Bufbyte *) "\n", 0, 1,
+      write_string_to_stdio_stream (stderr, 0, (const Intbyte *) "\n", 0, 1,
 				    Qterminal, 0);
       return Qnil;
     }
@@ -709,7 +709,7 @@
 }
 
 void
-echo_area_append (struct frame *f, const Bufbyte *nonreloc, Lisp_Object reloc,
+echo_area_append (struct frame *f, const Intbyte *nonreloc, Lisp_Object reloc,
 		  Bytecount offset, Bytecount length,
 		  Lisp_Object label)
 {
@@ -763,7 +763,7 @@
 }
 
 void
-echo_area_message (struct frame *f, const Bufbyte *nonreloc,
+echo_area_message (struct frame *f, const Intbyte *nonreloc,
 		   Lisp_Object reloc, Bytecount offset, Bytecount length,
 		   Lisp_Object label)
 {
@@ -808,7 +808,7 @@
 /* Dump an informative message to the echo area.  This function takes a
    string in internal format. */
 void
-message_internal (const Bufbyte *nonreloc, Lisp_Object reloc,
+message_internal (const Intbyte *nonreloc, Lisp_Object reloc,
 		  Bytecount offset, Bytecount length)
 {
   /* This function can call lisp  */
@@ -818,7 +818,7 @@
 }
 
 void
-message_append_internal (const Bufbyte *nonreloc, Lisp_Object reloc,
+message_append_internal (const Intbyte *nonreloc, Lisp_Object reloc,
 			 Bytecount offset, Bytecount length)
 {
   /* This function can call lisp  */
@@ -840,7 +840,7 @@
       struct gcpro gcpro1;
       /* message_internal() might GC, e.g. if there are after-change-hooks
 	 on the echo area buffer */
-      Lisp_Object obj = emacs_doprnt_string_va ((const Bufbyte *) fmt, Qnil,
+      Lisp_Object obj = emacs_doprnt_string_va ((const Intbyte *) fmt, Qnil,
 						-1, args);
       GCPRO1 (obj);
       message_internal (0, obj, 0, -1);
@@ -859,7 +859,7 @@
       struct gcpro gcpro1;
       /* message_internal() might GC, e.g. if there are after-change-hooks
 	 on the echo area buffer */
-      Lisp_Object obj = emacs_doprnt_string_va ((const Bufbyte *) fmt, Qnil,
+      Lisp_Object obj = emacs_doprnt_string_va ((const Intbyte *) fmt, Qnil,
 						-1, args);
       GCPRO1 (obj);
       message_append_internal (0, obj, 0, -1);
--- a/src/mule-ccl.c	Tue Sep 18 05:06:57 2001 +0000
+++ b/src/mule-ccl.c	Thu Sep 20 06:31:11 2001 +0000
@@ -737,7 +737,7 @@
 	  }							\
 	else							\
 	  {							\
-	    Bufbyte work[MAX_EMCHAR_LEN];			\
+	    Intbyte work[MAX_EMCHAR_LEN];			\
 	    int len;						\
 	    len = non_ascii_set_charptr_emchar (work, ch);	\
 	    Dynarr_add_many (destination, work, len);		\
@@ -751,7 +751,7 @@
 	  }							\
 	else							\
 	  {							\
-	    Bufbyte work[MAX_EMCHAR_LEN];			\
+	    Intbyte work[MAX_EMCHAR_LEN];			\
 	    int len;						\
 	    len = non_ascii_set_charptr_emchar (work, ch);	\
 	    Dynarr_add_many (destination, work, len);		\
@@ -764,7 +764,7 @@
    cannot handle a multibyte string except for Control-1 characters. */
 #define CCL_WRITE_STRING(len)					\
   do {								\
-    Bufbyte work[MAX_EMCHAR_LEN];				\
+    Intbyte work[MAX_EMCHAR_LEN];				\
     int ch, bytes;						\
     if (!destination)						\
       CCL_INVALID_CMD;						\
--- a/src/mule-charset.c	Tue Sep 18 05:06:57 2001 +0000
+++ b/src/mule-charset.c	Thu Sep 20 06:31:11 2001 +0000
@@ -190,10 +190,10 @@
  */
 
 Bytecount
-non_ascii_set_charptr_emchar (Bufbyte *str, Emchar c)
+non_ascii_set_charptr_emchar (Intbyte *str, Emchar c)
 {
-  Bufbyte *p;
-  Bufbyte lb;
+  Intbyte *p;
+  Intbyte lb;
   int c1, c2;
   Lisp_Object charset;
 
@@ -217,9 +217,9 @@
    Use the macro charptr_emchar() instead. */
 
 Emchar
-non_ascii_charptr_emchar (const Bufbyte *str)
+non_ascii_charptr_emchar (const Intbyte *str)
 {
-  Bufbyte i0 = *str, i1, i2 = 0;
+  Intbyte i0 = *str, i1, i2 = 0;
   Lisp_Object charset;
 
   if (i0 == LEADING_BYTE_CONTROL_1)
@@ -327,7 +327,7 @@
    Return the number of bytes copied.  */
 
 Bytecount
-non_ascii_charptr_copy_char (const Bufbyte *src, Bufbyte *dst)
+non_ascii_charptr_copy_char (const Intbyte *src, Intbyte *dst)
 {
   Bytecount bytes = REP_BYTES_BY_FIRST_BYTE (*src);
   Bytecount i;
@@ -348,17 +348,17 @@
 Emchar
 Lstream_get_emchar_1 (Lstream *stream, int ch)
 {
-  Bufbyte str[MAX_EMCHAR_LEN];
-  Bufbyte *strptr = str;
+  Intbyte str[MAX_EMCHAR_LEN];
+  Intbyte *strptr = str;
   Bytecount bytes;
 
-  str[0] = (Bufbyte) ch;
+  str[0] = (Intbyte) ch;
 
   for (bytes = REP_BYTES_BY_FIRST_BYTE (ch) - 1; bytes; bytes--)
     {
       int c = Lstream_getc (stream);
-      bufpos_checking_assert (c >= 0);
-      *++strptr = (Bufbyte) c;
+      charbpos_checking_assert (c >= 0);
+      *++strptr = (Intbyte) c;
     }
   return charptr_emchar (str);
 }
@@ -366,7 +366,7 @@
 int
 Lstream_fput_emchar (Lstream *stream, Emchar ch)
 {
-  Bufbyte str[MAX_EMCHAR_LEN];
+  Intbyte str[MAX_EMCHAR_LEN];
   Bytecount len = set_charptr_emchar (str, ch);
   return Lstream_write (stream, str, len);
 }
@@ -374,7 +374,7 @@
 void
 Lstream_funget_emchar (Lstream *stream, Emchar ch)
 {
-  Bufbyte str[MAX_EMCHAR_LEN];
+  Intbyte str[MAX_EMCHAR_LEN];
   Bytecount len = set_charptr_emchar (str, ch);
   Lstream_unread (stream, str, len);
 }
@@ -452,7 +452,7 @@
 static Lisp_Object
 make_charset (int id, Lisp_Object name, unsigned char rep_bytes,
 	      unsigned char type, unsigned char columns, unsigned char graphic,
-	      Bufbyte final, unsigned char direction,  Lisp_Object short_name,
+	      Intbyte final, unsigned char direction,  Lisp_Object short_name,
 	      Lisp_Object long_name, Lisp_Object doc,
 	      Lisp_Object reg)
 {
@@ -1172,7 +1172,7 @@
 /************************************************************************/
 
 Emchar
-lookup_composite_char (Bufbyte *str, int len)
+lookup_composite_char (Intbyte *str, int len)
 {
   Lisp_Object lispstr = make_string (str, len);
   Lisp_Object ch = Fgethash (lispstr,
--- a/src/mule-charset.h	Tue Sep 18 05:06:57 2001 +0000
+++ b/src/mule-charset.h	Thu Sep 20 06:31:11 2001 +0000
@@ -401,9 +401,9 @@
 
 /* Is this a prefix for a private leading byte? */
 
-INLINE_HEADER int LEADING_BYTE_PREFIX_P (Bufbyte lb);
+INLINE_HEADER int LEADING_BYTE_PREFIX_P (Intbyte lb);
 INLINE_HEADER int
-LEADING_BYTE_PREFIX_P (Bufbyte lb)
+LEADING_BYTE_PREFIX_P (Intbyte lb)
 {
   return (lb == PRE_LEADING_BYTE_PRIVATE_1 ||
 	  lb == PRE_LEADING_BYTE_PRIVATE_2);
@@ -438,11 +438,11 @@
 
 /* Does BYTE represent the first byte of a character? */
 
-#define BUFBYTE_FIRST_BYTE_P(byte) ((byte) < 0xA0)
+#define INTBYTE_FIRST_BYTE_P(byte) ((byte) < 0xA0)
 
 /* Does BYTE represent the first byte of a multi-byte character? */
 
-#define BUFBYTE_LEADING_BYTE_P(byte) BYTE_C1_P (byte)
+#define INTBYTE_LEADING_BYTE_P(byte) BYTE_C1_P (byte)
 
 
 /************************************************************************/
@@ -465,7 +465,7 @@
   Lisp_Object ccl_program;
 
   /* Final byte of this character set in ISO2022 designating escape sequence */
-  Bufbyte final;
+  Intbyte final;
 
   /* Number of bytes (1 - 4) required in the internal representation
      for characters in this character set.  This is *not* the
@@ -511,7 +511,7 @@
 
 /* Leading byte and id have been regrouped. -- OG */
 #define CHARSET_ID(cs)		 ((cs)->id)
-#define CHARSET_LEADING_BYTE(cs) ((Bufbyte) CHARSET_ID(cs))
+#define CHARSET_LEADING_BYTE(cs) ((Intbyte) CHARSET_ID(cs))
 #define CHARSET_NAME(cs)	 ((cs)->name)
 #define CHARSET_SHORT_NAME(cs)	 ((cs)->short_name)
 #define CHARSET_LONG_NAME(cs)	 ((cs)->long_name)
@@ -557,13 +557,13 @@
 
   /* Table of charsets indexed by type/final-byte/direction. */
   Lisp_Object charset_by_attributes[4][128][2];
-  Bufbyte next_allocated_1_byte_leading_byte;
-  Bufbyte next_allocated_2_byte_leading_byte;
+  Intbyte next_allocated_1_byte_leading_byte;
+  Intbyte next_allocated_2_byte_leading_byte;
 };
 
-INLINE_HEADER Lisp_Object CHARSET_BY_LEADING_BYTE (Bufbyte lb);
+INLINE_HEADER Lisp_Object CHARSET_BY_LEADING_BYTE (Intbyte lb);
 INLINE_HEADER Lisp_Object
-CHARSET_BY_LEADING_BYTE (Bufbyte lb)
+CHARSET_BY_LEADING_BYTE (Intbyte lb)
 {
   extern struct charset_lookup *chlook;
 
@@ -598,9 +598,9 @@
 extern const Bytecount rep_bytes_by_first_byte[0xA0];
 
 /* Number of bytes in the string representation of a character. */
-INLINE_HEADER int REP_BYTES_BY_FIRST_BYTE (Bufbyte fb);
+INLINE_HEADER int REP_BYTES_BY_FIRST_BYTE (Intbyte fb);
 INLINE_HEADER int
-REP_BYTES_BY_FIRST_BYTE (Bufbyte fb)
+REP_BYTES_BY_FIRST_BYTE (Intbyte fb)
 {
   type_checking_assert (fb < 0xA0);
   return rep_bytes_by_first_byte[fb];
@@ -679,8 +679,8 @@
    FIELD2_TO_PRIVATE_LEADING_BYTE are the same.
    */
 
-INLINE_HEADER Bufbyte CHAR_LEADING_BYTE (Emchar c);
-INLINE_HEADER Bufbyte
+INLINE_HEADER Intbyte CHAR_LEADING_BYTE (Emchar c);
+INLINE_HEADER Intbyte
 CHAR_LEADING_BYTE (Emchar c)
 {
   if (CHAR_ASCII_P (c))
@@ -770,7 +770,7 @@
 /*                           Composite characters                       */
 /************************************************************************/
 
-Emchar lookup_composite_char (Bufbyte *str, int len);
+Emchar lookup_composite_char (Intbyte *str, int len);
 Lisp_Object composite_char_string (Emchar ch);
 #endif /* ENABLE_COMPOSITE_CHARS */
 
@@ -790,9 +790,9 @@
 int Lstream_fput_emchar (Lstream *stream, Emchar ch);
 void Lstream_funget_emchar (Lstream *stream, Emchar ch);
 
-int copy_internal_to_external (const Bufbyte *internal, Bytecount len,
+int copy_internal_to_external (const Intbyte *internal, Bytecount len,
 			       unsigned char *external);
 Bytecount copy_external_to_internal (const unsigned char *external,
-				     int len, Bufbyte *internal);
+				     int len, Intbyte *internal);
 
 #endif /* INCLUDED_mule_charset_h_ */
--- a/src/mule-wnnfns.c	Tue Sep 18 05:06:57 2001 +0000
+++ b/src/mule-wnnfns.c	Thu Sep 20 06:31:11 2001 +0000
@@ -517,7 +517,7 @@
          fname and comment must be ASCII strings! */
       val =
 	Fcons (Fcons (make_int (dicinfo->dic_no),
-		      list4 (make_string ((Bufbyte *) (dicinfo->fname),
+		      list4 (make_string ((Intbyte *) (dicinfo->fname),
 					  strlen (dicinfo->fname)),
 			     make_string (comment, strlen ((char *) comment)),
 			     make_int (dicinfo->gosuu),
@@ -1191,7 +1191,7 @@
   if ((snum = check_wnn_server_type ()) == -1) return Qnil;
   if (!wnnfns_buf[snum]) return Qnil;
   if (jl_fuzokugo_get (wnnfns_buf[snum], fname) < 0) return Qnil;
-  return make_string ((Bufbyte *) fname, strlen (fname));
+  return make_string ((Intbyte *) fname, strlen (fname));
 }
 
 
@@ -1982,7 +1982,7 @@
 
   while ((ch = *mp++) != 0)
     {
-      if (BUFBYTE_LEADING_BYTE_P (ch))
+      if (INTBYTE_LEADING_BYTE_P (ch))
 	{
 	  switch (ch)
 	    {
--- a/src/objects-gtk.c	Tue Sep 18 05:06:57 2001 +0000
+++ b/src/objects-gtk.c	Thu Sep 20 06:31:11 2001 +0000
@@ -72,7 +72,7 @@
 }
 
 int
-gtk_parse_nearest_color (struct device *d, GdkColor *color, Bufbyte *name,
+gtk_parse_nearest_color (struct device *d, GdkColor *color, Intbyte *name,
 			 Bytecount len, Error_Behavior errb)
 {
   GdkColormap *cmap;
@@ -85,7 +85,7 @@
   xzero (*color);
   {
     const Extbyte *extname;
-    Extcount extnamelen;
+    Bytecount extnamelen;
 
     TO_EXTERNAL_FORMAT (DATA, (name, len), ALLOCA, (extname, extnamelen), Qbinary);
 
@@ -382,7 +382,7 @@
 
 static int
 gtk_font_spec_matches_charset (struct device *d, Lisp_Object charset,
-			       const Bufbyte *nonreloc, Lisp_Object reloc,
+			       const Intbyte *nonreloc, Lisp_Object reloc,
 			       Bytecount offset, Bytecount length)
 {
   if (UNBOUNDP (charset))
@@ -394,7 +394,7 @@
      */
   if (EQ (charset, Vcharset_ascii))
     {
-      const Bufbyte *the_nonreloc = nonreloc;
+      const Intbyte *the_nonreloc = nonreloc;
       int i;
       Bytecount the_length = length;
 
@@ -406,7 +406,7 @@
 	{
 	  for (i = 0;; i++)
 	    {
-	      const Bufbyte *new_nonreloc = (const Bufbyte *)
+	      const Intbyte *new_nonreloc = (const Intbyte *)
 		memchr (the_nonreloc, '-', the_length);
 	      if (!new_nonreloc)
 		break;
@@ -502,7 +502,7 @@
   /* ### This code seems awfully bogus -- mrb */
   for (i = 0; i < count; i ++)
     {
-      const Bufbyte *intname;
+      const Intbyte *intname;
       Bytecount intlen;
 
       TO_INTERNAL_FORMAT (C_STRING, names[i], ALLOCA, (intname, intlen),
--- a/src/objects-gtk.h	Tue Sep 18 05:06:57 2001 +0000
+++ b/src/objects-gtk.h	Thu Sep 20 06:31:11 2001 +0000
@@ -46,7 +46,7 @@
 
 int allocate_nearest_color (GdkColormap *screen_colormap, GdkVisual *visual,
 							GdkColor *color_def);
-int gtk_parse_nearest_color (struct device *d, GdkColor *color, Bufbyte *name,
+int gtk_parse_nearest_color (struct device *d, GdkColor *color, Intbyte *name,
 							 Bytecount len, Error_Behavior errb);
 
 /*****************************************************************************
--- a/src/objects-msw.c	Tue Sep 18 05:06:57 2001 +0000
+++ b/src/objects-msw.c	Thu Sep 20 06:31:11 2001 +0000
@@ -1663,7 +1663,7 @@
 
 static int
 mswindows_font_spec_matches_charset (struct device *d, Lisp_Object charset,
-			     const Bufbyte *nonreloc, Lisp_Object reloc,
+			     const Intbyte *nonreloc, Lisp_Object reloc,
 			     Bytecount offset, Bytecount length)
 {
   /* #### Implement me */
--- a/src/objects-tty.c	Tue Sep 18 05:06:57 2001 +0000
+++ b/src/objects-tty.c	Thu Sep 20 06:31:11 2001 +0000
@@ -217,7 +217,7 @@
 tty_initialize_font_instance (Lisp_Font_Instance *f, Lisp_Object name,
 			      Lisp_Object device, Error_Behavior errb)
 {
-  Bufbyte *str = XSTRING_DATA (name);
+  Intbyte *str = XSTRING_DATA (name);
   Lisp_Object charset = Qnil;
 
   if (strncmp ((const char *) str, "normal", 6))
@@ -284,10 +284,10 @@
 
 static int
 tty_font_spec_matches_charset (struct device *d, Lisp_Object charset,
-			       const Bufbyte *nonreloc, Lisp_Object reloc,
+			       const Intbyte *nonreloc, Lisp_Object reloc,
 			       Bytecount offset, Bytecount length)
 {
-  const Bufbyte *the_nonreloc = nonreloc;
+  const Intbyte *the_nonreloc = nonreloc;
 
   if (!the_nonreloc)
     the_nonreloc = XSTRING_DATA (reloc);
@@ -296,7 +296,7 @@
 
   if (UNBOUNDP (charset))
     return !memchr (the_nonreloc, '/', length);
-  the_nonreloc = (const Bufbyte *) memchr (the_nonreloc, '/', length);
+  the_nonreloc = (const Intbyte *) memchr (the_nonreloc, '/', length);
   if (!the_nonreloc)
     return 0;
   the_nonreloc++;
@@ -313,7 +313,7 @@
 tty_find_charset_font (Lisp_Object device, Lisp_Object font,
 		       Lisp_Object charset)
 {
-  Bufbyte *fontname = XSTRING_DATA (font);
+  Intbyte *fontname = XSTRING_DATA (font);
 
   if (strchr ((const char *) fontname, '/'))
     {
--- a/src/objects-x.c	Tue Sep 18 05:06:57 2001 +0000
+++ b/src/objects-x.c	Thu Sep 20 06:31:11 2001 +0000
@@ -816,7 +816,7 @@
     {
       Lisp_Object name, value;
       Atom atom = props [i].name;
-      Bufbyte *name_str = 0;
+      Intbyte *name_str = 0;
       Bytecount name_len;
       Extbyte *namestrext = XGetAtomName (dpy, atom);
 
@@ -837,17 +837,17 @@
 	   atom == DEVICE_XATOM_SPACING (d) ||
 	   atom == DEVICE_XATOM_CHARSET_REGISTRY (d) ||
 	   atom == DEVICE_XATOM_CHARSET_ENCODING (d) ||
-	   !bufbyte_strcmp (name_str, "CHARSET_COLLECTIONS") ||
-	   !bufbyte_strcmp (name_str, "FONTNAME_REGISTRY") ||
-	   !bufbyte_strcmp (name_str, "CLASSIFICATION") ||
-	   !bufbyte_strcmp (name_str, "COPYRIGHT") ||
-	   !bufbyte_strcmp (name_str, "DEVICE_FONT_NAME") ||
-	   !bufbyte_strcmp (name_str, "FULL_NAME") ||
-	   !bufbyte_strcmp (name_str, "MONOSPACED") ||
-	   !bufbyte_strcmp (name_str, "QUALITY") ||
-	   !bufbyte_strcmp (name_str, "RELATIVE_SET") ||
-	   !bufbyte_strcmp (name_str, "RELATIVE_WEIGHT") ||
-	   !bufbyte_strcmp (name_str, "STYLE")))
+	   !intbyte_strcmp (name_str, "CHARSET_COLLECTIONS") ||
+	   !intbyte_strcmp (name_str, "FONTNAME_REGISTRY") ||
+	   !intbyte_strcmp (name_str, "CLASSIFICATION") ||
+	   !intbyte_strcmp (name_str, "COPYRIGHT") ||
+	   !intbyte_strcmp (name_str, "DEVICE_FONT_NAME") ||
+	   !intbyte_strcmp (name_str, "FULL_NAME") ||
+	   !intbyte_strcmp (name_str, "MONOSPACED") ||
+	   !intbyte_strcmp (name_str, "QUALITY") ||
+	   !intbyte_strcmp (name_str, "RELATIVE_SET") ||
+	   !intbyte_strcmp (name_str, "RELATIVE_WEIGHT") ||
+	   !intbyte_strcmp (name_str, "STYLE")))
 	{
 	  Extbyte *val_str = XGetAtomName (dpy, props [i].card32);
 
@@ -886,7 +886,7 @@
 
 static int
 x_font_spec_matches_charset (struct device *d, Lisp_Object charset,
-			     const Bufbyte *nonreloc, Lisp_Object reloc,
+			     const Intbyte *nonreloc, Lisp_Object reloc,
 			     Bytecount offset, Bytecount length)
 {
   if (UNBOUNDP (charset))
@@ -898,7 +898,7 @@
      */
   if (EQ (charset, Vcharset_ascii))
     {
-      const Bufbyte *the_nonreloc = nonreloc;
+      const Intbyte *the_nonreloc = nonreloc;
       int i;
       Bytecount the_length = length;
 
@@ -910,7 +910,7 @@
 	{
 	  for (i = 0;; i++)
 	    {
-	      const Bufbyte *new_nonreloc = (const Bufbyte *)
+	      const Intbyte *new_nonreloc = (const Intbyte *)
 		memchr (the_nonreloc, '-', the_length);
 	      if (!new_nonreloc)
 		break;
@@ -951,7 +951,7 @@
   /* #### This code seems awfully bogus -- mrb */
   for (i = 0; i < count; i ++)
     {
-      const Bufbyte *intname;
+      const Intbyte *intname;
       Bytecount intlen;
 
       TO_INTERNAL_FORMAT (C_STRING, names[i],
--- a/src/objects.c	Tue Sep 18 05:06:57 2001 +0000
+++ b/src/objects.c	Thu Sep 20 06:31:11 2001 +0000
@@ -674,7 +674,7 @@
 
 int
 font_spec_matches_charset (struct device *d, Lisp_Object charset,
-			   const Bufbyte *nonreloc, Lisp_Object reloc,
+			   const Intbyte *nonreloc, Lisp_Object reloc,
 			   Bytecount offset, Bytecount length)
 {
   return DEVMETH_OR_GIVEN (d, font_spec_matches_charset,
--- a/src/objects.h	Tue Sep 18 05:06:57 2001 +0000
+++ b/src/objects.h	Thu Sep 20 06:31:11 2001 +0000
@@ -150,7 +150,7 @@
 
 #ifdef MULE
 int font_spec_matches_charset (struct device *d, Lisp_Object charset,
-			       const Bufbyte *nonreloc,
+			       const Intbyte *nonreloc,
 			       Lisp_Object reloc, Bytecount offset,
 			       Bytecount length);
 #endif
--- a/src/opaque.c	Tue Sep 18 05:06:57 2001 +0000
+++ b/src/opaque.c	Thu Sep 20 06:31:11 2001 +0000
@@ -52,14 +52,14 @@
   write_c_string (buf, printcharfun);
 }
 
-inline static Memory_Count
-aligned_sizeof_opaque (Memory_Count opaque_size)
+inline static Bytecount
+aligned_sizeof_opaque (Bytecount opaque_size)
 {
   return ALIGN_SIZE (offsetof (Lisp_Opaque, data) + opaque_size,
 		     ALIGNOF (max_align_t));
 }
 
-static Memory_Count
+static Bytecount
 sizeof_opaque (const void *header)
 {
   return aligned_sizeof_opaque (((const Lisp_Opaque *) header)->size);
@@ -70,7 +70,7 @@
    If DATA is OPAQUE_UNINIT, the object's data is uninitialized.
    Else the object's data is initialized by copying from DATA. */
 Lisp_Object
-make_opaque (const void *data, Memory_Count size)
+make_opaque (const void *data, Bytecount size)
 {
   Lisp_Opaque *p = (Lisp_Opaque *)
     alloc_lcrecord (aligned_sizeof_opaque (size), &lrecord_opaque);
@@ -95,7 +95,7 @@
 static int
 equal_opaque (Lisp_Object obj1, Lisp_Object obj2, int depth)
 {
-  Memory_Count size;
+  Bytecount size;
   return ((size = XOPAQUE_SIZE (obj1)) == XOPAQUE_SIZE (obj2) &&
 	  !memcmp (XOPAQUE_DATA (obj1), XOPAQUE_DATA (obj2), size));
 }
--- a/src/opaque.h	Tue Sep 18 05:06:57 2001 +0000
+++ b/src/opaque.h	Thu Sep 20 06:31:11 2001 +0000
@@ -29,7 +29,7 @@
 typedef struct Lisp_Opaque
 {
   struct lcrecord_header header;
-  Memory_Count size;
+  Bytecount size;
   max_align_t data[1];
 } Lisp_Opaque;
 
@@ -53,7 +53,7 @@
 #define XOPAQUE_DATA(op) OPAQUE_DATA (XOPAQUE (op))
 #define XOPAQUE_MARKFUN(op) OPAQUE_MARKFUN (XOPAQUE (op))
 
-Lisp_Object make_opaque (const void *data, Memory_Count size);
+Lisp_Object make_opaque (const void *data, Bytecount size);
 
 typedef struct Lisp_Opaque_Ptr
 {
--- a/src/print.c	Tue Sep 18 05:06:57 2001 +0000
+++ b/src/print.c	Thu Sep 20 06:31:11 2001 +0000
@@ -111,7 +111,7 @@
 
 static void
 std_handle_out_external (FILE *stream, Lisp_Object lstream,
-			 const Extbyte *extptr, Extcount extlen,
+			 const Extbyte *extptr, Bytecount extlen,
 			 /* is this really stdout/stderr?
 			    (controls termscript writing) */
 			 int output_is_std_handle,
@@ -176,9 +176,9 @@
 static int
 std_handle_out_va (FILE *stream, const char *fmt, va_list args)
 {
-  Bufbyte kludge[8192];
+  Intbyte kludge[8192];
   Extbyte *extptr;
-  Extcount extlen;
+  Bytecount extlen;
   int retval;
 
   retval = vsprintf ((char *) kludge, fmt, args);
@@ -189,7 +189,7 @@
   else
     {
       extptr = (Extbyte *) kludge;
-      extlen = (Extcount) strlen ((char *) kludge);
+      extlen = (Bytecount) strlen ((char *) kludge);
     }
 
   std_handle_out_external (stream, Qnil, extptr, extlen, 1, 1);
@@ -248,18 +248,18 @@
 
 void
 write_string_to_stdio_stream (FILE *stream, struct console *con,
-			      const Bufbyte *str,
+			      const Intbyte *str,
 			      Bytecount offset, Bytecount len,
 			      Lisp_Object coding_system,
 			      int must_flush)
 {
-  Extcount extlen;
+  Bytecount extlen;
   const Extbyte *extptr;
 
   /* #### yuck! sometimes this function is called with string data,
      and the following call may gc. */
   {
-    Bufbyte *puta = (Bufbyte *) alloca (len);
+    Intbyte *puta = (Intbyte *) alloca (len);
     memcpy (puta, str + offset, len);
     TO_EXTERNAL_FORMAT (DATA, (puta, len),
 			ALLOCA, (extptr, extlen),
@@ -283,7 +283,7 @@
    buffer_insert_string_1() in insdel.c. */
 
 static void
-output_string (Lisp_Object function, const Bufbyte *nonreloc,
+output_string (Lisp_Object function, const Intbyte *nonreloc,
 	       Lisp_Object reloc, Bytecount offset, Bytecount len)
 {
   /* This function can GC */
@@ -293,7 +293,7 @@
      other functions that take both a nonreloc and a reloc, or things
      may get confused and an assertion failure in
      fixup_internal_substring() may get triggered. */
-  const Bufbyte *newnonreloc = nonreloc;
+  const Intbyte *newnonreloc = nonreloc;
   struct gcpro gcpro1, gcpro2;
 
   /* Emacs won't print while GCing, but an external debugger might */
@@ -319,7 +319,7 @@
 	     we inhibit GC.  */
 	  if (len < 65536)
 	    {
-	      Bufbyte *copied = alloca_array (Bufbyte, len);
+	      Intbyte *copied = alloca_array (Intbyte, len);
 	      memcpy (copied, newnonreloc + offset, len);
 	      Lstream_write (XLSTREAM (function), copied, len);
 	    }
@@ -347,7 +347,7 @@
   else if (MARKERP (function))
     {
       /* marker_position() will err if marker doesn't point anywhere.  */
-      Bufpos spoint = marker_position (function);
+      Charbpos spoint = marker_position (function);
 
       buffer_insert_string_1 (XMARKER (function)->buffer,
 			      spoint, nonreloc, reloc, offset, len,
@@ -478,7 +478,7 @@
 
 /* Used for printing a single-byte character (*not* any Emchar).  */
 #define write_char_internal(string_of_length_1, stream)			\
-  output_string (stream, (const Bufbyte *) (string_of_length_1),	\
+  output_string (stream, (const Intbyte *) (string_of_length_1),	\
 		 Qnil, 0, 1)
 
 /* NOTE: Do not call this with the data of a Lisp_String, as
@@ -491,10 +491,10 @@
    canonicalize_printcharfun() (i.e. Qnil means stdout, not
    Vstandard_output, etc.)  */
 void
-write_string_1 (const Bufbyte *str, Bytecount size, Lisp_Object stream)
+write_string_1 (const Intbyte *str, Bytecount size, Lisp_Object stream)
 {
   /* This function can GC */
-#ifdef ERROR_CHECK_BUFPOS
+#ifdef ERROR_CHECK_CHARBPOS
   assert (size >= 0);
 #endif
   output_string (stream, str, Qnil, 0, size);
@@ -504,7 +504,7 @@
 write_c_string (const char *str, Lisp_Object stream)
 {
   /* This function can GC */
-  write_string_1 ((const Bufbyte *) str, strlen (str), stream);
+  write_string_1 ((const Intbyte *) str, strlen (str), stream);
 }
 
 
@@ -515,7 +515,7 @@
        (character, stream))
 {
   /* This function can GC */
-  Bufbyte str[MAX_EMCHAR_LEN];
+  Intbyte str[MAX_EMCHAR_LEN];
   Bytecount len;
 
   CHECK_CHAR_COERCE_INT (character);
@@ -869,7 +869,7 @@
 void
 float_to_string (char *buf, double data)
 {
-  Bufbyte *cp, c;
+  Intbyte *cp, c;
   int width;
 
   if (NILP (Vfloat_output_format)
@@ -914,7 +914,7 @@
      representation of that form not be corrupted by the printer.
    */
   {
-    Bufbyte *s = (Bufbyte *) buf; /* don't use signed chars here!
+    Intbyte *s = (Intbyte *) buf; /* don't use signed chars here!
 				     isdigit() can't hack them! */
     if (*s == '-') s++;
     for (; *s; s++)
@@ -1192,7 +1192,7 @@
       write_char_internal ("\"", printcharfun);
       for (i = 0; i < bcmax; i++)
 	{
-	  Bufbyte ch = string_byte (s, i);
+	  Intbyte ch = string_byte (s, i);
 	  if (ch == '\"' || ch == '\\'
 	      || (ch == '\n' && print_escape_newlines))
 	    {
@@ -1366,14 +1366,14 @@
 	else if (ch < 160)
 	  {
 	    *p++ = '\\', *p++ = '^';
-	    p += set_charptr_emchar ((Bufbyte *) p, ch + 64);
+	    p += set_charptr_emchar ((Intbyte *) p, ch + 64);
 	  }
 	else
 	  {
-	    p += set_charptr_emchar ((Bufbyte *) p, ch);
+	    p += set_charptr_emchar ((Intbyte *) p, ch);
 	  }
 
-	output_string (printcharfun, (Bufbyte *) buf, Qnil, 0, p - buf);
+	output_string (printcharfun, (Intbyte *) buf, Qnil, 0, p - buf);
 
 	break;
       }
@@ -1508,7 +1508,7 @@
 
   /* Does it look like an integer or a float? */
   {
-    Bufbyte *data = string_data (name);
+    Intbyte *data = string_data (name);
     Bytecount confusing = 0;
 
     if (size == 0)
@@ -1591,7 +1591,7 @@
 */
        (character))
 {
-  Bufbyte str[MAX_EMCHAR_LEN];
+  Intbyte str[MAX_EMCHAR_LEN];
   Bytecount len;
   int extlen;
   const Extbyte *extptr;
@@ -1654,7 +1654,7 @@
 				  Qterminal, 1);
   else
     {
-      Bufbyte str[MAX_EMCHAR_LEN];
+      Intbyte str[MAX_EMCHAR_LEN];
       Bytecount len;
 
       CHECK_CHAR_COERCE_INT (char_or_string);
--- a/src/process-nt.c	Tue Sep 18 05:06:57 2001 +0000
+++ b/src/process-nt.c	Thu Sep 20 06:31:11 2001 +0000
@@ -117,7 +117,7 @@
  */
 
 static int 
-alloc_process_memory (HANDLE h_process, Memory_Count size,
+alloc_process_memory (HANDLE h_process, Bytecount size,
 		      process_memory* pmc)
 {
   LPTHREAD_START_ROUTINE adr_ExitThread =
@@ -189,12 +189,12 @@
 static DWORD
 run_in_other_process (HANDLE h_process,
 		      LPTHREAD_START_ROUTINE routine,
-		      LPVOID data, Memory_Count data_size)
+		      LPVOID data, Bytecount data_size)
 {
   process_memory pm;
-  const Memory_Count code_size = FRAGMENT_CODE_SIZE;
+  const Bytecount code_size = FRAGMENT_CODE_SIZE;
   /* Need at most 3 extra bytes of memory, for data alignment */
-  Memory_Count total_size = code_size + data_size + 3;
+  Bytecount total_size = code_size + data_size + 3;
   LPVOID remote_data;
   HANDLE h_thread;
   DWORD dw_unused;
@@ -1053,12 +1053,12 @@
   /* use a reasonable-sized buffer (somewhere around the size of the
      stream buffer) so as to avoid inundating the stream with blocked
      data. */
-  Bufbyte chunkbuf[512];
+  Intbyte chunkbuf[512];
   Bytecount chunklen;
 
   while (1)
     {
-      Lstream_Data_Count writeret;
+      Bytecount writeret;
 
       chunklen = Lstream_read (lstream, chunkbuf, 512);
       if (chunklen <= 0)
--- a/src/process-unix.c	Tue Sep 18 05:06:57 2001 +0000
+++ b/src/process-unix.c	Thu Sep 20 06:31:11 2001 +0000
@@ -1275,12 +1275,12 @@
       /* use a reasonable-sized buffer (somewhere around the size of the
 	 stream buffer) so as to avoid inundating the stream with blocked
 	 data. */
-      Bufbyte chunkbuf[512];
+      Intbyte chunkbuf[512];
       Bytecount chunklen;
 
       while (1)
 	{
-	  Lstream_Data_Count writeret;
+	  Bytecount writeret;
 
 	  chunklen = Lstream_read (lstream, chunkbuf, 512);
 	  if (chunklen <= 0)
@@ -1357,10 +1357,10 @@
      character in init_process_io_handles but here it simply screws
      things up. */
 #if 0
-  Bufbyte eof_char = get_eof_char (XPROCESS (proc));
+  Intbyte eof_char = get_eof_char (XPROCESS (proc));
   send_process (proc, Qnil, &eof_char, 0, 1);
 #else
-  send_process (proc, Qnil, (const Bufbyte *) "\004", 0, 1);
+  send_process (proc, Qnil, (const Intbyte *) "\004", 0, 1);
 #endif
   return 1;
 }
@@ -1497,7 +1497,7 @@
         char sigchar = process_signal_char (d->subtty, signo);
         if (sigchar)
 	  {
-	    send_process (proc, Qnil, (Bufbyte *) &sigchar, 0, 1);
+	    send_process (proc, Qnil, (Intbyte *) &sigchar, 0, 1);
 	    return;
 	  }
       }
@@ -1591,7 +1591,7 @@
   retval = getaddrinfo (ext_host, NULL, &hints, &res);
   if (retval != 0)
     {
-      CBufbyte *gai_error;
+      CIntbyte *gai_error;
 
       EXTERNAL_TO_C_STRING (gai_strerror (retval), gai_error, Qnative);
       maybe_signal_error (Qio_error, gai_error, host,
@@ -1685,7 +1685,7 @@
     retval = getaddrinfo (ext_host, portstring, &hints, &res);
     if (retval != 0)
       {
-	CBufbyte *gai_error;
+	CIntbyte *gai_error;
 
 	EXTERNAL_TO_C_STRING (gai_strerror (retval), gai_error, Qnative);
 	signal_error (Qio_error, gai_error, list2 (host, service));
--- a/src/process.c	Tue Sep 18 05:06:57 2001 +0000
+++ b/src/process.c	Thu Sep 20 06:31:11 2001 +0000
@@ -850,7 +850,7 @@
 {
   /* This function can GC */
   Bytecount nbytes, nchars;
-  Bufbyte chars[1024];
+  Intbyte chars[1024];
   Lisp_Object outstream;
   Lisp_Process *p = XPROCESS (process);
 
@@ -901,9 +901,9 @@
   if (!NILP (p->buffer) && BUFFER_LIVE_P (XBUFFER (p->buffer)))
     {
       Lisp_Object old_read_only = Qnil;
-      Bufpos old_point;
-      Bufpos old_begv;
-      Bufpos old_zv;
+      Charbpos old_point;
+      Charbpos old_begv;
+      Charbpos old_zv;
       struct gcpro gcpro1, gcpro2;
       struct buffer *buf = XBUFFER (p->buffer);
 
@@ -920,7 +920,7 @@
 	 thus preserving logical ordering of input and output.  */
       if (XMARKER (p->mark)->buffer)
 	BUF_SET_PT (buf,
-		    bufpos_clip_to_bounds (old_begv, marker_position (p->mark),
+		    charbpos_clip_to_bounds (old_begv, marker_position (p->mark),
 					   old_zv));
       else
 	BUF_SET_PT (buf, old_zv);
@@ -961,10 +961,10 @@
       if (old_begv != BUF_BEGV (buf) || old_zv != BUF_ZV (buf))
 	{
 	  Fwiden(p->buffer);
-	  old_begv = bufpos_clip_to_bounds (BUF_BEG (buf),
+	  old_begv = charbpos_clip_to_bounds (BUF_BEG (buf),
 					    old_begv,
 					    BUF_Z (buf));
-	  old_zv = bufpos_clip_to_bounds (BUF_BEG (buf),
+	  old_zv = charbpos_clip_to_bounds (BUF_BEG (buf),
 					  old_zv,
 					  BUF_Z (buf));
 	  Fnarrow_to_region (make_int (old_begv), make_int (old_zv),
@@ -972,7 +972,7 @@
 	}
 
       buf->read_only = old_read_only;
-      old_point = bufpos_clip_to_bounds (BUF_BEGV (buf),
+      old_point = charbpos_clip_to_bounds (BUF_BEGV (buf),
 					 old_point,
 					 BUF_ZV (buf));
       BUF_SET_PT (buf, old_point);
@@ -989,12 +989,12 @@
    object RELOCATABLE (either a string or a buffer).  START and LEN
    specify the offset and length of the data to send.
 
-   Note that START and LEN are in Bufpos's if RELOCATABLE is a buffer,
+   Note that START and LEN are in Charbpos's if RELOCATABLE is a buffer,
    and in Bytecounts otherwise. */
 
 void
 send_process (Lisp_Object process,
-              Lisp_Object relocatable, const Bufbyte *nonrelocatable,
+              Lisp_Object relocatable, const Intbyte *nonrelocatable,
               int start, int len)
 {
   /* This function can GC */
@@ -1116,7 +1116,7 @@
        (process, start, end, buffer))
 {
   /* This function can GC */
-  Bufpos bstart, bend;
+  Charbpos bstart, bend;
   struct buffer *buf = decode_buffer (buffer, 0);
 
   XSETBUFFER (buffer, buf);
@@ -1451,7 +1451,7 @@
 	    {
 	      Lisp_Object old_read_only = Qnil;
 	      Lisp_Object old = Fcurrent_buffer ();
-	      Bufpos opoint;
+	      Charbpos opoint;
               struct gcpro ngcpro1, ngcpro2;
 
 	      /* Avoid error if buffer is deleted
@@ -1484,7 +1484,7 @@
 	      Fset_marker (p->mark, make_int (BUF_PT (current_buffer)),
 			   p->buffer);
 
-	      opoint = bufpos_clip_to_bounds(BUF_BEGV (XBUFFER (p->buffer)),
+	      opoint = charbpos_clip_to_bounds(BUF_BEGV (XBUFFER (p->buffer)),
 					     opoint,
 					     BUF_ZV (XBUFFER (p->buffer)));
 	      BUF_SET_PT (current_buffer, opoint);
@@ -1560,7 +1560,7 @@
     return XINT (signal_);
   else
     {
-      Bufbyte *name;
+      Intbyte *name;
 
       CHECK_SYMBOL (signal_);
       name = string_data (XSYMBOL (signal_)->name);
--- a/src/procimpl.h	Tue Sep 18 05:06:57 2001 +0000
+++ b/src/procimpl.h	Thu Sep 20 06:31:11 2001 +0000
@@ -178,7 +178,7 @@
 			      void* out, int flags);
 void send_process (Lisp_Object proc,
 		   Lisp_Object relocatable,
-		   const Bufbyte *nonrelocatable,
+		   const Intbyte *nonrelocatable,
 		   int start, int len);
 
 #endif /* INCLUDED_procimpl_h_ */
--- a/src/redisplay-gtk.c	Tue Sep 18 05:06:57 2001 +0000
+++ b/src/redisplay-gtk.c	Thu Sep 20 06:31:11 2001 +0000
@@ -434,7 +434,7 @@
 			 add_glyph_rune(). */
 		      Lisp_Object string =
 			XIMAGE_INSTANCE_TEXT_STRING (instance);
-		      convert_bufbyte_string_into_emchar_dynarr
+		      convert_intbyte_string_into_emchar_dynarr
 			(XSTRING_DATA (string), XSTRING_LENGTH (string), buf);
 
 		      gtk_output_string (w, dl, buf, xpos,
--- a/src/redisplay-output.c	Tue Sep 18 05:06:57 2001 +0000
+++ b/src/redisplay-output.c	Thu Sep 20 06:31:11 2001 +0000
@@ -188,7 +188,7 @@
 static int
 compare_runes (struct window *w, struct rune *crb, struct rune *drb)
 {
-  /* Do not compare the values of bufpos and endpos.  They do not
+  /* Do not compare the values of charbpos and endpos.  They do not
      affect the display characteristics. */
 
   /* Note: (hanoi 6) spends 95% of its time in redisplay, and about
@@ -846,11 +846,11 @@
  boolean indicating success or failure.
  ****************************************************************************/
 
-#define ADJ_BUFPOS (rb->bufpos + dl->offset)
+#define ADJ_CHARBPOS (rb->charbpos + dl->offset)
 #define ADJ_ENDPOS (rb->endpos + dl->offset)
 
 int
-redisplay_move_cursor (struct window *w, Bufpos new_point, int no_output_end)
+redisplay_move_cursor (struct window *w, Charbpos new_point, int no_output_end)
 {
   struct frame *f = XFRAME (w->frame);
   struct device *d = XDEVICE (f->device);
@@ -886,13 +886,13 @@
 
   if (rb->cursor_type == CURSOR_OFF)
     return 0;
-  else if (ADJ_BUFPOS == new_point
-	   || (ADJ_ENDPOS && (new_point >= ADJ_BUFPOS)
+  else if (ADJ_CHARBPOS == new_point
+	   || (ADJ_ENDPOS && (new_point >= ADJ_CHARBPOS)
 	       && (new_point <= ADJ_ENDPOS)))
     {
       w->last_point_x[CURRENT_DISP] = x;
       w->last_point_y[CURRENT_DISP] = y;
-      Fset_marker (w->last_point[CURRENT_DISP], make_int (ADJ_BUFPOS),
+      Fset_marker (w->last_point[CURRENT_DISP], make_int (ADJ_CHARBPOS),
 		   w->buffer);
       dl->cursor_elt = x;
       return 1;
@@ -951,13 +951,13 @@
       int first = 0;
       int cur_dl, up;
 
-      if (ADJ_BUFPOS < new_point)
+      if (ADJ_CHARBPOS < new_point)
 	{
 	  up = 1;
 	  cur_rb = x + 1;
 	  cur_dl = y;
 	}
-      else /* (rb->bufpos + dl->offset) > new_point */
+      else /* (rb->charbpos + dl->offset) > new_point */
 	{
 	  up = 0;
 
@@ -989,9 +989,9 @@
 
 	      if (rb->cursor_type != IGNORE_CURSOR
 		  && rb->cursor_type != NO_CURSOR &&
-		  (ADJ_BUFPOS == new_point
-		   || (ADJ_ENDPOS && (new_point >= ADJ_BUFPOS)
-		       && (new_point <= ADJ_BUFPOS))))
+		  (ADJ_CHARBPOS == new_point
+		   || (ADJ_ENDPOS && (new_point >= ADJ_CHARBPOS)
+		       && (new_point <= ADJ_CHARBPOS))))
 		{
 		  rb->cursor_type = CURSOR_ON;
 		  dl->cursor_elt = cur_rb;
@@ -1003,7 +1003,7 @@
 		  w->last_point_x[CURRENT_DISP] = cur_rb;
 		  w->last_point_y[CURRENT_DISP] = cur_dl;
 		  Fset_marker (w->last_point[CURRENT_DISP],
-			       make_int (ADJ_BUFPOS), w->buffer);
+			       make_int (ADJ_CHARBPOS), w->buffer);
 
 		  if (!no_output_end)
 		    {
@@ -1028,7 +1028,7 @@
     }
   return 0;
 }
-#undef ADJ_BUFPOS
+#undef ADJ_CHARBPOS
 #undef ADJ_ENDPOS
 
 /*****************************************************************************
@@ -1453,12 +1453,12 @@
 			unsigned char charsets[NUM_LEADING_BYTES];
 			struct face_cachel *cachel = WINDOW_FACE_CACHEL (w, findex);
 
-			find_charsets_in_bufbyte_string (charsets,
+			find_charsets_in_intbyte_string (charsets,
 							 XSTRING_DATA (string),
 							 XSTRING_LENGTH (string));
 			ensure_face_cachel_complete (cachel, window, charsets);
 
-			convert_bufbyte_string_into_emchar_dynarr
+			convert_intbyte_string_into_emchar_dynarr
 			  (XSTRING_DATA (string), XSTRING_LENGTH (string), buf);
 
 			redisplay_normalize_display_box (&cdb, &cdga);
@@ -2080,10 +2080,10 @@
 
   while (first_line <= last_line)
     {
-      Charcount old_len = (Dynarr_atp (cdla, first_line)->end_bufpos -
-			   Dynarr_atp (cdla, first_line)->bufpos);
-      Charcount new_len = (Dynarr_atp (ddla, first_line)->end_bufpos -
-			   Dynarr_atp (ddla, first_line)->bufpos);
+      Charcount old_len = (Dynarr_atp (cdla, first_line)->end_charbpos -
+			   Dynarr_atp (cdla, first_line)->charbpos);
+      Charcount new_len = (Dynarr_atp (ddla, first_line)->end_charbpos -
+			   Dynarr_atp (ddla, first_line)->charbpos);
 
       assert (Dynarr_length (cdla) == Dynarr_length (ddla));
 
--- a/src/redisplay-tty.c	Tue Sep 18 05:06:57 2001 +0000
+++ b/src/redisplay-tty.c	Thu Sep 20 06:31:11 2001 +0000
@@ -81,9 +81,9 @@
 				      Emchar_dynarr *buf, int xpos,
 				      face_index findex,
 				      int cursor);
-static void tty_output_bufbyte_string (struct window *w,
+static void tty_output_intbyte_string (struct window *w,
 				       struct display_line *dl,
-				       Bufbyte *str, Bytecount len,
+				       Intbyte *str, Bytecount len,
 				       int xpos, face_index findex,
 				       int cursor);
 static void tty_turn_on_face (struct window *w, face_index findex);
@@ -517,8 +517,8 @@
 }
 
 static void
-tty_output_bufbyte_string (struct window *w, struct display_line *dl,
-			   Bufbyte *str, Bytecount len, int xpos,
+tty_output_intbyte_string (struct window *w, struct display_line *dl,
+			   Intbyte *str, Bytecount len, int xpos,
 			   face_index findex, int cursor)
 {
   struct frame *f = XFRAME (w->frame);
@@ -531,13 +531,13 @@
   tty_turn_on_face (w, findex);
 
   send_string_to_tty_console (c, str, len);
-  TTY_INC_CURSOR_X (c, bufbyte_string_displayed_columns (str, len));
+  TTY_INC_CURSOR_X (c, intbyte_string_displayed_columns (str, len));
 
   /* Turn the face properties back off. */
   tty_turn_off_face (w, findex);
 }
 
-static Bufbyte_dynarr *tty_output_emchar_dynarr_dynarr;
+static Intbyte_dynarr *tty_output_emchar_dynarr_dynarr;
 
 /*****************************************************************************
  tty_output_emchar_dynarr
@@ -551,15 +551,15 @@
 			  int cursor)
 {
   if (!tty_output_emchar_dynarr_dynarr)
-    tty_output_emchar_dynarr_dynarr = Dynarr_new (Bufbyte);
+    tty_output_emchar_dynarr_dynarr = Dynarr_new (Intbyte);
   else
     Dynarr_reset (tty_output_emchar_dynarr_dynarr);
 
-  convert_emchar_string_into_bufbyte_dynarr (Dynarr_atp (buf, 0),
+  convert_emchar_string_into_intbyte_dynarr (Dynarr_atp (buf, 0),
 					    Dynarr_length (buf),
 					    tty_output_emchar_dynarr_dynarr);
 
-  tty_output_bufbyte_string (w, dl,
+  tty_output_intbyte_string (w, dl,
 			     Dynarr_atp (tty_output_emchar_dynarr_dynarr, 0),
 			     Dynarr_length (tty_output_emchar_dynarr_dynarr),
 			     xpos, findex, cursor);
@@ -567,17 +567,17 @@
 
 #if 0
 
-static Bufbyte_dynarr *sidcs_dynarr;
+static Intbyte_dynarr *sidcs_dynarr;
 
 static void
 substitute_in_dynamic_color_string (Lisp_Object spec, Lisp_Object string)
 {
   int i;
-  Bufbyte *specdata = XSTRING_DATA   (spec);
+  Intbyte *specdata = XSTRING_DATA   (spec);
   Bytecount speclen = XSTRING_LENGTH (spec);
 
   if (!sidcs_dynarr)
-    sidcs_dynarr = Dynarr_new (Bufbyte);
+    sidcs_dynarr = Dynarr_new (Intbyte);
   else
     Dynarr_reset (sidcs_dynarr);
 
@@ -606,7 +606,7 @@
 set_foreground_to (struct console *c, Lisp_Object sym)
 {
   Lisp_Object result;
-  Bufbyte *escseq = 0;
+  Intbyte *escseq = 0;
   Bytecount escseqlen = 0;
 
   result = assq_no_quit (sym, Vtty_color_alist);
@@ -636,7 +636,7 @@
 set_background_to (struct console *c, Lisp_Object sym)
 {
   Lisp_Object result;
-  Bufbyte *escseq = 0;
+  Intbyte *escseq = 0;
   Bytecount escseqlen = 0;
 
   result = assq_no_quit (sym, Vtty_color_alist);
--- a/src/redisplay.c	Tue Sep 18 05:06:57 2001 +0000
+++ b/src/redisplay.c	Thu Sep 20 06:31:11 2001 +0000
@@ -70,10 +70,10 @@
 #endif /* HAVE_TTY */
 
 /* Note: We have to be careful throughout this code to properly handle
-   and differentiate between Bufbytes and Emchars.
-
-   Since strings are generally composed of Bufbytes, I've taken the tack
-   that any contiguous set of Bufbytes is called a "string", while
+   and differentiate between Intbytes and Emchars.
+
+   Since strings are generally composed of Intbytes, I've taken the tack
+   that any contiguous set of Intbytes is called a "string", while
    any contiguous set of Emchars is called an "array". */
 
 /* Return value to indicate a failure by an add_*_rune routine to add
@@ -93,7 +93,7 @@
 /* The following structures are completely private to redisplay.c so
    we put them here instead of in a header file, for modularity. */
 
-/* NOTE: Bytinds not Bufpos's in this structure. */
+/* NOTE: Bytebposs not Charbpos's in this structure. */
 
 typedef struct position_redisplay_data_type
 {
@@ -121,8 +121,8 @@
   int font_is_bogus;	/* If true, it means we couldn't instantiate
 			   the font for this charset, so we substitute
 			   ~'s from the ASCII charset. */
-  Bytind bi_bufpos;
-  Bytind bi_endpos;
+  Bytebpos bi_charbpos;
+  Bytebpos bi_endpos;
   int pixpos;
   int max_pixpos;
   int blank_width;	/* Width of the blank that is to be added.
@@ -136,7 +136,7 @@
 			   the non-printing char '\n', which is stuck
 			   in the output routines with its width being
 			   BLANK_WIDTH. */
-  Bytind bi_cursor_bufpos;/* This stores the buffer position of the cursor. */
+  Bytebpos bi_cursor_charbpos;/* This stores the buffer position of the cursor. */
   unsigned int cursor_type :3;
   int cursor_x;		/* rune block cursor is at */
   int start_col;	/* Number of character columns (each column has
@@ -145,7 +145,7 @@
 			   scrolling, where a certain number of columns
 			   (those off the left side of the screen) need
 			   to be skipped before anything is displayed. */
-  Bytind bi_start_col_enabled;
+  Bytebpos bi_start_col_enabled;
   int start_col_xoffset;	/* Number of pixels that still need to
 			   be skipped.  This is used for
 			   horizontal scrolling of glyphs, where we want
@@ -196,12 +196,12 @@
 };
 
 /* Data that should be propagated to the next line.  Either a single
-   Emchar or a string of Bufbyte's.
+   Emchar or a string of Intbyte's.
 
    The actual data that is propagated ends up as a Dynarr of these
    blocks.
 
-   #### It's unclean that both Emchars and Bufbytes are here.
+   #### It's unclean that both Emchars and Intbytes are here.
    */
 
 typedef struct prop_block prop_block;
@@ -213,14 +213,14 @@
   {
     struct
     {
-      Bufbyte *str;
+      Intbyte *str;
       Bytecount len; /* length of the string. */
     } p_string;
 
     struct
     {
       Emchar ch;
-      Bytind bi_cursor_bufpos; /* NOTE: is in Bytinds */
+      Bytebpos bi_cursor_charbpos; /* NOTE: is in Bytebposs */
       unsigned int cursor_type :3;
     } p_char;
 
@@ -249,8 +249,8 @@
 					  struct glyph_block *gb,
 					  int pos_type, int allow_cursor,
 					  struct glyph_cachel *cachel);
-static Bytind create_text_block (struct window *w, struct display_line *dl,
-				 Bytind bi_start_pos, prop_block_dynarr **prop,
+static Bytebpos create_text_block (struct window *w, struct display_line *dl,
+				 Bytebpos bi_start_pos, prop_block_dynarr **prop,
 				 int type);
 static int create_overlay_glyph_block (struct window *w,
 				       struct display_line *dl);
@@ -262,9 +262,9 @@
 static void redisplay_windows (Lisp_Object window, int skip_selected);
 static void decode_mode_spec (struct window *w, Emchar spec, int type);
 static void free_display_line (struct display_line *dl);
-static void update_line_start_cache (struct window *w, Bufpos from, Bufpos to,
-				     Bufpos point, int no_regen);
-static int point_visible (struct window *w, Bufpos point, int type);
+static void update_line_start_cache (struct window *w, Charbpos from, Charbpos to,
+				     Charbpos point, int no_regen);
+static int point_visible (struct window *w, Charbpos point, int type);
 
 /* This used to be 10 but 30 seems to give much better performance. */
 #define INIT_MAX_PREEMPTS	30
@@ -304,7 +304,7 @@
 
 /* This holds a string representing the text corresponding to a single
    modeline % spec. */
-static Bufbyte_dynarr *mode_spec_bufbyte_string;
+static Intbyte_dynarr *mode_spec_intbyte_string;
 
 int in_display;		/* 1 if in redisplay.  */
 
@@ -494,7 +494,7 @@
 
 int
 redisplay_text_width_string (struct window *w, int findex,
-			     Bufbyte *nonreloc, Lisp_Object reloc,
+			     Intbyte *nonreloc, Lisp_Object reloc,
 			     Bytecount offset, Bytecount len)
 {
   if (!rtw_emchar_dynarr)
@@ -504,7 +504,7 @@
   fixup_internal_substring (nonreloc, reloc, offset, &len);
   if (STRINGP (reloc))
     nonreloc = XSTRING_DATA (reloc);
-  convert_bufbyte_string_into_emchar_dynarr (nonreloc, len, rtw_emchar_dynarr);
+  convert_intbyte_string_into_emchar_dynarr (nonreloc, len, rtw_emchar_dynarr);
   return redisplay_text_width_emchar_string
     (w, findex, Dynarr_atp (rtw_emchar_dynarr, 0),
      Dynarr_length (rtw_emchar_dynarr));
@@ -512,7 +512,7 @@
 
 int
 redisplay_frame_text_width_string (struct frame *f, Lisp_Object face,
-				   Bufbyte *nonreloc, Lisp_Object reloc,
+				   Intbyte *nonreloc, Lisp_Object reloc,
 				   Bytecount offset, Bytecount len)
 {
   unsigned char charsets[NUM_LEADING_BYTES];
@@ -526,8 +526,8 @@
   fixup_internal_substring (nonreloc, reloc, offset, &len);
   if (STRINGP (reloc))
     nonreloc = XSTRING_DATA (reloc);
-  convert_bufbyte_string_into_emchar_dynarr (nonreloc, len, rtw_emchar_dynarr);
-  find_charsets_in_bufbyte_string (charsets, nonreloc, len);
+  convert_intbyte_string_into_emchar_dynarr (nonreloc, len, rtw_emchar_dynarr);
+  find_charsets_in_intbyte_string (charsets, nonreloc, len);
   reset_face_cachel (&cachel);
   cachel.face = face;
   XSETFRAME (frame, f);
@@ -687,12 +687,12 @@
    when the contents of the line reach the right boundary of the given
    window. */
 
-static Bufpos
+static Charbpos
 generate_display_line (struct window *w, struct display_line *dl, int bounds,
-		       Bufpos start_pos, prop_block_dynarr **prop,
+		       Charbpos start_pos, prop_block_dynarr **prop,
 		       int type)
 {
-  Bufpos ret_bufpos;
+  Charbpos ret_charbpos;
   int overlay_width;
   struct buffer *b = XBUFFER (WINDOW_BUFFER (w));
 
@@ -720,17 +720,17 @@
   /* Create a display block for the text region of the line. */
   {
     /* #### urk urk urk!!! Chuck fix this shit! */
-    Bytind hacked_up_bytind =
-      create_text_block (w, dl, bufpos_to_bytind (b, start_pos),
+    Bytebpos hacked_up_bytebpos =
+      create_text_block (w, dl, charbpos_to_bytebpos (b, start_pos),
 			 prop, type);
-    if (hacked_up_bytind > BI_BUF_ZV (b))
-      ret_bufpos = BUF_ZV (b) + 1;
+    if (hacked_up_bytebpos > BI_BUF_ZV (b))
+      ret_charbpos = BUF_ZV (b) + 1;
     else
-      ret_bufpos = bytind_to_bufpos (b, hacked_up_bytind);
+      ret_charbpos = bytebpos_to_charbpos (b, hacked_up_bytebpos);
   }
-  dl->bufpos = start_pos;
-  if (dl->end_bufpos < dl->bufpos)
-    dl->end_bufpos = dl->bufpos;
+  dl->charbpos = start_pos;
+  if (dl->end_charbpos < dl->charbpos)
+    dl->end_charbpos = dl->charbpos;
 
   if (MARKERP (Voverlay_arrow_position)
       && EQ (w->buffer, Fmarker_buffer (Voverlay_arrow_position))
@@ -756,9 +756,9 @@
   /* In the future additional types of display blocks may be generated
      here. */
 
-  w->last_redisplay_pos = ret_bufpos;
-
-  return ret_bufpos;
+  w->last_redisplay_pos = ret_charbpos;
+
+  return ret_charbpos;
 }
 
 /* Adds an hscroll glyph to a display block.  If this is called, then
@@ -774,23 +774,23 @@
 {
   struct glyph_block gb;
   prop_block_dynarr *retval;
-  Bytind bi_old_cursor_bufpos = data->bi_cursor_bufpos;
+  Bytebpos bi_old_cursor_charbpos = data->bi_cursor_charbpos;
   int old_cursor_type = data->cursor_type;
-  Bytind bi_old_bufpos = data->bi_bufpos;
+  Bytebpos bi_old_charbpos = data->bi_charbpos;
 
   if (data->cursor_type == CURSOR_ON
-      && data->bi_cursor_bufpos >= data->bi_start_col_enabled
-      && data->bi_cursor_bufpos <= data->bi_bufpos)
-    {
-      data->bi_cursor_bufpos = data->bi_start_col_enabled;
+      && data->bi_cursor_charbpos >= data->bi_start_col_enabled
+      && data->bi_cursor_charbpos <= data->bi_charbpos)
+    {
+      data->bi_cursor_charbpos = data->bi_start_col_enabled;
     }
   else
     {
       data->cursor_type = NO_CURSOR;
     }
 
-  data->bi_endpos = data->bi_bufpos;
-  data->bi_bufpos = data->bi_start_col_enabled;
+  data->bi_endpos = data->bi_charbpos;
+  data->bi_charbpos = data->bi_start_col_enabled;
 
   gb.extent = Qnil;
   gb.glyph = Vhscroll_glyph;
@@ -803,9 +803,9 @@
       data->pixpos - oldpixpos - space_width (XWINDOW (data->window));
   }
   data->bi_endpos = 0;
-  data->bi_cursor_bufpos = bi_old_cursor_bufpos;
+  data->bi_cursor_charbpos = bi_old_cursor_charbpos;
   data->cursor_type = old_cursor_type;
-  data->bi_bufpos = bi_old_bufpos;
+  data->bi_charbpos = bi_old_charbpos;
 
   data->bi_start_col_enabled = 0;
   return retval;
@@ -903,28 +903,28 @@
   crb->findex = data->findex;
   crb->xpos = data->pixpos;
   crb->width = width;
-  if (data->bi_bufpos)
+  if (data->bi_charbpos)
     {
       if (NILP (data->string))
-	crb->bufpos =
-	  bytind_to_bufpos (XBUFFER (WINDOW_BUFFER (XWINDOW (data->window))),
-			    data->bi_bufpos);
+	crb->charbpos =
+	  bytebpos_to_charbpos (XBUFFER (WINDOW_BUFFER (XWINDOW (data->window))),
+			    data->bi_charbpos);
       else
-	crb->bufpos =
-	  bytecount_to_charcount (XSTRING_DATA (data->string), data->bi_bufpos);
+	crb->charbpos =
+	  bytecount_to_charcount (XSTRING_DATA (data->string), data->bi_charbpos);
     }
   else if (data->is_modeline)
-    crb->bufpos = data->modeline_charpos;
+    crb->charbpos = data->modeline_charpos;
   else
     /* Text but not in buffer */
-    crb->bufpos = 0;
+    crb->charbpos = 0;
   crb->type = RUNE_CHAR;
   crb->object.chr.ch = data->font_is_bogus ? '~' : data->ch;
   crb->endpos = 0;
 
   if (data->cursor_type == CURSOR_ON)
     {
-      if (data->bi_bufpos == data->bi_cursor_bufpos)
+      if (data->bi_charbpos == data->bi_cursor_charbpos)
 	{
 	  crb->cursor_type = CURSOR_ON;
 	  data->cursor_x = Dynarr_length (data->db->runes);
@@ -958,10 +958,10 @@
    unless NO_PROP is non-zero. */
 
 static prop_block_dynarr *
-add_bufbyte_string_runes (pos_data *data, Bufbyte *c_string,
+add_intbyte_string_runes (pos_data *data, Intbyte *c_string,
 			  Bytecount c_length, int no_prop)
 {
-  Bufbyte *pos, *end = c_string + c_length;
+  Intbyte *pos, *end = c_string + c_length;
   prop_block_dynarr *prop;
 
   /* #### This function is too simplistic.  It needs to do the same
@@ -972,7 +972,7 @@
 
   for (pos = c_string; pos < end;)
     {
-      Bufbyte *old_pos = pos;
+      Intbyte *old_pos = pos;
 
       data->ch = charptr_emchar (pos);
 
@@ -989,7 +989,7 @@
 	      prop = Dynarr_new (prop_block);
 
 	      pb.type = PROP_STRING;
-	      pb.data.p_string.str = xnew_array (Bufbyte, len);
+	      pb.data.p_string.str = xnew_array (Intbyte, len);
 	      strncpy ((char *) pb.data.p_string.str, (char *) pos, len);
 	      pb.data.p_string.len = len;
 
@@ -1056,19 +1056,19 @@
   rb.findex = data->findex;
   rb.xpos = data->pixpos;
   rb.width = data->blank_width;
-  if (data->bi_bufpos)
-    rb.bufpos =
-      bytind_to_bufpos (XBUFFER (WINDOW_BUFFER (XWINDOW (data->window))),
-			data->bi_bufpos);
+  if (data->bi_charbpos)
+    rb.charbpos =
+      bytebpos_to_charbpos (XBUFFER (WINDOW_BUFFER (XWINDOW (data->window))),
+			data->bi_charbpos);
   else
     /* #### and this is really correct too? */
-    rb.bufpos = 0;
+    rb.charbpos = 0;
   rb.endpos = 0;
   rb.type = RUNE_BLANK;
 
   if (data->cursor_type == CURSOR_ON)
     {
-      if (data->bi_bufpos == data->bi_cursor_bufpos)
+      if (data->bi_charbpos == data->bi_cursor_charbpos)
 	{
 	  rb.cursor_type = CURSOR_ON;
 	  data->cursor_x = Dynarr_length (data->db->runes);
@@ -1258,7 +1258,7 @@
 
   if (STRINGP (entry))
     {
-      prop = add_bufbyte_string_runes (data,
+      prop = add_intbyte_string_runes (data,
 				       XSTRING_DATA   (entry),
 				       XSTRING_LENGTH (entry),
 				       0);
@@ -1293,10 +1293,10 @@
 	  && STRINGP (XCAR (XCDR (entry))))
 	{
 	  Lisp_Object format = XCAR (XCDR (entry));
-	  Bytind len = XSTRING_LENGTH (format);
-	  Bufbyte *src = XSTRING_DATA (format), *end = src + len;
-	  Bufbyte *result = alloca_array (Bufbyte, len);
-	  Bufbyte *dst = result;
+	  Bytebpos len = XSTRING_LENGTH (format);
+	  Intbyte *src = XSTRING_DATA (format), *end = src + len;
+	  Intbyte *result = alloca_array (Intbyte, len);
+	  Intbyte *dst = result;
 
 	  while (src < end)
 	    {
@@ -1320,7 +1320,7 @@
 		    }
 		}
 	    }
-	  prop = add_bufbyte_string_runes (data, result, dst - result, 0);
+	  prop = add_intbyte_string_runes (data, result, dst - result, 0);
 	}
     }
 
@@ -1381,7 +1381,7 @@
      record? */
   int elt;
   prop_block_dynarr *add_failed;
-  Bytind bi_old_cursor_bufpos = data->bi_cursor_bufpos;
+  Bytebpos bi_old_cursor_charbpos = data->bi_cursor_charbpos;
   int old_cursor_type = data->cursor_type;
 
   for (elt = 0; elt < Dynarr_length (*prop); elt++)
@@ -1392,7 +1392,7 @@
 	{
 	case PROP_CHAR:
 	  data->ch = pb->data.p_char.ch;
-	  data->bi_cursor_bufpos = pb->data.p_char.bi_cursor_bufpos;
+	  data->bi_cursor_charbpos = pb->data.p_char.bi_cursor_charbpos;
 	  data->cursor_type = pb->data.p_char.cursor_type;
 	  add_failed = add_emchar_rune (data);
 
@@ -1403,16 +1403,16 @@
 	  if (pb->data.p_string.str)
 	    xfree (pb->data.p_string.str);
 	  /* #### bogus bogus -- this doesn't do anything!
-	     Should probably call add_bufbyte_string_runes(),
+	     Should probably call add_intbyte_string_runes(),
 	     once that function is fixed. */
 	  break;
 	case PROP_MINIBUF_PROMPT:
 	  {
 	    face_index old_findex = data->findex;
-	    Bytind bi_old_bufpos = data->bi_bufpos;
+	    Bytebpos bi_old_charbpos = data->bi_charbpos;
 
 	    data->findex = DEFAULT_INDEX;
-	    data->bi_bufpos = 0;
+	    data->bi_charbpos = 0;
 	    data->cursor_type = NO_CURSOR;
 
 	    while (pb->data.p_string.len > 0)
@@ -1423,13 +1423,13 @@
 		if (add_failed)
 		  {
 		    data->findex = old_findex;
-		    data->bi_bufpos = bi_old_bufpos;
+		    data->bi_charbpos = bi_old_charbpos;
 		    goto oops_no_more_space;
 		  }
 		else
 		  {
 		    /* Complicated equivalent of ptr++, len-- */
-		    Bufbyte *oldpos = pb->data.p_string.str;
+		    Intbyte *oldpos = pb->data.p_string.str;
 		    INC_CHARPTR (pb->data.p_string.str);
 		    pb->data.p_string.len -= pb->data.p_string.str - oldpos;
 		  }
@@ -1437,19 +1437,19 @@
 
 	    data->findex = old_findex;
 	    /* ##### FIXME FIXME FIXME -- Upon successful return from
-	       this function, data->bi_bufpos is automatically incremented.
+	       this function, data->bi_charbpos is automatically incremented.
 	       However, we don't want that to happen if we were adding
 	       the minibuffer prompt. */
 	    {
 	      struct buffer *buf =
 		XBUFFER (WINDOW_BUFFER (XWINDOW (data->window)));
 	      /* #### Chuck fix this shit or I'm gonna scream! */
-	      if (bi_old_bufpos > BI_BUF_BEGV (buf))
-	        data->bi_bufpos = prev_bytind (buf, bi_old_bufpos);
+	      if (bi_old_charbpos > BI_BUF_BEGV (buf))
+	        data->bi_charbpos = prev_bytebpos (buf, bi_old_charbpos);
               else
 		/* #### is this correct?  Does anyone know?
 		   Does anyone care? Is this a cheesy hack or what? */
-	        data->bi_bufpos = BI_BUF_BEGV (buf) - 1;
+	        data->bi_charbpos = BI_BUF_BEGV (buf) - 1;
 	    }
 	  }
 	  break;
@@ -1463,7 +1463,7 @@
 
 	    data->findex = pb->data.p_blank.findex;
 	    data->blank_width = pb->data.p_blank.width;
-	    data->bi_cursor_bufpos = 0;
+	    data->bi_cursor_charbpos = 0;
 	    data->cursor_type = IGNORE_CURSOR;
 
 	    if (data->pixpos + data->blank_width > data->max_pixpos)
@@ -1496,7 +1496,7 @@
 
  oops_no_more_space:
 
-  data->bi_cursor_bufpos = bi_old_cursor_bufpos;
+  data->bi_cursor_charbpos = bi_old_cursor_charbpos;
   data->cursor_type = old_cursor_type;
   if (elt < Dynarr_length (*prop))
     {
@@ -1670,17 +1670,17 @@
 	{
 	  Lisp_Object string = XIMAGE_INSTANCE_TEXT_STRING (instance);
 	  face_index orig_findex = data->findex;
-	  Bytind orig_bufpos = data->bi_bufpos;
-	  Bytind orig_start_col_enabled = data->bi_start_col_enabled;
+	  Bytebpos orig_charbpos = data->bi_charbpos;
+	  Bytebpos orig_start_col_enabled = data->bi_start_col_enabled;
 
 	  data->findex = findex;
 	  data->bi_start_col_enabled = 0;
 	  if (!allow_cursor)
-	    data->bi_bufpos = 0;
-	  add_bufbyte_string_runes (data, XSTRING_DATA (string),
+	    data->bi_charbpos = 0;
+	  add_intbyte_string_runes (data, XSTRING_DATA (string),
 				    XSTRING_LENGTH (string), 0);
 	  data->findex = orig_findex;
-	  data->bi_bufpos = orig_bufpos;
+	  data->bi_charbpos = orig_charbpos;
 	  data->bi_start_col_enabled = orig_start_col_enabled;
 	  return NULL;
 	}
@@ -1688,10 +1688,10 @@
       rb.findex = findex;
       rb.xpos = data->pixpos;
       rb.width = width;
-      rb.bufpos = 0;			/* glyphs are never "at" anywhere */
+      rb.charbpos = 0;			/* glyphs are never "at" anywhere */
       if (data->bi_endpos)
 	/* #### is this necessary at all? */
-	rb.endpos = bytind_to_bufpos (XBUFFER (WINDOW_BUFFER (w)),
+	rb.endpos = bytebpos_to_charbpos (XBUFFER (WINDOW_BUFFER (w)),
 				      data->bi_endpos);
       else
         rb.endpos = 0;
@@ -1702,12 +1702,12 @@
 
       if (allow_cursor)
 	{
-	  rb.bufpos = bytind_to_bufpos (XBUFFER (WINDOW_BUFFER (w)),
-					data->bi_bufpos);
+	  rb.charbpos = bytebpos_to_charbpos (XBUFFER (WINDOW_BUFFER (w)),
+					data->bi_charbpos);
 
 	  if (data->cursor_type == CURSOR_ON)
 	    {
-	      if (data->bi_bufpos == data->bi_cursor_bufpos)
+	      if (data->bi_charbpos == data->bi_cursor_charbpos)
 		{
 		  rb.cursor_type = CURSOR_ON;
 		  data->cursor_x = Dynarr_length (data->db->runes);
@@ -1801,12 +1801,12 @@
    display line DL accurately represents the text on a line starting
    at the given position.
 
-   NOTE NOTE NOTE NOTE: This function works with and returns Bytinds.
+   NOTE NOTE NOTE NOTE: This function works with and returns Bytebposs.
    You must do appropriate conversion. */
 
-static Bytind
+static Bytebpos
 create_text_block (struct window *w, struct display_line *dl,
-		   Bytind bi_start_pos, prop_block_dynarr **prop,
+		   Bytebpos bi_start_pos, prop_block_dynarr **prop,
 		   int type)
 {
   struct frame *f = XFRAME (w->frame);
@@ -1911,7 +1911,7 @@
   data.db = db;
   data.dl = dl;
 
-  data.bi_bufpos = bi_start_pos;
+  data.bi_charbpos = bi_start_pos;
   data.pixpos = dl->bounds.left_in;
   data.last_charset = Qunbound;
   data.last_findex = DEFAULT_INDEX;
@@ -1928,7 +1928,7 @@
 
   if (cursor_in_echo_area && MINI_WINDOW_P (w) && echo_area_active (f))
     {
-      data.bi_cursor_bufpos = BI_BUF_ZV (b);
+      data.bi_cursor_charbpos = BI_BUF_ZV (b);
       data.cursor_type = CURSOR_ON;
     }
   else if (MINI_WINDOW_P (w) && !active_minibuffer)
@@ -1938,12 +1938,12 @@
 	   d == XDEVICE(CONSOLE_SELECTED_DEVICE(XCONSOLE(DEVICE_CONSOLE(d))))&&
 	   f == XFRAME(DEVICE_SELECTED_FRAME(d)))
     {
-      data.bi_cursor_bufpos = BI_BUF_PT (b);
+      data.bi_cursor_charbpos = BI_BUF_PT (b);
       data.cursor_type = CURSOR_ON;
     }
   else if (w == XWINDOW (FRAME_SELECTED_WINDOW (f)))
     {
-      data.bi_cursor_bufpos = bi_marker_position (w->pointm[type]);
+      data.bi_cursor_charbpos = bi_marker_position (w->pointm[type]);
       data.cursor_type = CURSOR_ON;
     }
   else
@@ -1988,10 +1988,10 @@
 	 && (active_minibuffer || !NILP (synch_minibuffers_value)))
     {
       /* #### This check probably should not be necessary. */
-      if (data.bi_bufpos > BI_BUF_ZV (b))
+      if (data.bi_charbpos > BI_BUF_ZV (b))
 	{
 	  /* #### urk!  More of this lossage! */
-	  data.bi_bufpos--;
+	  data.bi_charbpos--;
 	  goto done;
 	}
 
@@ -1999,38 +1999,38 @@
          a continuation line then find the next line we are actually
          supposed to display. */
       if (selective > 0
-	  && (data.bi_bufpos == BI_BUF_BEGV (b)
-	      || BUF_FETCH_CHAR (b, prev_bytind (b, data.bi_bufpos)) == '\n'))
-	{
-	  while (bi_spaces_at_point (b, data.bi_bufpos) >= selective)
+	  && (data.bi_charbpos == BI_BUF_BEGV (b)
+	      || BUF_FETCH_CHAR (b, prev_bytebpos (b, data.bi_charbpos)) == '\n'))
+	{
+	  while (bi_spaces_at_point (b, data.bi_charbpos) >= selective)
 	    {
-	      data.bi_bufpos =
-		bi_find_next_newline_no_quit (b, data.bi_bufpos, 1);
-	      if (data.bi_bufpos >= BI_BUF_ZV (b))
+	      data.bi_charbpos =
+		bi_find_next_newline_no_quit (b, data.bi_charbpos, 1);
+	      if (data.bi_charbpos >= BI_BUF_ZV (b))
 		{
-		  data.bi_bufpos = BI_BUF_ZV (b);
+		  data.bi_charbpos = BI_BUF_ZV (b);
 		  goto done;
 		}
 	    }
 	}
 
       /* Check for face changes. */
-      if (initial || (!no_more_frags && data.bi_bufpos == data.ef->end))
+      if (initial || (!no_more_frags && data.bi_charbpos == data.ef->end))
 	{
 	  /* Now compute the face and begin/end-glyph information. */
 	  data.findex =
-	    /* Remember that the extent-fragment routines deal in Bytind's. */
-	    extent_fragment_update (w, data.ef, data.bi_bufpos);
+	    /* Remember that the extent-fragment routines deal in Bytebpos's. */
+	    extent_fragment_update (w, data.ef, data.bi_charbpos);
 
 	  get_display_tables (w, data.findex, &face_dt, &window_dt);
 
-	  if (data.bi_bufpos == data.ef->end)
+	  if (data.bi_charbpos == data.ef->end)
 	    no_more_frags = 1;
 	}
       initial = 0;
 
       /* Determine what is next to be displayed.  We first handle any
-         glyphs returned by glyphs_at_bufpos.  If there are no glyphs to
+         glyphs returned by glyphs_at_charbpos.  If there are no glyphs to
          display then we determine what to do based on the character at the
          current buffer position. */
 
@@ -2074,7 +2074,7 @@
 	  /* If point is in an invisible region we place it on the
              next visible character. */
 	  if (data.cursor_type == CURSOR_ON
-	      && data.bi_bufpos == data.bi_cursor_bufpos)
+	      && data.bi_charbpos == data.bi_cursor_charbpos)
 	    {
 	      data.cursor_type = NEXT_CURSOR;
 	    }
@@ -2083,10 +2083,10 @@
 	  if (data.start_col)
 	    data.start_col--;
 
-	  if (data.bi_bufpos == BI_BUF_ZV (b))
+	  if (data.bi_charbpos == BI_BUF_ZV (b))
 	    goto done;
 	  else
-	    INC_BYTIND (b, data.bi_bufpos);
+	    INC_BYTEBPOS (b, data.bi_charbpos);
 	}
 
       /* If there is propagation data, then it represents the current
@@ -2100,13 +2100,13 @@
 
 	  if (*prop)
 	    goto done;	/* gee, a really narrow window */
-	  else if (data.bi_bufpos == BI_BUF_ZV (b))
+	  else if (data.bi_charbpos == BI_BUF_ZV (b))
 	    goto done;
-	  else if (data.bi_bufpos < BI_BUF_BEGV (b))
+	  else if (data.bi_charbpos < BI_BUF_BEGV (b))
 	    /* #### urk urk urk! Aborts are not very fun! Fix this please! */
-	    data.bi_bufpos = BI_BUF_BEGV (b);
+	    data.bi_charbpos = BI_BUF_BEGV (b);
 	  else
-	    INC_BYTIND (b, data.bi_bufpos);
+	    INC_BYTEBPOS (b, data.bi_charbpos);
 	}
 
       /* If there are end glyphs, add them to the line.  These are
@@ -2132,14 +2132,14 @@
       /* If at end-of-buffer, we've already processed begin and
 	 end-glyphs at this point and there's no text to process,
 	 so we're done. */
-      else if (data.bi_bufpos == BI_BUF_ZV (b))
+      else if (data.bi_charbpos == BI_BUF_ZV (b))
 	goto done;
 
       else
 	{
 	  Lisp_Object entry = Qnil;
 	  /* Get the character at the current buffer position. */
-	  data.ch = BI_BUF_FETCH_CHAR (b, data.bi_bufpos);
+	  data.ch = BI_BUF_FETCH_CHAR (b, data.bi_charbpos);
 	  if (!NILP (face_dt) || !NILP (window_dt))
 	    entry = display_table_entry (data.ch, face_dt, window_dt);
 
@@ -2164,7 +2164,7 @@
 
 	      if (selective > 0
 		  && (bi_spaces_at_point
-		      (b, next_bytind (b, data.bi_bufpos))
+		      (b, next_bytebpos (b, data.bi_charbpos))
 		      >= selective))
 		{
 		  if (!NILP (b->selective_display_ellipses))
@@ -2186,25 +2186,25 @@
 		      *prop = add_emchar_rune (&data);
 		    }
 
-		  /* We need to set data.bi_bufpos to the start of the
+		  /* We need to set data.bi_charbpos to the start of the
                      next visible region in order to make this line
                      appear to contain all of the invisible area.
                      Otherwise, the line cache won't work
                      correctly. */
-		  INC_BYTIND (b, data.bi_bufpos);
-		  while (bi_spaces_at_point (b, data.bi_bufpos) >= selective)
+		  INC_BYTEBPOS (b, data.bi_charbpos);
+		  while (bi_spaces_at_point (b, data.bi_charbpos) >= selective)
 		    {
-		      data.bi_bufpos =
-			bi_find_next_newline_no_quit (b, data.bi_bufpos, 1);
-		      if (data.bi_bufpos >= BI_BUF_ZV (b))
+		      data.bi_charbpos =
+			bi_find_next_newline_no_quit (b, data.bi_charbpos, 1);
+		      if (data.bi_charbpos >= BI_BUF_ZV (b))
 			{
-			  data.bi_bufpos = BI_BUF_ZV (b);
+			  data.bi_charbpos = BI_BUF_ZV (b);
 			  break;
 			}
 		    }
 		  if (BI_BUF_FETCH_CHAR
-		      (b, prev_bytind (b, data.bi_bufpos)) == '\n')
-		    DEC_BYTIND (b, data.bi_bufpos);
+		      (b, prev_bytebpos (b, data.bi_charbpos)) == '\n')
+		    DEC_BYTEBPOS (b, data.bi_charbpos);
 		}
 	      else
 		{
@@ -2221,20 +2221,20 @@
              line is done. */
 	  else if (data.ch == (('M' & 037)) && selective == -1)
 	    {
-	      Bytind bi_next_bufpos;
+	      Bytebpos bi_next_charbpos;
 
 	      /* Find the buffer position at the end of the line. */
-	      bi_next_bufpos =
-		bi_find_next_newline_no_quit (b, data.bi_bufpos, 1);
-	      if (BI_BUF_FETCH_CHAR (b, prev_bytind (b, bi_next_bufpos))
+	      bi_next_charbpos =
+		bi_find_next_newline_no_quit (b, data.bi_charbpos, 1);
+	      if (BI_BUF_FETCH_CHAR (b, prev_bytebpos (b, bi_next_charbpos))
 		  == '\n')
-		DEC_BYTIND (b, bi_next_bufpos);
+		DEC_BYTEBPOS (b, bi_next_charbpos);
 
 	      /* If the cursor is somewhere in the elided text make
                  sure that the cursor gets drawn appropriately. */
 	      if (data.cursor_type == CURSOR_ON
-		  && (data.bi_cursor_bufpos >= data.bi_bufpos &&
-		      data.bi_cursor_bufpos < bi_next_bufpos))
+		  && (data.bi_cursor_charbpos >= data.bi_charbpos &&
+		      data.bi_cursor_charbpos < bi_next_charbpos))
 		{
 		    data.cursor_type = NEXT_CURSOR;
 		}
@@ -2260,10 +2260,10 @@
                  need to do this before potentially adding a newline
                  so that the cursor flag will get set correctly (if
                  needed). */
-	      data.bi_bufpos = bi_next_bufpos;
+	      data.bi_charbpos = bi_next_charbpos;
 
 	      if (NILP (b->selective_display_ellipses)
-		  || data.bi_cursor_bufpos == bi_next_bufpos)
+		  || data.bi_cursor_charbpos == bi_next_charbpos)
 		{
 		  /* We have to at least add a newline character so
                      that the cursor shows up properly. */
@@ -2280,7 +2280,7 @@
 	      /* This had better be a newline but doing it this way
                  we'll see obvious incorrect results if it isn't.  No
                  need to abort here. */
-	      data.ch = BI_BUF_FETCH_CHAR (b, data.bi_bufpos);
+	      data.ch = BI_BUF_FETCH_CHAR (b, data.bi_charbpos);
 
 	      goto done;
 	    }
@@ -2349,7 +2349,7 @@
 	     often bites people who carelessly use `char' instead
 	     of `unsigned char'.)
 	     */
-	  else if (data.ch < 0x100 && iscntrl ((Bufbyte) data.ch))
+	  else if (data.ch < 0x100 && iscntrl ((Intbyte) data.ch))
 	    {
 	      *prop = add_control_char_runes (&data, b);
 
@@ -2376,7 +2376,7 @@
 		goto done;
 	    }
 
-	  INC_BYTIND (b, data.bi_bufpos);
+	  INC_BYTEBPOS (b, data.bi_charbpos);
 	}
     }
 
@@ -2384,15 +2384,15 @@
 
   /* Determine the starting point of the next line if we did not hit the
      end of the buffer. */
-  if (data.bi_bufpos < BI_BUF_ZV (b)
+  if (data.bi_charbpos < BI_BUF_ZV (b)
       && (active_minibuffer || !NILP (synch_minibuffers_value)))
     {
       /* #### This check is not correct.  If the line terminated
 	 due to a begin-glyph or end-glyph hitting window-end, then
-	 data.ch will not point to the character at data.bi_bufpos.  If
+	 data.ch will not point to the character at data.bi_charbpos.  If
 	 you make the two changes mentioned at the top of this loop,
 	 you should be able to say '(if (*prop))'.  That should also
-	 make it possible to eliminate the data.bi_bufpos < BI_BUF_ZV (b)
+	 make it possible to eliminate the data.bi_charbpos < BI_BUF_ZV (b)
 	 check. */
 
       /* The common case is that the line ended because we hit a newline.
@@ -2408,15 +2408,15 @@
 	    {
 	      if (data.cursor_type == CURSOR_ON)
 		{
-		  if (data.bi_cursor_bufpos >= bi_start_pos
-		      && data.bi_cursor_bufpos <= data.bi_bufpos)
-		    data.bi_cursor_bufpos = data.bi_bufpos;
+		  if (data.bi_cursor_charbpos >= bi_start_pos
+		      && data.bi_cursor_charbpos <= data.bi_charbpos)
+		    data.bi_cursor_charbpos = data.bi_charbpos;
 		}
 	      data.findex = DEFAULT_INDEX;
 	      data.start_col = 0;
 	      data.bi_start_col_enabled = 0;
 
-	      if (data.bi_bufpos != bi_start_pos)
+	      if (data.bi_charbpos != bi_start_pos)
 		{
 		  struct glyph_block gb;
 
@@ -2436,7 +2436,7 @@
 		}
 	    }
 
-	  INC_BYTIND (b, data.bi_bufpos);
+	  INC_BYTEBPOS (b, data.bi_charbpos);
 	}
 
       /* Otherwise we have a buffer line which cannot fit on one display
@@ -2456,10 +2456,10 @@
 
 	  if (truncate_win)
 	    {
-	      Bytind bi_pos;
+	      Bytebpos bi_pos;
 
 	      /* Now find the start of the next line. */
-	      bi_pos = bi_find_next_newline_no_quit (b, data.bi_bufpos, 1);
+	      bi_pos = bi_find_next_newline_no_quit (b, data.bi_charbpos, 1);
 
 	      /* If the cursor is past the truncation line then we
                  make it appear on the truncation glyph.  If we've hit
@@ -2468,17 +2468,17 @@
                  newline.  In that case the cursor should actually
                  appear on the next line. */
 	      if (data.cursor_type == CURSOR_ON
-		  && data.bi_cursor_bufpos >= data.bi_bufpos
-		  && (data.bi_cursor_bufpos < bi_pos ||
+		  && data.bi_cursor_charbpos >= data.bi_charbpos
+		  && (data.bi_cursor_charbpos < bi_pos ||
 		      (bi_pos == BI_BUF_ZV (b)
 		       && (bi_pos == BI_BUF_BEGV (b)
-			   || (BI_BUF_FETCH_CHAR (b, prev_bytind (b, bi_pos))
+			   || (BI_BUF_FETCH_CHAR (b, prev_bytebpos (b, bi_pos))
 			       != '\n')))))
-		data.bi_cursor_bufpos = bi_pos;
+		data.bi_cursor_charbpos = bi_pos;
 	      else
 		data.cursor_type = NO_CURSOR;
 
-	      data.bi_bufpos = bi_pos;
+	      data.bi_charbpos = bi_pos;
 	      gb.glyph = Vtruncation_glyph;
 	      cachel = GLYPH_CACHEL (w, TRUN_GLYPH_INDEX);
 	    }
@@ -2487,7 +2487,7 @@
 	      /* The cursor can never be on the continuation glyph. */
 	      data.cursor_type = NO_CURSOR;
 
-	      /* data.bi_bufpos is already at the start of the next line. */
+	      /* data.bi_charbpos is already at the start of the next line. */
 
 	      dl->line_continuation = 1;
 	      gb.glyph = Vcontinuation_glyph;
@@ -2496,14 +2496,14 @@
 
 	  add_glyph_rune (&data, &gb, BEGIN_GLYPHS, 0, cachel);
 
-	  if (truncate_win && data.bi_bufpos == BI_BUF_ZV (b)
-	      && BI_BUF_FETCH_CHAR (b, prev_bytind (b, BI_BUF_ZV (b))) != '\n')
+	  if (truncate_win && data.bi_charbpos == BI_BUF_ZV (b)
+	      && BI_BUF_FETCH_CHAR (b, prev_bytebpos (b, BI_BUF_ZV (b))) != '\n')
 	    /* #### Damn this losing shit. */
-	    data.bi_bufpos++;
+	    data.bi_charbpos++;
 	}
     }
   else if ((active_minibuffer || !NILP (synch_minibuffers_value))
-	   && (!echo_area_active (f) || data.bi_bufpos == BI_BUF_ZV (b)))
+	   && (!echo_area_active (f) || data.bi_charbpos == BI_BUF_ZV (b)))
     {
       /* We need to add a marker to the end of the line since there is no
          newline character in order for the cursor to get drawn.  We label
@@ -2524,7 +2524,7 @@
       /* #### urk!  Chuck, this shit is bad news.  Going around
 	 manipulating invalid positions is guaranteed to result in
 	 trouble sooner or later. */
-      data.bi_bufpos = BI_BUF_ZV (b) + 1;
+      data.bi_charbpos = BI_BUF_ZV (b) + 1;
     }
 
   /* Calculate left whitespace boundary. */
@@ -2624,17 +2624,17 @@
 
   dl->cursor_elt = data.cursor_x;
   /* #### lossage lossage lossage! Fix this shit! */
-  if (data.bi_bufpos > BI_BUF_ZV (b))
-    dl->end_bufpos = BUF_ZV (b);
+  if (data.bi_charbpos > BI_BUF_ZV (b))
+    dl->end_charbpos = BUF_ZV (b);
   else
-    dl->end_bufpos = bytind_to_bufpos (b, data.bi_bufpos) - 1;
+    dl->end_charbpos = bytebpos_to_charbpos (b, data.bi_charbpos) - 1;
   if (truncate_win)
-    data.dl->num_chars = column_at_point (b, dl->end_bufpos, 0);
+    data.dl->num_chars = column_at_point (b, dl->end_charbpos, 0);
   else
     /* This doesn't correctly take into account tabs and control
        characters but if the window isn't being truncated then this
        value isn't going to end up being used anyhow. */
-    data.dl->num_chars = dl->end_bufpos - dl->bufpos;
+    data.dl->num_chars = dl->end_charbpos - dl->charbpos;
 
   /* #### handle horizontally scrolled line with text none of which
      was actually laid out. */
@@ -2657,10 +2657,10 @@
      The main loop should get fixed so that it isn't necessary to call
      this function if we are already at EOB. */
 
-  if (data.bi_bufpos == BI_BUF_ZV (b) && bi_start_pos == BI_BUF_ZV (b))
-    return data.bi_bufpos + 1; /* Yuck! */
+  if (data.bi_charbpos == BI_BUF_ZV (b) && bi_start_pos == BI_BUF_ZV (b))
+    return data.bi_charbpos + 1; /* Yuck! */
   else
-    return data.bi_bufpos;
+    return data.bi_charbpos;
 }
 
 /* Display the overlay arrow at the beginning of the given line. */
@@ -2696,7 +2696,7 @@
 
   if (STRINGP (Voverlay_arrow_string))
     {
-      add_bufbyte_string_runes
+      add_intbyte_string_runes
 	(&data,
 	 XSTRING_DATA   (Voverlay_arrow_string),
 	 XSTRING_LENGTH (Voverlay_arrow_string),
@@ -2830,7 +2830,7 @@
 	       : get_builtin_face_cache_index (w, Vright_margin_face));
   rb.xpos = xpos;
   rb.width = width;
-  rb.bufpos = -1;
+  rb.charbpos = -1;
   rb.endpos = 0;
   rb.type = RUNE_BLANK;
   rb.cursor_type = CURSOR_OFF;
@@ -3539,7 +3539,7 @@
     {
       int elt;
       Bytecount len;
-      Bufbyte *strdata;
+      Intbyte *strdata;
       struct buffer *buf = XBUFFER (WINDOW_BUFFER (w));
 
       in_modeline_generation = 1;
@@ -3628,7 +3628,7 @@
       rb.findex = MODELINE_INDEX;
       rb.xpos = dl->bounds.left_out;
       rb.width = dl->bounds.right_out - dl->bounds.left_out;
-      rb.bufpos = 0;
+      rb.charbpos = 0;
       rb.endpos = 0;
       rb.type = RUNE_HLINE;
       rb.object.hline.thickness = 1;
@@ -3681,12 +3681,12 @@
 }
 
 static Charcount
-add_string_to_fstring_db_runes (pos_data *data, const Bufbyte *str,
+add_string_to_fstring_db_runes (pos_data *data, const Intbyte *str,
                                 Charcount pos, Charcount min_pos, Charcount max_pos)
 {
   /* This function has been Mule-ized. */
   Charcount end;
-  const Bufbyte *cur_pos = str;
+  const Intbyte *cur_pos = str;
   struct display_block *db = data->db;
 
   data->blank_width = space_width (XWINDOW (data->window));
@@ -3700,7 +3700,7 @@
 
   while (pos < end && *cur_pos)
     {
-      const Bufbyte *old_cur_pos = cur_pos;
+      const Intbyte *old_cur_pos = cur_pos;
       int succeeded;
 
       data->ch = charptr_emchar (cur_pos);
@@ -3791,11 +3791,11 @@
       /* A string.  Add to the display line and check for %-constructs
          within it. */
 
-      Bufbyte *this = XSTRING_DATA (elt);
+      Intbyte *this = XSTRING_DATA (elt);
 
       while ((pos < max_pos || max_pos == -1) && *this)
         {
-          Bufbyte *last = this;
+          Intbyte *last = this;
 
           while (*this && *this != '%')
             this++;
@@ -3812,7 +3812,7 @@
 		{
 		  Charcount tmp_max = (max_pos == -1 ? pos + size - *offset :
 				       min (pos + size - *offset, max_pos));
-		  const Bufbyte *tmp_last = charptr_n_addr (last, *offset);
+		  const Intbyte *tmp_last = charptr_n_addr (last, *offset);
 
 		  pos = add_string_to_fstring_db_runes (data, tmp_last,
 							pos, pos, tmp_max);
@@ -3856,7 +3856,7 @@
                     {
                       int cur_pixsize;
                       int dash_pixsize;
-                      Bufbyte ch = '-';
+                      Intbyte ch = '-';
                       SET_CURRENT_MODE_CHARS_PIXSIZE;
 
                       dash_pixsize =
@@ -3869,26 +3869,26 @@
 
                   while (num_to_add--)
                     pos = add_string_to_fstring_db_runes
-                      (data, (const Bufbyte *) "-", pos, pos, max_pos);
+                      (data, (const Intbyte *) "-", pos, pos, max_pos);
                 }
               else if (*this != 0)
                 {
                   Emchar ch = charptr_emchar (this);
-                  Bufbyte *str;
+                  Intbyte *str;
 		  Charcount size;
 
                   decode_mode_spec (w, ch, type);
 
-                  str = Dynarr_atp (mode_spec_bufbyte_string, 0);
+                  str = Dynarr_atp (mode_spec_intbyte_string, 0);
 		  size = bytecount_to_charcount
 		    /* Skip the null character added by `decode_mode_spec' */
-		    (str, Dynarr_length (mode_spec_bufbyte_string)) - 1;
+		    (str, Dynarr_length (mode_spec_intbyte_string)) - 1;
 
 		  if (size <= *offset)
 		    *offset -= size;
 		  else
 		    {
-		      const Bufbyte *tmp_str = charptr_n_addr (str, *offset);
+		      const Intbyte *tmp_str = charptr_n_addr (str, *offset);
 
 		      /* #### NOTE: I don't understand why a tmp_max is not
 			 computed and used here as in the plain string case
@@ -3927,14 +3927,14 @@
              don't check for % within it.  */
           if (STRINGP (tem))
             {
-	      Bufbyte *str = XSTRING_DATA (tem);
+	      Intbyte *str = XSTRING_DATA (tem);
 	      Charcount size = XSTRING_CHAR_LENGTH (tem);
 
 	      if (size <= *offset)
 		*offset -= size;
 	      else
 		{
-		  const Bufbyte *tmp_str = charptr_n_addr (str, *offset);
+		  const Intbyte *tmp_str = charptr_n_addr (str, *offset);
 
 		  /* #### NOTE: I don't understand why a tmp_max is not
 		     computed and used here as in the plain string case
@@ -4128,8 +4128,8 @@
 	  *offset -= size;
 	else
 	  {
-	    const Bufbyte *tmp_str =
-	      charptr_n_addr ((const Bufbyte *) str, *offset);
+	    const Intbyte *tmp_str =
+	      charptr_n_addr ((const Intbyte *) str, *offset);
 
 	    /* #### NOTE: I don't understand why a tmp_max is not computed and
 	       used here as in the plain string case above. -- dv */
@@ -4142,7 +4142,7 @@
 
   if (min_pos > pos)
     {
-      add_string_to_fstring_db_runes (data, (const Bufbyte *) "", pos,
+      add_string_to_fstring_db_runes (data, (const Intbyte *) "", pos,
 				      min_pos, -1);
     }
 
@@ -4262,10 +4262,10 @@
    modeline routines should be modified to use this code as it copes
    with many more types of display situation. */
 
-static Bufpos
+static Charbpos
 create_string_text_block (struct window *w, Lisp_Object disp_string,
 			  struct display_line *dl,
-			  Bufpos start_pos,
+			  Charbpos start_pos,
 			  prop_block_dynarr **prop,
 			  face_index default_face)
 {
@@ -4282,7 +4282,7 @@
   /* we're working with these a lot so precalculate them */
   Bytecount slen = XSTRING_LENGTH (disp_string);
   Bytecount bi_string_zv = slen;
-  Bytind bi_start_pos = charcount_to_bytecount (string_data (s), start_pos);
+  Bytebpos bi_start_pos = charcount_to_bytecount (string_data (s), start_pos);
 
   pos_data data;
 
@@ -4385,7 +4385,7 @@
   data.db = db;
   data.dl = dl;
 
-  data.bi_bufpos = bi_start_pos;
+  data.bi_charbpos = bi_start_pos;
   data.pixpos = dl->bounds.left_in;
   data.last_charset = Qunbound;
   data.last_findex = default_face;
@@ -4447,20 +4447,20 @@
   while (data.pixpos <= data.max_pixpos)
     {
       /* #### This check probably should not be necessary. */
-      if (data.bi_bufpos > bi_string_zv)
+      if (data.bi_charbpos > bi_string_zv)
 	{
 	  /* #### urk!  More of this lossage! */
-	  data.bi_bufpos--;
+	  data.bi_charbpos--;
 	  goto done;
 	}
 
       /* Check for face changes. */
-      if (initial || (!no_more_frags && data.bi_bufpos == data.ef->end))
+      if (initial || (!no_more_frags && data.bi_charbpos == data.ef->end))
 	{
 	  /* Now compute the face and begin/end-glyph information. */
 	  data.findex =
-	    /* Remember that the extent-fragment routines deal in Bytind's. */
-	    extent_fragment_update (w, data.ef, data.bi_bufpos);
+	    /* Remember that the extent-fragment routines deal in Bytebpos's. */
+	    extent_fragment_update (w, data.ef, data.bi_charbpos);
 	  /* This is somewhat cheesy but the alternative is to
              propagate default_face into extent_fragment_update. */
 	  if (data.findex == DEFAULT_INDEX)
@@ -4468,13 +4468,13 @@
 
 	  get_display_tables (w, data.findex, &face_dt, &window_dt);
 
-	  if (data.bi_bufpos == data.ef->end)
+	  if (data.bi_charbpos == data.ef->end)
 	    no_more_frags = 1;
 	}
       initial = 0;
 
       /* Determine what is next to be displayed.  We first handle any
-         glyphs returned by glyphs_at_bufpos.  If there are no glyphs to
+         glyphs returned by glyphs_at_charbpos.  If there are no glyphs to
          display then we determine what to do based on the character at the
          current buffer position. */
 
@@ -4519,10 +4519,10 @@
 	  if (data.start_col)
 	    data.start_col--;
 
-	  if (data.bi_bufpos == bi_string_zv)
+	  if (data.bi_charbpos == bi_string_zv)
 	    goto done;
 	  else
-	    INC_CHARBYTIND (string_data (s), data.bi_bufpos);
+	    INC_CHARBYTEBPOS (string_data (s), data.bi_charbpos);
 	}
 
       /* If there is propagation data, then it represents the current
@@ -4536,13 +4536,13 @@
 
 	  if (*prop)
 	    goto done;	/* gee, a really narrow window */
-	  else if (data.bi_bufpos == bi_string_zv)
+	  else if (data.bi_charbpos == bi_string_zv)
 	    goto done;
-	  else if (data.bi_bufpos < 0)
+	  else if (data.bi_charbpos < 0)
 	    /* #### urk urk urk! Aborts are not very fun! Fix this please! */
-	    data.bi_bufpos = 0;
+	    data.bi_charbpos = 0;
 	  else
-	    INC_CHARBYTIND (string_data (s), data.bi_bufpos);
+	    INC_CHARBYTEBPOS (string_data (s), data.bi_charbpos);
 	}
 
       /* If there are end glyphs, add them to the line.  These are
@@ -4568,14 +4568,14 @@
       /* If at end-of-buffer, we've already processed begin and
 	 end-glyphs at this point and there's no text to process,
 	 so we're done. */
-      else if (data.bi_bufpos == bi_string_zv)
+      else if (data.bi_charbpos == bi_string_zv)
 	goto done;
 
       else
 	{
 	  Lisp_Object entry = Qnil;
 	  /* Get the character at the current buffer position. */
-	  data.ch = string_char (s, data.bi_bufpos);
+	  data.ch = string_char (s, data.bi_charbpos);
 	  if (!NILP (face_dt) || !NILP (window_dt))
 	    entry = display_table_entry (data.ch, face_dt, window_dt);
 
@@ -4663,7 +4663,7 @@
 	     often bites people who carelessly use `char' instead
 	     of `unsigned char'.)
 	     */
-	  else if (data.ch < 0x100 && iscntrl ((Bufbyte) data.ch))
+	  else if (data.ch < 0x100 && iscntrl ((Intbyte) data.ch))
 	    {
 	      *prop = add_control_char_runes (&data, b);
 
@@ -4690,7 +4690,7 @@
 		goto done;
 	    }
 
-	  INC_CHARBYTIND (string_data (s), data.bi_bufpos);
+	  INC_CHARBYTEBPOS (string_data (s), data.bi_charbpos);
 	}
     }
 
@@ -4698,14 +4698,14 @@
 
   /* Determine the starting point of the next line if we did not hit the
      end of the buffer. */
-  if (data.bi_bufpos < bi_string_zv)
+  if (data.bi_charbpos < bi_string_zv)
     {
       /* #### This check is not correct.  If the line terminated
 	 due to a begin-glyph or end-glyph hitting window-end, then
-	 data.ch will not point to the character at data.bi_bufpos.  If
+	 data.ch will not point to the character at data.bi_charbpos.  If
 	 you make the two changes mentioned at the top of this loop,
 	 you should be able to say '(if (*prop))'.  That should also
-	 make it possible to eliminate the data.bi_bufpos < BI_BUF_ZV (b)
+	 make it possible to eliminate the data.bi_charbpos < BI_BUF_ZV (b)
 	 check. */
 
       /* The common case is that the line ended because we hit a newline.
@@ -4713,7 +4713,7 @@
          position. */
       if (data.ch == '\n')
 	{
-	  INC_CHARBYTIND (string_data (s), data.bi_bufpos);
+	  INC_CHARBYTEBPOS (string_data (s), data.bi_charbpos);
 	}
 
       /* Otherwise we have a buffer line which cannot fit on one display
@@ -4733,13 +4733,13 @@
 
 	  if (truncate_win)
 	    {
-	      Bytind bi_pos;
+	      Bytebpos bi_pos;
 
 	      /* Now find the start of the next line. */
-	      bi_pos = bi_find_next_emchar_in_string (s, '\n', data.bi_bufpos, 1);
+	      bi_pos = bi_find_next_emchar_in_string (s, '\n', data.bi_charbpos, 1);
 
 	      data.cursor_type = NO_CURSOR;
-	      data.bi_bufpos = bi_pos;
+	      data.bi_charbpos = bi_pos;
 	      gb.glyph = Vtruncation_glyph;
 	      cachel = GLYPH_CACHEL (w, TRUN_GLYPH_INDEX);
 	    }
@@ -4748,7 +4748,7 @@
 	      /* The cursor can never be on the continuation glyph. */
 	      data.cursor_type = NO_CURSOR;
 
-	      /* data.bi_bufpos is already at the start of the next line. */
+	      /* data.bi_charbpos is already at the start of the next line. */
 
 	      dl->line_continuation = 1;
 	      gb.glyph = Vcontinuation_glyph;
@@ -4758,19 +4758,19 @@
 	  if (end_glyph_width)
 	    add_glyph_rune (&data, &gb, BEGIN_GLYPHS, 0, cachel);
 
-	  if (truncate_win && data.bi_bufpos == bi_string_zv)
+	  if (truncate_win && data.bi_charbpos == bi_string_zv)
 	    {
-	      const Bufbyte* endb = charptr_n_addr (string_data (s), bi_string_zv);
+	      const Intbyte* endb = charptr_n_addr (string_data (s), bi_string_zv);
 	      DEC_CHARPTR (endb);
 	      if (charptr_emchar (endb) != '\n')
 		{
 		  /* #### Damn this losing shit. */
-		  data.bi_bufpos++;
+		  data.bi_charbpos++;
 		}
 	    }
 	}
     }
-  else if (data.bi_bufpos == bi_string_zv)
+  else if (data.bi_charbpos == bi_string_zv)
     {
       /* create_text_block () adds a bogus \n marker here which screws
 	 up subwindow display. Since we never have a cursor in the
@@ -4873,18 +4873,18 @@
 
   dl->cursor_elt = data.cursor_x;
   /* #### lossage lossage lossage! Fix this shit! */
-  if (data.bi_bufpos > bi_string_zv)
-    dl->end_bufpos = buffer_or_string_bytind_to_bufpos (disp_string, bi_string_zv);
+  if (data.bi_charbpos > bi_string_zv)
+    dl->end_charbpos = buffer_or_string_bytebpos_to_charbpos (disp_string, bi_string_zv);
   else
-    dl->end_bufpos = buffer_or_string_bytind_to_bufpos (disp_string, data.bi_bufpos) - 1;
+    dl->end_charbpos = buffer_or_string_bytebpos_to_charbpos (disp_string, data.bi_charbpos) - 1;
   if (truncate_win)
     data.dl->num_chars =
-      string_column_at_point (s, dl->end_bufpos, b ? XINT (b->tab_width) : 8);
+      string_column_at_point (s, dl->end_charbpos, b ? XINT (b->tab_width) : 8);
   else
     /* This doesn't correctly take into account tabs and control
        characters but if the window isn't being truncated then this
        value isn't going to end up being used anyhow. */
-    data.dl->num_chars = dl->end_bufpos - dl->bufpos;
+    data.dl->num_chars = dl->end_charbpos - dl->charbpos;
 
   /* #### handle horizontally scrolled line with text none of which
      was actually laid out. */
@@ -4907,10 +4907,10 @@
      The main loop should get fixed so that it isn't necessary to call
      this function if we are already at EOB. */
 
-  if (data.bi_bufpos == bi_string_zv && bi_start_pos == bi_string_zv)
-    return bytecount_to_charcount (string_data (s), data.bi_bufpos) + 1; /* Yuck! */
+  if (data.bi_charbpos == bi_string_zv && bi_start_pos == bi_string_zv)
+    return bytecount_to_charcount (string_data (s), data.bi_charbpos) + 1; /* Yuck! */
   else
-    return bytecount_to_charcount (string_data (s), data.bi_bufpos);
+    return bytecount_to_charcount (string_data (s), data.bi_charbpos);
 }
 
 /* Given a display line and a starting position, ensure that the
@@ -4922,16 +4922,16 @@
 
    This is very similar to generate_display_line but with the same
    limitations as create_string_text_block. I have taken the liberty
-   of fixing the bytind stuff though.*/
-
-static Bufpos
+   of fixing the bytebpos stuff though.*/
+
+static Charbpos
 generate_string_display_line (struct window *w, Lisp_Object disp_string,
 			      struct display_line *dl,
-			      Bufpos start_pos,
+			      Charbpos start_pos,
 			      prop_block_dynarr **prop,
 			      face_index default_face)
 {
-  Bufpos ret_bufpos;
+  Charbpos ret_charbpos;
 
   /* you must set bounds before calling this. */
 
@@ -4953,11 +4953,11 @@
   dl->modeline = 0;
 
   /* Create a display block for the text region of the line. */
-  ret_bufpos = create_string_text_block (w, disp_string, dl, start_pos,
+  ret_charbpos = create_string_text_block (w, disp_string, dl, start_pos,
 					 prop, default_face);
-  dl->bufpos = start_pos;
-  if (dl->end_bufpos < dl->bufpos)
-    dl->end_bufpos = dl->bufpos;
+  dl->charbpos = start_pos;
+  if (dl->end_charbpos < dl->charbpos)
+    dl->end_charbpos = dl->charbpos;
 
   /* If there are left glyphs associated with any character in the
      text block, then create a display block to handle them. */
@@ -4969,7 +4969,7 @@
   if (dl->right_glyphs != NULL && Dynarr_length (dl->right_glyphs))
     create_right_glyph_block (w, dl);
 
-  return ret_bufpos;
+  return ret_charbpos;
 }
 
 /* This is ripped off from regenerate_window. All we want to do is
@@ -4979,7 +4979,7 @@
 generate_displayable_area (struct window *w, Lisp_Object disp_string,
 			   int xpos, int ypos, int width, int height,
 			   display_line_dynarr* dla,
-			   Bufpos start_pos,
+			   Charbpos start_pos,
 			   face_index default_face)
 {
   int yend = ypos + height;
@@ -5011,7 +5011,7 @@
     {
       struct display_line dl;
       struct display_line *dlp;
-      Bufpos next_pos;
+      Charbpos next_pos;
       int local;
 
       if (Dynarr_length (dla) < Dynarr_largest (dla))
@@ -5085,7 +5085,7 @@
    changed it to the echo area buffer. */
 
 static void
-regenerate_window (struct window *w, Bufpos start_pos, Bufpos point, int type)
+regenerate_window (struct window *w, Charbpos start_pos, Charbpos point, int type)
 {
   struct frame *f = XFRAME (w->frame);
   struct buffer *b = XBUFFER (w->buffer);
@@ -5298,7 +5298,7 @@
 	dla_end = Dynarr_length (cdla) - 1;	\
       }						\
 						\
-    start_pos = (Dynarr_atp (cdla, dla_start)->bufpos \
+    start_pos = (Dynarr_atp (cdla, dla_start)->charbpos \
 		 + Dynarr_atp (cdla, dla_start)->offset); \
     /* If this isn't true, then startp has changed and we need to do a \
        full regen. */				\
@@ -5320,8 +5320,8 @@
    when dealing with buffer changes. */
 
 static int
-regenerate_window_extents_only_changed (struct window *w, Bufpos startp,
-					Bufpos pointm,
+regenerate_window_extents_only_changed (struct window *w, Charbpos startp,
+					Charbpos pointm,
 					Charcount beg_unchanged,
 					Charcount end_unchanged)
 {
@@ -5332,7 +5332,7 @@
   int dla_start = 0;
   int dla_end, line;
   int first_line, last_line;
-  Bufpos start_pos;
+  Charbpos start_pos;
   /* Don't define this in the loop where it is used because we
      definitely want its value to survive between passes. */
   prop_block_dynarr *prop = NULL;
@@ -5396,8 +5396,8 @@
   while (line <= dla_end)
     {
       struct display_line *dl = Dynarr_atp (cdla, line);
-      Bufpos lstart = dl->bufpos + dl->offset;
-      Bufpos lend = dl->end_bufpos + dl->offset;
+      Charbpos lstart = dl->charbpos + dl->offset;
+      Charbpos lend = dl->end_charbpos + dl->offset;
 
       if (beg_unchanged >= lstart && beg_unchanged <= lend)
 	break;
@@ -5431,20 +5431,20 @@
   first_line = last_line = line;
   while (line <= dla_end)
     {
-      Bufpos old_start, old_end, new_start;
+      Charbpos old_start, old_end, new_start;
       struct display_line *cdl = Dynarr_atp (cdla, line);
       struct display_line *ddl = Dynarr_atp (ddla, line);
       struct display_block *db;
       int initial_size;
 
-      assert (cdl->bufpos == ddl->bufpos);
-      assert (cdl->end_bufpos == ddl->end_bufpos);
+      assert (cdl->charbpos == ddl->charbpos);
+      assert (cdl->end_charbpos == ddl->end_charbpos);
       assert (cdl->offset == ddl->offset);
 
       db = get_display_block_from_line (ddl, TEXT);
       initial_size = Dynarr_length (db->runes);
-      old_start = ddl->bufpos + ddl->offset;
-      old_end = ddl->end_bufpos + ddl->offset;
+      old_start = ddl->charbpos + ddl->offset;
+      old_end = ddl->end_charbpos + ddl->offset;
 
       /* If this is the first line being updated and it used
          propagation data, fail.  Otherwise we'll be okay because
@@ -5452,7 +5452,7 @@
       if (line == first_line && ddl->used_prop_data)
 	return 0;
 
-      new_start = generate_display_line (w, ddl, 0, ddl->bufpos + ddl->offset,
+      new_start = generate_display_line (w, ddl, 0, ddl->charbpos + ddl->offset,
 					 &prop, DESIRED_DISP);
       ddl->offset = 0;
 
@@ -5475,8 +5475,8 @@
 	  || cdl->top_clip != ddl->top_clip
 	  || (cdl->cursor_elt != -1 && ddl->cursor_elt == -1)
 	  || (cdl->cursor_elt == -1 && ddl->cursor_elt != -1)
-	  || old_start != ddl->bufpos
-	  || old_end != ddl->end_bufpos
+	  || old_start != ddl->charbpos
+	  || old_end != ddl->end_charbpos
 	  || initial_size != Dynarr_length (db->runes))
 	{
 	  return 0;
@@ -5492,7 +5492,7 @@
 
       /* If the extent changes end on the line we just updated then
          we're done.  Otherwise go on to the next line. */
-      if (end_unchanged <= ddl->end_bufpos)
+      if (end_unchanged <= ddl->end_charbpos)
 	break;
       else
 	line++;
@@ -5509,8 +5509,8 @@
    invariants located here. */
 
 static int
-regenerate_window_incrementally (struct window *w, Bufpos startp,
-				 Bufpos pointm)
+regenerate_window_incrementally (struct window *w, Charbpos startp,
+				 Charbpos pointm)
 {
   struct buffer *b = XBUFFER (w->buffer);
   display_line_dynarr *cdla = window_display_lines (w, CURRENT_DISP);
@@ -5520,7 +5520,7 @@
 
   int dla_start = 0;
   int dla_end, line;
-  Bufpos start_pos;
+  Charbpos start_pos;
 
   /* If this function is called, the current and desired structures
      had better be identical.  If they are not, then that is a bug. */
@@ -5563,8 +5563,8 @@
   while (line <= dla_end)
     {
       struct display_line *dl = Dynarr_atp (cdla, line);
-      Bufpos lstart = dl->bufpos + dl->offset;
-      Bufpos lend = dl->end_bufpos + dl->offset;
+      Charbpos lstart = dl->charbpos + dl->offset;
+      Charbpos lend = dl->end_charbpos + dl->offset;
 
       if (beg_unchanged >= lstart && beg_unchanged <= lend)
 	break;
@@ -5587,13 +5587,13 @@
        we fail the next thing that is going to happen is a full regen
        so we will actually end up being safe. */
     {
-      Bufpos new_start;
+      Charbpos new_start;
       prop_block_dynarr *prop = NULL;
       struct display_line *cdl = Dynarr_atp (cdla, line);
       struct display_line *ddl = Dynarr_atp (ddla, line);
 
-      assert (cdl->bufpos == ddl->bufpos);
-      assert (cdl->end_bufpos == ddl->end_bufpos);
+      assert (cdl->charbpos == ddl->charbpos);
+      assert (cdl->end_charbpos == ddl->end_charbpos);
       assert (cdl->offset == ddl->offset);
 
       /* If the line continues to next display line, fail. */
@@ -5604,7 +5604,7 @@
       if (ddl->used_prop_data)
 	return 0;
 
-      new_start = generate_display_line (w, ddl, 0, ddl->bufpos + ddl->offset,
+      new_start = generate_display_line (w, ddl, 0, ddl->charbpos + ddl->offset,
 					 &prop, DESIRED_DISP);
       ddl->offset = 0;
 
@@ -5634,7 +5634,7 @@
 
       /* If the changed area also ends on this line, then we may be in
          business.  Update everything and return success. */
-      if (end_unchanged >= ddl->bufpos && end_unchanged <= ddl->end_bufpos)
+      if (end_unchanged >= ddl->charbpos && end_unchanged <= ddl->end_charbpos)
 	{
 	  w->last_modified[DESIRED_DISP] = make_int (BUF_MODIFF (b));
 	  w->last_facechange[DESIRED_DISP] = make_int (BUF_FACECHANGE (b));
@@ -5679,8 +5679,8 @@
              the line because we checked before entering the loop. */
 	  if (extent_beg_unchanged != -1
 	      && extent_end_unchanged != -1
-	      && ((extent_beg_unchanged < ddl->bufpos)
-		  || (extent_end_unchanged > ddl->end_bufpos)))
+	      && ((extent_beg_unchanged < ddl->charbpos)
+		  || (extent_end_unchanged > ddl->end_charbpos)))
 	    return regenerate_window_extents_only_changed (w, startp, pointm,
 							   extent_beg_unchanged,
 							   extent_end_unchanged);
@@ -5697,10 +5697,10 @@
    that point is displayed in the middle of the window.
    Return the window's new start position. */
 
-static Bufpos
-regenerate_window_point_center (struct window *w, Bufpos point, int type)
+static Charbpos
+regenerate_window_point_center (struct window *w, Charbpos point, int type)
 {
-  Bufpos startp;
+  Charbpos startp;
 
   /* We need to make sure that the modeline is generated so that the
      window height can be calculated correctly. */
@@ -5717,7 +5717,7 @@
    indicating whether the given point is contained within. */
 
 static int
-point_visible (struct window *w, Bufpos point, int type)
+point_visible (struct window *w, Charbpos point, int type)
 {
   struct buffer *b = XBUFFER (w->buffer);
   display_line_dynarr *dla = window_display_lines (w, type);
@@ -5730,10 +5730,10 @@
 
   if (Dynarr_length (dla) > first_line)
     {
-      Bufpos start, end;
+      Charbpos start, end;
       struct display_line *dl = Dynarr_atp (dla, first_line);
 
-      start = dl->bufpos;
+      start = dl->charbpos;
       end = BUF_Z (b) - w->window_end_pos[type] - 1;
 
       if (point >= start && point <= end)
@@ -5742,8 +5742,8 @@
 	    {
 	      dl = Dynarr_atp (dla, Dynarr_length (dla) - 1);
 
-	      if (point >= (dl->bufpos + dl->offset)
-		  && point <= (dl->end_bufpos + dl->offset))
+	      if (point >= (dl->charbpos + dl->offset)
+		  && point <= (dl->end_charbpos + dl->offset))
 		return !dl->clip;
 	      else
 		return 1;
@@ -5771,7 +5771,7 @@
    window W for display lines TYPE. */
 
 int
-line_at_center (struct window *w, int type, Bufpos start, Bufpos point)
+line_at_center (struct window *w, int type, Charbpos start, Charbpos point)
 {
   display_line_dynarr *dla;
   int half;
@@ -5801,8 +5801,8 @@
 /* Return a value for point that would place it at the beginning of
    the line which is in the middle of the window. */
 
-Bufpos
-point_at_center (struct window *w, int type, Bufpos start, Bufpos point)
+Charbpos
+point_at_center (struct window *w, int type, Charbpos start, Charbpos point)
 {
   /* line_at_center will regenerate the display structures, if necessary. */
   int line = line_at_center (w, type, start, point);
@@ -5814,7 +5814,7 @@
       display_line_dynarr *dla = window_display_lines (w, type);
       struct display_line *dl = Dynarr_atp (dla, line);
 
-      return dl->bufpos;
+      return dl->charbpos;
     }
 }
 
@@ -6165,8 +6165,8 @@
 
   if (!skip_output)
     {
-      Bufpos start = marker_position (w->start[DESIRED_DISP]);
-      Bufpos end = (w->window_end_pos[DESIRED_DISP] == -1
+      Charbpos start = marker_position (w->start[DESIRED_DISP]);
+      Charbpos end = (w->window_end_pos[DESIRED_DISP] == -1
 		    ? BUF_ZV (b)
 		    : BUF_Z (b) - w->window_end_pos[DESIRED_DISP] - 1);
       /* Don't pollute the cache if not sure if we are correct */
@@ -6235,13 +6235,13 @@
 static int
 call_redisplay_end_triggers (struct window *w, void *closure)
 {
-  Bufpos lrpos = w->last_redisplay_pos;
+  Charbpos lrpos = w->last_redisplay_pos;
   w->last_redisplay_pos = 0;
   if (!NILP (w->buffer)
       && !NILP (w->redisplay_end_trigger)
       && lrpos > 0)
     {
-      Bufpos pos;
+      Charbpos pos;
 
       if (MARKERP (w->redisplay_end_trigger)
 	  && XMARKER (w->redisplay_end_trigger)->buffer != 0)
@@ -6639,7 +6639,7 @@
   /* Be careful in the order of these tests. The first clause will
      fail if DEVICE_SELECTED_FRAME == Qnil (since w->frame cannot be).
      This can occur when the frame title is computed really early */
-  Bufpos pos =
+  Charbpos pos =
     ((EQ(DEVICE_SELECTED_FRAME(d), w->frame) &&
        (w == XWINDOW (FRAME_SELECTED_WINDOW (device_selected_frame(d)))) &&
       EQ(DEVICE_CONSOLE(d), Vselected_console) &&
@@ -6662,7 +6662,7 @@
 
 /* Given a character representing an object in a modeline
    specification, return a string (stored into the global array
-   `mode_spec_bufbyte_string') with the information that object
+   `mode_spec_intbyte_string') with the information that object
    represents.
 
    This function is largely unchanged from previous versions of the
@@ -6679,7 +6679,7 @@
   const char *str = NULL;
   struct buffer *b = XBUFFER (w->buffer);
 
-  Dynarr_reset (mode_spec_bufbyte_string);
+  Dynarr_reset (mode_spec_intbyte_string);
 
   switch (spec)
     {
@@ -6696,7 +6696,7 @@
       /* print the current column */
     case 'c':
       {
-        Bufpos pt = (w == XWINDOW (Fselected_window (Qnil)))
+        Charbpos pt = (w == XWINDOW (Fselected_window (Qnil)))
                     ? BUF_PT (b)
                     : marker_position (w->pointm[type]);
 	int col = column_at_point (b, pt, 1) + !!column_number_start_at_one;
@@ -6704,8 +6704,8 @@
 
 	long_to_string (buf, col);
 
-	Dynarr_add_many (mode_spec_bufbyte_string,
-			 (const Bufbyte *) buf, strlen (buf));
+	Dynarr_add_many (mode_spec_intbyte_string,
+			 (const Intbyte *) buf, strlen (buf));
 
 	goto decode_mode_spec_done;
       }
@@ -6809,7 +6809,7 @@
       /* print percent of buffer above top of window, or Top, Bot or All */
     case 'p':
     {
-      Bufpos pos = marker_position (w->start[type]);
+      Charbpos pos = marker_position (w->start[type]);
 
       /* This had better be while the desired lines are being done. */
       if (w->window_end_pos[type] <= BUF_Z (b) - BUF_ZV (b))
@@ -6840,7 +6840,7 @@
 	    percent = 99;
 
 	  sprintf (buf, "%d%%", percent);
-	  Dynarr_add_many (mode_spec_bufbyte_string, (Bufbyte *) buf,
+	  Dynarr_add_many (mode_spec_intbyte_string, (Intbyte *) buf,
 			   strlen (buf));
 
 	  goto decode_mode_spec_done;
@@ -6852,8 +6852,8 @@
        Top, or print Bottom or All */
     case 'P':
     {
-      Bufpos toppos = marker_position (w->start[type]);
-      Bufpos botpos = BUF_Z (b) - w->window_end_pos[type];
+      Charbpos toppos = marker_position (w->start[type]);
+      Charbpos botpos = BUF_Z (b) - w->window_end_pos[type];
 
       /* botpos is only accurate as of the last redisplay, so we can
          only treat it as a hint.  In particular, after erase-buffer,
@@ -6891,7 +6891,7 @@
 	  else
 	    sprintf (buf, "%d%%", percent);
 
-	  Dynarr_add_many (mode_spec_bufbyte_string, (Bufbyte *) buf,
+	  Dynarr_add_many (mode_spec_intbyte_string, (Intbyte *) buf,
 			   strlen (buf));
 
 	  goto decode_mode_spec_done;
@@ -6916,7 +6916,7 @@
 	}
 
       for (i = 0; i < command_loop_level; i++)
-	Dynarr_add (mode_spec_bufbyte_string, '[');
+	Dynarr_add (mode_spec_intbyte_string, '[');
 
       goto decode_mode_spec_done;
     }
@@ -6933,7 +6933,7 @@
 	}
 
       for (i = 0; i < command_loop_level; i++)
-	Dynarr_add (mode_spec_bufbyte_string, ']');
+	Dynarr_add (mode_spec_intbyte_string, ']');
 
       goto decode_mode_spec_done;
     }
@@ -6945,14 +6945,14 @@
     }
 
   if (STRINGP (obj))
-    Dynarr_add_many (mode_spec_bufbyte_string,
+    Dynarr_add_many (mode_spec_intbyte_string,
 		     XSTRING_DATA   (obj),
 		     XSTRING_LENGTH (obj));
   else if (str)
-    Dynarr_add_many (mode_spec_bufbyte_string, (Bufbyte *) str, strlen (str));
+    Dynarr_add_many (mode_spec_intbyte_string, (Intbyte *) str, strlen (str));
 
 decode_mode_spec_done:
-  Dynarr_add (mode_spec_bufbyte_string, '\0');
+  Dynarr_add (mode_spec_intbyte_string, '\0');
 }
 
 /* Given a display line, free all of its data structures. */
@@ -7162,8 +7162,8 @@
 	{
 	  struct line_start_cache lsc;
 
-	  lsc.start = dl->bufpos;
-	  lsc.end = dl->end_bufpos;
+	  lsc.start = dl->charbpos;
+	  lsc.end = dl->end_charbpos;
 	  lsc.height = dl->ascent + dl->descent;
 
 	  Dynarr_add (internal_cache, lsc);
@@ -7206,7 +7206,7 @@
    window's cache, or -1 if the cache is empty.  Assumes that the
    cache is valid. */
 
-static Bufpos
+static Charbpos
 line_start_cache_start (struct window *w)
 {
   line_start_cache_dynarr *cache = w->line_start_cache;
@@ -7221,7 +7221,7 @@
    window's cache, or -1 if the cache is empty.  Assumes that the
    cache is valid. */
 
-static Bufpos
+static Charbpos
 line_start_cache_end (struct window *w)
 {
   line_start_cache_dynarr *cache = w->line_start_cache;
@@ -7242,7 +7242,7 @@
    for any reason. */
 
 int
-point_in_line_start_cache (struct window *w, Bufpos point, int min_past)
+point_in_line_start_cache (struct window *w, Charbpos point, int min_past)
 {
   struct buffer *b = XBUFFER (w->buffer);
   line_start_cache_dynarr *cache = w->line_start_cache;
@@ -7271,8 +7271,8 @@
 
       if (!Dynarr_length (cache))
 	{
-	  Bufpos from = find_next_newline_no_quit (b, point, -1);
-	  Bufpos to = find_next_newline_no_quit (b, from, win_char_height);
+	  Charbpos from = find_next_newline_no_quit (b, point, -1);
+	  Charbpos to = find_next_newline_no_quit (b, from, win_char_height);
 
 	  update_line_start_cache (w, from, to, point, 0);
 
@@ -7289,7 +7289,7 @@
       while (line_start_cache_start (w) > point
 	     && (loop < cache_adjustment || min_past == -1))
 	{
-	  Bufpos from, to;
+	  Charbpos from, to;
 
 	  from = line_start_cache_start (w);
 	  if (from <= BUF_BEGV (b))
@@ -7304,7 +7304,7 @@
 
       if (line_start_cache_start (w) > point)
 	{
-	  Bufpos from, to;
+	  Charbpos from, to;
 
 	  from = find_next_newline_no_quit (b, point, -1);
 	  if (from >= BUF_ZV (b))
@@ -7323,7 +7323,7 @@
       while (line_start_cache_end (w) < point
 	     && (loop < cache_adjustment || min_past == -1))
 	{
-	  Bufpos from, to;
+	  Charbpos from, to;
 
 	  to = line_start_cache_end (w);
 	  if (to >= BUF_ZV (b))
@@ -7338,7 +7338,7 @@
 
       if (line_start_cache_end (w) < point)
 	{
-	  Bufpos from, to;
+	  Charbpos from, to;
 
 	  from = find_next_newline_no_quit (b, point, -1);
 	  if (from >= BUF_ZV (b))
@@ -7375,7 +7375,7 @@
   while (1)
     {
       int new_pos;
-      Bufpos start, end;
+      Charbpos start, end;
 
       pos = (bottom + top + 1) >> 1;
       start = Dynarr_atp (cache, pos)->start;
@@ -7385,10 +7385,10 @@
 	{
 	  if (pos < min_past && line_start_cache_start (w) > BUF_BEGV (b))
 	    {
-	      Bufpos from =
+	      Charbpos from =
 		find_next_newline_no_quit (b, line_start_cache_start (w),
 					   -min_past - 1);
-	      Bufpos to = line_start_cache_end (w);
+	      Charbpos to = line_start_cache_end (w);
 
 	      update_line_start_cache (w, from, to, point, 0);
 	      goto find_point_loop;
@@ -7396,8 +7396,8 @@
 	  else if ((Dynarr_length (cache) - pos - 1) < min_past
 		   && line_start_cache_end (w) < BUF_ZV (b))
 	    {
-	      Bufpos from = line_start_cache_end (w);
-	      Bufpos to = find_next_newline_no_quit (b, from,
+	      Charbpos from = line_start_cache_end (w);
+	      Charbpos to = find_next_newline_no_quit (b, from,
 						     (min_past
 						      ? min_past
 						      : 1));
@@ -7431,7 +7431,7 @@
    if display of the window was to begin at STARTP. */
 
 int
-point_would_be_visible (struct window *w, Bufpos startp, Bufpos point)
+point_would_be_visible (struct window *w, Charbpos startp, Charbpos point)
 {
   struct buffer *b = XBUFFER (w->buffer);
   int pixpos = -WINDOW_TEXT_TOP_CLIP(w);
@@ -7468,7 +7468,7 @@
       /* Expand the cache if necessary. */
       if (start_elt == Dynarr_length (w->line_start_cache))
 	{
-	  Bufpos old_startp =
+	  Charbpos old_startp =
 	    Dynarr_atp (w->line_start_cache, start_elt - 1)->start;
 
 	  start_elt = point_in_line_start_cache (w, old_startp,
@@ -7522,15 +7522,15 @@
    #### With a little work this could probably be reworked as just a
    call to start_with_line_at_pixpos. */
 
-static Bufpos
-start_end_of_last_line (struct window *w, Bufpos startp, int end,
+static Charbpos
+start_end_of_last_line (struct window *w, Charbpos startp, int end,
                         int may_error)
 {
   struct buffer *b = XBUFFER (w->buffer);
   line_start_cache_dynarr *cache = w->line_start_cache;
   int pixpos = 0;
   int bottom = WINDOW_TEXT_HEIGHT (w);
-  Bufpos cur_start;
+  Charbpos cur_start;
   int start_elt;
 
   validate_line_start_cache (w);
@@ -7580,9 +7580,9 @@
       start_elt++;
       if (start_elt == Dynarr_length (cache))
 	{
-	  Bufpos from = line_start_cache_end (w);
+	  Charbpos from = line_start_cache_end (w);
 	  int win_char_height = window_char_height (w, 0);
-	  Bufpos to = find_next_newline_no_quit (b, from,
+	  Charbpos to = find_next_newline_no_quit (b, from,
 						 (win_char_height
 						  ? win_char_height
 						  : 1));
@@ -7605,8 +7605,8 @@
 /* For the given window W, if display starts at STARTP, what will be
    the buffer position at the beginning of the last line displayed. */
 
-Bufpos
-start_of_last_line (struct window *w, Bufpos startp)
+Charbpos
+start_of_last_line (struct window *w, Charbpos startp)
 {
   return start_end_of_last_line (w, startp, 0 , 0);
 }
@@ -7615,14 +7615,14 @@
    the buffer position at the end of the last line displayed.  This is
    also know as the window end position. */
 
-Bufpos
-end_of_last_line (struct window *w, Bufpos startp)
+Charbpos
+end_of_last_line (struct window *w, Charbpos startp)
 {
   return start_end_of_last_line (w, startp, 1, 0);
 }
 
-static Bufpos
-end_of_last_line_may_error (struct window *w, Bufpos startp)
+static Charbpos
+end_of_last_line_may_error (struct window *w, Charbpos startp)
 {
   return start_end_of_last_line (w, startp, 1, 1);
 }
@@ -7631,12 +7631,12 @@
 /* For window W, what does the starting position have to be so that
    the line containing POINT will cover pixel position PIXPOS. */
 
-Bufpos
-start_with_line_at_pixpos (struct window *w, Bufpos point, int pixpos)
+Charbpos
+start_with_line_at_pixpos (struct window *w, Charbpos point, int pixpos)
 {
   struct buffer *b = XBUFFER (w->buffer);
   int cur_elt;
-  Bufpos cur_pos, prev_pos = point;
+  Charbpos cur_pos, prev_pos = point;
   int point_line_height;
   int pixheight = pixpos - WINDOW_TEXT_TOP (w);
 
@@ -7675,7 +7675,7 @@
       cur_elt--;
       while (cur_elt < 0)
 	{
-	  Bufpos from, to;
+	  Charbpos from, to;
 	  int win_char_height;
 
 	  if (cur_pos <= BUF_BEGV (b))
@@ -7719,8 +7719,8 @@
    considered to be the number of lines from the bottom (-1 is the
    bottom line). */
 
-Bufpos
-start_with_point_on_display_line (struct window *w, Bufpos point, int line)
+Charbpos
+start_with_point_on_display_line (struct window *w, Charbpos point, int line)
 {
   validate_line_start_cache (w);
   w->line_cache_validation_override++;
@@ -7745,7 +7745,7 @@
       int new_line = -line - 1;
       int cur_elt = point_in_line_start_cache (w, point, new_line);
       int pixpos = WINDOW_TEXT_BOTTOM (w);
-      Bufpos retval, search_point;
+      Charbpos retval, search_point;
 
       /* If scroll_on_clipped_lines is false, the last "visible" line of
  	 the window covers the pixel at WINDOW_TEXT_BOTTOM (w) - 1.
@@ -7802,12 +7802,12 @@
    overhead for too little gain. */
 
 static void
-update_line_start_cache (struct window *w, Bufpos from, Bufpos to,
-			 Bufpos point, int no_regen)
+update_line_start_cache (struct window *w, Charbpos from, Charbpos to,
+			 Charbpos point, int no_regen)
 {
   struct buffer *b = XBUFFER (w->buffer);
   line_start_cache_dynarr *cache = w->line_start_cache;
-  Bufpos low_bound, high_bound;
+  Charbpos low_bound, high_bound;
 
   validate_line_start_cache (w);
   w->line_cache_validation_override++;
@@ -7854,7 +7854,7 @@
      to follow what's going on by having it separate. */
   if (no_regen)
     {
-      Bufpos start, end;
+      Charbpos start, end;
 
       update_internal_cache_list (w, DESIRED_DISP);
       if (!Dynarr_length (internal_cache))
@@ -7955,14 +7955,14 @@
 
   if (!Dynarr_length (cache) || from < low_bound)
     {
-      Bufpos startp = find_next_newline_no_quit (b, from, -1);
+      Charbpos startp = find_next_newline_no_quit (b, from, -1);
       int marker = 0;
       int old_lb = low_bound;
 
       while (startp < old_lb || low_bound == -1)
 	{
 	  int ic_elt;
-          Bufpos new_startp;
+          Charbpos new_startp;
 
 	  regenerate_window (w, startp, point, CMOTION_DISP);
 	  update_internal_cache_list (w, CMOTION_DISP);
@@ -8031,7 +8031,7 @@
 
   if (to > high_bound)
     {
-      Bufpos startp = Dynarr_atp (cache, Dynarr_length (cache) - 1)->end + 1;
+      Charbpos startp = Dynarr_atp (cache, Dynarr_length (cache) - 1)->end + 1;
 
       do
 	{
@@ -8218,7 +8218,7 @@
     d->pixel_to_glyph_cache.obj_x = *obj_x;				\
     d->pixel_to_glyph_cache.obj_y = *obj_y;				\
     d->pixel_to_glyph_cache.w = *w;					\
-    d->pixel_to_glyph_cache.bufpos = *bufpos;				\
+    d->pixel_to_glyph_cache.charbpos = *charbpos;				\
     d->pixel_to_glyph_cache.closest = *closest;				\
     d->pixel_to_glyph_cache.modeline_closest = *modeline_closest;	\
     d->pixel_to_glyph_cache.obj1 = *obj1;				\
@@ -8262,8 +8262,8 @@
 int
 pixel_to_glyph_translation (struct frame *f, int x_coord, int y_coord,
 			    int *col, int *row, int *obj_x, int *obj_y,
-			    struct window **w, Bufpos *bufpos,
-			    Bufpos *closest, Charcount *modeline_closest,
+			    struct window **w, Charbpos *charbpos,
+			    Charbpos *closest, Charcount *modeline_closest,
 			    Lisp_Object *obj1, Lisp_Object *obj2)
 {
   struct device *d;
@@ -8301,7 +8301,7 @@
       *obj_x = cache->obj_x;
       *obj_y = cache->obj_y;
       *w = cache->w;
-      *bufpos = cache->bufpos;
+      *charbpos = cache->charbpos;
       *closest = cache->closest;
       *modeline_closest = cache->modeline_closest;
       *obj1 = cache->obj1;
@@ -8316,7 +8316,7 @@
       *obj_x = 0;
       *obj_y = 0;
       *w = 0;
-      *bufpos = 0;
+      *charbpos = 0;
       *closest = 0;
       *modeline_closest = -1;
       *obj1 = Qnil;
@@ -8543,20 +8543,20 @@
 		  if (x_check <= left_bound)
 		    {
 		      if (dl->modeline)
-			*modeline_closest = Dynarr_atp (db->runes, 0)->bufpos;
+			*modeline_closest = Dynarr_atp (db->runes, 0)->charbpos;
 		      else
-			*closest = Dynarr_atp (db->runes, 0)->bufpos;
+			*closest = Dynarr_atp (db->runes, 0)->charbpos;
 		    }
 		  else
 		    {
 		      if (dl->modeline)
 			*modeline_closest =
 			  Dynarr_atp (db->runes,
-				      Dynarr_length (db->runes) - 1)->bufpos;
+				      Dynarr_length (db->runes) - 1)->charbpos;
 		      else
 			*closest =
 			  Dynarr_atp (db->runes,
-				      Dynarr_length (db->runes) - 1)->bufpos;
+				      Dynarr_length (db->runes) - 1)->charbpos;
 		    }
 
 		  if (dl->modeline)
@@ -8611,7 +8611,7 @@
 		      rb = Dynarr_atp (db->runes, *col);
 		    }
 
-		  *bufpos = rb->bufpos + dl->offset;
+		  *charbpos = rb->charbpos + dl->offset;
 		  low_x_coord = rb->xpos;
 		  high_x_coord = rb->xpos + rb->width;
 
@@ -8626,11 +8626,11 @@
 			    {
 			      if (dl->modeline)
 				*modeline_closest =
-				  (Dynarr_atp (db->runes, elt)->bufpos +
+				  (Dynarr_atp (db->runes, elt)->charbpos +
 				   dl->offset);
 			      else
 				*closest =
-				  (Dynarr_atp (db->runes, elt)->bufpos +
+				  (Dynarr_atp (db->runes, elt)->charbpos +
 				   dl->offset);
 			      break;
 			    }
@@ -8644,18 +8644,18 @@
 		      if (elt == Dynarr_length (db->runes))
 			{
 			  if (dl->modeline)
-			    *modeline_closest = dl->end_bufpos + dl->offset;
+			    *modeline_closest = dl->end_charbpos + dl->offset;
 			  else
-			    *closest = dl->end_bufpos + dl->offset;
+			    *closest = dl->end_charbpos + dl->offset;
 			  really_over_nothing = 1;
 			}
 		    }
 		  else
 		    {
 		      if (dl->modeline)
-			*modeline_closest = rb->bufpos + dl->offset;
+			*modeline_closest = rb->charbpos + dl->offset;
 		      else
-			*closest = rb->bufpos + dl->offset;
+			*closest = rb->charbpos + dl->offset;
 		    }
 
 		  if (dl->modeline)
@@ -9124,8 +9124,8 @@
     {
       if (!cmotion_display_lines)
 	cmotion_display_lines = Dynarr_new (display_line);
-      if (!mode_spec_bufbyte_string)
-	mode_spec_bufbyte_string = Dynarr_new (Bufbyte);
+      if (!mode_spec_intbyte_string)
+	mode_spec_intbyte_string = Dynarr_new (Intbyte);
       if (!formatted_string_extent_dynarr)
 	formatted_string_extent_dynarr = Dynarr_new (EXTENT);
       if (!formatted_string_extent_start_dynarr)
--- a/src/redisplay.h	Tue Sep 18 05:06:57 2001 +0000
+++ b/src/redisplay.h	Thu Sep 20 06:31:11 2001 +0000
@@ -50,7 +50,7 @@
 typedef struct line_start_cache line_start_cache;
 struct line_start_cache
 {
-  Bufpos start, end;
+  Charbpos start, end;
   int height;
 };
 
@@ -112,10 +112,10 @@
 				   each of the face properties in this
 				   particular window. */
 
-  Bufpos bufpos;		/* buffer position this rune is displaying;
+  Charbpos charbpos;		/* buffer position this rune is displaying;
 				   for the modeline, the value here is a
 				   Charcount, but who's looking? */
-  Bufpos endpos;		/* if set this rune covers a range of pos */
+  Charbpos endpos;		/* if set this rune covers a range of pos */
  				/* #### Chuck, what does it mean for a rune
 				   to cover a range of pos?  I don't get
 				   this. */
@@ -257,7 +257,7 @@
 
 /*  Modeline commentary: IMO the modeline is handled very badly, we
   special case virtually *everything* in the redisplay routines for
-  the modeline. The fact that dl->bufpos can be either a buffer
+  the modeline. The fact that dl->charbpos can be either a buffer
   position or a char count highlights this. There is no abstraction at
   all that I can find and it means that the code is made very ugly as
   a result. Either we should treat the modeline *entirely* separately,
@@ -293,9 +293,9 @@
 					   in pixels.*/
   unsigned short top_clip;		/* amount of top of line to clip
 					   in pixels.*/
-  Bufpos bufpos;			/* first buffer position on line */
-  Bufpos end_bufpos;			/* last buffer position on line */
-  Charcount offset;			/* adjustment to bufpos vals */
+  Charbpos charbpos;			/* first buffer position on line */
+  Charbpos end_charbpos;			/* last buffer position on line */
+  Charcount offset;			/* adjustment to charbpos vals */
   Charcount num_chars;			/* # of chars on line
 					   including expansion of tabs
 					   and control chars */
@@ -383,13 +383,13 @@
 };
 
 /* NOTE NOTE NOTE: Currently the positions in an extent fragment
-   structure are Bytind's, not Bufpos's.  This could change. */
+   structure are Bytebpos's, not Charbpos's.  This could change. */
 
 struct extent_fragment
 {
   Lisp_Object object; /* buffer or string */
   struct frame *frm;
-  Bytind pos, end;
+  Bytebpos pos, end;
   EXTENT_dynarr *extents;
   glyph_block_dynarr *begin_glyphs, *end_glyphs;
   unsigned int invisible:1;
@@ -681,11 +681,11 @@
 EXFUN (Fredraw_frame, 2);
 
 int redisplay_text_width_string (struct window *w, int findex,
-				 Bufbyte *nonreloc, Lisp_Object reloc,
+				 Intbyte *nonreloc, Lisp_Object reloc,
 				 Bytecount offset, Bytecount len);
 int redisplay_frame_text_width_string (struct frame *f,
 				       Lisp_Object face,
-				       Bufbyte *nonreloc,
+				       Intbyte *nonreloc,
 				       Lisp_Object reloc,
 				       Bytecount offset, Bytecount len);
 int redisplay_frame (struct frame *f, int preemption_check);
@@ -694,9 +694,9 @@
 						   enum display_type type);
 layout_bounds calculate_display_line_boundaries (struct window *w,
 						 int modeline);
-Bufpos point_at_center (struct window *w, int type, Bufpos start,
-			Bufpos point);
-int line_at_center (struct window *w, int type, Bufpos start, Bufpos point);
+Charbpos point_at_center (struct window *w, int type, Charbpos start,
+			Charbpos point);
+int line_at_center (struct window *w, int type, Charbpos start, Charbpos point);
 int window_half_pixpos (struct window *w);
 void redisplay_echo_area (void);
 void free_display_structs (struct window_mirror *mir);
@@ -705,7 +705,7 @@
 void generate_displayable_area (struct window *w, Lisp_Object disp_string,
 				int xpos, int ypos, int width, int height,
 				display_line_dynarr* dl,
-				Bufpos start_pos, face_index default_face);
+				Charbpos start_pos, face_index default_face);
 /* `generate_title_string' in frame.c needs this */
 void generate_formatted_string_db (Lisp_Object format_str,
 				   Lisp_Object result_str,
@@ -718,20 +718,20 @@
 int pixel_to_glyph_translation (struct frame *f, int x_coord,
 				int y_coord, int *col, int *row,
 				int *obj_x, int *obj_y,
-				struct window **w, Bufpos *bufpos,
-				Bufpos *closest, Charcount *modeline_closest,
+				struct window **w, Charbpos *charbpos,
+				Charbpos *closest, Charcount *modeline_closest,
 				Lisp_Object *obj1, Lisp_Object *obj2);
 void glyph_to_pixel_translation (struct window *w, int char_x,
 				 int char_y, int *pix_x, int *pix_y);
-int point_in_line_start_cache (struct window *w, Bufpos point,
+int point_in_line_start_cache (struct window *w, Charbpos point,
 			       int min_past);
-int point_would_be_visible (struct window *w, Bufpos startp,
-		    Bufpos point);
-Bufpos start_of_last_line (struct window *w, Bufpos startp);
-Bufpos end_of_last_line (struct window *w, Bufpos startp);
-Bufpos start_with_line_at_pixpos (struct window *w, Bufpos point,
+int point_would_be_visible (struct window *w, Charbpos startp,
+		    Charbpos point);
+Charbpos start_of_last_line (struct window *w, Charbpos startp);
+Charbpos end_of_last_line (struct window *w, Charbpos startp);
+Charbpos start_with_line_at_pixpos (struct window *w, Charbpos point,
 				  int pixpos);
-Bufpos start_with_point_on_display_line (struct window *w, Bufpos point,
+Charbpos start_with_point_on_display_line (struct window *w, Charbpos point,
 					 int line);
 int redisplay_variable_changed (Lisp_Object sym, Lisp_Object *val,
 				Lisp_Object in_object, int flags);
@@ -791,7 +791,7 @@
 			    int last_line, int update_values);
 void redisplay_output_window (struct window *w);
 void bevel_modeline (struct window *w, struct display_line *dl);
-int redisplay_move_cursor (struct window *w, Bufpos new_point,
+int redisplay_move_cursor (struct window *w, Charbpos new_point,
 			   int no_output_end);
 void redisplay_redraw_cursor (struct frame *f, int run_begin_end_meths);
 void output_display_line (struct window *w, display_line_dynarr *cdla,
--- a/src/regex.c	Tue Sep 18 05:06:57 2001 +0000
+++ b/src/regex.c	Thu Sep 20 06:31:11 2001 +0000
@@ -1167,8 +1167,8 @@
 typedef struct
 {
   fail_stack_elt_t *stack;
-  Element_Count size;
-  Element_Count avail;			/* Offset of next open position.  */
+  Elemcount size;
+  Elemcount avail;			/* Offset of next open position.  */
 } fail_stack_type;
 
 #define FAIL_STACK_EMPTY()     (fail_stack.avail == 0)
@@ -1551,7 +1551,7 @@
 #define PATFETCH_EXTENDED(emch)						\
   do {if (p == pend) return REG_EEND;					\
     assert (p < pend);							\
-    emch = charptr_emchar ((const Bufbyte *) p);			\
+    emch = charptr_emchar ((const Intbyte *) p);			\
     INC_CHARPTR (p);							\
     if (TRANSLATE_P (translate) && emch < 0x80)				\
       emch = (Emchar) (unsigned char) RE_TRANSLATE (emch);		\
@@ -1560,7 +1560,7 @@
 #define PATFETCH_RAW_EXTENDED(emch)					\
   do {if (p == pend) return REG_EEND;					\
     assert (p < pend);							\
-    emch = charptr_emchar ((const Bufbyte *) p);			\
+    emch = charptr_emchar ((const Intbyte *) p);			\
     INC_CHARPTR (p);							\
   } while (0)
 
@@ -3182,7 +3182,7 @@
 #else
 	    {
 	      Bytecount bt_count;
-	      Bufbyte tmp_buf[MAX_EMCHAR_LEN];
+	      Intbyte tmp_buf[MAX_EMCHAR_LEN];
 	      int i;
 
 	      bt_count = set_charptr_emchar (tmp_buf, c);
@@ -3443,12 +3443,12 @@
 			reg_syntax_t syntax, Lisp_Object rtab)
 {
   Emchar this_char, range_start, range_end;
-  const Bufbyte *p;
+  const Intbyte *p;
 
   if (*p_ptr == pend)
     return REG_ERANGE;
 
-  p = (const Bufbyte *) *p_ptr;
+  p = (const Intbyte *) *p_ptr;
   range_end = charptr_emchar (p);
   p--; /* back to '-' */
   DEC_CHARPTR (p); /* back to start of range */
@@ -3632,7 +3632,7 @@
 		EMACS_INT first, last;
 		Lisp_Object dummy_val;
 		int jj;
-		Bufbyte strr[MAX_EMCHAR_LEN];
+		Intbyte strr[MAX_EMCHAR_LEN];
 
 		unified_range_table_get_range (p, i, &first, &last,
 					       &dummy_val);
@@ -4963,7 +4963,7 @@
             DEBUG_PRINT2 ("EXECUTING charset_mule%s.\n", not_p ? "_not" : "");
 
 	    REGEX_PREFETCH ();
-	    c = charptr_emchar ((const Bufbyte *) d);
+	    c = charptr_emchar ((const Intbyte *) d);
 	    c = TRANSLATE_EXTENDED_UNSAFE (c); /* The character to match.  */
 
 	    if (EQ (Qt, unified_range_table_lookup (p, c, Qnil)))
@@ -5821,7 +5821,7 @@
 	    }
 #endif
 
-	    emch = charptr_emchar ((const Bufbyte *) d);
+	    emch = charptr_emchar ((const Intbyte *) d);
 	    matches = (SYNTAX_FROM_CACHE (regex_emacs_buffer->mirror_syntax_table,
 			emch) == (enum syntaxcode) mcnt);
 	    INC_CHARPTR (d);
@@ -5853,7 +5853,7 @@
 
 	    mcnt = *p++;
 	    REGEX_PREFETCH ();
-	    emch = charptr_emchar ((const Bufbyte *) d);
+	    emch = charptr_emchar ((const Intbyte *) d);
 	    INC_CHARPTR (d);
 	    if (check_category_char(emch, regex_emacs_buffer->category_table,
 				    mcnt, should_succeed))
@@ -6498,7 +6498,7 @@
 	  size_t errbuf_size)
 {
   const char *msg;
-  Memory_Count msg_size;
+  Bytecount msg_size;
 
   if (errcode < 0
       || errcode >= (int) (sizeof (re_error_msgid) /
@@ -6515,7 +6515,7 @@
 
   if (errbuf_size != 0)
     {
-      if (msg_size > (Memory_Count) errbuf_size)
+      if (msg_size > (Bytecount) errbuf_size)
         {
           strncpy (errbuf, msg, errbuf_size - 1);
           errbuf[errbuf_size - 1] = 0;
--- a/src/regex.h	Tue Sep 18 05:06:57 2001 +0000
+++ b/src/regex.h	Thu Sep 20 06:31:11 2001 +0000
@@ -27,8 +27,8 @@
 #define RE_TRANSLATE_TYPE Lisp_Object
 #else
 #define RE_TRANSLATE_TYPE char *
-#define Element_Count ssize_t
-#define Memory_Count ssize_t
+#define Elemcount ssize_t
+#define Bytecount ssize_t
 #endif /* emacs */
 
 /* POSIX says that <sys/types.h> must be included (by the caller) before
--- a/src/scrollbar-gtk.h	Tue Sep 18 05:06:57 2001 +0000
+++ b/src/scrollbar-gtk.h	Thu Sep 20 06:31:11 2001 +0000
@@ -60,7 +60,7 @@
 
   /* Recorded starting position for Motif-like scrollbar drags. */
   int vdrag_orig_value;
-  Bufpos vdrag_orig_window_start;
+  Charbpos vdrag_orig_window_start;
 };
 
 #define SCROLLBAR_GTK_DATA(i) ((struct gtk_scrollbar_data *) ((i)->scrollbar_data))
--- a/src/scrollbar-msw.c	Tue Sep 18 05:06:57 2001 +0000
+++ b/src/scrollbar-msw.c	Thu Sep 20 06:31:11 2001 +0000
@@ -341,7 +341,7 @@
   /* Find the window to scroll */
   {
     int mene, _mene, tekel, upharsin;
-    Bufpos mens, sana;
+    Charbpos mens, sana;
     Charcount in;
     Lisp_Object corpore, sano;
     struct window *needle_in_haystack;
--- a/src/scrollbar-x.h	Tue Sep 18 05:06:57 2001 +0000
+++ b/src/scrollbar-x.h	Thu Sep 20 06:31:11 2001 +0000
@@ -46,7 +46,7 @@
     defined (LWLIB_SCROLLBARS_ATHENA3D)
   /* Recorded starting position for Motif-like scrollbar drags. */
   int vdrag_orig_value;
-  Bufpos vdrag_orig_window_start;
+  Charbpos vdrag_orig_window_start;
 #endif
 };
 
--- a/src/scrollbar.c	Tue Sep 18 05:06:57 2001 +0000
+++ b/src/scrollbar.c	Thu Sep 20 06:31:11 2001 +0000
@@ -375,10 +375,10 @@
  * return w->start.  If flag, then return beginning point of line
  * which w->sb_point lies on.
  */
-static Bufpos
+static Charbpos
 scrollbar_point (struct window *w, int flag)
 {
-  Bufpos start_pos, end_pos, sb_pos;
+  Charbpos start_pos, end_pos, sb_pos;
   Lisp_Object buf;
   struct buffer *b;
 
@@ -420,7 +420,7 @@
   struct frame *f = XFRAME (w->frame);
   struct device *d = XDEVICE (f->device);
   struct buffer *b = XBUFFER (w->buffer);
-  Bufpos start_pos, end_pos, sb_pos;
+  Charbpos start_pos, end_pos, sb_pos;
   int scrollbar_width  = window_scrollbar_width  (w);
   int scrollbar_height = window_scrollbar_height (w);
 
@@ -665,8 +665,8 @@
      accurate.  We know this because either set-window-start or
      recenter was called immediately prior to it being called. */
   Lisp_Object buf;
-  Bufpos start_pos = XINT (Fwindow_start (win));
-  Bufpos ptint = XINT (orig_pt);
+  Charbpos start_pos = XINT (Fwindow_start (win));
+  Charbpos ptint = XINT (orig_pt);
   struct window *w = XWINDOW (win);
   int selected = ((w == XWINDOW (Fselected_window (XFRAME (w->frame)->device)))
 		  ? 1
@@ -692,7 +692,7 @@
       else
 	{
 	  /* #### Taken from forward-line. */
-	  Bufpos pos;
+	  Charbpos pos;
 
 	  pos = find_next_newline (XBUFFER (buf),
 				   marker_position (w->pointm[CURRENT_DISP]),
@@ -759,7 +759,7 @@
     window_scroll (window, Qnil, -1, ERROR_ME_NOT);
   else
     {
-      Bufpos bufpos;
+      Charbpos charbpos;
       Lisp_Object value = Fcdr (object);
 
       CHECK_INT (value);
@@ -768,9 +768,9 @@
 	 rather than the window's point.
 
 	 #### It does?  Why does it take a window argument then? */
-      bufpos = vmotion (XWINDOW (window), XINT (Fwindow_point (window)),
+      charbpos = vmotion (XWINDOW (window), XINT (Fwindow_point (window)),
 			XINT (value), 0);
-      Fset_window_point (window, make_int (bufpos));
+      Fset_window_point (window, make_int (charbpos));
       Fcenter_to_window_line (Qzero, window);
     }
 
@@ -852,7 +852,7 @@
 */
        (object))
 {
-  Bufpos start_pos;
+  Charbpos start_pos;
   Lisp_Object orig_pt;
   Lisp_Object window = Fcar (object);
   Lisp_Object value = Fcdr (object);
--- a/src/search.c	Tue Sep 18 05:06:57 2001 +0000
+++ b/src/search.c	Thu Sep 20 06:31:11 2001 +0000
@@ -84,7 +84,7 @@
    able to free or re-allocate it properly.  */
 
 /* Note: things get trickier under Mule because the values returned from
-   the regexp routines are in Bytinds but we need them to be in Bufpos's.
+   the regexp routines are in Bytebposs but we need them to be in Charbpos's.
    We take the easy way out for the moment and just convert them immediately.
    We could be more clever by not converting them until necessary, but
    that gets real ugly real fast since the buffer might have changed and
@@ -109,17 +109,17 @@
 /* range table for use with skip_chars.  Only needed for Mule. */
 Lisp_Object Vskip_chars_range_table;
 
-static void set_search_regs (struct buffer *buf, Bufpos beg, Charcount len);
+static void set_search_regs (struct buffer *buf, Charbpos beg, Charcount len);
 static void save_search_regs (void);
-static Bufpos simple_search (struct buffer *buf, Bufbyte *base_pat,
-			     Bytecount len, Bytind pos, Bytind lim,
+static Charbpos simple_search (struct buffer *buf, Intbyte *base_pat,
+			     Bytecount len, Bytebpos pos, Bytebpos lim,
 			     EMACS_INT n, Lisp_Object trt);
-static Bufpos boyer_moore (struct buffer *buf, Bufbyte *base_pat,
-			   Bytecount len, Bytind pos, Bytind lim,
+static Charbpos boyer_moore (struct buffer *buf, Intbyte *base_pat,
+			   Bytecount len, Bytebpos pos, Bytebpos lim,
 			   EMACS_INT n, Lisp_Object trt,
 			   Lisp_Object inverse_trt, int charset_base);
-static Bufpos search_buffer (struct buffer *buf, Lisp_Object str,
-			     Bufpos bufpos, Bufpos buflim, EMACS_INT n, int RE,
+static Charbpos search_buffer (struct buffer *buf, Lisp_Object str,
+			     Charbpos charbpos, Charbpos buflim, EMACS_INT n, int RE,
 			     Lisp_Object trt, Lisp_Object inverse_trt,
 			     int posix);
 
@@ -229,13 +229,13 @@
   return Qnil; /* Not reached. */
 }
 
-/* Convert the search registers from Bytinds to Bufpos's.  Needs to be
+/* Convert the search registers from Bytebposs to Charbpos's.  Needs to be
    done after each regexp match that uses the search regs.
 
    We could get a potential speedup by not converting the search registers
    until it's really necessary, e.g. when match-data or replace-match is
    called.  However, this complexifies the code a lot (e.g. the buffer
-   could have changed and the Bytinds stored might be invalid) and is
+   could have changed and the Bytebposs stored might be invalid) and is
    probably not a great time-saver. */
 
 static void
@@ -247,9 +247,9 @@
   for (i = 0; i < num_regs; i++)
     {
       if (search_regs.start[i] >= 0)
-	search_regs.start[i] = bytind_to_bufpos (buf, search_regs.start[i]);
+	search_regs.start[i] = bytebpos_to_charbpos (buf, search_regs.start[i]);
       if (search_regs.end[i] >= 0)
-	search_regs.end[i] = bytind_to_bufpos (buf, search_regs.end[i]);
+	search_regs.end[i] = bytebpos_to_charbpos (buf, search_regs.end[i]);
     }
 }
 
@@ -290,7 +290,7 @@
 {
   /* This function has been Mule-ized, except for the trt table handling. */
   Lisp_Object val;
-  Bytind p1, p2;
+  Bytebpos p1, p2;
   Bytecount s1, s2;
   REGISTER int i;
   struct re_pattern_buffer *bufp;
@@ -458,14 +458,14 @@
    This does not clobber the match data. */
 
 Bytecount
-fast_string_match (Lisp_Object regexp,  const Bufbyte *nonreloc,
+fast_string_match (Lisp_Object regexp,  const Intbyte *nonreloc,
 		   Lisp_Object reloc, Bytecount offset,
 		   Bytecount length, int case_fold_search,
 		   Error_Behavior errb, int no_quit)
 {
   /* This function has been Mule-ized, except for the trt table handling. */
   Bytecount val;
-  Bufbyte *newnonreloc = (Bufbyte *) nonreloc;
+  Intbyte *newnonreloc = (Intbyte *) nonreloc;
   struct re_pattern_buffer *bufp;
 
   bufp = compile_pattern (regexp, 0,
@@ -491,7 +491,7 @@
 	  /* QUIT could relocate RELOC.  Therefore we must alloca()
 	     and copy.  No way around this except some serious
 	     rewriting of re_search(). */
-	  newnonreloc = (Bufbyte *) alloca (length);
+	  newnonreloc = (Intbyte *) alloca (length);
 	  memcpy (newnonreloc, XSTRING_DATA (reloc), length);
 	}
     }
@@ -561,12 +561,12 @@
 
    If ALLOW_QUIT is non-zero, call QUIT periodically. */
 
-static Bytind
-bi_scan_buffer (struct buffer *buf, Emchar target, Bytind st, Bytind en,
+static Bytebpos
+bi_scan_buffer (struct buffer *buf, Emchar target, Bytebpos st, Bytebpos en,
 		EMACS_INT count, EMACS_INT *shortage, int allow_quit)
 {
   /* This function has been Mule-ized. */
-  Bytind lim = en > 0 ? en :
+  Bytebpos lim = en > 0 ? en :
     ((count > 0) ? BI_BUF_ZV (buf) : BI_BUF_BEGV (buf));
 
   /* #### newline cache stuff in this function not yet ported */
@@ -590,7 +590,7 @@
 	    {
 	      if (BI_BUF_FETCH_CHAR (buf, st) == target)
 		count--;
-	      INC_BYTIND (buf, st);
+	      INC_BYTEBPOS (buf, st);
 	    }
 	}
       else
@@ -598,12 +598,12 @@
 	{
 	  while (st < lim && count > 0)
 	    {
-	      Bytind ceil;
-	      Bufbyte *bufptr;
+	      Bytebpos ceil;
+	      Intbyte *bufptr;
 
 	      ceil = BI_BUF_CEILING_OF (buf, st);
 	      ceil = min (lim, ceil);
-	      bufptr = (Bufbyte *) memchr (BI_BUF_BYTE_ADDRESS (buf, st),
+	      bufptr = (Intbyte *) memchr (BI_BUF_BYTE_ADDRESS (buf, st),
 					   (int) target, ceil - st);
 	      if (bufptr)
 		{
@@ -628,7 +628,7 @@
 	{
 	  while (st > lim && count < 0)
 	    {
-	      DEC_BYTIND (buf, st);
+	      DEC_BYTEBPOS (buf, st);
 	      if (BI_BUF_FETCH_CHAR (buf, st) == target)
 		count++;
 	    }
@@ -638,9 +638,9 @@
 	{
 	  while (st > lim && count < 0)
 	    {
-	      Bytind floor;
-	      Bufbyte *bufptr;
-	      Bufbyte *floorptr;
+	      Bytebpos floor;
+	      Intbyte *bufptr;
+	      Intbyte *floorptr;
 
 	      floor = BI_BUF_FLOOR_OF (buf, st);
 	      floor = max (lim, floor);
@@ -674,54 +674,54 @@
 	/* We found the character we were looking for; we have to return
 	   the position *after* it due to the strange way that the return
 	   value is defined. */
-	  INC_BYTIND (buf, st);
+	  INC_BYTEBPOS (buf, st);
 	  return st;
 	}
     }
 }
 
-Bufpos
-scan_buffer (struct buffer *buf, Emchar target, Bufpos start, Bufpos end,
+Charbpos
+scan_buffer (struct buffer *buf, Emchar target, Charbpos start, Charbpos end,
 	     EMACS_INT count, EMACS_INT *shortage, int allow_quit)
 {
-  Bytind bi_retval;
-  Bytind bi_start, bi_end;
-
-  bi_start = bufpos_to_bytind (buf, start);
+  Bytebpos bi_retval;
+  Bytebpos bi_start, bi_end;
+
+  bi_start = charbpos_to_bytebpos (buf, start);
   if (end)
-    bi_end = bufpos_to_bytind (buf, end);
+    bi_end = charbpos_to_bytebpos (buf, end);
   else
     bi_end = 0;
   bi_retval = bi_scan_buffer (buf, target, bi_start, bi_end, count,
 			      shortage, allow_quit);
-  return bytind_to_bufpos (buf, bi_retval);
+  return bytebpos_to_charbpos (buf, bi_retval);
 }
 
-Bytind
-bi_find_next_newline_no_quit (struct buffer *buf, Bytind from, int count)
+Bytebpos
+bi_find_next_newline_no_quit (struct buffer *buf, Bytebpos from, int count)
 {
   return bi_scan_buffer (buf, '\n', from, 0, count, 0, 0);
 }
 
-Bufpos
-find_next_newline_no_quit (struct buffer *buf, Bufpos from, int count)
+Charbpos
+find_next_newline_no_quit (struct buffer *buf, Charbpos from, int count)
 {
   return scan_buffer (buf, '\n', from, 0, count, 0, 0);
 }
 
-Bufpos
-find_next_newline (struct buffer *buf, Bufpos from, int count)
+Charbpos
+find_next_newline (struct buffer *buf, Charbpos from, int count)
 {
   return scan_buffer (buf, '\n', from, 0, count, 0, 1);
 }
 
-Bytind
-bi_find_next_emchar_in_string (Lisp_String* str, Emchar target, Bytind st,
+Bytebpos
+bi_find_next_emchar_in_string (Lisp_String* str, Emchar target, Bytebpos st,
 			       EMACS_INT count)
 {
   /* This function has been Mule-ized. */
-  Bytind lim = string_length (str) -1;
-  Bufbyte* s = string_data (str);
+  Bytebpos lim = string_length (str) -1;
+  Intbyte* s = string_data (str);
 
   assert (count >= 0);
 
@@ -737,7 +737,7 @@
 	{
 	  if (string_char (str, st) == target)
 	    count--;
-	  INC_CHARBYTIND (s, st);
+	  INC_CHARBYTEBPOS (s, st);
 	}
     }
   else
@@ -745,12 +745,12 @@
     {
       while (st < lim && count > 0)
 	{
-	  Bufbyte *bufptr = (Bufbyte *) memchr (charptr_n_addr (s, st),
+	  Intbyte *bufptr = (Intbyte *) memchr (charptr_n_addr (s, st),
 						(int) target, lim - st);
 	  if (bufptr)
 	    {
 	      count--;
-	      st =  (Bytind)(bufptr - s) + 1;
+	      st =  (Bytebpos)(bufptr - s) + 1;
 	    }
 	  else
 	    st = lim;
@@ -762,11 +762,11 @@
 /* Like find_next_newline, but returns position before the newline,
    not after, and only search up to TO.  This isn't just
    find_next_newline (...)-1, because you might hit TO.  */
-Bufpos
-find_before_next_newline (struct buffer *buf, Bufpos from, Bufpos to, int count)
+Charbpos
+find_before_next_newline (struct buffer *buf, Charbpos from, Charbpos to, int count)
 {
   EMACS_INT shortage;
-  Bufpos pos = scan_buffer (buf, '\n', from, to, count, &shortage, 1);
+  Charbpos pos = scan_buffer (buf, '\n', from, to, count, &shortage, 1);
 
   if (shortage == 0)
     pos--;
@@ -779,7 +779,7 @@
 	    Lisp_Object string, Lisp_Object lim)
 {
   /* This function has been Mule-ized. */
-  REGISTER Bufbyte *p, *pend;
+  REGISTER Intbyte *p, *pend;
   REGISTER Emchar c;
   /* We store the first 256 chars in an array here and the rest in
      a range table. */
@@ -789,7 +789,7 @@
 #ifndef emacs
   Lisp_Char_Table *syntax_table = XCHAR_TABLE (buf->mirror_syntax_table);
 #endif
-  Bufpos limit;
+  Charbpos limit;
 
   if (NILP (lim))
     limit = forwardp ? BUF_ZV (buf) : BUF_BEGV (buf);
@@ -880,7 +880,7 @@
       fastmap[i] ^= 1;
 
   {
-    Bufpos start_point = BUF_PT (buf);
+    Charbpos start_point = BUF_PT (buf);
 
     if (syntaxp)
       {
@@ -1017,8 +1017,8 @@
 		int RE, int posix)
 {
   /* This function has been Mule-ized, except for the trt table handling. */
-  REGISTER Bufpos np;
-  Bufpos lim;
+  REGISTER Charbpos np;
+  Charbpos lim;
   EMACS_INT n = direction;
   struct buffer *buf;
 
@@ -1085,7 +1085,7 @@
 {
   /* This function has been Mule-ized. */
   Bytecount len = XSTRING_LENGTH (regexp);
-  Bufbyte *s = XSTRING_DATA (regexp);
+  Intbyte *s = XSTRING_DATA (regexp);
   while (--len >= 0)
     {
       switch (*s++)
@@ -1114,14 +1114,14 @@
 }
 
 /* Search for the n'th occurrence of STRING in BUF,
-   starting at position BUFPOS and stopping at position BUFLIM,
+   starting at position CHARBPOS and stopping at position BUFLIM,
    treating PAT as a literal string if RE is false or as
    a regular expression if RE is true.
 
    If N is positive, searching is forward and BUFLIM must be greater
-   than BUFPOS.
+   than CHARBPOS.
    If N is negative, searching is backward and BUFLIM must be less
-   than BUFPOS.
+   than CHARBPOS.
 
    Returns -x if only N-x occurrences found (x > 0),
    or else the position at the beginning of the Nth occurrence
@@ -1129,18 +1129,18 @@
 
    POSIX is nonzero if we want full backtracking (POSIX style)
    for this pattern.  0 means backtrack only enough to get a valid match.  */
-static Bufpos
-search_buffer (struct buffer *buf, Lisp_Object string, Bufpos bufpos,
-	       Bufpos buflim, EMACS_INT n, int RE, Lisp_Object trt,
+static Charbpos
+search_buffer (struct buffer *buf, Lisp_Object string, Charbpos charbpos,
+	       Charbpos buflim, EMACS_INT n, int RE, Lisp_Object trt,
 	       Lisp_Object inverse_trt, int posix)
 {
   /* This function has been Mule-ized, except for the trt table handling. */
   Bytecount len = XSTRING_LENGTH (string);
-  Bufbyte *base_pat = XSTRING_DATA (string);
+  Intbyte *base_pat = XSTRING_DATA (string);
   REGISTER EMACS_INT i, j;
-  Bytind p1, p2;
+  Bytebpos p1, p2;
   Bytecount s1, s2;
-  Bytind pos, lim;
+  Bytebpos pos, lim;
 
   if (running_asynch_code)
     save_search_regs ();
@@ -1148,16 +1148,16 @@
   /* Null string is found at starting position.  */
   if (len == 0)
     {
-      set_search_regs (buf, bufpos, 0);
-      return bufpos;
+      set_search_regs (buf, charbpos, 0);
+      return charbpos;
     }
 
   /* Searching 0 times means don't move.  */
   if (n == 0)
-    return bufpos;
-
-  pos = bufpos_to_bytind (buf, bufpos);
-  lim = bufpos_to_bytind (buf, buflim);
+    return charbpos;
+
+  pos = charbpos_to_bytebpos (buf, charbpos);
+  lim = charbpos_to_bytebpos (buf, buflim);
   if (RE && !trivial_regexp_p (string))
     {
       struct re_pattern_buffer *bufp;
@@ -1203,8 +1203,8 @@
 	      /* Set pos to the new position. */
 	      pos = search_regs.start[0];
 	      fixup_search_regs_for_buffer (buf);
-	      /* And bufpos too. */
-	      bufpos = search_regs.start[0];
+	      /* And charbpos too. */
+	      charbpos = search_regs.start[0];
 	    }
 	  else
 	    {
@@ -1240,8 +1240,8 @@
 	      /* Set pos to the new position. */
 	      pos = search_regs.end[0];
 	      fixup_search_regs_for_buffer (buf);
-	      /* And bufpos too. */
-	      bufpos = search_regs.end[0];
+	      /* And charbpos too. */
+	      charbpos = search_regs.end[0];
 	    }
 	  else
 	    {
@@ -1249,19 +1249,19 @@
 	    }
 	  n--;
 	}
-      return bufpos;
+      return charbpos;
     }
   else				/* non-RE case */
     {
       int charset_base = -1;
       int boyer_moore_ok = 1;
-      Bufbyte *pat = 0;
-      Bufbyte *patbuf = alloca_array (Bufbyte, len * MAX_EMCHAR_LEN);
+      Intbyte *pat = 0;
+      Intbyte *patbuf = alloca_array (Intbyte, len * MAX_EMCHAR_LEN);
       pat = patbuf;
 #ifdef MULE
       while (len > 0)
 	{
-	  Bufbyte tmp_str[MAX_EMCHAR_LEN];
+	  Intbyte tmp_str[MAX_EMCHAR_LEN];
 	  Emchar c, translated, inverse;
 	  Bytecount orig_bytelen, new_bytelen, inv_bytelen;
 
@@ -1337,9 +1337,9 @@
    regardless of what is in TRT.  It is used in cases where
    boyer_moore cannot work.  */
 
-static Bufpos
-simple_search (struct buffer *buf, Bufbyte *base_pat, Bytecount len_byte,
-	       Bytind idx, Bytind lim, EMACS_INT n, Lisp_Object trt)
+static Charbpos
+simple_search (struct buffer *buf, Intbyte *base_pat, Bytecount len_byte,
+	       Bytebpos idx, Bytebpos lim, EMACS_INT n, Lisp_Object trt)
 {
   int forward = n > 0;
   Bytecount buf_len = 0; /* Shut up compiler. */
@@ -1350,8 +1350,8 @@
 	while (1)
 	  {
 	    Bytecount this_len = len_byte;
-	    Bytind this_idx = idx;
-	    Bufbyte *p = base_pat;
+	    Bytebpos this_idx = idx;
+	    Intbyte *p = base_pat;
 	    if (idx >= lim)
 	      goto stop;
 
@@ -1371,7 +1371,7 @@
 		pat_len = charcount_to_bytecount (p, 1);
 		p += pat_len;
 		this_len -= pat_len;
-		INC_BYTIND (buf, this_idx);
+		INC_BYTEBPOS (buf, this_idx);
 	      }
 	    if (this_len == 0)
 	      {
@@ -1379,7 +1379,7 @@
 		idx = this_idx;
 		break;
 	      }
-	    INC_BYTIND (buf, idx);
+	    INC_BYTEBPOS (buf, idx);
 	  }
 	n--;
       }
@@ -1389,8 +1389,8 @@
 	while (1)
 	  {
 	    Bytecount this_len = len_byte;
-	    Bytind this_idx = idx;
-	    Bufbyte *p;
+	    Bytebpos this_idx = idx;
+	    Intbyte *p;
 	    if (idx <= lim)
 	      goto stop;
 	    p = base_pat + len_byte;
@@ -1400,7 +1400,7 @@
 		Emchar pat_ch, buf_ch;
 
 		DEC_CHARPTR (p);
-		DEC_BYTIND (buf, this_idx);
+		DEC_BYTEBPOS (buf, this_idx);
 		pat_ch = charptr_emchar (p);
 		buf_ch = BI_BUF_FETCH_CHAR (buf, this_idx);
 
@@ -1417,23 +1417,23 @@
 		idx = this_idx;
 		break;
 	      }
-	    DEC_BYTIND (buf, idx);
+	    DEC_BYTEBPOS (buf, idx);
 	  }
 	n++;
       }
  stop:
   if (n == 0)
     {
-      Bufpos beg, end, retval;
+      Charbpos beg, end, retval;
       if (forward)
 	{
-	  beg = bytind_to_bufpos (buf, idx - buf_len);
-	  retval = end = bytind_to_bufpos (buf, idx);
+	  beg = bytebpos_to_charbpos (buf, idx - buf_len);
+	  retval = end = bytebpos_to_charbpos (buf, idx);
 	}
       else
 	{
-	  retval = beg = bytind_to_bufpos (buf, idx);
-	  end = bytind_to_bufpos (buf, idx + buf_len);
+	  retval = beg = bytebpos_to_charbpos (buf, idx);
+	  end = bytebpos_to_charbpos (buf, idx + buf_len);
 	}
       set_search_regs (buf, beg, end - beg);
 
@@ -1458,9 +1458,9 @@
 
    If that criterion is not satisfied, do not call this function.  */
 	    
-static Bufpos
-boyer_moore (struct buffer *buf, Bufbyte *base_pat, Bytecount len,
-	     Bytind pos, Bytind lim, EMACS_INT n, Lisp_Object trt,
+static Charbpos
+boyer_moore (struct buffer *buf, Intbyte *base_pat, Bytecount len,
+	     Bytebpos pos, Bytebpos lim, EMACS_INT n, Lisp_Object trt,
 	     Lisp_Object inverse_trt, int charset_base)
 {
   /* #### Someone really really really needs to comment the workings
@@ -1496,16 +1496,16 @@
   EMACS_INT *BM_tab_base;
   REGISTER Bytecount dirlen;
   EMACS_INT infinity;
-  Bytind limit;
+  Bytebpos limit;
   Bytecount stride_for_teases = 0;
   REGISTER EMACS_INT i, j;
-  Bufbyte *pat, *pat_end;
-  REGISTER Bufbyte *cursor, *p_limit, *ptr2;
-  Bufbyte simple_translate[0400];
+  Intbyte *pat, *pat_end;
+  REGISTER Intbyte *cursor, *p_limit, *ptr2;
+  Intbyte simple_translate[0400];
   REGISTER int direction = ((n > 0) ? 1 : -1);
 #ifdef MULE
-  Bufbyte translate_prev_byte = 0;
-  Bufbyte translate_anteprev_byte = 0;
+  Intbyte translate_prev_byte = 0;
+  Intbyte translate_anteprev_byte = 0;
 #endif
 #ifdef C_ALLOCA
   EMACS_INT BM_tab_space[0400];
@@ -1566,11 +1566,11 @@
      in the pattern.  Others don't matter anyway!  */
   xzero (simple_translate);
   for (i = 0; i < 0400; i++)
-    simple_translate[i] = (Bufbyte) i;
+    simple_translate[i] = (Intbyte) i;
   i = 0;
   while (i != infinity)
     {
-      Bufbyte *ptr = base_pat + i;
+      Intbyte *ptr = base_pat + i;
       i += direction;
       if (i == dirlen)
 	i = infinity;
@@ -1581,19 +1581,19 @@
 	  int this_translated = 1;
 
 	  /* Is *PTR the last byte of a character?  */
-	  if (pat_end - ptr == 1 || BUFBYTE_FIRST_BYTE_P (ptr[1]))
+	  if (pat_end - ptr == 1 || INTBYTE_FIRST_BYTE_P (ptr[1]))
 	    {
-	      Bufbyte *charstart = ptr;
-	      while (!BUFBYTE_FIRST_BYTE_P (*charstart))
+	      Intbyte *charstart = ptr;
+	      while (!INTBYTE_FIRST_BYTE_P (*charstart))
 		charstart--;
 	      untranslated = charptr_emchar (charstart);
 	      if (charset_base == (untranslated & ~CHAR_FIELD3_MASK))
 		{
 		  ch = TRANSLATE (trt, untranslated);
-		  if (!BUFBYTE_FIRST_BYTE_P (*ptr))
+		  if (!INTBYTE_FIRST_BYTE_P (*ptr))
 		    {
 		      translate_prev_byte = ptr[-1];
-		      if (!BUFBYTE_FIRST_BYTE_P (translate_prev_byte))
+		      if (!INTBYTE_FIRST_BYTE_P (translate_prev_byte))
 			translate_anteprev_byte = ptr[-2];
 		    }
 		}
@@ -1651,7 +1651,7 @@
 
 	  while ((j = TRANSLATE (inverse_trt, j)) != k)
 	    {
-	      simple_translate[j] = (Bufbyte) k;
+	      simple_translate[j] = (Intbyte) k;
 	      BM_tab[j] = dirlen - i;
 	    }
 #endif
@@ -1676,8 +1676,8 @@
      reverse) of pattern would align in a possible match.  */
   while (n != 0)
     {
-      Bytind tail_end;
-      Bufbyte *tail_end_ptr;
+      Bytebpos tail_end;
+      Intbyte *tail_end_ptr;
       /* It's been reported that some (broken) compiler thinks
 	 that Boolean expressions in an arithmetic context are
 	 unsigned.  Using an explicit ?1:0 prevents this.  */
@@ -1762,10 +1762,10 @@
 		      cursor -= direction;
 		      /* Translate only the last byte of a character.  */
 		      if ((cursor == tail_end_ptr
-			   || BUFBYTE_FIRST_BYTE_P (cursor[1]))
-			  && (BUFBYTE_FIRST_BYTE_P (cursor[0])
+			   || INTBYTE_FIRST_BYTE_P (cursor[1]))
+			  && (INTBYTE_FIRST_BYTE_P (cursor[0])
 			      || (translate_prev_byte == cursor[-1]
-				  && (BUFBYTE_FIRST_BYTE_P (translate_prev_byte)
+				  && (INTBYTE_FIRST_BYTE_P (translate_prev_byte)
 				      || translate_anteprev_byte == cursor[-2]))))
 			ch = simple_translate[*cursor];
 		      else
@@ -1790,11 +1790,11 @@
 		  cursor -= direction;
 
 		  {
-		    Bytind bytstart = (pos + cursor - ptr2 +
+		    Bytebpos bytstart = (pos + cursor - ptr2 +
 				       ((direction > 0)
 					? 1 - len : 0));
-		    Bufpos bufstart = bytind_to_bufpos (buf, bytstart);
-		    Bufpos bufend = bytind_to_bufpos (buf, bytstart + len);
+		    Charbpos bufstart = bytebpos_to_charbpos (buf, bytstart);
+		    Charbpos bufend = bytebpos_to_charbpos (buf, bytstart + len);
 
 		    set_search_regs (buf, bufstart, bufend - bufstart);
 		  }
@@ -1846,16 +1846,16 @@
 		{
 #ifdef MULE
 		  Emchar ch;
-		  Bufbyte *ptr;
+		  Intbyte *ptr;
 #endif
 		  pos -= direction;
 #ifdef MULE
 		  ptr = BI_BUF_BYTE_ADDRESS (buf, pos);
 		  if ((ptr == tail_end_ptr
-		       || BUFBYTE_FIRST_BYTE_P (ptr[1]))
-		      && (BUFBYTE_FIRST_BYTE_P (ptr[0])
+		       || INTBYTE_FIRST_BYTE_P (ptr[1]))
+		      && (INTBYTE_FIRST_BYTE_P (ptr[0])
 			  || (translate_prev_byte == ptr[-1]
-			      && (BUFBYTE_FIRST_BYTE_P (translate_prev_byte)
+			      && (INTBYTE_FIRST_BYTE_P (translate_prev_byte)
 				  || translate_anteprev_byte == ptr[-2]))))
 		    ch = simple_translate[*ptr];
 		  else
@@ -1879,11 +1879,11 @@
 		  pos -= direction;
 
 		  {
-		    Bytind bytstart = (pos +
+		    Bytebpos bytstart = (pos +
 				       ((direction > 0)
 					? 1 - len : 0));
-		    Bufpos bufstart = bytind_to_bufpos (buf, bytstart);
-		    Bufpos bufend = bytind_to_bufpos (buf, bytstart + len);
+		    Charbpos bufstart = bytebpos_to_charbpos (buf, bytstart);
+		    Charbpos bufend = bytebpos_to_charbpos (buf, bytstart + len);
 
 		    set_search_regs (buf, bufstart, bufend - bufstart);
 		  }
@@ -1902,14 +1902,14 @@
       if ((lim - pos) * direction < 0)
 	return (0 - n) * direction;
     }
-  return bytind_to_bufpos (buf, pos);
+  return bytebpos_to_charbpos (buf, pos);
 }
 
 /* Record beginning BEG and end BEG + LEN
    for a match just found in the current buffer.  */
 
 static void
-set_search_regs (struct buffer *buf, Bufpos beg, Charcount len)
+set_search_regs (struct buffer *buf, Charbpos beg, Charcount len)
 {
   /* This function has been Mule-ized. */
   /* Make sure we have registers in which to store
@@ -1957,10 +1957,10 @@
   {
     /* The following value is an upper bound on the amount of storage we
        need.  In non-Mule, it is exact. */
-    Bufbyte *storage =
-      (Bufbyte *) alloca (XSTRING_LENGTH (string) - punct_count +
+    Intbyte *storage =
+      (Intbyte *) alloca (XSTRING_LENGTH (string) - punct_count +
                           5 * (word_count - 1) + 4);
-    Bufbyte *o = storage;
+    Intbyte *o = storage;
 
     *o++ = '\\';
     *o++ = 'b';
@@ -2259,7 +2259,7 @@
   /* This function has been Mule-ized. */
   /* This function can GC */
   enum { nochange, all_caps, cap_initial } case_action;
-  Bufpos pos, last;
+  Charbpos pos, last;
   int some_multiletter_word;
   int some_lowercase;
   int some_uppercase;
@@ -2648,7 +2648,7 @@
      in the replacement string. */
   if (ul_pos_dynarr)
     {
-      Bufpos eend = BUF_PT (buf);
+      Charbpos eend = BUF_PT (buf);
       int i = 0;
       int cur_action = 'E';
 
@@ -2756,7 +2756,7 @@
   len = -1;
   for (i = 0; i < search_regs.num_regs; i++)
     {
-      Bufpos start = search_regs.start[i];
+      Charbpos start = search_regs.start[i];
       if (start >= 0)
 	{
 	  if (EQ (last_thing_searched, Qt)
@@ -2933,12 +2933,12 @@
 */
        (string))
 {
-  REGISTER Bufbyte *in, *out, *end;
-  REGISTER Bufbyte *temp;
+  REGISTER Intbyte *in, *out, *end;
+  REGISTER Intbyte *temp;
 
   CHECK_STRING (string);
 
-  temp = (Bufbyte *) alloca (XSTRING_LENGTH (string) * 2);
+  temp = (Intbyte *) alloca (XSTRING_LENGTH (string) * 2);
 
   /* Now copy the data into the new string, inserting escapes. */
 
--- a/src/select-common.h	Tue Sep 18 05:06:57 2001 +0000
+++ b/src/select-common.h	Thu Sep 20 06:31:11 2001 +0000
@@ -68,7 +68,7 @@
 static Lisp_Object
 selection_data_to_lisp_data (struct device *d,
 			     UChar_Binary *data,
-			     Memory_Count size,
+			     Bytecount size,
 			     XE_ATOM_TYPE type,
 			     int format)
 {
@@ -106,8 +106,8 @@
 	return XE_ATOM_TO_SYMBOL (d, *((XE_ATOM_TYPE *) data));
       else
 	{
-	  Element_Count i;
-	  Element_Count len = size / sizeof (XE_ATOM_TYPE);
+	  Elemcount i;
+	  Elemcount len = size / sizeof (XE_ATOM_TYPE);
 	  Lisp_Object v = Fmake_vector (make_int (len), Qzero);
 	  for (i = 0; i < len; i++)
 	    Faset (v, make_int (i), XE_ATOM_TO_SYMBOL (d, ((XE_ATOM_TYPE *) data) [i]));
@@ -142,7 +142,7 @@
    */
   else if (format == 16)
     {
-      Element_Count i;
+      Elemcount i;
       Lisp_Object v = make_vector (size / 4, Qzero);
       for (i = 0; i < size / 4; i++)
 	{
@@ -153,7 +153,7 @@
     }
   else
     {
-      Element_Count i;
+      Elemcount i;
       Lisp_Object v = make_vector (size / 4, Qzero);
       for (i = 0; i < size / 4; i++)
 	{
@@ -170,7 +170,7 @@
 			     Lisp_Object obj,
 			     UChar_Binary **data_ret,
 			     XE_ATOM_TYPE *type_ret,
-			     Memory_Count *size_ret,
+			     Bytecount *size_ret,
 			     int *format_ret)
 {
   Lisp_Object type = Qnil;
@@ -193,7 +193,7 @@
   else if (STRINGP (obj))
     {
       const Extbyte *extval;
-      Extcount extvallen;
+      Bytecount extvallen;
 
       TO_EXTERNAL_FORMAT (LISP_STRING, obj,
 			  ALLOCA, (extval, extvallen),
@@ -210,10 +210,10 @@
     }
   else if (CHARP (obj))
     {
-      Bufbyte buf[MAX_EMCHAR_LEN];
+      Intbyte buf[MAX_EMCHAR_LEN];
       Bytecount len;
       const Extbyte *extval;
-      Extcount extvallen;
+      Bytecount extvallen;
 
       *format_ret = 8;
       len = set_charptr_emchar (buf, XCHAR (obj));
@@ -264,7 +264,7 @@
 	 a set of 16 or 32 bit INTEGERs;
 	 or a set of ATOM_PAIRs (represented as [[A1 A2] [A3 A4] ...]
        */
-      Element_Count i;
+      Elemcount i;
 
       if (SYMBOLP (XVECTOR_DATA (obj) [0]))
 	/* This vector is an ATOM set */
--- a/src/select-gtk.c	Tue Sep 18 05:06:57 2001 +0000
+++ b/src/select-gtk.c	Thu Sep 20 06:31:11 2001 +0000
@@ -64,7 +64,7 @@
   if (atom == GDK_SELECTION_SECONDARY) return (QSECONDARY);
 
   {
-    CBufbyte *intstr;
+    CIntbyte *intstr;
     Extbyte *str = gdk_atom_name (atom);
 
     if (! str) return Qnil;
@@ -196,7 +196,7 @@
 
   {
     UChar_Binary *data;
-    Memory_Count size;
+    Bytecount size;
     int format;
     GdkAtom type;
     lisp_data_to_selection_data (d, converted_selection,
--- a/src/select-x.c	Tue Sep 18 05:06:57 2001 +0000
+++ b/src/select-x.c	Thu Sep 20 06:31:11 2001 +0000
@@ -284,13 +284,13 @@
 #endif
       XmString fmh;
       String encoding = "STRING";
-      const Bufbyte *data  = XSTRING_DATA (selection_value);
+      const Intbyte *data  = XSTRING_DATA (selection_value);
       Bytecount bytes = XSTRING_LENGTH (selection_value);
 
 #ifdef MULE
       {
 	enum { ASCII, LATIN_1, WORLD } chartypes = ASCII;
-	const Bufbyte *ptr = data, *end = ptr + bytes;
+	const Intbyte *ptr = data, *end = ptr + bytes;
 	/* Optimize for the common ASCII case */
 	while (ptr <= end)
 	  {
@@ -461,16 +461,16 @@
  */
 static void
 x_reply_selection_request (XSelectionRequestEvent *event, int format,
-			   UChar_Binary *data, Memory_Count size, Atom type)
+			   UChar_Binary *data, Bytecount size, Atom type)
 {
   /* This function can GC */
   XSelectionEvent reply;
   Display *display = event->display;
   struct device *d = get_device_from_display (display);
   Window window = event->requestor;
-  Memory_Count bytes_remaining;
+  Bytecount bytes_remaining;
   int format_bytes = format/8;
-  Memory_Count max_bytes = SELECTION_QUANTUM (display);
+  Bytecount max_bytes = SELECTION_QUANTUM (display);
   if (max_bytes > MAX_SELECTION_QUANTUM) max_bytes = MAX_SELECTION_QUANTUM;
 
   reply.type      = SelectionNotify;
@@ -527,7 +527,7 @@
 
       while (bytes_remaining)
 	{
-	  Memory_Count i = ((bytes_remaining < max_bytes)
+	  Bytecount i = ((bytes_remaining < max_bytes)
 		   ? bytes_remaining
 		   : max_bytes);
 	  prop_id = expect_property_change (display, window, reply.property,
@@ -625,7 +625,7 @@
 
   {
     UChar_Binary *data;
-    Memory_Count size;
+    Bytecount size;
     int format;
     Atom type;
     lisp_data_to_selection_data (d, converted_selection,
@@ -840,8 +840,8 @@
 copy_multiple_data (Lisp_Object obj)
 {
   Lisp_Object vec;
-  Element_Count i;
-  Element_Count len;
+  Elemcount i;
+  Elemcount len;
   if (CONSP (obj))
     return Fcons (XCAR (obj), copy_multiple_data (XCDR (obj)));
 
@@ -946,16 +946,16 @@
 
 static void
 x_get_window_property (Display *display, Window window, Atom property,
-		       UChar_Binary **data_ret, Memory_Count *bytes_ret,
+		       UChar_Binary **data_ret, Bytecount *bytes_ret,
 		       Atom *actual_type_ret, int *actual_format_ret,
 		       unsigned long *actual_size_ret, int delete_p)
 {
-  Memory_Count total_size;
+  Bytecount total_size;
   unsigned long bytes_remaining;
-  Memory_Count offset = 0;
+  Bytecount offset = 0;
   UChar_Binary *tmp_data = 0;
   int result;
-  Memory_Count buffer_size = SELECTION_QUANTUM (display);
+  Bytecount buffer_size = SELECTION_QUANTUM (display);
   if (buffer_size > MAX_SELECTION_QUANTUM) buffer_size = MAX_SELECTION_QUANTUM;
 
   /* First probe the thing to find out how big it is. */
@@ -987,7 +987,7 @@
   while (bytes_remaining)
     {
 #if 0
-      Memory_Count last = bytes_remaining;
+      Bytecount last = bytes_remaining;
 #endif
       result =
 	XGetWindowProperty (display, window, property,
@@ -1017,14 +1017,14 @@
 receive_incremental_selection (Display *display, Window window, Atom property,
 			       /* this one is for error messages only */
 			       Lisp_Object target_type,
-			       Memory_Count min_size_bytes,
+			       Bytecount min_size_bytes,
 			       UChar_Binary **data_ret,
-			       Memory_Count *size_bytes_ret,
+			       Bytecount *size_bytes_ret,
 			       Atom *type_ret, int *format_ret,
 			       unsigned long *size_ret)
 {
   /* This function can GC */
-  Memory_Count offset = 0;
+  Bytecount offset = 0;
   int prop_id;
   *size_bytes_ret = min_size_bytes;
   *data_ret = (UChar_Binary *) xmalloc (*size_bytes_ret);
@@ -1044,7 +1044,7 @@
   while (1)
     {
       UChar_Binary *tmp_data;
-      Memory_Count tmp_size_bytes;
+      Bytecount tmp_size_bytes;
       wait_for_property_change (prop_id);
       /* expect it again immediately, because x_get_window_property may
 	 .. no it won't, I don't get it.
@@ -1097,7 +1097,7 @@
   int actual_format;
   unsigned long actual_size;
   UChar_Binary *data = NULL;
-  Memory_Count bytes = 0;
+  Bytecount bytes = 0;
   Lisp_Object val;
   struct device *d = get_device_from_display (display);
 
@@ -1125,9 +1125,9 @@
     {
       /* Ok, that data wasn't *the* data, it was just the beginning. */
 
-      Memory_Count min_size_bytes =
+      Bytecount min_size_bytes =
 	/* careful here. */
-	(Memory_Count) (* ((unsigned int *) data));
+	(Bytecount) (* ((unsigned int *) data));
       xfree (data);
       receive_incremental_selection (display, window, property, target_type,
 				     min_size_bytes, &data, &bytes,
@@ -1245,7 +1245,7 @@
   Window window = RootWindow (display, 0); /* Cutbuffers are on frame 0 */
   Atom cut_buffer_atom;
   UChar_Binary *data;
-  Memory_Count bytes;
+  Bytecount bytes;
   Atom type;
   int format;
   unsigned long size;
@@ -1286,12 +1286,12 @@
   Display *display = DEVICE_X_DISPLAY (d);
   Window window = RootWindow (display, 0); /* Cutbuffers are on frame 0 */
   Atom cut_buffer_atom;
-  const Bufbyte *data  = XSTRING_DATA (string);
+  const Intbyte *data  = XSTRING_DATA (string);
   Bytecount bytes = XSTRING_LENGTH (string);
   Bytecount bytes_remaining;
-  Memory_Count max_bytes = SELECTION_QUANTUM (display);
+  Bytecount max_bytes = SELECTION_QUANTUM (display);
 #ifdef MULE
-  const Bufbyte *ptr, *end;
+  const Intbyte *ptr, *end;
   enum { ASCII, LATIN_1, WORLD } chartypes = ASCII;
 #endif
 
@@ -1346,7 +1346,7 @@
 
   while (bytes_remaining)
     {
-      Memory_Count chunk =
+      Bytecount chunk =
 	bytes_remaining < max_bytes ? bytes_remaining : max_bytes;
       XChangeProperty (display, window, cut_buffer_atom, XA_STRING, 8,
 		       (bytes_remaining == bytes
--- a/src/sheap.c	Tue Sep 18 05:06:57 2001 +0000
+++ b/src/sheap.c	Thu Sep 20 06:31:11 2001 +0000
@@ -126,7 +126,7 @@
 {
   int rc = 0;
 
-  Memory_Count lost = (STATIC_HEAP_BASE + STATIC_HEAP_SLOP + SHEAP_ADJUSTMENT)
+  Bytecount lost = (STATIC_HEAP_BASE + STATIC_HEAP_SLOP + SHEAP_ADJUSTMENT)
     - (static_heap_ptr - static_heap_buffer);
   char buf[200];
   sprintf (buf, "Static heap usage: %ld of %ld",
--- a/src/sound.c	Tue Sep 18 05:06:57 2001 +0000
+++ b/src/sound.c	Thu Sep 20 06:31:11 2001 +0000
@@ -323,7 +323,7 @@
   if (DEVICE_CONNECTED_TO_NAS_P (d) && STRINGP (sound))
     {
       const UChar_Binary *soundext;
-      Extcount soundextlen;
+      Bytecount soundextlen;
 
       TO_EXTERNAL_FORMAT (LISP_STRING, sound,
 			  ALLOCA, (soundext, soundextlen),
@@ -337,7 +337,7 @@
   if (DEVICE_CONNECTED_TO_ESD_P (d) && STRINGP (sound))
     {
       UChar_Binary *soundext;
-      Extcount soundextlen;
+      Bytecount soundextlen;
       int succes;
 
       TO_EXTERNAL_FORMAT (LISP_STRING, sound, ALLOCA, (soundext, soundextlen),
@@ -358,7 +358,7 @@
       && STRINGP (sound))
     {
       UChar_Binary *soundext;
-      Extcount soundextlen;
+      Bytecount soundextlen;
       int succes;
 
       TO_EXTERNAL_FORMAT (LISP_STRING, sound,
--- a/src/sound.h	Tue Sep 18 05:06:57 2001 +0000
+++ b/src/sound.h	Thu Sep 20 06:31:11 2001 +0000
@@ -31,8 +31,8 @@
 
 # define sound_perror(string)						 \
 do {									 \
-  Bufbyte *errmess;							 \
-  Bufbyte *string_int;							 \
+  Intbyte *errmess;							 \
+  Intbyte *string_int;							 \
   /* #### fix this to GET_STRERROR in my mule ws */			 \
   EXTERNAL_TO_C_STRING (strerror (errno), errmess, Qnative);		 \
   EXTERNAL_TO_C_STRING (string, string_int, Qnative);			 \
@@ -40,7 +40,7 @@
 } while (0)
 # define sound_warn(string)					\
 do {								\
-  Bufbyte *string_int;						\
+  Intbyte *string_int;						\
   EXTERNAL_TO_C_STRING (GETTEXT (string), string_int, Qnative);	\
   warn_when_safe (Qsound, Qwarning, "audio: %s", string_int);	\
 } while (0)
--- a/src/specifier.c	Tue Sep 18 05:06:57 2001 +0000
+++ b/src/specifier.c	Thu Sep 20 06:31:11 2001 +0000
@@ -350,15 +350,15 @@
 		internal_hash (s->buffer_specs, depth + 1));
 }
 
-inline static Memory_Count
-aligned_sizeof_specifier (Memory_Count specifier_type_specific_size)
+inline static Bytecount
+aligned_sizeof_specifier (Bytecount specifier_type_specific_size)
 {
   return ALIGN_SIZE (offsetof (Lisp_Specifier, data)
 		     + specifier_type_specific_size,
 		     ALIGNOF (max_align_t));
 }
 
-static Memory_Count
+static Bytecount
 sizeof_specifier (const void *header)
 {
   const Lisp_Specifier *p = (const Lisp_Specifier *) header;
@@ -473,7 +473,7 @@
 
 static Lisp_Object
 make_specifier_internal (struct specifier_methods *spec_meths,
-			 Memory_Count data_size, int call_create_meth)
+			 Bytecount data_size, int call_create_meth)
 {
   Lisp_Object specifier;
   Lisp_Specifier *sp = (Lisp_Specifier *)
--- a/src/symbols.c	Tue Sep 18 05:06:57 2001 +0000
+++ b/src/symbols.c	Thu Sep 20 06:31:11 2001 +0000
@@ -180,7 +180,7 @@
 intern (const char *str)
 {
   Bytecount len = strlen (str);
-  const Bufbyte *buf = (const Bufbyte *) str;
+  const Intbyte *buf = (const Intbyte *) str;
   Lisp_Object obarray = Vobarray;
 
   if (!VECTORP (obarray) || XVECTOR_LENGTH (obarray) == 0)
@@ -339,7 +339,7 @@
    Also store the bucket number in oblookup_last_bucket_number.  */
 
 Lisp_Object
-oblookup (Lisp_Object obarray, const Bufbyte *ptr, Bytecount size)
+oblookup (Lisp_Object obarray, const Intbyte *ptr, Bytecount size)
 {
   unsigned int hash, obsize;
   Lisp_Symbol *tail;
@@ -379,7 +379,7 @@
    Investigation by Karl Nelson <kenelson@ece.ucdavis.edu>.
    Do a web search for "g_str_hash X31_HASH" if you want to know more. */
 unsigned int
-hash_string (const Bufbyte *ptr, Bytecount len)
+hash_string (const Intbyte *ptr, Bytecount len)
 {
   unsigned int hash;
 
@@ -3218,7 +3218,7 @@
 
   /* Bootstrapping problem: Qnil isn't set when make_string_nocopy is
      called the first time. */
-  Qnil = Fmake_symbol (make_string_nocopy ((const Bufbyte *) "nil", 3));
+  Qnil = Fmake_symbol (make_string_nocopy ((const Intbyte *) "nil", 3));
   XSYMBOL (Qnil)->name->plist = Qnil;
   XSYMBOL (Qnil)->value = Qnil; /* Nihil ex nihil */
   XSYMBOL (Qnil)->plist = Qnil;
@@ -3286,7 +3286,7 @@
   for (i = 0; i < len; i++)
     if (temp[i] == '_')
       temp[i] = '-';
-  *location = Fintern (make_string ((const Bufbyte *) temp, len), Qnil);
+  *location = Fintern (make_string ((const Intbyte *) temp, len), Qnil);
   if (dump_p)
     staticpro (location);
   else
@@ -3321,7 +3321,7 @@
 void
 defsymbol_nodump (Lisp_Object *location, const char *name)
 {
-  *location = Fintern (make_string_nocopy ((const Bufbyte *) name,
+  *location = Fintern (make_string_nocopy ((const Intbyte *) name,
 					   strlen (name)),
 		       Qnil);
   staticpro_nodump (location);
@@ -3330,7 +3330,7 @@
 void
 defsymbol (Lisp_Object *location, const char *name)
 {
-  *location = Fintern (make_string_nocopy ((const Bufbyte *) name,
+  *location = Fintern (make_string_nocopy ((const Intbyte *) name,
 					   strlen (name)),
 		       Qnil);
   staticpro (location);
@@ -3592,7 +3592,7 @@
     sym = Fintern (build_string (symbol_name), Qnil);
   else
 #endif
-    sym = Fintern (make_string_nocopy ((const Bufbyte *) symbol_name,
+    sym = Fintern (make_string_nocopy ((const Intbyte *) symbol_name,
 				       strlen (symbol_name)), Qnil);
 
   XSETOBJ (XSYMBOL (sym)->value, magic);
--- a/src/syntax.c	Tue Sep 18 05:06:57 2001 +0000
+++ b/src/syntax.c	Thu Sep 20 06:31:11 2001 +0000
@@ -99,12 +99,12 @@
   int comstyle;		/* comment style a=0, or b=1, or ST_COMMENT_STYLE */
   int quoted;		/* Nonzero if just after an escape char at end of
 			   parsing */
-  Bufpos thislevelstart;/* Char number of most recent start-of-expression
+  Charbpos thislevelstart;/* Char number of most recent start-of-expression
                            at current level */
-  Bufpos prevlevelstart;/* Char number of start of containing expression */
-  Bufpos location;	/* Char number at which parsing stopped */
+  Charbpos prevlevelstart;/* Char number of start of containing expression */
+  Charbpos location;	/* Char number at which parsing stopped */
   int mindepth;		/* Minimum depth seen while scanning  */
-  Bufpos comstr_start;	/* Position just after last comment/string starter  */
+  Charbpos comstr_start;	/* Position just after last comment/string starter  */
   Lisp_Object levelstarts;	/* Char numbers of starts-of-expression
                                    of levels (starting from outermost).  */
 };
@@ -116,20 +116,20 @@
    find_start_begv   is the BEGV value when it was found.
    find_start_modiff is the value of MODIFF when it was found.  */
 
-static Bufpos find_start_pos;
-static Bufpos find_start_value;
+static Charbpos find_start_pos;
+static Charbpos find_start_value;
 static struct buffer *find_start_buffer;
-static Bufpos find_start_begv;
+static Charbpos find_start_begv;
 static int find_start_modiff;
 
 /* Find a defun-start that is the last one before POS (or nearly the last).
    We record what we find, so that another call in the same area
    can return the same value right away.  */
 
-static Bufpos
-find_defun_start (struct buffer *buf, Bufpos pos)
+static Charbpos
+find_defun_start (struct buffer *buf, Charbpos pos)
 {
-  Bufpos tem;
+  Charbpos tem;
 
   /* Use previous finding, if it's valid and applies to this inquiry.  */
   if (buf == find_start_buffer
@@ -457,10 +457,10 @@
    If that many words cannot be found before the end of the buffer, return 0.
    COUNT negative means scan backward and stop at word beginning.  */
 
-Bufpos
-scan_words (struct buffer *buf, Bufpos from, int count)
+Charbpos
+scan_words (struct buffer *buf, Charbpos from, int count)
 {
-  Bufpos limit = count > 0 ? BUF_ZV (buf) : BUF_BEGV (buf);
+  Charbpos limit = count > 0 ? BUF_ZV (buf) : BUF_BEGV (buf);
   Emchar ch0, ch1;
   enum syntaxcode code;
 
@@ -573,7 +573,7 @@
 */
        (count, buffer))
 {
-  Bufpos val;
+  Charbpos val;
   struct buffer *buf = decode_buffer (buffer, 0);
   EMACS_INT n;
 
@@ -600,13 +600,13 @@
 
 static void scan_sexps_forward (struct buffer *buf,
 				struct lisp_parse_state *,
-				Bufpos from, Bufpos end,
+				Charbpos from, Charbpos end,
 				int targetdepth, int stopbefore,
 				Lisp_Object oldstate,
 				int commentstop);
 
 static int
-find_start_of_comment (struct buffer *buf, Bufpos from, Bufpos stop,
+find_start_of_comment (struct buffer *buf, Charbpos from, Charbpos stop,
 		       int comstyle)
 {
   Emchar c;
@@ -624,8 +624,8 @@
   int parity = 0;
   Emchar my_stringend = 0;
   int string_lossage = 0;
-  Bufpos comment_end = from;
-  Bufpos comstart_pos = 0;
+  Charbpos comment_end = from;
+  Charbpos comstart_pos = 0;
   int comstart_parity = 0;
   int styles_match_p = 0;
   /* mask to match comment styles against; for ST_COMMENT_STYLE, this
@@ -788,8 +788,8 @@
   return from;
 }
 
-static Bufpos
-find_end_of_comment (struct buffer *buf, Bufpos from, Bufpos stop, int comstyle)
+static Charbpos
+find_end_of_comment (struct buffer *buf, Charbpos from, Charbpos stop, int comstyle)
 {
   int c;
   int prev_code;
@@ -877,8 +877,8 @@
 */
        (count, buffer))
 {
-  Bufpos from;
-  Bufpos stop;
+  Charbpos from;
+  Charbpos stop;
   Emchar c;
   enum syntaxcode code;
   int syncode;
@@ -960,7 +960,7 @@
 
 	  if (code == Scomment)
 	    {
-	      Bufpos newfrom = find_end_of_comment (buf, from, stop, comstyle);
+	      Charbpos newfrom = find_end_of_comment (buf, from, stop, comstyle);
 	      if (newfrom < 0)
 		{
 		  /* we stopped because from==stop */
@@ -1065,10 +1065,10 @@
 
 
 Lisp_Object
-scan_lists (struct buffer *buf, Bufpos from, int count, int depth,
+scan_lists (struct buffer *buf, Charbpos from, int count, int depth,
 	    int sexpflag, int noerror)
 {
-  Bufpos stop;
+  Charbpos stop;
   Emchar c;
   int quoted;
   int mathexit = 0;
@@ -1169,7 +1169,7 @@
 		break;
 	      UPDATE_SYNTAX_CACHE_FORWARD (from);
 	      {
-		Bufpos newfrom =
+		Charbpos newfrom =
 		  find_end_of_comment (buf, from, stop, comstyle);
 		if (newfrom < 0)
 		  {
@@ -1453,12 +1453,12 @@
 }
 
 int
-char_quoted (struct buffer *buf, Bufpos pos)
+char_quoted (struct buffer *buf, Charbpos pos)
 {
   enum syntaxcode code;
-  Bufpos beg = BUF_BEGV (buf);
+  Charbpos beg = BUF_BEGV (buf);
   int quoted = 0;
-  Bufpos startpos = pos;
+  Charbpos startpos = pos;
 
   while (pos > beg)
     {
@@ -1545,8 +1545,8 @@
        (buffer))
 {
   struct buffer *buf = decode_buffer (buffer, 0);
-  Bufpos beg = BUF_BEGV (buf);
-  Bufpos pos = BUF_PT (buf);
+  Charbpos beg = BUF_BEGV (buf);
+  Charbpos pos = BUF_PT (buf);
 #ifndef emacs
   Lisp_Char_Table *mirrortab = XCHAR_TABLE (buf->mirror_syntax_table);
 #endif
@@ -1574,7 +1574,7 @@
 
 static void
 scan_sexps_forward (struct buffer *buf, struct lisp_parse_state *stateptr,
-		    Bufpos from, Bufpos end,
+		    Charbpos from, Charbpos end,
 		    int targetdepth, int stopbefore,
 		    Lisp_Object oldstate,
 		    int commentstop)
@@ -1772,7 +1772,7 @@
 	    goto done;
 	  UPDATE_SYNTAX_CACHE_FORWARD (from);
 	  {
-	    Bufpos newfrom = find_end_of_comment (buf, from, end, state.comstyle);
+	    Charbpos newfrom = find_end_of_comment (buf, from, end, state.comstyle);
 	    if (newfrom < 0)
 	      {
 		/* we terminated search because from == end */
@@ -1944,7 +1944,7 @@
 {
   struct lisp_parse_state state;
   int target;
-  Bufpos start, end;
+  Charbpos start, end;
   struct buffer *buf = decode_buffer (buffer, 0);
   Lisp_Object val;
 
--- a/src/syntax.h	Tue Sep 18 05:06:57 2001 +0000
+++ b/src/syntax.h	Thu Sep 20 06:31:11 2001 +0000
@@ -248,9 +248,9 @@
 
 extern const unsigned char syntax_code_spec[];
 
-Lisp_Object scan_lists (struct buffer *buf, Bufpos from, int count,
+Lisp_Object scan_lists (struct buffer *buf, Charbpos from, int count,
 			int depth, int sexpflag, int no_error);
-int char_quoted (struct buffer *buf, Bufpos pos);
+int char_quoted (struct buffer *buf, Charbpos pos);
 
 /* NOTE: This does not refer to the mirror table, but to the
    syntax table itself. */
@@ -281,9 +281,9 @@
   Lisp_Object current_syntax_table;	/* Syntax table for current pos. */
   Lisp_Object old_prop;			/* Syntax-table prop at prev pos. */
 
-  Bufpos next_change;			/* Position of the next extent
+  Charbpos next_change;			/* Position of the next extent
                                            change. */
-  Bufpos prev_change;			/* Position of the previous
+  Charbpos prev_change;			/* Position of the previous
                                            extent change. */
 };
 extern struct syntax_cache syntax_cache;
@@ -332,7 +332,7 @@
    : STRINGP (syntax_cache.object)						\
    ? bytecount_to_charcount (XSTRING_DATA (syntax_cache.object), bytepos)	\
    : (BUFFERP (syntax_cache.object) || NILP (syntax_cache.object))		\
-   ? bytind_to_bufpos (syntax_cache.buffer,					\
+   ? bytebpos_to_charbpos (syntax_cache.buffer,					\
 		       bytepos + BI_BUF_BEGV (syntax_cache.buffer))		\
    : (bytepos))
 
@@ -342,7 +342,7 @@
    : STRINGP (obj)						\
    ? bytecount_to_charcount (XSTRING_DATA (obj), bytepos)	\
    : (BUFFERP (obj) || NILP (obj))				\
-   ? bytind_to_bufpos (buf, bytepos + BI_BUF_BEGV (buf))	\
+   ? bytebpos_to_charbpos (buf, bytepos + BI_BUF_BEGV (buf))	\
    : (bytepos))
 
 #else  /* not emacs */
--- a/src/sysdep.c	Tue Sep 18 05:06:57 2001 +0000
+++ b/src/sysdep.c	Thu Sep 20 06:31:11 2001 +0000
@@ -805,10 +805,10 @@
 
 /* Figure out the eof character for the FD. */
 
-Bufbyte
+Intbyte
 get_eof_char (int fd)
 {
-  const Bufbyte ctrl_d = (Bufbyte) '\004';
+  const Intbyte ctrl_d = (Intbyte) '\004';
 
   if (!isatty (fd))
     return ctrl_d;
@@ -821,9 +821,9 @@
     if ((int) strlen ((const char *) t.c_cc) < (VEOF + 1))
       return ctrl_d;
     else
-      return (Bufbyte) t.c_cc[VEOF];
+      return (Intbyte) t.c_cc[VEOF];
 #endif
-    return t.c_cc[VEOF] == _POSIX_VDISABLE ? ctrl_d : (Bufbyte) t.c_cc[VEOF];
+    return t.c_cc[VEOF] == _POSIX_VDISABLE ? ctrl_d : (Intbyte) t.c_cc[VEOF];
   }
 #else /* ! HAVE_TERMIOS */
   /* On Berkeley descendants, the following IOCTL's retrieve the
@@ -832,7 +832,7 @@
   {
     struct tchars c;
     ioctl (fd, TIOCGETC, &c);
-    return (Bufbyte) c.t_eofc;
+    return (Intbyte) c.t_eofc;
   }
 #else /* ! defined (TIOCGLTC) && defined (TIOCGETC) */
   /* On SYSV descendants, the TCGETA ioctl retrieves the current control
@@ -844,7 +844,7 @@
     if ((int) strlen ((const char *) t.c_cc) < (VINTR + 1))
       return ctrl_d;
     else
-      return (Bufbyte) t.c_cc[VINTR];
+      return (Intbyte) t.c_cc[VINTR];
   }
 #else /* ! defined (TCGETA) */
   /* Rather than complain, we'll just guess ^D, which is what
@@ -2389,7 +2389,7 @@
   Vsystem_name = build_string (hostname);
 #endif /* HAVE_GETHOSTNAME  */
   {
-    Bufbyte *p;
+    Intbyte *p;
     Bytecount i;
 
     for (i = 0, p = XSTRING_DATA (Vsystem_name);
@@ -3022,8 +3022,8 @@
     return NULL;
   {
     const Extbyte * const external_name = (const Extbyte *) rtnval->d_name;
-    Extcount external_len = strlen (rtnval->d_name);
-    const Bufbyte *internal_name;
+    Bytecount external_len = strlen (rtnval->d_name);
+    const Intbyte *internal_name;
     Bytecount internal_len;
 
     TO_INTERNAL_FORMAT (DATA, (external_name, external_len),
@@ -3036,13 +3036,13 @@
       return rtnval;
 
     { /* Non-ASCII filename */
-      static Bufbyte_dynarr *internal_DIRENTRY;
+      static Intbyte_dynarr *internal_DIRENTRY;
       if (!internal_DIRENTRY)
-        internal_DIRENTRY = Dynarr_new (Bufbyte);
+        internal_DIRENTRY = Dynarr_new (Intbyte);
       else
         Dynarr_reset (internal_DIRENTRY);
 
-      Dynarr_add_many (internal_DIRENTRY, (Bufbyte *) rtnval,
+      Dynarr_add_many (internal_DIRENTRY, (Intbyte *) rtnval,
                        offsetof (DIRENTRY, d_name));
 
 
--- a/src/sysdep.h	Tue Sep 18 05:06:57 2001 +0000
+++ b/src/sysdep.h	Thu Sep 20 06:31:11 2001 +0000
@@ -46,7 +46,7 @@
 void wait_without_blocking (void);
 
 int get_pty_max_bytes (int fd);
-Bufbyte get_eof_char (int fd);
+Intbyte get_eof_char (int fd);
 
 /* Wait for subprocess with process id `pid' to terminate and
    make sure it will get eliminated (not remain forever as a zombie) */
--- a/src/syswindows.h	Tue Sep 18 05:06:57 2001 +0000
+++ b/src/syswindows.h	Thu Sep 20 06:31:11 2001 +0000
@@ -55,6 +55,23 @@
 #define WIN32_LEAN_AND_MEAN
 #endif
 
+#if defined (CYGWIN) || defined (MINGW)
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+/* Fucking GCC complains about "no previous prototype" for inline
+   functions.  DUH!  See DECLARE_INLINE_HEADER. */
+extern __inline void *GetCurrentFiber (void);
+extern __inline void *GetFiberData (void);
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif
+
 #include <windows.h>
 
 #if defined (WIN32_LEAN_AND_MEAN)
@@ -225,7 +242,7 @@
 
 #define LOCAL_FILE_FORMAT_TO_TSTR(path, out)		\
 do {							\
-  Bufbyte *lttff;					\
+  Intbyte *lttff;					\
 							\
   LOCAL_TO_WIN32_FILE_FORMAT (path, lttff);		\
   C_STRING_TO_EXTERNAL (lttff, out, Qmswindows_tstr);	\
@@ -247,7 +264,7 @@
   int ltwff2 =								\
     cygwin_posix_to_win32_path_list_buf_size ((char *)			\
 					      XSTRING_DATA (ltwff1));	\
-  pathout = (Bufbyte *) alloca (ltwff2);				\
+  pathout = (Intbyte *) alloca (ltwff2);				\
   cygwin_posix_to_win32_path_list ((char *) XSTRING_DATA (ltwff1),	\
 				   (char *) pathout);			\
 } while (0)
@@ -261,17 +278,17 @@
 #ifdef CYGWIN
 #define WIN32_TO_LOCAL_FILE_FORMAT(path, pathout)			\
 do {									\
-  Bufbyte *wtlff1 = (path);						\
+  Intbyte *wtlff1 = (path);						\
   int wtlff2 =								\
     cygwin_win32_to_posix_path_list_buf_size ((char *) wtlff1);		\
-  Bufbyte *wtlff3 = (Bufbyte *) alloca (wtlff2);			\
+  Intbyte *wtlff3 = (Intbyte *) alloca (wtlff2);			\
   cygwin_win32_to_posix_path_list ((char *) wtlff1, (char *) wtlff3);	\
-  (pathout) = build_string ((CBufbyte *) wtlff3);			\
+  (pathout) = build_string ((CIntbyte *) wtlff3);			\
 } while (0)
 #else
 #define WIN32_TO_LOCAL_FILE_FORMAT(path, pathout)	\
 do {							\
-  (pathout) = build_string ((CBufbyte *) path);		\
+  (pathout) = build_string ((CIntbyte *) path);		\
 } while (0)
 #endif
 
--- a/src/tests.c	Tue Sep 18 05:06:57 2001 +0000
+++ b/src/tests.c	Thu Sep 20 06:31:11 2001 +0000
@@ -40,10 +40,10 @@
 */
        ())
 {
-  void *ptr; Memory_Count len;
+  void *ptr; Bytecount len;
   Lisp_Object string, opaque;
 
-  Bufbyte int_foo[] = "\n\nfoo\nbar";
+  Intbyte int_foo[] = "\n\nfoo\nbar";
   Extbyte ext_unix[]= "\n\nfoo\nbar";
 
   Extbyte ext_dos[] = "\r\n\r\nfoo\r\nbar";
@@ -52,8 +52,8 @@
   Lisp_Object string_foo = make_string (int_foo, sizeof (int_foo) - 1);
 
   Extbyte ext_latin[]  = "f\372b\343\340";
-  Bufbyte int_latin1[] = "f\201\372b\201\343\201\340";
-  Bufbyte int_latin2[] = "f\202\372b\202\343\202\340";
+  Intbyte int_latin1[] = "f\201\372b\201\343\201\340";
+  Intbyte int_latin2[] = "f\202\372b\202\343\202\340";
 #ifdef MULE
   Extbyte ext_latin12[]= "f\033-A\372b\343\340\033-B";
   Extbyte ext_tilde[]  = "f~b~~";
--- a/src/toolbar-gtk.c	Tue Sep 18 05:06:57 2001 +0000
+++ b/src/toolbar-gtk.c	Thu Sep 20 06:31:11 2001 +0000
@@ -228,7 +228,7 @@
 	      return;
 	    }
 	  buf = Dynarr_new (Emchar);
-	  convert_bufbyte_string_into_emchar_dynarr
+	  convert_intbyte_string_into_emchar_dynarr
 	    (XSTRING_DATA (string), XSTRING_LENGTH (string), buf);
 	  find_charsets_in_emchar_string (charsets, Dynarr_atp (buf, 0),
 					  Dynarr_length (buf));
--- a/src/toolbar-x.c	Tue Sep 18 05:06:57 2001 +0000
+++ b/src/toolbar-x.c	Thu Sep 20 06:31:11 2001 +0000
@@ -239,7 +239,7 @@
 	      return;
 	    }
 	  buf = Dynarr_new (Emchar);
-	  convert_bufbyte_string_into_emchar_dynarr
+	  convert_intbyte_string_into_emchar_dynarr
 	    (XSTRING_DATA (string), XSTRING_LENGTH (string), buf);
 	  find_charsets_in_emchar_string (charsets, Dynarr_atp (buf, 0),
 					  Dynarr_length (buf));
--- a/src/tooltalk.c	Tue Sep 18 05:06:57 2001 +0000
+++ b/src/tooltalk.c	Thu Sep 20 06:31:11 2001 +0000
@@ -301,7 +301,7 @@
 {
   if (tt_is_err (st))
     {
-      CBufbyte *err;
+      CIntbyte *err;
 
       EXTERNAL_TO_C_STRING (tt_status_message (st), err, Qnative);
       signal_error (Qtooltalk_error, err, Qunbound);
@@ -532,7 +532,7 @@
 tt_message_arg_bval_vector (Tt_message m, int n)
 {
   /* !!#### This function has not been Mule-ized */
-  Bufbyte *value;
+  Intbyte *value;
   int len = 0;
 
   check_status (tt_message_arg_bval (m, n, &value, &len));
@@ -762,7 +762,7 @@
   else if (EQ (attribute, Qtt_arg_bval))
     {
       Extbyte *value_ext;
-      Extcount value_ext_len;
+      Bytecount value_ext_len;
       CHECK_STRING (value);
       TO_EXTERNAL_FORMAT (LISP_STRING, value,
 			  ALLOCA, (value_ext, value_ext_len),
--- a/src/tparam.c	Tue Sep 18 05:06:57 2001 +0000
+++ b/src/tparam.c	Thu Sep 20 06:31:11 2001 +0000
@@ -30,8 +30,8 @@
 #define realloc xrealloc
 #define malloc xmalloc
 #define free xfree
-extern void *xmalloc (Memory_Count size);
-extern void *xrealloc (void *, Memory_Count size);
+extern void *xmalloc (Bytecount size);
+extern void *xrealloc (void *, Bytecount size);
 
 /* Assuming STRING is the value of a termcap string entry
    containing `%' constructs to expand parameters,
--- a/src/undo.c	Tue Sep 18 05:06:57 2001 +0000
+++ b/src/undo.c	Thu Sep 20 06:31:11 2001 +0000
@@ -28,7 +28,7 @@
 #include "extents.h"
 
 /* Maintained in event-stream.c */
-extern Bufpos last_point_position;
+extern Charbpos last_point_position;
 extern Lisp_Object last_point_position_buffer;
 
 /* Extent code needs to know about undo because the behavior of insert()
@@ -118,7 +118,7 @@
    because we don't need to record the contents.)  */
 
 void
-record_insert (struct buffer *b, Bufpos beg, Charcount length)
+record_insert (struct buffer *b, Charbpos beg, Charcount length)
 {
   if (!undo_prelude (b, 1))
     return;
@@ -148,7 +148,7 @@
    for LENGTH characters at location BEG.  */
 
 void
-record_delete (struct buffer *b, Bufpos beg, Charcount length)
+record_delete (struct buffer *b, Charbpos beg, Charcount length)
 {
   /* This function can GC */
   Lisp_Object sbeg;
@@ -184,7 +184,7 @@
    The replacement does not change the number of characters.  */
 
 void
-record_change (struct buffer *b, Bufpos beg, Charcount length)
+record_change (struct buffer *b, Charbpos beg, Charcount length)
 {
   record_delete (b, beg, length);
   record_insert (b, beg, length);
@@ -222,7 +222,7 @@
 /* Record a change in property PROP (whose old value was VAL)
    for LENGTH characters starting at position BEG in BUFFER.  */
 
-record_property_change (Bufpos beg, Charcount length,
+record_property_change (Charbpos beg, Charcount length,
                         Lisp_Object prop, Lisp_Object value,
                         Lisp_Object buffer)
 {
@@ -408,7 +408,7 @@
 	  /* Handle an integer by setting point to that value.  */
 	  else if (INTP (next))
 	    BUF_SET_PT (current_buffer,
-			bufpos_clip_to_bounds (BUF_BEGV (current_buffer),
+			charbpos_clip_to_bounds (BUF_BEGV (current_buffer),
 					       XINT (next),
 					       BUF_ZV (current_buffer)));
 	  else if (CONSP (next))
--- a/src/win32.c	Tue Sep 18 05:06:57 2001 +0000
+++ b/src/win32.c	Thu Sep 20 06:31:11 2001 +0000
@@ -87,7 +87,7 @@
 Lisp_Object
 tstr_to_local_file_format (Extbyte *pathout)
 {
-  Bufbyte *ttlff;
+  Intbyte *ttlff;
   Lisp_Object in;
 
   EXTERNAL_TO_C_STRING (pathout, ttlff, Qmswindows_tstr);
--- a/src/window.c	Tue Sep 18 05:06:57 2001 +0000
+++ b/src/window.c	Thu Sep 20 06:31:11 2001 +0000
@@ -1299,8 +1299,8 @@
        (pos, window))
 {
   struct window *w = decode_window (window);
-  Bufpos top = marker_position (w->start[CURRENT_DISP]);
-  Bufpos posint;
+  Charbpos top = marker_position (w->start[CURRENT_DISP]);
+  Charbpos posint;
   struct buffer *buf = XBUFFER (w->buffer);
 
   if (NILP (pos))
@@ -1438,7 +1438,7 @@
      (window, noclipped))
 {
   struct window *w;
-  Bufpos start, eobuf;
+  Charbpos start, eobuf;
   int defheight;
   int hlimit, height, prev_height = -1;
   int line;
@@ -1728,7 +1728,7 @@
     }
   else
     {
-      Bufpos startp = marker_position (w->start[CURRENT_DISP]);
+      Charbpos startp = marker_position (w->start[CURRENT_DISP]);
       return make_int (end_of_last_line (w, startp));
     }
 }
@@ -1862,7 +1862,7 @@
   if (! EQ (buf, XWINDOW (Fselected_window (Qnil))->buffer))
     {
       struct buffer *b= XBUFFER (buf);
-      BUF_SET_PT (b, bufpos_clip_to_bounds (BUF_BEGV (b),
+      BUF_SET_PT (b, charbpos_clip_to_bounds (BUF_BEGV (b),
                                      marker_position (w->pointm[CURRENT_DISP]),
                                      BUF_ZV (b)));
     }
@@ -3024,7 +3024,7 @@
 {
   struct window *w = decode_window (window);
   struct buffer *b = XBUFFER (w->buffer);
-  Bufpos start_pos;
+  Charbpos start_pos;
   int old_top = WINDOW_TOP (w);
 
   XSETWINDOW (window, w);
@@ -3045,7 +3045,7 @@
   if (start_pos >= BUF_BEGV (b) && start_pos <= BUF_ZV (b)
       && !MINI_WINDOW_P (w))
     {
-      Bufpos new_start = start_with_line_at_pixpos (w, start_pos, old_top);
+      Charbpos new_start = start_with_line_at_pixpos (w, start_pos, old_top);
 
       if (new_start >= BUF_BEGV (b) && new_start <= BUF_ZV (b))
 	{
@@ -3567,7 +3567,7 @@
      redisplay_window has altered point after scrolling,
      because it makes the change only in the window.  */
   {
-    Bufpos new_point = marker_position (w->pointm[CURRENT_DISP]);
+    Charbpos new_point = marker_position (w->pointm[CURRENT_DISP]);
     if (new_point < BUF_BEGV (current_buffer))
       new_point = BUF_BEGV (current_buffer);
     else if (new_point > BUF_ZV (current_buffer))
@@ -4296,7 +4296,7 @@
     point = make_int (BUF_PT (b));
   else
     {
-      Bufpos pos = marker_position (w->pointm[CURRENT_DISP]);
+      Charbpos pos = marker_position (w->pointm[CURRENT_DISP]);
 
       if (pos < BUF_BEGV (b))
 	pos = BUF_BEGV (b);
@@ -4395,7 +4395,7 @@
       else
 	{
 	  int vtarget;
-	  Bufpos startp, old_start;
+	  Charbpos startp, old_start;
 
 	  if (WINDOW_TEXT_TOP_CLIP (w))
 	    {
@@ -4453,7 +4453,7 @@
       else
 	{
 	  int vtarget;
-	  Bufpos startp, old_start;
+	  Charbpos startp, old_start;
 
 	  if (WINDOW_TEXT_TOP_CLIP (w))
 	    {
@@ -4498,7 +4498,7 @@
 
 	      if (!point_would_be_visible (w, startp, XINT (point)))
 		{
-		  Bufpos new_point;
+		  Charbpos new_point;
 
 		  if (MINI_WINDOW_P (w))
 		    new_point = startp;
@@ -4531,9 +4531,9 @@
 	{
 	  int vtarget;
 	  int movement = next_screen_context_lines - 1;
-	  Bufpos old_startp = marker_position (w->start[CURRENT_DISP]);
-	  Bufpos bottom = vmotion (w, old_startp, movement, &vtarget);
-	  Bufpos startp =
+	  Charbpos old_startp = marker_position (w->start[CURRENT_DISP]);
+	  Charbpos bottom = vmotion (w, old_startp, movement, &vtarget);
+	  Charbpos startp =
 	    start_with_point_on_display_line (w, bottom,
 					      -1 - (movement - vtarget));
 
@@ -4548,7 +4548,7 @@
 
 	  if (!point_would_be_visible (w, startp, XINT (point)))
 	    {
-	      Bufpos new_point = start_of_last_line (w, startp);
+	      Charbpos new_point = start_of_last_line (w, startp);
 
 	      if (selected)
 		BUF_SET_PT (b, new_point);
@@ -4712,8 +4712,8 @@
 {
   struct window *w = decode_window (window);
   struct buffer *b = XBUFFER (w->buffer);
-  Bufpos opoint = BUF_PT (b);
-  Bufpos startp;
+  Charbpos opoint = BUF_PT (b);
+  Charbpos startp;
 
   if (NILP (n))
     startp = start_with_line_at_pixpos (w, opoint, window_half_pixpos (w));
@@ -4744,7 +4744,7 @@
   struct window *w;
   struct buffer *b;
   int height;
-  Bufpos start, new_point;
+  Charbpos start, new_point;
   int selected;
 
   /* Don't use decode_window() because we need the new value of
@@ -5129,14 +5129,14 @@
   return Qnil;
 }
 
-inline static Memory_Count
+inline static Bytecount
 sizeof_window_config_for_n_windows (int n)
 {
   return FLEXIBLE_ARRAY_STRUCT_SIZEOF (struct window_config,
 				       struct saved_window, saved_windows, n);
 }
 
-static Memory_Count
+static Bytecount
 sizeof_window_config (const void *h)
 {
   const struct window_config *c = (const struct window_config *) h;
@@ -6028,7 +6028,7 @@
   if (y<0 || x<0 || y >= Dynarr_length (dla) || !NILP (pos))
     {
       int first_line, i;
-      Bufpos point;
+      Charbpos point;
 
       if (NILP (pos))
 	pos = Fwindow_point (window);
@@ -6045,20 +6045,20 @@
 	{
 	  dl = Dynarr_atp (dla, i);
 	  /* find the vertical location first */
-	  if (point >= dl->bufpos && point <= dl->end_bufpos)
+	  if (point >= dl->charbpos && point <= dl->end_charbpos)
 	    {
 	      db = get_display_block_from_line (dl, TEXT);
 	      for (i = 0; i < Dynarr_length (db->runes); i++)
 		{
 		  rb = Dynarr_atp (db->runes, i);
-		  if (point <= rb->bufpos)
-		    goto found_bufpos;
+		  if (point <= rb->charbpos)
+		    goto found_charbpos;
 		}
 	      return Qnil;
 	    }
 	}
       return Qnil;
-    found_bufpos:
+    found_charbpos:
       ;
     }
   else
--- a/src/window.h	Tue Sep 18 05:06:57 2001 +0000
+++ b/src/window.h	Thu Sep 20 06:31:11 2001 +0000
@@ -137,7 +137,7 @@
 
   /* Set by redisplay to the last position seen.  This is used
      to implement the redisplay-end-trigger-functions. */
-  Bufpos last_redisplay_pos;
+  Charbpos last_redisplay_pos;
 
 #define WINDOW_SLOT_DECLARATION
 #define WINDOW_SLOT(slot) Lisp_Object slot;