!**************************************** PROCEDURE PCE_ONE_WINDOW ! ! Switches back to 1 window from split screen edits ! local this_position, this_buffer; ! this_position := mark(none); this_buffer := current_buffer; ! if pce_number_of_windows = 1 then message ("Only one window on screen"); else unmap(pce_top_window); unmap(pce_bottom_window); map(pce_main_window,this_buffer); eve$set_status_line(pce_main_window); position(this_position); pce_number_of_windows := 1; eve$x_number_of_windows := 1; endif; ! ENDPROCEDURE; !**************************************** PROCEDURE PCE_TOGGLE_BETWN_BUFRS ! ! Switches the cursor between 2 windows created by Pce_two_files ! if current_window = pce_top_window then position (pce_bottom_window); else position (pce_top_window); endif; ! ENDPROCEDURE; !**************************************** PROCEDURE PCE_GKI ! PCE_GET_KEY_INFORMATION ! ! Retrieves information about user/TPU defined keys ! local key_to_interpret, key_info; ! message ("press the key you want information on: "); key_to_interpret := read_key; key_info := lookup_key (key_to_interpret, comment); if key_info <> "" then message ("comment: " + key_info); else key_info := lookup_key (key_to_interpret, program); if key_info <> 0 then message ("program: " + key_info); else message ("that key is not currently defined"); endif; endif; ENDPROCEDURE; !**************************************** PROCEDURE PCE_GOTO_LINE_NUMBER(PCE_LINE_NUMBER) ! ! Position to line # n ! local pce_line_number, this_line_number, temp; ! this_line_number := pce_line_number; pce_last_line := get_info(current_buffer,"record_count"); ! if eve$prompt_number(this_line_number, temp, "line number: ", "no value entered - position not changed") then if temp > pce_last_line then temp := pce_last_line; else if temp < 1 then temp := 1; endif; endif; position(beginning_of(current_buffer)); if temp > 1 then move_vertical(temp-1); endif; endif; ! ENDPROCEDURE; !**************************************** PROCEDURE PCE_REG_WINDOW ! set(width,current_window,80); set(margins,current_buffer,1,72); ! ENDPROCEDURE; !**************************************** PROCEDURE PCE_WIDE_WINDOW ! set(width,current_window,132); set(margins,current_buffer,1,124); ! ENDPROCEDURE; !+ ! FIX_CRFFS.TPU - Routine to turn CRFFs into line breaks ! and remove leading CRs and trailing CRFFs !- procedure eve_fix_crffs LOCAL the_range; on_error if (ERROR <> tpu$_STRNOTFOUND) then message("Error (" + str(ERROR) + ") at line " + str(ERROR_LINE)); return; endif; endon_error; ! ! First remove the CRFFs. If they are not at the EOL, add a line break. ! position(beginning_of(current_buffer)); loop the_range := search(ascii(13)+ascii(12), FORWARD); exitif (the_range = 0); erase(the_range); position(beginning_of(the_range)); if (current_character <> "") then split_line; endif; endloop; ! ! Next remove naked FFs. If they are not at the EOL, add a line break. ! position(beginning_of(current_buffer)); loop the_range := search(ascii(12), FORWARD); exitif (the_range = 0); erase(the_range); position(beginning_of(the_range)); if (current_character <> "") then split_line; endif; endloop; ! ! Next remove naked LFs. If they are not at the EOL, add a line break. ! position(beginning_of(current_buffer)); loop the_range := search(ascii(10), FORWARD); exitif (the_range = 0); erase(the_range); position(beginning_of(the_range)); if (current_character <> "") then split_line; endif; endloop; ! ! Finally, remove naked CRs. If they are not at the BOL, add a line break. ! position(beginning_of(current_buffer)); loop the_range := search(ascii(13), FORWARD); exitif (the_range = 0); position(end_of(the_range)); if (current_offset <> 0) then split_line; endif; erase(the_range); endloop; ENDPROCEDURE !**************************************** PROCEDURE PCE_TYPE_ALL(SEARCH_STRING) ! new - 860626 -- RHS ! This procedure will find all occurances of a string in the current buffer ! and displays each record where the string occurs in the message buffer. ! Local search_string, this_string, this_range, temp, found_flag, old_position; old_position := mark(none); this_string := search_string; if eve$prompt_string(this_string, temp, "String to search for: ", "nothing entered - search cancelled") then this_string := temp; found_flag := 0; loop; this_range := search(this_string, FORWARD, EXACT); if this_range <> 0 then found_flag := 1; position(this_range); message(current_line); move_vertical(1); move_horizontal(-current_offset); else if found_flag = 1 then message('End of search'); endif; position(old_position); return; endif; endloop; endif ENDPROCEDURE; !**************************************** PROCEDURE EVE_GET_FILE (GET_FILE_PARAMETER) ! Edit a file in the current window. If the file is already in a buffer, ! use the old buffer. If not, create a new buffer. ! ! Parameters: ! ! get_file_parameter String containing file name - input local get_file_name, ! Local copy of get_file_parameter temp_buffer_name, ! String for buffer name based on get_file_name file_search_result, ! Latest string returned by file_search temp_file_name, ! First file name string returned by file_search loop_buffer, ! Buffer currently being checked in loop new_buffer, ! New buffer created if needed found_a_buffer, ! True if buffer found with same name want_new_buffer, ! True if file should go into a new buffer current_file_name, current_file_type; on_error if error = tpu$_parsefail then message (fao ("Don't understand file name: !AS", get_file_name)); if eve$x_starting_up then eve$set_status_line (current_window); endif; return; endif; endon_error; if eve$check_bad_window then message ("Cursor has been moved to a text window; try command again"); return; endif; if not (eve$prompt_string (get_file_parameter, get_file_name, "File to get: ", "No file specified")) then return; endif; ! ! If no file type is given use file type of name of current buffer or ! * for the file type. ! current_file_name := get_info(current_buffer, "name"); current_file_type := substr(current_file_name, index(current_file_name, '.'), length(current_file_name)); get_file_name := file_parse(get_file_name, "", "", node) + file_parse(get_file_name, "", "", device) + file_parse(get_file_name, "", "", directory) + file_parse(get_file_name, "", "", name) + file_parse(get_file_name, current_file_type, "*", type) + file_parse(get_file_name, "", "", version); ! Protect against earlier file_search with same file name. file_search_result := file_search (eve$x_null); temp_file_name := eve$x_null; erase (eve$choice_buffer); loop file_search_result := file_search (get_file_name); exitif file_search_result = eve$x_null; eve$add_choice (file_search_result); temp_file_name := file_search_result; endloop; if get_info (eve$choice_buffer, "record_count") > 1 then ! If get_file is called from tpu$init_procedure, can't handle ! multiple choices, so set status line on main window and return if eve$x_starting_up then eve$set_status_line (current_window); endif; eve$display_choices (fao ("Ambiguous file name: !AS", get_file_name)); return; endif; ! See if we already have a buffer by that name if temp_file_name = eve$x_null then temp_buffer_name := file_parse (get_file_name, eve$x_null, eve$x_null, name) + file_parse (get_file_name, eve$x_null, eve$x_null, type); else temp_buffer_name := file_parse (temp_file_name, eve$x_null, eve$x_null, name) + file_parse (temp_file_name, eve$x_null, eve$x_null, type); endif; get_file_name := file_parse (get_file_name); loop_buffer := get_info (buffers, "first"); loop exitif loop_buffer = 0; if temp_buffer_name = get_info (loop_buffer, "name") then found_a_buffer := 1; exitif 1; endif; loop_buffer := get_info (buffers, "next"); endloop; ! If there is a buffer by that name, is it the exact same file? ! If so, switch to that buffer. Otherwise use a new buffer, ! asking for a new buffer name (null new name will abort). if found_a_buffer then ! Have a buffer with the same name if temp_file_name = eve$x_null then ! No file on disk if get_file_name = get_info (loop_buffer, "output_file") then want_new_buffer := 0; else want_new_buffer := 1; endif; else ! Check to see if the same file if (temp_file_name = get_info (loop_buffer, "output_file")) or (temp_file_name = get_info (loop_buffer, "file_name")) then want_new_buffer := 0; else want_new_buffer := 1; endif; endif; if want_new_buffer then message (fao ("Buffer name !AS is in use", temp_buffer_name)); temp_buffer_name := read_line ("Type a new buffer name or press Return to cancel: "); if temp_buffer_name = eve$x_null then message ("No new buffer created"); else new_buffer := eve$create_buffer (temp_buffer_name, get_file_name, temp_file_name); endif; else if current_buffer = loop_buffer then message (fao ("Already editing file !AS", get_file_name)); else map (current_window, loop_buffer); endif; endif; else ! No buffer with the same name, so create a new buffer new_buffer := eve$create_buffer (temp_buffer_name, get_file_name, temp_file_name); endif; if new_buffer <> 0 then set (eob_text, new_buffer, "[End of file]"); set (margins, new_buffer, eve$x_default_left_margin, get_info (current_window, "width") - eve$x_default_right_margin); endif; ! Correct the status line in any event eve$set_status_line (current_window); ENDPROCEDURE;