diff options
Diffstat (limited to 'src/intervals.c')
-rw-r--r-- | src/intervals.c | 158 |
1 files changed, 43 insertions, 115 deletions
diff --git a/src/intervals.c b/src/intervals.c index 4f12d711bf5..3a7a0bf8c96 100644 --- a/src/intervals.c +++ b/src/intervals.c @@ -52,7 +52,7 @@ along with GNU Emacs. If not, see <http://www.gnu.org/licenses/>. */ #define TMEM(sym, set) (CONSP (set) ? ! NILP (Fmemq (sym, set)) : ! NILP (set)) -Lisp_Object merge_properties_sticky (); +Lisp_Object merge_properties_sticky (Lisp_Object pleft, Lisp_Object pright); static INTERVAL reproduce_tree (INTERVAL, INTERVAL); static INTERVAL reproduce_tree_obj (INTERVAL, Lisp_Object); @@ -62,8 +62,7 @@ static INTERVAL reproduce_tree_obj (INTERVAL, Lisp_Object); /* Create the root interval of some object, a buffer or string. */ INTERVAL -create_root_interval (parent) - Lisp_Object parent; +create_root_interval (Lisp_Object parent) { INTERVAL new; @@ -95,8 +94,7 @@ create_root_interval (parent) /* Make the interval TARGET have exactly the properties of SOURCE */ void -copy_properties (source, target) - register INTERVAL source, target; +copy_properties (register INTERVAL source, register INTERVAL target) { if (DEFAULT_INTERVAL_P (source) && DEFAULT_INTERVAL_P (target)) return; @@ -110,8 +108,7 @@ copy_properties (source, target) is added to TARGET if TARGET has no such property as yet. */ static void -merge_properties (source, target) - register INTERVAL source, target; +merge_properties (register INTERVAL source, register INTERVAL target) { register Lisp_Object o, sym, val; @@ -149,8 +146,7 @@ merge_properties (source, target) 0 otherwise. */ int -intervals_equal (i0, i1) - INTERVAL i0, i1; +intervals_equal (INTERVAL i0, INTERVAL i1) { register Lisp_Object i0_cdr, i0_sym; register Lisp_Object i1_cdr, i1_val; @@ -206,10 +202,7 @@ intervals_equal (i0, i1) Pass FUNCTION two args: an interval, and ARG. */ void -traverse_intervals_noorder (tree, function, arg) - INTERVAL tree; - void (* function) (INTERVAL, Lisp_Object); - Lisp_Object arg; +traverse_intervals_noorder (INTERVAL tree, void (*function) (INTERVAL, Lisp_Object), Lisp_Object arg) { /* Minimize stack usage. */ while (!NULL_INTERVAL_P (tree)) @@ -229,11 +222,7 @@ traverse_intervals_noorder (tree, function, arg) Pass FUNCTION two args: an interval, and ARG. */ void -traverse_intervals (tree, position, function, arg) - INTERVAL tree; - int position; - void (* function) (INTERVAL, Lisp_Object); - Lisp_Object arg; +traverse_intervals (INTERVAL tree, int position, void (*function) (INTERVAL, Lisp_Object), Lisp_Object arg) { while (!NULL_INTERVAL_P (tree)) { @@ -323,8 +312,7 @@ root_interval (interval) */ static INLINE INTERVAL -rotate_right (interval) - INTERVAL interval; +rotate_right (INTERVAL interval) { INTERVAL i; INTERVAL B = interval->left; @@ -371,8 +359,7 @@ rotate_right (interval) */ static INLINE INTERVAL -rotate_left (interval) - INTERVAL interval; +rotate_left (INTERVAL interval) { INTERVAL i; INTERVAL B = interval->right; @@ -413,8 +400,7 @@ rotate_left (interval) themselves are already balanced. */ static INTERVAL -balance_an_interval (i) - INTERVAL i; +balance_an_interval (INTERVAL i) { register int old_diff, new_diff; @@ -451,8 +437,7 @@ balance_an_interval (i) Lisp Object. */ static INLINE INTERVAL -balance_possible_root_interval (interval) - register INTERVAL interval; +balance_possible_root_interval (register INTERVAL interval) { Lisp_Object parent; int have_parent = 0; @@ -482,8 +467,7 @@ balance_possible_root_interval (interval) (the amount of text). */ static INTERVAL -balance_intervals_internal (tree) - register INTERVAL tree; +balance_intervals_internal (register INTERVAL tree) { /* Balance within each side. */ if (tree->left) @@ -496,8 +480,7 @@ balance_intervals_internal (tree) /* Advertised interface to balance intervals. */ INTERVAL -balance_intervals (tree) - INTERVAL tree; +balance_intervals (INTERVAL tree) { if (tree == NULL_INTERVAL) return NULL_INTERVAL; @@ -519,9 +502,7 @@ balance_intervals (tree) it is still a root after this operation. */ INTERVAL -split_interval_right (interval, offset) - INTERVAL interval; - int offset; +split_interval_right (INTERVAL interval, int offset) { INTERVAL new = make_interval (); int position = interval->position; @@ -566,9 +547,7 @@ split_interval_right (interval, offset) it is still a root after this operation. */ INTERVAL -split_interval_left (interval, offset) - INTERVAL interval; - int offset; +split_interval_left (INTERVAL interval, int offset) { INTERVAL new = make_interval (); int new_length = offset; @@ -608,8 +587,7 @@ split_interval_left (interval, offset) of another interval! */ int -interval_start_pos (source) - INTERVAL source; +interval_start_pos (INTERVAL source) { Lisp_Object parent; @@ -635,9 +613,7 @@ interval_start_pos (source) will update this cache based on the result of find_interval. */ INTERVAL -find_interval (tree, position) - register INTERVAL tree; - register int position; +find_interval (register INTERVAL tree, register int position) { /* The distance from the left edge of the subtree at TREE to POSITION. */ @@ -691,8 +667,7 @@ find_interval (tree, position) find_interval). */ INTERVAL -next_interval (interval) - register INTERVAL interval; +next_interval (register INTERVAL interval) { register INTERVAL i = interval; register int next_position; @@ -731,8 +706,7 @@ next_interval (interval) find_interval). */ INTERVAL -previous_interval (interval) - register INTERVAL interval; +previous_interval (register INTERVAL interval) { register INTERVAL i; @@ -771,9 +745,7 @@ previous_interval (interval) To speed up the process, we assume that the ->position of I and all its parents is already uptodate. */ INTERVAL -update_interval (i, pos) - register INTERVAL i; - int pos; +update_interval (register INTERVAL i, int pos) { if (NULL_INTERVAL_P (i)) return NULL_INTERVAL; @@ -892,9 +864,7 @@ adjust_intervals_for_insertion (tree, position, length) this text, and make it have the merged properties of both ends. */ static INTERVAL -adjust_intervals_for_insertion (tree, position, length) - INTERVAL tree; - int position, length; +adjust_intervals_for_insertion (INTERVAL tree, int position, int length) { register INTERVAL i; register INTERVAL temp; @@ -1119,8 +1089,7 @@ FR 8 9 A B */ Lisp_Object -merge_properties_sticky (pleft, pright) - Lisp_Object pleft, pright; +merge_properties_sticky (Lisp_Object pleft, Lisp_Object pright) { register Lisp_Object props, front, rear; Lisp_Object lfront, lrear, rfront, rrear; @@ -1256,8 +1225,7 @@ merge_properties_sticky (pleft, pright) storing the resulting subtree into its parent. */ static INTERVAL -delete_node (i) - register INTERVAL i; +delete_node (register INTERVAL i) { register INTERVAL migrate, this; register int migrate_amt; @@ -1290,8 +1258,7 @@ delete_node (i) for the length of I. */ void -delete_interval (i) - register INTERVAL i; +delete_interval (register INTERVAL i) { register INTERVAL parent; int amt = LENGTH (i); @@ -1345,9 +1312,7 @@ delete_interval (i) deleting the appropriate amount of text. */ static int -interval_deletion_adjustment (tree, from, amount) - register INTERVAL tree; - register int from, amount; +interval_deletion_adjustment (register INTERVAL tree, register int from, register int amount) { register int relative_position = from; @@ -1407,9 +1372,7 @@ interval_deletion_adjustment (tree, from, amount) buffer position, i.e. origin 1). */ static void -adjust_intervals_for_deletion (buffer, start, length) - struct buffer *buffer; - int start, length; +adjust_intervals_for_deletion (struct buffer *buffer, int start, int length) { register int left_to_delete = length; register INTERVAL tree = BUF_INTERVALS (buffer); @@ -1460,9 +1423,7 @@ adjust_intervals_for_deletion (buffer, start, length) of LENGTH. */ INLINE void -offset_intervals (buffer, start, length) - struct buffer *buffer; - int start, length; +offset_intervals (struct buffer *buffer, int start, int length) { if (NULL_INTERVAL_P (BUF_INTERVALS (buffer)) || length == 0) return; @@ -1483,8 +1444,7 @@ offset_intervals (buffer, start, length) interval. */ INTERVAL -merge_interval_right (i) - register INTERVAL i; +merge_interval_right (register INTERVAL i) { register int absorb = LENGTH (i); register INTERVAL successor; @@ -1540,8 +1500,7 @@ merge_interval_right (i) The caller must verify that this is not the first (leftmost) interval. */ INTERVAL -merge_interval_left (i) - register INTERVAL i; +merge_interval_left (register INTERVAL i) { register int absorb = LENGTH (i); register INTERVAL predecessor; @@ -1595,8 +1554,7 @@ merge_interval_left (i) the pointers of the copy. */ static INTERVAL -reproduce_tree (source, parent) - INTERVAL source, parent; +reproduce_tree (INTERVAL source, INTERVAL parent) { register INTERVAL t = make_interval (); @@ -1612,9 +1570,7 @@ reproduce_tree (source, parent) } static INTERVAL -reproduce_tree_obj (source, parent) - INTERVAL source; - Lisp_Object parent; +reproduce_tree_obj (INTERVAL source, Lisp_Object parent) { register INTERVAL t = make_interval (); @@ -1714,11 +1670,7 @@ make_new_interval (intervals, start, length) text... */ void -graft_intervals_into_buffer (source, position, length, buffer, inherit) - INTERVAL source; - int position, length; - struct buffer *buffer; - int inherit; +graft_intervals_into_buffer (INTERVAL source, int position, int length, struct buffer *buffer, int inherit) { register INTERVAL under, over, this, prev; register INTERVAL tree; @@ -1876,18 +1828,13 @@ graft_intervals_into_buffer (source, position, length, buffer, inherit) and for PROP appearing on the default-text-properties list. */ Lisp_Object -textget (plist, prop) - Lisp_Object plist; - register Lisp_Object prop; +textget (Lisp_Object plist, register Lisp_Object prop) { return lookup_char_property (plist, prop, 1); } Lisp_Object -lookup_char_property (plist, prop, textprop) - Lisp_Object plist; - register Lisp_Object prop; - int textprop; +lookup_char_property (Lisp_Object plist, register Lisp_Object prop, int textprop) { register Lisp_Object tail, fallback = Qnil; @@ -1974,8 +1921,7 @@ set_point (EMACS_INT charpos) if the invisible property comes from an overlay. */ static int -adjust_for_invis_intang (pos, test_offs, adj, test_intang) - int pos, test_offs, adj, test_intang; +adjust_for_invis_intang (int pos, int test_offs, int adj, int test_intang) { Lisp_Object invis_propval, invis_overlay; Lisp_Object test_pos; @@ -2237,8 +2183,7 @@ set_point_both (EMACS_INT charpos, EMACS_INT bytepos) segment that reaches all the way to point. */ void -move_if_not_intangible (position) - int position; +move_if_not_intangible (int position) { Lisp_Object pos; Lisp_Object intangible_propval; @@ -2301,11 +2246,7 @@ move_if_not_intangible (position) nil means the current buffer. */ int -get_property_and_range (pos, prop, val, start, end, object) - int pos; - Lisp_Object prop, *val; - EMACS_INT *start, *end; - Lisp_Object object; +get_property_and_range (int pos, Lisp_Object prop, Lisp_Object *val, EMACS_INT *start, EMACS_INT *end, Lisp_Object object) { INTERVAL i, prev, next; @@ -2348,10 +2289,7 @@ get_property_and_range (pos, prop, val, start, end, object) POSITION must be in the accessible part of BUFFER. */ Lisp_Object -get_local_map (position, buffer, type) - register int position; - register struct buffer *buffer; - Lisp_Object type; +get_local_map (register int position, register struct buffer *buffer, Lisp_Object type) { Lisp_Object prop, lispy_position, lispy_buffer; int old_begv, old_zv, old_begv_byte, old_zv_byte; @@ -2404,9 +2342,7 @@ get_local_map (position, buffer, type) The new interval tree has no parent and has a starting-position of 0. */ INTERVAL -copy_intervals (tree, start, length) - INTERVAL tree; - int start, length; +copy_intervals (INTERVAL tree, int start, int length) { register INTERVAL i, new, t; register int got, prevlen; @@ -2447,10 +2383,7 @@ copy_intervals (tree, start, length) /* Give STRING the properties of BUFFER from POSITION to LENGTH. */ INLINE void -copy_intervals_to_string (string, buffer, position, length) - Lisp_Object string; - struct buffer *buffer; - int position, length; +copy_intervals_to_string (Lisp_Object string, struct buffer *buffer, int position, int length) { INTERVAL interval_copy = copy_intervals (BUF_INTERVALS (buffer), position, length); @@ -2465,8 +2398,7 @@ copy_intervals_to_string (string, buffer, position, length) Assume they have identical characters. */ int -compare_string_intervals (s1, s2) - Lisp_Object s1, s2; +compare_string_intervals (Lisp_Object s1, Lisp_Object s2) { INTERVAL i1, i2; int pos = 0; @@ -2504,10 +2436,7 @@ compare_string_intervals (s1, s2) START_BYTE ... END_BYTE in bytes. */ static void -set_intervals_multibyte_1 (i, multi_flag, start, start_byte, end, end_byte) - INTERVAL i; - int multi_flag; - int start, start_byte, end, end_byte; +set_intervals_multibyte_1 (INTERVAL i, int multi_flag, int start, int start_byte, int end, int end_byte) { /* Fix the length of this interval. */ if (multi_flag) @@ -2617,8 +2546,7 @@ set_intervals_multibyte_1 (i, multi_flag, start, start_byte, end, end_byte) or to fit them as non-multibyte (if MULTI_FLAG is 0). */ void -set_intervals_multibyte (multi_flag) - int multi_flag; +set_intervals_multibyte (int multi_flag) { if (BUF_INTERVALS (current_buffer)) set_intervals_multibyte_1 (BUF_INTERVALS (current_buffer), multi_flag, |