Compaq AA-PWCBD-TE Computer Accessories User Manual


 
Sample DECTPU Procedures
A.2 Translation of Control Characters
Example A–2 (Cont.) Procedure to Display Control Characters
translate_array := CREATE_ARRAY (32, 0);
translate_array {1} := ’<SOH>’;
translate_array {2} := ’<STX>’;
translate_array {3} := ’<ETX>’;
translate_array {4} := ’<EOT>’;
translate_array {5} := ’<ENQ>’;
translate_array {6} := ’<ACK>’;
translate_array {7} := ’<BEL>’;
translate_array {8} := ’<BS>’;
translate_array {14} := ’<SO>’;
translate_array {15} := ’<SI>’;
translate_array {16} := ’<DLE>’;
translate_array {17} := ’<DC1>’;
translate_array {18} := ’<DC2>’;
translate_array {19} := ’<DC3>’;
translate_array {20} := ’<DC4>’;
translate_array {21} := ’<NAK>’;
translate_array {22} := ’<SYN>’;
translate_array {23} := ’<ETB>’;
translate_array {24} := ’<CAN>’;
translate_array {25} := ’<EM>’;
translate_array {26} := ’<SUB>’;
translate_array {27} := ’<ESC>’;
translate_array {28} := ’<FS>’;
translate_array {29} := ’<GS>’;
translate_array {30} := ’<RS>’;
translate_array {31} := ’<US>’;
ENDIF;
!
! The range *must* be a single character long
!
IF LENGTH (char_range) <> 1
THEN
RETURN 0;
ENDIF;
!
! Find the character
!
replace_text := translate_array {ASCII (STR (char_range))};
!
! If we got back a value of TPU$K_UNSPECIFIED, TPU will display the character
! meaningfully
!
IF replace_text = TPU$K_UNSPECIFIED
THEN
RETURN 0;
ENDIF;
!
! Erase the range and insert the new text
!
ERASE (char_range);
COPY_TEXT (replace_text);
RETURN 1;
ENDPROCEDURE;
(continued on next page)
Sample DECTPU Procedures A–3