From 0fd3bd7f336c2e164dedf20e33154c39fb4c90c3 Mon Sep 17 00:00:00 2001 From: Michael R Sweet Date: Tue, 1 Jun 2004 20:19:34 +0000 Subject: [PATCH] Optimizations and bug fixes from STR #2: - mxmlIndexNew() sort algorithm update to eliminate unnecessary right-hand recursion. - Combine printf() and puts() calls in mxmldoc to reduce the number of calls and code size. - mxmlSaveFile() now writes Unicode chars with fwrite for potential speedup and modest size savings. - mxmlEntityAddCallback() now returns an integer status so an app knows when it was not possible to add an entity callback. --- CHANGES | 6 +- doc/reference.html | 7 +- doc/relnotes.html | 6 ++ mxml-attr.c | 13 ++- mxml-entity.c | 14 ++- mxml-file.c | 56 ++++++----- mxml-index.c | 85 ++++++++-------- mxml-private.c | 10 +- mxml.h | 6 +- mxml.xml | 4 + mxmldoc.c | 241 +++++++++++++++++++++------------------------ 11 files changed, 233 insertions(+), 215 deletions(-) diff --git a/CHANGES b/CHANGES index 559f928..661dc09 100644 --- a/CHANGES +++ b/CHANGES @@ -1,9 +1,13 @@ -README - 05/16/2004 +README - 06/01/2004 ------------------- CHANGES IN Mini-XML 2.0 - New programmers manual. + - Added optimizations to mxmldoc, mxmlSaveFile(), and + mxmlIndexNew() (STR #2) + - mxmlEntityAddCallback() now returns an integer status + (STR #2) - Added UTF-16 support (input only; all output is UTF-8) - Added index functions to build a searchable index of XML nodes. diff --git a/doc/reference.html b/doc/reference.html index f39d325..3757cb4 100644 --- a/doc/reference.html +++ b/doc/reference.html @@ -191,7 +191,7 @@ mxmlElementSetAttr(

Add a callback to convert entities to Unicode.

Syntax

-void
+int
 mxmlEntityAddCallback(
     int (*cb)(const char *name));
 
