diff options
author | ru <ru@FreeBSD.org> | 2005-05-23 10:46:22 +0000 |
---|---|---|
committer | ru <ru@FreeBSD.org> | 2005-05-23 10:46:22 +0000 |
commit | 212fa58b27874a1ac997e85e3f696ffad810e44c (patch) | |
tree | 3fc59092050a7fe0bd61c1e105cf78dc1c99d284 /contrib/texinfo/info | |
parent | 007f372a86653605d72852e22dcd423d0276786c (diff) | |
download | FreeBSD-src-212fa58b27874a1ac997e85e3f696ffad810e44c.zip FreeBSD-src-212fa58b27874a1ac997e85e3f696ffad810e44c.tar.gz |
Import of stripped down GNU texinfo 4.8
Diffstat (limited to 'contrib/texinfo/info')
50 files changed, 1896 insertions, 1871 deletions
diff --git a/contrib/texinfo/info/README b/contrib/texinfo/info/README index 5ea39e2..4178a01 100644 --- a/contrib/texinfo/info/README +++ b/contrib/texinfo/info/README @@ -1,4 +1,4 @@ -$Id: README,v 1.2 2002/09/11 16:32:09 karl Exp $ +$Id: README,v 1.3 2004/04/11 17:56:45 karl Exp $ texinfo/info/README Copyright (C) 2002 Free Software Foundation, Inc. diff --git a/contrib/texinfo/info/dir.c b/contrib/texinfo/info/dir.c index 626407f..98061df 100644 --- a/contrib/texinfo/info/dir.c +++ b/contrib/texinfo/info/dir.c @@ -1,7 +1,7 @@ /* dir.c -- how to build a special "dir" node from "localdir" files. - $Id: dir.c,v 1.1 2002/08/25 23:38:38 karl Exp $ + $Id: dir.c,v 1.3 2004/04/11 17:56:45 karl Exp $ - Copyright (C) 1993, 1997, 1998 Free Software Foundation, Inc. + Copyright (C) 1993, 1997, 1998, 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 @@ -28,7 +28,11 @@ with the addition of the menus of every file named in the array dirs_to_add which are found in INFOPATH. */ -static void add_menu_to_file_buffer (), insert_text_into_fb_at_binding (); +static void add_menu_to_file_buffer (char *contents, long int size, + FILE_BUFFER *fb); +static void insert_text_into_fb_at_binding (FILE_BUFFER *fb, + SEARCH_BINDING *binding, char *text, int textlen); +void maybe_build_dir_node (char *dirname); static char *dirs_to_add[] = { "dir", "localdir", (char *)NULL @@ -45,8 +49,7 @@ typedef struct } dir_file_list_entry_type; static int -new_dir_file_p (test) - struct stat *test; +new_dir_file_p (struct stat *test) { static unsigned dir_file_list_len = 0; static dir_file_list_entry_type *dir_file_list = NULL; @@ -70,8 +73,7 @@ new_dir_file_p (test) void -maybe_build_dir_node (dirname) - char *dirname; +maybe_build_dir_node (char *dirname) { int path_index, update_tags; char *this_dir; @@ -162,10 +164,7 @@ maybe_build_dir_node (dirname) to the menu found in FB->contents. Second argument SIZE is the total size of CONTENTS. */ static void -add_menu_to_file_buffer (contents, size, fb) - char *contents; - long size; - FILE_BUFFER *fb; +add_menu_to_file_buffer (char *contents, long int size, FILE_BUFFER *fb) { SEARCH_BINDING contents_binding, fb_binding; long contents_offset, fb_offset; @@ -271,11 +270,8 @@ add_menu_to_file_buffer (contents, size, fb) } static void -insert_text_into_fb_at_binding (fb, binding, text, textlen) - FILE_BUFFER *fb; - SEARCH_BINDING *binding; - char *text; - int textlen; +insert_text_into_fb_at_binding (FILE_BUFFER *fb, + SEARCH_BINDING *binding, char *text, int textlen) { char *contents; long start, end; diff --git a/contrib/texinfo/info/display.c b/contrib/texinfo/info/display.c index 07fb3d5..1a9fd0a 100644 --- a/contrib/texinfo/info/display.c +++ b/contrib/texinfo/info/display.c @@ -1,7 +1,7 @@ /* display.c -- How to display Info windows. - $Id: display.c,v 1.4 2003/05/13 16:20:44 karl Exp $ + $Id: display.c,v 1.7 2004/04/11 17:56:45 karl Exp $ - Copyright (C) 1993, 1997, 2003 Free Software Foundation, Inc. + Copyright (C) 1993, 1997, 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 @@ -17,15 +17,19 @@ 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 "display.h" -extern int info_any_buffered_input_p (); /* Found in session.c. */ +extern int info_any_buffered_input_p (void); /* Found in session.c. */ -static void free_display (); -static DISPLAY_LINE **make_display (); +static void free_display (DISPLAY_LINE **display); +static DISPLAY_LINE **make_display (int width, int height); + +void handle_tag (char *tag); +void handle_tag_start (char *tag); +void handle_tag_end (char *tag); /* An array of display lines which tell us what is currently visible on the display. */ @@ -36,8 +40,7 @@ int display_inhibited = 0; /* Initialize THE_DISPLAY to WIDTH and HEIGHT, with nothing in it. */ void -display_initialize_display (width, height) - int width, height; +display_initialize_display (int width, int height) { free_display (the_display); the_display = make_display (width, height); @@ -46,13 +49,11 @@ display_initialize_display (width, height) /* Clear all of the lines in DISPLAY making the screen blank. */ void -display_clear_display (display) - DISPLAY_LINE **display; +display_clear_display (DISPLAY_LINE **display) { register int i; - register DISPLAY_LINE *display_line; - for (i = 0; (display_line = display[i]); i++) + for (i = 0; display[i]; i++) { display[i]->text[0] = '\0'; display[i]->textlen = 0; @@ -66,8 +67,7 @@ int display_was_interrupted_p = 0; /* Update the windows pointed to by WINDOW in the_display. This actually writes the text on the screen. */ void -display_update_display (window) - WINDOW *window; +display_update_display (WINDOW *window) { register WINDOW *win; @@ -91,11 +91,36 @@ display_update_display (window) display_update_one_window (the_echo_area); } +void +handle_tag_start (char *tag) +{ + /* TODO really handle this tag. */ + return; +} + +void +handle_tag_end (char *tag) +{ + /* TODO really handle this tag. */ + return; +} + +void +handle_tag (char *tag) +{ + if (tag[0] == '/') + { + tag++; + handle_tag_end (tag); + } + else + handle_tag_start (tag); +} + /* Display WIN on the_display. Unlike display_update_display (), this function only does one window. */ void -display_update_one_window (win) - WINDOW *win; +display_update_one_window (WINDOW *win) { register char *nodetext; /* Current character to display. */ register char *last_node_char; /* Position of the last character in node. */ @@ -153,12 +178,40 @@ display_update_one_window (win) replen = win->width - pl_index + pl_ignore; } else if (*nodetext == '\0' - && (nodetext + 1) < last_node_char - && *(nodetext + 1) == '\b') + && (nodetext + 2) < last_node_char + && *(nodetext + 1) == '\b' + && *(nodetext + 2) == '[') { - /* Found new style image tag/cookie \0\b[ or \0\b] - Just skip for now. */ - nodetext++; + /* Found new style tag/cookie \0\b[ + Read until the closing tag \0\b] */ + int element_len = 0; + char *element; + + /* Skip the escapes. */ + nodetext += 3; + + while (!(*nodetext == '\0' + && *(nodetext + 1) == '\b' + && *(nodetext + 2) == ']')) + { + nodetext++; + element_len++; + } + + element = (char *) malloc (element_len + 1); + strncpy (element, nodetext - element_len, element_len); + + /* Skip the escapes. */ + nodetext += 2; + pl_ignore += element_len + 5; + /* Append string terminator. */ + element[element_len] = '\0'; + + handle_tag (element); + + /* Over and out */ + free (element); + continue; } else @@ -283,7 +336,7 @@ display_update_one_window (win) fflush (stdout); /* Update the display text buffer. */ - if (strlen (printed_line) > screenwidth) + if (strlen (printed_line) > (unsigned int) screenwidth) /* printed_line[] can include more than screenwidth characters if we are under -R and there are escape sequences in it. However, entry->text was @@ -395,8 +448,7 @@ display_update_one_window (win) for no scrolling to take place in the case that the terminal doesn't support it. This doesn't matter to us. */ void -display_scroll_display (start, end, amount) - int start, end, amount; +display_scroll_display (int start, int end, int amount) { register int i, last; DISPLAY_LINE *temp; @@ -466,10 +518,8 @@ display_scroll_display (start, end, amount) starts that used to appear in this window. OLD_COUNT is the number of lines that appear in the OLD_STARTS array. */ void -display_scroll_line_starts (window, old_pagetop, old_starts, old_count) - WINDOW *window; - int old_pagetop, old_count; - char **old_starts; +display_scroll_line_starts (WINDOW *window, int old_pagetop, + char **old_starts, int old_count) { register int i, old, new; /* Indices into the line starts arrays. */ int last_new, last_old; /* Index of the last visible line. */ @@ -541,8 +591,7 @@ display_scroll_line_starts (window, old_pagetop, old_starts, old_count) /* Move the screen cursor to directly over the current character in WINDOW. */ void -display_cursor_at_point (window) - WINDOW *window; +display_cursor_at_point (WINDOW *window) { int vpos, hpos; @@ -560,8 +609,7 @@ display_cursor_at_point (window) /* Make a DISPLAY_LINE ** with width and height. */ static DISPLAY_LINE ** -make_display (width, height) - int width, height; +make_display (int width, int height) { register int i; DISPLAY_LINE **display; @@ -581,8 +629,7 @@ make_display (width, height) /* Free the storage allocated to DISPLAY. */ static void -free_display (display) - DISPLAY_LINE **display; +free_display (DISPLAY_LINE **display) { register int i; register DISPLAY_LINE *display_line; diff --git a/contrib/texinfo/info/display.h b/contrib/texinfo/info/display.h index f1cf8c0..286db29 100644 --- a/contrib/texinfo/info/display.h +++ b/contrib/texinfo/info/display.h @@ -1,10 +1,10 @@ /* display.h -- How the display in Info is done. - $Id: display.h,v 1.1 2002/08/25 23:38:38 karl Exp $ + $Id: display.h,v 1.3 2004/04/11 17:56:45 karl Exp $ This file is part of GNU Info, a program for reading online documentation stored in Info format. - Copyright (C) 1993, 97 Free Software Foundation, Inc. + Copyright (C) 1993, 1997, 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 @@ -45,33 +45,34 @@ extern int display_inhibited; extern int display_was_interrupted_p; /* Initialize THE_DISPLAY to WIDTH and HEIGHT, with nothing in it. */ -extern void display_initialize_display (); +extern void display_initialize_display (int width, int height); /* Clear all of the lines in DISPLAY making the screen blank. */ -extern void display_clear_display (); +extern void display_clear_display (DISPLAY_LINE **display); /* Update the windows pointed to by WINDOWS in THE_DISPLAY. This actually writes the text on the screen. */ -extern void display_update_display (); +extern void display_update_display (WINDOW *window); /* Display WIN on THE_DISPLAY. Unlike display_update_display (), this function only does one window. */ -extern void display_update_one_window (); +extern void display_update_one_window (WINDOW *win); /* Move the screen cursor to directly over the current character in WINDOW. */ -extern void display_cursor_at_point (); +extern void display_cursor_at_point (WINDOW *window); /* Scroll the region of the_display starting at START, ending at END, and moving the lines AMOUNT lines. If AMOUNT is less than zero, the lines are moved up in the screen, otherwise down. Actually, it is possible for no scrolling to take place in the case that the terminal doesn't support it. This doesn't matter to us. */ -extern void display_scroll_display (); +extern void display_scroll_display (int start, int end, int amount); /* Try to scroll lines in WINDOW. OLD_PAGETOP is the pagetop of WINDOW before having had its line starts recalculated. OLD_STARTS is the list of line starts that used to appear in this window. OLD_COUNT is the number of lines that appear in the OLD_STARTS array. */ -extern void display_scroll_line_starts (); +extern void display_scroll_line_starts (WINDOW *window, int old_pagetop, + char **old_starts, int old_count); #endif /* not INFO_DISPLAY_H */ 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/doc.h b/contrib/texinfo/info/doc.h index 00c22e5..9315e8a 100644 --- a/contrib/texinfo/info/doc.h +++ b/contrib/texinfo/info/doc.h @@ -1,7 +1,7 @@ /* doc.h -- Structures associating function pointers with documentation. - $Id: doc.h,v 1.1 2002/08/25 23:38:38 karl Exp $ + $Id: doc.h,v 1.3 2004/04/11 17:56:45 karl Exp $ - Copyright (C) 1993, 2001 Free Software Foundation, Inc. + Copyright (C) 1993, 2001, 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 @@ -66,15 +66,6 @@ typedef struct extern FUNCTION_DOC function_doc_array[]; -extern char *function_documentation (); -extern char *key_documentation (); -extern char *pretty_keyname (); -extern char *pretty_keyseq (); -extern char *where_is (); -extern char *replace_in_documentation (); -extern void info_document_key (); -extern void dump_map_to_message_buffer (); - /* Under the old key-binding system, an info command is specified by the pointer to its function. Under the new INFOKEY binding system, it is specified by a pointer to the command's FUNCTION_DOC structure, @@ -82,7 +73,9 @@ extern void dump_map_to_message_buffer (); easily divined using the InfoFunction() extractor. */ #if defined(INFOKEY) typedef FUNCTION_DOC InfoCommand; -#define InfoFunction(ic) ((ic) ? (ic)->func : NULL) +/* The cast to VFunction * prevents pgcc from complaining about + dereferencing a void *. */ +#define InfoFunction(ic) ((ic) ? (ic)->func : (VFunction *) NULL) #define InfoCmd(fn) (&function_doc_array[A_##fn]) #define DocInfoCmd(fd) ((fd) && (fd)->func ? (fd) : NULL) #else /* !INFOKEY */ @@ -92,8 +85,19 @@ typedef VFunction InfoCommand; #define DocInfoCmd(fd) ((fd)->func) #endif /* !INFOKEY */ +#include "infomap.h" /* for Keymap. */ + #if defined (NAMED_FUNCTIONS) -extern char *function_name (); -extern InfoCommand *named_function (); +extern char *function_name (InfoCommand *cmd); +extern InfoCommand *named_function (char *name); #endif /* NAMED_FUNCTIONS */ + +extern char *function_documentation (InfoCommand *cmd); +extern char *key_documentation (char key, Keymap map); +extern char *pretty_keyname (unsigned char key); +extern char *pretty_keyseq (char *keyseq); +extern char *where_is (Keymap map, InfoCommand *cmd); +extern char *replace_in_documentation (char *string, int help_is_only_window_p); +extern void dump_map_to_message_buffer (char *prefix, Keymap map); + #endif /* !DOC_H */ diff --git a/contrib/texinfo/info/dribble.c b/contrib/texinfo/info/dribble.c index c4b5b9f..d456319 100644 --- a/contrib/texinfo/info/dribble.c +++ b/contrib/texinfo/info/dribble.c @@ -1,6 +1,7 @@ /* dribble.c -- dribble files for Info. + $Id: dribble.c,v 1.3 2004/04/11 17:56:45 karl Exp $ - Copyright (C) 1993, 98 Free Software Foundation, Inc. + Copyright (C) 1993, 1998, 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 @@ -28,8 +29,7 @@ FILE *info_dribble_file = (FILE *)NULL; /* Open a dribble file named NAME, perhaps closing an already open one. This sets the global variable INFO_DRIBBLE_FILE to the open stream. */ void -open_dribble_file (name) - char *name; +open_dribble_file (char *name) { /* Perhaps close existing dribble file. */ close_dribble_file (); @@ -49,7 +49,7 @@ open_dribble_file (name) /* If there is a dribble file already open, close it. */ void -close_dribble_file () +close_dribble_file (void) { if (info_dribble_file) { @@ -61,8 +61,7 @@ close_dribble_file () /* Write some output to our existing dribble file. */ void -dribble (byte) - unsigned char byte; +dribble (unsigned char byte) { if (info_dribble_file) fwrite (&byte, sizeof (unsigned char), 1, info_dribble_file); diff --git a/contrib/texinfo/info/dribble.h b/contrib/texinfo/info/dribble.h index 5647b40..f30f204 100644 --- a/contrib/texinfo/info/dribble.h +++ b/contrib/texinfo/info/dribble.h @@ -3,7 +3,7 @@ /* This file is part of GNU Info, a program for reading online documentation stored in Info format. - Copyright (C) 1993 Free Software Foundation, Inc. + Copyright (C) 1993, 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 @@ -30,12 +30,12 @@ extern FILE *info_dribble_file; /* Open a dribble file named NAME, perhaps closing an already open one. This sets the global variable INFO_DRIBBLE_FILE to the open stream. */ -extern void open_dribble_file (); +extern void open_dribble_file (char *name); /* If there is a dribble file already open, close it. */ -extern void close_dribble_file (); +extern void close_dribble_file (void); /* Write some output to our existing dribble file. */ -extern void dribble (); +extern void dribble (unsigned char byte); #endif /* !_DRIBBLE_H_ */ diff --git a/contrib/texinfo/info/echo-area.c b/contrib/texinfo/info/echo-area.c index 8954571..31385c8 100644 --- a/contrib/texinfo/info/echo-area.c +++ b/contrib/texinfo/info/echo-area.c @@ -1,7 +1,8 @@ /* echo-area.c -- how to read a line in the echo area. - $Id: echo-area.c,v 1.1 2002/08/25 23:38:38 karl Exp $ + $Id: echo-area.c,v 1.7 2004/12/14 00:15:36 karl Exp $ - Copyright (C) 1993, 1997, 1998, 1999, 2001 Free Software Foundation, Inc. + Copyright (C) 1993, 1997, 1998, 1999, 2001, 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 @@ -49,18 +50,19 @@ static int input_line_point; static int input_line_beg; static int input_line_end; static NODE input_line_node = { - (char *)NULL, (char *)NULL, (char *)NULL, input_line, EA_MAX_INPUT, 0 + (char *)NULL, (char *)NULL, (char *)NULL, input_line, + EA_MAX_INPUT, 0, N_IsInternal }; -static void echo_area_initialize_node (); -static void push_echo_area (), pop_echo_area (); -static int echo_area_stack_contains_completions_p (); +static void echo_area_initialize_node (void); +static void push_echo_area (void), pop_echo_area (void); +static int echo_area_stack_contains_completions_p (void); -static void ea_kill_text (); +static void ea_kill_text (int from, int to); /* Non-zero means we force the user to complete. */ static int echo_area_must_complete_p = 0; -static int completions_window_p (); +static int completions_window_p (WINDOW *window); /* If non-null, this is a window which was specifically created to display possible completions output. We remember it so we can delete it when @@ -76,8 +78,7 @@ static long calling_window_pagetop = 0; /* Remember the node and pertinent variables of the calling window. */ static void -remember_calling_window (window) - WINDOW *window; +remember_calling_window (WINDOW *window) { /* Only do this if the calling window is not the completions window, or, if it is the completions window and there is no other window. */ @@ -94,7 +95,7 @@ remember_calling_window (window) /* Restore the caller's window so that it shows the node that it was showing on entry to info_read_xxx_echo_area (). */ static void -restore_calling_window () +restore_calling_window (void) { register WINDOW *win, *compwin = (WINDOW *)NULL; @@ -124,7 +125,10 @@ restore_calling_window () !echo_area_stack_contains_completions_p ()) { WINDOW *next; - int pagetop, start, end, amount; + int pagetop = 0; + int start = 0; + int end = 0; + int amount = 0; next = compwin->next; if (next) @@ -156,8 +160,7 @@ restore_calling_window () /* Set up a new input line with PROMPT. */ static void -initialize_input_line (prompt) - char *prompt; +initialize_input_line (char *prompt) { input_line_prompt = prompt; if (prompt) @@ -169,7 +172,7 @@ initialize_input_line (prompt) } static char * -echo_area_after_read () +echo_area_after_read (void) { char *return_value; @@ -198,9 +201,7 @@ echo_area_after_read () active window, so that we can restore it when we need to. PROMPT, if non-null, is a prompt to print before reading the line. */ char * -info_read_in_echo_area (window, prompt) - WINDOW *window; - char *prompt; +info_read_in_echo_area (WINDOW *window, char *prompt) { char *line; @@ -246,11 +247,11 @@ info_read_in_echo_area (window, prompt) /* (re) Initialize the echo area node. */ static void -echo_area_initialize_node () +echo_area_initialize_node (void) { register int i; - for (i = input_line_end; i < sizeof (input_line); i++) + for (i = input_line_end; (unsigned int) i < sizeof (input_line); i++) input_line[i] = ' '; input_line[i - 1] = '\n'; @@ -262,7 +263,7 @@ echo_area_initialize_node () echo area node, but its primary purpose is to side effect the input line buffer contents. */ void -echo_area_prep_read () +echo_area_prep_read (void) { if (the_echo_area->node != &input_line_node) echo_area_initialize_node (); @@ -559,7 +560,7 @@ DECLARE_INFO_COMMAND (ea_yank, _("Yank back the contents of the last kill")) if (!kill_ring_index) { - inform_in_echo_area (_("Kill ring is empty")); + inform_in_echo_area ((char *) _("Kill ring is empty")); return; } @@ -576,8 +577,8 @@ DECLARE_INFO_COMMAND (ea_yank_pop, _("Yank back a previous kill")) { register int len; - if (((ea_last_executed_command != ea_yank) && - (ea_last_executed_command != ea_yank_pop)) || + if (((ea_last_executed_command != (VFunction *) ea_yank) && + (ea_last_executed_command != (VFunction *) ea_yank_pop)) || (kill_ring_index == 0)) return; @@ -670,8 +671,7 @@ DECLARE_INFO_COMMAND (ea_backward_kill_word, otherwise it is prepended. If the last command was not a kill command, then a new slot is made for this kill. */ static void -ea_kill_text (from, to) - int from, to; +ea_kill_text (int from, int to) { register int i, counter, distance; int killing_backwards, slot; @@ -776,7 +776,7 @@ static int completions_found_slots = 0; static REFERENCE *LCD_completion; /* Internal functions used by the user calls. */ -static void build_completions (), completions_must_be_rebuilt (); +static void build_completions (void), completions_must_be_rebuilt (void); /* Variable which holds the output of completions. */ static NODE *possible_completions_output_node = (NODE *)NULL; @@ -785,8 +785,7 @@ static char *compwin_name = "*Completions*"; /* Return non-zero if WINDOW is a window used for completions output. */ static int -completions_window_p (window) - WINDOW *window; +completions_window_p (WINDOW *window) { int result = 0; @@ -800,11 +799,8 @@ completions_window_p (window) /* Workhorse for completion readers. If FORCE is non-zero, the user cannot exit unless the line read completes, or is empty. */ char * -info_read_completing_internal (window, prompt, completions, force) - WINDOW *window; - char *prompt; - REFERENCE **completions; - int force; +info_read_completing_internal (WINDOW *window, char *prompt, + REFERENCE **completions, int force) { char *line; @@ -869,9 +865,9 @@ info_read_completing_internal (window, prompt, completions, force) if (i == completions_found_index) { if (!completions_found_index) - inform_in_echo_area (_("No completions")); + inform_in_echo_area ((char *) _("No completions")); else - inform_in_echo_area (_("Not complete")); + inform_in_echo_area ((char *) _("Not complete")); continue; } } @@ -897,10 +893,8 @@ info_read_completing_internal (window, prompt, completions, force) /* Read a line in the echo area with completion over COMPLETIONS. */ char * -info_read_completing_in_echo_area (window, prompt, completions) - WINDOW *window; - char *prompt; - REFERENCE **completions; +info_read_completing_in_echo_area (WINDOW *window, + char *prompt, REFERENCE **completions) { return (info_read_completing_internal (window, prompt, completions, 1)); } @@ -908,10 +902,8 @@ info_read_completing_in_echo_area (window, prompt, completions) /* Read a line in the echo area allowing completion over COMPLETIONS, but not requiring it. */ char * -info_read_maybe_completing (window, prompt, completions) - WINDOW *window; - char *prompt; - REFERENCE **completions; +info_read_maybe_completing (WINDOW *window, + char *prompt, REFERENCE **completions) { return (info_read_completing_internal (window, prompt, completions, 0)); } @@ -929,22 +921,23 @@ DECLARE_INFO_COMMAND (ea_possible_completions, _("List possible completions")) if (!completions_found_index) { terminal_ring_bell (); - inform_in_echo_area (_("No completions")); + inform_in_echo_area ((char *) _("No completions")); } else if ((completions_found_index == 1) && (key != '?')) { - inform_in_echo_area (_("Sole completion")); + inform_in_echo_area ((char *) _("Sole completion")); } else { register int i, l; - int limit, count, max_label = 0; + int limit, iterations, max_label = 0; initialize_message_buffer (); printf_to_message_buffer (completions_found_index == 1 - ? _("One completion:\n") - : _("%d completions:\n"), - completions_found_index); + ? (char *) _("One completion:\n") + : (char *) _("%d completions:\n"), + (void *) (long) completions_found_index, + NULL, NULL); /* Find the maximum length of a label. */ for (i = 0; i < completions_found_index; i++) @@ -967,15 +960,15 @@ DECLARE_INFO_COMMAND (ea_possible_completions, _("List possible completions")) limit = 1; /* How many iterations of the printing loop? */ - count = (completions_found_index + (limit - 1)) / limit; + iterations = (completions_found_index + (limit - 1)) / limit; /* Watch out for special case. If the number of completions is less than LIMIT, then just do the inner printing loop. */ if (completions_found_index < limit) - count = 1; + iterations = 1; /* Print the sorted items, up-and-down alphabetically. */ - for (i = 0; i < count; i++) + for (i = 0; i < iterations; i++) { register int j; @@ -990,17 +983,17 @@ DECLARE_INFO_COMMAND (ea_possible_completions, _("List possible completions")) label = completions_found[l]->label; printed_length = strlen (label); - printf_to_message_buffer ("%s", label); + printf_to_message_buffer ("%s", label, NULL, NULL); if (j + 1 < limit) { for (k = 0; k < max_label - printed_length; k++) - printf_to_message_buffer (" "); + printf_to_message_buffer (" ", NULL, NULL, NULL); } } - l += count; + l += iterations; } - printf_to_message_buffer ("\n"); + printf_to_message_buffer ("\n", NULL, NULL, NULL); } /* Make a new node to hold onto possible completions. Don't destroy @@ -1028,7 +1021,7 @@ DECLARE_INFO_COMMAND (ea_possible_completions, _("List possible completions")) { /* If we can split the window to display most of the completion items, then do so. */ - if (calling_window->height > (count * 2) + if (calling_window->height > (iterations * 2) && calling_window->height / 2 >= WINDOW_MIN_SIZE) { int start, pagetop; @@ -1046,7 +1039,7 @@ DECLARE_INFO_COMMAND (ea_possible_completions, _("List possible completions")) window_make_window (possible_completions_output_node); active_window = the_echo_area; window_change_window_height - (compwin, -(compwin->height - (count + 2))); + (compwin, -(compwin->height - (iterations + 2))); window_adjust_pagetop (calling_window); remember_calling_window (calling_window); @@ -1105,7 +1098,7 @@ DECLARE_INFO_COMMAND (ea_complete, _("Insert completion")) return; } - if (ea_last_executed_command == ea_complete) + if (ea_last_executed_command == (VFunction *) ea_complete) { /* If the keypress is a SPC character, and we have already tried completing once, and there are several completions, then check @@ -1153,9 +1146,11 @@ DECLARE_INFO_COMMAND (ea_complete, _("Insert completion")) } /* Utility REFERENCE used to store possible LCD. */ -static REFERENCE LCD_reference = { (char *)NULL, (char *)NULL, (char *)NULL }; +static REFERENCE LCD_reference = { + (char *)NULL, (char *)NULL, (char *)NULL, 0, 0, 0 +}; -static void remove_completion_duplicates (); +static void remove_completion_duplicates (void); /* Variables which remember the state of the most recent call to build_completions (). */ @@ -1164,7 +1159,7 @@ static REFERENCE **last_completion_items = (REFERENCE **)NULL; /* How to tell the completion builder to reset internal state. */ static void -completions_must_be_rebuilt () +completions_must_be_rebuilt (void) { maybe_free (last_completion_request); last_completion_request = (char *)NULL; @@ -1174,7 +1169,7 @@ completions_must_be_rebuilt () /* Build a list of possible completions from echo_area_completion_items, and the contents of input_line. */ static void -build_completions () +build_completions (void) { register int i, len; register REFERENCE *entry; @@ -1222,7 +1217,8 @@ build_completions () if (!informed_of_lengthy_job && completions_found_index > 100) { informed_of_lengthy_job = 1; - window_message_in_echo_area (_("Building completions...")); + window_message_in_echo_area ((char *) _("Building completions..."), + NULL, NULL); } } @@ -1291,15 +1287,17 @@ build_completions () /* Function called by qsort. */ static int -compare_references (entry1, entry2) - REFERENCE **entry1, **entry2; +compare_references (const void *entry1, const void *entry2) { - return (strcasecmp ((*entry1)->label, (*entry2)->label)); + REFERENCE **e1 = (REFERENCE **) entry1; + REFERENCE **e2 = (REFERENCE **) entry2; + + return (strcasecmp ((*e1)->label, (*e2)->label)); } /* Prune duplicate entries from COMPLETIONS_FOUND. */ static void -remove_completion_duplicates () +remove_completion_duplicates (void) { register int i, j; REFERENCE **temp; @@ -1359,8 +1357,7 @@ DECLARE_INFO_COMMAND (ea_scroll_completions_window, _("Scroll the completions wi /* Function which gets called when an Info window is deleted while the echo area is active. WINDOW is the window which has just been deleted. */ void -echo_area_inform_of_deleted_window (window) - WINDOW *window; +echo_area_inform_of_deleted_window (WINDOW *window) { /* If this is the calling_window, forget what we remembered about it. */ if (window == calling_window) @@ -1400,7 +1397,7 @@ static int pushed_echo_areas_slots = 0; /* Pushing the echo_area has a side effect of zeroing the completion_items. */ static void -push_echo_area () +push_echo_area (void) { PUSHED_EA *pushed; @@ -1422,7 +1419,7 @@ push_echo_area () } static void -pop_echo_area () +pop_echo_area (void) { PUSHED_EA *popped; @@ -1460,7 +1457,7 @@ pop_echo_area () /* Returns non-zero if any of the prior stacked calls to read in the echo area produced a completions window. */ static int -echo_area_stack_contains_completions_p () +echo_area_stack_contains_completions_p (void) { register int i; @@ -1483,7 +1480,7 @@ echo_area_stack_contains_completions_p () #endif /* HAVE_SYS_TIME_H */ static void -pause_or_input () +pause_or_input (void) { #ifdef FD_SET struct timeval timer; @@ -1503,14 +1500,14 @@ pause_or_input () for input or a couple of seconds, whichever comes first. Then flush the informational message that was printed. */ void -inform_in_echo_area (message) - char *message; +inform_in_echo_area (const char *message) { - register int i; + int i; char *text; + int avail = EA_MAX_INPUT + 1 - input_line_end; text = xstrdup (message); - for (i = 0; text[i] && text[i] != '\n'; i++) + for (i = 0; text[i] && text[i] != '\n' && i < avail; i++) ; text[i] = 0; diff --git a/contrib/texinfo/info/echo-area.h b/contrib/texinfo/info/echo-area.h index e8b57cb..3178428 100644 --- a/contrib/texinfo/info/echo-area.h +++ b/contrib/texinfo/info/echo-area.h @@ -1,10 +1,10 @@ /* echo-area.h -- Functions used in reading information from the echo area. - $Id: echo-area.h,v 1.1 2002/08/25 23:38:38 karl Exp $ + $Id: echo-area.h,v 1.4 2004/08/07 22:03:08 karl Exp $ This file is part of GNU Info, a program for reading online documentation stored in Info format. - Copyright (C) 1993, 97 Free Software Foundation, Inc. + Copyright (C) 1993, 1997, 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 @@ -33,32 +33,53 @@ extern int echo_area_is_active, info_aborted_echo_area; killed some text. */ extern int echo_area_last_command_was_kill; -extern void inform_in_echo_area (), echo_area_inform_of_deleted_window (); -extern void echo_area_prep_read (); +extern void inform_in_echo_area (const char *message); +extern void echo_area_inform_of_deleted_window (WINDOW *window); +extern void echo_area_prep_read (void); extern VFunction *ea_last_executed_command; +extern char * info_read_completing_internal (WINDOW *window, char *prompt, + REFERENCE **completions, int force); /* Read a line of text in the echo area. Return a malloc ()'ed string, or NULL if the user aborted out of this read. WINDOW is the currently active window, so that we can restore it when we need to. PROMPT, if non-null, is a prompt to print before reading the line. */ -extern char *info_read_in_echo_area (); +extern char *info_read_in_echo_area (WINDOW *window, char *prompt); /* Read a line in the echo area with completion over COMPLETIONS. Takes arguments of WINDOW, PROMPT, and COMPLETIONS, a REFERENCE **. */ -char *info_read_completing_in_echo_area (); +char *info_read_completing_in_echo_area (WINDOW *window, + char *prompt, REFERENCE **completions); /* Read a line in the echo area allowing completion over COMPLETIONS, but not requiring it. Takes arguments of WINDOW, PROMPT, and COMPLETIONS, a REFERENCE **. */ -extern char *info_read_maybe_completing (); - -extern void ea_insert (), ea_quoted_insert (); -extern void ea_beg_of_line (), ea_backward (), ea_delete (), ea_end_of_line (); -extern void ea_forward (), ea_abort (), ea_rubout (), ea_complete (); -extern void ea_newline (), ea_kill_line (), ea_transpose_chars (); -extern void ea_yank (), ea_tab_insert (), ea_possible_completions (); -extern void ea_backward_word (), ea_kill_word (), ea_forward_word (); -extern void ea_yank_pop (), ea_backward_kill_word (); -extern void ea_scroll_completions_window (); +extern char *info_read_maybe_completing (WINDOW *window, + char *prompt, REFERENCE **completions); + +extern void ea_insert (WINDOW *window, int count, unsigned char key); +extern void ea_quoted_insert (WINDOW *window, int count, unsigned char key); +extern void ea_beg_of_line (WINDOW *window, int count, unsigned char key); +extern void ea_backward (WINDOW *window, int count, unsigned char key); +extern void ea_delete (WINDOW *window, int count, unsigned char key); +extern void ea_end_of_line (WINDOW *window, int count, unsigned char key); +extern void ea_forward (WINDOW *window, int count, unsigned char key); +extern void ea_abort (WINDOW *window, int count, unsigned char key); +extern void ea_rubout (WINDOW *window, int count, unsigned char key); +extern void ea_complete (WINDOW *window, int count, unsigned char key); +extern void ea_newline (WINDOW *window, int count, unsigned char key); +extern void ea_kill_line (WINDOW *window, int count, unsigned char key); +extern void ea_backward_kill_line (WINDOW *window, int count, unsigned char key); +extern void ea_transpose_chars (WINDOW *window, int count, unsigned char key); +extern void ea_yank (WINDOW *window, int count, unsigned char key); +extern void ea_tab_insert (WINDOW *window, int count, unsigned char key); +extern void ea_possible_completions (WINDOW *window, int count, unsigned char key); +extern void ea_backward_word (WINDOW *window, int count, unsigned char key); +extern void ea_kill_word (WINDOW *window, int count, unsigned char key); +extern void ea_forward_word (WINDOW *window, int count, unsigned char key); +extern void ea_yank_pop (WINDOW *window, int count, unsigned char key); +extern void ea_backward_kill_word (WINDOW *window, int count, unsigned char key); +extern void ea_scroll_completions_window (WINDOW *window, int count, + unsigned char key); #endif /* not INFO_ECHO_AREA_H */ diff --git a/contrib/texinfo/info/filesys.c b/contrib/texinfo/info/filesys.c index 83618f1..8134480 100644 --- a/contrib/texinfo/info/filesys.c +++ b/contrib/texinfo/info/filesys.c @@ -1,7 +1,7 @@ /* filesys.c -- filesystem specific functions. - $Id: filesys.c,v 1.3 2003/01/31 19:18:11 karl Exp $ + $Id: filesys.c,v 1.6 2004/07/30 17:17:40 karl Exp $ - Copyright (C) 1993, 1997, 1998, 2000, 2002, 2003 Free Software + Copyright (C) 1993, 1997, 1998, 2000, 2002, 2003, 2004 Free Software Foundation, Inc. This program is free software; you can redistribute it and/or modify @@ -26,9 +26,12 @@ #include "filesys.h" /* Local to this file. */ -static char *info_file_in_path (), *lookup_info_filename (); -static char *info_absolute_file (); -static void remember_info_filename (), maybe_initialize_infopath (); +static char *info_file_in_path (char *filename, char *path); +static char *lookup_info_filename (char *filename); +static char *info_absolute_file (char *fname); + +static void remember_info_filename (char *filename, char *expansion); +static void maybe_initialize_infopath (void); typedef struct { @@ -77,8 +80,7 @@ static char *local_temp_filename = (char *)NULL; static int local_temp_filename_size = 0; char * -info_find_fullpath (partial) - char *partial; +info_find_fullpath (char *partial) { int initial_character; char *temp; @@ -141,7 +143,7 @@ info_find_fullpath (partial) if (temp) { remember_info_filename (partial, temp); - if (strlen (temp) > local_temp_filename_size) + if (strlen (temp) > (unsigned int) local_temp_filename_size) local_temp_filename = (char *) xrealloc (local_temp_filename, (local_temp_filename_size = (50 + strlen (temp)))); @@ -157,8 +159,7 @@ info_find_fullpath (partial) one that is a regular file, return it as a new string. Otherwise, return a NULL pointer. */ static char * -info_file_in_path (filename, path) - char *filename, *path; +info_file_in_path (char *filename, char *path) { struct stat finfo; char *temp_dirname; @@ -255,8 +256,7 @@ info_file_in_path (filename, path) return a NULL pointer. We do it by taking the file name apart into its directory and basename parts, and calling info_file_in_path.*/ static char * -info_absolute_file (fname) - char *fname; +info_absolute_file (char *fname) { char *containing_dir = xstrdup (fname); char *base = filename_non_directory (containing_dir); @@ -273,23 +273,21 @@ info_absolute_file (fname) are no more. Advance IDX to the character after the colon. */ char * -extract_colon_unit (string, idx) - char *string; - int *idx; +extract_colon_unit (char *string, int *idx) { - int i = *idx; - int start = *idx; + unsigned int i = (unsigned int) *idx; + unsigned int start = i; if (!string || i >= strlen (string)) return NULL; + if (!string[i]) /* end of string */ + return NULL; + /* Advance to next PATH_SEP. */ while (string[i] && string[i] != PATH_SEP[0]) i++; - if (!string[i] && i == start) /* end of string, and didn't advance */ - return NULL; - { char *value = xmalloc ((i - start) + 1); strncpy (value, &string[start], (i - start)); @@ -316,8 +314,7 @@ static int names_and_files_slots = 0; /* Find the result for having already called info_find_fullpath () with FILENAME. */ static char * -lookup_info_filename (filename) - char *filename; +lookup_info_filename (char *filename) { if (filename && names_and_files) { @@ -333,8 +330,7 @@ lookup_info_filename (filename) /* Add a filename and its expansion to our list. */ static void -remember_info_filename (filename, expansion) - char *filename, *expansion; +remember_info_filename (char *filename, char *expansion) { FILENAME_LIST *new; @@ -358,7 +354,7 @@ remember_info_filename (filename, expansion) } static void -maybe_initialize_infopath () +maybe_initialize_infopath (void) { if (!infopath_size) { @@ -372,9 +368,7 @@ maybe_initialize_infopath () /* Add PATH to the list of paths found in INFOPATH. 2nd argument says whether to put PATH at the front or end of INFOPATH. */ void -info_add_path (path, where) - char *path; - int where; +info_add_path (char *path, int where) { int len; @@ -408,7 +402,7 @@ info_add_path (path, where) /* Make INFOPATH have absolutely nothing in it. */ void -zap_infopath () +zap_infopath (void) { if (infopath) free (infopath); @@ -433,9 +427,7 @@ zap_infopath () FIXME: is it a good idea to show the EOL type on the modeline? */ long -convert_eols (text, textlen) - char *text; - long textlen; +convert_eols (char *text, long int textlen) { register char *s = text; register char *d = text; @@ -459,11 +451,8 @@ convert_eols (text, textlen) If the file turns out to be compressed, set IS_COMPRESSED to non-zero. If the file cannot be read, return a NULL pointer. */ char * -filesys_read_info_file (pathname, filesize, finfo, is_compressed) - char *pathname; - long *filesize; - struct stat *finfo; - int *is_compressed; +filesys_read_info_file (char *pathname, long int *filesize, + struct stat *finfo, int *is_compressed) { long st_size; @@ -472,7 +461,7 @@ filesys_read_info_file (pathname, filesize, finfo, is_compressed) if (compressed_filename_p (pathname)) { *is_compressed = 1; - return (filesys_read_compressed (pathname, filesize, finfo)); + return (filesys_read_compressed (pathname, filesize)); } else { @@ -524,10 +513,7 @@ filesys_read_info_file (pathname, filesize, finfo, is_compressed) #define FILESYS_PIPE_BUFFER_SIZE (16 * BASIC_PIPE_BUFFER) char * -filesys_read_compressed (pathname, filesize, finfo) - char *pathname; - long *filesize; - struct stat *finfo; +filesys_read_compressed (char *pathname, long int *filesize) { FILE *stream; char *command, *decompressor; @@ -553,7 +539,7 @@ filesys_read_compressed (pathname, filesize, finfo) temp = (char *)xmalloc (5 + strlen (command)); sprintf (temp, "%s...", command); - message_in_echo_area ("%s", temp); + message_in_echo_area ("%s", temp, NULL); free (temp); } #endif /* !BUILDING_LIBRARY */ @@ -615,8 +601,7 @@ filesys_read_compressed (pathname, filesize, finfo) /* Return non-zero if FILENAME belongs to a compressed file. */ int -compressed_filename_p (filename) - char *filename; +compressed_filename_p (char *filename) { char *decompressor; @@ -632,8 +617,7 @@ compressed_filename_p (filename) /* Return the command string that would be used to decompress FILENAME. */ char * -filesys_decompressor_for_file (filename) - char *filename; +filesys_decompressor_for_file (char *filename) { register int i; char *extension = (char *)NULL; @@ -676,9 +660,7 @@ static char *errmsg_buf = (char *)NULL; static int errmsg_buf_size = 0; char * -filesys_error_string (filename, error_num) - char *filename; - int error_num; +filesys_error_string (char *filename, int error_num) { int len; char *result; @@ -701,8 +683,7 @@ filesys_error_string (filename, error_num) in combination. */ int -is_dir_name (filename) - char *filename; +is_dir_name (char *filename) { unsigned i; diff --git a/contrib/texinfo/info/filesys.h b/contrib/texinfo/info/filesys.h index 5b7f5b7..89ca543 100644 --- a/contrib/texinfo/info/filesys.h +++ b/contrib/texinfo/info/filesys.h @@ -1,7 +1,7 @@ /* filesys.h -- external declarations for filesys.c. - $Id: filesys.h,v 1.1 2002/08/25 23:38:38 karl Exp $ + $Id: filesys.h,v 1.3 2004/04/11 17:56:45 karl Exp $ - Copyright (C) 1993, 1997, 1998, 2002 Free Software Foundation, Inc. + Copyright (C) 1993, 1997, 1998, 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 @@ -28,11 +28,11 @@ extern char *infopath; /* Make INFOPATH have absolutely nothing in it. */ -extern void zap_infopath (); +extern void zap_infopath (void); /* Add PATH to the list of paths found in INFOPATH. 2nd argument says whether to put PATH at the front or end of INFOPATH. */ -extern void info_add_path (); +extern void info_add_path (char *path, int where); /* Defines that are passed along with the pathname to info_add_path (). */ #define INFOPATH_PREPEND 0 @@ -41,27 +41,29 @@ extern void info_add_path (); /* Expand the filename in PARTIAL to make a real name for this operating system. This looks in INFO_PATHS in order to find the correct file. If it can't find the file, it returns NULL. */ -extern char *info_find_fullpath (); +extern char *info_find_fullpath (char *partial); /* Given a chunk of text and its length, convert all CRLF pairs at the EOLs into a single Newline character. Return the length of produced text. */ -long convert_eols (); +long convert_eols (char *text, long textlen); /* Read the contents of PATHNAME, returning a buffer with the contents of that file in it, and returning the size of that buffer in FILESIZE. FINFO is a stat struct which has already been filled in by the caller. If the file cannot be read, return a NULL pointer. */ -extern char *filesys_read_info_file (); -extern char *filesys_read_compressed (); +extern char *filesys_read_info_file (char *pathname, long int *filesize, + struct stat *finfo, int *is_compressed); + +extern char *filesys_read_compressed (char *pathname, long int *filesize); /* Return the command string that would be used to decompress FILENAME. */ -extern char *filesys_decompressor_for_file (); -extern int compressed_filename_p (); +extern char *filesys_decompressor_for_file (char *filename); +extern int compressed_filename_p (char *filename); /* A function which returns a pointer to a static buffer containing an error message for FILENAME and ERROR_NUM. */ -extern char *filesys_error_string (); +extern char *filesys_error_string (char *filename, int error_num); /* The number of the most recent file system error. */ extern int filesys_error_number; @@ -69,10 +71,10 @@ extern int filesys_error_number; /* Given a string containing units of information separated by colons, return the next one pointed to by IDX, or NULL if there are no more. Advance IDX to the character after the colon. */ -extern char *extract_colon_unit (); +extern char *extract_colon_unit (char *string, int *idx); /* Return true if FILENAME is `dir', with a possible compression suffix. */ -extern int is_dir_name (); +extern int is_dir_name (char *filename); /* The default value of INFOPATH. */ #if !defined (DEFAULT_INFOPATH) diff --git a/contrib/texinfo/info/footnotes.c b/contrib/texinfo/info/footnotes.c index 7abb8a6..c8cd7b5 100644 --- a/contrib/texinfo/info/footnotes.c +++ b/contrib/texinfo/info/footnotes.c @@ -1,7 +1,8 @@ /* footnotes.c -- Some functions for manipulating footnotes. - $Id: footnotes.c,v 1.2 2002/11/06 00:41:17 karl Exp $ + $Id: footnotes.c,v 1.4 2004/04/11 17:56:45 karl Exp $ - Copyright (C) 1993, 1997, 1998, 1999, 2002 Free Software Foundation, Inc. + Copyright (C) 1993, 1997, 1998, 1999, 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 @@ -17,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" @@ -26,12 +27,14 @@ int auto_footnotes_p = 0; static char *footnote_nodename = "*Footnotes*"; +NODE * make_footnotes_node (NODE *node); + #define FOOTNOTE_HEADER_FORMAT \ - "*** Footnotes appearing in the node \"%s\" ***\n" + "*** Footnotes appearing in the node `%s' ***\n" /* Find the window currently showing footnotes. */ static WINDOW * -find_footnotes_window () +find_footnotes_window (void) { WINDOW *win; @@ -48,8 +51,7 @@ find_footnotes_window () return the manufactured node. If NODE has no footnotes, return a NULL pointer. */ NODE * -make_footnotes_node (node) - NODE *node; +make_footnotes_node (NODE *node) { NODE *fn_node, *result = (NODE *)NULL; long fn_start; @@ -160,8 +162,7 @@ make_footnotes_node (node) in WINDOW's node. Returns FN_UNABLE if there were footnotes, but the window to show them couldn't be made. */ int -info_get_or_remove_footnotes (window) - WINDOW *window; +info_get_or_remove_footnotes (WINDOW *window) { WINDOW *fn_win; NODE *new_footnotes; @@ -209,7 +210,7 @@ info_get_or_remove_footnotes (window) /* If we are hacking automatic footnotes, and there are footnotes but we couldn't display them, print a message to that effect. */ if (auto_footnotes_p) - inform_in_echo_area (_("Footnotes could not be displayed")); + inform_in_echo_area ((char *) _("Footnotes could not be displayed")); return (FN_UNABLE); } } @@ -256,11 +257,11 @@ DECLARE_INFO_COMMAND (info_show_footnotes, switch (result) { case FN_UNFOUND: - info_error (msg_no_foot_node); + info_error ((char *) msg_no_foot_node, NULL, NULL); break; case FN_UNABLE: - info_error (msg_win_too_small); + info_error ((char *) msg_win_too_small, NULL, NULL); break; } } diff --git a/contrib/texinfo/info/footnotes.h b/contrib/texinfo/info/footnotes.h index 6fd42a3..7f58399 100644 --- a/contrib/texinfo/info/footnotes.h +++ b/contrib/texinfo/info/footnotes.h @@ -1,7 +1,7 @@ /* footnotes.h -- Some functions for manipulating footnotes. - $Id: footnotes.h,v 1.1 2002/08/25 23:38:38 karl Exp $ + $Id: footnotes.h,v 1.3 2004/04/11 17:56:45 karl Exp $ - Copyright (C) 1993, 1997, 1998, 2002 Free Software Foundation, Inc. + Copyright (C) 1993, 1997, 1998, 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 @@ -35,7 +35,7 @@ and displayed. Returns FN_UNFOUND if there were no footnotes found in WINDOW's node. Returns FN_UNABLE if there were footnotes, but the window to show them couldn't be made. */ -extern int info_get_or_remove_footnotes (); +extern int info_get_or_remove_footnotes (WINDOW *window); /* Non-zero means attempt to show footnotes when displaying a new window. */ extern int auto_footnotes_p; 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/gc.c b/contrib/texinfo/info/gc.c index 1c868ba..9416e3b 100644 --- a/contrib/texinfo/info/gc.c +++ b/contrib/texinfo/info/gc.c @@ -1,9 +1,7 @@ -/* gc.c -- Functions to remember and garbage collect unused node contents. */ +/* gc.c -- Functions to remember and garbage collect unused node contents. + $Id: gc.c,v 1.3 2004/04/11 17:56:45 karl Exp $ -/* This file is part of GNU Info, a program for reading online documentation - stored in Info format. - - Copyright (C) 1993 Free Software Foundation, Inc. + Copyright (C) 1993, 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 @@ -34,8 +32,7 @@ static int gcable_pointers_slots = 0; is not actually garbage collected until no info window contains a node whose contents member is equal to the pointer. */ void -add_gcable_pointer (pointer) - char *pointer; +add_gcable_pointer (char *pointer) { gc_pointers (); add_pointer_to_array (pointer, gcable_pointers_index, gcable_pointers, @@ -45,7 +42,7 @@ add_gcable_pointer (pointer) /* Grovel the list of info windows and gc-able pointers finding those node->contents which are collectible, and free them. */ void -gc_pointers () +gc_pointers (void) { register int i, j, k; INFO_WINDOW *iw; diff --git a/contrib/texinfo/info/gc.h b/contrib/texinfo/info/gc.h index 832cd53..67d031f 100644 --- a/contrib/texinfo/info/gc.h +++ b/contrib/texinfo/info/gc.h @@ -1,10 +1,10 @@ /* gc.h -- Functions for garbage collecting unused node contents. - $Id: gc.h,v 1.1 2002/08/25 23:38:38 karl Exp $ + $Id: gc.h,v 1.3 2004/04/11 17:56:45 karl Exp $ This file is part of GNU Info, a program for reading online documentation stored in Info format. - Copyright (C) 1993, 97 Free Software Foundation, Inc. + Copyright (C) 1993, 1997, 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 @@ -28,10 +28,10 @@ /* Add POINTER to the list of garbage collectible pointers. A pointer is not actually garbage collected until no info window contains a node whose contents member is equal to the pointer. */ -extern void add_gcable_pointer (); +extern void add_gcable_pointer (char *pointer); /* Grovel the list of info windows and gc-able pointers finding those node->contents which are collectible, and free them. */ -extern void gc_pointers (); +extern void gc_pointers (void); #endif /* not INFO_GC_H */ diff --git a/contrib/texinfo/info/indices.c b/contrib/texinfo/info/indices.c index 29cd2e2..f5b0eb5 100644 --- a/contrib/texinfo/info/indices.c +++ b/contrib/texinfo/info/indices.c @@ -1,7 +1,7 @@ /* indices.c -- deal with an Info file index. - $Id: indices.c,v 1.2 2003/02/11 16:39:06 karl Exp $ + $Id: indices.c,v 1.5 2004/04/11 17:56:45 karl Exp $ - Copyright (C) 1993, 1997, 1998, 1999, 2002, 2003 Free Software + Copyright (C) 1993, 1997, 1998, 1999, 2002, 2003, 2004 Free Software Foundation, Inc. This program is free software; you can redistribute it and/or modify @@ -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 "indices.h" @@ -55,9 +55,7 @@ static int index_nodenames_slots = 0; /* Add the name of NODE, and the range of the associated index elements (passed in ARRAY) to index_nodenames. */ static void -add_index_to_index_nodenames (array, node) - REFERENCE **array; - NODE *node; +add_index_to_index_nodenames (REFERENCE **array, NODE *node) { register int i, last; INDEX_NAME_ASSOC *assoc; @@ -88,8 +86,7 @@ add_index_to_index_nodenames (array, node) indices are concatenated and the result returned. If WINDOW's info file doesn't have any indices, a NULL pointer is returned. */ REFERENCE ** -info_indices_of_window (window) - WINDOW *window; +info_indices_of_window (WINDOW *window) { FILE_BUFFER *fb; @@ -99,8 +96,7 @@ info_indices_of_window (window) } REFERENCE ** -info_indices_of_file_buffer (file_buffer) - FILE_BUFFER *file_buffer; +info_indices_of_file_buffer (FILE_BUFFER *file_buffer) { register int i; REFERENCE **result = (REFERENCE **)NULL; @@ -181,10 +177,7 @@ DECLARE_INFO_COMMAND (info_index_search, /* Look up SEARCH_STRING in the index for this file. If SEARCH_STRING is NULL, prompt user for input. */ void -do_info_index_search (window, count, search_string) - WINDOW *window; - int count; - char *search_string; +do_info_index_search (WINDOW *window, int count, char *search_string) { FILE_BUFFER *fb; char *line; @@ -203,14 +196,15 @@ do_info_index_search (window, count, search_string) (FILENAME_CMP (initial_index_filename, fb->filename) != 0)) { info_free_references (index_index); - window_message_in_echo_area (_("Finding index entries...")); + window_message_in_echo_area ((char *) _("Finding index entries..."), + NULL, NULL); index_index = info_indices_of_file_buffer (fb); } /* If there is no index, quit now. */ if (!index_index) { - info_error (_("No indices found.")); + info_error ((char *) _("No indices found."), NULL, NULL); return; } @@ -220,7 +214,7 @@ do_info_index_search (window, count, search_string) line = xstrdup (search_string); else { - line = info_read_maybe_completing (window, _("Index entry: "), + line = info_read_maybe_completing (window, (char *) _("Index entry: "), index_index); window = active_window; @@ -283,9 +277,7 @@ do_info_index_search (window, count, search_string) } int -index_entry_exists (window, string) - WINDOW *window; - char *string; +index_entry_exists (WINDOW *window, char *string) { register int i; FILE_BUFFER *fb; @@ -340,14 +332,14 @@ DECLARE_INFO_COMMAND (info_next_index_match, yet. */ if (!index_search) { - info_error (_("No previous index search string.")); + info_error ((char *) _("No previous index search string."), NULL, NULL); return; } /* If there is no index, that is an error. */ if (!index_index) { - info_error (_("No index entries.")); + info_error ((char *) _("No index entries."), NULL, NULL); return; } @@ -380,8 +372,8 @@ DECLARE_INFO_COMMAND (info_next_index_match, /* If that failed, print an error. */ if ((i < 0) || (!index_index[i])) { - info_error (_("No %sindex entries containing \"%s\"."), - index_offset > 0 ? _("more ") : "", index_search); + info_error ((char *) _("No %sindex entries containing `%s'."), + index_offset > 0 ? (char *) _("more ") : "", index_search); return; } @@ -410,26 +402,27 @@ DECLARE_INFO_COMMAND (info_next_index_match, if (partial && show_index_match) { - int j, ls, start, upper; + int k, ls, start, upper; ls = strlen (index_search); start = partial - ls; upper = isupper (match[start]) ? 1 : 0; - for (j = 0; j < ls; j++) + for (k = 0; k < ls; k++) if (upper) - match[j + start] = info_tolower (match[j + start]); + match[k + start] = info_tolower (match[k + start]); else - match[j + start] = info_toupper (match[j + start]); + match[k + start] = info_toupper (match[k + start]); } { char *format; format = replace_in_documentation - (_("Found \"%s\" in %s. (`\\[next-index-match]' tries to find next.)")); + ((char *) _("Found `%s' in %s. (`\\[next-index-match]' tries to find next.)"), + 0); - window_message_in_echo_area (format, match, name); + window_message_in_echo_area (format, match, (char *) name); } free (match); @@ -440,7 +433,7 @@ DECLARE_INFO_COMMAND (info_next_index_match, if (!node) { - info_error (msg_cant_file_node, + info_error ((char *) msg_cant_file_node, index_index[i]->filename, index_index[i]->nodename); return; } @@ -471,9 +464,7 @@ DECLARE_INFO_COMMAND (info_next_index_match, /* For every menu item in DIR, search the indices of that file for SEARCH_STRING. */ REFERENCE ** -apropos_in_all_indices (search_string, inform) - char *search_string; - int inform; +apropos_in_all_indices (char *search_string, int inform) { register int i, dir_index; REFERENCE **all_indices = (REFERENCE **)NULL; @@ -547,7 +538,8 @@ apropos_in_all_indices (search_string, inform) } if (this_fb && inform) - message_in_echo_area (_("Scanning indices of \"%s\"..."), files_name); + message_in_echo_area ((char *) _("Scanning indices of `%s'..."), + files_name, NULL); this_index = info_indices_of_file_buffer (this_fb); free (this_node); @@ -601,20 +593,17 @@ apropos_in_all_indices (search_string, inform) } #define APROPOS_NONE \ - N_("No available info files have \"%s\" in their indices.") + N_("No available info files have `%s' in their indices.") void -info_apropos (string) - char *string; +info_apropos (char *string) { REFERENCE **apropos_list; apropos_list = apropos_in_all_indices (string, 0); if (!apropos_list) - { - info_error (_(APROPOS_NONE), string); - } + info_error ((char *) _(APROPOS_NONE), string, NULL); else { register int i; @@ -634,7 +623,7 @@ DECLARE_INFO_COMMAND (info_index_apropos, { char *line; - line = info_read_in_echo_area (window, _("Index apropos: ")); + line = info_read_in_echo_area (window, (char *) _("Index apropos: ")); window = active_window; @@ -654,9 +643,7 @@ DECLARE_INFO_COMMAND (info_index_apropos, apropos_list = apropos_in_all_indices (line, 1); if (!apropos_list) - { - info_error (_(APROPOS_NONE), line); - } + info_error ((char *) _(APROPOS_NONE), line, NULL); else { register int i; @@ -664,7 +651,8 @@ DECLARE_INFO_COMMAND (info_index_apropos, initialize_message_buffer (); printf_to_message_buffer - (_("\n* Menu: Nodes whoses indices contain \"%s\":\n"), line); + ((char *) _("\n* Menu: Nodes whose indices contain `%s':\n"), + line, NULL, NULL); line_buffer = (char *)xmalloc (500); for (i = 0; apropos_list[i]; i++) @@ -678,7 +666,7 @@ DECLARE_INFO_COMMAND (info_index_apropos, len = pad_to (40, line_buffer); sprintf (line_buffer + len, "(%s)%s.", apropos_list[i]->filename, apropos_list[i]->nodename); - printf_to_message_buffer ("%s\n", line_buffer); + printf_to_message_buffer ("%s\n", line_buffer, NULL, NULL); } free (line_buffer); } @@ -745,4 +733,3 @@ DECLARE_INFO_COMMAND (info_index_apropos, if (!info_error_was_printed) window_clear_echo_area (); } - diff --git a/contrib/texinfo/info/indices.h b/contrib/texinfo/info/indices.h index b5f74bb..1ccd676 100644 --- a/contrib/texinfo/info/indices.h +++ b/contrib/texinfo/info/indices.h @@ -1,10 +1,10 @@ /* indices.h -- Functions defined in indices.c. - $Id: indices.h,v 1.1 2002/08/25 23:38:38 karl Exp $ + $Id: indices.h,v 1.3 2004/04/11 17:56:45 karl Exp $ This file is part of GNU Info, a program for reading online documentation stored in Info format. - Copyright (C) 1993, 97 Free Software Foundation, Inc. + Copyright (C) 1993, 1997, 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 @@ -28,15 +28,18 @@ /* User-visible variable controls the output of info-index-next. */ extern int show_index_match; -extern REFERENCE **info_indices_of_window (), **info_indices_of_file_buffer (); -extern void info_apropos (); +extern REFERENCE **info_indices_of_window (WINDOW *window); +extern REFERENCE **info_indices_of_file_buffer (FILE_BUFFER *file_buffer); +extern void info_apropos (char *string); /* For every menu item in DIR, search the indices of that file for STRING. */ -REFERENCE **apropos_in_all_indices (); +REFERENCE **apropos_in_all_indices (char *search_string, int inform); /* User visible functions declared in indices.c. */ -extern void info_index_search (), info_next_index_match (); -extern void do_info_index_search (); -extern int index_intry_exists (); +extern void info_index_search (WINDOW *window, int count, unsigned char key); +extern void info_next_index_match (WINDOW *window, int count, unsigned char key); +extern void info_index_apropos (WINDOW *window, int count, unsigned char key); +extern void do_info_index_search (WINDOW *window, int count, char *search_string); +extern int index_entry_exists (WINDOW *window, char *string); #endif /* not INFO_INDICES_H */ diff --git a/contrib/texinfo/info/info-utils.c b/contrib/texinfo/info/info-utils.c index d018cbd..c23bac5 100644 --- a/contrib/texinfo/info/info-utils.c +++ b/contrib/texinfo/info/info-utils.c @@ -1,7 +1,7 @@ /* info-utils.c -- miscellanous. - $Id: info-utils.c,v 1.2 2003/03/06 23:22:23 karl Exp $ + $Id: info-utils.c,v 1.4 2004/04/11 17:56:45 karl Exp $ - Copyright (C) 1993, 1998, 2003 Free Software Foundation, Inc. + Copyright (C) 1993, 1998, 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 @@ -17,7 +17,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 "info-utils.h" @@ -37,12 +37,19 @@ char *info_parsed_filename = (char *)NULL; calling info_parse_xxx (). */ char *info_parsed_nodename = (char *)NULL; +/* Variable which holds the most recent line number parsed as a result of + calling info_parse_xxx (). */ +int info_parsed_line_number = 0; + /* Functions to remember a filename or nodename for later return. */ -static void save_filename (), saven_filename (); -static void save_nodename (), saven_nodename (); +static void save_filename (char *filename); +static void saven_filename (char *filename, int len); +static void save_nodename (char *nodename); +static void saven_nodename (char *nodename, int len); /* How to get a reference (either menu or cross). */ -static REFERENCE **info_references_internal (); +static REFERENCE **info_references_internal (char *label, + SEARCH_BINDING *binding); /* Parse the filename and nodename out of STRING. If STRING doesn't contain a filename (i.e., it is NOT (FILENAME)NODENAME) then set @@ -50,9 +57,7 @@ static REFERENCE **info_references_internal (); non-zero, it says to allow the nodename specification to cross a newline boundary (i.e., only `,', `.', or `TAB' can end the spec). */ void -info_parse_node (string, newlines_okay) - char *string; - int newlines_okay; +info_parse_node (char *string, int newlines_okay) { register int i = 0; @@ -96,6 +101,37 @@ info_parse_node (string, newlines_okay) free (info_parsed_nodename); info_parsed_nodename = (char *)NULL; } + + /* Parse ``(line ...)'' part of menus, if any. */ + { + char *rest = string + i; + + /* Advance only if it's not already at end of string. */ + if (*rest) + rest++; + + /* Skip any whitespace first, and then a newline in case the item + was so long to contain the ``(line ...)'' string in the same + physical line. */ + while (whitespace(*rest)) + rest++; + if (*rest == '\n') + { + rest++; + while (whitespace(*rest)) + rest++; + } + + /* Are we looking at an opening parenthesis? That can only mean + we have a winner. :) */ + if (strncmp (rest, "(line ", strlen ("(line ")) == 0) + { + rest += strlen ("(line "); + info_parsed_line_number = strtol (rest, NULL, 0); + } + else + info_parsed_line_number = 0; + } } /* Return the node addressed by LABEL in NODE (usually one of "Prev:", @@ -103,9 +139,7 @@ info_parse_node (string, newlines_okay) the global INFO_PARSED_NODENAME and INFO_PARSED_FILENAME contain the information. */ void -info_parse_label (label, node) - char *label; - NODE *node; +info_parse_label (char *label, NODE *node) { register int i; char *nodeline; @@ -135,30 +169,29 @@ info_parse_label (label, node) /* Return a NULL terminated array of REFERENCE * which represents the menu found in NODE. If there is no menu in NODE, just return a NULL pointer. */ REFERENCE ** -info_menu_of_node (node) - NODE *node; +info_menu_of_node (NODE *node) { long position; - SEARCH_BINDING search; + SEARCH_BINDING tmp_search; REFERENCE **menu = (REFERENCE **)NULL; - search.buffer = node->contents; - search.start = 0; - search.end = node->nodelen; - search.flags = S_FoldCase; + tmp_search.buffer = node->contents; + tmp_search.start = 0; + tmp_search.end = node->nodelen; + tmp_search.flags = S_FoldCase; /* Find the start of the menu. */ - position = search_forward (INFO_MENU_LABEL, &search); + position = search_forward (INFO_MENU_LABEL, &tmp_search); if (position == -1) return ((REFERENCE **) NULL); /* We have the start of the menu now. Glean menu items from the rest of the node. */ - search.start = position + strlen (INFO_MENU_LABEL); - search.start += skip_line (search.buffer + search.start); - search.start--; - menu = info_menu_items (&search); + tmp_search.start = position + strlen (INFO_MENU_LABEL); + tmp_search.start += skip_line (tmp_search.buffer + tmp_search.start); + tmp_search.start--; + menu = info_menu_items (&tmp_search); return (menu); } @@ -166,30 +199,28 @@ info_menu_of_node (node) refrences found in NODE. If there are no cross references in NODE, just return a NULL pointer. */ REFERENCE ** -info_xrefs_of_node (node) - NODE *node; +info_xrefs_of_node (NODE *node) { - SEARCH_BINDING search; + SEARCH_BINDING tmp_search; #if defined (HANDLE_MAN_PAGES) if (node->flags & N_IsManPage) return (xrefs_of_manpage (node)); #endif - search.buffer = node->contents; - search.start = 0; - search.end = node->nodelen; - search.flags = S_FoldCase; + tmp_search.buffer = node->contents; + tmp_search.start = 0; + tmp_search.end = node->nodelen; + tmp_search.flags = S_FoldCase; - return (info_xrefs (&search)); + return (info_xrefs (&tmp_search)); } /* Glean menu entries from BINDING->buffer + BINDING->start until we have looked at the entire contents of BINDING. Return an array of REFERENCE * that represents each menu item in this range. */ REFERENCE ** -info_menu_items (binding) - SEARCH_BINDING *binding; +info_menu_items (SEARCH_BINDING *binding) { return (info_references_internal (INFO_MENU_ENTRY_LABEL, binding)); } @@ -198,8 +229,7 @@ info_menu_items (binding) BINDING->end. Return an array of REFERENCE * that represents each cross reference in this range. */ REFERENCE ** -info_xrefs (binding) - SEARCH_BINDING *binding; +info_xrefs (SEARCH_BINDING *binding) { return (info_references_internal (INFO_XREF_LABEL, binding)); } @@ -207,33 +237,31 @@ info_xrefs (binding) /* Glean cross references or menu items from BINDING. Return an array of REFERENCE * that represents the items found. */ static REFERENCE ** -info_references_internal (label, binding) - char *label; - SEARCH_BINDING *binding; +info_references_internal (char *label, SEARCH_BINDING *binding) { - SEARCH_BINDING search; + SEARCH_BINDING tmp_search; REFERENCE **refs = (REFERENCE **)NULL; int refs_index = 0, refs_slots = 0; int searching_for_menu_items = 0; long position; - search.buffer = binding->buffer; - search.start = binding->start; - search.end = binding->end; - search.flags = S_FoldCase | S_SkipDest; + tmp_search.buffer = binding->buffer; + tmp_search.start = binding->start; + tmp_search.end = binding->end; + tmp_search.flags = S_FoldCase | S_SkipDest; searching_for_menu_items = (strcasecmp (label, INFO_MENU_ENTRY_LABEL) == 0); - while ((position = search_forward (label, &search)) != -1) + while ((position = search_forward (label, &tmp_search)) != -1) { int offset, start; char *refdef; REFERENCE *entry; - search.start = position; - search.start += skip_whitespace (search.buffer + search.start); - start = search.start - binding->start; - refdef = search.buffer + search.start; + tmp_search.start = position; + tmp_search.start += skip_whitespace (tmp_search.buffer + tmp_search.start); + start = tmp_search.start - binding->start; + refdef = tmp_search.buffer + tmp_search.start; offset = string_in_line (":", refdef); /* When searching for menu items, if no colon, there is no @@ -290,6 +318,8 @@ info_references_internal (label, binding) if (info_parsed_nodename) entry->nodename = xstrdup (info_parsed_nodename); + + entry->line_number = info_parsed_line_number; } add_pointer_to_array @@ -301,9 +331,7 @@ info_references_internal (label, binding) /* Get the entry associated with LABEL in REFERENCES. Return a pointer to the ENTRY if found, or NULL. */ REFERENCE * -info_get_labeled_reference (label, references) - char *label; - REFERENCE **references; +info_get_labeled_reference (char *label, REFERENCE **references) { register int i; REFERENCE *entry; @@ -320,8 +348,7 @@ info_get_labeled_reference (label, references) REFERENCE ** which is the concatenation of REF1 and REF2. The REF1 and REF2 arrays are freed, but their contents are not. */ REFERENCE ** -info_concatenate_references (ref1, ref2) - REFERENCE **ref1, **ref2; +info_concatenate_references (REFERENCE **ref1, REFERENCE **ref2) { register int i, j; REFERENCE **result; @@ -361,8 +388,7 @@ info_concatenate_references (ref1, ref2) every opportunity, we don't share any points, but copy everything into new memory. */ REFERENCE * -info_copy_reference (src) - REFERENCE *src; +info_copy_reference (REFERENCE *src) { REFERENCE *dest = xmalloc (sizeof (REFERENCE)); dest->label = src->label ? xstrdup (src->label) : NULL; @@ -378,8 +404,7 @@ info_copy_reference (src) /* Free the data associated with REFERENCES. */ void -info_free_references (references) - REFERENCE **references; +info_free_references (REFERENCE **references) { register int i; REFERENCE *entry; @@ -403,11 +428,10 @@ info_free_references (references) all such sequences with just a single space. Remove whitespace from start and end of string. */ void -canonicalize_whitespace (string) - char *string; +canonicalize_whitespace (char *string) { register int i, j; - int len, whitespace_found, whitespace_loc; + int len, whitespace_found, whitespace_loc = 0; char *temp; if (!string) @@ -458,9 +482,7 @@ static char the_rep[10]; /* Return a pointer to a string which is the printed representation of CHARACTER if it were printed at HPOS. */ char * -printed_representation (character, hpos) - unsigned char character; - int hpos; +printed_representation (unsigned char character, int hpos) { register int i = 0; int printable_limit = ISO_Latin_p ? 255 : 127; @@ -524,22 +546,21 @@ static int parsed_filename_size = 0; /* Amount of space allocated to INFO_PARSED_NODENAME via xmalloc (). */ static int parsed_nodename_size = 0; -static void save_string (), saven_string (); +static void save_string (char *string, char **string_p, int *string_size_p); +static void saven_string (char *string, int len, char **string_p, + int *string_size_p); /* Remember FILENAME in PARSED_FILENAME. An empty FILENAME is translated to a NULL pointer in PARSED_FILENAME. */ static void -save_filename (filename) - char *filename; +save_filename (char *filename) { save_string (filename, &info_parsed_filename, &parsed_filename_size); } /* Just like save_filename (), but you pass the length of the string. */ static void -saven_filename (filename, len) - char *filename; - int len; +saven_filename (char *filename, int len) { saven_string (filename, len, &info_parsed_filename, &parsed_filename_size); @@ -548,17 +569,14 @@ saven_filename (filename, len) /* Remember NODENAME in PARSED_NODENAME. An empty NODENAME is translated to a NULL pointer in PARSED_NODENAME. */ static void -save_nodename (nodename) - char *nodename; +save_nodename (char *nodename) { save_string (nodename, &info_parsed_nodename, &parsed_nodename_size); } /* Just like save_nodename (), but you pass the length of the string. */ static void -saven_nodename (nodename, len) - char *nodename; - int len; +saven_nodename (char *nodename, int len) { saven_string (nodename, len, &info_parsed_nodename, &parsed_nodename_size); @@ -568,10 +586,7 @@ saven_nodename (nodename, len) bytes allocated to it. An empty STRING is translated to a NULL pointer in STRING_P. */ static void -save_string (string, string_p, string_size_p) - char *string; - char **string_p; - int *string_size_p; +save_string (char *string, char **string_p, int *string_size_p) { if (!string || !*string) { @@ -583,7 +598,7 @@ save_string (string, string_p, string_size_p) } else { - if (strlen (string) >= *string_size_p) + if (strlen (string) >= (unsigned int) *string_size_p) *string_p = (char *)xrealloc (*string_p, (*string_size_p = 1 + strlen (string))); @@ -593,11 +608,7 @@ save_string (string, string_p, string_size_p) /* Just like save_string (), but you also pass the length of STRING. */ static void -saven_string (string, len, string_p, string_size_p) - char *string; - int len; - char **string_p; - int *string_size_p; +saven_string (char *string, int len, char **string_p, int *string_size_p) { if (!string) { @@ -619,8 +630,7 @@ saven_string (string, len, string_p, string_size_p) /* Return a pointer to the part of PATHNAME that simply defines the file. */ char * -filename_non_directory (pathname) - char *pathname; +filename_non_directory (char *pathname) { register char *filename = pathname + strlen (pathname); @@ -635,8 +645,7 @@ filename_non_directory (pathname) /* Return non-zero if NODE is one especially created by Info. */ int -internal_info_node_p (node) - NODE *node; +internal_info_node_p (NODE *node) { #if defined (NEVER) if (node && @@ -652,9 +661,7 @@ internal_info_node_p (node) /* Make NODE appear to be one especially created by Info. */ void -name_internal_node (node, name) - NODE *node; - char *name; +name_internal_node (NODE *node, char *name) { if (!node) return; @@ -668,8 +675,7 @@ name_internal_node (node, name) /* Return the window displaying NAME, the name of an internally created Info window. */ WINDOW * -get_internal_info_window (name) - char *name; +get_internal_info_window (char *name) { WINDOW *win; @@ -683,8 +689,7 @@ get_internal_info_window (name) /* Return a window displaying the node NODE. */ WINDOW * -get_window_of_node (node) - NODE *node; +get_window_of_node (NODE *node) { WINDOW *win = (WINDOW *)NULL; diff --git a/contrib/texinfo/info/info-utils.h b/contrib/texinfo/info/info-utils.h index 6ff0581..6517b15 100644 --- a/contrib/texinfo/info/info-utils.h +++ b/contrib/texinfo/info/info-utils.h @@ -1,7 +1,8 @@ /* info-utils.h -- Exported functions and variables from info-utils.c. - $Id: info-utils.h,v 1.2 2003/03/06 23:21:48 karl Exp $ + $Id: info-utils.h,v 1.4 2004/04/11 17:56:45 karl Exp $ - Copyright (C) 1993, 1996, 1998, 2002, 2003 Free Software Foundation, Inc. + Copyright (C) 1993, 1996, 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 @@ -34,6 +35,7 @@ typedef struct { char *filename; /* File where this node can be found. */ char *nodename; /* Name of the node. */ int start, end; /* Offsets within the containing node of LABEL. */ + int line_number; /* Specific line number a menu item points to. */ } REFERENCE; /* When non-zero, various display and input functions handle ISO Latin @@ -53,72 +55,73 @@ extern char *info_parsed_nodename; INFO_PARSED_FILENAME to NULL. If second argument NEWLINES_OKAY is non-zero, it says to allow the nodename specification to cross a newline boundary (i.e., only `,', `.', or `TAB' can end the spec). */ -void info_parse_node (); +void info_parse_node (char *string, int newlines_okay); /* Return a NULL terminated array of REFERENCE * which represents the menu found in NODE. If there is no menu in NODE, just return a NULL pointer. */ -extern REFERENCE **info_menu_of_node (); +extern REFERENCE **info_menu_of_node (NODE *node); /* Return a NULL terminated array of REFERENCE * which represents the cross refrences found in NODE. If there are no cross references in NODE, just return a NULL pointer. */ -extern REFERENCE **info_xrefs_of_node (); +extern REFERENCE **info_xrefs_of_node (NODE *node); /* Glean cross references from BINDING->buffer + BINDING->start until BINDING->end. Return an array of REFERENCE * that represents each cross reference in this range. */ -extern REFERENCE **info_xrefs (); +extern REFERENCE **info_xrefs (SEARCH_BINDING *binding); /* Get the entry associated with LABEL in REFERENCES. Return a pointer to the reference if found, or NULL. */ -extern REFERENCE *info_get_labeled_reference (); +extern REFERENCE *info_get_labeled_reference (char *label, + REFERENCE **references); /* Glean menu entries from BINDING->buffer + BINDING->start until we have looked at the entire contents of BINDING. Return an array of REFERENCE * that represents each menu item in this range. */ -extern REFERENCE **info_menu_items (); +extern REFERENCE **info_menu_items (SEARCH_BINDING *binding); /* A utility function for concatenating REFERENCE **. Returns a new REFERENCE ** which is the concatenation of REF1 and REF2. The REF1 and REF2 arrays are freed, but their contents are not. */ -REFERENCE **info_concatenate_references (); +REFERENCE **info_concatenate_references (REFERENCE **ref1, REFERENCE **ref2); /* Copy an existing reference into new memory. */ -extern REFERENCE *info_copy_reference (); +extern REFERENCE *info_copy_reference (REFERENCE *src); /* Free the data associated with REFERENCES. */ -extern void info_free_references (); +extern void info_free_references (REFERENCE **references); /* Search for sequences of whitespace or newlines in STRING, replacing all such sequences with just a single space. Remove whitespace from start and end of string. */ -void canonicalize_whitespace (); +void canonicalize_whitespace (char *string); /* Return a pointer to a string which is the printed representation of CHARACTER if it were printed at HPOS. */ -extern char *printed_representation (); +extern char *printed_representation (unsigned char character, int hpos); /* Return a pointer to the part of PATHNAME that simply defines the file. */ -extern char *filename_non_directory (); +extern char *filename_non_directory (char *pathname); /* Return non-zero if NODE is one especially created by Info. */ -extern int internal_info_node_p (); +extern int internal_info_node_p (NODE *node); /* Make NODE appear to be one especially created by Info, and give it NAME. */ -extern void name_internal_node (); +extern void name_internal_node (NODE *node, char *name); /* Return the window displaying NAME, the name of an internally created Info window. */ -extern WINDOW *get_internal_info_window (); +extern WINDOW *get_internal_info_window (char *name); /* Return a window displaying the node NODE. */ -extern WINDOW *get_window_of_node (); +extern WINDOW *get_window_of_node (NODE *node); /* Return the node addressed by LABEL in NODE (usually one of "Prev:", "Next:", "Up:", "File:", or "Node:". After a call to this function, the globals `info_parsed_nodename' and `info_parsed_filename' contain the information. */ -extern void info_parse_label (/* label, node */); +extern void info_parse_label (char *label, NODE *node); #define info_file_label_of_node(n) info_parse_label (INFO_FILE_LABEL, n) #define info_next_label_of_node(n) info_parse_label (INFO_NEXT_LABEL, n) diff --git a/contrib/texinfo/info/info.c b/contrib/texinfo/info/info.c index 5fceb74..79dd024 100644 --- a/contrib/texinfo/info/info.c +++ b/contrib/texinfo/info/info.c @@ -1,8 +1,8 @@ /* info.c -- Display nodes of Info files in multiple windows. - $Id: info.c,v 1.7 2003/05/19 13:10:59 karl Exp $ + $Id: info.c,v 1.11 2004/04/11 17:56:45 karl Exp $ - Copyright (C) 1993, 1996, 1997, 1998, 1999, 2000, 2001, 2002, 2003 - Free Software Foundation, Inc. + 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 it under the terms of the GNU General Public License as published by @@ -77,8 +77,11 @@ int dump_subnodes = 0; /* Non-zero means make default keybindings be loosely modeled on vi(1). */ int vi_keys_p = 0; -/* Non-zero means don't remove ANSI escape sequences from man pages. */ -int raw_escapes_p = 0; +/* Non-zero means don't remove ANSI escape sequences. */ +int raw_escapes_p = 1; + +/* Non-zero means print the absolute location of the file to be loaded. */ +static int print_where_p = 0; #ifdef __MSDOS__ /* Non-zero indicates that screen output should be made 'speech-friendly'. @@ -103,15 +106,18 @@ static struct option long_options[] = { { "file", 1, 0, 'f' }, { "help", 0, &print_help_p, 1 }, { "index-search", 1, 0, IDXSRCH_OPTION }, + { "location", 0, &print_where_p, 1 }, { "node", 1, 0, 'n' }, { "output", 1, 0, 'o' }, { "raw-escapes", 0, &raw_escapes_p, 1 }, + { "no-raw-escapes", 0, &raw_escapes_p, 0 }, { "restore", 1, 0, RESTORE_OPTION }, { "show-options", 0, 0, 'O' }, { "subnodes", 0, &dump_subnodes, 1 }, { "usage", 0, 0, 'O' }, { "version", 0, &print_version_p, 1 }, { "vi-keys", 0, &vi_keys_p, 1 }, + { "where", 0, &print_where_p, 1 }, #ifdef __MSDOS__ { "speech-friendly", 0, &speech_friendly, 1 }, #endif @@ -120,18 +126,17 @@ static struct option long_options[] = { /* String describing the shorthand versions of the long options found above. */ #ifdef __MSDOS__ -static char *short_options = "d:n:f:ho:ORsb"; +static char *short_options = "d:n:f:ho:ORswb"; #else -static char *short_options = "d:n:f:ho:ORs"; +static char *short_options = "d:n:f:ho:ORws"; #endif /* When non-zero, the Info window system has been initialized. */ int info_windows_initialized_p = 0; /* Some "forward" declarations. */ -static void info_short_help (); -static void init_messages (); -extern void add_file_directory_to_path (); +static void info_short_help (void); +static void init_messages (void); /* **************************************************************** */ @@ -141,9 +146,7 @@ extern void add_file_directory_to_path (); /* **************************************************************** */ int -main (argc, argv) - int argc; - char **argv; +main (int argc, char **argv) { int getopt_long_index; /* Index returned by getopt_long (). */ NODE *initial_node; /* First node loaded by Info. */ @@ -153,9 +156,11 @@ main (argc, argv) setlocale (LC_ALL, ""); #endif +#ifdef ENABLE_NLS /* Set the text message domain. */ bindtextdomain (PACKAGE, LOCALEDIR); textdomain (PACKAGE); +#endif init_messages (); @@ -229,6 +234,11 @@ main (argc, argv) dump_subnodes = 1; break; + /* For compatibility with man, -w is --where. */ + case 'w': + print_where_p = 1; + break; + #ifdef __MSDOS__ /* User wants speech-friendly output. */ case 'b': @@ -281,11 +291,10 @@ main (argc, argv) { printf ("%s (GNU %s) %s\n", program_name, PACKAGE, VERSION); 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); } @@ -322,7 +331,13 @@ For more information about these matters, see the files named COPYING.\n"), { info_add_path (DEFAULT_INFOPATH, INFOPATH_PREPEND); #ifdef INFODIR /* from the Makefile */ - info_add_path (INFODIR, INFOPATH_PREPEND); + info_add_path (INFODIR, INFOPATH_PREPEND); +#endif +#ifdef INFODIR2 /* from the Makefile, too */ +# ifdef INFODIR + if (!STREQ (INFODIR, INFODIR2)) +# endif + info_add_path (INFODIR2, INFOPATH_PREPEND); #endif } } @@ -349,10 +364,10 @@ For more information about these matters, see the files named COPYING.\n"), if (!initial_node) { if (info_recent_file_error) - info_error (info_recent_file_error); + info_error (info_recent_file_error, NULL, NULL); else - info_error (msg_cant_find_node, - user_nodenames ? user_nodenames[0] : "Top"); + info_error ((char *) msg_cant_find_node, + user_nodenames ? user_nodenames[0] : "Top", NULL); xexit (1); } @@ -364,7 +379,9 @@ For more information about these matters, see the files named COPYING.\n"), { free (initial_node); - if (user_output_filename) + if (print_where_p) + printf ("%s\n", user_filename ? user_filename : "unknown?!"); + else if (user_output_filename) dump_nodes_to_file (user_filename, user_nodenames, user_output_filename, dump_subnodes); else @@ -378,13 +395,27 @@ For more information about these matters, see the files named COPYING.\n"), file name is either "dir", or the contents of user_filename if one was specified. */ { - char *errstr, *errarg1, *errarg2; + const char *errstr; + char *errarg1, *errarg2; + NODE *new_initial_node = info_follow_menus (initial_node, argv + optind, - &errstr, &errarg1, &errarg2); + &errstr, &errarg1, &errarg2); if (new_initial_node && new_initial_node != initial_node) initial_node = new_initial_node; + if (print_where_p) + { + if (initial_node->parent) + printf ("%s\n", initial_node->parent); + else if (initial_node->filename + && !is_dir_name (filename_non_directory (initial_node->filename))) + printf ("%s\n", initial_node->filename); + else + xexit (1); + xexit (0); + } + /* If the user specified that this node should be output, then do that now. Otherwise, start the Info session with this node. Or act accordingly if the initial node was not found. */ @@ -394,14 +425,14 @@ For more information about these matters, see the files named COPYING.\n"), dump_node_to_file (initial_node, user_output_filename, dump_subnodes); else - info_error (errstr, errarg1, errarg2); + info_error ((char *) errstr, errarg1, errarg2); } else { if (errstr) - begin_info_session_with_error (initial_node, errstr, - errarg1, errarg2); + begin_info_session_with_error (initial_node, (char *) errstr, + errarg1, errarg2); /* If the user specified `--index-search=STRING' or --show-options, start the info session in the node corresponding to what they want. */ @@ -483,8 +514,7 @@ For more information about these matters, see the files named COPYING.\n"), } void -add_file_directory_to_path (filename) - char *filename; +add_file_directory_to_path (char *filename) { char *directory_name = xstrdup (filename); char *temp = filename_non_directory (directory_name); @@ -518,9 +548,7 @@ int info_error_rings_bell_p = 1; then the message is printed in the echo area. Otherwise, a message is output to stderr. */ void -info_error (format, arg1, arg2) - char *format; - void *arg1, *arg2; +info_error (char *format, void *arg1, void *arg2) { info_error_was_printed = 1; @@ -556,7 +584,7 @@ info_error (format, arg1, arg2) /* Produce a scaled down description of the available options to Info. */ static void -info_short_help () +info_short_help (void) { #ifdef __MSDOS__ static const char speech_friendly_string[] = N_("\ @@ -580,10 +608,12 @@ Options:\n\ --index-search=STRING go to node pointed by index entry STRING.\n\ -n, --node=NODENAME specify nodes in first visited Info file.\n\ -o, --output=FILENAME output selected nodes to FILENAME.\n\ - -R, --raw-escapes don't remove ANSI escapes from man pages.\n\ + -R, --raw-escapes output \"raw\" ANSI escapes (default).\n\ + --no-raw-escapes output escapes as literal text.\n\ --restore=FILENAME read initial keystrokes from FILENAME.\n\ -O, --show-options, --usage go to command-line options node.\n%s\ --subnodes recursively output menu items.\n\ + -w, --where, --location print physical location of Info file.\n\ --vi-keys use vi-like and less-like key bindings.\n\ --version display version information and exit.\n\ \n\ @@ -634,7 +664,7 @@ const char *msg_win_too_small; const char *msg_cant_make_help; static void -init_messages () +init_messages (void) { msg_cant_find_node = _("Cannot find node `%s'."); msg_cant_file_node = _("Cannot find node `(%s)%s'."); diff --git a/contrib/texinfo/info/info.h b/contrib/texinfo/info/info.h index 90b82e4..7ff8abe 100644 --- a/contrib/texinfo/info/info.h +++ b/contrib/texinfo/info/info.h @@ -1,7 +1,7 @@ /* info.h -- Header file which includes all of the other headers. - $Id: info.h,v 1.2 2003/02/11 16:39:06 karl Exp $ + $Id: info.h,v 1.4 2004/04/11 17:56:45 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 @@ -126,7 +126,9 @@ extern int raw_escapes_p; /* Print FORMAT with ARG1 and ARG2. If the window system was initialized, then the message is printed in the echo area. Otherwise, a message is output to stderr. */ -extern void info_error (); +extern void info_error (char *format, void *arg1, void *arg2); + +extern void add_file_directory_to_path (char *filename); /* Error message defines. */ extern const char *msg_cant_find_node; @@ -147,16 +149,12 @@ extern const char *msg_win_too_small; extern const char *msg_cant_make_help; -extern char *filename_non_directory (); /* Found in info-utils.c. */ - #if defined(INFOKEY) -extern void set_variable_to_value (); /* Found in variables.c. */ +/* Found in variables.c. */ +extern void set_variable_to_value (char *name, char *value); #endif /* INFOKEY */ -#if !defined (BUILDING_LIBRARY) -extern int info_windows_initialized_p; /* Found in session.c */ -/* Found in window.c. */ -extern void message_in_echo_area (), unmessage_in_echo_area (); -#endif /* !BUILDING_LIBRARY */ +/* Found in m-x.c. */ +extern char *read_function_name (char *prompt, WINDOW *window); #endif /* !INFO_H */ diff --git a/contrib/texinfo/info/infodoc.c b/contrib/texinfo/info/infodoc.c index 5c25323..eeea147 100644 --- a/contrib/texinfo/info/infodoc.c +++ b/contrib/texinfo/info/infodoc.c @@ -1,7 +1,7 @@ /* infodoc.c -- functions which build documentation nodes. - $Id: infodoc.c,v 1.6 2003/05/13 16:22:11 karl Exp $ + $Id: infodoc.c,v 1.8 2004/04/11 17:56:45 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 @@ -185,12 +185,10 @@ static char *info_help_keys_text[][2] = { #endif /* !INFOKEY */ -static char *where_is_internal (); +static char *where_is_internal (Keymap map, InfoCommand *cmd); void -dump_map_to_message_buffer (prefix, map) - char *prefix; - Keymap map; +dump_map_to_message_buffer (char *prefix, Keymap map) { register int i; unsigned prefix_len = strlen (prefix); @@ -226,13 +224,16 @@ dump_map_to_message_buffer (prefix, map) if (last - 1 != i) { - printf_to_message_buffer ("%s .. ", pretty_keyseq (new_prefix)); + printf_to_message_buffer ("%s .. ", pretty_keyseq (new_prefix), + NULL, NULL); new_prefix[prefix_len] = last - 1; - printf_to_message_buffer ("%s\t", pretty_keyseq (new_prefix)); + printf_to_message_buffer ("%s\t", pretty_keyseq (new_prefix), + NULL, NULL); i = last - 1; } else - printf_to_message_buffer ("%s\t", pretty_keyseq (new_prefix)); + printf_to_message_buffer ("%s\t", pretty_keyseq (new_prefix), + NULL, NULL); #if defined (NAMED_FUNCTIONS) /* Print the name of the function, and some padding before the @@ -241,22 +242,23 @@ dump_map_to_message_buffer (prefix, map) int length_so_far; int desired_doc_start = 40; /* Must be multiple of 8. */ - printf_to_message_buffer ("(%s)", name); + printf_to_message_buffer ("(%s)", name, NULL, NULL); length_so_far = message_buffer_length_this_line (); - if ((desired_doc_start + strlen (doc)) >= the_screen->width) - printf_to_message_buffer ("\n "); + if ((desired_doc_start + strlen (doc)) + >= (unsigned int) the_screen->width) + printf_to_message_buffer ("\n ", NULL, NULL, NULL); else { while (length_so_far < desired_doc_start) { - printf_to_message_buffer ("\t"); + printf_to_message_buffer ("\t", NULL, NULL, NULL); length_so_far += character_width ('\t', length_so_far); } } } #endif /* NAMED_FUNCTIONS */ - printf_to_message_buffer ("%s\n", doc); + printf_to_message_buffer ("%s\n", doc, NULL, NULL); } } free (new_prefix); @@ -269,8 +271,7 @@ dump_map_to_message_buffer (prefix, map) make q do the right thing in both cases. */ static void -create_internal_info_help_node (help_is_only_window_p) - int help_is_only_window_p; +create_internal_info_help_node (int help_is_only_window_p) { register int i; NODE *node; @@ -291,8 +292,9 @@ create_internal_info_help_node (help_is_only_window_p) for (i = 0; info_internal_help_text[i]; i++) { #ifdef INFOKEY - printf_to_message_buffer (replace_in_documentation ( - _(info_internal_help_text[i]), help_is_only_window_p)); + printf_to_message_buffer (replace_in_documentation + ((char *) _(info_internal_help_text[i]), help_is_only_window_p), + NULL, NULL, NULL); #else /* Don't translate blank lines, gettext outputs the po file header in that case. We want a blank line. */ @@ -306,18 +308,21 @@ create_internal_info_help_node (help_is_only_window_p) if (STREQ (key, "CTRL-x 0") && help_is_only_window_p) key = "l"; - printf_to_message_buffer (msg, key); + printf_to_message_buffer (msg, key, NULL, NULL); #endif /* !INFOKEY */ } - printf_to_message_buffer ("---------------------\n\n"); - printf_to_message_buffer (_("The current search path is:\n")); - printf_to_message_buffer (" %s\n", infopath); - printf_to_message_buffer ("---------------------\n\n"); - printf_to_message_buffer (_("Commands available in Info windows:\n\n")); + printf_to_message_buffer ("---------------------\n\n", NULL, NULL, NULL); + printf_to_message_buffer ((char *) _("The current search path is:\n"), + NULL, NULL, NULL); + printf_to_message_buffer (" %s\n", infopath, NULL, NULL); + printf_to_message_buffer ("---------------------\n\n", NULL, NULL, NULL); + printf_to_message_buffer ((char *) _("Commands available in Info windows:\n\n"), + NULL, NULL, NULL); dump_map_to_message_buffer ("", info_keymap); - printf_to_message_buffer ("---------------------\n\n"); - printf_to_message_buffer (_("Commands available in the echo area:\n\n")); + printf_to_message_buffer ("---------------------\n\n", NULL, NULL, NULL); + printf_to_message_buffer ((char *) _("Commands available in the echo area:\n\n"), + NULL, NULL, NULL); dump_map_to_message_buffer ("", echo_area_keymap); #if defined (NAMED_FUNCTIONS) @@ -329,19 +334,22 @@ create_internal_info_help_node (help_is_only_window_p) { InfoCommand *cmd = DocInfoCmd(&function_doc_array[i]); - if (InfoFunction(cmd) != info_do_lowercase_version + if (InfoFunction(cmd) != (VFunction *) info_do_lowercase_version && !where_is_internal (info_keymap, cmd) && !where_is_internal (echo_area_keymap, cmd)) { if (!printed_one_mx) { - printf_to_message_buffer ("---------------------\n\n"); + printf_to_message_buffer ("---------------------\n\n", + NULL, NULL, NULL); if (exec_keys && exec_keys[0]) printf_to_message_buffer - (_("The following commands can only be invoked via %s:\n\n"), exec_keys); + ((char *) _("The following commands can only be invoked via %s:\n\n"), + exec_keys, NULL, NULL); else printf_to_message_buffer - (_("The following commands cannot be invoked at all:\n\n")); + ((char *) _("The following commands cannot be invoked at all:\n\n"), + NULL, NULL, NULL); printed_one_mx = 1; } @@ -350,22 +358,22 @@ create_internal_info_help_node (help_is_only_window_p) exec_keys, function_doc_array[i].func_name, replace_in_documentation (strlen (function_doc_array[i].doc) - ? _(function_doc_array[i].doc) - : "") + ? (char *) _(function_doc_array[i].doc) : "", 0) ); } } if (printed_one_mx) - printf_to_message_buffer ("\n"); + printf_to_message_buffer ("\n", NULL, NULL, NULL); maybe_free (exec_keys); #endif /* NAMED_FUNCTIONS */ printf_to_message_buffer ("%s", replace_in_documentation - (_("--- Use `\\[history-node]' or `\\[kill-node]' to exit ---\n"))); + ((char *) _("--- Use `\\[history-node]' or `\\[kill-node]' to exit ---\n"), 0), + NULL, NULL); node = message_buffer_to_node (); internal_info_help_node_contents = node->contents; } @@ -404,7 +412,7 @@ create_internal_info_help_node (help_is_only_window_p) #define HELP_SPLIT_SIZE 24 static WINDOW * -info_find_or_create_help_window () +info_find_or_create_help_window (void) { int help_is_only_window_p; WINDOW *eligible = NULL; @@ -438,9 +446,8 @@ info_find_or_create_help_window () argument is false if help will be the only window (so l must be used to quit help), true if help will be one of several visible windows (so CTRL-x 0 must be used to quit help). */ - help_is_only_window_p - = ((help_window && !windows->next) - || !help_window && eligible->height < HELP_SPLIT_SIZE); + help_is_only_window_p = ((help_window && !windows->next) + || (!help_window && eligible->height < HELP_SPLIT_SIZE)); create_internal_info_help_node (help_is_only_window_p); /* Either use the existing window to display the help node, or create @@ -487,7 +494,7 @@ DECLARE_INFO_COMMAND (info_get_help_window, _("Display help message")) } else { - info_error (msg_cant_make_help); + info_error ((char *) msg_cant_make_help, NULL, NULL); } } @@ -529,9 +536,9 @@ DECLARE_INFO_COMMAND (info_get_info_help_node, _("Visit Info node `(info)Help'") if (!node) { 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", nodename); + info_error ((char *) msg_cant_file_node, "Info", nodename); } else { @@ -559,8 +566,7 @@ DECLARE_INFO_COMMAND (info_get_info_help_node, _("Visit Info node `(info)Help'") /* Return the documentation associated with the Info command FUNCTION. */ char * -function_documentation (cmd) - InfoCommand *cmd; +function_documentation (InfoCommand *cmd) { char *doc; @@ -580,15 +586,14 @@ function_documentation (cmd) #endif /* !INFOKEY */ - return replace_in_documentation ((strlen (doc) == 0) ? doc : _(doc)); + return replace_in_documentation ((strlen (doc) == 0) ? doc : (char *) _(doc), 0); } #if defined (NAMED_FUNCTIONS) /* Return the user-visible name of the function associated with the Info command FUNCTION. */ char * -function_name (cmd) - InfoCommand *cmd; +function_name (InfoCommand *cmd) { #if defined (INFOKEY) @@ -609,8 +614,7 @@ function_name (cmd) /* Return a pointer to the info command for function NAME. */ InfoCommand * -named_function (name) - char *name; +named_function (char *name) { register int i; @@ -624,9 +628,7 @@ named_function (name) /* Return the documentation associated with KEY in MAP. */ char * -key_documentation (key, map) - char key; - Keymap map; +key_documentation (char key, Keymap map) { InfoCommand *function = map[key].function; @@ -648,7 +650,8 @@ DECLARE_INFO_COMMAND (describe_key, _("Print documentation for KEY")) for (;;) { - message_in_echo_area (_("Describe key: %s"), pretty_keyseq (keys)); + message_in_echo_area ((char *) _("Describe key: %s"), + pretty_keyseq (keys), NULL); keystroke = info_get_input_char (); unmessage_in_echo_area (); @@ -674,7 +677,8 @@ DECLARE_INFO_COMMAND (describe_key, _("Print documentation for KEY")) if (map[keystroke].function == (InfoCommand *)NULL) { - message_in_echo_area (_("%s is undefined."), pretty_keyseq (keys)); + message_in_echo_area ((char *) _("%s is undefined."), + pretty_keyseq (keys), NULL); return; } else if (map[keystroke].type == ISKMAP) @@ -693,7 +697,8 @@ DECLARE_INFO_COMMAND (describe_key, _("Print documentation for KEY")) edit keys that emit an escape sequence: it's terribly confusing to see a message "Home (do-lowercase-version)" or some such when Home is unbound. */ - if (InfoFunction(map[keystroke].function) == info_do_lowercase_version) + if (InfoFunction(map[keystroke].function) + == (VFunction *) info_do_lowercase_version) { unsigned char lowerkey = Meta_p(keystroke) ? Meta (tolower (UnMeta (keystroke))) @@ -701,8 +706,8 @@ DECLARE_INFO_COMMAND (describe_key, _("Print documentation for KEY")) if (map[lowerkey].function == (InfoCommand *)NULL) { - message_in_echo_area (_("%s is undefined."), - pretty_keyseq (keys)); + message_in_echo_area ((char *) _("%s is undefined."), + pretty_keyseq (keys), NULL); return; } } @@ -725,7 +730,7 @@ DECLARE_INFO_COMMAND (describe_key, _("Print documentation for KEY")) sprintf (message, _("%s is defined to %s."), keyname, fundoc); #endif /* !NAMED_FUNCTIONS */ - window_message_in_echo_area ("%s", message); + window_message_in_echo_area ("%s", message, NULL); free (message); break; } @@ -734,8 +739,7 @@ DECLARE_INFO_COMMAND (describe_key, _("Print documentation for KEY")) /* Return the pretty printable name of a single character. */ char * -pretty_keyname (key) - unsigned char key; +pretty_keyname (unsigned char key) { static char rep_buffer[30]; char *rep; @@ -785,11 +789,10 @@ pretty_keyname (key) /* Return the pretty printable string which represents KEYSEQ. */ -static void pretty_keyseq_internal (); +static void pretty_keyseq_internal (char *keyseq, char *rep); char * -pretty_keyseq (keyseq) - char *keyseq; +pretty_keyseq (char *keyseq) { static char keyseq_rep[200]; @@ -800,8 +803,7 @@ pretty_keyseq (keyseq) } static void -pretty_keyseq_internal (keyseq, rep) - char *keyseq, *rep; +pretty_keyseq_internal (char *keyseq, char *rep) { if (term_kP && strncmp(keyseq, term_kP, strlen(term_kP)) == 0) { @@ -869,8 +871,7 @@ pretty_keyseq_internal (keyseq, rep) /* Return a pointer to the last character in s that is found in f. */ static char * -strrpbrk (s, f) - const char *s, *f; +strrpbrk (const char *s, const char *f) { register const char *e = s + strlen(s); register const char *t; @@ -886,9 +887,7 @@ strrpbrk (s, f) /* Replace the names of functions with the key that invokes them. */ char * -replace_in_documentation (string, help_is_only_window_p) - char *string; - int help_is_only_window_p; +replace_in_documentation (char *string, int help_is_only_window_p) { unsigned reslen = strlen (string); register int i, start, next; @@ -1058,9 +1057,7 @@ static int where_is_rep_index = 0; static int where_is_rep_size = 0; char * -where_is (map, cmd) - Keymap map; - InfoCommand *cmd; +where_is (Keymap map, InfoCommand *cmd) { char *rep; @@ -1093,9 +1090,7 @@ where_is (map, cmd) /* Return the printed rep of the keystrokes that invoke FUNCTION, as found in MAP, or NULL. */ static char * -where_is_internal (map, cmd) - Keymap map; - InfoCommand *cmd; +where_is_internal (Keymap map, InfoCommand *cmd) { #if defined(INFOKEY) @@ -1154,14 +1149,12 @@ where_is_internal (map, cmd) #endif /* INFOKEY */ } -extern char *read_function_name (); - DECLARE_INFO_COMMAND (info_where_is, _("Show what to type to execute a given command")) { char *command_name; - command_name = read_function_name (_("Where is command: "), window); + command_name = read_function_name ((char *) _("Where is command: "), window); if (!command_name) { @@ -1183,20 +1176,24 @@ DECLARE_INFO_COMMAND (info_where_is, if (!location || !location[0]) { - info_error (_("`%s' is not on any keys"), command_name); + info_error ((char *) _("`%s' is not on any keys"), + command_name, NULL); } else { if (strstr (location, function_name (command))) window_message_in_echo_area - (_("%s can only be invoked via %s."), command_name, location); + ((char *) _("%s can only be invoked via %s."), + command_name, location); else window_message_in_echo_area - (_("%s can be invoked via %s."), command_name, location); + ((char *) _("%s can be invoked via %s."), + command_name, location); } } else - info_error (_("There is no function named `%s'"), command_name); + info_error ((char *) _("There is no function named `%s'"), + command_name, NULL); } free (command_name); diff --git a/contrib/texinfo/info/infokey.c b/contrib/texinfo/info/infokey.c index 4cb6518..51f23aa 100644 --- a/contrib/texinfo/info/infokey.c +++ b/contrib/texinfo/info/infokey.c @@ -1,7 +1,7 @@ /* infokey.c -- compile ~/.infokey to ~/.info. - $Id: infokey.c,v 1.4 2003/05/13 16:26:02 karl Exp $ + $Id: infokey.c,v 1.9 2004/12/14 00:15:36 karl Exp $ - Copyright (C) 1999, 2001, 2002, 2003 Free Software Foundation, Inc. + Copyright (C) 1999, 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 @@ -69,9 +69,16 @@ struct sect }; /* Some "forward" declarations. */ -static char *mkpath (); -static int compile (), write_infokey_file (); -static void syntax_error (), error_message (), suggest_help (), short_help (); +static char *mkpath (const char *dir, const char *file); +static int compile (FILE *fp, const char *filename, struct sect *sections); +static int write_infokey_file (FILE *fp, struct sect *sections); +static void syntax_error (const char *filename, + unsigned int linenum, const char *fmt, + const void *a1, const void *a2, const void *a3, const void *a4); +static void error_message (int error_code, const char *fmt, + const void *a1, const void *a2, const void *a3, const void *a4); +static void suggest_help (void); +static void short_help (void); /* **************************************************************** */ @@ -81,9 +88,7 @@ static void syntax_error (), error_message (), suggest_help (), short_help (); /* **************************************************************** */ int -main (argc, argv) - int argc; - char **argv; +main (int argc, char **argv) { int getopt_long_index; /* Index returned by getopt_long (). */ @@ -92,9 +97,11 @@ main (argc, argv) setlocale (LC_ALL, ""); #endif +#ifdef ENABLE_NLS /* Set the text message domain. */ bindtextdomain (PACKAGE, LOCALEDIR); textdomain (PACKAGE); +#endif while (1) { @@ -160,7 +167,8 @@ For more information about these matters, see the files named COPYING.\n"), } else if (optind != argc) { - error_message (0, _("incorrect number of arguments")); + error_message (0, _("incorrect number of arguments"), + NULL, NULL, NULL, NULL); suggest_help (); xexit (1); } @@ -190,7 +198,8 @@ For more information about these matters, see the files named COPYING.\n"), inf = fopen (input_filename, "r"); if (!inf) { - error_message (errno, _("cannot open input file `%s'"), input_filename); + error_message (errno, _("cannot open input file `%s'"), + input_filename, NULL, NULL, NULL); xexit (1); } @@ -203,7 +212,8 @@ For more information about these matters, see the files named COPYING.\n"), outf = fopen (output_filename, FOPEN_WBIN); if (!outf) { - error_message (errno, _("cannot create output file `%s'"), output_filename); + error_message (errno, _("cannot create output file `%s'"), + output_filename, NULL, NULL, NULL); xexit (1); } @@ -213,12 +223,14 @@ For more information about these matters, see the files named COPYING.\n"), write_error = 0; if (!write_infokey_file (outf, sections)) { - error_message (errno, _("error writing to `%s'"), output_filename); + error_message (errno, _("error writing to `%s'"), + output_filename, NULL, NULL, NULL); write_error = 1; } if (fclose (outf) == EOF) { - error_message (errno, _("error closing output file `%s'"), output_filename); + error_message (errno, _("error closing output file `%s'"), + output_filename, NULL, NULL, NULL); write_error = 1; } if (write_error) @@ -236,9 +248,7 @@ For more information about these matters, see the files named COPYING.\n"), } static char * -mkpath (dir, file) - const char *dir; - const char *file; +mkpath (const char *dir, const char *file) { char *p; @@ -365,21 +375,19 @@ mkpath (dir, file) following the '=' is not ignored. */ -static int add_to_section (), lookup_action (); +static int add_to_section (struct sect *s, const char *str, unsigned int len); +static int lookup_action (const char *actname); /* Compile the input file into its various sections. Return true if no error was encountered. */ static int -compile (fp, filename, sections) - FILE *fp; - const char *filename; - struct sect sections[]; +compile (FILE *fp, const char *filename, struct sect *sections) { int error = 0; char rescan = 0; unsigned int lnum = 0; - int c; + int c = 0; /* This parser is a true state machine, with no sneaky fetching of input characters inside the main loop. In other words, all @@ -411,9 +419,9 @@ compile (fp, filename, sections) octal, special_key } - seqstate; /* used if state == get_keyseq */ + seqstate; /* used if state == get_keyseq */ char meta = 0; - char ocnt; /* used if state == get_keyseq && seqstate == octal */ + char ocnt = 0; /* used if state == get_keyseq && seqstate == octal */ /* Data is accumulated in the following variables. The code avoids overflowing these strings, and throws an error @@ -421,17 +429,17 @@ compile (fp, filename, sections) lengths are arbitrary (and should be large enough) and their lengths are not hard-coded anywhere else, so increasing them here will not break anything. */ - char oval; + char oval = 0; char comment[10]; - unsigned int clen; + unsigned int clen = 0; char seq[20]; - unsigned int slen; + unsigned int slen = 0; char act[80]; - unsigned int alen; + unsigned int alen = 0; char varn[80]; - unsigned int varlen; + unsigned int varlen = 0; char val[80]; - unsigned int vallen; + unsigned int vallen = 0; #define To_seq(c) \ do { \ @@ -439,7 +447,8 @@ compile (fp, filename, sections) seq[slen++] = meta ? Meta(c) : (c); \ else \ { \ - syntax_error(filename, lnum, _("key sequence too long")); \ + syntax_error(filename, lnum, _("key sequence too long"), \ + NULL, NULL, NULL, NULL); \ error = 1; \ } \ meta = 0; \ @@ -517,7 +526,8 @@ compile (fp, filename, sections) rescan = 1; if (slen == 0) { - syntax_error (filename, lnum, _("missing key sequence")); + syntax_error (filename, lnum, _("missing key sequence"), + NULL, NULL, NULL, NULL); error = 1; } } @@ -596,7 +606,9 @@ compile (fp, filename, sections) To_seq (oval); else { - syntax_error (filename, lnum, _("NUL character (\\000) not permitted")); + syntax_error (filename, lnum, + _("NUL character (\\000) not permitted"), + NULL, NULL, NULL, NULL); error = 1; } } @@ -625,7 +637,9 @@ compile (fp, filename, sections) To_seq (CONTROL (c)); else { - syntax_error (filename, lnum, _("NUL character (^%c) not permitted"), c); + syntax_error (filename, lnum, + (char *) _("NUL character (^%c) not permitted"), + (void *) (long) c, NULL, NULL, NULL); error = 1; } seqstate = normal; @@ -648,7 +662,8 @@ compile (fp, filename, sections) rescan = 1; if (alen == 0) { - syntax_error (filename, lnum, _("missing action name"), c); + syntax_error (filename, lnum, (char *) _("missing action name"), + (void *) (long) c, NULL, NULL, NULL); error = 1; } else @@ -663,13 +678,15 @@ compile (fp, filename, sections) && add_to_section (§ions[section], "", 1) && add_to_section (§ions[section], &av, 1))) { - syntax_error (filename, lnum, _("section too long")); + syntax_error (filename, lnum, _("section too long"), + NULL, NULL, NULL, NULL); error = 1; } } else { - syntax_error (filename, lnum, _("unknown action `%s'"), act); + syntax_error (filename, lnum, _("unknown action `%s'"), + act, NULL, NULL, NULL); error = 1; } } @@ -678,7 +695,8 @@ compile (fp, filename, sections) act[alen++] = c; else { - syntax_error (filename, lnum, _("action name too long")); + syntax_error (filename, lnum, _("action name too long"), + NULL, NULL, NULL, NULL); error = 1; } break; @@ -690,7 +708,9 @@ compile (fp, filename, sections) state = start_of_line; else if (!isspace (c)) { - syntax_error (filename, lnum, _("extra characters following action `%s'"), act); + syntax_error (filename, lnum, + _("extra characters following action `%s'"), + act, NULL, NULL, NULL); error = 1; } break; @@ -700,7 +720,8 @@ compile (fp, filename, sections) { if (varlen == 0) { - syntax_error (filename, lnum, _("missing variable name")); + syntax_error (filename, lnum, _("missing variable name"), + NULL, NULL, NULL, NULL); error = 1; } state = get_value; @@ -708,14 +729,17 @@ compile (fp, filename, sections) } else if (c == '\n' || isspace (c)) { - syntax_error (filename, lnum, _("missing `=' immediately after variable name")); + syntax_error (filename, lnum, + _("missing `=' immediately after variable name"), + NULL, NULL, NULL, NULL); error = 1; } else if (varlen < sizeof varn) varn[varlen++] = c; else { - syntax_error (filename, lnum, _("variable name too long")); + syntax_error (filename, lnum, _("variable name too long"), + NULL, NULL, NULL, NULL); error = 1; } break; @@ -729,7 +753,8 @@ compile (fp, filename, sections) && add_to_section (§ions[section], val, vallen) && add_to_section (§ions[section], "", 1))) { - syntax_error (filename, lnum, _("section too long")); + syntax_error (filename, lnum, _("section too long"), + NULL, NULL, NULL, NULL); error = 1; } } @@ -737,10 +762,16 @@ compile (fp, filename, sections) val[vallen++] = c; else { - syntax_error (filename, lnum, _("value too long")); + syntax_error (filename, lnum, _("value too long"), + NULL, NULL, NULL, NULL); error = 1; } break; + + case get_equals: + case got_equals: + case got_varname: + break; } } @@ -753,14 +784,11 @@ compile (fp, filename, sections) characters fit, or false if the section's size limit was exceeded. */ static int -add_to_section (s, str, len) - struct sect *s; - const char *str; - unsigned int len; +add_to_section (struct sect *s, const char *str, unsigned int len) { if (s->cur + len > sizeof s->data) return 0; - strncpy (s->data + s->cur, str, len); + strncpy ((char *) s->data + s->cur, str, len); s->cur += len; return 1; } @@ -769,8 +797,7 @@ add_to_section (s, str, len) auto-generated array in key.c. */ static int -lookup_action (actname) - const char *actname; +lookup_action (const char *actname) { int i; @@ -787,9 +814,7 @@ lookup_action (actname) in radix INFOKEY_RADIX. */ static int -putint (i, fp) - int i; - FILE *fp; +putint (int i, FILE *fp) { return fputc (i % INFOKEY_RADIX, fp) != EOF && fputc ((i / INFOKEY_RADIX) % INFOKEY_RADIX, fp) != EOF; @@ -799,10 +824,7 @@ putint (i, fp) empty, simply omit it. */ static int -putsect (s, code, fp) - struct sect *s; - int code; - FILE *fp; +putsect (struct sect *s, int code, FILE *fp) { if (s->cur == 0) return 1; @@ -814,9 +836,7 @@ putsect (s, code, fp) /* Write an entire infokey file, given an array containing its sections. */ static int -write_infokey_file (fp, sections) - FILE *fp; - struct sect sections[]; +write_infokey_file (FILE *fp, struct sect *sections) { /* Get rid of sections with no effect. */ if (sections[info].cur == 1 && sections[info].data[0] == 0) @@ -848,10 +868,8 @@ write_infokey_file (fp, sections) progname: "filename", line N: message */ static void -error_message (error_code, fmt, a1, a2, a3, a4) - int error_code; - const char *fmt; - const void *a1, *a2, *a3, *a4; +error_message (int error_code, const char *fmt, + const void *a1, const void *a2, const void *a3, const void *a4) { fprintf (stderr, "%s: ", program_name); fprintf (stderr, fmt, a1, a2, a3, a4); @@ -864,11 +882,9 @@ error_message (error_code, fmt, a1, a2, a3, a4) progname: message */ static void -syntax_error (filename, linenum, fmt, a1, a2, a3, a4) - const char *filename; - unsigned int linenum; - const char *fmt; - const void *a1, *a2, *a3, *a4; +syntax_error (const char *filename, + unsigned int linenum, const char *fmt, + const void *a1, const void *a2, const void *a3, const void *a4) { fprintf (stderr, "%s: ", program_name); fprintf (stderr, _("\"%s\", line %u: "), filename, linenum); @@ -878,14 +894,14 @@ syntax_error (filename, linenum, fmt, a1, a2, a3, a4) /* Produce a gentle rtfm. */ static void -suggest_help () +suggest_help (void) { fprintf (stderr, _("Try --help for more information.\n")); } /* Produce a scaled down description of the available options to Info. */ static void -short_help () +short_help (void) { printf (_("\ Usage: %s [OPTION]... [INPUT-FILE]\n\ diff --git a/contrib/texinfo/info/infokey.h b/contrib/texinfo/info/infokey.h index 9b362fa..d51211d 100644 --- a/contrib/texinfo/info/infokey.h +++ b/contrib/texinfo/info/infokey.h @@ -1,5 +1,5 @@ /* infokey.h -- Custom keystroke definition support. - $Id: infokey.h,v 1.1 2002/08/25 23:38:38 karl Exp $ + $Id: infokey.h,v 1.2 2004/04/11 17:56:45 karl Exp $ Copyright (C) 1999, 2002 Free Software Foundation, Inc. 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/infomap.h b/contrib/texinfo/info/infomap.h index fe7fa77..31e4d82 100644 --- a/contrib/texinfo/info/infomap.h +++ b/contrib/texinfo/info/infomap.h @@ -1,7 +1,7 @@ /* infomap.h -- description of a keymap in Info and related functions. - $Id: infomap.h,v 1.1 2002/08/25 23:38:38 karl Exp $ + $Id: infomap.h,v 1.3 2004/04/11 17:56:46 karl Exp $ - Copyright (C) 1993, 2001 Free Software Foundation, Inc. + Copyright (C) 1993, 2001, 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 @@ -67,15 +67,16 @@ extern Keymap echo_area_keymap; /* Return a new keymap which has all the uppercase letters mapped to run the function info_do_lowercase_version (). */ -extern Keymap keymap_make_keymap (); +extern Keymap keymap_make_keymap (void); /* Return a new keymap which is a copy of MAP. */ -extern Keymap keymap_copy_keymap (); +extern Keymap keymap_copy_keymap (Keymap map, Keymap rootmap, + Keymap newroot); /* Free MAP and it's descendents. */ -extern void keymap_discard_keymap (); +extern void keymap_discard_keymap (Keymap map, Keymap rootmap); /* Initialize the info keymaps. */ -extern void initialize_info_keymaps (); +extern void initialize_info_keymaps (void); #endif /* not INFOMAP_H */ diff --git a/contrib/texinfo/info/key.c b/contrib/texinfo/info/key.c index 06be6fa..8fa2717 100644 --- a/contrib/texinfo/info/key.c +++ b/contrib/texinfo/info/key.c @@ -1,7 +1,7 @@ /* key.c -- Generated array containing function names. 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: @@ -142,5 +142,5 @@ FUNCTION_KEY function_key_array[] = { /* Commands found in "./variables.c". */ { "describe-variable", A_describe_variable }, { "set-variable", A_set_variable }, - (char *)0 + { (char *)NULL, 0 } }; diff --git a/contrib/texinfo/info/m-x.c b/contrib/texinfo/info/m-x.c index 383261d..52365d1 100644 --- a/contrib/texinfo/info/m-x.c +++ b/contrib/texinfo/info/m-x.c @@ -1,7 +1,8 @@ /* m-x.c -- Meta-x minibuffer reader. - $Id: m-x.c,v 1.1 2002/08/25 23:38:38 karl Exp $ + $Id: m-x.c,v 1.3 2004/04/11 17:56:46 karl Exp $ - Copyright (C) 1993, 1997, 1998, 2001, 2002 Free Software Foundation, Inc. + Copyright (C) 1993, 1997, 1998, 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 @@ -17,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 "funs.h" @@ -32,9 +33,7 @@ name. A return value of NULL indicates that no function name could be read. */ char * -read_function_name (prompt, window) - char *prompt; - WINDOW *window; +read_function_name (char *prompt, WINDOW *window) { register int i; char *line; @@ -71,7 +70,7 @@ DECLARE_INFO_COMMAND (describe_command, { char *line; - line = read_function_name (_("Describe command: "), window); + line = read_function_name ((char *) _("Describe command: "), window); if (!line) { @@ -138,7 +137,8 @@ DECLARE_INFO_COMMAND (info_execute_command, (strncmp (line, "echo-area-", 10) == 0)) { free (line); - info_error (_("Cannot execute an `echo-area' command here.")); + info_error ((char *) _("Cannot execute an `echo-area' command here."), + NULL, NULL); return; } @@ -148,7 +148,10 @@ DECLARE_INFO_COMMAND (info_execute_command, if (!command) return; - (*InfoFunction(command)) (active_window, count, 0); + if (InfoFunction(command)) + (*InfoFunction(command)) (active_window, count, 0); + else + info_error ((char *) _("Undefined command: %s"), line, NULL); } } diff --git a/contrib/texinfo/info/man.c b/contrib/texinfo/info/man.c index 1590b78..33fd6d4 100644 --- a/contrib/texinfo/info/man.c +++ b/contrib/texinfo/info/man.c @@ -1,7 +1,7 @@ /* man.c: How to read and format man files. - $Id: man.c,v 1.2 2003/05/13 16:37:54 karl Exp $ + $Id: man.c,v 1.4 2004/04/11 17:56:46 karl Exp $ - Copyright (C) 1995, 1997, 1998, 1999, 2000, 2002, 2003 Free Software + Copyright (C) 1995, 1997, 1998, 1999, 2000, 2002, 2003, 2004 Free Software Foundation, Inc. This program is free software; you can redistribute it and/or modify @@ -53,22 +53,20 @@ static char const * const exec_extensions[] = { static char const * const exec_extensions[] = { "", NULL }; #endif -static char *read_from_fd (); -static void clean_manpage (); -static NODE *manpage_node_of_file_buffer (); -static char *get_manpage_contents (); +static char *read_from_fd (int fd); +static void clean_manpage (char *manpage); +static NODE *manpage_node_of_file_buffer (FILE_BUFFER *file_buffer, + char *pagename); +static char *get_manpage_contents (char *pagename); NODE * -make_manpage_node (pagename) - char *pagename; +make_manpage_node (char *pagename) { return (info_get_node (MANPAGE_FILE_BUFFER_NAME, pagename)); } NODE * -get_manpage_node (file_buffer, pagename) - FILE_BUFFER *file_buffer; - char *pagename; +get_manpage_node (FILE_BUFFER *file_buffer, char *pagename) { NODE *node; @@ -121,23 +119,25 @@ get_manpage_node (file_buffer, pagename) for (in = 0; in < info_win->nodes_index; in++) { - NODE *node = info_win->nodes[in]; + NODE *tmp_node = info_win->nodes[in]; /* It really only suffices to see that node->filename is "*manpages*". But after several hours of debugging this, would you blame me for being a bit paranoid? */ - if (node && node->filename && node->contents && - strcmp (node->filename, - MANPAGE_FILE_BUFFER_NAME) == 0 && - node->contents >= old_contents && - node->contents + node->nodelen <= old_contents_end) + if (tmp_node && tmp_node->filename + && tmp_node->contents + && strcmp (tmp_node->filename, + MANPAGE_FILE_BUFFER_NAME) == 0 + && tmp_node->contents >= old_contents + && tmp_node->contents + tmp_node->nodelen + <= old_contents_end) { info_win->nodes[in] = manpage_node_of_file_buffer (file_buffer, - node->nodename); - free (node->nodename); - free (node); + tmp_node->nodename); + free (tmp_node->nodename); + free (tmp_node); } } } @@ -151,7 +151,7 @@ get_manpage_node (file_buffer, pagename) } FILE_BUFFER * -create_manpage_file_buffer () +create_manpage_file_buffer (void) { FILE_BUFFER *file_buffer = make_file_buffer (); file_buffer->filename = xstrdup (MANPAGE_FILE_BUFFER_NAME); @@ -168,8 +168,7 @@ create_manpage_file_buffer () one that is an executable file, return it as a new string. Otherwise, return a NULL pointer. */ static char * -executable_file_in_path (filename, path) - char *filename, *path; +executable_file_in_path (char *filename, char *path) { struct stat finfo; char *temp_dirname; @@ -223,7 +222,7 @@ executable_file_in_path (filename, path) /* Return the full pathname of the system man page formatter. */ static char * -find_man_formatter () +find_man_formatter (void) { return (executable_file_in_path ("man", (char *)getenv ("PATH"))); } @@ -232,8 +231,7 @@ static char *manpage_pagename = (char *)NULL; static char *manpage_section = (char *)NULL; static void -get_page_and_section (pagename) - char *pagename; +get_page_and_section (char *pagename) { register int i; @@ -268,21 +266,19 @@ get_page_and_section (pagename) #if PIPE_USE_FORK static void -reap_children (sig) - int sig; +reap_children (int sig) { wait (NULL); } #endif static char * -get_manpage_contents (pagename) - char *pagename; +get_manpage_contents (char *pagename) { static char *formatter_args[4] = { (char *)NULL }; int pipes[2]; pid_t child; - RETSIGTYPE (*sigsave) (); + RETSIGTYPE (*sigsave) (int signum); char *formatted_page = NULL; int arg_index = 1; @@ -376,8 +372,7 @@ get_manpage_contents (pagename) } static void -clean_manpage (manpage) - char *manpage; +clean_manpage (char *manpage) { register int i, j; int newline_count = 0; @@ -434,9 +429,7 @@ clean_manpage (manpage) } static NODE * -manpage_node_of_file_buffer (file_buffer, pagename) - FILE_BUFFER *file_buffer; - char *pagename; +manpage_node_of_file_buffer (FILE_BUFFER *file_buffer, char *pagename) { NODE *node = (NODE *)NULL; TAG *tag = (TAG *)NULL; @@ -470,8 +463,7 @@ manpage_node_of_file_buffer (file_buffer, pagename) } static char * -read_from_fd (fd) - int fd; +read_from_fd (int fd) { struct timeval timeout; char *buffer = (char *)NULL; @@ -551,8 +543,7 @@ static char *reference_section_starters[] = static SEARCH_BINDING frs_binding; static SEARCH_BINDING * -find_reference_section (node) - NODE *node; +find_reference_section (NODE *node) { register int i; long position = -1; @@ -591,8 +582,7 @@ find_reference_section (node) } REFERENCE ** -xrefs_of_manpage (node) - NODE *node; +xrefs_of_manpage (NODE *node) { SEARCH_BINDING *reference_section; REFERENCE **refs = (REFERENCE **)NULL; @@ -660,10 +650,7 @@ xrefs_of_manpage (node) } long -locate_manpage_xref (node, start, dir) - NODE *node; - long start; - int dir; +locate_manpage_xref (NODE *node, long int start, int dir) { REFERENCE **refs; long position = -1; @@ -710,9 +697,7 @@ locate_manpage_xref (node, start, dir) a START and END value of 0 -- strlen (window-line-containing-point). The BUFFER is a pointer to the start of that line. */ REFERENCE ** -manpage_xrefs_in_binding (node, binding) - NODE *node; - SEARCH_BINDING *binding; +manpage_xrefs_in_binding (NODE *node, SEARCH_BINDING *binding) { register int i; REFERENCE **all_refs = xrefs_of_manpage (node); diff --git a/contrib/texinfo/info/man.h b/contrib/texinfo/info/man.h index 461936f..73ef1b6 100644 --- a/contrib/texinfo/info/man.h +++ b/contrib/texinfo/info/man.h @@ -1,10 +1,10 @@ /* man.h: Defines and external function declarations for man.c. - $Id: man.h,v 1.1 2002/08/25 23:38:38 karl Exp $ + $Id: man.h,v 1.3 2004/04/11 17:56:46 karl Exp $ This file is part of GNU Info, a program for reading online documentation stored in Info format. - Copyright (C) 1993, 97 Free Software Foundation, Inc. + Copyright (C) 1993, 1997, 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 @@ -27,11 +27,13 @@ #define MANPAGE_FILE_BUFFER_NAME "*manpages*" -extern NODE *make_manpage_node (/* char *pagename */); -extern NODE *get_manpage_node (/* FILE_BUFFER *file_buffer, char *pagename */); -extern FILE_BUFFER *create_manpage_file_buffer (/* void */); -extern long locate_manpage_xref (/* NODE *node, long start, int dir */); -extern REFERENCE **xrefs_of_manpage (/* NODE *node */); -extern REFERENCE **manpage_xrefs_in_binding (/* NODE *node, SEARCH_BINDING *binding */); +extern NODE *make_manpage_node (char *pagename); +extern NODE *get_manpage_node (FILE_BUFFER *file_buffer, + char *pagename); +extern FILE_BUFFER *create_manpage_file_buffer (void); +extern long locate_manpage_xref (NODE *node, long int start, int dir); +extern REFERENCE **xrefs_of_manpage (NODE *node); +extern REFERENCE **manpage_xrefs_in_binding (NODE *node, + SEARCH_BINDING *binding); #endif /* INFO_MAN_H */ 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/nodes.c b/contrib/texinfo/info/nodes.c index a0b58cf..a3381a8 100644 --- a/contrib/texinfo/info/nodes.c +++ b/contrib/texinfo/info/nodes.c @@ -1,7 +1,7 @@ /* nodes.c -- how to get an Info file and node. - $Id: nodes.c,v 1.2 2003/05/13 16:37:54 karl Exp $ + $Id: nodes.c,v 1.4 2004/04/11 17:56:46 karl Exp $ - Copyright (C) 1993, 1998, 1999, 2000, 2002, 2003 Free Software + Copyright (C) 1993, 1998, 1999, 2000, 2002, 2003, 2004 Free Software Foundation, Inc. This program is free software; you can redistribute it and/or modify @@ -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" @@ -31,16 +31,23 @@ # include "man.h" #endif /* HANDLE_MAN_PAGES */ -static void forget_info_file (), remember_info_file (); -static void free_file_buffer_tags (), free_info_tag (); -static void get_nodes_of_tags_table (), get_nodes_of_info_file (); -static void get_tags_of_indirect_tags_table (); -static void info_reload_file_buffer_contents (); -static char *adjust_nodestart (); -static FILE_BUFFER *info_load_file_internal (), *info_find_file_internal (); -static NODE *info_node_of_file_buffer_tags (); - -static long get_node_length (); +static void forget_info_file (char *filename); +static void remember_info_file (FILE_BUFFER *file_buffer); +static void free_file_buffer_tags (FILE_BUFFER *file_buffer); +static void free_info_tag (TAG *tag); +static void get_nodes_of_tags_table (FILE_BUFFER *file_buffer, + SEARCH_BINDING *buffer_binding); +static void get_nodes_of_info_file (FILE_BUFFER *file_buffer); +static void get_tags_of_indirect_tags_table (FILE_BUFFER *file_buffer, + SEARCH_BINDING *indirect_binding, SEARCH_BINDING *tags_binding); +static void info_reload_file_buffer_contents (FILE_BUFFER *fb); +static char *adjust_nodestart (NODE *node, int min, int max); +static FILE_BUFFER *info_load_file_internal (char *filename, int get_tags); +static FILE_BUFFER *info_find_file_internal (char *filename, int get_tags); +static NODE *info_node_of_file_buffer_tags (FILE_BUFFER *file_buffer, + char *nodename); + +static long get_node_length (SEARCH_BINDING *binding); /* Magic number that RMS used to decide how much a tags table pointer could be off by. I feel that it should be much smaller, like 4. */ @@ -65,15 +72,14 @@ int info_loaded_files_slots = 0; /* Public functions for node manipulation. */ /* Used to build `dir' menu from `localdir' files found in INFOPATH. */ -extern void maybe_build_dir_node (); +extern void maybe_build_dir_node (char *dirname); /* Return a pointer to a NODE structure for the Info node (FILENAME)NODENAME. If FILENAME is NULL, `dir' is used. IF NODENAME is NULL, `Top' is used. If the node cannot be found, return NULL. */ NODE * -info_get_node (filename, nodename) - char *filename, *nodename; +info_get_node (char *filename, char *nodename) { NODE *node; FILE_BUFFER *file_buffer = NULL; @@ -128,9 +134,7 @@ info_get_node (filename, nodename) nodename of "Top" is used. If the node cannot be found, return a NULL pointer. */ NODE * -info_get_node_of_file_buffer (nodename, file_buffer) - char *nodename; - FILE_BUFFER *file_buffer; +info_get_node_of_file_buffer (char *nodename, FILE_BUFFER *file_buffer) { NODE *node = NULL; @@ -188,8 +192,7 @@ info_get_node_of_file_buffer (nodename, file_buffer) and add it to the list of loaded files. If the file cannot be found, return a NULL FILE_BUFFER *. */ FILE_BUFFER * -info_find_file (filename) - char *filename; +info_find_file (char *filename) { return info_find_file_internal (filename, INFO_GET_TAGS); } @@ -197,8 +200,7 @@ info_find_file (filename) /* Load the info file FILENAME, remembering information about it in a file buffer. */ FILE_BUFFER * -info_load_file (filename) - char *filename; +info_load_file (char *filename) { return info_load_file_internal (filename, INFO_GET_TAGS); } @@ -212,9 +214,7 @@ info_load_file (filename) function is called by info_get_node () when we already have a valid tags table describing the nodes, it is unnecessary. */ static FILE_BUFFER * -info_find_file_internal (filename, get_tags) - char *filename; - int get_tags; +info_find_file_internal (char *filename, int get_tags) { int i; FILE_BUFFER *file_buffer; @@ -306,9 +306,7 @@ info_find_file_internal (filename, get_tags) default behaviour when info_load_file () is called, but it is not necessary when loading a subfile for which we already have tags. */ static FILE_BUFFER * -info_load_file_internal (filename, get_tags) - char *filename; - int get_tags; +info_load_file_internal (char *filename, int get_tags) { char *fullpath, *contents; long filesize; @@ -332,23 +330,23 @@ info_load_file_internal (filename, get_tags) if (retcode < 0) { char *lowered_name; - char *basename; + char *tmp_basename; lowered_name = xstrdup (filename); - basename = filename_non_directory (lowered_name); + tmp_basename = filename_non_directory (lowered_name); - while (*basename) + while (*tmp_basename) { - if (isupper (*basename)) - *basename = tolower (*basename); + if (isupper (*tmp_basename)) + *tmp_basename = tolower (*tmp_basename); - basename++; + tmp_basename++; } fullpath = info_find_fullpath (lowered_name); - free (lowered_name); retcode = stat (fullpath, &finfo); + free (lowered_name); } /* If the file wasn't found, give up, returning a NULL pointer. */ @@ -385,8 +383,7 @@ info_load_file_internal (filename, get_tags) /* Grovel FILE_BUFFER->contents finding tags and nodes, and filling in the various slots. This can also be used to rebuild a tag or node table. */ void -build_tags_and_nodes (file_buffer) - FILE_BUFFER *file_buffer; +build_tags_and_nodes (FILE_BUFFER *file_buffer) { SEARCH_BINDING binding; long position; @@ -496,8 +493,7 @@ build_tags_and_nodes (file_buffer) FILE_BUFFER->tags, and the number of allocated slots in FILE_BUFFER->tags_slots. */ static void -get_nodes_of_info_file (file_buffer) - FILE_BUFFER *file_buffer; +get_nodes_of_info_file (FILE_BUFFER *file_buffer) { long nodestart; int tags_index = 0; @@ -573,8 +569,7 @@ get_nodes_of_info_file (file_buffer) /* Return the length of the node which starts at BINDING. */ static long -get_node_length (binding) - SEARCH_BINDING *binding; +get_node_length (SEARCH_BINDING *binding) { int i; char *body; @@ -591,33 +586,33 @@ get_node_length (binding) /* Build and save the array of nodes in FILE_BUFFER by searching through the contents of BUFFER_BINDING for a tags table, and groveling the contents. */ static void -get_nodes_of_tags_table (file_buffer, buffer_binding) - FILE_BUFFER *file_buffer; - SEARCH_BINDING *buffer_binding; +get_nodes_of_tags_table (FILE_BUFFER *file_buffer, + SEARCH_BINDING *buffer_binding) { int name_offset; - SEARCH_BINDING *search; + SEARCH_BINDING *tmp_search; long position; int tags_index = 0; - search = copy_binding (buffer_binding); + tmp_search = copy_binding (buffer_binding); /* Find the start of the tags table. */ - position = find_tags_table (search); + position = find_tags_table (tmp_search); /* If none, we're all done. */ if (position == -1) return; /* Move to one character before the start of the actual table. */ - search->start = position; - search->start += skip_node_separator (search->buffer + search->start); - search->start += strlen (TAGS_TABLE_BEG_LABEL); - search->start--; + tmp_search->start = position; + tmp_search->start += skip_node_separator + (tmp_search->buffer + tmp_search->start); + tmp_search->start += strlen (TAGS_TABLE_BEG_LABEL); + tmp_search->start--; /* The tag table consists of lines containing node names and positions. Do each line until we find one that doesn't contain a node name. */ - while ((position = search_forward ("\n", search)) != -1) + while ((position = search_forward ("\n", tmp_search)) != -1) { TAG *entry; char *nodedef; @@ -625,22 +620,22 @@ get_nodes_of_tags_table (file_buffer, buffer_binding) int anchor = 0; /* Prepare to skip this line. */ - search->start = position; - search->start++; + tmp_search->start = position; + tmp_search->start++; /* Skip past informative "(Indirect)" tags table line. */ - if (!tags_index && looking_at (TAGS_TABLE_IS_INDIRECT_LABEL, search)) + if (!tags_index && looking_at (TAGS_TABLE_IS_INDIRECT_LABEL, tmp_search)) continue; /* Find the label preceding the node name. */ name_offset = - string_in_line (INFO_NODE_LABEL, search->buffer + search->start); + string_in_line (INFO_NODE_LABEL, tmp_search->buffer + tmp_search->start); /* If no node label, maybe it's an anchor. */ if (name_offset == -1) { name_offset = string_in_line (INFO_REF_LABEL, - search->buffer + search->start); + tmp_search->buffer + tmp_search->start); if (name_offset != -1) anchor = 1; } @@ -653,8 +648,8 @@ get_nodes_of_tags_table (file_buffer, buffer_binding) entry = xmalloc (sizeof (TAG)); /* Find the beginning of the node definition. */ - search->start += name_offset; - nodedef = search->buffer + search->start; + tmp_search->start += name_offset; + nodedef = tmp_search->buffer + tmp_search->start; nodedef += skip_whitespace (nodedef); /* Move past the node's name in this tag to the TAGSEP character. */ @@ -682,7 +677,7 @@ get_nodes_of_tags_table (file_buffer, buffer_binding) add_pointer_to_array (entry, tags_index, file_buffer->tags, file_buffer->tags_slots, 100, TAG *); } - free (search); + free (tmp_search); } /* A structure used only in `get_tags_of_indirect_tags_table' to hold onto @@ -696,9 +691,8 @@ typedef struct { subfiles of every node which appears in TAGS_BINDING. The 2nd argument is a binding surrounding the indirect files list. */ static void -get_tags_of_indirect_tags_table (file_buffer, indirect_binding, tags_binding) - FILE_BUFFER *file_buffer; - SEARCH_BINDING *indirect_binding, *tags_binding; +get_tags_of_indirect_tags_table (FILE_BUFFER *file_buffer, + SEARCH_BINDING *indirect_binding, SEARCH_BINDING *tags_binding) { int i; SUBFILE **subfiles = NULL; @@ -863,9 +857,7 @@ get_tags_of_indirect_tags_table (file_buffer, indirect_binding, tags_binding) /* Return the node that contains TAG in FILE_BUFFER, else (pathologically) NULL. Called from info_node_of_file_buffer_tags. */ static NODE * -find_node_of_anchor (file_buffer, tag) - FILE_BUFFER *file_buffer; - TAG *tag; +find_node_of_anchor (FILE_BUFFER *file_buffer, TAG *tag) { int anchor_pos, node_pos; TAG *node_tag; @@ -920,7 +912,7 @@ find_node_of_anchor (file_buffer, tag) /* Otherwise an anchor at the end of a node ends up displaying at the end of the last line of the node (way over on the right of the screen), which looks wrong. */ - if (node->display_pos >= node->nodelen) + if (node->display_pos >= (unsigned long) node->nodelen) node->display_pos = node->nodelen - 1; /* Don't search in the node for the xref text, it's not there. */ @@ -934,9 +926,7 @@ find_node_of_anchor (file_buffer, tag) /* Return the node from FILE_BUFFER which matches NODENAME by searching the tags table in FILE_BUFFER, or NULL. */ static NODE * -info_node_of_file_buffer_tags (file_buffer, nodename) - FILE_BUFFER *file_buffer; - char *nodename; +info_node_of_file_buffer_tags (FILE_BUFFER *file_buffer, char *nodename) { TAG *tag; int i; @@ -1060,7 +1050,7 @@ info_node_of_file_buffer_tags (file_buffer, nodename) /* Create a new, empty file buffer. */ FILE_BUFFER * -make_file_buffer () +make_file_buffer (void) { FILE_BUFFER *file_buffer = xmalloc (sizeof (FILE_BUFFER)); @@ -1076,8 +1066,7 @@ make_file_buffer () /* Add FILE_BUFFER to our list of already loaded info files. */ static void -remember_info_file (file_buffer) - FILE_BUFFER *file_buffer; +remember_info_file (FILE_BUFFER *file_buffer) { int i; @@ -1090,8 +1079,7 @@ remember_info_file (file_buffer) /* Forget the contents, tags table, nodes list, and names of FILENAME. */ static void -forget_info_file (filename) - char *filename; +forget_info_file (char *filename) { int i; FILE_BUFFER *file_buffer; @@ -1127,8 +1115,7 @@ forget_info_file (filename) /* Free the tags (if any) associated with FILE_BUFFER. */ static void -free_file_buffer_tags (file_buffer) - FILE_BUFFER *file_buffer; +free_file_buffer_tags (FILE_BUFFER *file_buffer) { int i; @@ -1156,8 +1143,7 @@ free_file_buffer_tags (file_buffer) /* Free the data associated with TAG, as well as TAG itself. */ static void -free_info_tag (tag) - TAG *tag; +free_info_tag (TAG *tag) { free (tag->nodename); @@ -1174,8 +1160,7 @@ free_info_tag (tag) the file was already loaded at least once successfully, so the tags and/or nodes members are still correctly filled. */ static void -info_reload_file_buffer_contents (fb) - FILE_BUFFER *fb; +info_reload_file_buffer_contents (FILE_BUFFER *fb) { int is_compressed; @@ -1205,9 +1190,7 @@ info_reload_file_buffer_contents (fb) position directly on the separator that precedes this node. If the node could not be found, return a NULL pointer. */ static char * -adjust_nodestart (node, min, max) - NODE *node; - int min, max; +adjust_nodestart (NODE *node, int min, int max) { long position; SEARCH_BINDING node_body; @@ -1248,7 +1231,7 @@ adjust_nodestart (node, min, max) nodedef += offset; nodedef += skip_whitespace (nodedef); offset = skip_node_characters (nodedef, DONT_SKIP_NEWLINES); - if ((offset == strlen (node->nodename)) && + if (((unsigned int) offset == strlen (node->nodename)) && (strncmp (node->nodename, nodedef, offset) == 0)) { node->contents = nodestart; diff --git a/contrib/texinfo/info/nodes.h b/contrib/texinfo/info/nodes.h index 0002ea4..e2fbabe 100644 --- a/contrib/texinfo/info/nodes.h +++ b/contrib/texinfo/info/nodes.h @@ -1,7 +1,7 @@ /* nodes.h -- How we represent nodes internally. - $Id: nodes.h,v 1.1 2002/08/25 23:38:38 karl Exp $ + $Id: nodes.h,v 1.3 2004/04/11 17:56:46 karl Exp $ - Copyright (C) 1993, 1997, 1998, 2002 Free Software Foundation, Inc. + Copyright (C) 1993, 1997, 1998, 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 @@ -123,33 +123,34 @@ extern int info_loaded_files_slots; already, or it may not. If it does not already appear, find the file, and add it to the list of loaded files. If the file cannot be found, return a NULL FILE_BUFFER *. */ -extern FILE_BUFFER *info_find_file (); +extern FILE_BUFFER *info_find_file (char *filename); /* Force load the file named FILENAME, and return the information structure describing this file. Even if the file was already loaded, this loads a new buffer, rebuilds tags and nodes, and returns a new FILE_BUFFER *. */ -extern FILE_BUFFER *info_load_file (); +extern FILE_BUFFER *info_load_file (char *filename); /* Return a pointer to a NODE structure for the Info node (FILENAME)NODENAME. FILENAME can be passed as NULL, in which case the filename of "dir" is used. NODENAME can be passed as NULL, in which case the nodename of "Top" is used. If the node cannot be found, return a NULL pointer. */ -extern NODE *info_get_node (); +extern NODE *info_get_node (char *filename, char *nodename); /* Return a pointer to a NODE structure for the Info node NODENAME in FILE_BUFFER. NODENAME can be passed as NULL, in which case the nodename of "Top" is used. If the node cannot be found, return a NULL pointer. */ -extern NODE *info_get_node_of_file_buffer (); +extern NODE *info_get_node_of_file_buffer (char *nodename, + FILE_BUFFER *file_buffer); /* Grovel FILE_BUFFER->contents finding tags and nodes, and filling in the various slots. This can also be used to rebuild a tag or node table. */ -extern void build_tags_and_nodes (); +extern void build_tags_and_nodes (FILE_BUFFER *file_buffer); /* When non-zero, this is a string describing the most recent file error. */ extern char *info_recent_file_error; /* Create a new, empty file buffer. */ -extern FILE_BUFFER *make_file_buffer (); +extern FILE_BUFFER *make_file_buffer (void); #endif /* not NODES_H */ diff --git a/contrib/texinfo/info/search.c b/contrib/texinfo/info/search.c index 593cff9..a1d5da6 100644 --- a/contrib/texinfo/info/search.c +++ b/contrib/texinfo/info/search.c @@ -1,7 +1,7 @@ /* search.c -- searching large bodies of text. - $Id: search.c,v 1.1 2002/08/25 23:38:38 karl Exp $ + $Id: search.c,v 1.3 2004/04/11 17:56:46 karl Exp $ - Copyright (C) 1993, 1997, 1998, 2002 Free Software Foundation, Inc. + Copyright (C) 1993, 1997, 1998, 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 @@ -36,9 +36,7 @@ /* A function which makes a binding with buffer and bounds. */ SEARCH_BINDING * -make_binding (buffer, start, end) - char *buffer; - long start, end; +make_binding (char *buffer, long int start, long int end) { SEARCH_BINDING *binding; @@ -53,8 +51,7 @@ make_binding (buffer, start, end) /* Make a copy of BINDING without duplicating the data. */ SEARCH_BINDING * -copy_binding (binding) - SEARCH_BINDING *binding; +copy_binding (SEARCH_BINDING *binding) { SEARCH_BINDING *copy; @@ -73,9 +70,7 @@ copy_binding (binding) /* Search forwards or backwards for the text delimited by BINDING. The search is forwards if BINDING->start is greater than BINDING->end. */ long -search (string, binding) - char *string; - SEARCH_BINDING *binding; +search (char *string, SEARCH_BINDING *binding) { long result; @@ -90,9 +85,7 @@ search (string, binding) /* Search forwards for STRING through the text delimited in BINDING. */ long -search_forward (string, binding) - char *string; - SEARCH_BINDING *binding; +search_forward (char *string, SEARCH_BINDING *binding) { register int c, i, len; register char *buff, *end; @@ -151,9 +144,7 @@ search_forward (string, binding) /* Search for STRING backwards through the text delimited in BINDING. */ long -search_backward (input_string, binding) - char *input_string; - SEARCH_BINDING *binding; +search_backward (char *input_string, SEARCH_BINDING *binding) { register int c, i, len; register char *buff, *end; @@ -225,8 +216,7 @@ search_backward (input_string, binding) Return an offset of -1 if STRING does not appear in LINE. The search is bound by the end of the line (i.e., either NEWLINE or 0). */ int -string_in_line (string, line) - char *string, *line; +string_in_line (char *string, char *line) { register int end; SEARCH_BINDING binding; @@ -245,9 +235,7 @@ string_in_line (string, line) /* Return non-zero if STRING is the first text to appear at BINDING. */ int -looking_at (string, binding) - char *string; - SEARCH_BINDING *binding; +looking_at (char *string, SEARCH_BINDING *binding) { long search_end; @@ -273,8 +261,7 @@ looking_at (string, binding) /* Return the index of the first non-whitespace character in STRING. */ int -skip_whitespace (string) - char *string; +skip_whitespace (char *string) { register int i; @@ -285,8 +272,7 @@ skip_whitespace (string) /* Return the index of the first non-whitespace or newline character in STRING. */ int -skip_whitespace_and_newlines (string) - char *string; +skip_whitespace_and_newlines (char *string) { register int i; @@ -296,8 +282,7 @@ skip_whitespace_and_newlines (string) /* Return the index of the first whitespace character in STRING. */ int -skip_non_whitespace (string) - char *string; +skip_non_whitespace (char *string) { register int i; @@ -313,9 +298,7 @@ skip_non_whitespace (string) the period. If second argument NEWLINES_OKAY is non-zero, newlines should be skipped while parsing out the nodename specification. */ int -skip_node_characters (string, newlines_okay) - char *string; - int newlines_okay; +skip_node_characters (char *string, int newlines_okay) { register int c, i = 0; int paren_seen = 0; @@ -381,8 +364,7 @@ skip_node_characters (string, newlines_okay) BINDING-buffer. The search starts at BINDING->start. Return -1 if no node separator was found. */ long -find_node_separator (binding) - SEARCH_BINDING *binding; +find_node_separator (SEARCH_BINDING *binding) { register long i; char *body; @@ -407,8 +389,7 @@ find_node_separator (binding) /* Return the length of the node separator characters that BODY is currently pointing at. */ int -skip_node_separator (body) - char *body; +skip_node_separator (char *body) { register int i; @@ -432,8 +413,7 @@ skip_node_separator (body) /* Return the number of characters from STRING to the start of the next line. */ int -skip_line (string) - char *string; +skip_line (char *string) { register int i; @@ -448,23 +428,23 @@ skip_line (string) /* Return the absolute position of the beginning of a tags table in this binding starting the search at binding->start. */ long -find_tags_table (binding) - SEARCH_BINDING *binding; +find_tags_table (SEARCH_BINDING *binding) { - SEARCH_BINDING search; + SEARCH_BINDING tmp_search; long position; - search.buffer = binding->buffer; - search.start = binding->start; - search.end = binding->end; - search.flags = S_FoldCase; + tmp_search.buffer = binding->buffer; + tmp_search.start = binding->start; + tmp_search.end = binding->end; + tmp_search.flags = S_FoldCase; - while ((position = find_node_separator (&search)) != -1 ) + while ((position = find_node_separator (&tmp_search)) != -1 ) { - search.start = position; - search.start += skip_node_separator (search.buffer + search.start); + tmp_search.start = position; + tmp_search.start += skip_node_separator (tmp_search.buffer + + tmp_search.start); - if (looking_at (TAGS_TABLE_BEG_LABEL, &search)) + if (looking_at (TAGS_TABLE_BEG_LABEL, &tmp_search)) return (position); } return (-1); @@ -476,41 +456,41 @@ find_tags_table (binding) really point to the right node. It returns the absolute position of the separator preceding the node. */ long -find_node_in_binding (nodename, binding) - char *nodename; - SEARCH_BINDING *binding; +find_node_in_binding (char *nodename, SEARCH_BINDING *binding) { long position; int offset, namelen; - SEARCH_BINDING search; + SEARCH_BINDING tmp_search; namelen = strlen (nodename); - search.buffer = binding->buffer; - search.start = binding->start; - search.end = binding->end; - search.flags = 0; + tmp_search.buffer = binding->buffer; + tmp_search.start = binding->start; + tmp_search.end = binding->end; + tmp_search.flags = 0; - while ((position = find_node_separator (&search)) != -1) + while ((position = find_node_separator (&tmp_search)) != -1) { - search.start = position; - search.start += skip_node_separator (search.buffer + search.start); + tmp_search.start = position; + tmp_search.start += skip_node_separator + (tmp_search.buffer + tmp_search.start); - offset = string_in_line (INFO_NODE_LABEL, search.buffer + search.start); + offset = string_in_line + (INFO_NODE_LABEL, tmp_search.buffer + tmp_search.start); if (offset == -1) continue; - search.start += offset; - search.start += skip_whitespace (search.buffer + search.start); + tmp_search.start += offset; + tmp_search.start += skip_whitespace (tmp_search.buffer + tmp_search.start); offset = skip_node_characters - (search.buffer + search.start, DONT_SKIP_NEWLINES); + (tmp_search.buffer + tmp_search.start, DONT_SKIP_NEWLINES); /* Notice that this is an exact match. You cannot grovel through the buffer with this function looking for random nodes. */ if ((offset == namelen) && - (search.buffer[search.start] == nodename[0]) && - (strncmp (search.buffer + search.start, nodename, offset) == 0)) + (tmp_search.buffer[tmp_search.start] == nodename[0]) && + (strncmp (tmp_search.buffer + tmp_search.start, nodename, offset) == 0)) return (position); } return (-1); diff --git a/contrib/texinfo/info/search.h b/contrib/texinfo/info/search.h index 5f94978..3e06107 100644 --- a/contrib/texinfo/info/search.h +++ b/contrib/texinfo/info/search.h @@ -1,7 +1,7 @@ /* search.h -- Structure used to search large bodies of text, with bounds. - $Id: search.h,v 1.1 2002/08/25 23:38:38 karl Exp $ + $Id: search.h,v 1.3 2004/04/11 17:56:46 karl Exp $ - Copyright (C) 1993, 1997, 1998, 2002 Free Software Foundation, Inc. + Copyright (C) 1993, 1997, 1998, 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 @@ -42,26 +42,34 @@ typedef struct { #define S_FoldCase 0x01 /* Set means fold case in searches. */ #define S_SkipDest 0x02 /* Set means return pointing after the dest. */ -SEARCH_BINDING *make_binding (), *copy_binding (); -extern long search_forward (), search_backward (), search (); -extern int looking_at (); +SEARCH_BINDING *make_binding (char *buffer, long int start, long int end); +SEARCH_BINDING *copy_binding (SEARCH_BINDING *binding); +extern long search_forward (char *string, SEARCH_BINDING *binding); +extern long search_backward (char *input_string, SEARCH_BINDING *binding); +extern long search (char *string, SEARCH_BINDING *binding); +extern int looking_at (char *string, SEARCH_BINDING *binding); /* Note that STRING_IN_LINE () always returns the offset of the 1st character after the string. */ -extern int string_in_line (); +extern int string_in_line (char *string, char *line); /* Function names that start with "skip" are passed a string, and return an offset from the start of that string. Function names that start with "find" are passed a SEARCH_BINDING, and return an absolute position marker of the item being searched for. "Find" functions return a value of -1 if the item being looked for couldn't be found. */ -extern int skip_whitespace (), skip_non_whitespace (); -extern int skip_whitespace_and_newlines (), skip_line (); -extern int skip_node_characters (), skip_node_separator (); +extern int skip_whitespace (char *string); +extern int skip_non_whitespace (char *string); +extern int skip_whitespace_and_newlines (char *string); +extern int skip_line (char *string); +extern int skip_node_characters (char *string, int newlines_okay); +extern int skip_node_separator (char *body); + #define DONT_SKIP_NEWLINES 0 #define SKIP_NEWLINES 1 -extern long find_node_separator (), find_tags_table (); -extern long find_node_in_binding (); +extern long find_node_separator (SEARCH_BINDING *binding); +extern long find_tags_table (SEARCH_BINDING *binding); +extern long find_node_in_binding (char *nodename, SEARCH_BINDING *binding); #endif /* not INFO_SEARCH_H */ 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/session.h b/contrib/texinfo/info/session.h index f2f806c..62f8ffe 100644 --- a/contrib/texinfo/info/session.h +++ b/contrib/texinfo/info/session.h @@ -1,7 +1,8 @@ /* session.h -- Functions found in session.c. - $Id: session.h,v 1.1 2002/08/25 23:38:38 karl Exp $ + $Id: session.h,v 1.3 2004/04/11 17:56:46 karl Exp $ - Copyright (C) 1993, 1998, 1999, 2001, 2002 Free Software Foundation, Inc. + Copyright (C) 1993, 1998, 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 @@ -32,7 +33,7 @@ utility program `makedoc', which is also responsible for making the documentation/function-pointer maps. */ #define DECLARE_INFO_COMMAND(name, doc) \ -void name (window, count, key) WINDOW *window; int count; unsigned char key; +void name (WINDOW *window, int count, unsigned char key) /* Variables found in session.h. */ extern VFunction *info_last_executed_command; @@ -60,27 +61,38 @@ extern char *info_scroll_choices[]; #define IS_PageOnly 2 /* Simply give up at the bottom of a node. */ /* Utility functions found in session.c */ -extern void info_dispatch_on_key (); -extern unsigned char info_get_input_char (), info_get_another_input_char (); -extern unsigned char info_input_pending_p (); -extern void remember_window_and_node (), set_remembered_pagetop_and_point (); -extern void set_window_pagetop (), info_set_node_of_window (); -extern void initialize_keyseq (), add_char_to_keyseq (); -extern void info_gather_typeahead (); -extern FILE_BUFFER *file_buffer_of_window (); -extern long info_search_in_node (), info_target_search_node (); -extern void info_select_reference (); -extern int info_any_buffered_input_p (); -extern void print_node (); -extern void dump_node_to_file (), dump_nodes_to_file (); -extern char *program_name_from_file_name (); +extern void info_dispatch_on_key (unsigned char key, Keymap map); +extern unsigned char info_get_input_char (void); +extern unsigned char info_get_another_input_char (void); +extern unsigned char info_input_pending_p (void); +extern void remember_window_and_node (WINDOW *window, NODE *node); +extern void set_remembered_pagetop_and_point (WINDOW *window); +extern void set_window_pagetop (WINDOW *window, int desired_top); +extern void info_set_node_of_window (int remember, WINDOW *window, + NODE *node); +extern void initialize_keyseq (void); +extern void add_char_to_keyseq (char character); +extern void info_gather_typeahead (void); +extern FILE_BUFFER *file_buffer_of_window (WINDOW *window); +extern long info_search_in_node (char *string, NODE *node, + long int start, WINDOW *window, int dir, int case_sensitive); +extern long info_target_search_node (NODE *node, char *string, + long int start); +extern void info_select_reference (WINDOW *window, REFERENCE *entry); +extern int info_any_buffered_input_p (void); +extern void print_node (NODE *node); +extern void dump_node_to_file (NODE *node, char *filename, + int dump_subnodes); +extern void dump_nodes_to_file (char *filename, char **nodenames, + char *output_filename, int dump_subnodes); +extern char *program_name_from_file_name (char *file_name); /* Do the physical deletion of WINDOW, and forget this window and associated nodes. */ -extern void info_delete_window_internal (); +extern void info_delete_window_internal (WINDOW *window); /* Tell Info that input is coming from the file FILENAME. */ -extern void info_set_input_from_file (); +extern void info_set_input_from_file (char *filename); #define return_if_control_g(val) \ do { \ @@ -92,59 +104,134 @@ extern void info_set_input_from_file (); /* The names of the functions that run an info session. */ /* Starting an info session. */ -extern void begin_multiple_window_info_session (), begin_info_session (); -extern void begin_info_session_with_error (), info_session (); -extern void info_read_and_dispatch (); +extern void begin_multiple_window_info_session (char *filename, + char **nodenames); +extern void begin_info_session (NODE *initial_node); +extern void begin_info_session_with_error (NODE *initial_node, + char *format, void *arg1, void *arg2); +extern void info_session (void); +extern void initialize_info_session (NODE *node, int clear_screen); +extern void info_read_and_dispatch (void); +extern void info_intuit_options_node (WINDOW *window, + NODE *initial_node, char *program); /* Moving the point within a node. */ -extern void info_next_line (), info_prev_line (); -extern void info_end_of_line (), info_beginning_of_line (); -extern void info_forward_char (), info_backward_char (); -extern void info_forward_word (), info_backward_word (); -extern void info_beginning_of_node (), info_end_of_node (); -extern void info_move_to_prev_xref (), info_move_to_next_xref (); +extern void info_next_line (WINDOW *window, int count, unsigned char key); +extern void info_prev_line (WINDOW *window, int count, unsigned char key); +extern void info_end_of_line (WINDOW *window, int count, unsigned char key); +extern void info_beginning_of_line (WINDOW *window, int count, unsigned char key); +extern void info_forward_char (WINDOW *window, int count, unsigned char key); +extern void info_backward_char (WINDOW *window, int count, unsigned char key); +extern void info_forward_word (WINDOW *window, int count, unsigned char key); +extern void info_backward_word (WINDOW *window, int count, unsigned char key); +extern void info_beginning_of_node (WINDOW *window, int count, unsigned char key); +extern void info_end_of_node (WINDOW *window, int count, unsigned char key); +extern void info_move_to_prev_xref (WINDOW *window, int count, unsigned char key); +extern void info_move_to_next_xref (WINDOW *window, int count, unsigned char key); /* Scrolling text within a window. */ -extern void info_scroll_forward (), info_scroll_backward (); -extern void info_redraw_display (), info_toggle_wrap (); -extern void info_move_to_window_line (); -extern void info_up_line (), info_down_line (); -extern void info_scroll_half_screen_down (), info_scroll_half_screen_up (); +extern void info_scroll_forward (WINDOW *window, int count, unsigned char key); +extern void info_scroll_backward (WINDOW *window, int count, unsigned char key); +extern void info_redraw_display (WINDOW *window, int count, unsigned char key); +extern void info_toggle_wrap (WINDOW *window, int count, unsigned char key); +extern void info_move_to_window_line (WINDOW *window, int count, + unsigned char key); +extern void info_up_line (WINDOW *window, int count, unsigned char key); +extern void info_down_line (WINDOW *window, int count, unsigned char key); +extern void info_scroll_half_screen_down (WINDOW *window, int count, + unsigned char key); +extern void info_scroll_half_screen_up (WINDOW *window, int count, + unsigned char key); +extern void info_scroll_forward_set_window (WINDOW *window, int count, + unsigned char key); +extern void info_scroll_forward_page_only (WINDOW *window, int count, + unsigned char key); +extern void info_scroll_forward_page_only_set_window (WINDOW *window, int count, + unsigned char key); +extern void info_scroll_backward_set_window (WINDOW *window, int count, + unsigned char key); +extern void info_scroll_backward_page_only (WINDOW *window, int count, + unsigned char key); +extern void info_scroll_backward_page_only_set_window (WINDOW *window, int count, + unsigned char key); +extern void info_scroll_other_window_backward (WINDOW *window, int count, + unsigned char key); /* Manipulating multiple windows. */ -extern void info_split_window (), info_delete_window (); -extern void info_keep_one_window (), info_grow_window (); -extern void info_scroll_other_window (), info_tile_windows (); -extern void info_next_window (), info_prev_window (); +extern void info_split_window (WINDOW *window, int count, unsigned char key); +extern void info_delete_window (WINDOW *window, int count, unsigned char key); +extern void info_keep_one_window (WINDOW *window, int count, unsigned char key); +extern void info_grow_window (WINDOW *window, int count, unsigned char key); +extern void info_scroll_other_window (WINDOW *window, int count, + unsigned char key); +extern void info_tile_windows (WINDOW *window, int count, unsigned char key); +extern void info_next_window (WINDOW *window, int count, unsigned char key); +extern void info_prev_window (WINDOW *window, int count, unsigned char key); /* Selecting nodes. */ -extern void info_next_node (), info_prev_node (), info_up_node (); -extern void info_last_node (), info_first_node (), info_history_node (); -extern void info_goto_node (), info_top_node (), info_dir_node (); -extern void info_global_next_node (), info_global_prev_node (); -extern void info_kill_node (), info_view_file (); -extern void info_menu_sequence (); -extern NODE *info_follow_menus (/* initial_node, menus, errstr, errarg */); +extern void info_next_node (WINDOW *window, int count, unsigned char key); +extern void info_prev_node (WINDOW *window, int count, unsigned char key); +extern void info_up_node (WINDOW *window, int count, unsigned char key); +extern void info_last_node (WINDOW *window, int count, unsigned char key); +extern void info_first_node (WINDOW *window, int count, unsigned char key); +extern void info_history_node (WINDOW *window, int count, unsigned char key); +extern void info_goto_node (WINDOW *window, int count, unsigned char key); +extern void info_goto_invocation_node (WINDOW *window, int count, + unsigned char key); +extern void info_top_node (WINDOW *window, int count, unsigned char key); +extern void info_dir_node (WINDOW *window, int count, unsigned char key); +extern void info_global_next_node (WINDOW *window, int count, unsigned char key); +extern void info_global_prev_node (WINDOW *window, int count, unsigned char key); +extern void info_kill_node (WINDOW *window, int count, unsigned char key); +extern void info_view_file (WINDOW *window, int count, unsigned char key); +extern void info_menu_sequence (WINDOW *window, int count, unsigned char key); +extern NODE *info_follow_menus (NODE *initial_node, char **menus, + const char **errstr, char **errarg1, char **errarg2); +extern void info_man (WINDOW *window, int count, unsigned char key); +extern void list_visited_nodes (WINDOW *window, int count, unsigned char key); +extern void select_visited_node (WINDOW *window, int count, unsigned char key); /* Selecting cross references. */ -extern void info_menu_digit (), info_menu_item (), info_xref_item (); -extern void info_find_menu (), info_select_reference_this_line (); +extern void info_menu_digit (WINDOW *window, int count, unsigned char key); +extern void info_menu_item (WINDOW *window, int count, unsigned char key); +extern void info_xref_item (WINDOW *window, int count, unsigned char key); +extern void info_find_menu (WINDOW *window, int count, unsigned char key); +extern void info_select_reference_this_line (WINDOW *window, int count, + unsigned char key); +extern void info_last_menu_item (WINDOW *window, int count, unsigned char key); +extern void info_visit_menu (WINDOW *window, int count, unsigned char key); /* Hacking numeric arguments. */ extern int info_explicit_arg, info_numeric_arg, info_numeric_arg_sign; -extern void info_add_digit_to_numeric_arg (), info_universal_argument (); -extern void info_initialize_numeric_arg (), info_numeric_arg_digit_loop (); +extern void info_add_digit_to_numeric_arg (WINDOW *window, int count, + unsigned char key); +extern void info_universal_argument (WINDOW *window, int count, + unsigned char key); +extern void info_initialize_numeric_arg (void); +extern void info_numeric_arg_digit_loop (WINDOW *window, int count, + unsigned char key); /* Searching commands. */ -extern void info_search (), isearch_forward (), isearch_backward (); -extern void info_search_case_sensitively (), info_search_backward (); -extern void info_search_next (), info_search_previous (); +extern void info_search (WINDOW *window, int count, unsigned char key); +extern void isearch_forward (WINDOW *window, int count, unsigned char key); +extern void isearch_backward (WINDOW *window, int count, unsigned char key); +extern void info_search_case_sensitively (WINDOW *window, int count, + unsigned char key); +extern void info_search_backward (WINDOW *window, int count, unsigned char key); +extern void info_search_next (WINDOW *window, int count, unsigned char key); +extern void info_search_previous (WINDOW *window, int count, unsigned char key); /* Dumping and printing nodes. */ -extern void info_print_node (); +extern void info_print_node (WINDOW *window, int count, unsigned char key); + +/* Footnotes. */ +extern void info_show_footnotes (WINDOW *window, int count, unsigned char key); /* Miscellaneous commands. */ -extern void info_abort_key (), info_quit (), info_do_lowercase_version (); +extern void info_abort_key (WINDOW *window, int count, unsigned char key); +extern void info_quit (WINDOW *window, int count, unsigned char key); +extern void info_do_lowercase_version (WINDOW *window, int count, + unsigned char key); #endif /* not SESSION_H */ 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/signals.h b/contrib/texinfo/info/signals.h index 5c9f252..2e3761e 100644 --- a/contrib/texinfo/info/signals.h +++ b/contrib/texinfo/info/signals.h @@ -1,7 +1,7 @@ /* signals.h -- header to include system dependent signal definitions. - $Id: signals.h,v 1.1 2002/08/25 23:38:38 karl Exp $ + $Id: signals.h,v 1.2 2004/04/11 17:56:46 karl Exp $ - Copyright (C) 1993, 1994, 1995, 1997, 2002 Free Software Foundation, Inc. + Copyright (C) 1993, 1994, 1995, 1997, 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 @@ -17,7 +17,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). */ #ifndef INFO_SIGNALS_H #define INFO_SIGNALS_H @@ -34,7 +34,10 @@ # define sigmask(x) (1 << ((x)-1)) #endif /* !HAVE_SIGPROCMASK && !sigmask */ -#if !defined (HAVE_SIGPROCMASK) +/* Without SA_NOCLDSTOP, sigset_t might end up being undefined even + though we have sigprocmask, on older systems, according to Nelson + Beebe. The test is from coreutils/sort.c, via Paul Eggert. */ +#if !defined (HAVE_SIGPROCMASK) || !defined (SA_NOCLDSTOP) # if !defined (SIG_BLOCK) # define SIG_UNBLOCK 1 # define SIG_BLOCK 2 diff --git a/contrib/texinfo/info/termdep.h b/contrib/texinfo/info/termdep.h index 8d2758a..45f38ac 100644 --- a/contrib/texinfo/info/termdep.h +++ b/contrib/texinfo/info/termdep.h @@ -1,5 +1,5 @@ /* termdep.h -- system things that terminal.c depends on. - $Id: termdep.h,v 1.1 2002/08/25 23:38:38 karl Exp $ + $Id: termdep.h,v 1.2 2004/04/11 17:56:46 karl Exp $ Copyright (C) 1993, 1996, 1997, 1998, 2001, 2002 Free Software Foundation, Inc. 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/info/terminal.h b/contrib/texinfo/info/terminal.h index 647d468..dbf6b49 100644 --- a/contrib/texinfo/info/terminal.h +++ b/contrib/texinfo/info/terminal.h @@ -1,7 +1,8 @@ /* terminal.h -- The external interface to terminal I/O. - $Id: terminal.h,v 1.1 2002/08/25 23:38:38 karl Exp $ + $Id: terminal.h,v 1.3 2004/04/11 17:56:46 karl Exp $ - Copyright (C) 1993, 1996, 1997, 2001, 2002 Free Software Foundation, Inc. + Copyright (C) 1993, 1996, 1997, 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 @@ -52,68 +53,71 @@ extern int terminal_can_scroll; The variables SCREENHEIGHT and SCREENWIDTH are set to the dimensions that this terminal actually has. The variable TERMINAL_HAS_META_P becomes non- zero if this terminal supports a Meta key. */ -extern void terminal_initialize_terminal (); +extern void terminal_initialize_terminal (char *terminal_name); extern VFunction *terminal_initialize_terminal_hook; /* Return the current screen width and height in the variables SCREENWIDTH and SCREENHEIGHT. */ -extern void terminal_get_screen_size (); +extern void terminal_get_screen_size (void); extern VFunction *terminal_get_screen_size_hook; /* Save and restore tty settings. */ -extern void terminal_prep_terminal (), terminal_unprep_terminal (); -extern VFunction *terminal_prep_terminal_hook, *terminal_unprep_terminal_hook; +extern void terminal_prep_terminal (void); +extern void terminal_unprep_terminal (void); + +extern VFunction *terminal_prep_terminal_hook; +extern VFunction *terminal_unprep_terminal_hook; /* Re-initialize the terminal to TERMINAL_NAME. */ -extern void terminal_new_terminal (); +extern void terminal_new_terminal (char *terminal_name); extern VFunction *terminal_new_terminal_hook; /* Move the cursor to the terminal location of X and Y. */ -extern void terminal_goto_xy (); +extern void terminal_goto_xy (int x, int y); extern VFunction *terminal_goto_xy_hook; /* Print STRING to the terminal at the current position. */ -extern void terminal_put_text (); +extern void terminal_put_text (char *string); extern VFunction *terminal_put_text_hook; /* Print NCHARS from STRING to the terminal at the current position. */ -extern void terminal_write_chars (); +extern void terminal_write_chars (char *string, int nchars); extern VFunction *terminal_write_chars_hook; /* Clear from the current position of the cursor to the end of the line. */ -extern void terminal_clear_to_eol (); +extern void terminal_clear_to_eol (void); extern VFunction *terminal_clear_to_eol_hook; /* Clear the entire terminal screen. */ -extern void terminal_clear_screen (); +extern void terminal_clear_screen (void); extern VFunction *terminal_clear_screen_hook; /* Move the cursor up one line. */ -extern void terminal_up_line (); +extern void terminal_up_line (void); extern VFunction *terminal_up_line_hook; /* Move the cursor down one line. */ -extern void terminal_down_line (); +extern void terminal_down_line (void); extern VFunction *terminal_down_line_hook; /* Turn on reverse video if possible. */ -extern void terminal_begin_inverse (); +extern void terminal_begin_inverse (void); extern VFunction *terminal_begin_inverse_hook; /* Turn off reverse video if possible. */ -extern void terminal_end_inverse (); +extern void terminal_end_inverse (void); extern VFunction *terminal_end_inverse_hook; /* Scroll an area of the terminal, starting with the region from START to END, AMOUNT lines. If AMOUNT is negative, the lines are scrolled towards the top of the screen, else they are scrolled towards the bottom of the screen. */ -extern void terminal_scroll_terminal (); +extern void terminal_scroll_terminal (int start, int end, int amount); extern VFunction *terminal_scroll_terminal_hook; /* Ring the terminal bell. The bell is run visibly if it both has one and terminal_use_visible_bell_p is non-zero. */ -extern void terminal_ring_bell (); +extern void terminal_ring_bell (void); extern VFunction *terminal_ring_bell_hook; /* The key sequences output by special keys, if this terminal has any. */ diff --git a/contrib/texinfo/info/tilde.c b/contrib/texinfo/info/tilde.c index 19f56b1..ac32abd 100644 --- a/contrib/texinfo/info/tilde.c +++ b/contrib/texinfo/info/tilde.c @@ -1,8 +1,8 @@ /* tilde.c -- tilde expansion code (~/foo := $HOME/foo). - $Id: tilde.c,v 1.1 2002/08/25 23:38:38 karl Exp $ + $Id: tilde.c,v 1.3 2004/04/11 17:56:46 karl Exp $ - Copyright (C) 1988, 1989, 1990, 1991, 1992, 1993, 1996, 1998, 1999, 2002 - Free Software Foundation, Inc. + Copyright (C) 1988, 1989, 1990, 1991, 1992, 1993, 1996, 1998, 1999, + 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 @@ -22,6 +22,7 @@ /* Include config.h before doing alloca. */ #include "info.h" +#include "tilde.h" #if defined (TEST) || defined (STATIC_MALLOC) static void *xmalloc (), *xrealloc (); @@ -59,9 +60,7 @@ char **tilde_additional_suffixes = default_suffixes; the tilde which starts the expansion. Place the length of the text which identified this tilde starter in LEN, excluding the tilde itself. */ static int -tilde_find_prefix (string, len) - char *string; - int *len; +tilde_find_prefix (char *string, int *len) { register int i, j, string_len; register char **prefixes = tilde_additional_prefixes; @@ -92,8 +91,7 @@ tilde_find_prefix (string, len) /* Find the end of a tilde expansion in STRING, and return the index of the character which ends the tilde definition. */ static int -tilde_find_suffix (string) - char *string; +tilde_find_suffix (char *string) { register int i, j, string_len; register char **suffixes = tilde_additional_suffixes; @@ -116,10 +114,9 @@ tilde_find_suffix (string) /* Return a new string which is the result of tilde expanding STRING. */ char * -tilde_expand (string) - char *string; +tilde_expand (char *string) { - char *result, *tilde_expand_word (); + char *result; int result_size, result_index; result_size = result_index = 0; @@ -179,8 +176,7 @@ tilde_expand (string) /* Do the work of tilde expansion on FILENAME. FILENAME starts with a tilde. If there is no expansion, call tilde_expansion_failure_hook. */ char * -tilde_expand_word (filename) - char *filename; +tilde_expand_word (char *filename) { char *dirname = filename ? xstrdup (filename) : NULL; @@ -236,9 +232,7 @@ tilde_expand_word (filename) expansion, then let them try. */ if (tilde_expansion_failure_hook) { - char *expansion; - - expansion = (*tilde_expansion_failure_hook) (username); + char *expansion = (*tilde_expansion_failure_hook) (username); if (expansion) { diff --git a/contrib/texinfo/info/tilde.h b/contrib/texinfo/info/tilde.h index 83f534b..b499f3e 100644 --- a/contrib/texinfo/info/tilde.h +++ b/contrib/texinfo/info/tilde.h @@ -1,12 +1,10 @@ -/* tilde.h: Externally available variables and function in libtilde.a. */ - -/* This file is part of GNU Info, a program for reading online documentation - stored in Info format. +/* tilde.h: Externally available variables and function in libtilde.a. + $Id: tilde.h,v 1.3 2004/04/11 17:56:46 karl Exp $ This file has appeared in prior works by the Free Software Foundation; thus it carries copyright dates from 1988 through 1993. - Copyright (C) 1988, 1989, 1990, 1991, 1992, 1993 Free Software + Copyright (C) 1988, 1989, 1990, 1991, 1992, 1993, 2004 Free Software Foundation, Inc. This program is free software; you can redistribute it and/or modify @@ -47,10 +45,10 @@ extern char **tilde_additional_prefixes; extern char **tilde_additional_suffixes; /* Return a new string which is the result of tilde expanding STRING. */ -extern char *tilde_expand (); +extern char *tilde_expand (char *string); /* Do the work of tilde expansion on FILENAME. FILENAME starts with a tilde. If there is no expansion, call tilde_expansion_failure_hook. */ -extern char *tilde_expand_word (); +extern char *tilde_expand_word (char *filename); #endif /* not TILDE_H */ diff --git a/contrib/texinfo/info/variables.c b/contrib/texinfo/info/variables.c index 7280325..3636801 100644 --- a/contrib/texinfo/info/variables.c +++ b/contrib/texinfo/info/variables.c @@ -1,7 +1,7 @@ /* variables.c -- how to manipulate user visible variables in Info. - $Id: variables.c,v 1.1 2002/08/25 23:38:38 karl Exp $ + $Id: variables.c,v 1.3 2004/04/11 17:56:46 karl Exp $ - Copyright (C) 1993, 1997, 2001, 2002 Free Software Foundation, Inc. + Copyright (C) 1993, 1997, 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 @@ -77,7 +77,7 @@ DECLARE_INFO_COMMAND (describe_variable, _("Explain the use of a variable")) char *description; /* Get the variable's name. */ - var = read_variable_name (_("Describe variable: "), window); + var = read_variable_name ((char *) _("Describe variable: "), window); if (!var) return; @@ -92,7 +92,7 @@ DECLARE_INFO_COMMAND (describe_variable, _("Explain the use of a variable")) sprintf (description, "%s (%d): %s.", var->name, *(var->value), _(var->doc)); - window_message_in_echo_area ("%s", description); + window_message_in_echo_area ("%s", description, NULL); free (description); } @@ -102,7 +102,7 @@ DECLARE_INFO_COMMAND (set_variable, _("Set the value of an Info variable")) char *line; /* Get the variable's name and value. */ - var = read_variable_name (_("Set variable: "), window); + var = read_variable_name ((char *) _("Set variable: "), window); if (!var) return; @@ -201,9 +201,7 @@ DECLARE_INFO_COMMAND (set_variable, _("Set the value of an Info variable")) address of a VARIABLE_ALIST member. A return value of NULL indicates that no variable could be read. */ VARIABLE_ALIST * -read_variable_name (prompt, window) - char *prompt; - WINDOW *window; +read_variable_name (char *prompt, WINDOW *window) { register int i; char *line; @@ -249,7 +247,7 @@ read_variable_name (prompt, window) /* Make an array of REFERENCE which actually contains the names of the variables available in Info. */ REFERENCE ** -make_variable_completions_array () +make_variable_completions_array (void) { register int i; REFERENCE **array = (REFERENCE **)NULL; @@ -274,9 +272,7 @@ make_variable_completions_array () #if defined(INFOKEY) void -set_variable_to_value(name, value) - char *name; - char *value; +set_variable_to_value(char *name, char *value) { register int i; diff --git a/contrib/texinfo/info/variables.h b/contrib/texinfo/info/variables.h index 58169d3..7e5b082 100644 --- a/contrib/texinfo/info/variables.h +++ b/contrib/texinfo/info/variables.h @@ -1,10 +1,10 @@ /* variables.h -- Description of user visible variables in Info. - $Id: variables.h,v 1.1 2002/08/25 23:38:38 karl Exp $ + $Id: variables.h,v 1.3 2004/04/11 17:56:46 karl Exp $ This file is part of GNU Info, a program for reading online documentation stored in Info format. - Copyright (C) 1993, 97 Free Software Foundation, Inc. + Copyright (C) 1993, 1997, 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 @@ -42,14 +42,15 @@ typedef struct { /* Read the name of an Info variable in the echo area and return the address of a VARIABLE_ALIST member. A return value of NULL indicates that no variable could be read. */ -extern VARIABLE_ALIST *read_variable_name (); +extern VARIABLE_ALIST *read_variable_name (char *prompt, WINDOW *window); /* Make an array of REFERENCE which actually contains the names of the variables available in Info. */ -extern REFERENCE **make_variable_completions_array (); +extern REFERENCE **make_variable_completions_array (void); /* Set the value of an info variable. */ -extern void set_variable (); +extern void set_variable (WINDOW *window, int count, unsigned char key); +extern void describe_variable (WINDOW *window, int count, unsigned char key); /* The list of user-visible variables. */ extern int auto_footnotes_p; diff --git a/contrib/texinfo/info/window.c b/contrib/texinfo/info/window.c index 93b9644..cf5665b 100644 --- a/contrib/texinfo/info/window.c +++ b/contrib/texinfo/info/window.c @@ -1,7 +1,7 @@ /* window.c -- windows in Info. - $Id: window.c,v 1.2 2003/02/11 16:39:06 karl Exp $ + $Id: window.c,v 1.4 2004/04/11 17:56:46 karl Exp $ - Copyright (C) 1993, 1997, 1998, 2001, 2002, 2003 Free Software + Copyright (C) 1993, 1997, 1998, 2001, 2002, 2003, 2004 Free Software Foundation, Inc. This program is free software; you can redistribute it and/or modify @@ -51,8 +51,7 @@ WINDOW *active_window = NULL; Create the first window ever. You pass the dimensions of the total screen size. */ void -window_initialize_windows (width, height) - int width, height; +window_initialize_windows (int width, int height) { the_screen = xmalloc (sizeof (WINDOW)); the_echo_area = xmalloc (sizeof (WINDOW)); @@ -83,7 +82,7 @@ window_initialize_windows (width, height) area. */ the_echo_area->height = ECHO_AREA_HEIGHT; active_window->height = the_screen->height - 1 - the_echo_area->height; - window_new_screen_size (width, height, NULL); + window_new_screen_size (width, height); /* The echo area uses a different keymap than normal info windows. */ the_echo_area->keymap = echo_area_keymap; @@ -103,8 +102,7 @@ window_initialize_windows (width, height) VFunction *window_deletion_notifier = NULL; void -window_new_screen_size (width, height) - int width, height; +window_new_screen_size (int width, int height) { register WINDOW *win; int delta_height, delta_each, delta_leftover; @@ -232,7 +230,7 @@ window_new_screen_size (width, height) if ((win->height < WINDOW_MIN_HEIGHT) || (win->height > avail)) { - WINDOW *lastwin; + WINDOW *lastwin = NULL; /* Split the space among the available windows. */ delta_each = avail / numwins; @@ -262,8 +260,7 @@ window_new_screen_size (width, height) window. If the window could not be made return a NULL pointer. The active window is not changed.*/ WINDOW * -window_make_window (node) - NODE *node; +window_make_window (NODE *node) { WINDOW *window; @@ -377,9 +374,7 @@ window_make_window (node) the previous and next windows in the chain. If there is only one user window, then no change takes place. */ void -window_change_window_height (window, amount) - WINDOW *window; - int amount; +window_change_window_height (WINDOW *window, int amount) { register WINDOW *win, *prev, *next; @@ -510,8 +505,7 @@ window_change_window_height (window, amount) internal nodes as well, otherwise do not change the height of such windows. */ void -window_tile_windows (style) - int style; +window_tile_windows (int style) { WINDOW *win, *last_adjusted; int numwins, avail, per_win_height, leftover; @@ -564,8 +558,7 @@ window_tile_windows (style) /* Toggle the state of line wrapping in WINDOW. This can do a bit of fancy redisplay. */ void -window_toggle_wrap (window) - WINDOW *window; +window_toggle_wrap (WINDOW *window) { if (window->flags & W_NoWrap) window->flags &= ~W_NoWrap; @@ -599,9 +592,7 @@ window_toggle_wrap (window) /* Set WINDOW to display NODE. */ void -window_set_node_of_window (window, node) - WINDOW *window; - NODE *node; +window_set_node_of_window (WINDOW *window, NODE *node) { window->node = node; window->pagetop = 0; @@ -619,8 +610,7 @@ window_set_node_of_window (window, node) If the active window is the next or previous window, choose that window as the recipient of the extra space. Otherwise, prefer the next window. */ void -window_delete_window (window) - WINDOW *window; +window_delete_window (WINDOW *window) { WINDOW *next, *prev, *window_to_fix; @@ -691,9 +681,7 @@ window_delete_window (window) /* For every window in CHAIN, set the flags member to have FLAG set. */ void -window_mark_chain (chain, flag) - WINDOW *chain; - int flag; +window_mark_chain (WINDOW *chain, int flag) { register WINDOW *win; @@ -703,9 +691,7 @@ window_mark_chain (chain, flag) /* For every window in CHAIN, clear the flags member of FLAG. */ void -window_unmark_chain (chain, flag) - WINDOW *chain; - int flag; +window_unmark_chain (WINDOW *chain, int flag) { register WINDOW *win; @@ -716,8 +702,7 @@ window_unmark_chain (chain, flag) /* Return the number of characters it takes to display CHARACTER on the screen at HPOS. */ int -character_width (character, hpos) - int character, hpos; +character_width (int character, int hpos) { int printable_limit = 127; int width = 1; @@ -751,9 +736,7 @@ character_width (character, hpos) /* Return the number of characters it takes to display STRING on the screen at HPOS. */ int -string_width (string, hpos) - char *string; - int hpos; +string_width (char *string, int hpos) { register int i, width, this_char_width; @@ -782,8 +765,7 @@ string_width (string, hpos) /* Quickly guess the approximate number of lines that NODE would take to display. This really only counts carriage returns. */ int -window_physical_lines (node) - NODE *node; +window_physical_lines (NODE *node) { register int i, lines; char *contents; @@ -802,8 +784,7 @@ window_physical_lines (node) /* Calculate a list of line starts for the node belonging to WINDOW. The line starts are pointers to the actual text within WINDOW->NODE. */ void -calculate_line_starts (window) - WINDOW *window; +calculate_line_starts (WINDOW *window) { register int i, hpos; char **line_starts = NULL; @@ -869,7 +850,7 @@ calculate_line_starts (window) cwidth = character_width (c, hpos); /* If this character fits within this line, just do the next one. */ - if ((hpos + cwidth) < window->width) + if ((hpos + cwidth) < (unsigned int) window->width) { i++; hpos += cwidth; @@ -918,8 +899,7 @@ calculate_line_starts (window) /* Given WINDOW, recalculate the line starts for the node it displays. */ void -recalculate_line_starts (window) - WINDOW *window; +recalculate_line_starts (WINDOW *window) { maybe_free (window->line_starts); calculate_line_starts (window); @@ -933,8 +913,7 @@ int window_scroll_step = 0; /* Adjust the pagetop of WINDOW such that the cursor point will be visible. */ void -window_adjust_pagetop (window) - WINDOW *window; +window_adjust_pagetop (WINDOW *window) { register int line = 0; char *contents; @@ -991,8 +970,7 @@ window_adjust_pagetop (window) /* Return the index of the line containing point. */ int -window_line_of_point (window) - WINDOW *window; +window_line_of_point (WINDOW *window) { register int i, start = 0; @@ -1014,8 +992,7 @@ window_line_of_point (window) /* Get and return the goal column for this window. */ int -window_get_goal_column (window) - WINDOW *window; +window_get_goal_column (WINDOW *window) { if (!window->node) return (-1); @@ -1030,8 +1007,7 @@ window_get_goal_column (window) /* Get and return the printed column offset of the cursor in this window. */ int -window_get_cursor_column (window) - WINDOW *window; +window_get_cursor_column (WINDOW *window) { int i, hpos, end; char *line; @@ -1069,11 +1045,9 @@ window_get_cursor_column (window) /* Count the number of characters in LINE that precede the printed column offset of GOAL. */ int -window_chars_to_goal (line, goal) - char *line; - int goal; +window_chars_to_goal (char *line, int goal) { - register int i, check, hpos; + register int i, check = 0, hpos; for (hpos = 0, i = 0; line[i] != '\n'; i++) { @@ -1099,8 +1073,7 @@ window_chars_to_goal (line, goal) /* Create a modeline for WINDOW, and store it in window->modeline. */ void -window_make_modeline (window) - WINDOW *window; +window_make_modeline (WINDOW *window) { register int i; char *modeline; @@ -1214,9 +1187,7 @@ window_make_modeline (window) /* Make WINDOW start displaying at PERCENT percentage of its node. */ void -window_goto_percentage (window, percent) - WINDOW *window; - int percent; +window_goto_percentage (WINDOW *window, int percent) { int desired_line; @@ -1235,9 +1206,7 @@ window_goto_percentage (window, percent) /* Get the state of WINDOW, and save it in STATE. */ void -window_get_state (window, state) - WINDOW *window; - WINDOW_STATE *state; +window_get_state (WINDOW *window, SEARCH_STATE *state) { state->node = window->node; state->pagetop = window->pagetop; @@ -1246,9 +1215,7 @@ window_get_state (window, state) /* Set the node, pagetop, and point of WINDOW. */ void -window_set_state (window, state) - WINDOW *window; - WINDOW_STATE *state; +window_set_state (WINDOW *window, SEARCH_STATE *state) { if (window->node != state->node) window_set_node_of_window (window, state->node); @@ -1264,7 +1231,7 @@ static NODE *echo_area_node = NULL; /* Make the node of the_echo_area be an empty one. */ static void -free_echo_area () +free_echo_area (void) { if (echo_area_node) { @@ -1279,7 +1246,7 @@ free_echo_area () /* Clear the echo area, removing any message that is already present. The echo area is cleared immediately. */ void -window_clear_echo_area () +window_clear_echo_area (void) { free_echo_area (); display_update_one_window (the_echo_area); @@ -1290,9 +1257,7 @@ window_clear_echo_area () printf () hair is present. The message appears immediately. If there was already a message appearing in the echo area, it is removed. */ void -window_message_in_echo_area (format, arg1, arg2) - char *format; - void *arg1, *arg2; +window_message_in_echo_area (char *format, void *arg1, void *arg2) { free_echo_area (); echo_area_node = build_message_node (format, arg1, arg2); @@ -1309,9 +1274,7 @@ static int old_echo_area_nodes_index = 0; static int old_echo_area_nodes_slots = 0; void -message_in_echo_area (format, arg1, arg2) - char *format; - void *arg1, *arg2; +message_in_echo_area (char *format, void *arg1, void *arg2) { if (echo_area_node) { @@ -1324,7 +1287,7 @@ message_in_echo_area (format, arg1, arg2) } void -unmessage_in_echo_area () +unmessage_in_echo_area (void) { free_echo_area (); @@ -1343,8 +1306,7 @@ static int message_buffer_size = 0; /* Ensure that there is enough space to stuff LENGTH characters into MESSAGE_BUFFER. */ static void -message_buffer_resize (length) - int length; +message_buffer_resize (int length) { if (!message_buffer) { @@ -1362,9 +1324,7 @@ message_buffer_resize (length) /* Format MESSAGE_BUFFER with the results of printing FORMAT with ARG1 and ARG2. */ static void -build_message_buffer (format, arg1, arg2, arg3) - char *format; - void *arg1, *arg2, *arg3; +build_message_buffer (char *format, void *arg1, void *arg2, void *arg3) { register int i, len; void *args[3]; @@ -1511,9 +1471,7 @@ build_message_buffer (format, arg1, arg2, arg3) /* Build a new node which has FORMAT printed with ARG1 and ARG2 as the contents. */ NODE * -build_message_node (format, arg1, arg2) - char *format; - void *arg1, *arg2; +build_message_node (char *format, void *arg1, void *arg2) { NODE *node; @@ -1526,7 +1484,7 @@ build_message_node (format, arg1, arg2) /* Convert the contents of the message buffer to a node. */ NODE * -message_buffer_to_node () +message_buffer_to_node (void) { NODE *node; @@ -1548,16 +1506,14 @@ message_buffer_to_node () /* Useful functions can be called from outside of window.c. */ void -initialize_message_buffer () +initialize_message_buffer (void) { message_buffer_index = 0; } /* Print FORMAT with ARG1,2 to the end of the current message buffer. */ void -printf_to_message_buffer (format, arg1, arg2, arg3) - char *format; - void *arg1, *arg2, *arg3; +printf_to_message_buffer (char *format, void *arg1, void *arg2, void *arg3) { build_message_buffer (format, arg1, arg2, arg3); } @@ -1565,7 +1521,7 @@ printf_to_message_buffer (format, arg1, arg2, arg3) /* Return the current horizontal position of the "cursor" on the most recently output message buffer line. */ int -message_buffer_length_this_line () +message_buffer_length_this_line (void) { register int i; @@ -1579,9 +1535,7 @@ message_buffer_length_this_line () /* Pad STRING to COUNT characters by inserting blanks. */ int -pad_to (count, string) - int count; - char *string; +pad_to (int count, char *string) { register int i; diff --git a/contrib/texinfo/info/window.h b/contrib/texinfo/info/window.h index 2686a82..44f620f 100644 --- a/contrib/texinfo/info/window.h +++ b/contrib/texinfo/info/window.h @@ -1,10 +1,10 @@ /* window.h -- Structure and flags used in manipulating Info windows. - $Id: window.h,v 1.1 2002/08/25 23:38:38 karl Exp $ + $Id: window.h,v 1.3 2004/04/11 17:56:46 karl Exp $ This file is part of GNU Info, a program for reading online documentation stored in Info format. - Copyright (C) 1993, 97 Free Software Foundation, Inc. + Copyright (C) 1993, 1997, 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 @@ -25,8 +25,8 @@ #ifndef INFO_WINDOW_H #define INFO_WINDOW_H -#include "nodes.h" #include "infomap.h" +#include "nodes.h" /* Smallest number of visible lines in a window. The actual height is always one more than this number because each window has a modeline. */ @@ -75,6 +75,14 @@ typedef struct { WINDOW_STATE_DECL; /* What gets saved. */ } WINDOW_STATE; +/* 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; + #define W_UpdateWindow 0x01 /* WINDOW needs updating. */ #define W_WindowIsPerm 0x02 /* This WINDOW is a permanent object. */ #define W_WindowVisible 0x04 /* This WINDOW is currently visible. */ @@ -95,24 +103,24 @@ extern WINDOW *the_echo_area; /* THE_ECHO_AREA is a window in THE_SCREEN. */ extern int window_scroll_step; /* Make the modeline member for WINDOW. */ -extern void window_make_modeline (); +extern void window_make_modeline (WINDOW *window); /* Initalize the window system by creating THE_SCREEN and THE_ECHO_AREA. Create the first window ever, and make it permanent. You pass WIDTH and HEIGHT; the dimensions of the total screen size. */ -extern void window_initialize_windows (); +extern void window_initialize_windows (int width, int height); /* Make a new window showing NODE, and return that window structure. The new window is made to be the active window. If NODE is passed as NULL, then show the node showing in the active window. If the window could not be made return a NULL pointer. The active window is not changed.*/ -extern WINDOW *window_make_window (); +extern WINDOW *window_make_window (NODE *node); /* Delete WINDOW from the list of known windows. If this window was the active window, make the next window in the chain be the active window, or the previous window in the chain if there is no next window. */ -extern void window_delete_window (); +extern void window_delete_window (WINDOW *window); /* A function to call when the screen changes size, and some windows have to get deleted. The function is called with the window to be deleted @@ -121,111 +129,113 @@ extern void window_delete_window (); extern VFunction *window_deletion_notifier; /* Set WINDOW to display NODE. */ -extern void window_set_node_of_window (); +extern void window_set_node_of_window (WINDOW *window, NODE *node); /* Tell the window system that the size of the screen has changed. This causes lots of interesting things to happen. The permanent windows are resized, as well as every visible window. You pass WIDTH and HEIGHT; the dimensions of the total screen size. */ -extern void window_new_screen_size (); +extern void window_new_screen_size (int width, int height); /* Change the height of WINDOW by AMOUNT. This also automagically adjusts the previous and next windows in the chain. If there is only one user window, then no change takes place. */ -extern void window_change_window_height (); +extern void window_change_window_height (WINDOW *window, int amount); /* Adjust the pagetop of WINDOW such that the cursor point will be visible. */ -extern void window_adjust_pagetop (); +extern void window_adjust_pagetop (WINDOW *window); /* Tile all of the windows currently displayed in the global variable WINDOWS. If argument DO_INTERNALS is non-zero, tile windows displaying internal nodes as well. */ #define DONT_TILE_INTERNALS 0 #define TILE_INTERNALS 1 -extern void window_tile_windows (); +extern void window_tile_windows (int style); /* Toggle the state of line wrapping in WINDOW. This can do a bit of fancy redisplay. */ -extern void window_toggle_wrap (); +extern void window_toggle_wrap (WINDOW *window); /* For every window in CHAIN, set the flags member to have FLAG set. */ -extern void window_mark_chain (); +extern void window_mark_chain (WINDOW *chain, int flag); /* For every window in CHAIN, clear the flags member of FLAG. */ -extern void window_unmark_chain (); +extern void window_unmark_chain (WINDOW *chain, int flag); /* Make WINDOW start displaying at PERCENT percentage of its node. */ -extern void window_goto_percentage (); +extern void window_goto_percentage (WINDOW *window, int percent); /* Build a new node which has FORMAT printed with ARG1 and ARG2 as the contents. */ -extern NODE *build_message_node (); +extern NODE *build_message_node (char *format, void *arg1, void *arg2); /* Useful functions can be called from outside of window.c. */ -extern void initialize_message_buffer (); +extern void initialize_message_buffer (void); /* Print FORMAT with ARG1,2 to the end of the current message buffer. */ -extern void printf_to_message_buffer (); +extern void printf_to_message_buffer (char *format, void *arg1, void *arg2, + void *arg3); /* Convert the contents of the message buffer to a node. */ -extern NODE *message_buffer_to_node (); +extern NODE *message_buffer_to_node (void); /* Return the length of the most recently printed line in message buffer. */ -extern int message_buffer_length_this_line (); +extern int message_buffer_length_this_line (void); /* Pad STRING to COUNT characters by inserting blanks. */ -extern int pad_to (); +extern int pad_to (int count, char *string); /* Make a message appear in the echo area, built from FORMAT, ARG1 and ARG2. The arguments are treated similar to printf () arguments, but not all of printf () hair is present. The message appears immediately. If there was already a message appearing in the echo area, it is removed. */ -extern void window_message_in_echo_area (); +extern void window_message_in_echo_area (char *format, void *arg1, void *arg2); /* Place a temporary message in the echo area built from FORMAT, ARG1 and ARG2. The message appears immediately, but does not destroy any existing message. A future call to unmessage_in_echo_area () restores the old contents. */ -extern void message_in_echo_area (); -extern void unmessage_in_echo_area (); +extern void message_in_echo_area (char *format, void *arg1, void *arg2); +extern void unmessage_in_echo_area (void); /* Clear the echo area, removing any message that is already present. The echo area is cleared immediately. */ -extern void window_clear_echo_area (); +extern void window_clear_echo_area (void); /* Quickly guess the approximate number of lines to that NODE would take to display. This really only counts carriage returns. */ -extern int window_physical_lines (); +extern int window_physical_lines (NODE *node); /* Calculate a list of line starts for the node belonging to WINDOW. The line starts are pointers to the actual text within WINDOW->NODE. */ -extern void calculate_line_starts (); +extern void calculate_line_starts (WINDOW *window); /* Given WINDOW, recalculate the line starts for the node it displays. */ -extern void recalculate_line_starts (); +extern void recalculate_line_starts (WINDOW *window); /* Return the number of characters it takes to display CHARACTER on the screen at HPOS. */ -extern int character_width (); +extern int character_width (int character, int hpos); /* Return the number of characters it takes to display STRING on the screen at HPOS. */ -extern int string_width (); +extern int string_width (char *string, int hpos); /* Return the index of the line containing point. */ -extern int window_line_of_point (); +extern int window_line_of_point (WINDOW *window); /* Get and return the goal column for this window. */ -extern int window_get_goal_column (); +extern int window_get_goal_column (WINDOW *window); /* Get and return the printed column offset of the cursor in this window. */ -extern int window_get_cursor_column (); +extern int window_get_cursor_column (WINDOW *window); /* Get and Set the node, pagetop, and point of WINDOW. */ -extern void window_get_state (), window_set_state (); +extern void window_get_state (WINDOW *window, SEARCH_STATE *state); +extern void window_set_state (WINDOW *window, SEARCH_STATE *state); /* Count the number of characters in LINE that precede the printed column offset of GOAL. */ -extern int window_chars_to_goal (); +extern int window_chars_to_goal (char *line, int goal); #endif /* not INFO_WINDOW_H */ |