diff --git a/documentation.html b/documentation.html index 5ed7daf..decca89 100644 --- a/documentation.html +++ b/documentation.html @@ -826,7 +826,7 @@ typedef union mxml_value_u mxml_value_t;
An XML node value.
-struct mxml_value_u +union mxml_value_u { mxml_element_t element; int integer; diff --git a/mxml-node.c b/mxml-node.c index 072d65a..b5df08a 100644 --- a/mxml-node.c +++ b/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 $". */ diff --git a/mxmldoc.c b/mxmldoc.c index 3e9fc1e..e400683 100644 --- a/mxmldoc.c +++ b/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("Definition
"); puts(""); - 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 $". */