Fix enum handling.

web
Michael R Sweet 21 years ago
parent 417206e811
commit 4dbac7157e
  1. 2
      documentation.html
  2. 26
      mxml-node.c
  3. 29
      mxmldoc.c

@ -826,7 +826,7 @@ typedef union <a href="#mxml_value_u">mxml_value_u</a> mxml_value_t;
<p>An XML node value.</p> <p>An XML node value.</p>
<h3>Definition</h3> <h3>Definition</h3>
<pre> <pre>
struct mxml_value_u union mxml_value_u
{ {
<a href="#mxml_element_t">mxml_element_t</a> element; <a href="#mxml_element_t">mxml_element_t</a> element;
int integer; int integer;

@ -1,5 +1,5 @@
/* /*
* "$Id: mxml-node.c,v 1.10 2003/12/03 03:59:04 mike Exp $" * "$Id: mxml-node.c,v 1.11 2003/12/04 04:55:57 mike Exp $"
* *
* Node support code for mini-XML, a small XML-like file parsing library. * Node support code for mini-XML, a small XML-like file parsing library.
* *
@ -75,10 +75,13 @@ mxmlAdd(mxml_node_t *parent, /* I - Parent node */
#if DEBUG > 1 #if DEBUG > 1
fprintf(stderr, " BEFORE: node->parent=%p\n", node->parent); fprintf(stderr, " BEFORE: node->parent=%p\n", node->parent);
fprintf(stderr, " BEFORE: parent->child=%p\n", parent->child); if (parent)
fprintf(stderr, " BEFORE: parent->last_child=%p\n", parent->last_child); {
fprintf(stderr, " BEFORE: parent->prev=%p\n", parent->prev); fprintf(stderr, " BEFORE: parent->child=%p\n", parent->child);
fprintf(stderr, " BEFORE: parent->next=%p\n", parent->next); fprintf(stderr, " BEFORE: parent->last_child=%p\n", parent->last_child);
fprintf(stderr, " BEFORE: parent->prev=%p\n", parent->prev);
fprintf(stderr, " BEFORE: parent->next=%p\n", parent->next);
}
#endif /* DEBUG > 1 */ #endif /* DEBUG > 1 */
/* /*
@ -168,10 +171,13 @@ mxmlAdd(mxml_node_t *parent, /* I - Parent node */
#if DEBUG > 1 #if DEBUG > 1
fprintf(stderr, " AFTER: node->parent=%p\n", node->parent); fprintf(stderr, " AFTER: node->parent=%p\n", node->parent);
fprintf(stderr, " AFTER: parent->child=%p\n", parent->child); if (parent)
fprintf(stderr, " AFTER: parent->last_child=%p\n", parent->last_child); {
fprintf(stderr, " AFTER: parent->prev=%p\n", parent->prev); fprintf(stderr, " AFTER: parent->child=%p\n", parent->child);
fprintf(stderr, " AFTER: parent->next=%p\n", parent->next); fprintf(stderr, " AFTER: parent->last_child=%p\n", parent->last_child);
fprintf(stderr, " AFTER: parent->prev=%p\n", parent->prev);
fprintf(stderr, " AFTER: parent->next=%p\n", parent->next);
}
#endif /* DEBUG > 1 */ #endif /* DEBUG > 1 */
} }
@ -626,5 +632,5 @@ mxml_new(mxml_node_t *parent, /* I - Parent node */
/* /*
* End of "$Id: mxml-node.c,v 1.10 2003/12/03 03:59:04 mike Exp $". * End of "$Id: mxml-node.c,v 1.11 2003/12/04 04:55:57 mike Exp $".
*/ */

@ -1,5 +1,5 @@
/* /*
* "$Id: mxmldoc.c,v 1.21 2003/12/03 22:22:49 mike Exp $" * "$Id: mxmldoc.c,v 1.22 2003/12/04 04:55:57 mike Exp $"
* *
* Documentation generator using mini-XML, a small XML-like file parsing * Documentation generator using mini-XML, a small XML-like file parsing
* library. * library.
@ -716,8 +716,19 @@ scan_file(const char *filename, /* I - Filename */
} }
break; break;
case '=' :
if (type)
{
#ifdef DEBUG
fputs("Identifier: <<<< = >>>\n", stderr);
#endif /* DEBUG */
ch = type->last_child->value.text.string[0];
mxmlNewText(type, isalnum(ch) || ch == '_', "=");
}
break;
default : /* Other */ default : /* Other */
if (isalpha(ch) || ch == '_' || ch == '.') if (isalnum(ch) || ch == '_' || ch == '.')
{ {
state = STATE_IDENTIFIER; state = STATE_IDENTIFIER;
bufptr = buffer; bufptr = buffer;
@ -1061,11 +1072,15 @@ scan_file(const char *filename, /* I - Filename */
#ifdef DEBUG #ifdef DEBUG
fprintf(stderr, "function: %s\n", buffer); fprintf(stderr, "function: %s\n", buffer);
fprintf(stderr, " comment=%p\n", comment);
fprintf(stderr, " child = (%p) %s\n", fprintf(stderr, " child = (%p) %s\n",
comment->child, comment->child->value.text.string); comment->child,
comment->child ?
comment->child->value.text.string : "(null)");
fprintf(stderr, " last_child = (%p) %s\n", fprintf(stderr, " last_child = (%p) %s\n",
comment->last_child, comment->last_child,
comment->last_child->value.text.string); comment->last_child ?
comment->last_child->value.text.string : "(null)");
#endif /* DEBUG */ #endif /* DEBUG */
if (!type->last_child || if (!type->last_child ||
@ -1211,7 +1226,7 @@ scan_file(const char *filename, /* I - Filename */
buffer); buffer);
} }
} }
else if (enumeration) else if (enumeration && !isdigit(buffer[0]))
{ {
#ifdef DEBUG #ifdef DEBUG
fprintf(stderr, "Constant: <<<< %s >>>\n", buffer); fprintf(stderr, "Constant: <<<< %s >>>\n", buffer);
@ -1920,7 +1935,7 @@ write_documentation(mxml_node_t *doc) /* I - XML documentation */
puts("<h3>Definition</h3>"); puts("<h3>Definition</h3>");
puts("<pre>"); puts("<pre>");
printf("struct %s\n{\n", name); printf("union %s\n{\n", name);
for (arg = mxmlFindElement(scut, scut, "variable", NULL, NULL, for (arg = mxmlFindElement(scut, scut, "variable", NULL, NULL,
MXML_DESCEND_FIRST); MXML_DESCEND_FIRST);
arg; arg;
@ -2148,5 +2163,5 @@ ws_cb(mxml_node_t *node, /* I - Element node */
/* /*
* End of "$Id: mxmldoc.c,v 1.21 2003/12/03 22:22:49 mike Exp $". * End of "$Id: mxmldoc.c,v 1.22 2003/12/04 04:55:57 mike Exp $".
*/ */

Loading…
Cancel
Save