(Fexecute_kbd_macro): Update prototype.
[bpt/emacs.git] / src / lisp.h
index 2b6c2a2..c0fd094 100644 (file)
@@ -1,5 +1,5 @@
 /* Fundamental definitions for GNU Emacs Lisp interpreter.
-   Copyright (C) 1985,86,87,93,94,95,97,98,1999,2000, 2001
+   Copyright (C) 1985,86,87,93,94,95,97,98,1999,2000, 2001, 2002
      Free Software Foundation, Inc.
 
 This file is part of GNU Emacs.
@@ -235,7 +235,11 @@ LISP_MAKE_RVALUE (Lisp_Object o)
     return o;
 }
 #else
-#define LISP_MAKE_RVALUE(o) (o) /* XXX - keeps arg as rvalue.  */
+/* This isn't quite right - it keeps the argument as an lvalue.
+   Making it const via casting would help avoid code actually
+   modifying the location in question, but the casting could cover
+   other type-related bugs.  */
+#define LISP_MAKE_RVALUE(o) (o)
 #endif
 
 #endif /* NO_UNION_TYPE */
@@ -299,7 +303,7 @@ enum pvec_type
   PVEC_BUFFER = 0x20000,
   PVEC_HASH_TABLE = 0x40000,
   PVEC_TYPE_MASK = 0x7fe00
-  
+
 #if 0 /* This is used to make the value of PSEUDOVECTOR_FLAG available to
         GDB.  It doesn't work on OS Alpha.  Moved to a variable in
         emacs.c.  */
@@ -348,26 +352,6 @@ enum pvec_type
 #define XUINT(a) ((EMACS_UINT) ((a) & VALMASK))
 #endif
 
-#ifndef XPNTR
-#ifdef HAVE_SHM
-/* In this representation, data is found in two widely separated segments.  */
-extern size_t pure_size;
-#define XPNTR(a) \
-  (XUINT (a) | (XUINT (a) > pure_size ? DATA_SEG_BITS : PURE_SEG_BITS))
-#else /* not HAVE_SHM */
-#ifdef DATA_SEG_BITS
-/* This case is used for the rt-pc.
-   In the diffs I was given, it checked for ptr = 0
-   and did not adjust it in that case.
-   But I don't think that zero should ever be found
-   in a Lisp object whose data type says it points to something.  */
-#define XPNTR(a) (XUINT (a) | DATA_SEG_BITS)
-#else
-#define XPNTR(a) XUINT (a)
-#endif
-#endif /* not HAVE_SHM */
-#endif /* no XPNTR */
-
 #ifndef XSET
 #define XSET(var, type, ptr) \
    ((var) = ((EMACS_INT)(type) << VALBITS) + ((EMACS_INT) (ptr) & VALMASK))
@@ -433,7 +417,6 @@ extern size_t pure_size;
 #endif /* EXPLICIT_SIGN_EXTEND */
 
 #define XUINT(a) ((a).u.val)
-#define XPNTR(a) ((a).u.val)
 
 #define XSET(var, vartype, ptr) \
    (((var).s.val = ((EMACS_INT) (ptr))), ((var).s.type = ((char) (vartype))))
@@ -459,6 +442,26 @@ extern Lisp_Object make_number ();
 
 #endif /* NO_UNION_TYPE */
 
+#ifndef XPNTR
+#ifdef HAVE_SHM
+/* In this representation, data is found in two widely separated segments.  */
+extern size_t pure_size;
+#define XPNTR(a) \
+  (XUINT (a) | (XUINT (a) > pure_size ? DATA_SEG_BITS : PURE_SEG_BITS))
+#else /* not HAVE_SHM */
+#ifdef DATA_SEG_BITS
+/* This case is used for the rt-pc.
+   In the diffs I was given, it checked for ptr = 0
+   and did not adjust it in that case.
+   But I don't think that zero should ever be found
+   in a Lisp object whose data type says it points to something.  */
+#define XPNTR(a) (XUINT (a) | DATA_SEG_BITS)
+#else
+#define XPNTR(a) XUINT (a)
+#endif
+#endif /* not HAVE_SHM */
+#endif /* no XPNTR */
+
 /* Largest and smallest representable fixnum values.  These are the C
    values.  */
 
@@ -535,6 +538,20 @@ extern Lisp_Object make_number ();
 #define ASET(ARRAY, IDX, VAL)  (AREF ((ARRAY), (IDX)) = (VAL))
 #define ASIZE(ARRAY)           XVECTOR ((ARRAY))->size
 
+/* Convenience macros for dealing with Lisp strings.  */
+
+#define SREF(string, index)    (XSTRING (string)->data[index] + 0)
+#define SSET(string, index, new) (XSTRING (string)->data[index] = (new))
+#define SDATA(string)          (XSTRING (string)->data + 0)
+#define SCHARS(string)         (XSTRING (string)->size + 0)
+#define SBYTES(string)         (STRING_BYTES (XSTRING (string)) + 0)
+
+#define STRING_SET_CHARS(string, newsize) \
+    (XSTRING (string)->size = (newsize))
+
+#define STRING_COPYIN(string, index, new, count) \
+    bcopy (new, XSTRING (string)->data + index, count)
+
 \f
 /* Basic data type for use of intervals.  See the macros in intervals.h.  */
 
