/[emacs]/emacs/src/intervals.h
ViewVC logotype

Diff of /emacs/src/intervals.h

Parent Directory Parent Directory | Revision Log Revision Log | View Patch Patch

revision 1.53 by monnier, Sat May 17 18:54:56 2003 UTC revision 1.54 by monnier, Wed Jul 9 20:25:59 2003 UTC
# Line 23  Boston, MA 02111-1307, USA.  */ Line 23  Boston, MA 02111-1307, USA.  */
23  #define NULL_INTERVAL ((INTERVAL)0)  #define NULL_INTERVAL ((INTERVAL)0)
24  #define INTERVAL_DEFAULT NULL_INTERVAL  #define INTERVAL_DEFAULT NULL_INTERVAL
25    
26    /* Basic data type for use of intervals.  */
27    
28    struct interval
29    {
30      /* The first group of entries deal with the tree structure.  */
31    
32      unsigned EMACS_INT total_length; /* Length of myself and both children.  */
33      unsigned EMACS_INT position;  /* Cache of interval's character position.  */
34                                    /* This field is usually updated
35                                       simultaneously with an interval
36                                       traversal, there is no guarantee
37                                       that it is valid for a random
38                                       interval.  */
39      struct interval *left;        /* Intervals which precede me.  */
40      struct interval *right;       /* Intervals which succeed me.  */
41    
42      /* Parent in the tree, or the Lisp_Object containing this interval tree.  */
43      union
44      {
45        struct interval *interval;
46        Lisp_Object obj;
47      } up;
48      unsigned int up_obj : 1;
49    
50      unsigned gcmarkbit : 1;
51    
52      /* The remaining components are `properties' of the interval.
53         The first four are duplicates for things which can be on the list,
54         for purposes of speed.  */
55    
56      unsigned int write_protect : 1;   /* Non-zero means can't modify.  */
57      unsigned int visible : 1;         /* Zero means don't display.  */
58      unsigned int front_sticky : 1;    /* Non-zero means text inserted just
59                                           before this interval goes into it.  */
60      unsigned int rear_sticky : 1;     /* Likewise for just after it.  */
61    
62      /* Properties of this interval.
63         The mark bit on this field says whether this particular interval
64         tree node has been visited.  Since intervals should never be
65         shared, GC aborts if it seems to have visited an interval twice.  */
66      Lisp_Object plist;
67    };
68    
69  /* These are macros for dealing with the interval tree. */  /* These are macros for dealing with the interval tree. */
70    
71  /* Size of the structure used to represent an interval */  /* Size of the structure used to represent an interval */
# Line 41  Boston, MA 02111-1307, USA.  */ Line 84  Boston, MA 02111-1307, USA.  */
84  #define INT_LISPLIKE(i) (BUFFERP ((Lisp_Object){(EMACS_INT)(i)}) \  #define INT_LISPLIKE(i) (BUFFERP ((Lisp_Object){(EMACS_INT)(i)}) \
85                           || STRINGP ((Lisp_Object){(EMACS_INT)(i)}))                           || STRINGP ((Lisp_Object){(EMACS_INT)(i)}))
86  #endif  #endif
87  #define NULL_INTERVAL_P(i) (CHECK(!INT_LISPLIKE(i),"non-interval"),(i) == NULL_INTERVAL)  #define NULL_INTERVAL_P(i) \
88       (CHECK (!INT_LISPLIKE (i), "non-interval"), (i) == NULL_INTERVAL)
89  /* old #define NULL_INTERVAL_P(i) ((i) == NULL_INTERVAL || INT_LISPLIKE (i)) */  /* old #define NULL_INTERVAL_P(i) ((i) == NULL_INTERVAL || INT_LISPLIKE (i)) */
90    
91  /* True if this interval has no right child. */  /* True if this interval has no right child. */
# Line 111  Boston, MA 02111-1307, USA.  */ Line 155  Boston, MA 02111-1307, USA.  */
155     The choice of macros is dependent on the type needed.  Don't add     The choice of macros is dependent on the type needed.  Don't add
156     casts to get around this, it will break some development work in     casts to get around this, it will break some development work in
157     progress.  */     progress.  */
158  #define SET_INTERVAL_PARENT(i,p) (eassert (!INT_LISPLIKE (p)),(i)->up_obj = 0, (i)->up.interval = (p))  #define SET_INTERVAL_PARENT(i,p) \
159  #define SET_INTERVAL_OBJECT(i,o) (eassert (!INTEGERP (o)), eassert (BUFFERP (o) || STRINGP (o)),(i)->up_obj = 1, (i)->up.obj = (o))     (eassert (!INT_LISPLIKE (p)), (i)->up_obj = 0, (i)->up.interval = (p))
160  #define INTERVAL_PARENT(i) (eassert((i) != 0 && (i)->up_obj == 0),(i)->up.interval)  #define SET_INTERVAL_OBJECT(i,o) \
161       (eassert (BUFFERP (o) || STRINGP (o)), (i)->up_obj = 1, (i)->up.obj = (o))
162    #define INTERVAL_PARENT(i) \
163       (eassert ((i) != 0 && (i)->up_obj == 0),(i)->up.interval)
164  #define GET_INTERVAL_OBJECT(d,s) (eassert((s)->up_obj == 1), (d) = (s)->up.obj)  #define GET_INTERVAL_OBJECT(d,s) (eassert((s)->up_obj == 1), (d) = (s)->up.obj)
165    
166  /* Make the parent of D be whatever the parent of S is, regardless of  /* Make the parent of D be whatever the parent of S is, regardless of
167     type.  This is used when balancing an interval tree.  */     type.  This is used when balancing an interval tree.  */
168  #define COPY_INTERVAL_PARENT(d,s) ((d)->up = (s)->up, (d)->up_obj = (s)->up_obj)  #define COPY_INTERVAL_PARENT(d,s) \
169       ((d)->up = (s)->up, (d)->up_obj = (s)->up_obj)
170    
171  /* Get the parent interval, if any, otherwise a null pointer.  Useful  /* Get the parent interval, if any, otherwise a null pointer.  Useful
172     for walking up to the root in a "for" loop; use this to get the     for walking up to the root in a "for" loop; use this to get the
173     "next" value, and test the result to see if it's NULL_INTERVAL.  */     "next" value, and test the result to see if it's NULL_INTERVAL.  */
174  #define INTERVAL_PARENT_OR_NULL(i) (INTERVAL_HAS_PARENT (i) ? INTERVAL_PARENT (i) : 0)  #define INTERVAL_PARENT_OR_NULL(i) \
175       (INTERVAL_HAS_PARENT (i) ? INTERVAL_PARENT (i) : 0)
176    
177  /* Abort if interval I's size is negative.  */  /* Abort if interval I's size is negative.  */
178  #define CHECK_TOTAL_LENGTH(i) \  #define CHECK_TOTAL_LENGTH(i) \
# Line 304  int add_text_properties_from_list P_ ((L Line 353  int add_text_properties_from_list P_ ((L
353  void extend_property_ranges P_ ((Lisp_Object, Lisp_Object, Lisp_Object));  void extend_property_ranges P_ ((Lisp_Object, Lisp_Object, Lisp_Object));
354  Lisp_Object get_char_property_and_overlay P_ ((Lisp_Object, Lisp_Object,  Lisp_Object get_char_property_and_overlay P_ ((Lisp_Object, Lisp_Object,
355                                                 Lisp_Object, Lisp_Object*));                                                 Lisp_Object, Lisp_Object*));
356  extern int text_property_stickiness P_ ((Lisp_Object prop, Lisp_Object pos, Lisp_Object buffer));  extern int text_property_stickiness P_ ((Lisp_Object prop, Lisp_Object pos,
357  extern Lisp_Object get_pos_property P_ ((Lisp_Object pos, Lisp_Object prop, Lisp_Object object));                                           Lisp_Object buffer));
358    extern Lisp_Object get_pos_property P_ ((Lisp_Object pos, Lisp_Object prop,
359                                             Lisp_Object object));
360    
361  extern void syms_of_textprop ();  extern void syms_of_textprop P_ ((void));
362    
363  #include "composite.h"  #include "composite.h"

Legend:
Removed from v.1.53  
changed lines
  Added in v.1.54

savannah-hackers-public@gnu.org
ViewVC Help
Powered by ViewVC 1.1.26