Sample DECTPU Procedures
A.2 Translation of Control Characters
Example A–2 (Cont.) Procedure to Display Control Characters
!
! This procedure controls the outer loop search for the special
! control characters that we want to view.
!
PROCEDURE view_controls (source_buffer)
CONSTANT
Ctrl_char_str :=
ASCII (0) + ASCII (1) + ASCII (2) + ASCII (3) +
ASCII (4) + ASCII (5) + ASCII (6) + ASCII (7) +
ASCII (8) + ASCII (9) + ASCII (10) + ASCII (11) +
ASCII (12) + ASCII (13) + ASCII (14) + ASCII (15) +
ASCII (16) + ASCII (17) + ASCII (18) + ASCII (19) +
ASCII (20) + ASCII (21) + ASCII (22) + ASCII (23) +
ASCII (24) + ASCII (25) + ASCII (26) + ASCII (27) +
ASCII (28) + ASCII (29) + ASCII (30) + ASCII (31);
LOCAL
Ctrl_char_pattern,
Ctrl_char_range;
! Create the translation buffer and window, if necessary
!
IF translate_buffer = TPU$K_UNSPECIFIED
THEN
translate_buffer := CREATE_BUFFER ("translation");
SET (NO_WRITE, translate_buffer);
ENDIF;
IF translate_window = TPU$K_UNSPECIFIED
THEN
translate_window := CREATE_WINDOW (1, 10, ON);
ENDIF;
!
! Make a copy of the buffer we are translating
!
ERASE (translate_buffer);
POSITION (translate_buffer);
COPY_TEXT (source_buffer);
!
! Search for any control characters and translate them. If a control character
! is not found, SEARCH_QUIETLY will return a 0.
!
Ctrl_char_pattern := ANY (Ctrl_char_str);
POSITION (BEGINNING_OF (translate_buffer));
(continued on next page)
A–4 Sample DECTPU Procedures