@@ -573,7 +590,7 @@ struct interval
      The first four are duplicates for things which can be on the list,
      for purposes of speed.  */
 
-  unsigned int write_protect : 1;    /* Non-zero means can't modify.  */
+  unsigned int write_protect : 1;   /* Non-zero means can't modify.  */
   unsigned int visible : 1;        /* Zero means don't display.  */
   unsigned int front_sticky : 1;    /* Non-zero means text inserted just
                                       before this interval goes into it.  */
@@ -621,11 +638,6 @@ struct Lisp_Cons
 #define XCDR_AS_LVALUE(c) (XCONS ((c))->cdr)
 #endif
 
-/* Okay, we're not quite ready to turn this on yet.  A few files still
-   need to be updated and tested.  */
-#undef LISP_MAKE_RVALUE
-#define LISP_MAKE_RVALUE(x) (x)
-
 /* Use these from normal code.  */
 #define XCAR(c)        LISP_MAKE_RVALUE(XCAR_AS_LVALUE(c))
 #define XCDR(c) LISP_MAKE_RVALUE(XCDR_AS_LVALUE(c))
@@ -674,8 +686,14 @@ extern int string_bytes P_ ((struct Lisp_String *));
 
 #endif /* not GC_CHECK_STRING_BYTES */
 
-/* Set the length in bytes of STR.  */
-#define SET_STRING_BYTES(STR, SIZE)  ((STR)->size_byte = (SIZE))
+/* Mark STR as a unibyte string.  */
+#define STRING_SET_UNIBYTE(STR)      (XSTRING (STR)->size_byte = -1)
+
+/* Get text properties.  */
+#define STRING_INTERVALS(STR)  (XSTRING (STR)->intervals + 0)
+
+/* Set text properties.  */
+#define STRING_SET_INTERVALS(STR, INT) (XSTRING (STR)->intervals = (INT))
 
 /* In a string or vector, the sign bit of the `size' is the gc mark bit */
 
@@ -868,9 +886,11 @@ struct Lisp_Symbol
      enum symbol_interned.  */
   unsigned interned : 2;
 
-  /* The symbol's name.  This should become a Lisp_Object
-     some day; there's no need for the Lisp_String pointer nowadays.  */
-  struct Lisp_String *name;
+  /* The symbol's name, as a Lisp string.
+
+     The name "xname" is used to intentionally break code referring to
+     the old field "name" of type pointer to struct Lisp_String.  */
+  Lisp_Object xname;
 
   /* Value of the symbol or Qunbound if unbound.  If this symbol is a
      defvaralias, `value' contains the symbol for which it is an
@@ -878,16 +898,21 @@ struct Lisp_Symbol
      and set a symbol's value, to take defvaralias into account.  */
   Lisp_Object value;
 
-  /* Function value of the symbol or Qunbound if not fcoundp.  */
+  /* Function value of the symbol or Qunbound if not fboundp.  */
   Lisp_Object function;
 
   /* The symbol's property list.  */
   Lisp_Object plist;
-    
+
   /* Next symbol in obarray bucket, if the symbol is interned.  */
   struct Lisp_Symbol *next;
 };
 
+/* Value is name of symbol.  */
+
+#define SYMBOL_NAME(sym)  \
+     LISP_MAKE_RVALUE (XSYMBOL (sym)->xname)
+
 /* Value is non-zero if SYM is an interned symbol.  */
 
 #define SYMBOL_INTERNED_P(sym)  \
@@ -921,7 +946,7 @@ struct Lisp_Symbol
        else                                                    \
         XSYMBOL (sym)->value = (val);                          \
      } while (0)
-     
+
 \f
 /***********************************************************************
                             Hash Tables
@@ -934,14 +959,14 @@ struct Lisp_Hash_Table
   /* Vector fields.  The hash table code doesn't refer to these.  */
   EMACS_INT size;
   struct Lisp_Vector *vec_next;
-  
+
   /* Function used to compare keys.  */
   Lisp_Object test;
 
   /* Nil if table is non-weak.  Otherwise a symbol describing the
      weakness of the table.  */
   Lisp_Object weak;
-  
+
   /* When the table is resized, and this is an integer, compute the
      new size by adding this to the old size.  If a float, compute the
      new size by multiplying the old size with this factor.  */
@@ -1011,6 +1036,32 @@ struct Lisp_Hash_Table
        }                                                       \
      while (0)
 
