MODULE TPUPlus_CNTL IDENT "900409" !**************************************** PROCEDURE EVE_CONTROL_REPLACE !PROCEDURE MY_EDITOR_REPLACE_CONTROL_CHARACTERS !--------------------------------------------------------------------------- ! Replace Control Characters (0 - 31) With Displayable Strings !--------------------------------------------------------------------------- local this_pos, ! marker - cursor position at start of routine char_range, ! range - found character char, ! string - search character count, ! integer - replacement count idx; ! integer - loop index on_error if error = TPU$_STRNOTFOUND then char_range := 0; endif; endon_error; message ('Replacing control characters'); this_pos := mark (none); count := 0; idx := 0; loop; exitif idx > 127; position (beginning_of (current_buffer)); char := ascii (idx); loop; char_range := search (char, forward); exitif char_range = 0; count := count + 1; position (beginning_of (char_range)); erase_character (1); case idx from 0 to 31 [0]: copy_text (''); [1]: copy_text (''); [2]: copy_text (''); [3]: copy_text (''); [4]: copy_text (''); [5]: copy_text (''); [6]: copy_text (''); [7]: copy_text (''); [8]: copy_text (''); [9]: copy_text (''); [10]: copy_text (''); [11]: copy_text (''); [12]: copy_text (''); [13]: copy_text (''); [14]: copy_text (''); [15]: copy_text (''); [16]: copy_text (''); [17]: copy_text (''); [18]: copy_text (''); [19]: copy_text (''); [20]: copy_text (''); [21]: copy_text (''); [22]: copy_text (''); [23]: copy_text (''); [24]: copy_text (''); [25]: copy_text (''); [26]: copy_text (''); [27]: copy_text (''); [28]: copy_text (''); [29]: copy_text (''); [30]: copy_text (''); [31]: copy_text (''); endcase; if idx = 127 then copy_text (''); endif; endloop; idx := idx + 1; if ((idx > 31) and (idx < 127)) then idx := 127; endif; endloop; position (this_pos); message (fao ('!SL control characters replaced with ASCII strings', count)); ENDPROCEDURE; !**************************************** PROCEDURE EVE_ASCII_REPLACE !PROCEDURE MY_EDITOR_REPLACE_ASCII_STRINGS !--------------------------------------------------------------------------- ! Replace ASCII Strings With Control Characters (0 - 31) !--------------------------------------------------------------------------- local this_pos, ! marker - cursor position at start of routine string_range, ! range - found string search_string, ! string - search string count, ! integer - replacement count idx; ! integer - loop index on_error if error = TPU$_STRNOTFOUND then string_range := 0; endif; endon_error; message ('Replacing control characters'); this_pos := mark (none); count := 0; idx := 0; loop; exitif idx > 127; position (beginning_of (current_buffer)); case idx from 0 to 31 [0]: search_string := ''; [1]: search_string := ''; [2]: search_string := ''; [3]: search_string := ''; [4]: search_string := ''; [5]: search_string := ''; [6]: search_string := ''; [7]: search_string := ''; [8]: search_string := ''; [9]: search_string := ''; [10]: search_string := ''; [11]: search_string := ''; [12]: search_string := ''; [13]: search_string := ''; [14]: search_string := ''; [15]: search_string := ''; [16]: search_string := ''; [17]: search_string := ''; [18]: search_string := ''; [19]: search_string := ''; [20]: search_string := ''; [21]: search_string := ''; [22]: search_string := ''; [23]: search_string := ''; [24]: search_string := ''; [25]: search_string := ''; [26]: search_string := ''; [27]: search_string := ''; [28]: search_string := ''; [29]: search_string := ''; [30]: search_string := ''; [31]: search_string := ''; endcase; if idx = 127 then search_string := ''; endif; loop; string_range := search (search_string, forward); exitif string_range = 0; count := count + 1; position (beginning_of (string_range)); erase (string_range); copy_text (ascii (idx)); endloop; idx := idx + 1; if ((idx > 31) and (idx < 127)) then idx := 127; endif; endloop; position (this_pos); message (fao ('!SL ASCII strings replaced with control characters', count)); ENDPROCEDURE; ENDMODULE;