diff --git a/doc/mxml.man b/doc/mxml.man index 6ac7d15..a0f95db 100644 --- a/doc/mxml.man +++ b/doc/mxml.man @@ -1,4 +1,4 @@ -.TH mxml 3 "Mini-XML API" "03/31/17" "Mini-XML API" +.TH mxml 3 "Mini-XML API" "04/01/17" "Mini-XML API" .SH NAME mxml \- Mini-XML API .SH INCLUDE FILE diff --git a/doc/reference.html b/doc/reference.html index dc477d9..6ae8d5e 100644 --- a/doc/reference.html +++ b/doc/reference.html @@ -1715,7 +1715,7 @@ typedef void (*mxml_error_cb_t)(const char *);
An XML node index.
-typedef struct mxml_index_s mxml_index_t; +typedef struct mxml_index_s mxml_index_t;
Load callback function
@@ -1725,7 +1725,7 @@ typedef mxml_type_t (*mxml_load_cb_t)(mxml_node_tAn XML node.
-typedef struct mxml_node_s mxml_node_t; +typedef struct mxml_node_s mxml_node_t;
Save callback function
diff --git a/mxmldoc.c b/mxmldoc.c index a39748d..eff358a 100644 --- a/mxmldoc.c +++ b/mxmldoc.c @@ -167,8 +167,7 @@ static void add_toc(toc_t *toc, int level, const char *anchor, const char *titl static mxml_node_t *add_variable(mxml_node_t *parent, const char *name, mxml_node_t *type); static toc_t *build_toc(mxml_node_t *doc, const char *introfile); -static mxml_node_t *find_public(mxml_node_t *node, mxml_node_t *top, - const char *name); +static mxml_node_t *find_public(mxml_node_t *node, mxml_node_t *top, const char *element, const char *name); static void free_toc(toc_t *toc); static char *get_comment_info(mxml_node_t *description); static char *get_iso_date(time_t t); @@ -955,14 +954,14 @@ build_toc(mxml_node_t *doc, /* I - Documentation */ * Next the classes... */ - if ((scut = find_public(doc, doc, "class")) != NULL) + if ((scut = find_public(doc, doc, "class", NULL)) != NULL) { add_toc(toc, 1, "CLASSES", "Classes"); while (scut) { name = mxmlElementGetAttr(scut, "name"); - scut = find_public(scut, doc, "class"); + scut = find_public(scut, doc, "class", NULL); add_toc(toc, 2, name, name); } } @@ -971,14 +970,14 @@ build_toc(mxml_node_t *doc, /* I - Documentation */ * Functions... */ - if ((function = find_public(doc, doc, "function")) != NULL) + if ((function = find_public(doc, doc, "function", NULL)) != NULL) { add_toc(toc, 1, "FUNCTIONS", "Functions"); while (function) { name = mxmlElementGetAttr(function, "name"); - function = find_public(function, doc, "function"); + function = find_public(function, doc, "function", NULL); add_toc(toc, 2, name, name); } } @@ -987,14 +986,14 @@ build_toc(mxml_node_t *doc, /* I - Documentation */ * Data types... */ - if ((scut = find_public(doc, doc, "typedef")) != NULL) + if ((scut = find_public(doc, doc, "typedef", NULL)) != NULL) { add_toc(toc, 1, "TYPES", "Data Types"); while (scut) { name = mxmlElementGetAttr(scut, "name"); - scut = find_public(scut, doc, "typedef"); + scut = find_public(scut, doc, "typedef", NULL); add_toc(toc, 2, name, name); } } @@ -1003,14 +1002,14 @@ build_toc(mxml_node_t *doc, /* I - Documentation */ * Structures... */ - if ((scut = find_public(doc, doc, "struct")) != NULL) + if ((scut = find_public(doc, doc, "struct", NULL)) != NULL) { add_toc(toc, 1, "STRUCTURES", "Structures"); while (scut) { name = mxmlElementGetAttr(scut, "name"); - scut = find_public(scut, doc, "struct"); + scut = find_public(scut, doc, "struct", NULL); add_toc(toc, 2, name, name); } } @@ -1019,14 +1018,14 @@ build_toc(mxml_node_t *doc, /* I - Documentation */ * Unions... */ - if ((scut = find_public(doc, doc, "union")) != NULL) + if ((scut = find_public(doc, doc, "union", NULL)) != NULL) { add_toc(toc, 1, "UNIONS", "Unions"); while (scut) { name = mxmlElementGetAttr(scut, "name"); - scut = find_public(scut, doc, "union"); + scut = find_public(scut, doc, "union", NULL); add_toc(toc, 2, name, name); } } @@ -1035,14 +1034,14 @@ build_toc(mxml_node_t *doc, /* I - Documentation */ * Globals variables... */ - if ((arg = find_public(doc, doc, "variable")) != NULL) + if ((arg = find_public(doc, doc, "variable", NULL)) != NULL) { add_toc(toc, 1, "VARIABLES", "Variables"); while (arg) { name = mxmlElementGetAttr(arg, "name"); - arg = find_public(arg, doc, "variable"); + arg = find_public(arg, doc, "variable", NULL); add_toc(toc, 2, name, name); } } @@ -1051,14 +1050,14 @@ build_toc(mxml_node_t *doc, /* I - Documentation */ * Enumerations/constants... */ - if ((scut = find_public(doc, doc, "enumeration")) != NULL) + if ((scut = find_public(doc, doc, "enumeration", NULL)) != NULL) { add_toc(toc, 1, "ENUMERATIONS", "Enumerations"); while (scut) { name = mxmlElementGetAttr(scut, "name"); - scut = find_public(scut, doc, "enumeration"); + scut = find_public(scut, doc, "enumeration", NULL); add_toc(toc, 2, name, name); } } @@ -1117,17 +1116,16 @@ epub_ws_cb(mxml_node_t *node, /* I - Element node */ static mxml_node_t * /* I - Found node or NULL */ find_public(mxml_node_t *node, /* I - Current node */ mxml_node_t *top, /* I - Top node */ - const char *name) /* I - Name of element */ + const char *element, /* I - Element */ + const char *name) /* I - Name */ { mxml_node_t *description, /* Description node */ *comment; /* Comment node */ - for (node = mxmlFindElement(node, top, name, NULL, NULL, - node == top ? MXML_DESCEND_FIRST : - MXML_NO_DESCEND); + for (node = mxmlFindElement(node, top, element, name ? "name" : NULL, name, node == top ? MXML_DESCEND_FIRST : MXML_NO_DESCEND); node; - node = mxmlFindElement(node, top, name, NULL, NULL, MXML_NO_DESCEND)) + node = mxmlFindElement(node, top, element, name ? "name" : NULL, name, MXML_NO_DESCEND)) { /* * Get the description for this node... @@ -3512,7 +3510,7 @@ write_epub(const char *section, /* I - Section */ * List of classes... */ - if ((scut = find_public(doc, doc, "class")) != NULL) + if ((scut = find_public(doc, doc, "class", NULL)) != NULL) { fputs("\n" "typedef ", fp); - type = mxmlFindElement(scut, scut, "type", NULL, NULL, - MXML_DESCEND_FIRST); + type = mxmlFindElement(scut, scut, "type", NULL, NULL, MXML_DESCEND_FIRST); for (type = type->child; type; type = type->next) if (!strcmp(type->value.text.string, "(")) @@ -3572,16 +3569,11 @@ write_epub(const char *section, /* I - Section */ if (type->value.text.whitespace) putc(' ', fp); - if (mxmlFindElement(doc, doc, "class", "name", - type->value.text.string, MXML_DESCEND) || - mxmlFindElement(doc, doc, "enumeration", "name", - type->value.text.string, MXML_DESCEND) || - mxmlFindElement(doc, doc, "struct", "name", - type->value.text.string, MXML_DESCEND) || - mxmlFindElement(doc, doc, "typedef", "name", - type->value.text.string, MXML_DESCEND) || - mxmlFindElement(doc, doc, "union", "name", - type->value.text.string, MXML_DESCEND)) + if (find_public(doc, doc, "class", type->value.text.string) || + find_public(doc, doc, "enumeration", type->value.text.string) || + find_public(doc, doc, "struct", type->value.text.string) || + find_public(doc, doc, "typedef", type->value.text.string) || + find_public(doc, doc, "union", type->value.text.string)) { fputs("value.text.string, OUTPUT_EPUB); @@ -3609,16 +3601,11 @@ write_epub(const char *section, /* I - Section */ if (type->value.text.whitespace) putc(' ', fp); - if (mxmlFindElement(doc, doc, "class", "name", - type->value.text.string, MXML_DESCEND) || - mxmlFindElement(doc, doc, "enumeration", "name", - type->value.text.string, MXML_DESCEND) || - mxmlFindElement(doc, doc, "struct", "name", - type->value.text.string, MXML_DESCEND) || - mxmlFindElement(doc, doc, "typedef", "name", - type->value.text.string, MXML_DESCEND) || - mxmlFindElement(doc, doc, "union", "name", - type->value.text.string, MXML_DESCEND)) + if (find_public(doc, doc, "class", type->value.text.string) || + find_public(doc, doc, "enumeration", type->value.text.string) || + find_public(doc, doc, "struct", type->value.text.string) || + find_public(doc, doc, "typedef", type->value.text.string) || + find_public(doc, doc, "union", type->value.text.string)) { fputs("value.text.string, OUTPUT_EPUB); @@ -3644,7 +3631,7 @@ write_epub(const char *section, /* I - Section */ fputs("
\n", fp); - scut = find_public(scut, doc, "typedef"); + scut = find_public(scut, doc, "typedef", NULL); } } @@ -3652,7 +3639,7 @@ write_epub(const char *section, /* I - Section */ * List of structures... */ - if ((scut = find_public(doc, doc, "struct")) != NULL) + if ((scut = find_public(doc, doc, "struct", NULL)) != NULL) { fputs("", fp); - write_element(fp, doc, mxmlFindElement(arg, arg, "type", NULL, - NULL, MXML_DESCEND_FIRST), - OUTPUT_EPUB); + write_element(fp, doc, mxmlFindElement(arg, arg, "type", NULL, NULL, MXML_DESCEND_FIRST), OUTPUT_EPUB); fputs(mxmlElementGetAttr(arg, "name"), fp); if ((defval = mxmlElementGetAttr(arg, "default")) != NULL) fprintf(fp, " %s", defval); fputs(";
\n", fp); - arg = find_public(arg, doc, "variable"); + arg = find_public(arg, doc, "variable", NULL); } } @@ -3716,7 +3701,7 @@ write_epub(const char *section, /* I - Section */ * List of enumerations... */ - if ((scut = find_public(doc, doc, "enumeration")) != NULL) + if ((scut = find_public(doc, doc, "enumeration", NULL)) != NULL) { fputs("", fp); - write_string(fp, author, OUTPUT_EPUB); - fputs("
\n", fp); - - fputs("", fp); - write_string(fp, copyright, OUTPUT_EPUB); - fputs("
\n", fp); - - fputs("