Fix typedef documentation (STR #72)

This commit is contained in:
Michael R Sweet 2009-05-05 04:43:18 +00:00
parent 9ac6418218
commit ec99705731
3 changed files with 74 additions and 30 deletions

21
CHANGES
View File

@ -1,24 +1,23 @@
CHANGES - 2009-04-18 CHANGES - 2009-05-04
-------------------- --------------------
CHANGES IN Mini-XML 2.6 CHANGES IN Mini-XML 2.6
- Documentation fixes (STR #91, STR #92) - Documentation fixes (STR #91, STR #92)
- The mxmldoc program did handle typedef comments properly (STR #72)
- Added support for "long long" printf formats. - Added support for "long long" printf formats.
- The XML parser now rejects UTF-8 XML files that start with a BOM - The XML parser now rejects UTF-8 XML files that start with a BOM
(STR #89) (STR #89)
- The mxmldoc program now supports generating Xcode documentation - The mxmldoc program now supports generating Xcode documentation sets.
sets.
- mxmlSave*() did not output UTF-8 correctly on some platforms. - mxmlSave*() did not output UTF-8 correctly on some platforms.
- mxmlNewXML() now adds encoding="utf-8" in the ?xml directive - mxmlNewXML() now adds encoding="utf-8" in the ?xml directive to avoid
to avoid problems with non-conformant XML parsers that assume problems with non-conformant XML parsers that assume something other
something other than UTF-8 as the default encoding. than UTF-8 as the default encoding.
- Wrapping was not disabled when mxmlSetWrapMargin(0) was - Wrapping was not disabled when mxmlSetWrapMargin(0) was called, and
called, and "<?xml ... ?>" was always followed by a newline "<?xml ... ?>" was always followed by a newline (STR #76)
(STR #76)
- The mxml.pc.in file was broken (STR #79) - The mxml.pc.in file was broken (STR #79)
- The mxmldoc program now handles "typedef enum name {} name" - The mxmldoc program now handles "typedef enum name {} name" correctly
correctly (STR #72) (STR #72)
CHANGES IN Mini-XML 2.5 CHANGES IN Mini-XML 2.5

View File

@ -1236,7 +1236,9 @@ scan_file(const char *filename, /* I - Filename */
comment->last_child->value.text.string); comment->last_child->value.text.string);
description = mxmlNewElement(typedefnode, "description"); description = mxmlNewElement(typedefnode, "description");
#ifdef DEBUG #ifdef DEBUG
fputs(" duplicating comment for typedef...\n", stderr); fprintf(stderr,
" duplicating comment %p/%p for typedef...\n",
comment->last_child, comment->child);
#endif /* DEBUG */ #endif /* DEBUG */
update_comment(typedefnode, comment->last_child); update_comment(typedefnode, comment->last_child);
mxmlAdd(description, MXML_ADD_AFTER, MXML_ADD_TO_PARENT, mxmlAdd(description, MXML_ADD_AFTER, MXML_ADD_TO_PARENT,
@ -1245,8 +1247,9 @@ scan_file(const char *filename, /* I - Filename */
description = mxmlNewElement(structclass, "description"); description = mxmlNewElement(structclass, "description");
#ifdef DEBUG #ifdef DEBUG
fprintf(stderr, " adding comment to %s...\n", fprintf(stderr, " adding comment %p/%p to %s...\n",
structclass->value.element.name); comment->last_child, comment->child,
structclass->value.element.name);
#endif /* DEBUG */ #endif /* DEBUG */
update_comment(structclass, comment->last_child); update_comment(structclass, comment->last_child);
mxmlAdd(description, MXML_ADD_AFTER, MXML_ADD_TO_PARENT, mxmlAdd(description, MXML_ADD_AFTER, MXML_ADD_TO_PARENT,
@ -1318,7 +1321,9 @@ scan_file(const char *filename, /* I - Filename */
comment->last_child->value.text.string); comment->last_child->value.text.string);
description = mxmlNewElement(typedefnode, "description"); description = mxmlNewElement(typedefnode, "description");
#ifdef DEBUG #ifdef DEBUG
fputs(" duplicating comment for typedef...\n", stderr); fprintf(stderr,
" duplicating comment %p/%p for typedef...\n",
comment->last_child, comment->child);
#endif /* DEBUG */ #endif /* DEBUG */
update_comment(typedefnode, comment->last_child); update_comment(typedefnode, comment->last_child);
mxmlAdd(description, MXML_ADD_AFTER, MXML_ADD_TO_PARENT, mxmlAdd(description, MXML_ADD_AFTER, MXML_ADD_TO_PARENT,
@ -1327,7 +1332,8 @@ scan_file(const char *filename, /* I - Filename */
description = mxmlNewElement(enumeration, "description"); description = mxmlNewElement(enumeration, "description");
#ifdef DEBUG #ifdef DEBUG
fputs(" adding comment to enumeration...\n", stderr); fprintf(stderr, " adding comment %p/%p to enumeration...\n",
comment->last_child, comment->child);
#endif /* DEBUG */ #endif /* DEBUG */
update_comment(enumeration, comment->last_child); update_comment(enumeration, comment->last_child);
mxmlAdd(description, MXML_ADD_AFTER, MXML_ADD_TO_PARENT, mxmlAdd(description, MXML_ADD_AFTER, MXML_ADD_TO_PARENT,
@ -1664,8 +1670,11 @@ scan_file(const char *filename, /* I - Filename */
{ {
description = mxmlNewElement(variable, "description"); description = mxmlNewElement(variable, "description");
#ifdef DEBUG #ifdef DEBUG
fputs(" adding comment to variable...\n", stderr); fprintf(stderr,
" adding comment %p/%p to variable...\n",
comment->last_child, comment->child);
#endif /* DEBUG */ #endif /* DEBUG */
mxmlNewText(comment, 0, buffer);
update_comment(variable, update_comment(variable,
mxmlNewText(description, 0, buffer)); mxmlNewText(description, 0, buffer));
} }
@ -1686,8 +1695,11 @@ scan_file(const char *filename, /* I - Filename */
{ {
description = mxmlNewElement(constant, "description"); description = mxmlNewElement(constant, "description");
#ifdef DEBUG #ifdef DEBUG
fputs(" adding comment to constant...\n", stderr); fprintf(stderr,
" adding comment %p/%p to constant...\n",
comment->last_child, comment->child);
#endif /* DEBUG */ #endif /* DEBUG */
mxmlNewText(comment, 0, buffer);
update_comment(constant, update_comment(constant,
mxmlNewText(description, 0, buffer)); mxmlNewText(description, 0, buffer));
} }
@ -1720,9 +1732,12 @@ scan_file(const char *filename, /* I - Filename */
{ {
description = mxmlNewElement(typedefnode, "description"); description = mxmlNewElement(typedefnode, "description");
#ifdef DEBUG #ifdef DEBUG
fprintf(stderr, " adding comment to typedef %s...\n", fprintf(stderr,
" adding comment %p/%p to typedef %s...\n",
comment->last_child, comment->child,
mxmlElementGetAttr(typedefnode, "name")); mxmlElementGetAttr(typedefnode, "name"));
#endif /* DEBUG */ #endif /* DEBUG */
mxmlNewText(comment, 0, buffer);
update_comment(typedefnode, update_comment(typedefnode,
mxmlNewText(description, 0, buffer)); mxmlNewText(description, 0, buffer));
@ -1748,8 +1763,10 @@ scan_file(const char *filename, /* I - Filename */
{ {
description = mxmlNewElement(tree, "description"); description = mxmlNewElement(tree, "description");
#ifdef DEBUG #ifdef DEBUG
fputs(" adding comment to parent...\n", stderr); fprintf(stderr, " adding comment %p/%p to parent...\n",
comment->last_child, comment->child);
#endif /* DEBUG */ #endif /* DEBUG */
mxmlNewText(comment, 0, buffer);
update_comment(tree, update_comment(tree,
mxmlNewText(description, 0, buffer)); mxmlNewText(description, 0, buffer));
} }
@ -1834,8 +1851,10 @@ scan_file(const char *filename, /* I - Filename */
{ {
description = mxmlNewElement(variable, "description"); description = mxmlNewElement(variable, "description");
#ifdef DEBUG #ifdef DEBUG
fputs(" adding comment to variable...\n", stderr); fprintf(stderr, " adding comment %p/%p to variable...\n",
comment->last_child, comment->child);
#endif /* DEBUG */ #endif /* DEBUG */
mxmlNewText(comment, 0, buffer);
update_comment(variable, update_comment(variable,
mxmlNewText(description, 0, buffer)); mxmlNewText(description, 0, buffer));
} }
@ -1856,8 +1875,10 @@ scan_file(const char *filename, /* I - Filename */
{ {
description = mxmlNewElement(constant, "description"); description = mxmlNewElement(constant, "description");
#ifdef DEBUG #ifdef DEBUG
fputs(" adding comment to constant...\n", stderr); fprintf(stderr, " adding comment %p/%p to constant...\n",
comment->last_child, comment->child);
#endif /* DEBUG */ #endif /* DEBUG */
mxmlNewText(comment, 0, buffer);
update_comment(constant, update_comment(constant,
mxmlNewText(description, 0, buffer)); mxmlNewText(description, 0, buffer));
} }
@ -1890,9 +1911,12 @@ scan_file(const char *filename, /* I - Filename */
{ {
description = mxmlNewElement(typedefnode, "description"); description = mxmlNewElement(typedefnode, "description");
#ifdef DEBUG #ifdef DEBUG
fprintf(stderr, " adding comment to typedef %s...\n", fprintf(stderr,
" adding comment %p/%p to typedef %s...\n",
comment->last_child, comment->child,
mxmlElementGetAttr(typedefnode, "name")); mxmlElementGetAttr(typedefnode, "name"));
#endif /* DEBUG */ #endif /* DEBUG */
mxmlNewText(comment, 0, buffer);
update_comment(typedefnode, update_comment(typedefnode,
mxmlNewText(description, 0, buffer)); mxmlNewText(description, 0, buffer));
@ -1918,8 +1942,10 @@ scan_file(const char *filename, /* I - Filename */
{ {
description = mxmlNewElement(tree, "description"); description = mxmlNewElement(tree, "description");
#ifdef DEBUG #ifdef DEBUG
fputs(" adding comment to parent...\n", stderr); fprintf(stderr, " adding comment %p/%p to parent...\n",
comment->last_child, comment->child);
#endif /* DEBUG */ #endif /* DEBUG */
mxmlNewText(comment, 0, buffer);
update_comment(tree, update_comment(tree,
mxmlNewText(description, 0, buffer)); mxmlNewText(description, 0, buffer));
} }
@ -1980,8 +2006,10 @@ scan_file(const char *filename, /* I - Filename */
{ {
description = mxmlNewElement(variable, "description"); description = mxmlNewElement(variable, "description");
#ifdef DEBUG #ifdef DEBUG
fputs(" adding comment to variable...\n", stderr); fprintf(stderr, " adding comment %p/%p to variable...\n",
comment->last_child, comment->child);
#endif /* DEBUG */ #endif /* DEBUG */
mxmlNewText(comment, 0, buffer);
update_comment(variable, update_comment(variable,
mxmlNewText(description, 0, buffer)); mxmlNewText(description, 0, buffer));
} }
@ -2002,8 +2030,10 @@ scan_file(const char *filename, /* I - Filename */
{ {
description = mxmlNewElement(constant, "description"); description = mxmlNewElement(constant, "description");
#ifdef DEBUG #ifdef DEBUG
fputs(" adding comment to constant...\n", stderr); fprintf(stderr, " adding comment %p/%p to constant...\n",
comment->last_child, comment->child);
#endif /* DEBUG */ #endif /* DEBUG */
mxmlNewText(comment, 0, buffer);
update_comment(constant, update_comment(constant,
mxmlNewText(description, 0, buffer)); mxmlNewText(description, 0, buffer));
} }
@ -2037,9 +2067,11 @@ scan_file(const char *filename, /* I - Filename */
{ {
description = mxmlNewElement(typedefnode, "description"); description = mxmlNewElement(typedefnode, "description");
#ifdef DEBUG #ifdef DEBUG
fprintf(stderr, " adding comment to typedef %s...\n", fprintf(stderr, " adding comment %p/%p to typedef %s...\n",
comment->last_child, comment->child,
mxmlElementGetAttr(typedefnode, "name")); mxmlElementGetAttr(typedefnode, "name"));
#endif /* DEBUG */ #endif /* DEBUG */
mxmlNewText(comment, 0, buffer);
update_comment(typedefnode, update_comment(typedefnode,
mxmlNewText(description, 0, buffer)); mxmlNewText(description, 0, buffer));
@ -2063,8 +2095,10 @@ scan_file(const char *filename, /* I - Filename */
{ {
description = mxmlNewElement(tree, "description"); description = mxmlNewElement(tree, "description");
#ifdef DEBUG #ifdef DEBUG
fputs(" adding comment to parent...\n", stderr); fprintf(stderr, " adding comment %p/%p to parent...\n",
comment->last_child, comment->child);
#endif /* DEBUG */ #endif /* DEBUG */
mxmlNewText(comment, 0, buffer);
update_comment(tree, update_comment(tree,
mxmlNewText(description, 0, buffer)); mxmlNewText(description, 0, buffer));
} }
@ -2249,7 +2283,8 @@ scan_file(const char *filename, /* I - Filename */
description = mxmlNewElement(returnvalue, "description"); description = mxmlNewElement(returnvalue, "description");
#ifdef DEBUG #ifdef DEBUG
fputs(" adding comment to returnvalue...\n", stderr); fprintf(stderr, " adding comment %p/%p to returnvalue...\n",
comment->last_child, comment->child);
#endif /* DEBUG */ #endif /* DEBUG */
update_comment(returnvalue, comment->last_child); update_comment(returnvalue, comment->last_child);
mxmlAdd(description, MXML_ADD_AFTER, MXML_ADD_TO_PARENT, mxmlAdd(description, MXML_ADD_AFTER, MXML_ADD_TO_PARENT,
@ -2260,7 +2295,8 @@ scan_file(const char *filename, /* I - Filename */
description = mxmlNewElement(function, "description"); description = mxmlNewElement(function, "description");
#ifdef DEBUG #ifdef DEBUG
fputs(" adding comment to function...\n", stderr); fprintf(stderr, " adding comment %p/%p to function...\n",
comment->last_child, comment->child);
#endif /* DEBUG */ #endif /* DEBUG */
update_comment(function, comment->last_child); update_comment(function, comment->last_child);
mxmlAdd(description, MXML_ADD_AFTER, MXML_ADD_TO_PARENT, mxmlAdd(description, MXML_ADD_AFTER, MXML_ADD_TO_PARENT,

View File

@ -6,3 +6,12 @@ typedef enum foo_enum_e /* Sample enumeration type */
FOO_BLUE, /* Blue fish */ FOO_BLUE, /* Blue fish */
FOO_PRIVATE /* Private fish @private@ */ FOO_PRIVATE /* Private fish @private@ */
} foo_enum_t; } foo_enum_t;
typedef enum foo_enum2_e /* Sample enumeration type #2 */
{
FOO2_ONE, /* One fish #2 */
FOO2_TWO, /* Two fish #2 */
FOO2_RED, /* Red fish #2 */
FOO2_BLUE, /* Blue fish #2 */
FOO2_PRIVATE /* Private fish #2 @private@ */
} foo_enum2_t;