Skip to content
GitLab
Projects
Groups
Snippets
Help
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Open sidebar
emacs
emacs
Commits
25eeac41
Commit
25eeac41
authored
Apr 15, 1997
by
Richard M. Stallman
Browse files
(update_interval): New function.
parent
c81a9bdc
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
39 additions
and
0 deletions
+39
-0
src/intervals.c
src/intervals.c
+39
-0
No files found.
src/intervals.c
View file @
25eeac41
...
...
@@ -670,6 +670,45 @@ previous_interval (interval)
return
NULL_INTERVAL
;
}
/* Find the interval containing POS given some non-NULL INTERVAL
in the same tree. */
INTERVAL
update_interval
(
i
,
pos
)
register
INTERVAL
i
;
int
pos
;
{
if
(
NULL_INTERVAL_P
(
i
))
return
NULL_INTERVAL
;
while
(
1
)
{
if
(
pos
<
i
->
position
)
{
/* Move left. */
if
(
pos
>=
i
->
position
-
TOTAL_LENGTH
(
i
->
left
))
i
=
i
->
left
;
/* Move to the left child */
else
if
(
NULL_PARENT
(
i
))
error
(
"Point before start of properties"
);
else
i
=
i
->
parent
;
continue
;
}
else
if
(
pos
>=
INTERVAL_LAST_POS
(
i
))
{
/* Move right. */
if
(
pos
<
INTERVAL_LAST_POS
(
i
)
+
TOTAL_LENGTH
(
i
->
right
))
i
=
i
->
right
;
/* Move to the right child */
else
if
(
NULL_PARENT
(
i
))
error
(
"Point after end of properties"
);
else
i
=
i
->
parent
;
continue
;
}
else
return
i
;
}
}
#if 0
/* Traverse a path down the interval tree TREE to the interval
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment