MODULE TPUPlus_REPL IDENT "900409" ! ! PROCEDURE EVE$$BOX_SELECT ! PROCEDURE EVE$$REMEMBER ! PROCEDURE EVE$CLEAR_SELECT_POSITION ! PROCEDURE EVE$EDT_DELETE_CHAR ! PROCEDURE EVE$INIT_DO_KEY (; CALLER, DEFINE_DO_FLAG) ! PROCEDURE EVE$POSITION_IN_MIDDLE (NEW_POSITION) ! PROCEDURE EVE$SET_FIND_TARGET_CASE (HOW_EXACT) ! PROCEDURE EVE$WPS_PARAGRAPH ! PROCEDURE EVE$WPS_SENTENCE ! PROCEDURE EVE$WRITE_FILE ! PROCEDURE EVE_BUFFER (BUFFER_PARAMETER) ! PROCEDURE EVE_CHANGE_MODE ! PROCEDURE EVE_DCL (DCL_PARAMETER) ! PROCEDURE EVE_ERASE_CHARACTER ! PROCEDURE EVE_GET_FILE (GET_FILE_PARAMETER) ! PROCEDURE EVE_INCLUDE_FILE (INCLUDE_FILE_PARAMETER) ! PROCEDURE EVE_MOVE_BY_PAGE ! PROCEDURE EVE_ONE_WINDOW ! PROCEDURE EVE_TWO_WINDOWS ! PROCEDURE PCE$GET_FILE1 (GET_FILE_PARAMETER; NEW_BUF_NAME) ! !**************************************** PROCEDURE EVE$$BOX_SELECT ! Creates box selection array: ! {0} = select mark at start of selection ! {1} = range for 1st line segment in the box ... ! {N} = range for Nth line segment in the box eve$x_box_array := create_array; eve$x_box_array {0} := select (eve$x_box_highlighting); pce$x_select_marker := mark (reverse); return (TRUE); ENDPROCEDURE; !**************************************** PROCEDURE EVE$$REMEMBER ! Guts of REMEMBER (display_errors) local learn_sequence, ! Learn sequence returned by end_learn builtin learn_key, ! Keyword for key to bind sequence to remember_key, ! Keyword for last key pressed before this proc mouse_number, ! Number of mouse clicked define_error, ! Integer - true if recursive key definition filtered_key, ! Key returned from key validation routine key_msg; ! EVE message to issue for input key on_error [TPU$_NOTLEARNING]: if display_errors then eve$message (EVE$_NOREMEM); eve$learn_abort; endif; return (FALSE); [TPU$_RECURLEARN]: eve$message (EVE$_NORECURS); define_error := 1; [OTHERWISE]: endon_error; remember_key := last_key; ! Insure REMEMBER isn't entered from the command line - that doesn't work. if eve$$x_state_array {eve$$k_command_line_flag} then if eve$test_synonym ("remember", eve$$lookup_comment (CTRL_R_KEY, eve$x_key_map_list)) then eve$message (EVE$_REMEMBERCTRLR); else eve$message (EVE$_REMEMBERKEY); endif; eve$learn_abort; return (FALSE); endif; learn_sequence := learn_end; eve$set_message (""); ! restore the null message as the default loop ! 1 = allow mouse keys in user windows learn_key := eve$prompt_key (message_text (EVE$_KEYTOLEARN, 1), 1); if learn_key = 0 then eve$learn_abort; return (FALSE); endif; ! Return gets you out without redefining a key if learn_key = RET_KEY then eve$message (EVE$_SEQNOTREM); eve$learn_abort; return (FALSE); endif; ! ! Run entered key through input filter ! if eve$$filter_key (learn_key, filtered_key, key_msg) then ! ! Reject user binding sequence to key that invoked this procedure. ! if remember_key = filtered_key then eve$message (EVE$_NOLRNREMEMBER); else define_key (learn_sequence, filtered_key, eve$x_sequence, eve$x_user_keys); ! ! Following code added 900406 - RHS ! define_key (learn_sequence, filtered_key, eve$x_sequence, eve$x_edt_keys); ! ! if define_error then ! recursive learn caught by on_error define_error := 0; else case key_msg [EVE$_SUBSTITUTE]: eve$message (EVE$_SUBSTITUTE, 0, eve$key_name (learn_key), eve$key_name (filtered_key)); endcase; exitif; endif; endif; else eve$message (key_msg); eve$learn_abort; endif; ! end of if endloop; eve$message (EVE$_SEQREMMED); return (TRUE); ENDPROCEDURE; !**************************************** PROCEDURE EVE$CLEAR_SELECT_POSITION local old_filter, the_key_map_list; on_error [TPU$_CONTROLC]: eve$stop_pending_delete; eve$learn_abort; abort; [OTHERWISE]: eve$stop_pending_delete; endon_error; ! doesn't matter what happened or why we got here... delete our marker pce$x_select_marker := 0; ! did user delete buffer containing the select/found range from under us? if get_info (eve$x_select_position, "type") = UNSPECIFIED then eve$x_select_position := 0; eve$stop_pending_delete; endif; if get_info (eve$x_box_array, "type") = UNSPECIFIED then eve$x_box_array := 0; eve$stop_pending_delete; endif; if get_info (eve$x_found_range, "type") = UNSPECIFIED then eve$x_found_range := 0; endif; if eve$x_select_position <> 0 then the_key_map_list := get_info (get_info (eve$x_select_position, "buffer"), "key_map_list"); endif; eve$x_select_position := 0; ! standard selection eve$x_box_array := 0; ! box selection eve$$x_adjusted_select_mark := 0; ! mouse selection marker eve$$x_state_array {eve$$k_select_all_active} := 0; eve$stop_pending_delete; if (eve$x_found_range = 0) and (the_key_map_list <> 0) then ! remove the found filter from our k_m_l's eve$set_key_procedure (FALSE, eve$x_command_key_map_list, 0, eve$$k_found_post_filter_id); eve$set_key_procedure (FALSE, eve$x_mouse_list, 0, eve$$k_found_post_filter_id); eve$set_key_procedure (FALSE, the_key_map_list, 0, eve$$k_found_post_filter_id); endif; return (TRUE); ENDPROCEDURE; !**************************************** PROCEDURE EVE$EDT_DELETE_CHAR !+ ! EDT -- Delete character !- local delete_eol, char_range, saved_mark; on_error [TPU$_CONTROLC]: eve$$restore_position (saved_mark); ! restore free cursor position eve$learn_abort; abort; [OTHERWISE]: eve$$restore_position (saved_mark); endon_error; if not eve$declare_intention (eve$k_action_erase_to_right) then return (FALSE); endif; saved_mark := mark (FREE_CURSOR); if eve$eol_nopad_delete then return (TRUE); endif; if not get_info (current_window, "beyond_eob") then if not (get_info (current_window, "before_bol") or get_info (current_window, "middle_of_tab")) then position (TEXT); ! snap to text endif; else position (TEXT); ! snap to text saved_mark := mark (FREE_CURSOR); endif; if mark (NONE) = end_of (current_buffer) then move_vertical (1); ! force an error message endif; if current_character = "" then if eve$in_prompting_window then eve$x_restore_char := 0; return (TRUE); else delete_eol := TRUE; endif; else delete_eol := FALSE; endif; char_range := create_range (mark (NONE), mark (NONE), NONE); eve$x_erased_char_forward := TRUE; eve$x_restore_char := eve$erase_text (char_range, eve$x_char_buffer, delete_eol); if eve$x_restore_char = 0 then eve$learn_abort; return (FALSE); endif; ! ! Following code commented out -- RHS ! !if (get_info (current_buffer, "mode") = OVERSTRIKE) then ! if not delete_eol then ! eve$insert_text (" "); ! endif; !endif; ! ! if length (eve$x_restore_char) = 0 then position (saved_mark); endif; return (TRUE); ENDPROCEDURE; !**************************************** PROCEDURE EVE$INIT_DO_KEY (; CALLER, DEFINE_DO_FLAG) ! ! Dummy procedure to replace DECs ! ENDPROCEDURE !**************************************** PROCEDURE EVE$POSITION_IN_MIDDLE (NEW_POSITION) local scroll_offset, ! New value for scroll_top and scroll_bottom saved_scrolls, ! Boolean set if saved_scroll_xxx are valid saved_scroll_top, ! Original value of scroll_top saved_scroll_bottom, ! Original value of scroll_bottom saved_scroll_amount, ! Original value of scroll_amount saved_window, ! Current window saved_mark; ! Current position on_error [TPU$_CONTROLC]: if saved_scrolls then set (SCROLLING, saved_window, ON, saved_scroll_top, saved_scroll_bottom, saved_scroll_amount); eve$$restore_position (new_position); update (saved_window); else eve$$restore_position (saved_mark); endif; eve$learn_abort; abort; [OTHERWISE]: if saved_scrolls then set (SCROLLING, saved_window, ON, saved_scroll_top, saved_scroll_bottom, saved_scroll_amount); eve$$restore_position (new_position); update (saved_window); else eve$$restore_position (saved_mark); endif; endon_error; saved_window := current_window; saved_mark := mark (FREE_CURSOR); ! ! Following line was modified 900406 - RHS ! !scroll_offset := (get_info (saved_window, "visible_length") / 2) - 2;!*** V2.0 Compat scroll_offset := (get_info (saved_window, "visible_length") / 2) - 1; ! if scroll_offset < 0 then scroll_offset := 0; else if scroll_offset > eve$x_max_scroll_offset then scroll_offset := eve$x_max_scroll_offset; endif; endif; saved_scroll_top := get_info (saved_window, "scroll_top"); saved_scroll_bottom := get_info (saved_window, "scroll_bottom"); saved_scroll_amount := get_info (saved_window, "scroll_amount"); if (saved_scroll_top = 0) and (saved_scroll_bottom = 0) and (saved_scroll_amount = 0) then ! No scroll regions set, force one <= 4 lines saved_scrolls := TRUE; set (SCROLLING, saved_window, ON, scroll_offset, scroll_offset, 0); position (new_position); update (saved_window); set (SCROLLING, saved_window, ON, saved_scroll_top, saved_scroll_bottom, saved_scroll_amount); else ! Use current scroll regions position (new_position); update (saved_window); endif; ENDPROCEDURE; !**************************************** PROCEDURE EVE$SET_FIND_TARGET_CASE (HOW_EXACT) ! EVE's FIND is case-sensitive unless (1) sensitivity has been ! set to noexact, and (2) the target is all lowercase, in which ! case the search is case-insensitive. local lowercase_target, ! Lowercase version of eve$x_target the_target; if get_info (eve$x_target, "type") = STRING then lowercase_target := eve$x_target; else lowercase_target := eve$x_target_pattern; endif; the_target := lowercase_target; change_case (lowercase_target, LOWER); how_exact := eve$x_find_exact; if not eve$get_find_case_sensitivity then if lowercase_target = the_target then how_exact := eve$x_find_no_exact; endif; endif; if pce$case_sensitive = tpu$k_unspecified then pce$case_sensitive := ""; endif; if pce$case_sensitive <> "" then if pce$case_sensitive then how_exact := eve$x_find_exact; else if pce$case_sensitive = false then how_exact := eve$x_find_no_exact; endif; endif; endif; return (TRUE); ENDPROCEDURE; !**************************************** PROCEDURE EVE$WPS_PARAGRAPH local saved_mark; on_error [TPU$_CONTROLC]: eve$$restore_position (saved_mark); eve$learn_abort; abort; [OTHERWISE]: eve$$restore_position (saved_mark); endon_error; if not eve$declare_intention (eve$k_action_reposition) then return (FALSE); endif; ! An EVE paragraph_break is the blank line above the 1st line of text in the ! paragraph. saved_mark := mark (FREE_CURSOR); if (current_direction = FORWARD) then if saved_mark = end_of (current_buffer) then move_vertical (1); ! force error message + return endif; else if (current_direction = REVERSE) then if saved_mark = beginning_of (current_buffer) then move_vertical (-1); ! force error message + return endif; endif; endif; position (LINE_BEGIN); if (current_direction = FORWARD) then if mark (NONE) = end_of (current_buffer) then return (TRUE); endif; loop exitif (mark (NONE) = end_of (current_buffer)); position (LINE_END); move_horizontal (1); exitif eve$paragraph_break; endloop; loop exitif (mark (NONE) = end_of (current_buffer)); position (LINE_END); move_horizontal (1); exitif not eve$paragraph_break; endloop; else if mark (NONE) = beginning_of (current_buffer) then return (TRUE); else if eve$paragraph_break then loop ! move up to non-break (skipping over all breaks) exitif (mark (NONE) = beginning_of (current_buffer)); move_vertical (-1); position (LINE_BEGIN); exitif not eve$paragraph_break; endloop; else move_vertical (-1); position (LINE_BEGIN); if eve$paragraph_break then ! we were on 1st line of text in para loop ! move up to non - break (skipping over all breaks) exitif (mark (NONE) = beginning_of (current_buffer)); move_vertical (-1); position (LINE_BEGIN); exitif not eve$paragraph_break; endloop; endif; endif; loop ! move up to start of paragraph we're in exitif (mark (NONE) = beginning_of (current_buffer)); move_vertical (-1); position (LINE_BEGIN); exitif eve$paragraph_break; endloop; if mark (NONE) <> beginning_of (current_buffer) then position (LINE_END); move_horizontal (1); ! now move down to start of text in this para endif; endif; endif; eve$$case_change (saved_mark); eve$position_in_middle (mark (free_cursor)); return (TRUE); ENDPROCEDURE; !**************************************** PROCEDURE EVE$WPS_SENTENCE local the_target, the_find, saved_mark; on_error [TPU$_CONTROLC]: eve$$restore_position (saved_mark); eve$learn_abort; abort; [OTHERWISE]: eve$$restore_position (saved_mark); endon_error; if not eve$declare_intention (eve$k_action_reposition) then return (FALSE); endif; saved_mark := mark (FREE_CURSOR); the_find := search_quietly (eve$x_wps_pattern_sentence, current_direction); if (the_find <> 0) then position (the_find); if (current_direction = REVERSE) then ! We're on the end of the previous sentence, now move to the ! beginning of it (go backwards to end of previous sentence, and ! then forward to the beginning of this one). if (mark (NONE) <> beginning_of (current_buffer)) then move_horizontal (-1); the_target := search_quietly (eve$x_wps_pattern_sentence, REVERSE); if (the_target <> 0) then position (the_target); else position (beginning_of (current_buffer)); endif; endif; endif; ! We've found end of sentence, now move to start of the next sentence. the_find := search_quietly (eve$x_wps_pattern_symbols, FORWARD); if (the_find <> 0) then position (the_find); else position (end_of (current_buffer)); endif; eve$$case_change (saved_mark); !Change case if we really moved return (TRUE); else if (current_direction = REVERSE) then position (beginning_of (current_buffer)); else if (current_direction = FORWARD) then position (end_of (current_buffer)); endif; endif; eve$message (EVE$_EOSNOTFOUND); eve$learn_abort; return (FALSE); endif; eve$position_in_middle (mark (free_cursor)); ENDPROCEDURE; !**************************************** PROCEDURE EVE$WRITE_FILE (write_buffer, ! Required buffer -- the buffer to write out write_file_name, ! Optional string -- file name to use; if null, use ! buffer's output_file; if null, ask for one; if null ! don't write it out. format_arg) ! Required integer -- Format number to write in ! 0 -- Editor default (ASCII for base EVE) ! 1 -- ASCII ! 2 -- DDIF (not supported in base EVE) ! else -- No other formats defined at present ! Procedure to write out a buffer to a file. Used by EXIT, WRITE FILE, ! and DELETE BUFFER. ! Return value: ! eve$k_success (1) -- File was written ! eve$k_warning (0) -- File was not written ! eve$k_async_prompting (3) -- dialog box is prompting for filename local the_file, ! Copy of write_file_name or prompted file name the_format, ! Local copy of format_arg status, ! Result from set(widget) the_value, ! Value for widget write_result; ! name of file actually written on_error [OTHERWISE]: endon_error; case format_arg from 0 to 2 [0]: the_format := 1; [1]: the_format := format_arg; [2]: return (FALSE); [OUTRANGE]: return (FALSE); endcase; if eve$x_trimming then eve$message (EVE$_TRIMMING); eve$trim_buffer (write_buffer); eve$message (EVE$_DONETRIM); endif; the_file := write_file_name; if the_file = "" then if (get_info (write_buffer, "output_file") = 0) and (get_info (write_buffer, "file_name") = "") then ! This branch taken only from WRITE FILE, not from EXIT procedures if (eve$$x_state_array {eve$$k_command_line_flag} = eve$k_invoked_by_menu) and (eve$$x_state_array {eve$$k_dialog_box}) then %if eve$x_option_decwindows %then if eve$x_decwindows_active then if get_info (eve$x_writefileprompt_dialog, "type") <> WIDGET then eve$x_writefileprompt_dialog := create_widget ("WRITEFILEPROMPT_DIALOG", eve$x_widget_hierarchy, SCREEN, eve$kt_callback_routine); endif; the_value := message_text (EVE$_FILENAMEPROMPT, 0, get_info (write_buffer, "name")); status := set (WIDGET, get_info (WIDGET, "widget_id", eve$x_writefileprompt_dialog, "WRITEFILEPROMPT_DIALOG.WRITEFILEPROMPT_LABEL"), eve$dwt$c_nlabel, the_value); eve$$set_responder (eve$$k_writefileprompt_ok, fao ("eve$$widget_writefileprompt_ok ('!AS', !UL)", get_info (write_buffer, "name"), the_format)); eve$manage_widget (eve$x_writefileprompt_dialog); endif; %endif return (eve$k_async_prompting); else the_file := eve$prompt_line (message_text (EVE$_WRITEFILEPROMPT, 1, get_info (write_buffer, "name")), eve$$x_prompt_terminators, ""); if (the_file = 0) or (the_file = "") then eve$message (EVE$_NOFILESPEC); if (the_file = 0) then return (FALSE); ! abort else return (TRUE); ! harmless return if no filename endif; endif; endif; endif; endif; if the_file = "" then write_result := eve$$write_file (write_buffer); else write_result := eve$$write_file (write_buffer, the_file); endif; if write_result = 0 then eve$learn_abort; return (FALSE); endif; ! ! Following code commented out - 910116 -- RHS ! !if write_result <> "" then ! set (OUTPUT_FILE, write_buffer, write_result); !endif; return (TRUE); ENDPROCEDURE; !**************************************** PROCEDURE EVE_BUFFER (BUFFER_PARAMETER) ! Map a buffer to the current window. If the buffer doesn't already ! exist, create a new buffer. local buffer_name, ! Local copy of buffer_parameter saved_buffer, ! Current buffer saved_mark, ! Current cursor position saved_window, ! Current window loop_buffer, ! Current buffer being checked in loop loop_buffer_name, ! String containing name of loop_buffer found_a_buffer, ! True if buffer found with same exact name possible_buffer_name, ! Most recent string entered in choice buffer possible_buffer, ! Buffer whose name is possible_buffer_name how_many_buffers, ! Number of buffers listed in choice buffer new_buffer; ! New buffer created when there is no match on_error [TPU$_CONTROLC]: eve$$restore_position (saved_window, saved_mark); eve$learn_abort; abort; [OTHERWISE]: eve$$restore_position (saved_window, saved_mark); endon_error; if eve$check_bad_window then eve$message (EVE$_CURSINTEXT); eve$learn_abort; return (FALSE); endif; if not eve$declare_intention (eve$k_action_new_buffer) then return (FALSE); endif; if not (eve$prompt_string (buffer_parameter, buffer_name, message_text (EVE$_BUFNAM, 1), message_text (EVE$_BUFNOTSWITCH, 0))) then eve$learn_abort; return (FALSE); endif; eve$cleanse_string (buffer_name); ! See if we already have a buffer by that name saved_mark := mark (FREE_CURSOR); saved_window := current_window; saved_buffer := current_buffer; loop_buffer := get_info (BUFFERS, "first"); change_case (buffer_name, UPPER); ! buffer names are uppercase erase (eve$choice_buffer); loop exitif loop_buffer = 0; loop_buffer_name := get_info (loop_buffer, "name"); if buffer_name = loop_buffer_name then found_a_buffer := 1; how_many_buffers := 1; exitif 1; else if buffer_name = substr (loop_buffer_name, 1, length (buffer_name)) then eve$add_choice (loop_buffer_name); possible_buffer := loop_buffer; possible_buffer_name := loop_buffer_name; how_many_buffers := how_many_buffers + 1; endif; endif; loop_buffer := get_info (BUFFERS, "next"); endloop; change_case (buffer_name, LOWER); ! for messages if found_a_buffer then if loop_buffer = saved_buffer then eve$message (EVE$_INBUFF, 0, loop_buffer_name); return (TRUE); ! no learn abort here else map (current_window, loop_buffer); endif; else if get_info (eve$choice_buffer, "record_count") > 0 then if how_many_buffers = 1 then if possible_buffer = saved_buffer then eve$message (EVE$_INBUFF, 0, possible_buffer_name); return (TRUE); ! no learn abort here else map (current_window, possible_buffer); endif; else eve$display_choices (message_text (EVE$_AMBBUF, 0, buffer_name), !** How do we get the synonym for the key that was defined to this command? "buffer ", buffer_name); eve$learn_abort; return (FALSE); endif; else if not eve$create_new_buffer (buffer_name) then return (FALSE); endif; endif; endif; eve$set_status_line (current_window); eve$position_in_middle (mark (free_cursor)); return (TRUE); ENDPROCEDURE; ! eve_buffer !**************************************** PROCEDURE EVE_CHANGE_MODE ! Toggle mode between insert and overstrike ! Additionally, change insert/overstike mode for box cut/paste operations if get_info (current_buffer, "mode") = OVERSTRIKE then set (INSERT, current_buffer); eve$x_box_pad_flag := FALSE; ! eve$message (EVE$_BOXNOPADMODE); eve$define_attr ("eve_set_box_nopad", "eve_set_box_nopad;", message_text (EVE$_BOXNOPADMODE, 0)); else set (OVERSTRIKE, current_buffer); eve$x_box_pad_flag := TRUE; ! eve$message (EVE$_BOXPADMODE); eve$define_attr ("eve_set_box_pad", "eve_set_box_pad;", message_text (EVE$_BOXPADMODE, 0)); endif; eve$update_status_lines; return (TRUE); ENDPROCEDURE; !**************************************** PROCEDURE EVE_DCL (DCL_PARAMETER) ! Run a DCL command and put the output in a second window on the screen. ! This is the only command to automatically create a second window if ! needed, but the user is left in the current buffer at the end of the ! command (reduce trap-door risk). Returns true if successful, false ! if no dcl command was issued. ! ! Parameters: ! ! dcl_parameter String containing DCL command - input local dcl_string, ! Local copy of dcl_parameter dcl_window, ! Window to map dcl_buffer this_window, ! Current window this_buffer, ! Current buffer map_status; on_error [TPU$_CREATEFAIL]: %if eve$x_option_decwindows %then if eve$x_decwindows_active then eve$popup_message (message_text (EVE$_CANTCREADCL, 1)); else eve$message (EVE$_CANTCREADCL); endif; %else eve$message (EVE$_CANTCREADCL); %endif eve$learn_abort; return (FALSE); [OTHERWISE]: endon_error; if not (eve$prompt_string (dcl_parameter, dcl_string, message_text (EVE$_DCLPROMT, 1), message_text (EVE$_NODCLCMD, 0))) then eve$learn_abort; return (FALSE); endif; if (get_info (eve$dcl_buffer, "type") <> BUFFER) then if eve$x_buf_str_dcl = tpu$k_unspecified then eve$x_buf_str_dcl := "DCL"; endif; eve$dcl_buffer := eve$init_buffer (eve$x_buf_str_dcl, ""); endif; if (get_info (eve$x_dcl_process, "type") = UNSPECIFIED) or (eve$x_dcl_process = 0) then eve$message (EVE$_CREATEDCL); eve$x_dcl_process := create_process (eve$dcl_buffer, "$ set noon"); endif; ! ! Following code added 900406 - RHS ! map_status := eag$x_map_on; if eag$x_map_on then eve_set_nomapping; endif; ! ! this_buffer := current_buffer; if this_buffer = eve$dcl_buffer then dcl_window := current_window; else if eve$x_number_of_windows = 1 then eve_split_window (2); this_window := eve$top_window; update (eve$top_window); dcl_window := current_window; map (dcl_window, eve$dcl_buffer); else this_window := current_window; dcl_window := eve$get_mapped_window (eve$dcl_buffer); if dcl_window = 0 then ! insure the dcl_window is opposite the current_window dcl_window := eve$bottom_window; if dcl_window = this_window then dcl_window := eve$top_window; endif; endif; map (dcl_window, eve$dcl_buffer); endif; endif; eve$set_status_line (dcl_window); position (end_of (eve$dcl_buffer)); ! Process the DCL string - need to include the $ split_line; copy_text (dcl_string); update (current_window); send (dcl_string, eve$x_dcl_process); position (end_of (eve$dcl_buffer)); update (current_window); if this_buffer <> eve$dcl_buffer then position (this_window); endif; ! ! Following code added 900406 - RHS ! if map_status then eve_one_window; eve_set_mapping; message ("Output (if any) from DCL cmd is in DCL buffer"); endif; ! ! return (TRUE); ENDPROCEDURE; ! eve_dcl !**************************************** PROCEDURE EVE_ERASE_CHARACTER ! Delete current character local char_range, delete_eol, saved_mark, start_mark; on_error [TPU$_CONTROLC]: eve$$restore_position (saved_mark); ! restore free cursor position eve$learn_abort; abort; [OTHERWISE]: eve$$restore_position (saved_mark); endon_error; if not eve$declare_intention (eve$k_action_erase_character) then return (FALSE); endif; saved_mark := mark (FREE_CURSOR); if not get_info (current_window, "beyond_eob") then if not (get_info (current_window, "before_bol") or get_info (current_window, "middle_of_tab")) then position (TEXT); ! snap to text endif; else position (TEXT); ! snap to text saved_mark := mark (FREE_CURSOR); endif; if mark (NONE) = end_of (current_buffer) then move_vertical (1); ! force error msg and return endif; if current_character = "" then delete_eol := TRUE; else delete_eol := FALSE; endif; char_range := create_range (mark (NONE), mark (NONE), NONE); eve$x_erased_char_forward := FALSE; eve$x_restore_char := eve$erase_text (char_range, eve$x_char_buffer, delete_eol); ! ! Following code modified - 900406 - RHS ! !if (get_info (current_buffer, "mode") = OVERSTRIKE) then ! if not delete_eol then ! eve$insert_text (" "); ! endif; !endif; ! ! return (TRUE); ENDPROCEDURE; ! EVE_ERASE_CHARACTER !**************************************** 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. ! ! modified 900514 - RHS to allow non-DECWindows terminals to use modified ! version of eve$get_file1 (wildcard get) ! %if eve$x_option_decwindows %then if eve$x_decwindows_active then return (eve$get_file1 (get_file_parameter)); else return (pce$get_file1 (get_file_parameter)); endif; %else return (pce$get_file1 (get_file_parameter)); %endif ENDPROCEDURE; !**************************************** PROCEDURE EVE_INCLUDE_FILE (INCLUDE_FILE_PARAMETER) ! Like read_file built-in, but positions the cursor at the start of ! the inserted file. Handles wildcarding in file name. local include_file_name, ! Local copy of include_file_parameter started_at_bof, ! True if current position at start of file include_position, ! Marker for where cursor should end up file_count, ! Number of files matching the spec temp, temp_file_name, ! First file name string - from file_parse current_file_name, current_file_type; on_error [TPU$_CONTROLC]: eve$learn_abort; return (FALSE); [TPU$_TRUNCATE]: eve$message (error_text, error); [OTHERWISE]: endon_error; position (TEXT); ! no padding if eve$check_bad_window then eve$message (EVE$_CURSINTEXT); eve$learn_abort; return (FALSE); endif; if not eve$declare_intention (eve$k_action_include_file) then return (FALSE); endif; if not (eve$prompt_string (include_file_parameter, include_file_name, message_text (EVE$_INCLPROMPT, 1), message_text (EVE$_NOFILEINCL, 0))) then eve$learn_abort; return (FALSE); endif; ! ! Following code added 900406 - RHS ! ! If no file type is given use file type of file name of current buffer ! current_file_name := get_info(current_buffer, "name"); current_file_type := substr(current_file_name, index(current_file_name, '.'), length(current_file_name)); include_file_name := file_parse(include_file_name, "", "", node) + file_parse(include_file_name, "", "", device) + file_parse(include_file_name, "", "", directory) + file_parse(include_file_name, "", "", name) + file_parse(include_file_name, current_file_type, "", type) + file_parse(include_file_name, "", "", version); ! ! if mark (FREE_CURSOR) = beginning_of (current_buffer) then started_at_bof := 1; endif; if started_at_bof then include_position := mark (FREE_CURSOR); else move_horizontal (-1); include_position := mark (FREE_CURSOR); move_horizontal (1); endif; ! Initialize to null string and protect against earlier file_search ! with same file name. eve$reset_file_search; temp_file_name := file_parse (include_file_name); erase (eve$choice_buffer); temp := eve$$file_search_loop (include_file_name, file_count, TRUE); if temp <> "" then temp_file_name := temp; endif; case get_info (eve$choice_buffer, "record_count") from 0 to 1 [0]: eve$message (EVE$_CANTINCLFILE, 0, include_file_name); [1]: read_file (temp_file_name); if started_at_bof then position (beginning_of (current_buffer)); else ! position (include_position); eve$position_in_middle (include_position); move_horizontal (1); endif; return (TRUE); [OUTRANGE]: ! ! Following code added 900604 - RHS ! ! multiple files specified (wild-carded) position(beginning_of(eve$choice_buffer)); loop ! get all the files specified by user's wild-card choice_position := mark(none); if current_line <> eve$kt_null then temp_file_name := current_line; position (include_position); read_file (temp_file_name); endif; position(choice_position); move_vertical(1); exitif mark(none) = end_of(current_buffer); endloop; if started_at_bof then position (include_position); position (beginning_of (current_buffer)); else eve$position_in_middle (include_position); move_horizontal (1); endif; update(current_window); return (TRUE); ! ! ! ! Following code commented out 900406 - RHS ! !! give resolved node/dev/dir if search_list or [...] ! temp_file_name := file_parse (temp_file_name, "", "", NODE, DEVICE, DIRECTORY) ! + file_parse (include_file_name, "", "", NAME, TYPE, VERSION); !!** How do we get the synonym for the key that was defined to this command? ! eve$display_choices (message_text (EVE$_AMBFILE, 0, include_file_name), ! "include file ", temp_file_name); endcase; eve$learn_abort; return (FALSE); ENDPROCEDURE; !**************************************** PROCEDURE EVE_MOVE_BY_PAGE local saved_mark, ! Marker where we started saved_scrolls, ! Boolean set if saved_scroll_xxx valid saved_scroll_top, ! Original value of scroll_top saved_scroll_bottom, ! Original value of scroll_bottom saved_scroll_amount, ! Original value of scroll_amount window_length; ! For finding bottom of scroll region on_error [TPU$_CONTROLC]: if saved_scrolls then set (SCROLLING, current_window, ON, saved_scroll_top, saved_scroll_bottom, saved_scroll_amount); update (current_window); endif; eve$learn_abort; abort; [TPU$_STRNOTFOUND]: if current_window = eve$prompt_window then eve$learn_abort; return (FALSE); endif; if current_direction = FORWARD then position (end_of (current_buffer)); if mark (NONE) <> saved_mark then eve$message (EVE$_NONEXTPAGE); endif; else position (beginning_of (current_buffer)); if mark (NONE) <> saved_mark then eve$message (EVE$_NOPREVPAGE); endif; endif; [OTHERWISE]: if saved_scrolls then set (SCROLLING, current_window, ON, saved_scroll_top, saved_scroll_bottom, saved_scroll_amount); update (current_window); endif; endon_error; if not eve$declare_intention (eve$k_action_reposition) then return (FALSE); endif; saved_mark := mark (FREE_CURSOR); ! prevent padding position (TEXT); ! snap cursor to prevent padding ! ! Following line modified - 900406 - RHS ! !position (search (PAGE_BREAK, current_direction, EXACT)); ! want error if none eve$position_in_middle (search (PAGE_BREAK, current_direction, EXACT)); ! ! if mark (NONE) = saved_mark then if current_direction = FORWARD then move_horizontal (1); else move_horizontal (-1); endif; ! ! Following line modified - 900406 - RHS ! ! position (search (PAGE_BREAK, current_direction, EXACT)); eve$position_in_middle (search (PAGE_BREAK, current_direction, EXACT)); endif; if eve$x_repeat_count <= 1 then ! save old scrolling region saved_scroll_amount := get_info (current_window, "scroll_amount"); saved_scroll_bottom := get_info (current_window, "scroll_bottom"); saved_scroll_top := get_info (current_window, "scroll_top"); saved_scrolls := TRUE; ! for error handler window_length := get_info (current_window, "visible_bottom") - get_info (current_window, "visible_top"); ! find # of lines from bottom to place cursor window_length := window_length - saved_scroll_top; ! quickly force cursor to top of screen set (SCROLLING, current_window, ON, saved_scroll_top, window_length, 0); update (current_window); ! be sure to show it ! reset old scrolling region set (SCROLLING, current_window, ON, saved_scroll_top, saved_scroll_bottom, saved_scroll_amount); endif; return (TRUE); ENDPROCEDURE; ! EVE_MOVE_BY_PAGE !**************************************** PROCEDURE EVE_ONE_WINDOW ! Delete windows and map only one window on the screen local this_window, ! Current window the_number; on_error [TPU$_CONTROLC]: if eve$x_number_of_windows = 1 then eve$x_number_of_windows := 2; ! get past only one test below endif; eve_one_window; eve$learn_abort; abort; [TPU$_NOTARRAY]: if eve$eve_in_control then eve$message (error_text, error); endif; eve$learn_abort; return (0); [OTHERWISE]: endon_error; eve$check_bad_window; this_window := current_window; the_number := eve$$get_window_number; if (eve$x_number_of_windows = 1) or (the_number = 0) then eve$message (EVE$_ONLYONE); ! no learn_abort here else if get_info (eve$$x_ruler_window, "type") = WINDOW then if get_info (eve$$x_ruler_window, "buffer") <> 0 then eve$$exit_ruler; endif; endif; ! eve$x_number_of_windows can exceed actual window count, and the ! following will still work loop exitif eve$x_number_of_windows < 1; if (eve$$x_windows {eve$x_number_of_windows} <> this_window) and (get_info (eve$$x_windows {eve$x_number_of_windows}, "type") = WINDOW) then ! in case ^C aborted this loop after deleting a window ! but before decrementing the count delete (eve$$x_windows {eve$x_number_of_windows}); endif; eve$x_number_of_windows := eve$x_number_of_windows - 1; endloop; eve$x_number_of_windows := 1; eve$$x_windows {the_number} := tpu$k_unspecified; eve$$x_windows {1} := this_window; adjust_window (this_window, 1 - get_info (this_window, "top", WINDOW), eve$main_window_length - get_info (this_window, "bottom", WINDOW)); ! reset the window's attributes that changed due to adjust_window if (eve$x_scroll_top <> 0) or (eve$x_scroll_bottom <> 0) then eve$set_scroll_margins (this_window, eve$x_scroll_top, eve$x_scroll_bottom); endif; endif; ! ! Following code was added 900406 - RHS ! if eag_map_lock = 1 then eag$x_pre_command_window := current_window; adjust_window (current_window, 0, -eag_map_lines); position (eag$x_pre_command_window); eag_show_map; endif; ! ! return (TRUE); ENDPROCEDURE; ! EVE_ONE_WINDOW !**************************************** PROCEDURE EVE_TWO_WINDOWS ! ! Following code was modified 900406 - RHS ! if eve$x_number_of_windows = 2 then message ("Already 2 windows on screen - Operation cancelled"); else return (eve_split_window (2)); endif; ! ! ENDPROCEDURE; ! EVE_TWO_WINDOWS !**************************************** PROCEDURE PCE$GET_FILE1 (GET_FILE_PARAMETER; NEW_BUF_NAME) ! ! This is the pre 5.3 EVE_GET_FILE procedure as modified for use in TPUPlus. ! Until such time as I can get DEC's new version of this routine to work ! as this one does then I will continue to use this old version. In this ! version the parameter NEW_BUF_NAME (above) is a dummy variable. ! ! 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. ! ! Modified 881112 by R. Stacks to handle getting multiple files (i.e. ! wildcard file specs) while in the editor... NOT on start up... ! NOTE: This version somehow allows wildcarding on start-up... ! ! 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, ! Save the filename temp_file_name, ! First file name string returned by file_search loop_buffer, ! Buffer currently being checked in loop file_count, ! Number of files matching the spec temp_answer, ! Answer to "Create file?" 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 [TPU$_CONTROLC]: eve$learn_abort; abort; [TPU$_SEARCHFAIL]: eve$message (EVE$_NOSUCHFILE, 0, get_file_name); eve$learn_abort; return (FALSE); [OTHERWISE]: endon_error; if eve$check_bad_window then eve$message (EVE$_CURSINTEXT); eve$learn_abort; return (FALSE); endif; if not (eve$prompt_string (get_file_parameter, get_file_name, message_text (EVE$_GETFILEPROMPT, 1), message_text (EVE$_NOFILESPEC, 0))) then eve$learn_abort; return (FALSE); 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. eve$reset_file_search; temp_file_name := ""; erase (eve$choice_buffer); loop file_search_result := eve$$file_search (get_file_name); exitif file_search_result = ""; file_count := file_count + 1; eve$add_choice (file_search_result); temp_file_name := file_search_result; endloop; if file_count > 1 then ! If get_file is called from eve$init_procedure, can't handle ! multiple choices, so set status line on main window and return if eve$x_starting_up then !** How do we get the synonym for the key that was defined to this command? eve$display_choices (message_text (EVE$_AMBFILE, 0, get_file_name), "get file " + get_file_name); eve$learn_abort; return (FALSE); endif; ! otherwise we are in the editor already, past the init part then, ! get all files specified by the user's use of wildcards eve$reset_file_search; temp_file_name := ""; erase (eve$choice_buffer); loop ! set up to search for the files again, ! this time pull each one into the editor using ! a separate buffer for each file file_search_result := eve$$file_search (get_file_name); exitif file_search_result = ""; temp_file_name := file_search_result; ! Set-up to see if we already have a buffer by that name if temp_file_name = "" then temp_buffer_name := file_parse (get_file_name, "", "", NAME, TYPE); else temp_buffer_name := file_parse (temp_file_name, "", "", NAME, TYPE); endif; temp_file := get_file_name; get_file_name := file_parse (get_file_name); if get_file_name = "" then get_file_name := temp_file; endif; ! Make sure we don't try to use a wildcard file-spec to create a new file. if file_count = 0 then if eve$is_wildcard (get_file_name) then eve$message (EVE$_NOFILMATCH, 0, get_file_name); eve$learn_abort; return (FALSE); endif; endif; 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 = "" 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 eve$message (EVE$_BUFINUSE, 0, temp_buffer_name); temp_buffer_name := eve$prompt_line(message_text(EVE$_NEWBUFPROMPT, 1), eve$$x_prompt_terminators, ""); if temp_buffer_name = 0 then eve$learn_abort; return (FALSE); endif; if temp_buffer_name = "" then eve$message (EVE$_NOBUFFCREA); eve$learn_abort; return (FALSE); else new_buffer := eve$create_buffer (temp_buffer_name, get_file_name, temp_file_name); if new_buffer = 0 then return (FALSE); endif; endif; else if current_buffer = loop_buffer then eve$message (EVE$_ALREDIT, 0, get_file_name); eve$learn_abort; return (FALSE); else map (current_window, loop_buffer); endif; endif; else if (temp_file_name = "") and (eve$x_starting_up) and (get_info (COMMAND_LINE, "create") = 0) then ! EXIT the editor: input file doesn't exist and /NOCREATE was specified eve$message (EVE$_NOSUCHFILE, 0, get_file_name); exit; endif; ! 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); if new_buffer = 0 then return (FALSE); endif; endif; ! Correct the status line in any event eve$set_status_line (current_window); set (informational, off); pce$init_tabs; set (informational, on); endloop; else ! Set-up to see if we already have a buffer by that name if temp_file_name = "" then temp_buffer_name := file_parse (get_file_name, "", "", NAME, TYPE); else temp_buffer_name := file_parse (temp_file_name, "", "", NAME, TYPE); endif; temp_file := get_file_name; get_file_name := file_parse (get_file_name); if get_file_name = "" then get_file_name := temp_file; endif; ! Make sure we don't try to use a wildcard file-spec to create a new file. if file_count = 0 then if eve$is_wildcard (get_file_name) then eve$message (EVE$_NOFILMATCH, 0, get_file_name); eve$learn_abort; return (FALSE); endif; endif; 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 = "" 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 eve$message (EVE$_BUFINUSE, 0, temp_buffer_name); temp_buffer_name := eve$prompt_line(message_text(EVE$_NEWBUFPROMPT, 1), eve$$x_prompt_terminators, ""); if temp_buffer_name = 0 then eve$learn_abort; return (FALSE); endif; if temp_buffer_name = "" then eve$message (EVE$_NOBUFFCREA); eve$learn_abort; return (FALSE); else new_buffer := eve$create_buffer (temp_buffer_name, get_file_name, temp_file_name); if new_buffer = 0 then return (FALSE); endif; endif; else if current_buffer = loop_buffer then eve$message (EVE$_ALREDIT, 0, get_file_name); eve$learn_abort; return (FALSE); else map (current_window, loop_buffer); endif; endif; else if (temp_file_name = "") and (eve$x_starting_up) and (get_info (COMMAND_LINE, "create") = 0) then ! EXIT the editor: input file doesn't exist and /NOCREATE was specified eve$message (EVE$_NOSUCHFILE, 0, get_file_name); exit; endif; ! 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); if new_buffer = 0 then return (FALSE); endif; endif; ! Correct the status line in any event eve$set_status_line (current_window); endif; set (informational, off); pce$init_tabs; set (informational, on); if eag_map_lock = 1 then eag_show_map; endif; ! !%IF eve$x_option_evej ! !%THEN ! !% eve$conversion_start; ! !%ENDIF return (TRUE); ENDPROCEDURE; pce$case_sensitive := ""; pce$x_select_marker := 0; eve$x_box_highlighting := NONE; ENDMODULE;