beautypg.com

Compaq DEC Text Processing Utility AA-PWCBD-TE User Manual

Page 133

background image

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} := ’’;
translate_array {2} := ’’;
translate_array {3} := ’’;
translate_array {4} := ’’;
translate_array {5} := ’’;
translate_array {6} := ’’;
translate_array {7} := ’’;
translate_array {8} := ’’;
translate_array {14} := ’’;
translate_array {15} := ’’;
translate_array {16} := ’’;
translate_array {17} := ’’;
translate_array {18} := ’’;
translate_array {19} := ’’;
translate_array {20} := ’’;
translate_array {21} := ’’;
translate_array {22} := ’’;
translate_array {23} := ’’;
translate_array {24} := ’’;
translate_array {25} := ’’;
translate_array {26} := ’’;
translate_array {27} := ’’;
translate_array {28} := ’’;
translate_array {29} := ’’;
translate_array {30} := ’’;
translate_array {31} := ’’;

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