Pass FUNCTION two args: an interval, and ARG. */
void
-traverse_intervals (INTERVAL tree, int position, void (*function) (INTERVAL, Lisp_Object), Lisp_Object arg)
+traverse_intervals (INTERVAL tree, EMACS_UINT position,
+ void (*function) (INTERVAL, Lisp_Object), Lisp_Object arg)
{
while (!NULL_INTERVAL_P (tree))
{
{
INTERVAL i;
INTERVAL B = interval->left;
- int old_total = interval->total_length;
+ EMACS_UINT old_total = interval->total_length;
/* Deal with any Parent of A; make it point to B. */
if (! ROOT_INTERVAL_P (interval))
{
INTERVAL i;
INTERVAL B = interval->right;
- int old_total = interval->total_length;
+ EMACS_UINT old_total = interval->total_length;
/* Deal with any parent of A; make it point to B. */
if (! ROOT_INTERVAL_P (interval))
static INTERVAL
balance_an_interval (INTERVAL i)
{
- register int old_diff, new_diff;
+ register EMACS_INT old_diff, new_diff;
while (1)
{
it is still a root after this operation. */
INTERVAL
-split_interval_right (INTERVAL interval, int offset)
+split_interval_right (INTERVAL interval, EMACS_INT offset)
{
INTERVAL new = make_interval ();
- int position = interval->position;
- int new_length = LENGTH (interval) - offset;
+ EMACS_UINT position = interval->position;
+ EMACS_UINT new_length = LENGTH (interval) - offset;
new->position = position + offset;
SET_INTERVAL_PARENT (new, interval);
it is still a root after this operation. */
INTERVAL
-split_interval_left (INTERVAL interval, int offset)
+split_interval_left (INTERVAL interval, EMACS_INT offset)
{
INTERVAL new = make_interval ();
- int new_length = offset;
+ EMACS_INT new_length = offset;
new->position = interval->position;
interval->position = interval->position + offset;
will update this cache based on the result of find_interval. */
INTERVAL
-find_interval (register INTERVAL tree, register int position)
+find_interval (register INTERVAL tree, register EMACS_INT position)
{
/* The distance from the left edge of the subtree at TREE
to POSITION. */
- register int relative_position;
+ register EMACS_UINT relative_position;
if (NULL_INTERVAL_P (tree))
return NULL_INTERVAL;
next_interval (register INTERVAL interval)
{
register INTERVAL i = interval;
- register int next_position;
+ register EMACS_UINT next_position;
if (NULL_INTERVAL_P (i))
return NULL_INTERVAL;
To speed up the process, we assume that the ->position of
I and all its parents is already uptodate. */
INTERVAL
-update_interval (register INTERVAL i, int pos)
+update_interval (register INTERVAL i, EMACS_INT pos)
{
if (NULL_INTERVAL_P (i))
return NULL_INTERVAL;
this text, and make it have the merged properties of both ends. */
static INTERVAL
-adjust_intervals_for_insertion (INTERVAL tree, int position, int length)
+adjust_intervals_for_insertion (INTERVAL tree,
+ EMACS_INT position, EMACS_INT length)
{
register INTERVAL i;
register INTERVAL temp;
int eobp = 0;
Lisp_Object parent;
- int offset;
+ EMACS_INT offset;
if (TOTAL_LENGTH (tree) == 0) /* Paranoia */
abort ();
delete_node (register INTERVAL i)
{
register INTERVAL migrate, this;
- register int migrate_amt;
+ register EMACS_UINT migrate_amt;
if (NULL_INTERVAL_P (i->left))
return i->right;
delete_interval (register INTERVAL i)
{
register INTERVAL parent;
- int amt = LENGTH (i);
+ EMACS_UINT amt = LENGTH (i);
if (amt > 0) /* Only used on zero-length intervals now. */
abort ();
Do this by recursing down TREE to the interval in question, and
deleting the appropriate amount of text. */
-static int
-interval_deletion_adjustment (register INTERVAL tree, register int from, register int amount)
+static EMACS_UINT
+interval_deletion_adjustment (register INTERVAL tree, register EMACS_UINT from,
+ register EMACS_UINT amount)
{
- register int relative_position = from;
+ register EMACS_UINT relative_position = from;
if (NULL_INTERVAL_P (tree))
return 0;
/* Left branch */
if (relative_position < LEFT_TOTAL_LENGTH (tree))
{
- int subtract = interval_deletion_adjustment (tree->left,
- relative_position,
- amount);
+ EMACS_UINT subtract = interval_deletion_adjustment (tree->left,
+ relative_position,
+ amount);
tree->total_length -= subtract;
CHECK_TOTAL_LENGTH (tree);
return subtract;
else if (relative_position >= (TOTAL_LENGTH (tree)
- RIGHT_TOTAL_LENGTH (tree)))
{
- int subtract;
+ EMACS_UINT subtract;
relative_position -= (tree->total_length
- RIGHT_TOTAL_LENGTH (tree));
else
{
/* How much can we delete from this interval? */
- int my_amount = ((tree->total_length
- - RIGHT_TOTAL_LENGTH (tree))
- - relative_position);
+ EMACS_UINT my_amount = ((tree->total_length
+ - RIGHT_TOTAL_LENGTH (tree))
+ - relative_position);
if (amount > my_amount)
amount = my_amount;
buffer position, i.e. origin 1). */
static void
-adjust_intervals_for_deletion (struct buffer *buffer, int start, int length)
+adjust_intervals_for_deletion (struct buffer *buffer,
+ EMACS_INT start, EMACS_INT length)
{
- register int left_to_delete = length;
+ register EMACS_INT left_to_delete = length;
register INTERVAL tree = BUF_INTERVALS (buffer);
Lisp_Object parent;
- int offset;
+ EMACS_UINT offset;
GET_INTERVAL_OBJECT (parent, tree);
offset = (BUFFERP (parent) ? BUF_BEG (XBUFFER (parent)) : 0);
of LENGTH. */
INLINE void
-offset_intervals (struct buffer *buffer, int start, int length)
+offset_intervals (struct buffer *buffer, EMACS_INT start, EMACS_INT length)
{
if (NULL_INTERVAL_P (BUF_INTERVALS (buffer)) || length == 0)
return;
INTERVAL
merge_interval_right (register INTERVAL i)
{
- register int absorb = LENGTH (i);
+ register EMACS_UINT absorb = LENGTH (i);
register INTERVAL successor;
/* Zero out this interval. */
INTERVAL
merge_interval_left (register INTERVAL i)
{
- register int absorb = LENGTH (i);
+ register EMACS_UINT absorb = LENGTH (i);
register INTERVAL predecessor;
/* Zero out this interval. */
static INTERVAL
make_new_interval (intervals, start, length)
INTERVAL intervals;
- int start, length;
+ EMACS_INT start, length;
{
INTERVAL slot;
text... */
void
-graft_intervals_into_buffer (INTERVAL source, int position, int length, struct buffer *buffer, int inherit)
+graft_intervals_into_buffer (INTERVAL source, EMACS_INT position,
+ EMACS_INT length, struct buffer *buffer,
+ int inherit)
{
register INTERVAL under, over, this, prev;
register INTERVAL tree;
- int over_used;
+ EMACS_UINT over_used;
tree = BUF_INTERVALS (buffer);
if the invisible property comes from an overlay. */
static int
-adjust_for_invis_intang (int pos, int test_offs, int adj, int test_intang)
+adjust_for_invis_intang (EMACS_INT pos, EMACS_INT test_offs, EMACS_INT adj,
+ int test_intang)
{
Lisp_Object invis_propval, invis_overlay;
Lisp_Object test_pos;
segment that reaches all the way to point. */
void
-move_if_not_intangible (int position)
+move_if_not_intangible (EMACS_INT position)
{
Lisp_Object pos;
Lisp_Object intangible_propval;
POSITION must be in the accessible part of BUFFER. */
Lisp_Object
-get_local_map (register int position, register struct buffer *buffer, Lisp_Object type)
+get_local_map (register EMACS_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;
+ EMACS_INT old_begv, old_zv, old_begv_byte, old_zv_byte;
/* Perhaps we should just change `position' to the limit. */
if (position > BUF_ZV (buffer) || position < BUF_BEGV (buffer))
The new interval tree has no parent and has a starting-position of 0. */
INTERVAL
-copy_intervals (INTERVAL tree, int start, int length)
+copy_intervals (INTERVAL tree, EMACS_INT start, EMACS_INT length)
{
register INTERVAL i, new, t;
- register int got, prevlen;
+ register EMACS_UINT got, prevlen;
if (NULL_INTERVAL_P (tree) || length <= 0)
return NULL_INTERVAL;
/* Give STRING the properties of BUFFER from POSITION to LENGTH. */
INLINE void
-copy_intervals_to_string (Lisp_Object string, struct buffer *buffer, int position, int length)
+copy_intervals_to_string (Lisp_Object string, struct buffer *buffer,
+ EMACS_INT position, EMACS_INT length)
{
INTERVAL interval_copy = copy_intervals (BUF_INTERVALS (buffer),
position, length);
compare_string_intervals (Lisp_Object s1, Lisp_Object s2)
{
INTERVAL i1, i2;
- int pos = 0;
- int end = SCHARS (s1);
+ EMACS_INT pos = 0;
+ EMACS_INT end = SCHARS (s1);
i1 = find_interval (STRING_INTERVALS (s1), 0);
i2 = find_interval (STRING_INTERVALS (s2), 0);
while (pos < end)
{
/* Determine how far we can go before we reach the end of I1 or I2. */
- int len1 = (i1 != 0 ? INTERVAL_LAST_POS (i1) : end) - pos;
- int len2 = (i2 != 0 ? INTERVAL_LAST_POS (i2) : end) - pos;
- int distance = min (len1, len2);
+ EMACS_INT len1 = (i1 != 0 ? INTERVAL_LAST_POS (i1) : end) - pos;
+ EMACS_INT len2 = (i2 != 0 ? INTERVAL_LAST_POS (i2) : end) - pos;
+ EMACS_INT distance = min (len1, len2);
/* If we ever find a mismatch between the strings,
they differ. */
START_BYTE ... END_BYTE in bytes. */
static void
-set_intervals_multibyte_1 (INTERVAL i, int multi_flag, int start, int start_byte, int end, int end_byte)
+set_intervals_multibyte_1 (INTERVAL i, int multi_flag,
+ EMACS_INT start, EMACS_INT start_byte,
+ EMACS_INT end, EMACS_INT end_byte)
{
/* Fix the length of this interval. */
if (multi_flag)
/* Recursively fix the length of the subintervals. */
if (i->left)
{
- int left_end, left_end_byte;
+ EMACS_INT left_end, left_end_byte;
if (multi_flag)
{
- int temp;
+ EMACS_INT temp;
left_end_byte = start_byte + LEFT_TOTAL_LENGTH (i);
left_end = BYTE_TO_CHAR (left_end_byte);
}
if (i->right)
{
- int right_start_byte, right_start;
+ EMACS_INT right_start_byte, right_start;
if (multi_flag)
{
- int temp;
+ EMACS_INT temp;
right_start_byte = end_byte - RIGHT_TOTAL_LENGTH (i);
right_start = BYTE_TO_CHAR (right_start_byte);
extern INTERVAL create_root_interval (Lisp_Object);
extern void copy_properties (INTERVAL, INTERVAL);
extern int intervals_equal (INTERVAL, INTERVAL);
-extern void traverse_intervals (INTERVAL, int,
+extern void traverse_intervals (INTERVAL, EMACS_UINT,
void (*) (INTERVAL, Lisp_Object),
Lisp_Object);
extern void traverse_intervals_noorder (INTERVAL,
void (*) (INTERVAL, Lisp_Object),
Lisp_Object);
-extern INTERVAL split_interval_right (INTERVAL, int);
-extern INTERVAL split_interval_left (INTERVAL, int);
-extern INTERVAL find_interval (INTERVAL, int);
+extern INTERVAL split_interval_right (INTERVAL, EMACS_INT);
+extern INTERVAL split_interval_left (INTERVAL, EMACS_INT);
+extern INTERVAL find_interval (INTERVAL, EMACS_INT);
extern INTERVAL next_interval (INTERVAL);
extern INTERVAL previous_interval (INTERVAL);
extern INTERVAL merge_interval_left (INTERVAL);
extern INTERVAL merge_interval_right (INTERVAL);
extern void delete_interval (INTERVAL);
-extern INLINE void offset_intervals (struct buffer *, int, int);
-extern void graft_intervals_into_buffer (INTERVAL, int, int,
+extern INLINE void offset_intervals (struct buffer *, EMACS_INT, EMACS_INT);
+extern void graft_intervals_into_buffer (INTERVAL, EMACS_INT, EMACS_INT,
struct buffer *, int);
extern void verify_interval_modification (struct buffer *, int, int);
extern INTERVAL balance_intervals (INTERVAL);
extern INLINE void copy_intervals_to_string (Lisp_Object, struct buffer *,
- int, int);
-extern INTERVAL copy_intervals (INTERVAL, int, int);
+ EMACS_INT, EMACS_INT);
+extern INTERVAL copy_intervals (INTERVAL, EMACS_INT, EMACS_INT);
extern int compare_string_intervals (Lisp_Object, Lisp_Object);
extern Lisp_Object textget (Lisp_Object, Lisp_Object);
extern Lisp_Object lookup_char_property (Lisp_Object, Lisp_Object, int);
-extern void move_if_not_intangible (int);
+extern void move_if_not_intangible (EMACS_INT);
extern int get_property_and_range (EMACS_INT, Lisp_Object, Lisp_Object *,
EMACS_INT *, EMACS_INT *, Lisp_Object);
-extern Lisp_Object get_local_map (int, struct buffer *, Lisp_Object);
-extern INTERVAL update_interval (INTERVAL, int);
+extern Lisp_Object get_local_map (EMACS_INT, struct buffer *, Lisp_Object);
+extern INTERVAL update_interval (INTERVAL, EMACS_INT);
extern void set_intervals_multibyte (int);
extern INTERVAL validate_interval_range (Lisp_Object, Lisp_Object *,
Lisp_Object *, int);