! EVE$SHOW.TPU 11-APR-1989 15:42 Page 1 ! EVE - { Extensible | Easy | Efficient } Vax Editor ! !************************************************************************* ! * ! © Copyright 2005 Hewlett-Packard Development Company, L.P. * ! * ! Confidential computer software. Valid license from HP required for * ! possession, use or copying. Consistent with FAR 12.211 and 12.212, * ! Commercial Computer Software, Computer Software Documentation, and * ! Technical Data for Commercial Items are licensed to the U.S. * ! Government under vendor's standard commercial license. * ! * !************************************************************************* ! !++ ! FACILITY: ! VAX Language-Sensative Editor ! ! ABSTRACT: ! This file contains TPU procedures for LSE that relate to the contents ! of the EVE$SHOW.TPU file. ! ! ENVIRONMENT: ! VAX/VMS ! !Author: Paul B. Patrick, Duane Smith, Glenn J. Joyce ! ! CREATION DATE: 13-Jul-1989 ! ! MODIFIED BY: ! ! X3.0-0 PBP 13-Jul-89 Create this file ! X3.0-1 PBP 31-Jul-89 Updated with Change from EVE V2.4 ! X3.0-2 PBP 14-Aug-89 Renamed temp_buffer and lowercase_topic ! to temp ! X3.0-3 PBP 15-Aug-89 Fixed module name to remove conflict ! X3.1 DAS 08-May-90 Supercede EVE$DELETE_BUFFER to only verify ! buffers that are writeable. ! X3.2 WCC 17-Sep-90 change lse$do_command('goto screen') to ! lse_next_screen and lse_previous_screen. ! X3.2-1 DAS 29-Oct-90 Fixed UNSPECIFIED problem when cleaning up ! the buffer_list after deleting a buffer. ! X3.2-2 GJJ 28-Feb-91 Applied name coversions to the resource ! and callback names; updated the copyright. ! X4.0-1 SHE 01-Aug-91 Changed calls to CREATE_WIDGET to calls to ! lse$create_dialog_box to getting min. widths ! and heights for resizeable dialog boxes. ! X4.0-2 WC3 16-Oct-91 Use LSE_SAVE_FILE instead of eve$write_file in ! eve$delete_buffer. ! X4.0-3 DAS 27-Oct-91 Missing LOCAL TEARDOWN_WHEN_DONE ! X4.0-4 DAS 14-Nov-91 Empty module init ! X4.0-5 SHE 03-Dec-91 Remove EVE's eve$$set_responder paradigm. ! X4.0-6 SHE 02-Mar-92 Removed set_responder for eve$$k_writedelprompt_ok !-- procedure lse$eve_show_module_ident return "X4.0-6"; endprocedure; ! EVE$SHOW.TPU Page 13 procedure eve_show_summary ! List TPU and EVE version etc. local temp, the_length, the_names, the_name, the_key, legend, lowercase_topic, topic, faci, the_key_map_list, saved_mark, saved_window, space_index, temp_buffer, this_buffer, teardown_when_done; on_error [TPU$_CONTROLC]: if teardown_when_done then eve$teardown_windows; endif; if saved_window <> tpu$x_show_window then ! don't unmap it if that's what was mapped unmap (tpu$x_show_window); else unmap (saved_window, this_buffer); endif; eve$$restore_position (saved_window, saved_mark); eve$learn_abort; abort; [OTHERWISE]: if teardown_when_done then eve$teardown_windows; endif; if saved_window <> tpu$x_show_window then ! don't unmap it if that's what was mapped unmap (tpu$x_show_window); else unmap (saved_window, this_buffer); endif; eve$$restore_position (saved_window, saved_mark); endon_error; ! eve$check_bad_window; if get_info (eve$prompt_window, "buffer") <> 0 then eve$message(EVE$_CANTSHOW); update(message_window); eve$learn_abort; return (FALSE); endif; saved_mark := mark (FREE_CURSOR); saved_window := current_window; this_buffer := get_info (current_window, "buffer"); if get_info (tpu$x_show_buffer,"type") <> BUFFER then temp := get_info (BUFFERS, "find_buffer", "$SHOW"); if temp <> 0 then ! User must have created own show buffer ! so delete it delete (temp); endif; tpu$x_show_buffer := eve$init_buffer ("$SHOW", ""); endif; ! test if EVE is in control of the interface if not eve$eve_in_control then if get_info (WINDOWS, "first") = 0 then temp := current_buffer; teardown_when_done := TRUE; eve$setup_windows (tpu$x_show_buffer); position (temp); endif; endif; position (tpu$x_show_buffer); erase(tpu$x_show_buffer); map (tpu$x_show_window, tpu$x_show_buffer); set (status_line, tpu$x_show_window, REVERSE, " Buffer: $SHOW"); eve$set_fixed_status_line (tpu$x_show_buffer, compile ("return eve$$sys_window_status")); show (SUMMARY); position (beginning_of (tpu$x_show_buffer)); !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! ! The following must by synchronized with the literal in TPU. !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! temp := search_quietly ("Timer Message", FORWARD); !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! if temp <> 0 then position (temp); move_horizontal (-current_offset); erase_line; temp := current_line; edit (temp, TRIM, OFF); if temp = "" then erase_line; endif; endif; position (beginning_of (tpu$x_show_buffer)); !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! ! The following must by synchronized with the literal in TPU. !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! temp := search_quietly ("calls to LIB$GET_VM,", FORWARD); !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! if temp <> 0 then position (temp); move_horizontal (-current_offset); erase_line; endif; position (end_of (tpu$x_show_buffer)); eve$insert_module_summary; position (beginning_of (tpu$x_show_buffer)); the_key_map_list := eve$current_key_map_list; LOOP eve$set_status_line(tpu$x_show_window); temp := eve$prompt_line ( "Press RETURN to exit: ", HELP, ""); exitif temp = 0; the_key := last_key; faci := ''; legend := ''; topic := ''; eve$$parse_comment (the_key, the_key_map_list,faci,legend, topic); if not eve$on_a_pre_lk201 then eve$$x_help_vt100 := false; else eve$$x_help_vt100 := true; endif; if (eve$$x_help_vt100) then if eve$test_synonym ("move_up", topic) then lse_previous_screen; else if eve$test_synonym ("move_down", topic) then lse_next_screen; endif; endif; else if (eve$test_synonym ("next_screen", topic)) or (eve$test_synonym ("previous_screen", topic)) then execute (the_key, the_key_map_list); ! delete a character from reply endif; endif; exitif the_key = ret_key; ENDLOOP; set (status_line, tpu$x_show_window, NONE, ""); unmap(tpu$x_show_window); map (saved_window, this_buffer); !eve$set_status_line (tpu$x_show_window); return (TRUE); endprocedure ! ! This procedure EVE$DELETE_BUFFER is being superceded in order to fix a bug. ! The bug is that the user should not have to verify buffers that are set to ! not be written. This was discussed in TPU_DESIGN note 218 and EVE said that ! they will pick up this change. ! ! EVE$SHOW.TPU Page 7 procedure eve$delete_buffer ! Delete a buffer (the_buffer, ! Buffer to delete remove_flag; ! Set if should remove entry in BUFFER LIST buffer the_answer, ! Answer string: delete_only, write_first, or ! quit [=EXIT key or its synonyms] the_file_name) ! Output file_name for the buffer ! This routine actually deletes a specific buffer. local answer, answer_length, problem, ! "modified", "system", ... buffer_name, flag, saved_mark, ! Remember where are in case abort saved_window, ! Remember where in case need to abort same_buffer, ! Flag set if cursor is in buffer to be deleted mapped_elsewhere, ! Flag set if buffer mapped <> current window output_file_name, ! File to which to pre-write the deleted buffer status, ! Status from set (widget) delete_only, ! String of eve$_delete_only write_first, ! String of eve$_write_first new_buffer; ! Buffer to map in place of deleted one. on_error [TPU$_CONTROLC]: eve$$restore_position (saved_window, saved_mark); eve$learn_abort; abort; [TPU$_INVBUFDELETE]: eve$message (error_text, error); eve$$restore_position (saved_window, saved_mark); [OTHERWISE]: eve$$restore_position (saved_window, saved_mark); endon_error; problem := ""; if get_info (the_buffer, "type") <> BUFFER then eve$learn_abort; return (FALSE); endif; ! handle permanent buffers first if get_info (the_buffer, "permanent") then eve$message (TPU$_INVBUFDELETE); eve$learn_abort; return (FALSE); endif; delete_only := message_text (EVE$_DELETE_ONLY, 1); write_first := message_text (EVE$_WRITE_FIRST, 1); ! See if buffer can't be deleted without notifying user saved_window := current_window; saved_mark := mark (FREE_CURSOR); buffer_name := get_info (the_buffer, "name"); ! ! Prior to LSE change... ! !if get_info (the_buffer, "modified") and ! (get_info (the_buffer, "record_count") <> 0) !then ! problem := message_text (EVE$_MODIFIED, 1); !endif; ! ! After LSE change ! if not get_info (the_buffer, "no_write") then if get_info (the_buffer, "modified") then problem := message_text (EVE$_MODIFIED, 1); endif; endif; if get_info (the_buffer, "system") then if problem <> "" then problem := problem + " "; endif; problem := problem + message_text (EVE$_SYSTEM, 1); endif; edit (problem, LOWER, TRIM); if the_answer <> tpu$k_unspecified then answer := the_answer; edit (answer, TRIM, COMPRESS, LOWER); else answer := message_text (EVE$_DELETE_ONLY, 1); endif; answer_length := length (answer); ! any problems? if (problem <> "") and (the_answer = tpu$k_unspecified) then loop if (eve$$x_state_array {eve$$k_command_line_flag} = eve$k_invoked_by_menu) and (eve$$x_state_array {eve$$k_dialog_box}) ! user hasn't disabled dialogs then %if eve$x_option_decwindows %then ! ! ## LSE Change ! lse$$menus_reallydelbuf_dialog (buffer_name); %endif return (eve$k_async_prompting); else answer := eve$prompt_line (message_text (EVE$_REALLYDELBUF, 1, problem), eve$$x_prompt_terminators, ""); if answer = 0 then return (FALSE); endif; endif; edit (answer, TRIM, COMPRESS, LOWER); answer_length := length (answer); if eve$test_synonym ("exit", eve$$lookup_comment (last_key, eve$x_key_map_list)) or (answer_length = 0) or (answer = substr (eve$x_quit, 1, answer_length)) then eve$message (EVE$_NOBUFDELED); eve$learn_abort; return (FALSE); endif; exitif (answer = substr (delete_only, 1, answer_length)); exitif (answer = substr (write_first, 1, answer_length)); ! keep looping until a valid response (D, W, Q=RETURN=^Z) endloop; endif; ! If buffer to delete = current_buffer, or it's not but it's mapped elsewhere, ! then get a buffer to map in its place. if (current_buffer = the_buffer) then same_buffer := TRUE; else if get_info (the_buffer, "map_count") > 0 then mapped_elsewhere := 1; endif; endif; new_buffer := current_buffer; if same_buffer or mapped_elsewhere then new_buffer := get_info (BUFFERS, "first"); loop exitif new_buffer = 0; exitif (not get_info (new_buffer, "system")) and (new_buffer <> the_buffer); new_buffer := get_info (BUFFERS, "next"); endloop; if new_buffer = 0 then new_buffer := eve$x_buf_str_main; if not eve$x_ultrix_active then ! upcase buffer names only on VMS change_case (new_buffer, UPPER); endif; if get_info (the_buffer, "name") <> new_buffer then eve_buffer (new_buffer); new_buffer := current_buffer; else %if eve$x_option_decwindows %then eve$popup_message (message_text (EVE$_CANTDELBUF, 1, eve$x_buf_str_main)); %else eve$message (EVE$_CANTDELBUF, eve$x_buf_str_main); %endif eve$learn_abort; return (FALSE); endif; endif; endif; if (new_buffer <> the_buffer) then if (answer = substr (write_first, 1, answer_length)) then if the_file_name <> tpu$k_unspecified then output_file_name := the_file_name; else if (get_info (the_buffer, "output_file") = 0) and (get_info (the_buffer, "file_name") = "") then if not lse$prompt_string ( '', output_file_name, FAO (lse$get_message_text (EVE$_WRITEDELPROMPT), buffer_name), '') then eve$message (EVE$_NOBUFDELED); eve$$restore_position (saved_window, saved_mark); return (FALSE); else if (output_file_name = "") then eve$message (EVE$_NOBUFDELED); eve$$restore_position (saved_window, saved_mark); return (FALSE); endif; endif; else output_file_name := ""; endif; endif; !LSE if not eve$write_file (the_buffer, output_file_name, 0) lse$$push_position; position( the_buffer ); flag := lse_save_file (output_file_name); lse$$pop_position; if not flag then ! another message even if eve$write_file already did one %if eve$x_option_decwindows %then eve$popup_message (message_text (EVE$_CANTWRITEDELBUF, 1, buffer_name)); %else eve$message (EVE$_CANTWRITEDELBUF, 0, buffer_name); %endif eve$$restore_position (saved_window, saved_mark); return (FALSE); endif; endif; eve$remap_windows (the_buffer, new_buffer); if (get_info (saved_mark, "buffer") = the_buffer) and (current_buffer <> new_buffer) then eve_buffer (get_info (new_buffer, "name")); endif; if mapped_elsewhere then eve$$restore_position (saved_window, saved_mark); endif; delete (the_buffer); if get_info (eve$x_select_position, "type") = UNSPECIFIED then ! the selection was in that buffer eve$x_select_position := 0; eve$stop_pending_delete; endif; eve$message (EVE$_BUFDELED, 0, buffer_name); endif; ! restore writedelprompt_ok widget to invalid_event program ! ### LSE Change ! !%if eve$x_option_decwindows !%then !eve$$set_responder (eve$$k_writedelprompt_ok, ! "eve$invalid_event(" + str (eve$$k_writedelprompt_ok) + ! ")"); !%endif if remove_flag <> tpu$k_unspecified then if remove_flag then saved_window := current_window; saved_mark := mark (FREE_CURSOR); if get_info (eve$x_bufed_buffer, "type") <> BUFFER then ! The BUFFER LIST buffer was just deleted, exit return (TRUE); ! or else we'll delete a line in user's buffer else position (eve$x_bufed_buffer); endif; position (LINE_END); move_horizontal (-1); if current_character = "-" then move_horizontal (-current_offset); set (MODIFIABLE, eve$x_bufed_buffer, ON); erase_line; set (MODIFIABLE, eve$x_bufed_buffer, OFF); else move_horizontal (-current_offset); endif; set (MODIFIABLE, eve$x_bufed_buffer, ON); erase_line; set (MODIFIABLE, eve$x_bufed_buffer, OFF); ! sync remapped window with saved editing position map (saved_window, get_info (saved_mark, "buffer")); endif; endif; return (TRUE); endprocedure; ! eve$delete_buffer