emacs-diffs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Emacs-diffs] Changes to emacs/src/intervals.h


From: Stefan Monnier
Subject: [Emacs-diffs] Changes to emacs/src/intervals.h
Date: Wed, 09 Jul 2003 16:26:00 -0400

Index: emacs/src/intervals.h
diff -c emacs/src/intervals.h:1.53 emacs/src/intervals.h:1.54
*** emacs/src/intervals.h:1.53  Sat May 17 14:54:56 2003
--- emacs/src/intervals.h       Wed Jul  9 16:25:59 2003
***************
*** 23,28 ****
--- 23,71 ----
  #define NULL_INTERVAL ((INTERVAL)0)
  #define INTERVAL_DEFAULT NULL_INTERVAL
  
+ /* Basic data type for use of intervals.  */
+ 
+ struct interval
+ {
+   /* The first group of entries deal with the tree structure.  */
+ 
+   unsigned EMACS_INT total_length; /* Length of myself and both children.  */
+   unsigned EMACS_INT position;        /* Cache of interval's character 
position.  */
+                               /* This field is usually updated
+                                  simultaneously with an interval
+                                  traversal, there is no guarantee
+                                  that it is valid for a random
+                                  interval.  */
+   struct interval *left;      /* Intervals which precede me.  */
+   struct interval *right;     /* Intervals which succeed me.  */
+ 
+   /* Parent in the tree, or the Lisp_Object containing this interval tree.  */
+   union
+   {
+     struct interval *interval;
+     Lisp_Object obj;
+   } up;
+   unsigned int up_obj : 1;
+ 
+   unsigned gcmarkbit : 1;
+ 
+   /* 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 int write_protect : 1;   /* Non-zero means can't modify.  */
+   unsigned int visible : 1;       /* Zero means don't display.  */
+   unsigned int front_sticky : 1;    /* Non-zero means text inserted just
+                                      before this interval goes into it.  */
+   unsigned int rear_sticky : 1;           /* Likewise for just after it.  */
+ 
+   /* 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;
+ };
+ 
  /* These are macros for dealing with the interval tree. */
  
  /* Size of the structure used to represent an interval */
***************
*** 41,47 ****
  #define INT_LISPLIKE(i) (BUFFERP ((Lisp_Object){(EMACS_INT)(i)}) \
                         || STRINGP ((Lisp_Object){(EMACS_INT)(i)}))
  #endif
! #define NULL_INTERVAL_P(i) (CHECK(!INT_LISPLIKE(i),"non-interval"),(i) == 
NULL_INTERVAL)
  /* old #define NULL_INTERVAL_P(i) ((i) == NULL_INTERVAL || INT_LISPLIKE (i)) 
*/
  
  /* True if this interval has no right child. */
--- 84,91 ----
  #define INT_LISPLIKE(i) (BUFFERP ((Lisp_Object){(EMACS_INT)(i)}) \
                         || STRINGP ((Lisp_Object){(EMACS_INT)(i)}))
  #endif
! #define NULL_INTERVAL_P(i) \
!    (CHECK (!INT_LISPLIKE (i), "non-interval"), (i) == NULL_INTERVAL)
  /* old #define NULL_INTERVAL_P(i) ((i) == NULL_INTERVAL || INT_LISPLIKE (i)) 
*/
  
  /* True if this interval has no right child. */
***************
*** 111,129 ****
     The choice of macros is dependent on the type needed.  Don't add
     casts to get around this, it will break some development work in
     progress.  */
! #define SET_INTERVAL_PARENT(i,p) (eassert (!INT_LISPLIKE (p)),(i)->up_obj = 
0, (i)->up.interval = (p))
! #define SET_INTERVAL_OBJECT(i,o) (eassert (!INTEGERP (o)), eassert (BUFFERP 
(o) || STRINGP (o)),(i)->up_obj = 1, (i)->up.obj = (o))
! #define INTERVAL_PARENT(i) (eassert((i) != 0 && (i)->up_obj == 
0),(i)->up.interval)
  #define GET_INTERVAL_OBJECT(d,s) (eassert((s)->up_obj == 1), (d) = 
