diff --git a/contrib/texinfo/info/doc.c b/contrib/texinfo/info/doc.c index 5ae64b1874ee..4ca2266309c2 100644 --- a/contrib/texinfo/info/doc.c +++ b/contrib/texinfo/info/doc.c @@ -1,4 +1,3 @@ -/* $FreeBSD$ */ /* doc.c -- Generated structure containing function names and doc strings. This file was automatically made from various source files with the diff --git a/contrib/texinfo/info/funs.h b/contrib/texinfo/info/funs.h index 0d3647a9d758..5e8bc0425626 100644 --- a/contrib/texinfo/info/funs.h +++ b/contrib/texinfo/info/funs.h @@ -1,4 +1,3 @@ -/* $FreeBSD$ */ /* funs.h -- Generated declarations for Info commands. */ /* Functions declared in "./session.c". */ diff --git a/contrib/texinfo/info/infomap.c b/contrib/texinfo/info/infomap.c index a89bd1c7aa95..de82f6922f2f 100644 --- a/contrib/texinfo/info/infomap.c +++ b/contrib/texinfo/info/infomap.c @@ -1,8 +1,8 @@ -/* $FreeBSD$ */ /* infomap.c -- keymaps for Info. - $Id: infomap.c,v 1.28 2002/02/08 23:02:53 karl Exp $ + $Id: infomap.c,v 1.5 2003/01/24 19:04:54 karl Exp $ - Copyright (C) 1993, 97, 98, 99, 2001, 02 Free Software Foundation, Inc. + Copyright (C) 1993, 1997, 1998, 1999, 2001, 2002, 2003 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 @@ -59,47 +59,154 @@ keymap_make_keymap () return (keymap); } +#if defined(INFOKEY) +static FUNCTION_KEYSEQ * +find_function_keyseq (map, c, rootmap) + Keymap map; + int c; + Keymap rootmap; +{ + FUNCTION_KEYSEQ *k; + + if (map[c].type != ISFUNC) + abort(); + if (map[c].function == NULL) + return NULL; + for (k = map[c].function->keys; k; k = k->next) + { + const unsigned char *p; + Keymap m = rootmap; + if (k->map != rootmap) + continue; + for (p = k->keyseq; *p && m[*p].type == ISKMAP; p++) + m = (Keymap)m[*p].function; + if (*p != c || p[1]) + continue; + if (m[*p].type != ISFUNC) + abort (); + break; + } + return k; +} + +static void +add_function_keyseq (function, keyseq, rootmap) + InfoCommand *function; + const unsigned char *keyseq; + Keymap rootmap; +{ + FUNCTION_KEYSEQ *ks; + + if (function == NULL || + function == InfoCmd(info_do_lowercase_version) || + function == InfoCmd(ea_insert)) + return; + ks = (FUNCTION_KEYSEQ *)xmalloc (sizeof(FUNCTION_KEYSEQ)); + ks->next = function->keys; + ks->map = rootmap; + ks->keyseq = xstrdup(keyseq); + function->keys = ks; +} + +static void +remove_function_keyseq (function, keyseq, rootmap) + InfoCommand *function; + const unsigned char *keyseq; + Keymap rootmap; +{ + + FUNCTION_KEYSEQ *k, *kp; + + if (function == NULL || + function == InfoCmd(info_do_lowercase_version) || + function == InfoCmd(ea_insert)) + return; + for (kp = NULL, k = function->keys; k; kp = k, k = k->next) + if (k->map == rootmap && strcmp(k->keyseq, keyseq) == 0) + break; + if (!k) + abort (); + if (kp) + kp->next = k->next; + else + function->keys = k->next; +} +#endif /* INFOKEY */ + /* Return a new keymap which is a copy of MAP. */ Keymap -keymap_copy_keymap (map) - Keymap map; +keymap_copy_keymap (map, rootmap, newroot) + Keymap map; + Keymap rootmap; + Keymap newroot; { int i; Keymap keymap; +#if defined(INFOKEY) + FUNCTION_KEYSEQ *ks; +#endif /* INFOKEY */ keymap = keymap_make_keymap (); + if (!newroot) + newroot = keymap; for (i = 0; i < 256; i++) { keymap[i].type = map[i].type; - keymap[i].function = map[i].function; + switch (map[i].type) + { + case ISFUNC: + keymap[i].function = map[i].function; +#if defined(INFOKEY) + ks = find_function_keyseq (map, i, rootmap, NULL); + 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); + break; + } } return (keymap); } /* Free the keymap and its descendants. */ void -keymap_discard_keymap (map) - Keymap (map); +keymap_discard_keymap (map, rootmap) + Keymap map; + Keymap rootmap; { int i; if (!map) return; + if (!rootmap) + rootmap = map; for (i = 0; i < 256; i++) { +#if defined(INFOKEY) + FUNCTION_KEYSEQ *ks; +#endif /* INFOKEY */ switch (map[i].type) { case ISFUNC: +#if defined(INFOKEY) + ks = find_function_keyseq(map, i, rootmap); + if (ks) + remove_function_keyseq (map[i].function, ks->keyseq, rootmap); +#endif /* INFOKEY */ break; case ISKMAP: - keymap_discard_keymap ((Keymap)map[i].function); + keymap_discard_keymap ((Keymap)map[i].function, rootmap); break; } } + free(map); } /* Conditionally bind key sequence. */ @@ -117,27 +224,45 @@ keymap_bind_keyseq (map, keyseq, keyentry) while ((c = *s++) != '\0') { +#if defined(INFOKEY) + FUNCTION_KEYSEQ *ks; +#endif /* INFOKEY */ switch (m[c].type) { case ISFUNC: +#if defined(INFOKEY) + ks = find_function_keyseq(m, c, map); + if (ks) + remove_function_keyseq (m[c].function, ks->keyseq, map); +#else /* !INFOKEY */ if (!(m[c].function == NULL || ( -#if !defined(INFOKEY) m != map && -#endif /* !INFOKEY */ m[c].function == InfoCmd(info_do_lowercase_version)) )) return 0; +#endif /* !INFOKEY */ if (*s != '\0') { m[c].type = ISKMAP; + /* Here we are casting the Keymap pointer returned from + keymap_make_keymap to an InfoCommand pointer. Ugh. + This makes the `function' structure garbage + if it's actually interpreted as an InfoCommand. + Should really be using a union, and taking steps to + avoid the possible error. */ m[c].function = (InfoCommand *)keymap_make_keymap (); } break; case ISKMAP: +#if defined(INFOKEY) + if (*s == '\0') + keymap_discard_keymap ((Keymap)m[c].function, map); +#else /* !INFOKEY */ if (*s == '\0') return 0; +#endif break; } if (*s != '\0') @@ -147,18 +272,7 @@ keymap_bind_keyseq (map, keyseq, keyentry) else { #if defined(INFOKEY) - FUNCTION_KEYSEQ *k; - - for (k = keyentry->function->keys; k && k->map != map; k = k->next) - ; - if (!k) - { - FUNCTION_KEYSEQ *ks = (FUNCTION_KEYSEQ *)xmalloc (sizeof(FUNCTION_KEYSEQ)); - ks->next = keyentry->function->keys; - ks->map = map; - ks->keyseq = xstrdup (keyseq); - keyentry->function->keys = ks; - } + add_function_keyseq (keyentry->function, keyseq, map); #endif /* INFOKEY */ m[c] = *keyentry; } @@ -506,8 +620,8 @@ initialize_vi_like_keymaps () map['b'].function = ea_backward_word; map['d'].function = ea_kill_word; map['f'].function = ea_forward_word; - map['h'].function = ea_forward; - map['l'].function = ea_backward; + map['h'].function = ea_backward; + map['l'].function = ea_forward; map['w'].function = ea_forward_word; map['x'].function = ea_delete; map['X'].function = ea_kill_word; @@ -1722,3 +1836,4 @@ initialize_info_keymaps () } #endif /* defined(INFOKEY) */ +/* vim: set sw=2 cino={1s>2sn-s^-se-s: */ diff --git a/contrib/texinfo/info/nodemenu.c b/contrib/texinfo/info/nodemenu.c index b109057a347c..dad513706f87 100644 --- a/contrib/texinfo/info/nodemenu.c +++ b/contrib/texinfo/info/nodemenu.c @@ -1,7 +1,7 @@ /* nodemenu.c -- produce a menu of all visited nodes. - $Id: nodemenu.c,v 1.8 1998/06/28 19:54:27 karl Exp $ + $Id: nodemenu.c,v 1.1 2002/08/25 23:38:38 karl Exp $ - Copyright (C) 1993, 97, 98 Free Software Foundation, Inc. + Copyright (C) 1993, 1997, 1998, 2002 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 diff --git a/contrib/texinfo/info/session.c b/contrib/texinfo/info/session.c index 56b12f712cb7..7cf95fac631a 100644 --- a/contrib/texinfo/info/session.c +++ b/contrib/texinfo/info/session.c @@ -1,9 +1,8 @@ -/* $FreeBSD$ */ /* session.c -- user windowing interface to Info. - $Id: session.c,v 1.45 2002/03/02 15:05:04 karl Exp $ + $Id: session.c,v 1.3 2003/01/24 19:05:53 karl Exp $ - Copyright (C) 1993, 96, 97, 98, 99, 2000, 01, 02 - Free Software Foundation, Inc. + Copyright (C) 1993, 1996, 1997, 1998, 1999, 2000, 2001, 2002, 2003 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 @@ -3937,7 +3936,7 @@ incremental_search (window, count, ignore) key = info_get_input_char (); window_get_state (window, &mystate); - if (key == DEL) + if (key == DEL || key == Control ('h')) { /* User wants to delete one level of search? */ if (!isearch_states_index) @@ -3968,9 +3967,15 @@ incremental_search (window, count, ignore) if (!Meta_p (key) || key > 32) { - func = InfoFunction(window->keymap[key].function); + /* If this key is not a keymap, get its associated function, + if any. If it is a keymap, then it's probably ESC from an + arrow key, and we handle that case below. */ + char type = window->keymap[key].type; + func = type == ISFUNC + ? InfoFunction(window->keymap[key].function) + : NULL; /* function member is a Keymap if ISKMAP */ - if (isprint (key) || func == (VFunction *)NULL) + if (isprint (key) || (type == ISFUNC && func == NULL)) { insert_and_search: diff --git a/contrib/texinfo/info/terminal.c b/contrib/texinfo/info/terminal.c index adab0908fef7..ff9913aaf911 100644 --- a/contrib/texinfo/info/terminal.c +++ b/contrib/texinfo/info/terminal.c @@ -1,9 +1,8 @@ -/* $FreeBSD$ */ -/* terminal.c -- How to handle the physical terminal for Info. - $Id: terminal.c,v 1.23 2001/11/16 23:16:04 karl Exp $ +/* terminal.c -- how to handle the physical terminal for Info. + $Id: terminal.c,v 1.1 2002/08/25 23:38:38 karl Exp $ - Copyright (C) 1988, 89, 90, 91, 92, 93, 96, 97, 98, 99, 2001 - Free Software Foundation, Inc. + Copyright (C) 1988, 1989, 1990, 1991, 1992, 1993, 1996, 1997, 1998, + 1999, 2001, 2002 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 diff --git a/contrib/texinfo/makeinfo/makeinfo.c b/contrib/texinfo/makeinfo/makeinfo.c index 61affed662b6..725e5de6370c 100644 --- a/contrib/texinfo/makeinfo/makeinfo.c +++ b/contrib/texinfo/makeinfo/makeinfo.c @@ -1,9 +1,8 @@ -/* $FreeBSD$ */ /* makeinfo -- convert Texinfo source into other formats. - $Id: makeinfo.c,v 1.205 2002/03/28 16:33:48 karl Exp $ + $Id: makeinfo.c,v 1.17 2003/01/19 18:44:28 karl Exp $ - Copyright (C) 1987, 92, 93, 94, 95, 96, 97, 98, 99, 2000, 01, 02 - Free Software Foundation, Inc. + Copyright (C) 1987, 1992, 1993, 1994, 1995, 1996, 1997, 1998, 1999, + 2000, 2001, 2002, 2003 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 @@ -135,6 +134,9 @@ int do_justification = 0; /* Nonzero means don't replace whitespace with   in HTML mode. */ int in_html_elt = 0; +/* True when expanding a macro definition. */ +static int executing_macro = 0; + typedef struct brace_element { struct brace_element *next; @@ -372,7 +374,7 @@ usage (exit_value) else { printf (_("Usage: %s [OPTION]... TEXINFO-FILE...\n"), progname); - printf ("\n"); + puts ("\n"); puts (_("\ Translate Texinfo source documentation to various other formats, by default\n\ @@ -389,17 +391,17 @@ General options:\n\ -v, --verbose explain what is being done.\n\ --version display version information and exit.\n"), max_error_level, reference_warning_limit); - printf ("\n"); + puts ("\n"); /* xgettext: no-wrap */ - puts (_("\ + puts (_("\ Output format selection (default is to produce Info):\n\ - --docbook output DocBook rather than Info.\n\ + --docbook output DocBook XML rather than Info.\n\ --html output HTML rather than Info.\n\ - --xml output XML (TexinfoML) rather than Info.\n\ + --xml output Texinfo XML rather than Info.\n\ ")); - puts (_("\ + puts (_("\ General output options:\n\ -E, --macro-expand FILE output macro-expanded source to FILE.\n\ ignoring any @setfilename.\n\ @@ -413,7 +415,7 @@ General output options:\n\ -o, --output=FILE output to FILE (directory if split HTML),\n\ ")); - printf (_("\ + printf (_("\ Options for Info and plain text:\n\ --enable-encoding output accented and special characters in\n\ Info output based on @documentencoding.\n\ @@ -428,10 +430,10 @@ Options for Info and plain text:\n\ --split-size=NUM split Info files at size NUM (default %d).\n"), fill_column, paragraph_start_indent, DEFAULT_SPLIT_SIZE); - } - printf ("\n"); - puts (_("\ + puts ("\n"); + + puts (_("\ Input file options:\n\ --commands-in-node-names allow @ commands in node names.\n\ -D VAR define the variable VAR, as with @set.\n\ @@ -440,30 +442,32 @@ Input file options:\n\ -U VAR undefine the variable VAR, as with @clear.\n\ ")); - puts (_("\ + puts (_("\ Conditional processing in input:\n\ --ifhtml process @ifhtml and @html even if not generating HTML.\n\ --ifinfo process @ifinfo even if not generating Info.\n\ --ifplaintext process @ifplaintext even if not generating plain text.\n\ --iftex process @iftex and @tex; implies --no-split.\n\ + --ifxml process @ifxml and @xml.\n\ --no-ifhtml do not process @ifhtml and @html text.\n\ --no-ifinfo do not process @ifinfo text.\n\ --no-ifplaintext do not process @ifplaintext text.\n\ --no-iftex do not process @iftex and @tex text.\n\ + --no-ifxml do not process @ifxml and @xml text.\n\ ")); - puts (_("\ + puts (_("\ The defaults for the @if... conditionals depend on the output format:\n\ if generating HTML, --ifhtml is on and the others are off;\n\ if generating Info, --ifinfo is on and the others are off;\n\ if generating plain text, --ifplaintext is on and the others are off;\n\ ")); - fputs (_("\ + fputs (_("\ Examples:\n\ makeinfo foo.texi write Info to foo's @setfilename\n\ makeinfo --html foo.texi write HTML to @setfilename\n\ - makeinfo --xml foo.texi write XML to @setfilename\n\ + makeinfo --xml foo.texi write Texinfo XML to @setfilename\n\ makeinfo --docbook foo.texi write DocBook XML to @setfilename\n\ makeinfo --no-headers foo.texi write plain text to standard output\n\ \n\ @@ -472,11 +476,13 @@ Examples:\n\ makeinfo --no-split foo.texi write one Info file however big\n\ "), stdout); - puts (_("\n\ + puts (_("\n\ Email bug reports to bug-texinfo@gnu.org,\n\ general questions and discussion to help-texinfo@gnu.org.\n\ Texinfo home page: http://www.gnu.org/software/texinfo/")); + } /* end of full help */ + xexit (exit_value); } @@ -495,12 +501,14 @@ struct option long_options[] = { "ifinfo", 0, &process_info, 1 }, { "ifplaintext", 0, &process_plaintext, 1 }, { "iftex", 0, &process_tex, 1 }, + { "ifxml", 0, &process_xml, 1 }, { "macro-expand", 1, 0, 'E' }, { "no-headers", 0, &no_headers, 1 }, { "no-ifhtml", 0, &process_html, 0 }, { "no-ifinfo", 0, &process_info, 0 }, { "no-ifplaintext", 0, &process_plaintext, 0 }, { "no-iftex", 0, &process_tex, 0 }, + { "no-ifxml", 0, &process_xml, 0 }, { "no-number-footnotes", 0, &number_footnotes, 0 }, { "no-number-sections", 0, &number_sections, 0 }, { "no-pointer-validate", 0, &validating, 0 }, @@ -560,8 +568,8 @@ main (argc, argv) case 'd': /* --docbook */ splitting = 0; - xml = 1; - docbook = 1; + xml = 1; + docbook = 1; break; case 'e': /* --error-limit */ @@ -670,7 +678,7 @@ main (argc, argv) footnote_style_preset = 1; break; - case 'S': /* --split-size */ + case 'S': /* --split-size */ if (sscanf (optarg, "%d", &split_size) != 1) { fprintf (stderr, @@ -678,7 +686,7 @@ main (argc, argv) "--split-size", progname, optarg); usage (1); } - break; + break; case 'v': verbose_mode++; @@ -691,8 +699,8 @@ main (argc, argv) There is NO warranty. You may redistribute this software\n\ under the terms of the GNU General Public License.\n\ For more information about these matters, see the files named COPYING.\n"), - "2002"); - exit (0); + "2003"); + xexit (0); break; case 'w': /* --html */ @@ -702,7 +710,8 @@ For more information about these matters, see the files named COPYING.\n"), case 'x': /* --xml */ splitting = 0; - xml = 1; + xml = 1; + process_xml = 1; break; case '?': @@ -775,7 +784,20 @@ For more information about these matters, see the files named COPYING.\n"), /* Hacking tokens and strings. */ -/* Return the next token as a string pointer. We cons the string. */ +/* Return the next token as a string pointer. We cons the string. This + `token' means simply a command name. */ + +/* = is so @alias works. ^ and _ are so macros can be used in math mode + without a space following. Possibly we should simply allow alpha, to + be compatible with TeX. */ +#define COMMAND_CHAR(c) (!cr_or_whitespace(c) \ + && (c) != '{' \ + && (c) != '}' \ + && (c) != '=' \ + && (c) != '_' \ + && (c) != '^' \ + ) + char * read_token () { @@ -799,7 +821,7 @@ read_token () for (i = 0; ((input_text_offset != input_text_length) && (character = curchar ()) - && command_char (character)); + && COMMAND_CHAR (character)); i++, input_text_offset++); result = xmalloc (i + 1); memcpy (result, &input_text[input_text_offset - i], i); @@ -1066,7 +1088,7 @@ get_rest_of_line (expand, string) char *tem; /* Don't expand non-macros in input, since we want them - intact in the macro-expanded output. */ + intact in the macro-expanded output. */ only_macro_expansion++; get_until_in_line (1, "\n", &tem); only_macro_expansion--; @@ -1113,7 +1135,7 @@ get_until_in_braces (match, string) { if (i < input_text_length - 1 && input_text[i] == '@') { - i++; /* skip commands like @, and @{ */ + i++; /* skip commands like @, and @{ */ continue; } else if (input_text[i] == '{') @@ -1338,9 +1360,9 @@ insert_toplevel_subdirectory (output_filename) free (output_filename); output_filename = xmalloc (strlen (dir) + 1 - + strlen (basename) + 1 - + index_len - + 1); + + strlen (basename) + 1 + + index_len + + 1); strcpy (output_filename, dir); if (strlen (dir)) strcat (output_filename, "/"); @@ -1354,19 +1376,19 @@ insert_toplevel_subdirectory (output_filename) strcat (output_filename, "/"); strcat (output_filename, basename); if (mkdir (output_filename, 0777) == -1) - { - char *errmsg = strerror (errno); + { + char *errmsg = strerror (errno); - if ((errno == EEXIST + if ((errno == EEXIST #ifdef __MSDOS__ - || errno == EACCES + || errno == EACCES #endif - ) - && (stat (output_filename, &st) == 0 && !S_ISDIR (st.st_mode))) - errmsg = _("File exists, but is not a directory"); + ) + && (stat (output_filename, &st) == 0 && !S_ISDIR (st.st_mode))) + errmsg = _("File exists, but is not a directory"); line_error (_("Can't create directory `%s': %s"), output_filename, errmsg); - exit (1); + xexit (1); } strcat (output_filename, "/"); } @@ -1447,7 +1469,7 @@ convert_from_loaded_file (name) { get_until ("\n", &output_filename); /* read rest of line */ if (xml && !docbook) - xml_begin_document (output_filename); + xml_begin_document (output_filename); if (html || xml) { /* Change any extension to .html or .xml. */ char *html_name, *directory_part, *basename_part, *temp; @@ -1506,11 +1528,11 @@ convert_from_loaded_file (name) { if (html && splitting) { - if (FILENAME_CMP (output_filename, NULL_DEVICE) == 0 - || FILENAME_CMP (output_filename, ALSO_NULL_DEVICE) == 0) - splitting = 0; - else - output_filename = insert_toplevel_subdirectory (output_filename); + if (FILENAME_CMP (output_filename, NULL_DEVICE) == 0 + || FILENAME_CMP (output_filename, ALSO_NULL_DEVICE) == 0) + splitting = 0; + else + output_filename = insert_toplevel_subdirectory (output_filename); real_output_filename = xstrdup (output_filename); } else if (!real_output_filename) @@ -1539,7 +1561,7 @@ convert_from_loaded_file (name) /* Make the displayable filename from output_filename. Only the base portion of the filename need be displayed. */ - flush_output (); /* in case there was no @bye */ + flush_output (); /* in case there was no @bye */ if (output_stream != stdout) pretty_output_filename = filename_part (output_filename); else @@ -1605,7 +1627,7 @@ convert_from_loaded_file (name) close_paragraph (); } - flush_output (); /* in case there was no @bye */ + flush_output (); /* in case there was no @bye */ if (output_stream != stdout) fclose (output_stream); @@ -1615,7 +1637,7 @@ convert_from_loaded_file (name) /* If we need to output the table of contents, do it now. */ if (contents_filename || shortcontents_filename) - toc_update (); + toc_update (); if (splitting && !html && (!errors_printed || force)) split_file (real_output_filename, split_size); @@ -1709,7 +1731,7 @@ handle_menu_entry () if (had_menu_commentary) { - add_word ("