aboutsummaryrefslogtreecommitdiffstats
path: root/src/intervals.c
diff options
context:
space:
mode:
authorTom Tromey2012-09-04 10:10:06 -0600
committerTom Tromey2012-09-04 10:10:06 -0600
commitbf69f522a9e135f9aa483cedd53e71e915f2bf75 (patch)
tree3f73c47fb863ef87f420de1d30858da821072bd9 /src/intervals.c
parent303324a9232dbc89369faceb6b3530740d0fc1bd (diff)
parent6ec9a5a7b5efb129807f567709ca858211ed7840 (diff)
downloademacs-bf69f522a9e135f9aa483cedd53e71e915f2bf75.tar.gz
emacs-bf69f522a9e135f9aa483cedd53e71e915f2bf75.zip
merge from trunk
Diffstat (limited to 'src/intervals.c')
-rw-r--r--src/intervals.c58
1 files changed, 28 insertions, 30 deletions
diff --git a/src/intervals.c b/src/intervals.c
index 0a85e20e5d9..49d61b2f9b0 100644
--- a/src/intervals.c
+++ b/src/intervals.c
@@ -178,14 +178,13 @@ merge_properties (register INTERVAL source, register INTERVAL target)
178 } 178 }
179} 179}
180 180
181/* Return 1 if the two intervals have the same properties, 181/* Return true if the two intervals have the same properties. */
182 0 otherwise. */
183 182
184int 183bool
185intervals_equal (INTERVAL i0, INTERVAL i1) 184intervals_equal (INTERVAL i0, INTERVAL i1)
186{ 185{
187 register Lisp_Object i0_cdr, i0_sym; 186 Lisp_Object i0_cdr, i0_sym;
188 register Lisp_Object i1_cdr, i1_val; 187 Lisp_Object i1_cdr, i1_val;
189 188
190 if (DEFAULT_INTERVAL_P (i0) && DEFAULT_INTERVAL_P (i1)) 189 if (DEFAULT_INTERVAL_P (i0) && DEFAULT_INTERVAL_P (i1))
191 return 1; 190 return 1;
@@ -469,10 +468,10 @@ balance_an_interval (INTERVAL i)
469 Lisp Object. */ 468 Lisp Object. */
470 469
471static inline INTERVAL 470static inline INTERVAL
472balance_possible_root_interval (register INTERVAL interval) 471balance_possible_root_interval (INTERVAL interval)
473{ 472{
474 Lisp_Object parent; 473 Lisp_Object parent;
475 int have_parent = 0; 474 bool have_parent = 0;
476 475
477 if (!INTERVAL_HAS_OBJECT (interval) && !INTERVAL_HAS_PARENT (interval)) 476 if (!INTERVAL_HAS_OBJECT (interval) && !INTERVAL_HAS_PARENT (interval))
478 return interval; 477 return interval;
@@ -845,9 +844,9 @@ static INTERVAL
845adjust_intervals_for_insertion (INTERVAL tree, 844adjust_intervals_for_insertion (INTERVAL tree,
846 ptrdiff_t position, ptrdiff_t length) 845 ptrdiff_t position, ptrdiff_t length)
847{ 846{
848 register INTERVAL i; 847 INTERVAL i;
849 register INTERVAL temp; 848 INTERVAL temp;
850 int eobp = 0; 849 bool eobp = 0;
851 Lisp_Object parent; 850 Lisp_Object parent;
852 ptrdiff_t offset; 851 ptrdiff_t offset;
853 852
@@ -1068,11 +1067,10 @@ FR 8 9 A B
1068static Lisp_Object 1067static Lisp_Object
1069merge_properties_sticky (Lisp_Object pleft, Lisp_Object pright) 1068merge_properties_sticky (Lisp_Object pleft, Lisp_Object pright)
1070{ 1069{
1071 register Lisp_Object props, front, rear; 1070 Lisp_Object props, front, rear;
1072 Lisp_Object lfront, lrear, rfront, rrear; 1071 Lisp_Object lfront, lrear, rfront, rrear;
1073 register Lisp_Object tail1, tail2, sym, lval, rval, cat; 1072 Lisp_Object tail1, tail2, sym, lval, rval, cat;
1074 int use_left, use_right; 1073 bool use_left, use_right, lpresent;
1075 int lpresent;
1076 1074
1077 props = Qnil; 1075 props = Qnil;
1078 front = Qnil; 1076 front = Qnil;
@@ -1610,7 +1608,7 @@ reproduce_tree_obj (INTERVAL source, Lisp_Object parent)
1610void 1608void
1611graft_intervals_into_buffer (INTERVAL source, ptrdiff_t position, 1609graft_intervals_into_buffer (INTERVAL source, ptrdiff_t position,
1612 ptrdiff_t length, struct buffer *buffer, 1610 ptrdiff_t length, struct buffer *buffer,
1613 int inherit) 1611 bool inherit)
1614{ 1612{
1615 INTERVAL tree = buffer_intervals (buffer); 1613 INTERVAL tree = buffer_intervals (buffer);
1616 INTERVAL under, over, this; 1614 INTERVAL under, over, this;
@@ -1753,9 +1751,9 @@ textget (Lisp_Object plist, register Lisp_Object prop)
1753} 1751}
1754 1752
1755Lisp_Object 1753Lisp_Object
1756lookup_char_property (Lisp_Object plist, register Lisp_Object prop, int textprop) 1754lookup_char_property (Lisp_Object plist, Lisp_Object prop, bool textprop)
1757{ 1755{
1758 register Lisp_Object tail, fallback = Qnil; 1756 Lisp_Object tail, fallback = Qnil;
1759 1757
1760 for (tail = plist; CONSP (tail); tail = Fcdr (XCDR (tail))) 1758 for (tail = plist; CONSP (tail); tail = Fcdr (XCDR (tail)))
1761 { 1759 {
@@ -1826,8 +1824,8 @@ set_point (ptrdiff_t charpos)
1826/* If there's an invisible character at position POS + TEST_OFFS in the 1824/* If there's an invisible character at position POS + TEST_OFFS in the
1827 current buffer, and the invisible property has a `stickiness' such that 1825 current buffer, and the invisible property has a `stickiness' such that
1828 inserting a character at position POS would inherit the property it, 1826 inserting a character at position POS would inherit the property it,
1829 return POS + ADJ, otherwise return POS. If TEST_INTANG is non-zero, 1827 return POS + ADJ, otherwise return POS. If TEST_INTANG, intangibility
1830 then intangibility is required as well as invisibility. 1828 is required as well as invisibility.
1831 1829
1832 TEST_OFFS should be either 0 or -1, and ADJ should be either 1 or -1. 1830 TEST_OFFS should be either 0 or -1, and ADJ should be either 1 or -1.
1833 1831
@@ -1836,7 +1834,7 @@ set_point (ptrdiff_t charpos)
1836 1834
1837static ptrdiff_t 1835static ptrdiff_t
1838adjust_for_invis_intang (ptrdiff_t pos, ptrdiff_t test_offs, ptrdiff_t adj, 1836adjust_for_invis_intang (ptrdiff_t pos, ptrdiff_t test_offs, ptrdiff_t adj,
1839 int test_intang) 1837 bool test_intang)
1840{ 1838{
1841 Lisp_Object invis_propval, invis_overlay; 1839 Lisp_Object invis_propval, invis_overlay;
1842 Lisp_Object test_pos; 1840 Lisp_Object test_pos;
@@ -1883,8 +1881,8 @@ set_point_both (ptrdiff_t charpos, ptrdiff_t bytepos)
1883 initial position is the same as the destination, in the rare 1881 initial position is the same as the destination, in the rare
1884 instances where this is important, e.g. in line-move-finish 1882 instances where this is important, e.g. in line-move-finish
1885 (simple.el). */ 1883 (simple.el). */
1886 int backwards = (charpos < old_position ? 1 : 0); 1884 bool backwards = charpos < old_position;
1887 int have_overlays; 1885 bool have_overlays;
1888 ptrdiff_t original_position; 1886 ptrdiff_t original_position;
1889 1887
1890 bset_point_before_scroll (current_buffer, Qnil); 1888 bset_point_before_scroll (current_buffer, Qnil);
@@ -2154,12 +2152,12 @@ move_if_not_intangible (ptrdiff_t position)
2154 2152
2155/* If text at position POS has property PROP, set *VAL to the property 2153/* If text at position POS has property PROP, set *VAL to the property
2156 value, *START and *END to the beginning and end of a region that 2154 value, *START and *END to the beginning and end of a region that
2157 has the same property, and return 1. Otherwise return 0. 2155 has the same property, and return true. Otherwise return false.
2158 2156
2159 OBJECT is the string or buffer to look for the property in; 2157 OBJECT is the string or buffer to look for the property in;
2160 nil means the current buffer. */ 2158 nil means the current buffer. */
2161 2159
2162int 2160bool
2163get_property_and_range (ptrdiff_t pos, Lisp_Object prop, Lisp_Object *val, 2161get_property_and_range (ptrdiff_t pos, Lisp_Object prop, Lisp_Object *val,
2164 ptrdiff_t *start, ptrdiff_t *end, Lisp_Object object) 2162 ptrdiff_t *start, ptrdiff_t *end, Lisp_Object object)
2165{ 2163{
@@ -2306,10 +2304,10 @@ copy_intervals_to_string (Lisp_Object string, struct buffer *buffer,
2306 set_string_intervals (string, interval_copy); 2304 set_string_intervals (string, interval_copy);
2307} 2305}
2308 2306
2309/* Return 1 if strings S1 and S2 have identical properties; 0 otherwise. 2307/* Return true if strings S1 and S2 have identical properties.
2310 Assume they have identical characters. */ 2308 Assume they have identical characters. */
2311 2309
2312int 2310bool
2313compare_string_intervals (Lisp_Object s1, Lisp_Object s2) 2311compare_string_intervals (Lisp_Object s1, Lisp_Object s2)
2314{ 2312{
2315 INTERVAL i1, i2; 2313 INTERVAL i1, i2;
@@ -2348,7 +2346,7 @@ compare_string_intervals (Lisp_Object s1, Lisp_Object s2)
2348 START_BYTE ... END_BYTE in bytes. */ 2346 START_BYTE ... END_BYTE in bytes. */
2349 2347
2350static void 2348static void
2351set_intervals_multibyte_1 (INTERVAL i, int multi_flag, 2349set_intervals_multibyte_1 (INTERVAL i, bool multi_flag,
2352 ptrdiff_t start, ptrdiff_t start_byte, 2350 ptrdiff_t start, ptrdiff_t start_byte,
2353 ptrdiff_t end, ptrdiff_t end_byte) 2351 ptrdiff_t end, ptrdiff_t end_byte)
2354{ 2352{
@@ -2456,11 +2454,11 @@ set_intervals_multibyte_1 (INTERVAL i, int multi_flag,
2456} 2454}
2457 2455
2458/* Update the intervals of the current buffer 2456/* Update the intervals of the current buffer
2459 to fit the contents as multibyte (if MULTI_FLAG is 1) 2457 to fit the contents as multibyte (if MULTI_FLAG)
2460 or to fit them as non-multibyte (if MULTI_FLAG is 0). */ 2458 or to fit them as non-multibyte (if not MULTI_FLAG). */
2461 2459
2462void 2460void
2463set_intervals_multibyte (int multi_flag) 2461set_intervals_multibyte (bool multi_flag)
2464{ 2462{
2465 INTERVAL i = buffer_intervals (current_buffer); 2463 INTERVAL i = buffer_intervals (current_buffer);
2466 2464