+/* Value is the key part of entry IDX in hash table H.  */
+
+#define HASH_KEY(H, IDX)   AREF ((H)->key_and_value, 2 * (IDX))
+
+/* Value is the value part of entry IDX in hash table H.  */
+
+#define HASH_VALUE(H, IDX) AREF ((H)->key_and_value, 2 * (IDX) + 1)
+
+/* Value is the index of the next entry following the one at IDX
+   in hash table H.  */
+
+#define HASH_NEXT(H, IDX)  AREF ((H)->next, (IDX))
+
+/* Value is the hash code computed for entry IDX in hash table H.  */
+
+#define HASH_HASH(H, IDX)  AREF ((H)->hash, (IDX))
+
+/* Value is the index of the element in hash table H that is the
+   start of the collision list at index IDX in the index vector of H.  */
+
+#define HASH_INDEX(H, IDX)  AREF ((H)->index, (IDX))
+
+/* Value is the size of hash table H.  */
+
+#define HASH_TABLE_SIZE(H) XVECTOR ((H)->next)->size
+
 /* Default size for hash tables if not specified.  */
 
 #define DEFAULT_HASH_SIZE 65
@@ -1068,7 +1119,7 @@ struct Lisp_Intfwd
   {
     int type : 16;     /* = Lisp_Misc_Intfwd */
     int spacer : 16;
-    int *intvar;
+    EMACS_INT *intvar;
   };
 
 /* Boolean forwarding pointer to an int variable.
@@ -1113,7 +1164,7 @@ struct Lisp_Buffer_Objfwd
    one that corresponds to the loaded binding.  To read or set the
    variable, you must first make sure the right binding is loaded;
    then you can access the value in (or through) `realvalue'.
-   
+
    `buffer' and `frame' are the buffer and frame for which the loaded
    binding was found.  If those have changed, to make sure the right
    binding is loaded it is necessary to find which binding goes with
@@ -1543,12 +1594,12 @@ typedef unsigned char UCHAR;
 #if (!defined (__STDC__) && !defined (PROTOTYPES)) \
     || defined (USE_NONANSI_DEFUN)
 
-#define DEFUN(lname, fnname, sname, minargs, maxargs, prompt, args)    \
+#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 args
+  Lisp_Object fnname
 
 #else
 
@@ -1587,9 +1638,9 @@ typedef unsigned char UCHAR;
       || (SYMBOLP (OBJ) && !NILP (Ffboundp (OBJ)))     \
       || COMPILEDP (OBJ)                               \
       || SUBRP (OBJ))
-     
+
 /* 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 P_ ((struct Lisp_Subr *));
 
 #define MANY -2
@@ -1598,7 +1649,7 @@ extern void defsubr P_ ((struct Lisp_Subr *));
 extern void defvar_lisp P_ ((char *, Lisp_Object *));
 extern void defvar_lisp_nopro P_ ((char *, Lisp_Object *));
 extern void defvar_bool P_ ((char *, int *));
-extern void defvar_int P_ ((char *, int *));
+extern void defvar_int P_ ((char *, EMACS_INT *));
 extern void defvar_per_buffer P_ ((char *, Lisp_Object *, Lisp_Object, char *));
 extern void defvar_kboard P_ ((char *, int));
 
@@ -1632,9 +1683,9 @@ extern void defvar_kboard P_ ((char *, int));
       form.
 
    Otherwise, the element is a variable binding.
-   
+
    If the symbol field is a symbol, it is an ordinary variable binding.
-   
+
    Otherwise, it should be a structure (SYMBOL WHERE
    . CURRENT-BUFFER), which means having bound a local value while
    CURRENT-BUFFER was active.  If WHERE is nil this means we saw the
@@ -1653,12 +1704,20 @@ extern struct specbinding *specpdl;
 extern struct specbinding *specpdl_ptr;
 extern int specpdl_size;
 
-#define BINDING_STACK_SIZE()   (specpdl_ptr - specpdl)
+extern EMACS_INT max_specpdl_size;
+
+#define SPECPDL_INDEX()        (specpdl_ptr - specpdl)
 
 /* Everything needed to describe an active condition case.  */
 struct handler
   {
     /* The handler clauses and variable from the condition-case form.  */
+    /* For a handler set up in Lisp code, this is always a list.
+       For an internal handler set up by internal_condition_case*,
+       this can instead be the symbol t or `error'.
+       t: handle all conditions.
+       error: handle all conditions, and errors can run the debugger
+              or display a backtrace.  */
     Lisp_Object handler;
     Lisp_Object var;
     /* Fsignal stores here the condition-case clause that applies,
@@ -1761,7 +1820,7 @@ extern int consing_since_gc;
 
 /* Threshold for doing another gc.  */
 
-extern int gc_cons_threshold;
+extern EMACS_INT gc_cons_threshold;
 
 /* Structure for recording stack slots that need marking.  */
 
@@ -1781,13 +1840,13 @@ extern struct gcpro *gcprolist;
 struct gcpro
 {
   struct gcpro *next;
-  
+
   /* Address of first protected variable.  */
   volatile Lisp_Object *var;
-  
+
   /* Number of consecutive protected variables.  */
   int nvars;
-  
+
 #ifdef DEBUG_GCPRO
   int level;
 #endif
@@ -1814,11 +1873,18 @@ struct gcpro
 
 #if GC_MARK_STACK == GC_MAKE_GCPROS_NOOPS
 
-#define GCPRO1(varname) ((void) 0)
-#define GCPRO2(varname1, varname2)((void) 0) 
-#define GCPRO3(varname1, varname2, varname3) ((void) 0) 
-#define GCPRO4(varname1, varname2, varname3, varname4) ((void) 0)
-#define GCPRO5(varname1, varname2, varname3, varname4, varname5) ((void) 0)
+/* Do something silly with gcproN vars just so gcc shuts up.  */
+
+#define GCPRO1(varname) ((void) gcpro1)
+#define GCPRO2(varname1, varname2)(((void) gcpro2, (void) gcpro1))
+#define GCPRO3(varname1, varname2, varname3) \
+  (((void) gcpro3, (void) gcpro2, (void) gcpro1))
+#define GCPRO4(varname1, varname2, varname3, varname4) \
+  (((void) gcpro4, (void) gcpro3, (void) gcpro2, (void) gcpro1))
+#define GCPRO5(varname1, varname2, varname3, varname4, varname5) \
+  (((void) gcpro5, (void) gcpro4, (void) gcpro3, (void) gcpro2, (void) gcpro1))
+#define GCPRO6(varname1, varname2, varname3, varname4, varname5, varname6) \
+  (((void) gcpro6, (void) gcpro5, (void) gcpro4, (void) gcpro3, (void) gcpro2, (void) gcpro1))
 #define UNGCPRO ((void) 0)
 
 #else /* GC_MARK_STACK != GC_MAKE_GCPROS_NOOPS */
@@ -1855,6 +1921,15 @@ struct gcpro
   gcpro5.next = &gcpro4; gcpro5.var = &varname5; gcpro5.nvars = 1; \
   gcprolist = &gcpro5; }
 
+#define GCPRO6(varname1, varname2, varname3, varname4, varname5, varname6) \
+ {gcpro1.next = gcprolist; gcpro1.var = &varname1; gcpro1.nvars = 1; \
+  gcpro2.next = &gcpro1; gcpro2.var = &varname2; gcpro2.nvars = 1; \
+  gcpro3.next = &gcpro2; gcpro3.var = &varname3; gcpro3.nvars = 1; \
+  gcpro4.next = &gcpro3; gcpro4.var = &varname4; gcpro4.nvars = 1; \
+  gcpro5.next = &gcpro4; gcpro5.var = &varname5; gcpro5.nvars = 1; \
+  gcpro6.next = &gcpro5; gcpro6.var = &varname6; gcpro6.nvars = 1; \
+  gcprolist = &gcpro6; }
+
 #define UNGCPRO (gcprolist = gcpro1.next)
 
 #else
@@ -1900,6 +1975,17 @@ extern int gcpro_level;
   gcpro5.level = gcpro_level++; \
   gcprolist = &gcpro5; }
 
