summaryrefslogtreecommitdiffstats
path: root/contrib/texinfo
diff options
context:
space:
mode:
authorru <ru@FreeBSD.org>2005-05-23 10:50:32 +0000
committerru <ru@FreeBSD.org>2005-05-23 10:50:32 +0000
commit8b2f0a4d7f08415b66667ee1937a24f1b1333e09 (patch)
treeab8801c7bc6a071e5dfe8c658d4b0ea907acf620 /contrib/texinfo
parentadfa5ff0fcbcb100e0392141216bc92735980e19 (diff)
downloadFreeBSD-src-8b2f0a4d7f08415b66667ee1937a24f1b1333e09.zip
FreeBSD-src-8b2f0a4d7f08415b66667ee1937a24f1b1333e09.tar.gz
Use stock (FSF) version of this file.
Diffstat (limited to 'contrib/texinfo')
-rw-r--r--contrib/texinfo/info/doc.c224
-rw-r--r--contrib/texinfo/info/funs.h224
-rw-r--r--contrib/texinfo/info/infomap.c154
-rw-r--r--contrib/texinfo/info/nodemenu.c38
-rw-r--r--contrib/texinfo/info/session.c649
-rw-r--r--contrib/texinfo/info/signals.c62
-rw-r--r--contrib/texinfo/info/terminal.c67
-rw-r--r--contrib/texinfo/makeinfo/makeinfo.c1705
8 files changed, 1452 insertions, 1671 deletions
diff --git a/contrib/texinfo/info/doc.c b/contrib/texinfo/info/doc.c
index 4ca2266..324219e 100644
--- a/contrib/texinfo/info/doc.c
+++ b/contrib/texinfo/info/doc.c
@@ -1,7 +1,7 @@
/* doc.c -- Generated structure containing function names and doc strings.
This file was automatically made from various source files with the
- command "./makedoc". DO NOT EDIT THIS FILE, only "./makedoc.c".
+ command `..//info/makedoc'. DO NOT EDIT THIS FILE, only `..//info/makedoc.c'.
Source files groveled to make this file include:
./session.c
@@ -24,123 +24,123 @@
FUNCTION_DOC function_doc_array[] = {
/* Commands found in "./session.c". */
- { 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]" },
+ { (VFunction *)info_next_line, "next-line", (FUNCTION_KEYSEQ *)0, "Move down to the next line" },
+ { (VFunction *)info_prev_line, "prev-line", (FUNCTION_KEYSEQ *)0, "Move up to the previous line" },
+ { (VFunction *)info_end_of_line, "end-of-line", (FUNCTION_KEYSEQ *)0, "Move to the end of the line" },
+ { (VFunction *)info_beginning_of_line, "beginning-of-line", (FUNCTION_KEYSEQ *)0, "Move to the start of the line" },
+ { (VFunction *)info_forward_char, "forward-char", (FUNCTION_KEYSEQ *)0, "Move forward a character" },
+ { (VFunction *)info_backward_char, "backward-char", (FUNCTION_KEYSEQ *)0, "Move backward a character" },
+ { (VFunction *)info_forward_word, "forward-word", (FUNCTION_KEYSEQ *)0, "Move forward a word" },
+ { (VFunction *)info_backward_word, "backward-word", (FUNCTION_KEYSEQ *)0, "Move backward a word" },
+ { (VFunction *)info_global_next_node, "global-next-node", (FUNCTION_KEYSEQ *)0, "Move forwards or down through node structure" },
+ { (VFunction *)info_global_prev_node, "global-prev-node", (FUNCTION_KEYSEQ *)0, "Move backwards or up through node structure" },
+ { (VFunction *)info_scroll_forward, "scroll-forward", (FUNCTION_KEYSEQ *)0, "Scroll forward in this window" },
+ { (VFunction *)info_scroll_forward_set_window, "scroll-forward-set-window", (FUNCTION_KEYSEQ *)0, "Scroll forward in this window and set default window size" },
+ { (VFunction *)info_scroll_forward_page_only, "scroll-forward-page-only", (FUNCTION_KEYSEQ *)0, "Scroll forward in this window staying within node" },
+ { (VFunction *)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" },
+ { (VFunction *)info_scroll_backward, "scroll-backward", (FUNCTION_KEYSEQ *)0, "Scroll backward in this window" },
+ { (VFunction *)info_scroll_backward_set_window, "scroll-backward-set-window", (FUNCTION_KEYSEQ *)0, "Scroll backward in this window and set default window size" },
+ { (VFunction *)info_scroll_backward_page_only, "scroll-backward-page-only", (FUNCTION_KEYSEQ *)0, "Scroll backward in this window staying within node" },
+ { (VFunction *)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" },
+ { (VFunction *)info_beginning_of_node, "beginning-of-node", (FUNCTION_KEYSEQ *)0, "Move to the start of this node" },
+ { (VFunction *)info_end_of_node, "end-of-node", (FUNCTION_KEYSEQ *)0, "Move to the end of this node" },
+ { (VFunction *)info_down_line, "down-line", (FUNCTION_KEYSEQ *)0, "Scroll down by lines" },
+ { (VFunction *)info_up_line, "up-line", (FUNCTION_KEYSEQ *)0, "Scroll up by lines" },
+ { (VFunction *)info_scroll_half_screen_down, "scroll-half-screen-down", (FUNCTION_KEYSEQ *)0, "Scroll down by half screen size" },
+ { (VFunction *)info_scroll_half_screen_up, "scroll-half-screen-up", (FUNCTION_KEYSEQ *)0, "Scroll up by half screen size" },
+ { (VFunction *)info_next_window, "next-window", (FUNCTION_KEYSEQ *)0, "Select the next window" },
+ { (VFunction *)info_prev_window, "prev-window", (FUNCTION_KEYSEQ *)0, "Select the previous window" },
+ { (VFunction *)info_split_window, "split-window", (FUNCTION_KEYSEQ *)0, "Split the current window" },
+ { (VFunction *)info_delete_window, "delete-window", (FUNCTION_KEYSEQ *)0, "Delete the current window" },
+ { (VFunction *)info_keep_one_window, "keep-one-window", (FUNCTION_KEYSEQ *)0, "Delete all other windows" },
+ { (VFunction *)info_scroll_other_window, "scroll-other-window", (FUNCTION_KEYSEQ *)0, "Scroll the other window" },
+ { (VFunction *)info_scroll_other_window_backward, "scroll-other-window-backward", (FUNCTION_KEYSEQ *)0, "Scroll the other window backward" },
+ { (VFunction *)info_grow_window, "grow-window", (FUNCTION_KEYSEQ *)0, "Grow (or shrink) this window" },
+ { (VFunction *)info_tile_windows, "tile-windows", (FUNCTION_KEYSEQ *)0, "Divide the available screen space among the visible windows" },
+ { (VFunction *)info_toggle_wrap, "toggle-wrap", (FUNCTION_KEYSEQ *)0, "Toggle the state of line wrapping in the current window" },
+ { (VFunction *)info_next_node, "next-node", (FUNCTION_KEYSEQ *)0, "Select the Next node" },
+ { (VFunction *)info_prev_node, "prev-node", (FUNCTION_KEYSEQ *)0, "Select the Prev node" },
+ { (VFunction *)info_up_node, "up-node", (FUNCTION_KEYSEQ *)0, "Select the Up node" },
+ { (VFunction *)info_last_node, "last-node", (FUNCTION_KEYSEQ *)0, "Select the last node in this file" },
+ { (VFunction *)info_first_node, "first-node", (FUNCTION_KEYSEQ *)0, "Select the first node in this file" },
+ { (VFunction *)info_last_menu_item, "last-menu-item", (FUNCTION_KEYSEQ *)0, "Select the last item in this node's menu" },
+ { (VFunction *)info_menu_digit, "menu-digit", (FUNCTION_KEYSEQ *)0, "Select this menu item" },
+ { (VFunction *)info_menu_item, "menu-item", (FUNCTION_KEYSEQ *)0, "Read a menu item and select its node" },
+ { (VFunction *)info_xref_item, "xref-item", (FUNCTION_KEYSEQ *)0, "Read a footnote or cross reference and select its node" },
+ { (VFunction *)info_find_menu, "find-menu", (FUNCTION_KEYSEQ *)0, "Move to the start of this node's menu" },
+ { (VFunction *)info_visit_menu, "visit-menu", (FUNCTION_KEYSEQ *)0, "Visit as many menu items at once as possible" },
+ { (VFunction *)info_goto_node, "goto-node", (FUNCTION_KEYSEQ *)0, "Read a node name and select it" },
+ { (VFunction *)info_menu_sequence, "menu-sequence", (FUNCTION_KEYSEQ *)0, "Read a list of menus starting from dir and follow them" },
+ { (VFunction *)info_goto_invocation_node, "goto-invocation-node", (FUNCTION_KEYSEQ *)0, "Find the node describing program invocation" },
+ { (VFunction *)info_man, "man", (FUNCTION_KEYSEQ *)0, "Read a manpage reference and select it" },
+ { (VFunction *)info_top_node, "top-node", (FUNCTION_KEYSEQ *)0, "Select the node `Top' in this file" },
+ { (VFunction *)info_dir_node, "dir-node", (FUNCTION_KEYSEQ *)0, "Select the node `(dir)'" },
+ { (VFunction *)info_history_node, "history-node", (FUNCTION_KEYSEQ *)0, "Select the most recently selected node" },
+ { (VFunction *)info_kill_node, "kill-node", (FUNCTION_KEYSEQ *)0, "Kill this node" },
+ { (VFunction *)info_view_file, "view-file", (FUNCTION_KEYSEQ *)0, "Read the name of a file and select it" },
+ { (VFunction *)info_print_node, "print-node", (FUNCTION_KEYSEQ *)0, "Pipe the contents of this node through INFO_PRINT_COMMAND" },
+ { (VFunction *)info_search_case_sensitively, "search-case-sensitively", (FUNCTION_KEYSEQ *)0, "Read a string and search for it case-sensitively" },
+ { (VFunction *)info_search, "search", (FUNCTION_KEYSEQ *)0, "Read a string and search for it" },
+ { (VFunction *)info_search_backward, "search-backward", (FUNCTION_KEYSEQ *)0, "Read a string and search backward for it" },
+ { (VFunction *)info_search_next, "search-next", (FUNCTION_KEYSEQ *)0, "Repeat last search in the same direction" },
+ { (VFunction *)info_search_previous, "search-previous", (FUNCTION_KEYSEQ *)0, "Repeat last search in the reverse direction" },
+ { (VFunction *)isearch_forward, "isearch-forward", (FUNCTION_KEYSEQ *)0, "Search interactively for a string as you type it" },
+ { (VFunction *)isearch_backward, "isearch-backward", (FUNCTION_KEYSEQ *)0, "Search interactively for a string as you type it" },
+ { (VFunction *)info_move_to_prev_xref, "move-to-prev-xref", (FUNCTION_KEYSEQ *)0, "Move to the previous cross reference" },
+ { (VFunction *)info_move_to_next_xref, "move-to-next-xref", (FUNCTION_KEYSEQ *)0, "Move to the next cross reference" },
+ { (VFunction *)info_select_reference_this_line, "select-reference-this-line", (FUNCTION_KEYSEQ *)0, "Select reference or menu item appearing on this line" },
+ { (VFunction *)info_abort_key, "abort-key", (FUNCTION_KEYSEQ *)0, "Cancel current operation" },
+ { (VFunction *)info_move_to_window_line, "move-to-window-line", (FUNCTION_KEYSEQ *)0, "Move the cursor to a specific line of the window" },
+ { (VFunction *)info_redraw_display, "redraw-display", (FUNCTION_KEYSEQ *)0, "Redraw the display" },
+ { (VFunction *)info_quit, "quit", (FUNCTION_KEYSEQ *)0, "Quit using Info" },
+ { (VFunction *)info_do_lowercase_version, "do-lowercase-version", (FUNCTION_KEYSEQ *)0, "Run command bound to this key's lowercase variant" },
+ { (VFunction *)info_add_digit_to_numeric_arg, "add-digit-to-numeric-arg", (FUNCTION_KEYSEQ *)0, "Add this digit to the current numeric argument" },
+ { (VFunction *)info_universal_argument, "universal-argument", (FUNCTION_KEYSEQ *)0, "Start (or multiply by 4) the current numeric argument" },
+ { (VFunction *)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", (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" },
+ { (VFunction *)ea_forward, "echo-area-forward", (FUNCTION_KEYSEQ *)0, "Move forward a character" },
+ { (VFunction *)ea_backward, "echo-area-backward", (FUNCTION_KEYSEQ *)0, "Move backward a character" },
+ { (VFunction *)ea_beg_of_line, "echo-area-beg-of-line", (FUNCTION_KEYSEQ *)0, "Move to the start of this line" },
+ { (VFunction *)ea_end_of_line, "echo-area-end-of-line", (FUNCTION_KEYSEQ *)0, "Move to the end of this line" },
+ { (VFunction *)ea_forward_word, "echo-area-forward-word", (FUNCTION_KEYSEQ *)0, "Move forward a word" },
+ { (VFunction *)ea_backward_word, "echo-area-backward-word", (FUNCTION_KEYSEQ *)0, "Move backward a word" },
+ { (VFunction *)ea_delete, "echo-area-delete", (FUNCTION_KEYSEQ *)0, "Delete the character under the cursor" },
+ { (VFunction *)ea_rubout, "echo-area-rubout", (FUNCTION_KEYSEQ *)0, "Delete the character behind the cursor" },
+ { (VFunction *)ea_abort, "echo-area-abort", (FUNCTION_KEYSEQ *)0, "Cancel or quit operation" },
+ { (VFunction *)ea_newline, "echo-area-newline", (FUNCTION_KEYSEQ *)0, "Accept (or force completion of) this line" },
+ { (VFunction *)ea_quoted_insert, "echo-area-quoted-insert", (FUNCTION_KEYSEQ *)0, "Insert next character verbatim" },
+ { (VFunction *)ea_insert, "echo-area-insert", (FUNCTION_KEYSEQ *)0, "Insert this character" },
+ { (VFunction *)ea_tab_insert, "echo-area-tab-insert", (FUNCTION_KEYSEQ *)0, "Insert a TAB character" },
+ { (VFunction *)ea_transpose_chars, "echo-area-transpose-chars", (FUNCTION_KEYSEQ *)0, "Transpose characters at point" },
+ { (VFunction *)ea_yank, "echo-area-yank", (FUNCTION_KEYSEQ *)0, "Yank back the contents of the last kill" },
+ { (VFunction *)ea_yank_pop, "echo-area-yank-pop", (FUNCTION_KEYSEQ *)0, "Yank back a previous kill" },
+ { (VFunction *)ea_kill_line, "echo-area-kill-line", (FUNCTION_KEYSEQ *)0, "Kill to the end of the line" },
+ { (VFunction *)ea_backward_kill_line, "echo-area-backward-kill-line", (FUNCTION_KEYSEQ *)0, "Kill to the beginning of the line" },
+ { (VFunction *)ea_kill_word, "echo-area-kill-word", (FUNCTION_KEYSEQ *)0, "Kill the word following the cursor" },
+ { (VFunction *)ea_backward_kill_word, "echo-area-backward-kill-word", (FUNCTION_KEYSEQ *)0, "Kill the word preceding the cursor" },
+ { (VFunction *)ea_possible_completions, "echo-area-possible-completions", (FUNCTION_KEYSEQ *)0, "List possible completions" },
+ { (VFunction *)ea_complete, "echo-area-complete", (FUNCTION_KEYSEQ *)0, "Insert completion" },
+ { (VFunction *)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", (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" },
+ { (VFunction *)info_get_help_window, "get-help-window", (FUNCTION_KEYSEQ *)0, "Display help message" },
+ { (VFunction *)info_get_info_help_node, "get-info-help-node", (FUNCTION_KEYSEQ *)0, "Visit Info node `(info)Help'" },
+ { (VFunction *)describe_key, "describe-key", (FUNCTION_KEYSEQ *)0, "Print documentation for KEY" },
+ { (VFunction *)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", (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" },
+ { (VFunction *)describe_command, "describe-command", (FUNCTION_KEYSEQ *)0, "Read the name of an Info command and describe it" },
+ { (VFunction *)info_execute_command, "execute-command", (FUNCTION_KEYSEQ *)0, "Read a command name in the echo area and execute it" },
+ { (VFunction *)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", (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" },
+ { (VFunction *)info_index_search, "index-search", (FUNCTION_KEYSEQ *)0, "Look up a string in the index for this file" },
+ { (VFunction *)info_next_index_match, "next-index-match", (FUNCTION_KEYSEQ *)0, "Go to the next matching index item from the last `\\[index-search]' command" },
+ { (VFunction *)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", (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" },
+ { (VFunction *)list_visited_nodes, "list-visited-nodes", (FUNCTION_KEYSEQ *)0, "Make a window containing a menu of all of the currently visited nodes" },
+ { (VFunction *)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", (FUNCTION_KEYSEQ *)0, "Show the footnotes associated with this node in another window" },
+ { (VFunction *)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", (FUNCTION_KEYSEQ *)0, "Explain the use of a variable" },
- { set_variable, "set-variable", (FUNCTION_KEYSEQ *)0, "Set the value of an Info variable" },
+ { (VFunction *)describe_variable, "describe-variable", (FUNCTION_KEYSEQ *)0, "Explain the use of a variable" },
+ { (VFunction *)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 5e8bc04..f41ef05 100644
--- a/contrib/texinfo/info/funs.h
+++ b/contrib/texinfo/info/funs.h
@@ -1,241 +1,243 @@
/* funs.h -- Generated declarations for Info commands. */
+#include "info.h"
+
/* Functions declared in "./session.c". */
#define A_info_next_line 0
-extern void info_next_line ();
+extern void info_next_line (WINDOW *window, int count, unsigned char key);
#define A_info_prev_line 1
-extern void info_prev_line ();
+extern void info_prev_line (WINDOW *window, int count, unsigned char key);
#define A_info_end_of_line 2
-extern void info_end_of_line ();
+extern void info_end_of_line (WINDOW *window, int count, unsigned char key);
#define A_info_beginning_of_line 3
-extern void info_beginning_of_line ();
+extern void info_beginning_of_line (WINDOW *window, int count, unsigned char key);
#define A_info_forward_char 4
-extern void info_forward_char ();
+extern void info_forward_char (WINDOW *window, int count, unsigned char key);
#define A_info_backward_char 5
-extern void info_backward_char ();
+extern void info_backward_char (WINDOW *window, int count, unsigned char key);
#define A_info_forward_word 6
-extern void info_forward_word ();
+extern void info_forward_word (WINDOW *window, int count, unsigned char key);
#define A_info_backward_word 7
-extern void info_backward_word ();
+extern void info_backward_word (WINDOW *window, int count, unsigned char key);
#define A_info_global_next_node 8
-extern void info_global_next_node ();
+extern void info_global_next_node (WINDOW *window, int count, unsigned char key);
#define A_info_global_prev_node 9
-extern void info_global_prev_node ();
+extern void info_global_prev_node (WINDOW *window, int count, unsigned char key);
#define A_info_scroll_forward 10
-extern void info_scroll_forward ();
+extern void info_scroll_forward (WINDOW *window, int count, unsigned char key);
#define A_info_scroll_forward_set_window 11
-extern void info_scroll_forward_set_window ();
+extern void info_scroll_forward_set_window (WINDOW *window, int count, unsigned char key);
#define A_info_scroll_forward_page_only 12
-extern void info_scroll_forward_page_only ();
+extern void info_scroll_forward_page_only (WINDOW *window, int count, unsigned char key);
#define A_info_scroll_forward_page_only_set_window 13
-extern void info_scroll_forward_page_only_set_window ();
+extern void info_scroll_forward_page_only_set_window (WINDOW *window, int count, unsigned char key);
#define A_info_scroll_backward 14
-extern void info_scroll_backward ();
+extern void info_scroll_backward (WINDOW *window, int count, unsigned char key);
#define A_info_scroll_backward_set_window 15
-extern void info_scroll_backward_set_window ();
+extern void info_scroll_backward_set_window (WINDOW *window, int count, unsigned char key);
#define A_info_scroll_backward_page_only 16
-extern void info_scroll_backward_page_only ();
+extern void info_scroll_backward_page_only (WINDOW *window, int count, unsigned char key);
#define A_info_scroll_backward_page_only_set_window 17
-extern void info_scroll_backward_page_only_set_window ();
+extern void info_scroll_backward_page_only_set_window (WINDOW *window, int count, unsigned char key);
#define A_info_beginning_of_node 18
-extern void info_beginning_of_node ();
+extern void info_beginning_of_node (WINDOW *window, int count, unsigned char key);
#define A_info_end_of_node 19
-extern void info_end_of_node ();
+extern void info_end_of_node (WINDOW *window, int count, unsigned char key);
#define A_info_down_line 20
-extern void info_down_line ();
+extern void info_down_line (WINDOW *window, int count, unsigned char key);
#define A_info_up_line 21
-extern void info_up_line ();
+extern void info_up_line (WINDOW *window, int count, unsigned char key);
#define A_info_scroll_half_screen_down 22
-extern void info_scroll_half_screen_down ();
+extern void info_scroll_half_screen_down (WINDOW *window, int count, unsigned char key);
#define A_info_scroll_half_screen_up 23
-extern void info_scroll_half_screen_up ();
+extern void info_scroll_half_screen_up (WINDOW *window, int count, unsigned char key);
#define A_info_next_window 24
-extern void info_next_window ();
+extern void info_next_window (WINDOW *window, int count, unsigned char key);
#define A_info_prev_window 25
-extern void info_prev_window ();
+extern void info_prev_window (WINDOW *window, int count, unsigned char key);
#define A_info_split_window 26
-extern void info_split_window ();
+extern void info_split_window (WINDOW *window, int count, unsigned char key);
#define A_info_delete_window 27
-extern void info_delete_window ();
+extern void info_delete_window (WINDOW *window, int count, unsigned char key);
#define A_info_keep_one_window 28
-extern void info_keep_one_window ();
+extern void info_keep_one_window (WINDOW *window, int count, unsigned char key);
#define A_info_scroll_other_window 29
-extern void info_scroll_other_window ();
+extern void info_scroll_other_window (WINDOW *window, int count, unsigned char key);
#define A_info_scroll_other_window_backward 30
-extern void info_scroll_other_window_backward ();
+extern void info_scroll_other_window_backward (WINDOW *window, int count, unsigned char key);
#define A_info_grow_window 31
-extern void info_grow_window ();
+extern void info_grow_window (WINDOW *window, int count, unsigned char key);
#define A_info_tile_windows 32
-extern void info_tile_windows ();
+extern void info_tile_windows (WINDOW *window, int count, unsigned char key);
#define A_info_toggle_wrap 33
-extern void info_toggle_wrap ();
+extern void info_toggle_wrap (WINDOW *window, int count, unsigned char key);
#define A_info_next_node 34
-extern void info_next_node ();
+extern void info_next_node (WINDOW *window, int count, unsigned char key);
#define A_info_prev_node 35
-extern void info_prev_node ();
+extern void info_prev_node (WINDOW *window, int count, unsigned char key);
#define A_info_up_node 36
-extern void info_up_node ();
+extern void info_up_node (WINDOW *window, int count, unsigned char key);
#define A_info_last_node 37
-extern void info_last_node ();
+extern void info_last_node (WINDOW *window, int count, unsigned char key);
#define A_info_first_node 38
-extern void info_first_node ();
+extern void info_first_node (WINDOW *window, int count, unsigned char key);
#define A_info_last_menu_item 39
-extern void info_last_menu_item ();
+extern void info_last_menu_item (WINDOW *window, int count, unsigned char key);
#define A_info_menu_digit 40
-extern void info_menu_digit ();
+extern void info_menu_digit (WINDOW *window, int count, unsigned char key);
#define A_info_menu_item 41
-extern void info_menu_item ();
+extern void info_menu_item (WINDOW *window, int count, unsigned char key);
#define A_info_xref_item 42
-extern void info_xref_item ();
+extern void info_xref_item (WINDOW *window, int count, unsigned char key);
#define A_info_find_menu 43
-extern void info_find_menu ();
+extern void info_find_menu (WINDOW *window, int count, unsigned char key);
#define A_info_visit_menu 44
-extern void info_visit_menu ();
+extern void info_visit_menu (WINDOW *window, int count, unsigned char key);
#define A_info_goto_node 45
-extern void info_goto_node ();
+extern void info_goto_node (WINDOW *window, int count, unsigned char key);
#define A_info_menu_sequence 46
-extern void info_menu_sequence ();
+extern void info_menu_sequence (WINDOW *window, int count, unsigned char key);
#define A_info_goto_invocation_node 47
-extern void info_goto_invocation_node ();
+extern void info_goto_invocation_node (WINDOW *window, int count, unsigned char key);
#define A_info_man 48
-extern void info_man ();
+extern void info_man (WINDOW *window, int count, unsigned char key);
#define A_info_top_node 49
-extern void info_top_node ();
+extern void info_top_node (WINDOW *window, int count, unsigned char key);
#define A_info_dir_node 50
-extern void info_dir_node ();
+extern void info_dir_node (WINDOW *window, int count, unsigned char key);
#define A_info_history_node 51
-extern void info_history_node ();
+extern void info_history_node (WINDOW *window, int count, unsigned char key);
#define A_info_kill_node 52
-extern void info_kill_node ();
+extern void info_kill_node (WINDOW *window, int count, unsigned char key);
#define A_info_view_file 53
-extern void info_view_file ();
+extern void info_view_file (WINDOW *window, int count, unsigned char key);
#define A_info_print_node 54
-extern void info_print_node ();
+extern void info_print_node (WINDOW *window, int count, unsigned char key);
#define A_info_search_case_sensitively 55
-extern void info_search_case_sensitively ();
+extern void info_search_case_sensitively (WINDOW *window, int count, unsigned char key);
#define A_info_search 56
-extern void info_search ();
+extern void info_search (WINDOW *window, int count, unsigned char key);
#define A_info_search_backward 57
-extern void info_search_backward ();
+extern void info_search_backward (WINDOW *window, int count, unsigned char key);
#define A_info_search_next 58
-extern void info_search_next ();
+extern void info_search_next (WINDOW *window, int count, unsigned char key);
#define A_info_search_previous 59
-extern void info_search_previous ();
+extern void info_search_previous (WINDOW *window, int count, unsigned char key);
#define A_isearch_forward 60
-extern void isearch_forward ();
+extern void isearch_forward (WINDOW *window, int count, unsigned char key);
#define A_isearch_backward 61
-extern void isearch_backward ();
+extern void isearch_backward (WINDOW *window, int count, unsigned char key);
#define A_info_move_to_prev_xref 62
-extern void info_move_to_prev_xref ();
+extern void info_move_to_prev_xref (WINDOW *window, int count, unsigned char key);
#define A_info_move_to_next_xref 63
-extern void info_move_to_next_xref ();
+extern void info_move_to_next_xref (WINDOW *window, int count, unsigned char key);
#define A_info_select_reference_this_line 64
-extern void info_select_reference_this_line ();
+extern void info_select_reference_this_line (WINDOW *window, int count, unsigned char key);
#define A_info_abort_key 65
-extern void info_abort_key ();
+extern void info_abort_key (WINDOW *window, int count, unsigned char key);
#define A_info_move_to_window_line 66
-extern void info_move_to_window_line ();
+extern void info_move_to_window_line (WINDOW *window, int count, unsigned char key);
#define A_info_redraw_display 67
-extern void info_redraw_display ();
+extern void info_redraw_display (WINDOW *window, int count, unsigned char key);
#define A_info_quit 68
-extern void info_quit ();
+extern void info_quit (WINDOW *window, int count, unsigned char key);
#define A_info_do_lowercase_version 69
-extern void info_do_lowercase_version ();
+extern void info_do_lowercase_version (WINDOW *window, int count, unsigned char key);
#define A_info_add_digit_to_numeric_arg 70
-extern void info_add_digit_to_numeric_arg ();
+extern void info_add_digit_to_numeric_arg (WINDOW *window, int count, unsigned char key);
#define A_info_universal_argument 71
-extern void info_universal_argument ();
+extern void info_universal_argument (WINDOW *window, int count, unsigned char key);
#define A_info_numeric_arg_digit_loop 72
-extern void info_numeric_arg_digit_loop ();
+extern void info_numeric_arg_digit_loop (WINDOW *window, int count, unsigned char key);
/* Functions declared in "./echo-area.c". */
#define A_ea_forward 73
-extern void ea_forward ();
+extern void ea_forward (WINDOW *window, int count, unsigned char key);
#define A_ea_backward 74
-extern void ea_backward ();
+extern void ea_backward (WINDOW *window, int count, unsigned char key);
#define A_ea_beg_of_line 75
-extern void ea_beg_of_line ();
+extern void ea_beg_of_line (WINDOW *window, int count, unsigned char key);
#define A_ea_end_of_line 76
-extern void ea_end_of_line ();
+extern void ea_end_of_line (WINDOW *window, int count, unsigned char key);
#define A_ea_forward_word 77
-extern void ea_forward_word ();
+extern void ea_forward_word (WINDOW *window, int count, unsigned char key);
#define A_ea_backward_word 78
-extern void ea_backward_word ();
+extern void ea_backward_word (WINDOW *window, int count, unsigned char key);
#define A_ea_delete 79
-extern void ea_delete ();
+extern void ea_delete (WINDOW *window, int count, unsigned char key);
#define A_ea_rubout 80
-extern void ea_rubout ();
+extern void ea_rubout (WINDOW *window, int count, unsigned char key);
#define A_ea_abort 81
-extern void ea_abort ();
+extern void ea_abort (WINDOW *window, int count, unsigned char key);
#define A_ea_newline 82
-extern void ea_newline ();
+extern void ea_newline (WINDOW *window, int count, unsigned char key);
#define A_ea_quoted_insert 83
-extern void ea_quoted_insert ();
+extern void ea_quoted_insert (WINDOW *window, int count, unsigned char key);
#define A_ea_insert 84
-extern void ea_insert ();
+extern void ea_insert (WINDOW *window, int count, unsigned char key);
#define A_ea_tab_insert 85
-extern void ea_tab_insert ();
+extern void ea_tab_insert (WINDOW *window, int count, unsigned char key);
#define A_ea_transpose_chars 86
-extern void ea_transpose_chars ();
+extern void ea_transpose_chars (WINDOW *window, int count, unsigned char key);
#define A_ea_yank 87
-extern void ea_yank ();
+extern void ea_yank (WINDOW *window, int count, unsigned char key);
#define A_ea_yank_pop 88
-extern void ea_yank_pop ();
+extern void ea_yank_pop (WINDOW *window, int count, unsigned char key);
#define A_ea_kill_line 89
-extern void ea_kill_line ();
+extern void ea_kill_line (WINDOW *window, int count, unsigned char key);
#define A_ea_backward_kill_line 90
-extern void ea_backward_kill_line ();
+extern void ea_backward_kill_line (WINDOW *window, int count, unsigned char key);
#define A_ea_kill_word 91
-extern void ea_kill_word ();
+extern void ea_kill_word (WINDOW *window, int count, unsigned char key);
#define A_ea_backward_kill_word 92
-extern void ea_backward_kill_word ();
+extern void ea_backward_kill_word (WINDOW *window, int count, unsigned char key);
#define A_ea_possible_completions 93
-extern void ea_possible_completions ();
+extern void ea_possible_completions (WINDOW *window, int count, unsigned char key);
#define A_ea_complete 94
-extern void ea_complete ();
+extern void ea_complete (WINDOW *window, int count, unsigned char key);
#define A_ea_scroll_completions_window 95
-extern void ea_scroll_completions_window ();
+extern void ea_scroll_completions_window (WINDOW *window, int count, unsigned char key);
/* Functions declared in "./infodoc.c". */
#define A_info_get_help_window 96
-extern void info_get_help_window ();
+extern void info_get_help_window (WINDOW *window, int count, unsigned char key);
#define A_info_get_info_help_node 97
-extern void info_get_info_help_node ();
+extern void info_get_info_help_node (WINDOW *window, int count, unsigned char key);
#define A_describe_key 98
-extern void describe_key ();
+extern void describe_key (WINDOW *window, int count, unsigned char key);
#define A_info_where_is 99
-extern void info_where_is ();
+extern void info_where_is (WINDOW *window, int count, unsigned char key);
/* Functions declared in "./m-x.c". */
#define A_describe_command 100
-extern void describe_command ();
+extern void describe_command (WINDOW *window, int count, unsigned char key);
#define A_info_execute_command 101
-extern void info_execute_command ();
+extern void info_execute_command (WINDOW *window, int count, unsigned char key);
#define A_set_screen_height 102
-extern void set_screen_height ();
+extern void set_screen_height (WINDOW *window, int count, unsigned char key);
/* Functions declared in "./indices.c". */
#define A_info_index_search 103
-extern void info_index_search ();
+extern void info_index_search (WINDOW *window, int count, unsigned char key);
#define A_info_next_index_match 104
-extern void info_next_index_match ();
+extern void info_next_index_match (WINDOW *window, int count, unsigned char key);
#define A_info_index_apropos 105
-extern void info_index_apropos ();
+extern void info_index_apropos (WINDOW *window, int count, unsigned char key);
/* Functions declared in "./nodemenu.c". */
#define A_list_visited_nodes 106
-extern void list_visited_nodes ();
+extern void list_visited_nodes (WINDOW *window, int count, unsigned char key);
#define A_select_visited_node 107
-extern void select_visited_node ();
+extern void select_visited_node (WINDOW *window, int count, unsigned char key);
/* Functions declared in "./footnotes.c". */
#define A_info_show_footnotes 108
-extern void info_show_footnotes ();
+extern void info_show_footnotes (WINDOW *window, int count, unsigned char key);
/* Functions declared in "./variables.c". */
#define A_describe_variable 109
-extern void describe_variable ();
+extern void describe_variable (WINDOW *window, int count, unsigned char key);
#define A_set_variable 110
-extern void set_variable ();
+extern void set_variable (WINDOW *window, int count, unsigned char key);
#define A_NCOMMANDS 111
diff --git a/contrib/texinfo/info/infomap.c b/contrib/texinfo/info/infomap.c
index 82fd490..c7dc2f4 100644
--- a/contrib/texinfo/info/infomap.c
+++ b/contrib/texinfo/info/infomap.c
@@ -1,7 +1,7 @@
/* infomap.c -- keymaps for Info.
- $Id: infomap.c,v 1.7 2003/05/13 16:27:04 karl Exp $
+ $Id: infomap.c,v 1.10 2004/07/30 20:43:40 karl Exp $
- Copyright (C) 1993, 1997, 1998, 1999, 2001, 2002, 2003 Free Software
+ Copyright (C) 1993, 1997, 1998, 1999, 2001, 2002, 2003, 2004 Free Software
Foundation, Inc.
This program is free software; you can redistribute it and/or modify
@@ -30,10 +30,13 @@
#include "variables.h"
#endif /* INFOKEY */
+static int keymap_bind_keyseq (Keymap map, const char *keyseq,
+ KEYMAP_ENTRY *keyentry);
+
/* Return a new keymap which has all the uppercase letters mapped to run
the function info_do_lowercase_version (). */
Keymap
-keymap_make_keymap ()
+keymap_make_keymap (void)
{
int i;
Keymap keymap;
@@ -61,10 +64,7 @@ keymap_make_keymap ()
#if defined(INFOKEY)
static FUNCTION_KEYSEQ *
-find_function_keyseq (map, c, rootmap)
- Keymap map;
- int c;
- Keymap rootmap;
+find_function_keyseq (Keymap map, int c, Keymap rootmap)
{
FUNCTION_KEYSEQ *k;
@@ -78,7 +78,7 @@ find_function_keyseq (map, c, rootmap)
Keymap m = rootmap;
if (k->map != rootmap)
continue;
- for (p = k->keyseq; *p && m[*p].type == ISKMAP; p++)
+ for (p = (unsigned char *) k->keyseq; *p && m[*p].type == ISKMAP; p++)
m = (Keymap)m[*p].function;
if (*p != c || p[1])
continue;
@@ -90,10 +90,8 @@ find_function_keyseq (map, c, rootmap)
}
static void
-add_function_keyseq (function, keyseq, rootmap)
- InfoCommand *function;
- const unsigned char *keyseq;
- Keymap rootmap;
+add_function_keyseq (InfoCommand *function,
+ const char *keyseq, Keymap rootmap)
{
FUNCTION_KEYSEQ *ks;
@@ -109,10 +107,8 @@ add_function_keyseq (function, keyseq, rootmap)
}
static void
-remove_function_keyseq (function, keyseq, rootmap)
- InfoCommand *function;
- const unsigned char *keyseq;
- Keymap rootmap;
+remove_function_keyseq (InfoCommand *function,
+ const char *keyseq, Keymap rootmap)
{
FUNCTION_KEYSEQ *k, *kp;
@@ -135,10 +131,7 @@ remove_function_keyseq (function, keyseq, rootmap)
/* Return a new keymap which is a copy of MAP. */
Keymap
-keymap_copy_keymap (map, rootmap, newroot)
- Keymap map;
- Keymap rootmap;
- Keymap newroot;
+keymap_copy_keymap (Keymap map, Keymap rootmap, Keymap newroot)
{
int i;
Keymap keymap;
@@ -158,14 +151,14 @@ keymap_copy_keymap (map, rootmap, newroot)
case ISFUNC:
keymap[i].function = map[i].function;
#if defined(INFOKEY)
- ks = find_function_keyseq (map, i, rootmap, NULL);
+ ks = find_function_keyseq (map, i, rootmap);
if (ks)
add_function_keyseq(map[i].function, ks->keyseq, newroot);
#endif /* INFOKEY */
break;
case ISKMAP:
- keymap[i].function = (InfoCommand *)keymap_copy_keymap (
- (Keymap)map[i].function, rootmap);
+ keymap[i].function = (InfoCommand *)keymap_copy_keymap
+ ((Keymap)map[i].function, rootmap, NULL);
break;
}
}
@@ -174,9 +167,7 @@ keymap_copy_keymap (map, rootmap, newroot)
/* Free the keymap and its descendants. */
void
-keymap_discard_keymap (map, rootmap)
- Keymap map;
- Keymap rootmap;
+keymap_discard_keymap (Keymap map, Keymap rootmap)
{
int i;
@@ -210,14 +201,12 @@ keymap_discard_keymap (map, rootmap)
}
/* Conditionally bind key sequence. */
-int
-keymap_bind_keyseq (map, keyseq, keyentry)
- Keymap map;
- const unsigned char *keyseq;
- KEYMAP_ENTRY *keyentry;
+static int
+keymap_bind_keyseq (Keymap map,
+ const char *keyseq, KEYMAP_ENTRY *keyentry)
{
Keymap m = map;
- const unsigned char *s = keyseq;
+ const unsigned char *s = (unsigned char *) keyseq;
int c;
if (s == NULL || *s == '\0') return 0;
@@ -715,8 +704,8 @@ initialize_vi_like_keymaps ()
map['H'].function = info_get_help_window;
map['i'].function = info_index_search;
map['I'].function = info_goto_invocation_node;
- map['j'].function = info_down_line;
- map['k'].function = info_up_line;
+ map['j'].function = info_next_line;
+ map['k'].function = info_prev_line;
map['l'].function = info_history_node;
map['m'].function = info_menu_item;
map['n'].function = info_search_next;
@@ -1193,8 +1182,8 @@ static unsigned char default_vi_like_info_keys[] =
'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,
+ 'j', NUL, A_info_next_line,
+ 'k', NUL, A_info_prev_line,
'l', NUL, A_info_history_node,
'm', NUL, A_info_menu_item,
'n', NUL, A_info_search_next,
@@ -1432,8 +1421,7 @@ 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;
+filesize(int f)
{
long pos = lseek(f, 0L, SEEK_CUR);
long sz = -1L;
@@ -1449,8 +1437,7 @@ filesize(f)
Integers are stored as two bytes, low order first, in radix INFOKEY_RADIX.
*/
static int
-getint(sp)
- unsigned char **sp;
+getint(unsigned char **sp)
{
int n;
@@ -1465,7 +1452,7 @@ getint(sp)
/* Fetch the contents of the standard infokey file "$HOME/.info". Return
true if ok, false if not. */
static int
-fetch_user_maps()
+fetch_user_maps(void)
{
char *filename = NULL;
char *homedir;
@@ -1495,7 +1482,8 @@ fetch_user_maps()
{
if (filename && errno != ENOENT)
{
- info_error(filesys_error_string(filename, errno));
+ info_error(filesys_error_string(filename, errno),
+ NULL, NULL);
free(filename);
}
return 0;
@@ -1509,11 +1497,11 @@ fetch_user_maps()
/* 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);
+ info_error((char *) _("Ignoring invalid infokey file `%s' - too small"),
+ filename, NULL);
else
- info_error(_("Ignoring invalid infokey file `%s' - too big"),
- filename);
+ info_error((char *) _("Ignoring invalid infokey file `%s' - too big"),
+ filename, NULL);
close(f);
free(filename);
return 0;
@@ -1523,9 +1511,10 @@ fetch_user_maps()
buf = (unsigned char *)xmalloc((int)len);
nread = read(f, buf, (unsigned int) len);
close(f);
- if (nread != len)
+ if ((unsigned int) nread != len)
{
- info_error(_("Error reading infokey file `%s' - short read"), filename);
+ info_error((char *) _("Error reading infokey file `%s' - short read"),
+ filename, NULL);
free(buf);
free(filename);
return 0;
@@ -1543,26 +1532,33 @@ fetch_user_maps()
|| buf[len - 1] != INFOKEY_MAGIC_E3
)
{
- info_error(_("Invalid infokey file `%s' (bad magic numbers) -- run infokey to update it"), filename);
+ info_error((char *) _("Invalid infokey file `%s' (bad magic numbers) -- run infokey to update it"),
+ filename, NULL);
free(filename);
return 0;
}
- if (len < INFOKEY_NMAGIC + strlen(VERSION) + 1 || strcmp(VERSION, buf + 4) != 0)
+ if (len < INFOKEY_NMAGIC + strlen(VERSION) + 1
+ || strcmp(VERSION, (char *) (buf + 4)) != 0)
{
- info_error(_("Your infokey file `%s' is out of date -- run infokey to update it"), filename);
+ info_error
+ ((char *) _("Your infokey file `%s' is out of date -- run infokey to update it"),
+ filename, NULL);
free(filename);
return 0;
}
/* Extract the pieces. */
- for (p = buf + 4 + strlen(VERSION) + 1; p - buf < len - 4; p += n)
+ for (p = buf + 4 + strlen(VERSION) + 1;
+ (unsigned int) (p - buf) < len - 4;
+ p += n)
{
int s = *p++;
n = getint(&p);
- if (n < 0 || n > len - 4 - (p - buf))
+ if (n < 0 || (unsigned int) n > len - 4 - (p - buf))
{
- info_error(_("Invalid infokey file `%s' (bad section length) -- run infokey to update it"), filename);
+ info_error((char *) _("Invalid infokey file `%s' (bad section length) -- run infokey to update it"),
+ filename, NULL);
free(filename);
return 0;
}
@@ -1582,7 +1578,8 @@ fetch_user_maps()
user_vars_len = n;
break;
default:
- info_error(_("Invalid infokey file `%s' (bad section code) -- run infokey to update it"), filename);
+ info_error((char *) _("Invalid infokey file `%s' (bad section code) -- run infokey to update it"),
+ filename, NULL);
free(filename);
return 0;
}
@@ -1597,27 +1594,26 @@ fetch_user_maps()
doesn't define.
*/
static int
-decode_keys(src, slen, dst, dlen)
- unsigned char *src;
- unsigned int slen;
- unsigned char *dst;
- unsigned int dlen;
+decode_keys(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)
+#define To_dst(c) do { \
+ if ((unsigned int) (d - dst) < dlen) *d++ = (c); \
+} while (0)
- while (s - src < slen)
+ while ((unsigned int) (s - src) < slen)
{
unsigned char c = ISMETA(*s) ? UNMETA(*s) : *s;
if (c == SK_ESCAPE)
{
- unsigned char *t;
+ char *t;
static char lit[] = { SK_ESCAPE, NUL };
- switch (s + 1 - src < slen ? s[1] : '\0')
+ switch ((unsigned int) (s + 1 - src) < slen ? s[1] : '\0')
{
case SK_RIGHT_ARROW: t = term_kr; break;
case SK_LEFT_ARROW: t = term_kl; break;
@@ -1658,20 +1654,17 @@ decode_keys(src, slen, dst, dlen)
/* 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;
+section_to_keymaps(Keymap map, unsigned char *table, unsigned int len)
{
int stop;
unsigned char *p;
- unsigned char *seq;
- unsigned int seqlen;
+ unsigned char *seq = NULL;
+ unsigned int seqlen = 0;
enum { getseq, gotseq, getaction } state = getseq;
stop = len > 0 ? table[0] : 0;
- for (p = table + 1; p - table < len; p++)
+ for (p = table + 1; (unsigned int) (p - table) < len; p++)
{
switch (state)
{
@@ -1712,30 +1705,30 @@ section_to_keymaps(map, table, len)
action < A_NCOMMANDS
? &function_doc_array[action]
: NULL;
- keymap_bind_keyseq(map, keyseq, &ke);
+ keymap_bind_keyseq(map,
+ (const char *) keyseq, &ke);
}
}
break;
}
}
if (state != getseq)
- info_error(_("Bad data in infokey file -- some key bindings ignored"));
+ info_error((char *) _("Bad data in infokey file -- some key bindings ignored"),
+ NULL, NULL);
return !stop;
}
/* Convert an infokey file section to variable settings.
*/
static void
-section_to_vars(table, len)
- unsigned char *table;
- unsigned int len;
+section_to_vars(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++)
+ for (p = table; (unsigned int) (p - table) < len; p++)
{
switch (state)
{
@@ -1763,18 +1756,19 @@ section_to_vars(table, len)
case gotval:
if (!*p)
{
- set_variable_to_value(var, val);
+ set_variable_to_value((char *) var, (char *) val);
state = getvar;
}
break;
}
}
if (state != getvar)
- info_error(_("Bad data in infokey file -- some var settings ignored"));
+ info_error((char *) _("Bad data in infokey file -- some var settings ignored"),
+ NULL, NULL);
}
void
-initialize_info_keymaps ()
+initialize_info_keymaps (void)
{
int i;
int suppress_info_default_bindings = 0;
diff --git a/contrib/texinfo/info/nodemenu.c b/contrib/texinfo/info/nodemenu.c
index 4de2cfa..1090d08 100644
--- a/contrib/texinfo/info/nodemenu.c
+++ b/contrib/texinfo/info/nodemenu.c
@@ -1,7 +1,8 @@
/* nodemenu.c -- produce a menu of all visited nodes.
- $Id: nodemenu.c,v 1.3 2003/05/13 16:37:54 karl Exp $
+ $Id: nodemenu.c,v 1.5 2004/04/11 17:56:46 karl Exp $
- Copyright (C) 1993, 1997, 1998, 2002, 2003 Free Software Foundation, Inc.
+ Copyright (C) 1993, 1997, 1998, 2002, 2003, 2004 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
@@ -21,9 +22,11 @@
#include "info.h"
+NODE * get_visited_nodes (Function *filter_func);
+
/* Return a line describing the format of a node information line. */
static const char *
-nodemenu_format_info ()
+nodemenu_format_info (void)
{
return (_("\n\
* Menu:\n\
@@ -42,8 +45,7 @@ nodemenu_format_info ()
* (dir)Top:: 40 589 /usr/gnu/info/dir
*/
static char *
-format_node_info (node)
- NODE *node;
+format_node_info (NODE *node)
{
register int i, len;
char *parent, *containing_file;
@@ -109,10 +111,12 @@ format_node_info (node)
/* Little string comparison routine for qsort (). */
static int
-compare_strings (string1, string2)
- char **string1, **string2;
+compare_strings (const void *entry1, const void *entry2)
{
- return (strcasecmp (*string1, *string2));
+ char **e1 = (char **) entry1;
+ char **e2 = (char **) entry2;
+
+ return (strcasecmp (*e1, *e2));
}
/* The name of the nodemenu node. */
@@ -123,8 +127,7 @@ static char *nodemenu_nodename = "*Node Menu*";
which nodes will appear in the listing. FILTER_FUNC takes an argument
of NODE, and returns non-zero if the node should appear in the listing. */
NODE *
-get_visited_nodes (filter_func)
- Function *filter_func;
+get_visited_nodes (Function *filter_func)
{
register int i, iw_index;
INFO_WINDOW *info_win;
@@ -196,14 +199,16 @@ get_visited_nodes (filter_func)
printf_to_message_buffer
("%s", replace_in_documentation
- (_("Here is the menu of nodes you have recently visited.\n\
-Select one from this menu, or use `\\[history-node]' in another window.\n")));
+ ((char *) _("Here is the menu of nodes you have recently visited.\n\
+Select one from this menu, or use `\\[history-node]' in another window.\n"), 0),
+ NULL, NULL);
- printf_to_message_buffer ("%s\n", nodemenu_format_info ());
+ printf_to_message_buffer ("%s\n", (char *) nodemenu_format_info (),
+ NULL, NULL);
for (i = 0; (lines != (char **)NULL) && (i < lines_index); i++)
{
- printf_to_message_buffer ("%s\n", lines[i]);
+ printf_to_message_buffer ("%s\n", lines[i], NULL, NULL);
free (lines[i]);
}
@@ -308,7 +313,8 @@ DECLARE_INFO_COMMAND (select_visited_node,
free (node);
line =
- info_read_completing_in_echo_area (window, _("Select visited node: "), menu);
+ info_read_completing_in_echo_area (window,
+ (char *) _("Select visited node: "), menu);
window = active_window;
@@ -328,7 +334,7 @@ DECLARE_INFO_COMMAND (select_visited_node,
entry = info_get_labeled_reference (line, menu);
if (!entry)
- info_error (_("The reference disappeared! (%s)."), line);
+ info_error ((char *) _("The reference disappeared! (%s)."), line, NULL);
else
info_select_reference (window, entry);
}
diff --git a/contrib/texinfo/info/session.c b/contrib/texinfo/info/session.c
index cff7d75..7a8996b 100644
--- a/contrib/texinfo/info/session.c
+++ b/contrib/texinfo/info/session.c
@@ -1,7 +1,7 @@
/* session.c -- user windowing interface to Info.
- $Id: session.c,v 1.8 2003/03/22 17:41:16 karl Exp $
+ $Id: session.c,v 1.16 2004/12/14 00:15:36 karl Exp $
- Copyright (C) 1993, 1996, 1997, 1998, 1999, 2000, 2001, 2002, 2003
+ Copyright (C) 1993, 1996, 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004
Free Software Foundation, Inc.
This program is free software; you can redistribute it and/or modify
@@ -18,9 +18,10 @@
along with this program; if not, write to the Free Software
Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
- Written by Brian Fox (bfox@ai.mit.edu). */
+ Originally written by Brian Fox (bfox@ai.mit.edu). */
#include "info.h"
+#include "search.h"
#include <sys/ioctl.h>
#if defined (HAVE_SYS_TIME_H)
@@ -32,14 +33,11 @@
# include "man.h"
#endif
-#ifdef M_XENIX
-/* SCO 3.2v5.0.2 defines but does not correctly declare strncasecmp.
- Since we use it as a symbol, have to get it right. --gildea, 1jul99. */
-extern int strncasecmp (const char *, const char *, size_t);
-#endif
-
-static void info_clear_pending_input (), info_set_pending_input ();
-static void info_handle_pointer ();
+static void info_clear_pending_input (void);
+static void info_set_pending_input (unsigned char key);
+static void info_handle_pointer (char *label, WINDOW *window);
+static void display_info_keyseq (int expecting_future_input);
+char *node_printed_rep (NODE *node);
/* **************************************************************** */
/* */
@@ -66,17 +64,15 @@ static int info_windows_index = 0;
/* Number of slots allocated to `info_windows'. */
static int info_windows_slots = 0;
-void remember_window_and_node (), forget_window_and_nodes ();
-void initialize_info_session (), info_session ();
-void display_startup_message_and_start ();
+void remember_window_and_node (WINDOW *window, NODE *node);
+void forget_window_and_nodes (WINDOW *window);
+void display_startup_message_and_start (void);
/* Begin an info session finding the nodes specified by FILENAME and NODENAMES.
For each loaded node, create a new window. Always split the largest of the
available windows. */
void
-begin_multiple_window_info_session (filename, nodenames)
- char *filename;
- char **nodenames;
+begin_multiple_window_info_session (char *filename, char **nodenames)
{
register int i;
WINDOW *window = (WINDOW *)NULL;
@@ -114,7 +110,7 @@ begin_multiple_window_info_session (filename, nodenames)
if (!largest)
{
display_update_display (windows);
- info_error (msg_cant_find_window);
+ info_error ((char *) msg_cant_find_window, NULL, NULL);
info_session ();
xexit (0);
}
@@ -129,7 +125,7 @@ begin_multiple_window_info_session (filename, nodenames)
else
{
display_update_display (windows);
- info_error (msg_win_too_small);
+ info_error ((char *) msg_win_too_small, NULL, NULL);
info_session ();
xexit (0);
}
@@ -141,11 +137,8 @@ begin_multiple_window_info_session (filename, nodenames)
/* Start an info session with INITIAL_NODE, and an error message in the echo
area made from FORMAT and ARG. */
void
-begin_info_session_with_error (initial_node, format, arg1, arg2)
- NODE *initial_node;
- char *format;
- void *arg1;
- void *arg2;
+begin_info_session_with_error (NODE *initial_node, char *format,
+ void *arg1, void *arg2)
{
initialize_info_session (initial_node, 1);
info_error (format, arg1, arg2);
@@ -154,28 +147,28 @@ begin_info_session_with_error (initial_node, format, arg1, arg2)
/* Start an info session with INITIAL_NODE. */
void
-begin_info_session (initial_node)
- NODE *initial_node;
+begin_info_session (NODE *initial_node)
{
initialize_info_session (initial_node, 1);
display_startup_message_and_start ();
}
void
-display_startup_message_and_start ()
+display_startup_message_and_start (void)
{
char *format;
format = replace_in_documentation
- (_("Welcome to Info version %s. Type \\[get-help-window] for help, \\[menu-item] for menu item."));
+ ((char *) _("Welcome to Info version %s. Type \\[get-help-window] for help, \\[menu-item] for menu item."),
+ 0);
- window_message_in_echo_area (format, VERSION);
+ window_message_in_echo_area (format, VERSION, NULL);
info_session ();
}
/* Run an info session with an already initialized window and node. */
void
-info_session ()
+info_session (void)
{
display_update_display (windows);
info_last_executed_command = NULL;
@@ -192,7 +185,7 @@ info_session ()
/* Here is a window-location dependent event loop. Called from the
functions info_session (), and from read_xxx_in_echo_area (). */
void
-info_read_and_dispatch ()
+info_read_and_dispatch (void)
{
unsigned char key;
int done;
@@ -200,12 +193,12 @@ info_read_and_dispatch ()
while (!done && !quit_info_immediately)
{
- int lk;
+ int lk = 0;
/* If we haven't just gone up or down a line, there is no
goal column for this window. */
- if ((info_last_executed_command != info_next_line) &&
- (info_last_executed_command != info_prev_line))
+ if ((info_last_executed_command != (VFunction *) info_next_line) &&
+ (info_last_executed_command != (VFunction *) info_prev_line))
active_window->goal_column = -1;
if (echo_area_is_active)
@@ -242,30 +235,28 @@ info_read_and_dispatch ()
if (lk == echo_area_last_command_was_kill)
echo_area_last_command_was_kill = 0;
- if (ea_last_executed_command == ea_newline ||
+ if (ea_last_executed_command == (VFunction *) ea_newline ||
info_aborted_echo_area)
{
ea_last_executed_command = (VFunction *)NULL;
done = 1;
}
- if (info_last_executed_command == info_quit)
+ if (info_last_executed_command == (VFunction *) info_quit)
quit_info_immediately = 1;
}
- else if (info_last_executed_command == info_quit)
+ else if (info_last_executed_command == (VFunction *) info_quit)
done = 1;
}
}
/* Found in signals.c */
-extern void initialize_info_signal_handler ();
+extern void initialize_info_signal_handler (void );
/* Initialize the first info session by starting the terminal, window,
and display systems. If CLEAR_SCREEN is 0, don't clear the screen. */
void
-initialize_info_session (node, clear_screen)
- NODE *node;
- int clear_screen;
+initialize_info_session (NODE *node, int clear_screen)
{
char *term_name = getenv ("TERM");
terminal_initialize_terminal (term_name);
@@ -275,7 +266,7 @@ initialize_info_session (node, clear_screen)
if (!term_name)
term_name = "dumb";
- info_error (msg_term_too_dumb, term_name);
+ info_error ((char *) msg_term_too_dumb, term_name, NULL);
xexit (1);
}
@@ -293,7 +284,7 @@ initialize_info_session (node, clear_screen)
/* Tell the window system how to notify us when a window needs to be
asynchronously deleted (e.g., user resizes window very small). */
- window_deletion_notifier = forget_window_and_nodes;
+ window_deletion_notifier = (VFunction *) forget_window_and_nodes;
/* If input has not been redirected yet, make it come from unbuffered
standard input. */
@@ -308,8 +299,7 @@ initialize_info_session (node, clear_screen)
/* Tell Info that input is coming from the file FILENAME. */
void
-info_set_input_from_file (filename)
- char *filename;
+info_set_input_from_file (char *filename)
{
FILE *stream;
@@ -331,8 +321,7 @@ info_set_input_from_file (filename)
/* Return the INFO_WINDOW containing WINDOW, or NULL if there isn't one. */
static INFO_WINDOW *
-get_info_window_of_window (window)
- WINDOW *window;
+get_info_window_of_window (WINDOW *window)
{
register int i;
INFO_WINDOW *info_win = (INFO_WINDOW *)NULL;
@@ -348,8 +337,7 @@ get_info_window_of_window (window)
values if the window and node are the same as the current one being
displayed. */
void
-set_remembered_pagetop_and_point (window)
- WINDOW *window;
+set_remembered_pagetop_and_point (WINDOW *window)
{
INFO_WINDOW *info_win;
@@ -367,9 +355,7 @@ set_remembered_pagetop_and_point (window)
}
void
-remember_window_and_node (window, node)
- WINDOW *window;
- NODE *node;
+remember_window_and_node (WINDOW *window, NODE *node)
{
/* See if we already have this window in our list. */
INFO_WINDOW *info_win = get_info_window_of_window (window);
@@ -428,7 +414,7 @@ remember_window_and_node (window, node)
#define DEBUG_FORGET_WINDOW_AND_NODES
#if defined (DEBUG_FORGET_WINDOW_AND_NODES)
static void
-consistency_check_info_windows ()
+consistency_check_info_windows (void)
{
register int i;
@@ -448,8 +434,7 @@ consistency_check_info_windows ()
/* Remove WINDOW and its associated list of nodes from INFO_WINDOWS. */
void
-forget_window_and_nodes (window)
- WINDOW *window;
+forget_window_and_nodes (WINDOW *window)
{
register int i;
INFO_WINDOW *info_win = (INFO_WINDOW *)NULL;
@@ -496,10 +481,7 @@ forget_window_and_nodes (window)
the footnotes for this window. If REMEMBER is nonzero, first call
set_remembered_pagetop_and_point. */
void
-info_set_node_of_window (remember, window, node)
- int remember;
- WINDOW *window;
- NODE *node;
+info_set_node_of_window (int remember, WINDOW *window, NODE *node)
{
if (remember)
set_remembered_pagetop_and_point (window);
@@ -526,9 +508,7 @@ info_set_node_of_window (remember, window, node)
/* Change the pagetop of WINDOW to DESIRED_TOP, perhaps scrolling the screen
to do so. */
void
-set_window_pagetop (window, desired_top)
- WINDOW *window;
- int desired_top;
+set_window_pagetop (WINDOW *window, int desired_top)
{
int point_line, old_pagetop;
@@ -591,8 +571,7 @@ set_window_pagetop (window, desired_top)
/* Immediately make WINDOW->point visible on the screen, and move the
terminal cursor there. */
static void
-info_show_point (window)
- WINDOW *window;
+info_show_point (WINDOW *window)
{
int old_pagetop;
@@ -615,13 +594,11 @@ info_show_point (window)
/* Move WINDOW->point from OLD line index to NEW line index. */
static void
-move_to_new_line (old, new, window)
- int old, new;
- WINDOW *window;
+move_to_new_line (int old, int new, WINDOW *window)
{
if (old == -1)
{
- info_error (msg_cant_find_point);
+ info_error ((char *) msg_cant_find_point, NULL, NULL);
}
else
{
@@ -869,23 +846,22 @@ int default_scroll_size = -1; /* meaning half screen size */
/* Move to 1st menu item, Next, Up/Next, or error in this window. */
static void
-forward_move_node_structure (window, behaviour)
- WINDOW *window;
- int behaviour;
+forward_move_node_structure (WINDOW *window, int behaviour)
{
switch (behaviour)
{
case IS_PageOnly:
- info_error (msg_at_node_bottom);
+ info_error ((char *) msg_at_node_bottom, NULL, NULL);
break;
case IS_NextOnly:
info_next_label_of_node (window->node);
if (!info_parsed_nodename && !info_parsed_filename)
- info_error (msg_no_pointer, _("Next"));
+ info_error ((char *) msg_no_pointer, (char *) _("Next"), NULL);
else
{
- window_message_in_echo_area (_("Following Next node..."));
+ window_message_in_echo_area ((char *) _("Following Next node..."),
+ NULL, NULL);
info_handle_pointer ("Next", window);
}
break;
@@ -902,7 +878,8 @@ forward_move_node_structure (window, behaviour)
if (menu)
{
info_free_references (menu);
- window_message_in_echo_area (_("Selecting first menu item..."));
+ window_message_in_echo_area ((char *) _("Selecting first menu item..."),
+ NULL, NULL);
info_menu_digit (window, 1, '1');
return;
}
@@ -913,7 +890,8 @@ forward_move_node_structure (window, behaviour)
info_next_label_of_node (window->node);
if (INFO_LABEL_FOUND ())
{
- window_message_in_echo_area (_("Selecting Next node..."));
+ window_message_in_echo_area ((char *) _("Selecting Next node..."),
+ NULL, NULL);
info_handle_pointer ("Next", window);
return;
}
@@ -983,8 +961,8 @@ forward_move_node_structure (window, behaviour)
/* This node has a "Next" pointer, and it is not the
same as the first menu item found in this node. */
window_message_in_echo_area
- (_("Moving Up %d time(s), then Next."),
- up_counter);
+ ((char *) _("Moving Up %d time(s), then Next."),
+ (void *) (long) up_counter, NULL);
info_handle_pointer ("Next", window);
return;
@@ -1007,7 +985,8 @@ forward_move_node_structure (window, behaviour)
window->point = info_win->points[old_current];
recalculate_line_starts (window);
window->flags |= W_UpdateWindow;
- info_error (_("No more nodes within this document."));
+ info_error ((char *) _("No more nodes within this document."),
+ NULL, NULL);
}
}
}
@@ -1018,23 +997,22 @@ forward_move_node_structure (window, behaviour)
/* Move Prev, Up or error in WINDOW depending on BEHAVIOUR. */
static void
-backward_move_node_structure (window, behaviour)
- WINDOW *window;
- int behaviour;
+backward_move_node_structure (WINDOW *window, int behaviour)
{
switch (behaviour)
{
case IS_PageOnly:
- info_error (msg_at_node_top);
+ info_error ((char *) msg_at_node_top, NULL, NULL);
break;
case IS_NextOnly:
info_prev_label_of_node (window->node);
if (!info_parsed_nodename && !info_parsed_filename)
- info_error (_("No `Prev' for this node."));
+ info_error ((char *) _("No `Prev' for this node."), NULL, NULL);
else
{
- window_message_in_echo_area (_("Moving Prev in this window."));
+ window_message_in_echo_area ((char *) _("Moving Prev in this window."),
+ NULL, NULL);
info_handle_pointer ("Prev", window);
}
break;
@@ -1048,10 +1026,13 @@ backward_move_node_structure (window, behaviour)
info_up_label_of_node (window->node);
if (!info_parsed_nodename && (!info_parsed_filename
|| is_dir_name (info_parsed_filename)))
- info_error (_("No `Prev' or `Up' for this node within this document."));
+ info_error ((char *)
+ _("No `Prev' or `Up' for this node within this document."),
+ NULL, NULL);
else
{
- window_message_in_echo_area (_("Moving Up in this window."));
+ window_message_in_echo_area ((char *) _("Moving Up in this window."),
+ NULL, NULL);
info_handle_pointer ("Up", window);
}
}
@@ -1089,7 +1070,8 @@ backward_move_node_structure (window, behaviour)
/* Move to the previous node. If this node now contains a menu,
and we have not inhibited movement to it, move to the node
corresponding to the last menu item. */
- window_message_in_echo_area (_("Moving Prev in this window."));
+ window_message_in_echo_area ((char *) _("Moving Prev in this window."),
+ NULL, NULL);
info_handle_pointer ("Prev", window);
if (!inhibit_menu_traversing)
@@ -1099,7 +1081,7 @@ backward_move_node_structure (window, behaviour)
{
info_free_references (menu);
window_message_in_echo_area
- (_("Moving to `Prev's last menu item."));
+ ((char *) _("Moving to `Prev's last menu item."), NULL, NULL);
info_menu_digit (window, 1, '0');
}
}
@@ -1140,15 +1122,13 @@ DECLARE_INFO_COMMAND (info_global_prev_node,
}
}
-static void _scroll_forward();
-static void _scroll_backward();
+static void _scroll_forward(WINDOW *window, int count,
+ unsigned char key, int behaviour);
+static void _scroll_backward(WINDOW *window, int count,
+ unsigned char key, int behaviour);
static void
-_scroll_forward(window, count, key, behaviour)
- WINDOW *window;
- int count;
- unsigned char key;
- int behaviour;
+_scroll_forward(WINDOW *window, int count, unsigned char key, int behaviour)
{
if (count < 0)
_scroll_backward (window, -count, key, behaviour);
@@ -1188,11 +1168,7 @@ _scroll_forward(window, count, key, behaviour)
}
static void
-_scroll_backward(window, count, key, behaviour)
- WINDOW *window;
- int count;
- unsigned char key;
- int behaviour;
+_scroll_backward(WINDOW *window, int count, unsigned char key, int behaviour)
{
if (count < 0)
_scroll_forward (window, -count, key, behaviour);
@@ -1406,7 +1382,7 @@ DECLARE_INFO_COMMAND (info_next_window, _("Select the next window"))
/* If no other window, error now. */
if (!windows->next && !echo_area_is_active)
{
- info_error (msg_one_window);
+ info_error ((char *) msg_one_window, NULL, NULL);
return;
}
@@ -1446,7 +1422,7 @@ DECLARE_INFO_COMMAND (info_prev_window, _("Select the previous window"))
if (!windows->next && !echo_area_is_active)
{
- info_error (msg_one_window);
+ info_error ((char *) msg_one_window, NULL, NULL);
return;
}
@@ -1457,7 +1433,7 @@ DECLARE_INFO_COMMAND (info_prev_window, _("Select the previous window"))
if (window == the_echo_area ||
(window == windows && !echo_area_is_active))
{
- register WINDOW *win, *last;
+ register WINDOW *win, *last = NULL;
for (win = windows; win; win = win->next)
last = win;
@@ -1502,7 +1478,7 @@ DECLARE_INFO_COMMAND (info_split_window, _("Split the current window"))
if (!split)
{
- info_error (msg_win_too_small);
+ info_error ((char *) msg_win_too_small, NULL, NULL);
}
else
{
@@ -1570,11 +1546,11 @@ DECLARE_INFO_COMMAND (info_delete_window, _("Delete the current window"))
{
if (!windows->next)
{
- info_error (msg_cant_kill_last);
+ info_error ((char *) msg_cant_kill_last, NULL, NULL);
}
else if (window->flags & W_WindowIsPerm)
{
- info_error (_("Cannot delete a permanent window"));
+ info_error ((char *) _("Cannot delete a permanent window"), NULL, NULL);
}
else
{
@@ -1591,8 +1567,7 @@ DECLARE_INFO_COMMAND (info_delete_window, _("Delete the current window"))
/* Do the physical deletion of WINDOW, and forget this window and
associated nodes. */
void
-info_delete_window_internal (window)
- WINDOW *window;
+info_delete_window_internal (WINDOW *window)
{
if (windows->next && ((window->flags & W_WindowIsPerm) == 0))
{
@@ -1660,7 +1635,7 @@ DECLARE_INFO_COMMAND (info_scroll_other_window, _("Scroll the other window"))
/* If only one window, give up. */
if (!windows->next)
{
- info_error (msg_one_window);
+ info_error ((char *) msg_one_window, NULL, NULL);
return;
}
@@ -1712,8 +1687,7 @@ DECLARE_INFO_COMMAND (info_toggle_wrap,
/* Return (FILENAME)NODENAME for NODE, or just NODENAME if NODE's
filename is not set. */
char *
-node_printed_rep (node)
- NODE *node;
+node_printed_rep (NODE *node)
{
char *rep;
@@ -1734,9 +1708,7 @@ node_printed_rep (node)
/* Using WINDOW for various defaults, select the node referenced by ENTRY
in it. If the node is selected, the window and node are remembered. */
void
-info_select_reference (window, entry)
- WINDOW *window;
- REFERENCE *entry;
+info_select_reference (WINDOW *window, REFERENCE *entry)
{
NODE *node;
char *filename, *nodename, *file_system_error;
@@ -1781,9 +1753,9 @@ info_select_reference (window, entry)
if (!node)
{
if (file_system_error)
- info_error (file_system_error);
+ info_error (file_system_error, NULL, NULL);
else
- info_error (msg_cant_find_node, nodename);
+ info_error ((char *) msg_cant_find_node, nodename, NULL);
}
maybe_free (file_system_error);
@@ -1798,9 +1770,7 @@ info_select_reference (window, entry)
Select the parsed node in WINDOW and remember it, or error if the node
couldn't be found. */
static void
-info_parse_and_select (line, window)
- char *line;
- WINDOW *window;
+info_parse_and_select (char *line, WINDOW *window)
{
REFERENCE entry;
@@ -1818,9 +1788,7 @@ info_parse_and_select (line, window)
WINDOW. The node should have been pointed to by the LABEL pointer of
WINDOW->node. */
static void
-info_handle_pointer (label, window)
- char *label;
- WINDOW *window;
+info_handle_pointer (char *label, WINDOW *window)
{
if (info_parsed_filename || info_parsed_nodename)
{
@@ -1861,9 +1829,9 @@ info_handle_pointer (label, window)
else
{
if (info_recent_file_error)
- info_error (info_recent_file_error);
+ info_error (info_recent_file_error, NULL, NULL);
else
- info_error (msg_cant_file_node, filename, nodename);
+ info_error ((char *) msg_cant_file_node, filename, nodename);
}
free (filename);
@@ -1871,7 +1839,7 @@ info_handle_pointer (label, window)
}
else
{
- info_error (msg_no_pointer, label);
+ info_error ((char *) msg_no_pointer, label, NULL);
}
}
@@ -1927,7 +1895,7 @@ DECLARE_INFO_COMMAND (info_last_node, _("Select the last node in this file"))
}
if (!node)
- info_error (_("This window has no additional nodes"));
+ info_error ((char *) _("This window has no additional nodes"), NULL, NULL);
else
info_set_node_of_window (1, window, node);
}
@@ -1960,7 +1928,7 @@ DECLARE_INFO_COMMAND (info_first_node, _("Select the first node in this file"))
}
if (!node)
- info_error (_("This window has no additional nodes"));
+ info_error ((char *) _("This window has no additional nodes"), NULL, NULL);
else
info_set_node_of_window (1, window, node);
}
@@ -1976,13 +1944,13 @@ DECLARE_INFO_COMMAND (info_last_menu_item,
DECLARE_INFO_COMMAND (info_menu_digit, _("Select this menu item"))
{
register int i, item;
- register REFERENCE *entry, **menu;
+ register REFERENCE **menu;
menu = info_menu_of_node (window->node);
if (!menu)
{
- info_error (msg_no_menu_node);
+ info_error ((char *) msg_no_menu_node, NULL, NULL);
return;
}
@@ -1994,15 +1962,20 @@ DECLARE_INFO_COMMAND (info_menu_digit, _("Select this menu item"))
for (i = 0; menu[i + 1]; i++);
else
{
- for (i = 0; (entry = menu[i]); i++)
+ for (i = 0; menu[i]; i++)
if (i == item - 1)
break;
}
if (menu[i])
- info_select_reference (window, menu[i]);
+ {
+ info_select_reference (window, menu[i]);
+ if (menu[i]->line_number > 0)
+ info_next_line (window, menu[i]->line_number - 1, key);
+ }
else
- info_error (_("There aren't %d items in this menu."), item);
+ info_error ((char *) _("There aren't %d items in this menu."),
+ (void *) (long) item, NULL);
info_free_references (menu);
return;
@@ -2026,9 +1999,7 @@ DECLARE_INFO_COMMAND (info_menu_digit, _("Select this menu item"))
limit of 200 chars (in Emacs 21.2). */
static REFERENCE **
-nearest_xref (xref_list, pos)
- REFERENCE **xref_list;
- long pos;
+nearest_xref (REFERENCE **xref_list, long int pos)
{
int this_xref;
int nearest = -1;
@@ -2081,12 +2052,8 @@ nearest_xref (xref_list, pos)
to build the list of references. ASK_P is non-zero if the user
should be prompted, or zero to select the default item. */
static void
-info_menu_or_ref_item (window, count, key, builder, ask_p)
- WINDOW *window;
- int count;
- unsigned char key;
- REFERENCE **(*builder) ();
- int ask_p;
+info_menu_or_ref_item (WINDOW *window, int count,
+ unsigned char key, REFERENCE **(*builder) (NODE *node), int ask_p)
{
char *line;
REFERENCE *entry;
@@ -2096,9 +2063,9 @@ info_menu_or_ref_item (window, count, key, builder, ask_p)
if (!menu)
{
if (builder == info_menu_of_node)
- info_error (msg_no_menu_node);
+ info_error ((char *) msg_no_menu_node, NULL, NULL);
else
- info_error (msg_no_xref_node);
+ info_error ((char *) msg_no_xref_node, NULL, NULL);
return;
}
@@ -2165,16 +2132,20 @@ info_menu_or_ref_item (window, count, key, builder, ask_p)
else if (window->point < refs[which]->start)
break;
}
- if (closest == -1)
- which--;
- else
- which = closest;
+ if (which > 0)
+ {
+ if (closest == -1)
+ which--;
+ else
+ which = closest;
+ }
}
defentry = (REFERENCE *)xmalloc (sizeof (REFERENCE));
defentry->label = xstrdup (refs[which]->label);
defentry->filename = refs[which]->filename;
defentry->nodename = refs[which]->nodename;
+ defentry->line_number = refs[which]->line_number;
if (defentry->filename)
defentry->filename = xstrdup (defentry->filename);
@@ -2192,24 +2163,27 @@ info_menu_or_ref_item (window, count, key, builder, ask_p)
char *prompt;
/* Build the prompt string. */
- if (defentry)
- prompt = (char *)xmalloc (99 + strlen (defentry->label));
- else
- prompt = (char *)xmalloc (99);
-
if (builder == info_menu_of_node)
{
if (defentry)
- sprintf (prompt, _("Menu item (%s): "), defentry->label);
+ {
+ prompt = xmalloc (strlen (defentry->label)
+ + strlen (_("Menu item (%s): ")));
+ sprintf (prompt, _("Menu item (%s): "), defentry->label);
+ }
else
- sprintf (prompt, _("Menu item: "));
+ prompt = xstrdup (_("Menu item: "));
}
else
{
if (defentry)
- sprintf (prompt, _("Follow xref (%s): "), defentry->label);
+ {
+ prompt = xmalloc (strlen (defentry->label)
+ + strlen (_("Follow xref (%s): ")));
+ sprintf (prompt, _("Follow xref (%s): "), defentry->label);
+ }
else
- sprintf (prompt, _("Follow xref: "));
+ prompt = xstrdup (_("Follow xref: "));
}
line = info_read_completing_in_echo_area (window, prompt, menu);
@@ -2287,11 +2261,12 @@ info_menu_or_ref_item (window, count, key, builder, ask_p)
}
if (!entry && defentry)
- info_error (_("The reference disappeared! (%s)."), line);
+ info_error ((char *) _("The reference disappeared! (%s)."), line, NULL);
else
{
NODE *orig = window->node;
info_select_reference (window, entry);
+
if (builder == info_xrefs_of_node && window->node != orig
&& !(window->node->flags & N_FromAnchor))
{ /* Search for this reference in the node. */
@@ -2312,6 +2287,11 @@ info_menu_or_ref_item (window, count, key, builder, ask_p)
window_adjust_pagetop (window);
}
}
+
+ if (entry->line_number > 0)
+ /* next_line starts at line 1? Anyway, the -1 makes it
+ move to the right line. */
+ info_next_line (window, entry->line_number - 1, key);
}
free (line);
@@ -2359,7 +2339,7 @@ DECLARE_INFO_COMMAND (info_find_menu, _("Move to the start of this node's menu")
position = search (INFO_MENU_LABEL, &binding);
if (position == -1)
- info_error (msg_no_menu_node);
+ info_error ((char *) msg_no_menu_node, NULL, NULL);
else
{
window->point = position;
@@ -2378,7 +2358,7 @@ DECLARE_INFO_COMMAND (info_visit_menu,
menu = info_menu_of_node (window->node);
if (!menu)
- info_error (msg_no_menu_node);
+ info_error ((char *) msg_no_menu_node, NULL, NULL);
for (i = 0; (!info_error_was_printed) && (entry = menu[i]); i++)
{
@@ -2388,7 +2368,7 @@ DECLARE_INFO_COMMAND (info_visit_menu,
window_tile_windows (TILE_INTERNALS);
if (!new)
- info_error (msg_win_too_small);
+ info_error ((char *) msg_win_too_small, NULL, NULL);
else
{
active_window = new;
@@ -2453,11 +2433,12 @@ DECLARE_INFO_COMMAND (info_goto_node, _("Read a node name and select it"))
}
}
}
- line = info_read_maybe_completing (window, _("Goto node: "), items);
+ line = info_read_maybe_completing (window, (char *) _("Goto node: "),
+ items);
info_free_references (items);
}
#else /* !GOTO_COMPLETES */
- line = info_read_in_echo_area (window, _("Goto node: "));
+ line = info_read_in_echo_area (window, (char *) _("Goto node: "));
#endif /* !GOTO_COMPLETES */
/* If the user aborted, quit now. */
@@ -2485,11 +2466,8 @@ DECLARE_INFO_COMMAND (info_goto_node, _("Read a node name and select it"))
will be NULL. */
NODE *
-info_follow_menus (initial_node, menus, errstr, errarg1, errarg2)
- NODE *initial_node;
- char **menus;
- const char **errstr;
- char **errarg1, **errarg2;
+info_follow_menus (NODE *initial_node, char **menus,
+ const char **errstr, char **errarg1, char **errarg2)
{
NODE *node = NULL;
*errstr = *errarg1 = *errarg2 = NULL;
@@ -2544,7 +2522,8 @@ info_follow_menus (initial_node, menus, errstr, errarg1, errarg2)
if (strcasecmp (entry->label, arg) == 0)
break;
else
- if (strncasecmp (entry->label, arg, strlen (arg)) == 0)
+ if ((best_guess == -1)
+ && (strncasecmp (entry->label, arg, strlen (arg)) == 0))
best_guess = i;
}
@@ -2622,8 +2601,7 @@ info_follow_menus (initial_node, menus, errstr, errarg1, errarg2)
Return array terminated with NULL. */
static char **
-split_list_of_nodenames (str)
- char *str;
+split_list_of_nodenames (char *str)
{
unsigned len = 2;
char **nodes = xmalloc (len * sizeof (char *));
@@ -2652,7 +2630,7 @@ split_list_of_nodenames (str)
DECLARE_INFO_COMMAND (info_menu_sequence,
_("Read a list of menus starting from dir and follow them"))
{
- char *line = info_read_in_echo_area (window, _("Follow menus: "));
+ char *line = info_read_in_echo_area (window, (char *) _("Follow menus: "));
/* If the user aborted, quit now. */
if (!line)
@@ -2665,10 +2643,11 @@ DECLARE_INFO_COMMAND (info_menu_sequence,
if (*line)
{
- char *errstr, *errarg1, *errarg2;
+ const char *errstr;
+ char *errarg1, *errarg2;
NODE *dir_node = info_get_node (NULL, NULL);
char **nodes = split_list_of_nodenames (line);
- NODE *node;
+ NODE *node = NULL;
/* If DIR_NODE is NULL, they might be reading a file directly,
like in "info -d . -f ./foo". Try using "Top" instead. */
@@ -2684,16 +2663,15 @@ DECLARE_INFO_COMMAND (info_menu_sequence,
/* If we still cannot find the starting point, give up.
We cannot allow a NULL pointer inside info_follow_menus. */
if (!dir_node)
- info_error (msg_cant_find_node, "Top");
+ info_error ((char *) msg_cant_find_node, "Top", NULL);
else
- node
- = info_follow_menus (dir_node, nodes, &errstr, &errarg1, &errarg2);
+ node = info_follow_menus (dir_node, nodes, &errstr, &errarg1, &errarg2);
free (nodes);
if (!errstr)
info_set_node_of_window (1, window, node);
else
- info_error (errstr, errarg1, errarg2);
+ info_error ((char *) errstr, errarg1, errarg2);
}
free (line);
@@ -2706,10 +2684,7 @@ DECLARE_INFO_COMMAND (info_menu_sequence,
or NULL if there's nothing in this menu seems to fit the bill.
If EXACT is non-zero, allow only exact matches. */
static REFERENCE *
-entry_in_menu (arg, menu, exact)
- char *arg;
- REFERENCE **menu;
- int exact;
+entry_in_menu (char *arg, REFERENCE **menu, int exact)
{
REFERENCE *entry;
@@ -2743,10 +2718,7 @@ entry_in_menu (arg, menu, exact)
invocation info and its command-line options, by looking for menu
items and chains of menu items with characteristic names. */
void
-info_intuit_options_node (window, initial_node, program)
- WINDOW *window;
- NODE *initial_node;
- char *program;
+info_intuit_options_node (WINDOW *window, NODE *initial_node, char *program)
{
/* The list of node names typical for GNU manuals where the program
usage and specifically the command-line arguments are described.
@@ -2781,7 +2753,7 @@ info_intuit_options_node (window, initial_node, program)
in the menu hierarchy... */
for (node = initial_node; node; initial_node = node)
{
- REFERENCE *entry;
+ REFERENCE *entry = NULL;
/* Build and return a list of the menu items in this node. */
menu = info_menu_of_node (initial_node);
@@ -2794,13 +2766,15 @@ info_intuit_options_node (window, initial_node, program)
/* Look for node names typical for usage nodes in this menu. */
for (try_node = invocation_nodes; *try_node; try_node++)
{
- char nodename[200];
+ char *nodename;
+ nodename = xmalloc (strlen (program) + strlen (*try_node));
sprintf (nodename, *try_node, program);
/* The last resort "%s" is dangerous, so we restrict it
to exact matches here. */
entry = entry_in_menu (nodename, menu,
strcmp (*try_node, "%s") == 0);
+ free (nodename);
if (entry)
break;
}
@@ -2828,8 +2802,7 @@ info_intuit_options_node (window, initial_node, program)
/* Given a name of an Info file, find the name of the package it
describes by removing the leading directories and extensions. */
char *
-program_name_from_file_name (file_name)
- char *file_name;
+program_name_from_file_name (char *file_name)
{
int i;
char *program_name = xstrdup (filename_non_directory (file_name));
@@ -2870,7 +2843,7 @@ DECLARE_INFO_COMMAND (info_goto_invocation_node,
free (prompt);
if (!line)
{
- info_abort_key ();
+ info_abort_key (window, 0, 0);
return;
}
if (*line)
@@ -2882,7 +2855,7 @@ DECLARE_INFO_COMMAND (info_goto_invocation_node,
from the Top node. */
top_node = info_get_node (file_name, NULL);
if (!top_node)
- info_error (msg_cant_find_node, "Top");
+ info_error ((char *) msg_cant_find_node, "Top", NULL);
info_intuit_options_node (window, top_node, program_name);
free (line);
@@ -2894,7 +2867,7 @@ DECLARE_INFO_COMMAND (info_man, _("Read a manpage reference and select it"))
{
char *line;
- line = info_read_in_echo_area (window, _("Get Manpage: "));
+ line = info_read_in_echo_area (window, (char *) _("Get Manpage: "));
if (!line)
{
@@ -2939,8 +2912,7 @@ DECLARE_INFO_COMMAND (info_dir_node, _("Select the node `(dir)'"))
/* Read the name of a node to kill. The list of available nodes comes
from the nodes appearing in the current window configuration. */
static char *
-read_nodename_to_kill (window)
- WINDOW *window;
+read_nodename_to_kill (WINDOW *window)
{
int iw;
char *nodename;
@@ -2948,7 +2920,7 @@ read_nodename_to_kill (window)
REFERENCE **menu = NULL;
int menu_index = 0, menu_slots = 0;
char *default_nodename = xstrdup (active_window->node->nodename);
- char *prompt = xmalloc (40 + strlen (default_nodename));
+ char *prompt = xmalloc (strlen (_("Kill node (%s): ")) + strlen (default_nodename));
sprintf (prompt, _("Kill node (%s): "), default_nodename);
@@ -2980,9 +2952,7 @@ read_nodename_to_kill (window)
/* Delete NODENAME from this window, showing the most
recently selected node in this window. */
static void
-kill_node (window, nodename)
- WINDOW *window;
- char *nodename;
+kill_node (WINDOW *window, char *nodename)
{
int iw, i;
INFO_WINDOW *info_win;
@@ -3004,7 +2974,7 @@ kill_node (window, nodename)
if (!info_win)
{
if (*nodename)
- info_error (_("Cannot kill node `%s'"), nodename);
+ info_error ((char *) _("Cannot kill node `%s'"), nodename, NULL);
else
window_clear_echo_area ();
@@ -3014,7 +2984,7 @@ kill_node (window, nodename)
/* If there are no more nodes left anywhere to view, complain and exit. */
if (info_windows_index == 1 && info_windows[0]->nodes_index == 1)
{
- info_error (_("Cannot kill the last node"));
+ info_error ((char *) _("Cannot kill the last node"), NULL, NULL);
return;
}
@@ -3118,7 +3088,7 @@ DECLARE_INFO_COMMAND (info_view_file, _("Read the name of a file and select it")
{
char *line;
- line = info_read_in_echo_area (window, _("Find file: "));
+ line = info_read_in_echo_area (window, (char *) _("Find file: "));
if (!line)
{
info_abort_key (active_window, 1, 0);
@@ -3133,9 +3103,9 @@ DECLARE_INFO_COMMAND (info_view_file, _("Read the name of a file and select it")
if (!node)
{
if (info_recent_file_error)
- info_error (info_recent_file_error);
+ info_error (info_recent_file_error, NULL, NULL);
else
- info_error (_("Cannot find `%s'."), line);
+ info_error ((char *) _("Cannot find `%s'."), line, NULL);
}
else
info_set_node_of_window (1, window, node);
@@ -3154,19 +3124,17 @@ DECLARE_INFO_COMMAND (info_view_file, _("Read the name of a file and select it")
/* **************************************************************** */
#define VERBOSE_NODE_DUMPING
-static void write_node_to_stream ();
-static void dump_node_to_stream ();
-static void initialize_dumping ();
+static void write_node_to_stream (NODE *node, FILE *stream);
+static void dump_node_to_stream (char *filename, char *nodename,
+ FILE *stream, int dump_subnodes);
+static void initialize_dumping (void);
/* Dump the nodes specified by FILENAME and NODENAMES to the file named
in OUTPUT_FILENAME. If DUMP_SUBNODES is non-zero, recursively dump
the nodes which appear in the menu of each node dumped. */
void
-dump_nodes_to_file (filename, nodenames, output_filename, dump_subnodes)
- char *filename;
- char **nodenames;
- char *output_filename;
- int dump_subnodes;
+dump_nodes_to_file (char *filename, char **nodenames,
+ char *output_filename, int dump_subnodes)
{
register int i;
FILE *output_stream;
@@ -3180,7 +3148,8 @@ dump_nodes_to_file (filename, nodenames, output_filename, dump_subnodes)
if (!output_stream)
{
- info_error (_("Could not create output file `%s'."), output_filename);
+ info_error ((char *) _("Could not create output file `%s'."),
+ output_filename, NULL);
return;
}
@@ -3193,7 +3162,7 @@ dump_nodes_to_file (filename, nodenames, output_filename, dump_subnodes)
fclose (output_stream);
#if defined (VERBOSE_NODE_DUMPING)
- info_error (_("Done."));
+ info_error ((char *) _("Done."), NULL, NULL);
#endif /* VERBOSE_NODE_DUMPING */
}
@@ -3203,7 +3172,7 @@ static int dumped_already_index = 0;
static int dumped_already_slots = 0;
static void
-initialize_dumping ()
+initialize_dumping (void)
{
dumped_already_index = 0;
}
@@ -3212,10 +3181,8 @@ initialize_dumping ()
If DUMP_SUBNODES is non-zero, recursively dump the nodes which appear
in the menu of each node dumped. */
static void
-dump_node_to_stream (filename, nodename, stream, dump_subnodes)
- char *filename, *nodename;
- FILE *stream;
- int dump_subnodes;
+dump_node_to_stream (char *filename, char *nodename,
+ FILE *stream, int dump_subnodes)
{
register int i;
NODE *node;
@@ -3225,14 +3192,15 @@ dump_node_to_stream (filename, nodename, stream, dump_subnodes)
if (!node)
{
if (info_recent_file_error)
- info_error (info_recent_file_error);
+ info_error (info_recent_file_error, NULL, NULL);
else
{
if (filename && *nodename != '(')
- info_error (msg_cant_file_node, filename_non_directory (filename),
- nodename);
+ info_error ((char *) msg_cant_file_node,
+ filename_non_directory (filename),
+ nodename);
else
- info_error (msg_cant_find_node, nodename);
+ info_error ((char *) msg_cant_find_node, nodename, NULL);
}
return;
}
@@ -3249,7 +3217,7 @@ dump_node_to_stream (filename, nodename, stream, dump_subnodes)
#if defined (VERBOSE_NODE_DUMPING)
/* Maybe we should print some information about the node being output. */
- info_error (_("Writing node %s..."), node_printed_rep (node));
+ info_error ((char *) _("Writing node %s..."), node_printed_rep (node), NULL);
#endif /* VERBOSE_NODE_DUMPING */
write_node_to_stream (node, stream);
@@ -3284,10 +3252,7 @@ dump_node_to_stream (filename, nodename, stream, dump_subnodes)
/* Dump NODE to FILENAME. If DUMP_SUBNODES is non-zero, recursively dump
the nodes which appear in the menu of each node dumped. */
void
-dump_node_to_file (node, filename, dump_subnodes)
- NODE *node;
- char *filename;
- int dump_subnodes;
+dump_node_to_file (NODE *node, char *filename, int dump_subnodes)
{
FILE *output_stream;
char *nodes_filename;
@@ -3301,7 +3266,8 @@ dump_node_to_file (node, filename, dump_subnodes)
if (!output_stream)
{
- info_error (_("Could not create output file `%s'."), filename);
+ info_error ((char *) _("Could not create output file `%s'."), filename,
+ NULL);
return;
}
@@ -3318,7 +3284,7 @@ dump_node_to_file (node, filename, dump_subnodes)
fclose (output_stream);
#if defined (VERBOSE_NODE_DUMPING)
- info_error (_("Done."));
+ info_error ((char *) _("Done."), NULL, NULL);
#endif /* VERBOSE_NODE_DUMPING */
}
@@ -3334,8 +3300,7 @@ DECLARE_INFO_COMMAND (info_print_node,
/* Print NODE on a printer piping it into INFO_PRINT_COMMAND. */
void
-print_node (node)
- NODE *node;
+print_node (NODE *node)
{
FILE *printer_pipe;
char *print_command = getenv ("INFO_PRINT_COMMAND");
@@ -3363,13 +3328,13 @@ print_node (node)
if (!printer_pipe)
{
- info_error (_("Cannot open pipe to `%s'."), print_command);
+ info_error ((char *) _("Cannot open pipe to `%s'."), print_command, NULL);
return;
}
#if defined (VERBOSE_NODE_DUMPING)
/* Maybe we should print some information about the node being output. */
- info_error (_("Printing node %s..."), node_printed_rep (node));
+ info_error ((char *) _("Printing node %s..."), node_printed_rep (node), NULL);
#endif /* VERBOSE_NODE_DUMPING */
write_node_to_stream (node, printer_pipe);
@@ -3379,14 +3344,12 @@ print_node (node)
fclose (printer_pipe);
#if defined (VERBOSE_NODE_DUMPING)
- info_error (_("Done."));
+ info_error ((char *) _("Done."), NULL, NULL);
#endif /* VERBOSE_NODE_DUMPING */
}
static void
-write_node_to_stream (node, stream)
- NODE *node;
- FILE *stream;
+write_node_to_stream (NODE *node, FILE *stream)
{
fwrite (node->contents, 1, node->nodelen, stream);
}
@@ -3403,11 +3366,11 @@ write_node_to_stream (node, stream)
to gc even those file buffer contents which had to be uncompressed. */
int gc_compressed_files = 0;
-static void info_gc_file_buffers ();
-static void info_search_1 ();
+static void info_gc_file_buffers (void);
+static void info_search_1 (WINDOW *window, int count,
+ unsigned char key, int case_sensitive, int ask_for_string);
static char *search_string = (char *)NULL;
-static int search_string_index = 0;
static int search_string_size = 0;
static int isearch_is_active = 0;
@@ -3416,8 +3379,7 @@ static int last_search_case_sensitive = 0;
/* Return the file buffer which belongs to WINDOW's node. */
FILE_BUFFER *
-file_buffer_of_window (window)
- WINDOW *window;
+file_buffer_of_window (WINDOW *window)
{
/* If this window has no node, then it has no file buffer. */
if (!window->node)
@@ -3439,12 +3401,8 @@ file_buffer_of_window (window)
DIR says which direction to search in. If it is positive, search
forward, else backwards. */
long
-info_search_in_node (string, node, start, window, dir, case_sensitive)
- char *string;
- NODE *node;
- long start;
- WINDOW *window;
- int dir, case_sensitive;
+info_search_in_node (char *string, NODE *node, long int start,
+ WINDOW *window, int dir, int case_sensitive)
{
SEARCH_BINDING binding;
long offset;
@@ -3486,13 +3444,10 @@ info_search_in_node (string, node, start, window, dir, case_sensitive)
search at START. Return the absolute position of the match, or -1, if
no part of the string could be found. */
long
-info_target_search_node (node, string, start)
- NODE *node;
- char *string;
- long start;
+info_target_search_node (NODE *node, char *string, long int start)
{
register int i;
- long offset;
+ long offset = 0;
char *target;
target = xstrdup (string);
@@ -3521,10 +3476,8 @@ info_target_search_node (node, string, start)
If the search fails, return non-zero, else zero. Side-effect window
leaving the node and point where the string was found current. */
static int
-info_search_internal (string, window, dir, case_sensitive)
- char *string;
- WINDOW *window;
- int dir, case_sensitive;
+info_search_internal (char *string, WINDOW *window,
+ int dir, int case_sensitive)
{
register int i;
FILE_BUFFER *file_buffer;
@@ -3561,7 +3514,7 @@ info_search_internal (string, window, dir, case_sensitive)
file's node list. */
if (file_buffer->tags)
{
- register int current_tag, number_of_tags;
+ register int current_tag = 0, number_of_tags;
char *last_subfile;
TAG *tag;
@@ -3611,8 +3564,8 @@ info_search_internal (string, window, dir, case_sensitive)
if (!echo_area_is_active && (last_subfile != tag->filename))
{
window_message_in_echo_area
- (_("Searching subfile %s ..."),
- filename_non_directory (tag->filename));
+ ((char *) _("Searching subfile %s ..."),
+ filename_non_directory (tag->filename), NULL);
last_subfile = tag->filename;
}
@@ -3625,9 +3578,9 @@ info_search_internal (string, window, dir, case_sensitive)
if (!echo_area_is_active)
{
if (info_recent_file_error)
- info_error (info_recent_file_error);
+ info_error (info_recent_file_error, NULL, NULL);
else
- info_error (msg_cant_file_node,
+ info_error ((char *) msg_cant_file_node,
filename_non_directory (file_buffer->filename),
tag->nodename);
}
@@ -3686,12 +3639,8 @@ DECLARE_INFO_COMMAND (info_search_backward,
}
static void
-info_search_1 (window, count, key, case_sensitive, ask_for_string)
- WINDOW *window;
- int count;
- unsigned char key;
- int case_sensitive;
- int ask_for_string;
+info_search_1 (WINDOW *window, int count, unsigned char key,
+ int case_sensitive, int ask_for_string)
{
char *line, *prompt;
int result, old_pagetop;
@@ -3718,7 +3667,12 @@ info_search_1 (window, count, key, case_sensitive, ask_for_string)
if (ask_for_string)
{
- prompt = (char *)xmalloc (50 + strlen (search_string));
+ prompt = (char *)xmalloc (strlen (_("%s%sfor string [%s]: "))
+ + strlen (_("Search backward"))
+ + strlen (_("Search"))
+ + strlen (_(" case-sensitively "))
+ + strlen (_(" "))
+ + strlen (search_string));
sprintf (prompt, _("%s%sfor string [%s]: "),
direction < 0 ? _("Search backward") : _("Search"),
@@ -3730,18 +3684,17 @@ info_search_1 (window, count, key, case_sensitive, ask_for_string)
if (!line)
{
- info_abort_key ();
+ info_abort_key (window, 0, 0);
return;
}
if (*line)
{
- if (strlen (line) + 1 > search_string_size)
+ if (strlen (line) + 1 > (unsigned int) search_string_size)
search_string = (char *) xrealloc
(search_string, (search_string_size += 50 + strlen (line)));
strcpy (search_string, line);
- search_string_index = strlen (line);
free (line);
}
}
@@ -3762,7 +3715,7 @@ info_search_1 (window, count, key, case_sensitive, ask_for_string)
active_window, direction, case_sensitive);
if (result != 0 && !info_error_was_printed)
- info_error (_("Search failed."));
+ info_error ((char *) _("Search failed."), NULL, NULL);
else if (old_pagetop != active_window->pagetop)
{
int new_pagetop;
@@ -3783,7 +3736,7 @@ DECLARE_INFO_COMMAND (info_search_next,
_("Repeat last search in the same direction"))
{
if (!last_search_direction)
- info_error (_("No previous search string"));
+ info_error ((char *) _("No previous search string"), NULL, NULL);
else
info_search_1 (window, last_search_direction * count,
key, last_search_case_sensitive, 0);
@@ -3793,7 +3746,7 @@ DECLARE_INFO_COMMAND (info_search_previous,
_("Repeat last search in the reverse direction"))
{
if (!last_search_direction)
- info_error (_("No previous search string"));
+ info_error ((char *) _("No previous search string"), NULL, NULL);
else
info_search_1 (window, -last_search_direction * count,
key, last_search_case_sensitive, 0);
@@ -3805,7 +3758,8 @@ DECLARE_INFO_COMMAND (info_search_previous,
/* */
/* **************************************************************** */
-static void incremental_search ();
+static void incremental_search (WINDOW *window, int count,
+ unsigned char ignore);
DECLARE_INFO_COMMAND (isearch_forward,
_("Search interactively for a string as you type it"))
@@ -3829,14 +3783,6 @@ static int isearch_string_index = 0;
static int isearch_string_size = 0;
static unsigned char isearch_terminate_search_key = ESC;
-/* Structure defining the current state of an incremental search. */
-typedef struct {
- WINDOW_STATE_DECL; /* The node, pagetop and point. */
- int search_index; /* Offset of the last char in the search string. */
- int direction; /* The direction that this search is heading in. */
- int failing; /* Whether or not this search failed. */
-} SEARCH_STATE;
-
/* Array of search states. */
static SEARCH_STATE **isearch_states = (SEARCH_STATE **)NULL;
static int isearch_states_index = 0;
@@ -3844,9 +3790,7 @@ static int isearch_states_slots = 0;
/* Push the state of this search. */
static void
-push_isearch (window, search_index, direction, failing)
- WINDOW *window;
- int search_index, direction, failing;
+push_isearch (WINDOW *window, int search_index, int direction, int failing)
{
SEARCH_STATE *state;
@@ -3862,9 +3806,7 @@ push_isearch (window, search_index, direction, failing)
/* Pop the state of this search to WINDOW, SEARCH_INDEX, and DIRECTION. */
static void
-pop_isearch (window, search_index, direction, failing)
- WINDOW *window;
- int *search_index, *direction, *failing;
+pop_isearch (WINDOW *window, int *search_index, int *direction, int *failing)
{
SEARCH_STATE *state;
@@ -3884,7 +3826,7 @@ pop_isearch (window, search_index, direction, failing)
/* Free the memory used by isearch_states. */
static void
-free_isearch_states ()
+free_isearch_states (void)
{
register int i;
@@ -3898,15 +3840,12 @@ free_isearch_states ()
/* Display the current search in the echo area. */
static void
-show_isearch_prompt (dir, string, failing_p)
- int dir;
- unsigned char *string;
- int failing_p;
+show_isearch_prompt (int dir, unsigned char *string, int failing_p)
{
register int i;
const char *prefix;
char *prompt, *p_rep;
- int prompt_len, p_rep_index, p_rep_size;
+ unsigned int prompt_len, p_rep_index, p_rep_size;
if (dir < 0)
prefix = _("I-search backward: ");
@@ -3941,17 +3880,14 @@ show_isearch_prompt (dir, string, failing_p)
sprintf (prompt, "%s%s%s", failing_p ? _("Failing ") : "", prefix,
p_rep ? p_rep : "");
- window_message_in_echo_area ("%s", prompt);
+ window_message_in_echo_area ("%s", prompt, NULL);
maybe_free (p_rep);
free (prompt);
display_cursor_at_point (active_window);
}
static void
-incremental_search (window, count, ignore)
- WINDOW *window;
- int count;
- unsigned char ignore;
+incremental_search (WINDOW *window, int count, unsigned char ignore)
{
unsigned char key;
int last_search_result, search_result, dir;
@@ -3974,7 +3910,7 @@ incremental_search (window, count, ignore)
/* Show the search string in the echo area. */
isearch_string[isearch_string_index] = '\0';
- show_isearch_prompt (dir, isearch_string, search_result);
+ show_isearch_prompt (dir, (unsigned char *) isearch_string, search_result);
isearch_is_active = 1;
@@ -4008,7 +3944,8 @@ incremental_search (window, count, ignore)
pop_isearch
(window, &isearch_string_index, &dir, &search_result);
isearch_string[isearch_string_index] = '\0';
- show_isearch_prompt (dir, isearch_string, search_result);
+ show_isearch_prompt (dir, (unsigned char *) isearch_string,
+ search_result);
goto after_search;
}
}
@@ -4046,15 +3983,16 @@ incremental_search (window, count, ignore)
isearch_string[isearch_string_index] = '\0';
goto search_now;
}
- else if (func == isearch_forward || func == isearch_backward)
+ else if (func == (VFunction *) isearch_forward
+ || func == (VFunction *) 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))
+ if ((func == (VFunction *) isearch_forward && dir > 0) ||
+ (func == (VFunction *) isearch_backward && dir < 0))
{
/* If the user has typed no characters, then insert the
last successful search into the current search string. */
@@ -4063,8 +4001,8 @@ incremental_search (window, count, ignore)
/* Of course, there must be something to insert. */
if (last_isearch_accepted)
{
- if (strlen (last_isearch_accepted) + 1 >=
- isearch_string_size)
+ if (strlen ((char *) last_isearch_accepted) + 1
+ >= (unsigned int) isearch_string_size)
isearch_string = (char *)
xrealloc (isearch_string,
isearch_string_size += 10 +
@@ -4090,7 +4028,7 @@ incremental_search (window, count, ignore)
dir = -dir;
}
}
- else if (func == info_abort_key)
+ else if (func == (VFunction *) info_abort_key)
{
/* If C-g pressed, and the search is failing, pop the search
stack back to the last unfailed search. */
@@ -4101,7 +4039,8 @@ incremental_search (window, count, ignore)
pop_isearch
(window, &isearch_string_index, &dir, &search_result);
isearch_string[isearch_string_index] = '\0';
- show_isearch_prompt (dir, isearch_string, search_result);
+ show_isearch_prompt (dir, (unsigned char *) isearch_string,
+ search_result);
continue;
}
else
@@ -4117,7 +4056,7 @@ incremental_search (window, count, ignore)
non-null. Exit the search, remembering the search string. If
the key is not the same as the isearch_terminate_search_key,
then push it into pending input. */
- if (isearch_string_index && func != info_abort_key)
+ if (isearch_string_index && func != (VFunction *) info_abort_key)
{
maybe_free (last_isearch_accepted);
last_isearch_accepted = xstrdup (isearch_string);
@@ -4136,7 +4075,7 @@ incremental_search (window, count, ignore)
|| info_any_buffered_input_p ()))
info_set_pending_input (key);
- if (func == info_abort_key)
+ if (func == (VFunction *) info_abort_key)
{
if (isearch_states_index)
window_set_state (window, &orig_state);
@@ -4154,7 +4093,7 @@ incremental_search (window, count, ignore)
/* Search for the contents of isearch_string. */
search_now:
- show_isearch_prompt (dir, isearch_string, search_result);
+ show_isearch_prompt (dir, (unsigned char *) isearch_string, search_result);
/* If the search string includes upper-case letters, make the
search case-sensitive. */
@@ -4196,7 +4135,7 @@ incremental_search (window, count, ignore)
terminal_ring_bell ();
after_search:
- show_isearch_prompt (dir, isearch_string, search_result);
+ show_isearch_prompt (dir, (unsigned char *) isearch_string, search_result);
if (search_result == 0)
{
@@ -4230,7 +4169,7 @@ incremental_search (window, count, ignore)
Garbage collecting a file buffer means to free the file buffers
contents. */
static void
-info_gc_file_buffers ()
+info_gc_file_buffers (void)
{
register int fb_index, iw_index, i;
register FILE_BUFFER *fb;
@@ -4289,11 +4228,7 @@ info_gc_file_buffers ()
/* Move to the next or previous cross reference in this node. */
static void
-info_move_to_xref (window, count, key, dir)
- WINDOW *window;
- int count;
- unsigned char key;
- int dir;
+info_move_to_xref (WINDOW *window, int count, unsigned char key, int dir)
{
long firstmenu, firstxref;
long nextmenu, nextxref;
@@ -4335,7 +4270,7 @@ info_move_to_xref (window, count, key, dir)
if (firstmenu == -1 && firstxref == -1)
{
- info_error (msg_no_xref_node);
+ info_error ((char *) msg_no_xref_node, NULL, NULL);
return;
}
@@ -4424,10 +4359,11 @@ DECLARE_INFO_COMMAND (info_select_reference_this_line,
_("Select reference or menu item appearing on this line"))
{
char *line;
- NODE *orig;
- line = window->line_starts[window_line_of_point (window)];
- orig = window->node;
+ if (window->line_starts)
+ line = window->line_starts[window_line_of_point (window)];
+ else
+ line = "";
/* If this line contains a menu item, select that one. */
if (strncmp ("* ", line, 2) == 0)
@@ -4450,7 +4386,7 @@ DECLARE_INFO_COMMAND (info_abort_key, _("Cancel current operation"))
do it. */
if (!info_error_rings_bell_p)
terminal_ring_bell ();
- info_error (_("Quit"));
+ info_error ((char *) _("Quit"), NULL, NULL);
info_initialize_numeric_arg ();
info_clear_pending_input ();
@@ -4545,19 +4481,18 @@ DECLARE_INFO_COMMAND (info_do_lowercase_version,
{}
static void
-dispatch_error (keyseq)
- char *keyseq;
+dispatch_error (char *keyseq)
{
char *rep;
rep = pretty_keyseq (keyseq);
if (!echo_area_is_active)
- info_error (_("Unknown command (%s)."), rep);
+ info_error ((char *) _("Unknown command (%s)."), rep, NULL);
else
{
- char *temp = xmalloc (1 + strlen (rep) + strlen (_("\"\" is invalid")));
- sprintf (temp, _("\"%s\" is invalid"), rep);
+ char *temp = xmalloc (1 + strlen (rep) + strlen (_("\"%s\" is invalid")));
+ sprintf (temp, _("`%s' is invalid"), rep);
terminal_ring_bell ();
inform_in_echo_area (temp);
free (temp);
@@ -4572,7 +4507,7 @@ static int info_keyseq_displayed_p = 0;
/* Initialize the length of the current key sequence. */
void
-initialize_keyseq ()
+initialize_keyseq (void)
{
info_keyseq_index = 0;
info_keyseq_displayed_p = 0;
@@ -4580,8 +4515,7 @@ initialize_keyseq ()
/* Add CHARACTER to the current key sequence. */
void
-add_char_to_keyseq (character)
- char character;
+add_char_to_keyseq (char character)
{
if (info_keyseq_index + 2 >= info_keyseq_size)
info_keyseq = (char *)xrealloc (info_keyseq, info_keyseq_size += 10);
@@ -4593,9 +4527,8 @@ add_char_to_keyseq (character)
/* 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. */
-void
-display_info_keyseq (expecting_future_input)
- int expecting_future_input;
+static void
+display_info_keyseq (int expecting_future_input)
{
char *rep;
@@ -4607,7 +4540,7 @@ display_info_keyseq (expecting_future_input)
inform_in_echo_area (rep);
else
{
- window_message_in_echo_area (rep);
+ window_message_in_echo_area (rep, NULL, NULL);
display_cursor_at_point (active_window);
}
info_keyseq_displayed_p = 1;
@@ -4615,7 +4548,7 @@ display_info_keyseq (expecting_future_input)
/* Called by interactive commands to read a keystroke. */
unsigned char
-info_get_another_input_char ()
+info_get_another_input_char (void)
{
int ready = !info_keyseq_displayed_p; /* ready if new and pending key */
@@ -4652,9 +4585,7 @@ info_get_another_input_char ()
/* Do the command associated with KEY in MAP. If the associated command is
really a keymap, then read another key, and dispatch into that map. */
void
-info_dispatch_on_key (key, map)
- unsigned char key;
- Keymap map;
+info_dispatch_on_key (unsigned char key, Keymap map)
{
#if !defined(INFOKEY)
if (Meta_p (key) && (!ISO_Latin_p || map[key].function != ea_insert))
@@ -4684,7 +4615,7 @@ info_dispatch_on_key (key, map)
if (func != (VFunction *)NULL)
{
/* Special case info_do_lowercase_version (). */
- if (func == info_do_lowercase_version)
+ if (func == (VFunction *) info_do_lowercase_version)
{
#if defined(INFOKEY)
unsigned char lowerkey;
@@ -4792,7 +4723,7 @@ DECLARE_INFO_COMMAND (info_universal_argument,
/* Create a default argument. */
void
-info_initialize_numeric_arg ()
+info_initialize_numeric_arg (void)
{
info_numeric_arg = info_numeric_arg_sign = 1;
info_explicit_arg = 0;
@@ -4833,8 +4764,9 @@ DECLARE_INFO_COMMAND (info_numeric_arg_digit_loop,
key = UnMeta (key);
#endif /* !defined(INFOKEY) */
- if (keymap[key].type == ISFUNC &&
- InfoFunction(keymap[key].function) == info_universal_argument)
+ if (keymap[key].type == ISFUNC
+ && InfoFunction(keymap[key].function)
+ == (VFunction *) info_universal_argument)
{
info_numeric_arg *= 4;
key = 0;
@@ -4884,22 +4816,21 @@ static int pending_input_character = 0;
/* How to make there be no pending input. */
static void
-info_clear_pending_input ()
+info_clear_pending_input (void)
{
pending_input_character = 0;
}
/* How to set the pending input character. */
static void
-info_set_pending_input (key)
- unsigned char key;
+info_set_pending_input (unsigned char key)
{
pending_input_character = key;
}
/* How to see if there is any pending input. */
unsigned char
-info_input_pending_p ()
+info_input_pending_p (void)
{
return (pending_input_character);
}
@@ -4912,8 +4843,7 @@ static unsigned char info_input_buffer[MAX_INFO_INPUT_BUFFERING];
/* Add KEY to the buffer of characters to be read. */
static void
-info_push_typeahead (key)
- unsigned char key;
+info_push_typeahead (unsigned char key)
{
/* Flush all pending input in the case of C-g pressed. */
if (key == Control ('g'))
@@ -4924,14 +4854,14 @@ info_push_typeahead (key)
else
{
info_input_buffer[push_index++] = key;
- if (push_index >= sizeof (info_input_buffer))
+ if ((unsigned int) push_index >= sizeof (info_input_buffer))
push_index = 0;
}
}
/* Return the amount of space available in INFO_INPUT_BUFFER for new chars. */
static int
-info_input_buffer_space_available ()
+info_input_buffer_space_available (void)
{
if (pop_index > push_index)
return (pop_index - push_index);
@@ -4943,22 +4873,21 @@ info_input_buffer_space_available ()
Return the key in KEY.
Result is non-zero if there was a key, or 0 if there wasn't. */
static int
-info_get_key_from_typeahead (key)
- unsigned char *key;
+info_get_key_from_typeahead (unsigned char *key)
{
if (push_index == pop_index)
return (0);
*key = info_input_buffer[pop_index++];
- if (pop_index >= sizeof (info_input_buffer))
+ if ((unsigned int) pop_index >= sizeof (info_input_buffer))
pop_index = 0;
return (1);
}
int
-info_any_buffered_input_p ()
+info_any_buffered_input_p (void)
{
info_gather_typeahead ();
return (push_index != pop_index);
@@ -4967,7 +4896,7 @@ info_any_buffered_input_p ()
/* If characters are available to be read, then read them and stuff them into
info_input_buffer. Otherwise, do nothing. */
void
-info_gather_typeahead ()
+info_gather_typeahead (void)
{
register int i = 0;
int tty, space_avail;
@@ -5041,7 +4970,7 @@ info_gather_typeahead ()
/* How to read a single character. */
unsigned char
-info_get_input_char ()
+info_get_input_char (void)
{
unsigned char keystroke;
diff --git a/contrib/texinfo/info/signals.c b/contrib/texinfo/info/signals.c
index 61e5f97..724768b 100644
--- a/contrib/texinfo/info/signals.c
+++ b/contrib/texinfo/info/signals.c
@@ -1,7 +1,7 @@
-/* signals.c -- install and maintain Info signal handlers.
- $Id: signals.c,v 1.4 2003/01/29 19:23:22 karl Exp $
+/* signals.c -- install and maintain signal handlers.
+ $Id: signals.c,v 1.7 2004/04/11 17:56:46 karl Exp $
- Copyright (C) 1993, 1994, 1995, 1998, 2002, 2003 Free Software
+ Copyright (C) 1993, 1994, 1995, 1998, 2002, 2003, 2004 Free Software
Foundation, Inc.
This program is free software; you can redistribute it and/or modify
@@ -18,11 +18,13 @@
along with this program; if not, write to the Free Software
Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
- Written by Brian Fox (bfox@ai.mit.edu). */
+ Originally written by Brian Fox (bfox@ai.mit.edu). */
#include "info.h"
#include "signals.h"
+void initialize_info_signal_handler (void);
+
/* **************************************************************** */
/* */
/* Pretending That We Have POSIX Signals */
@@ -32,8 +34,7 @@
#if !defined (HAVE_SIGPROCMASK) && defined (HAVE_SIGSETMASK)
/* Perform OPERATION on NEWSET, perhaps leaving information in OLDSET. */
static void
-sigprocmask (operation, newset, oldset)
- int operation, *newset, *oldset;
+sigprocmask (int operation, int *newset, int *oldset)
{
switch (operation)
{
@@ -64,8 +65,7 @@ sigprocmask (operation, newset, oldset)
#if defined (HAVE_SIGACTION) || defined (HAVE_SIGPROCMASK) ||\
defined (HAVE_SIGSETMASK)
static void
-mask_termsig (set)
- sigset_t *set;
+mask_termsig (sigset_t *set)
{
# if defined (SIGTSTP)
sigaddset (set, SIGTSTP);
@@ -75,6 +75,9 @@ mask_termsig (set)
# if defined (SIGWINCH)
sigaddset (set, SIGWINCH);
# endif
+#if defined (SIGQUIT)
+ sigaddset (set, SIGQUIT);
+#endif
#if defined (SIGINT)
sigaddset (set, SIGINT);
#endif
@@ -84,23 +87,19 @@ mask_termsig (set)
}
#endif /* HAVE_SIGACTION || HAVE_SIGPROCMASK || HAVE_SIGSETMASK */
-static RETSIGTYPE info_signal_proc ();
+static RETSIGTYPE info_signal_proc (int sig);
#if defined (HAVE_SIGACTION)
typedef struct sigaction signal_info;
signal_info info_signal_handler;
static void
-set_termsig (sig, old)
- int sig;
- signal_info *old;
+set_termsig (int sig, signal_info *old)
{
sigaction (sig, &info_signal_handler, old);
}
static void
-restore_termsig (sig, saved)
- int sig;
- const signal_info *saved;
+restore_termsig (int sig, const signal_info *saved)
{
sigaction (sig, saved, NULL);
}
@@ -114,15 +113,20 @@ static int term_conf_busy = 0;
static signal_info old_TSTP, old_TTOU, old_TTIN;
static signal_info old_WINCH, old_INT, old_USR1;
+static signal_info old_QUIT;
void
-initialize_info_signal_handler ()
+initialize_info_signal_handler (void)
{
-#if defined (HAVE_SIGACTION)
+#ifdef SA_NOCLDSTOP
+ /* (Based on info from Paul Eggert found in coreutils.) Don't use
+ HAVE_SIGACTION to decide whether to use the sa_handler, sa_flags,
+ sa_mask members, as some systems (Solaris 7+) don't define them. Use
+ SA_NOCLDSTOP instead; it's been part of POSIX.1 since day 1 (in 1988). */
info_signal_handler.sa_handler = info_signal_proc;
info_signal_handler.sa_flags = 0;
mask_termsig (&info_signal_handler.sa_mask);
-#endif /* HAVE_SIGACTION */
+#endif /* SA_NOCLDSTOP */
#if defined (SIGTSTP)
set_termsig (SIGTSTP, &old_TSTP);
@@ -134,6 +138,10 @@ initialize_info_signal_handler ()
set_termsig (SIGWINCH, &old_WINCH);
#endif
+#if defined (SIGQUIT)
+ set_termsig (SIGQUIT, &old_QUIT);
+#endif
+
#if defined (SIGINT)
set_termsig (SIGINT, &old_INT);
#endif
@@ -145,7 +153,7 @@ initialize_info_signal_handler ()
}
static void
-redisplay_after_signal ()
+redisplay_after_signal (void)
{
terminal_clear_screen ();
display_clear_display (the_display);
@@ -156,7 +164,7 @@ redisplay_after_signal ()
}
static void
-reset_info_window_sizes ()
+reset_info_window_sizes (void)
{
terminal_goto_xy (0, 0);
fflush (stdout);
@@ -164,15 +172,14 @@ reset_info_window_sizes ()
terminal_get_screen_size ();
terminal_prep_terminal ();
display_initialize_display (screenwidth, screenheight);
- window_new_screen_size (screenwidth, screenheight, NULL);
+ window_new_screen_size (screenwidth, screenheight);
redisplay_after_signal ();
}
static RETSIGTYPE
-info_signal_proc (sig)
- int sig;
+info_signal_proc (int sig)
{
- signal_info *old_signal_handler;
+ signal_info *old_signal_handler = NULL;
#if !defined (HAVE_SIGACTION)
/* best effort: first increment this counter and later block signals */
@@ -195,6 +202,9 @@ info_signal_proc (sig)
case SIGTTOU:
case SIGTTIN:
#endif
+#if defined (SIGQUIT)
+ case SIGQUIT:
+#endif
#if defined (SIGINT)
case SIGINT:
#endif
@@ -207,6 +217,10 @@ info_signal_proc (sig)
if (sig == SIGTTIN)
old_signal_handler = &old_TTIN;
#endif /* SIGTSTP */
+#if defined (SIGQUIT)
+ if (sig == SIGQUIT)
+ old_signal_handler = &old_QUIT;
+#endif /* SIGQUIT */
#if defined (SIGINT)
if (sig == SIGINT)
old_signal_handler = &old_INT;
diff --git a/contrib/texinfo/info/terminal.c b/contrib/texinfo/info/terminal.c
index ff9913a..9238643 100644
--- a/contrib/texinfo/info/terminal.c
+++ b/contrib/texinfo/info/terminal.c
@@ -1,8 +1,8 @@
/* terminal.c -- how to handle the physical terminal for Info.
- $Id: terminal.c,v 1.1 2002/08/25 23:38:38 karl Exp $
+ $Id: terminal.c,v 1.3 2004/04/11 17:56:46 karl Exp $
Copyright (C) 1988, 1989, 1990, 1991, 1992, 1993, 1996, 1997, 1998,
- 1999, 2001, 2002 Free Software Foundation, Inc.
+ 1999, 2001, 2002, 2004 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
@@ -18,7 +18,7 @@
along with this program; if not, write to the Free Software
Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
- Written by Brian Fox (bfox@ai.mit.edu). */
+ Originally written by Brian Fox (bfox@ai.mit.edu). */
#include "info.h"
#include "terminal.h"
@@ -103,9 +103,6 @@ static char *visible_bell;
/* The string to write to turn on the meta key, if this term has one. */
static char *term_mm;
-/* The string to write to turn off the meta key, if this term has one. */
-static char *term_mo;
-
/* The string to turn on inverse mode, if this term has one. */
static char *term_invbeg;
@@ -116,8 +113,7 @@ static char *term_invend;
return its argument, all the code I've looked at (termutils, less)
does so, so fine. */
static int
-output_character_function (c)
- int c;
+output_character_function (int c)
{
putc (c, stdout);
return c;
@@ -132,9 +128,9 @@ output_character_function (c)
/* Tell the terminal that we will be doing cursor addressable motion. */
static void
-terminal_begin_using_terminal ()
+terminal_begin_using_terminal (void)
{
- RETSIGTYPE (*sigsave) ();
+ RETSIGTYPE (*sigsave) (int signum);
if (term_keypad_on)
send_to_terminal (term_keypad_on);
@@ -163,9 +159,9 @@ terminal_begin_using_terminal ()
/* Tell the terminal that we will not be doing any more cursor
addressable motion. */
static void
-terminal_end_using_terminal ()
+terminal_end_using_terminal (void)
{
- RETSIGTYPE (*sigsave) ();
+ RETSIGTYPE (*sigsave) (int signum);
if (term_keypad_off)
send_to_terminal (term_keypad_off);
@@ -230,8 +226,7 @@ char *term_kx = NULL; /* del */
/* Move the cursor to the terminal location of X and Y. */
void
-terminal_goto_xy (x, y)
- int x, y;
+terminal_goto_xy (int x, int y)
{
if (terminal_goto_xy_hook)
(*terminal_goto_xy_hook) (x, y);
@@ -244,8 +239,7 @@ terminal_goto_xy (x, y)
/* Print STRING to the terminal at the current position. */
void
-terminal_put_text (string)
- char *string;
+terminal_put_text (char *string)
{
if (terminal_put_text_hook)
(*terminal_put_text_hook) (string);
@@ -257,9 +251,7 @@ terminal_put_text (string)
/* Print NCHARS from STRING to the terminal at the current position. */
void
-terminal_write_chars (string, nchars)
- char *string;
- int nchars;
+terminal_write_chars (char *string, int nchars)
{
if (terminal_write_chars_hook)
(*terminal_write_chars_hook) (string, nchars);
@@ -272,7 +264,7 @@ terminal_write_chars (string, nchars)
/* Clear from the current position of the cursor to the end of the line. */
void
-terminal_clear_to_eol ()
+terminal_clear_to_eol (void)
{
if (terminal_clear_to_eol_hook)
(*terminal_clear_to_eol_hook) ();
@@ -284,7 +276,7 @@ terminal_clear_to_eol ()
/* Clear the entire terminal screen. */
void
-terminal_clear_screen ()
+terminal_clear_screen (void)
{
if (terminal_clear_screen_hook)
(*terminal_clear_screen_hook) ();
@@ -296,7 +288,7 @@ terminal_clear_screen ()
/* Move the cursor up one line. */
void
-terminal_up_line ()
+terminal_up_line (void)
{
if (terminal_up_line_hook)
(*terminal_up_line_hook) ();
@@ -308,7 +300,7 @@ terminal_up_line ()
/* Move the cursor down one line. */
void
-terminal_down_line ()
+terminal_down_line (void)
{
if (terminal_down_line_hook)
(*terminal_down_line_hook) ();
@@ -320,7 +312,7 @@ terminal_down_line ()
/* Turn on reverse video if possible. */
void
-terminal_begin_inverse ()
+terminal_begin_inverse (void)
{
if (terminal_begin_inverse_hook)
(*terminal_begin_inverse_hook) ();
@@ -332,7 +324,7 @@ terminal_begin_inverse ()
/* Turn off reverse video if possible. */
void
-terminal_end_inverse ()
+terminal_end_inverse (void)
{
if (terminal_end_inverse_hook)
(*terminal_end_inverse_hook) ();
@@ -345,7 +337,7 @@ terminal_end_inverse ()
/* Ring the terminal bell. The bell is run visibly if it both has one and
terminal_use_visible_bell_p is non-zero. */
void
-terminal_ring_bell ()
+terminal_ring_bell (void)
{
if (terminal_ring_bell_hook)
(*terminal_ring_bell_hook) ();
@@ -360,8 +352,7 @@ terminal_ring_bell ()
/* At the line START, delete COUNT lines from the terminal display. */
static void
-terminal_delete_lines (start, count)
- int start, count;
+terminal_delete_lines (int start, int count)
{
int lines;
@@ -384,8 +375,7 @@ terminal_delete_lines (start, count)
/* At the line START, insert COUNT lines in the terminal display. */
static void
-terminal_insert_lines (start, count)
- int start, count;
+terminal_insert_lines (int start, int count)
{
int lines;
@@ -412,8 +402,7 @@ terminal_insert_lines (start, count)
towards the top of the screen, else they are scrolled towards the
bottom of the screen. */
void
-terminal_scroll_terminal (start, end, amount)
- int start, end, amount;
+terminal_scroll_terminal (int start, int end, int amount)
{
if (!terminal_can_scroll)
return;
@@ -449,8 +438,7 @@ terminal_scroll_terminal (start, end, amount)
/* Re-initialize the terminal considering that the TERM/TERMCAP variable
has changed. */
void
-terminal_new_terminal (terminal_name)
- char *terminal_name;
+terminal_new_terminal (char *terminal_name)
{
if (terminal_new_terminal_hook)
(*terminal_new_terminal_hook) (terminal_name);
@@ -462,7 +450,7 @@ terminal_new_terminal (terminal_name)
/* Set the global variables SCREENWIDTH and SCREENHEIGHT. */
void
-terminal_get_screen_size ()
+terminal_get_screen_size (void)
{
if (terminal_get_screen_size_hook)
(*terminal_get_screen_size_hook) ();
@@ -522,8 +510,7 @@ terminal_get_screen_size ()
TERMINAL_HAS_META_P becomes nonzero if this terminal supports a Meta
key. Finally, the terminal screen is cleared. */
void
-terminal_initialize_terminal (terminal_name)
- char *terminal_name;
+terminal_initialize_terminal (char *terminal_name)
{
char *buffer;
@@ -632,12 +619,10 @@ terminal_initialize_terminal (terminal_name)
if (terminal_has_meta_p)
{
term_mm = tgetstr ("mm", &buffer);
- term_mo = tgetstr ("mo", &buffer);
}
else
{
term_mm = NULL;
- term_mo = NULL;
}
/* Attempt to find the arrow keys. */
@@ -704,7 +689,7 @@ struct ltchars original_ltchars;
/* Prepare to start using the terminal to read characters singly. */
void
-terminal_prep_terminal ()
+terminal_prep_terminal (void)
{
int tty;
@@ -844,7 +829,7 @@ terminal_prep_terminal ()
/* Restore the tty settings back to what they were before we started using
this terminal. */
void
-terminal_unprep_terminal ()
+terminal_unprep_terminal (void)
{
int tty;
diff --git a/contrib/texinfo/makeinfo/makeinfo.c b/contrib/texinfo/makeinfo/makeinfo.c
index a5e63fc..22ed4c4 100644
--- a/contrib/texinfo/makeinfo/makeinfo.c
+++ b/contrib/texinfo/makeinfo/makeinfo.c
@@ -1,8 +1,8 @@
/* makeinfo -- convert Texinfo source into other formats.
- $Id: makeinfo.c,v 1.34 2003/06/02 12:32:29 karl Exp $
+ $Id: makeinfo.c,v 1.74 2004/12/19 17:15:42 karl Exp $
Copyright (C) 1987, 1992, 1993, 1994, 1995, 1996, 1997, 1998, 1999,
- 2000, 2001, 2002, 2003 Free Software Foundation, Inc.
+ 2000, 2001, 2002, 2003, 2004 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
@@ -18,7 +18,7 @@
along with this program; if not, write to the Free Software
Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
- Makeinfo was authored by Brian Fox (bfox@ai.mit.edu). */
+ Original author of makeinfo: Brian Fox (bfox@ai.mit.edu). */
#include "system.h"
#include "getopt.h"
@@ -27,6 +27,7 @@
#include "makeinfo.h"
#include "cmds.h"
#include "files.h"
+#include "float.h"
#include "footnote.h"
#include "html.h"
#include "index.h"
@@ -34,6 +35,7 @@
#include "lang.h"
#include "macro.h"
#include "node.h"
+#include "sectioning.h"
#include "toc.h"
#include "xml.h"
@@ -69,10 +71,6 @@ char *output_filename = NULL;
char *command_output_filename = NULL;
static char *save_command_output_filename = NULL;
-/* Flags which control initial output string for xrefs. */
-int px_ref_flag = 0;
-int ref_flag = 0;
-
#define INITIAL_PARAGRAPH_SPACE 5000
int paragraph_buffer_len = INITIAL_PARAGRAPH_SPACE;
@@ -135,9 +133,16 @@ int do_justification = 0;
/* Nonzero means don't replace whitespace with &nbsp; in HTML mode. */
int in_html_elt = 0;
+/* Nonzero means we are inserting a block level HTML element that must not be
+ enclosed in a <p>, such as <ul>, <ol> and <h?>. */
+int in_html_block_level_elt = 0;
+
/* True when expanding a macro definition. */
static int executing_macro = 0;
+/* True when we are inside a <li> block of a menu. */
+static int in_menu_item = 0;
+
typedef struct brace_element
{
struct brace_element *next;
@@ -149,64 +154,44 @@ typedef struct brace_element
BRACE_ELEMENT *brace_stack = NULL;
-extern void do_multitable (), end_multitable ();
-
-void push_node_filename (), pop_node_filename ();
-void remember_error ();
-void convert_from_stream (), convert_from_file (), convert_from_loaded_file ();
-void init_internals (), init_paragraph (), init_brace_stack ();
-void init_insertion_stack (), init_indices ();
-void init_tag_table (), write_tag_table (), write_tag_table_internal ();
-void validate_file (), validate_other_references (), split_file ();
-void free_node_references (), handle_variable ();
-void handle_variable_internal ();
-void normalize_node_name ();
-void add_anchor_name ();
-void free_node_node_references (), remember_node_node_reference ();
-
-char **get_brace_args ();
-int array_len ();
-void free_array ();
-static int end_of_sentence_p ();
-void reader_loop ();
-void remember_brace (), remember_brace_1 ();
-void pop_and_call_brace (), discard_braces ();
-void add_word (), add_char (), insert (), flush_output ();
-void insert_string ();
-void close_paragraph ();
-void ignore_blank_line ();
-void do_flush_right_indentation (), discard_insertions ();
-void start_paragraph (), indent ();
-void inhibit_output_flushing (), uninhibit_output_flushing ();
-int set_paragraph_indent ();
-int self_delimiting (), search_forward ();
-int multitable_item (), number_of_node ();
-
-void me_execute_string_keep_state ();
-void maybe_update_execution_strings ();
-
-extern char *escape_string ();
-extern void insert_html_tag ();
-extern void sectioning_html ();
-
-#if defined (VA_FPRINTF) && __STDC__
-/* Unfortunately we must use prototypes if we are to use <stdarg.h>. */
-void add_word_args (const char *, ...);
-void execute_string (char *, ...);
-#else
-void add_word_args ();
-void execute_string ();
-#endif /* no prototypes */
+static void convert_from_file (char *name);
+static void convert_from_loaded_file (char *name);
+static void convert_from_stream (FILE *stream, char *name);
+static void do_flush_right_indentation (void);
+static void handle_variable (int action);
+static void handle_variable_internal (int action, char *name);
+static void init_brace_stack (void);
+static void init_internals (void);
+static void pop_and_call_brace (void);
+static void remember_brace (COMMAND_FUNCTION (*proc));
+static int end_of_sentence_p (void);
+
+void maybe_update_execution_strings (char **text, unsigned int new_len);
/* Error handling. */
/* Number of errors encountered. */
int errors_printed = 0;
+/* Remember that an error has been printed. If more than
+ max_error_level have been printed, then exit the program. */
+static void
+remember_error (void)
+{
+ errors_printed++;
+ if (max_error_level && (errors_printed > max_error_level))
+ {
+ fprintf (stderr, _("Too many errors! Gave up.\n"));
+ flush_file_stack ();
+ if (errors_printed - max_error_level < 2)
+ cm_bye ();
+ xexit (1);
+ }
+}
+
/* Print the last error gotten from the file system. */
int
-fs_error (filename)
- char *filename;
+fs_error (char *filename)
{
remember_error ();
perror (filename);
@@ -329,24 +314,9 @@ warning (format, va_alist)
}
-/* Remember that an error has been printed. If more than
- max_error_level have been printed, then exit the program. */
-void
-remember_error ()
-{
- errors_printed++;
- if (max_error_level && (errors_printed > max_error_level))
- {
- fprintf (stderr, _("Too many errors! Gave up.\n"));
- flush_file_stack ();
- cm_bye ();
- xexit (1);
- }
-}
-
/* The other side of a malformed expression. */
-void
-misplaced_brace ()
+static void
+misplaced_brace (void)
{
line_error (_("Misplaced %c"), '}');
}
@@ -355,7 +325,7 @@ misplaced_brace ()
/* Display the version info of this invocation of Makeinfo. */
static void
-print_version_info ()
+print_version_info (void)
{
printf ("makeinfo (GNU %s) %s\n", PACKAGE, VERSION);
}
@@ -364,8 +334,7 @@ print_version_info ()
Otherwise, just say to use --help for more info.
Then exit with EXIT_VALUE. */
static void
-usage (exit_value)
- int exit_value;
+usage (int exit_value)
{
if (exit_value != 0)
fprintf (stderr, _("Try `%s --help' for more information.\n"), progname);
@@ -389,14 +358,15 @@ General options:\n\
-v, --verbose explain what is being done.\n\
--version display version information and exit.\n"),
max_error_level, reference_warning_limit);
- puts ("\n");
+ puts ("");
/* xgettext: no-wrap */
puts (_("\
Output format selection (default is to produce Info):\n\
- --docbook output DocBook XML rather than Info.\n\
+ --docbook output Docbook XML rather than Info.\n\
--html output HTML rather than Info.\n\
--xml output Texinfo XML rather than Info.\n\
+ --plaintext output plain text rather than Info.\n\
"));
puts (_("\
@@ -428,7 +398,7 @@ Options for Info and plain text:\n\
--split-size=NUM split Info files at size NUM (default %d).\n"),
fill_column, paragraph_start_indent,
DEFAULT_SPLIT_SIZE);
- puts ("\n");
+ puts ("");
puts (_("\
Options for HTML:\n\
@@ -436,6 +406,13 @@ Options for HTML:\n\
read stdin if FILE is -.\n\
"));
+ printf (_("\
+Options for XML and Docbook:\n\
+ --output-indent=VAL indent XML elements by VAL spaces (default %d).\n\
+ If VAL is 0, ignorable whitespace is dropped.\n\
+"), xml_indentation_increment);
+ puts ("");
+
puts (_("\
Input file options:\n\
--commands-in-node-names allow @ commands in node names.\n\
@@ -447,16 +424,21 @@ Input file options:\n\
puts (_("\
Conditional processing in input:\n\
+ --ifdocbook process @ifdocbook and @docbook even if\n\
+ not generating Docbook.\n\
--ifhtml process @ifhtml and @html even if not generating HTML.\n\
--ifinfo process @ifinfo even if not generating Info.\n\
--ifplaintext process @ifplaintext even if not generating plain text.\n\
--iftex process @iftex and @tex; implies --no-split.\n\
--ifxml process @ifxml and @xml.\n\
+ --no-ifdocbook do not process @ifdocbook and @docbook text.\n\
--no-ifhtml do not process @ifhtml and @html text.\n\
--no-ifinfo do not process @ifinfo text.\n\
--no-ifplaintext do not process @ifplaintext text.\n\
--no-iftex do not process @iftex and @tex text.\n\
--no-ifxml do not process @ifxml and @xml text.\n\
+\n\
+ Also, for the --no-ifFORMAT options, do process @ifnotFORMAT text.\n\
"));
puts (_("\
@@ -502,6 +484,7 @@ struct option long_options[] =
{ "force", 0, &force, 1 },
{ "help", 0, 0, 'h' },
{ "html", 0, 0, 'w' },
+ { "ifdocbook", 0, &process_docbook, 1 },
{ "ifhtml", 0, &process_html, 1 },
{ "ifinfo", 0, &process_info, 1 },
{ "ifplaintext", 0, &process_plaintext, 1 },
@@ -509,6 +492,7 @@ struct option long_options[] =
{ "ifxml", 0, &process_xml, 1 },
{ "macro-expand", 1, 0, 'E' },
{ "no-headers", 0, &no_headers, 1 },
+ { "no-ifdocbook", 0, &process_docbook, 0 },
{ "no-ifhtml", 0, &process_html, 0 },
{ "no-ifinfo", 0, &process_info, 0 },
{ "no-ifplaintext", 0, &process_plaintext, 0 },
@@ -523,7 +507,9 @@ struct option long_options[] =
{ "number-footnotes", 0, &number_footnotes, 1 },
{ "number-sections", 0, &number_sections, 1 },
{ "output", 1, 0, 'o' },
+ { "output-indent", 1, 0, 'i' },
{ "paragraph-indent", 1, 0, 'p' },
+ { "plaintext", 0, 0, 't' },
{ "reference-limit", 1, 0, 'r' },
{ "split-size", 1, 0, 'S'},
{ "verbose", 0, &verbose_mode, 1 },
@@ -532,14 +518,24 @@ struct option long_options[] =
{NULL, 0, NULL, 0}
};
+/* We use handle_variable_internal for -D and -U, and it depends on
+ execute_string, which depends on input_filename, which is not defined
+ while we are handling options. :-\ So we save these defines in this
+ struct, and handle them later. */
+typedef struct command_line_define
+{
+ struct command_line_define *next;
+ int action;
+ char *define;
+} COMMAND_LINE_DEFINE;
+
+static COMMAND_LINE_DEFINE *command_line_defines = NULL;
+
/* For each file mentioned in the command line, process it, turning
Texinfo commands into wonderfully formatted output text. */
int
-main (argc, argv)
- int argc;
- char **argv;
+main (int argc, char **argv)
{
- extern int errors_printed;
int c, ind;
int reading_from_stdin = 0;
@@ -547,17 +543,69 @@ main (argc, argv)
/* Do not use LC_ALL, because LC_NUMERIC screws up the scanf parsing
of the argument to @multicolumn. */
setlocale (LC_TIME, "");
+#ifdef LC_MESSAGES /* ultrix */
setlocale (LC_MESSAGES, "");
+#endif
setlocale (LC_CTYPE, "");
setlocale (LC_COLLATE, "");
#endif
+#ifdef ENABLE_NLS
/* Set the text message domain. */
bindtextdomain (PACKAGE, LOCALEDIR);
textdomain (PACKAGE);
+#endif
+
+ /* If TEXINFO_OUTPUT_FORMAT envvar is set, use it to set default output.
+ Can be overridden with one of the output options. */
+ if (getenv ("TEXINFO_OUTPUT_FORMAT") != NULL)
+ {
+ if (STREQ (getenv ("TEXINFO_OUTPUT_FORMAT"), "docbook"))
+ {
+ splitting = 0;
+ html = 0;
+ docbook = 1;
+ xml = 1;
+ process_docbook = 1;
+ }
+ else if (STREQ (getenv ("TEXINFO_OUTPUT_FORMAT"), "html"))
+ {
+ html = 1;
+ docbook = 0;
+ xml = 0;
+ process_html = 1;
+ }
+ else if (STREQ (getenv ("TEXINFO_OUTPUT_FORMAT"), "info"))
+ {
+ html = 0;
+ docbook = 0;
+ xml = 0;
+ }
+ else if (STREQ (getenv ("TEXINFO_OUTPUT_FORMAT"), "plaintext"))
+ {
+ splitting = 0;
+ no_headers = 1;
+ html = 0;
+ docbook = 0;
+ xml = 0;
+ process_plaintext = 1;
+ }
+ else if (STREQ (getenv ("TEXINFO_OUTPUT_FORMAT"), "xml"))
+ {
+ splitting = 0;
+ html = 0;
+ docbook = 0;
+ xml = 1;
+ process_xml = 1;
+ }
+ else
+ fprintf (stderr,
+ _("%s: Ignoring unrecognized TEXINFO_OUTPUT_FORMAT value `%s'.\n"),
+ progname, getenv ("TEXINFO_OUTPUT_FORMAT"));
+ }
/* Parse argument flags from the input line. */
- while ((c = getopt_long (argc, argv, "D:de:E:f:hI:o:p:P:r:s:U:vV:wx",
+ while ((c = getopt_long (argc, argv, "D:de:E:f:hI:i:o:p:P:r:s:t:U:vV:wx",
long_options, &ind)) != EOF)
{
if (c == 0 && long_options[ind].flag == 0)
@@ -572,13 +620,24 @@ main (argc, argv)
case 'D':
case 'U':
/* User specified variable to set or clear. */
- handle_variable_internal ((c == 'D') ? SET : CLEAR, optarg);
+ if (xml && !docbook)
+ {
+ COMMAND_LINE_DEFINE *new = xmalloc (sizeof (COMMAND_LINE_DEFINE));
+ new->action = (c == 'D') ? SET : CLEAR;
+ new->define = xstrdup (optarg);
+ new->next = command_line_defines;
+ command_line_defines = new;
+ }
+ else
+ handle_variable_internal ((c == 'D' ? SET : CLEAR), optarg);
break;
case 'd': /* --docbook */
splitting = 0;
xml = 1;
docbook = 1;
+ html = 0;
+ process_docbook = 1;
break;
case 'e': /* --error-limit */
@@ -586,7 +645,7 @@ main (argc, argv)
{
fprintf (stderr,
_("%s: %s arg must be numeric, not `%s'.\n"),
- "--error-limit", progname, optarg);
+ progname, "--error-limit", optarg);
usage (1);
}
break;
@@ -598,10 +657,13 @@ main (argc, argv)
macro_expansion_output_stream
= strcmp (optarg, "-") == 0 ? stdout : fopen (optarg, "w");
if (!macro_expansion_output_stream)
- error (_("Couldn't open macro expansion output `%s'"), optarg);
+ error (_("%s: could not open macro expansion output `%s'"),
+ progname, optarg);
}
else
- error (_("Cannot specify more than one macro expansion output"));
+ fprintf (stderr,
+ _("%s: ignoring second macro expansion output `%s'.\n"),
+ progname, optarg);
break;
case 'f': /* --fill-column */
@@ -609,7 +671,7 @@ main (argc, argv)
{
fprintf (stderr,
_("%s: %s arg must be numeric, not `%s'.\n"),
- "--fill-column", progname, optarg);
+ progname, "--fill-column", optarg);
usage (1);
}
break;
@@ -620,14 +682,17 @@ main (argc, argv)
case 'I':
/* Append user-specified dir to include file path. */
- if (!include_files_path)
- include_files_path = xstrdup (".");
-
- include_files_path = (char *)
- xrealloc (include_files_path,
- 2 + strlen (include_files_path) + strlen (optarg));
- strcat (include_files_path, PATH_SEP);
- strcat (include_files_path, optarg);
+ append_to_include_path (optarg);
+ break;
+
+ case 'i':
+ if (sscanf (optarg, "%d", &xml_indentation_increment) != 1)
+ {
+ fprintf (stderr,
+ _("%s: %s arg must be numeric, not `%s'.\n"),
+ progname, "--output-indent", optarg);
+ usage (1);
+ }
break;
case 'o': /* --output */
@@ -647,23 +712,7 @@ main (argc, argv)
case 'P':
/* Prepend user-specified include dir to include path. */
- if (!include_files_path)
- {
- include_files_path = xstrdup (optarg);
- include_files_path = xrealloc (include_files_path,
- strlen (include_files_path) + 3); /* 3 for ":.\0" */
- strcat (strcat (include_files_path, PATH_SEP), ".");
- }
- else
- {
- char *tmp = xstrdup (include_files_path);
- include_files_path = xrealloc (include_files_path,
- strlen (include_files_path) + strlen (optarg) + 2); /* 2 for ":\0" */
- strcpy (include_files_path, optarg);
- strcat (include_files_path, ":");
- strcat (include_files_path, tmp);
- free (tmp);
- }
+ prepend_to_include_path (optarg);
break;
case 'r': /* --reference-limit */
@@ -671,7 +720,7 @@ main (argc, argv)
{
fprintf (stderr,
_("%s: %s arg must be numeric, not `%s'.\n"),
- "--reference-limit", progname, optarg);
+ progname, "--reference-limit", optarg);
usage (1);
}
break;
@@ -680,7 +729,7 @@ main (argc, argv)
if (set_footnote_style (optarg) < 0)
{
fprintf (stderr,
- _("%s: --footnote-style arg must be `separate' or `end', not `%s'.\n"),
+ _("%s: --footnote-style arg must be `separate' or `end', not `%s'.\n"),
progname, optarg);
usage (1);
}
@@ -692,11 +741,20 @@ main (argc, argv)
{
fprintf (stderr,
_("%s: %s arg must be numeric, not `%s'.\n"),
- "--split-size", progname, optarg);
+ progname, "--split-size", optarg);
usage (1);
}
break;
+ case 't': /* --plaintext */
+ splitting = 0;
+ no_headers = 1;
+ html = 0;
+ docbook = 0;
+ xml = 0;
+ process_plaintext = 1;
+ break;
+
case 'v':
verbose_mode++;
break;
@@ -704,21 +762,24 @@ main (argc, argv)
case 'V': /* --version */
print_version_info ();
puts ("");
- printf (_("Copyright (C) %s Free Software Foundation, Inc.\n\
-There is NO warranty. You may redistribute this software\n\
+ puts ("Copyright (C) 2004 Free Software Foundation, Inc.");
+ printf (_("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"),
- "2003");
+For more information about these matters, see the files named COPYING.\n"));
xexit (0);
break;
case 'w': /* --html */
+ xml = 0;
+ docbook = 0;
html = 1;
process_html = 1;
break;
case 'x': /* --xml */
splitting = 0;
+ html = 0;
+ docbook = 0;
xml = 1;
process_xml = 1;
break;
@@ -729,6 +790,9 @@ For more information about these matters, see the files named COPYING.\n"),
}
}
+ if (macro_expansion_output_stream)
+ validating = 0;
+
if (!validating)
expensive_validation = 0;
@@ -746,6 +810,10 @@ For more information about these matters, see the files named COPYING.\n"),
if (no_headers)
{
+ /* If the user did not specify an output file, use stdout. */
+ if (!command_output_filename)
+ command_output_filename = xstrdup ("-");
+
if (html && splitting && !STREQ (command_output_filename, "-"))
{ /* --no-headers --no-split --html indicates confusion. */
fprintf (stderr,
@@ -756,10 +824,6 @@ For more information about these matters, see the files named COPYING.\n"),
/* --no-headers implies --no-split. */
splitting = 0;
-
- /* If the user did not specify an output file, use stdout. */
- if (!command_output_filename)
- command_output_filename = xstrdup ("-");
}
if (process_info == -1)
@@ -790,7 +854,6 @@ For more information about these matters, see the files named COPYING.\n"),
xexit (errors_printed ? 2 : 0);
return 0; /* Avoid bogus warnings. */
}
-
/* Hacking tokens and strings. */
@@ -808,8 +871,8 @@ For more information about these matters, see the files named COPYING.\n"),
&& (c) != '^' \
)
-char *
-read_token ()
+static char *
+read_token (void)
{
int i, character;
char *result;
@@ -841,8 +904,7 @@ read_token ()
/* Return nonzero if CHARACTER is self-delimiting. */
int
-self_delimiting (character)
- int character;
+self_delimiting (int character)
{
/* @; and @\ are not Texinfo commands, but they are listed here
anyway. I don't know why. --karl, 10aug96. */
@@ -851,35 +913,35 @@ self_delimiting (character)
/* Clear whitespace from the front and end of string. */
void
-canon_white (string)
- char *string;
+canon_white (char *string)
{
- int len = strlen (string);
- int x;
+ char *p = string;
+ unsigned len;
- if (!len)
+ if (!*p)
return;
- for (x = 0; x < len; x++)
+ do
{
- if (!cr_or_whitespace (string[x]))
- {
- strcpy (string, string + x);
- break;
- }
+ if (!cr_or_whitespace (*p))
+ break;
+ ++p;
}
- len = strlen (string);
- if (len)
- len--;
- while (len > -1 && cr_or_whitespace (string[len]))
- len--;
- string[len + 1] = 0;
+ while (*p);
+
+ len = strlen (p);
+ while (len && cr_or_whitespace (p[len-1]))
+ --len;
+
+ if (p != string)
+ memmove (string, p, len);
+
+ string[len] = 0;
}
/* Bash STRING, replacing all whitespace with just one space. */
void
-fix_whitespace (string)
- char *string;
+fix_whitespace (char *string)
{
char *temp = xmalloc (strlen (string) + 1);
int string_index = 0;
@@ -909,8 +971,7 @@ fix_whitespace (string)
/* Discard text until the desired string is found. The string is
included in the discarded text. */
void
-discard_until (string)
- char *string;
+discard_until (char *string)
{
int temp = search_forward (string, input_text_offset);
@@ -924,18 +985,26 @@ discard_until (string)
if (temp < 0)
{
- input_text_offset = input_text_length - strlen (string);
-
+ /* not found, move current position to end of string */
+ input_text_offset = input_text_length;
if (strcmp (string, "\n") != 0)
- {
- line_error (_("Expected `%s'"), string);
+ { /* Give a more descriptive feedback, if we are looking for ``@end ''
+ during macro execution. That means someone used a multiline
+ command as an argument to, say, @section ... style commands. */
+ char *end_block = xmalloc (8);
+ sprintf (end_block, "\n%cend ", COMMAND_PREFIX);
+ if (executing_string && strstr (string, end_block))
+ line_error (_("Multiline command %c%s used improperly"),
+ COMMAND_PREFIX, command);
+ else
+ line_error (_("Expected `%s'"), string);
+ free (end_block);
return;
}
}
else
- input_text_offset = temp;
-
- input_text_offset += strlen (string);
+ /* found, move current position to after the found string */
+ input_text_offset = temp + strlen (string);
}
/* Read characters from the file until we are at MATCH.
@@ -943,8 +1012,7 @@ discard_until (string)
On exit input_text_offset is after the match string.
Return the offset where the string starts. */
int
-get_until (match, string)
- char *match, **string;
+get_until (char *match, char **string)
{
int len, current_point, x, new_point, tem;
@@ -977,8 +1045,7 @@ get_until (match, string)
/* Replace input_text[FROM .. TO] with its expansion. */
void
-replace_with_expansion (from, to)
- int from, *to;
+replace_with_expansion (int from, int *to)
{
char *xp;
unsigned xp_len, new_len;
@@ -1054,9 +1121,7 @@ replace_with_expansion (from, to)
expand the text before looking for MATCH for those cases where
MATCH might be produced by some macro. */
void
-get_until_in_line (expand, match, string)
- int expand;
- char *match, **string;
+get_until_in_line (int expand, char *match, char **string)
{
int real_bottom = input_text_length;
int limit = search_forward ("\n", input_text_offset);
@@ -1088,9 +1153,7 @@ get_until_in_line (expand, match, string)
}
void
-get_rest_of_line (expand, string)
- int expand;
- char **string;
+get_rest_of_line (int expand, char **string)
{
xml_no_para ++;
if (expand)
@@ -1121,7 +1184,7 @@ get_rest_of_line (expand, string)
/* Backup the input pointer to the previous character, keeping track
of the current line number. */
void
-backup_input_pointer ()
+backup_input_pointer (void)
{
if (input_text_offset)
{
@@ -1134,8 +1197,7 @@ backup_input_pointer ()
/* Read characters from the file until we are at MATCH or closing brace.
Place the characters read into STRING. */
void
-get_until_in_braces (match, string)
- char *match, **string;
+get_until_in_braces (char *match, char **string)
{
char *temp;
int i, brace = 0;
@@ -1192,8 +1254,8 @@ static char *suffixes[] = {
NULL
};
-void
-initialize_conversion ()
+static void
+initialize_conversion (void)
{
init_tag_table ();
init_indices ();
@@ -1207,16 +1269,11 @@ initialize_conversion ()
output_position = 0;
}
-typedef struct generic_list {
- struct generic_list *next;
-} GENERIC_LIST;
-
/* Reverse the chain of structures in LIST. Output the new head
of the chain. You should always assign the output value of this
function to something, or you will lose the chain. */
GENERIC_LIST *
-reverse_list (list)
- GENERIC_LIST *list;
+reverse_list (GENERIC_LIST *list)
{
GENERIC_LIST *next;
GENERIC_LIST *prev = NULL;
@@ -1237,10 +1294,8 @@ reverse_list (list)
/* Convert the Texinfo file coming from the open stream STREAM. Assume the
source of the stream is named NAME. */
-void
-convert_from_stream (stream, name)
- FILE *stream;
- char *name;
+static void
+convert_from_stream (FILE *stream, char *name)
{
char *buffer = NULL;
int buffer_offset = 0, buffer_size = 0;
@@ -1287,13 +1342,15 @@ convert_from_stream (stream, name)
convert_from_loaded_file (name);
}
-void
-convert_from_file (name)
- char *name;
+static void
+convert_from_file (char *name)
{
int i;
char *filename = xmalloc (strlen (name) + 50);
+ /* Prepend file directory to the search path, so relative links work. */
+ prepend_to_include_path (pathname_part (name));
+
initialize_conversion ();
/* Try to load the file specified by NAME, concatenated with our
@@ -1304,7 +1361,7 @@ convert_from_file (name)
strcpy (filename, name);
strcat (filename, suffixes[i]);
- if (find_and_load (filename))
+ if (find_and_load (filename, 1))
break;
if (!suffixes[i][0] && strrchr (filename, '.'))
@@ -1325,6 +1382,38 @@ convert_from_file (name)
input_filename = filename;
convert_from_loaded_file (name);
+
+ /* Pop the prepended path, so multiple filenames in the
+ command line do not screw each others include paths. */
+ pop_path_from_include_path ();
+}
+
+static int
+create_html_directory (char *dir, int can_remove_file)
+{
+ struct stat st;
+
+ /* Already exists. */
+ if (stat (dir, &st) == 0)
+ {
+ /* And it's a directory, so silently reuse it. */
+ if (S_ISDIR (st.st_mode))
+ return 1;
+ /* Not a directory, so move it out of the way if we are allowed. */
+ else if (can_remove_file)
+ {
+ if (unlink (dir) != 0)
+ return 0;
+ }
+ else
+ return 0;
+ }
+
+ if (mkdir (dir, 0777) == 0)
+ /* Success! */
+ return 1;
+ else
+ return 0;
}
/* Given OUTPUT_FILENAME == ``/foo/bar/baz.html'', return
@@ -1339,13 +1428,11 @@ convert_from_file (name)
foo.whatever unchanged. */
static char *
-insert_toplevel_subdirectory (output_filename)
- char *output_filename;
+insert_toplevel_subdirectory (char *output_filename)
{
static const char index_name[] = "index.html";
char *dir, *subdir, *base, *basename, *p;
char buf[PATH_MAX];
- struct stat st;
const int index_len = sizeof (index_name) - 1;
strcpy (buf, output_filename);
@@ -1375,41 +1462,34 @@ insert_toplevel_subdirectory (output_filename)
if (strlen (dir))
strcat (output_filename, "/");
strcat (output_filename, subdir);
- if ((mkdir (output_filename, 0777) == -1 && errno != EEXIST)
- /* output_filename might exist, but be a non-directory. */
- || (stat (output_filename, &st) == 0 && !S_ISDIR (st.st_mode)))
- { /* that failed, try subdir name with .html */
+
+ /* First try, do not remove existing file. */
+ if (!create_html_directory (output_filename, 0))
+ {
+ /* That failed, try subdir name with .html.
+ Remove it if it exists. */
strcpy (output_filename, dir);
if (strlen (dir))
strcat (output_filename, "/");
strcat (output_filename, basename);
- if (mkdir (output_filename, 0777) == -1)
- {
- const char *errmsg = strerror (errno);
- if ((errno == EEXIST
-#ifdef __MSDOS__
- || errno == EACCES
-#endif
- )
- && (stat (output_filename, &st) == 0 && !S_ISDIR (st.st_mode)))
- errmsg = _("File exists, but is not a directory");
+ if (!create_html_directory (output_filename, 1))
+ {
+ /* Last try failed too :-\ */
line_error (_("Can't create directory `%s': %s"),
- output_filename, errmsg);
+ output_filename, strerror (errno));
xexit (1);
}
- strcat (output_filename, "/");
}
- else if (strlen (subdir))
- strcat (output_filename, "/");
+
+ 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;
+static void
+convert_from_loaded_file (char *name)
{
char *real_output_filename = NULL;
@@ -1476,8 +1556,6 @@ convert_from_loaded_file (name)
if (!command_output_filename)
{
get_until ("\n", &output_filename); /* read rest of line */
- 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;
@@ -1553,6 +1631,9 @@ convert_from_loaded_file (name)
set_current_output_filename (real_output_filename);
+ if (xml && !docbook)
+ xml_begin_document (filename_part (output_filename));
+
if (verbose_mode)
printf (_("Making %s file `%s' from `%s'.\n"),
no_headers ? "text"
@@ -1593,6 +1674,19 @@ convert_from_loaded_file (name)
output_filename, VERSION, input_filename);
close_paragraph ();
+
+ if (xml && !docbook)
+ {
+ /* Just before the real main loop, let's handle the defines. */
+ COMMAND_LINE_DEFINE *temp;
+
+ for (temp = command_line_defines; temp; temp = temp->next)
+ {
+ handle_variable_internal (temp->action, temp->define);
+ free(temp->define);
+ }
+ }
+
reader_loop ();
if (xml)
xml_end_document ();
@@ -1611,7 +1705,8 @@ finished:
&& FILENAME_CMP (macro_expansion_filename, NULL_DEVICE) != 0
&& FILENAME_CMP (macro_expansion_filename, ALSO_NULL_DEVICE) != 0)
{
- fprintf (stderr, _("%s: Removing macro output file `%s' due to errors; use --force to preserve.\n"),
+ fprintf (stderr,
+_("%s: Removing macro output file `%s' due to errors; use --force to preserve.\n"),
progname, macro_expansion_filename);
if (unlink (macro_expansion_filename) < 0)
perror (macro_expansion_filename);
@@ -1621,15 +1716,10 @@ finished:
if (output_stream)
{
output_pending_notes ();
- if (tag_table)
- {
- tag_table = (TAG_ENTRY *) reverse_list (tag_table);
- if (!no_headers && !html)
- write_tag_table ();
- }
if (html)
{
+ no_indent = 1;
start_paragraph ();
add_word ("</body></html>\n");
close_paragraph ();
@@ -1638,14 +1728,19 @@ finished:
/* maybe we want local variables in info output. */
{
char *trailer = info_trailer ();
- if (trailer)
+ if (!xml && !docbook && trailer)
{
+ if (html)
+ insert_string ("<!--");
insert_string (trailer);
free (trailer);
+ if (html)
+ insert_string ("\n-->\n");
}
}
- flush_output (); /* in case there was no @bye */
+ /* Write stuff makeinfo generates after @bye, ie. info_trailer. */
+ flush_output ();
if (output_stream != stdout)
fclose (output_stream);
@@ -1654,19 +1749,28 @@ finished:
if (validating)
validate_file (tag_table);
- /* If we need to output the table of contents, do it now. */
- if (contents_filename || shortcontents_filename)
- toc_update ();
+ handle_delayed_writes ();
+
+ if (tag_table)
+ {
+ tag_table = (TAG_ENTRY *) reverse_list ((GENERIC_LIST *) tag_table);
+ if (!no_headers && !html && !STREQ (current_output_filename, "-"))
+ write_tag_table (real_output_filename);
+ }
if (splitting && !html && (!errors_printed || force))
- split_file (real_output_filename, split_size);
+ {
+ clean_old_split_files (real_output_filename);
+ split_file (real_output_filename, split_size);
+ }
else if (errors_printed
&& !force
&& strcmp (real_output_filename, "-") != 0
&& FILENAME_CMP (real_output_filename, NULL_DEVICE) != 0
&& FILENAME_CMP (real_output_filename, ALSO_NULL_DEVICE) != 0)
{ /* If there were errors, and no --force, remove the output. */
- fprintf (stderr, _("%s: Removing output file `%s' due to errors; use --force to preserve.\n"),
+ fprintf (stderr,
+ _("%s: Removing output file `%s' due to errors; use --force to preserve.\n"),
progname, real_output_filename);
if (unlink (real_output_filename) < 0)
perror (real_output_filename);
@@ -1674,33 +1778,35 @@ finished:
}
free (real_output_filename);
}
-
-
-/* If enable_encoding and document_encoding are both set, return a Local
- Variables section (as a malloc-ed string) so that Emacs' locale
- features can work. Else return NULL. */
-
+/* If enable_encoding is set and @documentencoding is used, return a
+ Local Variables section (as a malloc-ed string) so that Emacs'
+ locale features can work. Else return NULL. */
char *
-info_trailer ()
+info_trailer (void)
{
- if (!enable_encoding || document_encoding_code <= US_ASCII)
+ char *encoding;
+
+ if (!enable_encoding)
return NULL;
- {
-#define LV_FMT "\n\037\nLocal Variables:\ncoding: %s\nEnd:\n"
- char *enc_name = encoding_table[document_encoding_code].encname;
- char *lv = xmalloc (sizeof (LV_FMT) + strlen (enc_name));
- sprintf (lv, LV_FMT, enc_name);
- return lv;
- }
-}
+ encoding = current_document_encoding ();
+ if (encoding && *encoding)
+ {
+#define LV_FMT "\n\037\nLocal Variables:\ncoding: %s\nEnd:\n"
+ char *lv = xmalloc (sizeof (LV_FMT) + strlen (encoding));
+ sprintf (lv, LV_FMT, encoding);
+ free (encoding);
+ return lv;
+ }
+ free (encoding);
+ return NULL;
+}
void
-free_and_clear (pointer)
- char **pointer;
+free_and_clear (char **pointer)
{
if (*pointer)
{
@@ -1710,8 +1816,8 @@ free_and_clear (pointer)
}
/* Initialize some state. */
-void
-init_internals ()
+static void
+init_internals (void)
{
free_and_clear (&output_filename);
free_and_clear (&command);
@@ -1731,9 +1837,9 @@ init_internals ()
}
void
-init_paragraph ()
+init_paragraph (void)
{
- free_and_clear (&output_paragraph);
+ free (output_paragraph);
output_paragraph = xmalloc (paragraph_buffer_len);
output_paragraph[0] = 0;
output_paragraph_offset = 0;
@@ -1747,7 +1853,7 @@ init_paragraph ()
menu line. */
static void
-handle_menu_entry ()
+handle_menu_entry (void)
{
char *tem;
@@ -1773,23 +1879,21 @@ handle_menu_entry ()
if (had_menu_commentary)
{
- add_word ("<ul class=\"menu\">\n");
+ add_html_block_elt ("<ul class=\"menu\">\n");
had_menu_commentary = 0;
in_paragraph = 0;
}
- else if (!in_paragraph && !paragraph_is_open)
- {
- add_word ("<p>\n");
- in_paragraph = 1;
- }
if (in_paragraph)
{
- add_word ("</p>");
+ add_html_block_elt ("</p>\n");
+ add_html_block_elt ("<ul class=\"menu\">\n");
in_paragraph = 0;
}
- add_word ("<li><a");
+ in_menu_item = 1;
+
+ add_html_block_elt ("<li><a");
if (next_menu_item_number <= 9)
{
add_word(" accesskey=");
@@ -1819,7 +1923,18 @@ handle_menu_entry ()
free (string);
}
input_text_offset++; /* discard the second colon or the period */
- add_word (": ");
+
+ /* Insert a colon only if there is a description of this menu item. */
+ {
+ int save_input_text_offset = input_text_offset;
+ int save_line_number = line_number;
+ char *test_string;
+ get_rest_of_line (0, &test_string);
+ if (strlen (test_string) > 0)
+ add_word (": ");
+ input_text_offset = save_input_text_offset;
+ line_number = save_line_number;
+ }
}
else if (xml && tem)
{
@@ -1840,8 +1955,7 @@ handle_menu_entry ()
/* Find the command corresponding to STRING. If the command is found,
return a pointer to the data structure. Otherwise return -1. */
static COMMAND *
-get_command_entry (string)
- char *string;
+get_command_entry (char *string)
{
int i;
@@ -1864,7 +1978,7 @@ get_command_entry (string)
Read the next token to determine what to do. Return zero
if there's no known command or macro after the prefix character. */
static int
-read_command ()
+read_command (void)
{
COMMAND *entry;
int old_text_offset = input_text_offset++;
@@ -1894,7 +2008,7 @@ read_command ()
return 1;
}
- }
+ }
if (only_macro_expansion)
{
@@ -1970,11 +2084,10 @@ read_command ()
the function with the proper arguments. Although the filling isn't
necessary for HTML, it should do no harm. */
void
-reader_loop ()
+reader_loop (void)
{
int character;
int done = 0;
- int dash_count = 0;
while (!done)
{
@@ -1986,25 +2099,79 @@ reader_loop ()
/* If only_macro_expansion, only handle macros and leave
everything else intact. */
if (!only_macro_expansion && !in_fixed_width_font
+ && ((!html && !xml) || escape_html)
&& (character == '\'' || character == '`')
&& input_text[input_text_offset + 1] == character)
{
- input_text_offset++;
- character = '"'; /* html fixxme */
+ if (html)
+ {
+ input_text_offset += 2;
+ add_word (character == '`' ? "&ldquo;" : "&rdquo;");
+ continue;
+ }
+ else if (xml)
+ {
+ input_text_offset += 2;
+ xml_insert_entity (character == '`' ? "ldquo" : "rdquo");
+ continue;
+ }
+ else
+ {
+ input_text_offset++;
+ character = '"';
+ }
}
/* Convert --- to --. */
- if (!only_macro_expansion && character == '-')
+ if (!only_macro_expansion && character == '-' && !in_fixed_width_font
+ && ((!html && !xml) || escape_html))
{
- dash_count++;
- if (dash_count == 2 && !in_fixed_width_font)
+ int dash_count = 0;
+
+ /* Get the number of consequtive dashes. */
+ while (input_text[input_text_offset] == '-')
{
+ dash_count++;
input_text_offset++;
- continue;
}
+
+ /* Eat one dash. */
+ dash_count--;
+
+ if (html || xml)
+ {
+ if (dash_count == 0)
+ add_char ('-');
+ else
+ while (dash_count > 0)
+ {
+ if (dash_count >= 2)
+ {
+ if (html)
+ add_word ("&mdash;");
+ else
+ xml_insert_entity ("mdash");
+ dash_count -= 2;
+ }
+ else if (dash_count >= 1)
+ {
+ if (html)
+ add_word ("&ndash;");
+ else
+ xml_insert_entity ("ndash");
+ dash_count--;
+ }
+ }
+ }
+ else
+ {
+ add_char ('-');
+ while (--dash_count > 0)
+ add_char ('-');
+ }
+
+ continue;
}
- else if (dash_count > 0)
- dash_count = 0;
/* If this is a whitespace character, then check to see if the line
is blank. If so, advance to the carriage return. */
@@ -2094,10 +2261,8 @@ reader_loop ()
remember_brace (misplaced_brace);
}
else
- { /* We don't mind `extra' braces inside @math. */
- extern void cm_no_op ();
- remember_brace (cm_no_op);
- }
+ /* We don't mind `extra' braces inside @math. */
+ remember_brace (cm_no_op);
/* remember_brace advances input_text_offset. */
break;
}
@@ -2121,29 +2286,16 @@ reader_loop ()
maybe_write_itext (input_text, input_text_offset);
}
-void
-init_brace_stack ()
+static void
+init_brace_stack (void)
{
brace_stack = NULL;
}
-void
-remember_brace (proc)
- COMMAND_FUNCTION *proc;
-{
- if (curchar () != '{')
- line_error (_("%c%s expected braces"), COMMAND_PREFIX, command);
- else
- input_text_offset++;
- remember_brace_1 (proc, output_paragraph_offset);
-}
-
/* Remember the current output position here. Save PROC
along with it so you can call it later. */
-void
-remember_brace_1 (proc, position)
- COMMAND_FUNCTION *proc;
- int position;
+static void
+remember_brace_1 (COMMAND_FUNCTION (*proc), int position)
{
BRACE_ELEMENT *new = xmalloc (sizeof (BRACE_ELEMENT));
new->next = brace_stack;
@@ -2155,10 +2307,20 @@ remember_brace_1 (proc, position)
brace_stack = new;
}
+static void
+remember_brace (COMMAND_FUNCTION (*proc))
+{
+ if (curchar () != '{')
+ line_error (_("%c%s expected braces"), COMMAND_PREFIX, command);
+ else
+ input_text_offset++;
+ remember_brace_1 (proc, output_paragraph_offset);
+}
+
/* Pop the top of the brace stack, and call the associated function
with the args END and POS. */
-void
-pop_and_call_brace ()
+static void
+pop_and_call_brace (void)
{
if (brace_stack == NULL)
{
@@ -2186,9 +2348,8 @@ pop_and_call_brace ()
}
/* Shift all of the markers in `brace_stack' by AMOUNT. */
-void
-adjust_braces_following (here, amount)
- int here, amount;
+static void
+adjust_braces_following (int here, int amount)
{
BRACE_ELEMENT *stack = brace_stack;
@@ -2204,8 +2365,7 @@ adjust_braces_following (here, amount)
Always returns the first function in the command table if more than
one matches PROC. */
static const char *
-find_proc_name (proc)
- COMMAND_FUNCTION *proc;
+find_proc_name (COMMAND_FUNCTION (*proc))
{
int i;
@@ -2220,7 +2380,7 @@ find_proc_name (proc)
in braces, but that was wrong because of things like @code{foo @@}. So now
I only detect it at the beginning of nodes. */
void
-discard_braces ()
+discard_braces (void)
{
if (!brace_stack)
return;
@@ -2247,9 +2407,8 @@ discard_braces ()
}
}
-int
-get_char_len (character)
- int character;
+static int
+get_char_len (int character)
{
/* Return the printed length of the character. */
int len;
@@ -2307,8 +2466,7 @@ add_word_args (format, va_alist)
/* Add STRING to output_paragraph. */
void
-add_word (string)
- char *string;
+add_word (char *string)
{
while (*string)
add_char (*string++);
@@ -2318,14 +2476,49 @@ add_word (string)
Use this to output HTML directives with embedded blanks, to make
them @w-safe. */
void
-add_html_elt (string)
- char *string;
+add_html_elt (char *string)
{
in_html_elt++;
add_word (string);
in_html_elt--;
}
+/* These two functions below, add_html_block_elt and add_html_block_elt_args,
+ are mixtures of add_html_elt and add_word_args. They inform makeinfo that
+ the current HTML element being inserted should not be enclosed in a <p>
+ element. */
+void
+add_html_block_elt (char *string)
+{
+ in_html_block_level_elt++;
+ add_word (string);
+ in_html_block_level_elt--;
+}
+
+void
+#if defined (VA_FPRINTF) && __STDC__
+add_html_block_elt_args (const char *format, ...)
+#else
+add_html_block_elt_args (format, va_alist)
+ const char *format;
+ va_dcl
+#endif
+{
+ char buffer[2000]; /* xx no fixed limits */
+#ifdef VA_FPRINTF
+ va_list ap;
+#endif
+
+ VA_START (ap, format);
+#ifdef VA_SPRINTF
+ VA_SPRINTF (buffer, format, ap);
+#else
+ sprintf (buffer, format, a1, a2, a3, a4, a5, a6, a7, a8);
+#endif /* not VA_SPRINTF */
+ va_end (ap);
+ add_html_block_elt (buffer);
+}
+
/* Here is another awful kludge, used in add_char. Ordinarily, macro
expansions take place in the body of the document, and therefore we
should html_output_head when we see one. But there's an exception: a
@@ -2335,7 +2528,7 @@ add_html_elt (string)
So we need to be able to check if we are defining the @copying text.
We do this by looking back through the insertion stack. */
static int
-defining_copying ()
+defining_copying (void)
{
INSERTION_ELT *i;
for (i = insertion_stack; i; i = i->next)
@@ -2350,8 +2543,7 @@ defining_copying ()
/* Add the character to the current paragraph. If filling_enabled is
nonzero, then do filling as well. */
void
-add_char (character)
- int character;
+add_char (int character)
{
if (xml)
{
@@ -2463,6 +2655,7 @@ add_char (character)
any order and with any omissions, and we'll still output
the html <head> `just in time'. */
if ((executing_macro || !executing_string)
+ && !only_macro_expansion
&& html && !html_output_head_p && !defining_copying ())
html_output_head ();
@@ -2476,12 +2669,16 @@ add_char (character)
indent (pending_indent);
pending_indent = 0;
- /* This horrible kludge of checking for a < prevents <p>
- from being inserted when we already have html markup
- starting a paragraph, as with <ul> and <h1> and the like. */
- if ((html || xml) && escape_html && character != '<'
- && (!in_fixed_width_font || in_menu || in_detailmenu))
+ /* This check for in_html_block_level_elt prevents <p> from being
+ inserted when we already have html markup starting a paragraph,
+ as with <ul> and <h1> and the like. */
+ if (html && !in_html_block_level_elt)
{
+ if ((in_menu || in_detailmenu) && in_menu_item)
+ {
+ insert_string ("</li></ul>\n");
+ in_menu_item = 0;
+ }
insert_string ("<p>");
in_paragraph = 1;
adjust_braces_following (0, 3); /* adjust for <p> */
@@ -2536,9 +2733,9 @@ add_char (character)
if (t1 != temp)
{
adjust_braces_following (temp, (- (t1 - temp)));
- strncpy ((char *) &output_paragraph[temp],
- (char *) &output_paragraph[t1],
- (output_paragraph_offset - t1));
+ memmove (&output_paragraph[temp],
+ &output_paragraph[t1],
+ output_paragraph_offset - t1);
output_paragraph_offset -= (t1 - temp);
}
}
@@ -2600,8 +2797,7 @@ add_char (character)
/* Add a character and store its position in meta_char_pos. */
void
-add_meta_char (character)
- int character;
+add_meta_char (int character)
{
meta_char_pos = output_paragraph_offset;
add_char (character);
@@ -2609,9 +2805,19 @@ add_meta_char (character)
/* Insert CHARACTER into `output_paragraph'. */
void
-insert (character)
- int character;
+insert (int character)
{
+ /* We don't want to strip trailing whitespace in multitables. Otherwise
+ horizontal separators confuse the font locking in Info mode in Emacs,
+ because it looks like a @subsection. Adding a trailing space to those
+ lines fixes it. */
+ if (character == '\n' && !html && !xml && !multitable_active)
+ {
+ while (output_paragraph_offset
+ && whitespace (output_paragraph[output_paragraph_offset-1]))
+ output_paragraph_offset--;
+ }
+
output_paragraph[output_paragraph_offset++] = character;
if (output_paragraph_offset == paragraph_buffer_len)
{
@@ -2622,8 +2828,7 @@ insert (character)
/* Insert the null-terminated string STRING into `output_paragraph'. */
void
-insert_string (string)
- char *string;
+insert_string (const char *string)
{
while (*string)
insert (*string++);
@@ -2637,7 +2842,7 @@ insert_string (string)
/* Return true if at an end-of-sentence character, possibly followed by
post-sentence punctuation to ignore. */
static int
-end_of_sentence_p ()
+end_of_sentence_p (void)
{
int loc = output_paragraph_offset - 1;
@@ -2660,8 +2865,7 @@ end_of_sentence_p ()
the current output line. If COUNT is less than zero,
then remove until none left. */
void
-kill_self_indent (count)
- int count;
+kill_self_indent (int count)
{
/* Handle infinite case first. */
if (count < 0)
@@ -2690,20 +2894,20 @@ static int flushing_ignored = 0;
/* Prevent calls to flush_output () from having any effect. */
void
-inhibit_output_flushing ()
+inhibit_output_flushing (void)
{
flushing_ignored++;
}
/* Allow calls to flush_output () to write the paragraph data. */
void
-uninhibit_output_flushing ()
+uninhibit_output_flushing (void)
{
flushing_ignored--;
}
void
-flush_output ()
+flush_output (void)
{
int i;
@@ -2712,6 +2916,12 @@ flush_output ()
for (i = 0; i < output_paragraph_offset; i++)
{
+ if (output_paragraph[i] == '\n')
+ {
+ output_line_number++;
+ node_line_number++;
+ }
+
/* If we turned on the 8th bit for a space inside @w, turn it
back off for output. This might be problematic, since the
0x80 character may be used in 8-bit character sets. Sigh.
@@ -2741,8 +2951,7 @@ flush_output ()
int paragraph_spacing = DEFAULT_PARAGRAPH_SPACING;
static void
-close_paragraph_with_lines (lines)
- int lines;
+close_paragraph_with_lines (int lines)
{
int old_spacing = paragraph_spacing;
paragraph_spacing = lines;
@@ -2752,14 +2961,14 @@ close_paragraph_with_lines (lines)
/* Close the current paragraph, leaving no blank lines between them. */
void
-close_single_paragraph ()
+close_single_paragraph (void)
{
close_paragraph_with_lines (0);
}
/* Close a paragraph after an insertion has ended. */
void
-close_insertion_paragraph ()
+close_insertion_paragraph (void)
{
if (!insertion_paragraph_closed)
{
@@ -2795,18 +3004,21 @@ close_insertion_paragraph ()
/* Close the currently open paragraph. */
void
-close_paragraph ()
+close_paragraph (void)
{
int i;
+ /* We don't need these newlines in XML and Docbook outputs for
+ paragraph seperation. We have <para> element for that. */
+ if (xml)
+ return;
+
/* The insertion paragraph is no longer closed. */
insertion_paragraph_closed = 0;
if (paragraph_is_open && !must_start_paragraph)
{
- int tindex, c;
-
- tindex = output_paragraph_offset;
+ int tindex = output_paragraph_offset;
/* Back up to last non-newline/space character, forcing all such
subsequent characters to be newlines. This isn't strictly
@@ -2814,7 +3026,7 @@ close_paragraph ()
to make decisions. */
for (tindex = output_paragraph_offset - 1; tindex >= 0; --tindex)
{
- c = output_paragraph[tindex];
+ int c = output_paragraph[tindex];
if (c == ' '|| c == '\n')
output_paragraph[tindex] = '\n';
@@ -2858,15 +3070,15 @@ close_paragraph ()
/* Make the last line just read look as if it were only a newline. */
void
-ignore_blank_line ()
+ignore_blank_line (void)
{
last_inserted_character = '\n';
last_char_was_newline = 1;
}
/* Align the end of the text in output_paragraph with fill_column. */
-void
-do_flush_right_indentation ()
+static void
+do_flush_right_indentation (void)
{
char *temp;
int temp_len;
@@ -2903,7 +3115,7 @@ do_flush_right_indentation ()
/* Begin a new paragraph. */
void
-start_paragraph ()
+start_paragraph (void)
{
/* First close existing one. */
if (paragraph_is_open)
@@ -2950,8 +3162,7 @@ start_paragraph ()
/* Insert the indentation specified by AMOUNT. */
void
-indent (amount)
- int amount;
+indent (int amount)
{
/* For every START_POS saved within the brace stack which will be affected
by this indentation, bump that start pos forward. */
@@ -2964,9 +3175,7 @@ indent (amount)
/* Search forward for STRING in input_text.
FROM says where where to start. */
int
-search_forward (string, from)
- char *string;
- int from;
+search_forward (char *string, int from)
{
int len = strlen (string);
@@ -2978,518 +3187,64 @@ search_forward (string, from)
}
return -1;
}
-
-/* Cross references. */
-
-/* Return next comma-delimited argument, but do not cross a close-brace
- boundary. Clean up whitespace, too. If EXPAND is nonzero, replace
- the entire brace-delimited argument list with its expansion before
- looking for the next comma. */
-char *
-get_xref_token (expand)
- int expand;
-{
- char *string;
-
- if (docbook)
- xml_in_xref_token = 1;
-
- if (expand)
- {
- int old_offset = input_text_offset;
- int old_lineno = line_number;
-
- get_until_in_braces ("}", &string);
- if (curchar () == '}') /* as opposed to end of text */
- input_text_offset++;
- if (input_text_offset > old_offset)
- {
- int limit = input_text_offset;
-
- input_text_offset = old_offset;
- line_number = old_lineno;
- only_macro_expansion++;
- replace_with_expansion (input_text_offset, &limit);
- only_macro_expansion--;
- }
- free (string);
- }
-
- get_until_in_braces (",", &string);
- if (curchar () == ',')
- input_text_offset++;
- fix_whitespace (string);
-
- if (docbook)
- xml_in_xref_token = 0;
-
- return string;
-}
-/* NOTE: If you wonder why the HTML output is produced with such a
- peculiar mix of calls to add_word and execute_string, here's the
- reason. get_xref_token (1) expands all macros in a reference, but
- any other commands, like @value, @@, etc., are left intact. To
- expand them, we need to run the arguments through execute_string.
- However, characters like <, &, > and others cannot be let into
- execute_string, because they will be escaped. See the mess? */
-
-/* Make a cross reference. */
-void
-cm_xref (arg)
+/* search_forward until n characters. */
+int
+search_forward_until_pos (char *string, int from, int end_pos)
{
- if (arg == START)
- {
- char *arg1 = get_xref_token (1); /* expands all macros in xref */
- char *arg2 = get_xref_token (0);
- char *arg3 = get_xref_token (0);
- char *arg4 = get_xref_token (0);
- char *arg5 = get_xref_token (0);
- char *tem;
-
- /* "@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 "));
- }
- else
- add_word_args ("%s", px_ref_flag ? "*note " : "*Note ");
-
- 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)
- 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_html_elt ("<a href=");
- /* Note that if we are splitting, and the referenced
- tag is an anchor rather than a node, we will
- produce a reference to a file whose name is
- derived from the anchor name. However, only
- nodes create files, so we are referencing a
- non-existent file. cm_anchor, which see, deals
- with that problem. */
- if (splitting)
- execute_string ("\"../%s/", arg4);
- else
- execute_string ("\"%s.html", arg4);
- /* Do not collapse -- to -, etc., in references. */
- in_fixed_width_font++;
- tem = expansion (arg1, 0); /* expand @-commands in node */
- in_fixed_width_font--;
- add_anchor_name (tem, 1);
- free (tem);
- add_word ("\">");
- execute_string ("%s", ref_name);
- add_word ("</a>");
- }
- else
- {
- execute_string ("%s:", ref_name);
- in_fixed_width_font++;
- execute_string (" (%s)%s%s", arg4, arg1, px_ref_flag ? "." : "");
- in_fixed_width_font--;
- }
+ int save_input_text_length = input_text_length;
+ input_text_length = end_pos;
- /* 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);
+ from = search_forward (string, from);
- if (*arg3)
- {
- if (html)
- {
- add_html_elt ("<a href=\"");
- in_fixed_width_font++;
- tem = expansion (arg1, 0);
- in_fixed_width_font--;
- add_anchor_name (tem, 1);
- free (tem);
- add_word ("\">");
- execute_string ("%s", *arg2 ? arg2 : arg3);
- add_word ("</a>");
- }
- 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 ("<a href=\"");
- in_fixed_width_font++;
- tem = expansion (arg1, 0);
- in_fixed_width_font--;
- add_anchor_name (tem, 1);
- free (tem);
- add_word ("\">");
- execute_string ("%s", *arg2 ? arg2 : arg1);
- add_word ("</a>");
- }
- 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);
- }
- else
- { /* Check to make sure that the next non-whitespace character is
- valid to follow an xref (so info readers can find the node
- names). `input_text_offset' is pointing at the "}" which ended
- the xref or ref command. */
- int temp;
+ input_text_length = save_input_text_length;
- for (temp = input_text_offset + 1; temp < input_text_length; )
- {
- if (cr_or_whitespace (input_text[temp]))
- temp++;
- else
- {
- if (input_text[temp] != '.' && input_text[temp] != ',')
- warning (_("`.' or `,' must follow cross reference, not %c"),
- input_text[temp]);
- break;
- }
- }
- }
+ return from;
}
-void
-cm_pxref (arg)
- int arg;
-{
- if (arg == START)
- {
- px_ref_flag++;
- cm_xref (arg);
- px_ref_flag--;
- }
- /* Note that cm_xref isn't called with arg == END, which disables
- the code near the end of cm_xref that checks for `.' or `,'
- after the cross-reference. This is because @pxref{} generates
- the required character itself, when needed. */
-}
-
-void
-cm_ref (arg)
- int arg;
+/* Return next non-whitespace and non-cr character. */
+int
+next_nonwhitespace_character (void)
{
- if (arg == START)
- {
- ref_flag++;
- cm_xref (arg);
- ref_flag--;
- }
-}
+ /* First check the current input_text. Start from the next char because
+ we already have input_text[input_text_offset] in ``current''. */
+ int pos = input_text_offset + 1;
-void
-cm_inforef (arg)
- int arg;
-{
- if (arg == START)
+ while (pos < input_text_length)
{
- char *node = get_xref_token (1); /* expands all macros in inforef */
- char *pname = get_xref_token (0);
- char *file = get_xref_token (0);
-
- /* (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_html_elt ("<a href=");
- if (splitting)
- execute_string ("\"../%s/", file);
- else
- execute_string ("\"%s.html", file);
- tem = expansion (node, 0);
- add_anchor_name (tem, 1);
- add_word ("\">");
- execute_string ("%s", *pname ? pname : tem);
- add_word ("</a>");
- free (tem);
- }
- else
- {
- if (*pname)
- execute_string ("*note %s: (%s)%s", pname, file, node);
- else
- execute_string ("*note (%s)%s::", file, node);
- }
-
- free (node);
- free (pname);
- free (file);
+ if (!cr_or_whitespace(input_text[pos]))
+ return input_text[pos];
+ pos++;
}
-}
-/* A URL reference. */
-void
-cm_uref (arg)
- int arg;
-{
- if (arg == START)
- {
- extern int printing_index;
- char *url = get_xref_token (1); /* expands all macros in uref */
- char *desc = get_xref_token (0);
- char *replacement = get_xref_token (0);
+ { /* Can't find a valid character, so go through filestack
+ in case we are doing @include or expanding a macro. */
+ FSTACK *tos = filestack;
- 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_html_elt ("<a href=");
- /* don't collapse `--' etc. in the url */
- in_fixed_width_font++;
- execute_string ("\"%s\"", url);
- in_fixed_width_font--;
- add_word (">");
- execute_string ("%s", *replacement ? replacement
- : (*desc ? desc : url));
- add_word ("</a>");
- }
- else if (*replacement) /* do not show the url */
- execute_string ("%s", replacement);
- else if (*desc) /* show both text and url */
- {
- execute_string ("%s ", desc);
- in_fixed_width_font++;
- execute_string ("(%s)", url);
- in_fixed_width_font--;
- }
- else /* no text at all, so have the url to show */
- {
- in_fixed_width_font++;
- execute_string ("%s%s%s",
- printing_index ? "" : "`",
- url,
- printing_index ? "" : "'");
- in_fixed_width_font--;
- }
- if (url)
- free (url);
- if (desc)
- free (desc);
- if (replacement)
- free (replacement);
- }
-}
+ while (tos)
+ {
+ int tmp_input_text_length = filestack->size;
+ int tmp_input_text_offset = filestack->offset;
+ char *tmp_input_text = filestack->text;
-/* An email reference. */
-void
-cm_email (arg)
- int arg;
-{
- if (arg == START)
- {
- char *addr = get_xref_token (1); /* expands all macros in email */
- char *name = get_xref_token (0);
+ while (tmp_input_text_offset < tmp_input_text_length)
+ {
+ if (!cr_or_whitespace(tmp_input_text[tmp_input_text_offset]))
+ return tmp_input_text[tmp_input_text_offset];
+ tmp_input_text_offset++;
+ }
- if (xml && docbook)
- {
- xml_insert_element_with_attribute (EMAIL, START, "url=\"mailto:%s\"", addr);
- if (*name)
- execute_string (name);
- xml_insert_element (EMAIL, END);
- }
- else if (xml)
- {
- xml_insert_element (EMAIL, START);
- xml_insert_element (EMAILADDRESS, START);
- execute_string (addr);
- xml_insert_element (EMAILADDRESS, END);
- if (*name)
- {
- xml_insert_element (EMAILNAME, START);
- execute_string (name);
- xml_insert_element (EMAILNAME, END);
- }
- xml_insert_element (EMAIL, END);
- }
- else if (html)
- {
- add_html_elt ("<a href=");
- /* don't collapse `--' etc. in the address */
- in_fixed_width_font++;
- execute_string ("\"mailto:%s\"", addr);
- in_fixed_width_font--;
- add_word (">");
- execute_string ("%s", *name ? name : addr);
- add_word ("</a>");
- }
- else
- {
- execute_string ("%s%s", name, *name ? " " : "");
- in_fixed_width_font++;
- execute_string ("<%s>", addr);
- in_fixed_width_font--;
- }
+ tos = tos->next;
+ }
+ }
- if (addr)
- free (addr);
- if (name)
- free (name);
- }
+ return -1;
}
-
+
/* An external image is a reference, kind of. The parsing is (not
coincidentally) similar, anyway. */
void
-cm_image (arg)
- int arg;
+cm_image (int arg)
{
char *name_arg, *w_arg, *h_arg, *alt_arg, *ext_arg;
@@ -3507,34 +3262,48 @@ cm_image (arg)
struct stat file_info;
char *pathname = NULL;
char *fullname = xmalloc (strlen (name_arg)
- + (ext_arg && *ext_arg ? strlen (ext_arg) + 1 : 4) + 1);
+ + (ext_arg && *ext_arg ? strlen (ext_arg) + 1: 4) + 1);
if (ext_arg && *ext_arg)
{
- sprintf (fullname, "%s.%s", name_arg, ext_arg);
+ sprintf (fullname, "%s%s", name_arg, ext_arg);
if (access (fullname, R_OK) != 0)
pathname = get_file_info_in_path (fullname, include_files_path,
&file_info);
+
+ if (pathname == NULL)
+ {
+ /* Backwards compatibility (4.6 <= version < 4.7):
+ try prefixing @image's EXTENSION parameter with a period. */
+ sprintf (fullname, "%s.%s", name_arg, ext_arg);
+ if (access (fullname, R_OK) != 0)
+ pathname = get_file_info_in_path (fullname, include_files_path,
+ &file_info);
+ }
}
else
{
sprintf (fullname, "%s.png", name_arg);
- if (access (fullname, R_OK) != 0)
- {
- pathname = get_file_info_in_path (fullname,
- include_files_path, &file_info);
- if (pathname == NULL)
- {
- sprintf (fullname, "%s.jpg", name_arg);
- if (access (fullname, R_OK) != 0)
- pathname = get_file_info_in_path (fullname,
+ if (access (fullname, R_OK) != 0) {
+ pathname = get_file_info_in_path (fullname,
+ include_files_path, &file_info);
+ if (pathname == NULL) {
+ sprintf (fullname, "%s.jpg", name_arg);
+ if (access (fullname, R_OK) != 0) {
+ sprintf (fullname, "%s.gif", name_arg);
+ if (access (fullname, R_OK) != 0) {
+ pathname = get_file_info_in_path (fullname,
include_files_path, &file_info);
}
+ }
}
+ }
}
if (html)
{
+ int image_in_div = 0;
+
if (pathname == NULL && access (fullname, R_OK) != 0)
{
line_error(_("@image file `%s' (for HTML) not readable: %s"),
@@ -3548,19 +3317,42 @@ cm_image (arg)
return;
}
+ if (!paragraph_is_open)
+ {
+ add_html_block_elt ("<div class=\"block-image\">");
+ image_in_div = 1;
+ }
+
add_html_elt ("<img src=");
add_word_args ("\"%s\"", fullname);
add_html_elt (" alt=");
- add_word_args ("\"%s\">", (*alt_arg) ? alt_arg : fullname);
+ add_word_args ("\"%s\">",
+ escape_string (*alt_arg ? text_expansion (alt_arg) : fullname));
+
+ if (image_in_div)
+ add_html_block_elt ("</div>");
}
else if (xml && docbook)
xml_insert_docbook_image (name_arg);
else if (xml)
{
- xml_insert_element_with_attribute (IMAGE, START, "width=\"%s\" height=\"%s\" alttext=\"%s\" extension=\"%s\"",
- w_arg, h_arg, alt_arg, ext_arg);
- add_word (name_arg);
- xml_insert_element (IMAGE, END);
+ extern int xml_in_para;
+ extern int xml_no_para;
+ int elt = xml_in_para ? INLINEIMAGE : IMAGE;
+
+ if (!xml_in_para)
+ xml_no_para++;
+
+ xml_insert_element_with_attribute (elt,
+ START, "width=\"%s\" height=\"%s\" name=\"%s\" extension=\"%s\"",
+ w_arg, h_arg, name_arg, ext_arg);
+ xml_insert_element (IMAGEALTTEXT, START);
+ execute_string ("%s", alt_arg);
+ xml_insert_element (IMAGEALTTEXT, END);
+ xml_insert_element (elt, END);
+
+ if (!xml_in_para)
+ xml_no_para--;
}
else
{ /* Try to open foo.EXT or foo.txt. */
@@ -3568,7 +3360,7 @@ cm_image (arg)
char *txtpath = NULL;
char *txtname = xmalloc (strlen (name_arg)
+ (ext_arg && *ext_arg
- ? strlen (ext_arg) + 1 : 4) + 1);
+ ? strlen (ext_arg) : 4) + 1);
strcpy (txtname, name_arg);
strcat (txtname, ".txt");
image_file = fopen (txtname, "r");
@@ -3587,49 +3379,72 @@ cm_image (arg)
int ch;
int save_inhibit_indentation = inhibit_paragraph_indentation;
int save_filling_enabled = filling_enabled;
+ int image_in_brackets = paragraph_is_open;
+
+ /* Write magic ^@^H[image ...^@^H] cookie in the info file, if
+ there's an accompanying bitmap. Otherwise just include the
+ text image. In the plaintext output, always include the text
+ image without the magic cookie. */
+ int use_magic_cookie = !no_headers
+ && access (fullname, R_OK) == 0 && !STREQ (fullname, txtname);
inhibit_paragraph_indentation = 1;
filling_enabled = 0;
last_char_was_newline = 0;
- /* Write magic ^@^H[image ...^@^H] cookie in the info file. */
- add_char ('\0');
- add_word ("\010[image");
+ if (use_magic_cookie)
+ {
+ add_char ('\0');
+ add_word ("\010[image");
- if (access (fullname, R_OK) == 0
- || (pathname != NULL && access (pathname, R_OK) == 0))
- add_word_args (" src=%s", fullname);
+ if (access (fullname, R_OK) == 0
+ || (pathname != NULL && access (pathname, R_OK) == 0))
+ add_word_args (" src=\"%s\"", fullname);
- if (*alt_arg)
- add_word_args (" alt=\"%s\"", alt_arg);
+ if (*alt_arg)
+ add_word_args (" alt=\"%s\"", alt_arg);
+ }
if (image_file != NULL)
{
- add_word (" text=\"");
+ if (use_magic_cookie)
+ add_word (" text=\"");
+
+ if (image_in_brackets)
+ add_char ('[');
+
/* Maybe we need to remove the final newline if the image
file is only one line to allow in-line images. On the
other hand, they could just make the file without a
final newline. */
while ((ch = getc (image_file)) != EOF)
{
- if (ch == '"' || ch == '\\')
+ if (use_magic_cookie && (ch == '"' || ch == '\\'))
add_char ('\\');
add_char (ch);
}
- add_char ('"');
+
+ if (image_in_brackets)
+ add_char (']');
+
+ if (use_magic_cookie)
+ add_char ('"');
if (fclose (image_file) != 0)
perror (txtname);
}
+ if (use_magic_cookie)
+ {
+ add_char ('\0');
+ add_word ("\010]");
+ }
+
inhibit_paragraph_indentation = save_inhibit_indentation;
filling_enabled = save_filling_enabled;
-
- add_char ('\0');
- add_word ("\010]");
}
else
- line_error (_("@image file `%s' (for text) unreadable: %s"),
+ warning (_("@image file `%s' (for text) unreadable: %s"),
txtname, strerror (errno));
}
@@ -3665,10 +3480,8 @@ typedef struct defines {
DEFINE *defines = NULL;
/* Add NAME to the list of `set' defines. */
-void
-set (name, value)
- char *name;
- char *value;
+static void
+set (char *name, char *value)
{
DEFINE *temp;
@@ -3685,12 +3498,18 @@ set (name, value)
temp->name = xstrdup (name);
temp->value = xstrdup (value);
defines = temp;
+
+ if (xml && !docbook)
+ {
+ xml_insert_element_with_attribute (SETVALUE, START, "name=\"%s\"", name);
+ execute_string ("%s", value);
+ xml_insert_element (SETVALUE, END);
+ }
}
/* Remove NAME from the list of `set' defines. */
-void
-clear (name)
- char *name;
+static void
+clear (char *name)
{
DEFINE *temp, *last;
@@ -3714,12 +3533,17 @@ clear (name)
last = temp;
temp = temp->next;
}
+
+ if (xml && !docbook)
+ {
+ xml_insert_element_with_attribute (CLEARVALUE, START, "name=\"%s\"", name);
+ xml_insert_element (CLEARVALUE, END);
+ }
}
/* Return the value of NAME. The return value is NULL if NAME is unset. */
-char *
-set_p (name)
- char *name;
+static char *
+set_p (char *name)
{
DEFINE *temp;
@@ -3732,26 +3556,26 @@ set_p (name)
/* Create a variable whose name appears as the first word on this line. */
void
-cm_set ()
+cm_set (void)
{
handle_variable (SET);
}
/* Remove a variable whose name appears as the first word on this line. */
void
-cm_clear ()
+cm_clear (void)
{
handle_variable (CLEAR);
}
void
-cm_ifset ()
+cm_ifset (void)
{
handle_variable (IFSET);
}
void
-cm_ifclear ()
+cm_ifclear (void)
{
handle_variable (IFCLEAR);
}
@@ -3763,7 +3587,7 @@ cm_ifclear ()
if ARG1 and ARG2 caselessly string compare to the same string, otherwise,
it produces no output. */
void
-cm_ifeq ()
+cm_ifeq (void)
{
char **arglist;
@@ -3783,11 +3607,16 @@ cm_ifeq ()
}
void
-cm_value (arg, start_pos, end_pos)
- int arg, start_pos, end_pos;
+cm_value (int arg, int start_pos, int end_pos)
{
static int value_level = 0, saved_meta_pos = -1;
+ /* xml_add_char() skips any content inside menus when output format is
+ Docbook, so @value{} is no use there. Also start_pos and end_pos does not
+ get updated, causing name to be empty string. So just return. */
+ if (docbook && in_menu)
+ return;
+
/* All the text after @value{ upto the matching } will eventually
disappear from output_paragraph, when this function is called
with ARG == END. If the text produced until then sets
@@ -3833,11 +3662,18 @@ cm_value (arg, start_pos, end_pos)
among other things. */
if (value)
- execute_string ("%s", value);
+ {
+ /* We need to get past the closing brace since the value may
+ expand to a context-sensitive macro (e.g. @xref) and produce
+ spurious warnings */
+ input_text_offset++;
+ execute_string ("%s", value);
+ input_text_offset--;
+ }
else
{
- warning (_("undefined flag: %s"), name);
- add_word_args (_("{No value for `%s'}"), name);
+ warning (_("undefined flag: %s"), name);
+ add_word_args (_("{No value for `%s'}"), name);
}
free (name);
@@ -3845,9 +3681,8 @@ cm_value (arg, start_pos, end_pos)
}
/* Set, clear, or conditionalize based on ACTION. */
-void
-handle_variable (action)
- int action;
+static void
+handle_variable (int action)
{
char *name;
@@ -3861,10 +3696,8 @@ handle_variable (action)
free (name);
}
-void
-handle_variable_internal (action, name)
- int action;
- char *name;
+static void
+handle_variable_internal (int action, char *name)
{
char *temp;
int delimiter, additional_text_present = 0;
@@ -4020,7 +3853,6 @@ handle_variable_internal (action, name)
}
/* Execution of random text not in file. */
-
typedef struct {
char *string; /* The string buffer. */
int size; /* The size of the buffer. */
@@ -4031,9 +3863,8 @@ static EXECUTION_STRING **execution_strings = NULL;
static int execution_strings_index = 0;
static int execution_strings_slots = 0;
-EXECUTION_STRING *
-get_execution_string (initial_size)
- int initial_size;
+static EXECUTION_STRING *
+get_execution_string (int initial_size)
{
int i = 0;
EXECUTION_STRING *es = NULL;
@@ -4081,9 +3912,7 @@ get_execution_string (initial_size)
entry in the execution_strings[] array and change the .STRING and
.SIZE members of that entry as appropriate. */
void
-maybe_update_execution_strings (text, new_len)
- char **text;
- unsigned new_len;
+maybe_update_execution_strings (char **text, unsigned int new_len)
{
int i = 0;
@@ -4127,10 +3956,11 @@ execute_string (format, va_alist)
#endif
{
EXECUTION_STRING *es;
- char *temp_string;
+ char *temp_string, *temp_input_filename;
#ifdef VA_FPRINTF
va_list ap;
#endif
+ int insertion_level_at_start = insertion_level;
es = get_execution_string (EXECUTE_STRING_MAX);
temp_string = es->string;
@@ -4147,28 +3977,50 @@ execute_string (format, va_alist)
pushfile ();
input_text_offset = 0;
input_text = temp_string;
- input_filename = xstrdup (input_filename);
input_text_length = strlen (temp_string);
+ input_filename = xstrdup (input_filename);
+ temp_input_filename = input_filename;
executing_string++;
reader_loop ();
- free (input_filename);
+
+ /* If insertion stack level changes during execution, that means a multiline
+ command is used inside braces or @section ... kind of commands. */
+ if (insertion_level_at_start != insertion_level && !executing_macro)
+ {
+ line_error (_("Multiline command %c%s used improperly"),
+ COMMAND_PREFIX,
+ command);
+ /* We also need to keep insertion_level intact to make sure warnings are
+ issued for @end ... command. */
+ while (insertion_level > insertion_level_at_start)
+ pop_insertion ();
+ }
popfile ();
executing_string--;
es->in_use = 0;
+ free (temp_input_filename);
}
/* Return what would be output for STR (in newly-malloced memory), i.e.,
- expand Texinfo commands. If IMPLICIT_CODE is set, expand @code{STR}.
- This is generally used for short texts; filling, indentation, and
- html escapes are disabled. */
+ expand Texinfo commands according to the current output format. If
+ IMPLICIT_CODE is set, expand @code{STR}. This is generally used for
+ short texts; filling, indentation, and html escapes are disabled. */
+
+char *
+expansion (char *str, int implicit_code)
+{
+ return maybe_escaped_expansion (str, implicit_code, 0);
+}
+
+
+/* Do HTML escapes according to DO_HTML_ESCAPE. Needed in
+ cm_printindex, q.v. */
char *
-expansion (str, implicit_code)
- char *str;
- int implicit_code;
+maybe_escaped_expansion (char *str, int implicit_code, int do_html_escape)
{
char *result;
@@ -4183,7 +4035,7 @@ expansion (str, implicit_code)
filling_enabled = 0;
indented_fill = 0;
no_indent = 1;
- escape_html = 0;
+ escape_html = do_html_escape;
result = full_expansion (str, implicit_code);
@@ -4198,12 +4050,10 @@ expansion (str, implicit_code)
/* Expand STR (or @code{STR} if IMPLICIT_CODE is nonzero). No change to
any formatting parameters -- filling, indentation, html escapes,
- etc., are not reset. */
+ etc., are not reset. Always returned in new memory. */
char *
-full_expansion (str, implicit_code)
- char *str;
- int implicit_code;
+full_expansion (char *str, int implicit_code)
{
int length;
char *result;
@@ -4260,18 +4110,20 @@ full_expansion (str, implicit_code)
format is. */
char *
-text_expansion (str)
- char *str;
+text_expansion (char *str)
{
char *ret;
int save_html = html;
int save_xml = xml;
+ int save_docbook = docbook;
html = 0;
xml = 0;
+ docbook = 0;
ret = expansion (str, 0);
html = save_html;
xml = save_xml;
+ docbook = save_docbook;
return ret;
}
@@ -4285,8 +4137,7 @@ text_expansion (str)
If NUM is zero, we assume `none'.
Returns 0 if successful, or nonzero if STRING isn't one of the above. */
int
-set_paragraph_indent (string)
- char *string;
+set_paragraph_indent (char *string)
{
if (strcmp (string, "asis") == 0 || strcmp (string, _("asis")) == 0)
paragraph_start_indent = 0;
OpenPOWER on IntegriCloud