From f7fdbeb2c9e64f2b504a029c46fc579a26b400ed Mon Sep 17 00:00:00 2001
From: Michael R Sweet 'mxmlAdd()' - Add a node to a tree.
+ Add a node to a tree.
Adds the specified node to the parent. If the child argument is not
NULL, puts the new node before or after the specified child depending
@@ -124,7 +124,7 @@ mxmlAdd(
'mxmlDelete()' - Delete a node and all of its children.
+ Delete a node and all of its children.
If the specified node has a parent, this function first removes the
node from its parent using the mxmlRemove() function.mxmlAdd()
Description
-mxmlDelete()
Description
-name Name of attribute
O - Attribute value or NULL
+Attribute value or NULL
'mxmlElementSetAttr()' - Set an attribute. +
Set an attribute. If the named attribute already exists, the value of the attribute is replaced by the new string value. The string value is copied @@ -207,7 +207,7 @@ mxmlEntityAddCallback(void);
None.
O - 0 on success, -1 on failure
+0 on success, -1 on failure
O - Entity name or NULL
+Entity name or NULL
O - Character value or -1 on error
+Character value or -1 on error
'mxmlEntityRemoveCallback()' - Remove a callback.
+Remove a callback.
void @@ -302,12 +302,12 @@ mxmlFindElement(descend Descend into tree - MXML_DESCEND, MXML_NO_DESCEND, or MXML_DESCEND_FIRST Returns
-O - Element node or NULL
+Element node or NULL
mxmlIndexDelete()
Description
-'mxmlIndexDelete()' - Delete an index.
+Delete an index.
Syntax
void @@ -342,7 +342,7 @@ mxmlIndexEnum(ind Index to enumerate Returns
-O - Next node or NULL if there is none
+Next node or NULL if there is none
mxmlIndexFind()
@@ -370,7 +370,7 @@ mxmlIndexFind(value Attribute value, if any Returns
-O - Node or NULL if none found
+Node or NULL if none found
mxmlIndexNew()
@@ -399,7 +399,7 @@ mxmlIndexNew(attr Attribute to index or NULL for none Returns
-O - New index
+New index
mxmlIndexReset()
@@ -422,7 +422,7 @@ mxmlIndexReset(ind Index to reset Returns
-O - First node or NULL if there is none
+First node or NULL if there is none
mxmlLoadFd()
@@ -454,7 +454,7 @@ mxmlLoadFd(fd File descriptor to read from Returns
-O - First node or NULL if the file could not be read.
+First node or NULL if the file could not be read.
mxmlLoadFile()
@@ -486,7 +486,7 @@ mxmlLoadFile(fp File to read from Returns
-O - First node or NULL if the file could not be read.
+First node or NULL if the file could not be read.
mxmlLoadString()
@@ -518,7 +518,7 @@ mxmlLoadString(s String to load Returns
-O - First node or NULL if the string has errors.
+First node or NULL if the string has errors.
mxmlNewCDATA() Mini-XML 2.3
@@ -546,7 +546,7 @@ mxmlNewCDATA(data Data string Returns
-O - New node
+New node
mxmlNewCustom() Mini-XML 2.1
@@ -574,7 +574,7 @@ mxmlNewCustom(data Pointer to data Returns
-O - New node
+New node
mxmlNewElement()
@@ -599,7 +599,7 @@ mxmlNewElement(name Name of element Returns
-O - New node
+New node
mxmlNewInteger()
@@ -624,7 +624,7 @@ mxmlNewInteger(integer Integer value Returns
-O - New node
+New node
mxmlNewOpaque()
@@ -650,7 +650,7 @@ mxmlNewOpaque(opaque Opaque string Returns
-O - New node
+New node
mxmlNewReal()
@@ -675,7 +675,7 @@ mxmlNewReal(real Real number value Returns
-O - New node
+New node
mxmlNewText()
@@ -704,7 +704,7 @@ mxmlNewText(string String Returns
-O - New node
+New node
mxmlNewTextf()
@@ -735,12 +735,12 @@ mxmlNewTextf(... Additional args as needed Returns
-O - New node
+New node
mxmlRemove()
Description
-'mxmlRemove()' - Remove a node from its parent. +
Remove a node from its parent. Does not free memory used by the node - use mxmlDelete() for that. This function does nothing if the node has no parent.
@@ -788,7 +788,7 @@ mxmlSaveAllocString(node Node to write Returns
-O - Allocated string or NULL
+Allocated string or NULL
mxmlSaveFd()
@@ -815,7 +815,7 @@ mxmlSaveFd(fd File descriptor to write to Returns
-O - 0 on success, -1 on error.
+0 on success, -1 on error.
mxmlSaveFile()
@@ -842,7 +842,7 @@ mxmlSaveFile(fp File to write to Returns
-O - 0 on success, -1 on error.
+0 on success, -1 on error.
mxmlSaveString()
@@ -875,7 +875,7 @@ mxmlSaveString(bufsize Size of string buffer Returns
-O - Size of string
+Size of string
mxmlSetCDATA() Mini-XML 2.3
@@ -900,7 +900,7 @@ mxmlSetCDATA(data New data string Returns
-O - 0 on success, -1 on failure
+0 on success, -1 on failure
mxmlSetCustom() Mini-XML 2.1
@@ -925,19 +925,18 @@ mxmlSetCustom(data New data pointer Returns
-O - 0 on success, -1 on failure
+0 on success, -1 on failure
mxmlSetCustomHandlers()
Description
-'mxmlSetCustomHandlers()' - Set the handling functions for custom data. +
Set the handling functions for custom data. The load function accepts a node pointer and a data string and must return 0 on success and non-zero on error. The save function accepts a node pointer and must return a malloc'd -string on success and NULL on error. -
+string on success and NULL on error.Syntax
void @@ -976,12 +975,12 @@ mxmlSetElement(name New name string Returns
-O - 0 on success, -1 on failure
+0 on success, -1 on failure
mxmlSetErrorCallback()
Description
-'mxmlSetErrorCallback()' - Set the error message callback.
+Set the error message callback.
Syntax
void @@ -1013,7 +1012,7 @@ mxmlSetInteger(integer Integer value Returns
-O - 0 on success, -1 on failure
+0 on success, -1 on failure
mxmlSetOpaque()
@@ -1036,7 +1035,7 @@ mxmlSetOpaque(opaque Opaque string Returns
-O - 0 on success, -1 on failure
+0 on success, -1 on failure
mxmlSetReal()
@@ -1059,7 +1058,7 @@ mxmlSetReal(real Real number value Returns
-O - 0 on success, -1 on failure
+0 on success, -1 on failure
mxmlSetText()
@@ -1084,7 +1083,7 @@ mxmlSetText(string String Returns
-O - 0 on success, -1 on failure
+0 on success, -1 on failure
mxmlSetTextf()
@@ -1111,7 +1110,7 @@ mxmlSetTextf(... Additional arguments as needed Returns
-O - 0 on success, -1 on failure
+0 on success, -1 on failure
mxmlWalkNext()
@@ -1138,7 +1137,7 @@ mxmlWalkNext(descend Descend into tree - MXML_DESCEND, MXML_NO_DESCEND, or MXML_DESCEND_FIRST Returns
-O - Next node or NULL
+Next node or NULL
mxmlWalkPrev()
@@ -1165,7 +1164,7 @@ mxmlWalkPrev(descend Descend into tree - MXML_DESCEND, MXML_NO_DESCEND, or MXML_DESCEND_FIRST Returns
-O - Previous node or NULL
+Previous node or NULL
Structures
*** An XML custom value.
+An XML custom value.
typedef struct mxml_custom_s mxml_custom_t; @@ -1365,7 +1364,7 @@ typedef struct mxml_custom_s mxml_custom_t;mxml_element_t
Description
-*** An XML element value.
+An XML element value.
Definition
typedef struct mxml_element_s mxml_element_t; @@ -1374,7 +1373,7 @@ typedef struct mxml_element_s mxml_element_t;mxml_index_t
Description
-*** An XML node index.
+An XML node index.
Definition
typedef struct mxml_index_s mxml_index_t; @@ -1383,7 +1382,7 @@ typedef struct mxml_index_s mxml_index_t;mxml_node_t
Description
-*** An XML node.
+An XML node.
Definition
typedef struct mxml_node_s mxml_node_t; @@ -1392,7 +1391,7 @@ typedef struct mxml_node_s mxml_node_t;mxml_text_t
Description
-*** An XML text value.
+An XML text value.
Definition
typedef struct mxml_text_s mxml_text_t; @@ -1401,7 +1400,7 @@ typedef struct mxml_text_s mxml_text_t;mxml_value_t
Description
-*** An XML node value.
+An XML node value.
Definition
typedef union mxml_value_u mxml_value_t; diff --git a/mxml.xml b/mxml.xml index a722e40..74bfea5 100644 --- a/mxml.xml +++ b/mxml.xml @@ -3,7 +3,7 @@ xmlns="http://www.easysw.com" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://www.easysw.com/~mike/mxml/mxmldoc.xsd">- 'mxmlAdd()' - Add a node to a tree. + Add a node to a tree. Adds the specified node to the parent. If the child argument is not NULL, puts the new node before or after the specified child depending @@ -29,7 +29,7 @@ MXML_ADD_TO_PARENT can be used to specify a NULL child pointer. - 'mxmlDelete()' - Delete a node and all of its children. + Delete a node and all of its children. If the specified node has a parent, this function first removes the node from its parent using the mxmlRemove() function. @@ -41,7 +41,7 @@ node from its parent using the mxmlRemove() function.const char * -O - Attribute value or NULL +Attribute value or NULL Get an attribute. @@ -57,7 +57,7 @@ named attribute does not exist. - 'mxmlElementSetAttr()' - Set an attribute. + Set an attribute. If the named attribute already exists, the value of the attribute is replaced by the new string value. The string value is copied @@ -79,14 +79,14 @@ not an element. int -O - 0 on success, -1 on failure +0 on success, -1 on failure Add a callback to convert entities to Unicode. const char * -O - Entity name or NULL +Entity name or NULL Get the name that corresponds to the character value. @@ -99,7 +99,7 @@ If val does not need to be represented by a named entity, NULL is returned. int -O - Character value or -1 on error +Character value or -1 on error Get the character corresponding to a named entity. @@ -111,12 +111,12 @@ name is not known. - 'mxmlEntityRemoveCallback()' - Remove a callback. +Remove a callback. mxml_node_t * -O - Element node or NULL +Element node or NULL Find the named element. @@ -154,7 +154,7 @@ constrains the search to a particular node's children. - 'mxmlIndexDelete()' - Delete an index. +Delete an index. mxml_index_t * Index to delete @@ -163,7 +163,7 @@ constrains the search to a particular node's children.mxml_node_t * -O - Next node or NULL if there is none +Next node or NULL if there is none Return the next node in the index. @@ -176,7 +176,7 @@ Nodes are returned in the sorted order of the index. mxml_node_t * -O - Node or NULL if none found +Node or NULL if none found Find the next matching node. @@ -200,7 +200,7 @@ to calling mxmlIndexEnum(). mxml_index_t * -O - New index +New index Create a new index. @@ -225,7 +225,7 @@ argument is not NULL. mxml_node_t * -O - First node or NULL if there is none +First node or NULL if there is none Reset the enumeration/find pointer in the index and return the first node in the index. @@ -240,7 +240,7 @@ mxmlIndexFind() for the first time. mxml_node_t * -O - First node or NULL if the file could not be read. +First node or NULL if the file could not be read. Load a file descriptor into an XML node tree. @@ -266,7 +266,7 @@ child nodes of the specified type. mxml_node_t * -O - First node or NULL if the file could not be read. +First node or NULL if the file could not be read. Load a file into an XML node tree. @@ -292,7 +292,7 @@ child nodes of the specified type. mxml_node_t * -O - First node or NULL if the string has errors. +First node or NULL if the string has errors. Load a string into an XML node tree. @@ -318,7 +318,7 @@ child nodes of the specified type. mxml_node_t * -O - New node +New node Create a new CDATA node. @@ -340,7 +340,7 @@ is copied into the new node. CDATA nodes use the MXML_ELEMENT type. mxml_node_t * -O - New node +New node Create a new custom data node. @@ -362,7 +362,7 @@ node is not dynamically allocated or is separately managed. mxml_node_t * -O - New node +New node Create a new element node. @@ -381,7 +381,7 @@ element node has no parent. mxml_node_t * -O - New node +New node Create a new integer node. @@ -400,7 +400,7 @@ integer node has no parent. mxml_node_t * -O - New node +New node Create a new opaque string. @@ -420,7 +420,7 @@ is copied into the new node. mxml_node_t * -O - New node +New node Create a new real number node. @@ -439,7 +439,7 @@ the new real number node has no parent. mxml_node_t * -O - New node +New node Create a new text fragment node. @@ -464,7 +464,7 @@ string must be nul-terminated and is copied into the new node. mxml_node_t * -O - New node +New node Create a new formatted text fragment node. @@ -490,7 +490,7 @@ string must be nul-terminated and is formatted into the new node. - 'mxmlRemove()' - Remove a node from its parent. + Remove a node from its parent. Does not free memory used by the node - use mxmlDelete() for that. This function does nothing if the node has no parent. @@ -502,7 +502,7 @@ This function does nothing if the node has no parent.char * -O - Allocated string or NULL +Allocated string or NULL Save an XML node tree to an allocated string. @@ -525,7 +525,7 @@ element tags. int -O - 0 on success, -1 on error. +0 on success, -1 on error. Save an XML tree to a file descriptor. @@ -546,7 +546,7 @@ element tags. int -O - 0 on success, -1 on error. +0 on success, -1 on error. Save an XML tree to a file. @@ -567,7 +567,7 @@ element tags. int -O - Size of string +Size of string Save an XML node tree to a string. @@ -596,7 +596,7 @@ element tags. int -O - 0 on success, -1 on failure +0 on success, -1 on failure Set the element name of a CDATA node. @@ -615,7 +615,7 @@ The node is not changed if it is not a CDATA element node. int -O - 0 on success, -1 on failure +0 on success, -1 on failure Set the data and destructor of a custom data node. @@ -632,14 +632,13 @@ The node is not changed if it is not a custom node. - 'mxmlSetCustomHandlers()' - Set the handling functions for custom data. + Set the handling functions for custom data. The load function accepts a node pointer and a data string and must return 0 on success and non-zero on error. The save function accepts a node pointer and must return a malloc'd -string on success and NULL on error. - +string on success and NULL on error.mxml_custom_load_cb_t Load function @@ -652,7 +651,7 @@ string on success and NULL on error.int -O - 0 on success, -1 on failure +0 on success, -1 on failure Set the name of an element node. @@ -667,12 +666,12 @@ The node is not changed if it is not an element node. - 'mxmlSetErrorCallback()' - Set the error message callback. +Set the error message callback. int -O - 0 on success, -1 on failure +0 on success, -1 on failure Set the value of an integer node. @@ -689,7 +688,7 @@ The node is not changed if it is not an integer node. int -O - 0 on success, -1 on failure +0 on success, -1 on failure Set the value of an opaque node. @@ -706,7 +705,7 @@ The node is not changed if it is not an opaque node. int -O - 0 on success, -1 on failure +0 on success, -1 on failure Set the value of a real number node. @@ -723,7 +722,7 @@ The node is not changed if it is not a real number node. int -O - 0 on success, -1 on failure +0 on success, -1 on failure Set the value of a text node. @@ -744,7 +743,7 @@ The node is not changed if it is not a text node. int -O - 0 on success, -1 on failure +0 on success, -1 on failure Set the value of a text node to a formatted string. @@ -768,7 +767,7 @@ The node is not changed if it is not a text node. mxml_node_t * -O - Next node or NULL +Next node or NULL Walk to the next logical node in the tree. @@ -791,7 +790,7 @@ the node's children. mxml_node_t * -O - Previous node or NULL +Previous node or NULL Walk to the previous logical node in the tree. @@ -845,7 +844,7 @@ the walk to the node's children. struct mxml_custom_s -*** An XML custom value. @since Mini-XML 2.1@ +An XML custom value. @since Mini-XML 2.1@ An XML element value. @@ -864,7 +863,7 @@ the walk to the node's children.struct mxml_element_s -*** An XML element value. +An XML element value. An XML node index. @@ -891,7 +890,7 @@ the walk to the node's children.struct mxml_index_s -*** An XML node index. +An XML node index. An XML node. @@ -926,7 +925,7 @@ the walk to the node's children.struct mxml_node_s -*** An XML node. +An XML node. An XML text value. @@ -941,7 +940,7 @@ the walk to the node's children.struct mxml_text_s -*** An XML text value. +An XML text value. The XML node type. @@ -969,7 +968,7 @@ the walk to the node's children.union mxml_value_u -*** An XML node value. +An XML node value. An XML node value. diff --git a/mxmldoc.c b/mxmldoc.c index 3511acb..e247a97 100644 --- a/mxmldoc.c +++ b/mxmldoc.c @@ -1,4 +1,3 @@ -#define DEBUG 1 /* * "$Id$" * @@ -138,6 +137,8 @@ static mxml_node_t *add_variable(mxml_node_t *parent, const char *name, mxml_node_t *type); +static mxml_node_t *find_public(mxml_node_t *node, mxml_node_t *top, + const char *name); static char *get_comment_info(mxml_node_t *description); static char *get_text(mxml_node_t *node, char *buffer, int buflen); static mxml_node_t *new_documentation(mxml_node_t **mxmldoc); @@ -473,6 +474,65 @@ add_variable(mxml_node_t *parent, /* I - Parent node */ } +/* + * 'find_public()' - Find a public function, type, etc. + */ + +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 */ +{ + 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); + node; + node = mxmlFindElement(node, top, name, NULL, NULL, MXML_NO_DESCEND)) + { + /* + * Get the description for this node... + */ + + description = mxmlFindElement(node, node, "description", NULL, NULL, + MXML_DESCEND_FIRST); + + /* + * A missing or empty description signals a private node... + */ + + if (!description || !description->child) + continue; + + /* + * Look for @private@ in the comment text... + */ + + for (comment = description->child; comment; comment = comment->next) + if (strstr(comment->value.text.string, "@private@")) + break; + + if (!comment) + { + /* + * No @private@, so return this node... + */ + + return (node); + } + } + + /* + * If we get here, there are no (more) public nodes... + */ + + return (NULL); +} + + /* * 'get_comment_info()' - Get info from comment. */ @@ -792,27 +852,6 @@ scan_file(const char *filename, /* I - Filename */ fprintf(stderr, " scope = %s\n", scope ? scope : "(null)"); #endif /* DEBUG */ - if (comment->last_child && - strstr(comment->last_child->value.text.string, "@private@")) - { - mxmlDelete(type); - type = NULL; - - if (typedefnode) - { - mxmlDelete(typedefnode); - typedefnode = NULL; - } - - mxmlDelete(structclass); - structclass = NULL; - - braces ++; - function = NULL; - variable = NULL; - break; - } - if (type->child->next) { mxmlElementSetAttr(structclass, "name", @@ -862,9 +901,9 @@ scan_file(const char *filename, /* I - Filename */ #ifdef DEBUG fputs(" duplicating comment for typedef...\n", stderr); #endif /* DEBUG */ + update_comment(typedefnode, comment->last_child); mxmlAdd(description, MXML_ADD_AFTER, MXML_ADD_TO_PARENT, comment->last_child); - update_comment(typedefnode, comment->last_child); } description = mxmlNewElement(structclass, "description"); @@ -872,9 +911,9 @@ scan_file(const char *filename, /* I - Filename */ fprintf(stderr, " adding comment to %s...\n", structclass->value.element.name); #endif /* DEBUG */ + update_comment(structclass, comment->last_child); mxmlAdd(description, MXML_ADD_AFTER, MXML_ADD_TO_PARENT, comment->last_child); - update_comment(structclass, comment->last_child); if (scan_file(filename, fp, structclass)) { @@ -944,18 +983,18 @@ scan_file(const char *filename, /* I - Filename */ #ifdef DEBUG fputs(" duplicating comment for typedef...\n", stderr); #endif /* DEBUG */ + update_comment(typedefnode, comment->last_child); mxmlAdd(description, MXML_ADD_AFTER, MXML_ADD_TO_PARENT, comment->last_child); - update_comment(typedefnode, comment->last_child); } description = mxmlNewElement(enumeration, "description"); #ifdef DEBUG fputs(" adding comment to enumeration...\n", stderr); #endif /* DEBUG */ + update_comment(enumeration, comment->last_child); mxmlAdd(description, MXML_ADD_AFTER, MXML_ADD_TO_PARENT, comment->last_child); - update_comment(enumeration, comment->last_child); } else if (type && type->child && !strcmp(type->child->value.text.string, "extern")) @@ -1259,6 +1298,7 @@ scan_file(const char *filename, /* I - Filename */ #endif /* DEBUG */ update_comment(typedefnode, mxmlNewText(description, 0, buffer)); + typedefnode = NULL; } else if (strcmp(tree->value.element.name, "mxmldoc") && !mxmlFindElement(tree, tree, "description", @@ -1364,6 +1404,7 @@ scan_file(const char *filename, /* I - Filename */ #endif /* DEBUG */ update_comment(typedefnode, mxmlNewText(description, 0, buffer)); + typedefnode = NULL; } else if (strcmp(tree->value.element.name, "mxmldoc") && !mxmlFindElement(tree, tree, "description", @@ -1640,9 +1681,9 @@ scan_file(const char *filename, /* I - Filename */ #ifdef DEBUG fputs(" adding comment to returnvalue...\n", stderr); #endif /* DEBUG */ + update_comment(returnvalue, comment->last_child); mxmlAdd(description, MXML_ADD_AFTER, MXML_ADD_TO_PARENT, comment->last_child); - update_comment(returnvalue, comment->last_child); } else mxmlDelete(type); @@ -1651,9 +1692,9 @@ scan_file(const char *filename, /* I - Filename */ #ifdef DEBUG fputs(" adding comment to function...\n", stderr); #endif /* DEBUG */ + update_comment(function, comment->last_child); mxmlAdd(description, MXML_ADD_AFTER, MXML_ADD_TO_PARENT, comment->last_child); - update_comment(function, comment->last_child); type = NULL; } @@ -2026,16 +2067,6 @@ update_comment(mxml_node_t *parent, /* I - Parent node */ for (; ptr > comment->value.text.string && isspace(*ptr & 255); ptr --) *ptr = '\0'; - /* - * Remove private types, variables, etc. - */ - - if (strstr(comment->value.text.string, "@private@")) - { - fputs("Deleting private node!\n", stderr); - mxmlDelete(parent); - } - #ifdef DEBUG fprintf(stderr, " updated comment = %s\n", comment->value.text.string); #endif /* DEBUG */ @@ -2211,19 +2242,19 @@ write_documentation( puts("Contents
"); puts(""); - if (mxmlFindElement(doc, doc, "class", NULL, NULL, MXML_DESCEND_FIRST)) + if (find_public(doc, doc, "class")) puts("\t
"); @@ -2231,17 +2262,15 @@ write_documentation( * List of classes... */ - if (mxmlFindElement(doc, doc, "class", NULL, NULL, MXML_DESCEND_FIRST)) + if (find_public(doc, doc, "class")) { puts("\n" "- Classes
"); - if (mxmlFindElement(doc, doc, "enumeration", NULL, NULL, MXML_DESCEND_FIRST)) + if (find_public(doc, doc, "enumeration")) puts("\t- Enumerations
"); - if (mxmlFindElement(doc, doc, "function", NULL, NULL, MXML_DESCEND_FIRST)) + if (find_public(doc, doc, "function")) puts("\t- Functions
"); - if (mxmlFindElement(doc, doc, "struct", NULL, NULL, MXML_DESCEND_FIRST)) + if (find_public(doc, doc, "struct")) puts("\t- Structures
"); - if (mxmlFindElement(doc, doc, "typedef", NULL, NULL, MXML_DESCEND_FIRST)) + if (find_public(doc, doc, "typedef")) puts("\t- Types
"); - if (mxmlFindElement(doc, doc, "union", NULL, NULL, MXML_DESCEND_FIRST)) + if (find_public(doc, doc, "union")) puts("\t- Unions
"); - if (mxmlFindElement(doc, doc, "variable", NULL, NULL, MXML_DESCEND_FIRST)) + if (find_public(doc, doc, "variable")) puts("\t- Variables
"); puts("Classes
\n" ""); - for (scut = mxmlFindElement(doc, doc, "class", NULL, NULL, - MXML_DESCEND_FIRST); + for (scut = find_public(doc, doc, "class"); scut; - scut = mxmlFindElement(scut, doc, "class", NULL, NULL, - MXML_NO_DESCEND)) + scut = find_public(scut, doc, "class")) { name = mxmlElementGetAttr(scut, "name"); printf("\t
"); - for (scut = mxmlFindElement(doc, doc, "class", NULL, NULL, - MXML_DESCEND_FIRST); + for (scut = find_public(doc, doc, "class"); scut; - scut = mxmlFindElement(scut, doc, "class", NULL, NULL, - MXML_NO_DESCEND)) + scut = find_public(scut, doc, "class")) { cname = mxmlElementGetAttr(scut, "name"); description = mxmlFindElement(scut, scut, "description", NULL, @@ -2301,11 +2328,11 @@ write_documentation( printf(" %s;\n", mxmlElementGetAttr(arg, "name")); } - for (function = mxmlFindElement(scut, scut, "function", "scope", scopes[i], - MXML_DESCEND_FIRST); + for (function = mxmlFindElement(scut, scut, "function", "scope", + scopes[i], MXML_DESCEND_FIRST); function; - function = mxmlFindElement(function, scut, "function", "scope", scopes[i], - MXML_NO_DESCEND)) + function = mxmlFindElement(function, scut, "function", "scope", + scopes[i], MXML_NO_DESCEND)) { if (!inscope) { @@ -2420,17 +2447,15 @@ write_documentation( * List of enumerations... */ - if (mxmlFindElement(doc, doc, "enumeration", NULL, NULL, MXML_DESCEND_FIRST)) + if (find_public(doc, doc, "enumeration")) { puts("\n" "- %s %s
\n", name, name, @@ -2251,11 +2280,9 @@ write_documentation( puts("Enumerations
\n" ""); - for (scut = mxmlFindElement(doc, doc, "enumeration", NULL, NULL, - MXML_DESCEND_FIRST); + for (scut = find_public(doc, doc, "enumeration"); scut; - scut = mxmlFindElement(scut, doc, "enumeration", NULL, NULL, - MXML_NO_DESCEND)) + scut = find_public(scut, doc, "enumeration")) { name = mxmlElementGetAttr(scut, "name"); printf("\t
"); - for (scut = mxmlFindElement(doc, doc, "enumeration", NULL, NULL, - MXML_DESCEND_FIRST); + for (scut = find_public(doc, doc, "enumeration"); scut; - scut = mxmlFindElement(scut, doc, "enumeration", NULL, NULL, - MXML_NO_DESCEND)) + scut = find_public(scut, doc, "enumeration")) { name = mxmlElementGetAttr(scut, "name"); description = mxmlFindElement(scut, scut, "description", NULL, @@ -2490,17 +2513,15 @@ write_documentation( * List of functions... */ - if (mxmlFindElement(doc, doc, "function", NULL, NULL, MXML_DESCEND_FIRST)) + if (find_public(doc, doc, "function")) { puts("\n" "- %s %s
\n", name, name, @@ -2440,11 +2465,9 @@ write_documentation( puts("Functions
\n" ""); - for (function = mxmlFindElement(doc, doc, "function", NULL, NULL, - MXML_DESCEND_FIRST); + for (function = find_public(doc, doc, "function"); function; - function = mxmlFindElement(function, doc, "function", NULL, NULL, - MXML_NO_DESCEND)) + function = find_public(function, doc, "function")) { name = mxmlElementGetAttr(function, "name"); printf("\t
"); - for (function = mxmlFindElement(doc, doc, "function", NULL, NULL, - MXML_DESCEND_FIRST); + for (function = find_public(doc, doc, "function"); function; - function = mxmlFindElement(function, doc, "function", NULL, NULL, - MXML_NO_DESCEND)) + function = find_public(function, doc, "function")) { name = mxmlElementGetAttr(function, "name"); description = mxmlFindElement(function, function, "description", NULL, @@ -2618,17 +2637,15 @@ write_documentation( * List of structures... */ - if (mxmlFindElement(doc, doc, "struct", NULL, NULL, MXML_DESCEND_FIRST)) + if (find_public(doc, doc, "struct")) { puts("\n" "- %s() %s
\n", name, name, @@ -2510,11 +2531,9 @@ write_documentation( puts("Structures
\n" ""); - for (scut = mxmlFindElement(doc, doc, "struct", NULL, NULL, - MXML_DESCEND_FIRST); + for (scut = find_public(doc, doc, "struct"); scut; - scut = mxmlFindElement(scut, doc, "struct", NULL, NULL, - MXML_NO_DESCEND)) + scut = find_public(scut, doc, "struct")) { name = mxmlElementGetAttr(scut, "name"); printf("\t
"); - for (scut = mxmlFindElement(doc, doc, "struct", NULL, NULL, - MXML_DESCEND_FIRST); + for (scut = find_public(doc, doc, "struct"); scut; - scut = mxmlFindElement(scut, doc, "struct", NULL, NULL, - MXML_NO_DESCEND)) + scut = find_public(scut, doc, "struct")) { cname = mxmlElementGetAttr(scut, "name"); description = mxmlFindElement(scut, scut, "description", NULL, @@ -2785,17 +2800,15 @@ write_documentation( * List of types... */ - if (mxmlFindElement(doc, doc, "typedef", NULL, NULL, MXML_DESCEND_FIRST)) + if (find_public(doc, doc, "typedef")) { puts("\n" "- %s %s
\n", name, name, @@ -2638,11 +2655,9 @@ write_documentation( puts("Types
\n" ""); - for (scut = mxmlFindElement(doc, doc, "typedef", NULL, NULL, - MXML_DESCEND_FIRST); + for (scut = find_public(doc, doc, "typedef"); scut; - scut = mxmlFindElement(scut, doc, "typedef", NULL, NULL, - MXML_NO_DESCEND)) + scut = find_public(scut, doc, "typedef")) { name = mxmlElementGetAttr(scut, "name"); printf("\t
"); - for (scut = mxmlFindElement(doc, doc, "typedef", NULL, NULL, - MXML_DESCEND_FIRST); + for (scut = find_public(doc, doc, "typedef"); scut; - scut = mxmlFindElement(scut, doc, "typedef", NULL, NULL, - MXML_NO_DESCEND)) + scut = find_public(scut, doc, "typedef")) { name = mxmlElementGetAttr(scut, "name"); description = mxmlFindElement(scut, scut, "description", NULL, @@ -2909,17 +2920,15 @@ write_documentation( * List of unions... */ - if (mxmlFindElement(doc, doc, "union", NULL, NULL, MXML_DESCEND_FIRST)) + if (find_public(doc, doc, "union")) { puts("\n" "- %s %s
\n", name, name, @@ -2805,11 +2818,9 @@ write_documentation( puts("Unions
\n" ""); - for (scut = mxmlFindElement(doc, doc, "union", NULL, NULL, - MXML_DESCEND_FIRST); + for (scut = find_public(doc, doc, "union"); scut; - scut = mxmlFindElement(scut, doc, "union", NULL, NULL, - MXML_NO_DESCEND)) + scut = find_public(scut, doc, "union")) { name = mxmlElementGetAttr(scut, "name"); printf("\t
"); - for (scut = mxmlFindElement(doc, doc, "union", NULL, NULL, - MXML_DESCEND_FIRST); + for (scut = find_public(doc, doc, "union"); scut; - scut = mxmlFindElement(scut, doc, "union", NULL, NULL, - MXML_NO_DESCEND)) + scut = find_public(scut, doc, "union")) { name = mxmlElementGetAttr(scut, "name"); description = mxmlFindElement(scut, scut, "description", NULL, @@ -2995,17 +3002,15 @@ write_documentation( * Variables... */ - if (mxmlFindElement(doc, doc, "variable", NULL, NULL, MXML_DESCEND_FIRST)) + if (find_public(doc, doc, "variable")) { puts("\n" "- %s %s
\n", name, name, @@ -2929,11 +2938,9 @@ write_documentation( puts("Variables
\n" ""); - for (arg = mxmlFindElement(doc, doc, "variable", NULL, NULL, - MXML_DESCEND_FIRST); + for (arg = find_public(doc, doc, "variable"); arg; - arg = mxmlFindElement(arg, doc, "variable", NULL, NULL, - MXML_NO_DESCEND)) + arg = find_public(arg, doc, "variable")) { name = mxmlElementGetAttr(arg, "name"); printf("\t
"); - for (arg = mxmlFindElement(doc, doc, "variable", NULL, NULL, - MXML_DESCEND_FIRST); + for (arg = find_public(doc, doc, "variable"); arg; - arg = mxmlFindElement(arg, doc, "variable", NULL, NULL, - MXML_NO_DESCEND)) + arg = find_public(arg, doc, "variable")) { name = mxmlElementGetAttr(arg, "name"); description = mxmlFindElement(arg, arg, "description", NULL, diff --git a/test/dotest.sh b/test/dotest.sh index 984d996..a9b1448 100755 --- a/test/dotest.sh +++ b/test/dotest.sh @@ -1,4 +1,5 @@ #!/bin/sh +(cd ..; make mxmldoc-static) if test $# -gt 0; then files=$* diff --git a/test/function.cxx b/test/function.cxx index 01006b2..6c43e89 100644 --- a/test/function.cxx +++ b/test/function.cxx @@ -89,3 +89,16 @@ foo_void_func(void) { puts("foo_void_func()"); } + + +/* + * 'foo_private_func()' - Private function. + * + * @private@ + */ + +void +foo_private_func(void) +{ + puts("foo_private_func()"); +} diff --git a/test/struct.cxx b/test/struct.cxx index f325d00..b6354e1 100644 --- a/test/struct.cxx +++ b/test/struct.cxx @@ -46,3 +46,9 @@ foo_s::foo_s(float f, int b) foo_s::~foo_s() { } + +typedef struct foo_private_s /* @private@ */ +{ + int a; /* Value of "a" */ + char b[255]; /* Value of "b" */ +} foo_private_t; diff --git a/test/type.cxx b/test/type.cxx new file mode 100644 index 0000000..78349b8 --- /dev/null +++ b/test/type.cxx @@ -0,0 +1,3 @@ +typedef int foo_simple_t; /* Simple integer type */ + +typedef int foo_simple_private_t; /* @private@ */- %s %s
\n", name, name, @@ -3015,11 +3020,9 @@ write_documentation( puts("