+#define GCPRO6(varname1, varname2, varname3, varname4, varname5, varname6) \
+ {gcpro1.next = gcprolist; gcpro1.var = &varname1; gcpro1.nvars = 1; \
+  gcpro1.level = gcpro_level; \
+  gcpro2.next = &gcpro1; gcpro2.var = &varname2; gcpro2.nvars = 1; \
+  gcpro3.next = &gcpro2; gcpro3.var = &varname3; gcpro3.nvars = 1; \
+  gcpro4.next = &gcpro3; gcpro4.var = &varname4; gcpro4.nvars = 1; \
+  gcpro5.next = &gcpro4; gcpro5.var = &varname5; gcpro5.nvars = 1; \
+  gcpro6.next = &gcpro5; gcpro6.var = &varname6; gcpro6.nvars = 1; \
+  gcpro6.level = gcpro_level++; \
+  gcprolist = &gcpro6; }
+
 #define UNGCPRO                                        \
  ((--gcpro_level != gcpro1.level)              \
   ? (abort (), 0)                              \
@@ -2080,10 +2166,11 @@ EXFUN (Fcheck_coding_system, 1);
 EXFUN (Fread_coding_system, 2);
 EXFUN (Fread_non_nil_coding_system, 1);
 EXFUN (Ffind_operation_coding_system, MANY);
+EXFUN (Fupdate_coding_systems_internal, 0);
 EXFUN (Fencode_coding_string, 3);
 EXFUN (Fdecode_coding_string, 3);
-extern Lisp_Object detect_coding_system P_ ((unsigned char *, int, int, int));
-Lisp_Object code_convert_string_norecord P_ ((Lisp_Object, Lisp_Object, int));
+extern Lisp_Object detect_coding_system P_ ((const unsigned char *, int, int,
+                                            int));
 extern void init_coding P_ ((void));
 extern void init_coding_once P_ ((void));
 extern void syms_of_coding P_ ((void));
@@ -2091,13 +2178,13 @@ extern Lisp_Object code_convert_string_norecord P_ ((Lisp_Object, Lisp_Object,
                                                     int));
 
 /* Defined in charset.c */
-extern int nonascii_insert_offset;
+extern EMACS_INT nonascii_insert_offset;
 extern Lisp_Object Vnonascii_translation_table;
 EXFUN (Fchar_bytes, 1);
 EXFUN (Fchar_width, 1);
 EXFUN (Fstring, MANY);
-extern int chars_in_text P_ ((unsigned char *, int));
-extern int multibyte_chars_in_text P_ ((unsigned char *, int));
+extern int chars_in_text P_ ((const unsigned char *, int));
+extern int multibyte_chars_in_text P_ ((const unsigned char *, int));
 extern int unibyte_char_to_multibyte P_ ((int));
 extern int multibyte_char_to_unibyte P_ ((int, Lisp_Object));
 extern Lisp_Object Qcharset;
@@ -2201,6 +2288,7 @@ extern Lisp_Object string_make_unibyte P_ ((Lisp_Object));
 EXFUN (Fcopy_alist, 1);
 EXFUN (Fplist_get, 2);
 EXFUN (Fplist_put, 3);
+EXFUN (Fplist_member, 2);
 EXFUN (Fset_char_table_parent, 2);
 EXFUN (Fchar_table_extra_slot, 2);
 EXFUN (Fset_char_table_extra_slot, 3);
@@ -2227,20 +2315,20 @@ extern Lisp_Object Qinhibit_modification_hooks;
 extern void move_gap P_ ((int));
 extern void move_gap_both P_ ((int, int));
 extern void make_gap P_ ((int));
-extern int copy_text P_ ((unsigned char *, unsigned char *, int, int, int));
-extern int count_size_as_multibyte P_ ((unsigned char *, int));
-extern int count_combining_before P_ ((unsigned char *, int, int, int));
-extern int count_combining_after P_ ((unsigned char *, int, int, int));
-extern void insert P_ ((unsigned char *, int));
-extern void insert_and_inherit P_ ((unsigned char *, int));
-extern void insert_1 P_ ((unsigned char *, int, int, int, int));
-extern void insert_1_both P_ ((unsigned char *, int, int, int, int, int));
+extern int copy_text P_ ((const unsigned char *, unsigned char *, int, int, int));
+extern int count_size_as_multibyte P_ ((const unsigned char *, int));
+extern int count_combining_before P_ ((const unsigned char *, int, int, int));
+extern int count_combining_after P_ ((const unsigned char *, int, int, int));
+extern void insert P_ ((const unsigned char *, int));
+extern void insert_and_inherit P_ ((const unsigned char *, int));
+extern void insert_1 P_ ((const unsigned char *, int, int, int, int));
+extern void insert_1_both P_ ((const unsigned char *, int, int, int, int, int));
 extern void insert_from_string P_ ((Lisp_Object, int, int, int, int, int));
 extern void insert_from_buffer P_ ((struct buffer *, int, int, int));
 extern void insert_char P_ ((int));
-extern void insert_string P_ ((char *));
-extern void insert_before_markers P_ ((unsigned char *, int));
-extern void insert_before_markers_and_inherit P_ ((unsigned char *, int));
+extern void insert_string P_ ((const char *));
+extern void insert_before_markers P_ ((const unsigned char *, int));
+extern void insert_before_markers_and_inherit P_ ((const unsigned char *, int));
 extern void insert_from_string_before_markers P_ ((Lisp_Object, int, int, int, int, int));
 extern void del_range P_ ((int, int));
 extern Lisp_Object del_range_1 P_ ((int, int, int, int));
@@ -2252,12 +2340,14 @@ extern void prepare_to_modify_buffer P_ ((int, int, int *));
 extern void signal_before_change P_ ((int, int, int *));
 extern void signal_after_change P_ ((int, int, int));
 extern void adjust_after_replace P_ ((int, int, Lisp_Object, int, int));
+extern void adjust_after_replace_noundo P_ ((int, int, int, int, int, int));
 extern void adjust_after_insert P_ ((int, int, int, int, int));
 extern void replace_range P_ ((int, int, Lisp_Object, int, int, int));
 extern void syms_of_insdel P_ ((void));
 
 /* Defined in dispnew.c */
 extern Lisp_Object selected_frame;
+extern EMACS_INT baud_rate;
 EXFUN (Fding, 1);
 EXFUN (Fredraw_frame, 1);
 EXFUN (Fredraw_display, 0);
@@ -2266,13 +2356,14 @@ EXFUN (Fsit_for, 3);
 extern Lisp_Object sit_for P_ ((int, int, int, int, int));
 extern void init_display P_ ((void));
 extern void syms_of_display P_ ((void));
-extern void safe_bcopy P_ ((char *, char *, int));
+extern void safe_bcopy P_ ((const char *, char *, int));
 
 /* Defined in xdisp.c */
 extern Lisp_Object Qinhibit_point_motion_hooks;
 extern Lisp_Object Qinhibit_redisplay, Qdisplay;
 extern Lisp_Object Qinhibit_eval_during_redisplay;
 extern Lisp_Object Qmessage_truncate_lines;
+extern Lisp_Object Qcursor_in_non_selected_windows;
 extern Lisp_Object Vmessage_log_max;
 extern int message_enable_multibyte;
 extern Lisp_Object echo_area_buffer[2];
@@ -2283,17 +2374,17 @@ extern Lisp_Object push_message_unwind P_ ((Lisp_Object));
 extern void pop_message P_ ((void));
 extern void restore_message P_ ((void));
 extern Lisp_Object current_message P_ ((void));
-extern void set_message P_ ((char *s, Lisp_Object, int, int));
+extern void set_message P_ ((const char *s, Lisp_Object, int, int));
 extern void clear_message P_ ((int, int));
 extern void message P_ ((/* char *, ... */));
 extern void message_nolog P_ ((/* char *, ... */));
 extern void message1 P_ ((char *));
 extern void message1_nolog P_ ((char *));
-extern void message2 P_ ((char *, int, int));
-extern void message2_nolog P_ ((char *, int, int));
+extern void message2 P_ ((const char *, int, int));
+extern void message2_nolog P_ ((const char *, int, int));
 extern void message3 P_ ((Lisp_Object, int, int));
 extern void message3_nolog P_ ((Lisp_Object, int, int));
-extern void message_dolog P_ ((char *, int, int, int));
+extern void message_dolog P_ ((const char *, int, int, int));
 extern void message_with_string P_ ((char *, Lisp_Object, int));
 extern void message_log_maybe_newline P_ ((void));
 extern void update_echo_area P_ ((void));
@@ -2322,6 +2413,7 @@ extern void buffer_memory_full P_ ((void));
 extern int survives_gc_p P_ ((Lisp_Object));
 extern void mark_object P_ ((Lisp_Object *));
 extern Lisp_Object Vpurify_flag;
+extern Lisp_Object Vmemory_full;
 EXFUN (Fcons, 2);
 EXFUN (list2, 2);
 EXFUN (list3, 3);
@@ -2335,10 +2427,10 @@ EXFUN (Fvector, MANY);
 EXFUN (Fmake_symbol, 1);
 EXFUN (Fmake_marker, 0);
 EXFUN (Fmake_string, 2);
-extern Lisp_Object build_string P_ ((char *));
-extern Lisp_Object make_string P_ ((char *, int));
-extern Lisp_Object make_unibyte_string P_ ((char *, int));
-extern Lisp_Object make_multibyte_string P_ ((char *, int, int));
+extern Lisp_Object build_string P_ ((const char *));
+extern Lisp_Object make_string P_ ((const char *, int));
+extern Lisp_Object make_unibyte_string P_ ((const char *, int));
+extern Lisp_Object make_multibyte_string P_ ((const char *, int, int));
 extern Lisp_Object make_event_array P_ ((int, Lisp_Object *));
 extern Lisp_Object make_uninit_string P_ ((int));
 extern Lisp_Object make_uninit_multibyte_string P_ ((int, int));
@@ -2382,14 +2474,14 @@ EXFUN (Fprint, 2);
 EXFUN (Ferror_message_string, 1);
 extern Lisp_Object Vstandard_output, Qstandard_output;
 extern Lisp_Object Qexternal_debugging_output;
-extern void temp_output_buffer_setup P_ ((char *));
+extern void temp_output_buffer_setup P_ ((const char *));
 extern int print_level, print_escape_newlines;
 extern Lisp_Object Qprint_escape_newlines;
 extern void write_string P_ ((char *, int));
 extern void write_string_1 P_ ((char *, int, Lisp_Object));
-extern void print_error_message P_ ((Lisp_Object, Lisp_Object));
+extern void print_error_message P_ ((Lisp_Object, Lisp_Object, char *, Lisp_Object));
 extern Lisp_Object internal_with_output_to_temp_buffer
-       P_ ((char *, Lisp_Object (*) (Lisp_Object), Lisp_Object));
+       P_ ((const char *, Lisp_Object (*) (Lisp_Object), Lisp_Object));
 extern void float_to_string P_ ((unsigned char *, double));
 extern void syms_of_print P_ ((void));
 
@@ -2410,15 +2502,15 @@ EXFUN (Fread_char, 2);
 EXFUN (Fread_event, 2);
 extern Lisp_Object read_filtered_event P_ ((int, int, int, int));
 EXFUN (Feval_region, 4);
-extern Lisp_Object intern P_ ((char *));
+extern Lisp_Object intern P_ ((const char *));
 extern Lisp_Object make_symbol P_ ((char *));
-extern Lisp_Object oblookup P_ ((Lisp_Object, char *, int, int));
+extern Lisp_Object oblookup P_ ((Lisp_Object, const char *, int, int));
 #define LOADHIST_ATTACH(x) \
  if (initialized) Vcurrent_load_list = Fcons (x, Vcurrent_load_list)
 extern Lisp_Object Vcurrent_load_list;
 extern Lisp_Object Vload_history, Vload_suffixes;
 extern int openp P_ ((Lisp_Object, Lisp_Object, Lisp_Object,
-                     Lisp_Object *, int));
+                     Lisp_Object *, Lisp_Object));
 extern int isfloat_string P_ ((char *));
 extern void map_obarray P_ ((Lisp_Object, void (*) (Lisp_Object, Lisp_Object),
                             Lisp_Object));
