entered into RCS
[bpt/emacs.git] / src / lisp.h
index de0d53f..66b85c7 100644 (file)
@@ -1,5 +1,5 @@
 /* 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.
 
@@ -153,12 +153,19 @@ enum Lisp_Type
     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
@@ -558,7 +565,10 @@ struct Lisp_Float
 
 /* 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:  */
 
@@ -568,10 +578,44 @@ typedef unsigned char UCHAR;
 #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)
@@ -579,10 +623,28 @@ typedef unsigned char UCHAR;
 #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)); }
@@ -616,7 +678,7 @@ typedef unsigned char UCHAR;
   {                                                    \
     if (XTYPE ((x)) != Lisp_Window                     \
        || NILP (XWINDOW ((x))->buffer))                \
-      x = wrong_type_argument (Qlive_window_p, (x));   \
+      x = wrong_type_argument (Qwindow_live_p, (x));   \
   }
 
 #define CHECK_PROCESS(x, i) \
@@ -666,6 +728,9 @@ typedef unsigned char UCHAR;
 #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
@@ -894,16 +959,17 @@ void staticpro();
   
 #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;
@@ -915,6 +981,9 @@ extern Lisp_Object Qinvalid_function, Qwrong_number_of_arguments, Qno_catch;
 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;
@@ -950,13 +1019,19 @@ 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 ();
@@ -989,7 +1064,7 @@ 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 ();
@@ -1011,8 +1086,13 @@ extern Lisp_Object Vobarray, Vstandard_input;
 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;
@@ -1055,11 +1135,12 @@ extern Lisp_Object save_excursion_restore (), save_restriction_restore ();
 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 */
@@ -1117,7 +1198,7 @@ extern Lisp_Object Qdisabled;
 extern Lisp_Object Vhelp_form, Vtop_level;
 extern Lisp_Object Fdiscard_input (), Frecursive_edit ();
 extern Lisp_Object Fcommand_execute (), Finput_pending_p ();
-extern Lisp_Object Qvertical_scrollbar;
+extern Lisp_Object Qvertical_scroll_bar;
 
 /* defined in keymap.c */
 
@@ -1132,12 +1213,13 @@ extern Lisp_Object get_keyelt (), get_keymap();
 extern Lisp_Object Fvertical_motion (), Findent_to (), Fcurrent_column ();
 
 /* defined in window.c */
-extern Lisp_Object Qwindowp, Qlive_window_p;
+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 ();
@@ -1174,6 +1256,8 @@ extern Lisp_Object Frubber_band_rectangle ();
 
 /* 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 */
@@ -1211,7 +1295,9 @@ extern int immediate_quit;            /* Nonzero means ^G can quit instantly */
 
 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 ();