! EVE$HELP.TPU 31-DEC-1992 10:31 Page 1 module eve$help ident "V03-009" ! ! COPYRIGHT © 1987,1991 BY ! DIGITAL EQUIPMENT CORPORATION, MAYNARD, MASSACHUSETTS ! ALL RIGHTS RESERVED ! ! THIS SOFTWARE IS FURNISHED UNDER A LICENSE AND MAY BE USED AND COPIED ! ONLY IN ACCORDANCE WITH THE TERMS OF SUCH LICENSE AND WITH THE ! INCLUSION OF THE ABOVE COPYRIGHT NOTICE. THIS SOFTWARE OR ANY OTHER ! COPIES THEREOF MAY NOT BE PROVIDED OR OTHERWISE MADE AVAILABLE TO ANY ! OTHER PERSON. NO TITLE TO AND OWNERSHIP OF THE SOFTWARE IS HEREBY ! TRANSFERRED. ! ! THE INFORMATION IN THIS SOFTWARE IS SUBJECT TO CHANGE WITHOUT NOTICE ! AND SHOULD NOT BE CONSTRUED AS A COMMITMENT BY DIGITAL EQUIPMENT ! CORPORATION. ! ! DIGITAL ASSUMES NO RESPONSIBILITY FOR THE USE OR RELIABILITY OF ITS ! SOFTWARE ON EQUIPMENT WHICH IS NOT SUPPLIED BY DIGITAL. ! !++ ! FACILITY: ! DECTPU - Text Processing Utility ! EVE - Extensible Versatile Editor ! ! ABSTRACT: ! This is the source program for the EVE interface advanced move ! and delete features. This file was obtained from the old ! evesecini.tpu file. ! ! ENVIRONMENT: ! OpenVMS VAX, OpenVMS AXP, RISC/ULTRIX ! ! CREATION DATE: 10-Oct-1986 !-- ! EVE$HELP.TPU Page 2 !++ ! Table of Contents ! ! EVE$HELP.TPU ! 31-DEC-1992 10:31 ! ! Procedure name Page Description ! -------------- ---- ------------ ! ! eve$help_module_pre_init 3 Init help libraries ! eve_show_key 4 Quicky help on a key ! eve$list_keys 5 List all defined keys ! eve$draw_keypad 6 Draw the picture dynamically ! eve$$help_keypad_template 7 Get the template for draw_keypad ! eve$$overstrike_legend 8 Fill in a key "box" ! eve$$center_2_legends 9 Break the key-name in two ! eve$$center_legend 9 Put in a centered word ! eve$$draw_key 10 Draw a key with both legends ! eve$$is_keypad_defined 11 Numeric pad or f17-f20 defined? ! eve$$is_gold_keypad 12 Any Gold function keys defined ! eve$$draw_key_cluster 13 Draw a group of keys ! eve$define_key_cluster 14 Create a help keypad flag ! eve$$keypad_captions 15 Get the text to fill and insert ! eve$define_keyboard 16 Define for keypad help ! eve$set_keyboard 17 Set the keyboard type ! eve$keyboard_type 18 What kind of keyboard do we have? ! eve$set_keypad_captions 19 Whose captions in HELP? ! eve$filled_box 20 Insert filled text ! eve$rect_overstrike 21 Rectangular paste guts ! eve$set_mode 22 Set mode and return old one ! eve_help 23 Command line help ! eve$help_setup 24 Setup for help ! eve$help_parse 25 Parse the help topic ! eve$help_display_topic 26 Display parsed help topic ! eve$help_cleanup 27 Cleanup after help ! eve$help_status_line 28 Set help status line + EOB text ! eve$help_enter_prompt 29 Prompt for help topic ! eve$$help_scroll 30 Scroll help info ! eve$help_next_prompt 31 Issue next help prompt ! eve$help_undefined_key 32 Help prompt processing ! eve$$help_post_filter 34 Clean up after help key press ! eve$$help_scroll_bars 35 Remove scroll bars if short topic ! eve$is_help_facility 36 is topic facility code? ! eve$help_text 37 Display help topic ! eve$dynamic_help 38 Dynamic keypad help ! eve$help_keypad 39 --- Obsolete --- ! eve$$test_buffer_bounds 40 is EOB or BOB visible? ! eve$$insert_invoke_strings 41 Tell how to invoke other libs ! eve$get_help_library_topic 42 Get fac's helplib.& major topic ! eve$declare_help_library 43 Declare a facility-specific help library ! eve$get_help_item 44 Return info about facility help library !-- ! EVE$HELP.TPU Page 3 procedure eve$help_module_pre_init ! Init help libraries ! Determine if we're running on Ultrix eve$x_ultrix_active := (get_info (SYSTEM, "operating_system") = ULTRIX); ! declare the major help libraries if eve$x_ultrix_active then eve$declare_help_library ("EVE", "/usr/lib/tpu/eve_help.hlbu", "", message_text (EVE$_INVOKEEVEHELP, 1)); eve$declare_help_library ("TPU", "/usr/lib/tpu/tpu_help.hlbu", "", message_text (EVE$_INVOKETPUHELP, 1)); else eve$declare_help_library ("EVE", "eve$help", "", message_text (EVE$_INVOKEEVEHELP, 1)); eve$declare_help_library ("TPU", "tpuhelp", "", message_text (EVE$_INVOKETPUHELP, 1)); endif; eve$declare_help_library ("GET_INFO", "tpuhelp", "", ""); eve$declare_help_library ("SET", "tpuhelp", "", ""); eve$kt_topic_eve_eve := eve$get_help_item (eve$k_help_facility, "eve"); ! info topic eve$kt_topic_eve_tpu := eve$get_help_item (eve$k_help_facility, "tpu"); ! info topic endprocedure; ! eve$help_module_pre_init ! EVE$HELP.TPU Page 4 procedure eve_show_key ! Quicky help on a key (key_string) local the_key, the_name, the_code, the_list, pointer, the_keypad, facility, topic, legend; on_error [OTHERWISE]: endon_error; if key_string <> "" then the_key := eve$$parse_keystring (key_string); else the_key := eve$prompt_key (message_text (EVE$_KEYTODESCR, 1)); endif; if the_key = 0 then learn_abort; return (FALSE); endif; the_name := eve$key_name (the_key); the_list := eve$current_key_map_list; if the_key = get_info (the_list, "shift_key") then eve$message (EVE$_ISGOLDKEY, 0, the_name); return (1); endif; the_code := lookup_key (the_key, PROGRAM); if the_code = 0 then eve$message (EVE$_NOKEY, 0, the_name); return (TRUE); endif; the_keypad := lookup_key (the_key, KEY_MAP, the_list); if index (substr (the_keypad, 1, 4), "EVE$") <> 0 then the_keypad := substr (the_keypad, 5, length (the_keypad)); pointer := index (the_keypad, "_KEYS"); if (pointer <> 0) and (pointer <> 1) then the_keypad := substr (the_keypad, 1, pointer - 1); endif; endif; eve$$parse_comment (the_key, the_list, facility, legend, topic); if topic = "" then if get_info (the_code, "type") = LEARN then topic := message_text (EVE$_SEQUENCE, 1); else topic := message_text (EVE$_UNKNOWN, 1); endif; endif; if (topic <> legend) and (legend <> "") then ! display legend, it contains args topic := legend; endif; eve$message (EVE$_KEYDESCR, 0, the_name, topic, the_keypad); return TRUE; endprocedure; ! eve_show_key ! EVE$HELP.TPU Page 5 procedure eve$list_keys ! List all defined keys (which_key_map_list) local the_key, facility, legend, topic, the_key_name, the_offset, the_gold_key, the_gold, non_gold, the_comment, the_count, the_key_map_list; on_error [OTHERWISE]: endon_error; eve$message (EVE$_HELP_BLDKEYS); the_key_map_list := which_key_map_list; if the_key_map_list = "" then the_key_map_list := eve$current_key_map_list (eve$$x_help_this_buffer); endif; position (help_buffer); erase (help_buffer); map (tpu$x_show_window, help_buffer); eve$set_status_line (tpu$x_show_window); the_gold_key := get_info (the_key_map_list, "shift_key"); the_offset := length (message_text (EVE$_HELP_KEYFAO, 1, "", "")); copy_text (message_text (EVE$_HELP_KEYHEAD, 1)); copy_text (" " * (the_offset - current_offset)); copy_text (message_text (EVE$_HELP_GOLDHEAD, 1)); split_line; copy_text (fao ("!#* ", the_offset - current_offset)); if the_gold_key <> key_name (the_gold_key, SHIFT_KEY) then copy_text (message_text (EVE$_HELP_GOLDIS, 1, eve$key_name (the_gold_key))); else copy_text (message_text (EVE$_HELP_ENABLEGOLD, 1)); endif; set (OVERSTRIKE, help_buffer); split_line; the_gold := mark (NONE); move_vertical (-1); non_gold := mark (NONE); the_key := get_info (DEFINED_KEY, "first", the_key_map_list); loop exitif the_key = 0; eve$$parse_comment (the_key, the_key_map_list, facility, legend, topic); the_key_name := eve$key_name (the_key); if (legend <> '') and (legend <> message_text (EVE$_UNKNOWN, 1)) and (legend <> message_text (EVE$_TYPING, 1)) then translate (legend, " ", "_"); eve$capitalize_string (legend); case get_info (the_key, "key_type") [PRINTING, KEYPAD, FUNCTION, CONTROL]: position (non_gold); move_vertical (1); move_horizontal (-current_offset); copy_text (message_text (EVE$_HELP_KEYFAO, 1, the_key_name, legend)); non_gold := mark (NONE); [SHIFT_PRINTING, SHIFT_KEYPAD, SHIFT_FUNCTION, SHIFT_CONTROL]: if the_key = key_name ("0", SHIFT_KEY) then the_comment := lookup_key (the_key, COMMENT, the_key_map_list); the_count := 1; loop the_key := get_info (DEFINED_KEY, "next", the_key_map_list); if ((the_comment <> lookup_key (the_key, COMMENT, the_key_map_list)) or (int (the_key) < int (key_name ("0", SHIFT_KEY))) or (int (the_key) > int (key_name ("9", SHIFT_KEY)))) then ! backup to GOLD 0 loop the_key := get_info (DEFINED_KEY, "previous", the_key_map_list); the_count := the_count - 1; exitif the_count = 0; endloop; exitif; endif; the_count := the_count + 1; if the_count = 10 then ! did all digits the_key_name := message_text (EVE$_HELP_GOLDIGITS, 1); exitif; endif; endloop; endif; position (the_gold); move_vertical (1); if current_offset = 0 then if mark (NONE) <> end_of (help_buffer) then move_vertical (1); move_horizontal (-1); endif; endif; copy_text (fao ("!#* ", the_offset - current_offset)); copy_text (message_text (EVE$_HELP_GOLDFAO, 1, the_key_name, legend)); the_gold := mark (NONE); endcase; endif; the_key := get_info (DEFINED_KEY, "next", the_key_map_list); endloop; position (beginning_of (help_buffer)); eve$clear_message; endprocedure; ! eve$list_keys ! EVE$HELP.TPU Page 6 procedure eve$draw_keypad ! Draw the picture dynamically (which_key_map_list) local the_gold_key, ! The key-name of the shift key is_gold, ! Indicates there is a GOLD key defined. gold_comment, ! Comment for redefined GOLD key. split_keys, ! Indicates that ½ size legends are needed. saved_informational, ! Save informational setting box_width, ! Width of a key picture temp, ! Used in searches legend_mark, ! Location of the "Use DO..." legend legend_column, ! and column offset the_width, ! and width legend_top, ! and first line text legend_bot, ! and second line text the_banner, ! Banner text filled_start, ! Location of the Filled text field filled_length, ! and length filled_width, ! and width the_flag, ! The current flag (e.g. ~PF1~) the_cluster, ! Array of key-names range_index, ! Pointer into video range array window_width, ! Width of the window saved_key_map, ! Key_map of shift key saved_gold_program, ! Saved program of the shift key saved_gold_comment, ! Saved comment of the shift key saved_mode; ! INSERT/OVERSTRIKE state on entry on_error [TPU$_CONTROLC]: if saved_informational <> 0 then set (INFORMATIONAL, saved_informational); endif; if (saved_mode = INSERT) then set (INSERT, help_buffer); endif; if (saved_gold_program <> 0) and ! restore original gold key def (saved_key_map <> 0) ! ^C before assigned then define_key (saved_gold_program, the_gold_key, saved_gold_comment, saved_key_map); else if is_gold then undefine_key (the_gold_key, which_key_map_list); endif; endif; eve$learn_abort; abort; [OTHERWISE]: if saved_informational <> 0 then set (INFORMATIONAL, saved_informational); endif; if (saved_mode = INSERT) then set (INSERT, help_buffer); endif; if (saved_gold_program <> 0) and ! restore original gold key def (saved_key_map <> 0) then define_key (saved_gold_program, the_gold_key, saved_gold_comment, saved_key_map); else if is_gold then undefine_key (the_gold_key, which_key_map_list); endif; endif; endon_error; eve$message (EVE$_HELP_BLDKEYPAD); if get_info (SYSTEM, "informational") then saved_informational := ON; else saved_informational := OFF; endif; saved_mode := get_info (help_buffer, "mode"); set (INFORMATIONAL, OFF); set (OVERSTRIKE, help_buffer); the_gold_key := get_info (which_key_map_list, "shift_key"); is_gold := (the_gold_key <> key_name (the_gold_key, SHIFT_KEY)); gold_comment := message_text (EVE$_GOLDKEY, 1); if is_gold then ! define the gold key so 'gold' will be seen in the diagram ! (save and temporarily redefine the gold key) saved_gold_program := lookup_key (the_gold_key, PROGRAM, which_key_map_list); saved_gold_comment := lookup_key (the_gold_key, COMMENT, which_key_map_list); if saved_gold_program <> 0 then ! need to remember the key_map where the gold key's defined saved_key_map := get_info (KEY_MAP, "first", which_key_map_list); loop exitif lookup_key (the_gold_key, PROGRAM, saved_key_map) <> 0; saved_key_map := get_info (KEY_MAP, "next", which_key_map_list); endloop; define_key (eve$$x_help_null_program, ! nop the_gold_key, gold_comment, saved_key_map); else define_key (eve$$x_help_null_program, ! nop the_gold_key, gold_comment, get_info (KEY_MAP, "first", which_key_map_list)); endif; split_keys := eve$$is_gold_keypad (which_key_map_list); endif; window_width := 80; box_width := 8; eve$$help_keypad_template (which_key_map_list); position (beginning_of (help_buffer)); eve$$x_keypad_ranges := create_array; temp := search_quietly ("~" + span ("X") + "~", FORWARD); if temp <> 0 then position (temp); the_width := length (temp); copy_text (" " * the_width); position (temp); move_vertical (1); copy_text (" " * the_width); if eve$x_help_legend_top <> 0 then legend_top := eve$x_help_legend_top; legend_bot := eve$x_help_legend_bot; else if eve$on_a_pre_lk201 or not eve$test_synonym ("do", eve$$lookup_comment (DO, which_key_map_list)) then legend_top := message_text (EVE$_HELP_LEGENDTOP2, 1); legend_bot := eve$$get_do_keys (the_width); else legend_top := message_text (EVE$_HELP_LEGENDTOP, 1); legend_bot := message_text (EVE$_HELP_LEGENDBOT, 1); endif; endif; position (temp); move_horizontal ((the_width - length (legend_top)) / 2); copy_text (legend_top); position (temp); move_vertical (1); move_horizontal ((the_width - length (legend_bot)) / 2); copy_text (legend_bot); endif; position (beginning_of (help_buffer)); temp := search_quietly ("~" + span ("G") + "~", FORWARD); if temp <> 0 then the_width := length (temp); position (temp); copy_text (" " * the_width); if split_keys then position (temp); the_banner := message_text (EVE$_HELP_BANNER, 1); move_horizontal ((the_width - length (the_banner)) / 2); copy_text (the_banner); move_horizontal (-8); temp := search_quietly (ANCHOR + "reverse", FORWARD, NO_EXACT); if temp <> 0 then range_index := range_index + 1; eve$$x_keypad_ranges {range_index} := create_range (beginning_of (temp), end_of (temp), REVERSE); endif; endif; endif; position (beginning_of (help_buffer)); loop temp := search_quietly ("~" + span ("F") + "~", FORWARD); exitif temp = 0; if filled_start = 0 then filled_start := beginning_of (temp); filled_width := length (temp); else !*** error if filled_width <> length (temp) endif; filled_length := get_info (mark (NONE), "record_number") - get_info (filled_start, "record_number"); position (temp); copy_text (" " * length (temp)); endloop; if filled_start <> 0 then eve$filled_box (eve$$keypad_captions, filled_start, filled_length, filled_width); endif; position (beginning_of (help_buffer)); loop temp := search_quietly ("~" + span ('abcdefghijklmnopqrstuvwxyz' + 'ABCDEFGHIJKLMNOPQRSTUVWXYZ' + '0123456789') + "~", FORWARD, EXACT); exitif temp = 0; position (temp); the_flag := str (temp); copy_text (" " * length (the_flag)); position (temp); the_flag := substr (the_flag, 2, length (the_flag) - 2); change_case (the_flag, UPPER); the_cluster := eve$$x_key_clusters {the_flag}; if the_cluster <> tpu$k_unspecified then eve$$draw_key_cluster (the_cluster, box_width, split_keys, the_gold_key, which_key_map_list, range_index); if the_flag = "PF1" then position (temp); move_vertical (3); eve$$draw_key_cluster (eve$$x_key_clusters {"KP7"}, box_width, split_keys, the_gold_key, which_key_map_list, range_index); position (temp); move_vertical (6); eve$$draw_key_cluster (eve$$x_key_clusters {"KP4"}, box_width, split_keys, the_gold_key, which_key_map_list, range_index); position (temp); move_vertical (9); eve$$draw_key_cluster (eve$$x_key_clusters {"KP1"}, box_width, split_keys, the_gold_key, which_key_map_list, range_index); position (temp); move_vertical (10); move_horizontal (box_width * 3); eve$$draw_key_cluster (eve$$x_key_clusters {"ENTER"}, box_width, split_keys, the_gold_key, which_key_map_list, range_index); position (temp); move_vertical (12); eve$$draw_key_cluster (eve$$x_key_clusters {"KP0"}, box_width, split_keys, the_gold_key, which_key_map_list, range_index); position (temp); endif; endif; endloop; position (end_of (help_buffer)); position (search_quietly (notany (eve$x_whitespace), REVERSE)); move_horizontal (1); erase (create_range (mark (NONE), end_of (help_buffer), NONE)); position (beginning_of (help_buffer)); if (saved_mode = INSERT) then set (INSERT, help_buffer); endif; eve$clear_message; ! clear 'building...' message ! restore the original gold key def if (saved_gold_program <> 0) and (saved_key_map <> 0) then define_key (saved_gold_program, the_gold_key, saved_gold_comment, saved_key_map); else if is_gold then undefine_key (the_gold_key, which_key_map_list); endif; endif; set (INFORMATIONAL, saved_informational); endprocedure; ! eve$draw_keypad ! EVE$HELP.TPU Page 7 procedure eve$$help_keypad_template ! Get the template for draw_keypad (which_key_map_list) ! The keypad diagram is built from one of a set of templates ! stored in the EVE help library. Currently, there are three ! templates in the library, 1 for the vt100, and two for the ! LK201-based terminals (VT200s and later). ! ! The three basic layouts look like this: ! ! VT100 Simple LK201 Full LK201 ! ! [][][][] [][][][] [][][][] [][__] [][__] [][][][] ! [][][][] [][][] [][][] [][][][] ! [][][][] [][][] [][][] [][][][] ! [][][]|| [] [] [][][][] ! [__][]|| [][][] [][][] [][][]|| ! [__][]|| ! ! The full LK201 layout is used if any of the F17-F20 keys or the ! numeric kepad keys are defined. ! ! In each of the diagrams stored in the EVE help file, there are ! flags indicating where the keys go. The flags all start and end ! with a tilde (~). The flags are created with the procedure ! EVE$DEFINE_KEY_CLUSTER. ! ! A number of flags are handled specially. They are: ! ! ~PF1~ Indicates the whole numeric keypad ! ~XXXX~ "Legend" field used for DO key message ! ~GGGG~ "Banner" field used for GOLD keys msg ! ~FFFF~ "Filled" area used for text. ! ! The legend and banner fields are both variable width fields ! whose widths are determined by the number of X's or G's used. ! The legend field is a two line tall field. The text for both ! legends is centered. ! ! The legend field can be used by EVE-based applications. Only one ! application in a section file may use them. (Notes uses them today.) ! To do so, the application places the text to be displayed in the ! legend filed in the two variables EVE$X_HELP_LEGEND_TOP and ! EVE$X_HELP_LEGEND_BOTTOM. ! ! If no application is using the legend EVE uses it to either ! display the "Use the DO key to enter advanced commands" message ! or to list the various DO keys if the LK201 DO key is not ! available or is not bound to DO. ! ! The filled area is a variable width, variable length rectangular ! field used to display text. local keyboard_type; keyboard_type := eve$keyboard_type (which_key_map_list); help_text (eve$$x_keypad_help_library {keyboard_type}, eve$$x_keypad_help_topic {keyboard_type}, OFF, help_buffer); position (beginning_of (help_buffer)); erase_line; ! erase the topic line (text should include title - which may ! differ from the topic in the library) if not eve$x_ultrix_active then ! Ultrix topics have topic line followed by first text line. VMS ! topics have blank line, topic line, blank line, first text line. erase_line; erase_line; endif; endprocedure; ! eve$$help_keypad_template ! EVE$HELP.TPU Page 8 procedure eve$$overstrike_legend ! Fill in a key "box" (the_key, the_width, one_line, which_key_map_list) local legend, ptr, facility, topic, initial, top_legend, bot_legend, saved_mode; on_error [TPU$_CONTROLC]: if (saved_mode = INSERT) then set (INSERT, help_buffer); endif; eve$learn_abort; abort; [OTHERWISE]: if (saved_mode = INSERT) then set (INSERT, help_buffer); endif; endon_error; saved_mode := get_info (help_buffer, "mode"); set (OVERSTRIKE, help_buffer); if (eve$$parse_comment (the_key, which_key_map_list, facility, legend, topic)) then if (legend = message_text (EVE$_TYPING, 1)) then legend := ""; endif; ! ! English-specific optimization of the legends: ! if legend = "help keypad" then legend := "HELP"; else if legend = "help keys" then if one_line then legend := "KeyDefs"; endif; endif; endif; initial := substr (legend, 1, 1); edit (initial, UPPER, OFF); legend := initial + substr (legend, 2, 999); translate (legend, " ", "_(""');"); edit (legend, COMPRESS, TRIM, OFF); if (length (legend) <= the_width) then eve$$center_legend (legend, the_width); else eve$$center_2_legends (legend, top_legend, bot_legend, the_width, one_line); eve$$center_legend (top_legend, the_width); if (bot_legend <> "") then move_vertical (1); eve$$center_legend (bot_legend, the_width); move_vertical (-1); endif; endif; endif; if (saved_mode = INSERT) then set (INSERT, help_buffer); endif; endprocedure; ! eve$$overstrike_legend ! EVE$HELP.TPU Page 9 procedure eve$$center_2_legends ! Break the key-name in two (key_help, top_legend, bot_legend, the_width, one_line) local initial, word_2, word_3, the_rest, sub_width, words, ptr; on_error [OTHERWISE]: endon_error; if (length (key_help) <= the_width) then top_legend := key_help; bot_legend := ""; else sub_width := the_width / 2; ! maximize sub_width for 2 words if (sub_width < 3) then sub_width := 3; endif; ptr := index (key_help, " "); ! find the 1st space if (ptr <> 0) then top_legend := substr (key_help, 1, ptr - 1); ! 1st word bot_legend := substr (key_help, ptr + 1, 9999); ! rest of string if (one_line) then ptr := index (bot_legend, " "); if ptr = 0 then word_2 := bot_legend; words := 2; else word_2 := substr (bot_legend, 1, ptr - 1); word_3 := substr (bot_legend, ptr + 1, 99); ptr := index (word_3, " "); if ptr = 0 then words := 3; else the_rest := substr (word_3, ptr + 1, 99); word_3 := substr (word_3, 1, ptr - 1); words := 4; endif; endif; case words from 2 to 4 [2]: if length (top_legend) < sub_width then top_legend := top_legend + " "; endif; initial := substr (word_2, 1, 1); change_case (initial, UPPER); top_legend := substr (top_legend, 1, sub_width) + " " + initial + substr (word_2, 2, the_width); [3]: if length (top_legend) < sub_width then top_legend := top_legend + " "; endif; initial := substr (word_2, 1, 1); change_case (initial, UPPER); top_legend := substr (top_legend, 1, sub_width) + initial + substr (word_2, 2, (sub_width / 2)); initial := substr (word_3, 1, 1); change_case (initial, UPPER); top_legend := top_legend + initial + substr (word_3, 2, (sub_width / 2)); [4]: if length (top_legend) < sub_width then top_legend := top_legend + " "; endif; if (sub_width / 3) = 1 then initial := substr (word_2, 1, 1) + substr (word_3, 1, 1) + substr (the_rest, 1, 1); change_case (initial, UPPER); top_legend := substr (top_legend, 1, sub_width) + " " + initial; else initial := substr (word_2, 1, 1); change_case (initial, UPPER); top_legend := substr (top_legend, 1, sub_width) + initial + substr (word_2, 2, (sub_width / 3)); initial := substr (word_3, 1, 1); change_case (initial, UPPER); top_legend := top_legend + initial + substr (word_3, 2, (sub_width / 3)); initial := substr (the_rest, 1, 1); change_case (initial, UPPER); top_legend := top_legend + initial + substr (the_rest, 2, (sub_width / 3)); endif; endcase; bot_legend := ""; endif; else top_legend := key_help; ! no spaces in the topic bot_legend := ""; endif; top_legend := substr (top_legend, 1, the_width); bot_legend := substr (bot_legend, 1, the_width); endif; endprocedure; ! eve$$center_2_legends procedure eve$$center_legend ! Put in a centered word (the_word, the_width) local column; on_error [OTHERWISE]: endon_error; column := current_offset; move_horizontal ((the_width - length (the_word)) / 2); copy_text (the_word); move_horizontal (column - current_offset); endprocedure; ! eve$$center_legend ! EVE$HELP.TPU Page 10 procedure eve$$draw_key ! Draw a key with both legends (the_key, box_width, is_gold_key, the_gold_key, which_key_map_list) local ptr, split_key, the_range; on_error [OTHERWISE]: endon_error; split_key := (is_gold_key and (int (the_key) <> int (the_gold_key))); eve$$overstrike_legend (the_key, box_width - 1, split_key, which_key_map_list); if (split_key) then move_vertical (1); eve$$overstrike_legend (key_name (the_key, SHIFT_KEY), box_width - 1, split_key, which_key_map_list); ptr := mark (NONE); move_horizontal (box_width - 2); the_range := create_range (ptr, mark (NONE), REVERSE); move_horizontal (2); move_vertical (-1); return (the_range); else move_horizontal (box_width); return (0); endif; endprocedure; ! eve$$draw_key ! EVE$HELP.TPU Page 11 procedure eve$$is_keypad_defined ! Numeric pad or f17-f20 defined? (which_key_map_list) local temp, the_comment, where; on_error [OTHERWISE]: endon_error; if eve$current_keypad (which_key_map_list) <> eve$x_numeric_keys then return (TRUE); endif; if eve$$lookup_comment (F17, which_key_map_list) <> "" then return (TRUE); endif; if eve$$lookup_comment (F18, which_key_map_list) <> "" then return (TRUE); endif; if eve$$lookup_comment (F19, which_key_map_list) <> "" then return (TRUE); endif; if which_key_map_list = eve$x_key_map_list then where := eve$x_user_keys; else if get_info (KEY_MAP, "first", which_key_map_list) = eve$x_user_keys then where := eve$x_user_keys; else where := which_key_map_list; endif; endif; temp := get_info (DEFINED_KEY, "first", where); loop exitif temp = 0; if ((int (temp) >= int (KP0)) and (int (temp) <= int (KP9)) or (int (temp) >= int (COMMA)) and (int (temp) <= int (PERIOD)) or ((int (temp) >= int (PF1)) and (int (temp) <= int (PF4))) or ((int (temp) >= int (F17)) and (int (temp) <= int (F20)))) then the_comment := eve$$lookup_comment (temp, which_key_map_list); if (the_comment <> message_text (EVE$_GOLDKEY, 1)) and not eve$test_terminator (eve$$x_help_ignorable_keys, the_comment) then return (TRUE); endif; endif; temp := get_info (DEFINED_KEY, "next", where); endloop; return (FALSE); endprocedure; ! eve$$is_keypad_defined ! EVE$HELP.TPU Page 12 procedure eve$$is_gold_keypad ! Any Gold function keys defined (which_key_map_list) ! Procedure to see if there are gold versions of any of the keys in the set: ! ! [E1-E6, arrow keys, COMMA, MINUS, PERIOD, KP0-KP9, PF1-PF4, F11-F20, ENTER] local temp; on_error [OTHERWISE]: endon_error; temp := get_info (DEFINED_KEY, "first", which_key_map_list); loop exitif temp = 0; if int (temp) = int (key_name (ENTER, SHIFT_KEY)) then return (TRUE); endif; if (int (temp) >= int (key_name (E1, SHIFT_KEY))) and (int (temp) <= int (key_name (E6, SHIFT_KEY))) then return (TRUE); endif; if (int (temp) >= int (key_name (UP, SHIFT_KEY))) and (int (temp) <= int (key_name (RIGHT, SHIFT_KEY))) then return (TRUE); endif; if (int (temp) >= int (key_name (COMMA, SHIFT_KEY))) and (int (temp) <= int (key_name (PERIOD, SHIFT_KEY))) then return (TRUE); endif; if (int (temp) >= int (key_name (KP0, SHIFT_KEY))) and (int (temp) <= int (key_name (KP9, SHIFT_KEY))) then return (TRUE); endif; if (int (temp) >= int (key_name (PF1, SHIFT_KEY))) and (int (temp) <= int (key_name (PF4, SHIFT_KEY))) then return (TRUE); endif; if (int (temp) >= int (key_name (F11, SHIFT_KEY))) and (int (temp) <= int (key_name (F20, SHIFT_KEY))) then return (TRUE); endif; temp := get_info (DEFINED_KEY, "next", which_key_map_list); endloop; endprocedure; ! eve$$is_gold_keypad ! EVE$HELP.TPU Page 13 procedure eve$$draw_key_cluster ! Draw a group of keys (the_cluster, box_width, split_keys, the_gold_key, which_key_map_list, range_index) local the_index, the_key, the_width; the_index := 1; loop the_key := the_cluster {the_index}; the_index := the_index + 1; exitif the_key = tpu$k_unspecified; the_width := box_width; if the_key = the_cluster {the_index} then the_index := the_index + 1; the_width := the_width + box_width; endif; range_index := range_index + 1; eve$$x_keypad_ranges {range_index} := eve$$draw_key (the_key, the_width, split_keys, the_gold_key, which_key_map_list); endloop; endprocedure; ! eve$$draw_key_cluster ! EVE$HELP.TPU Page 14 procedure eve$define_key_cluster ! Create a help keypad flag (the_flag, key_1; key_2, key_3, key_4, key_5, key_6) local temp; temp := create_array; temp {1} := key_1; temp {2} := key_2; temp {3} := key_3; temp {4} := key_4; temp {5} := key_5; temp {6} := key_6; eve$$x_key_clusters {the_flag} := temp; return (TRUE); endprocedure; ! eve$define_key_cluster ! EVE$HELP.TPU Page 15 procedure eve$$keypad_captions ! Get the text to fill and insert local saved_mark, the_library, ! HELP library containing diagrams the_topic; ! and the major topic saved_mark := mark (FREE_CURSOR); eve$get_help_library_topic (eve$x_facility_for_captions, the_library, the_topic); if get_info (eve$$x_caption_buffer, "type") <> BUFFER then if eve$x_buf_str_caption = tpu$k_unspecified then eve$x_buf_str_caption := "$CAPTION$"; endif; eve$$x_caption_buffer := eve$init_buffer (eve$x_buf_str_caption, "[EOB]"); endif; help_text (the_library, the_topic + "keypad_captions", OFF, eve$$x_caption_buffer); position (beginning_of (eve$$x_caption_buffer)); erase_line; erase_line; erase_line; position (saved_mark); return (eve$$x_caption_buffer); endprocedure; ! eve$$keypad_captions ! EVE$HELP.TPU Page 16 procedure eve$define_keyboard ! Define for keypad help (keyboard_type, the_facility, keypad_topic) local the_library, the_topic; if get_info (eve$$x_keypad_help_library, "type") <> ARRAY then eve$$x_keypad_help_library := create_array; endif; if get_info (eve$$x_keypad_help_topic, "type") <> ARRAY then eve$$x_keypad_help_topic := create_array; endif; eve$get_help_library_topic (the_facility, the_library, the_topic); if the_library <> 0 then eve$$x_keypad_help_library {keyboard_type} := the_library; eve$$x_keypad_help_topic {keyboard_type} := the_topic + keypad_topic; endif; endprocedure; ! eve$define_keyboard ! EVE$HELP.TPU Page 17 procedure eve$set_keyboard ! Set the keyboard type (the_arg) local local_arg, keyboard_type; if the_arg = 0 then eve$$x_keyboard_type := the_arg; return (TRUE); endif; if (get_info (eve$$x_keypad_help_library, "type") <> ARRAY) or (get_info (the_arg, "type") <> STRING) then return (FALSE); endif; local_arg := the_arg; change_case (local_arg, LOWER); keyboard_type := get_info (eve$$x_keypad_help_library, "first"); loop exitif keyboard_type = tpu$k_unspecified; change_case (keyboard_type, LOWER); if keyboard_type = local_arg then eve$$x_keyboard_type := local_arg; return (TRUE); endif; keyboard_type := get_info (eve$$x_keypad_help_library, "next"); endloop; return (FALSE); endprocedure; ! eve$set_keyboard ! EVE$HELP.TPU Page 18 procedure eve$keyboard_type ! What kind of keyboard do we have? (which_key_map_list) if get_info (eve$$x_keyboard_type, "type") = STRING then if eve$$x_keypad_help_library {eve$$x_keyboard_type} <> tpu$k_unspecified then return eve$$x_keyboard_type; else eve$message (EVE$_BADKEYBDTYPE, 0, eve$$x_keyboard_type); endif; endif; if eve$on_a_pre_lk201 then return ("vt100"); else if eve$$is_keypad_defined (which_key_map_list) then return ("lk201 wide"); else return ("lk201"); endif; endif; endprocedure; ! eve$keyboard_type ! EVE$HELP.TPU Page 19 procedure eve$set_keypad_captions ! Whose captions in HELP? (facility_arg) local the_facility, temp; the_facility := facility_arg; if eve$is_help_facility (the_facility, temp) then eve$x_facility_for_captions := the_facility; return (TRUE); else return (FALSE); endif; endprocedure; ! eve$set_keypad_captions ! EVE$HELP.TPU Page 20 procedure eve$filled_box ! Insert filled text (source_buffer, upper_left, max_rows, max_cols) local saved_position, start_mark, the_stuff, temp; if get_info (source_buffer, "type") = BUFFER then saved_position := mark (FREE_CURSOR); position (beginning_of (source_buffer)); loop exitif current_line <> ""; move_horizontal (1); append_line; endloop; position (end_of (source_buffer)); if mark (NONE) = beginning_of (source_buffer) then return (FALSE); endif; move_horizontal (-1); loop exitif current_line <> ""; append_line; endloop; position (beginning_of (source_buffer)); loop start_mark := mark (NONE); temp := search_quietly (LINE_END + LINE_END, FORWARD, EXACT); if temp = 0 then position (end_of (current_buffer)); move_horizontal (-1); else position (temp); endif; fill (create_range (start_mark, mark (NONE), NONE), "-", 1, max_cols, 0); move_horizontal (1); exitif mark (NONE) = end_of (current_buffer); move_horizontal (1); endloop; if get_info (source_buffer, "record_count") > max_rows then position (beginning_of (source_buffer)); move_vertical (max_rows - 1); position (search_quietly (LINE_BEGIN + LINE_BEGIN, REVERSE)); move_horizontal (-1); the_stuff := create_range (beginning_of (current_buffer), mark (NONE), NONE); eve$filled_box := FALSE; else the_stuff := source_buffer; eve$filled_box := TRUE; endif; position (upper_left); eve$rect_overstrike (the_stuff); position (saved_position); return; ! TRUE/FALSE set above. else return (FALSE); endif; endprocedure; ! eve$filled_box ! EVE$HELP.TPU Page 21 procedure eve$rect_overstrike ! Rectangular paste guts (source_buffer) ! This procedure pastes the rectangular region in the source buffer ! using the current position in the current buffer as the upper left corner. local saved_position, saved_mode; on_error [OTHERWISE]: eve$$restore_position (saved_position); set (saved_mode, current_buffer); endon_error; saved_position := mark (NONE); saved_mode := eve$set_mode (OVERSTRIKE); copy_text (source_buffer); position (saved_position); set (saved_mode, current_buffer); endprocedure; ! eve$rect_overstrike ! EVE$HELP.TPU Page 22 procedure eve$set_mode ! Set mode and return old one (new_mode) ! This procedure returns the current mode for the current buffer ! and sets it to the value in NEW_MODE. eve$set_mode := get_info (current_buffer, "mode"); set (new_mode, current_buffer); endprocedure; ! eve$set_mode ! EVE$HELP.TPU Page 23 procedure eve_help ! Command line help (first_topic) ! String containing topic from command line - input ! Top-level help command. ! ! EVE and TPU are considered "facilities". Each has its own library of help ! topics. Switch between these libraries by typing one of the following: ! 1. the facility name (TPU or EVE) ! 2. the facility name followed by the topic you want, e.g., EVE FIND ! Users can create their own facility libraries. ! ! The list of commands/topics for a facility are obtained by typing one ! of the following: ! 1. ? ! 2. commands ! 3. list of topics on_error [TPU$_CONTROLC]: eve$help_cleanup; eve$learn_abort; abort; [OTHERWISE]: eve$help_cleanup; endon_error; if eve$$x_ctx_sensitive_help then if last_key = HELP then eve$$x_ctx_sensitive_help := FALSE; return (TRUE); endif; else if get_info (eve$prompt_window, "buffer") <> 0 then eve$message (EVE$_CANTHELP); update (message_window); eve$learn_abort; return (FALSE); endif; endif; eve$$x_help_mode := 0; ! command line help eve$help_setup (first_topic); if not eve$help_parse then return (FALSE); endif; eve$help_display_topic; return (TRUE); endprocedure; ! eve_help ! EVE$HELP.TPU Page 24 procedure eve$help_setup ! Setup for help (first_topic; ! initial help topic string save_context) ! boolean flag to save current buffer/window ! (allows multiple calls in a help session) local temp_buffer; on_error [TPU$_CONTROLC]: eve$help_cleanup; eve$learn_abort; abort; [OTHERWISE]: eve$help_cleanup; endon_error; eve$$x_help_teardown_when_done := 0; eve$$x_help_ambiguous_topic := ""; eve$$x_help_to_be_ignored := 0; eve$$x_help_the_facility := ""; eve$$x_showing_commands := 0; eve$x_showing_keypad := FALSE; eve$$x_help_showing_keys := FALSE; eve$$x_state_array {eve$$k_ambiguous_parse} := FALSE; eve$$x_state_array {eve$$k_help_active} := 1; ! disables parser error messages ! (in case user pressed after ! just erasing an ambiguous command) ! test if EVE is in control of the interface if not eve$eve_in_control then if get_info (WINDOWS, "first") <> 0 then ! reject request if not in control and somebody's windows exist eve$learn_abort; return (FALSE); else ! set up EVE's windows if not in control and no windows exist temp_buffer := current_buffer; eve$$x_help_teardown_when_done := TRUE; eve$setup_windows (help_buffer); position (temp_buffer); endif; endif; if (save_context = TRUE) or (save_context = tpu$k_unspecified) then ! these may have already been saved in prior call to eve$help_setup ! during this help session eve$$x_help_saved_window := current_window; eve$$x_help_saved_mark := mark (FREE_CURSOR); ! in case show_window is up eve$$x_help_this_buffer := get_info (current_window, "buffer"); eve$x_old_help_topic := ""; ! init previous topic (for duplicates) endif; eve$$x_help_vt100 := FALSE; if not eve$on_a_pre_lk201 then ! Vt200 status lines (next/prev screen keys exist) eve$$x_help_term_mask := eve$$x_terminator_array {eve$$x_help_terminators}; else ! Vt100 status lines (up/down arrow for next/prev screen) eve$$x_help_vt100 := TRUE; eve$$x_help_term_mask := eve$$x_terminator_array {eve$$x_help_vt100_terminators}; endif; edit (eve$$x_help_term_mask, TRIM, COMPRESS, LOWER, OFF); eve$$x_help_cmd_window_flag := FALSE; if eve$$x_help_saved_window = eve$command_window then eve$$x_help_cmd_window_flag := TRUE; ! for endif; eve$map_help (help_buffer); eve$$x_help_this_topic := first_topic; ! use the default facility = EVE eve$$x_help_the_facility := eve$get_help_item (eve$k_help_facility, "eve"); ! put special key_map_list on the help_prompt_buffer for duration of help set (KEY_MAP_LIST, eve$x_help_key_map_list, eve$help_prompt_buffer); ! get shift_key from original buffer's k_m_l set (SHIFT_KEY, get_info (eve$current_key_map_list (eve$$x_help_this_buffer), "shift_key"), eve$x_help_key_map_list); return (TRUE); endprocedure; ! eve$help_setup ! EVE$HELP.TPU Page 25 procedure eve$help_parse ! Parse the help topic ! Parses EVE commands, TPU builtins, informational help topics, and ! facility names. local lowercase_topic, ! Lowercase version of eve$$x_help_this_topic expand_result, ! String of possible commands valid_eve_cmd, valid_topic, the_prefix, prefix_length, paren_index, special_facility, the_rest, count, temp, original_topic, ambiguous_commands, ambiguous_topics, saved_mark; on_error [TPU$_CONTROLC]: eve$help_cleanup; eve$$release_scratch_buffer; eve$learn_abort; abort; [OTHERWISE]: eve$$release_scratch_buffer; eve$help_cleanup; endon_error; ! If the topic is a facility, let the list of commands be displayed if eve$is_help_facility (eve$$x_help_this_topic, eve$$x_help_the_facility) then eve$$x_showing_commands := FALSE; endif; eve$$x_help_ambiguous_topic := eve$$x_help_this_topic; ! remove multiple spaces and tabs as EVE's parser did for EVE help edit (eve$$x_help_this_topic, COMPRESS, TRIM, OFF); lowercase_topic := eve$$x_help_this_topic; change_case (lowercase_topic, LOWER); ! Unmap choice window if not done previously eve$unmap_if_mapped (eve$choice_window); ! Parse lowercase_topic, assigning the result to eve$$x_help_this_topic. ! Parse in this order: ! 1. "keypad" and "keys" "keyp", "keys" ! 2. "list of topics" "l o t", "?", "commands" ! 3. facility names NOTES ! 4. EVE commands [EVE_]SET LEFT MARGIN ! 5. DECTPU builtins GET_INFO ! 6. informational topics [EVE$KT_TOPIC__]fo ba ! 7. otherwise, pass the topic to the librarian ! ! Note: ! o If a topic is not found by the librarian, then the ! "Sorry..." message will be displayed. ! o Informational topics include some DECTPU V1 keywords and ! lexical elements because some V1 builtins (e.g., ANCHOR, ! LINE_BEGIN) are V2 keywords. ! o User libraries may have EVE_ commands in them which ! can be ambiguous with other EVE commands. ! o If a valid command, ignore any informational topics ambiguous with it ! o Merge ambiguous commands and ambiguous info topics in choices buffer ! keypad, keys, list of topics if lowercase_topic <> "" then if (lowercase_topic = substr (eve$x_keypad, 1, length (lowercase_topic))) and (eve$$x_help_the_facility <> eve$get_help_item (eve$k_help_facility, "tpu")) then if eve$$x_help_cmd_window_flag then ! = list of topics eve$$x_help_this_topic := eve$x_commands; eve$$x_help_mode := 0; eve$clear_message; eve$$x_help_cmd_window_flag := FALSE; eve$$x_help_the_facility := eve$get_help_item (eve$k_help_facility, "eve"); else eve$$x_help_mode := 1; ! get keypad diagram endif; return (TRUE); else if (lowercase_topic = substr (eve$x_keys, 1, length (lowercase_topic))) and (eve$$x_help_the_facility <> eve$get_help_item (eve$k_help_facility, "tpu")) then eve$$x_help_mode := 2; return (TRUE); ! get list of all defined keys else eve$$x_help_mode := 0; the_prefix := eve$$x_help_prefix + eve$get_help_item (eve$k_help_facility, "eve") + "_"; change_case (the_prefix, UPPER); eve$$x_state_array {eve$$k_help_active} := 4; expand_result := eve$$parse (lowercase_topic, the_prefix); eve$$x_state_array {eve$$k_help_active} := 1; if expand_result = "eve$kt_topic_eve_list_of_topics" then lowercase_topic := "?"; endif; endif; endif; endif; the_prefix := ""; expand_result := ""; if (lowercase_topic = "") or (lowercase_topic = "?") then eve$$x_help_this_topic := eve$x_commands; if eve$$x_help_the_facility = eve$get_help_item (eve$k_help_facility, "keypad") then ! default to EVE's facility after keypad help eve$$x_help_the_facility := eve$get_help_item (eve$k_help_facility, "eve"); endif; else ! see if it's exactly a facility name if (lowercase_topic = eve$get_help_item (eve$k_help_facility, eve$$x_help_the_facility)) then ! don't parse facility names eve$$x_help_the_facility := lowercase_topic; eve$$x_help_this_topic := lowercase_topic; else if eve$$x_help_the_facility <> eve$get_help_item (eve$k_help_facility, "tpu") then ! see if it's a valid command (EVE's or user's) expand_result := eve$$parse (lowercase_topic); the_prefix := eve$$x_command_prefix; prefix_length := length (eve$$x_command_prefix); ! don't use parser results if facility is not EVE's if (expand_result <> "") and (eve$$x_help_the_facility = eve$get_help_item (eve$k_help_facility, "eve")) then ! valid command, delete the prefix + optional ! "(...)" arg list if index (expand_result, "(") = 0 then eve$$x_help_this_topic := substr (expand_result, prefix_length + 1, length (expand_result)); else eve$$x_help_this_topic := substr (expand_result, prefix_length + 1, index (expand_result, "(") - prefix_length - 1); endif; ! catch EVE commands that are illegal if index (eve$$kt_illegal_commands, eve$$x_help_this_topic) <> 0 then eve$$x_help_this_topic := eve$kt_topic_eve_not_implemented; endif; valid_eve_cmd := eve$$x_help_this_topic; endif; else ! see if it's a DECTPU builtin ! look for "GET INFO (...)" or "SET (...)" paren_index := index (lowercase_topic, "("); if paren_index <> 0 then ! remove spaces after the "(" temp := substr (lowercase_topic, 1, paren_index - 1); ! save the builtin ! insure it's a valid builtin and allows parens expand_result := eve$$parse (temp, ""); if (not eve$$x_state_array {eve$$k_ambiguous_parse}) and (expand_result <> "") then if (expand_result = eve$get_help_item (eve$k_help_facility, "get_info")) or (expand_result = eve$get_help_item (eve$k_help_facility, "set")) then special_facility := expand_result; else expand_result := ""; endif; endif; if expand_result <> "" then the_rest := substr (lowercase_topic, paren_index + 1, length (lowercase_topic)); count := 1; loop exitif index (eve$x_whitespace, substr (the_rest, count, 1)) = 0; count := count + 1; endloop; the_rest := substr (the_rest, count, length (the_rest)); ! remove spaces before the ")" paren_index := index (the_rest, ")"); if paren_index <> 0 then count := paren_index - 1; loop exitif index (eve$x_whitespace, substr (the_rest, count, 1)) = 0; count := count - 1; endloop; the_rest := substr (the_rest, 1, count); endif; ! try to parse the parenthisied keyword the_prefix := eve$$x_help_prefix + special_facility + "_"; change_case (the_prefix, UPPER); expand_result := eve$$parse (the_rest, the_prefix); if expand_result <> "" then the_rest := substr (expand_result, length (the_prefix) + 1, length (expand_result)); endif; if not eve$$x_state_array {eve$$k_ambiguous_parse} then ! ""==> parse TPU builtin names expand_result := eve$$parse (temp, ""); if expand_result <> "" then eve$$x_help_this_topic := expand_result + "(" + the_rest; if paren_index <> 0 then eve$$x_help_this_topic := eve$$x_help_this_topic + ")"; endif; endif; endif; endif; else ! no parens in the builtin expand_result := eve$$parse (lowercase_topic, ""); if expand_result <> "" then eve$$x_help_this_topic := expand_result; endif; endif; endif; ! remember if it's an ambiguous command/builtin if eve$$x_state_array {eve$$k_ambiguous_parse} then if not eve$$reserve_scratch_buffer then eve$help_cleanup; return (FALSE); endif; erase (eve$$x_scratch_buffer); saved_mark := mark (FREE_CURSOR); position (eve$$x_scratch_buffer); copy_text (eve$choice_buffer); if the_prefix <> "" then eve$strip_choices (length (the_prefix), eve$$x_scratch_buffer); endif; position (saved_mark); ambiguous_commands := TRUE; endif; if valid_eve_cmd = 0 then ! Not a legal command (may be ambig cmd or info topic), ! see if it's an info topic. the_prefix := eve$$x_help_prefix + eve$$x_help_the_facility + "_"; change_case (the_prefix, UPPER); expand_result := eve$$parse (lowercase_topic, the_prefix); if expand_result <> "" then eve$$x_help_this_topic := substr (expand_result, length (the_prefix) + 1, length (expand_result)); valid_topic := eve$$x_help_this_topic; else if eve$$x_state_array {eve$$k_ambiguous_parse} then ambiguous_topics := TRUE; endif; endif; eve$strip_choices (length (the_prefix), eve$choice_buffer); endif; ! Merge ambiguous commands with ambiguous info topics if ambiguous_topics or ambiguous_commands then ! an ambiguous command/builtin or info topic if eve$$x_state_array {eve$$k_in_init_file} then ! don't display choices if in /init file eve$message (EVE$_AMBCMDINIT, 0, eve$$x_current_init_cmd); eve$help_cleanup; return (FALSE); endif; if ambiguous_commands then ! Scratch buffer contains stripped ambiguous commands. Add ! them to choice buffer (may have stripped ambiguous topics). saved_mark := mark (FREE_CURSOR); position (eve$choice_buffer); copy_text (eve$$x_scratch_buffer); ! ambiguous commands position (saved_mark); endif; ! Now display the ambiguities translate (eve$choice_buffer, " ", "_"); eve$display_choices (message_text (EVE$_AMBCMD, 0, eve$$x_help_ambiguous_topic), ""); eve$map_choices; update (tpu$x_show_window); eve$$release_scratch_buffer; endif; ! If not any of the above, the librarian will look for it, ! and if not found, we'll put up the 'Sorry...' message. endif; endif; return (TRUE); endprocedure; ! eve$help_parse ! EVE$HELP.TPU Page 26 procedure eve$help_display_topic ! Display parsed help topic on_error [TPU$_CONTROLC]: eve$help_cleanup; eve$learn_abort; abort; [OTHERWISE]: eve$help_cleanup; endon_error; edit (eve$$x_help_this_topic, LOWER, OFF); if not eve$$x_state_array {eve$$k_ambiguous_parse} then eve$$x_help_ambiguous_topic := ""; if eve$$x_help_this_topic = eve$x_commands then if not eve$$x_showing_commands then eve$help_text (eve$$x_help_the_facility, eve$$x_help_this_topic); eve$help_next_prompt; eve$x_showing_keypad := FALSE; eve$$x_help_showing_keys := FALSE; else eve$message (EVE$_ALRLISTCMD); eve$help_next_prompt; update (tpu$x_show_window); endif; eve$$x_showing_commands := TRUE; else eve$$x_showing_commands := FALSE; if eve$$x_help_mode <> 0 then eve$dynamic_help (eve$current_key_map_list( eve$$x_help_this_buffer), eve$$x_help_mode); eve$help_next_prompt; else if eve$$x_help_this_topic = "_at_file" then ! parser converted @ into _at_file (!) eve$$x_help_this_topic := "@"; endif; eve$help_text (eve$$x_help_the_facility, eve$$x_help_this_topic); eve$help_next_prompt; endif; endif; ! remove scroll bars if topic is shorter than the window eve$$help_scroll_bars; else eve$$x_state_array {eve$$k_ambiguous_parse} := FALSE; eve$help_next_prompt; endif; return (TRUE); endprocedure; ! eve$help_display_topic ! EVE$HELP.TPU Page 27 procedure eve$help_cleanup ! Cleanup after help on_error [TPU$_CONTROLC]: eve$help_cleanup; eve$learn_abort; abort; [OTHERWISE]: endon_error; if eve$$x_ctx_sensitive_help then if eve$$x_cs_handler <> WINDOW then eve$$x_ctx_sensitive_help := FALSE; return (TRUE); endif; endif; eve$unmap_if_mapped (eve$choice_window); eve$unmap_if_mapped (eve$prompt_window); update (message_window); eve$$x_state_array {eve$$k_help_active} := 0; ! re-enable parser error msgs if eve$$x_help_teardown_when_done then eve$teardown_windows; endif; if eve$$x_help_saved_window <> tpu$x_show_window then eve$unmap_help; else ! don't unmap then map show_window, just remap map (eve$$x_help_saved_window, eve$$x_help_this_buffer); endif; eve$set_status_line (current_window); eve$$x_state_array {eve$$k_help_active} := 0; eve$$restore_position (eve$$x_help_saved_window, eve$$x_help_saved_mark); if eve$$x_ctx_sensitive_help then update (ALL); eve$$x_ctx_sensitive_help := FALSE; endif; ! unconditionally restore scroll bars to the tpu$x_show_window eve$$set_scroll_bars (tpu$x_show_window); ! remove special key_map_list from the help_prompt_buffer set (KEY_MAP_LIST, eve$x_key_map_list, eve$help_prompt_buffer); return (TRUE); endprocedure; ! eve$help_cleanup ! EVE$HELP.TPU Page 28 procedure eve$help_status_line ! Set help status line + EOB text on_error [OTHERWISE]: endon_error; eve$set_status_line (tpu$x_show_window); if eve$x_showing_keypad or ! remove EOB from keypad diagram/list eve$$x_help_showing_keys then set (EOB_TEXT, help_buffer, ""); else set (EOB_TEXT, help_buffer, message_text (EVE$_EOBHELP, 1)); endif; endprocedure; ! eve$help_status_line ! EVE$HELP.TPU Page 29 procedure eve$help_enter_prompt ! Prompt for help topic (prompt; initial_reply, init_flag) local start_mark, initial_copy; on_error [TPU$_CONTROLC]: eve$help_cleanup; eve$learn_abort; abort; [OTHERWISE]: eve$help_cleanup; endon_error; eve$$x_choice_range := 0; if (init_flag = TRUE) or (init_flag = tpu$k_unspecified) then erase (eve$help_prompt_buffer); position (end_of (eve$recall_line_buffer)); ! Only to set the position endif; if get_info (eve$prompt_window, "buffer") = 0 then map (eve$prompt_window, eve$help_prompt_buffer); endif; position (eve$prompt_window); ! for context-sensitive help position (beginning_of (eve$help_prompt_buffer)); copy_text (prompt); eve$x_prompt := prompt; eve$x_prompt_length := length (prompt); move_horizontal (-1); eve$x_help_prompt_range := create_range (beginning_of (eve$help_prompt_buffer), mark (NONE), NONE); ! prompt window is reverse position (LINE_END); if initial_reply <> eve$k_no_arg then initial_copy := initial_reply; edit (initial_copy, TRIM); copy_text (initial_copy); start_mark := mark (NONE); position (end_of (eve$x_help_prompt_range)); move_horizontal (1); eve$$x_choice_range := create_range (start_mark, mark (NONE), NONE); position (LINE_END); endif; return (TRUE); endprocedure; ! eve$help_enter_prompt ! EVE$HELP.TPU Page 30 procedure eve$$help_scroll ! Scroll help info local scroll_window, how_much_scroll, next_flag, prev_flag, up_flag, down_flag; next_flag := eve$test_synonym ("next_screen", eve$$x_help_this_topic); prev_flag := eve$test_synonym ("previous_screen", eve$$x_help_this_topic); up_flag := eve$$x_help_vt100 and eve$test_synonym ("move_up", eve$$x_help_this_topic); down_flag := eve$$x_help_vt100 and eve$test_synonym ("move_down", eve$$x_help_this_topic); if (next_flag or prev_flag or up_flag or down_flag) then if get_info (eve$choice_window, "buffer") <> 0 then scroll_window := eve$choice_window; else if (get_info (help_buffer, "record_count") > get_info (tpu$x_show_window, "visible_length") - 1) then scroll_window := tpu$x_show_window; endif; endif; endif; if scroll_window <> 0 then position (scroll_window); ! allow overlap of text how_much_scroll := get_info (scroll_window, "visible_length") - 2; if how_much_scroll <= 0 then how_much_scroll := 1; endif; if (next_flag or down_flag) then scroll (scroll_window, how_much_scroll); else scroll (scroll_window, -how_much_scroll); endif; position (eve$prompt_window); return (TRUE); endif; return (FALSE); endprocedure; ! eve$$help_scroll ! EVE$HELP.TPU Page 31 procedure eve$help_next_prompt ! Issue next help prompt if eve$$x_help_mode = 0 then if (eve$$x_showing_commands) or (eve$$x_help_this_topic = eve$x_commands) then return (eve$help_enter_prompt (message_text (EVE$_HELPPROMPT, 1), eve$$x_help_ambiguous_topic)); else return (eve$help_enter_prompt (message_text (EVE$_HELPPROMPT2, 1), eve$$x_help_ambiguous_topic)); endif; else if (eve$x_showing_keypad) or (eve$$x_help_showing_keys) then return (eve$help_enter_prompt (message_text (EVE$_HELPKEYRET, 1), "")); else return (eve$help_enter_prompt (message_text (EVE$_HELPKEYHELP, 1), "")); endif; endif; endprocedure; ! eve$help_next_prompt ! EVE$HELP.TPU Page 32 procedure eve$help_undefined_key ! Help prompt processing (the_key) ! Process keys in the help prompt buffer. Display new help topic and new ! prompt (if necessary), changing between keypad, keylist, and command modes. local temp_string, legend, put_in_recall_buffer, key_help, key_facility, test_bounds, recall_line, the_list, this_key; on_error [TPU$_CONTROLC]: eve$help_cleanup; eve$learn_abort; abort; [OTHERWISE]: eve$help_cleanup; endon_error; ! handle typing keys first for speed (use EVE's kml to avoid self_insert=off) this_key := the_key; if (ascii (this_key) <> ascii (0)) and ! PRINTING and not ALT-modified (lookup_key (this_key, PROGRAM, eve$x_key_map_list) = 0) then eve$clear_message; if current_offset < eve$x_prompt_length then ! don't let chars be put into the prompt move_horizontal (eve$x_prompt_length - current_offset); endif; ! insert a printable key using EVE's kml (so user can type in a topic) execute (this_key, eve$x_key_map_list); update (eve$prompt_window); return (TRUE); endif; if eve$$x_ctx_sensitive_help then if last_key = HELP then ! fires off ctx_sensitive help, ignore it eve$$x_ctx_sensitive_help := FALSE; return (TRUE); endif; endif; eve$clear_message; ! get current kml (not command/help, default = eve$x_key_map_list) ! and the last key's comment the_list := eve$current_key_map_list (eve$$x_help_this_buffer); if the_list <> eve$x_key_map_list then ! A foreign kml: DEL is the only allowed line-editing character, ! and RETURN exits help. eve$$parse_comment (this_key, eve$x_key_map_list, ! get EVE's key comment key_facility, legend, eve$$x_help_this_topic); if (eve$test_synonym ("delete", eve$$x_help_this_topic)) or (eve$test_synonym ("return", eve$$x_help_this_topic)) then ! force EVE's kml for "delete" or "return" the_list := eve$x_key_map_list; else ! use foreign kml's definition eve$$parse_comment (this_key, the_list, ! get kml's key comment key_facility, legend, eve$$x_help_this_topic); endif; eve$$x_help_mode := 1; ! force keypad mode else eve$$parse_comment (this_key, the_list, ! get key comment key_facility, legend, eve$$x_help_this_topic); endif; ! get the reply string temp_string := substr (current_line, eve$x_prompt_length + 1, 999); ! also handle the DEL_KEY first for speed if (eve$test_synonym ("delete", eve$$x_help_this_topic)) and (temp_string <> "") and (current_offset > eve$x_prompt_length) ! insure didn't move into prompt then execute (this_key, the_list); ! delete a character from reply update (eve$prompt_window); return (TRUE); endif; ! exit help with RETURN if (temp_string = "") and (eve$test_synonym ("return", eve$$x_help_this_topic)) then eve$help_cleanup; return (TRUE); endif; ! keypad help if eve$$x_help_mode <> 0 then ! keypad help (DEL is the only line-editing character.) if eve$is_mouse (this_key) then eve$message (EVE$_NOMOUSEINPROMPT); else ! DEL ? if (temp_string <> "") and (eve$test_synonym ("delete", eve$$x_help_this_topic)) then execute (this_key, the_list); eve$$help_post_filter; update (eve$prompt_window); return (TRUE); endif; key_help := 0; if temp_string <> "" then if temp_string = substr (eve$x_keypad, 1, length (temp_string)) then key_help := 1; ! keypad diagram else if temp_string = substr (eve$x_keys, 1, length (temp_string)) then key_help := 2; ! keys endif; endif; endif; if (key_help = 0) and (temp_string <> "") then ! a reply that's not "keypad" or "keys" eve$$x_help_this_topic := temp_string; edit (eve$$x_help_this_topic, COMPRESS, TRIM, OFF); eve$$x_help_mode := 0; ! switch to command-line help mode, ! (and EVE's facility after keypad help) eve$$x_help_the_facility := eve$get_help_item (eve$k_help_facility, "eve"); if not eve$help_parse then eve$help_cleanup; return (FALSE); endif; eve$help_display_topic; eve$x_showing_keypad := FALSE; eve$$x_help_showing_keys := FALSE; if eve$$x_help_ambiguous_topic = "" then put_in_recall_buffer := TRUE; else eve$$x_state_array {eve$$k_ambiguous_parse} := FALSE; endif; else if this_key = eve$$x_help_to_be_ignored then eve$$x_help_to_be_ignored := FALSE; else ! see if a mouse up key should be ignored next time around loop eve$$x_help_to_be_ignored := eve$key_to_ignore (this_key); if temp_string = "" then eve$$x_help_the_facility := key_facility; else legend := ""; endif; if eve$$help_scroll then test_bounds := TRUE; else ! switch the facility if the topic = a facility eve$is_help_facility (eve$$x_help_this_topic, eve$$x_help_the_facility); if eve$$x_help_this_topic = "" then if eve$alphabetic (this_key) <> "" then eve$$x_help_this_topic := message_text (EVE$_TYPING, 1); else eve$$x_help_this_topic := message_text (EVE$_UNKNOWN, 1); endif; endif; %if eve$x_option_keyhelp %then change_case (legend, LOWER); if eve$test_synonym ("help", eve$$x_help_this_topic) then key_help := 0; if (legend = eve$$x_help_this_topic + " " + eve$x_keypad) and (not eve$x_showing_keypad) then ! draw the keypad key_help := 1; else if (legend = eve$$x_help_this_topic + " " + eve$x_keys) and (not eve$$x_help_showing_keys) then key_help := 2; endif; endif; endif; if key_help <> 0 then eve$$x_showing_commands := FALSE; eve$dynamic_help (the_list, key_help); eve$help_next_prompt; else if eve$$x_help_the_facility = "" then eve$$x_help_the_facility := eve$get_help_item (eve$k_help_facility, "eve"); endif; eve$help_text (eve$$x_help_the_facility, eve$$x_help_this_topic); eve$x_showing_keypad := FALSE; eve$$x_help_showing_keys := FALSE; eve$help_next_prompt; endif; %else if (legend = "help " + eve$x_keypad) then if (not eve$x_showing_keypad) then eve$x_showing_keypad := TRUE; if eve$x_numeric_keypad then eve$help_text (eve$get_help_item (eve$k_help_facility, "eve"), message_text (EVE$_VT200PADHELP, 1)); else eve$help_text (eve$get_help_item (eve$k_help_facility, "eve"), message_text (EVE$_VT100PADHELP, 1)); endif; else eve$x_showing_keypad := FALSE; eve$help_text (eve$$x_help_the_facility, eve$$x_help_this_topic); endif; eve$help_next_prompt; eve$x_old_help_topic := ""; ! allow alternate 's else if eve$$x_help_the_facility = "" then eve$$x_help_the_facility := eve$get_help_item (eve$k_help_facility, "eve"); endif; eve$help_text (eve$$x_help_the_facility, eve$$x_help_this_topic); eve$x_showing_keypad := FALSE; eve$$x_help_showing_keys := FALSE; eve$help_next_prompt; endif; %endif ! remove scroll bars if topic is shorter than the window eve$$help_scroll_bars; endif; endif; endif; ! end of next/prev screen test endif; ! EVE$HELP.TPU Page 33 else ! command line help eve$$x_help_to_be_ignored := FALSE; if eve$$x_help_this_topic <> "" then ! don't call eve$test_terminator here for speed if index (" " + eve$$x_help_term_mask + " ", " " + eve$$x_help_this_topic + " ") <> 0 then ! hit a terminator if eve$$help_scroll then test_bounds := TRUE; else ! terminator with reply, get help if temp_string <> "" then ! make reply the topic eve$$x_help_this_topic := temp_string; if not eve$help_parse then eve$help_cleanup; return (FALSE); endif; eve$help_display_topic; if eve$$x_help_ambiguous_topic = "" then put_in_recall_buffer := TRUE; endif; else ! terminator without reply, is it "keys" or "keypad"? if (legend = eve$$x_help_this_topic + " " + eve$x_keypad) then ! draw the keypad eve$$x_help_this_topic := eve$x_keypad; key_help := 1; else if (legend = eve$$x_help_this_topic + " " + eve$x_keys) then eve$$x_help_this_topic := eve$x_keys; key_help := 2; endif; endif; if key_help <> 0 then eve$$x_showing_commands := FALSE; eve$dynamic_help (the_list, key_help); eve$help_next_prompt; ! remove scroll bars if topic is shorter than the window eve$$help_scroll_bars; else if not ((eve$test_synonym ("next_screen", eve$$x_help_this_topic)) or (eve$test_synonym ("previous_screen", eve$$x_help_this_topic)) or (eve$$x_help_vt100 and ((eve$test_synonym ("move_up", eve$$x_help_this_topic)) or (eve$test_synonym ("move_down", eve$$x_help_this_topic))))) then ! all other terminators on null line = exit help eve$help_cleanup; return (TRUE); endif; endif; endif; endif; else ! not a help terminator if index (" " + eve$$x_terminator_array {eve$$x_recall_terminators} + " ", " " + eve$$x_help_this_topic + " ") <> 0 then ! it's a recall terminator position (eve$recall_line_buffer); if index ( eve$$x_terminator_array {eve$$x_recall_up_terminators}, eve$$x_help_this_topic) <> 0 then if mark (NONE) <> beginning_of (current_buffer) then move_vertical (-1); else if eve$x_recall_round then position (end_of (current_buffer)); endif; endif; else if mark (NONE) <> end_of (current_buffer) then move_vertical (1); else if eve$x_recall_round then position (beginning_of (current_buffer)); endif; endif; endif; if mark (NONE) = end_of (current_buffer) then recall_line := ""; else recall_line := current_line; endif; position (eve$help_prompt_buffer); erase_line; eve$help_enter_prompt (eve$x_prompt, recall_line, FALSE); else ! not help/recall terminator execute (this_key, the_list); ! execute this key endif; endif; else ! reject mouse keys if eve$is_mouse (this_key) then eve$message (EVE$_NOMOUSEINPROMPT); else ! execute user-defined key (null comment) execute (this_key, the_list); endif; endif; ! Clean up after executing the key: ! 1. exit if it unmapped the prompt_window or positioned to ! another buffer ! 2. put cursor @end of 1st line if > 1 line inserted into prompt buf if get_info (eve$prompt_window, "buffer") = 0 then eve$help_cleanup; return (FALSE); endif; if current_buffer <> eve$help_prompt_buffer then if current_window <> eve$choice_window then ! don't exit help if now in choices window, eve$help_cleanup; ! allow selecting a choice with mouse or SELECT endif; return (FALSE); endif; if (get_info (eve$help_prompt_buffer, "record_count") > 1) or (mark (NONE) = end_of (eve$help_prompt_buffer)) then position (beginning_of (eve$help_prompt_buffer)); position (LINE_END); endif; eve$$help_post_filter; update (eve$prompt_window); endif; if put_in_recall_buffer then ! save the topic in the recall line buffer position (end_of (eve$recall_line_buffer)); if mark (NONE) <> beginning_of (eve$recall_line_buffer) then move_vertical (-1); if current_line <> temp_string then move_vertical (1); copy_text (temp_string); endif; else copy_text (temp_string); endif; position (end_of (eve$recall_line_buffer)); endif; if test_bounds then ! set the status line after NEXT/PREV SCREEN eve$set_status_line (tpu$x_show_window); endif; position (eve$help_prompt_buffer); position (eve$prompt_window); return (TRUE); endprocedure; ! eve$help_undefined_key ! EVE$HELP.TPU Page 34 procedure eve$$help_post_filter ! Clean up after help key press local here; if str (eve$x_help_prompt_range) <> eve$x_prompt then here := mark (FREE_CURSOR); erase (eve$x_help_prompt_range); position (beginning_of (eve$help_prompt_buffer)); ! add in prompt again - being careful if in overstrike mode eve$insert_text (eve$x_prompt); move_horizontal (-1); eve$x_help_prompt_range := create_range (beginning_of (eve$help_prompt_buffer), mark (NONE), NONE); ! prompt window =reverse position (here); if mark (NONE) = end_of (current_buffer) then move_horizontal (-1); endif; position (here); else ! paranoia code if current_offset < eve$x_prompt_length then move_horizontal (eve$x_prompt_length - current_offset); endif; endif; endprocedure; ! eve$$help_post_filter ! EVE$HELP.TPU Page 35 procedure eve$$help_scroll_bars ! Remove scroll bars if short topic on_error [OTHERWISE]: endon_error; %if eve$x_option_decwindows %then if eve$x_decwindows_active then if get_info (help_buffer, "record_count") > (get_info (tpu$x_show_window, "visible_length") - 1 - ! status line ! the following tells if scroll bar exists, not it's visibility. ! it's visible if (visible_bottom = visible_length -2). (get_info (tpu$x_show_window, "scroll_bar", HORIZONTAL) <> 0)) then eve$$set_scroll_bars (tpu$x_show_window); else eve$$set_no_scroll_bars (tpu$x_show_window); endif; update (tpu$x_show_window); endif; %endif endprocedure; ! eve$$help_scroll_bars ! EVE$HELP.TPU Page 36 procedure eve$is_help_facility ! is topic facility code? (topic, facility) ! Determine if a command-line help topic is a facility code (e.g, EVE, TPU), ! and, if so, return the name of the facility. And, if the help topic ! is a facility plus a topic (e.g., TPU APPEND_LINE), strip the ! facility from the 'topic' parameter, leaving only the topic string. This ! allows the user to enter the command "help facility topic", and get help ! on the topic without having to enter first the command "help facility" ! followed by the topic. ! local fac, list_of_topics, space_index, lower_topic, the_topic; on_error [OTHERWISE]: endon_error; the_topic := topic; lower_topic := topic; edit (the_topic, COMPRESS, LOWER, TRIM, OFF); edit (lower_topic, COMPRESS, TRIM, OFF); space_index := index (the_topic, " "); if space_index <> 0 ! we've got a facility and a topic then fac := substr (the_topic, 1, space_index - 1); the_topic := substr (the_topic, space_index, length (the_topic)); lower_topic := substr (lower_topic, space_index, length (lower_topic)); else fac := the_topic; endif; if eve$get_help_item (eve$k_help_facility, fac) <> "" then if (fac <> eve$get_help_item (eve$k_help_facility, "get_info")) and (fac <> eve$get_help_item (eve$k_help_facility, "set")) then facility := fac; ! topic contains a facility topic := lower_topic; return (TRUE); endif; else return (FALSE); endif; endprocedure; ! eve$is_help_facility ! EVE$HELP.TPU Page 37 procedure eve$help_text ! Display help topic (facility, ! String containing the facility name which is used to ! find the corresponding help library and major help topic(s) ! Note that the facility major topic may consist ! of more than just the top level topic. sub_topic) ! The actual topic that the user is interested in ! Do help_text for a given topic, stripping librarian header information, ! and update the info_window. local library, ! help library from facility translated_topic, ! sub_topic with no "_" major_topic, ! major topic from fac ("edt key", etc) search_range, ! used to search for extra topics in buffer old_help_topic, ! major_topic + " " + sub_topic old_help_facility, ! facility temp_facility, ! uppercase facility local_sub_topic, ! copy of sub_topic arg here, ! marker space_index, ! index of spaces in major_topic original_buffer, ! buffer upon entry help_level; ! topic level (derived from # spaces in ! major_topic) on_error [TPU$_ENDOFBUF]: erase (help_buffer); copy_text (message_text (EVE$_NOHELPON, 1, temp_facility, local_sub_topic)); update (tpu$x_show_window); return; [OTHERWISE]: position (original_buffer); endon_error; original_buffer := current_buffer; local_sub_topic := sub_topic; library := eve$get_help_item (eve$k_help_library, facility); major_topic := eve$get_help_item (eve$k_help_topic, facility); ! ignore duplicate topics - prevent disk seeks on slow devices if (eve$x_old_help_facility + eve$x_old_help_topic = facility + major_topic + " " + local_sub_topic) then if local_sub_topic = eve$x_commands then eve$message (EVE$_ALRLISTCMD); update (message_window); else translated_topic := local_sub_topic; translate (translated_topic, " ", "_"); eve$message (EVE$_ALRHELP, 0, translated_topic); endif; update (tpu$x_show_window); return; endif; ! the new topic now becomes the old old_help_topic := major_topic + " " + local_sub_topic; old_help_facility := facility; edit (old_help_topic, TRIM, OFF); help_text (library, old_help_topic, OFF, help_buffer); position (beginning_of (help_buffer)); temp_facility := facility; change_case (temp_facility, UPPER); if (search_quietly (LINE_BEGIN + span (" ") + eve$x_nodocmsg, FORWARD) <> 0) then ! couldn't find the topic, tell how to get help on all facilities erase (help_buffer); copy_text (message_text (EVE$_NOHELPON, 1, temp_facility, local_sub_topic)); split_line; split_line; copy_text (" ~I~"); ! show where invoke strings go ! Insert how_to_invoke strings for facilities <> facility eve$$insert_invoke_strings (facility, "~I~"); else edit (major_topic, TRIM, COMPRESS, OFF); ! Determine help topic level, and therefore how many topic ! lines to remove from the beginning of the help buffer. ! (this code is tied to the help library contents) if (major_topic = "") and (substr (local_sub_topic, 1, 6) <> eve$x_keypad) then help_level := 1; else help_level := 2; space_index := 0; loop space_index := index (substr (major_topic, space_index + 1, length (major_topic)), " "); exitif space_index = 0; help_level := help_level + 1; endloop; endif; ! Skip over topic lines. On Ultrix, topics have a topic line followed by ! the first text line. On VMS, topics have a blank line, the topic, and ! a blank line followed by the first text line. move_vertical ((eve$x_ultrix_active = 0) + ((1 + (eve$x_ultrix_active = 0)) * help_level)); erase (create_range (beginning_of (help_buffer), mark (NONE), NONE)); ! If more than 1 topic was retrieved, then format them too. loop exitif mark (NONE) = end_of (help_buffer); move_vertical (1); ! topics should be in column 1 search_range := search_quietly (LINE_BEGIN + any (eve$x_alphanumeric_characters), FORWARD); exitif search_range = 0; if (search_range <> 0) and (substr (local_sub_topic, 1, 6) <> eve$x_keypad) then position (search_range); here := mark (NONE); move_vertical (-1); ! go to blank line before the topic line move_vertical ((eve$x_ultrix_active = 0) + ! Skip over topic lines. ((1 + (eve$x_ultrix_active = 0)) * help_level)); erase (create_range (here, mark (NONE), NONE)); endif; endloop; endif; if local_sub_topic = eve$kt_topic_eve_about then position (beginning_of (help_buffer)); erase_line; copy_text (" " + eve$version); position (search (LINE_BEGIN, REVERSE)); move_horizontal (7); copy_text (message_text (EVE$_EVENAME, 1)); position (search (LINE_END, FORWARD)); split_line; split_line; endif; ! Insert how_to_invoke strings for facilities <> facility if local_sub_topic = eve$x_commands then eve$$insert_invoke_strings (facility, "~I~"); endif; eve$x_old_help_topic := major_topic + " " + local_sub_topic; edit (eve$x_old_help_topic, COMPRESS, OFF); eve$x_old_help_facility := facility; ! erase any trailing blank lines (to avoid NEXT/PREV SCREEN status line) position (end_of (help_buffer)); position (search_quietly (notany (eve$x_whitespace), REVERSE)); move_horizontal (1); erase (create_range (mark (NONE), end_of (help_buffer), NONE)); position (beginning_of (help_buffer)); ! set dynamic status line depending on length of help message eve$help_status_line; position (original_buffer); update (tpu$x_show_window); endprocedure; ! eve$help_text ! EVE$HELP.TPU Page 38 procedure eve$dynamic_help ! Dynamic keypad help (which_key_map_list, which; do_setup) ! Puts up keypad diagram or list of keys, and sets status line. ! Assumes current_buffer = help_buffer local help_char, ! Keyword of key to provide help on facility, ! "Facility" - points to library/main-topic topic, ! String with help library subtopic temp, ! Surprise! the_key_map_list, ! Local copy of which_key_map_list answer; ! String user may type in at the prompt on_error [OTHERWISE]: endon_error; eve$$x_help_mode := which; if do_setup = TRUE then if eve$$x_help_mode = 1 then eve$help_setup (eve$x_keypad); else if eve$$x_help_mode = 2 then eve$help_setup (eve$x_keys); endif; endif; endif; the_key_map_list := which_key_map_list; if (the_key_map_list = "") then the_key_map_list := eve$current_key_map_list (eve$$x_help_this_buffer); endif; facility := ""; eve$x_old_help_topic := ""; %if eve$x_option_keyhelp %then case eve$$x_help_mode [1]: if eve$x_showing_keypad then eve$message (EVE$_ALRHELP, 0, eve$x_keypad); else eve$draw_keypad (the_key_map_list); ! draw the keypad eve$clear_message; endif; eve$x_showing_keypad := TRUE; eve$$x_help_showing_keys := FALSE; [2]: if eve$$x_help_showing_keys then eve$message (EVE$_ALRHELP, 0, eve$x_keys); else eve$list_keys (the_key_map_list); ! List the keys endif; eve$x_showing_keypad := FALSE; eve$$x_help_showing_keys := TRUE; endcase; ! Set eob_text, status line per the length of the keypad diagram, and ! update the window (as eve$help_text would if we had called it) eve$help_status_line; update (tpu$x_show_window); %else eve$x_showing_keypad := TRUE; if eve$x_numeric_keypad then eve$help_text (eve$get_help_item (eve$k_help_facility, "eve"), message_text (EVE$_VT200PADHELP, 1)); else eve$help_text (eve$get_help_item (eve$k_help_facility, "eve"), message_text (EVE$_VT100PADHELP, 1)); endif; %endif endprocedure; ! eve$dynamic_help ! EVE$HELP.TPU Page 39 procedure eve$help_keypad ! --- Obsolete --- (which_key_map_list, which) ! 1 = keypad 2 = key list local help_char, ! Keyword of key to provide help on facility, ! "Facility" - points to library/main-topic topic, ! String with help library subtopic legend, ! Key legend which_choice, ! Local copy of which vt100, ! Set if on a vt100 this_key_map_list, ! Local copy of which_key_map_list answer, ! String user may type in at the prompt to_be_ignored; ! Key-name of the stroke to be ignored on_error [OTHERWISE]: endon_error; this_key_map_list := which_key_map_list; if (this_key_map_list = "") then this_key_map_list := eve$current_key_map_list; endif; facility := ""; which_choice := which; eve$clear_message; eve$x_old_help_topic := ""; vt100 := eve$on_a_pre_lk201; %if eve$x_option_keyhelp %then case which_choice [1]: eve$x_showing_keypad := TRUE; eve$draw_keypad (this_key_map_list); ! draw the keypad [2]: eve$$x_help_showing_keys := TRUE; eve$list_keys (this_key_map_list); ! List the keys endcase; eve$help_status_line; %else eve$x_showing_keypad := TRUE; if eve$x_numeric_keypad then eve$help_text (eve$get_help_item (eve$k_help_facility, "eve"), message_text (EVE$_VT200PADHELP, 1)); else eve$help_text (eve$get_help_item (eve$k_help_facility, "eve"), message_text (EVE$_VT100PADHELP, 1)); endif; %endif loop update (tpu$x_show_window); if (eve$x_showing_keypad) or (eve$$x_help_showing_keys) then answer := eve$prompt_line (message_text (EVE$_HELPKEYRET, 1), HELP, ""); else answer := eve$prompt_line (message_text (EVE$_HELPKEYHELP, 1), HELP, ""); endif; if answer = 0 then return (0); endif; which_choice := 0; ! default to keypad diagram if answer <> "" then topic := "help"; ! Set up topic in case we got an answer if answer = substr (eve$x_keypad, 1, length (answer)) then which_choice := 1; ! keypad diagram else if answer = substr (eve$x_keys, 1, length (answer)) then which_choice := 2; ! keys else return (answer); endif; endif; endif; help_char := last_key; if help_char = to_be_ignored then to_be_ignored := FALSE; ! ignore mouse up key else ! see if a mouse up key should be ignored next time around loop to_be_ignored := eve$key_to_ignore (help_char); if answer = "" then eve$$parse_comment (help_char, this_key_map_list, facility, legend, topic); else legend := ""; endif; exitif eve$test_synonym ("return", topic); ! perform next/prev screen only if topic_length > window_length if ((eve$test_synonym ("next_screen", topic)) or (eve$test_synonym ("previous_screen", topic)) or (vt100 and ((eve$test_synonym ("move_up", topic)) or (eve$test_synonym ("move_down", topic))))) and (get_info (help_buffer, "record_count") > get_info (tpu$x_show_window, "visible_length") - 1) then if (eve$test_synonym ("next_screen", topic)) or (vt100 and (eve$test_synonym ("move_down", topic))) then eve$move_by_screen (1); else if (eve$test_synonym ("previous_screen", topic)) or (vt100 and (eve$test_synonym ("move_up", topic))) then eve$move_by_screen (-1); endif; endif; eve$set_status_line (tpu$x_show_window); eve$clear_message; else ! switch the facility if the topic = a facility eve$is_help_facility (topic, facility); if topic = "" then if eve$alphabetic (help_char) <> "" then topic := message_text (EVE$_TYPING, 1); else topic := message_text (EVE$_UNKNOWN, 1); endif; endif; eve$clear_message; %if eve$x_option_keyhelp %then change_case (legend, LOWER); if eve$test_synonym ("help", topic) then if (legend = topic + " " + eve$x_keypad) and (not eve$x_showing_keypad) then ! draw the keypad which_choice := 1; else if (legend = topic + " " + eve$x_keys) and (not eve$$x_help_showing_keys) then which_choice := 2; endif; endif; endif; if which_choice <> 0 then case which_choice [1]: if eve$x_showing_keypad then eve$message (EVE$_ALRHELP, 0, eve$x_keypad); else eve$draw_keypad (this_key_map_list); endif; eve$x_showing_keypad := TRUE; eve$$x_help_showing_keys := FALSE; [2]: if eve$$x_help_showing_keys then eve$message (EVE$_ALRHELP, 0, eve$x_keys); else eve$list_keys (this_key_map_list); eve$$x_help_showing_keys := TRUE; eve$x_showing_keypad := FALSE; endif; endcase; eve$set_status_line (tpu$x_show_window); eve$x_old_help_topic := ""; ! allow alternate 's else if facility = "" then facility := eve$get_help_item (eve$k_help_facility, "eve"); endif; eve$help_text (facility, topic); eve$x_showing_keypad := FALSE; eve$$x_help_showing_keys := FALSE; which_choice := 0; endif; %else if (topic = "help " + eve$x_keypad) and (not eve$x_showing_keypad) then eve$x_showing_keypad := TRUE; if eve$x_numeric_keypad then eve$help_text (eve$get_help_item (eve$k_help_facility, "eve"), message_text (EVE$_VT200PADHELP, 1)); else eve$help_text (eve$get_help_item (eve$k_help_facility, "eve"), message_text (EVE$_VT100PADHELP, 1)); endif; eve$x_old_help_topic := ""; ! allow alternate 's else if facility = "" then facility := eve$get_help_item (eve$k_help_facility, "eve"); endif; eve$help_text (facility, topic); eve$x_showing_keypad := FALSE; eve$$x_help_showing_keys := FALSE; endif; %endif endif; ! end of next/prev screen test endif; ! end of ignoring a mouse up key endloop; eve$clear_message; endprocedure; ! eve$help_keypad ! EVE$HELP.TPU Page 40 procedure eve$$test_buffer_bounds ! is EOB or BOB visible? ! Description ! Test if either the beginning or end of the current buffer is visible. ! Used by EVE_HELP to determine which status line to display when the ! user should press NEXT/PREV SCREEN to see more of a large help topic. ! (if beginning of buffer is visible, no check is made for end of buffer) ! Return Value ! 0 if beginning of buffer is visible ! 1 if end is visible ! 2 if neither local there, the_row, the_top, the_bottom, saved_mark; on_error [TPU$_CONTROLC]: eve$$restore_position (saved_mark); eve$learn_abort; abort; [OTHERWISE]: eve$$restore_position (saved_mark); endon_error; saved_mark := mark (FREE_CURSOR); ! only needed for error returns position (TEXT); ! snap cursor to text the_row := get_info (current_window, "current_row"); the_top := get_info (current_window, "visible_top"); the_bottom := get_info (current_window, "visible_bottom"); ! test for the top of buffer being visible move_vertical (the_top - the_row); there := mark (NONE); position (saved_mark); if there = beginning_of (current_buffer) then return (0); endif; position (TEXT); ! snap cursor to text ! test for the bottom of buffer being visible move_vertical (the_bottom - the_row); there := mark (NONE); position (saved_mark); position (TEXT); ! snap cursor to text if there = end_of (current_buffer) then return (1); endif; return (2); endprocedure; ! eve$$test_buffer_bounds ! EVE$HELP.TPU Page 41 procedure eve$$insert_invoke_strings ! Tell how to invoke other libs (facility, ! the facility for which an invoke string is not needed label) ! the label marking the start of the bulleted list (the label ! and the rest of the line is erased); if not found, then ! indent 6 spaces before and 2 spaces after the "o". ! Insert a bulleted list into the help buffer consisting of all the ! how_to_invoke help strings for facilities <> facility. local the_facility, a_facility, indent_range, indent_length, tilde, ! partial pattern for bulleted list split_the_line, temp; on_error [OTHERWISE]: endon_error; position (beginning_of (help_buffer)); ! look for label where bulleted list starts indent_range := search_quietly (LINE_BEGIN + (span (eve$x_whitespace) | "") + (label @ tilde), FORWARD); if indent_range = 0 then indent_range := " o "; else position (tilde); indent_length := current_offset; erase_line; split_line; move_vertical (-1); indent_range := (fao ("!#* ", indent_length) + "o "); endif; the_facility := facility; edit (the_facility, COMPRESS, LOWER, TRIM, OFF); a_facility := get_info (eve$$x_help_facility_array, "first"); loop exitif a_facility = tpu$k_unspecified; temp := eve$get_help_item (eve$k_help_facility, a_facility); if temp <> the_facility then temp := eve$get_help_item (eve$k_help_invoke, a_facility); if temp <> "" then copy_text (indent_range + temp); split_line; split_the_line := TRUE; endif; endif; a_facility := get_info (eve$$x_help_facility_array, "next"); endloop; if split_the_line then append_line; endif; endprocedure; ! eve$$insert_invoke_strings ! EVE$HELP.TPU Page 42 procedure eve$get_help_library_topic ! Get fac's helplib.& major topic (the_facility, the_library, the_topic) ! Procedure to return a facility's help library and major topic strings local this_facility; on_error [OTHERWISE]: endon_error; this_facility := the_facility; change_case (this_facility, UPPER); if eve$get_help_item (eve$k_help_facility, this_facility) = "" then ! force the defaults the_library := eve$get_help_item (eve$k_help_library, "eve"); the_topic := eve$get_help_item (eve$k_help_topic, "eve"); return; endif; the_library := eve$get_help_item (eve$k_help_library, this_facility); the_topic := eve$get_help_item (eve$k_help_topic, this_facility); endprocedure; ! eve$get_help_library_topic ! EVE$HELP.TPU Page 43 procedure eve$declare_help_library ! Declare a facility-specific help library (facility, ! facility code (product name), e.g., EVE, TPU, NOTES library; ! file spec for facility help library, doesn't include ! dev:[dir] for logical names to work major_topic, ! top level help topic(s) above the facility topics ! - input (string, or message code) how_to_invoke, ! comment to be added to list of topic displays that ! tells user how to invoke the facility help library, ! e.g., "For help on DECTPU built-ins, type TPU and ! press RETURN." - input (string, or message code) cs_help_arg_list) ! Arg-list to be used when the HELP widget is used ! Declare a facility help library. local the_facility, the_topic, the_invoke_string; on_error [OTHERWISE]: endon_error; if get_info (eve$$x_help_facility_array, "type") <> ARRAY then eve$$x_help_facility_array := create_array; eve$$x_help_library_array := create_array; eve$$x_help_fac_topic_array := create_array; eve$$x_help_invoke_array := create_array; eve$$x_help_arg_list_array := create_array; endif; the_facility := facility; edit (the_facility, COMPRESS, TRIM, LOWER, OFF); eve$$x_help_facility_array {the_facility} := the_facility; eve$$x_help_library_array {the_facility} := library; if get_info (major_topic, "type") <> UNSPECIFIED then case get_info (major_topic, "type") [STRING]: the_topic := major_topic; [KEYWORD, INTEGER]: the_topic := message_text (major_topic); endcase; if the_topic <> 0 then edit (the_topic, COMPRESS, TRIM, UPPER, OFF); eve$$x_help_fac_topic_array {the_facility} := the_topic; endif; else eve$$x_help_fac_topic_array {the_facility} := ""; endif; if get_info (how_to_invoke, "type") <> UNSPECIFIED then case get_info (how_to_invoke, "type") [STRING]: the_invoke_string := how_to_invoke; [KEYWORD, INTEGER]: the_invoke_string := message_text (how_to_invoke); endcase; if the_invoke_string <> 0 then eve$$x_help_invoke_array {the_facility} := the_invoke_string; endif; else eve$$x_help_invoke_array {the_facility} := ""; endif; eve$$x_help_arg_list_array {the_facility} := cs_help_arg_list; return (TRUE); endprocedure; ! eve$declare_help_library ! EVE$HELP.TPU Page 44 procedure eve$get_help_item ! Return info about facility help library (item_code, a_facility) ! return the specified help item associated with the indicated facility: ! item_code = 0 (eve$k_help_facility), return the facility's facility name ! item_code = 1 (eve$k_help_library), return the facility's library file spec ! item_code = 2 (eve$k_help_topic), return the facility's major help topic ! item_code = 3 (eve$k_help_invoke), return the facility's how-to-invoke ! string ! item_code = 4 (eve$k_help_arg_list), return HELP widget arg-list local the_facility; on_error [OTHERWISE]: endon_error; the_facility := a_facility; edit (the_facility, COMPRESS, LOWER, TRIM, OFF); if eve$$x_help_facility_array {the_facility} = tpu$k_unspecified then return (""); endif; case item_code [eve$k_help_facility]: ! facility return (eve$$x_help_facility_array {the_facility}); [eve$k_help_library]: ! library return (eve$$x_help_library_array {the_facility}); [eve$k_help_topic]: ! major topic return (eve$$x_help_fac_topic_array {the_facility}); [eve$k_help_invoke]: ! how-to-invoke string return (eve$$x_help_invoke_array {the_facility}); [eve$k_help_arg_list]: return (eve$$x_help_arg_list_array {the_facility}); endcase; endprocedure; ! eve$get_help_item ! EVE$HELP.TPU Page 45 ! Module initialization code eve$x_showing_keypad := FALSE; ! set some flags off eve$$x_showing_commands := FALSE; eve$$x_help_showing_keys := FALSE; eve$$x_help_this_buffer := 0; ! Define the default legend to display on the help frame. It is displayed ! under a three key wide field. eve$x_help_legend_top := 0; eve$x_help_legend_bot := 0; eve$x_help_do_gold_legend := TRUE; ! Display the gold message eve$$x_help_ignorable_keys := eve$create_terminator ("return do"); eve$$x_key_clusters := create_array; eve$$x_keyboard_type := 0; ! Define VT100/LK201 numeric keypad ! ! When the PF1 flag is seen, the KP7, KP4, KP1, ENTER, and KP0 ! flags are assumed to be in the normal relation to it. eve$define_key_cluster ("PF1", PF1, PF2, PF3, PF4); eve$define_key_cluster ("KP7", KP7, KP8, KP9, MINUS); eve$define_key_cluster ("KP4", KP4, KP5, KP6, COMMA); eve$define_key_cluster ("KP1", KP1, KP2, KP3); eve$define_key_cluster ("ENTER", ENTER); eve$define_key_cluster ("KP0", KP0, KP0, PERIOD); ! Define LK201 clusters eve$define_key_cluster ("F11", F11, F12, F13, F14); eve$define_key_cluster ("F15", F15, F16, F16); eve$define_key_cluster ("F17", F17, F18, F19, F20); eve$define_key_cluster ("E1", E1, E2, E3); eve$define_key_cluster ("E4", E4, E5, E6); eve$define_key_cluster ("UP", UP); eve$define_key_cluster ("LEFT", LEFT, DOWN, RIGHT); ! Define the Vt100 arrows to the right of UP (reused from above) eve$define_key_cluster ("DOWN", DOWN, LEFT, RIGHT); !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! ! ! Developer note: The following must be synchronized with the help ! topics in the EVE$HELP.HLB (Source = KEYPAD.RNH) ! !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! eve$define_keyboard ("vt100", "EVE", "vt100_template"); eve$define_keyboard ("lk201", "EVE", "lk201_template"); eve$define_keyboard ("lk201 wide", "EVE", "lk201_wide_template"); eve$set_keypad_captions ("EVE"); eve$$x_ctx_sensitive_help := FALSE; eve$x_help_keys := "EVE$HELP_KEYS"; eve$x_help_key_map_list := "EVE$HELP_MAP_LIST"; if get_info (eve$help_prompt_buffer, "type") <> BUFFER then if eve$x_buf_str_help_prompt = tpu$k_unspecified then eve$x_buf_str_help_prompt := "$HELP$PROMPT$"; endif; eve$help_prompt_buffer := eve$init_buffer (eve$x_buf_str_help_prompt, ""); if get_info (SCREEN, "line_editing") <> 0 then set (get_info (SCREEN, "line_editing"), eve$help_prompt_buffer); else ! for VMS V4 line-editing compatibility set (OVERSTRIKE, eve$help_prompt_buffer); endif; endif; set (KEY_MAP_LIST, eve$x_key_map_list, eve$help_prompt_buffer); set (SHIFT_KEY, get_info (eve$x_key_map_list, "shift_key"), eve$x_help_key_map_list); if get_info (eve$$x_help_null_program, "type") <> PROGRAM then eve$$x_help_null_program := compile ("eve$null"); endif; endmodule; ! EVE$HELP.TPU Page 46 ! ! Global constant and variable declarations ! variable eve$$x_keypad_help_library; variable eve$$x_keypad_help_topic; ! EVE$HELP.TPU Page 47 ! ! EVE$BUILD time executable code ! eve$x_help_keys := create_key_map ("EVE$HELP_KEYS"); eve$x_help_key_map_list := create_key_map_list ("EVE$HELP_MAP_LIST", "EVE$HELP_KEYS"); set (SELF_INSERT, eve$x_help_key_map_list, OFF); set (UNDEFINED_KEY, eve$x_help_key_map_list, "eve$help_undefined_key (last_key)"); eve$$require ("eve$core"); ! Build dependency