diff options
| author | Joseph Arceneaux | 1992-09-21 23:57:58 +0000 |
|---|---|---|
| committer | Joseph Arceneaux | 1992-09-21 23:57:58 +0000 |
| commit | 1d1d7ba08ef81c239bca09acf4e8157b2eef1c54 (patch) | |
| tree | 91954f359ba2068a02e5dfd641de3881d6a661ec /src | |
| parent | d7c9f762b50357e9c39e6d0f2ec57ac967c56d7a (diff) | |
| download | emacs-1d1d7ba08ef81c239bca09acf4e8157b2eef1c54.tar.gz emacs-1d1d7ba08ef81c239bca09acf4e8157b2eef1c54.zip | |
comment changes
Diffstat (limited to 'src')
| -rw-r--r-- | src/intervals.c | 37 |
1 files changed, 30 insertions, 7 deletions
diff --git a/src/intervals.c b/src/intervals.c index 0a653748da9..94970e6848b 100644 --- a/src/intervals.c +++ b/src/intervals.c | |||
| @@ -631,7 +631,7 @@ adjust_intervals_for_insertion (tree, position, length) | |||
| 631 | is actually between the two intervals, make the new text belong to | 631 | is actually between the two intervals, make the new text belong to |
| 632 | the interval which is "sticky". | 632 | the interval which is "sticky". |
| 633 | 633 | ||
| 634 | If both intervals are "stick", then make them belong to the left-most | 634 | If both intervals are "sticky", then make them belong to the left-most |
| 635 | interval. Another possibility would be to create a new interval for | 635 | interval. Another possibility would be to create a new interval for |
| 636 | this text, and make it have the merged properties of both ends. */ | 636 | this text, and make it have the merged properties of both ends. */ |
| 637 | 637 | ||
| @@ -839,12 +839,14 @@ delete_interval (i) | |||
| 839 | } | 839 | } |
| 840 | } | 840 | } |
| 841 | 841 | ||
| 842 | /* Recurse down to the interval containing FROM. Then delete as much | 842 | /* Find the interval in TREE corresponding to the character position FROM |
| 843 | as possible (up to AMOUNT) from that interval, adjusting parental | 843 | and delete as much as possible of AMOUNT from that interval, starting |
| 844 | intervals on the way up. If an interval is zeroed out, then | 844 | after the relative position of FROM within it. Return the amount |
| 845 | it is deleted. | 845 | actually deleted, and if the interval was zeroed-out, delete that |
| 846 | interval node from the tree. | ||
| 846 | 847 | ||
| 847 | Returns the amount deleted. */ | 848 | Do this by recursing down TREE to the interval in question, and |
| 849 | deleting the appropriate amount of text. */ | ||
| 848 | 850 | ||
| 849 | static int | 851 | static int |
| 850 | interval_deletion_adjustment (tree, from, amount) | 852 | interval_deletion_adjustment (tree, from, amount) |
| @@ -924,9 +926,15 @@ interval_deletion_adjustment (tree, from, amount) | |||
| 924 | } | 926 | } |
| 925 | } | 927 | } |
| 926 | 928 | ||
| 929 | /* Never reach here */ | ||
| 927 | abort (); | 930 | abort (); |
| 928 | } | 931 | } |
| 929 | 932 | ||
| 933 | /* Effect the adjustments neccessary to the interval tree of BUFFER | ||
| 934 | to correspond to the deletion of LENGTH characters from that buffer | ||
| 935 | text. The deletion is effected at position START (relative to the | ||
| 936 | buffer). */ | ||
| 937 | |||
| 930 | static void | 938 | static void |
| 931 | adjust_intervals_for_deletion (buffer, start, length) | 939 | adjust_intervals_for_deletion (buffer, start, length) |
| 932 | struct buffer *buffer; | 940 | struct buffer *buffer; |
| @@ -966,7 +974,10 @@ adjust_intervals_for_deletion (buffer, start, length) | |||
| 966 | } | 974 | } |
| 967 | } | 975 | } |
| 968 | 976 | ||
| 969 | /* Note that all intervals in OBJECT after START have slid by LENGTH. */ | 977 | /* Make the adjustments neccessary to the interval tree of BUFFER to |
| 978 | represent an addition or deletion of LENGTH characters starting | ||
| 979 | at position START. Addition or deletion is indicated by the sign | ||
| 980 | of LENGTH. */ | ||
| 970 | 981 | ||
| 971 | INLINE void | 982 | INLINE void |
| 972 | offset_intervals (buffer, start, length) | 983 | offset_intervals (buffer, start, length) |
| @@ -982,6 +993,11 @@ offset_intervals (buffer, start, length) | |||
| 982 | adjust_intervals_for_deletion (buffer, start, -length); | 993 | adjust_intervals_for_deletion (buffer, start, -length); |
| 983 | } | 994 | } |
| 984 | 995 | ||
| 996 | /* Make an exact copy of interval tree SOURCE which descends from | ||
| 997 | PARENT. This is done by recursing through SOURCE, copying | ||
| 998 | the current interval and its properties, and then adjusting | ||
| 999 | the pointers of the copy. */ | ||
| 1000 | |||
| 985 | static INTERVAL | 1001 | static INTERVAL |
| 986 | reproduce_tree (source, parent) | 1002 | reproduce_tree (source, parent) |
| 987 | INTERVAL source, parent; | 1003 | INTERVAL source, parent; |
| @@ -999,6 +1015,13 @@ reproduce_tree (source, parent) | |||
| 999 | return t; | 1015 | return t; |
| 1000 | } | 1016 | } |
| 1001 | 1017 | ||
| 1018 | /* Make a new interval of length LENGTH starting at START in the | ||
| 1019 | group of intervals INTERVALS, which is actually an interval tree. | ||
| 1020 | Returns the new interval. | ||
| 1021 | |||
| 1022 | Generate an error if the new positions would overlap an existing | ||
| 1023 | interval. */ | ||
| 1024 | |||
| 1002 | static INTERVAL | 1025 | static INTERVAL |
| 1003 | make_new_interval (intervals, start, length) | 1026 | make_new_interval (intervals, start, length) |
| 1004 | INTERVAL intervals; | 1027 | INTERVAL intervals; |