@@ -2431,7 +2523,6 @@ extern void syms_of_lread P_ ((void));
 /* Defined in eval.c */
 extern Lisp_Object Qautoload, Qexit, Qinteractive, Qcommandp, Qdefun, Qmacro;
 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;
 extern Lisp_Object Vsignaling_function;
@@ -2472,7 +2563,7 @@ EXFUN (Funwind_protect, UNEVALLED);
 EXFUN (Fcondition_case, UNEVALLED);
 EXFUN (Fsignal, 2);
 EXFUN (Fautoload, 5);
-EXFUN (Fcommandp, 1);
+EXFUN (Fcommandp, 2);
 EXFUN (Feval, 1);
 EXFUN (Fapply, MANY);
 EXFUN (Ffuncall, MANY);
@@ -2505,6 +2596,7 @@ extern void init_eval P_ ((void));
 extern void syms_of_eval P_ ((void));
 
 /* Defined in editfns.c */
+EXFUN (Fpropertize, MANY);
 EXFUN (Fcurrent_message, 0);
 EXFUN (Fgoto_char, 1);
 EXFUN (Fpoint_min_marker, 0);
@@ -2556,8 +2648,8 @@ extern Lisp_Object Vinhibit_field_text_motion;
 EXFUN (Fconstrain_to_field, 5);
 EXFUN (Ffield_string, 1);
 EXFUN (Fdelete_field, 1);
