!Last Modified: 10-OCT-1988 14:48:47.24, By: FLEMING procedure eve_controls local this_buffer; if (get_info(translate_buffer,"type") = UNSPECIFIED) then translate_buffer := create_buffer ('translation'); set (no_write, translate_buffer); endif; this_buffer := current_buffer; eve$search_controls(this_buffer,translate_buffer); eve_two_windows; map(current_window,translate_buffer); ! eve$set_status_line(current_window); endprocedure ! This procedure controls the outer loop search for the special ! control characters that we want to view ! procedure eve$search_controls (some_buffer,translate_buffer) local control_char_pat, control_char, char_to_translate; ! When the search fails we know that we have either hit the end of ! the buffer or there were no more special characters found. on_error position (translate_buffer); return; endon_error; control_char_pat := any (''); position (translate_buffer); erase (translate_buffer); copy_text (some_buffer); ! Make a copy of the original buffer position (beginning_of (translate_buffer)); loop ! Find all occurrences control_char := search (control_char_pat, forward); position (control_char); char_to_translate := current_character; ! Save the character erase (control_char); ! then erase it eve$translate_controls (char_to_translate); ! Substitute the new text endloop; endprocedure !+ ! PRINT_BUFFER.TPU !- ! ! The 3 following procedures copies the current buffer to another buffer, ! translates control characters to readable characters and writes the ! new buffer. It then submits the file to the specified print que (default ! sys$print). The first two procedures are taken from this note file ! and modified a bit. The last procedure calls the other two and creates ! the subprocess/writes the file/prints the file. ! ! ! This procedure translates control characters to readable characters. ! procedure eve$translate_controls (char) ! The backwards questions mark is the placeholder for control characters ! from ASCII(0) thru ASCII(31) on the VT2xx series of terminals CASE char FROM '' TO '' [''] : COPY_TEXT (''); [''] : COPY_TEXT (''); [''] : COPY_TEXT (''); [''] : COPY_TEXT (''); [''] : COPY_TEXT (''); [''] : COPY_TEXT (''); [''] : COPY_TEXT (''); [''] : COPY_TEXT (''); [''] : COPY_TEXT (''); [''] : COPY_TEXT (''); [''] : COPY_TEXT (''); [''] : COPY_TEXT (''); [''] : COPY_TEXT (''); [''] : COPY_TEXT (''); [''] : COPY_TEXT (''); [''] : COPY_TEXT (''); [''] : COPY_TEXT (''); [''] : COPY_TEXT (''); [''] : COPY_TEXT (''); [''] : COPY_TEXT (''); [''] : COPY_TEXT (''); [''] : COPY_TEXT (''); [''] : COPY_TEXT (''); [''] : COPY_TEXT (''); [''] : COPY_TEXT (''); [''] : COPY_TEXT (''); [''] : COPY_TEXT (''); [INRANGE, OUTRANGE] : COPY_TEXT (char); endcase; endprocedure ! procedure eve_ascii local prompt,alfanum,number; prompt := "Enter ASCII value for character: "; alfanum := read_line(prompt); edit(alfanum,TRIM); number := int(alfanum); copy_text(ascii(number)); endprocedure !+ ! DISPLAY_CHARACTER.TPU !- ! This procedure writes a one line message describing the current character ! in terms of Octal, Decimal, Hexadecimal and (sometimes ) '^' notation. ! PROCEDURE eve_display_character LOCAL i,xcc; ! Handle end-of-buffer condition IF MARK( NONE ) = END_OF( CURRENT_BUFFER ) THEN MESSAGE( 'At end of buffer, no current character.' ); RETURN; ENDIF; ! Convert the character to an integer the hard way (no builtin yet) i := 0; LOOP; EXITIF i > 255; EXITIF CURRENT_CHARACTER = ASCII(i); i := i + 1; ENDLOOP; IF i > 255 THEN i := 0; ENDIF; ! On overflow, reset to NULL ! Provide ^ notation for ASCII control characters IF i < 32 THEN xcc := ', ^' + ASCII(i+64); ELSE xcc := ''; ENDIF; ! Format and output the results MESSAGE( FAO( "Current Character is '!AS', Octal=!OB, Decimal=!-!UB, " + "Hex=!-!XB!AS", CURRENT_CHARACTER, i, xcc ) ); ENDPROCEDURE