bug-texinfo
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

patch to makeinfo's xml handling


From: Per Bothner
Subject: patch to makeinfo's xml handling
Date: Sat, 05 Feb 2005 00:13:44 -0800
User-agent: Mozilla/5.0 (X11; U; Linux i686; en-US; rv:1.7.3) Gecko/20041020

I noticed that makeinfo --docbook wasn't mapping uref to
ulink, which the ChangeLog claimed it would do.  I tracked
it down to two elements missing in docbook_element_list.
See the attached patch.

I also added a sanity test to quickly detect such bugs
in the future.  The test only checks if the total number
of entries is correct; not that the entries are in the
correct order.  To do that you can either construct the
table at initialization time (which should be plenty fast
enough), or use designated initializers, as in C99:

element docbook_element_list [PARA+1] = {
  [TEXINFO] = { "book",  0, 0, 0 },
  [SETFILENAME] = { "", 0, 0, 0 },
  ...;

Of course this means you'd no longer be able to build
makeinfo with a non-C99 compiler, but I don't think
this is a problem: Gcc has had this extension for a
long time (though I'm not sure if it's always used
the syntax).  (You could also get rid of the non-__STDC_;
if we can require a standard C compiler to compile Gcc,
there is no reason to support K&R C for texinfo.)
--
        --Per Bothner
address@hidden   http://per.bothner.com/
2005-02-04  Per Bothner  <address@hidden>

        * makeinfo/xml.c (docbook_element_list): Add two missing entries.

        * makeinfo/xml.c (xml_begin_document): Check for mipatch between
        enum xml_element and texinfoml_element_list/docbook_element_list.

--- xml.c~      2004-12-19 09:02:23.000000000 -0800
+++ xml.c       2005-02-04 23:55:02.176540645 -0800
@@ -329,6 +329,8 @@ element docbook_element_list [] = {
   { "wordasword",          0, 1, 0 }, /* I */
   { "emphasis",            0, 1, 0 }, /* B */
   { "",                    0, 1, 0 }, /* R */
+  { "",                    0, 1, 0 }, /* SLANTED */
+  { "",                    0, 1, 0 }, /* SANSSERIF */
 
   { "",                    0, 0, 0 }, /* EXDENT */
 
@@ -635,6 +637,13 @@ xml_begin_document (char *output_filenam
       insert_string ("/texinfo.dtd\">");
       xml_element_list = texinfoml_element_list;
     }
+
+  if (strcmp (xml_element_list[PARA].name, "para"))
+    {
+      printf ("internal error: xml_element_list table inconsistent");
+      xexit (-1);
+    }
+
   if (language_code != last_language_code)
     {
       if (docbook)

reply via email to

[Prev in Thread] Current Thread [Next in Thread]