-EXFUN (Ffield_beginning, 2);
-EXFUN (Ffield_end, 2);
+EXFUN (Ffield_beginning, 3);
+EXFUN (Ffield_end, 3);
 EXFUN (Ffield_string_no_properties, 1);
 extern void set_time_zone_rule P_ ((char *));
 
@@ -2643,9 +2735,9 @@ EXFUN (Ffile_directory_p, 1);
 EXFUN (Fwrite_region, 7);
 EXFUN (Ffile_readable_p, 1);
 EXFUN (Ffile_executable_p, 1);
-EXFUN (Fread_file_name, 5);
+EXFUN (Fread_file_name, 6);
 extern Lisp_Object close_file_unwind P_ ((Lisp_Object));
-extern void report_file_error P_ ((char *, Lisp_Object));
+extern void report_file_error P_ ((const char *, Lisp_Object));
 extern int internal_delete_file P_ ((Lisp_Object));
 extern void syms_of_fileio P_ ((void));
 EXFUN (Fmake_temp_name, 1);
@@ -2667,7 +2759,7 @@ EXFUN (Fmatch_beginning, 1);
 EXFUN (Fmatch_end, 1);
 EXFUN (Flooking_at, 1);
 extern int fast_string_match P_ ((Lisp_Object, Lisp_Object));
