(struct Lisp_Marker): Make insertion_type an unsigned int.
[bpt/emacs.git] / src / lisp.h
index 1b773b2..fc5473d 100644 (file)
@@ -1,5 +1,5 @@
 /* Fundamental definitions for GNU Emacs Lisp interpreter.
-   Copyright (C) 1985, 1986, 1987, 1993, 1994 Free Software Foundation, Inc.
+   Copyright (C) 1985,86,87,93,94,95 Free Software Foundation, Inc.
 
 This file is part of GNU Emacs.
 
@@ -26,16 +26,16 @@ the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA.  */
 #define EMACS_UINT unsigned int
 #endif
 
-/* Define the fundamental Lisp data structures */
+/* Define the fundamental Lisp data structures */
 
-/* This is the set of Lisp data types */
+/* This is the set of Lisp data types */
 
 enum Lisp_Type
   {
-    /* Integer.  XINT(obj) is the integer value. */
+    /* Integer.  XINT (obj) is the integer value.  */
     Lisp_Int,
 
-    /* Symbol.  XSYMBOL (object) points to a struct Lisp_Symbol. */
+    /* Symbol.  XSYMBOL (object) points to a struct Lisp_Symbol.  */
     Lisp_Symbol,
 
     /* Miscellaneous.  XMISC (object) points to a union Lisp_Misc,
@@ -43,60 +43,34 @@ enum Lisp_Type
     Lisp_Misc,
 
     /* String.  XSTRING (object) points to a struct Lisp_String.
-       The length of the string, and its contents, are stored therein. */
+       The length of the string, and its contents, are stored therein.  */
     Lisp_String,
 
     /* Vector of Lisp objects, or something resembling it.
-       XVECTOR(object) points to a struct Lisp_Vector, which contains
+       XVECTOR (object) points to a struct Lisp_Vector, which contains
        the size and contents.  The size field also contains the type
        information, if it's not a real vector object.  */
     Lisp_Vectorlike,
 
-    /* Cons.  XCONS (object) points to a struct Lisp_Cons. */
+    /* Cons.  XCONS (object) points to a struct Lisp_Cons.  */
     Lisp_Cons,
 
-    /* Byte-compiled function.  A vector of 4 to 6 elements which are the
-       arglist, bytecode-string, constant vector, stack size,
-       (optional) doc string, and (optional) interactive spec.  */
-    Lisp_Compiled,
-
-    /* Editor buffer.  XBUFFER(obj) points to a struct buffer.  */
-    Lisp_Buffer,
-
-    /* Built-in function.  XSUBR(obj) points to a struct Lisp_Subr
-       which describes how to call the function, and its documentation,
-       as well as pointing to the code. */
-    Lisp_Subr,
-
-    /* Object describing a connection to a subprocess.
-       It points to storage of type  struct Lisp_Process  */
-    Lisp_Process,
-
-#ifdef MULTI_FRAME
-    /* Pointer to a vector-like object describing a display frame
-       on which Emacs can display a window hierarchy.  We don't define
-       this unless MULTI_FRAME is defined; this helps the compiler catch
-       code that won't work on a non-MULTI_FRAME configuration.  */
-    Lisp_Frame,
-#endif
-
-    /* Window used for Emacs display.
-       Data inside looks like a Lisp_Vector.  */
-    Lisp_Window,
-
-    /* Used by save,set,restore-window-configuration */
-    OBSOLETE_Lisp_Window_Configuration,
-
 #ifdef LISP_FLOAT_TYPE
     Lisp_Float,
 #endif /* LISP_FLOAT_TYPE */
+
+    /* This is not a type code.  It is for range checking.  */
+    Lisp_Type_Limit
   };
 
 /* This is the set of datatypes that share a common structure.
-   The first member of the structure is a type code from this set.  */
+   The first member of the structure is a type code from this set.
+   The enum values are arbitrary, but we'll use large numbers to make it
+   more likely that we'll spot the error if a random word in memory is
+   mistakenly interpreted as a Lisp_Misc.  */
 enum Lisp_Misc_Type
   {
-    Lisp_Misc_Free,
+    Lisp_Misc_Free = 0x5eab,
     Lisp_Misc_Marker,
     Lisp_Misc_Intfwd,
     Lisp_Misc_Boolfwd,
@@ -104,9 +78,38 @@ enum Lisp_Misc_Type
     Lisp_Misc_Buffer_Objfwd,
     Lisp_Misc_Buffer_Local_Value,
     Lisp_Misc_Some_Buffer_Local_Value,
-    Lisp_Misc_Overlay
+    Lisp_Misc_Overlay,
+    Lisp_Misc_Kboard_Objfwd,
+    /* Currently floats are not a misc type,
+       but let's define this in case we want to change that.  */
+    Lisp_Misc_Float,
+    /* This is not a type code.  It is for range checking.  */
+    Lisp_Misc_Limit
   };
 
+/* These values are overridden by the m- file on some machines.  */
+#ifndef VALBITS
+#define VALBITS 28
+#endif
+
+#ifndef GCTYPEBITS
+#define GCTYPEBITS 3
+#endif
+
+/* Make these values available in GDB, which sees enums but not macros.  */
+
+enum gdb_lisp_params
+{
+  gdb_valbits = VALBITS,
+  gdb_gctypebits = GCTYPEBITS,
+  gdb_emacs_intbits = sizeof (EMACS_INT) * INTBITS / sizeof (int),
+#ifdef DATA_SEG_BITS
+  gdb_data_seg_bits = DATA_SEG_BITS
+#else
+  gdb_data_seg_bits = 0
+#endif
+};
+
 #ifndef NO_UNION_TYPE
 
 #ifndef WORDS_BIG_ENDIAN
