!+ ! PRINT.TPU - !- ! ! ! A set of procedures that implement the following EVE commands for ! printing on the printer attached to your terminal. ! ! PRINT FILE - Print named file (will prompt if not specified) ! PRINT FF - Print a formfeed. ! PRINT RANGE - Print the current select range or the current buffer ! if no select active. ! PRINT SCREEN - Print the current screen display. ! ! In the interest of saving paper, these procedures do not automatically ! print a formfeed at the end of the listing. Use PRINT FF to cause ! paper eject between listings. ! ! ! Print the current screen. ! procedure EVE_PRINT_SCREEN set (text, message_window, no_translate); message(ascii(27) + '[i'); update(message_window); set (text, message_window, blank_tabs); ! Put back the window the way it was erase(message_buffer); endprocedure ! ! Procedure to print a range. Accepts the range as input ! procedure eve$print_range (range_to_print, brief_message) local v_pos ; v_pos := mark(none); set (text, message_window, no_translate); message(ascii(27) + '[5i'); !Turn on printer controller mode update (message_window); if (brief_message <> eve$x_null) then message (brief_message); update (message_window); endif; position(beginning_of(range_to_print)); ! ! Print the range. Note that we have to do carriage control ourselves ! loop exitif (mark(none) >= end_of (range_to_print)); message (current_line); !Write line to printer update (message_window); !Make sure it gets out message (ascii (13)+ascii(10)); !Write crlf update (message_window); move_vertical (1); !Next line in range endloop; message(ascii(27) + '[4i'); !Turn off printer controller mode update(message_window); set (text, message_window, blank_tabs); ! Put back the window the way it was erase(message_buffer); position(v_pos); endprocedure ! ! EVE command to print a range, or the whole buffer if ! there is no select active. Does not clear the select range ! procedure EVE_PRINT_RANGE local v_range ,v_line ,v_pos ; v_pos := mark(none); if (eve$x_select_position = 0) then v_range := create_range (beginning_of(current_buffer), end_of(current_buffer), none); else v_range := create_range (eve$x_select_position, mark(none), none); endif; eve$print_range (v_range, eve$x_null); endprocedure ! ! EVE PRINT FILE command. Accepts a file name, and prints the ! file on the printer port. ! procedure EVE_PRINT_FILE(file_to_print) local print_file ,v_pos ,v_file ,v_header ; on_error position (v_pos); return; endon_error; v_pos := mark(none); if eve$prompt_string (file_to_print, print_file, "File to print: ", "No file printed") then position (eve$choice_buffer); erase (current_buffer); v_file := read_file (print_file); message (eve$x_null); v_header := fao("[!AS !%D]!/!/",v_file, 0); eve$print_range (create_range (beginning_of (current_buffer), end_of (current_buffer), none),v_header); erase (current_buffer); position (v_pos); endif; endprocedure ! ! Procedure to print a form feed on the printer port ! procedure EVE_PRINT_FF set (text, message_window, no_translate); message(ascii(27) + '[5i' +ascii(12) +ascii(27) + '[4i'); update(message_window); set (text, message_window, blank_tabs); ! Put back the window the way it was erase(message_buffer); refresh; endprocedure ! ! Initialization. Define the parameter for EVE's command parser ! procedure tpu$local_init eve$arg1_print_file := eve$arg1_buffer; endprocedure tpu$local_init;