DEC Text Processing Utility Data Types
3.10 Range Data Type
3.10 Range Data Type
A range contains all the text between (and including) two markers. You can
form a range with the CREATE_RANGE built-in procedure. A range is associated
with characters within a buffer. If the characters within a range move, the range
moves with them. If characters are added or deleted between two markers that
delimit a range, the size of the range changes. If all the characters in a range are
deleted, the range moves to the nearest character.
DECTPU does not support ranges of zero length unless the range begins and
ends at the end of a buffer. All other ranges contain at least one character (which
could be a space character) or a line-end (if the range is created at the end of a
line).
If you create a range by specifying a free marker as a parameter to the CREATE_
RANGE built-in, DECTPU creates a new marker and binds the marker to the
text nearest to the free marker position. DECTPU uses the new bound marker as
the range delimiter. This operation does not cause insertion of padding spaces.
Deleting the markers used to create a range does not affect the range.
To convert the contents of a range to a string, use either the STR or the SUBSTR
built-in procedure.
To remove a range, use the DELETE built-in procedure with the range as a
parameter. For example, the following statement deletes the range range1:
DELETE (range1);
You can also delete a range by removing all variable references to the range. To
do this, set all variables referring to the range to some other value, such as 0.
For example, the following statement sets the variable range1 to 0:
range1 := 0;
Deleting a range does not remove the characters of the range from the buffer; it
merely removes the range data structure. To remove the characters of a range,
use the ERASE built-in procedure with the range as a parameter. For example,
ERASE (my_range) removes all the characters in my_range, but it does not
remove the range structure. Using the statement DELETE (range_variable)
removes the range data structure, but does not affect the characters in the range.
The following built-in procedures, as well as the partial pattern assignment
operator, all return values of the range data type:
• CHANGE_CASE
• CREATE_RANGE
• EDIT
• GET_INFO
• READ_CLIPBOARD
• READ_GLOBAL_SELECT
• SEARCH
• SEARCH_QUIETLY
• SELECT_RANGE
• TRANSLATE
DEC Text Processing Utility Data Types 3–19