changeset 1290:9b0ddca4773b

* lisp.h: Conditionally define interval structure and macros. Add DECLARE_INTERVALS to struct Lisp_String.
author Joseph Arceneaux <jla@gnu.org>
date Thu, 01 Oct 1992 01:00:41 +0000
parents 74b26ab86df4
children 7c32612174c3
files src/lisp.h
diffstat 1 files changed, 55 insertions(+), 0 deletions(-) [+]
line wrap: on
line diff
--- a/src/lisp.h	Thu Oct 01 00:56:11 1992 +0000
+++ b/src/lisp.h	Thu Oct 01 01:00:41 1992 +0000
@@ -425,6 +425,60 @@
 #define XSETPROCESS(a, b) XSETPNTR(a, (int) (b))
 #define XSETFLOAT(a, b) XSETPNTR(a, (int) (b))
 
+#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_hungry;	    /* Non-zero means text inserted just
+				       before this interval goes into it. */
+  unsigned char rear_hungry;	    /* 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 */
+
 /* In a cons, the markbit of the car is the gc mark bit */
 
 struct Lisp_Cons
@@ -447,6 +501,7 @@
 struct Lisp_String
   {
     int size;
+    DECLARE_INTERVALS		/* `data' field must be last. */
     unsigned char data[1];
   };