/* Fundamental definitions for GNU Emacs Lisp interpreter.
- Copyright (C) 1985, 1986, 1987, 1993 Free Software Foundation, Inc.
+ Copyright (C) 1985, 1986, 1987, 1993, 1994 Free Software Foundation, Inc.
This file is part of GNU Emacs.
the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA. */
+/* These are default choices for the types to use. */
+#ifndef EMACS_INT
+#define EMACS_INT int
+#endif
+#ifndef EMACS_UINT
+#define EMACS_UINT unsigned int
+#endif
+
/* Define the fundamental Lisp data structures */
/* This is the set of Lisp data types */
/* Symbol. XSYMBOL (object) points to a struct Lisp_Symbol. */
Lisp_Symbol,
- /* Marker (buffer ptr). XMARKER(object) points to a struct Lisp_Marker. */
- Lisp_Marker,
+ /* Miscellaneous. XMISC (object) points to a union Lisp_Misc,
+ whose first member indicates the subtype. */
+ Lisp_Misc,
/* String. XSTRING (object) points to a struct Lisp_String.
The length of the string, and its contents, are stored therein. */
as well as pointing to the code. */
Lisp_Subr,
- /* Internal value return by subroutines of read.
- The user never sees this data type.
- Its value is just a number. */
- Lisp_Internal,
-
- /* Forwarding pointer to an int variable.
- This is allowed only in the value cell of a symbol,
- and it means that the symbol's value really lives in the
- specified int variable.
- XINTPTR(obj) points to the int variable. */
- Lisp_Intfwd,
-
- /* Boolean forwarding pointer to an int variable.
- This is like Lisp_Intfwd except that the ostensible
- "value" of the symbol is t if the int variable is nonzero,
- nil if it is zero. XINTPTR(obj) points to the int variable. */
- Lisp_Boolfwd,
-
/* Object describing a connection to a subprocess.
It points to storage of type struct Lisp_Process */
Lisp_Process,
- /* Forwarding pointer to a Lisp_Object variable.
- This is allowed only in the value cell of a symbol,
- and it means that the symbol's value really lives in the
- specified variable.
- XOBJFWD(obj) points to the Lisp_Object variable. */
- Lisp_Objfwd,
-
#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
Lisp_Frame,
#endif
- /* Used when a FILE * value needs to be passed
- in an argument of type Lisp_Object.
- You must do *(FILE **) XPNTR(obj) to get the value.
- The user will never see this data type. */
- Lisp_Internal_Stream,
-
/* Used in a symbol value cell when the symbol's value is per-buffer.
The actual contents are a cons cell which starts a list like this:
(REALVALUE BUFFER CURRENT-ALIST-ELEMENT . DEFAULT-VALUE).
Only make-local-variable does that. */
Lisp_Some_Buffer_Local_Value,
-
- /* Like Lisp_Objfwd except that value lives in a slot
- in the current buffer. Value is byte index of slot within buffer */
- Lisp_Buffer_Objfwd,
-
- /* In symbol value cell, means var is unbound.
- In symbol function cell, means function name is undefined. */
- Lisp_Void,
-
/* Window used for Emacs display.
Data inside looks like a Lisp_Vector. */
Lisp_Window,
Lisp_Overlay
};
+/* This is the set of datatypes that share a common structure.
+ The first member of the structure is a type code from this set. */
+enum Lisp_Misc_Type
+ {
+ Lisp_Misc_Free,
+ Lisp_Misc_Marker,
+ Lisp_Misc_Intfwd,
+ Lisp_Misc_Boolfwd,
+ Lisp_Misc_Objfwd,
+ Lisp_Misc_Buffer_Objfwd
+ };
+
#ifndef NO_UNION_TYPE
-#ifndef BIG_ENDIAN
+#ifndef WORDS_BIG_ENDIAN
/* Definition of Lisp_Object for little-endian machines. */
}
Lisp_Object;
-#else /* If BIG_ENDIAN */
+#else /* If WORDS_BIG_ENDIAN */
typedef
union Lisp_Object
}
Lisp_Object;
-#endif /* BIG_ENDIAN */
+#endif /* WORDS_BIG_ENDIAN */
#endif /* NO_UNION_TYPE */
#ifdef NO_UNION_TYPE
-#define Lisp_Object int
+#define Lisp_Object EMACS_INT
/* These values are overridden by the m- file on some machines. */
#ifndef VALBITS
#endif
#ifndef VALMASK
-#define VALMASK ((1<<VALBITS) - 1)
+#define VALMASK ((((EMACS_INT) 1)<<VALBITS) - 1)
#endif
-#define GCTYPEMASK ((1<<GCTYPEBITS) - 1)
+#define GCTYPEMASK ((((EMACS_INT) 1)<<GCTYPEBITS) - 1)
+
+/* Two flags that are set during GC. On some machines, these flags
+ are defined differently by the m- file. */
+
+/* This is set in the car of a cons and in the plist slot of a symbol
+ to indicate it is marked. Likewise in the plist slot of an interval,
+ the chain slot of a marker, the type slot of a float, and the name
+ slot of a buffer.
+
+ In strings, this bit in the size field indicates that the string
+ is a "large" one, one which was separately malloc'd
+ rather than being part of a string block. */
+
+#ifndef MARKBIT
#define MARKBIT (1 << (VALBITS + GCTYPEBITS))
+#endif /*MARKBIT */
+
+/* In the size word of a vector, this bit means the vector has been marked.
+ In the size word of a large string, likewise. */
+
+#ifndef ARRAY_MARK_FLAG
+#define ARRAY_MARK_FLAG ((MARKBIT >> 1) & ~MARKBIT)
+#endif /* no ARRAY_MARK_FLAG */
+
+#if ARRAY_MARK_FLAG == MARKBIT
+you lose
+#endif
#endif /* NO_UNION_TYPE */
\f
#endif
#ifndef XSETTYPE
-#define XSETTYPE(a, b) ((a) = XUINT (a) | ((int)(b) << VALBITS))
+#define XSETTYPE(a, b) ((a) = XUINT (a) | ((EMACS_INT)(b) << VALBITS))
#endif
-/* Use XFASTINT for fast retrieval and storage of integers known
- to be positive. This takes advantage of the fact that Lisp_Int is 0. */
-#define XFASTINT(a) (a)
+/* For integers known to be positive, XFASTINT provides fast retrieval
+ and XSETFASTINT provides fast storage. This takes advantage of the
+ fact that Lisp_Int is 0. */
+#define XFASTINT(a) ((a) + 0)
+#define XSETFASTINT(a, b) ((a) = (b))
/* Extract the value of a Lisp_Object as a signed integer. */
#endif /* not HAVE_SHM */
#endif /* no XPNTR */
-#ifndef XSETINT
-#define XSETINT(a, b) ((a) = ((a) & ~VALMASK) | ((b) & VALMASK))
-#endif
-
-#ifndef XSETUINT
-#define XSETUINT(a, b) XSETINT (a, b)
-#endif
-
-#ifndef XSETPNTR
-#define XSETPNTR(a, b) XSETINT (a, b)
-#endif
-
#ifndef XSET
#define XSET(var, type, ptr) \
- ((var) = ((int)(type) << VALBITS) + ((int) (ptr) & VALMASK))
+ ((var) = ((EMACS_INT)(type) << VALBITS) + ((EMACS_INT) (ptr) & VALMASK))
#endif
/* During garbage collection, XGCTYPE must be used for extracting types
#define XTYPE(a) ((enum Lisp_Type) (a).u.type)
#define XSETTYPE(a, b) ((a).u.type = (char) (b))
-/* Use XFASTINT for fast retrieval and storage of integers known
- to be positive. This takes advantage of the fact that Lisp_Int is 0. */
-#define XFASTINT(a) ((a).i)
+/* For integers known to be positive, XFASTINT provides fast retrieval
+ and XSETFASTINT provides fast storage. This takes advantage of the
+ fact that Lisp_Int is 0. */
+#define XFASTINT(a) ((a).i + 0)
+#define XSETFASTINT(a, b) ((a).i = (b))
#ifdef EXPLICIT_SIGN_EXTEND
/* Make sure we sign-extend; compilers have been known to fail to do so. */
#define XUINT(a) ((a).u.val)
#define XPNTR(a) ((a).u.val)
-#define XSETINT(a, b) ((a).s.val = (int) (b))
-#define XSETUINT(a, b) ((a).s.val = (int) (b))
-#define XSETPNTR(a, b) ((a).s.val = (int) (b))
#define XSET(var, vartype, ptr) \
(((var).s.type = ((char) (vartype))), ((var).s.val = ((int) (ptr))))
#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 XFUNCTION(a) ((Lisp_Object (*)()) XPNTR(a))
-#define XMARKER(a) ((struct Lisp_Marker *) XPNTR(a))
-#define XOBJFWD(a) ((Lisp_Object *) XPNTR(a))
-#define XINTPTR(a) ((int *) 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))
-
-#define XSETCONS(a, b) XSETPNTR(a, (int) (b))
-#define XSETBUFFER(a, b) XSETPNTR(a, (int) (b))
-#define XSETVECTOR(a, b) XSETPNTR(a, (int) (b))
-#define XSETSUBR(a, b) XSETPNTR(a, (int) (b))
-#define XSETSTRING(a, b) XSETPNTR(a, (int) (b))
-#define XSETSYMBOL(a, b) XSETPNTR(a, (int) (b))
-#define XSETFUNCTION(a, b) XSETPNTR(a, (int) (b))
-#define XSETMARKER(a, b) XSETPNTR(a, (int) (b))
-#define XSETOBJFWD(a, b) XSETPNTR(a, (int) (b))
-#define XSETINTPTR(a, b) XSETPNTR(a, (int) (b))
-#define XSETWINDOW(a, b) XSETPNTR(a, (int) (b))
-#define XSETPROCESS(a, b) XSETPNTR(a, (int) (b))
-#define XSETFLOAT(a, b) XSETPNTR(a, (int) (b))
+#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 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 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)
\f
#ifdef USE_TEXT_PROPERTIES
/* Basic data type for use of intervals. See the macros in intervals.h */
/* Complain if object is not string or buffer type */
#define CHECK_STRING_OR_BUFFER(x, i) \
- { if (XTYPE ((x)) != Lisp_String && XTYPE ((x)) != Lisp_Buffer) \
+ { if (!STRINGP ((x)) && !BUFFERP ((x))) \
x = wrong_type_argument (Qbuffer_or_string_p, (x)); }
/* Macro used to conditionally compile intervals into certain data
struct Lisp_String
{
- int size;
+ EMACS_INT size;
DECLARE_INTERVALS /* `data' field must be last. */
unsigned char data[1];
};
struct Lisp_Vector
{
- int size;
+ EMACS_INT size;
struct Lisp_Vector *next;
Lisp_Object contents[1];
};
char *prompt;
char *doc;
};
+\f
+/* A miscellaneous object, when it's on the free list. */
+struct Lisp_Free
+ {
+ enum Lisp_Misc_Type type; /* = Lisp_Misc_Free */
+ 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 modified;
+ };
+
+/* Forwarding pointer to an int variable.
+ This is allowed only in the value cell of a symbol,
+ and it means that the symbol's value really lives in the
+ specified int variable. */
+struct Lisp_Intfwd
+ {
+ enum Lisp_Misc_Type type; /* = Lisp_Misc_Intfwd */
+ int *intvar;
+ };
+
+/* Boolean forwarding pointer to an int variable.
+ This is like Lisp_Intfwd except that the ostensible
+ "value" of the symbol is t if the int variable is nonzero,
+ nil if it is zero. */
+struct Lisp_Boolfwd
+ {
+ enum Lisp_Misc_Type type; /* = Lisp_Misc_Boolfwd */
+ int *boolvar;
+ };
+
+/* Forwarding pointer to a Lisp_Object variable.
+ This is allowed only in the value cell of a symbol,
+ and it means that the symbol's value really lives in the
+ specified variable. */
+struct Lisp_Objfwd
+ {
+ enum Lisp_Misc_Type type; /* = Lisp_Misc_Objfwd */
+ Lisp_Object *objvar;
+ };
+
+/* Like Lisp_Objfwd except that value lives in a slot in the
+ current buffer. Value is byte index of slot within buffer. */
+struct Lisp_Buffer_Objfwd
+ {
+ enum Lisp_Misc_Type type; /* = Lisp_Misc_Buffer_Objfwd */
+ int offset;
+ };
+
+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_Boolfwd u_boolfwd;
+ struct Lisp_Objfwd u_objfwd;
+ struct Lisp_Buffer_Objfwd u_buffer_objfwd;
};
#ifdef LISP_FLOAT_TYPE
#define CHAR_CTL (0x400000)
#define CHAR_META (0x800000)
+#ifdef USE_X_TOOLKIT
+#ifdef NO_UNION_TYPE
+/* Use this for turning a (void *) into a Lisp_Object, as when the
+ Lisp_Object is passed into a toolkit callback function. */
+#define VOID_TO_LISP(larg,varg) \
+ do { ((larg) = ((Lisp_Object) (varg))); } while (0)
+#define CVOID_TO_LISP VOID_TO_LISP
+
+/* Use this for turning a Lisp_Object into a (void *), as when the
+ Lisp_Object is passed into a toolkit callback function. */
+#define LISP_TO_VOID(larg) ((void *) (larg))
+#define LISP_TO_CVOID(varg) ((const void *) (larg))
+
+#else /* not NO_UNION_TYPE */
+/* Use this for turning a (void *) into a Lisp_Object, as when the
+ Lisp_Object is passed into a toolkit callback function. */
+#define VOID_TO_LISP(larg,varg) \
+ do { ((larg).v = (void *) (varg)); } while (0)
+#define CVOID_TO_LISP(larg,varg) \
+ do { ((larg).cv = (const void *) (varg)); } while (0)
+
+/* Use this for turning a Lisp_Object into a (void *), as when the
+ Lisp_Object is passed into a toolkit callback function. */
+#define LISP_TO_VOID(larg) ((larg).v)
+#define LISP_TO_CVOID(larg) ((larg).cv)
+#endif /* not NO_UNION_TYPE */
+#endif /* USE_X_TOOLKIT */
+
\f
/* The glyph datatype, used to represent characters on the display. */
pretty quickly. */
#define GLYPH unsigned int
+#ifdef HAVE_FACES
+/* The FAST macros assume that we already know we're in an X window. */
+
/* Given a character code and a face ID, return the appropriate glyph. */
-#define MAKE_GLYPH(char, face) ((char) | ((face) << 8))
+#define FAST_MAKE_GLYPH(char, face) ((char) | ((face) << 8))
/* Return a glyph's character code. */
-#define GLYPH_CHAR(glyph) ((glyph) & 0xff)
+#define FAST_GLYPH_CHAR(glyph) ((glyph) & 0xff)
/* Return a glyph's face ID. */
-#define GLYPH_FACE(glyph) (((glyph) >> 8) & ((1 << 24) - 1))
-
+#define FAST_GLYPH_FACE(glyph) (((glyph) >> 8) & ((1 << 24) - 1))
+
+/* Slower versions that test the frame type first. */
+#define MAKE_GLYPH(f, char, face) (FRAME_TERMCAP_P (f) ? (char) \
+ : FAST_MAKE_GLYPH (char, face))
+#define GLYPH_CHAR(f, g) (FRAME_TERMCAP_P (f) ? (g) : FAST_GLYPH_CHAR (g))
+#define GLYPH_FACE(f, g) (FRAME_TERMCAP_P (f) ? (0) : FAST_GLYPH_FACE (g))
+#else /* not HAVE_FACES */
+#define MAKE_GLYPH(f, char, face) (char)
+#define GLYPH_CHAR(f, g) (g)
+#define GLYPH_FACE(f, g) (g)
+#endif /* not HAVE_FACES */
+
+/* The ID of the mode line highlighting face. */
+#define GLYPH_MODE_LINE_FACE 1
\f
/* Data type checking */
#define GC_NILP(x) GC_EQ (x, Qnil)
#ifdef LISP_FLOAT_TYPE
-#define NUMBERP(x) (XTYPE (x) == Lisp_Int || XTYPE (x) == Lisp_Float)
+#define NUMBERP(x) (INTEGERP (x) || FLOATP (x))
#else
-#define NUMBERP(x) (XTYPE (x) == Lisp_Int)
+#define NUMBERP(x) (INTEGERP (x))
#endif
#define INTEGERP(x) (XTYPE ((x)) == Lisp_Int)
#define SYMBOLP(x) (XTYPE ((x)) == Lisp_Symbol)
-#define MARKERP(x) (XTYPE ((x)) == Lisp_Marker)
+#define MISCP(x) (XTYPE ((x)) == Lisp_Misc)
#define STRINGP(x) (XTYPE ((x)) == Lisp_String)
#define VECTORP(x) (XTYPE ((x)) == Lisp_Vector)
#define CONSP(x) (XTYPE ((x)) == Lisp_Cons)
#define BUFFERP(x) (XTYPE ((x)) == Lisp_Buffer)
#define SUBRP(x) (XTYPE ((x)) == Lisp_Subr)
#define PROCESSP(x) (XTYPE ((x)) == Lisp_Process)
+#ifdef MULTI_FRAME
#define FRAMEP(x) (XTYPE ((x)) == Lisp_Frame)
+#else
+#ifdef MSDOS
+/* We could use this in the !MSDOS case also, but we prefer a compile-time
+ error message in case FRAMEP is used. */
+#define FRAMEP(x) (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) (0)
#endif
#define OVERLAYP(x) (XTYPE ((x)) == Lisp_Overlay)
+#define BUFFER_LOCAL_VALUEP(x) (XTYPE ((x)) == Lisp_Buffer_Local_Value)
+#define SOME_BUFFER_LOCAL_VALUEP(x) (XTYPE ((x)) == Lisp_Some_Buffer_Local_Value)
+#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 EQ(x, y) (XFASTINT (x) == XFASTINT (y))
#define GC_EQ(x, y) (XGCTYPE (x) == XGCTYPE (y) && XPNTR (x) == XPNTR (y))
#define CHECK_LIST(x, i) \
- do { if ((XTYPE ((x)) != Lisp_Cons) && !NILP (x)) x = wrong_type_argument (Qlistp, (x)); } while (0)
+ do { if (!CONSP ((x)) && !NILP (x)) x = wrong_type_argument (Qlistp, (x)); } while (0)
#define CHECK_STRING(x, i) \
- do { if (XTYPE ((x)) != Lisp_String) x = wrong_type_argument (Qstringp, (x)); } while (0)
+ do { if (!STRINGP ((x))) x = wrong_type_argument (Qstringp, (x)); } while (0)
#define CHECK_CONS(x, i) \
- do { if (XTYPE ((x)) != Lisp_Cons) x = wrong_type_argument (Qconsp, (x)); } while (0)
+ do { if (!CONSP ((x))) x = wrong_type_argument (Qconsp, (x)); } while (0)
#define CHECK_SYMBOL(x, i) \
- do { if (XTYPE ((x)) != Lisp_Symbol) x = wrong_type_argument (Qsymbolp, (x)); } while (0)
+ do { if (!SYMBOLP ((x))) x = wrong_type_argument (Qsymbolp, (x)); } while (0)
#define CHECK_VECTOR(x, i) \
- do { if (XTYPE ((x)) != Lisp_Vector) x = wrong_type_argument (Qvectorp, (x)); } while (0)
+ do { if (!VECTORP ((x))) x = wrong_type_argument (Qvectorp, (x)); } while (0)
#define CHECK_BUFFER(x, i) \
- do { if (XTYPE ((x)) != Lisp_Buffer) x = wrong_type_argument (Qbufferp, (x)); } while (0)
+ do { if (!BUFFERP ((x))) x = wrong_type_argument (Qbufferp, (x)); } while (0)
#define CHECK_WINDOW(x, i) \
- do { if (XTYPE ((x)) != Lisp_Window) x = wrong_type_argument (Qwindowp, (x)); } while (0)
+ do { if (!WINDOWP ((x))) x = wrong_type_argument (Qwindowp, (x)); } while (0)
/* This macro rejects windows on the interior of the window tree as
"dead", which is what we want; this is an argument-checking macro, and
#define CHECK_LIVE_WINDOW(x, i) \
do { \
- if (XTYPE ((x)) != Lisp_Window \
+ if (!WINDOWP ((x)) \
|| NILP (XWINDOW ((x))->buffer)) \
x = wrong_type_argument (Qwindow_live_p, (x)); \
} while (0)
#define CHECK_PROCESS(x, i) \
- do { if (XTYPE ((x)) != Lisp_Process) x = wrong_type_argument (Qprocessp, (x)); } while (0)
+ do { if (!PROCESSP ((x))) x = wrong_type_argument (Qprocessp, (x)); } while (0)
#define CHECK_NUMBER(x, i) \
- do { if (XTYPE ((x)) != Lisp_Int) x = wrong_type_argument (Qintegerp, (x)); } while (0)
+ do { if (!INTEGERP ((x))) x = wrong_type_argument (Qintegerp, (x)); } while (0)
#define CHECK_NATNUM(x, i) \
- do { if (XTYPE ((x)) != Lisp_Int || XINT ((x)) < 0) \
- x = wrong_type_argument (Qnatnump, (x)); } while (0)
+ do { if (!INTEGERP ((x)) || XINT ((x)) < 0) \
+ x = wrong_type_argument (Qwholenump, (x)); } while (0)
#define CHECK_MARKER(x, i) \
- do { if (XTYPE ((x)) != Lisp_Marker) x = wrong_type_argument (Qmarkerp, (x)); } while (0)
+ do { if (!MARKERP ((x))) x = wrong_type_argument (Qmarkerp, (x)); } while (0)
#define CHECK_NUMBER_COERCE_MARKER(x, i) \
- do { if (XTYPE ((x)) == Lisp_Marker) XFASTINT (x) = marker_position (x); \
- else if (XTYPE ((x)) != Lisp_Int) x = wrong_type_argument (Qinteger_or_marker_p, (x)); } while (0)
+ do { if (MARKERP ((x))) XSETFASTINT (x, marker_position (x)); \
+ else if (!INTEGERP ((x))) x = wrong_type_argument (Qinteger_or_marker_p, (x)); } while (0)
#ifdef LISP_FLOAT_TYPE
#define XFLOATINT(n) extract_float((n))
#define CHECK_FLOAT(x, i) \
- do { if (XTYPE (x) != Lisp_Float) \
+ do { if (!FLOATP (x)) \
x = wrong_type_argument (Qfloatp, (x)); } while (0)
#define CHECK_NUMBER_OR_FLOAT(x, i) \
- do { if (XTYPE (x) != Lisp_Float && XTYPE (x) != Lisp_Int) \
+ do { if (!FLOATP (x) && !INTEGERP (x)) \
x = wrong_type_argument (Qnumberp, (x)); } while (0)
#define CHECK_NUMBER_OR_FLOAT_COERCE_MARKER(x, i) \
- do { if (XTYPE (x) == Lisp_Marker) XFASTINT (x) = marker_position (x); \
- else if (XTYPE (x) != Lisp_Int && XTYPE (x) != Lisp_Float) \
+ do { if (MARKERP (x)) XSETFASTINT (x, marker_position (x)); \
+ else if (!INTEGERP (x) && !FLOATP (x)) \
x = wrong_type_argument (Qnumber_or_marker_p, (x)); } while (0)
#else /* Not LISP_FLOAT_TYPE */
#endif /* LISP_FLOAT_TYPE */
#define CHECK_OVERLAY(x, i) \
- do { if (XTYPE ((x)) != Lisp_Overlay) x = wrong_type_argument (Qoverlayp, (x));} while (0)
+ do { if (!OVERLAYP ((x))) x = wrong_type_argument (Qoverlayp, (x));} while (0)
/* Cast pointers to this type to compare them. Some machines want int. */
#ifndef PNTR_COMPARISON_TYPE
`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}; \
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}; \
+ Lisp_Object fnname
+
+/* Note that the weird token-substitution semantics of ANSI C makes
+ this work for MANY and UNEVALLED. */
+#define DEFUN_ARGS_MANY (int, Lisp_Object *)
+#define DEFUN_ARGS_UNEVALLED (Lisp_Object)
+#define DEFUN_ARGS_0 (void)
+#define DEFUN_ARGS_1 (Lisp_Object)
+#define DEFUN_ARGS_2 (Lisp_Object, Lisp_Object)
+#define DEFUN_ARGS_3 (Lisp_Object, Lisp_Object, Lisp_Object)
+#define DEFUN_ARGS_4 (Lisp_Object, Lisp_Object, Lisp_Object, Lisp_Object)
+#define DEFUN_ARGS_5 (Lisp_Object, Lisp_Object, Lisp_Object, Lisp_Object, \
+ Lisp_Object)
+#define DEFUN_ARGS_6 (Lisp_Object, Lisp_Object, Lisp_Object, Lisp_Object, \
+ Lisp_Object, Lisp_Object)
+#define DEFUN_ARGS_7 (Lisp_Object, Lisp_Object, Lisp_Object, Lisp_Object, \
+ Lisp_Object, Lisp_Object, Lisp_Object)
+#endif
+
/* defsubr (Sname);
is how we define the symbol for function `name' at start-up time. */
extern void defsubr ();
/* The handler clauses and variable from the condition-case form. */
Lisp_Object handler;
Lisp_Object var;
+ /* Fsignal stores here the condition-case clause that applies,
+ and Fcondition_case thus knows which clause to run. */
+ Lisp_Object chosen_clause;
/* Used to effect the longjump out to the handler. */
struct catchtag *tag;
extern struct catchtag *catchlist;
extern struct backtrace *backtrace_list;
+extern Lisp_Object memory_signal_data;
+
/* An address near the bottom of the stack.
Tells GC how to save a copy of the stack. */
extern char *stack_bottom;
#define UPCASE_TABLE XSTRING (current_buffer->upcase_table)->data
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 */
gcpro4.next = &gcpro3; gcpro4.var = &varname4; gcpro4.nvars = 1; \
gcprolist = &gcpro4; }
+#define GCPRO5(varname1, varname2, varname3, varname4, varname5) \
+ {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; \
+ gcprolist = &gcpro5; }
+
/* Call staticpro (&var) to protect static variable `var'. */
void staticpro();
#define UNGCPRO (gcprolist = gcpro1.next)
-/* Evaluate expr, UNGCPRO, and then return the value of expr. I used
- to have a `do ... while' clause around this to make it interact
- with semicolons correctly, but this makes some compilers complain
- that the while is never reached. */
-#define RETURN_UNGCPRO(expr) \
- { \
- Lisp_Object ret_ungc_val; \
- ret_ungc_val = (expr); \
- UNGCPRO; \
- return ret_ungc_val; \
- } \
+/* Evaluate expr, UNGCPRO, and then return the value of expr. */
+#define RETURN_UNGCPRO(expr) \
+if (1) \
+ { \
+ Lisp_Object ret_ungc_val; \
+ ret_ungc_val = (expr); \
+ UNGCPRO; \
+ return ret_ungc_val; \
+ } \
+else
\f
/* Defined in data.c */
extern Lisp_Object Qnil, Qt, Qquote, Qlambda, Qsubr, Qunbound;
extern Lisp_Object Qrange_error, Qdomain_error, Qsingularity_error;
extern Lisp_Object Qoverflow_error, Qunderflow_error;
-extern Lisp_Object Qintegerp, Qnumberp, Qnatnump, Qsymbolp, Qlistp, Qconsp;
+extern Lisp_Object Qintegerp, Qnumberp, Qnatnump, Qwholenump;
+extern Lisp_Object Qsymbolp, Qlistp, Qconsp;
extern Lisp_Object Qstringp, Qarrayp, Qsequencep, Qbufferp;
extern Lisp_Object Qchar_or_string_p, Qmarkerp, Qvectorp;
extern Lisp_Object Qinteger_or_marker_p, Qnumber_or_marker_p;
extern Lisp_Object Fappend (), Fconcat (), Fvconcat (), Fcopy_sequence ();
extern Lisp_Object Fsubstring ();
extern Lisp_Object Fnth (), Fnthcdr (), Fmemq (), Fassq (), Fassoc ();
-extern Lisp_Object Frassq (), Fdelq (), Fsort ();
+extern Lisp_Object 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 ();
/* Defined in alloc.c */
extern Lisp_Object Vpurify_flag;
-extern Lisp_Object Fcons (), Flist(), Fmake_list ();
+extern Lisp_Object Fcons (), Flist(), Fmake_list (), allocate_misc ();
extern Lisp_Object Fmake_vector (), Fvector (), Fmake_symbol (), Fmake_marker ();
extern Lisp_Object Fmake_string (), build_string (), make_string ();
extern Lisp_Object make_event_array (), make_uninit_string ();
extern Lisp_Object pure_cons (), make_pure_vector ();
extern Lisp_Object Fgarbage_collect ();
extern Lisp_Object Fmake_byte_code ();
+extern int gc_in_progress;
/* Defined in print.c */
extern Lisp_Object Vprin1_to_string_buffer;
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
+ if (!NILP (Vrun_hooks))
+ call1 (Vrun_hooks, Qmy_funny_hook); */
extern Lisp_Object Vrun_hooks;
extern Lisp_Object Fand (), For (), Fif (), Fprogn (), Fprog1 (), Fprog2 ();
extern Lisp_Object Fsetq (), Fquote ();
extern Lisp_Object Feval (), Fapply (), Ffuncall ();
extern Lisp_Object Fglobal_set (), Fglobal_value (), Fbacktrace ();
extern Lisp_Object apply1 (), call0 (), call1 (), call2 (), call3 ();
+extern Lisp_Object call4 (), call5 (), call6 ();
+extern Lisp_Object Fkill_emacs (), Fkey_binding (), Fsit_for ();
+extern Lisp_Object Fdo_auto_save (), Fset_marker ();
extern Lisp_Object apply_lambda ();
extern Lisp_Object internal_catch ();
extern Lisp_Object internal_condition_case ();
+extern Lisp_Object internal_condition_case_1 ();
extern Lisp_Object unbind_to ();
extern void error ();
extern Lisp_Object un_autoload ();
/* Defined in editfns.c */
-extern Lisp_Object Vprefix_arg, Qminus, Vcurrent_prefix_arg;
extern Lisp_Object Fgoto_char ();
extern Lisp_Object Fpoint_min_marker (), Fpoint_max_marker ();
extern Lisp_Object Fpoint_min (), Fpoint_max ();
extern Lisp_Object Fbarf_if_buffer_read_only ();
extern Lisp_Object Fcurrent_buffer (), Fswitch_to_buffer (), Fpop_to_buffer ();
extern Lisp_Object Fother_buffer ();
+extern Lisp_Object Foverlay_get ();
extern Lisp_Object Qoverlayp;
extern struct buffer *all_buffers;
extern Lisp_Object Ffile_name_directory ();
extern Lisp_Object expand_and_dir_to_file ();
extern Lisp_Object Ffile_accessible_directory_p ();
+extern Lisp_Object Funhandled_file_name_directory ();
/* Defined in abbrev.c */
/* Defined in callint.c */
+extern Lisp_Object Vprefix_arg, Qminus, Qplus, Vcurrent_prefix_arg;
extern Lisp_Object Vcommand_history;
extern Lisp_Object Qcall_interactively;
extern Lisp_Object Fcall_interactively ();
/* defined in keymap.c */
-extern Lisp_Object Qkeymap;
+extern Lisp_Object Qkeymap, Qmenu_bar;
extern Lisp_Object current_global_map;
extern Lisp_Object Fkey_description (), Fsingle_key_description ();
extern Lisp_Object Fwhere_is_internal ();
extern int window_internal_height (), window_internal_width ();
/* defined in frame.c */
+extern Lisp_Object Qvisible;
extern Lisp_Object Fframep ();
extern Lisp_Object Fselect_frame ();
extern Lisp_Object Ffocus_frame ();
/* defined in emacs.c */
extern Lisp_Object decode_env_path ();
extern Lisp_Object Vinvocation_name, Vinvocation_directory;
+extern Lisp_Object Vinstallation_directory;
void shut_down_emacs ( /* int signal, int no_x, Lisp_Object stuff */ );
/* Nonzero means don't do interactive redisplay and don't change tty modes */
extern int noninteractive;
/* 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 ();
/* defined in callproc.c */
extern Lisp_Object Vexec_path, Vexec_directory, Vdata_directory;
+extern Lisp_Object Vdoc_directory;
/* defined in doc.c */
extern Lisp_Object Vdoc_file_name;
extern char *egetenv ();
+/* Set up the name of the machine we're running on. */
+extern void init_system_name ();