From aee22b9168c04ecd0f10f49f1e903f2588bcfd15 Mon Sep 17 00:00:00 2001 From: ru Date: Mon, 25 Mar 2002 13:10:59 +0000 Subject: [PATCH] Use stock (FSF) version of this file. --- contrib/texinfo/info/doc.c | 223 +++--- contrib/texinfo/info/funs.h | 118 +++ contrib/texinfo/info/infomap.c | 1111 ++++++++++++++++++++++++++- contrib/texinfo/info/session.c | 292 ++++--- contrib/texinfo/info/terminal.c | 57 +- contrib/texinfo/makeinfo/makeinfo.c | 879 +++++++++++++++------ 6 files changed, 2186 insertions(+), 494 deletions(-) diff --git a/contrib/texinfo/info/doc.c b/contrib/texinfo/info/doc.c index e9756e4e8b70..5ae64b1874ee 100644 --- a/contrib/texinfo/info/doc.c +++ b/contrib/texinfo/info/doc.c @@ -1,3 +1,4 @@ +/* $FreeBSD$ */ /* doc.c -- Generated structure containing function names and doc strings. This file was automatically made from various source files with the @@ -18,125 +19,129 @@ a string which is the user-visible name of the function, and a string which documents its purpose. */ -#include "doc.h" +#include "info.h" #include "funs.h" FUNCTION_DOC function_doc_array[] = { /* Commands found in "./session.c". */ - { info_next_line, "next-line", "Move down to the next line" }, - { info_prev_line, "prev-line", "Move up to the previous line" }, - { info_end_of_line, "end-of-line", "Move to the end of the line" }, - { info_beginning_of_line, "beginning-of-line", "Move to the start of the line" }, - { info_forward_char, "forward-char", "Move forward a character" }, - { info_backward_char, "backward-char", "Move backward a character" }, - { info_forward_word, "forward-word", "Move forward a word" }, - { info_backward_word, "backward-word", "Move backward a word" }, - { info_global_next_node, "global-next-node", "Move forwards or down through node structure" }, - { info_global_prev_node, "global-prev-node", "Move backwards or up through node structure" }, - { info_scroll_forward, "scroll-forward", "Scroll forward in this window" }, - { info_scroll_forward_set_window, "scroll-forward-set-window", "Scroll forward in this window and set default window size" }, - { info_scroll_backward, "scroll-backward", "Scroll backward in this window" }, - { info_scroll_backward_set_window, "scroll-backward-set-window", "Scroll backward in this window and set default window size" }, - { info_beginning_of_node, "beginning-of-node", "Move to the start of this node" }, - { info_end_of_node, "end-of-node", "Move to the end of this node" }, - { info_down_line, "down-line", "Scroll down by lines" }, - { info_up_line, "up-line", "Scroll up by lines" }, - { info_scroll_half_screen_down, "scroll-half-screen-down", "Scroll down by half screen size" }, - { info_scroll_half_screen_up, "scroll-half-screen-up", "Scroll up by half screen size" }, - { info_next_window, "next-window", "Select the next window" }, - { info_prev_window, "prev-window", "Select the previous window" }, - { info_split_window, "split-window", "Split the current window" }, - { info_delete_window, "delete-window", "Delete the current window" }, - { info_keep_one_window, "keep-one-window", "Delete all other windows" }, - { info_scroll_other_window, "scroll-other-window", "Scroll the other window" }, - { info_scroll_other_window_backward, "scroll-other-window-backward", "Scroll the other window backward" }, - { info_grow_window, "grow-window", "Grow (or shrink) this window" }, - { info_tile_windows, "tile-windows", "Divide the available screen space among the visible windows" }, - { info_toggle_wrap, "toggle-wrap", "Toggle the state of line wrapping in the current window" }, - { info_next_node, "next-node", "Select the Next node" }, - { info_prev_node, "prev-node", "Select the Prev node" }, - { info_up_node, "up-node", "Select the Up node" }, - { info_last_node, "last-node", "Select the last node in this file" }, - { info_first_node, "first-node", "Select the first node in this file" }, - { info_last_menu_item, "last-menu-item", "Select the last item in this node's menu" }, - { info_menu_digit, "menu-digit", "Select this menu item" }, - { info_menu_item, "menu-item", "Read a menu item and select its node" }, - { info_xref_item, "xref-item", "Read a footnote or cross reference and select its node" }, - { info_find_menu, "find-menu", "Move to the start of this node's menu" }, - { info_visit_menu, "visit-menu", "Visit as many menu items at once as possible" }, - { info_goto_node, "goto-node", "Read a node name and select it" }, - { info_menu_sequence, "menu-sequence", "Read a list of menus starting from dir and follow them" }, - { info_goto_invocation_node, "goto-invocation-node", "Find the node describing program invocation" }, - { info_man, "man", "Read a manpage reference and select it" }, - { info_top_node, "top-node", "Select the node `Top' in this file" }, - { info_dir_node, "dir-node", "Select the node `(dir)'" }, - { info_history_node, "history-node", "Select the most recently selected node" }, - { info_kill_node, "kill-node", "Kill this node" }, - { info_view_file, "view-file", "Read the name of a file and select it" }, - { info_print_node, "print-node", "Pipe the contents of this node through INFO_PRINT_COMMAND" }, - { info_search_case_sensitively, "search-case-sensitively", "Read a string and search for it case-sensitively" }, - { info_search, "search", "Read a string and search for it" }, - { info_search_backward, "search-backward", "Read a string and search backward for it" }, - { info_search_next, "search-next", "Repeat last search in the same direction" }, - { info_search_previous, "search-previous", "Repeat last search in the reverse direction" }, - { isearch_forward, "isearch-forward", "Search interactively for a string as you type it" }, - { isearch_backward, "isearch-backward", "Search interactively for a string as you type it" }, - { info_move_to_prev_xref, "move-to-prev-xref", "Move to the previous cross reference" }, - { info_move_to_next_xref, "move-to-next-xref", "Move to the next cross reference" }, - { info_select_reference_this_line, "select-reference-this-line", "Select reference or menu item appearing on this line" }, - { info_abort_key, "abort-key", "Cancel current operation" }, - { info_move_to_window_line, "move-to-window-line", "Move the cursor to a specific line of the window" }, - { info_redraw_display, "redraw-display", "Redraw the display" }, - { info_quit, "quit", "Quit using Info" }, - { info_do_lowercase_version, "do-lowercase-version", "" }, - { info_add_digit_to_numeric_arg, "add-digit-to-numeric-arg", "Add this digit to the current numeric argument" }, - { info_universal_argument, "universal-argument", "Start (or multiply by 4) the current numeric argument" }, - { info_numeric_arg_digit_loop, "numeric-arg-digit-loop", "Internally used by \\[universal-argument]" }, + { info_next_line, "next-line", (FUNCTION_KEYSEQ *)0, "Move down to the next line" }, + { info_prev_line, "prev-line", (FUNCTION_KEYSEQ *)0, "Move up to the previous line" }, + { info_end_of_line, "end-of-line", (FUNCTION_KEYSEQ *)0, "Move to the end of the line" }, + { info_beginning_of_line, "beginning-of-line", (FUNCTION_KEYSEQ *)0, "Move to the start of the line" }, + { info_forward_char, "forward-char", (FUNCTION_KEYSEQ *)0, "Move forward a character" }, + { info_backward_char, "backward-char", (FUNCTION_KEYSEQ *)0, "Move backward a character" }, + { info_forward_word, "forward-word", (FUNCTION_KEYSEQ *)0, "Move forward a word" }, + { info_backward_word, "backward-word", (FUNCTION_KEYSEQ *)0, "Move backward a word" }, + { info_global_next_node, "global-next-node", (FUNCTION_KEYSEQ *)0, "Move forwards or down through node structure" }, + { info_global_prev_node, "global-prev-node", (FUNCTION_KEYSEQ *)0, "Move backwards or up through node structure" }, + { info_scroll_forward, "scroll-forward", (FUNCTION_KEYSEQ *)0, "Scroll forward in this window" }, + { info_scroll_forward_set_window, "scroll-forward-set-window", (FUNCTION_KEYSEQ *)0, "Scroll forward in this window and set default window size" }, + { info_scroll_forward_page_only, "scroll-forward-page-only", (FUNCTION_KEYSEQ *)0, "Scroll forward in this window staying within node" }, + { info_scroll_forward_page_only_set_window, "scroll-forward-page-only-set-window", (FUNCTION_KEYSEQ *)0, "Scroll forward in this window staying within node and set default window size" }, + { info_scroll_backward, "scroll-backward", (FUNCTION_KEYSEQ *)0, "Scroll backward in this window" }, + { info_scroll_backward_set_window, "scroll-backward-set-window", (FUNCTION_KEYSEQ *)0, "Scroll backward in this window and set default window size" }, + { info_scroll_backward_page_only, "scroll-backward-page-only", (FUNCTION_KEYSEQ *)0, "Scroll backward in this window staying within node" }, + { info_scroll_backward_page_only_set_window, "scroll-backward-page-only-set-window", (FUNCTION_KEYSEQ *)0, "Scroll backward in this window staying within node and set default window size" }, + { info_beginning_of_node, "beginning-of-node", (FUNCTION_KEYSEQ *)0, "Move to the start of this node" }, + { info_end_of_node, "end-of-node", (FUNCTION_KEYSEQ *)0, "Move to the end of this node" }, + { info_down_line, "down-line", (FUNCTION_KEYSEQ *)0, "Scroll down by lines" }, + { info_up_line, "up-line", (FUNCTION_KEYSEQ *)0, "Scroll up by lines" }, + { info_scroll_half_screen_down, "scroll-half-screen-down", (FUNCTION_KEYSEQ *)0, "Scroll down by half screen size" }, + { info_scroll_half_screen_up, "scroll-half-screen-up", (FUNCTION_KEYSEQ *)0, "Scroll up by half screen size" }, + { info_next_window, "next-window", (FUNCTION_KEYSEQ *)0, "Select the next window" }, + { info_prev_window, "prev-window", (FUNCTION_KEYSEQ *)0, "Select the previous window" }, + { info_split_window, "split-window", (FUNCTION_KEYSEQ *)0, "Split the current window" }, + { info_delete_window, "delete-window", (FUNCTION_KEYSEQ *)0, "Delete the current window" }, + { info_keep_one_window, "keep-one-window", (FUNCTION_KEYSEQ *)0, "Delete all other windows" }, + { info_scroll_other_window, "scroll-other-window", (FUNCTION_KEYSEQ *)0, "Scroll the other window" }, + { info_scroll_other_window_backward, "scroll-other-window-backward", (FUNCTION_KEYSEQ *)0, "Scroll the other window backward" }, + { info_grow_window, "grow-window", (FUNCTION_KEYSEQ *)0, "Grow (or shrink) this window" }, + { info_tile_windows, "tile-windows", (FUNCTION_KEYSEQ *)0, "Divide the available screen space among the visible windows" }, + { info_toggle_wrap, "toggle-wrap", (FUNCTION_KEYSEQ *)0, "Toggle the state of line wrapping in the current window" }, + { info_next_node, "next-node", (FUNCTION_KEYSEQ *)0, "Select the Next node" }, + { info_prev_node, "prev-node", (FUNCTION_KEYSEQ *)0, "Select the Prev node" }, + { info_up_node, "up-node", (FUNCTION_KEYSEQ *)0, "Select the Up node" }, + { info_last_node, "last-node", (FUNCTION_KEYSEQ *)0, "Select the last node in this file" }, + { info_first_node, "first-node", (FUNCTION_KEYSEQ *)0, "Select the first node in this file" }, + { info_last_menu_item, "last-menu-item", (FUNCTION_KEYSEQ *)0, "Select the last item in this node's menu" }, + { info_menu_digit, "menu-digit", (FUNCTION_KEYSEQ *)0, "Select this menu item" }, + { info_menu_item, "menu-item", (FUNCTION_KEYSEQ *)0, "Read a menu item and select its node" }, + { info_xref_item, "xref-item", (FUNCTION_KEYSEQ *)0, "Read a footnote or cross reference and select its node" }, + { info_find_menu, "find-menu", (FUNCTION_KEYSEQ *)0, "Move to the start of this node's menu" }, + { info_visit_menu, "visit-menu", (FUNCTION_KEYSEQ *)0, "Visit as many menu items at once as possible" }, + { info_goto_node, "goto-node", (FUNCTION_KEYSEQ *)0, "Read a node name and select it" }, + { info_menu_sequence, "menu-sequence", (FUNCTION_KEYSEQ *)0, "Read a list of menus starting from dir and follow them" }, + { info_goto_invocation_node, "goto-invocation-node", (FUNCTION_KEYSEQ *)0, "Find the node describing program invocation" }, + { info_man, "man", (FUNCTION_KEYSEQ *)0, "Read a manpage reference and select it" }, + { info_top_node, "top-node", (FUNCTION_KEYSEQ *)0, "Select the node `Top' in this file" }, + { info_dir_node, "dir-node", (FUNCTION_KEYSEQ *)0, "Select the node `(dir)'" }, + { info_history_node, "history-node", (FUNCTION_KEYSEQ *)0, "Select the most recently selected node" }, + { info_kill_node, "kill-node", (FUNCTION_KEYSEQ *)0, "Kill this node" }, + { info_view_file, "view-file", (FUNCTION_KEYSEQ *)0, "Read the name of a file and select it" }, + { info_print_node, "print-node", (FUNCTION_KEYSEQ *)0, "Pipe the contents of this node through INFO_PRINT_COMMAND" }, + { info_search_case_sensitively, "search-case-sensitively", (FUNCTION_KEYSEQ *)0, "Read a string and search for it case-sensitively" }, + { info_search, "search", (FUNCTION_KEYSEQ *)0, "Read a string and search for it" }, + { info_search_backward, "search-backward", (FUNCTION_KEYSEQ *)0, "Read a string and search backward for it" }, + { info_search_next, "search-next", (FUNCTION_KEYSEQ *)0, "Repeat last search in the same direction" }, + { info_search_previous, "search-previous", (FUNCTION_KEYSEQ *)0, "Repeat last search in the reverse direction" }, + { isearch_forward, "isearch-forward", (FUNCTION_KEYSEQ *)0, "Search interactively for a string as you type it" }, + { isearch_backward, "isearch-backward", (FUNCTION_KEYSEQ *)0, "Search interactively for a string as you type it" }, + { info_move_to_prev_xref, "move-to-prev-xref", (FUNCTION_KEYSEQ *)0, "Move to the previous cross reference" }, + { info_move_to_next_xref, "move-to-next-xref", (FUNCTION_KEYSEQ *)0, "Move to the next cross reference" }, + { info_select_reference_this_line, "select-reference-this-line", (FUNCTION_KEYSEQ *)0, "Select reference or menu item appearing on this line" }, + { info_abort_key, "abort-key", (FUNCTION_KEYSEQ *)0, "Cancel current operation" }, + { info_move_to_window_line, "move-to-window-line", (FUNCTION_KEYSEQ *)0, "Move the cursor to a specific line of the window" }, + { info_redraw_display, "redraw-display", (FUNCTION_KEYSEQ *)0, "Redraw the display" }, + { info_quit, "quit", (FUNCTION_KEYSEQ *)0, "Quit using Info" }, + { info_do_lowercase_version, "do-lowercase-version", (FUNCTION_KEYSEQ *)0, "Run command bound to this key's lowercase variant" }, + { info_add_digit_to_numeric_arg, "add-digit-to-numeric-arg", (FUNCTION_KEYSEQ *)0, "Add this digit to the current numeric argument" }, + { info_universal_argument, "universal-argument", (FUNCTION_KEYSEQ *)0, "Start (or multiply by 4) the current numeric argument" }, + { info_numeric_arg_digit_loop, "numeric-arg-digit-loop", (FUNCTION_KEYSEQ *)0, "Internally used by \\[universal-argument]" }, /* Commands found in "./echo-area.c". */ - { ea_forward, "echo-area-forward", "Move forward a character" }, - { ea_backward, "echo-area-backward", "Move backward a character" }, - { ea_beg_of_line, "echo-area-beg-of-line", "Move to the start of this line" }, - { ea_end_of_line, "echo-area-end-of-line", "Move to the end of this line" }, - { ea_forward_word, "echo-area-forward-word", "Move forward a word" }, - { ea_backward_word, "echo-area-backward-word", "Move backward a word" }, - { ea_delete, "echo-area-delete", "Delete the character under the cursor" }, - { ea_rubout, "echo-area-rubout", "Delete the character behind the cursor" }, - { ea_abort, "echo-area-abort", "Cancel or quit operation" }, - { ea_newline, "echo-area-newline", "Accept (or force completion of) this line" }, - { ea_quoted_insert, "echo-area-quoted-insert", "Insert next character verbatim" }, - { ea_insert, "echo-area-insert", "Insert this character" }, - { ea_tab_insert, "echo-area-tab-insert", "Insert a TAB character" }, - { ea_transpose_chars, "echo-area-transpose-chars", "Transpose characters at point" }, - { ea_yank, "echo-area-yank", "Yank back the contents of the last kill" }, - { ea_yank_pop, "echo-area-yank-pop", "Yank back a previous kill" }, - { ea_kill_line, "echo-area-kill-line", "Kill to the end of the line" }, - { ea_backward_kill_line, "echo-area-backward-kill-line", "Kill to the beginning of the line" }, - { ea_kill_word, "echo-area-kill-word", "Kill the word following the cursor" }, - { ea_backward_kill_word, "echo-area-backward-kill-word", "Kill the word preceding the cursor" }, - { ea_possible_completions, "echo-area-possible-completions", "List possible completions" }, - { ea_complete, "echo-area-complete", "Insert completion" }, - { ea_scroll_completions_window, "echo-area-scroll-completions-window", "Scroll the completions window" }, + { ea_forward, "echo-area-forward", (FUNCTION_KEYSEQ *)0, "Move forward a character" }, + { ea_backward, "echo-area-backward", (FUNCTION_KEYSEQ *)0, "Move backward a character" }, + { ea_beg_of_line, "echo-area-beg-of-line", (FUNCTION_KEYSEQ *)0, "Move to the start of this line" }, + { ea_end_of_line, "echo-area-end-of-line", (FUNCTION_KEYSEQ *)0, "Move to the end of this line" }, + { ea_forward_word, "echo-area-forward-word", (FUNCTION_KEYSEQ *)0, "Move forward a word" }, + { ea_backward_word, "echo-area-backward-word", (FUNCTION_KEYSEQ *)0, "Move backward a word" }, + { ea_delete, "echo-area-delete", (FUNCTION_KEYSEQ *)0, "Delete the character under the cursor" }, + { ea_rubout, "echo-area-rubout", (FUNCTION_KEYSEQ *)0, "Delete the character behind the cursor" }, + { ea_abort, "echo-area-abort", (FUNCTION_KEYSEQ *)0, "Cancel or quit operation" }, + { ea_newline, "echo-area-newline", (FUNCTION_KEYSEQ *)0, "Accept (or force completion of) this line" }, + { ea_quoted_insert, "echo-area-quoted-insert", (FUNCTION_KEYSEQ *)0, "Insert next character verbatim" }, + { ea_insert, "echo-area-insert", (FUNCTION_KEYSEQ *)0, "Insert this character" }, + { ea_tab_insert, "echo-area-tab-insert", (FUNCTION_KEYSEQ *)0, "Insert a TAB character" }, + { ea_transpose_chars, "echo-area-transpose-chars", (FUNCTION_KEYSEQ *)0, "Transpose characters at point" }, + { ea_yank, "echo-area-yank", (FUNCTION_KEYSEQ *)0, "Yank back the contents of the last kill" }, + { ea_yank_pop, "echo-area-yank-pop", (FUNCTION_KEYSEQ *)0, "Yank back a previous kill" }, + { ea_kill_line, "echo-area-kill-line", (FUNCTION_KEYSEQ *)0, "Kill to the end of the line" }, + { ea_backward_kill_line, "echo-area-backward-kill-line", (FUNCTION_KEYSEQ *)0, "Kill to the beginning of the line" }, + { ea_kill_word, "echo-area-kill-word", (FUNCTION_KEYSEQ *)0, "Kill the word following the cursor" }, + { ea_backward_kill_word, "echo-area-backward-kill-word", (FUNCTION_KEYSEQ *)0, "Kill the word preceding the cursor" }, + { ea_possible_completions, "echo-area-possible-completions", (FUNCTION_KEYSEQ *)0, "List possible completions" }, + { ea_complete, "echo-area-complete", (FUNCTION_KEYSEQ *)0, "Insert completion" }, + { ea_scroll_completions_window, "echo-area-scroll-completions-window", (FUNCTION_KEYSEQ *)0, "Scroll the completions window" }, /* Commands found in "./infodoc.c". */ - { info_get_help_window, "get-help-window", "Display help message" }, - { info_get_info_help_node, "get-info-help-node", "Visit Info node `(info)Help'" }, - { describe_key, "describe-key", "Print documentation for KEY" }, - { info_where_is, "where-is", "Show what to type to execute a given command" }, + { info_get_help_window, "get-help-window", (FUNCTION_KEYSEQ *)0, "Display help message" }, + { info_get_info_help_node, "get-info-help-node", (FUNCTION_KEYSEQ *)0, "Visit Info node `(info)Help'" }, + { describe_key, "describe-key", (FUNCTION_KEYSEQ *)0, "Print documentation for KEY" }, + { info_where_is, "where-is", (FUNCTION_KEYSEQ *)0, "Show what to type to execute a given command" }, /* Commands found in "./m-x.c". */ - { describe_command, "describe-command", "Read the name of an Info command and describe it" }, - { info_execute_command, "execute-command", "Read a command name in the echo area and execute it" }, - { set_screen_height, "set-screen-height", "Set the height of the displayed window" }, + { describe_command, "describe-command", (FUNCTION_KEYSEQ *)0, "Read the name of an Info command and describe it" }, + { info_execute_command, "execute-command", (FUNCTION_KEYSEQ *)0, "Read a command name in the echo area and execute it" }, + { set_screen_height, "set-screen-height", (FUNCTION_KEYSEQ *)0, "Set the height of the displayed window" }, /* Commands found in "./indices.c". */ - { info_index_search, "index-search", "Look up a string in the index for this file" }, - { info_next_index_match, "next-index-match", "Go to the next matching index item from the last `\\[index-search]' command" }, - { info_index_apropos, "index-apropos", "Grovel all known info file's indices for a string and build a menu" }, + { info_index_search, "index-search", (FUNCTION_KEYSEQ *)0, "Look up a string in the index for this file" }, + { info_next_index_match, "next-index-match", (FUNCTION_KEYSEQ *)0, "Go to the next matching index item from the last `\\[index-search]' command" }, + { info_index_apropos, "index-apropos", (FUNCTION_KEYSEQ *)0, "Grovel all known info file's indices for a string and build a menu" }, /* Commands found in "./nodemenu.c". */ - { list_visited_nodes, "list-visited-nodes", "Make a window containing a menu of all of the currently visited nodes" }, - { select_visited_node, "select-visited-node", "Select a node which has been previously visited in a visible window" }, + { list_visited_nodes, "list-visited-nodes", (FUNCTION_KEYSEQ *)0, "Make a window containing a menu of all of the currently visited nodes" }, + { select_visited_node, "select-visited-node", (FUNCTION_KEYSEQ *)0, "Select a node which has been previously visited in a visible window" }, /* Commands found in "./footnotes.c". */ - { info_show_footnotes, "show-footnotes", "Show the footnotes associated with this node in another window" }, + { info_show_footnotes, "show-footnotes", (FUNCTION_KEYSEQ *)0, "Show the footnotes associated with this node in another window" }, /* Commands found in "./variables.c". */ - { describe_variable, "describe-variable", "Explain the use of a variable" }, - { set_variable, "set-variable", "Set the value of an Info variable" }, - { (VFunction *)NULL, (char *)NULL, (char *)NULL } + { describe_variable, "describe-variable", (FUNCTION_KEYSEQ *)0, "Explain the use of a variable" }, + { set_variable, "set-variable", (FUNCTION_KEYSEQ *)0, "Set the value of an Info variable" }, + { (VFunction *)NULL, (char *)NULL, (FUNCTION_KEYSEQ *)NULL, (char *)NULL } }; diff --git a/contrib/texinfo/info/funs.h b/contrib/texinfo/info/funs.h index f5c4d33d14cb..0d3647a9d758 100644 --- a/contrib/texinfo/info/funs.h +++ b/contrib/texinfo/info/funs.h @@ -1,124 +1,242 @@ +/* $FreeBSD$ */ /* funs.h -- Generated declarations for Info commands. */ /* Functions declared in "./session.c". */ +#define A_info_next_line 0 extern void info_next_line (); +#define A_info_prev_line 1 extern void info_prev_line (); +#define A_info_end_of_line 2 extern void info_end_of_line (); +#define A_info_beginning_of_line 3 extern void info_beginning_of_line (); +#define A_info_forward_char 4 extern void info_forward_char (); +#define A_info_backward_char 5 extern void info_backward_char (); +#define A_info_forward_word 6 extern void info_forward_word (); +#define A_info_backward_word 7 extern void info_backward_word (); +#define A_info_global_next_node 8 extern void info_global_next_node (); +#define A_info_global_prev_node 9 extern void info_global_prev_node (); +#define A_info_scroll_forward 10 extern void info_scroll_forward (); +#define A_info_scroll_forward_set_window 11 extern void info_scroll_forward_set_window (); +#define A_info_scroll_forward_page_only 12 +extern void info_scroll_forward_page_only (); +#define A_info_scroll_forward_page_only_set_window 13 +extern void info_scroll_forward_page_only_set_window (); +#define A_info_scroll_backward 14 extern void info_scroll_backward (); +#define A_info_scroll_backward_set_window 15 extern void info_scroll_backward_set_window (); +#define A_info_scroll_backward_page_only 16 +extern void info_scroll_backward_page_only (); +#define A_info_scroll_backward_page_only_set_window 17 +extern void info_scroll_backward_page_only_set_window (); +#define A_info_beginning_of_node 18 extern void info_beginning_of_node (); +#define A_info_end_of_node 19 extern void info_end_of_node (); +#define A_info_down_line 20 extern void info_down_line (); +#define A_info_up_line 21 extern void info_up_line (); +#define A_info_scroll_half_screen_down 22 extern void info_scroll_half_screen_down (); +#define A_info_scroll_half_screen_up 23 extern void info_scroll_half_screen_up (); +#define A_info_next_window 24 extern void info_next_window (); +#define A_info_prev_window 25 extern void info_prev_window (); +#define A_info_split_window 26 extern void info_split_window (); +#define A_info_delete_window 27 extern void info_delete_window (); +#define A_info_keep_one_window 28 extern void info_keep_one_window (); +#define A_info_scroll_other_window 29 extern void info_scroll_other_window (); +#define A_info_scroll_other_window_backward 30 extern void info_scroll_other_window_backward (); +#define A_info_grow_window 31 extern void info_grow_window (); +#define A_info_tile_windows 32 extern void info_tile_windows (); +#define A_info_toggle_wrap 33 extern void info_toggle_wrap (); +#define A_info_next_node 34 extern void info_next_node (); +#define A_info_prev_node 35 extern void info_prev_node (); +#define A_info_up_node 36 extern void info_up_node (); +#define A_info_last_node 37 extern void info_last_node (); +#define A_info_first_node 38 extern void info_first_node (); +#define A_info_last_menu_item 39 extern void info_last_menu_item (); +#define A_info_menu_digit 40 extern void info_menu_digit (); +#define A_info_menu_item 41 extern void info_menu_item (); +#define A_info_xref_item 42 extern void info_xref_item (); +#define A_info_find_menu 43 extern void info_find_menu (); +#define A_info_visit_menu 44 extern void info_visit_menu (); +#define A_info_goto_node 45 extern void info_goto_node (); +#define A_info_menu_sequence 46 extern void info_menu_sequence (); +#define A_info_goto_invocation_node 47 extern void info_goto_invocation_node (); +#define A_info_man 48 extern void info_man (); +#define A_info_top_node 49 extern void info_top_node (); +#define A_info_dir_node 50 extern void info_dir_node (); +#define A_info_history_node 51 extern void info_history_node (); +#define A_info_kill_node 52 extern void info_kill_node (); +#define A_info_view_file 53 extern void info_view_file (); +#define A_info_print_node 54 extern void info_print_node (); +#define A_info_search_case_sensitively 55 extern void info_search_case_sensitively (); +#define A_info_search 56 extern void info_search (); +#define A_info_search_backward 57 extern void info_search_backward (); +#define A_info_search_next 58 extern void info_search_next (); +#define A_info_search_previous 59 extern void info_search_previous (); +#define A_isearch_forward 60 extern void isearch_forward (); +#define A_isearch_backward 61 extern void isearch_backward (); +#define A_info_move_to_prev_xref 62 extern void info_move_to_prev_xref (); +#define A_info_move_to_next_xref 63 extern void info_move_to_next_xref (); +#define A_info_select_reference_this_line 64 extern void info_select_reference_this_line (); +#define A_info_abort_key 65 extern void info_abort_key (); +#define A_info_move_to_window_line 66 extern void info_move_to_window_line (); +#define A_info_redraw_display 67 extern void info_redraw_display (); +#define A_info_quit 68 extern void info_quit (); +#define A_info_do_lowercase_version 69 extern void info_do_lowercase_version (); +#define A_info_add_digit_to_numeric_arg 70 extern void info_add_digit_to_numeric_arg (); +#define A_info_universal_argument 71 extern void info_universal_argument (); +#define A_info_numeric_arg_digit_loop 72 extern void info_numeric_arg_digit_loop (); /* Functions declared in "./echo-area.c". */ +#define A_ea_forward 73 extern void ea_forward (); +#define A_ea_backward 74 extern void ea_backward (); +#define A_ea_beg_of_line 75 extern void ea_beg_of_line (); +#define A_ea_end_of_line 76 extern void ea_end_of_line (); +#define A_ea_forward_word 77 extern void ea_forward_word (); +#define A_ea_backward_word 78 extern void ea_backward_word (); +#define A_ea_delete 79 extern void ea_delete (); +#define A_ea_rubout 80 extern void ea_rubout (); +#define A_ea_abort 81 extern void ea_abort (); +#define A_ea_newline 82 extern void ea_newline (); +#define A_ea_quoted_insert 83 extern void ea_quoted_insert (); +#define A_ea_insert 84 extern void ea_insert (); +#define A_ea_tab_insert 85 extern void ea_tab_insert (); +#define A_ea_transpose_chars 86 extern void ea_transpose_chars (); +#define A_ea_yank 87 extern void ea_yank (); +#define A_ea_yank_pop 88 extern void ea_yank_pop (); +#define A_ea_kill_line 89 extern void ea_kill_line (); +#define A_ea_backward_kill_line 90 extern void ea_backward_kill_line (); +#define A_ea_kill_word 91 extern void ea_kill_word (); +#define A_ea_backward_kill_word 92 extern void ea_backward_kill_word (); +#define A_ea_possible_completions 93 extern void ea_possible_completions (); +#define A_ea_complete 94 extern void ea_complete (); +#define A_ea_scroll_completions_window 95 extern void ea_scroll_completions_window (); /* Functions declared in "./infodoc.c". */ +#define A_info_get_help_window 96 extern void info_get_help_window (); +#define A_info_get_info_help_node 97 extern void info_get_info_help_node (); +#define A_describe_key 98 extern void describe_key (); +#define A_info_where_is 99 extern void info_where_is (); /* Functions declared in "./m-x.c". */ +#define A_describe_command 100 extern void describe_command (); +#define A_info_execute_command 101 extern void info_execute_command (); +#define A_set_screen_height 102 extern void set_screen_height (); /* Functions declared in "./indices.c". */ +#define A_info_index_search 103 extern void info_index_search (); +#define A_info_next_index_match 104 extern void info_next_index_match (); +#define A_info_index_apropos 105 extern void info_index_apropos (); /* Functions declared in "./nodemenu.c". */ +#define A_list_visited_nodes 106 extern void list_visited_nodes (); +#define A_select_visited_node 107 extern void select_visited_node (); /* Functions declared in "./footnotes.c". */ +#define A_info_show_footnotes 108 extern void info_show_footnotes (); /* Functions declared in "./variables.c". */ +#define A_describe_variable 109 extern void describe_variable (); +#define A_set_variable 110 extern void set_variable (); + +#define A_NCOMMANDS 111 diff --git a/contrib/texinfo/info/infomap.c b/contrib/texinfo/info/infomap.c index 932435e8d845..a89bd1c7aa95 100644 --- a/contrib/texinfo/info/infomap.c +++ b/contrib/texinfo/info/infomap.c @@ -1,7 +1,8 @@ -/* infomap.c -- Keymaps for Info. - $Id: infomap.c,v 1.20 1999/06/25 21:57:40 karl Exp $ +/* $FreeBSD$ */ +/* infomap.c -- keymaps for Info. + $Id: infomap.c,v 1.28 2002/02/08 23:02:53 karl Exp $ - Copyright (C) 1993, 97, 98, 99 Free Software Foundation, Inc. + Copyright (C) 1993, 97, 98, 99, 2001, 02 Free Software Foundation, Inc. This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by @@ -24,12 +25,17 @@ #include "funs.h" #include "terminal.h" +#if defined(INFOKEY) +#include "infokey.h" +#include "variables.h" +#endif /* INFOKEY */ + /* Return a new keymap which has all the uppercase letters mapped to run the function info_do_lowercase_version (). */ Keymap keymap_make_keymap () { - register int i; + int i; Keymap keymap; keymap = (Keymap)xmalloc (256 * sizeof (KEYMAP_ENTRY)); @@ -37,13 +43,17 @@ keymap_make_keymap () for (i = 0; i < 256; i++) { keymap[i].type = ISFUNC; - keymap[i].function = (VFunction *)NULL; + keymap[i].function = (InfoCommand *)NULL; } for (i = 'A'; i < ('Z' + 1); i++) { keymap[i].type = ISFUNC; - keymap[i].function = info_do_lowercase_version; +#if defined(INFOKEY) + keymap[Meta(i)].type = ISFUNC; + keymap[Meta(i)].function = +#endif /* INFOKEY */ + keymap[i].function = InfoCmd(info_do_lowercase_version); } return (keymap); @@ -54,7 +64,7 @@ Keymap keymap_copy_keymap (map) Keymap map; { - register int i; + int i; Keymap keymap; keymap = keymap_make_keymap (); @@ -72,7 +82,7 @@ void keymap_discard_keymap (map) Keymap (map); { - register int i; + int i; if (!map) return; @@ -99,9 +109,9 @@ keymap_bind_keyseq (map, keyseq, keyentry) const unsigned char *keyseq; KEYMAP_ENTRY *keyentry; { - register Keymap m = map; - register const unsigned char *s = keyseq; - register int c; + Keymap m = map; + const unsigned char *s = keyseq; + int c; if (s == NULL || *s == '\0') return 0; @@ -110,14 +120,18 @@ keymap_bind_keyseq (map, keyseq, keyentry) switch (m[c].type) { case ISFUNC: - if (!(m[c].function == NULL || - (m != map && m[c].function == info_do_lowercase_version))) + if (!(m[c].function == NULL || ( +#if !defined(INFOKEY) + m != map && +#endif /* !INFOKEY */ + m[c].function == InfoCmd(info_do_lowercase_version)) + )) return 0; if (*s != '\0') { m[c].type = ISKMAP; - m[c].function = (VFunction *)keymap_make_keymap (); + m[c].function = (InfoCommand *)keymap_make_keymap (); } break; @@ -132,6 +146,20 @@ keymap_bind_keyseq (map, keyseq, keyentry) } else { +#if defined(INFOKEY) + FUNCTION_KEYSEQ *k; + + for (k = keyentry->function->keys; k && k->map != map; k = k->next) + ; + if (!k) + { + FUNCTION_KEYSEQ *ks = (FUNCTION_KEYSEQ *)xmalloc (sizeof(FUNCTION_KEYSEQ)); + ks->next = keyentry->function->keys; + ks->map = map; + ks->keyseq = xstrdup (keyseq); + keyentry->function->keys = ks; + } +#endif /* INFOKEY */ m[c] = *keyentry; } } @@ -144,6 +172,8 @@ keymap_bind_keyseq (map, keyseq, keyentry) Keymap info_keymap = NULL; Keymap echo_area_keymap = NULL; +#if !defined(INFOKEY) + static void initialize_emacs_like_keymaps () { @@ -157,9 +187,9 @@ initialize_emacs_like_keymaps () } info_keymap[ESC].type = ISKMAP; - info_keymap[ESC].function = (VFunction *)keymap_make_keymap (); + info_keymap[ESC].function = (InfoCommand *)keymap_make_keymap (); info_keymap[Control ('x')].type = ISKMAP; - info_keymap[Control ('x')].function = (VFunction *)keymap_make_keymap (); + info_keymap[Control ('x')].function = (InfoCommand *)keymap_make_keymap (); /* Bind the echo area insert routines. Let's make all characters insertable by default, regardless of which character set we might @@ -168,10 +198,10 @@ initialize_emacs_like_keymaps () echo_area_keymap[i].function = ea_insert; echo_area_keymap[ESC].type = ISKMAP; - echo_area_keymap[ESC].function = (VFunction *) keymap_make_keymap (); + echo_area_keymap[ESC].function = (InfoCommand *) keymap_make_keymap (); echo_area_keymap[Control ('x')].type = ISKMAP; echo_area_keymap[Control ('x')].function - = (VFunction *) keymap_make_keymap (); + = (InfoCommand *) keymap_make_keymap (); /* Bind numeric arg functions for both echo area and info window maps. */ for (i = '0'; i < '9' + 1; i++) @@ -253,6 +283,9 @@ initialize_emacs_like_keymaps () keymap_bind_keyseq (map, term_kl, &map[Control ('b')]); /* left */ keymap_bind_keyseq (map, "\033OD", &map[Control ('b')]); keymap_bind_keyseq (map, "\033[D", &map[Control ('b')]); + keymap_bind_keyseq (map, term_kD, &map[DEL]); /* delete */ + keymap_bind_keyseq (map, term_kh, &map[Control ('a')]); /* home */ + keymap_bind_keyseq (map, term_ke, &map[Control ('e')]); /* end */ map = (Keymap)echo_area_keymap[ESC].function; keymap_bind_keyseq (map, term_kl, &map['b']); /* left */ @@ -261,6 +294,10 @@ initialize_emacs_like_keymaps () keymap_bind_keyseq (map, term_kr, &map['f']); /* right */ keymap_bind_keyseq (map, "\033OB", &map['f']); keymap_bind_keyseq (map, "\033[B", &map['f']); + keymap_bind_keyseq (map, term_kD, &map[DEL]); /* delete */ + + map = (Keymap)echo_area_keymap[Control ('x')].function; + keymap_bind_keyseq (map, term_kD, &map[DEL]); /* delete */ /* Bind commands for Info window keymaps. */ map = info_keymap; @@ -280,7 +317,7 @@ initialize_emacs_like_keymaps () map[Control ('r')].function = isearch_backward; map[Control ('s')].function = isearch_forward; map[Control ('u')].function = info_universal_argument; - map[Control ('v')].function = info_scroll_forward; + map[Control ('v')].function = info_scroll_forward_page_only; map[','].function = info_next_index_match; map['/'].function = info_search; @@ -327,7 +364,7 @@ initialize_emacs_like_keymaps () map['b'].function = info_backward_word; map['f'].function = info_forward_word; map['r'].function = info_move_to_window_line; - map['v'].function = info_scroll_backward; + map['v'].function = info_scroll_backward_page_only; #if defined (NAMED_FUNCTIONS) map['x'].function = info_execute_command; #endif /* NAMED_FUNCTIONS */ @@ -368,6 +405,9 @@ initialize_emacs_like_keymaps () keymap_bind_keyseq (map, term_kl, &map[Control ('b')]); /* left */ keymap_bind_keyseq (map, "\033OD", &map[Control ('b')]); keymap_bind_keyseq (map, "\033[D", &map[Control ('b')]); + keymap_bind_keyseq (map, term_kh, &map['b']); /* home */ + keymap_bind_keyseq (map, term_ke, &map['e']); /* end */ + keymap_bind_keyseq (map, term_kD, &map[DEL]); /* delete */ map = (Keymap)info_keymap[ESC].function; keymap_bind_keyseq (map, term_kl, &map['b']); /* left */ @@ -378,6 +418,7 @@ initialize_emacs_like_keymaps () keymap_bind_keyseq (map, "\033[B", &map['f']); keymap_bind_keyseq (map, term_kN, &map[Control ('v')]); /* pagedown */ keymap_bind_keyseq (map, term_kP, &map[DEL]); /* pageup */ + keymap_bind_keyseq (map, term_kD, &map[DEL]); /* delete */ /* The alternative to this definition of a `main map' key in the `ESC map' section, is something like: @@ -389,7 +430,7 @@ initialize_emacs_like_keymaps () static void initialize_vi_like_keymaps () { - register int i; + int i; Keymap map; if (!info_keymap) @@ -399,19 +440,19 @@ initialize_vi_like_keymaps () } info_keymap[ESC].type = ISKMAP; - info_keymap[ESC].function = (VFunction *)keymap_make_keymap (); + info_keymap[ESC].function = (InfoCommand *)keymap_make_keymap (); info_keymap[Control ('x')].type = ISKMAP; - info_keymap[Control ('x')].function = (VFunction *)keymap_make_keymap (); + info_keymap[Control ('x')].function = (InfoCommand *)keymap_make_keymap (); /* Bind the echo area insert routines. */ for (i = 0; i < 256; i++) echo_area_keymap[i].function = ea_insert; echo_area_keymap[ESC].type = ISKMAP; - echo_area_keymap[ESC].function = (VFunction *)keymap_make_keymap (); + echo_area_keymap[ESC].function = (InfoCommand *)keymap_make_keymap (); echo_area_keymap[Control ('x')].type = ISKMAP; echo_area_keymap[Control ('x')].function = - (VFunction *)keymap_make_keymap (); + (InfoCommand *)keymap_make_keymap (); /* Bind numeric arg functions for both echo area and info window maps. */ for (i = '0'; i < '9' + 1; i++) @@ -497,6 +538,9 @@ initialize_vi_like_keymaps () keymap_bind_keyseq (map, term_kl, &map[Control ('b')]); /* left */ keymap_bind_keyseq (map, "\033OD", &map[Control ('b')]); keymap_bind_keyseq (map, "\033[D", &map[Control ('b')]); + keymap_bind_keyseq (map, term_kh, &map[Control ('a')]); /* home */ + keymap_bind_keyseq (map, term_ke, &map[Control ('e')]); /* end */ + keymap_bind_keyseq (map, term_kD, &map[DEL]); /* delete */ map = (Keymap)echo_area_keymap[ESC].function; keymap_bind_keyseq (map, term_kl, &map['b']); /* left */ @@ -505,6 +549,10 @@ initialize_vi_like_keymaps () keymap_bind_keyseq (map, term_kr, &map['f']); /* right */ keymap_bind_keyseq (map, "\033OB", &map['f']); keymap_bind_keyseq (map, "\033[B", &map['f']); + keymap_bind_keyseq (map, term_kD, &map[DEL]); /* delete */ + + map = (Keymap)echo_area_keymap[Control ('x')].function; + keymap_bind_keyseq (map, term_kD, &map[DEL]); /* Bind commands for Info window keymaps. */ map = info_keymap; @@ -513,10 +561,10 @@ initialize_vi_like_keymaps () map[RET].function = info_down_line; map[SPC].function = info_scroll_forward; map[Control ('a')].function = info_beginning_of_line; - map[Control ('b')].function = info_scroll_backward; + map[Control ('b')].function = info_scroll_backward_page_only; map[Control ('d')].function = info_scroll_half_screen_down; map[Control ('e')].function = info_down_line; - map[Control ('f')].function = info_scroll_forward; + map[Control ('f')].function = info_scroll_forward_page_only; map[Control ('g')].function = info_abort_key; map[Control ('k')].function = info_up_line; map[Control ('l')].function = info_redraw_display; @@ -525,7 +573,7 @@ initialize_vi_like_keymaps () map[Control ('r')].function = info_redraw_display; map[Control ('s')].function = isearch_forward; map[Control ('u')].function = info_scroll_half_screen_up; - map[Control ('v')].function = info_scroll_forward; + map[Control ('v')].function = info_scroll_forward_page_only; map[Control ('y')].function = info_up_line; map[','].function = info_next_index_match; map['/'].function = info_search; @@ -545,8 +593,8 @@ initialize_vi_like_keymaps () map['d'].function = info_scroll_half_screen_down; map['e'].function = info_down_line; map['E'].function = info_view_file; - map['f'].function = info_scroll_forward; - map['F'].function = info_scroll_forward; + map['f'].function = info_scroll_forward_page_only; + map['F'].function = info_scroll_forward_page_only; map['g'].function = info_first_node; map['G'].function = info_last_node; map['h'].function = info_get_help_window; @@ -569,11 +617,12 @@ initialize_vi_like_keymaps () map['S'].function = info_search_case_sensitively; map['t'].function = info_top_node; map['u'].function = info_scroll_half_screen_up; - map['w'].function = info_scroll_backward_set_window; + map['w'].function = info_scroll_backward_page_only_set_window; map['y'].function = info_up_line; - map['z'].function = info_scroll_forward_set_window; + map['z'].function = info_scroll_forward_page_only_set_window; map['Z'].function = NULL; /* unbind, so it works to bind "ZZ" below */ map[DEL].function = info_scroll_backward; + keymap_bind_keyseq (map, term_kD, &map[DEL]); keymap_bind_keyseq (map, ":q", &map['q']); keymap_bind_keyseq (map, ":Q", &map['q']); keymap_bind_keyseq (map, "ZZ", &map['q']); @@ -583,7 +632,7 @@ initialize_vi_like_keymaps () map[Control ('f')].function = info_show_footnotes; map[Control ('g')].function = info_abort_key; map[TAB].function = info_move_to_prev_xref; - map[SPC].function = info_scroll_forward; + map[SPC].function = info_scroll_forward_page_only; map[Control ('v')].function = info_scroll_other_window; map['<'].function = info_beginning_of_node; map['>'].function = info_end_of_node; @@ -601,7 +650,7 @@ initialize_vi_like_keymaps () map['r'].function = isearch_backward; map['s'].function = isearch_forward; map['t'].function = info_top_node; - map['v'].function = info_scroll_backward; + map['v'].function = info_scroll_backward_page_only; #if defined (NAMED_FUNCTIONS) map['x'].function = info_execute_command; #endif /* NAMED_FUNCTIONS */ @@ -652,6 +701,8 @@ initialize_vi_like_keymaps () keymap_bind_keyseq (map, term_kl, &map[Control ('b')]); /* left */ keymap_bind_keyseq (map, "\033OD", &map[Control ('b')]); keymap_bind_keyseq (map, "\033[D", &map[Control ('b')]); + keymap_bind_keyseq (map, term_kh, &map['b']); /* home */ + keymap_bind_keyseq (map, term_ke, &map['e']); /* end */ map = (Keymap)info_keymap[ESC].function; keymap_bind_keyseq (map, term_kl, &map['b']); /* left */ @@ -662,6 +713,7 @@ initialize_vi_like_keymaps () keymap_bind_keyseq (map, "\033[B", &map['f']); keymap_bind_keyseq (map, term_kN, &map[Control ('v')]); /* pagedown */ keymap_bind_keyseq (map, term_kP, &map[DEL]); /* pageup */ + keymap_bind_keyseq (map, term_kD, &map[DEL]); /* delete */ /* The alternative to this definition of a `main map' key in the `ESC map' section, is something like: @@ -679,3 +731,994 @@ initialize_info_keymaps () initialize_emacs_like_keymaps (); } +#else /* defined(INFOKEY) */ + +/* Make sure that we don't have too many command codes defined. */ + +#if A_NCOMMANDS > A_MAX_COMMAND + 1 +#error "too many commands defined" +#endif + +/* Initialize the keymaps from the .info keymap file. */ + +#define NUL '\0' + +static unsigned char default_emacs_like_info_keys[] = +{ + 0, /* suppress-default-keybindings flag */ + TAB, NUL, A_info_move_to_next_xref, + LFD, NUL, A_info_select_reference_this_line, + RET, NUL, A_info_select_reference_this_line, + SPC, NUL, A_info_scroll_forward, + CONTROL('a'), NUL, A_info_beginning_of_line, + CONTROL('b'), NUL, A_info_backward_char, + CONTROL('e'), NUL, A_info_end_of_line, + CONTROL('f'), NUL, A_info_forward_char, + CONTROL('g'), NUL, A_info_abort_key, + CONTROL('h'), NUL, A_info_get_help_window, + CONTROL('l'), NUL, A_info_redraw_display, + CONTROL('n'), NUL, A_info_next_line, + CONTROL('p'), NUL, A_info_prev_line, + CONTROL('r'), NUL, A_isearch_backward, + CONTROL('s'), NUL, A_isearch_forward, + CONTROL('u'), NUL, A_info_universal_argument, + CONTROL('v'), NUL, A_info_scroll_forward_page_only, + ',', NUL, A_info_next_index_match, + '/', NUL, A_info_search, + '0', NUL, A_info_last_menu_item, + '1', NUL, A_info_menu_digit, + '2', NUL, A_info_menu_digit, + '3', NUL, A_info_menu_digit, + '4', NUL, A_info_menu_digit, + '5', NUL, A_info_menu_digit, + '6', NUL, A_info_menu_digit, + '7', NUL, A_info_menu_digit, + '8', NUL, A_info_menu_digit, + '9', NUL, A_info_menu_digit, + '<', NUL, A_info_first_node, + '>', NUL, A_info_last_node, + '?', NUL, A_info_get_help_window, + '[', NUL, A_info_global_prev_node, + ']', NUL, A_info_global_next_node, + 'b', NUL, A_info_beginning_of_node, + 'd', NUL, A_info_dir_node, + 'e', NUL, A_info_end_of_node, + 'f', NUL, A_info_xref_item, + 'g', NUL, A_info_goto_node, + 'G', NUL, A_info_menu_sequence, + 'h', NUL, A_info_get_info_help_node, + 'i', NUL, A_info_index_search, + 'l', NUL, A_info_history_node, + 'm', NUL, A_info_menu_item, + 'n', NUL, A_info_next_node, + 'O', NUL, A_info_goto_invocation_node, + 'p', NUL, A_info_prev_node, + 'q', NUL, A_info_quit, + 'r', NUL, A_info_xref_item, + 's', NUL, A_info_search, + 'S', NUL, A_info_search_case_sensitively, + 't', NUL, A_info_top_node, + 'u', NUL, A_info_up_node, + DEL, NUL, A_info_scroll_backward, + ESC, '0', NUL, A_info_add_digit_to_numeric_arg, + ESC, '1', NUL, A_info_add_digit_to_numeric_arg, + ESC, '2', NUL, A_info_add_digit_to_numeric_arg, + ESC, '3', NUL, A_info_add_digit_to_numeric_arg, + ESC, '4', NUL, A_info_add_digit_to_numeric_arg, + ESC, '5', NUL, A_info_add_digit_to_numeric_arg, + ESC, '6', NUL, A_info_add_digit_to_numeric_arg, + ESC, '7', NUL, A_info_add_digit_to_numeric_arg, + ESC, '8', NUL, A_info_add_digit_to_numeric_arg, + ESC, '9', NUL, A_info_add_digit_to_numeric_arg, + ESC, '-', NUL, A_info_add_digit_to_numeric_arg, + ESC, CONTROL('f'), NUL, A_info_show_footnotes, + ESC, CONTROL('g'), NUL, A_info_abort_key, + ESC, TAB, NUL, A_info_move_to_prev_xref, + ESC, CONTROL('v'), NUL, A_info_scroll_other_window, + ESC, '<', NUL, A_info_beginning_of_node, + ESC, '>', NUL, A_info_end_of_node, + ESC, 'b', NUL, A_info_backward_word, + ESC, 'f', NUL, A_info_forward_word, + ESC, 'r', NUL, A_info_move_to_window_line, + ESC, 'v', NUL, A_info_scroll_backward_page_only, + Meta('0'), NUL, A_info_add_digit_to_numeric_arg, + Meta('1'), NUL, A_info_add_digit_to_numeric_arg, + Meta('2'), NUL, A_info_add_digit_to_numeric_arg, + Meta('3'), NUL, A_info_add_digit_to_numeric_arg, + Meta('4'), NUL, A_info_add_digit_to_numeric_arg, + Meta('5'), NUL, A_info_add_digit_to_numeric_arg, + Meta('6'), NUL, A_info_add_digit_to_numeric_arg, + Meta('7'), NUL, A_info_add_digit_to_numeric_arg, + Meta('8'), NUL, A_info_add_digit_to_numeric_arg, + Meta('9'), NUL, A_info_add_digit_to_numeric_arg, + Meta('-'), NUL, A_info_add_digit_to_numeric_arg, + Meta(CONTROL('f')), NUL, A_info_show_footnotes, + Meta(CONTROL('g')), NUL, A_info_abort_key, + Meta(TAB), NUL, A_info_move_to_prev_xref, + Meta(CONTROL('v')), NUL, A_info_scroll_other_window, + Meta('<'), NUL, A_info_beginning_of_node, + Meta('>'), NUL, A_info_end_of_node, + Meta('b'), NUL, A_info_backward_word, + Meta('f'), NUL, A_info_forward_word, + Meta('r'), NUL, A_info_move_to_window_line, + Meta('v'), NUL, A_info_scroll_backward_page_only, +#if defined (NAMED_FUNCTIONS) + ESC, 'x', NUL, A_info_execute_command, + Meta('x'), NUL, A_info_execute_command, +#endif /* NAMED_FUNCTIONS */ + + CONTROL('x'), CONTROL('b'), NUL, A_list_visited_nodes, + CONTROL('x'), CONTROL('c'), NUL, A_info_quit, + CONTROL('x'), CONTROL('f'), NUL, A_info_view_file, + CONTROL('x'), CONTROL('g'), NUL, A_info_abort_key, + CONTROL('x'), CONTROL('v'), NUL, A_info_view_file, + CONTROL('x'), '0', NUL, A_info_delete_window, + CONTROL('x'), '1', NUL, A_info_keep_one_window, + CONTROL('x'), '2', NUL, A_info_split_window, + CONTROL('x'), '^', NUL, A_info_grow_window, + CONTROL('x'), 'b', NUL, A_select_visited_node, + CONTROL('x'), 'k', NUL, A_info_kill_node, + CONTROL('x'), 'n', NUL, A_info_search_next, + CONTROL('x'), 'N', NUL, A_info_search_previous, + CONTROL('x'), 'o', NUL, A_info_next_window, + CONTROL('x'), 't', NUL, A_info_tile_windows, + CONTROL('x'), 'w', NUL, A_info_toggle_wrap, + +/* Arrow key bindings for info keymaps. It seems that some + terminals do not match their termcap entries, so it's best to just + define everything with both of the usual prefixes. */ + + SK_ESCAPE, SK_PAGE_UP, NUL, A_info_scroll_backward_page_only, + SK_ESCAPE, SK_PAGE_DOWN, NUL, A_info_scroll_forward_page_only, + SK_ESCAPE, SK_UP_ARROW, NUL, A_info_prev_line, + '\033', 'O', 'A', NUL, A_info_prev_line, + '\033', '[', 'A', NUL, A_info_prev_line, + SK_ESCAPE, SK_DOWN_ARROW, NUL, A_info_next_line, + '\033', 'O', 'B', NUL, A_info_next_line, + '\033', '[', 'B', NUL, A_info_next_line, + SK_ESCAPE, SK_RIGHT_ARROW, NUL, A_info_forward_char, + '\033', 'O', 'C', NUL, A_info_forward_char, + '\033', '[', 'C', NUL, A_info_forward_char, + SK_ESCAPE, SK_LEFT_ARROW, NUL, A_info_backward_char, + '\033', 'O', 'D', NUL, A_info_backward_char, + '\033', '[', 'D', NUL, A_info_backward_char, + SK_ESCAPE, SK_HOME, NUL, A_info_beginning_of_node, + SK_ESCAPE, SK_END, NUL, A_info_end_of_node, + SK_ESCAPE, SK_DELETE, NUL, A_info_scroll_backward, + + ESC, SK_ESCAPE, SK_PAGE_UP, NUL, A_info_scroll_other_window_backward, + ESC, SK_ESCAPE, SK_PAGE_DOWN, NUL, A_info_scroll_other_window, + ESC, SK_ESCAPE, SK_UP_ARROW, NUL, A_info_prev_line, + ESC, '\033', 'O', 'A', NUL, A_info_prev_line, + ESC, '\033', '[', 'A', NUL, A_info_prev_line, + ESC, SK_ESCAPE, SK_DOWN_ARROW, NUL, A_info_next_line, + ESC, '\033', 'O', 'B', NUL, A_info_next_line, + ESC, '\033', '[', 'B', NUL, A_info_next_line, + ESC, SK_ESCAPE, SK_RIGHT_ARROW, NUL, A_info_forward_word, + ESC, '\033', 'O', 'C', NUL, A_info_forward_word, + ESC, '\033', '[', 'C', NUL, A_info_forward_word, + ESC, SK_ESCAPE, SK_LEFT_ARROW, NUL, A_info_backward_word, + ESC, '\033', 'O', 'D', NUL, A_info_backward_word, + ESC, '\033', '[', 'D', NUL, A_info_backward_word, +}; + +static unsigned char default_emacs_like_ea_keys[] = +{ + 0, /* suppress-default-keybindings flag */ + ESC, '0', NUL, A_info_add_digit_to_numeric_arg, + ESC, '1', NUL, A_info_add_digit_to_numeric_arg, + ESC, '2', NUL, A_info_add_digit_to_numeric_arg, + ESC, '3', NUL, A_info_add_digit_to_numeric_arg, + ESC, '4', NUL, A_info_add_digit_to_numeric_arg, + ESC, '5', NUL, A_info_add_digit_to_numeric_arg, + ESC, '6', NUL, A_info_add_digit_to_numeric_arg, + ESC, '7', NUL, A_info_add_digit_to_numeric_arg, + ESC, '8', NUL, A_info_add_digit_to_numeric_arg, + ESC, '9', NUL, A_info_add_digit_to_numeric_arg, + ESC, '-', NUL, A_info_add_digit_to_numeric_arg, + Meta('0'), NUL, A_info_add_digit_to_numeric_arg, + Meta('1'), NUL, A_info_add_digit_to_numeric_arg, + Meta('2'), NUL, A_info_add_digit_to_numeric_arg, + Meta('3'), NUL, A_info_add_digit_to_numeric_arg, + Meta('4'), NUL, A_info_add_digit_to_numeric_arg, + Meta('5'), NUL, A_info_add_digit_to_numeric_arg, + Meta('6'), NUL, A_info_add_digit_to_numeric_arg, + Meta('7'), NUL, A_info_add_digit_to_numeric_arg, + Meta('8'), NUL, A_info_add_digit_to_numeric_arg, + Meta('9'), NUL, A_info_add_digit_to_numeric_arg, + Meta('-'), NUL, A_info_add_digit_to_numeric_arg, + ESC, CONTROL('g'), NUL, A_ea_abort, + ESC, CONTROL('v'), NUL, A_ea_scroll_completions_window, + ESC, 'b', NUL, A_ea_backward_word, + ESC, 'd', NUL, A_ea_kill_word, + ESC, 'f', NUL, A_ea_forward_word, + ESC, 'y', NUL, A_ea_yank_pop, + ESC, '?', NUL, A_ea_possible_completions, + ESC, TAB, NUL, A_ea_tab_insert, + ESC, DEL, NUL, A_ea_backward_kill_word, + Meta(CONTROL('g')), NUL, A_ea_abort, + Meta(CONTROL('v')), NUL, A_ea_scroll_completions_window, + Meta('b'), NUL, A_ea_backward_word, + Meta('d'), NUL, A_ea_kill_word, + Meta('f'), NUL, A_ea_forward_word, + Meta('y'), NUL, A_ea_yank_pop, + Meta('?'), NUL, A_ea_possible_completions, + Meta(TAB), NUL, A_ea_tab_insert, + Meta(DEL), NUL, A_ea_backward_kill_word, + CONTROL('a'), NUL, A_ea_beg_of_line, + CONTROL('b'), NUL, A_ea_backward, + CONTROL('d'), NUL, A_ea_delete, + CONTROL('e'), NUL, A_ea_end_of_line, + CONTROL('f'), NUL, A_ea_forward, + CONTROL('g'), NUL, A_ea_abort, + CONTROL('h'), NUL, A_ea_rubout, +/* CONTROL('k') */ + SK_ESCAPE, SK_LITERAL, NUL, A_ea_kill_line, + CONTROL('l'), NUL, A_info_redraw_display, + CONTROL('q'), NUL, A_ea_quoted_insert, + CONTROL('t'), NUL, A_ea_transpose_chars, + CONTROL('u'), NUL, A_info_universal_argument, + CONTROL('y'), NUL, A_ea_yank, + LFD, NUL, A_ea_newline, + RET, NUL, A_ea_newline, + SPC, NUL, A_ea_complete, + TAB, NUL, A_ea_complete, + '?', NUL, A_ea_possible_completions, +#ifdef __MSDOS__ + /* PC users will lynch me if I don't give them their usual DEL + effect... */ + DEL, NUL, A_ea_delete, +#else + DEL, NUL, A_ea_rubout, +#endif +#if defined (NAMED_FUNCTIONS) + /* ESC, 'x', NUL, A_info_execute_command, */ + /* Meta('x'), NUL, A_info_execute_command, */ +#endif /* NAMED_FUNCTIONS */ + CONTROL('x'), 'o', NUL, A_info_next_window, + CONTROL('x'), DEL, NUL, A_ea_backward_kill_line, + +/* Arrow key bindings for echo area keymaps. It seems that some + terminals do not match their termcap entries, so it's best to just + define everything with both of the usual prefixes. */ + + SK_ESCAPE, SK_RIGHT_ARROW, NUL, A_ea_forward, + '\033', 'O', 'C', NUL, A_ea_forward, + '\033', '[', 'C', NUL, A_ea_forward, + SK_ESCAPE, SK_LEFT_ARROW, NUL, A_ea_backward, + '\033', 'O', 'D', NUL, A_ea_backward, + '\033', '[', 'D', NUL, A_ea_backward, + ESC, SK_ESCAPE, SK_RIGHT_ARROW, NUL, A_ea_forward_word, + ESC, '\033', 'O', 'C', NUL, A_ea_forward_word, + ESC, '\033', '[', 'C', NUL, A_ea_forward_word, + ESC, SK_ESCAPE, SK_LEFT_ARROW, NUL, A_ea_backward_word, + ESC, '\033', 'O', 'D', NUL, A_ea_backward_word, + ESC, '\033', '[', 'D', NUL, A_ea_backward_word, +#ifdef __MSDOS__ + SK_ESCAPE, SK_DELETE, NUL, A_ea_delete, +#else + SK_ESCAPE, SK_DELETE, NUL, A_ea_rubout, +#endif + SK_ESCAPE, SK_HOME, NUL, A_ea_beg_of_line, + SK_ESCAPE, SK_END, NUL, A_ea_end_of_line, + ESC, SK_ESCAPE, SK_DELETE, NUL, A_ea_backward_kill_word, + CONTROL('x'), SK_ESCAPE, SK_DELETE, NUL,A_ea_backward_kill_line, +}; + +static unsigned char default_vi_like_info_keys[] = +{ + 0, /* suppress-default-keybindings flag */ + '0', NUL, A_info_add_digit_to_numeric_arg, + '1', NUL, A_info_add_digit_to_numeric_arg, + '2', NUL, A_info_add_digit_to_numeric_arg, + '3', NUL, A_info_add_digit_to_numeric_arg, + '4', NUL, A_info_add_digit_to_numeric_arg, + '5', NUL, A_info_add_digit_to_numeric_arg, + '6', NUL, A_info_add_digit_to_numeric_arg, + '7', NUL, A_info_add_digit_to_numeric_arg, + '8', NUL, A_info_add_digit_to_numeric_arg, + '9', NUL, A_info_add_digit_to_numeric_arg, + '-', NUL, A_info_add_digit_to_numeric_arg, + TAB, NUL, A_info_move_to_next_xref, + LFD, NUL, A_info_down_line, + RET, NUL, A_info_down_line, + SPC, NUL, A_info_scroll_forward, + CONTROL('a'), NUL, A_info_beginning_of_line, + CONTROL('b'), NUL, A_info_scroll_backward_page_only, + CONTROL('d'), NUL, A_info_scroll_half_screen_down, + CONTROL('e'), NUL, A_info_down_line, + CONTROL('f'), NUL, A_info_scroll_forward_page_only, + CONTROL('g'), NUL, A_info_abort_key, + CONTROL('k'), NUL, A_info_up_line, + CONTROL('l'), NUL, A_info_redraw_display, + CONTROL('n'), NUL, A_info_down_line, + CONTROL('p'), NUL, A_info_up_line, + CONTROL('r'), NUL, A_info_redraw_display, + CONTROL('s'), NUL, A_isearch_forward, + CONTROL('u'), NUL, A_info_scroll_half_screen_up, + CONTROL('v'), NUL, A_info_scroll_forward_page_only, + CONTROL('y'), NUL, A_info_up_line, + ',', NUL, A_info_next_index_match, + '/', NUL, A_info_search, + ESC, '0', NUL, A_info_last_menu_item, + ESC, '1', NUL, A_info_menu_digit, + ESC, '2', NUL, A_info_menu_digit, + ESC, '3', NUL, A_info_menu_digit, + ESC, '4', NUL, A_info_menu_digit, + ESC, '5', NUL, A_info_menu_digit, + ESC, '6', NUL, A_info_menu_digit, + ESC, '7', NUL, A_info_menu_digit, + ESC, '8', NUL, A_info_menu_digit, + ESC, '9', NUL, A_info_menu_digit, + Meta('0'), NUL, A_info_last_menu_item, + Meta('1'), NUL, A_info_menu_digit, + Meta('2'), NUL, A_info_menu_digit, + Meta('3'), NUL, A_info_menu_digit, + Meta('4'), NUL, A_info_menu_digit, + Meta('5'), NUL, A_info_menu_digit, + Meta('6'), NUL, A_info_menu_digit, + Meta('7'), NUL, A_info_menu_digit, + Meta('8'), NUL, A_info_menu_digit, + Meta('9'), NUL, A_info_menu_digit, + '<', NUL, A_info_first_node, + '>', NUL, A_info_last_node, + '?', NUL, A_info_search_backward, + '[', NUL, A_info_global_prev_node, + ']', NUL, A_info_global_next_node, + '\'', NUL, A_info_history_node, + 'b', NUL, A_info_scroll_backward, + 'd', NUL, A_info_scroll_half_screen_down, + 'e', NUL, A_info_down_line, + 'E', NUL, A_info_view_file, + ':', 'e', NUL, A_info_view_file, + 'f', NUL, A_info_scroll_forward_page_only, + 'F', NUL, A_info_scroll_forward_page_only, + 'g', NUL, A_info_first_node, + 'G', NUL, A_info_last_node, + 'h', NUL, A_info_get_help_window, + 'H', NUL, A_info_get_help_window, + 'i', NUL, A_info_index_search, + 'I', NUL, A_info_goto_invocation_node, + 'j', NUL, A_info_down_line, + 'k', NUL, A_info_up_line, + 'l', NUL, A_info_history_node, + 'm', NUL, A_info_menu_item, + 'n', NUL, A_info_search_next, + 'N', NUL, A_info_search_previous, + 'O', NUL, A_info_goto_invocation_node, + 'p', NUL, A_info_prev_node, + 'q', NUL, A_info_quit, + 'Q', NUL, A_info_quit, + ':', 'q', NUL, A_info_quit, + ':', 'Q', NUL, A_info_quit, + 'Z', 'Z', NUL, A_info_quit, + 'r', NUL, A_info_redraw_display, + 'R', NUL, A_info_redraw_display, + 's', NUL, A_info_search, + 'S', NUL, A_info_search_case_sensitively, + 't', NUL, A_info_top_node, + 'u', NUL, A_info_scroll_half_screen_up, + 'w', NUL, A_info_scroll_backward_page_only_set_window, + 'y', NUL, A_info_up_line, + 'z', NUL, A_info_scroll_forward_page_only_set_window, + DEL, NUL, A_info_scroll_backward, + ESC, CONTROL('f'), NUL, A_info_show_footnotes, + ESC, CONTROL('g'), NUL, A_info_abort_key, + ESC, TAB, NUL, A_info_move_to_prev_xref, + ESC, SPC, NUL, A_info_scroll_forward_page_only, + ESC, CONTROL('v'), NUL, A_info_scroll_other_window, + ESC, '<', NUL, A_info_beginning_of_node, + ESC, '>', NUL, A_info_end_of_node, + ESC, '/', NUL, A_info_search, + ESC, '?', NUL, A_info_search_backward, + ESC, 'b', NUL, A_info_beginning_of_node, + ESC, 'd', NUL, A_info_dir_node, + ESC, 'e', NUL, A_info_end_of_node, + ESC, 'f', NUL, A_info_xref_item, + ESC, 'g', NUL, A_info_select_reference_this_line, + ESC, 'h', NUL, A_info_get_info_help_node, + ESC, 'm', NUL, A_info_menu_item, + ESC, 'n', NUL, A_info_search, + ESC, 'N', NUL, A_info_search_backward, + ESC, 'r', NUL, A_isearch_backward, + ESC, 's', NUL, A_isearch_forward, + ESC, 't', NUL, A_info_top_node, + ESC, 'v', NUL, A_info_scroll_backward_page_only, +#if defined (NAMED_FUNCTIONS) + ESC, 'x', NUL, A_info_execute_command, + Meta('x'), NUL, A_info_execute_command, +#endif /* NAMED_FUNCTIONS */ + ESC, DEL, NUL, A_info_scroll_other_window_backward, + CONTROL('x'), CONTROL('b'), NUL, A_list_visited_nodes, + CONTROL('x'), CONTROL('c'), NUL, A_info_quit, + CONTROL('x'), CONTROL('f'), NUL, A_info_view_file, + CONTROL('x'), CONTROL('g'), NUL, A_info_abort_key, + CONTROL('x'), CONTROL('v'), NUL, A_info_view_file, + CONTROL('x'), LFD, NUL, A_info_select_reference_this_line, + CONTROL('x'), RET, NUL, A_info_select_reference_this_line, + CONTROL('x'), '0', NUL, A_info_delete_window, + CONTROL('x'), '1', NUL, A_info_keep_one_window, + CONTROL('x'), '2', NUL, A_info_split_window, + CONTROL('x'), '^', NUL, A_info_grow_window, + CONTROL('x'), 'b', NUL, A_select_visited_node, + CONTROL('x'), 'g', NUL, A_info_goto_node, + CONTROL('x'), 'i', NUL, A_info_index_search, + CONTROL('x'), 'I', NUL, A_info_goto_invocation_node, + CONTROL('x'), 'k', NUL, A_info_kill_node, + CONTROL('x'), 'n', NUL, A_info_next_node, + CONTROL('x'), 'o', NUL, A_info_next_window, + CONTROL('x'), 'O', NUL, A_info_goto_invocation_node, + CONTROL('x'), 'p', NUL, A_info_prev_node, + CONTROL('x'), 'r', NUL, A_info_xref_item, + CONTROL('x'), 't', NUL, A_info_tile_windows, + CONTROL('x'), 'u', NUL, A_info_up_node, + CONTROL('x'), 'w', NUL, A_info_toggle_wrap, + CONTROL('x'), ',', NUL, A_info_next_index_match, + +/* Arrow key bindings for info keymaps. It seems that some + terminals do not match their termcap entries, so it's best to just + define everything with both of the usual prefixes. */ + + SK_ESCAPE, SK_PAGE_UP, NUL, A_info_scroll_backward_page_only, + SK_ESCAPE, SK_PAGE_DOWN, NUL, A_info_scroll_forward_page_only, + SK_ESCAPE, SK_UP_ARROW, NUL, A_info_up_line, + '\033', 'O', 'A', NUL, A_info_up_line, + '\033', '[', 'A', NUL, A_info_up_line, + SK_ESCAPE, SK_DOWN_ARROW, NUL, A_info_down_line, + '\033', 'O', 'B', NUL, A_info_down_line, + '\033', '[', 'B', NUL, A_info_down_line, + SK_ESCAPE, SK_RIGHT_ARROW, NUL, A_info_scroll_forward_page_only, + '\033', 'O', 'C', NUL, A_info_scroll_forward_page_only, + '\033', '[', 'C', NUL, A_info_scroll_forward_page_only, + SK_ESCAPE, SK_LEFT_ARROW, NUL, A_info_scroll_backward_page_only, + '\033', 'O', 'D', NUL, A_info_scroll_backward_page_only, + '\033', '[', 'D', NUL, A_info_scroll_backward_page_only, + SK_ESCAPE, SK_HOME, NUL, A_info_beginning_of_node, + SK_ESCAPE, SK_END, NUL, A_info_end_of_node, + ESC, SK_ESCAPE, SK_PAGE_DOWN, NUL, A_info_scroll_other_window, + ESC, SK_ESCAPE, SK_PAGE_UP, NUL, A_info_scroll_other_window_backward, + ESC, SK_ESCAPE, SK_DELETE, NUL, A_info_scroll_other_window_backward, + ESC, SK_ESCAPE, SK_UP_ARROW, NUL, A_info_prev_node, + ESC, '\033', 'O', 'A', NUL, A_info_prev_node, + ESC, '\033', '[', 'A', NUL, A_info_prev_node, + ESC, SK_ESCAPE, SK_DOWN_ARROW, NUL, A_info_next_node, + ESC, '\033', 'O', 'B', NUL, A_info_next_node, + ESC, '\033', '[', 'B', NUL, A_info_next_node, + ESC, SK_ESCAPE, SK_RIGHT_ARROW, NUL, A_info_xref_item, + ESC, '\033', 'O', 'C', NUL, A_info_xref_item, + ESC, '\033', '[', 'C', NUL, A_info_xref_item, + ESC, SK_ESCAPE, SK_LEFT_ARROW, NUL, A_info_beginning_of_node, + ESC, '\033', 'O', 'D', NUL, A_info_beginning_of_node, + ESC, '\033', '[', 'D', NUL, A_info_beginning_of_node, + CONTROL('x'), SK_ESCAPE, SK_DELETE, NUL,A_ea_backward_kill_line, +}; + +static unsigned char default_vi_like_ea_keys[] = +{ + 0, /* suppress-default-keybindings flag */ + ESC, '1', NUL, A_info_add_digit_to_numeric_arg, + ESC, '2', NUL, A_info_add_digit_to_numeric_arg, + ESC, '3', NUL, A_info_add_digit_to_numeric_arg, + ESC, '4', NUL, A_info_add_digit_to_numeric_arg, + ESC, '5', NUL, A_info_add_digit_to_numeric_arg, + ESC, '6', NUL, A_info_add_digit_to_numeric_arg, + ESC, '7', NUL, A_info_add_digit_to_numeric_arg, + ESC, '8', NUL, A_info_add_digit_to_numeric_arg, + ESC, '9', NUL, A_info_add_digit_to_numeric_arg, + ESC, '-', NUL, A_info_add_digit_to_numeric_arg, + Meta('1'), NUL, A_info_add_digit_to_numeric_arg, + Meta('2'), NUL, A_info_add_digit_to_numeric_arg, + Meta('3'), NUL, A_info_add_digit_to_numeric_arg, + Meta('4'), NUL, A_info_add_digit_to_numeric_arg, + Meta('5'), NUL, A_info_add_digit_to_numeric_arg, + Meta('6'), NUL, A_info_add_digit_to_numeric_arg, + Meta('7'), NUL, A_info_add_digit_to_numeric_arg, + Meta('8'), NUL, A_info_add_digit_to_numeric_arg, + Meta('9'), NUL, A_info_add_digit_to_numeric_arg, + Meta('-'), NUL, A_info_add_digit_to_numeric_arg, + ESC, CONTROL('g'), NUL, A_ea_abort, + ESC, CONTROL('h'), NUL, A_ea_backward_kill_word, + ESC, CONTROL('v'), NUL, A_ea_scroll_completions_window, + ESC, '0', NUL, A_ea_beg_of_line, + ESC, '$', NUL, A_ea_end_of_line, + ESC, 'b', NUL, A_ea_backward_word, + ESC, 'd', NUL, A_ea_kill_word, + ESC, 'f', NUL, A_ea_forward_word, + ESC, 'h', NUL, A_ea_forward, + ESC, 'l', NUL, A_ea_backward, + ESC, 'w', NUL, A_ea_forward_word, + ESC, 'x', NUL, A_ea_delete, + ESC, 'X', NUL, A_ea_kill_word, + ESC, 'y', NUL, A_ea_yank_pop, + ESC, '?', NUL, A_ea_possible_completions, + ESC, TAB, NUL, A_ea_tab_insert, + ESC, DEL, NUL, A_ea_kill_word, + Meta(CONTROL('g')), NUL, A_ea_abort, + Meta(CONTROL('h')), NUL, A_ea_backward_kill_word, + Meta(CONTROL('v')), NUL, A_ea_scroll_completions_window, + Meta('0'), NUL, A_ea_beg_of_line, + Meta('$'), NUL, A_ea_end_of_line, + Meta('b'), NUL, A_ea_backward_word, + Meta('d'), NUL, A_ea_kill_word, + Meta('f'), NUL, A_ea_forward_word, + Meta('h'), NUL, A_ea_forward, + Meta('l'), NUL, A_ea_backward, + Meta('w'), NUL, A_ea_forward_word, + Meta('x'), NUL, A_ea_delete, + Meta('X'), NUL, A_ea_kill_word, + Meta('y'), NUL, A_ea_yank_pop, + Meta('?'), NUL, A_ea_possible_completions, + Meta(TAB), NUL, A_ea_tab_insert, + Meta(DEL), NUL, A_ea_kill_word, + CONTROL('a'), NUL, A_ea_beg_of_line, + CONTROL('b'), NUL, A_ea_backward, + CONTROL('d'), NUL, A_ea_delete, + CONTROL('e'), NUL, A_ea_end_of_line, + CONTROL('f'), NUL, A_ea_forward, + CONTROL('g'), NUL, A_ea_abort, + CONTROL('h'), NUL, A_ea_rubout, +/* CONTROL('k') */ + SK_ESCAPE, SK_LITERAL, NUL, A_ea_kill_line, + CONTROL('l'), NUL, A_info_redraw_display, + CONTROL('q'), NUL, A_ea_quoted_insert, + CONTROL('t'), NUL, A_ea_transpose_chars, + CONTROL('u'), NUL, A_ea_abort, + CONTROL('v'), NUL, A_ea_quoted_insert, + CONTROL('y'), NUL, A_ea_yank, + LFD, NUL, A_ea_newline, + RET, NUL, A_ea_newline, + SPC, NUL, A_ea_complete, + TAB, NUL, A_ea_complete, + '?', NUL, A_ea_possible_completions, +#ifdef __MSDOS__ + /* PC users will lynch me if I don't give them their usual DEL + effect... */ + DEL, NUL, A_ea_delete, +#else + DEL, NUL, A_ea_rubout, +#endif + CONTROL('x'), 'o', NUL, A_info_next_window, + CONTROL('x'), DEL, NUL, A_ea_backward_kill_line, + + /* Arrow key bindings for echo area keymaps. It seems that some + terminals do not match their termcap entries, so it's best to just + define everything with both of the usual prefixes. */ + + SK_ESCAPE, SK_RIGHT_ARROW, NUL, A_ea_forward, + '\033', 'O', 'C', NUL, A_ea_forward, + '\033', '[', 'C', NUL, A_ea_forward, + SK_ESCAPE, SK_LEFT_ARROW, NUL, A_ea_backward, + '\033', 'O', 'D', NUL, A_ea_backward, + '\033', '[', 'D', NUL, A_ea_backward, + SK_ESCAPE, SK_HOME, NUL, A_ea_beg_of_line, + SK_ESCAPE, SK_END, NUL, A_ea_end_of_line, +#ifdef __MSDOS__ + SK_ESCAPE, SK_DELETE, NUL, A_ea_delete, +#else + SK_DELETE, SK_DELETE, NUL, A_ea_rubout, +#endif + ESC, SK_ESCAPE, SK_RIGHT_ARROW, NUL, A_ea_forward_word, + ESC, '\033', 'O', 'C', NUL, A_ea_forward_word, + ESC, '\033', '[', 'C', NUL, A_ea_forward_word, + ESC, SK_ESCAPE, SK_LEFT_ARROW, NUL, A_ea_backward_word, + ESC, '\033', 'O', 'D', NUL, A_ea_backward_word, + ESC, '\033', '[', 'D', NUL, A_ea_backward_word, + ESC, SK_ESCAPE, SK_DELETE, NUL, A_ea_kill_word, + CONTROL('x'), SK_ESCAPE, SK_DELETE, NUL,A_ea_backward_kill_line, +}; + +static unsigned char *user_info_keys; +static unsigned int user_info_keys_len; +static unsigned char *user_ea_keys; +static unsigned int user_ea_keys_len; +static unsigned char *user_vars; +static unsigned int user_vars_len; + +/* + * Return the size of a file, or 0 if the size can't be determined. + */ +static unsigned long +filesize(f) + int f; +{ + long pos = lseek(f, 0L, SEEK_CUR); + long sz = -1L; + if (pos != -1L) + { + sz = lseek(f, 0L, SEEK_END); + lseek(f, pos, SEEK_SET); + } + return sz == -1L ? 0L : sz; +} + +/* Get an integer from a infokey file. + Integers are stored as two bytes, low order first, in radix INFOKEY_RADIX. + */ +static int +getint(sp) + unsigned char **sp; +{ + int n; + + if ( !((*sp)[0] < INFOKEY_RADIX && (*sp)[1] < INFOKEY_RADIX) ) + return -1; + n = (*sp)[0] + (*sp)[1] * INFOKEY_RADIX; + *sp += 2; + return n; +} + + +/* Fetch the contents of the standard infokey file "$HOME/.info". Return + true if ok, false if not. */ +static int +fetch_user_maps() +{ + char *filename = NULL; + char *homedir; + int f; + unsigned char *buf; + unsigned long len; + long nread; + unsigned char *p; + int n; + + /* Find and open file. */ + if ((filename = getenv("INFOKEY")) != NULL) + filename = xstrdup(filename); + else if ((homedir = getenv("HOME")) != NULL) + { + filename = xmalloc(strlen(homedir) + 2 + strlen(INFOKEY_FILE)); + strcpy(filename, homedir); + strcat(filename, "/"); + strcat(filename, INFOKEY_FILE); + } +#ifdef __MSDOS__ + /* Poor baby, she doesn't have a HOME... */ + else + filename = xstrdup(INFOKEY_FILE); /* try current directory */ +#endif + if (filename == NULL || (f = open(filename, O_RDONLY)) == (-1)) + { + if (filename) + { + info_error(filesys_error_string(filename, errno)); + free(filename); + } + return 0; + } + SET_BINARY (f); + + /* Ensure that the file is a reasonable size. */ + len = filesize(f); + if (len < INFOKEY_NMAGIC + 2 || len > 100 * 1024) + { + /* Bad file (a valid file must have at least 9 chars, and + more than 100 KB is a problem). */ + if (len < INFOKEY_NMAGIC + 2) + info_error(_("Ignoring invalid infokey file `%s' - too small"), + filename); + else + info_error(_("Ignoring invalid infokey file `%s' - too big"), + filename); + close(f); + free(filename); + return 0; + } + + /* Read the file into a buffer. */ + buf = (unsigned char *)xmalloc((int)len); + nread = read(f, buf, (unsigned int) len); + close(f); + if (nread != len) + { + info_error(_("Error reading infokey file `%s' - short read"), filename); + free(buf); + free(filename); + return 0; + } + + /* Check the header, trailer, and version of the file to increase + our confidence that the contents are valid. */ + if ( buf[0] != INFOKEY_MAGIC_S0 + || buf[1] != INFOKEY_MAGIC_S1 + || buf[2] != INFOKEY_MAGIC_S2 + || buf[3] != INFOKEY_MAGIC_S3 + || buf[len - 4] != INFOKEY_MAGIC_E0 + || buf[len - 3] != INFOKEY_MAGIC_E1 + || buf[len - 2] != INFOKEY_MAGIC_E2 + || buf[len - 1] != INFOKEY_MAGIC_E3 + ) + { + info_error(_("Invalid infokey file `%s' (bad magic numbers) -- run infokey to update it"), filename); + free(filename); + return 0; + } + if (len < INFOKEY_NMAGIC + strlen(VERSION) + 1 || strcmp(VERSION, buf + 4) != 0) + { + info_error(_("Your infokey file `%s' is out of date -- run infokey to update it"), filename); + free(filename); + return 0; + } + + /* Extract the pieces. */ + for (p = buf + 4 + strlen(VERSION) + 1; p - buf < len - 4; p += n) + { + int s = *p++; + + n = getint(&p); + if (n < 0 || n > len - 4 - (p - buf)) + { + info_error(_("Invalid infokey file `%s' (bad section length) -- run infokey to update it"), filename); + free(filename); + return 0; + } + + switch (s) + { + case INFOKEY_SECTION_INFO: + user_info_keys = p; + user_info_keys_len = n; + break; + case INFOKEY_SECTION_EA: + user_ea_keys = p; + user_ea_keys_len = n; + break; + case INFOKEY_SECTION_VAR: + user_vars = p; + user_vars_len = n; + break; + default: + info_error(_("Invalid infokey file `%s' (bad section code) -- run infokey to update it"), filename); + free(filename); + return 0; + } + } + + free(filename); + return 1; +} + +/* Decode special key sequences from the infokey file. Return zero + if the key sequence includes special keys which the terminal + doesn't define. + */ +static int +decode_keys(src, slen, dst, dlen) + unsigned char *src; + unsigned int slen; + unsigned char *dst; + unsigned int dlen; +{ + unsigned char *s = src; + unsigned char *d = dst; + +#define To_dst(c) do { if (d - dst < dlen) *d++ = (c); } while (0) + + while (s - src < slen) + { + unsigned char c = ISMETA(*s) ? UNMETA(*s) : *s; + + if (c == SK_ESCAPE) + { + unsigned char *t; + static char lit[] = { SK_ESCAPE, NUL }; + + switch (s + 1 - src < slen ? s[1] : '\0') + { + case SK_RIGHT_ARROW: t = term_kr; break; + case SK_LEFT_ARROW: t = term_kl; break; + case SK_UP_ARROW: t = term_ku; break; + case SK_DOWN_ARROW: t = term_kd; break; + case SK_PAGE_UP: t = term_kP; break; + case SK_PAGE_DOWN: t = term_kN; break; + case SK_HOME: t = term_kh; break; + case SK_END: t = term_ke; break; + case SK_DELETE: t = term_kx; break; + case SK_INSERT: t = term_ki; break; + case SK_LITERAL: + default: t = lit; break; + } + if (t == NULL) + return 0; + while (*t) + To_dst(ISMETA(*s) ? Meta(*t++) : *t++); + s += 2; + } + else + { + if (ISMETA(*s)) + To_dst(Meta(*s++)); + else + To_dst(*s++); + } + } + + To_dst('\0'); + + return 1; + +#undef To_dst + +} + +/* Convert an infokey file section to keymap bindings. Return false if + the default bindings are to be suppressed. */ +static int +section_to_keymaps(map, table, len) + Keymap map; + unsigned char *table; + unsigned int len; +{ + int stop; + unsigned char *p; + unsigned char *seq; + unsigned int seqlen; + KEYMAP_ENTRY ke; + enum { getseq, gotseq, getaction } state = getseq; + + stop = len > 0 ? table[0] : 0; + + for (p = table + 1; p - table < len; p++) + { + switch (state) + { + case getseq: + if (*p) + { + seq = p; + state = gotseq; + } + break; + + case gotseq: + if (!*p) + { + seqlen = p - seq; + state = getaction; + } + break; + + case getaction: + { + unsigned int action = *p; + unsigned char keyseq[256]; + KEYMAP_ENTRY ke; + + state = getseq; + /* If decode_keys returns zero, it + means that seq includes keys which + the terminal doesn't support, like + PageDown. In that case, don't bind + the key sequence. */ + if (decode_keys(seq, seqlen, keyseq, + sizeof keyseq)) + { + keyseq[sizeof keyseq - 1] = '\0'; + ke.type = ISFUNC; + ke.function = + action < A_NCOMMANDS + ? &function_doc_array[action] + : NULL; + keymap_bind_keyseq(map, keyseq, &ke); + } + } + break; + } + } + if (state != getseq) + info_error(_("Bad data in infokey file -- some key bindings ignored")); + return !stop; +} + +/* Convert an infokey file section to variable settings. + */ +static void +section_to_vars(table, len) + unsigned char *table; + unsigned int len; +{ + enum { getvar, gotvar, getval, gotval } state = getvar; + unsigned char *var = NULL; + unsigned char *val = NULL; + unsigned char *p; + + for (p = table; p - table < len; p++) + { + switch (state) + { + case getvar: + if (*p) + { + var = p; + state = gotvar; + } + break; + + case gotvar: + if (!*p) + state = getval; + break; + + case getval: + if (*p) + { + val = p; + state = gotval; + } + break; + + case gotval: + if (!*p) + { + set_variable_to_value(var, val); + state = getvar; + } + break; + } + } + if (state != getvar) + info_error(_("Bad data in infokey file -- some var settings ignored")); +} + +void +initialize_info_keymaps () +{ + int i; + int suppress_info_default_bindings = 0; + int suppress_ea_default_bindings = 0; + Keymap map; + + if (!info_keymap) + { + info_keymap = keymap_make_keymap (); + echo_area_keymap = keymap_make_keymap (); + } + + /* Bind the echo area insert routines. */ + for (i = 0; i < 256; i++) + if (isprint (i)) + echo_area_keymap[i].function = InfoCmd(ea_insert); + + /* Get user-defined keys and variables. */ + if (fetch_user_maps()) + { + if (user_info_keys_len && user_info_keys[0]) + suppress_info_default_bindings = 1; + if (user_ea_keys_len && user_ea_keys[0]) + suppress_ea_default_bindings = 1; + } + + /* Apply the default bindings, unless the user says to suppress + them. */ + if (vi_keys_p) + { + if (!suppress_info_default_bindings) + section_to_keymaps(info_keymap, default_vi_like_info_keys, + sizeof(default_vi_like_info_keys)); + if (!suppress_ea_default_bindings) + section_to_keymaps(echo_area_keymap, default_vi_like_ea_keys, + sizeof(default_vi_like_ea_keys)); + } + else + { + if (!suppress_info_default_bindings) + section_to_keymaps(info_keymap, default_emacs_like_info_keys, + sizeof(default_emacs_like_info_keys)); + if (!suppress_ea_default_bindings) + section_to_keymaps(echo_area_keymap, default_emacs_like_ea_keys, + sizeof(default_emacs_like_ea_keys)); + } + + /* If the user specified custom bindings, apply them on top of the + default ones. */ + if (user_info_keys_len) + section_to_keymaps(info_keymap, user_info_keys, user_info_keys_len); + + if (user_ea_keys_len) + section_to_keymaps(echo_area_keymap, user_ea_keys, user_ea_keys_len); + + if (user_vars_len) + section_to_vars(user_vars, user_vars_len); +} + +#endif /* defined(INFOKEY) */ diff --git a/contrib/texinfo/info/session.c b/contrib/texinfo/info/session.c index 69b138d9cbba..56b12f712cb7 100644 --- a/contrib/texinfo/info/session.c +++ b/contrib/texinfo/info/session.c @@ -1,7 +1,9 @@ +/* $FreeBSD$ */ /* session.c -- user windowing interface to Info. - $Id: session.c,v 1.38 1999/09/25 16:10:04 karl Exp $ + $Id: session.c,v 1.45 2002/03/02 15:05:04 karl Exp $ - Copyright (C) 1993, 96, 97, 98, 99 Free Software Foundation, Inc. + Copyright (C) 1993, 96, 97, 98, 99, 2000, 01, 02 + Free Software Foundation, Inc. This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by @@ -1139,19 +1141,26 @@ DECLARE_INFO_COMMAND (info_global_prev_node, } } -/* Show the next screen of WINDOW's node. */ -DECLARE_INFO_COMMAND (info_scroll_forward, _("Scroll forward in this window")) +static void _scroll_forward(); +static void _scroll_backward(); + +static void +_scroll_forward(window, count, key, behaviour) + WINDOW *window; + int count; + unsigned char key; + int behaviour; { if (count < 0) - info_scroll_backward (window, -count, key); + _scroll_backward (window, -count, key, behaviour); else { int desired_top; /* Without an explicit numeric argument, scroll the bottom two lines to the top of this window, Or, if at bottom of window, - and the user wishes to scroll through nodes get the "Next" node - for this window. */ + and the chosen behaviour is to scroll through nodes get the + "Next" node for this window. */ if (default_window_size > 0) desired_top = window->pagetop + default_window_size; else if (!info_explicit_arg && count == 1) @@ -1159,16 +1168,9 @@ DECLARE_INFO_COMMAND (info_scroll_forward, _("Scroll forward in this window")) desired_top = window->pagetop + (window->height - 2); /* If there are no more lines to scroll here, error, or get - another node, depending on INFO_SCROLL_BEHAVIOUR. */ + another node, depending on BEHAVIOUR. */ if (desired_top > window->line_count) { - int behaviour = info_scroll_behaviour; - - /* Here is a hack. If the key being used is not SPC, do the - PageOnly behaviour. */ - if (key != SPC && key != DEL) - behaviour = IS_PageOnly; - forward_move_node_structure (window, behaviour); return; } @@ -1186,28 +1188,22 @@ DECLARE_INFO_COMMAND (info_scroll_forward, _("Scroll forward in this window")) } } -/* Like info_scroll_forward, but sets default_window_size as a side - effect. */ -DECLARE_INFO_COMMAND (info_scroll_forward_set_window, - _("Scroll forward in this window and set default window size")) -{ - if (info_explicit_arg) - default_window_size = count; - info_scroll_forward (window, count, key); -} - -/* Show the previous screen of WINDOW's node. */ -DECLARE_INFO_COMMAND (info_scroll_backward, _("Scroll backward in this window")) +static void +_scroll_backward(window, count, key, behaviour) + WINDOW *window; + int count; + unsigned char key; + int behaviour; { if (count < 0) - info_scroll_forward (window, -count, key); + _scroll_forward (window, -count, key, behaviour); else { int desired_top; /* Without an explicit numeric argument, scroll the top two lines - to the bottom of this window, or move to the previous, or Up'th - node. */ + to the bottom of this window, or, depending on the selected + behaviour, move to the previous, or Up'th node. */ if (default_window_size > 0) desired_top = window->pagetop - default_window_size; else if (!info_explicit_arg && count == 1) @@ -1216,14 +1212,6 @@ DECLARE_INFO_COMMAND (info_scroll_backward, _("Scroll backward in this window")) if ((desired_top < 0) && (window->pagetop == 0)) { - int behaviour = info_scroll_behaviour; - - /* Same kind of hack as in info_scroll_forward. If the key - used to invoke this command is not DEL, do only the PageOnly - behaviour. */ - if (key != DEL && key != SPC) - behaviour = IS_PageOnly; - backward_move_node_structure (window, behaviour); return; } @@ -1238,6 +1226,44 @@ DECLARE_INFO_COMMAND (info_scroll_backward, _("Scroll backward in this window")) } } +/* Show the next screen of WINDOW's node. */ +DECLARE_INFO_COMMAND (info_scroll_forward, _("Scroll forward in this window")) +{ + _scroll_forward (window, count, key, info_scroll_behaviour); +} + +/* Like info_scroll_forward, but sets default_window_size as a side + effect. */ +DECLARE_INFO_COMMAND (info_scroll_forward_set_window, + _("Scroll forward in this window and set default window size")) +{ + if (info_explicit_arg) + default_window_size = count; + _scroll_forward (window, count, key, info_scroll_behaviour); +} + +/* Show the next screen of WINDOW's node but never advance to next node. */ +DECLARE_INFO_COMMAND (info_scroll_forward_page_only, _("Scroll forward in this window staying within node")) +{ + _scroll_forward (window, count, key, IS_PageOnly); +} + +/* Like info_scroll_forward_page_only, but sets default_window_size as a side + effect. */ +DECLARE_INFO_COMMAND (info_scroll_forward_page_only_set_window, + _("Scroll forward in this window staying within node and set default window size")) +{ + if (info_explicit_arg) + default_window_size = count; + _scroll_forward (window, count, key, IS_PageOnly); +} + +/* Show the previous screen of WINDOW's node. */ +DECLARE_INFO_COMMAND (info_scroll_backward, _("Scroll backward in this window")) +{ + _scroll_backward (window, count, key, info_scroll_behaviour); +} + /* Like info_scroll_backward, but sets default_window_size as a side effect. */ DECLARE_INFO_COMMAND (info_scroll_backward_set_window, @@ -1245,7 +1271,24 @@ DECLARE_INFO_COMMAND (info_scroll_backward_set_window, { if (info_explicit_arg) default_window_size = count; - info_scroll_backward (window, count, key); + _scroll_backward (window, count, key, info_scroll_behaviour); +} + +/* Show the previous screen of WINDOW's node but never move to previous + node. */ +DECLARE_INFO_COMMAND (info_scroll_backward_page_only, _("Scroll backward in this window staying within node")) +{ + _scroll_backward (window, count, key, IS_PageOnly); +} + +/* Like info_scroll_backward_page_only, but sets default_window_size as a side + effect. */ +DECLARE_INFO_COMMAND (info_scroll_backward_page_only_set_window, + _("Scroll backward in this window staying within node and set default window size")) +{ + if (info_explicit_arg) + default_window_size = count; + _scroll_backward (window, count, key, IS_PageOnly); } /* Move to the beginning of the node. */ @@ -1301,7 +1344,7 @@ DECLARE_INFO_COMMAND (info_scroll_half_screen_down, _("Scroll down by half screen size")) { if (count < 0) - info_scroll_half_screen_up (window -count, key); + info_scroll_half_screen_up (window, -count, key); else { int scroll_size = (the_screen->height + 1) / 2; @@ -1327,7 +1370,7 @@ DECLARE_INFO_COMMAND (info_scroll_half_screen_up, _("Scroll up by half screen size")) { if (count < 0) - info_scroll_half_screen_down (window -count, key); + info_scroll_half_screen_down (window, -count, key); else { int scroll_size = (the_screen->height + 1) / 2; @@ -2028,7 +2071,19 @@ info_menu_or_ref_item (window, count, key, builder, ask_p) refs = manpage_xrefs_in_binding (window->node, &binding); else #endif /* HANDLE_MAN_PAGES */ - refs = info_xrefs (&binding); + { + refs = info_xrefs (&binding); + if (!refs && point_line > 0) + { + /* People get annoyed that Info cannot find an xref + which starts on a previous line and ends on this + one. So if we fail to find a reference on this + line, let's try the one before. */ + binding.start = + window->line_starts[point_line - 1] - binding.buffer; + refs = info_xrefs (&binding); + } + } } if (refs) @@ -2139,8 +2194,43 @@ info_menu_or_ref_item (window, count, key, builder, ask_p) if (line) { - /* Find the selected label in the references. */ - entry = info_get_labeled_reference (line, menu); + /* It is possible that the references have more than a single + entry with the same label, and also LINE is down-cased, which + complicates matters even more. Try to be as accurate as we + can: if they've chosen the default, use defentry directly. */ + if (defentry && strcmp (line, defentry->label) == 0) + entry = defentry; + else + /* Find the selected label in the references. If there are + more than one label which matches, find the one that's + closest to point. */ + { + register int i; + int best = -1, min_dist = window->node->nodelen; + REFERENCE *ref; + + for (i = 0; menu && (ref = menu[i]); i++) + { + /* Need to use strcasecmp because LINE is downcased + inside info_read_completing_in_echo_area. */ + if (strcasecmp (line, ref->label) == 0) + { + /* ref->end is more accurate estimate of position + for menus than ref->start. Go figure. */ + int dist = abs (window->point - ref->end); + + if (dist < min_dist) + { + min_dist = dist; + best = i; + } + } + } + if (best != -1) + entry = menu[best]; + else + entry = (REFERENCE *)NULL; + } if (!entry && defentry) info_error (_("The reference disappeared! (%s)."), line); @@ -2413,7 +2503,12 @@ info_follow_menus (initial_node, menus, errstr, errarg1, errarg2) { if (arg == first_arg) { - node = make_manpage_node (first_arg); + /* Maybe they typed "info foo" instead of "info -f foo". */ + node = info_get_node (first_arg, 0); + if (node) + add_file_directory_to_path (first_arg); + else + node = make_manpage_node (first_arg); if (node) goto maybe_got_node; } @@ -3873,14 +3968,27 @@ incremental_search (window, count, ignore) if (!Meta_p (key) || key > 32) { - func = window->keymap[key].function; + func = InfoFunction(window->keymap[key].function); - /* If this key invokes an incremental search, then this means that - we will either search again in the same direction, search - again in the reverse direction, or insert the last search - string that was accepted through incremental searching. */ - if (func == isearch_forward || func == isearch_backward) + if (isprint (key) || func == (VFunction *)NULL) { + insert_and_search: + + if (isearch_string_index + 2 >= isearch_string_size) + isearch_string = (char *)xrealloc + (isearch_string, isearch_string_size += 100); + + isearch_string[isearch_string_index++] = key; + isearch_string[isearch_string_index] = '\0'; + goto search_now; + } + else if (func == isearch_forward || func == isearch_backward) + { + /* If this key invokes an incremental search, then this + means that we will either search again in the same + direction, search again in the reverse direction, or + insert the last search string that was accepted through + incremental searching. */ if ((func == isearch_forward && dir > 0) || (func == isearch_backward && dir < 0)) { @@ -3918,18 +4026,6 @@ incremental_search (window, count, ignore) dir = -dir; } } - else if (isprint (key) || func == (VFunction *)NULL) - { - insert_and_search: - - if (isearch_string_index + 2 >= isearch_string_size) - isearch_string = (char *)xrealloc - (isearch_string, isearch_string_size += 100); - - isearch_string[isearch_string_index++] = key; - isearch_string[isearch_string_index] = '\0'; - goto search_now; - } else if (func == info_abort_key) { /* If C-g pressed, and the search is failing, pop the search @@ -3971,8 +4067,9 @@ incremental_search (window, count, ignore) /* FIXME: this seems like a kludge! We need a more reliable mechanism to know when ESC is a separate key and when it is part of an escape sequence. */ - if (key != isearch_terminate_search_key || - info_any_buffered_input_p ()) + if (key != RET /* Emacs addicts want RET to get lost */ + && (key != isearch_terminate_search_key + || info_any_buffered_input_p ())) info_set_pending_input (key); if (func == info_abort_key) @@ -4377,8 +4474,10 @@ DECLARE_INFO_COMMAND (info_quit, _("Quit using Info")) /* */ /* **************************************************************** */ -/* Declaration only. Special cased in info_dispatch_on_key (). */ -DECLARE_INFO_COMMAND (info_do_lowercase_version, "") +/* Declaration only. Special cased in info_dispatch_on_key (). + Doc string is to avoid ugly results with describe_key etc. */ +DECLARE_INFO_COMMAND (info_do_lowercase_version, + _("Run command bound to this key's lowercase variant")) {} static void @@ -4403,7 +4502,6 @@ dispatch_error (keyseq) /* Keeping track of key sequences. */ static char *info_keyseq = (char *)NULL; -static char keyseq_rep[100]; static int info_keyseq_index = 0; static int info_keyseq_size = 0; static int info_keyseq_displayed_p = 0; @@ -4428,25 +4526,6 @@ add_char_to_keyseq (character) info_keyseq[info_keyseq_index] = '\0'; } -/* Return the pretty printable string which represents KEYSEQ. */ -char * -pretty_keyseq (keyseq) - char *keyseq; -{ - register int i; - - keyseq_rep[0] = '\0'; - - for (i = 0; keyseq[i]; i++) - { - sprintf (keyseq_rep + strlen (keyseq_rep), "%s%s", - strlen (keyseq_rep) ? " " : "", - pretty_keyname (keyseq[i])); - } - - return (keyseq_rep); -} - /* Display the current value of info_keyseq. If argument EXPECTING is non-zero, input is expected to be read after the key sequence is displayed, so add an additional prompting character to the sequence. */ @@ -4513,6 +4592,7 @@ info_dispatch_on_key (key, map) unsigned char key; Keymap map; { +#if !defined(INFOKEY) if (Meta_p (key) && (!ISO_Latin_p || map[key].function != ea_insert)) { if (map[ESC].type == ISKMAP) @@ -4528,6 +4608,7 @@ info_dispatch_on_key (key, map) } return; } +#endif /* INFOKEY */ switch (map[key].type) { @@ -4535,13 +4616,26 @@ info_dispatch_on_key (key, map) { VFunction *func; - func = map[key].function; + func = InfoFunction(map[key].function); if (func != (VFunction *)NULL) { /* Special case info_do_lowercase_version (). */ if (func == info_do_lowercase_version) { +#if defined(INFOKEY) + unsigned char lowerkey; + + lowerkey = Meta_p(key) ? Meta (tolower (UnMeta (key))) : tolower (key); + if (lowerkey == key) + { + add_char_to_keyseq (key); + dispatch_error (info_keyseq); + return; + } + info_dispatch_on_key (lowerkey, map); +#else /* !INFOKEY */ info_dispatch_on_key (tolower (key), map); +#endif /* INFOKEY */ return; } @@ -4554,7 +4648,7 @@ info_dispatch_on_key (key, map) WINDOW *where; where = active_window; - (*map[key].function) + (*InfoFunction(map[key].function)) (active_window, info_numeric_arg * info_numeric_arg_sign, key); /* If we have input pending, then the last command was a prefix @@ -4564,9 +4658,9 @@ info_dispatch_on_key (key, map) if (!info_input_pending_p ()) { if (where == the_echo_area) - ea_last_executed_command = map[key].function; + ea_last_executed_command = InfoFunction(map[key].function); else - info_last_executed_command = map[key].function; + info_last_executed_command = InfoFunction(map[key].function); } } } @@ -4581,7 +4675,7 @@ info_dispatch_on_key (key, map) case ISKMAP: add_char_to_keyseq (key); - if (map[key].function != (VFunction *)NULL) + if (map[key].function != (InfoCommand *)NULL) { unsigned char newkey; @@ -4660,23 +4754,35 @@ DECLARE_INFO_COMMAND (info_numeric_arg_digit_loop, pure_key = key = info_get_another_input_char (); +#if !defined(INFOKEY) if (Meta_p (key)) add_char_to_keyseq (ESC); add_char_to_keyseq (UnMeta (key)); +#else /* defined(INFOKEY) */ + add_char_to_keyseq (key); +#endif /* defined(INFOKEY) */ } +#if !defined(INFOKEY) if (Meta_p (key)) key = UnMeta (key); +#endif /* !defined(INFOKEY) */ if (keymap[key].type == ISFUNC && - keymap[key].function == info_universal_argument) + InfoFunction(keymap[key].function) == info_universal_argument) { info_numeric_arg *= 4; key = 0; continue; } +#if defined(INFOKEY) + if (Meta_p (key)) + key = UnMeta (key); +#endif /* !defined(INFOKEY) */ + + if (isdigit (key)) { if (info_explicit_arg) diff --git a/contrib/texinfo/info/terminal.c b/contrib/texinfo/info/terminal.c index 9223d9532533..adab0908fef7 100644 --- a/contrib/texinfo/info/terminal.c +++ b/contrib/texinfo/info/terminal.c @@ -1,7 +1,8 @@ +/* $FreeBSD$ */ /* terminal.c -- How to handle the physical terminal for Info. - $Id: terminal.c,v 1.19 1999/09/20 12:28:54 karl Exp $ + $Id: terminal.c,v 1.23 2001/11/16 23:16:04 karl Exp $ - Copyright (C) 1988, 89, 90, 91, 92, 93, 96, 97, 98, 99 + Copyright (C) 1988, 89, 90, 91, 92, 93, 96, 97, 98, 99, 2001 Free Software Foundation, Inc. This program is free software; you can redistribute it and/or modify @@ -26,7 +27,6 @@ #include #include -#include /* TIOCGWINSZ on LynxOS, at least */ /* The Unix termcap interface code. */ #ifdef HAVE_NCURSES_TERMCAP_H @@ -217,12 +217,17 @@ int terminal_use_visible_bell_p = 0; int terminal_can_scroll = 0; /* The key sequences output by the arrow keys, if this terminal has any. */ -char *term_ku = (char *)NULL; -char *term_kd = (char *)NULL; -char *term_kr = (char *)NULL; -char *term_kl = (char *)NULL; -char *term_kP = (char *)NULL; /* page-up */ -char *term_kN = (char *)NULL; /* page-down */ +char *term_ku = NULL; +char *term_kd = NULL; +char *term_kr = NULL; +char *term_kl = NULL; +char *term_kP = NULL; /* page-up */ +char *term_kN = NULL; /* page-down */ +char *term_kh = NULL; /* home */ +char *term_ke = NULL; /* end */ +char *term_kD = NULL; /* delete */ +char *term_ki = NULL; /* ins */ +char *term_kx = NULL; /* del */ /* Move the cursor to the terminal location of X and Y. */ void @@ -555,6 +560,8 @@ terminal_initialize_terminal (terminal_name) term_up = term_dn = audible_bell = visible_bell = NULL; term_ku = term_kd = term_kl = term_kr = NULL; term_kP = term_kN = NULL; + term_kh = term_ke = NULL; + term_kD = NULL; return; } @@ -601,7 +608,7 @@ terminal_initialize_terminal (terminal_name) if (term_invbeg) term_invend = tgetstr ("me", &buffer); else - term_invend = (char *)NULL; + term_invend = NULL; if (!term_cr) term_cr = "\r"; @@ -611,7 +618,7 @@ terminal_initialize_terminal (terminal_name) term_up = tgetstr ("up", &buffer); term_dn = tgetstr ("dn", &buffer); visible_bell = tgetstr ("vb", &buffer); - terminal_has_visible_bell_p = (visible_bell != (char *)NULL); + terminal_has_visible_bell_p = (visible_bell != NULL); audible_bell = tgetstr ("bl", &buffer); if (!audible_bell) audible_bell = "\007"; @@ -630,8 +637,8 @@ terminal_initialize_terminal (terminal_name) } else { - term_mm = (char *)NULL; - term_mo = (char *)NULL; + term_mm = NULL; + term_mo = NULL; } /* Attempt to find the arrow keys. */ @@ -643,6 +650,19 @@ terminal_initialize_terminal (terminal_name) term_kP = tgetstr ("kP", &buffer); term_kN = tgetstr ("kN", &buffer); +#if defined(INFOKEY) + term_kh = tgetstr ("kh", &buffer); + term_ke = tgetstr ("@7", &buffer); + term_ki = tgetstr ("kI", &buffer); + term_kx = tgetstr ("kD", &buffer); +#endif /* defined(INFOKEY) */ + + /* Home and end keys. */ + term_kh = tgetstr ("kh", &buffer); + term_ke = tgetstr ("@7", &buffer); + + term_kD = tgetstr ("kD", &buffer); + /* If this terminal is not cursor addressable, then it is really dumb. */ if (!term_goto) terminal_is_dumb_p = 1; @@ -736,11 +756,22 @@ terminal_prep_terminal () #endif /* VLNEXT */ #endif /* TERMIOS or TERMIO */ +/* cf. emacs/src/sysdep.c for being sure output is on. */ #if defined (HAVE_TERMIOS_H) + /* linux kernel 2.2.x needs a TCOFF followed by a TCOON to turn output + back on if the user presses ^S at the very beginning; just a TCOON + doesn't work. --Kevin Ryde , 16jun2000. */ tcsetattr (tty, TCSANOW, &ttybuff); +# ifdef TCOON + tcflow (tty, TCOOFF); + tcflow (tty, TCOON); +# endif #else # if defined (HAVE_TERMIO_H) ioctl (tty, TCSETA, &ttybuff); +# ifdef TCXONC + ioctl (tty, TCXONC, 1); +# endif # endif #endif diff --git a/contrib/texinfo/makeinfo/makeinfo.c b/contrib/texinfo/makeinfo/makeinfo.c index 5f042bc6b146..5bd7ff46c367 100644 --- a/contrib/texinfo/makeinfo/makeinfo.c +++ b/contrib/texinfo/makeinfo/makeinfo.c @@ -1,7 +1,8 @@ +/* $FreeBSD$ */ /* makeinfo -- convert Texinfo source into other formats. - $Id: makeinfo.c,v 1.171 1999/09/19 15:24:44 karl Exp $ + $Id: makeinfo.c,v 1.195 2002/02/11 17:12:49 karl Exp $ - Copyright (C) 1987, 92, 93, 94, 95, 96, 97, 98, 99 + Copyright (C) 1987, 92, 93, 94, 95, 96, 97, 98, 99, 2000, 01, 02 Free Software Foundation, Inc. This program is free software; you can redistribute it and/or modify @@ -34,34 +35,7 @@ #include "macro.h" #include "node.h" #include "toc.h" - -/* We'd like to take advantage of _doprnt if it's around, a la error.c, - but then we'd have no VA_SPRINTF. */ -#if HAVE_VPRINTF -# if __STDC__ -# include -# define VA_START(args, lastarg) va_start(args, lastarg) -# else -# include -# define VA_START(args, lastarg) va_start(args) -# endif -# define VA_FPRINTF(file, fmt, ap) vfprintf (file, fmt, ap) -# define VA_SPRINTF(str, fmt, ap) vsprintf (str, fmt, ap) -#else /* not HAVE_VPRINTF */ -# define VA_START(args, lastarg) -# define va_alist a1, a2, a3, a4, a5, a6, a7, a8 -# define va_dcl char *a1, *a2, *a3, *a4, *a5, *a6, *a7, *a8; -# define va_end(args) -#endif - -/* DJGPP supports /dev/null, which is okay for Unix aficionados, - shell scripts and Makefiles, but interactive DOS die-hards - would probably want to have NUL as well. */ -#ifdef __DJGPP__ -# define ALSO_NULL_DEVICE "NUL" -#else -# define ALSO_NULL_DEVICE "" -#endif +#include "xml.h" /* You can change some of the behavior of Makeinfo by changing the following defines: */ @@ -157,6 +131,9 @@ int insertion_paragraph_closed = 0; /* Nonzero means attempt to make all of the lines have fill_column width. */ int do_justification = 0; +/* Nonzero means don't replace whitespace with   in HTML mode. */ +int in_html_elt = 0; + typedef struct brace_element { struct brace_element *next; @@ -262,7 +239,38 @@ error (format, va_alist) putc ('\n', stderr); } -/* Just like error (), but print the line number as well. */ +/* Just like error (), but print the input file and line number as well. */ +void +#if defined (VA_FPRINTF) && __STDC__ +file_line_error (char *infile, int lno, char *format, ...) +#else +file_line_error (infile, lno, format, va_alist) + char *infile; + int lno; + char *format; + va_dcl +#endif +{ +#ifdef VA_FPRINTF + va_list ap; +#endif + + remember_error (); + fprintf (stderr, "%s:%d: ", infile, lno); + + VA_START (ap, format); +#ifdef VA_FPRINTF + VA_FPRINTF (stderr, format, ap); +#else + fprintf (stderr, format, a1, a2, a3, a4, a5, a6, a7, a8); +#endif /* not VA_FPRINTF */ + va_end (ap); + + fprintf (stderr, ".\n"); +} + +/* Just like file_line_error (), but take the input file and the line + number from global variables. */ void #if defined (VA_FPRINTF) && __STDC__ line_error (char *format, ...) @@ -362,68 +370,106 @@ usage (exit_value) fprintf (stderr, _("Try `%s --help' for more information.\n"), progname); else { - printf (_("Usage: %s [OPTION]... TEXINFO-FILE...\n\ -\n\ -Translate Texinfo source documentation to various other formats:\n\ -Info files suitable for reading online with Emacs or standalone GNU Info\n\ -(by default); plain text (with --no-headers); or HTML (with --html).\n\ -\n\ -Options:\n\ - --commands-in-node-names allow @ commands in node names.\n\ - -D VAR define a variable, as with @set.\n\ - -E, --macro-expand FILE output macro-expanded source to FILE.\n\ - --error-limit=NUM quit after NUM errors (default %d).\n\ - --fill-column=NUM break Info lines at NUM characters (default %d).\n\ - --footnote-style=STYLE output footnotes according to STYLE:\n\ - `separate' to place footnotes in their own node,\n\ - `end' to place the footnotes at the end of the\n\ - node in which they are defined (the default).\n\ - --force preserve output even if errors.\n\ - --help display this help and exit.\n\ - --html output HTML rather than Info format;\n\ - -I DIR append DIR to the @include search path.\n\ - --ifhtml process @ifhtml and @html text even when not\n\ - generating HTML.\n\ - --ifinfo process @ifinfo text even when generating HTML.\n\ - --iftex process @iftex and @tex text.\n\ - implies --no-split.\n"), - progname, max_error_level, fill_column); - printf (_("\ - --no-headers suppress Info node separators and Node: lines and\n\ - write to standard output without --output.\n\ - --no-ifhtml do not process @ifhtml and @html text.\n\ - --no-ifinfo do not process @ifinfo text.\n\ - --no-iftex do not process @iftex and @tex text.\n\ - --no-split suppress splitting of large Info output files or\n\ - generation of one HTML file per node.\n\ - --no-validate suppress node cross-reference validation.\n\ - --no-warn suppress warnings (but not errors).\n\ - --number-sections include chapter, section, etc. numbers in output.\n\ - -o, --output=FILE output to FILE, ignoring any @setfilename.\n\ - -P DIR prepend DIR to the @include search path.\n\ - --paragraph-indent=VAL indent Info paragraphs by VAL spaces (default %d).\n\ - if VAL is `none', do not indent;\n\ - if VAL is `asis', preserve existing indentation.\n\ - --reference-limit=NUM warn about at most NUM references (default %d).\n\ - -U VAR undefine a variable, as with @clear.\n\ - -v, --verbose explain what is being done.\n\ - --version display version information and exit.\n\ -"), - paragraph_start_indent, reference_warning_limit); - } + printf (_("Usage: %s [OPTION]... TEXINFO-FILE...\n"), progname); + printf ("\n"); + /* xgettext: no-wrap */ + puts (_("\ +Translate Texinfo source documentation to various other formats, by default\n\ +Info files suitable for reading online with Emacs or standalone GNU Info.\n")); - puts (_("\n\ -The defaults for the @if... conditionals depend on the output format:\n\ -if generating HTML, --ifhtml is on and the others are off;\n\ -if generating Info or plain text, --ifinfo is on and the others are off.\n\ -\n\ + /* xgettext: no-wrap */ + printf (_("\ +General options:\n\ + --error-limit=NUM quit after NUM errors (default %d).\n\ + --force preserve output even if errors.\n\ + --help display this help and exit.\n\ + --no-validate suppress node cross-reference validation.\n\ + --no-warn suppress warnings (but not errors).\n\ + --reference-limit=NUM warn about at most NUM references (default %d).\n\ + -v, --verbose explain what is being done.\n\ + --version display version information and exit.\n"), + max_error_level, reference_warning_limit); + printf ("\n"); + + /* xgettext: no-wrap */ + puts (_("\ +Output format selection (default is to produce Info):\n\ + --docbook output DocBook rather than Info.\n\ + --html output HTML rather than Info.\n\ + --no-headers output plain text, suppressing Info node\n\ + separators and Node: lines; also, write to\n\ + standard output without --output.\n\ + --xml output XML (TexinfoML) rather than Info.\n\ +")); + + puts (_("\ +General output options:\n\ + -E, --macro-expand FILE output macro-expanded source to FILE.\n\ + ignoring any @setfilename.\n\ + --no-split suppress splitting of Info or HTML output,\n\ + generate only one output file.\n\ + --number-sections output chapter and sectioning numbers.\n\ + -o, --output=FILE output to FILE (directory if split HTML),\n\ +")); + + /* xgettext: no-wrap */ + printf (_("\ +Options for Info and plain text:\n\ + --enable-encoding output accented and special characters in\n\ + Info output based on @documentencoding.\n\ + --fill-column=NUM break Info lines at NUM characters (default %d).\n\ + --footnote-style=STYLE output footnotes in Info according to STYLE:\n\ + `separate' to put them in their own node;\n\ + `end' to put them at the end of the node\n\ + in which they are defined (default).\n\ + --paragraph-indent=VAL indent Info paragraphs by VAL spaces (default %d).\n\ + If VAL is `none', do not indent; if VAL is\n\ + `asis', preserve existing indentation.\n\ + --split-size=NUM split Info files at size NUM (default %d).\n"), + fill_column, paragraph_start_indent, + DEFAULT_SPLIT_SIZE); + } + printf ("\n"); + + /* xgettext: no-wrap */ + puts (_("\ +Input file options:\n\ + --commands-in-node-names allow @ commands in node names.\n\ + -D VAR define the variable VAR, as with @set.\n\ + -I DIR append DIR to the @include search path.\n\ + -P DIR prepend DIR to the @include search path.\n\ + -U VAR undefine the variable VAR, as with @clear.\n\ +")); + /* xgettext: no-wrap */ + puts (_("\ +Conditional processing in input:\n\ + --ifhtml process @ifhtml and @html even if not generating HTML.\n\ + --ifinfo process @ifinfo text even when generating HTML.\n\ + --iftex process @iftex and @tex text; implies --no-split.\n\ + --no-ifhtml do not process @ifhtml and @html text.\n\ + --no-ifinfo do not process @ifinfo text.\n\ + --no-iftex do not process @iftex and @tex text.\n\ +")); + + /* xgettext: no-wrap */ + puts (_("\ + The defaults for the @if... conditionals depend on the output format:\n\ + if generating HTML, --ifhtml is on and the others are off;\n\ + if generating Info or plain text, --ifinfo is on and the others are off.\n\ +")); + + /* xgettext: no-wrap */ + puts (_("\ Examples:\n\ - makeinfo foo.texi write Info to foo's @setfilename\n\ - makeinfo --html foo.texi write HTML to foo's @setfilename\n\ - makeinfo --no-headers -o - foo.texi write plain text to standard output\n\ - makeinfo --number-sections foo.texi write Info with numbered sections\n\ - makeinfo --no-split foo.texi write one Info file however big\n\ -\n\ + makeinfo foo.texi write Info to foo's @setfilename\n\ + makeinfo --html foo.texi write HTML to foo's @setfilename\n\ + makeinfo --no-headers -o - foo.texi write plain text to standard output\n\ + makeinfo --number-sections foo.texi write Info with numbered sections\n\ + makeinfo --no-split foo.texi write one Info file however big\n\ +")); + + /* xgettext: no-wrap */ + puts (_("\ Email bug reports to bug-texinfo@gnu.org,\n\ general questions and discussion to help-texinfo@gnu.org.")); xexit (exit_value); @@ -432,6 +478,8 @@ general questions and discussion to help-texinfo@gnu.org.")); struct option long_options[] = { { "commands-in-node-names", 0, &expensive_validation, 1 }, + { "docbook", 0, 0, 'd' }, + { "enable-encoding", 0, &enable_encoding, 1 }, { "error-limit", 1, 0, 'e' }, { "fill-column", 1, 0, 'f' }, { "footnote-style", 1, 0, 's' }, @@ -457,8 +505,10 @@ struct option long_options[] = { "output", 1, 0, 'o' }, { "paragraph-indent", 1, 0, 'p' }, { "reference-limit", 1, 0, 'r' }, + { "split-size", 1, 0, 'S'}, { "verbose", 0, &verbose_mode, 1 }, { "version", 0, 0, 'V' }, + { "xml", 0, 0, 'x' }, {NULL, 0, NULL, 0} }; @@ -487,7 +537,7 @@ main (argc, argv) textdomain (PACKAGE); /* Parse argument flags from the input line. */ - while ((c = getopt_long (argc, argv, "D:e:E:f:hI:o:p:P:r:s:U:vV:w", + while ((c = getopt_long (argc, argv, "D:de:E:f:hI:o:p:P:r:s:U:vV:wx", long_options, &ind)) != EOF) { if (c == 0 && long_options[ind].flag == 0) @@ -501,13 +551,19 @@ main (argc, argv) handle_variable_internal ((c == 'D') ? SET : CLEAR, optarg); break; + case 'd': /* --docbook */ + splitting = 0; + xml = 1; + docbook = 1; + break; + case 'e': /* --error-limit */ if (sscanf (optarg, "%d", &max_error_level) != 1) { fprintf (stderr, _("%s: %s arg must be numeric, not `%s'.\n"), "--error-limit", progname, optarg); - usage (stderr, 1); + usage (1); } break; @@ -606,6 +662,16 @@ main (argc, argv) footnote_style_preset = 1; break; + case 'S': /* --split-size */ + if (sscanf (optarg, "%d", &split_size) != 1) + { + fprintf (stderr, + _("%s: %s arg must be numeric, not `%s'.\n"), + "--split-size", progname, optarg); + usage (1); + } + break; + case 'v': verbose_mode++; break; @@ -617,7 +683,7 @@ main (argc, argv) There is NO warranty. You may redistribute this software\n\ under the terms of the GNU General Public License.\n\ For more information about these matters, see the files named COPYING.\n"), - "1999"); + "2002"); exit (0); break; @@ -625,9 +691,13 @@ For more information about these matters, see the files named COPYING.\n"), html = 1; process_html = 1; process_info = 0; - splitting = 0; /* too complicated for now */ break; + case 'x': /* --xml */ + splitting = 0; + xml = 1; + break; + case '?': usage (1); break; @@ -971,6 +1041,7 @@ get_rest_of_line (expand, string) int expand; char **string; { + xml_no_para ++; if (expand) { char *tem; @@ -993,6 +1064,7 @@ get_rest_of_line (expand, string) line_number++; input_text_offset++; } + xml_no_para --; } /* Backup the input pointer to the previous character, keeping track @@ -1020,10 +1092,21 @@ get_until_in_braces (match, string) for (i = input_text_offset; i < input_text_length; i++) { - if (input_text[i] == '{') + if (i < input_text_length - 1 && input_text[i] == '@') + { + i++; /* skip commands like @, and @{ */ + continue; + } + else if (input_text[i] == '{') brace++; else if (input_text[i] == '}') - brace--; + { + brace--; + /* If looking for a brace, don't stop at the interior brace, + like after "baz" in "@foo{something @bar{baz} more}". */ + if (brace == 0) + continue; + } else if (input_text[i] == '\n') line_number++; @@ -1191,6 +1274,77 @@ convert_from_file (name) convert_from_loaded_file (name); } +/* Given OUTPUT_FILENAME == ``/foo/bar/baz.html'', return + ``/foo/bar/baz/baz.html''. + + Split html output goes into the subdirectory of the toplevel + filename, without extension. For example: + + @setfilename foo.info + + produces output in files foo/index.html, foo/second-node.html, .... */ + +static char * +insert_toplevel_subdirectory (output_filename) + char *output_filename; +{ + char *dir, *subdir, *base, *basename, *p; + char buf[PATH_MAX]; + int max_name_len; + static const char index_name[] = "index.html"; + const int index_len = sizeof (index_name) - 1; + + strcpy (buf, output_filename); + dir = pathname_part (buf); + base = filename_part (buf); + basename = xstrdup (base); /* remember real @setfilename name */ + p = dir + strlen (dir) - 1; + if (p > dir && IS_SLASH (*p)) + *p = 0; + p = strrchr (base, '.'); + if (p) + *p = 0; + + /* Split html output goes into subdirectory of toplevel name. */ + subdir = ""; + if (FILENAME_CMP (base, filename_part (dir)) != 0) + subdir = base; + + max_name_len = strlen (basename); + if (index_len > max_name_len) + max_name_len = index_len; + + free (output_filename); + output_filename = xmalloc (strlen (dir) + 1 + + strlen (subdir) + 1 + + max_name_len + + 1); + strcpy (output_filename, dir); + if (strlen (dir)) + strcat (output_filename, "/"); + strcat (output_filename, subdir); + if (mkdir (output_filename, 0777) == -1 && errno != EEXIST) + { /* that failed, try subdir name with .html */ + strcpy (output_filename, dir); + if (strlen (dir)) + strcat (output_filename, "/"); + strcat (output_filename, basename); + if (mkdir (output_filename, 0777) == -1 && errno != EEXIST) + { + line_error (_("Can't create directory `%s': %s"), + output_filename, + strerror (errno)); + exit (1); + } + strcat (output_filename, "/"); + } + else if (strlen (subdir)) + strcat (output_filename, "/"); + strcat (output_filename, index_name); + return output_filename; +} + +/* FIXME: this is way too hairy */ void convert_from_loaded_file (name) char *name; @@ -1260,12 +1414,15 @@ convert_from_loaded_file (name) if (!command_output_filename) { get_until ("\n", &output_filename); /* read rest of line */ - if (html) - { /* Change any extension to .html. */ + if (xml && !docbook) + xml_begin_document (output_filename); + if (html || xml) + { /* Change any extension to .html or .xml. */ char *html_name, *directory_part, *basename_part, *temp; canon_white (output_filename); directory_part = pathname_part (output_filename); + basename_part = filename_part (output_filename); /* Zap any existing extension. */ @@ -1278,7 +1435,7 @@ convert_from_loaded_file (name) + strlen (basename_part) + 6); strcpy (html_name, directory_part); strcat (html_name, basename_part); - strcat (html_name, ".html"); + strcat (html_name, html ? ".html" : ".xml"); /* Replace name from @setfilename with the html name. */ free (output_filename); @@ -1297,13 +1454,15 @@ convert_from_loaded_file (name) } canon_white (output_filename); + toplevel_output_filename = xstrdup (output_filename); if (real_output_filename && strcmp (real_output_filename, "-") == 0) { if (macro_expansion_filename && strcmp (macro_expansion_filename, "-") == 0) { - fprintf (stderr, _("%s: Skipping macro expansion to stdout as Info output is going there.\n"), + fprintf (stderr, + _("%s: Skipping macro expansion to stdout as Info output is going there.\n"), progname); macro_expansion_output_stream = NULL; } @@ -1313,7 +1472,16 @@ convert_from_loaded_file (name) } else { - if (!real_output_filename) + if (html && splitting) + { + if (FILENAME_CMP (output_filename, NULL_DEVICE) == 0 + || FILENAME_CMP (output_filename, ALSO_NULL_DEVICE) == 0) + splitting = 0; + else + output_filename = insert_toplevel_subdirectory (output_filename); + real_output_filename = xstrdup (output_filename); + } + else if (!real_output_filename) real_output_filename = expand_filename (output_filename, name); else real_output_filename = xstrdup (real_output_filename); @@ -1325,7 +1493,10 @@ convert_from_loaded_file (name) if (verbose_mode) printf (_("Making %s file `%s' from `%s'.\n"), - no_headers ? "text" : (html ? "HTML" : "info"), + no_headers ? "text" + : html ? "HTML" + : xml ? "XML" + : "info", output_filename, input_filename); if (output_stream == NULL) @@ -1336,6 +1507,7 @@ convert_from_loaded_file (name) /* Make the displayable filename from output_filename. Only the base portion of the filename need be displayed. */ + flush_output (); /* in case there was no @bye */ if (output_stream != stdout) pretty_output_filename = filename_part (output_filename); else @@ -1354,12 +1526,15 @@ convert_from_loaded_file (name) } /* html fixxme: should output this as trailer on first page. */ - if (!no_headers && !html) + if (!no_headers && !html && !xml) add_word_args (_("This is %s, produced by makeinfo version %s from %s.\n"), output_filename, VERSION, input_filename); close_paragraph (); reader_loop (); + if (xml) + xml_end_document (); + finished: discard_insertions (0); @@ -1398,6 +1573,7 @@ convert_from_loaded_file (name) close_paragraph (); } + flush_output (); /* in case there was no @bye */ if (output_stream != stdout) fclose (output_stream); @@ -1410,7 +1586,7 @@ convert_from_loaded_file (name) toc_update (); if (splitting && !html && (!errors_printed || force)) - split_file (real_output_filename, 0); + split_file (real_output_filename, split_size); else if (errors_printed && !force && strcmp (real_output_filename, "-") != 0 @@ -1542,6 +1718,10 @@ handle_menu_entry () input_text_offset++; /* discard the second colon or the period */ add_word (": "); } + else if (xml && tem) + { + xml_start_menu_entry (tem); + } else if (tem) { /* For Info output, we can just use the input and the main case in reader_loop where we output what comes in. Just move off the * @@ -1774,6 +1954,8 @@ reader_loop () case '<': if (html && escape_html) add_word ("<"); + else if (xml) + xml_insert_entity ("lt"); else add_char (character); input_text_offset++; @@ -1782,6 +1964,8 @@ reader_loop () case '>': if (html && escape_html) add_word (">"); + else if (xml) + xml_insert_entity ("gt"); else add_char (character); input_text_offset++; @@ -1799,8 +1983,16 @@ reader_loop () we can ignore its partner. */ if (!only_macro_expansion) { - line_error (_("Misplaced %c"), '{'); - remember_brace (misplaced_brace); + if (!STREQ (command, "math")) + { + line_error (_("Misplaced %c"), '{'); + remember_brace (misplaced_brace); + } + else + { /* We don't mind `extra' braces inside @math. */ + extern void cm_no_op (); + remember_brace (cm_no_op); + } /* remember_brace advances input_text_offset. */ break; } @@ -1851,7 +2043,7 @@ remember_brace_1 (proc, position) BRACE_ELEMENT *new = xmalloc (sizeof (BRACE_ELEMENT)); new->next = brace_stack; new->proc = proc; - new->command = xstrdup (command); + new->command = command ? xstrdup (command) : ""; new->pos = position; new->line = line_number; new->in_fixed_width_font = in_fixed_width_font; @@ -1933,12 +2125,11 @@ discard_braces () if (brace_stack->proc != misplaced_brace) { char *proc_name; - int temp_line_number = line_number; - line_number = brace_stack->line; proc_name = find_proc_name (brace_stack->proc); - line_error (_("%c%s missing close brace"), COMMAND_PREFIX, proc_name); - line_number = temp_line_number; + file_line_error (input_filename, brace_stack->line, + _("%c%s missing close brace"), COMMAND_PREFIX, + proc_name); pop_and_call_brace (); } else @@ -2018,12 +2209,30 @@ add_word (string) add_char (*string++); } +/* Like add_word, but inhibits conversion of whitespace into  . + Use this to output HTML directives with embedded blanks, to make + them @w-safe. */ +void +add_html_elt (string) + char *string; +{ + in_html_elt++; + add_word (string); + in_html_elt--; +} + /* Add the character to the current paragraph. If filling_enabled is nonzero, then do filling as well. */ void add_char (character) int character; { + if (xml) + { + xml_add_char (character); + return; + } + /* If we are avoiding outputting headers, and we are currently in a menu, then simply return. But if we're only expanding macros, then we're being called from glean_node_from_menu to try to @@ -2044,9 +2253,11 @@ add_char (character) } } - if (non_splitting_words && strchr (" \t\n", character)) + if (non_splitting_words + && !(html && in_html_elt) + && strchr (" \t\n", character)) { - if (html) + if (html || docbook) { /* Seems cleaner to use   than an 8-bit char. */ add_word (" "); character = ';'; @@ -2117,6 +2328,14 @@ add_char (character) } } + /* This is sad, but it seems desirable to not force any + particular order on the front matter commands. This way, + the document can do @settitle, @documentlanguage, etc, in + any order and with any omissions, and we'll still output + the html `just in time'. */ + if (!executing_string && html && !html_output_head_p) + html_output_head (); + if (!paragraph_is_open) { start_paragraph (); @@ -2263,13 +2482,6 @@ void insert (character) int character; { - /* This is sad, but it seems desirable to not force any particular - order on the front matter commands. This way, the document can do - @settitle, @documentlanguage, etc, in any order and with any - omissions, and we'll still output the html `just in time'. */ - if (!executing_string && html && !html_output_head_p) - html_output_head (); - output_paragraph[output_paragraph_offset++] = character; if (output_paragraph_offset == paragraph_buffer_len) { @@ -2701,7 +2913,68 @@ cm_xref (arg) char *arg5 = get_xref_token (0); char *tem; - if (html) + /* "@xref{,Foo,, Bar, Baz} is not valid usage of @xref. The + first argument must never be blank." --rms. + We hereby comply by disallowing such constructs. */ + if (!*arg1) + line_error (_("First argument to cross-reference may not be empty")); + + if (xml && docbook) + { + if (!*arg4 && !*arg5) + { + char *arg1_id = xml_id (arg1); + if (*arg2) + { + xml_insert_element_with_attribute (XREFNODENAME, START, + "linkend=\"%s\"", arg1_id); + free (arg1_id); + if (*arg2) + execute_string (arg2); + xml_insert_element (XREFNODENAME, END); + } + else + { + xml_insert_element_with_attribute (XREF, START, + "linkend=\"%s\"", arg1_id); + free (arg1_id); + xml_pop_current_element (); + } + } + } + else if (xml) + { + xml_insert_element (XREF, START); + xml_insert_element (XREFNODENAME, START); + execute_string (arg1); + xml_insert_element (XREFNODENAME, END); + if (*arg2) + { + xml_insert_element (XREFINFONAME, START); + execute_string (arg2); + xml_insert_element (XREFINFONAME, END); + } + if (*arg3) + { + xml_insert_element (XREFPRINTEDDESC, START); + execute_string (arg3); + xml_insert_element (XREFPRINTEDDESC, END); + } + if (*arg4) + { + xml_insert_element (XREFINFOFILE, START); + execute_string (arg4); + xml_insert_element (XREFINFOFILE, END); + } + if (*arg5) + { + xml_insert_element (XREFPRINTEDNAME, START); + execute_string (arg5); + xml_insert_element (XREFPRINTEDNAME, END); + } + xml_insert_element (XREF, END); + } + else if (html) { if (!ref_flag) add_word_args ("%s", px_ref_flag ? _("see ") : _("See ")); @@ -2709,109 +2982,126 @@ cm_xref (arg) else add_word_args ("%s", px_ref_flag ? "*note " : "*Note "); - if (*arg5 || *arg4) - { - char *node_name; + if (!xml) + { + if (*arg5 || *arg4) + { + /* arg1 - node name + arg2 - reference name + arg3 - title or topic (and reference name if arg2 is NULL) + arg4 - info file name + arg5 - printed manual title */ + char *ref_name; - if (!*arg2) - { - if (*arg3) - node_name = arg3; - else - node_name = arg1; - } - else - node_name = arg2; + if (!*arg2) + { + if (*arg3) + ref_name = arg3; + else + ref_name = arg1; + } + else + ref_name = arg2; - if (html) - { - /* html fixxme: revisit this; external node name not - much use to us with numbered nodes. */ - add_word (""); - execute_string ("%s", arg1); - add_word (""); - } - else - { - execute_string ("%s:", node_name); - in_fixed_width_font++; - execute_string (" (%s)%s%s", arg4, arg1, px_ref_flag ? "." : ""); - in_fixed_width_font--; - } + if (html) + { + /* html fixxme: revisit this; external node name not + much use to us with numbered nodes. */ + add_html_elt (""); + execute_string ("%s", ref_name); + add_word (""); + } + else + { + execute_string ("%s:", ref_name); + in_fixed_width_font++; + execute_string (" (%s)%s%s", arg4, arg1, px_ref_flag ? "." : ""); + in_fixed_width_font--; + } - /* Free all of the arguments found. */ - if (arg1) free (arg1); - if (arg2) free (arg2); - if (arg3) free (arg3); - if (arg4) free (arg4); - if (arg5) free (arg5); - return; - } - else - remember_node_reference (arg1, line_number, followed_reference); - - if (*arg3) - { - if (html) - { - add_word (""); - execute_string ("%s", *arg2 ? arg2 : arg3); - add_word (""); - } - else - { - execute_string ("%s:", *arg2 ? arg2 : arg3); - in_fixed_width_font++; - execute_string (" %s%s", arg1, px_ref_flag ? "." : ""); - in_fixed_width_font--; - } - } - else - { - if (html) - { - add_word (""); - execute_string ("%s", *arg2 ? arg2 : arg1); - add_word (""); - } - else - { - if (*arg2) - { - execute_string ("%s:", arg2); - in_fixed_width_font++; - execute_string (" %s%s", arg1, px_ref_flag ? "." : ""); - in_fixed_width_font--; - } - else - { - in_fixed_width_font++; - execute_string ("%s::", arg1); - in_fixed_width_font--; - } - } - } + /* Free all of the arguments found. */ + if (arg1) free (arg1); + if (arg2) free (arg2); + if (arg3) free (arg3); + if (arg4) free (arg4); + if (arg5) free (arg5); + return; + } + else + remember_node_reference (arg1, line_number, followed_reference); + if (*arg3) + { + if (html) + { + add_html_elt (""); + execute_string ("%s", *arg2 ? arg2 : arg3); + add_word (""); + } + else + { + execute_string ("%s:", *arg2 ? arg2 : arg3); + in_fixed_width_font++; + execute_string (" %s%s", arg1, px_ref_flag ? "." : ""); + in_fixed_width_font--; + } + } + else + { + if (html) + { + add_html_elt (""); + execute_string ("%s", *arg2 ? arg2 : arg1); + add_word (""); + } + else + { + if (*arg2) + { + execute_string ("%s:", arg2); + in_fixed_width_font++; + execute_string (" %s%s", arg1, px_ref_flag ? "." : ""); + in_fixed_width_font--; + } + else + { + in_fixed_width_font++; + execute_string ("%s::", arg1); + in_fixed_width_font--; + } + } + } + } /* Free all of the arguments found. */ if (arg1) free (arg1); if (arg2) free (arg2); @@ -2879,15 +3169,45 @@ cm_inforef (arg) char *pname = get_xref_token (0); char *file = get_xref_token (0); - if (html) + /* (see comments at cm_xref). */ + if (!*node) + line_error (_("First argument to @inforef may not be empty")); + + if (xml && !docbook) + { + xml_insert_element (INFOREF, START); + xml_insert_element (INFOREFNODENAME, START); + execute_string (node); + xml_insert_element (INFOREFNODENAME, END); + if (*pname) + { + xml_insert_element (INFOREFREFNAME, START); + execute_string (pname); + xml_insert_element (INFOREFREFNAME, END); + } + xml_insert_element (INFOREFINFONAME, START); + execute_string (file); + xml_insert_element (INFOREFINFONAME, END); + + xml_insert_element (INFOREF, END); + } + else if (html) { + char *tem; + add_word (_("see ")); /* html fixxme: revisit this */ - add_word (""); - execute_string ("%s", pname); + add_html_elt (""); + execute_string ("%s", *pname ? pname : tem); add_word (""); + free (tem); } else { @@ -2915,9 +3235,29 @@ cm_uref (arg) char *desc = get_xref_token (0); char *replacement = get_xref_token (0); - if (html) + if (xml) + { + xml_insert_element (UREF, START); + xml_insert_element (UREFURL, START); + execute_string (url); + xml_insert_element (UREFURL, END); + if (*desc) + { + xml_insert_element (UREFDESC, START); + execute_string (desc); + xml_insert_element (UREFDESC, END); + } + if (*replacement) + { + xml_insert_element (UREFREPLACEMENT, START); + execute_string (replacement); + xml_insert_element (UREFREPLACEMENT, END); + } + xml_insert_element (UREF, END); + } + else if (html) { /* never need to show the url */ - add_word ("", fullname, fullname); + add_html_elt (");
+	  add_word_args (", (*alt_arg) ? alt_arg : fullname); } + else if (xml && docbook) + xml_insert_docbook_image (name_arg); + else if (xml) + { + xml_insert_element (IMAGE, START); + add_word (name_arg); + xml_insert_element (IMAGE, END); + } else { /* Try to open foo.txt. */ FILE *image_file; @@ -3060,8 +3449,8 @@ cm_image (arg) perror (fullname); } else - warning (_("@image file `%s' unreadable: %s"), fullname, - strerror (errno)); + line_error (_("@image file `%s' (for text) unreadable: %s"), + fullname, strerror (errno)); } free (fullname); @@ -3071,6 +3460,10 @@ cm_image (arg) if (name_arg) free (name_arg); + if (alt_arg) + free (alt_arg); + if (ext_arg) + free (ext_arg); } /* Conditionals. */ @@ -3415,13 +3808,9 @@ handle_variable_internal (action, name) } if (!done) - { - int save = line_number; - line_number = orig_line_number; - line_error (_("Reached eof before matching @end %s"), - condition); - line_number = save; - } + file_line_error (input_filename, orig_line_number, + _("Reached eof before matching @end %s"), + condition); /* We found the end of a false @ifset/ifclear. If we are in a menu, back up over the newline that ends the ifset,