-extern int fast_c_string_match_ignore_case P_ ((Lisp_Object, char *));
+extern int fast_c_string_match_ignore_case P_ ((Lisp_Object, const char *));
 extern int scan_buffer P_ ((int, int, int, int, int *, int));
 extern int scan_newline P_ ((int, int, int, int, int, int));
 extern int find_next_newline P_ ((int, int));
@@ -2679,7 +2771,6 @@ extern void syms_of_search P_ ((void));
 
 extern Lisp_Object last_minibuf_string;
 extern void choose_minibuf_frame P_ ((void));
-extern int scmp P_ ((unsigned char *, unsigned char *, int));
 EXFUN (Fcompleting_read, 8);
 EXFUN (Fread_from_minibuffer, 7);
 EXFUN (Fread_variable, 2);
@@ -2689,7 +2780,7 @@ EXFUN (Feval_minibuffer, 2);
 EXFUN (Fread_string, 5);
 EXFUN (Fread_no_blanks_input, 3);
 extern Lisp_Object get_minibuffer P_ ((int));
-extern void temp_echo_area_glyphs P_ ((char *));
+extern void temp_echo_area_glyphs P_ ((const char *));
 extern void init_minibuf_once P_ ((void));
 extern void syms_of_minibuf P_ ((void));
 extern void keys_of_minibuf P_ ((void));
