*** empty log message ***
[bpt/emacs.git] / src / lisp.h
index 95892c1..e5b0c36 100644 (file)
@@ -38,8 +38,9 @@ enum Lisp_Type
     /* 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. */
@@ -65,35 +66,10 @@ enum Lisp_Type
        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
@@ -102,12 +78,6 @@ enum Lisp_Type
     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).
@@ -147,15 +117,6 @@ enum Lisp_Type
        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,
@@ -176,6 +137,18 @@ enum Lisp_Type
     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 WORDS_BIG_ENDIAN
@@ -316,7 +289,7 @@ you lose
 /* 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)
+#define XFASTINT(a) ((a) + 0)
 #define XSETFASTINT(a, b) ((a) = (b))
 
 /* Extract the value of a Lisp_Object as a signed integer.  */
@@ -400,7 +373,7 @@ extern int pure_size;
 /* 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)
+#define XFASTINT(a) ((a).i + 0)
 #define XSETFASTINT(a, b) ((a).i = (b))
 
 #ifdef EXPLICIT_SIGN_EXTEND
@@ -437,12 +410,15 @@ extern int pure_size;
 #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 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 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)
@@ -451,17 +427,12 @@ extern int pure_size;
 #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 XSETMARKER(a, b) XSET (a, Lisp_Marker, b)
-#define XSETOBJFWD(a, b) XSET (a, Lisp_Objfwd, 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 XSETBOOLFWD(a, b) XSET (a, Lisp_Boolfwd, b)
-#define XSETBUFFER_OBJFWD(a, b) XSET (a, Lisp_Buffer_Objfwd, b)
 #define XSETWINDOW_CONFIGURATION(a, b) XSET (a, Lisp_Window_Configuration, b)
-#define XSETINTERNAL_STREAM(a, b) XSET (a, Lisp_Internal_Stream, b)
-#define XSETINTFWD(a, b) XSET (a, Lisp_Intfwd, b)
-#define XSETINTERNAL(a, b) XSET (a, Lisp_Internal, 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 */
@@ -583,15 +554,70 @@ struct Lisp_Subr
     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
@@ -671,7 +697,7 @@ typedef unsigned char UCHAR;
    pretty quickly.  */
 #define GLYPH unsigned int
 
-#ifdef HAVE_X_WINDOWS
+#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.  */
@@ -688,11 +714,11 @@ typedef unsigned char UCHAR;
                                   : 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
+#else /* not HAVE_FACES */
 #define MAKE_GLYPH(f, char, face) (char)
 #define GLYPH_CHAR(f, g) (g)
 #define GLYPH_FACE(f, g) (g)
-#endif
+#endif /* not HAVE_FACES */
 
 /* The ID of the mode line highlighting face.  */
 #define GLYPH_MODE_LINE_FACE 1
@@ -710,7 +736,7 @@ typedef unsigned char UCHAR;
 
 #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)
@@ -718,7 +744,15 @@ typedef unsigned char UCHAR;
 #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
@@ -727,15 +761,13 @@ typedef unsigned char UCHAR;
 #define FLOATP(x) (0)
 #endif
 #define OVERLAYP(x) (XTYPE ((x)) == Lisp_Overlay)
-#define BOOLFWDP(x) (XTYPE ((x)) == Lisp_Boolfwd)
-#define INTERNALP(x) (XTYPE ((x)) == Lisp_Internal)
-#define INTFWDP(x) (XTYPE ((x)) == Lisp_Intfwd)
-#define OBJFWDP(x) (XTYPE ((x)) == Lisp_Objfwd)
-#define INTERNAL_STREAMP(x) (XTYPE ((x)) == Lisp_Internal_Stream)
 #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 BUFFER_OBJFWDP(x) (XTYPE ((x)) == Lisp_Buffer_Objfwd)
-#define VOIDP(x) (XTYPE ((x)) == Lisp_Void)
+#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))
@@ -1198,7 +1230,7 @@ extern Lisp_Object Fcopy_alist ();
 
 /* 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 ();
@@ -1308,6 +1340,7 @@ 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 ();
+extern Lisp_Object Funhandled_file_name_directory ();
 
 /* Defined in abbrev.c */