Mercurial > hg > xemacs-beta
comparison src/extents.h @ 272:c5d627a313b1 r21-0b34
Import from CVS: tag r21-0b34
author | cvs |
---|---|
date | Mon, 13 Aug 2007 10:28:48 +0200 |
parents | d44af0c54775 |
children | 6240c7796c7a |
comparison
equal
deleted
inserted
replaced
271:c7b7086b0a39 | 272:c5d627a313b1 |
---|---|
29 #define EXTENTP(x) RECORDP (x, extent) | 29 #define EXTENTP(x) RECORDP (x, extent) |
30 #define GC_EXTENTP(x) GC_RECORDP (x, extent) | 30 #define GC_EXTENTP(x) GC_RECORDP (x, extent) |
31 #define CHECK_EXTENT(x) CHECK_RECORD (x, extent) | 31 #define CHECK_EXTENT(x) CHECK_RECORD (x, extent) |
32 #define CONCHECK_EXTENT(x) CONCHECK_RECORD (x, extent) | 32 #define CONCHECK_EXTENT(x) CONCHECK_RECORD (x, extent) |
33 | 33 |
34 /* the layouts for glyphs (extent->flags.glyph_layout). Must fit in 2 bits. */ | |
35 typedef enum glyph_layout | |
36 { | |
37 GL_TEXT, | |
38 GL_OUTSIDE_MARGIN, | |
39 GL_INSIDE_MARGIN, | |
40 GL_WHITESPACE | |
41 } glyph_layout; | |
42 | |
34 struct extent | 43 struct extent |
35 { | 44 { |
36 struct lrecord_header lheader; | 45 struct lrecord_header lheader; |
37 | 46 |
38 Memind start; | 47 Memind start; |
39 Memind end; | 48 Memind end; |
40 Lisp_Object object; /* A buffer, string, Qnil (extent detached from no | 49 Lisp_Object object; /* A buffer, string, Qnil (extent detached from no |
41 buffer), Qt (destroyed extent) */ | 50 buffer), Qt (destroyed extent) */ |
42 | 51 |
43 /* Extent properties are conceptually a plist, but the most common | 52 /* Extent properties are conceptually a plist, but the most common |
44 props are implemented as bits instead of conses. | 53 props are implemented as bits instead of conses. */ |
45 */ | |
46 struct | 54 struct |
47 { | 55 { |
48 Lisp_Object face; | 56 Lisp_Object face; |
49 | 57 |
50 /* These flags are simply an optimization for common boolean properties | 58 /* These flags are simply an optimization for common boolean properties |
51 which go onto the extent's property list. Any of them would work if | 59 which go onto the extent's property list. Any of them would work if |
52 done in the normal way, but the space savings of doing these in this | 60 done in the normal way, but the space savings of doing these in this |
53 way is significant. Note that if you add a flag, there are numerous | 61 way is significant. Note that if you add a flag, there are numerous |
54 places in extents.c that need to know about it. | 62 places in extents.c that need to know about it. |
55 | 63 |
56 Another consideration is that some of these properties are accessed | 64 Another consideration is that some of these properties are accessed |
57 during redisplay, so it's good for access to them to be fast (a bit | 65 during redisplay, so it's good for access to them to be fast (a bit |
58 reference instead of a search down a plist). | 66 reference instead of a search down a plist). |
59 | 67 |
60 `begin_glyph_layout' and `end_glyph_layout' are unusual in | 68 `begin_glyph_layout' and `end_glyph_layout' are unusual in that |
61 that they have 4 states instead of 2. | 69 they have 4 states instead of 2. |
62 | 70 |
63 Other special extent properties are stored in an auxiliary | 71 Other special extent properties are stored in an auxiliary |
64 structure that sits at the beginning of the plist. The has_aux | 72 structure that sits at the beginning of the plist. The has_aux |
65 flag indicates whether this structure exists. The has_parent | 73 flag indicates whether this structure exists. The has_parent |
66 flag is an optimization indicating whether the extent has a parent | 74 flag is an optimization indicating whether the extent has a parent |
67 (this could also be determined by looking in the aux structure). */ | 75 (this could also be determined by looking in the aux structure). */ |
68 | 76 |
69 unsigned int begin_glyph_layout :2; /* 2 text, margins, or whitespace */ | 77 enum_field (glyph_layout) begin_glyph_layout :2; |
70 unsigned int end_glyph_layout :2; /* 4 text, margins, or whitespace */ | 78 /* 2 text, margins, or whitespace */ |
71 unsigned int has_parent : 1; /* 5 extent has a parent */ | 79 enum_field (glyph_layout) end_glyph_layout :2; |
72 unsigned int has_aux : 1; /* 6 extent has an aux. structure */ | 80 /* 4 text, margins, or whitespace */ |
73 unsigned int start_open : 1; /* 7 insertion behavior at start */ | 81 unsigned int has_parent :1; /* 5 extent has a parent */ |
74 unsigned int end_open : 1; /* 8 insertion behavior at end */ | 82 unsigned int has_aux :1; /* 6 extent has an aux. structure */ |
75 unsigned int unused9 : 1; /* 9 unused */ | 83 unsigned int start_open :1; /* 7 insertion behavior at start */ |
76 unsigned int unique : 1; /* 10 there may be only one attached */ | 84 unsigned int end_open :1; /* 8 insertion behavior at end */ |
77 unsigned int duplicable : 1; /* 11 copied to strings by kill/undo */ | 85 unsigned int unused9 :1; /* 9 unused */ |
78 unsigned int REPLICATING : 1; /* 12 invoke old extent-replica behav.*/ | 86 unsigned int unique :1; /* 10 there may be only one attached */ |
79 /* Not used any more */ | 87 unsigned int duplicable :1; /* 11 copied to strings by kill/undo */ |
80 unsigned int detachable : 1; /* 13 extent detaches if text deleted */ | 88 unsigned int REPLICATING :1; /* 12 invoke old extent-replica behav.*/ |
81 unsigned int internal : 1; /* 14 used by map-extents etc. */ | 89 /* Not used any more */ |
82 unsigned int in_red_event : 1; /* 15 An event has been spawned for | 90 unsigned int detachable :1; /* 13 extent detaches if text deleted */ |
83 initial redisplay. Not exported to | 91 unsigned int internal :1; /* 14 used by map-extents etc. */ |
84 the lisp level */ | 92 unsigned int in_red_event :1; /* 15 An event has been spawned for |
85 unsigned int unused16 : 1; /* 16 unused */ | 93 initial redisplay. |
86 /* --- Adding more flags will cause the extent struct grow by another | 94 Not exported to the lisp level */ |
87 word. It's not clear that this would make a difference, however, | 95 unsigned int unused16 :1; /* 16 unused */ |
88 because on 32-bit machines things tend to get allocated in chunks | 96 /* --- Adding more flags will cause the extent struct to grow by another |
89 of 4 bytes. */ | 97 word. It's not clear that this would make a difference, however, |
90 } flags; | 98 because on 32-bit machines things tend to get allocated in chunks |
99 of 4 bytes. */ | |
100 } flags; | |
91 /* The plist may have an auxiliary structure as its first element */ | 101 /* The plist may have an auxiliary structure as its first element */ |
92 Lisp_Object plist; | 102 Lisp_Object plist; |
93 }; | 103 }; |
94 | 104 |
95 /* Basic properties of an extent (not affected by the extent's parent) */ | 105 /* Basic properties of an extent (not affected by the extent's parent) */ |
100 #define set_extent_end(e, val) ((e)->end = (val)) | 110 #define set_extent_end(e, val) ((e)->end = (val)) |
101 #define extent_endpoint(e, endp) ((endp) ? extent_end (e) : extent_start (e)) | 111 #define extent_endpoint(e, endp) ((endp) ? extent_end (e) : extent_start (e)) |
102 #define set_extent_endpoint(e, val, endp) \ | 112 #define set_extent_endpoint(e, val, endp) \ |
103 ((endp) ? set_extent_end (e, val) : set_extent_start (e, val)) | 113 ((endp) ? set_extent_end (e, val) : set_extent_start (e, val)) |
104 #define extent_detached_p(e) (extent_start (e) < 0) | 114 #define extent_detached_p(e) (extent_start (e) < 0) |
105 | |
106 /* the layouts for glyphs (extent->flags.glyph_layout). Must fit in 2 bits. */ | |
107 #define GL_TEXT 0 | |
108 #define GL_OUTSIDE_MARGIN 1 | |
109 #define GL_INSIDE_MARGIN 2 | |
110 #define GL_WHITESPACE 3 | |
111 | 115 |
112 /* Additional information that may be present in an extent. The idea is | 116 /* Additional information that may be present in an extent. The idea is |
113 that fast access is provided to this information, but since (hopefully) | 117 that fast access is provided to this information, but since (hopefully) |
114 most extents won't have this set on them, we usually don't need to | 118 most extents won't have this set on them, we usually don't need to |
115 have this structure around and thus the size of an extent is smaller. */ | 119 have this structure around and thus the size of an extent is smaller. */ |
156 struct extent_list *extents; | 160 struct extent_list *extents; |
157 struct stack_of_extents *soe; | 161 struct stack_of_extents *soe; |
158 }; | 162 }; |
159 | 163 |
160 DECLARE_LRECORD (extent_info, struct extent_info); | 164 DECLARE_LRECORD (extent_info, struct extent_info); |
161 #define XEXTENT_INFO(x) \ | 165 #define XEXTENT_INFO(x) XRECORD (x, extent_info, struct extent_info) |
162 XRECORD (x, extent_info, struct extent_info) | |
163 #define XSETEXTENT_INFO(x, p) XSETRECORD (x, p, extent_info) | 166 #define XSETEXTENT_INFO(x, p) XSETRECORD (x, p, extent_info) |
164 #define EXTENT_INFOP(x) RECORDP (x, extent_info) | 167 #define EXTENT_INFOP(x) RECORDP (x, extent_info) |
165 #define GC_EXTENT_INFOP(x) GC_RECORDP (x, extent_info) | 168 #define GC_EXTENT_INFOP(x) GC_RECORDP (x, extent_info) |
166 #define CHECK_EXTENT_INFO(x) CHECK_RECORD (x, extent_info) | 169 #define CHECK_EXTENT_INFO(x) CHECK_RECORD (x, extent_info) |
167 #define CONCHECK_EXTENT_INFO(x) CONCHECK_RECORD (x, extent_info) | 170 #define CONCHECK_EXTENT_INFO(x) CONCHECK_RECORD (x, extent_info) |
168 | 171 |
169 void flush_cached_extent_info (Lisp_Object extent_info); | 172 void flush_cached_extent_info (Lisp_Object extent_info); |
170 | 173 |
171 /* Note that we take pains in all the macros below never to evaluate | 174 /* A "normal" field is one that is stored in the `struct flags' structure |
172 the extent argument more than once. This may not be necessary | |
173 but is much less likely to introduce subtle bugs. */ | |
174 | |
175 MAC_DECLARE_EXTERN (EXTENT, MTancestor_extent) | |
176 MAC_DECLARE_EXTERN (EXTENT, MTaux_extent) | |
177 MAC_DECLARE_EXTERN (EXTENT, MTplist_extent) | |
178 MAC_DECLARE_EXTERN (EXTENT, MTensure_extent) | |
179 MAC_DECLARE_EXTERN (EXTENT, MTset_extent) | |
180 | |
181 /* extent_ancestor() chases all the parent links until there aren't any | |
182 more. extent_ancestor_1() does the same thing but it a function; | |
183 the following macro optimizes the most common case. */ | |
184 | |
185 #define extent_ancestor(e) \ | |
186 MAC_BEGIN \ | |
187 MAC_DECLARE (EXTENT, MTancestor_extent, e) \ | |
188 (MTancestor_extent->flags.has_parent ? \ | |
189 extent_ancestor_1 (MTancestor_extent) : \ | |
190 MTancestor_extent) \ | |
191 MAC_END | |
192 | |
193 /* a "normal" field is one that is stored in the `struct flags' structure | |
194 in an extent. an "aux" field is one that is stored in the extent's | 175 in an extent. an "aux" field is one that is stored in the extent's |
195 auxiliary structure. | 176 auxiliary structure. |
196 | 177 |
197 The functions below that have `extent_no_chase' in their name operate | 178 The functions below that have `extent_no_chase' in their name operate |
198 on an extent directly (ignoring its parent), and should normally | 179 on an extent directly (ignoring its parent), and should normally |
199 only be used on extents known not to have a parent. The other | 180 only be used on extents known not to have a parent. The other |
200 versions chase down any parent links. */ | 181 versions chase down any parent links. */ |
201 | 182 |
202 #define extent_no_chase_normal_field(e, field) ((e)->flags.field) | 183 #define extent_no_chase_normal_field(e, field) ((e)->flags.field) |
203 | 184 |
204 #define extent_no_chase_aux_field(e, field) \ | 185 INLINE struct extent_auxiliary *extent_aux_or_default (EXTENT e); |
205 MAC_BEGIN \ | 186 INLINE struct extent_auxiliary * |
206 MAC_DECLARE (EXTENT, MTaux_extent, e) \ | 187 extent_aux_or_default (EXTENT e) |
207 (MTaux_extent->flags.has_aux ? \ | 188 { |
208 XEXTENT_AUXILIARY (XCONS (MTaux_extent->plist)->car)->field \ | 189 return e->flags.has_aux ? |
209 : extent_auxiliary_defaults.field) \ | 190 XEXTENT_AUXILIARY (XCAR (e->plist)) : |
210 MAC_END | 191 & extent_auxiliary_defaults; |
192 } | |
193 | |
194 #define extent_no_chase_aux_field(e, field) (extent_aux_or_default(e)->field) | |
211 | 195 |
212 #define extent_normal_field(e, field) \ | 196 #define extent_normal_field(e, field) \ |
213 extent_no_chase_normal_field (extent_ancestor (e), field) | 197 extent_no_chase_normal_field (extent_ancestor (e), field) |
214 | 198 |
215 #define extent_aux_field(e, field) \ | 199 #define extent_aux_field(e, field) \ |
216 extent_no_chase_aux_field (extent_ancestor (e), field) | 200 extent_no_chase_aux_field (extent_ancestor (e), field) |
217 | 201 |
218 #define ensure_extent_has_auxiliary(e) \ | 202 #define set_extent_no_chase_aux_field(e, field, value) do { \ |
219 MAC_BEGIN \ | 203 EXTENT sencaf_e = (e); \ |
220 MAC_DECLARE (EXTENT, MTensure_extent, e) \ | 204 if (! sencaf_e->flags.has_aux) \ |
221 (MTensure_extent->flags.has_aux ? (void) 0 : \ | 205 allocate_extent_auxiliary (sencaf_e); \ |
222 allocate_extent_auxiliary (MTensure_extent)) \ | 206 XEXTENT_AUXILIARY (XCAR (sencaf_e->plist))->field = (value);\ |
223 MAC_END | 207 } while (0) |
224 | |
225 #define set_extent_no_chase_aux_field(e, field, value) \ | |
226 MAC_BEGIN \ | |
227 MAC_DECLARE (EXTENT, MTset_extent, e) \ | |
228 ensure_extent_has_auxiliary (MTset_extent) \ | |
229 MAC_SEP \ | |
230 XEXTENT_AUXILIARY (XCONS (MTset_extent->plist)->car)->field = \ | |
231 (value) \ | |
232 MAC_END | |
233 | 208 |
234 #define set_extent_no_chase_normal_field(e, field, value) \ | 209 #define set_extent_no_chase_normal_field(e, field, value) \ |
235 extent_no_chase_normal_field (e, field) = (value) | 210 extent_no_chase_normal_field (e, field) = (value) |
236 | 211 |
237 #define set_extent_aux_field(e, field, value) \ | 212 #define set_extent_aux_field(e, field, value) \ |
238 set_extent_no_chase_aux_field (extent_ancestor (e), field, value) | 213 set_extent_no_chase_aux_field (extent_ancestor (e), field, value) |
239 | 214 |
240 #define set_extent_normal_field(e, field, value) \ | 215 #define set_extent_normal_field(e, field, value) \ |
241 set_extent_ancestor_normal_field (extent_no_chase (e), field, value) | 216 set_extent_ancestor_normal_field (extent_no_chase (e), field, value) |
242 | 217 |
243 /* The `parent' and `children' fields are not affected by any | 218 /* The `parent' and `children' fields are not affected by any |
244 parent links. We don't provide any settors for these fields | 219 parent links. We don't provide any settors for these fields |
245 because they need special handling and it's cleaner just to | 220 because they need special handling and it's cleaner just to |
254 #define extent_invisible(e) extent_aux_field (e, invisible) | 229 #define extent_invisible(e) extent_aux_field (e, invisible) |
255 #define extent_read_only(e) extent_aux_field (e, read_only) | 230 #define extent_read_only(e) extent_aux_field (e, read_only) |
256 #define extent_mouse_face(e) extent_aux_field (e, mouse_face) | 231 #define extent_mouse_face(e) extent_aux_field (e, mouse_face) |
257 #define extent_initial_redisplay_function(e) extent_aux_field (e, initial_redisplay_function) | 232 #define extent_initial_redisplay_function(e) extent_aux_field (e, initial_redisplay_function) |
258 | 233 |
259 #define set_extent_begin_glyph(e, value) \ | 234 #define set_extent_begin_glyph(e, value) \ |
260 set_extent_aux_field (e, begin_glyph, value) | 235 set_extent_aux_field (e, begin_glyph, value) |
261 #define set_extent_end_glyph(e, value) \ | 236 #define set_extent_end_glyph(e, value) \ |
262 set_extent_aux_field (e, end_glyph, value) | 237 set_extent_aux_field (e, end_glyph, value) |
263 #define set_extent_priority(e, value) \ | 238 #define set_extent_priority(e, value) \ |
264 set_extent_aux_field (e, priority, value) | 239 set_extent_aux_field (e, priority, value) |
265 #define set_extent_invisible_1(e, value) \ | 240 #define set_extent_invisible_1(e, value) \ |
266 set_extent_aux_field (e, invisible, value) | 241 set_extent_aux_field (e, invisible, value) |
267 #define set_extent_read_only(e, value) \ | 242 #define set_extent_read_only(e, value) \ |
268 set_extent_aux_field (e, read_only, value) | 243 set_extent_aux_field (e, read_only, value) |
269 #define set_extent_mouse_face(e, value) \ | 244 #define set_extent_mouse_face(e, value) \ |
270 set_extent_aux_field (e, mouse_face, value) | 245 set_extent_aux_field (e, mouse_face, value) |
271 /* Use Fset_extent_initial_redisplay_function unless you know what you are ding */ | 246 /* Use Fset_extent_initial_redisplay_function unless you know what you're doing */ |
272 #define set_extent_initial_redisplay_function(e, value) \ | 247 #define set_extent_initial_redisplay_function(e, value) \ |
273 set_extent_aux_field (e, initial_redisplay_function, value) | 248 set_extent_aux_field (e, initial_redisplay_function, value) |
274 | 249 |
275 #define extent_face(e) extent_normal_field (e, face) | 250 #define extent_face(e) extent_normal_field (e, face) |
276 #define extent_begin_glyph_layout(e) \ | 251 #define extent_begin_glyph_layout(e) extent_normal_field (e, begin_glyph_layout) |
277 extent_normal_field (e, begin_glyph_layout) | 252 #define extent_end_glyph_layout(e) extent_normal_field (e, end_glyph_layout) |
278 #define extent_end_glyph_layout(e) extent_normal_field (e, end_glyph_layout) | 253 #define extent_start_open_p(e) extent_normal_field (e, start_open) |
279 #define extent_start_open_p(e) extent_normal_field (e, start_open) | 254 #define extent_end_open_p(e) extent_normal_field (e, end_open) |
280 #define extent_end_open_p(e) extent_normal_field (e, end_open) | 255 #define extent_unique_p(e) extent_normal_field (e, unique) |
281 #define extent_unique_p(e) extent_normal_field (e, unique) | 256 #define extent_duplicable_p(e) extent_normal_field (e, duplicable) |
282 #define extent_duplicable_p(e) extent_normal_field (e, duplicable) | 257 #define extent_detachable_p(e) extent_normal_field (e, detachable) |
283 #define extent_detachable_p(e) extent_normal_field (e, detachable) | 258 #define extent_internal_p(e) extent_normal_field (e, internal) |
284 #define extent_internal_p(e) extent_normal_field (e, internal) | 259 #define extent_in_red_event_p(e) extent_normal_field (e, in_red_event) |
285 #define extent_in_red_event_p(e) extent_normal_field (e, in_red_event) | 260 |
286 | 261 INLINE Lisp_Object * extent_no_chase_plist_addr (EXTENT e); |
287 #define extent_no_chase_plist_addr(e) \ | 262 INLINE Lisp_Object * |
288 MAC_BEGIN \ | 263 extent_no_chase_plist_addr (EXTENT e) |
289 MAC_DECLARE (EXTENT, MTplist_extent, e) \ | 264 { |
290 (MTplist_extent->flags.has_aux ? \ | 265 return e->flags.has_aux ? &XCDR (e->plist) : &e->plist; |
291 &XCONS (MTplist_extent->plist)->cdr : \ | 266 } |
292 &MTplist_extent->plist) \ | 267 |
293 MAC_END | |
294 #define extent_no_chase_plist(e) (*extent_no_chase_plist_addr (e)) | 268 #define extent_no_chase_plist(e) (*extent_no_chase_plist_addr (e)) |
295 | 269 |
296 #define extent_plist_addr(e) extent_no_chase_plist_addr (extent_ancestor (e)) | 270 #define extent_plist_addr(e) extent_no_chase_plist_addr (extent_ancestor (e)) |
297 #define extent_plist_slot(e) extent_no_chase_plist (extent_ancestor (e)) | 271 #define extent_plist_slot(e) extent_no_chase_plist (extent_ancestor (e)) |
298 | 272 |
320 ME_MIGHT_MODIFY_EXTENTS | ME_MIGHT_MOVE_SOE) | 294 ME_MIGHT_MODIFY_EXTENTS | ME_MIGHT_MOVE_SOE) |
321 | 295 |
322 | 296 |
323 #define EXTENT_LIVE_P(e) (!EQ (extent_object (e), Qt)) | 297 #define EXTENT_LIVE_P(e) (!EQ (extent_object (e), Qt)) |
324 | 298 |
325 #define CHECK_LIVE_EXTENT(x) \ | 299 #define CHECK_LIVE_EXTENT(x) do { \ |
326 do { CHECK_EXTENT (x); \ | 300 CHECK_EXTENT (x); \ |
327 if (!EXTENT_LIVE_P (XEXTENT (x))) \ | 301 if (!EXTENT_LIVE_P (XEXTENT (x))) \ |
328 dead_wrong_type_argument (Qextent_live_p, (x)); } while (0) | 302 dead_wrong_type_argument (Qextent_live_p, (x)); \ |
329 #define CONCHECK_LIVE_EXTENT(x) \ | 303 } while (0) |
330 do { CONCHECK_EXTENT (x); \ | 304 #define CONCHECK_LIVE_EXTENT(x) do { \ |
331 if (!EXTENT_LIVE_P (XEXTENT (x))) \ | 305 CONCHECK_EXTENT (x); \ |
332 x = wrong_type_argument (Qextent_live_p, (x)); } while (0) | 306 if (!EXTENT_LIVE_P (XEXTENT (x))) \ |
333 | 307 x = wrong_type_argument (Qextent_live_p, (x)); \ |
334 extern Lisp_Object Qextent_live_p; | 308 } while (0) |
309 | |
310 EXFUN (Fdetach_extent, 1); | |
311 EXFUN (Fextent_end_position, 1); | |
312 EXFUN (Fextent_object, 1); | |
313 EXFUN (Fextent_start_position, 1); | |
314 EXFUN (Fmake_extent, 3); | |
315 EXFUN (Fprevious_single_property_change, 4); | |
316 EXFUN (Fset_extent_endpoints, 4); | |
317 EXFUN (Fset_extent_parent, 2); | |
335 | 318 |
336 extern int inside_undo; | 319 extern int inside_undo; |
337 | 320 |
338 struct extent_fragment *extent_fragment_new (Lisp_Object buffer_or_string, | 321 struct extent_fragment *extent_fragment_new (Lisp_Object buffer_or_string, |
339 struct frame *frm); | 322 struct frame *frm); |
341 struct extent_fragment *ef, | 324 struct extent_fragment *ef, |
342 /* Note this is in Bytinds */ | 325 /* Note this is in Bytinds */ |
343 Bytind pos); | 326 Bytind pos); |
344 void extent_fragment_delete (struct extent_fragment *ef); | 327 void extent_fragment_delete (struct extent_fragment *ef); |
345 | 328 |
346 extern Lisp_Object Vlast_highlighted_extent; | |
347 | |
348 | 329 |
349 #ifdef emacs /* things other than emacs want the structs */ | 330 #ifdef emacs /* things other than emacs want the structs */ |
350 | 331 |
351 /* from alloc.c */ | 332 /* from alloc.c */ |
352 struct extent *allocate_extent (void); | 333 struct extent *allocate_extent (void); |
353 | 334 |
354 /* from extents.c */ | 335 /* from extents.c */ |
355 EXTENT extent_ancestor_1 (EXTENT e); | 336 EXTENT extent_ancestor_1 (EXTENT e); |
337 | |
338 /* extent_ancestor() chases all the parent links until there aren't any | |
339 more. extent_ancestor_1() does the same thing but it a function; | |
340 the following optimizes the most common case. */ | |
341 INLINE EXTENT extent_ancestor (EXTENT e); | |
342 INLINE EXTENT | |
343 extent_ancestor (EXTENT e) | |
344 { | |
345 return e->flags.has_parent ? extent_ancestor_1 (e) : e; | |
346 } | |
347 | |
356 void allocate_extent_auxiliary (EXTENT ext); | 348 void allocate_extent_auxiliary (EXTENT ext); |
357 void init_buffer_extents (struct buffer *b); | 349 void init_buffer_extents (struct buffer *b); |
358 void uninit_buffer_extents (struct buffer *b); | 350 void uninit_buffer_extents (struct buffer *b); |
359 void map_extents (Bufpos from, Bufpos to, int (*fn) (EXTENT extent, | 351 typedef int (*map_extents_fun) (EXTENT extent, void *arg); |
360 void * arg), | 352 void map_extents (Bufpos from, Bufpos to, map_extents_fun fn, |
361 void *arg, Lisp_Object obj, EXTENT after, | 353 void *arg, Lisp_Object obj, EXTENT after, |
362 unsigned int flags); | 354 unsigned int flags); |
363 | 355 |
364 /* Note the following five functions are NOT in Bufpos's */ | 356 /* Note the following five functions are NOT in Bufpos's */ |
365 void adjust_extents (Lisp_Object object, Memind from, | 357 void adjust_extents (Lisp_Object object, Memind from, |
374 Bytind opoint, Bytecount length); | 366 Bytind opoint, Bytecount length); |
375 void process_extents_for_deletion (Lisp_Object object, Bytind from, | 367 void process_extents_for_deletion (Lisp_Object object, Bytind from, |
376 Bytind to, int destroy_them); | 368 Bytind to, int destroy_them); |
377 | 369 |
378 void set_extent_glyph (EXTENT extent, Lisp_Object glyph, int endp, | 370 void set_extent_glyph (EXTENT extent, Lisp_Object glyph, int endp, |
379 unsigned int layout); | 371 glyph_layout layout); |
380 | 372 |
381 void add_string_extents (Lisp_Object string, struct buffer *buf, | 373 void add_string_extents (Lisp_Object string, struct buffer *buf, |
382 Bytind opoint, Bytecount length); | 374 Bytind opoint, Bytecount length); |
383 void splice_in_string_extents (Lisp_Object string, struct buffer *buf, | 375 void splice_in_string_extents (Lisp_Object string, struct buffer *buf, |
384 Bytind opoint, Bytecount length, | 376 Bytind opoint, Bytecount length, |