@@ -117,23 +120,23 @@ typedef
 union Lisp_Object
   {
     /* Used for comparing two Lisp_Objects;
-       also, positive integers can be accessed fast this way. */
+       also, positive integers can be accessed fast this way.  */
     int i;
 
     struct
       {
-       int val: 24;
-       char type;
+       int val: VALBITS;
+       int type: GCTYPEBITS+1;
       } s;
     struct
       {
-       unsigned int val: 24;
-       char type;
+       unsigned int val: VALBITS;
+       int type: GCTYPEBITS+1;
       } u;
     struct
       {
-       unsigned int val: 24;
-       enum Lisp_Type type: 7;
+       unsigned int val: VALBITS;
+       enum Lisp_Type type: GCTYPEBITS;
        /* The markbit is not really part of the value of a Lisp_Object,
           and is always zero except during garbage collection.  */
        unsigned int markbit: 1;
@@ -147,26 +150,26 @@ typedef
 union Lisp_Object
   {
     /* Used for comparing two Lisp_Objects;
-       also, positive integers can be accessed fast this way. */
+       also, positive integers can be accessed fast this way.  */
     int i;
 
     struct
       {
-       char type;
-       int val: 24;
+       int type: GCTYPEBITS+1;
+       int val: VALBITS;
       } s;
     struct
       {
-       char type;
-       unsigned int val: 24;
+       int type: GCTYPEBITS+1;
+       unsigned int val: VALBITS;
       } u;
     struct
       {
        /* The markbit is not really part of the value of a Lisp_Object,
           and is always zero except during garbage collection.  */
        unsigned int markbit: 1;
-       enum Lisp_Type type: 7;
-       unsigned int val: 24;
+       enum Lisp_Type type: GCTYPEBITS;
+       unsigned int val: VALBITS;
       } gu;
   }
 Lisp_Object;
@@ -183,15 +186,6 @@ Lisp_Object;
 
 #define Lisp_Object EMACS_INT
 
-/* These values are overridden by the m- file on some machines.  */
-#ifndef VALBITS
-#define VALBITS 24
-#endif
-
-#ifndef GCTYPEBITS
-#define GCTYPEBITS 7
-#endif
-
 #ifndef VALMASK
 #define VALMASK ((((EMACS_INT) 1)<<VALBITS) - 1)
 #endif
@@ -210,7 +204,7 @@ Lisp_Object;
    rather than being part of a string block.  */
 
 #ifndef MARKBIT
-#define MARKBIT (1 << (VALBITS + GCTYPEBITS))
+#define MARKBIT ((int) ((unsigned int) 1 << (VALBITS + GCTYPEBITS)))
 #endif /*MARKBIT */
 
 /* In the size word of a vector, this bit means the vector has been marked.
@@ -226,28 +220,31 @@ Lisp_Object;
 #define PSEUDOVECTOR_FLAG ((ARRAY_MARK_FLAG >> 1) & ~ARRAY_MARK_FLAG)
 #endif
 
-/* In a pseudo-vector, the size field actually contains a word with one
+/* In a pseudovector, the size field actually contains a word with one
    PSEUDOVECTOR_FLAG bit set, and exactly one of the following bits to
    indicate the actual type.  */
-#define PVEC_BUFFER    0x100
-#define PVEC_PROCESS   0x200
-#define PVEC_FRAME     0x400
-#define PVEC_COMPILED  0x800
-#define PVEC_WINDOW    0x1000
-#define PVEC_WINDOW_CONFIGURATION      0x2000
+enum pvec_type
+{
+  PVEC_NORMAL_VECTOR = 0,
+  PVEC_BUFFER = 0x100,
+  PVEC_PROCESS = 0x200,
+  PVEC_FRAME = 0x400,
+  PVEC_COMPILED = 0x800,
+  PVEC_WINDOW = 0x1000,
+  PVEC_WINDOW_CONFIGURATION = 0x2000,
+  PVEC_SUBR = 0x4000,
+  PVEC_TYPE_MASK = 0x7f00,
+  PVEC_FLAG = PSEUDOVECTOR_FLAG
+};
 
 /* For convenience, we also store the number of elements in these bits.  */
 #define PSEUDOVECTOR_SIZE_MASK 0xff
 
-#if ARRAY_MARK_FLAG == MARKBIT || PSEUDOVECTOR_FLAG == ARRAY_MARK_FLAG || PSEUDOVECTOR_FLAG == MARKBIT
-you lose
-#endif
-
 #endif /* NO_UNION_TYPE */
 \f
 /* These macros extract various sorts of values from a Lisp_Object.
  For example, if tem is a Lisp_Object whose type is Lisp_Cons,
- XCONS (tem) is the struct Lisp_Cons * pointing to the memory for that cons. */
+ XCONS (tem) is the struct Lisp_Cons * pointing to the memory for that cons.  */
 
 #ifdef NO_UNION_TYPE
 
@@ -355,7 +352,7 @@ extern int pure_size;
 
 #ifdef EXPLICIT_SIGN_EXTEND
 /* Make sure we sign-extend; compilers have been known to fail to do so.  */
-#define XINT(a) (((a).i << 8) >> 8)
+#define XINT(a) (((a).i << (INTBITS-VALBITS)) >> (INTBITS-VALBITS))
 #else
 #define XINT(a) ((a).s.val)
 #endif /* EXPLICIT_SIGN_EXTEND */
@@ -380,17 +377,17 @@ extern int pure_size;
 
 #endif /* NO_UNION_TYPE */
 
+/* Extract a value or address from a Lisp_Object.  */
 
 #define XCONS(a) ((struct Lisp_Cons *) XPNTR(a))
-#define XBUFFER(a) ((struct buffer *) XPNTR(a))
 #define XVECTOR(a) ((struct Lisp_Vector *) XPNTR(a))
-#define XSUBR(a) ((struct Lisp_Subr *) XPNTR(a))
 #define XSTRING(a) ((struct Lisp_String *) XPNTR(a))
 #define XSYMBOL(a) ((struct Lisp_Symbol *) XPNTR(a))
-#define XMISC(a)   ((union Lisp_Misc *) XPNTR(a))
-#define XWINDOW(a) ((struct window *) XPNTR(a))
-#define XPROCESS(a) ((struct Lisp_Process *) XPNTR(a))
 #define XFLOAT(a) ((struct Lisp_Float *) XPNTR(a))
+
+/* Misc types.  */
+#define XMISC(a)   ((union Lisp_Misc *) XPNTR(a))
+#define XMISCTYPE(a)   (XMARKER (a)->type)
 #define XMARKER(a) (&(XMISC(a)->u_marker))
 #define XINTFWD(a) (&(XMISC(a)->u_intfwd))
 #define XBOOLFWD(a) (&(XMISC(a)->u_boolfwd))
@@ -398,34 +395,50 @@ extern int pure_size;
 #define XBUFFER_OBJFWD(a) (&(XMISC(a)->u_buffer_objfwd))
 #define XBUFFER_LOCAL_VALUE(a) (&(XMISC(a)->u_buffer_local_value))
 #define XOVERLAY(a) (&(XMISC(a)->u_overlay))
+#define XKBOARD_OBJFWD(a) (&(XMISC(a)->u_kboard_objfwd))
+
+/* Pseudovector types.  */
+#define XPROCESS(a) ((struct Lisp_Process *) XPNTR(a))
+#define XWINDOW(a) ((struct window *) XPNTR(a))
+#define XSUBR(a) ((struct Lisp_Subr *) XPNTR(a))
+#define XBUFFER(a) ((struct buffer *) XPNTR(a))
+
+
+/* Construct a Lisp_Object from a value or address.  */
 
 #define XSETINT(a, b) XSET (a, Lisp_Int, b)
 #define XSETCONS(a, b) XSET (a, Lisp_Cons, b)
-#define XSETBUFFER(a, b) XSET (a, Lisp_Buffer, b)
 #define XSETVECTOR(a, b) XSET (a, Lisp_Vectorlike, b)
-#define XSETSUBR(a, b) XSET (a, Lisp_Subr, b)
 #define XSETSTRING(a, b) XSET (a, Lisp_String, b)
 #define XSETSYMBOL(a, b) XSET (a, Lisp_Symbol, b)
-#define XSETMISC(a, b) XSET (a, Lisp_Misc, b)
-#define XSETWINDOW(a, b) XSET (a, Lisp_Window, b)
-#define XSETPROCESS(a, b) XSET (a, Lisp_Process, b)
 #define XSETFLOAT(a, b) XSET (a, Lisp_Float, b)
-#define XSETPSEUDOVECTOR(a, b, code) (XSETVECTOR (a, b), XVECTOR (a)->size |= PSEUDOVECTOR_FLAG | (code))
-#define XSETWINDOW_CONFIGURATION(a, b) (XSETPSEUDOVECTOR (a, b, PVEC_WINDOW_CONFIGURATION))
-#define XSETCOMPILED(a, b) XSET (a, Lisp_Compiled, b)
-#define XSETMARKER(a, b) (XSETMISC (a, b), XMISC (a)->type = Lisp_Misc_Marker)
+
+/* Misc types.  */
+#define XSETMISC(a, b) XSET (a, Lisp_Misc, b)
+#define XSETMARKER(a, b) (XSETMISC (a, b), XMISCTYPE (a) = Lisp_Misc_Marker)
+
+/* Pseudovector types.  */
+#define XSETPSEUDOVECTOR(a, b, code) \
+  (XSETVECTOR (a, b), XVECTOR (a)->size |= PSEUDOVECTOR_FLAG | (code))
+#define XSETWINDOW_CONFIGURATION(a, b) \
+  (XSETPSEUDOVECTOR (a, b, PVEC_WINDOW_CONFIGURATION))
+#define XSETPROCESS(a, b) (XSETPSEUDOVECTOR (a, b, PVEC_PROCESS))
+#define XSETWINDOW(a, b) (XSETPSEUDOVECTOR (a, b, PVEC_WINDOW))
+#define XSETSUBR(a, b) (XSETPSEUDOVECTOR (a, b, PVEC_SUBR))
+#define XSETCOMPILED(a, b) (XSETPSEUDOVECTOR (a, b, PVEC_COMPILED))
+#define XSETBUFFER(a, b) (XSETPSEUDOVECTOR (a, b, PVEC_BUFFER))
 \f
 #ifdef USE_TEXT_PROPERTIES
-/* Basic data type for use of intervals.  See the macros in intervals.h */
+/* Basic data type for use of intervals.  See the macros in intervals.h */
 
 struct interval
 {
-  /* The first group of entries deal with the tree structure. */
+  /* The first group of entries deal with the tree structure.  */
 
-  unsigned int total_length;   /* Length of myself and both children. */
-  unsigned int position;       /* Cache of interval's character position  */
-  struct interval *left;       /* Intervals which precede me. */
-  struct interval *right;      /* Intervals which succeed me. */
+  unsigned int total_length;   /* Length of myself and both children.  */
+  unsigned int position;       /* Cache of interval's character position.  */
+  struct interval *left;       /* Intervals which precede me.  */
+  struct interval *right;      /* Intervals which succeed me.  */
 
   /* Parent in the tree, or the Lisp_Object containing this interval tree.
 
@@ -441,13 +454,13 @@ struct interval
 
   /* The remaining components are `properties' of the interval.
      The first four are duplicates for things which can be on the list,
-     for purposes of speed. */
+     for purposes of speed.  */
 
   unsigned char write_protect;     /* Non-zero means can't modify.  */
-  unsigned char visible;           /* Zero means don't display. */
+  unsigned char visible;           /* Zero means don't display.  */
   unsigned char front_sticky;      /* Non-zero means text inserted just
-                                      before this interval goes into it. */
-  unsigned char rear_sticky;       /* Likewise for just after it. */
+                                      before this interval goes into it.  */
+  unsigned char rear_sticky;       /* Likewise for just after it.  */
 
   /* Properties of this interval.
      The mark bit on this field says whether this particular interval
@@ -464,16 +477,16 @@ typedef struct interval *INTERVAL;
       x = wrong_type_argument (Qbuffer_or_string_p, (x)); }
 
 /* Macro used to conditionally compile intervals into certain data
-   structures.  See, e.g., struct Lisp_String below. */
+   structures.  See, e.g., struct Lisp_String below.  */
 #define DECLARE_INTERVALS INTERVAL intervals;
 
 /* Macro used to conditionally compile interval initialization into
-   certain code.  See, e.g., alloc.c. */
+   certain code.  See, e.g., alloc.c.  */
 #define INITIALIZE_INTERVAL(ptr,val) ptr->intervals = val
 
 #else  /* No text properties */
 
-/* If no intervals are used, make the above definitions go away. */
+/* If no intervals are used, make the above definitions go away.  */
 
 #define CHECK_STRING_OR_BUFFER(x, i)
 
@@ -505,7 +518,7 @@ struct Lisp_Buffer_Cons
 struct Lisp_String
   {
     EMACS_INT size;
-    DECLARE_INTERVALS          /* `data' field must be last. */
+    DECLARE_INTERVALS          /* `data' field must be last.  */
     unsigned char data[1];
   };
 
@@ -533,8 +546,17 @@ struct Lisp_Symbol
     struct Lisp_Symbol *next;  /* -> next symbol in this obarray bucket */
   };
 
+/* This structure describes a built-in function.
+   It is generated by the DEFUN macro only.
+   defsubr makes it into a Lisp object.
+
+   This type is treated in most respects as a pseudovector,
+   but since we never dynamically allocate or free them,
+   we don't need a next-vector field.  */
+   
 struct Lisp_Subr
   {
+    EMACS_INT size;
     Lisp_Object (*function) ();
     short min_args, max_args;
     char *symbol_name;
@@ -542,21 +564,28 @@ struct Lisp_Subr
     char *doc;
   };
 \f
+/* These structures are used for various misc types.  */
+
 /* A miscellaneous object, when it's on the free list.  */
 struct Lisp_Free
   {
-    enum Lisp_Misc_Type type;  /* = Lisp_Misc_Free */
+    int type : 16;     /* = Lisp_Misc_Free */
+    int spacer : 16;
     union Lisp_Misc *chain;
   };
 
 /* In a marker, the markbit of the chain field is used as the gc mark bit */
 struct Lisp_Marker
-  {
-    enum Lisp_Misc_Type type;  /* = Lisp_Misc_Marker */
-    struct buffer *buffer;
-    Lisp_Object chain;
-    int bufpos;
-  };
+{
+  int type : 16;               /* = Lisp_Misc_Marker */
+  int spacer : 15;
+  /* 1 means normal insertion at the marker's position
+     leaves the marker after the inserted text.  */
+  unsigned int insertion_type : 1;
+  struct buffer *buffer;
+  Lisp_Object chain;
+  int bufpos;
+};
 
 /* Forwarding pointer to an int variable.
    This is allowed only in the value cell of a symbol,
@@ -564,7 +593,8 @@ struct Lisp_Marker
    specified int variable.  */
 struct Lisp_Intfwd
   {
-    enum Lisp_Misc_Type type;  /* = Lisp_Misc_Intfwd */
+    int type : 16;     /* = Lisp_Misc_Intfwd */
+    int spacer : 16;
     int *intvar;
   };
 
@@ -574,7 +604,8 @@ struct Lisp_Intfwd
    nil if it is zero.  */
 struct Lisp_Boolfwd
   {
-    enum Lisp_Misc_Type type;  /* = Lisp_Misc_Boolfwd */
+    int type : 16;     /* = Lisp_Misc_Boolfwd */
+    int spacer : 16;
     int *boolvar;
   };
 
@@ -584,7 +615,8 @@ struct Lisp_Boolfwd
    specified variable.  */
 struct Lisp_Objfwd
   {
-    enum Lisp_Misc_Type type;  /* = Lisp_Misc_Objfwd */
+    int type : 16;     /* = Lisp_Misc_Objfwd */
+    int spacer : 16;
     Lisp_Object *objvar;
   };
 
@@ -592,7 +624,8 @@ struct Lisp_Objfwd
    current buffer.  Value is byte index of slot within buffer.  */
 struct Lisp_Buffer_Objfwd
   {
-    enum Lisp_Misc_Type type;  /* = Lisp_Misc_Buffer_Objfwd */
+    int type : 16;     /* = Lisp_Misc_Buffer_Objfwd */
+    int spacer : 16;
     int offset;
   };
 
@@ -615,7 +648,7 @@ struct Lisp_Buffer_Objfwd
    variable).
 
    If we want to examine or set the value and BUFFER is current,
-   we just examine or set REALVALUE. If BUFFER is not current, we
+   we just examine or set REALVALUE.  If BUFFER is not current, we
    store the current REALVALUE value into CURRENT-ALIST-ELEMENT,
    then find the appropriate alist element for the buffer now
    current and set up CURRENT-ALIST-ELEMENT.  Then we set
@@ -638,8 +671,9 @@ struct Lisp_Buffer_Objfwd
    Only make-local-variable does that.  */
 struct Lisp_Buffer_Local_Value
   {
-    enum Lisp_Misc_Type type;  /* = Lisp_Misc_Buffer_Local_Value
-                                  or Lisp_Misc_Some_Buffer_Local_Value */
+    int type : 16; /* = Lisp_Misc_Buffer_Local_Value
+                                     or Lisp_Misc_Some_Buffer_Local_Value */
+    int spacer : 16;
     Lisp_Object car, cdr;
   };
 
@@ -648,12 +682,26 @@ struct Lisp_Buffer_Local_Value
    PLIST is the overlay's property list.  */
 struct Lisp_Overlay
   {
-    enum Lisp_Misc_Type type;  /* = Lisp_Misc_Overlay */
+    int type : 16;     /* = Lisp_Misc_Overlay */
+    int spacer : 16;
     Lisp_Object start, end, plist;
   };
+
+/* Like Lisp_Objfwd except that value lives in a slot in the
+   current kboard.  */
+struct Lisp_Kboard_Objfwd
+  {
+    int type : 16;     /* = Lisp_Misc_Kboard_Objfwd */
+    int spacer : 16;
+    int offset;
+  };
+
+
+/* To get the type field of a union Lisp_Misc, use XMISCTYPE.
+   It uses one of these struct subtypes to get the type field.  */
+
 union Lisp_Misc
   {
-    enum Lisp_Misc_Type type;
     struct Lisp_Free u_free;
     struct Lisp_Marker u_marker;
     struct Lisp_Intfwd u_intfwd;
@@ -662,8 +710,9 @@ union Lisp_Misc
     struct Lisp_Buffer_Objfwd u_buffer_objfwd;
     struct Lisp_Buffer_Local_Value u_buffer_local_value;
     struct Lisp_Overlay u_overlay;
+    struct Lisp_Kboard_Objfwd u_kboard_objfwd;
   };
-
+\f
 #ifdef LISP_FLOAT_TYPE
 /* Optional Lisp floating point type */
 struct Lisp_Float
@@ -675,7 +724,7 @@ struct Lisp_Float
 #endif /* LISP_FLOAT_TYPE */
 
 /* A character, declared with the following typedef, is a member
-   of some character set associated with the current buffer. */
+   of some character set associated with the current buffer.  */
 #ifndef _UCHAR_T  /* Protect against something in ctab.h on AIX.  */
 #define _UCHAR_T
 typedef unsigned char UCHAR;
@@ -692,14 +741,14 @@ typedef unsigned char UCHAR;
 
 /* Flag bits in a character.  These also get used in termhooks.h.
    Richard Stallman <rms@gnu.ai.mit.edu> thinks that MULE
-   (MUlti-Lingual Emacs) might need 18 bits for the character value
-   itself, so we probably shouldn't use any bits lower than 0x040000.  */
-#define CHAR_ALT   (0x040000)
-#define CHAR_SUPER (0x080000)
-#define CHAR_HYPER (0x100000)
-#define CHAR_SHIFT (0x200000)
-#define CHAR_CTL   (0x400000)
-#define CHAR_META  (0x800000)
+   (MUlti-Lingual Emacs) might need 22 bits for the character value
+   itself, so we probably shouldn't use any bits lower than 0x0400000.  */
+#define CHAR_ALT   (0x0400000)
+#define CHAR_SUPER (0x0800000)
+#define CHAR_HYPER (0x1000000)
+#define CHAR_SHIFT (0x2000000)
+#define CHAR_CTL   (0x4000000)
+#define CHAR_META  (0x8000000)
 
 #ifdef USE_X_TOOLKIT
 #ifdef NO_UNION_TYPE
@@ -794,31 +843,7 @@ typedef unsigned char UCHAR;
 #define GC_STRINGP(x) (XGCTYPE ((x)) == Lisp_String)
 #define CONSP(x) (XTYPE ((x)) == Lisp_Cons)
 #define GC_CONSP(x) (XGCTYPE ((x)) == Lisp_Cons)
-#define COMPILEDP(x) (XTYPE ((x)) == Lisp_Compiled)
-#define GC_COMPILEDP(x) (XGCTYPE ((x)) == Lisp_Compiled)
-#define BUFFERP(x) (XTYPE ((x)) == Lisp_Buffer)
-#define GC_BUFFERP(x) (XGCTYPE ((x)) == Lisp_Buffer)
-#define SUBRP(x) (XTYPE ((x)) == Lisp_Subr)
-#define GC_SUBRP(x) (XGCTYPE ((x)) == Lisp_Subr)
-#define PROCESSP(x) (XTYPE ((x)) == Lisp_Process)
-#define GC_PROCESSP(x) (XGCTYPE ((x)) == Lisp_Process)
-#ifdef MULTI_FRAME
-#define FRAMEP(x) (XTYPE ((x)) == Lisp_Frame)
-#define GC_FRAMEP(x) (XGCTYPE ((x)) == Lisp_Frame)
-#else
-#ifdef HAVE_MOUSE
-/* We could use this in the !HAVE_MOUSE case also, but we prefer a compile-time
-   error message in case FRAMEP is used.  */
-#define FRAMEP(x) (EQ (x, Fselected_frame ()))
-#define GC_FRAMEP(x) (GC_EQ (x, Fselected_frame ()))
-#endif
-#endif
-#define WINDOWP(x) (XTYPE ((x)) == Lisp_Window)
-#define GC_WINDOWP(x) (XGCTYPE ((x)) == Lisp_Window)
-#define PSEUDOVECTORP(x, code) (VECTORLIKEP (x) && ((XVECTOR (x)->size & (PSEUDOVECTOR_FLAG | (code)))) == PSEUDOVECTOR_FLAG | (code))
-#define GC_PSEUDOVECTORP(x, code) (GC_VECTORLIKEP (x) && ((XVECTOR (x)->size & (PSEUDOVECTOR_FLAG | (code)))) == PSEUDOVECTOR_FLAG | (code))
-#define WINDOW_CONFIGURATIONP(x) PSEUDOVECTORP (x, PVEC_WINDOW_CONFIGURATION)
-#define GC_WINDOW_CONFIGURATIONP(x) GC_PSEUDOVECTORP (x, PVEC_WINDOW_CONFIGURATION)
+
 #ifdef LISP_FLOAT_TYPE
 #define FLOATP(x) (XTYPE ((x)) == Lisp_Float)
 #define GC_FLOATP(x) (XGCTYPE ((x)) == Lisp_Float)
@@ -828,23 +853,66 @@ typedef unsigned char UCHAR;
 #endif
 #define VECTORP(x) (VECTORLIKEP (x) && !(XVECTOR (x)->size & PSEUDOVECTOR_FLAG))
 #define GC_VECTORP(x) (GC_VECTORLIKEP (x) && !(XVECTOR (x)->size & PSEUDOVECTOR_FLAG))
-#define OVERLAYP(x) (MISCP (x) && XMISC (x)->type == Lisp_Misc_Overlay)
-#define GC_OVERLAYP(x) (GC_MISCP (x) && XMISC (x)->type == Lisp_Misc_Overlay)
-#define MARKERP(x) (MISCP (x) && XMISC (x)->type == Lisp_Misc_Marker)
-#define GC_MARKERP(x) (GC_MISCP (x) && XMISC (x)->type == Lisp_Misc_Marker)
-#define INTFWDP(x) (MISCP (x) && XMISC (x)->type == Lisp_Misc_Intfwd)
-#define GC_INTFWDP(x) (GC_MISCP (x) && XMISC (x)->type == Lisp_Misc_Intfwd)
-#define BOOLFWDP(x) (MISCP (x) && XMISC (x)->type == Lisp_Misc_Boolfwd)
-#define GC_BOOLFWDP(x) (GC_MISCP (x) && XMISC (x)->type == Lisp_Misc_Boolfwd)
-#define OBJFWDP(x) (MISCP (x) && XMISC (x)->type == Lisp_Misc_Objfwd)
-#define GC_OBJFWDP(x) (GC_MISCP (x) && XMISC (x)->type == Lisp_Misc_Objfwd)
-#define BUFFER_OBJFWDP(x) (MISCP (x) && XMISC (x)->type == Lisp_Misc_Buffer_Objfwd)
-#define GC_BUFFER_OBJFWDP(x) (GC_MISCP (x) && XMISC (x)->type == Lisp_Misc_Buffer_Objfwd)
-#define BUFFER_LOCAL_VALUEP(x) (MISCP (x) && XMISC (x)->type == Lisp_Misc_Buffer_Local_Value)
-#define GC_BUFFER_LOCAL_VALUEP(x) (GC_MISCP (x) && XMISC (x)->type == Lisp_Misc_Buffer_Local_Value)
-#define SOME_BUFFER_LOCAL_VALUEP(x) (MISCP (x) && XMISC (x)->type == Lisp_Misc_Some_Buffer_Local_Value)
-#define GC_SOME_BUFFER_LOCAL_VALUEP(x) (GC_MISCP (x) && XMISC (x)->type == Lisp_Misc_Some_Buffer_Local_Value)
+#define OVERLAYP(x) (MISCP (x) && XMISCTYPE (x) == Lisp_Misc_Overlay)
+#define GC_OVERLAYP(x) (GC_MISCP (x) && XMISCTYPE (x) == Lisp_Misc_Overlay)
+#define MARKERP(x) (MISCP (x) && XMISCTYPE (x) == Lisp_Misc_Marker)
+#define GC_MARKERP(x) (GC_MISCP (x) && XMISCTYPE (x) == Lisp_Misc_Marker)
+#define INTFWDP(x) (MISCP (x) && XMISCTYPE (x) == Lisp_Misc_Intfwd)
+#define GC_INTFWDP(x) (GC_MISCP (x) && XMISCTYPE (x) == Lisp_Misc_Intfwd)
+#define BOOLFWDP(x) (MISCP (x) && XMISCTYPE (x) == Lisp_Misc_Boolfwd)
+#define GC_BOOLFWDP(x) (GC_MISCP (x) && XMISCTYPE (x) == Lisp_Misc_Boolfwd)
+#define OBJFWDP(x) (MISCP (x) && XMISCTYPE (x) == Lisp_Misc_Objfwd)
+#define GC_OBJFWDP(x) (GC_MISCP (x) && XMISCTYPE (x) == Lisp_Misc_Objfwd)
+#define BUFFER_OBJFWDP(x) (MISCP (x) && XMISCTYPE (x) == Lisp_Misc_Buffer_Objfwd)
+#define GC_BUFFER_OBJFWDP(x) (GC_MISCP (x) && XMISCTYPE (x) == Lisp_Misc_Buffer_Objfwd)
+#define BUFFER_LOCAL_VALUEP(x) (MISCP (x) && XMISCTYPE (x) == Lisp_Misc_Buffer_Local_Value)
+#define GC_BUFFER_LOCAL_VALUEP(x) (GC_MISCP (x) && XMISCTYPE (x) == Lisp_Misc_Buffer_Local_Value)
+#define SOME_BUFFER_LOCAL_VALUEP(x) (MISCP (x) && XMISCTYPE (x) == Lisp_Misc_Some_Buffer_Local_Value)
+#define GC_SOME_BUFFER_LOCAL_VALUEP(x) (GC_MISCP (x) && XMISCTYPE (x) == Lisp_Misc_Some_Buffer_Local_Value)
+#define KBOARD_OBJFWDP(x) (MISCP (x) && XMISCTYPE (x) == Lisp_Misc_Kboard_Objfwd)
+#define GC_KBOARD_OBJFWDP(x) (GC_MISCP (x) && XMISCTYPE (x) == Lisp_Misc_Kboard_Objfwd)
+
+
+/* True if object X is a pseudovector whose code is CODE.  */
+#define PSEUDOVECTORP(x, code)                                 \
+  (VECTORLIKEP (x)                                             \
+   && (((XVECTOR (x)->size & (PSEUDOVECTOR_FLAG | (code))))    \
+       == (PSEUDOVECTOR_FLAG | (code))))
+
+/* True if object X is a pseudovector whose code is CODE.
+   This one works during GC.  */
+#define GC_PSEUDOVECTORP(x, code)                              \
+  (GC_VECTORLIKEP (x)                                          \
+   && (((XVECTOR (x)->size & (PSEUDOVECTOR_FLAG | (code))))    \
+       == (PSEUDOVECTOR_FLAG | (code))))
+
+/* Test for specific pseudovector types.  */
+#define WINDOW_CONFIGURATIONP(x) PSEUDOVECTORP (x, PVEC_WINDOW_CONFIGURATION)
+#define GC_WINDOW_CONFIGURATIONP(x) GC_PSEUDOVECTORP (x, PVEC_WINDOW_CONFIGURATION)
+#define PROCESSP(x) PSEUDOVECTORP (x, PVEC_PROCESS)
+#define GC_PROCESSP(x) GC_PSEUDOVECTORP (x, PVEC_PROCESS)
+#define WINDOWP(x) PSEUDOVECTORP (x, PVEC_WINDOW)
+#define GC_WINDOWP(x) GC_PSEUDOVECTORP (x, PVEC_WINDOW)
+#define SUBRP(x) PSEUDOVECTORP (x, PVEC_SUBR)
+#define GC_SUBRP(x) GC_PSEUDOVECTORP (x, PVEC_SUBR)
+#define COMPILEDP(x) PSEUDOVECTORP (x, PVEC_COMPILED)
+#define GC_COMPILEDP(x) GC_PSEUDOVECTORP (x, PVEC_COMPILED)
+#define BUFFERP(x) PSEUDOVECTORP (x, PVEC_BUFFER)
+#define GC_BUFFERP(x) GC_PSEUDOVECTORP (x, PVEC_BUFFER)
+
+#ifdef MULTI_FRAME
+#define FRAMEP(x) PSEUDOVECTORP (x, PVEC_FRAME)
+#define GC_FRAMEP(x) GC_PSEUDOVECTORP (x, PVEC_FRAME)
+#else
+#ifdef HAVE_MOUSE
+/* We could use this in the !HAVE_MOUSE case also, but we prefer a compile-time
+   error message in case FRAMEP is used.  */
+#define FRAMEP(x) (EQ (x, Fselected_frame ()))
+#define GC_FRAMEP(x) (GC_EQ (x, Fselected_frame ()))
+#endif
+#endif
 
+\f
 #define EQ(x, y) (XFASTINT (x) == XFASTINT (y))
 #define GC_EQ(x, y) (XGCTYPE (x) == XGCTYPE (y) && XPNTR (x) == XPNTR (y))
 
@@ -960,22 +1028,26 @@ typedef unsigned char UCHAR;
  `doc' is documentation for the user.  */
 
 #if !defined (__STDC__) || defined (USE_NONANSI_DEFUN)
-#define DEFUN(lname, fnname, sname, minargs, maxargs, prompt, doc) \
-  Lisp_Object fnname (); \
-  struct Lisp_Subr sname = {fnname, minargs, maxargs, lname, prompt, 0}; \
+#define DEFUN(lname, fnname, sname, minargs, maxargs, prompt, doc)     \
+  Lisp_Object fnname ();                                               \
+  struct Lisp_Subr sname =                                             \
+    { PVEC_SUBR | (sizeof (struct Lisp_Subr) / sizeof (EMACS_INT)),    \
+      fnname, minargs, maxargs, lname, prompt, 0};                     \
   Lisp_Object fnname
 
 #else
 
 /* This version of DEFUN declares a function prototype with the right
-   arguments, so we can catch errors with maxargs at compile-time. */
-#define DEFUN(lname, fnname, sname, minargs, maxargs, prompt, doc) \
-  Lisp_Object fnname DEFUN_ARGS_ ## maxargs ; \
-  struct Lisp_Subr sname = {fnname, minargs, maxargs, lname, prompt, 0}; \
+   arguments, so we can catch errors with maxargs at compile-time.  */
+#define DEFUN(lname, fnname, sname, minargs, maxargs, prompt, doc)     \
+  Lisp_Object fnname DEFUN_ARGS_ ## maxargs ;                          \
+  struct Lisp_Subr sname =                                             \
+    { PVEC_SUBR | (sizeof (struct Lisp_Subr) / sizeof (EMACS_INT)),    \
+      fnname, minargs, maxargs, lname, prompt, 0};                     \
   Lisp_Object fnname
 
 /* Note that the weird token-substitution semantics of ANSI C makes
-   this work for MANY and UNEVALLED. */
+   this work for MANY and UNEVALLED.  */
 #define DEFUN_ARGS_MANY                (int, Lisp_Object *)
 #define DEFUN_ARGS_UNEVALLED   (Lisp_Object)
 #define DEFUN_ARGS_0   (void)
@@ -992,7 +1064,7 @@ typedef unsigned char UCHAR;
 #endif
 
 /* defsubr (Sname);
- is how we define the symbol for function `name' at start-up time. */
+ is how we define the symbol for function `name' at start-up time.  */
 extern void defsubr ();
 
 #define MANY -2
@@ -1001,6 +1073,7 @@ extern void defsubr ();
 extern void defvar_lisp ();
 extern void defvar_bool ();
 extern void defvar_int ();
+extern void defvar_kboard ();
 
 /* Macros we use to define forwarded Lisp variables.
    These are used in the syms_of_FILENAME functions.  */
@@ -1011,6 +1084,10 @@ extern void defvar_int ();
 #define DEFVAR_INT(lname, vname, doc) defvar_int (lname, vname)
 #define DEFVAR_PER_BUFFER(lname, vname, type, doc)  \
  defvar_per_buffer (lname, vname, type, 0)
+#define DEFVAR_KBOARD(lname, vname, doc) \
+ defvar_kboard (lname, \
+               (int)((char *)(&current_kboard->vname) \
+                     - (char *)current_kboard))
 \f
 /* Structure for recording Lisp call stack for backtrace purposes.  */
 
@@ -1065,7 +1142,7 @@ extern Lisp_Object memory_signal_data;
    Tells GC how to save a copy of the stack.  */
 extern char *stack_bottom;
 
-/* Check quit-flag and quit if it is non-nil. */
+/* Check quit-flag and quit if it is non-nil.  */
 
 #define QUIT \
   if (!NILP (Vquit_flag) && NILP (Vinhibit_quit)) \
@@ -1100,7 +1177,7 @@ extern char *stack_bottom;
 
 #define UPCASE1(CH) (XSTRING (current_buffer->upcase_table)->data[CH])
 
-/* Downcase a character, or make no change if that cannot be done. */
+/* Downcase a character, or make no change if that cannot be done.  */
 
 #define DOWNCASE(CH) (XSTRING (current_buffer->downcase_table)->data[CH])
 
@@ -1115,15 +1192,15 @@ extern char *stack_bottom;
 extern Lisp_Object Vascii_downcase_table, Vascii_upcase_table;
 extern Lisp_Object Vascii_canon_table, Vascii_eqv_table;
 \f
-/* number of bytes of structure consed since last GC */
+/* Number of bytes of structure consed since last GC.  */
 
 extern int consing_since_gc;
 
-/* threshold for doing another gc */
+/* Threshold for doing another gc.  */
 
 extern int gc_cons_threshold;
 
-/* Structure for recording stack slots that need marking */
+/* Structure for recording stack slots that need marking */
 
 /* This is a chain of structures, each of which points at a Lisp_Object variable
  whose value should be marked in garbage collection.
@@ -1134,7 +1211,7 @@ extern int gc_cons_threshold;
  link disappears.
 
  Every function that can call Feval must protect in this fashion all
- Lisp_Object variables whose contents will be used again. */
+ Lisp_Object variables whose contents will be used again.  */
 
 extern struct gcpro *gcprolist;
 
@@ -1175,7 +1252,7 @@ struct gcpro
   gcpro5.next = &gcpro4; gcpro5.var = &varname5; gcpro5.nvars = 1; \
   gcprolist = &gcpro5; }
 
-/* Call staticpro (&var) to protect static variable `var'. */
+/* Call staticpro (&var) to protect static variable `var'.  */
 
 void staticpro();
   
@@ -1258,6 +1335,8 @@ extern unsigned long cons_to_long ();
 extern void args_out_of_range ();
 extern void args_out_of_range_3 ();
 extern Lisp_Object wrong_type_argument ();
+extern void store_symval_forwarding ();
+extern Lisp_Object do_symval_forwarding ();
 #ifdef LISP_FLOAT_TYPE
 extern Lisp_Object Ffloat_to_int(), Fint_to_float();
 extern double extract_float();
@@ -1265,15 +1344,21 @@ extern Lisp_Object make_float ();
 extern Lisp_Object Ffloat ();
 #endif /* LISP_FLOAT_TYPE */
 
+/* Defined in cmds.c */
+extern Lisp_Object Fend_of_line (), Fforward_char (), Fforward_line ();
+
+/* Defined in syntax.c */
+extern Lisp_Object Fforward_word ();
+
 /* Defined in fns.c */
 extern Lisp_Object Qstring_lessp;
 extern Lisp_Object Vfeatures;
 extern Lisp_Object Fidentity (), Frandom ();
-extern Lisp_Object Flength ();
+extern Lisp_Object Flength (), Fsafe_length ();
 extern Lisp_Object Fappend (), Fconcat (), Fvconcat (), Fcopy_sequence ();
 extern Lisp_Object Fsubstring ();
 extern Lisp_Object Fnth (), Fnthcdr (), Fmemq (), Fassq (), Fassoc ();
-extern Lisp_Object Fmember (), Frassq (), Fdelq (), Fsort ();
+extern Lisp_Object Felt (), Fmember (), Frassq (), Fdelq (), Fsort ();
 extern Lisp_Object Freverse (), Fnreverse (), Fget (), Fput (), Fequal ();
 extern Lisp_Object Ffillarray (), Fnconc (), Fmapcar (), Fmapconcat ();
 extern Lisp_Object Fy_or_n_p (), do_yes_or_no_p ();
@@ -1281,6 +1366,38 @@ extern Lisp_Object Ffeaturep (), Frequire () , Fprovide ();
 extern Lisp_Object concat2 (), nconc2 ();
 extern Lisp_Object assq_no_quit ();
 extern Lisp_Object Fcopy_alist ();
+extern Lisp_Object Fplist_get ();
+
+/* Defined in insdel.c */
+extern void move_gap ();
+extern void make_gap ();
+extern void insert ();
+extern void insert_and_inherit ();
+extern void insert_1 ();
+extern void insert_from_string ();
+extern void insert_from_buffer ();
+extern void insert_char ();
+extern void insert_string ();
+extern void insert_before_markers ();
+extern void insert_before_markers_and_inherit ();
+extern void insert_from_string_before_markers ();
+extern void del_range ();
+extern void del_range_1 ();
+extern void modify_region ();
+extern void prepare_to_modify_buffer ();
+extern void signal_before_change ();
+extern void signal_after_change ();
+
+/* Defined in xdisp.c */
+extern Lisp_Object Vmessage_log_max;
+extern void message ();
+extern void message_nolog ();
+extern void message1 ();
+extern void message1_nolog ();
+extern void message2 ();
+extern void message2_nolog ();
+extern void message_dolog ();
+extern void message_log_maybe_newline ();
 
 /* Defined in alloc.c */
 extern Lisp_Object Vpurify_flag;
@@ -1325,10 +1442,17 @@ extern Lisp_Object Vinhibit_quit, Qinhibit_quit, Vquit_flag;
 extern Lisp_Object Vmocklisp_arguments, Qmocklisp, Qmocklisp_arguments;
 extern Lisp_Object Vautoload_queue;
 extern Lisp_Object Vdebug_on_error;
-/* To run a normal hook, do
+/* To run a normal hook, use the appropriate function from the list below.
+   The calling convention:
+
    if (!NILP (Vrun_hooks))
-     call1 (Vrun_hooks, Qmy_funny_hook);  */
+     call1 (Vrun_hooks, Qmy_funny_hook);
+
+   should no longer be used.  */
 extern Lisp_Object Vrun_hooks;
+extern Lisp_Object Frun_hooks (), Frun_hook_with_args ();
+extern Lisp_Object Frun_hook_with_args_until_success ();
+extern Lisp_Object Frun_hook_with_args_until_failure ();
 extern Lisp_Object Fand (), For (), Fif (), Fprogn (), Fprog1 (), Fprog2 ();
 extern Lisp_Object Fsetq (), Fquote ();
 extern Lisp_Object Fuser_variable_p (), Finteractive_p ();
@@ -1349,6 +1473,7 @@ extern Lisp_Object internal_condition_case_1 ();
 extern Lisp_Object unbind_to ();
 extern void error ();
 extern Lisp_Object un_autoload ();
+extern Lisp_Object Ffetch_bytecode ();
 
 /* Defined in editfns.c */
 extern Lisp_Object Fgoto_char ();
@@ -1365,8 +1490,14 @@ extern Lisp_Object Fstring_equal (), Fstring_lessp (), Fbuffer_substring_lessp (
 extern Lisp_Object save_excursion_save (), save_restriction_save ();
 extern Lisp_Object save_excursion_restore (), save_restriction_restore ();
 extern Lisp_Object Fchar_to_string ();
+extern Lisp_Object Fdelete_region (), Fnarrow_to_region (), Fwiden ();
 
 /* defined in buffer.c */
+extern Lisp_Object Foverlay_start (), Foverlay_end ();
+extern void adjust_overlays_for_insert ();
+extern void adjust_overlays_for_delete ();
+extern void fix_overlays_in_range ();
+extern int overlay_touches_p ();
 extern Lisp_Object Vbuffer_alist, Vinhibit_read_only;
 extern Lisp_Object Fget_buffer (), Fget_buffer_create (), Fset_buffer ();
 extern Lisp_Object Fbarf_if_buffer_read_only ();
@@ -1391,6 +1522,7 @@ extern Lisp_Object Fsubstitute_in_file_name ();
 extern Lisp_Object Ffile_symlink_p ();
 extern Lisp_Object Fverify_visited_file_modtime ();
 extern Lisp_Object Ffile_exists_p ();
+extern Lisp_Object Ffile_name_absolute_p ();
 extern Lisp_Object Fdirectory_file_name ();
 extern Lisp_Object Ffile_name_directory ();
 extern Lisp_Object expand_and_dir_to_file ();
@@ -1404,6 +1536,10 @@ extern Lisp_Object Vfundamental_mode_abbrev_table;
 /* defined in search.c */
 extern Lisp_Object Fstring_match ();
 extern Lisp_Object Fscan_buffer ();
+extern void restore_match_data ();
+extern Lisp_Object Fmatch_data (), Fstore_match_data ();
+extern Lisp_Object Fmatch_beginning (), Fmatch_end ();
+extern Lisp_Object Fskip_chars_forward (), Fskip_chars_backward ();
 
 /* defined in minibuf.c */
 
@@ -1417,7 +1553,7 @@ extern Lisp_Object Fread_no_blanks_input ();
 
 /* Defined in callint.c */
 
-extern Lisp_Object Vprefix_arg, Qminus, Qplus, Vcurrent_prefix_arg;
+extern Lisp_Object Qminus, Qplus, Vcurrent_prefix_arg;
 extern Lisp_Object Vcommand_history;
 extern Lisp_Object Qcall_interactively;
 extern Lisp_Object Fcall_interactively ();
@@ -1426,6 +1562,7 @@ extern Lisp_Object Fprefix_numeric_value ();
 /* defined in casefiddle.c */
 
 extern Lisp_Object Fdowncase (), Fupcase (), Fcapitalize ();
+extern Lisp_Object Fupcase_initials (), Fupcase_initials_region ();
 
 /* defined in keyboard.c */
 
@@ -1433,7 +1570,11 @@ extern Lisp_Object Qdisabled;
 extern Lisp_Object Vhelp_form, Vtop_level;
 extern Lisp_Object Fdiscard_input (), Frecursive_edit ();
 extern Lisp_Object Fcommand_execute (), Finput_pending_p ();
+extern Lisp_Object menu_bar_items ();
 extern Lisp_Object Qvertical_scroll_bar;
+#ifdef MULTI_KBOARD
+extern void delete_kboard ();
+#endif
 
 /* defined in keymap.c */
 
@@ -1442,7 +1583,8 @@ extern Lisp_Object current_global_map;
 extern Lisp_Object Fkey_description (), Fsingle_key_description ();
 extern Lisp_Object Fwhere_is_internal ();
 extern Lisp_Object access_keymap (), store_in_keymap ();
-extern Lisp_Object get_keyelt (), get_keymap();
+extern Lisp_Object get_keyelt (), get_keymap (), get_keymap_1 ();
+extern void describe_map_tree ();
 
 /* defined in indent.c */
 extern Lisp_Object Fvertical_motion (), Findent_to (), Fcurrent_column ();
@@ -1458,6 +1600,10 @@ extern int window_internal_height (), window_internal_width ();
 
 /* defined in frame.c */
 extern Lisp_Object Qvisible;
+extern void store_frame_param (), store_in_alist ();
+extern Lisp_Object do_switch_frame ();
+extern Lisp_Object get_frame_param();
+extern Lisp_Object frame_buffer_predicate ();
 extern Lisp_Object Fframep ();
 extern Lisp_Object Fselect_frame ();
 extern Lisp_Object Ffocus_frame ();
@@ -1465,6 +1611,7 @@ extern Lisp_Object Funfocus_frame ();
 extern Lisp_Object Fselected_frame ();
 extern Lisp_Object Fwindow_frame ();
 extern Lisp_Object Fframe_root_window ();
+extern Lisp_Object Fframe_first_window ();
 extern Lisp_Object Fframe_selected_window ();
 extern Lisp_Object Fframe_list ();
 extern Lisp_Object Fnext_frame ();
@@ -1486,9 +1633,6 @@ extern Lisp_Object Fset_frame_height ();
 extern Lisp_Object Fset_frame_width ();
 extern Lisp_Object Fset_frame_size ();
 extern Lisp_Object Fset_frame_position ();
-#ifndef HAVE_X11
-extern Lisp_Object Frubber_band_rectangle ();
-#endif /* HAVE_X11 */
 
 /* defined in emacs.c */
 extern Lisp_Object decode_env_path ();
@@ -1499,11 +1643,15 @@ void shut_down_emacs ( /* int signal, int no_x, Lisp_Object stuff */ );
 extern int noninteractive;
 /* Nonzero means don't do use window-system-specific display code */
 extern int inhibit_window_system;
+/* Nonzero means that a filter or a sentinel is running.  */
+extern int running_asynch_code;
 
 /* defined in process.c */
 extern Lisp_Object Fget_process (), Fget_buffer_process (), Fprocessp ();
 extern Lisp_Object Fprocess_status (), Fkill_process ();
 extern Lisp_Object Fprocess_send_eof ();
+extern Lisp_Object Fwaiting_for_user_input_p ();
+extern Lisp_Object Qprocessp;
 
 /* defined in callproc.c */
 extern Lisp_Object Vexec_path, Vexec_directory, Vdata_directory;
@@ -1513,6 +1661,7 @@ extern Lisp_Object Vdoc_directory;
 extern Lisp_Object Vdoc_file_name;
 extern Lisp_Object Fsubstitute_command_keys ();
 extern Lisp_Object Fdocumentation (), Fdocumentation_property ();
+extern Lisp_Object read_doc_string ();
 
 /* defined in bytecode.c */
 extern Lisp_Object Qbytecode;
@@ -1528,10 +1677,18 @@ extern Lisp_Object truncate_undo_list ();
 
 /* defined in textprop.c */
 extern Lisp_Object Qmodification_hooks;
+extern Lisp_Object Qrear_nonsticky;
 extern Lisp_Object Qinsert_in_front_hooks, Qinsert_behind_hooks;
 extern Lisp_Object Fnext_property_change ();
 extern Lisp_Object Fnext_single_property_change ();
+extern Lisp_Object Fprevious_single_property_change ();
+
+/* defined in intervals.c */
+extern Lisp_Object get_local_map ();
 
+/* defined in xmenu.c */
+extern Lisp_Object Fx_popup_menu (), Fx_popup_dialog ();
+\f
 /* Nonzero means Emacs has already been initialized.
    Used during startup to detect startup of dumped Emacs.  */
 extern int initialized;
@@ -1569,3 +1726,9 @@ extern void init_system_name ();
 #ifndef IS_ANY_SEP
 #define IS_ANY_SEP(_c_) (IS_DIRECTORY_SEP (_c_))
 #endif
+
+#ifdef SWITCH_ENUM_BUG
+#define SWITCH_ENUM_CAST(x) ((int)(x))
+#else
+#define SWITCH_ENUM_CAST(x) (x)
+#endif