comparison src/intervals.c @ 46370:40db0673e6f0

Most uses of XSTRING combined with STRING_BYTES or indirection changed to SCHARS, SBYTES, STRING_INTERVALS, SREF, SDATA; explicit size_byte references left unchanged for now.
author Ken Raeburn <raeburn@raeburn.org>
date Mon, 15 Jul 2002 00:00:41 +0000
parents d65729232269
children 48b292c584a6
comparison
equal deleted inserted replaced
46369:dd1d3b1d0053 46370:40db0673e6f0
78 BUF_INTERVALS (XBUFFER (parent)) = new; 78 BUF_INTERVALS (XBUFFER (parent)) = new;
79 new->position = 1; 79 new->position = 1;
80 } 80 }
81 else if (STRINGP (parent)) 81 else if (STRINGP (parent))
82 { 82 {
83 new->total_length = XSTRING (parent)->size; 83 new->total_length = SCHARS (parent);
84 XSTRING (parent)->intervals = new; 84 STRING_INTERVALS (parent) = new;
85 new->position = 0; 85 new->position = 0;
86 } 86 }
87 87
88 SET_INTERVAL_OBJECT (new, parent); 88 SET_INTERVAL_OBJECT (new, parent);
89 89
450 if (have_parent) 450 if (have_parent)
451 { 451 {
452 if (BUFFERP (parent)) 452 if (BUFFERP (parent))
453 BUF_INTERVALS (XBUFFER (parent)) = interval; 453 BUF_INTERVALS (XBUFFER (parent)) = interval;
454 else if (STRINGP (parent)) 454 else if (STRINGP (parent))
455 XSTRING (parent)->intervals = interval; 455 STRING_INTERVALS (parent) = interval;
456 } 456 }
457 457
458 return interval; 458 return interval;
459 } 459 }
460 460
1278 SET_INTERVAL_OBJECT (parent, owner); 1278 SET_INTERVAL_OBJECT (parent, owner);
1279 1279
1280 if (BUFFERP (owner)) 1280 if (BUFFERP (owner))
1281 BUF_INTERVALS (XBUFFER (owner)) = parent; 1281 BUF_INTERVALS (XBUFFER (owner)) = parent;
1282 else if (STRINGP (owner)) 1282 else if (STRINGP (owner))
1283 XSTRING (owner)->intervals = parent; 1283 STRING_INTERVALS (owner) = parent;
1284 else 1284 else
1285 abort (); 1285 abort ();
1286 1286
1287 return; 1287 return;
1288 } 1288 }
2245 if (NILP (object)) 2245 if (NILP (object))
2246 i = find_interval (BUF_INTERVALS (current_buffer), pos); 2246 i = find_interval (BUF_INTERVALS (current_buffer), pos);
2247 else if (BUFFERP (object)) 2247 else if (BUFFERP (object))
2248 i = find_interval (BUF_INTERVALS (XBUFFER (object)), pos); 2248 i = find_interval (BUF_INTERVALS (XBUFFER (object)), pos);
2249 else if (STRINGP (object)) 2249 else if (STRINGP (object))
2250 i = find_interval (XSTRING (object)->intervals, pos); 2250 i = find_interval (STRING_INTERVALS (object), pos);
2251 else 2251 else
2252 abort (); 2252 abort ();
2253 2253
2254 if (NULL_INTERVAL_P (i) || (i->position + LENGTH (i) <= pos)) 2254 if (NULL_INTERVAL_P (i) || (i->position + LENGTH (i) <= pos))
2255 return 0; 2255 return 0;
2382 position, length); 2382 position, length);
2383 if (NULL_INTERVAL_P (interval_copy)) 2383 if (NULL_INTERVAL_P (interval_copy))
2384 return; 2384 return;
2385 2385
2386 SET_INTERVAL_OBJECT (interval_copy, string); 2386 SET_INTERVAL_OBJECT (interval_copy, string);
2387 XSTRING (string)->intervals = interval_copy; 2387 STRING_INTERVALS (string) = interval_copy;
2388 } 2388 }
2389 2389
2390 /* Return 1 if strings S1 and S2 have identical properties; 0 otherwise. 2390 /* Return 1 if strings S1 and S2 have identical properties; 0 otherwise.
2391 Assume they have identical characters. */ 2391 Assume they have identical characters. */
2392 2392
2394 compare_string_intervals (s1, s2) 2394 compare_string_intervals (s1, s2)
2395 Lisp_Object s1, s2; 2395 Lisp_Object s1, s2;
2396 { 2396 {
2397 INTERVAL i1, i2; 2397 INTERVAL i1, i2;
2398 int pos = 0; 2398 int pos = 0;
2399 int end = XSTRING (s1)->size; 2399 int end = SCHARS (s1);
2400 2400
2401 i1 = find_interval (XSTRING (s1)->intervals, 0); 2401 i1 = find_interval (STRING_INTERVALS (s1), 0);
2402 i2 = find_interval (XSTRING (s2)->intervals, 0); 2402 i2 = find_interval (STRING_INTERVALS (s2), 0);
2403 2403
2404 while (pos < end) 2404 while (pos < end)
2405 { 2405 {
2406 /* Determine how far we can go before we reach the end of I1 or I2. */ 2406 /* Determine how far we can go before we reach the end of I1 or I2. */
2407 int len1 = (i1 != 0 ? INTERVAL_LAST_POS (i1) : end) - pos; 2407 int len1 = (i1 != 0 ? INTERVAL_LAST_POS (i1) : end) - pos;