summaryrefslogtreecommitdiffstats
path: root/contrib/texinfo/makeinfo
diff options
context:
space:
mode:
Diffstat (limited to 'contrib/texinfo/makeinfo')
-rw-r--r--contrib/texinfo/makeinfo/cmds.c60
-rw-r--r--contrib/texinfo/makeinfo/defun.c33
-rw-r--r--contrib/texinfo/makeinfo/files.c11
-rw-r--r--contrib/texinfo/makeinfo/files.h3
-rw-r--r--contrib/texinfo/makeinfo/html.c213
-rw-r--r--contrib/texinfo/makeinfo/index.c125
-rw-r--r--contrib/texinfo/makeinfo/insertion.c41
-rw-r--r--contrib/texinfo/makeinfo/lang.c158
-rw-r--r--contrib/texinfo/makeinfo/lang.h12
-rw-r--r--contrib/texinfo/makeinfo/macro.c56
-rw-r--r--contrib/texinfo/makeinfo/makeinfo.c334
-rw-r--r--contrib/texinfo/makeinfo/makeinfo.h49
-rw-r--r--contrib/texinfo/makeinfo/node.c45
-rw-r--r--contrib/texinfo/makeinfo/sectioning.c35
-rw-r--r--contrib/texinfo/makeinfo/xml.c15
15 files changed, 884 insertions, 306 deletions
diff --git a/contrib/texinfo/makeinfo/cmds.c b/contrib/texinfo/makeinfo/cmds.c
index 5ff0b5d..db9472b 100644
--- a/contrib/texinfo/makeinfo/cmds.c
+++ b/contrib/texinfo/makeinfo/cmds.c
@@ -1,5 +1,5 @@
/* cmds.c -- Texinfo commands.
- $Id: cmds.c,v 1.16 2003/01/12 15:18:24 karl Exp $
+ $Id: cmds.c,v 1.18 2003/04/21 01:02:39 karl Exp $
Copyright (C) 1998, 1999, 2000, 2001, 2002, 2003 Free Software
Foundation, Inc.
@@ -56,7 +56,8 @@ void
cm_anchor (), cm_node (), cm_menu (), cm_xref (), cm_ftable (),
cm_vtable (), cm_pxref (), cm_inforef (), cm_uref (), cm_email (),
cm_quotation (), cm_display (), cm_smalldisplay (), cm_itemize (),
- cm_enumerate (), cm_tab (), cm_table (), cm_itemx (), cm_noindent (),
+ cm_enumerate (), cm_tab (), cm_table (), cm_itemx (),
+ cm_noindent (), cm_indent (),
cm_setfilename (), cm_br (), cm_sp (), cm_page (), cm_group (),
cm_center (), cm_ref (), cm_include (), cm_bye (), cm_item (), cm_end (),
cm_kindex (), cm_cindex (), cm_findex (), cm_pindex (), cm_vindex (),
@@ -66,7 +67,8 @@ void
cm_defcodeindex (), cm_result (), cm_expansion (), cm_equiv (),
cm_print (), cm_error (), cm_point (), cm_today (), cm_flushleft (),
cm_flushright (), cm_finalout (), cm_cartouche (), cm_detailmenu (),
- cm_multitable (), cm_settitle (), cm_titlefont (), cm_titlepage (), cm_tie (), cm_tt (),
+ cm_multitable (), cm_settitle (), cm_titlefont (), cm_titlepage (),
+ cm_tie (), cm_tt (),
cm_verbatim (), cm_verbatiminclude ();
/* Conditionals. */
@@ -74,7 +76,10 @@ void cm_set (), cm_clear (), cm_ifset (), cm_ifclear ();
void cm_value (), cm_ifeq ();
/* Options. */
-static void cm_paragraphindent (), cm_exampleindent ();
+static void
+ cm_exampleindent (),
+ cm_firstparagraphindent (),
+ cm_paragraphindent ();
/* Internals. */
static void cm_obsolete ();
@@ -94,6 +99,7 @@ COMMAND command_table[] = {
{ ",", cm_accent_cedilla, MAYBE_BRACE_ARGS },
{ "-", cm_no_op, NO_BRACE_ARGS },
{ ".", insert_self, NO_BRACE_ARGS },
+ { "/", cm_no_op, NO_BRACE_ARGS },
{ ":", cm_no_op, NO_BRACE_ARGS },
{ "=", cm_accent, MAYBE_BRACE_ARGS },
{ "?", insert_self, NO_BRACE_ARGS },
@@ -219,6 +225,7 @@ COMMAND command_table[] = {
{ "file", cm_code, BRACE_ARGS },
{ "finalout", cm_no_op, NO_BRACE_ARGS },
{ "findex", cm_findex, NO_BRACE_ARGS },
+ { "firstparagraphindent", cm_firstparagraphindent, NO_BRACE_ARGS },
{ "flushleft", cm_flushleft, NO_BRACE_ARGS },
{ "flushright", cm_flushright, NO_BRACE_ARGS },
{ "footnote", cm_footnote, NO_BRACE_ARGS}, /* self-arg eater */
@@ -247,6 +254,7 @@ COMMAND command_table[] = {
{ "ignore", command_name_condition, NO_BRACE_ARGS },
{ "image", cm_image, BRACE_ARGS },
{ "include", cm_include, NO_BRACE_ARGS },
+ { "indent", cm_indent, NO_BRACE_ARGS },
{ "inforef", cm_inforef, BRACE_ARGS },
{ "insertcopying", cm_insert_copying, NO_BRACE_ARGS },
{ "item", cm_item, NO_BRACE_ARGS },
@@ -268,7 +276,7 @@ COMMAND command_table[] = {
{ "need", cm_ignore_line, NO_BRACE_ARGS },
{ "node", cm_node, NO_BRACE_ARGS },
{ "noindent", cm_noindent, NO_BRACE_ARGS },
- { "noindent", cm_novalidate, NO_BRACE_ARGS },
+ { "novalidate", cm_novalidate, NO_BRACE_ARGS },
{ "nwnode", cm_node, NO_BRACE_ARGS },
{ "o", cm_special_char, BRACE_ARGS },
{ "oddfooting", cm_ignore_line, NO_BRACE_ARGS },
@@ -985,8 +993,8 @@ cm_obsolete (arg, start, end)
}
-/* This says to inhibit the indentation of the next paragraph, but
- not of following paragraphs. */
+/* Inhibit the indentation of the next paragraph, but not of following
+ paragraphs. */
void
cm_noindent ()
{
@@ -994,10 +1002,17 @@ cm_noindent ()
inhibit_paragraph_indentation = -1;
}
+/* Force indentation of the next paragraph. */
+void
+cm_indent ()
+{
+ inhibit_paragraph_indentation = 0;
+}
+
/* I don't know exactly what to do with this. Should I allow
someone to switch filenames in the middle of output? Since the
file could be partially written, this doesn't seem to make sense.
- Another option: ignore it, since they don't *really* want to
+ Another option: ignore it, since they don't really want to
switch files. Finally, complain, or at least warn. It doesn't
really matter, anyway, since this doesn't get executed. */
void
@@ -1402,6 +1417,7 @@ cm_paragraphindent ()
free (arg);
}
+
/* @exampleindent: change indentation of example-like environments. */
static int
set_default_indentation_increment (string)
@@ -1427,3 +1443,31 @@ cm_exampleindent ()
free (arg);
}
+
+
+/* @firstparagraphindent: suppress indentation in first paragraphs after
+ headings. */
+static int
+set_firstparagraphindent (string)
+ char *string;
+{
+ if (STREQ (string, "insert") || STREQ (string, _("insert")))
+ do_first_par_indent = 1;
+ else if (STREQ (string, "none") || STREQ (string, _("none")))
+ do_first_par_indent = 0;
+ else
+ return -1;
+ return 0;
+}
+
+static void
+cm_firstparagraphindent ()
+{
+ char *arg;
+
+ get_rest_of_line (1, &arg);
+ if (set_firstparagraphindent (arg) != 0)
+ line_error (_("Bad argument to %c%s"), COMMAND_PREFIX, command);
+
+ free (arg);
+}
diff --git a/contrib/texinfo/makeinfo/defun.c b/contrib/texinfo/makeinfo/defun.c
index ce56059..992cf3b 100644
--- a/contrib/texinfo/makeinfo/defun.c
+++ b/contrib/texinfo/makeinfo/defun.c
@@ -1,7 +1,8 @@
/* defun.c -- @defun and friends.
- $Id: defun.c,v 1.3 2002/11/11 00:57:49 feloy Exp $
+ $Id: defun.c,v 1.6 2003/05/09 23:51:10 karl Exp $
- Copyright (C) 1998, 1999, 2000, 2001, 2002 Free Software Foundation, Inc.
+ Copyright (C) 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
@@ -331,7 +332,8 @@ defun_internal (type, x_p)
{
enum insertion_type base_type;
char **defun_args, **scan_args;
- char *category, *defined_name, *type_name, *type_name2;
+ const char *category;
+ char *defined_name, *type_name, *type_name2;
{
char *line;
@@ -441,7 +443,7 @@ defun_internal (type, x_p)
if (*scan_args && **scan_args && **scan_args == '(')
warning ("`%c' follows defined name `%s' instead of whitespace",
**scan_args, defined_name);
-
+
if (!x_p)
begin_insertion (type);
@@ -559,7 +561,7 @@ defun_internal (type, x_p)
break;
case deftypefn:
case deftypevr:
- execute_string ("%s", type_name);
+ execute_string ("%s ", type_name);
xml_insert_element (FUNCTION, START);
execute_string ("%s", defined_name);
xml_insert_element (FUNCTION, END);
@@ -567,7 +569,7 @@ defun_internal (type, x_p)
case deftypemethod:
case deftypeop:
case deftypeivar:
- execute_string ("%s", type_name2);
+ execute_string ("%s ", type_name2);
xml_insert_element (FUNCTION, START);
execute_string ("%s", defined_name);
xml_insert_element (FUNCTION, END);
@@ -713,27 +715,26 @@ defun_internal (type, x_p)
void
cm_defun ()
{
- int x_p;
enum insertion_type type;
- char *temp = xstrdup (command);
-
- x_p = (command[strlen (command) - 1] == 'x');
+ char *base_command = xstrdup (command); /* command with any `x' removed */
+ int x_p = (command[strlen (command) - 1] == 'x');
if (x_p)
- temp[strlen (temp) - 1] = 0;
+ base_command[strlen (base_command) - 1] = 0;
- type = find_type_from_name (temp);
- free (temp);
+ type = find_type_from_name (base_command);
/* If we are adding to an already existing insertion, then make sure
that we are already in an insertion of type TYPE. */
if (x_p && (!insertion_level || insertion_stack->insertion != type))
{
- line_error (_("Must be in `%s' insertion to use `%sx'"),
- command, command);
+ line_error (_("Must be in `@%s' environment to use `@%s'"),
+ base_command, command);
discard_until ("\n");
return;
}
+ else
+ defun_internal (type, x_p);
- defun_internal (type, x_p);
+ free (base_command);
}
diff --git a/contrib/texinfo/makeinfo/files.c b/contrib/texinfo/makeinfo/files.c
index 2c3fc10..a6a69d2 100644
--- a/contrib/texinfo/makeinfo/files.c
+++ b/contrib/texinfo/makeinfo/files.c
@@ -1,7 +1,8 @@
/* files.c -- file-related functions for makeinfo.
- $Id: files.c,v 1.1 2002/08/25 23:38:38 karl Exp $
+ $Id: files.c,v 1.3 2003/03/06 14:05:30 karl Exp $
- Copyright (C) 1998, 1999, 2000, 2001, 2002 Free Software Foundation, Inc.
+ Copyright (C) 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
@@ -82,7 +83,7 @@ extract_colon_unit (string, index)
When found, return the stat () info for FILENAME in FINFO.
If PATH is NULL, only the current directory is searched.
If the file could not be found, return a NULL pointer. */
-static char *
+char *
get_file_info_in_path (filename, path, finfo)
char *filename, *path;
struct stat *finfo;
@@ -322,9 +323,7 @@ filename_part (filename)
#ifdef REMOVE_OUTPUT_EXTENSIONS
/* See if there is an extension to remove. If so, remove it. */
{
- char *temp;
-
- temp = strrchr (basename, '.');
+ char *temp = strrchr (basename, '.');
if (temp)
*temp = 0;
}
diff --git a/contrib/texinfo/makeinfo/files.h b/contrib/texinfo/makeinfo/files.h
index e2a1069..0e1cde3 100644
--- a/contrib/texinfo/makeinfo/files.h
+++ b/contrib/texinfo/makeinfo/files.h
@@ -1,5 +1,5 @@
/* files.h -- declarations for files.c.
- $Id: files.h,v 1.1 2002/08/25 23:38:38 karl Exp $
+ $Id: files.h,v 1.2 2003/03/06 14:05:30 karl Exp $
Copyright (C) 1998, 2002 Free Software Foundation, Inc.
@@ -36,6 +36,7 @@ extern FSTACK *filestack;
extern void pushfile (), popfile ();
extern void flush_file_stack ();
+extern char *get_file_info_in_path ();
extern char *find_and_load ();
extern char *output_name_from_input_name ();
extern char *expand_filename ();
diff --git a/contrib/texinfo/makeinfo/html.c b/contrib/texinfo/makeinfo/html.c
index 51960fc..0c06c6c 100644
--- a/contrib/texinfo/makeinfo/html.c
+++ b/contrib/texinfo/makeinfo/html.c
@@ -1,7 +1,7 @@
/* html.c -- html-related utilities.
- $Id: html.c,v 1.8 2002/11/04 22:14:40 karl Exp $
+ $Id: html.c,v 1.18 2003/06/02 12:32:29 karl Exp $
- Copyright (C) 1999, 2000, 2001, 2002 Free Software Foundation, Inc.
+ Copyright (C) 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
@@ -26,14 +26,17 @@
HSTACK *htmlstack = NULL;
+static char *process_css_file (/* char * */);
+
/* See html.h. */
int html_output_head_p = 0;
int html_title_written = 0;
+
void
html_output_head ()
{
- static char *html_title = NULL;
+ static const char *html_title = NULL;
if (html_output_head_p)
return;
@@ -49,7 +52,7 @@ html_output_head ()
add_word ("<meta http-equiv=\"Content-Type\" content=\"text/html");
if (document_encoding_code != no_encoding)
add_word_args ("; charset=%s",
- encoding_table[document_encoding_code].ecname);
+ encoding_table[document_encoding_code].encname);
add_word ("\">\n");
if (!document_description)
@@ -59,8 +62,12 @@ html_output_head ()
document_description);
add_word_args ("<meta name=\"generator\" content=\"makeinfo %s\">\n",
VERSION);
+#if 0
+ /* let's not do this now, since it causes mozilla to put up a
+ navigation bar. */
add_word ("<link href=\"http://www.gnu.org/software/texinfo/\" \
rel=\"generator-home\">\n");
+#endif
if (copying_text)
{ /* copying_text has already been fully expanded in
@@ -73,6 +80,44 @@ rel=\"generator-home\">\n");
insert_string ("-->\n");
}
+ /* Put the style definitions in a comment for the sake of browsers
+ that don't support <style>. */
+ add_word ("<meta http-equiv=\"Content-Style-Type\" content=\"text/css\">\n");
+ add_word ("<style type=\"text/css\"><!--\n");
+
+ {
+ char *css_inline = NULL;
+
+ if (css_include)
+ /* This writes out any @import commands from the --css-file,
+ and returns any actual css code following the imports. */
+ css_inline = process_css_file (css_include);
+
+ /* This seems cleaner than adding <br>'s at the end of each line for
+ these "roman" displays. It's hardly the end of the world if the
+ browser doesn't do <style>s, in any case; they'll just come out in
+ typewriter. */
+#define CSS_FONT_INHERIT "font-family:inherit"
+ add_word_args (" pre.display { %s }\n", CSS_FONT_INHERIT);
+ add_word_args (" pre.format { %s }\n", CSS_FONT_INHERIT);
+
+ /* Alternatively, we could do <font size=-1> in insertion.c, but this
+ way makes it easier to override. */
+#define CSS_FONT_SMALLER "font-size:smaller"
+ add_word_args (" pre.smalldisplay { %s; %s }\n", CSS_FONT_INHERIT,
+ CSS_FONT_SMALLER);
+ add_word_args (" pre.smallformat { %s; %s }\n", CSS_FONT_INHERIT,
+ CSS_FONT_SMALLER);
+ add_word_args (" pre.smallexample { %s }\n", CSS_FONT_SMALLER);
+ add_word_args (" pre.smalllisp { %s }\n", CSS_FONT_SMALLER);
+
+ /* Write out any css code from the user's --css-file. */
+ if (css_inline)
+ add_word (css_inline);
+
+ add_word ("--></style>\n");
+ }
+
add_word ("</head>\n<body>\n");
if (title && !html_title_written && titlepage_cmd_present)
@@ -82,6 +127,158 @@ rel=\"generator-home\">\n");
}
}
+
+
+/* Append CHAR to BUFFER, (re)allocating as necessary. We don't handle
+ null characters. */
+
+typedef struct
+{
+ unsigned size; /* allocated */
+ unsigned length; /* used */
+ char *buffer;
+} buffer_type;
+
+
+static buffer_type *
+init_buffer ()
+{
+ buffer_type *buf = xmalloc (sizeof (buffer_type));
+ buf->length = 0;
+ buf->size = 0;
+ buf->buffer = NULL;
+
+ return buf;
+}
+
+
+static void
+append_char (buf, c)
+ buffer_type *buf;
+ int c;
+{
+ buf->length++;
+ if (buf->length >= buf->size)
+ {
+ buf->size += 100;
+ buf->buffer = xrealloc (buf->buffer, buf->size);
+ }
+ buf->buffer[buf->length - 1] = c;
+ buf->buffer[buf->length] = 0;
+}
+
+
+/* Read the cascading style-sheet file FILENAME. Write out any @import
+ commands, which must come first, by the definition of css. If the
+ file contains any actual css code following the @imports, return it;
+ else return NULL. */
+
+static char *
+process_css_file (filename)
+ char *filename;
+{
+ int c, lastchar;
+ FILE *f;
+ buffer_type *import_text = init_buffer ();
+ buffer_type *inline_text = init_buffer ();
+ unsigned lineno = 1;
+ enum { null_state, comment_state, import_state, inline_state } state
+ = null_state, prev_state;
+
+ /* read from stdin if `-' is the filename. */
+ f = STREQ (filename, "-") ? stdin : fopen (filename, "r");
+ if (!f)
+ {
+ error (_("%s: could not open --css-file: %s"), progname, filename);
+ return NULL;
+ }
+
+ /* Read the file. The @import statements must come at the beginning,
+ with only whitespace and comments allowed before any inline css code. */
+ while ((c = getc (f)) >= 0)
+ {
+ if (c == '\n')
+ lineno++;
+
+ switch (state)
+ {
+ case null_state: /* between things */
+ if (c == '@')
+ {
+ /* If there's some other @command, just call it an
+ import, it's all the same to us. So don't bother
+ looking for the `import'. */
+ append_char (import_text, c);
+ state = import_state;
+ }
+ else if (c == '/')
+ { /* possible start of a comment */
+ int nextchar = getc (f);
+ if (nextchar == '*')
+ state = comment_state;
+ else
+ {
+ ungetc (nextchar, f); /* wasn't a comment */
+ state = inline_state;
+ }
+ }
+ else if (isspace (c))
+ ; /* skip whitespace; maybe should use c_isspace? */
+
+ else
+ /* not an @import, not a comment, not whitespace: we must
+ have started the inline text. */
+ state = inline_state;
+
+ if (state == inline_state)
+ append_char (inline_text, c);
+
+ if (state != null_state)
+ prev_state = null_state;
+ break;
+
+ case comment_state:
+ if (c == '/' && lastchar == '*')
+ state = prev_state; /* end of comment */
+ break; /* else ignore this comment char */
+
+ case import_state:
+ append_char (import_text, c); /* include this import char */
+ if (c == ';')
+ { /* done with @import */
+ append_char (import_text, '\n'); /* make the output nice */
+ state = null_state;
+ prev_state = import_state;
+ }
+ break;
+
+ case inline_state:
+ /* No harm in writing out comments, so don't bother parsing
+ them out, just append everything. */
+ append_char (inline_text, c);
+ break;
+ }
+
+ lastchar = c;
+ }
+
+ /* Reached the end of the file. We should not be still in a comment. */
+ if (state == comment_state)
+ warning (_("%s:%d: --css-file ended in comment"), filename, lineno);
+
+ /* Write the @import text, if any. */
+ if (import_text->buffer)
+ {
+ add_word (import_text->buffer);
+ free (import_text->buffer);
+ free (import_text);
+ }
+
+ /* We're wasting the buffer struct memory, but so what. */
+ return inline_text->buffer;
+}
+
+
/* Escape HTML special characters in the string if necessary,
returning a pointer to a possibly newly-allocated one. */
@@ -139,6 +336,8 @@ escape_string (string)
free (string);
return newstring - newlen;
}
+
+
/* Save current tag. */
void
@@ -187,7 +386,7 @@ insert_html_tag (start_or_end, tag)
}
if (start_or_end != START)
- pop_tag (tag);
+ pop_tag ();
if (htmlstack)
old_tag = htmlstack->tag;
@@ -228,6 +427,8 @@ insert_html_tag (start_or_end, tag)
}
}
+
+
/* Output an HTML <link> to the filename for NODE, including the
other string as extra attributes. */
void
@@ -240,7 +441,7 @@ add_link (nodename, attributes)
add_word_args ("%s", attributes);
add_word_args (" href=\"");
add_anchor_name (nodename, 1);
- add_word ("\"></a>\n");
+ add_word ("\">\n");
}
}
diff --git a/contrib/texinfo/makeinfo/index.c b/contrib/texinfo/makeinfo/index.c
index 05c883c..ab6a53c 100644
--- a/contrib/texinfo/makeinfo/index.c
+++ b/contrib/texinfo/makeinfo/index.c
@@ -1,7 +1,7 @@
/* index.c -- indexing for Texinfo.
- $Id: index.c,v 1.4 2002/11/26 22:54:31 karl Exp $
+ $Id: index.c,v 1.8 2003/05/16 23:52:40 karl Exp $
- Copyright (C) 1998, 1999, 2002 Free Software Foundation, Inc.
+ Copyright (C) 1998, 1999, 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
@@ -342,9 +342,14 @@ init_indices ()
here; otherwise, when we try to define the pg index again
just below, it will still point to cp. */
undefindex (name_index_alist[i]->name);
- free (name_index_alist[i]->name);
- free (name_index_alist[i]);
- name_index_alist[i] = NULL;
+
+ /* undefindex sets all this to null in some cases. */
+ if (name_index_alist[i])
+ {
+ free (name_index_alist[i]->name);
+ free (name_index_alist[i]);
+ name_index_alist[i] = NULL;
+ }
}
}
@@ -551,16 +556,16 @@ make_index_entries_unique (array, count)
free (copy);
}
-/* Sort the index passed in INDEX, returning an array of
- pointers to elements. The array is terminated with a NULL
- pointer. We call qsort because it's supposed to be fast.
- I think this looks bad. */
+
+/* Sort the index passed in INDEX, returning an array of pointers to
+ elements. The array is terminated with a NULL pointer. */
+
INDEX_ELT **
sort_index (index)
INDEX_ELT *index;
{
INDEX_ELT **array;
- INDEX_ELT *temp = index;
+ INDEX_ELT *temp;
int count = 0;
int save_line_number = line_number;
char *save_input_filename = input_filename;
@@ -573,35 +578,36 @@ sort_index (index)
characters @AE{} etc., to sort incorrectly. */
html = 0;
- while (temp)
- {
- count++;
- temp = temp->next;
- }
-
- /* We have the length. Make an array. */
-
+ for (temp = index, count = 0; temp; temp = temp->next, count++)
+ ;
+ /* We have the length, now we can allocate an array. */
array = xmalloc ((count + 1) * sizeof (INDEX_ELT *));
- count = 0;
- temp = index;
- while (temp)
+ for (temp = index, count = 0; temp; temp = temp->next, count++)
{
- array[count++] = temp;
+ /* Allocate new memory for the return array, since parts of the
+ original INDEX get freed. Otherwise, if the document calls
+ @printindex twice on the same index, with duplicate entries,
+ we'll have garbage the second time. There are cleaner ways to
+ deal, but this will suffice for now. */
+ array[count] = xmalloc (sizeof (INDEX_ELT));
+ *(array[count]) = *(temp); /* struct assignment, hope it's ok */
+
+ /* Adjust next pointers to use the new memory. */
+ if (count > 0)
+ array[count-1]->next = array[count];
/* Set line number and input filename to the source line for this
index entry, as this expansion finds any errors. */
- line_number = array[count - 1]->defining_line;
- input_filename = array[count - 1]->defining_file;
+ line_number = array[count]->defining_line;
+ input_filename = array[count]->defining_file;
/* If this particular entry should be printed as a "code" index,
- then expand it as @code{entry}, i.e. as in fixed-width font. */
- array[count-1]->entry = expansion (temp->entry_text,
- array[count-1]->code);
-
- temp = temp->next;
+ then expand it as @code{entry}, i.e., as in fixed-width font. */
+ array[count]->entry = expansion (temp->entry_text, array[count]->code);
}
array[count] = NULL; /* terminate the array. */
+
line_number = save_line_number;
input_filename = save_input_filename;
html = save_html;
@@ -619,11 +625,19 @@ sort_index (index)
if (lang_env && !STREQ (lang_env, "C") && !STREQ (lang_env, "POSIX"))
index_compare_fn = strcoll;
}
-#endif /* HAVE_STRCOLL */
+#endif /* HAVE_STRCOLL */
/* Sort the array. */
qsort (array, count, sizeof (INDEX_ELT *), index_element_compare);
+
+ /* Remove duplicate entries. */
make_index_entries_unique (array, count);
+
+ /* Replace the original index with the sorted one, in case the
+ document wants to print it again. If the index wasn't empty. */
+ if (index)
+ *index = **array;
+
return array;
}
@@ -667,11 +681,11 @@ cm_printindex ()
free (index_name);
return;
}
-
+
/* Do this before sorting, so execute_string is in the good environment */
if (xml && docbook)
xml_begin_index ();
-
+
/* Do this before sorting, so execute_string in index_element_compare
will give the same results as when we actually print. */
printing_index = 1;
@@ -685,25 +699,25 @@ cm_printindex ()
add_word_args ("<ul class=\"index-%s\" compact>", index_name);
else if (!no_headers && !docbook)
add_word ("* Menu:\n\n");
-
+
me_inhibit_expansion++;
-
+
/* This will probably be enough. */
line_length = 100;
line = xmalloc (line_length);
-
+
for (item = 0; (index = array[item]); item++)
{
/* A pathological document might have an index entry outside of any
node. Don't crash; try using the section name instead. */
- char *index_node = index->node;
-
+ const char *index_node = index->node;
+
line_number = index->defining_line;
input_filename = index->defining_file;
-
+
if ((!index_node || !*index_node) && html)
index_node = toc_find_section_of_node (index_node);
-
+
if (!index_node || !*index_node)
{
line_error (_("Entry for index `%s' outside of any node"),
@@ -711,7 +725,7 @@ cm_printindex ()
if (html || !no_headers)
index_node = _("(outside of any node)");
}
-
+
if (html)
/* fixme: html: we should use specific index anchors pointing
to the actual location of the indexed position (but then we
@@ -728,7 +742,7 @@ cm_printindex ()
expand the original entry text here. */
char *escaped_entry = xstrdup (index->entry_text);
char *expanded_entry;
-
+
/* expansion() doesn't HTML-escape the argument, so need
to do it separately. */
escaped_entry = escape_string (escaped_entry);
@@ -741,12 +755,14 @@ cm_printindex ()
if (index->node && *index->node)
{
/* Make sure any non-macros in the node name are expanded. */
+ char *expanded_index;
+
in_fixed_width_font++;
- index_node = expansion (index_node, 0);
+ expanded_index = expansion (index_node, 0);
in_fixed_width_font--;
- add_anchor_name (index_node, 1);
- add_word_args ("\">%s</a>", index_node);
- free (index_node);
+ add_anchor_name (expanded_index, 1);
+ add_word_args ("\">%s</a>", expanded_index);
+ free (expanded_index);
}
else if (STREQ (index_node, _("(outside of any node)")))
{
@@ -769,11 +785,11 @@ cm_printindex ()
else
{
unsigned new_length = strlen (index->entry);
-
+
if (new_length < 50) /* minimum length used below */
new_length = 50;
new_length += strlen (index_node) + 7; /* * : .\n\0 */
-
+
if (new_length > line_length)
{
line_length = new_length;
@@ -800,7 +816,7 @@ cm_printindex ()
index. Instead, output the number or name of the
section that corresponds to that node. */
char *section_name = toc_find_section_of_node (index_node);
-
+
sprintf (line, "%-*s ", number_sections ? 50 : 1, index->entry);
line[strlen (index->entry)] = ':';
insert_string (line);
@@ -808,13 +824,13 @@ cm_printindex ()
{
int idx = 0;
unsigned ref_len = strlen (section_name) + 30;
-
+
if (ref_len > line_length)
{
line_length = ref_len;
line = xrealloc (line, line_length);
}
-
+
if (number_sections)
{
while (section_name[idx]
@@ -835,7 +851,7 @@ cm_printindex ()
}
}
}
-
+
/* Prevent `output_paragraph' from growing to the size of the
whole index. */
flush_output ();
@@ -844,17 +860,16 @@ cm_printindex ()
free (line);
free (index_name);
-
+
me_inhibit_expansion--;
-
printing_index = 0;
- free (array);
+
close_single_paragraph ();
filling_enabled = saved_filling_enabled;
inhibit_paragraph_indentation = saved_inhibit_paragraph_indentation;
input_filename = saved_input_filename;
line_number = saved_line_number;
-
+
if (html)
add_word ("</ul>");
else if (xml && docbook)
diff --git a/contrib/texinfo/makeinfo/insertion.c b/contrib/texinfo/makeinfo/insertion.c
index ecc0f66..95c0be2 100644
--- a/contrib/texinfo/makeinfo/insertion.c
+++ b/contrib/texinfo/makeinfo/insertion.c
@@ -1,5 +1,5 @@
/* insertion.c -- insertions for Texinfo.
- $Id: insertion.c,v 1.14 2003/01/02 23:46:29 karl Exp $
+ $Id: insertion.c,v 1.21 2003/04/01 14:34:18 karl Exp $
Copyright (C) 1998, 1999, 2000, 2001, 2002, 2003 Free Software
Foundation, Inc.
@@ -130,8 +130,21 @@ char *
get_item_function ()
{
char *item_function;
+ char *item_loc;
+
get_rest_of_line (0, &item_function);
+ /* If the document erroneously says
+ @itemize @bullet @item foobar
+ it's nicer to give an error up front than repeat `@bullet expected
+ braces' until we get a segmentation fault. */
+ item_loc = strstr (item_function, "@item");
+ if (item_loc)
+ {
+ line_error (_("@item not allowed in argument to @itemize"));
+ *item_loc = 0;
+ }
+
/* If we hit the end of text in get_rest_of_line, backing up
input pointer will cause the last character of the last line
be pushed back onto the input, which is wrong. */
@@ -191,7 +204,7 @@ pop_insertion ()
/* Return a pointer to the print name of this
enumerated type. */
-char *
+const char *
insertion_type_pname (type)
enum insertion_type type;
{
@@ -643,8 +656,14 @@ begin_insertion (type)
close_single_paragraph ();
break;
- /* Insertions that are no-ops in info, but do something in TeX. */
case cartouche:
+ if (html)
+ add_word ("<table class=\"cartouche\" border=1><tr><td>\n");
+ if (in_menu)
+ no_discard++;
+ break;
+
+ /* Insertions that are no-ops in info, but do something in TeX. */
case ifclear:
case ifhtml:
case ifinfo:
@@ -845,7 +864,7 @@ end_insertion (type)
case menu:
in_menu--; /* No longer hacking menus. */
- if (html)
+ if (html && !no_headers)
add_word ("</ul>\n");
else if (!no_headers)
close_insertion_paragraph ();
@@ -869,8 +888,13 @@ end_insertion (type)
close_insertion_paragraph ();
break;
- case group:
case cartouche:
+ if (html)
+ add_word ("</td></tr></table>\n");
+ close_insertion_paragraph ();
+ break;
+
+ case group:
close_insertion_paragraph ();
break;
@@ -981,7 +1005,7 @@ discard_insertions (specials_ok)
break;
else
{
- char *offender = insertion_type_pname (insertion_stack->insertion);
+ const char *offender = insertion_type_pname (insertion_stack->insertion);
file_line_error (insertion_stack->filename,
insertion_stack->line_number,
@@ -1643,9 +1667,10 @@ cm_item ()
in this context, but I cannot find any way to force
them all render exactly one blank line. */
if (!itemx_flag
- && strncmp ((char *) output_paragraph
+ && ((output_paragraph_offset < sizeof (dl_tag) + 1)
+ || strncmp ((char *) output_paragraph
+ output_paragraph_offset - sizeof (dl_tag) + 1,
- dl_tag, sizeof (dl_tag) - 1) != 0)
+ dl_tag, sizeof (dl_tag) - 1) != 0))
add_word ("<br>");
add_word ("<dt>");
diff --git a/contrib/texinfo/makeinfo/lang.c b/contrib/texinfo/makeinfo/lang.c
index a9cbfe1..2938196 100644
--- a/contrib/texinfo/makeinfo/lang.c
+++ b/contrib/texinfo/makeinfo/lang.c
@@ -1,7 +1,7 @@
/* lang.c -- language-dependent support.
- $Id: lang.c,v 1.5 2002/11/12 18:48:52 feloy Exp $
+ $Id: lang.c,v 1.8 2003/05/01 00:05:27 karl Exp $
- Copyright (C) 1999, 2000, 2001, 2002 Free Software Foundation, Inc.
+ Copyright (C) 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
@@ -31,12 +31,12 @@ encoding_code_type document_encoding_code = no_encoding;
/* Current language code; default is English. */
language_code_type language_code = en;
-iso_map_type us_ascii_map [] = {{NULL, 0, 0}}; /* ASCII map is trivial */
+static iso_map_type us_ascii_map [] = {{NULL, 0, 0}}; /* ASCII map is trivial */
/* Translation table between HTML and ISO Codes. The last item is
hopefully the Unicode. It might be possible that those Unicodes are
not correct, cause I didn't check them. kama */
-iso_map_type iso8859_1_map [] = {
+static iso_map_type iso8859_1_map [] = {
{ "nbsp", 0xA0, 0x00A0 },
{ "iexcl", 0xA1, 0x00A1 },
{ "cent", 0xA2, 0x00A2 },
@@ -86,7 +86,7 @@ iso_map_type iso8859_1_map [] = {
{ "Iacute", 0xCD, 0x00CD },
{ "Icirc", 0xCE, 0x00CE },
{ "Iuml", 0xCF, 0x00CF },
- { "ETH", 0xD0, 0x00D0 }, /* I don't know ;-( */
+ { "ETH", 0xD0, 0x00D0 },
{ "Ntilde", 0xD1, 0x00D1 },
{ "Ograve", 0xD2, 0x00D2 },
{ "Oacute", 0xD3, 0x00D3 },
@@ -137,11 +137,133 @@ iso_map_type iso8859_1_map [] = {
{ NULL, 0, 0 }
};
+
+
+/* Date: Mon, 31 Mar 2003 00:19:28 +0200
+ From: Wojciech Polak <polak@gnu.org>
+...
+ * Primary Polish site for ogonki is http://www.agh.edu.pl/ogonki/,
+ but it's only in Polish language (it has some interesting links).
+
+ * A general site about ISO 8859-2 at http://nl.ijs.si/gnusl/cee/iso8859-2.html
+
+ * ISO 8859-2 Character Set at http://nl.ijs.si/gnusl/cee/charset.html
+ This site provides almost all information about iso-8859-2,
+ including the character table!!! (must see!)
+
+ * ISO 8859-2 and even HTML entities !!! (must see!)
+ http://people.ssh.fi/mtr/genscript/88592.txt
+
+ * (minor) http://www.agh.edu.pl/ogonki/plchars.html
+ One more table, this time it includes even information about Polish
+ characters in Unicode.
+*/
+
+static iso_map_type iso8859_2_map [] = {
+ { "nbsp", 0xA0, 0x00A0 }, /* NO-BREAK SPACE */
+ { "", 0xA1, 0x0104 }, /* LATIN CAPITAL LETTER A WITH OGONEK */
+ { "", 0xA2, 0x02D8 }, /* BREVE */
+ { "", 0xA3, 0x0141 }, /* LATIN CAPITAL LETTER L WITH STROKE */
+ { "curren", 0xA4, 0x00A4 }, /* CURRENCY SIGN */
+ { "", 0xA5, 0x013D }, /* LATIN CAPITAL LETTER L WITH CARON */
+ { "", 0xA6, 0x015A }, /* LATIN CAPITAL LETTER S WITH ACUTE */
+ { "sect", 0xA7, 0x00A7 }, /* SECTION SIGN */
+ { "uml", 0xA8, 0x00A8 }, /* DIAERESIS */
+ { "", 0xA9, 0x0160 }, /* LATIN CAPITAL LETTER S WITH CARON */
+ { "", 0xAA, 0x015E }, /* LATIN CAPITAL LETTER S WITH CEDILLA */
+ { "", 0xAB, 0x0164 }, /* LATIN CAPITAL LETTER T WITH CARON */
+ { "", 0xAC, 0x0179 }, /* LATIN CAPITAL LETTER Z WITH ACUTE */
+ { "shy", 0xAD, 0x00AD }, /* SOFT HYPHEN */
+ { "", 0xAE, 0x017D }, /* LATIN CAPITAL LETTER Z WITH CARON */
+ { "", 0xAF, 0x017B }, /* LATIN CAPITAL LETTER Z WITH DOT ABOVE */
+ { "deg", 0xB0, 0x00B0 }, /* DEGREE SIGN */
+ { "", 0xB1, 0x0105 }, /* LATIN SMALL LETTER A WITH OGONEK */
+ { "", 0xB2, 0x02DB }, /* OGONEK */
+ { "", 0xB3, 0x0142 }, /* LATIN SMALL LETTER L WITH STROKE */
+ { "acute", 0xB4, 0x00B4 }, /* ACUTE ACCENT */
+ { "", 0xB5, 0x013E }, /* LATIN SMALL LETTER L WITH CARON */
+ { "", 0xB6, 0x015B }, /* LATIN SMALL LETTER S WITH ACUTE */
+ { "", 0xB7, 0x02C7 }, /* CARON (Mandarin Chinese third tone) */
+ { "cedil", 0xB8, 0x00B8 }, /* CEDILLA */
+ { "", 0xB9, 0x0161 }, /* LATIN SMALL LETTER S WITH CARON */
+ { "", 0xBA, 0x015F }, /* LATIN SMALL LETTER S WITH CEDILLA */
+ { "", 0xBB, 0x0165 }, /* LATIN SMALL LETTER T WITH CARON */
+ { "", 0xBC, 0x017A }, /* LATIN SMALL LETTER Z WITH ACUTE */
+ { "", 0xBD, 0x02DD }, /* DOUBLE ACUTE ACCENT */
+ { "", 0xBE, 0x017E }, /* LATIN SMALL LETTER Z WITH CARON */
+ { "", 0xBF, 0x017C }, /* LATIN SMALL LETTER Z WITH DOT ABOVE */
+ { "", 0xC0, 0x0154 }, /* LATIN CAPITAL LETTER R WITH ACUTE */
+ { "", 0xC1, 0x00C1 }, /* LATIN CAPITAL LETTER A WITH ACUTE */
+ { "", 0xC2, 0x00C2 }, /* LATIN CAPITAL LETTER A WITH CIRCUMFLEX */
+ { "", 0xC3, 0x0102 }, /* LATIN CAPITAL LETTER A WITH BREVE */
+ { "", 0xC4, 0x00C4 }, /* LATIN CAPITAL LETTER A WITH DIAERESIS */
+ { "", 0xC5, 0x0139 }, /* LATIN CAPITAL LETTER L WITH ACUTE */
+ { "", 0xC6, 0x0106 }, /* LATIN CAPITAL LETTER C WITH ACUTE */
+ { "", 0xC7, 0x00C7 }, /* LATIN CAPITAL LETTER C WITH CEDILLA */
+ { "", 0xC8, 0x010C }, /* LATIN CAPITAL LETTER C WITH CARON */
+ { "", 0xC9, 0x00C9 }, /* LATIN CAPITAL LETTER E WITH ACUTE */
+ { "", 0xCA, 0x0118 }, /* LATIN CAPITAL LETTER E WITH OGONEK */
+ { "", 0xCB, 0x00CB }, /* LATIN CAPITAL LETTER E WITH DIAERESIS */
+ { "", 0xCC, 0x011A }, /* LATIN CAPITAL LETTER E WITH CARON */
+ { "", 0xCD, 0x00CD }, /* LATIN CAPITAL LETTER I WITH ACUTE */
+ { "", 0xCE, 0x00CE }, /* LATIN CAPITAL LETTER I WITH CIRCUMFLEX */
+ { "", 0xCF, 0x010E }, /* LATIN CAPITAL LETTER D WITH CARON */
+ { "", 0xD0, 0x0110 }, /* LATIN CAPITAL LETTER D WITH STROKE */
+ { "", 0xD1, 0x0143 }, /* LATIN CAPITAL LETTER N WITH ACUTE */
+ { "", 0xD2, 0x0147 }, /* LATIN CAPITAL LETTER N WITH CARON */
+ { "", 0xD3, 0x00D3 }, /* LATIN CAPITAL LETTER O WITH ACUTE */
+ { "", 0xD4, 0x00D4 }, /* LATIN CAPITAL LETTER O WITH CIRCUMFLEX */
+ { "", 0xD5, 0x0150 }, /* LATIN CAPITAL LETTER O WITH DOUBLE ACUTE */
+ { "", 0xD6, 0x00D6 }, /* LATIN CAPITAL LETTER O WITH DIAERESIS */
+ { "times", 0xD7, 0x00D7 }, /* MULTIPLICATION SIGN */
+ { "", 0xD8, 0x0158 }, /* LATIN CAPITAL LETTER R WITH CARON */
+ { "", 0xD9, 0x016E }, /* LATIN CAPITAL LETTER U WITH RING ABOVE */
+ { "", 0xDA, 0x00DA }, /* LATIN CAPITAL LETTER U WITH ACUTE */
+ { "", 0xDB, 0x0170 }, /* LATIN CAPITAL LETTER U WITH DOUBLE ACUTE */
+ { "", 0xDC, 0x00DC }, /* LATIN CAPITAL LETTER U WITH DIAERESIS */
+ { "", 0xDD, 0x00DD }, /* LATIN CAPITAL LETTER Y WITH ACUTE */
+ { "", 0xDE, 0x0162 }, /* LATIN CAPITAL LETTER T WITH CEDILLA */
+ { "", 0xDF, 0x00DF }, /* LATIN SMALL LETTER SHARP S (German) */
+ { "", 0xE0, 0x0155 }, /* LATIN SMALL LETTER R WITH ACUTE */
+ { "", 0xE1, 0x00E1 }, /* LATIN SMALL LETTER A WITH ACUTE */
+ { "", 0xE2, 0x00E2 }, /* LATIN SMALL LETTER A WITH CIRCUMFLEX */
+ { "", 0xE3, 0x0103 }, /* LATIN SMALL LETTER A WITH BREVE */
+ { "", 0xE4, 0x00E4 }, /* LATIN SMALL LETTER A WITH DIAERESIS */
+ { "", 0xE5, 0x013A }, /* LATIN SMALL LETTER L WITH ACUTE */
+ { "", 0xE6, 0x0107 }, /* LATIN SMALL LETTER C WITH ACUTE */
+ { "", 0xE7, 0x00E7 }, /* LATIN SMALL LETTER C WITH CEDILLA */
+ { "", 0xE8, 0x010D }, /* LATIN SMALL LETTER C WITH CARON */
+ { "", 0xE9, 0x00E9 }, /* LATIN SMALL LETTER E WITH ACUTE */
+ { "", 0xEA, 0x0119 }, /* LATIN SMALL LETTER E WITH OGONEK */
+ { "", 0xEB, 0x00EB }, /* LATIN SMALL LETTER E WITH DIAERESIS */
+ { "", 0xEC, 0x011B }, /* LATIN SMALL LETTER E WITH CARON */
+ { "", 0xED, 0x00ED }, /* LATIN SMALL LETTER I WITH ACUTE */
+ { "", 0xEE, 0x00EE }, /* LATIN SMALL LETTER I WITH CIRCUMFLEX */
+ { "", 0xEF, 0x010F }, /* LATIN SMALL LETTER D WITH CARON */
+ { "", 0xF0, 0x0111 }, /* LATIN SMALL LETTER D WITH STROKE */
+ { "", 0xF1, 0x0144 }, /* LATIN SMALL LETTER N WITH ACUTE */
+ { "", 0xF2, 0x0148 }, /* LATIN SMALL LETTER N WITH CARON */
+ { "", 0xF3, 0x00F3 }, /* LATIN SMALL LETTER O WITH ACUTE */
+ { "", 0xF4, 0x00F4 }, /* LATIN SMALL LETTER O WITH CIRCUMFLEX */
+ { "", 0xF5, 0x0151 }, /* LATIN SMALL LETTER O WITH DOUBLE ACUTE */
+ { "", 0xF6, 0x00F6 }, /* LATIN SMALL LETTER O WITH DIAERESIS */
+ { "divide", 0xF7, 0x00F7 }, /* DIVISION SIGN */
+ { "", 0xF8, 0x0159 }, /* LATIN SMALL LETTER R WITH CARON */
+ { "", 0xF9, 0x016F }, /* LATIN SMALL LETTER U WITH RING ABOVE */
+ { "", 0xFA, 0x00FA }, /* LATIN SMALL LETTER U WITH ACUTE */
+ { "", 0xFB, 0x0171 }, /* LATIN SMALL LETTER U WITH DOUBLE ACUTE */
+ { "", 0xFC, 0x00FC }, /* LATIN SMALL LETTER U WITH DIAERESIS */
+ { "", 0xFD, 0x00FD }, /* LATIN SMALL LETTER Y WITH ACUTE */
+ { "", 0xFE, 0x0163 }, /* LATIN SMALL LETTER T WITH CEDILLA */
+ { "", 0xFF, 0x02D9 }, /* DOT ABOVE (Mandarin Chinese light tone) */
+ { NULL, 0, 0 }
+};
+
encoding_type encoding_table[] = {
{ no_encoding, "(no encoding)", NULL },
{ US_ASCII, "US-ASCII", us_ascii_map },
{ ISO_8859_1, "ISO-8859-1", (iso_map_type *) iso8859_1_map },
- { ISO_8859_2, "ISO-8859-2", NULL },
+ { ISO_8859_2, "ISO-8859-2", (iso_map_type *) iso8859_2_map },
{ ISO_8859_3, "ISO-8859-3", NULL },
{ ISO_8859_4, "ISO-8859-4", NULL },
{ ISO_8859_5, "ISO-8859-5", NULL },
@@ -310,7 +432,7 @@ void
cm_documentlanguage ()
{
language_code_type c;
- char *lang_arg;
+ char *lang_arg;
/* Read the line with the language code on it. */
get_rest_of_line (0, &lang_arg);
@@ -365,13 +487,13 @@ cm_documentencoding ()
{
encoding_code_type enc;
char *enc_arg;
-
+
get_rest_of_line (1, &enc_arg);
/* See if we have this encoding. */
for (enc = no_encoding+1; enc != last_encoding_code; enc++)
{
- if (strcasecmp (enc_arg, encoding_table[enc].ecname) == 0)
+ if (strcasecmp (enc_arg, encoding_table[enc].encname) == 0)
{
document_encoding_code = enc;
break;
@@ -380,7 +502,7 @@ cm_documentencoding ()
/* If we didn't find this code, complain. */
if (enc == last_encoding_code)
- warning (_("unrecogized encoding name `%s'"), enc_arg);
+ warning (_("unrecognized encoding name `%s'"), enc_arg);
else if (encoding_table[document_encoding_code].isotab == NULL)
warning (_("sorry, encoding `%s' not supported"), enc_arg);
@@ -434,7 +556,7 @@ cm_accent_generic_html (arg, start, end, html_supported, single,
char *html_solo;
{
static int valid_html_accent; /* yikes */
-
+
if (arg == START)
{ /* If HTML has good support for this character, use it. */
if (strchr (html_supported, curchar ()))
@@ -447,7 +569,7 @@ cm_accent_generic_html (arg, start, end, html_supported, single,
escape_html = saved_escape_html;
}
else
- {
+ {
valid_html_accent = 0;
if (html_solo_standalone)
{ /* No special HTML support, so produce standalone char. */
@@ -492,7 +614,7 @@ cm_accent_generic_no_headers (arg, start, end, single, html_solo)
buffer[0] = output_paragraph[end - 1];
buffer[1] = 0;
strcat (buffer, html_solo);
-
+
rc = cm_search_iso_map (buffer);
if (rc >= 0)
/* A little bit tricky ;-)
@@ -505,12 +627,12 @@ cm_accent_generic_no_headers (arg, start, end, single, html_solo)
else
{ /* If we didn't find a translation for this character,
put the single instead. E.g., &Xuml; does not exist so X&uml;
- should be produced. */
+ should be produced. */
warning (_("%s is an invalid ISO code, using %c"),
buffer, single);
add_char (single);
}
-
+
free (buffer);
}
}
@@ -579,7 +701,7 @@ cm_accent_generic (arg, start, end, html_supported, single,
else if (no_headers)
cm_accent_generic_no_headers (arg, start, end, single, html_solo);
else if (arg == END)
- {
+ {
if (enable_encoding)
/* use 8-bit if available */
cm_accent_generic_no_headers (arg, start, end, single, html_solo);
@@ -665,9 +787,9 @@ cm_special_char (arg)
else if (strcmp (command, "ae") == 0)
add_encoded_char ("aelig", command);
else if (strcmp (command, "OE") == 0)
- add_word ("&#140;", command);
+ add_encoded_char ("#140", command);
else if (strcmp (command, "oe") == 0)
- add_word ("&#156;", command);
+ add_encoded_char ("#156", command);
else if (strcmp (command, "AA") == 0)
add_encoded_char ("Aring", command);
else if (strcmp (command, "aa") == 0)
diff --git a/contrib/texinfo/makeinfo/lang.h b/contrib/texinfo/makeinfo/lang.h
index b78ce9c..a1e9489 100644
--- a/contrib/texinfo/makeinfo/lang.h
+++ b/contrib/texinfo/makeinfo/lang.h
@@ -1,7 +1,7 @@
/* lang.h -- declarations for language codes etc.
- $Id: lang.h,v 1.3 2002/11/07 16:10:49 karl Exp $
+ $Id: lang.h,v 1.4 2003/05/01 00:05:27 karl Exp $
- Copyright (C) 1999, 2001, 2002 Free Software Foundation, Inc.
+ Copyright (C) 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
@@ -80,9 +80,9 @@ extern language_type language_table[];
typedef enum {
no_encoding,
US_ASCII,
- ISO_8859_1, /* default for en, de, */
- ISO_8859_2, /* actualy not supported like the rest below */
- ISO_8859_3,
+ ISO_8859_1,
+ ISO_8859_2,
+ ISO_8859_3, /* this and none of the rest are supported. */
ISO_8859_4,
ISO_8859_5,
ISO_8859_6,
@@ -118,7 +118,7 @@ typedef struct
typedef struct
{
encoding_code_type ec; /* document encoding type (see above enum) */
- char *ecname; /* encoding name like ISO-8859-1 */
+ char *encname; /* encoding name like "ISO-8859-1", valid in Emacs */
iso_map_type *isotab; /* address of ISO translation table */
} encoding_type;
diff --git a/contrib/texinfo/makeinfo/macro.c b/contrib/texinfo/makeinfo/macro.c
index 357d4ac..ef33a53 100644
--- a/contrib/texinfo/makeinfo/macro.c
+++ b/contrib/texinfo/makeinfo/macro.c
@@ -1,7 +1,7 @@
/* macro.c -- user-defined macros for Texinfo.
- $Id: macro.c,v 1.1 2002/08/25 23:38:38 karl Exp $
+ $Id: macro.c,v 1.2 2003/06/01 23:41:23 karl Exp $
- Copyright (C) 1998, 1999, 2002 Free Software Foundation, Inc.
+ Copyright (C) 1998, 1999, 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
@@ -322,7 +322,7 @@ apply (named, actuals, body)
else
{ /* Snarf parameter name, check against named parameters. */
char *param;
- int param_start, which, len;
+ int param_start, len;
param_start = ++i;
while (body[i] && body[i] != '\\')
@@ -336,29 +336,38 @@ apply (named, actuals, body)
if (body[i]) /* move past \ */
i++;
- /* Now check against named parameters. */
- for (which = 0; named && named[which]; which++)
- if (STREQ (named[which], param))
- break;
-
- if (named && named[which])
- {
- text = which < length_of_actuals ? actuals[which] : NULL;
- if (!text)
- text = "";
- len = strlen (text);
- }
- else
- { /* not a parameter, either it's \\ (if len==0) or an
- error. In either case, restore one \ at least. */
- if (len) {
- warning (_("\\ in macro expansion followed by `%s' instead of \\ or parameter name"),
- param);
- }
+ if (len == 0)
+ { /* \\ always means \, even if macro has no args. */
len++;
text = xmalloc (1 + len);
sprintf (text, "\\%s", param);
}
+ else
+ {
+ int which;
+
+ /* Check against named parameters. */
+ for (which = 0; named && named[which]; which++)
+ if (STREQ (named[which], param))
+ break;
+
+ if (named && named[which])
+ {
+ text = which < length_of_actuals ? actuals[which] : NULL;
+ if (!text)
+ text = "";
+ len = strlen (text);
+ text = xstrdup (text); /* so we can free it */
+ }
+ else
+ { /* not a parameter, so it's an error. */
+ warning (_("\\ in macro expansion followed by `%s' instead of parameter name"),
+ param);
+ len++;
+ text = xmalloc (1 + len);
+ sprintf (text, "\\%s", param);
+ }
+ }
if (strlen (param) + 2 < len)
{
@@ -371,8 +380,7 @@ apply (named, actuals, body)
strcpy (new_body + new_body_index, text);
new_body_index += len;
- if (!named || !named[which])
- free (text);
+ free (text);
}
}
diff --git a/contrib/texinfo/makeinfo/makeinfo.c b/contrib/texinfo/makeinfo/makeinfo.c
index 725e5de..a5e63fc 100644
--- a/contrib/texinfo/makeinfo/makeinfo.c
+++ b/contrib/texinfo/makeinfo/makeinfo.c
@@ -1,7 +1,7 @@
/* makeinfo -- convert Texinfo source into other formats.
- $Id: makeinfo.c,v 1.17 2003/01/19 18:44:28 karl Exp $
+ $Id: makeinfo.c,v 1.34 2003/06/02 12:32:29 karl Exp $
- Copyright (C) 1987, 1992, 1993, 1994, 1995, 1996, 1997, 1998, 1999,
+ 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
@@ -31,6 +31,7 @@
#include "html.h"
#include "index.h"
#include "insertion.h"
+#include "lang.h"
#include "macro.h"
#include "node.h"
#include "toc.h"
@@ -167,7 +168,6 @@ char **get_brace_args ();
int array_len ();
void free_array ();
static int end_of_sentence_p ();
-static void isolate_nodename ();
void reader_loop ();
void remember_brace (), remember_brace_1 ();
void pop_and_call_brace (), discard_braces ();
@@ -181,7 +181,6 @@ void inhibit_output_flushing (), uninhibit_output_flushing ();
int set_paragraph_indent ();
int self_delimiting (), search_forward ();
int multitable_item (), number_of_node ();
-extern void add_link (), add_escaped_anchor_name ();
void me_execute_string_keep_state ();
void maybe_update_execution_strings ();
@@ -189,11 +188,10 @@ void maybe_update_execution_strings ();
extern char *escape_string ();
extern void insert_html_tag ();
extern void sectioning_html ();
-extern void add_link ();
#if defined (VA_FPRINTF) && __STDC__
/* Unfortunately we must use prototypes if we are to use <stdarg.h>. */
-void add_word_args (char *, ...);
+void add_word_args (const char *, ...);
void execute_string (char *, ...);
#else
void add_word_args ();
@@ -218,10 +216,10 @@ fs_error (filename)
/* Print an error message, and return false. */
void
#if defined (VA_FPRINTF) && __STDC__
-error (char *format, ...)
+error (const char *format, ...)
#else
error (format, va_alist)
- char *format;
+ const char *format;
va_dcl
#endif
{
@@ -245,12 +243,12 @@ error (format, va_alist)
/* Just like error (), but print the input file and line number as well. */
void
#if defined (VA_FPRINTF) && __STDC__
-file_line_error (char *infile, int lno, char *format, ...)
+file_line_error (char *infile, int lno, const char *format, ...)
#else
file_line_error (infile, lno, format, va_alist)
char *infile;
int lno;
- char *format;
+ const char *format;
va_dcl
#endif
{
@@ -276,10 +274,10 @@ file_line_error (infile, lno, format, va_alist)
number from global variables. */
void
#if defined (VA_FPRINTF) && __STDC__
-line_error (char *format, ...)
+line_error (const char *format, ...)
#else
line_error (format, va_alist)
- char *format;
+ const char *format;
va_dcl
#endif
{
@@ -303,10 +301,10 @@ line_error (format, va_alist)
void
#if defined (VA_FPRINTF) && __STDC__
-warning (char *format, ...)
+warning (const char *format, ...)
#else
warning (format, va_alist)
- char *format;
+ const char *format;
va_dcl
#endif
{
@@ -374,7 +372,7 @@ usage (exit_value)
else
{
printf (_("Usage: %s [OPTION]... TEXINFO-FILE...\n"), progname);
- puts ("\n");
+ puts ("");
puts (_("\
Translate Texinfo source documentation to various other formats, by default\n\
@@ -430,16 +428,21 @@ Options for Info and plain text:\n\
--split-size=NUM split Info files at size NUM (default %d).\n"),
fill_column, paragraph_start_indent,
DEFAULT_SPLIT_SIZE);
-
puts ("\n");
puts (_("\
+Options for HTML:\n\
+ --css-include=FILE include FILE in HTML <style> output;\n\
+ read stdin if FILE is -.\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\
- -I DIR append DIR to the @include search path.\n\
- -P DIR prepend DIR to the @include search path.\n\
- -U VAR undefine the variable VAR, as with @clear.\n\
+ --commands-in-node-names allow @ commands in node names.\n\
+ -D VAR define the variable VAR, as with @set.\n\
+ -I DIR append DIR to the @include search path.\n\
+ -P DIR prepend DIR to the @include search path.\n\
+ -U VAR undefine the variable VAR, as with @clear.\n\
"));
puts (_("\
@@ -461,6 +464,7 @@ Conditional processing in input:\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\
+ if generating XML, --ifxml is on and the others are off.\n\
"));
fputs (_("\
@@ -489,6 +493,7 @@ Texinfo home page: http://www.gnu.org/software/texinfo/"));
struct option long_options[] =
{
{ "commands-in-node-names", 0, &expensive_validation, 1 },
+ { "css-include", 1, 0, 'C' },
{ "docbook", 0, 0, 'd' },
{ "enable-encoding", 0, &enable_encoding, 1 },
{ "error-limit", 1, 0, 'e' },
@@ -560,6 +565,10 @@ main (argc, argv)
switch (c)
{
+ case 'C': /* --css-include */
+ css_include = xstrdup (optarg);
+ break;
+
case 'D':
case 'U':
/* User specified variable to set or clear. */
@@ -713,7 +722,7 @@ For more information about these matters, see the files named COPYING.\n"),
xml = 1;
process_xml = 1;
break;
-
+
case '?':
usage (1);
break;
@@ -737,11 +746,11 @@ For more information about these matters, see the files named COPYING.\n"),
if (no_headers)
{
- if (html && splitting)
+ if (html && splitting && !STREQ (command_output_filename, "-"))
{ /* --no-headers --no-split --html indicates confusion. */
fprintf (stderr,
- "%s: --no-headers conflicts with --no-split for --html.\n",
- progname);
+ "%s: can't split --html output to `%s' with --no-headers.\n",
+ progname, command_output_filename);
usage (1);
}
@@ -752,7 +761,7 @@ For more information about these matters, see the files named COPYING.\n"),
if (!command_output_filename)
command_output_filename = xstrdup ("-");
}
-
+
if (process_info == -1)
{ /* no explicit --[no-]ifinfo option, so we'll do @ifinfo
if we're generating info or (for compatibility) plain text. */
@@ -764,7 +773,7 @@ For more information about these matters, see the files named COPYING.\n"),
if we're generating plain text. */
process_plaintext = no_headers && !html && !xml;
}
-
+
if (verbose_mode)
print_version_info ();
@@ -778,7 +787,8 @@ For more information about these matters, see the files named COPYING.\n"),
else
convert_from_stream (stdin, "stdin");
- return errors_printed ? 2 : 0;
+ xexit (errors_printed ? 2 : 0);
+ return 0; /* Avoid bogus warnings. */
}
@@ -836,7 +846,7 @@ self_delimiting (character)
{
/* @; and @\ are not Texinfo commands, but they are listed here
anyway. I don't know why. --karl, 10aug96. */
- return strchr ("~{|}`^\\@?=;:.-,*\'\" !\n\t", character) != NULL;
+ return strchr ("~{|}`^\\@?=;:./-,*\'\" !\n\t", character) != NULL;
}
/* Clear whitespace from the front and end of string. */
@@ -1163,6 +1173,8 @@ get_until_in_braces (match, string)
input_text_offset = i;
*string = temp;
}
+
+
/* Converting a file. */
@@ -1317,12 +1329,12 @@ convert_from_file (name)
/* Given OUTPUT_FILENAME == ``/foo/bar/baz.html'', return
"/foo/bar/baz/baz.html". This routine is called only if html && splitting.
-
+
Split html output goes into the subdirectory of the toplevel
filename, without extension. For example:
@setfilename foo.info
produces output in files foo/index.html, foo/second-node.html, ...
-
+
But if the user said -o foo.whatever on the cmd line, then use
foo.whatever unchanged. */
@@ -1330,16 +1342,16 @@ static char *
insert_toplevel_subdirectory (output_filename)
char *output_filename;
{
+ static const char index_name[] = "index.html";
char *dir, *subdir, *base, *basename, *p;
char buf[PATH_MAX];
struct stat st;
- static const char index_name[] = "index.html";
const int index_len = sizeof (index_name) - 1;
strcpy (buf, output_filename);
- dir = pathname_part (buf);
- base = filename_part (buf);
- basename = xstrdup (base); /* remember real @setfilename name */
+ dir = pathname_part (buf); /* directory of output_filename */
+ base = filename_part (buf); /* strips suffix, too */
+ basename = xstrdup (base); /* remember real @setfilename name */
p = dir + strlen (dir) - 1;
if (p > dir && IS_SLASH (*p))
*p = 0;
@@ -1348,15 +1360,11 @@ insert_toplevel_subdirectory (output_filename)
*p = 0;
/* Split html output goes into subdirectory of toplevel name. */
- subdir = "";
- if (FILENAME_CMP (base, filename_part (dir)) != 0)
- {
- if (save_command_output_filename
- && STREQ (output_filename, save_command_output_filename))
- subdir = basename; /* from user, use unchanged */
- else
- subdir = base; /* implicit, omit suffix */
- }
+ if (save_command_output_filename
+ && STREQ (output_filename, save_command_output_filename))
+ subdir = basename; /* from user, use unchanged */
+ else
+ subdir = base; /* implicit, omit suffix */
free (output_filename);
output_filename = xmalloc (strlen (dir) + 1
@@ -1367,7 +1375,7 @@ insert_toplevel_subdirectory (output_filename)
if (strlen (dir))
strcat (output_filename, "/");
strcat (output_filename, subdir);
- if (mkdir (output_filename, 0777) == -1 && errno != EEXIST
+ if ((mkdir (output_filename, 0777) == -1 && errno != EEXIST)
/* output_filename might exist, but be a non-directory. */
|| (stat (output_filename, &st) == 0 && !S_ISDIR (st.st_mode)))
{ /* that failed, try subdir name with .html */
@@ -1377,7 +1385,7 @@ insert_toplevel_subdirectory (output_filename)
strcat (output_filename, basename);
if (mkdir (output_filename, 0777) == -1)
{
- char *errmsg = strerror (errno);
+ const char *errmsg = strerror (errno);
if ((errno == EEXIST
#ifdef __MSDOS__
@@ -1440,7 +1448,7 @@ convert_from_loaded_file (name)
command_output_filename = output_name_from_input_name (name);
#endif /* !REQUIRE_SETFILENAME */
}
-
+
{
int i, end_of_first_line;
@@ -1588,7 +1596,7 @@ convert_from_loaded_file (name)
reader_loop ();
if (xml)
xml_end_document ();
-
+
finished:
discard_insertions (0);
@@ -1627,7 +1635,18 @@ finished:
close_paragraph ();
}
+ /* maybe we want local variables in info output. */
+ {
+ char *trailer = info_trailer ();
+ if (trailer)
+ {
+ insert_string (trailer);
+ free (trailer);
+ }
+ }
+
flush_output (); /* in case there was no @bye */
+
if (output_stream != stdout)
fclose (output_stream);
@@ -1656,6 +1675,29 @@ finished:
free (real_output_filename);
}
+
+
+/* If enable_encoding and document_encoding are both set, return a Local
+ Variables section (as a malloc-ed string) so that Emacs' locale
+ features can work. Else return NULL. */
+
+char *
+info_trailer ()
+{
+ if (!enable_encoding || document_encoding_code <= US_ASCII)
+ return NULL;
+
+ {
+#define LV_FMT "\n\037\nLocal Variables:\ncoding: %s\nEnd:\n"
+ char *enc_name = encoding_table[document_encoding_code].encname;
+ char *lv = xmalloc (sizeof (LV_FMT) + strlen (enc_name));
+ sprintf (lv, LV_FMT, enc_name);
+ return lv;
+ }
+}
+
+
+
void
free_and_clear (pointer)
char **pointer;
@@ -1708,10 +1750,10 @@ static void
handle_menu_entry ()
{
char *tem;
-
+
/* Ugh, glean_node_from_menu wants to read the * itself. */
input_text_offset--;
-
+
/* Find node name in menu entry and save it in references list for
later validation. Use followed_reference type for detailmenu
references since we don't want to use them for default node pointers. */
@@ -1740,7 +1782,7 @@ handle_menu_entry ()
add_word ("<p>\n");
in_paragraph = 1;
}
-
+
if (in_paragraph)
{
add_word ("</p>");
@@ -1780,7 +1822,7 @@ handle_menu_entry ()
add_word (": ");
}
else if (xml && tem)
- {
+ {
xml_start_menu_entry (tem);
}
else if (tem)
@@ -2002,7 +2044,7 @@ reader_loop ()
input_text_offset++;
}
break;
-
+
/* Escapes for HTML unless we're outputting raw HTML. Do
this always, even if SGML rules don't require it since
that's easier and safer for non-conforming browsers. */
@@ -2090,7 +2132,7 @@ remember_brace (proc)
COMMAND_FUNCTION *proc;
{
if (curchar () != '{')
- line_error (_("%c%s expected `{...}'"), COMMAND_PREFIX, command);
+ line_error (_("%c%s expected braces"), COMMAND_PREFIX, command);
else
input_text_offset++;
remember_brace_1 (proc, output_paragraph_offset);
@@ -2161,7 +2203,7 @@ adjust_braces_following (here, amount)
/* Return the string which invokes PROC; a pointer to a function.
Always returns the first function in the command table if more than
one matches PROC. */
-static char *
+static const char *
find_proc_name (proc)
COMMAND_FUNCTION *proc;
{
@@ -2187,7 +2229,7 @@ discard_braces ()
{
if (brace_stack->proc != misplaced_brace)
{
- char *proc_name;
+ const char *proc_name;
proc_name = find_proc_name (brace_stack->proc);
file_line_error (input_filename, brace_stack->line,
@@ -2241,10 +2283,10 @@ get_char_len (character)
void
#if defined (VA_FPRINTF) && __STDC__
-add_word_args (char *format, ...)
+add_word_args (const char *format, ...)
#else
add_word_args (format, va_alist)
- char *format;
+ const char *format;
va_dcl
#endif
{
@@ -2284,6 +2326,27 @@ add_html_elt (string)
in_html_elt--;
}
+/* Here is another awful kludge, used in add_char. Ordinarily, macro
+ expansions take place in the body of the document, and therefore we
+ should html_output_head when we see one. But there's an exception: a
+ macro call might take place within @copying, and that does not start
+ the real output, even though we fully expand the copying text.
+
+ So we need to be able to check if we are defining the @copying text.
+ We do this by looking back through the insertion stack. */
+static int
+defining_copying ()
+{
+ INSERTION_ELT *i;
+ for (i = insertion_stack; i; i = i->next)
+ {
+ if (i->insertion == copying)
+ return 1;
+ }
+ return 0;
+}
+
+
/* Add the character to the current paragraph. If filling_enabled is
nonzero, then do filling as well. */
void
@@ -2322,10 +2385,10 @@ add_char (character)
{
if (html || docbook)
{ /* Seems cleaner to use &nbsp; than an 8-bit char. */
- int saved_escape_html = escape_html;
- escape_html = 0;
+ int saved_escape_html = escape_html;
+ escape_html = 0;
add_word ("&nbsp");
- escape_html = saved_escape_html;
+ escape_html = saved_escape_html;
character = ';';
}
else
@@ -2400,7 +2463,7 @@ add_char (character)
any order and with any omissions, and we'll still output
the html <head> `just in time'. */
if ((executing_macro || !executing_string)
- && html && !html_output_head_p)
+ && html && !html_output_head_p && !defining_copying ())
html_output_head ();
if (!paragraph_is_open)
@@ -2997,16 +3060,16 @@ cm_xref (arg)
char *arg1_id = xml_id (arg1);
if (*arg2)
{
- xml_insert_element_with_attribute (XREFNODENAME, START,
+ xml_insert_element_with_attribute (XREFNODENAME, START,
"linkend=\"%s\"", arg1_id);
free (arg1_id);
if (*arg2)
execute_string (arg2);
xml_insert_element (XREFNODENAME, END);
- }
+ }
else
{
- xml_insert_element_with_attribute (XREF, START,
+ xml_insert_element_with_attribute (XREF, START,
"linkend=\"%s\"", arg1_id);
free (arg1_id);
xml_pop_current_element ();
@@ -3324,7 +3387,7 @@ cm_uref (arg)
execute_string (replacement);
xml_insert_element (UREFREPLACEMENT, END);
}
- xml_insert_element (UREF, END);
+ xml_insert_element (UREF, END);
}
else if (html)
{ /* never need to show the url */
@@ -3380,7 +3443,7 @@ cm_email (arg)
xml_insert_element_with_attribute (EMAIL, START, "url=\"mailto:%s\"", addr);
if (*name)
execute_string (name);
- xml_insert_element (EMAIL, END);
+ xml_insert_element (EMAIL, END);
}
else if (xml)
{
@@ -3394,7 +3457,7 @@ cm_email (arg)
execute_string (name);
xml_insert_element (EMAILNAME, END);
}
- xml_insert_element (EMAIL, END);
+ xml_insert_element (EMAIL, END);
}
else if (html)
{
@@ -3441,34 +3504,48 @@ cm_image (arg)
if (*name_arg)
{
+ struct stat file_info;
+ char *pathname = NULL;
char *fullname = xmalloc (strlen (name_arg)
+ (ext_arg && *ext_arg ? strlen (ext_arg) + 1 : 4) + 1);
- if (html)
+ if (ext_arg && *ext_arg)
{
- if (ext_arg && *ext_arg)
+ sprintf (fullname, "%s.%s", name_arg, ext_arg);
+ if (access (fullname, R_OK) != 0)
+ pathname = get_file_info_in_path (fullname, include_files_path,
+ &file_info);
+ }
+ else
+ {
+ sprintf (fullname, "%s.png", name_arg);
+ if (access (fullname, R_OK) != 0)
{
- sprintf (fullname, "%s.%s", name_arg, ext_arg);
- if (access (fullname, R_OK) != 0)
+ pathname = get_file_info_in_path (fullname,
+ include_files_path, &file_info);
+ if (pathname == NULL)
{
- line_error(_("@image file `%s' (for HTML) not readable: %s"),
- fullname, strerror (errno));
- return;
+ sprintf (fullname, "%s.jpg", name_arg);
+ if (access (fullname, R_OK) != 0)
+ pathname = get_file_info_in_path (fullname,
+ include_files_path, &file_info);
}
}
- else
+ }
+
+ if (html)
+ {
+ if (pathname == NULL && access (fullname, R_OK) != 0)
{
- sprintf (fullname, "%s.png", name_arg);
- if (access (fullname, R_OK) != 0)
+ line_error(_("@image file `%s' (for HTML) not readable: %s"),
+ fullname, strerror (errno));
+ return;
+ }
+ if (pathname != NULL && access (pathname, R_OK) != 0)
{
- sprintf (fullname, "%s.jpg", name_arg);
- if (access (fullname, R_OK) != 0)
- {
- line_error (_("No `%s.png' or `.jpg', and no extension supplied"),
- name_arg);
- return;
- }
- }
+ line_error (_("No such file `%s'"),
+ fullname);
+ return;
}
add_html_elt ("<img src=");
@@ -3480,17 +3557,32 @@ cm_image (arg)
xml_insert_docbook_image (name_arg);
else if (xml)
{
- xml_insert_element_with_attribute (IMAGE, START, "width=\"%s\" height=\"%s\" alttext=\"%s\" extension=\"%s\"", w_arg, h_arg, alt_arg, ext_arg);
+ xml_insert_element_with_attribute (IMAGE, START, "width=\"%s\" height=\"%s\" alttext=\"%s\" extension=\"%s\"",
+ w_arg, h_arg, alt_arg, ext_arg);
add_word (name_arg);
xml_insert_element (IMAGE, END);
}
else
- { /* Try to open foo.txt. */
+ { /* Try to open foo.EXT or foo.txt. */
FILE *image_file;
- strcpy (fullname, name_arg);
- strcat (fullname, ".txt");
- image_file = fopen (fullname, "r");
- if (image_file)
+ char *txtpath = NULL;
+ char *txtname = xmalloc (strlen (name_arg)
+ + (ext_arg && *ext_arg
+ ? strlen (ext_arg) + 1 : 4) + 1);
+ strcpy (txtname, name_arg);
+ strcat (txtname, ".txt");
+ image_file = fopen (txtname, "r");
+ if (image_file == NULL)
+ {
+ txtpath = get_file_info_in_path (txtname,
+ include_files_path, &file_info);
+ if (txtpath != NULL)
+ image_file = fopen (txtpath, "r");
+ }
+
+ if (image_file != NULL
+ || access (fullname, R_OK) == 0
+ || (pathname != NULL && access (pathname, R_OK) == 0))
{
int ch;
int save_inhibit_indentation = inhibit_paragraph_indentation;
@@ -3500,25 +3592,50 @@ cm_image (arg)
filling_enabled = 0;
last_char_was_newline = 0;
- /* Maybe we need to remove the final newline if the image
- file is only one line to allow in-line images. On the
- other hand, they could just make the file without a
- final newline. */
- while ((ch = getc (image_file)) != EOF)
- add_char (ch);
+ /* Write magic ^@^H[image ...^@^H] cookie in the info file. */
+ add_char ('\0');
+ add_word ("\010[image");
+
+ if (access (fullname, R_OK) == 0
+ || (pathname != NULL && access (pathname, R_OK) == 0))
+ add_word_args (" src=%s", fullname);
+
+ if (*alt_arg)
+ add_word_args (" alt=\"%s\"", alt_arg);
+
+ if (image_file != NULL)
+ {
+ add_word (" text=\"");
+ /* Maybe we need to remove the final newline if the image
+ file is only one line to allow in-line images. On the
+ other hand, they could just make the file without a
+ final newline. */
+ while ((ch = getc (image_file)) != EOF)
+ {
+ if (ch == '"' || ch == '\\')
+ add_char ('\\');
+ add_char (ch);
+ }
+ add_char ('"');
+
+ if (fclose (image_file) != 0)
+ perror (txtname);
+ }
inhibit_paragraph_indentation = save_inhibit_indentation;
filling_enabled = save_filling_enabled;
- if (fclose (image_file) != 0)
- perror (fullname);
+ add_char ('\0');
+ add_word ("\010]");
}
else
line_error (_("@image file `%s' (for text) unreadable: %s"),
- fullname, strerror (errno));
+ txtname, strerror (errno));
}
free (fullname);
+ if (pathname)
+ free (pathname);
}
else
line_error (_("@image missing filename argument"));
@@ -3718,7 +3835,10 @@ cm_value (arg, start_pos, end_pos)
if (value)
execute_string ("%s", value);
else
+ {
+ warning (_("undefined flag: %s"), name);
add_word_args (_("{No value for `%s'}"), name);
+ }
free (name);
}
@@ -4051,7 +4171,7 @@ expansion (str, implicit_code)
int implicit_code;
{
char *result;
-
+
/* Inhibit indentation and filling, so that extra newlines
are not added to the expansion. (This is undesirable if
we write the expanded text to macro_expansion_output_stream.) */
@@ -4064,14 +4184,14 @@ expansion (str, implicit_code)
indented_fill = 0;
no_indent = 1;
escape_html = 0;
-
+
result = full_expansion (str, implicit_code);
filling_enabled = saved_filling_enabled;
indented_fill = saved_indented_fill;
no_indent = saved_no_indent;
- escape_html = saved_escape_html;
-
+ escape_html = saved_escape_html;
+
return result;
}
@@ -4146,13 +4266,13 @@ text_expansion (str)
char *ret;
int save_html = html;
int save_xml = xml;
-
+
html = 0;
xml = 0;
ret = expansion (str, 0);
html = save_html;
xml = save_xml;
-
+
return ret;
}
diff --git a/contrib/texinfo/makeinfo/makeinfo.h b/contrib/texinfo/makeinfo/makeinfo.h
index bc322e2..dd77fe6 100644
--- a/contrib/texinfo/makeinfo/makeinfo.h
+++ b/contrib/texinfo/makeinfo/makeinfo.h
@@ -1,8 +1,8 @@
/* makeinfo.h -- declarations for Makeinfo.
- $Id: makeinfo.h,v 1.3 2003/01/17 17:14:34 karl Exp $
+ $Id: makeinfo.h,v 1.10 2003/05/12 13:12:32 karl Exp $
- Copyright (C) 1996, 1997, 1998, 1999, 2000, 2001, 2002, 2003 Free Software
- Foundation, Inc.
+ Copyright (C) 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
@@ -88,15 +88,22 @@ DECLARE (int, non_top_node_seen, 0);
/* Nonzero indicates that indentation is temporarily turned off. */
DECLARE (int, no_indent, 1);
+/* The amount of indentation to apply at the start of each line. */
+DECLARE (int, current_indent, 0);
+
+/* Nonzero means that we suppress the indentation of the first paragraph
+ following any section heading. */
+DECLARE (int, do_first_par_indent, 0);
+
+/* Amount by which @example indentation increases/decreases. */
+DECLARE (int, default_indentation_increment, 5);
+
/* Nonzero indicates that filling a line also indents the new line. */
DECLARE (int, indented_fill, 0);
/* Nonzero means forcing output text to be flushright. */
DECLARE (int, force_flush_right, 0);
-/* The amount of indentation to apply at the start of each line. */
-DECLARE (int, current_indent, 0);
-
/* The column at which long lines are broken. */
DECLARE (int, fill_column, 72);
@@ -104,9 +111,6 @@ DECLARE (int, fill_column, 72);
gets changed for cm_w (). */
DECLARE (int, non_splitting_words, 0);
-/* Amount by which @example indentation increases/decreases. */
-DECLARE (int, default_indentation_increment, 5);
-
/* Nonzero means that we are currently hacking the insides of an
insertion which would use a fixed width font. */
DECLARE (int, in_fixed_width_font, 0);
@@ -114,16 +118,17 @@ DECLARE (int, in_fixed_width_font, 0);
/* Nonzero if we are currently processing a multitable command */
DECLARE (int, multitable_active, 0);
-/* Nonzero means that we're generating HTML. */
+/* Nonzero means that we're generating HTML. (--html) */
DECLARE (int, html, 0);
-/* Nonzero means that we're generating XML. */
+/* Nonzero means that we're generating XML. (--xml) */
DECLARE (int, xml, 0);
-/* Nonzero means that we're generating DocBook. */
+/* Nonzero means that we're generating DocBook. (--docbook) */
DECLARE (int, docbook, 0);
-/* Nonzero means true 8-bit output for Info and plain text. */
+/* Nonzero means true 8-bit output for Info and plain text.
+ (--enable-encoding) */
DECLARE (int, enable_encoding, 0);
/* Nonzero means escape characters in HTML output. */
@@ -153,7 +158,7 @@ DECLARE (char *, command, NULL);
DECLARE (char *, copying_text, NULL);
/* @documentdescription ... @end documentdescription. */
-DECLARE (char *, document_description, NULL);
+DECLARE (const char *, document_description, NULL);
/* Nonzero if the last character inserted has the syntax class of NEWLINE. */
DECLARE (int, last_char_was_newline, 1);
@@ -174,6 +179,9 @@ DECLARE (char *, include_files_path, NULL);
/* The filename of the current input file. This is never freed. */
DECLARE (char *, node_filename, NULL);
+/* Name of CSS file to include, if any. (--css-include). */
+DECLARE (char *, css_include, NULL);
+
/* Nonzero means do not output "Node: Foo" for node separations, that
is, generate plain text. (--no-headers) */
DECLARE (int, no_headers, 0);
@@ -208,7 +216,8 @@ DECLARE (int, validating, 1);
/* Nonzero means print information about what is going on. (--verbose) */
DECLARE (int, verbose_mode, 0);
-/* Nonzero means prefix each @chapter, ... with a number like 1. (--number-sections) */
+/* Nonzero means prefix each @chapter, ... with a number like
+ 1, 1.1, etc. (--number-sections) */
DECLARE (int, number_sections, 0);
/* Nonzero means split size. When zero, DEFAULT_SPLIT_SIZE is used. */
@@ -260,9 +269,10 @@ DECLARE (int, expensive_validation, 0);
#define END_VERBATIM "end verbatim"
-/* Stuff for splitting large files. */
-#define SPLIT_SIZE_THRESHOLD 70000 /* What's good enough for Stallman... */
-#define DEFAULT_SPLIT_SIZE 50000 /* Is probably good enough for me. */
+/* Stuff for splitting large files. The numbers for Emacs
+ texinfo-format-buffer are much smaller, but memory capacities have
+ increased so much, 50k info files seem a bit tiny these days. */
+#define DEFAULT_SPLIT_SIZE 300000
DECLARE (int, splitting, 1); /* Defaults to true for now. */
#define skip_whitespace() \
@@ -286,4 +296,7 @@ DECLARE (int, splitting, 1); /* Defaults to true for now. */
#define looking_at(string) \
(strncmp (input_text + input_text_offset, string, strlen (string)) == 0)
+/* Possibly return Local Variables trailer for Info output. */
+extern char *info_trailer ();
+
#endif /* not MAKEINFO_H */
diff --git a/contrib/texinfo/makeinfo/node.c b/contrib/texinfo/makeinfo/node.c
index 10f4c3a..2215d4c 100644
--- a/contrib/texinfo/makeinfo/node.c
+++ b/contrib/texinfo/makeinfo/node.c
@@ -1,8 +1,8 @@
/* node.c -- nodes for Texinfo.
- $Id: node.c,v 1.6 2003/01/18 17:16:17 karl Exp $
+ $Id: node.c,v 1.12 2003/05/01 00:30:07 karl Exp $
- Copyright (C) 1998, 1999, 2000, 2001, 2002, 2003
- Free Software Foundation, Inc.
+ Copyright (C) 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
@@ -595,7 +595,7 @@ cm_node ()
filling_enabled = indented_fill = 0;
if (!html || (html && splitting))
current_footnote_number = 1;
-
+
if (verbose_mode)
printf (_("Formatting node %s...\n"), node);
@@ -609,7 +609,7 @@ cm_node ()
xml_begin_node ();
if (!docbook)
{
- xml_insert_element (NODENAME, START);
+ xml_insert_element (NODENAME, START);
if (macro_expansion_output_stream && !executing_string)
me_execute_string (node);
else
@@ -924,7 +924,7 @@ cm_node ()
add_word ("<div class=\"node\">\n");
/* The <p> avoids the links area running on with old Lynxen. */
add_word_args ("<p>%s\n", splitting ? "" : "<hr>");
- add_word_args ("%s<a name=\"", _("Node:"));
+ add_word_args ("%s%s<a name=\"", _("Node:"), "&nbsp;");
tem = expand_node_name (node);
add_anchor_name (tem, 0);
add_word_args ("\">%s</a>", tem);
@@ -935,6 +935,7 @@ cm_node ()
tem = expansion (next, 0);
add_word (",\n");
add_word (_("Next:"));
+ add_word ("&nbsp;");
add_word ("<a rel=\"next\" accesskey=\"n\" href=\"");
add_anchor_name (tem, 1);
add_word_args ("\">%s</a>", tem);
@@ -945,6 +946,7 @@ cm_node ()
tem = expansion (prev, 0);
add_word (",\n");
add_word (_("Previous:"));
+ add_word ("&nbsp;");
add_word ("<a rel=\"previous\" accesskey=\"p\" href=\"");
add_anchor_name (tem, 1);
add_word_args ("\">%s</a>", tem);
@@ -955,6 +957,7 @@ cm_node ()
tem = expansion (up, 0);
add_word (",\n");
add_word (_("Up:"));
+ add_word ("&nbsp;");
add_word ("<a rel=\"up\" accesskey=\"u\" href=\"");
add_anchor_name (tem, 1);
add_word_args ("\">%s</a>", tem);
@@ -979,7 +982,7 @@ cm_node ()
if (prev)
{
xml_insert_element (NODEPREV, START);
- execute_string ("%s", prev);
+ execute_string ("%s", prev);
xml_insert_element (NODEPREV, END);
}
if (up)
@@ -1042,6 +1045,9 @@ cm_anchor (arg)
/* Parse the anchor text. */
anchor = get_xref_token (1);
+ /* Force all versions of "top" to be "Top". */
+ normalize_node_name (anchor);
+
/* In HTML mode, need to actually produce some output. */
if (html)
{
@@ -1292,7 +1298,7 @@ validate (tag, line, label)
/* The strings here are followed in the message by `reference to...' in
the `validate' routine. They are only used in messages, thus are
translated. */
-static char *
+static const char *
reftype_type_string (type)
enum reftype type;
{
@@ -1598,7 +1604,7 @@ last_node_p (tags)
break;
}
}
-
+
return last;
}
@@ -1628,8 +1634,8 @@ split_file (filename, size)
if (size == 0)
size = DEFAULT_SPLIT_SIZE;
- if ((stat (filename, &fileinfo) != 0) ||
- (((long) fileinfo.st_size) < SPLIT_SIZE_THRESHOLD))
+ if ((stat (filename, &fileinfo) != 0)
+ || (((long) fileinfo.st_size) < size))
return;
file_size = (long) fileinfo.st_size;
@@ -1656,6 +1662,10 @@ split_file (filename, size)
TAG_ENTRY *tags = tag_table;
char *indirect_info = NULL;
+ /* Maybe we want a Local Variables section. */
+ char *trailer = info_trailer ();
+ int trailer_len = trailer ? strlen (trailer) : 0;
+
/* Remember the `header' of this file. The first tag in the file is
the bottom of the header; the top of the file is the start. */
the_header = xmalloc (1 + (header_size = tags->position));
@@ -1777,7 +1787,9 @@ split_file (filename, size)
|| write (fd, the_header, header_size) != header_size
|| write (fd, the_file + file_top, file_bot - file_top)
!= (file_bot - file_top)
- || (close (fd)) < 0)
+ || (trailer_len
+ && write (fd, trailer, trailer_len) != trailer_len)
+ || close (fd) < 0)
{
perror (split_filename);
if (fd != -1)
@@ -1822,7 +1834,16 @@ split_file (filename, size)
/* Inhibit newlines. */
paragraph_is_open = 0;
+ /* Write the indirect tag table. */
write_tag_table_indirect ();
+
+ /* preserve local variables in info output. */
+ if (trailer)
+ {
+ insert_string (trailer);
+ free (trailer);
+ }
+
fclose (output_stream);
free (the_header);
free (the_file);
diff --git a/contrib/texinfo/makeinfo/sectioning.c b/contrib/texinfo/makeinfo/sectioning.c
index 761dd39..cd04dfa 100644
--- a/contrib/texinfo/makeinfo/sectioning.c
+++ b/contrib/texinfo/makeinfo/sectioning.c
@@ -1,7 +1,7 @@
/* sectioning.c -- for @chapter, @section, ..., @contents ...
- $Id: sectioning.c,v 1.6 2002/11/08 02:21:07 karl Exp $
+ $Id: sectioning.c,v 1.10 2003/05/13 16:37:54 karl Exp $
- Copyright (C) 1999, 2001, 2002 Free Software Foundation, Inc.
+ Copyright (C) 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
@@ -52,7 +52,7 @@ section_alist_type section_alist[] = {
{ "heading", 3, ENUM_SECT_NO, TOC_NO },
{ "chapheading", 2, ENUM_SECT_NO, TOC_NO },
{ "majorheading", 2, ENUM_SECT_NO, TOC_NO },
-
+
{ "top", 1, ENUM_SECT_NO, TOC_YES },
{ NULL, 0, 0, 0 }
};
@@ -151,7 +151,7 @@ search_sectioning (text)
/* ignore the optional command prefix */
if (text[0] == COMMAND_PREFIX)
text++;
-
+
for (i = 0; (t = section_alist[i].name); i++)
{
if (strcmp (t, text) == 0)
@@ -161,7 +161,7 @@ search_sectioning (text)
}
return -1;
}
-
+
/* Return an integer which identifies the type section present in TEXT. */
int
what_section (text)
@@ -215,6 +215,11 @@ void
sectioning_underscore (cmd)
char *cmd;
{
+ /* If we're not indenting the first paragraph, we shall make it behave
+ like @noindent is called directly after the section heading. */
+ if (! do_first_par_indent)
+ cm_noindent ();
+
if (xml)
{
char *temp;
@@ -231,7 +236,7 @@ sectioning_underscore (cmd)
the section and put an Index instead */
flush_output ();
xml_last_section_output_position = output_paragraph_offset;
-
+
xml_insert_element (xml_element (cmd), START);
xml_insert_element (TITLE, START);
xml_open_section (level, cmd);
@@ -239,8 +244,8 @@ sectioning_underscore (cmd)
execute_string ("%s\n", temp);
free (temp);
xml_insert_element (TITLE, END);
- }
- else
+ }
+ else
{
char character;
char *temp;
@@ -300,7 +305,7 @@ handle_enum_increment (level, index)
enum_marker = APPENDIX_MAGIC;
numbers [0] = 0; /* this means we start with Appendix A */
}
-
+
/* only increment counters if we are not in unnumbered
area. This handles situations like this:
@unnumbered .... This sets enum_marker to UNNUMBERED_MAGIC
@@ -312,7 +317,7 @@ handle_enum_increment (level, index)
/* reset all counters which are one level deeper */
for (i = level; i < 3; i++)
numbers [i + 1] = 0;
-
+
numbers[level]++;
return xstrdup
(get_sectioning_number (level, section_alist[index].num));
@@ -397,6 +402,7 @@ insert_and_underscore (level, with_char, cmd)
/* Insert the text following input_text_offset up to the end of the
line as an HTML heading element of the appropriate `level' and
tagged as an anchor for the current node.. */
+
void
sectioning_html (level, cmd)
int level;
@@ -413,8 +419,10 @@ sectioning_html (level, cmd)
old_no_indent = no_indent;
no_indent = 1;
- /* level 0 (chapter) is <h2> */
- add_word_args ("<h%d class=\"%s\">", level + 2, cmd);
+ /* level 0 (chapter) is <h2>, everything else is <h3>. We don't want
+ to go lower than that because browsers then start rendering the
+ headings smaller than the text. */
+ add_word_args ("<h%d class=\"%s\">", MIN (3, level + 2), cmd);
/* If we are outside of any node, produce an anchor that
the TOC could refer to. */
@@ -429,7 +437,7 @@ sectioning_html (level, cmd)
/* This must be added after toc_anchor is extracted, since
toc_anchor cannot include the closing </a>. For details,
see toc.c:toc_add_entry and toc.c:contents_update_html.
-
+
Also, the anchor close must be output before the section name
in case the name itself contains an anchor. */
add_word ("</a>");
@@ -535,7 +543,6 @@ cm_top ()
}
else
{
- TAG_ENTRY *top_node = find_node ("Top");
top_node_seen = 1;
/* It is an error to use @top before using @node. */
diff --git a/contrib/texinfo/makeinfo/xml.c b/contrib/texinfo/makeinfo/xml.c
index 16316e0..83c8b56 100644
--- a/contrib/texinfo/makeinfo/xml.c
+++ b/contrib/texinfo/makeinfo/xml.c
@@ -1,7 +1,7 @@
/* xml.c -- xml output.
- $Id: xml.c,v 1.18 2002/12/17 16:34:22 karl Exp $
+ $Id: xml.c,v 1.19 2003/05/13 16:37:54 karl Exp $
- Copyright (C) 2001, 2002 Free Software Foundation, Inc.
+ Copyright (C) 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
@@ -316,7 +316,7 @@ element docbook_element_list [] = {
{ "comment", 0, 0 },
{ "function", 0, 1 },
{ "legalnotice", 1, 0 },
-
+
{ "para", 0, 0 } /* Must be last */
/* name / contains para / contained in para */
};
@@ -600,7 +600,7 @@ xml_insert_element_with_attribute (elt, arg, format, va_alist)
if (docbook && !only_macro_expansion && (in_menu || in_detailmenu))
return;
-
+
if (!xml_element_list[elt].name || !strlen (xml_element_list[elt].name))
{
/*printf ("Warning: Inserting empty element %d\n", elt);*/
@@ -634,7 +634,7 @@ xml_insert_element_with_attribute (elt, arg, format, va_alist)
if (arg == START && !xml_in_para && !xml_element_list[elt].contained_in_para)
xml_indent ();
- if (docbook && xml_table_level && !xml_in_item[xml_table_level] && !in_table_title
+ if (docbook && xml_table_level && !xml_in_item[xml_table_level] && !in_table_title
&& arg == START && elt != TABLEITEM && elt != TABLETERM
&& !in_indexterm && xml_current_element() == TABLE)
{
@@ -879,8 +879,8 @@ xml_add_char (character)
return;
if (docbook && !only_macro_expansion && (in_menu || in_detailmenu))
return;
-
- if (docbook && xml_table_level && !xml_in_item[xml_table_level] && !in_table_title
+
+ if (docbook && xml_table_level && !xml_in_item[xml_table_level] && !in_table_title
&& !cr_or_whitespace (character) && !in_indexterm)
{
in_table_title = 1;
@@ -1229,6 +1229,7 @@ xml_asterisk ()
to have real multilivel indexing support, not just string analysis. */
#define INDEX_SEP "@this string will never appear@" /* was , */
+void
xml_insert_indexterm (indexterm, index)
char *indexterm;
char *index;
OpenPOWER on IntegriCloud