80 |
} |
} |
81 |
else if (STRINGP (parent)) |
else if (STRINGP (parent)) |
82 |
{ |
{ |
83 |
new->total_length = XSTRING (parent)->size; |
new->total_length = SCHARS (parent); |
84 |
XSTRING (parent)->intervals = new; |
STRING_SET_INTERVALS (parent, new); |
85 |
new->position = 0; |
new->position = 0; |
86 |
} |
} |
87 |
|
|
347 |
|
|
348 |
/* Assuming that a right child exists, perform the following operation: |
/* Assuming that a right child exists, perform the following operation: |
349 |
|
|
350 |
A B |
A B |
351 |
/ \ / \ |
/ \ / \ |
352 |
B => A |
B => A |
353 |
/ \ / \ |
/ \ / \ |
354 |
c c |
c c |
355 |
*/ |
*/ |
356 |
|
|
452 |
if (BUFFERP (parent)) |
if (BUFFERP (parent)) |
453 |
BUF_INTERVALS (XBUFFER (parent)) = interval; |
BUF_INTERVALS (XBUFFER (parent)) = interval; |
454 |
else if (STRINGP (parent)) |
else if (STRINGP (parent)) |
455 |
XSTRING (parent)->intervals = interval; |
STRING_SET_INTERVALS (parent, interval); |
456 |
} |
} |
457 |
|
|
458 |
return interval; |
return interval; |
524 |
new->total_length = new_length + new->right->total_length; |
new->total_length = new_length + new->right->total_length; |
525 |
balance_an_interval (new); |
balance_an_interval (new); |
526 |
} |
} |
527 |
|
|
528 |
balance_possible_root_interval (interval); |
balance_possible_root_interval (interval); |
529 |
|
|
530 |
return new; |
return new; |
569 |
new->total_length = new_length + new->left->total_length; |
new->total_length = new_length + new->left->total_length; |
570 |
balance_an_interval (new); |
balance_an_interval (new); |
571 |
} |
} |
572 |
|
|
573 |
balance_possible_root_interval (interval); |
balance_possible_root_interval (interval); |
574 |
|
|
575 |
return new; |
return new; |
754 |
if (NULL_INTERVAL_P (i)) |
if (NULL_INTERVAL_P (i)) |
755 |
return NULL_INTERVAL; |
return NULL_INTERVAL; |
756 |
|
|
757 |
while (1) |
while (1) |
758 |
{ |
{ |
759 |
if (pos < i->position) |
if (pos < i->position) |
760 |
{ |
{ |
761 |
/* Move left. */ |
/* Move left. */ |
762 |
if (pos >= i->position - TOTAL_LENGTH (i->left)) |
if (pos >= i->position - TOTAL_LENGTH (i->left)) |
763 |
{ |
{ |
764 |
i->left->position = i->position - TOTAL_LENGTH (i->left) |
i->left->position = i->position - TOTAL_LENGTH (i->left) |
765 |
+ LEFT_TOTAL_LENGTH (i->left); |
+ LEFT_TOTAL_LENGTH (i->left); |
766 |
i = i->left; /* Move to the left child */ |
i = i->left; /* Move to the left child */ |
767 |
} |
} |
768 |
else if (NULL_PARENT (i)) |
else if (NULL_PARENT (i)) |
769 |
error ("Point before start of properties"); |
error ("Point before start of properties"); |
770 |
else |
else |
771 |
i = INTERVAL_PARENT (i); |
i = INTERVAL_PARENT (i); |
772 |
continue; |
continue; |
773 |
} |
} |
774 |
else if (pos >= INTERVAL_LAST_POS (i)) |
else if (pos >= INTERVAL_LAST_POS (i)) |
775 |
{ |
{ |
776 |
/* Move right. */ |
/* Move right. */ |
777 |
if (pos < INTERVAL_LAST_POS (i) + TOTAL_LENGTH (i->right)) |
if (pos < INTERVAL_LAST_POS (i) + TOTAL_LENGTH (i->right)) |
778 |
{ |
{ |
779 |
i->right->position = INTERVAL_LAST_POS (i) + |
i->right->position = INTERVAL_LAST_POS (i) + |
780 |
LEFT_TOTAL_LENGTH (i->right); |
LEFT_TOTAL_LENGTH (i->right); |
781 |
i = i->right; /* Move to the right child */ |
i = i->right; /* Move to the right child */ |
782 |
} |
} |
783 |
else if (NULL_PARENT (i)) |
else if (NULL_PARENT (i)) |
784 |
error ("Point after end of properties"); |
error ("Point after end of properties"); |
785 |
else |
else |
786 |
i = INTERVAL_PARENT (i); |
i = INTERVAL_PARENT (i); |
787 |
continue; |
continue; |
788 |
} |
} |
789 |
else |
else |
790 |
return i; |
return i; |
791 |
} |
} |
792 |
} |
} |
874 |
int eobp = 0; |
int eobp = 0; |
875 |
Lisp_Object parent; |
Lisp_Object parent; |
876 |
int offset; |
int offset; |
877 |
|
|
878 |
if (TOTAL_LENGTH (tree) == 0) /* Paranoia */ |
if (TOTAL_LENGTH (tree) == 0) /* Paranoia */ |
879 |
abort (); |
abort (); |
880 |
|
|
989 |
temp->total_length += length; |
temp->total_length += length; |
990 |
temp = balance_possible_root_interval (temp); |
temp = balance_possible_root_interval (temp); |
991 |
} |
} |
992 |
|
|
993 |
/* If at least one interval has sticky properties, |
/* If at least one interval has sticky properties, |
994 |
we check the stickiness property by property. |
we check the stickiness property by property. |
995 |
|
|
1046 |
temp = balance_possible_root_interval (temp); |
temp = balance_possible_root_interval (temp); |
1047 |
} |
} |
1048 |
} |
} |
1049 |
|
|
1050 |
return tree; |
return tree; |
1051 |
} |
} |
1052 |
|
|
1212 |
|
|
1213 |
cat = textget (props, Qcategory); |
cat = textget (props, Qcategory); |
1214 |
if (! NILP (front) |
if (! NILP (front) |
1215 |
&& |
&& |
1216 |
/* If we have inherited a front-stick category property that is t, |
/* If we have inherited a front-stick category property that is t, |
1217 |
we don't need to set up a detailed one. */ |
we don't need to set up a detailed one. */ |
1218 |
! (! NILP (cat) && SYMBOLP (cat) |
! (! NILP (cat) && SYMBOLP (cat) |
1222 |
} |
} |
1223 |
|
|
1224 |
|
|
1225 |
/* Delete an node I from its interval tree by merging its subtrees |
/* Delete a node I from its interval tree by merging its subtrees |
1226 |
into one subtree which is then returned. Caller is responsible for |
into one subtree which is then returned. Caller is responsible for |
1227 |
storing the resulting subtree into its parent. */ |
storing the resulting subtree into its parent. */ |
1228 |
|
|
1280 |
if (BUFFERP (owner)) |
if (BUFFERP (owner)) |
1281 |
BUF_INTERVALS (XBUFFER (owner)) = parent; |
BUF_INTERVALS (XBUFFER (owner)) = parent; |
1282 |
else if (STRINGP (owner)) |
else if (STRINGP (owner)) |
1283 |
XSTRING (owner)->intervals = parent; |
STRING_SET_INTERVALS (owner, parent); |
1284 |
else |
else |
1285 |
abort (); |
abort (); |
1286 |
|
|
1351 |
else |
else |
1352 |
{ |
{ |
1353 |
/* How much can we delete from this interval? */ |
/* How much can we delete from this interval? */ |
1354 |
int my_amount = ((tree->total_length |
int my_amount = ((tree->total_length |
1355 |
- RIGHT_TOTAL_LENGTH (tree)) |
- RIGHT_TOTAL_LENGTH (tree)) |
1356 |
- relative_position); |
- relative_position); |
1357 |
|
|
1361 |
tree->total_length -= amount; |
tree->total_length -= amount; |
1362 |
if (LENGTH (tree) == 0) |
if (LENGTH (tree) == 0) |
1363 |
delete_interval (tree); |
delete_interval (tree); |
1364 |
|
|
1365 |
return amount; |
return amount; |
1366 |
} |
} |
1367 |
|
|
1780 |
The properties of under are the result of |
The properties of under are the result of |
1781 |
adjust_intervals_for_insertion, so stickiness has |
adjust_intervals_for_insertion, so stickiness has |
1782 |
already been taken care of. */ |
already been taken care of. */ |
1783 |
|
|
1784 |
while (! NULL_INTERVAL_P (over)) |
while (! NULL_INTERVAL_P (over)) |
1785 |
{ |
{ |
1786 |
if (LENGTH (over) < LENGTH (under)) |
if (LENGTH (over) < LENGTH (under)) |
1805 |
|
|
1806 |
/* Get the value of property PROP from PLIST, |
/* Get the value of property PROP from PLIST, |
1807 |
which is the plist of an interval. |
which is the plist of an interval. |
1808 |
We check for direct properties, for categories with property PROP, |
We check for direct properties, for categories with property PROP, |
1809 |
and for PROP appearing on the default-text-properties list. */ |
and for PROP appearing on the default-text-properties list. */ |
1810 |
|
|
1811 |
Lisp_Object |
Lisp_Object |
1813 |
Lisp_Object plist; |
Lisp_Object plist; |
1814 |
register Lisp_Object prop; |
register Lisp_Object prop; |
1815 |
{ |
{ |
1816 |
lookup_char_property (plist, prop, 1); |
return lookup_char_property (plist, prop, 1); |
1817 |
} |
} |
1818 |
|
|
1819 |
Lisp_Object |
Lisp_Object |
1824 |
{ |
{ |
1825 |
register Lisp_Object tail, fallback = Qnil; |
register Lisp_Object tail, fallback = Qnil; |
1826 |
|
|
1827 |
for (tail = plist; !NILP (tail); tail = Fcdr (Fcdr (tail))) |
for (tail = plist; CONSP (tail); tail = Fcdr (XCDR (tail))) |
1828 |
{ |
{ |
1829 |
register Lisp_Object tem; |
register Lisp_Object tem; |
1830 |
tem = Fcar (tail); |
tem = XCAR (tail); |
1831 |
if (EQ (prop, tem)) |
if (EQ (prop, tem)) |
1832 |
return Fcar (Fcdr (tail)); |
return Fcar (XCDR (tail)); |
1833 |
if (EQ (tem, Qcategory)) |
if (EQ (tem, Qcategory)) |
1834 |
{ |
{ |
1835 |
tem = Fcar (Fcdr (tail)); |
tem = Fcar (XCDR (tail)); |
1836 |
if (SYMBOLP (tem)) |
if (SYMBOLP (tem)) |
1837 |
fallback = Fget (tem, prop); |
fallback = Fget (tem, prop); |
1838 |
} |
} |
1845 |
if (NILP (tail)) |
if (NILP (tail)) |
1846 |
return tail; |
return tail; |
1847 |
tail = XCDR (tail); |
tail = XCDR (tail); |
1848 |
for (; NILP (fallback) && !NILP (tail); tail = XCDR (tail)) |
for (; NILP (fallback) && CONSP (tail); tail = XCDR (tail)) |
1849 |
{ |
fallback = Fplist_get (plist, XCAR (tail)); |
|
if (!CONSP (tail)) |
|
|
wrong_type_argument (Qlistp, tail); |
|
|
fallback = Fplist_get (plist, XCAR (tail)); |
|
|
} |
|
1850 |
if (textprop && NILP (fallback) && CONSP (Vdefault_text_properties)) |
if (textprop && NILP (fallback) && CONSP (Vdefault_text_properties)) |
1851 |
fallback = Fplist_get (Vdefault_text_properties, prop); |
fallback = Fplist_get (Vdefault_text_properties, prop); |
1852 |
return fallback; |
return fallback; |
1887 |
BUF_PT (buffer) = charpos; |
BUF_PT (buffer) = charpos; |
1888 |
} |
} |
1889 |
|
|
1890 |
/* Set point in BUFFER to CHARPOS. If the target position is |
/* Set point in BUFFER to CHARPOS. If the target position is |
1891 |
before an intangible character, move to an ok place. */ |
before an intangible character, move to an ok place. */ |
1892 |
|
|
1893 |
void |
void |
1907 |
TEST_OFFS should be either 0 or -1, and ADJ should be either 1 or -1. |
TEST_OFFS should be either 0 or -1, and ADJ should be either 1 or -1. |
1908 |
|
|
1909 |
Note that `stickiness' is determined by overlay marker insertion types, |
Note that `stickiness' is determined by overlay marker insertion types, |
1910 |
if the invisible property comes from an overlay. */ |
if the invisible property comes from an overlay. */ |
1911 |
|
|
1912 |
static int |
static int |
1913 |
adjust_for_invis_intang (pos, test_offs, adj, test_intang) |
adjust_for_invis_intang (pos, test_offs, adj, test_intang) |
1945 |
} |
} |
1946 |
|
|
1947 |
/* Set point in BUFFER to CHARPOS, which corresponds to byte |
/* Set point in BUFFER to CHARPOS, which corresponds to byte |
1948 |
position BYTEPOS. If the target position is |
position BYTEPOS. If the target position is |
1949 |
before an intangible character, move to an ok place. */ |
before an intangible character, move to an ok place. */ |
1950 |
|
|
1951 |
void |
void |
2218 |
|
|
2219 |
} |
} |
2220 |
|
|
2221 |
/* If the whole stretch between PT and POSITION isn't intangible, |
/* If the whole stretch between PT and POSITION isn't intangible, |
2222 |
try moving to POSITION (which means we actually move farther |
try moving to POSITION (which means we actually move farther |
2223 |
if POSITION is inside of intangible text). */ |
if POSITION is inside of intangible text). */ |
2224 |
|
|
2247 |
else if (BUFFERP (object)) |
else if (BUFFERP (object)) |
2248 |
i = find_interval (BUF_INTERVALS (XBUFFER (object)), pos); |
i = find_interval (BUF_INTERVALS (XBUFFER (object)), pos); |
2249 |
else if (STRINGP (object)) |
else if (STRINGP (object)) |
2250 |
i = find_interval (XSTRING (object)->intervals, pos); |
i = find_interval (STRING_INTERVALS (object), pos); |
2251 |
else |
else |
2252 |
abort (); |
abort (); |
2253 |
|
|
2265 |
*start = i->position; |
*start = i->position; |
2266 |
|
|
2267 |
next = next_interval (i); |
next = next_interval (i); |
2268 |
while (! NULL_INTERVAL_P (next) |
while (! NULL_INTERVAL_P (next) |
2269 |
&& EQ (*val, textget (next->plist, prop))) |
&& EQ (*val, textget (next->plist, prop))) |
2270 |
i = next, next = next_interval (next); |
i = next, next = next_interval (next); |
2271 |
*end = i->position + LENGTH (i); |
*end = i->position + LENGTH (i); |
2384 |
return; |
return; |
2385 |
|
|
2386 |
SET_INTERVAL_OBJECT (interval_copy, string); |
SET_INTERVAL_OBJECT (interval_copy, string); |
2387 |
XSTRING (string)->intervals = interval_copy; |
STRING_SET_INTERVALS (string, interval_copy); |
2388 |
} |
} |
2389 |
|
|
2390 |
/* Return 1 if strings S1 and S2 have identical properties; 0 otherwise. |
/* Return 1 if strings S1 and S2 have identical properties; 0 otherwise. |
2396 |
{ |
{ |
2397 |
INTERVAL i1, i2; |
INTERVAL i1, i2; |
2398 |
int pos = 0; |
int pos = 0; |
2399 |
int end = XSTRING (s1)->size; |
int end = SCHARS (s1); |
2400 |
|
|
2401 |
i1 = find_interval (XSTRING (s1)->intervals, 0); |
i1 = find_interval (STRING_INTERVALS (s1), 0); |
2402 |
i2 = find_interval (XSTRING (s2)->intervals, 0); |
i2 = find_interval (STRING_INTERVALS (s2), 0); |
2403 |
|
|
2404 |
while (pos < end) |
while (pos < end) |
2405 |
{ |
{ |