@@ -202,7 +202,7 @@ mxmlEntityAddCallback( (*cb)(const char *name)Callback function to add

Returns

-

Nothing.

+

0 on success, -1 on failure

mxmlEntityGetName()


@@ -1215,8 +1215,7 @@ union mxml_value_u

num_callbacks

-
-

Definition

+

Definition

 static int num_callbacks = 1;
 
diff --git a/doc/relnotes.html b/doc/relnotes.html index b28957d..bb35b2c 100644 --- a/doc/relnotes.html +++ b/doc/relnotes.html @@ -9,6 +9,12 @@
  • New programmers manual.
  • +
  • Added optimizations to mxmldoc, mxmlSaveFile(), and + mxmlIndexNew() (STR #2)
  • + +
  • mxmlEntityAddCallback() now returns an integer + status (STR #2)
  • +
  • Added UTF-16 support (input only; all output is UTF-8)
  • diff --git a/mxml-attr.c b/mxml-attr.c index 519f92d..0a50138 100644 --- a/mxml-attr.c +++ b/mxml-attr.c @@ -1,5 +1,5 @@ /* - * "$Id: mxml-attr.c,v 1.8 2004/05/02 16:04:40 mike Exp $" + * "$Id: mxml-attr.c,v 1.9 2004/06/01 20:19:34 mike Exp $" * * Attribute support code for Mini-XML, a small XML-like file parsing library. * @@ -117,10 +117,15 @@ mxmlElementSetAttr(mxml_node_t *node, /* I - Element node */ * Replace the attribute value and return... */ - free(attr->value); + if (attr->value) + free(attr->value); if (value) - attr->value = strdup(value); + { + if ((attr->value = strdup(value)) == NULL) + mxml_error("Unable to allocate memory for attribute '%s' in element %s!", + name, node->value.element.name); + } else attr->value = NULL; @@ -172,5 +177,5 @@ mxmlElementSetAttr(mxml_node_t *node, /* I - Element node */ /* - * End of "$Id: mxml-attr.c,v 1.8 2004/05/02 16:04:40 mike Exp $". + * End of "$Id: mxml-attr.c,v 1.9 2004/06/01 20:19:34 mike Exp $". */ diff --git a/mxml-entity.c b/mxml-entity.c index bfd9657..fe1bb82 100644 --- a/mxml-entity.c +++ b/mxml-entity.c @@ -1,5 +1,5 @@ /* - * "$Id: mxml-entity.c,v 1.4 2004/05/16 05:25:38 mike Exp $" + * "$Id: mxml-entity.c,v 1.5 2004/06/01 20:19:34 mike Exp $" * * Character entity support code for Mini-XML, a small XML-like * file parsing library. @@ -58,7 +58,7 @@ static int (*callbacks[100])(const char *name) = * 'mxmlEntityAddCallback()' - Add a callback to convert entities to Unicode. */ -void +int /* O - 0 on success, -1 on failure */ mxmlEntityAddCallback(int (*cb)(const char *name)) /* I - Callback function to add */ { @@ -66,6 +66,14 @@ mxmlEntityAddCallback(int (*cb)(const char *name)) { callbacks[num_callbacks] = cb; num_callbacks ++; + + return (0); + } + else + { + mxml_error("Unable to add entity callback!"); + + return (-1); } } @@ -451,5 +459,5 @@ default_callback(const char *name) /* I - Entity name */ /* - * End of "$Id: mxml-entity.c,v 1.4 2004/05/16 05:25:38 mike Exp $". + * End of "$Id: mxml-entity.c,v 1.5 2004/06/01 20:19:34 mike Exp $". */ diff --git a/mxml-file.c b/mxml-file.c index 338edcf..279bba2 100644 --- a/mxml-file.c +++ b/mxml-file.c @@ -1,5 +1,5 @@ /* - * "$Id: mxml-file.c,v 1.31 2004/05/16 21:54:47 mike Exp $" + * "$Id: mxml-file.c,v 1.32 2004/06/01 20:19:34 mike Exp $" * * File loading code for Mini-XML, a small XML-like file parsing library. * @@ -601,18 +601,24 @@ static int /* O - 0 on success, -1 on failure */ mxml_file_putc(int ch, /* I - Character to write */ void *p) /* I - Pointer to file */ { + char buffer[4], /* Buffer for character */ + *bufptr; /* Pointer into buffer */ + int buflen; /* Number of bytes to write */ + + if (ch < 128) - return (putc(ch, (FILE *)p)); - else if (ch < 2048) + return (putc(ch, (FILE *)p) == EOF ? -1 : 0); + + bufptr = buffer; + + if (ch < 2048) { /* * Two-byte UTF-8 character... */ - if (putc(0xc0 | (ch >> 6), (FILE *)p) < 0) - return (-1); - else - return (putc(0x80 | (ch & 0x3f), (FILE *)p)); + *bufptr++ = 0xc0 | (ch >> 6); + *bufptr++ = 0x80 | (ch & 0x3f); } else if (ch < 65536) { @@ -620,12 +626,9 @@ mxml_file_putc(int ch, /* I - Character to write */ * Three-byte UTF-8 character... */ - if (putc(0xe0 | (ch >> 12), (FILE *)p) < 0) - return (-1); - else if (putc(0x80 | ((ch >> 6) & 0x3f), (FILE *)p) < 0) - return (-1); - else - return (putc(0x80 | (ch & 0x3f), (FILE *)p)); + *bufptr++ = 0xe0 | (ch >> 12); + *bufptr++ = 0x80 | ((ch >> 6) & 0x3f); + *bufptr++ = 0x80 | (ch & 0x3f); } else { @@ -633,15 +636,15 @@ mxml_file_putc(int ch, /* I - Character to write */ * Four-byte UTF-8 character... */ - if (putc(0xf0 | (ch >> 18), (FILE *)p) < 0) - return (-1); - else if (putc(0x80 | ((ch >> 12) & 0x3f), (FILE *)p) < 0) - return (-1); - else if (putc(0x80 | ((ch >> 6) & 0x3f), (FILE *)p) < 0) - return (-1); - else - return (putc(0x80 | (ch & 0x3f), (FILE *)p)); + *bufptr++ = 0xf0 | (ch >> 18); + *bufptr++ = 0x80 | ((ch >> 12) & 0x3f); + *bufptr++ = 0x80 | ((ch >> 6) & 0x3f); + *bufptr++ = 0x80 | (ch & 0x3f); } + + buflen = bufptr - buffer; + + return (fwrite(buffer, 1, buflen, (FILE *)p) < buflen ? -1 : 0); } @@ -1633,6 +1636,7 @@ mxml_write_node(mxml_node_t *node, /* I - Node to write */ width; /* Width of attr + value */ mxml_attr_t *attr; /* Current attribute */ char s[255]; /* Temporary string */ + int slen; /* Length of temporary string */ while (node != NULL) @@ -1779,11 +1783,11 @@ mxml_write_node(mxml_node_t *node, /* I - Node to write */ col ++; } - sprintf(s, "%d", node->value.integer); + slen = snprintf(s, sizeof(s), "%d", node->value.integer); if (mxml_write_string(s, p, putc_cb) < 0) return (-1); - col += strlen(s); + col += slen; break; case MXML_OPAQUE : @@ -1809,11 +1813,11 @@ mxml_write_node(mxml_node_t *node, /* I - Node to write */ col ++; } - sprintf(s, "%f", node->value.real); + slen = snprintf(s, sizeof(s), "%f", node->value.real); if (mxml_write_string(s, p, putc_cb) < 0) return (-1); - col += strlen(s); + col += slen; break; case MXML_TEXT : @@ -1932,5 +1936,5 @@ mxml_write_ws(mxml_node_t *node, /* I - Current node */ /* - * End of "$Id: mxml-file.c,v 1.31 2004/05/16 21:54:47 mike Exp $". + * End of "$Id: mxml-file.c,v 1.32 2004/06/01 20:19:34 mike Exp $". */ diff --git a/mxml-index.c b/mxml-index.c index 494d73c..086f779 100644 --- a/mxml-index.c +++ b/mxml-index.c @@ -1,5 +1,5 @@ /* - * "$Id: mxml-index.c,v 1.4 2004/05/16 18:25:20 mike Exp $" + * "$Id: mxml-index.c,v 1.5 2004/06/01 20:19:34 mike Exp $" * * Index support code for Mini-XML, a small XML-like file parsing library. * @@ -581,64 +581,69 @@ index_sort(mxml_index_t *ind, /* I - Index to sort */ /* - * Sort the pivot in the current partition... + * Loop until we have sorted all the way to the right... */ - pivot = ind->nodes[left]; - - for (templ = left, tempr = right; templ < tempr;) + do { /* - * Move left while left node <= pivot node... + * Sort the pivot in the current partition... */ - while ((templ < right) && - index_compare(ind, ind->nodes[templ], pivot) <= 0) - templ ++; + pivot = ind->nodes[left]; - /* - * Move right while right node > pivot node... - */ + for (templ = left, tempr = right; templ < tempr;) + { + /* + * Move left while left node <= pivot node... + */ + + while ((templ < right) && + index_compare(ind, ind->nodes[templ], pivot) <= 0) + templ ++; + + /* + * Move right while right node > pivot node... + */ - while ((tempr > left) && - index_compare(ind, ind->nodes[tempr], pivot) > 0) - tempr --; + while ((tempr > left) && + index_compare(ind, ind->nodes[tempr], pivot) > 0) + tempr --; + + /* + * Swap nodes if needed... + */ + + if (templ < tempr) + { + temp = ind->nodes[templ]; + ind->nodes[templ] = ind->nodes[tempr]; + ind->nodes[tempr] = temp; + } + } /* - * Swap nodes if needed... + * When we get here, the right (tempr) node is the new position for the + * pivot node... */ - if (templ < tempr) + if (index_compare(ind, pivot, ind->nodes[tempr]) > 0) { - temp = ind->nodes[templ]; - ind->nodes[templ] = ind->nodes[tempr]; - ind->nodes[tempr] = temp; + ind->nodes[left] = ind->nodes[tempr]; + ind->nodes[tempr] = pivot; } - } - /* - * When we get here, the right (tempr) node is the new position for the - * pivot node... - */ + /* + * Recursively sort the left partition as needed... + */ - if (index_compare(ind, pivot, ind->nodes[tempr]) > 0) - { - ind->nodes[left] = ind->nodes[tempr]; - ind->nodes[tempr] = pivot; + if (left < (tempr - 1)) + index_sort(ind, left, tempr - 1); } - - /* - * Recursively sort the left and right partitions as needed... - */ - - if (left < (tempr - 1)) - index_sort(ind, left, tempr - 1); - - if (right > (tempr + 1)) - index_sort(ind, tempr + 1, right); + while (right > (left = tempr + 1)); } /* - * End of "$Id: mxml-index.c,v 1.4 2004/05/16 18:25:20 mike Exp $". + * End of "$Id: mxml-index.c,v 1.5 2004/06/01 20:19:34 mike Exp $". */ diff --git a/mxml-private.c b/mxml-private.c index c9d01ef..3f793c3 100644 --- a/mxml-private.c +++ b/mxml-private.c @@ -1,5 +1,5 @@ /* - * "$Id: mxml-private.c,v 1.4 2004/05/02 16:04:40 mike Exp $" + * "$Id: mxml-private.c,v 1.5 2004/06/01 20:19:34 mike Exp $" * * Private functions for Mini-XML, a small XML-like file parsing library. * @@ -74,11 +74,7 @@ mxml_error(const char *format, /* I - Printf-style format string */ if (mxml_error_cb) (*mxml_error_cb)(s); else - { - fputs("mxml: ", stderr); - fputs(s, stderr); - putc('\n', stderr); - } + fprintf(stderr, "mxml: %s\n", s); /* * Free the string... @@ -128,5 +124,5 @@ mxml_real_cb(mxml_node_t *node) /* I - Current node */ /* - * End of "$Id: mxml-private.c,v 1.4 2004/05/02 16:04:40 mike Exp $". + * End of "$Id: mxml-private.c,v 1.5 2004/06/01 20:19:34 mike Exp $". */ diff --git a/mxml.h b/mxml.h index 0e7ab27..84163d4 100644 --- a/mxml.h +++ b/mxml.h @@ -1,5 +1,5 @@ /* - * "$Id: mxml.h,v 1.20 2004/05/16 05:25:38 mike Exp $" + * "$Id: mxml.h,v 1.21 2004/06/01 20:19:34 mike Exp $" * * Header file for Mini-XML, a small XML-like file parsing library. * @@ -146,7 +146,7 @@ extern void mxmlDelete(mxml_node_t *node); extern const char *mxmlElementGetAttr(mxml_node_t *node, const char *name); extern void mxmlElementSetAttr(mxml_node_t *node, const char *name, const char *value); -extern void mxmlEntityAddCallback(int (*cb)(const char *name)); +extern int mxmlEntityAddCallback(int (*cb)(const char *name)); extern const char *mxmlEntityGetName(int val); extern int mxmlEntityGetValue(const char *name); extern void mxmlEntityRemoveCallback(int (*cb)(const char *name)); @@ -225,5 +225,5 @@ extern mxml_type_t mxml_real_cb(mxml_node_t *node); /* - * End of "$Id: mxml.h,v 1.20 2004/05/16 05:25:38 mike Exp $". + * End of "$Id: mxml.h,v 1.21 2004/06/01 20:19:34 mike Exp $". */ diff --git a/mxml.xml b/mxml.xml index a19c082..8e53752 100644 --- a/mxml.xml +++ b/mxml.xml @@ -75,6 +75,10 @@ not an element. + + int + 0 on success, -1 on failure + Add a callback to convert entities to Unicode. int diff --git a/mxmldoc.c b/mxmldoc.c index 2759509..235ab26 100644 --- a/mxmldoc.c +++ b/mxmldoc.c @@ -1,5 +1,5 @@ /* - * "$Id: mxmldoc.c,v 1.36 2004/05/02 22:02:36 mike Exp $" + * "$Id: mxmldoc.c,v 1.37 2004/06/01 20:19:34 mike Exp $" * * Documentation generator using Mini-XML, a small XML-like file parsing * library. @@ -1779,19 +1779,18 @@ write_documentation(mxml_node_t *doc) /* I - XML documentation */ */ puts(""); - puts(""); - puts(""); - puts("\tDocumentation"); - puts("\t"); - puts("\t"); - puts(""); - puts(""); - + "\"http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd\">\n" + "\n" + "\n" + "\tDocumentation\n" + "\t\n" + "\t\n" + "\n" + ""); /* * Table of contents... @@ -1821,9 +1820,9 @@ write_documentation(mxml_node_t *doc) /* I - XML documentation */ if (mxmlFindElement(doc, doc, "class", NULL, NULL, MXML_DESCEND_FIRST)) { - puts(""); - puts("

    Classes

    "); - puts("
      "); + puts("\n" + "

      Classes

      \n" + "
        "); for (scut = mxmlFindElement(doc, doc, "class", NULL, NULL, MXML_DESCEND_FIRST); @@ -1844,24 +1843,23 @@ write_documentation(mxml_node_t *doc) /* I - XML documentation */ MXML_NO_DESCEND)) { cname = mxmlElementGetAttr(scut, "name"); - puts(""); - printf("

        %s

        \n", cname, cname); - puts("
        "); + printf("\n" + "

        %s

        \n" + "
        \n", cname, cname); description = mxmlFindElement(scut, scut, "description", NULL, NULL, MXML_DESCEND_FIRST); if (description) { - puts("

        Description

        "); - fputs("

        ", stdout); + fputs("

        Description

        \n" + "

        ", stdout); write_element(NULL, description); puts("

        "); } - puts("

        Definition

        "); - puts("
        ");
        -
        -      printf("class %s", cname);
        +      printf("

        Definition

        \n" + "
        \n"
        +             "class %s", cname);
               if ((parent = mxmlElementGetAttr(scut, "parent")) != NULL)
                 printf(" %s", parent);
               puts("\n{");
        @@ -1948,14 +1946,12 @@ write_documentation(mxml_node_t *doc)	/* I - XML documentation */
         	}
               }
         
        -      puts("};\n
        "); - - puts("

        Members

        "); - - puts("

        "); - puts(""); - puts(""); + puts("};\n\n" + "

        Members

        \n" + "

        NameDescription
        \n" + "\n" + ""); for (arg = mxmlFindElement(scut, scut, "variable", NULL, NULL, MXML_DESCEND_FIRST); @@ -2001,7 +1997,6 @@ write_documentation(mxml_node_t *doc) /* I - XML documentation */ } puts("
        NameDescription

        "); - } } @@ -2011,9 +2006,9 @@ write_documentation(mxml_node_t *doc) /* I - XML documentation */ if (mxmlFindElement(doc, doc, "enumeration", NULL, NULL, MXML_DESCEND_FIRST)) { - puts(""); - puts("

        Enumerations

        "); - puts("
          "); + puts("\n" + "

          Enumerations

          \n" + "
            "); for (scut = mxmlFindElement(doc, doc, "enumeration", NULL, NULL, MXML_DESCEND_FIRST); @@ -2034,26 +2029,25 @@ write_documentation(mxml_node_t *doc) /* I - XML documentation */ MXML_NO_DESCEND)) { name = mxmlElementGetAttr(scut, "name"); - puts(""); - printf("

            %s

            \n", name, name); - puts("
            "); + printf("\n" + "

            %s

            \n" + "
            \n", name, name); description = mxmlFindElement(scut, scut, "description", NULL, NULL, MXML_DESCEND_FIRST); if (description) { - puts("

            Description

            "); - fputs("

            ", stdout); + fputs("

            Description

            \n" + "

            ", stdout); write_element(NULL, description); puts("

            "); } - puts("

            Values

            "); - - puts("

            "); - puts(""); - puts(""); + puts("

            Values

            \n" + "

            NameDescription
            \n" + "\n" + ""); for (arg = mxmlFindElement(scut, scut, "constant", NULL, NULL, MXML_DESCEND_FIRST); @@ -2079,9 +2073,9 @@ write_documentation(mxml_node_t *doc) /* I - XML documentation */ if (mxmlFindElement(doc, doc, "function", NULL, NULL, MXML_DESCEND_FIRST)) { - puts(""); - puts("

            Functions

            "); - puts("
              "); + puts("\n" + "

              Functions

              \n" + "
                "); for (function = mxmlFindElement(doc, doc, "function", NULL, NULL, MXML_DESCEND_FIRST); @@ -2102,22 +2096,22 @@ write_documentation(mxml_node_t *doc) /* I - XML documentation */ MXML_NO_DESCEND)) { name = mxmlElementGetAttr(function, "name"); - puts(""); - printf("

                %s()

                \n", name, name); - puts("
                "); + printf("\n" + "

                %s()

                \n" + "
                \n", name, name); description = mxmlFindElement(function, function, "description", NULL, NULL, MXML_DESCEND_FIRST); if (description) { - puts("

                Description

                "); - fputs("

                ", stdout); + fputs("

                Description

                \n" + "

                ", stdout); write_element(NULL, description); puts("

                "); } - puts("

                Syntax

                "); - puts("
                ");
                +      puts("

                Syntax

                \n" + "
                ");
                 
                       arg = mxmlFindElement(function, function, "returnvalue", NULL,
                                             NULL, MXML_DESCEND_FIRST);
                @@ -2161,9 +2155,9 @@ write_documentation(mxml_node_t *doc)	/* I - XML documentation */
                       else
                       {
                 	puts("

            NameDescription
            "); - puts(""); - puts(""); + "cellpadding='5' cellspacing='0' width='80%'>\n" + "\n" + ""); for (arg = mxmlFindElement(function, function, "argument", NULL, NULL, MXML_DESCEND_FIRST); @@ -2205,9 +2199,9 @@ write_documentation(mxml_node_t *doc) /* I - XML documentation */ if (mxmlFindElement(doc, doc, "struct", NULL, NULL, MXML_DESCEND_FIRST)) { - puts(""); - puts("

            Structures

            "); - puts("
              "); + puts("\n" + "

              Structures

              \n" + "
                "); for (scut = mxmlFindElement(doc, doc, "struct", NULL, NULL, MXML_DESCEND_FIRST); @@ -2228,24 +2222,23 @@ write_documentation(mxml_node_t *doc) /* I - XML documentation */ MXML_NO_DESCEND)) { cname = mxmlElementGetAttr(scut, "name"); - puts(""); - printf("

                %s

                \n", cname, cname); - puts("
                "); + printf("\n" + "

                %s

                \n" + "
                \n", cname, cname); description = mxmlFindElement(scut, scut, "description", NULL, NULL, MXML_DESCEND_FIRST); if (description) { - puts("

                Description

                "); - fputs("

                ", stdout); + fputs("

                Description

                \n" + "

                ", stdout); write_element(NULL, description); puts("

                "); } - puts("

                Definition

                "); - puts("
                ");
                -
                -      printf("struct %s\n{\n", cname);
                +      printf("

                Definition

                \n" + "
                \n"
                +	     "struct %s\n{\n", cname);
                       for (arg = mxmlFindElement(scut, scut, "variable", NULL, NULL,
                                         	 MXML_DESCEND_FIRST);
                 	   arg;
                @@ -2311,14 +2304,12 @@ write_documentation(mxml_node_t *doc)	/* I - XML documentation */
                 	  puts(");");
                       }
                 
                -      puts("};\n
                "); - - puts("

                Members

                "); - - puts("

            NameDescription
            NameDescription
            "); - puts(""); - puts(""); + puts("};\n\n" + "

            Members

            \n" + "

            NameDescription
            \n" + "\n" + ""); for (arg = mxmlFindElement(scut, scut, "variable", NULL, NULL, MXML_DESCEND_FIRST); @@ -2373,9 +2364,9 @@ write_documentation(mxml_node_t *doc) /* I - XML documentation */ if (mxmlFindElement(doc, doc, "typedef", NULL, NULL, MXML_DESCEND_FIRST)) { - puts(""); - puts("

            Types

            "); - puts("
              "); + puts("\n" + "

              Types

              \n" + "
                "); for (scut = mxmlFindElement(doc, doc, "typedef", NULL, NULL, MXML_DESCEND_FIRST); @@ -2396,24 +2387,23 @@ write_documentation(mxml_node_t *doc) /* I - XML documentation */ MXML_NO_DESCEND)) { name = mxmlElementGetAttr(scut, "name"); - puts(""); - printf("

                %s

                \n", name, name); - puts("
                "); + printf("\n" + "

                %s

                \n" + "
                \n", name, name); description = mxmlFindElement(scut, scut, "description", NULL, NULL, MXML_DESCEND_FIRST); if (description) { - puts("

                Description

                "); - fputs("

                ", stdout); + fputs("

                Description

                \n" + "

                ", stdout); write_element(NULL, description); puts("

                "); } - puts("

                Definition

                "); - puts("
                ");
                -
                -      printf("typedef ");
                +      fputs("

                Definition

                \n" + "
                \n"
                +	    "typedef ", stdout);
                       write_element(doc, mxmlFindElement(scut, scut, "type", NULL,
                                                          NULL, MXML_DESCEND_FIRST));
                       printf(" %s;\n
                \n", name); @@ -2426,9 +2416,9 @@ write_documentation(mxml_node_t *doc) /* I - XML documentation */ if (mxmlFindElement(doc, doc, "union", NULL, NULL, MXML_DESCEND_FIRST)) { - puts(""); - puts("

                Unions

                "); - puts("
                  "); + puts("\n" + "

                  Unions

                  \n" + "
                    "); for (scut = mxmlFindElement(doc, doc, "union", NULL, NULL, MXML_DESCEND_FIRST); @@ -2449,24 +2439,23 @@ write_documentation(mxml_node_t *doc) /* I - XML documentation */ MXML_NO_DESCEND)) { name = mxmlElementGetAttr(scut, "name"); - puts(""); - printf("

                    %s

                    \n", name, name); - puts("
                    "); + printf("\n" + "

                    %s

                    \n" + "
                    \n", name, name); description = mxmlFindElement(scut, scut, "description", NULL, NULL, MXML_DESCEND_FIRST); if (description) { - puts("

                    Description

                    "); - fputs("

                    ", stdout); + fputs("

                    Description

                    \n" + "

                    ", stdout); write_element(NULL, description); puts("

                    "); } - puts("

                    Definition

                    "); - puts("
                    ");
                    -
                    -      printf("union %s\n{\n", name);
                    +      printf("

                    Definition

                    \n" + "
                    \n"
                    +	     "union %s\n{\n", name);
                           for (arg = mxmlFindElement(scut, scut, "variable", NULL, NULL,
                                             	 MXML_DESCEND_FIRST);
                     	   arg;
                    @@ -2479,14 +2468,12 @@ write_documentation(mxml_node_t *doc)	/* I - XML documentation */
                     	printf(" %s;\n", mxmlElementGetAttr(arg, "name"));
                           }
                     
                    -      puts("};\n
                    "); - - puts("

                    Members

                    "); - - puts("

            NameDescription
            "); - puts(""); - puts(""); + puts("};\n\n" + "

            Members

            \n" + "

            NameDescription
            \n" + "\n" + ""); for (arg = mxmlFindElement(scut, scut, "variable", NULL, NULL, MXML_DESCEND_FIRST); @@ -2512,9 +2499,9 @@ write_documentation(mxml_node_t *doc) /* I - XML documentation */ if (mxmlFindElement(doc, doc, "variable", NULL, NULL, MXML_DESCEND_FIRST)) { - puts(""); - puts("

            Variables

            "); - puts("
              "); + puts("\n" + "

              Variables

              \n" + "
                "); for (arg = mxmlFindElement(doc, doc, "variable", NULL, NULL, MXML_DESCEND_FIRST); @@ -2535,22 +2522,22 @@ write_documentation(mxml_node_t *doc) /* I - XML documentation */ MXML_NO_DESCEND)) { name = mxmlElementGetAttr(arg, "name"); - puts(""); - printf("

                %s

                \n", name, name); - puts("
                "); + printf("\n" + "

                %s

                \n" + "
                ", name, name); description = mxmlFindElement(arg, arg, "description", NULL, NULL, MXML_DESCEND_FIRST); if (description) { - puts("

                Description

                "); - fputs("

                ", stdout); + fputs("

                Description

                \n" + "

                ", stdout); write_element(NULL, description); puts("

                "); } - puts("

                Definition

                "); - puts("
                ");
                +      puts("

                Definition

                \n" + "
                ");
                 
                       write_element(doc, mxmlFindElement(arg, arg, "type", NULL,
                                                          NULL, MXML_DESCEND_FIRST));
                @@ -2565,8 +2552,8 @@ write_documentation(mxml_node_t *doc)	/* I - XML documentation */
                   * Standard footer...
                   */
                 
                -  puts("");
                -  puts("");
                +  puts("\n"
                +       "");
                 }
                 
                 
                @@ -2748,5 +2735,5 @@ ws_cb(mxml_node_t *node,		/* I - Element node */
                 
                 
                 /*
                - * End of "$Id: mxmldoc.c,v 1.36 2004/05/02 22:02:36 mike Exp $".
                + * End of "$Id: mxmldoc.c,v 1.37 2004/06/01 20:19:34 mike Exp $".
                  */
                
            NameDescription