comparison src/extents.c @ 171:929b76928fce r20-3b12

Import from CVS: tag r20-3b12
author cvs
date Mon, 13 Aug 2007 09:47:52 +0200
parents cca96a509cfe
children 8eaf7971accc
comparison
equal deleted inserted replaced
170:98a42ee61975 171:929b76928fce
2977 2977
2978 tail = extent_plist_slot (anc); 2978 tail = extent_plist_slot (anc);
2979 2979
2980 for (; !NILP (tail); tail = Fcdr (Fcdr (tail))) 2980 for (; !NILP (tail); tail = Fcdr (Fcdr (tail)))
2981 { 2981 {
2982 struct Lisp_String *k = XSYMBOL (XCAR (tail))->name; 2982 struct Lisp_String *k;
2983 Lisp_Object v = XCAR (XCDR (tail)); 2983 Lisp_Object v = XCAR (XCDR (tail));
2984 if (NILP (v)) continue; 2984 if (NILP (v)) continue;
2985 if (!SYMBOLP (XCAR (tail)))
2986 {
2987 /* ### Fix this! */
2988 strcpy (bp, "non-symbol ");
2989 bp += 11;
2990 continue;
2991 }
2992 k = XSYMBOL (XCAR (tail))->name;
2985 memcpy (bp, (char *) string_data (k), string_length (k)); 2993 memcpy (bp, (char *) string_data (k), string_length (k));
2986 bp += string_length (k); 2994 bp += string_length (k);
2987 *bp++ = ' '; 2995 *bp++ = ' ';
2988 } 2996 }
2989 2997
4047 4055
4048 me_flags = decode_map_extents_flags (flags); 4056 me_flags = decode_map_extents_flags (flags);
4049 4057
4050 if (!NILP (property)) 4058 if (!NILP (property))
4051 { 4059 {
4052 CHECK_SYMBOL (property);
4053 if (!NILP (value)) 4060 if (!NILP (value))
4054 value = canonicalize_extent_property (property, value); 4061 value = canonicalize_extent_property (property, value);
4055 } 4062 }
4056 4063
4057 GCPRO5 (function, maparg, object, property, value); 4064 GCPRO5 (function, maparg, object, property, value);
4192 4199
4193 me_flags = decode_map_extents_flags (flags); 4200 me_flags = decode_map_extents_flags (flags);
4194 4201
4195 if (!NILP (property)) 4202 if (!NILP (property))
4196 { 4203 {
4197 CHECK_SYMBOL (property);
4198 if (!NILP (value)) 4204 if (!NILP (value))
4199 value = canonicalize_extent_property (property, value); 4205 value = canonicalize_extent_property (property, value);
4200 } 4206 }
4201 4207
4202 GCPRO5 (function, maparg, object, property, value); 4208 GCPRO5 (function, maparg, object, property, value);
4386 EXTENT before_extent; 4392 EXTENT before_extent;
4387 enum extent_at_flag fl; 4393 enum extent_at_flag fl;
4388 4394
4389 object = decode_buffer_or_string (object); 4395 object = decode_buffer_or_string (object);
4390 position = get_buffer_or_string_pos_byte (object, pos, GB_NO_ERROR_IF_BAD); 4396 position = get_buffer_or_string_pos_byte (object, pos, GB_NO_ERROR_IF_BAD);
4391 CHECK_SYMBOL (property);
4392 if (NILP (before)) 4397 if (NILP (before))
4393 before_extent = 0; 4398 before_extent = 0;
4394 else 4399 else
4395 before_extent = decode_extent (before, DE_MUST_BE_ATTACHED); 4400 before_extent = decode_extent (before, DE_MUST_BE_ATTACHED);
4396 if (before_extent && !EQ (object, extent_object (before_extent))) 4401 if (before_extent && !EQ (object, extent_object (before_extent)))
5159 */ 5164 */
5160 (extent, property, value)) 5165 (extent, property, value))
5161 { 5166 {
5162 /* This function can GC if property is `keymap' */ 5167 /* This function can GC if property is `keymap' */
5163 EXTENT e = decode_extent (extent, 0); 5168 EXTENT e = decode_extent (extent, 0);
5164 CHECK_SYMBOL (property);
5165 5169
5166 if (EQ (property, Qread_only)) 5170 if (EQ (property, Qread_only))
5167 set_extent_read_only (e, value); 5171 set_extent_read_only (e, value);
5168 else if (EQ (property, Qunique)) 5172 else if (EQ (property, Qunique))
5169 extent_unique_p (e) = !NILP (value); 5173 extent_unique_p (e) = !NILP (value);
5241 See `set-extent-property' for the built-in property names. 5245 See `set-extent-property' for the built-in property names.
5242 */ 5246 */
5243 (extent, property, defalt)) 5247 (extent, property, defalt))
5244 { 5248 {
5245 EXTENT e = decode_extent (extent, 0); 5249 EXTENT e = decode_extent (extent, 0);
5246 CHECK_SYMBOL (property);
5247 5250
5248 if (EQ (property, Qdetached)) 5251 if (EQ (property, Qdetached))
5249 return (extent_detached_p (e) ? Qt : Qnil); 5252 return (extent_detached_p (e) ? Qt : Qnil);
5250 else if (EQ (property, Qdestroyed)) 5253 else if (EQ (property, Qdestroyed))
5251 return (!EXTENT_LIVE_P (e) ? Qt : Qnil); 5254 return (!EXTENT_LIVE_P (e) ? Qt : Qnil);
5858 Bytind position; 5861 Bytind position;
5859 int invert = 0; 5862 int invert = 0;
5860 5863
5861 object = decode_buffer_or_string (object); 5864 object = decode_buffer_or_string (object);
5862 position = get_buffer_or_string_pos_byte (object, pos, GB_NO_ERROR_IF_BAD); 5865 position = get_buffer_or_string_pos_byte (object, pos, GB_NO_ERROR_IF_BAD);
5863 CHECK_SYMBOL (prop);
5864 5866
5865 /* We canonicalize the start/end-open/closed properties to the 5867 /* We canonicalize the start/end-open/closed properties to the
5866 non-default version -- "adding" the default property really 5868 non-default version -- "adding" the default property really
5867 needs to remove the non-default one. See below for more 5869 needs to remove the non-default one. See below for more
5868 on this. */ 5870 on this. */
6242 /* This function can GC */ 6244 /* This function can GC */
6243 Bytind s, e; 6245 Bytind s, e;
6244 6246
6245 object = decode_buffer_or_string (object); 6247 object = decode_buffer_or_string (object);
6246 get_buffer_or_string_range_byte (object, start, end, &s, &e, 0); 6248 get_buffer_or_string_range_byte (object, start, end, &s, &e, 0);
6247 CHECK_SYMBOL (prop);
6248 put_text_prop (s, e, object, prop, value, 1); 6249 put_text_prop (s, e, object, prop, value, 1);
6249 return prop; 6250 return prop;
6250 } 6251 }
6251 6252
6252 DEFUN ("put-nonduplicable-text-property", 6253 DEFUN ("put-nonduplicable-text-property",
6263 /* This function can GC */ 6264 /* This function can GC */
6264 Bytind s, e; 6265 Bytind s, e;
6265 6266
6266 object = decode_buffer_or_string (object); 6267 object = decode_buffer_or_string (object);
6267 get_buffer_or_string_range_byte (object, start, end, &s, &e, 0); 6268 get_buffer_or_string_range_byte (object, start, end, &s, &e, 0);
6268 CHECK_SYMBOL (prop);
6269 put_text_prop (s, e, object, prop, value, 0); 6269 put_text_prop (s, e, object, prop, value, 0);
6270 return prop; 6270 return prop;
6271 } 6271 }
6272 6272
6273 DEFUN ("add-text-properties", Fadd_text_properties, 3, 4, 0, /* 6273 DEFUN ("add-text-properties", Fadd_text_properties, 3, 4, 0, /*
6288 CHECK_LIST (props); 6288 CHECK_LIST (props);
6289 for (; !NILP (props); props = Fcdr (Fcdr (props))) 6289 for (; !NILP (props); props = Fcdr (Fcdr (props)))
6290 { 6290 {
6291 Lisp_Object prop = XCAR (props); 6291 Lisp_Object prop = XCAR (props);
6292 Lisp_Object value = Fcar (XCDR (props)); 6292 Lisp_Object value = Fcar (XCDR (props));
6293 CHECK_SYMBOL (prop);
6294 changed |= put_text_prop (s, e, object, prop, value, 1); 6293 changed |= put_text_prop (s, e, object, prop, value, 1);
6295 } 6294 }
6296 return (changed ? Qt : Qnil); 6295 return (changed ? Qt : Qnil);
6297 } 6296 }
6298 6297
6317 CHECK_LIST (props); 6316 CHECK_LIST (props);
6318 for (; !NILP (props); props = Fcdr (Fcdr (props))) 6317 for (; !NILP (props); props = Fcdr (Fcdr (props)))
6319 { 6318 {
6320 Lisp_Object prop = XCAR (props); 6319 Lisp_Object prop = XCAR (props);
6321 Lisp_Object value = Fcar (XCDR (props)); 6320 Lisp_Object value = Fcar (XCDR (props));
6322 CHECK_SYMBOL (prop);
6323 changed |= put_text_prop (s, e, object, prop, value, 0); 6321 changed |= put_text_prop (s, e, object, prop, value, 0);
6324 } 6322 }
6325 return (changed ? Qt : Qnil); 6323 return (changed ? Qt : Qnil);
6326 } 6324 }
6327 6325
6342 get_buffer_or_string_range_byte (object, start, end, &s, &e, 0); 6340 get_buffer_or_string_range_byte (object, start, end, &s, &e, 0);
6343 CHECK_LIST (props); 6341 CHECK_LIST (props);
6344 for (; !NILP (props); props = Fcdr (Fcdr (props))) 6342 for (; !NILP (props); props = Fcdr (Fcdr (props)))
6345 { 6343 {
6346 Lisp_Object prop = XCAR (props); 6344 Lisp_Object prop = XCAR (props);
6347 CHECK_SYMBOL (prop);
6348 changed |= put_text_prop (s, e, object, prop, Qnil, 1); 6345 changed |= put_text_prop (s, e, object, prop, Qnil, 1);
6349 } 6346 }
6350 return (changed ? Qt : Qnil); 6347 return (changed ? Qt : Qnil);
6351 } 6348 }
6352 6349
6426 else 6423 else
6427 { 6424 {
6428 blim = get_buffer_or_string_pos_char (object, limit, 0); 6425 blim = get_buffer_or_string_pos_char (object, limit, 0);
6429 limit_was_nil = 0; 6426 limit_was_nil = 0;
6430 } 6427 }
6431 CHECK_SYMBOL (prop);
6432 6428
6433 extent = Fextent_at (make_int (bpos), object, prop, Qnil, Qnil); 6429 extent = Fextent_at (make_int (bpos), object, prop, Qnil, Qnil);
6434 if (!NILP (extent)) 6430 if (!NILP (extent))
6435 value = Fextent_property (extent, prop, Qnil); 6431 value = Fextent_property (extent, prop, Qnil);
6436 else 6432 else
6494 else 6490 else
6495 { 6491 {
6496 blim = get_buffer_or_string_pos_char (object, limit, 0); 6492 blim = get_buffer_or_string_pos_char (object, limit, 0);
6497 limit_was_nil = 0; 6493 limit_was_nil = 0;
6498 } 6494 }
6499
6500 CHECK_SYMBOL (prop);
6501 6495
6502 /* extent-at refers to the character AFTER bpos, but we want the 6496 /* extent-at refers to the character AFTER bpos, but we want the
6503 character before bpos. Thus the - 1. extent-at simply 6497 character before bpos. Thus the - 1. extent-at simply
6504 returns nil on bogus positions, so not to worry. */ 6498 returns nil on bogus positions, so not to worry. */
6505 extent = Fextent_at (make_int (bpos - 1), object, prop, Qnil, Qnil); 6499 extent = Fextent_at (make_int (bpos - 1), object, prop, Qnil, Qnil);