*** empty log message ***
[bpt/emacs.git] / src / lisp.h
index 8efdd8d..c6816f2 100644 (file)
@@ -447,8 +447,18 @@ struct interval
   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. */
+
+  /* Parent in the tree, or the Lisp_Object containing this interval tree.
+
+     The mark bit on the root interval of an interval tree says
+     whether we have started (and possibly finished) marking the
+     tree.  If GC comes across an interval tree whose root's parent
+     field has its markbit set, it leaves the tree alone.
+
+     You'd think we could store this information in the parent object
+     somewhere (after all, that should be visited once and then
+     ignored too, right?), but strings are GC'd strangely.  */
+  struct interval *parent;
 
   /* The remaining components are `properties' of the interval.
      The first four are duplicates for things which can be on the list,
@@ -460,7 +470,11 @@ struct interval
                                       before this interval goes into it. */
   unsigned char rear_sticky;       /* Likewise for just after it. */
 
-  Lisp_Object plist;               /* Properties of this interval. */
+  /* Properties of this interval.
+     The mark bit on this field says whether this particular interval
+     tree node has been visited.  Since intervals should never be
+     shared, GC aborts if it seems to have visited an interval twice.  */
+  Lisp_Object plist;
 };
 
 typedef struct interval *INTERVAL;
@@ -474,7 +488,7 @@ typedef struct interval *INTERVAL;
    structures.  See, e.g., struct Lisp_String below. */
 #define DECLARE_INTERVALS INTERVAL intervals;
 
-/* Macro used to condionally compile interval initialization into
+/* Macro used to conditionally compile interval initialization into
    certain code.  See, e.g., alloc.c. */
 #define INITIALIZE_INTERVAL(ptr,val) ptr->intervals = val
 
@@ -647,25 +661,25 @@ typedef unsigned char UCHAR;
 #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)); }
+  do { if ((XTYPE ((x)) != Lisp_Cons) && !NILP (x)) x = wrong_type_argument (Qlistp, (x)); } while (0)
 
 #define CHECK_STRING(x, i) \
-  { if (XTYPE ((x)) != Lisp_String) x = wrong_type_argument (Qstringp, (x)); }
+  do { if (XTYPE ((x)) != Lisp_String) x = wrong_type_argument (Qstringp, (x)); } while (0)
 
 #define CHECK_CONS(x, i) \
-  { if (XTYPE ((x)) != Lisp_Cons) x = wrong_type_argument (Qconsp, (x)); }
+  do { if (XTYPE ((x)) != Lisp_Cons) x = wrong_type_argument (Qconsp, (x)); } while (0)
 
 #define CHECK_SYMBOL(x, i) \
-  { if (XTYPE ((x)) != Lisp_Symbol) x = wrong_type_argument (Qsymbolp, (x)); }
+  do { if (XTYPE ((x)) != Lisp_Symbol) x = wrong_type_argument (Qsymbolp, (x)); } while (0)
 
 #define CHECK_VECTOR(x, i) \
-  { if (XTYPE ((x)) != Lisp_Vector) x = wrong_type_argument (Qvectorp, (x)); }
+  do { if (XTYPE ((x)) != Lisp_Vector) x = wrong_type_argument (Qvectorp, (x)); } while (0)
 
 #define CHECK_BUFFER(x, i) \
-  { if (XTYPE ((x)) != Lisp_Buffer) x = wrong_type_argument (Qbufferp, (x)); }
+  do { if (XTYPE ((x)) != Lisp_Buffer) x = wrong_type_argument (Qbufferp, (x)); } while (0)
 
 #define CHECK_WINDOW(x, i) \
