/* Fundamental definitions for GNU Emacs Lisp interpreter.
- Copyright (C) 1985, 1986, 1987, 1992 Free Software Foundation, Inc.
+ Copyright (C) 1985, 1986, 1987, 1993 Free Software Foundation, Inc.
This file is part of GNU Emacs.
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. */
+ 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
/* Used when a FILE * value needs to be passed
in an argument of type Lisp_Object.
created.
Note that REALVALUE can be a forwarding pointer. Each time it
- is examined or set, forwarding must be done. */
+ is examined or set, forwarding must be done. Each time we
+ switch buffers, buffer-local variables which forward into C
+ variables are swapped immediately, so the C code can assume
+ that they are always up to date. */
Lisp_Buffer_Local_Value,
/* Like Lisp_Buffer_Local_Value with one difference:
- merely setting the variable while some buffer is current
- does not cause that buffer to have its own local value of this variable.
- Only make-local-variable does that. */
+ merely setting the variable while some buffer is current
+ does not cause that buffer to have its own local value of this variable.
+ Only make-local-variable does that. */
Lisp_Some_Buffer_Local_Value,
Lisp_Window,
/* Used by save,set,restore-window-configuration */
- Lisp_Window_Configuration
+ Lisp_Window_Configuration,
#ifdef LISP_FLOAT_TYPE
- ,
- Lisp_Float
+ 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
};
#ifndef NO_UNION_TYPE
#define XSETPROCESS(a, b) XSETPNTR(a, (int) (b))
#define XSETFLOAT(a, b) XSETPNTR(a, (int) (b))
\f
+#ifdef USE_TEXT_PROPERTIES
+/* 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. */
+
+ 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. */
+ struct interval *parent; /* 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. */
+
+ unsigned char write_protect; /* Non-zero means can't modify. */
+ 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. */
+
+ Lisp_Object plist; /* Properties of this interval. */
+};
+
+typedef struct interval *INTERVAL;
+
+/* 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) \
+ 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. */
+#define DECLARE_INTERVALS INTERVAL intervals;
+
+/* Macro used to condionally compile interval initialization into
+ 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. */
+
+#define CHECK_STRING_OR_BUFFER(x, i)
+
+#define INTERVAL
+#define DECLARE_INTERVALS
+#define INITIALIZE_INTERVAL(ptr,val)
+
+#endif /* USE_TEXT_PROPERTIES */
+\f
/* In a cons, the markbit of the car is the gc mark bit */
struct Lisp_Cons
struct Lisp_String
{
int size;
+ DECLARE_INTERVALS /* `data' field must be last. */
unsigned char data[1];
};
/* A character, declared with the following typedef, is a member
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;
+#endif
/* Meanings of slots in a Lisp_Compiled: */
#define COMPILED_STACK_DEPTH 3
#define COMPILED_DOC_STRING 4
#define COMPILED_INTERACTIVE 5
+
+/* 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)
+
+\f
+/* The glyph datatype, used to represent characters on the display. */
+
+/* The low eight bits are the character code, and the bits above them
+ are the numeric face ID. If FID is the face ID of a glyph on a
+ frame F, then F->display.x->faces[FID] contains the description of
+ that face. This is an int instead of a short, so we can support a
+ good bunch of face ID's; given that we have no mechanism for
+ tossing unused frame face ID's yet, we'll probably run out of 255
+ pretty quickly. */
+#define GLYPH unsigned int
+
+/* Given a character code and a face ID, return the appropriate glyph. */
+#define MAKE_GLYPH(char, face) ((char) | ((face) << 8))
+
+/* Return a glyph's character code. */
+#define GLYPH_CHAR(glyph) ((glyph) & 0xff)
+
+/* Return a glyph's face ID. */
+#define GLYPH_FACE(glyph) (((glyph) >> 8) & ((1 << 24) - 1))
+
\f
/* Data type checking */
#define NILP(x) (XFASTINT (x) == XFASTINT (Qnil))
+#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) (XTYPE (x) == Lisp_Int)
#endif
-/* #define LISTP(x) (XTYPE ((x)) == Lisp_Cons)*/
+#define INTEGERP(x) (XTYPE ((x)) == Lisp_Int)
+#define SYMBOLP(x) (XTYPE ((x)) == Lisp_Symbol)
+#define MARKERP(x) (XTYPE ((x)) == Lisp_Marker)
+#define STRINGP(x) (XTYPE ((x)) == Lisp_String)
+#define VECTORP(x) (XTYPE ((x)) == Lisp_Vector)
#define CONSP(x) (XTYPE ((x)) == Lisp_Cons)
-#define EQ(x, y) (XFASTINT (x) == XFASTINT (y))
+#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 FRAMEP(x) (XTYPE ((x)) == Lisp_Frame)
+#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 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) \
{ if ((XTYPE ((x)) != Lisp_Cons) && !NILP (x)) x = wrong_type_argument (Qlistp, (x)); }
#define CHECK_WINDOW(x, i) \
{ if (XTYPE ((x)) != Lisp_Window) x = wrong_type_argument (Qwindowp, (x)); }
+/* 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
+ the user should never get access to interior windows.
+
+ A window of any sort, leaf or interior, is dead iff the buffer,
+ vchild, and hchild members are all nil. */
+
+#define CHECK_LIVE_WINDOW(x, i) \
+ { \
+ if (XTYPE ((x)) != Lisp_Window \
+ || NILP (XWINDOW ((x))->buffer)) \
+ x = wrong_type_argument (Qwindow_live_p, (x)); \
+ }
+
#define CHECK_PROCESS(x, i) \
{ if (XTYPE ((x)) != Lisp_Process) x = wrong_type_argument (Qprocessp, (x)); }
#define XFLOATINT(n) XINT((n))
#endif /* LISP_FLOAT_TYPE */
+#define CHECK_OVERLAY(x, i) \
+ { if (XTYPE ((x)) != Lisp_Overlay) x = wrong_type_argument (Qoverlayp, (x));}
+
/* Cast pointers to this type to compare them. Some machines want int. */
#ifndef PNTR_COMPARISON_TYPE
#define PNTR_COMPARISON_TYPE unsigned int
/* Macros we use to define forwarded Lisp variables.
These are used in the syms_of_FILENAME functions. */
-#define DEFVARLISP(lname, vname, doc) defvar_lisp (lname, vname)
-#define DEFVARBOOL(lname, vname, doc) defvar_bool (lname, vname)
-#define DEFVARINT(lname, vname, doc) defvar_int (lname, vname)
-#define DEFVARPERBUFFER(lname, vname, doc) \
- defvar_per_buffer (lname, vname)
-
#define DEFVAR_LISP(lname, vname, doc) defvar_lisp (lname, vname)
#define DEFVAR_LISP_NOPRO(lname, vname, doc) defvar_lisp_nopro (lname, vname)
#define DEFVAR_BOOL(lname, vname, doc) defvar_bool (lname, vname)
#define DEFVAR_PER_BUFFER(lname, vname, type, doc) \
defvar_per_buffer (lname, vname, type, 0)
\f
-/* Structure for recording Lisp call stack for backtrace purposes */
-
+/* Structure for recording Lisp call stack for backtrace purposes. */
+
+/* The special binding stack holds the outer values of variables while
+ they are bound by a function application or a let form, stores the
+ code to be executed for Lisp unwind-protect forms, and stores the C
+ functions to be called for record_unwind_protect.
+
+ If func is non-zero, undoing this binding applies func to old_value;
+ This implements record_unwind_protect.
+ If func is zero and symbol is nil, undoing this binding evaluates
+ the list of forms in old_value; this implements Lisp's unwind-protect
+ form.
+ Otherwise, undoing this binding stores old_value as symbol's value; this
+ undoes the bindings made by a let form or function call. */
struct specbinding
{
Lisp_Object symbol, old_value;
extern struct specbinding *specpdl_ptr;
extern int specpdl_size;
+/* Everything needed to describe an active condition case. */
struct handler
{
+ /* The handler clauses and variable from the condition-case form. */
Lisp_Object handler;
Lisp_Object var;
- int poll_suppress_count; /* No error should exit a piece of code
- in which polling is suppressed. */
+
+ /* Used to effect the longjump out to the handler. */
struct catchtag *tag;
+
+ /* The next enclosing handler. */
struct handler *next;
};
#define UNGCPRO (gcprolist = gcpro1.next)
-/* Evaluate expr, UNGCPRO, and then return the value of expr. */
+/* 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) \
- do \
{ \
Lisp_Object ret_ungc_val; \
ret_ungc_val = (expr); \
UNGCPRO; \
return ret_ungc_val; \
} \
- while (0)
\f
/* Defined in data.c */
extern Lisp_Object Qnil, Qt, Qquote, Qlambda, Qsubr, Qunbound;
extern Lisp_Object Qend_of_file, Qarith_error;
extern Lisp_Object Qbeginning_of_buffer, Qend_of_buffer, Qbuffer_read_only;
+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 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 Qboundp, Qfboundp;
+extern Lisp_Object Qbuffer_or_string_p;
extern Lisp_Object Qcdr;
#ifdef LISP_FLOAT_TYPE
extern Lisp_Object indirect_function (), Findirect_function ();
extern Lisp_Object Ffset (), Fsetplist ();
extern Lisp_Object Fsymbol_value (), find_symbol_value (), Fset ();
-extern Lisp_Object Fdefault_value (), Fset_default ();
+extern Lisp_Object Fdefault_value (), Fset_default (), Fdefault_boundp ();
extern Lisp_Object Faref (), Faset (), Farray_length ();
-extern Lisp_Object Fstring_to_int (), Fint_to_string ();
-extern Lisp_Object Feqlsign (), Fgtr (), Flss (), Fgeq (), Fleq (), Fneq (), Fzerop ();
-extern Lisp_Object Fplus (), Fminus (), Ftimes (), Fquo (), Frem (), Fmax (), Fmin ();
-extern Lisp_Object Flogand (), Flogior (), Flogxor (), Flognot (), Flsh (), Fash ();
+extern Lisp_Object Fstring_to_number (), Fnumber_to_string ();
+extern Lisp_Object Feqlsign (), Fgtr (), Flss (), Fgeq (), Fleq ();
+extern Lisp_Object Fneq (), Fzerop ();
+extern Lisp_Object Fplus (), Fminus (), Ftimes (), Fquo (), Frem ();
+extern Lisp_Object Fmax (), Fmin ();
+extern Lisp_Object Flogand (), Flogior (), Flogxor (), Flognot ();
+extern Lisp_Object Flsh (), Fash ();
+
extern Lisp_Object Fadd1 (), Fsub1 ();
extern Lisp_Object make_number ();
+extern Lisp_Object long_to_cons ();
+extern unsigned long cons_to_long ();
extern void args_out_of_range ();
extern void args_out_of_range_3 ();
extern Lisp_Object wrong_type_argument ();
#ifdef LISP_FLOAT_TYPE
extern Lisp_Object Ffloat_to_int(), Fint_to_float();
extern double extract_float();
+extern Lisp_Object make_float ();
+extern Lisp_Object Ffloat ();
#endif /* LISP_FLOAT_TYPE */
/* Defined in fns.c */
extern Lisp_Object Flength ();
extern Lisp_Object Fappend (), Fconcat (), Fvconcat (), Fcopy_sequence ();
extern Lisp_Object Fsubstring ();
-extern Lisp_Object Fnthcdr (), Fmemq (), Fassq (), Fassoc ();
+extern Lisp_Object Fnth (), Fnthcdr (), Fmemq (), Fassq (), Fassoc ();
extern Lisp_Object Frassq (), Fdelq (), Fsort ();
extern Lisp_Object Freverse (), Fnreverse (), Fget (), Fput (), Fequal ();
extern Lisp_Object Ffillarray (), Fnconc (), Fmapcar (), Fmapconcat ();
extern Lisp_Object Ffeaturep (), Frequire () , Fprovide ();
extern Lisp_Object concat2 (), nconc2 ();
extern Lisp_Object assq_no_quit ();
+extern Lisp_Object Fcopy_alist ();
/* Defined in alloc.c */
extern Lisp_Object Vpurify_flag;
extern Lisp_Object Fcons (), Flist(), Fmake_list ();
extern Lisp_Object Fmake_vector (), Fvector (), Fmake_symbol (), Fmake_marker ();
extern Lisp_Object Fmake_string (), build_string (), make_string ();
-extern Lisp_Object make_array (), make_uninit_string ();
+extern Lisp_Object make_event_array (), make_uninit_string ();
extern Lisp_Object Fpurecopy (), make_pure_string ();
extern Lisp_Object pure_cons (), make_pure_vector ();
extern Lisp_Object Fgarbage_collect ();
+extern Lisp_Object Fmake_byte_code ();
/* Defined in print.c */
extern Lisp_Object Vprin1_to_string_buffer;
extern Lisp_Object Fread (), Fread_from_string ();
extern Lisp_Object Fintern (), Fintern_soft (), Fload ();
extern Lisp_Object Fget_file_char (), Fread_char ();
+extern Lisp_Object read_filtered_event ();
extern Lisp_Object Feval_current_buffer (), Feval_region ();
extern Lisp_Object intern (), oblookup ();
+#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;
/* Defined in eval.c */
extern Lisp_Object Qautoload, Qexit, Qinteractive, Qcommandp, Qdefun, Qmacro;
extern Lisp_Object Fchar_to_string ();
/* defined in buffer.c */
-extern Lisp_Object Vbuffer_alist;
+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 Fcurrent_buffer (), Fswitch_to_buffer (), Fpop_to_buffer ();
extern Lisp_Object Fother_buffer ();
+extern Lisp_Object Qoverlayp;
extern struct buffer *all_buffers;
/* defined in marker.c */
/* Defined in fileio.c */
extern Lisp_Object Qfile_error;
+extern Lisp_Object Ffind_file_name_handler ();
extern Lisp_Object Ffile_name_as_directory ();
extern Lisp_Object Fexpand_file_name (), Ffile_name_nondirectory ();
extern Lisp_Object Fsubstitute_in_file_name ();
extern Lisp_Object Ffile_symlink_p ();
+extern Lisp_Object Fverify_visited_file_modtime ();
+extern Lisp_Object Ffile_exists_p ();
+extern Lisp_Object Fdirectory_file_name ();
+extern Lisp_Object Ffile_name_directory ();
+extern Lisp_Object expand_and_dir_to_file ();
+extern Lisp_Object Ffile_accessible_directory_p ();
/* Defined in abbrev.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 Qvertical_scroll_bar;
/* defined in keymap.c */
extern Lisp_Object Fvertical_motion (), Findent_to (), Fcurrent_column ();
/* defined in window.c */
-extern Lisp_Object Qwindowp;
+extern Lisp_Object Qwindowp, Qwindow_live_p;
extern Lisp_Object Fget_buffer_window ();
extern Lisp_Object Fsave_window_excursion ();
extern Lisp_Object Fset_window_configuration (), Fcurrent_window_configuration ();
extern Lisp_Object Fcoordinates_in_window_p ();
extern Lisp_Object Fwindow_at ();
+extern int window_internal_height (), window_internal_width ();
/* defined in frame.c */
extern Lisp_Object Fframep ();
/* defined in emacs.c */
extern Lisp_Object decode_env_path ();
+extern Lisp_Object Vinvocation_name;
+void shut_down_emacs ( /* int signal */ );
/* Nonzero means don't do interactive redisplay and don't change tty modes */
extern int noninteractive;
/* Nonzero means don't do use window-system-specific display code */
/* defined in bytecode.c */
extern Lisp_Object Qbytecode;
+extern Lisp_Object Fbyte_code ();
/* defined in macros.c */
extern Lisp_Object Qexecute_kbd_macro;
extern Lisp_Object Fexecute_kbd_macro ();
+/* defined in undo.c */
+extern Lisp_Object Fundo_boundary ();
+extern Lisp_Object truncate_undo_list ();
+
/* Nonzero means Emacs has already been initialized.
Used during startup to detect startup of dumped Emacs. */
extern int initialized;
extern void debugger ();
-extern char *malloc (), *realloc (), *getenv (), *ctime (), *getwd ();
+extern char *getenv (), *ctime (), *getwd ();
extern long *xmalloc (), *xrealloc ();
+extern void xfree ();
extern char *egetenv ();
+