/* 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.
#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,
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. XVECTOR(object) points to a struct Lisp_Vector.
- The length of the vector, and its contents, are stored therein. */
- Lisp_Vector,
+ /* Vector of Lisp objects, or something resembling it.
+ 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 */
- Lisp_Window_Configuration,
-
#ifdef LISP_FLOAT_TYPE
Lisp_Float,
#endif /* LISP_FLOAT_TYPE */
- /* The overlay type.
- An overlay values is actually a retagged cons, the first in a
- list of the form
- ((START . END) nil . PLIST)
- where START and END are markers in the overlay's buffer, and
- PLIST is the overlay's property list. */
- Lisp_Overlay
+ /* 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,
Lisp_Misc_Objfwd,
Lisp_Misc_Buffer_Objfwd,
Lisp_Misc_Buffer_Local_Value,
- Lisp_Misc_Some_Buffer_Local_Value
+ Lisp_Misc_Some_Buffer_Local_Value,
+ 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
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;
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;
#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
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.
#define ARRAY_MARK_FLAG ((MARKBIT >> 1) & ~MARKBIT)
#endif /* no ARRAY_MARK_FLAG */
-#if ARRAY_MARK_FLAG == MARKBIT
-you lose
+/* In the size word of a struct Lisp_Vector, this bit means it's really
+ some other vector-like object. */
+#ifndef PSEUDOVECTOR_FLAG
+#define PSEUDOVECTOR_FLAG ((ARRAY_MARK_FLAG >> 1) & ~ARRAY_MARK_FLAG)
#endif
+/* 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. */
+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
+
#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
#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 */
#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))
#define XOBJFWD(a) (&(XMISC(a)->u_objfwd))
#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_Vector, b)
-#define XSETSUBR(a, b) XSET (a, Lisp_Subr, b)
+#define XSETVECTOR(a, b) XSET (a, Lisp_Vectorlike, 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 XSETWINDOW_CONFIGURATION(a, b) XSET (a, Lisp_Window_Configuration, 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.
/* 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
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)
struct Lisp_String
{
EMACS_INT size;
- DECLARE_INTERVALS /* `data' field must be last. */
+ DECLARE_INTERVALS /* `data' field must be last. */
unsigned char data[1];
};
+/* If a struct is made to look like a vector, this macro returns the length
+ of that vector. */
+#define VECSIZE(type) ((sizeof (type) - (sizeof (struct Lisp_Vector) \
+ - sizeof (Lisp_Object))) \
+ / sizeof (Lisp_Object))
+
struct Lisp_Vector
{
EMACS_INT size;
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;
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,
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;
};
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;
};
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;
};
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;
};
The actual contents resemble a cons cell which starts a list like this:
(REALVALUE BUFFER CURRENT-ALIST-ELEMENT . DEFAULT-VALUE).
+ The cons-like structure is for historical reasons; it might be better
+ to just put these elements into the struct, now.
+
BUFFER is the last buffer for which this symbol's value was
made up to date.
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
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;
};
+/* In an overlay object, the mark bit of the plist is used as the GC mark.
+ START and END are markers in the overlay's buffer, and
+ PLIST is the overlay's property list. */
+struct Lisp_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;
struct Lisp_Objfwd u_objfwd;
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
#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;
/* 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
#ifdef LISP_FLOAT_TYPE
#define NUMBERP(x) (INTEGERP (x) || FLOATP (x))
+#define GC_NUMBERP(x) (GC_INTEGERP (x) || GC_FLOATP (x))
#else
#define NUMBERP(x) (INTEGERP (x))
+#define GC_NUMBERP(x) (GC_INTEGERP (x))
#endif
+#define NATNUMP(x) (INTEGERP (x) && XINT (x) >= 0)
+#define GC_NATNUMP(x) (GC_INTEGERP (x) && XINT (x) >= 0)
#define INTEGERP(x) (XTYPE ((x)) == Lisp_Int)
+#define GC_INTEGERP(x) (XGCTYPE ((x)) == Lisp_Int)
#define SYMBOLP(x) (XTYPE ((x)) == Lisp_Symbol)
+#define GC_SYMBOLP(x) (XGCTYPE ((x)) == Lisp_Symbol)
#define MISCP(x) (XTYPE ((x)) == Lisp_Misc)
+#define GC_MISCP(x) (XGCTYPE ((x)) == Lisp_Misc)
+#define VECTORLIKEP(x) (XTYPE ((x)) == Lisp_Vectorlike)
+#define GC_VECTORLIKEP(x) (XGCTYPE ((x)) == Lisp_Vectorlike)
#define STRINGP(x) (XTYPE ((x)) == Lisp_String)
-#define VECTORP(x) (XTYPE ((x)) == Lisp_Vector)
+#define GC_STRINGP(x) (XGCTYPE ((x)) == Lisp_String)
#define CONSP(x) (XTYPE ((x)) == Lisp_Cons)
-#define COMPILEDP(x) (XTYPE ((x)) == Lisp_Compiled)
-#define BUFFERP(x) (XTYPE ((x)) == Lisp_Buffer)
-#define SUBRP(x) (XTYPE ((x)) == Lisp_Subr)
-#define PROCESSP(x) (XTYPE ((x)) == Lisp_Process)
+#define GC_CONSP(x) (XGCTYPE ((x)) == Lisp_Cons)
+
+#ifdef LISP_FLOAT_TYPE
+#define FLOATP(x) (XTYPE ((x)) == Lisp_Float)
+#define GC_FLOATP(x) (XGCTYPE ((x)) == Lisp_Float)
+#else
+#define FLOATP(x) (0)
+#define GC_FLOATP(x) (0)
+#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) && 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) (XTYPE ((x)) == Lisp_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
-#define WINDOWP(x) (XTYPE ((x)) == Lisp_Window)
-#define WINDOW_CONFIGURATIONP(x) (XTYPE ((x)) == Lisp_Window_Configuration)
-#ifdef LISP_FLOAT_TYPE
-#define FLOATP(x) (XTYPE ((x)) == Lisp_Float)
-#else
-#define FLOATP(x) (0)
-#endif
-#define OVERLAYP(x) (XTYPE ((x)) == Lisp_Overlay)
-#define MARKERP(x) (MISCP (x) && XMISC (x)->type == Lisp_Misc_Marker)
-#define INTFWDP(x) (MISCP (x) && XMISC (x)->type == Lisp_Misc_Intfwd)
-#define BOOLFWDP(x) (MISCP (x) && XMISC (x)->type == Lisp_Misc_Boolfwd)
-#define OBJFWDP(x) (MISCP (x) && XMISC (x)->type == Lisp_Misc_Objfwd)
-#define BUFFER_OBJFWDP(x) (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 SOME_BUFFER_LOCAL_VALUEP(x) (MISCP (x) && XMISC (x)->type == Lisp_Misc_Some_Buffer_Local_Value)
+\f
#define EQ(x, y) (XFASTINT (x) == XFASTINT (y))
#define GC_EQ(x, y) (XGCTYPE (x) == XGCTYPE (y) && XPNTR (x) == XPNTR (y))
do { if (!INTEGERP ((x))) x = wrong_type_argument (Qintegerp, (x)); } while (0)
#define CHECK_NATNUM(x, i) \
- do { if (!INTEGERP ((x)) || XINT ((x)) < 0) \
- x = wrong_type_argument (Qwholenump, (x)); } while (0)
+ do { if (!NATNUMP (x)) x = wrong_type_argument (Qwholenump, (x)); } while (0)
#define CHECK_MARKER(x, i) \
do { if (!MARKERP ((x))) x = wrong_type_argument (Qmarkerp, (x)); } while (0)
`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)
#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
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. */
#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 *)(¤t_kboard->vname) \
+ - (char *)current_kboard))
\f
/* Structure for recording Lisp call stack for backtrace purposes. */
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)) \
#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])
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.
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;
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();
extern Lisp_Object Fsymbol_value (), find_symbol_value (), Fset ();
extern Lisp_Object Fdefault_value (), Fset_default (), Fdefault_boundp ();
-extern Lisp_Object Faref (), Faset (), Farray_length ();
+extern Lisp_Object Faref (), Faset ();
extern Lisp_Object Fstring_to_number (), Fnumber_to_string ();
extern Lisp_Object Feqlsign (), Fgtr (), Flss (), Fgeq (), Fleq ();
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();
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 ();
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;
extern Lisp_Object pure_cons (), make_pure_vector ();
extern Lisp_Object Fgarbage_collect ();
extern Lisp_Object Fmake_byte_code ();
+extern struct Lisp_Vector *allocate_vectorlike ();
extern int gc_in_progress;
/* Defined in print.c */
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 ();
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 ();
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 ();
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 ();
/* 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 */
/* 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 ();
/* defined in casefiddle.c */
extern Lisp_Object Fdowncase (), Fupcase (), Fcapitalize ();
+extern Lisp_Object Fupcase_initials (), Fupcase_initials_region ();
/* defined in keyboard.c */
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 */
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 ();
/* 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 ();
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 ();
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 ();
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;
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;
/* 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;
#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