(s)->up.obj)
  
  /* Make the parent of D be whatever the parent of S is, regardless of
     type.  This is used when balancing an interval tree.  */
! #define COPY_INTERVAL_PARENT(d,s) ((d)->up = (s)->up, (d)->up_obj = 
(s)->up_obj)
  
  /* Get the parent interval, if any, otherwise a null pointer.  Useful
     for walking up to the root in a "for" loop; use this to get the
     "next" value, and test the result to see if it's NULL_INTERVAL.  */
! #define INTERVAL_PARENT_OR_NULL(i) (INTERVAL_HAS_PARENT (i) ? INTERVAL_PARENT 
(i) : 0)
  
  /* Abort if interval I's size is negative.  */
  #define CHECK_TOTAL_LENGTH(i) \
--- 155,178 ----
     The choice of macros is dependent on the type needed.  Don't add
     casts to get around this, it will break some development work in
     progress.  */
! #define SET_INTERVAL_PARENT(i,p) \
!    (eassert (!INT_LISPLIKE (p)), (i)->up_obj = 0, (i)->up.interval = (p))
! #define SET_INTERVAL_OBJECT(i,o) \
!    (eassert (BUFFERP (o) || STRINGP (o)), (i)->up_obj = 1, (i)->up.obj = (o))
! #define INTERVAL_PARENT(i) \
!    (eassert ((i) != 0 && (i)->up_obj == 0),(i)->up.interval)
  #define GET_INTERVAL_OBJECT(d,s) (eassert((s)->up_obj == 1), (d) = 
(s)->up.obj)
  
  /* Make the parent of D be whatever the parent of S is, regardless of
     type.  This is used when balancing an interval tree.  */
! #define COPY_INTERVAL_PARENT(d,s) \
!    ((d)->up = (s)->up, (d)->up_obj = (s)->up_obj)
  
  /* Get the parent interval, if any, otherwise a null pointer.  Useful
     for walking up to the root in a "for" loop; use this to get the
     "next" value, and test the result to see if it's NULL_INTERVAL.  */
! #define INTERVAL_PARENT_OR_NULL(i) \
!    (INTERVAL_HAS_PARENT (i) ? INTERVAL_PARENT (i) : 0)
  
  /* Abort if interval I's size is negative.  */
  #define CHECK_TOTAL_LENGTH(i) \
***************
*** 304,312 ****
  void extend_property_ranges P_ ((Lisp_Object, Lisp_Object, Lisp_Object));
  Lisp_Object get_char_property_and_overlay P_ ((Lisp_Object, Lisp_Object,
                                               Lisp_Object, Lisp_Object*));
! extern int text_property_stickiness P_ ((Lisp_Object prop, Lisp_Object pos, 
Lisp_Object buffer));
! extern Lisp_Object get_pos_property P_ ((Lisp_Object pos, Lisp_Object prop, 
Lisp_Object object));
  
! extern void syms_of_textprop ();
  
  #include "composite.h"
--- 353,363 ----
  void extend_property_ranges P_ ((Lisp_Object, Lisp_Object, Lisp_Object));
  Lisp_Object get_char_property_and_overlay P_ ((Lisp_Object, Lisp_Object,
                                               Lisp_Object, Lisp_Object*));
! extern int text_property_stickiness P_ ((Lisp_Object prop, Lisp_Object pos,
!                                        Lisp_Object buffer));
! extern Lisp_Object get_pos_property P_ ((Lisp_Object pos, Lisp_Object prop,
!                                        Lisp_Object object));
  
! extern void syms_of_textprop P_ ((void));
  
  #include "composite.h"




reply via email to

[Prev in Thread] Current Thread [Next in Thread]