aboutsummaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorStefan Monnier2003-07-09 20:25:59 +0000
committerStefan Monnier2003-07-09 20:25:59 +0000
commit4a6a76d9e8f5eee86e76ffaaa51b69bda54717b9 (patch)
tree3def30df463b99177ea228e2aa768a4f91e5bdfd /src
parent6663843311af1b55d5be94d28c1fe6ad1b621b85 (diff)
downloademacs-4a6a76d9e8f5eee86e76ffaaa51b69bda54717b9.tar.gz
emacs-4a6a76d9e8f5eee86e76ffaaa51b69bda54717b9.zip
(struct interval): Move from lisp.h.
Diffstat (limited to 'src')
-rw-r--r--src/intervals.h69
1 files changed, 60 insertions, 9 deletions
diff --git a/src/intervals.h b/src/intervals.h
index 63f67ab3ad1..3bd05526ee2 100644
--- a/src/intervals.h
+++ b/src/intervals.h
@@ -23,6 +23,49 @@ Boston, MA 02111-1307, USA. */
23#define NULL_INTERVAL ((INTERVAL)0) 23#define NULL_INTERVAL ((INTERVAL)0)
24#define INTERVAL_DEFAULT NULL_INTERVAL 24#define INTERVAL_DEFAULT NULL_INTERVAL
25 25
26/* Basic data type for use of intervals. */
27
28struct 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
26/* These are macros for dealing with the interval tree. */ 69/* These are macros for dealing with the interval tree. */
27 70
28/* Size of the structure used to represent an interval */ 71/* Size of the structure used to represent an interval */
@@ -41,7 +84,8 @@ Boston, MA 02111-1307, USA. */
41#define INT_LISPLIKE(i) (BUFFERP ((Lisp_Object){(EMACS_INT)(i)}) \ 84#define INT_LISPLIKE(i) (BUFFERP ((Lisp_Object){(EMACS_INT)(i)}) \
42 || STRINGP ((Lisp_Object){(EMACS_INT)(i)})) 85 || STRINGP ((Lisp_Object){(EMACS_INT)(i)}))
43#endif 86#endif
44#define NULL_INTERVAL_P(i) (CHECK(!INT_LISPLIKE(i),"non-interval"),(i) == NULL_INTERVAL) 87#define NULL_INTERVAL_P(i) \
88 (CHECK (!INT_LISPLIKE (i), "non-interval"), (i) == NULL_INTERVAL)
45/* old #define NULL_INTERVAL_P(i) ((i) == NULL_INTERVAL || INT_LISPLIKE (i)) */ 89/* old #define NULL_INTERVAL_P(i) ((i) == NULL_INTERVAL || INT_LISPLIKE (i)) */
46 90
47/* True if this interval has no right child. */ 91/* True if this interval has no right child. */
@@ -111,19 +155,24 @@ Boston, MA 02111-1307, USA. */
111 The choice of macros is dependent on the type needed. Don't add 155 The choice of macros is dependent on the type needed. Don't add
112 casts to get around this, it will break some development work in 156 casts to get around this, it will break some development work in
113 progress. */ 157 progress. */
114#define SET_INTERVAL_PARENT(i,p) (eassert (!INT_LISPLIKE (p)),(i)->up_obj = 0, (i)->up.interval = (p)) 158#define SET_INTERVAL_PARENT(i,p) \
115#define SET_INTERVAL_OBJECT(i,o) (eassert (!INTEGERP (o)), eassert (BUFFERP (o) || STRINGP (o)),(i)->up_obj = 1, (i)->up.obj = (o)) 159 (eassert (!INT_LISPLIKE (p)), (i)->up_obj = 0, (i)->up.interval = (p))
116#define INTERVAL_PARENT(i) (eassert((i) != 0 && (i)->up_obj == 0),(i)->up.interval) 160#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)
117#define GET_INTERVAL_OBJECT(d,s) (eassert((s)->up_obj == 1), (d) = (s)->up.obj) 164#define GET_INTERVAL_OBJECT(d,s) (eassert((s)->up_obj == 1), (d) = (s)->up.obj)
118 165
119/* Make the parent of D be whatever the parent of S is, regardless of 166/* Make the parent of D be whatever the parent of S is, regardless of
120 type. This is used when balancing an interval tree. */ 167 type. This is used when balancing an interval tree. */
121#define COPY_INTERVAL_PARENT(d,s) ((d)->up = (s)->up, (d)->up_obj = (s)->up_obj) 168#define COPY_INTERVAL_PARENT(d,s) \
169 ((d)->up = (s)->up, (d)->up_obj = (s)->up_obj)
122 170
123/* Get the parent interval, if any, otherwise a null pointer. Useful 171/* Get the parent interval, if any, otherwise a null pointer. Useful
124 for walking up to the root in a "for" loop; use this to get the 172 for walking up to the root in a "for" loop; use this to get the
125 "next" value, and test the result to see if it's NULL_INTERVAL. */ 173 "next" value, and test the result to see if it's NULL_INTERVAL. */
126#define INTERVAL_PARENT_OR_NULL(i) (INTERVAL_HAS_PARENT (i) ? INTERVAL_PARENT (i) : 0) 174#define INTERVAL_PARENT_OR_NULL(i) \
175 (INTERVAL_HAS_PARENT (i) ? INTERVAL_PARENT (i) : 0)
127 176
128/* Abort if interval I's size is negative. */ 177/* Abort if interval I's size is negative. */
129#define CHECK_TOTAL_LENGTH(i) \ 178#define CHECK_TOTAL_LENGTH(i) \
@@ -304,9 +353,11 @@ int add_text_properties_from_list P_ ((Lisp_Object, Lisp_Object, Lisp_Object));
304void extend_property_ranges P_ ((Lisp_Object, Lisp_Object, Lisp_Object)); 353void extend_property_ranges P_ ((Lisp_Object, Lisp_Object, Lisp_Object));
305Lisp_Object get_char_property_and_overlay P_ ((Lisp_Object, Lisp_Object, 354Lisp_Object get_char_property_and_overlay P_ ((Lisp_Object, Lisp_Object,
306 Lisp_Object, Lisp_Object*)); 355 Lisp_Object, Lisp_Object*));
307extern int text_property_stickiness P_ ((Lisp_Object prop, Lisp_Object pos, Lisp_Object buffer)); 356extern int text_property_stickiness P_ ((Lisp_Object prop, Lisp_Object pos,
308extern Lisp_Object get_pos_property P_ ((Lisp_Object pos, Lisp_Object prop, Lisp_Object object)); 357 Lisp_Object buffer));
358extern Lisp_Object get_pos_property P_ ((Lisp_Object pos, Lisp_Object prop,
359 Lisp_Object object));
309 360
310extern void syms_of_textprop (); 361extern void syms_of_textprop P_ ((void));
311 362
312#include "composite.h" 363#include "composite.h"