Compaq AA-PWCBD-TE Computer Accessories User Manual


 
Sample DECTPU Procedures
A.1 Line-Mode Editor
Example A–1 (Cont.) Line-Mode Editing
!Top of buffer command
["T"]:
POSITION (BEGINNING_OF (CURRENT_BUFFER));
MESSAGE (CURRENT_LINE);
!Next line command
["N"]:
MOVE_HORIZONTAL (-CURRENT_OFFSET);
MOVE_VERTICAL (1);
MESSAGE (CURRENT_LINE);
!Insert text command
["I"]:
SPLIT_LINE;
COPY_TEXT (SUBSTR (cmd, 2, 999));
MESSAGE (CURRENT_LINE);
!List from here to end of file command
["L"]:
m1 := MARK (NONE);
LOOP
MESSAGE (CURRENT_LINE);
MOVE_VERTICAL (1);
EXITIF MARK (NONE) = END_OF (CURRENT_BUFFER);
ENDLOOP;
POSITION (m1);
!QUIT
["Q"]:
QUIT;
[INRANGE,OUTRANGE]:
MESSAGE ("Unrecognized command - enter I,L,N,Q or T");
ENDCASE;
ENDLOOP;
A.2 Translation of Control Characters
Example A–2 shows how to display control characters in a meaningful way.
This is accomplished by translating the buffer to a different visual format and
mapping this new form to a window. On the VT400, VT300, and VT200 series of
terminals, control characters are shown as reverse question marks; on the VT100
series of terminals, they are shown as rectangles.
Example A–2 Procedure to Display Control Characters
! This procedure performs the substitution of meaningful characters
! for the escape or control characters.
!
PROCEDURE translate_controls (char_range)
LOCAL
replace_text;
!
! If the translation array is not yet set up, then do it now. The elements
! that we do not initialize will contain the value TPUK_UNSPECIFIED. They are
! characters that TPU will display meaningfully.
!
IF translate_array = TPU$K_UNSPECIFIED
THEN
(continued on next page)
A–2 Sample DECTPU Procedures