-  { if (XTYPE ((x)) != Lisp_Window) x = wrong_type_argument (Qwindowp, (x)); }
+  do { if (XTYPE ((x)) != Lisp_Window) 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 
@@ -675,28 +689,28 @@ typedef unsigned char UCHAR;
    vchild, and hchild members are all nil.  */
 
 #define CHECK_LIVE_WINDOW(x, i)                                \
-  {                                                    \
+  do {                                                 \
     if (XTYPE ((x)) != Lisp_Window                     \
        || NILP (XWINDOW ((x))->buffer))                \
       x = wrong_type_argument (Qwindow_live_p, (x));   \
-  }
+  } while (0)
 
 #define CHECK_PROCESS(x, i) \
-  { if (XTYPE ((x)) != Lisp_Process) x = wrong_type_argument (Qprocessp, (x)); }
+  do { if (XTYPE ((x)) != Lisp_Process) x = wrong_type_argument (Qprocessp, (x)); } while (0)
 
 #define CHECK_NUMBER(x, i) \
-  { if (XTYPE ((x)) != Lisp_Int) x = wrong_type_argument (Qintegerp, (x)); }
+  do { if (XTYPE ((x)) != Lisp_Int) x = wrong_type_argument (Qintegerp, (x)); } while (0)
 
 #define CHECK_NATNUM(x, i) \
-  { if (XTYPE ((x)) != Lisp_Int || XINT ((x)) < 0)     \
-      x = wrong_type_argument (Qnatnump, (x)); }
+  do { if (XTYPE ((x)) != Lisp_Int || XINT ((x)) < 0)  \
+      x = wrong_type_argument (Qnatnump, (x)); } while (0)
 
 #define CHECK_MARKER(x, i) \
-  { if (XTYPE ((x)) != Lisp_Marker) x = wrong_type_argument (Qmarkerp, (x)); }
+  do { if (XTYPE ((x)) != Lisp_Marker) x = wrong_type_argument (Qmarkerp, (x)); } while (0)
 
 #define CHECK_NUMBER_COERCE_MARKER(x, i) \
-  { 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)); }
+  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)
 
 #ifdef LISP_FLOAT_TYPE
 
@@ -707,17 +721,17 @@ typedef unsigned char UCHAR;
 #define XFLOATINT(n) extract_float((n))
 
 #define CHECK_FLOAT(x, i)              \
-{ if (XTYPE (x) != Lisp_Float) \
-    x = wrong_type_argument (Qfloatp, (x)); }
+  do { if (XTYPE (x) != Lisp_Float)    \
+    x = wrong_type_argument (Qfloatp, (x)); } while (0)
 
 #define CHECK_NUMBER_OR_FLOAT(x, i)    \
-{ if (XTYPE (x) != Lisp_Float && XTYPE (x) != Lisp_Int)        \
-    x = wrong_type_argument (Qnumberp, (x)); }
+  do { if (XTYPE (x) != Lisp_Float && XTYPE (x) != Lisp_Int)   \
+    x = wrong_type_argument (Qnumberp, (x)); } while (0)
 
 #define CHECK_NUMBER_OR_FLOAT_COERCE_MARKER(x, i) \
-{ if (XTYPE (x) == Lisp_Marker) XFASTINT (x) = marker_position (x);    \
+  do { if (XTYPE (x) == Lisp_Marker) XFASTINT (x) = marker_position (x);       \
   else if (XTYPE (x) != Lisp_Int && XTYPE (x) != Lisp_Float)           \
-    x = wrong_type_argument (Qnumber_or_marker_p, (x)); }
+    x = wrong_type_argument (Qnumber_or_marker_p, (x)); } while (0)
 
 #else  /* Not LISP_FLOAT_TYPE */
 
@@ -729,7 +743,7 @@ typedef unsigned char UCHAR;
 #endif /* LISP_FLOAT_TYPE */
 
 #define CHECK_OVERLAY(x, i) \
-  { if (XTYPE ((x)) != Lisp_Overlay) x = wrong_type_argument (Qoverlayp, (x));}
+  do { if (XTYPE ((x)) != Lisp_Overlay) x = wrong_type_argument (Qoverlayp, (x));} while (0)
 
 /* Cast pointers to this type to compare them.  Some machines want int.  */
 #ifndef PNTR_COMPARISON_TYPE
@@ -980,6 +994,7 @@ extern Lisp_Object Qsetting_constant, Qinvalid_read_syntax;
 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 Qmark_inactive;
 
 extern Lisp_Object Qrange_error, Qdomain_error, Qsingularity_error;
 extern Lisp_Object Qoverflow_error, Qunderflow_error;
@@ -1135,7 +1150,7 @@ 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 ();
@@ -1256,8 +1271,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 */ );
+extern Lisp_Object Vinvocation_name, Vinvocation_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;
 /* Nonzero means don't do use window-system-specific display code */
@@ -1287,6 +1302,10 @@ extern Lisp_Object Fexecute_kbd_macro ();
 extern Lisp_Object Fundo_boundary ();
 extern Lisp_Object truncate_undo_list ();
 
+/* defined in textprop.c */
+extern Lisp_Object Qmodification_hooks;
+extern Lisp_Object Qinsert_in_front_hooks, Qinsert_behind_hooks;
+
 /* Nonzero means Emacs has already been initialized.
    Used during startup to detect startup of dumped Emacs.  */
 extern int initialized;
@@ -1295,7 +1314,6 @@ extern int immediate_quit;            /* Nonzero means ^G can quit instantly */
 
 extern void debugger ();
 
-extern void *malloc (), *realloc ();
 extern char *getenv (), *ctime (), *getwd ();
 extern long *xmalloc (), *xrealloc ();
 extern void xfree ();