@@ -2760,9 +2851,9 @@ EXFUN (Fvertical_motion, 2);
 EXFUN (Findent_to, 2);
 EXFUN (Fcurrent_column, 0);
 EXFUN (Fmove_to_column, 2);
-extern int current_column P_ ((void));
+extern double current_column P_ ((void));
 extern void invalidate_current_column P_ ((void));
-extern int indented_beyond_p P_ ((int, int, int));
+extern int indented_beyond_p P_ ((int, int, double));
 extern void syms_of_indent P_ ((void));
 
 /* defined in window.c */
@@ -2835,7 +2926,6 @@ extern void frames_discard_buffer P_ ((Lisp_Object));
 extern void set_frame_buffer_list P_ ((Lisp_Object, Lisp_Object));
 extern void frames_bury_buffer P_ ((Lisp_Object));
 extern void syms_of_frame P_ ((void));
-extern void keys_of_frame P_ ((void));
 
 /* defined in emacs.c */
 extern Lisp_Object decode_env_path P_ ((char *, char *));
@@ -2911,7 +3001,7 @@ extern void unmark_byte_stack P_ ((void));
 
 /* defined in macros.c */
 extern Lisp_Object Qexecute_kbd_macro;
-EXFUN (Fexecute_kbd_macro, 2);
+EXFUN (Fexecute_kbd_macro, 3);
 extern void init_macros P_ ((void));
 extern void syms_of_macros P_ ((void));
 
@@ -2978,10 +3068,10 @@ extern int set_window_size P_ ((int, int, int));
 extern void create_process P_ ((Lisp_Object, char **, Lisp_Object));
 extern int tabs_safe_p P_ ((void));
 extern void init_baud_rate P_ ((void));
-extern int emacs_open P_ ((char *, int, int));
+extern int emacs_open P_ ((const char *, int, int));
 extern int emacs_close P_ ((int));
 extern int emacs_read P_ ((int, char *, unsigned int));
-extern int emacs_write P_ ((int, char *, unsigned int));
+extern int emacs_write P_ ((int, const char *, unsigned int));
 
 /* defined in filelock.c */
 EXFUN (Funlock_buffer, 0);
@@ -3008,9 +3098,6 @@ extern void syms_of_ccl P_ ((void));
 EXFUN (Ffile_attributes, 1);
 extern void syms_of_dired P_ ((void));
 
-/* Defined in mocklisp.c */
-extern void syms_of_mocklisp P_ ((void));
-
 /* Defined in term.c */
 extern void syms_of_term P_ ((void));
 extern void fatal () NO_RETURN;
@@ -3033,8 +3120,12 @@ extern void syms_of_xfns P_ ((void));
 extern void init_xfns P_ ((void));
 extern Lisp_Object Vx_resource_name;
 EXFUN (Fxw_display_color_p, 1);
+EXFUN (Fx_file_dialog, 4);
 #endif /* HAVE_X_WINDOWS */
 
+/* Defined in xsmfns.c */
+extern void syms_of_xsmfns P_ ((void));
+
 /* Defined in xselect.c */
 extern void syms_of_xselect P_ ((void));
 
@@ -3054,7 +3145,7 @@ extern POINTER_TYPE *xmalloc P_ ((size_t));
 extern POINTER_TYPE *xrealloc P_ ((POINTER_TYPE *, size_t));
 extern void xfree P_ ((POINTER_TYPE *));
 
-extern char *xstrdup P_ ((char *));
+extern char *xstrdup P_ ((const char *));
 
 #ifndef USE_CRT_DLL
 extern char *egetenv P_ ((char *));
@@ -3096,7 +3187,7 @@ extern Lisp_Object Vdirectory_sep_char;
 
 /* Loop over Lisp list LIST.  Signal an error if LIST is not a proper
    list, or if it contains circles.
-   
+
    HARE and TORTOISE should be the names of Lisp_Object variables, and
    N should be the name of an EMACS_INT variable declared in the
    function where the macro is used.  Each nested loop should use
@@ -3110,7 +3201,7 @@ extern Lisp_Object Vdirectory_sep_char;
    ? 1                                                 \
    : (CONSP (obj)                                      \
       ? 0                                              \
-      : (wrong_type_argument (Qlistp, (list), 0)), 1))
+      : (wrong_type_argument (Qlistp, (list))), 1))
 
 #define FOREACH(hare, list, tortoise, n)               \
   for (tortoise = hare = (list), n = 0;                        \
@@ -3135,4 +3226,6 @@ extern Lisp_Object Vdirectory_sep_char;
    fixnum.  */
 
 #define make_fixnum_or_float(val) \
-   (FIXNUM_OVERFLOW_P (val) ? make_float (val) : make_number ((int)(val)))
+   (FIXNUM_OVERFLOW_P (val) \
+    ? make_float (val) \
+    : make_number ((EMACS_INT)(val)))