Compaq AA-PWCBD-TE Computer Accessories User Manual


 
Lexical Elements of the DEC Text Processing Utility Language
4.8 Expressions
When used with markers, these operators test whether one marker is closer
to (or farther from) the top of the buffer than another marker. (If markers are
in different buffers, they will return as false.) For example, the procedure in
Example 4–3 uses relational operators to determine which half of the buffer the
cursor is located in.
Example 4–3 Procedure That Uses Relational Operators on Markers
PROCEDURE which_half
LOCAL number_lines,
saved_mark;
saved_mark := MARK (FREE_CURSOR);
POSITION (BEGINNING_OF (CURRENT_BUFFER));
number_lines := GET_INFO (current_buffer, "record_count");
IF number_lines = 0
THEN
MESSAGE ("The current buffer is empty");
ELSE
MOVE_VERTICAL (number_lines/2);
IF MARK (FREE_CURSOR) = saved_mark
THEN
MESSAGE ("You are at the middle of the buffer");
ELSE
IF MARK (FREE_CURSOR) < saved_mark
THEN
MESSAGE ("You are in the second half of the buffer");
ELSE
MESSAGE ("You are in the first half of the buffer");
ENDIF;
ENDIF;
ENDIF;
ENDPROCEDURE;
4.8.3 Pattern Expressions
A pattern expression consists of the pattern operators (+, &, | , @) combined with
string constants, string variables, pattern variables, pattern procedures, pattern
keywords, or parentheses. The following are valid pattern expressions:
pat1 := LINE_BEGIN + SPAN ("0123456789") + ANY ("abc");
pat2 := LINE_END + ("end"|"begin");
pat3 := SCAN (’;"!’) + (NOTANY ("’") & LINE_END);
See Chapter 3 for more information on pattern expressions.
4.8.4 Boolean Expressions
DECTPU performs bitwise logical operations on Boolean expressions. This means
that the logical operation is performed on the individual bits of the operands to
produce the individual bits of the result. In the following example, the value of
user_variable is set to 3.
user_variable := 3 AND 7;
As another example, if user_var were %X7777 (30583), then you would use the
following statement to set user_var to %x0077 (119):
user_var := user_var AND %XFF
Lexical Elements of the DEC Text Processing Utility Language 4–11