mirror of
https://github.com/michaelrsweet/mxml.git
synced 2024-11-08 05:29:58 +00:00
Fix enum handling.
This commit is contained in:
parent
417206e811
commit
4dbac7157e
@ -826,7 +826,7 @@ typedef union <a href="#mxml_value_u">mxml_value_u</a> mxml_value_t;
|
||||
<p>An XML node value.</p>
|
||||
<h3>Definition</h3>
|
||||
<pre>
|
||||
struct mxml_value_u
|
||||
union mxml_value_u
|
||||
{
|
||||
<a href="#mxml_element_t">mxml_element_t</a> element;
|
||||
int integer;
|
||||
|
26
mxml-node.c
26
mxml-node.c
@ -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.
|
||||
*
|
||||
@ -75,10 +75,13 @@ mxmlAdd(mxml_node_t *parent, /* I - Parent node */
|
||||
|
||||
#if DEBUG > 1
|
||||
fprintf(stderr, " BEFORE: node->parent=%p\n", node->parent);
|
||||
fprintf(stderr, " BEFORE: parent->child=%p\n", parent->child);
|
||||
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);
|
||||
if (parent)
|
||||
{
|
||||
fprintf(stderr, " BEFORE: parent->child=%p\n", parent->child);
|
||||
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 */
|
||||
|
||||
/*
|
||||
@ -168,10 +171,13 @@ mxmlAdd(mxml_node_t *parent, /* I - Parent node */
|
||||
|
||||
#if DEBUG > 1
|
||||
fprintf(stderr, " AFTER: node->parent=%p\n", node->parent);
|
||||
fprintf(stderr, " AFTER: parent->child=%p\n", parent->child);
|
||||
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);
|
||||
if (parent)
|
||||
{
|
||||
fprintf(stderr, " AFTER: parent->child=%p\n", parent->child);
|
||||
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 */
|
||||
}
|
||||
|
||||
@ -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 $".
|
||||
*/
|
||||
|
29
mxmldoc.c
29
mxmldoc.c
@ -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
|
||||
* library.
|
||||
@ -716,8 +716,19 @@ scan_file(const char *filename, /* I - Filename */
|
||||
}
|
||||
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 */
|
||||
if (isalpha(ch) || ch == '_' || ch == '.')
|
||||
if (isalnum(ch) || ch == '_' || ch == '.')
|
||||
{
|
||||
state = STATE_IDENTIFIER;
|
||||
bufptr = buffer;
|
||||
@ -1061,11 +1072,15 @@ scan_file(const char *filename, /* I - Filename */
|
||||
|
||||
#ifdef DEBUG
|
||||
fprintf(stderr, "function: %s\n", buffer);
|
||||
fprintf(stderr, " comment=%p\n", comment);
|
||||
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",
|
||||
comment->last_child,
|
||||
comment->last_child->value.text.string);
|
||||
comment->last_child ?
|
||||
comment->last_child->value.text.string : "(null)");
|
||||
#endif /* DEBUG */
|
||||
|
||||
if (!type->last_child ||
|
||||
@ -1211,7 +1226,7 @@ scan_file(const char *filename, /* I - Filename */
|
||||
buffer);
|
||||
}
|
||||
}
|
||||
else if (enumeration)
|
||||
else if (enumeration && !isdigit(buffer[0]))
|
||||
{
|
||||
#ifdef DEBUG
|
||||
fprintf(stderr, "Constant: <<<< %s >>>\n", buffer);
|
||||
@ -1920,7 +1935,7 @@ write_documentation(mxml_node_t *doc) /* I - XML documentation */
|
||||
puts("<h3>Definition</h3>");
|
||||
puts("<pre>");
|
||||
|
||||
printf("struct %s\n{\n", name);
|
||||
printf("union %s\n{\n", name);
|
||||
for (arg = mxmlFindElement(scut, scut, "variable", NULL, NULL,
|
||||
MXML_DESCEND_FIRST);
|
||||
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…
Reference in New Issue
Block a user