From 2fc73455b22712501db36339c8064b2f92a0461d Mon Sep 17 00:00:00 2001 From: Michael R Sweet Date: Thu, 13 Oct 2005 06:18:51 +0000 Subject: [PATCH] Add support for @deprecated@ and @since version@ comments (still needs some work) --- doc/reference.html | 185 +++++++++++++++++++------------------- mxmldoc.c | 217 +++++++++++++++++++++++++++++++-------------- test/function.cxx | 4 + 3 files changed, 246 insertions(+), 160 deletions(-) diff --git a/doc/reference.html b/doc/reference.html index 03fe905..a2b3797 100644 --- a/doc/reference.html +++ b/doc/reference.html @@ -7,6 +7,7 @@ h1, h2, h3, p { font-family: sans-serif; text-align: justify; } tt, pre a:link, pre a:visited, tt a:link, tt a:visited { font-weight: bold; color: #7f0000; } pre { font-weight: bold; color: #7f0000; margin-left: 2em; } + span.info { font-weight: bold; padding: 2; color: #ffffff; background: #000000; float: right; } --> @@ -24,7 +25,7 @@
  • mxml_type_e
  • -

    mxml_type_e

    +

    NOmxml_type_e


    Description

    The XML node type.

    @@ -32,13 +33,13 @@

    - - - - - - - + + + + + + +
    NameDescription
    MXML_CUSTOMCustom data
    MXML_ELEMENTXML element with attributes
    MXML_IGNOREIgnore/throw away node
    MXML_INTEGERInteger value
    MXML_OPAQUEOpaque string
    MXML_REALReal value
    MXML_TEXTText fragment
    NOMXML_CUSTOMCustom data
    NOMXML_ELEMENTXML element with attributes
    NOMXML_IGNOREIgnore/throw away node
    NOMXML_INTEGERInteger value
    NOMXML_OPAQUEOpaque string
    NOMXML_REALReal value
    NOMXML_TEXTText fragment

    Functions

    @@ -87,7 +88,7 @@
  • mxmlWalkPrev()
  • -

    mxmlAdd()

    +

    NOmxmlAdd()


    Description

    Add a node to a tree. @@ -119,7 +120,7 @@ mxmlAdd(

    Returns

    Nothing.

    -

    mxmlDelete()

    +

    NOmxmlDelete()


    Description

    Delete a node and all of its children. @@ -141,7 +142,7 @@ mxmlDelete(

    Returns

    Nothing.

    -

    mxmlElementGetAttr()

    +

    NOmxmlElementGetAttr()


    Description

    Get an attribute. @@ -165,7 +166,7 @@ mxmlElementGetAttr(

    Returns

    Attribute value or NULL

    -

    mxmlElementSetAttr()

    +

    NOmxmlElementSetAttr()


    Description

    Set an attribute. @@ -193,7 +194,7 @@ mxmlElementSetAttr(

    Returns

    Nothing.

    -

    mxmlEntityAddCallback()

    +

    NOmxmlEntityAddCallback()


    Description

    Add a callback to convert entities to Unicode.

    @@ -207,7 +208,7 @@ mxmlEntityAddCallback(void);

    Returns

    0 on success, -1 on failure

    -

    mxmlEntityGetName()

    +

    NOmxmlEntityGetName()


    Description

    Get the name that corresponds to the character value. @@ -228,7 +229,7 @@ mxmlEntityGetName(

    Returns

    Entity name or NULL

    -

    mxmlEntityGetValue()

    +

    NOmxmlEntityGetValue()


    Description

    Get the character corresponding to a named entity. @@ -250,7 +251,7 @@ mxmlEntityGetValue(

    Returns

    Character value or -1 on error

    -

    mxmlEntityRemoveCallback()

    +

    NOmxmlEntityRemoveCallback()


    Description

    Remove a callback.

    @@ -264,7 +265,7 @@ mxmlEntityRemoveCallback(void);

    Returns

    Nothing.

    -

    mxmlFindElement()

    +

    NOmxmlFindElement()


    Description

    Find the named element. @@ -302,7 +303,7 @@ mxmlFindElement(

    Returns

    Element node or NULL

    -

    mxmlIndexDelete()

    +

    NOmxmlIndexDelete()


    Description

    Delete an index.

    @@ -321,7 +322,7 @@ mxmlIndexDelete(

    Returns

    Nothing.

    -

    mxmlIndexEnum()

    +

    NOmxmlIndexEnum()


    Description

    Return the next node in the index. @@ -342,7 +343,7 @@ mxmlIndexEnum(

    Returns

    Next node or NULL if there is none

    -

    mxmlIndexFind()

    +

    NOmxmlIndexFind()


    Description

    Find the next matching node. @@ -370,7 +371,7 @@ mxmlIndexFind(

    Returns

    Node or NULL if none found

    -

    mxmlIndexNew()

    +

    NOmxmlIndexNew()


    Description

    Create a new index. @@ -399,7 +400,7 @@ mxmlIndexNew(

    Returns

    New index

    -

    mxmlIndexReset()

    +

    NOmxmlIndexReset()


    Description

    Reset the enumeration/find pointer in the index and @@ -422,7 +423,7 @@ mxmlIndexReset(

    Returns

    First node or NULL if there is none

    -

    mxmlLoadFd()

    +

    NOmxmlLoadFd()


    Description

    Load a file descriptor into an XML node tree. @@ -454,7 +455,7 @@ mxmlLoadFd(

    Returns

    First node or NULL if the file could not be read.

    -

    mxmlLoadFile()

    +

    NOmxmlLoadFile()


    Description

    Load a file into an XML node tree. @@ -486,7 +487,7 @@ mxmlLoadFile(

    Returns

    First node or NULL if the file could not be read.

    -

    mxmlLoadString()

    +

    NOmxmlLoadString()


    Description

    Load a string into an XML node tree. @@ -518,7 +519,7 @@ mxmlLoadString(

    Returns

    First node or NULL if the string has errors.

    -

    mxmlNewCDATA()

    +

    NOmxmlNewCDATA()


    Description

    Create a new CDATA node. @@ -544,7 +545,7 @@ mxmlNewCDATA(

    Returns

    New node

    -

    mxmlNewCustom()

    +

    NOmxmlNewCustom()


    Description

    Create a new custom data node. @@ -570,7 +571,7 @@ mxmlNewCustom(

    Returns

    New node

    -

    mxmlNewElement()

    +

    NOmxmlNewElement()


    Description

    Create a new element node. @@ -595,7 +596,7 @@ mxmlNewElement(

    Returns

    New node

    -

    mxmlNewInteger()

    +

    NOmxmlNewInteger()


    Description

    Create a new integer node. @@ -620,7 +621,7 @@ mxmlNewInteger(

    Returns

    New node

    -

    mxmlNewOpaque()

    +

    NOmxmlNewOpaque()


    Description

    Create a new opaque string. @@ -646,7 +647,7 @@ mxmlNewOpaque(

    Returns

    New node

    -

    mxmlNewReal()

    +

    NOmxmlNewReal()


    Description

    Create a new real number node. @@ -671,7 +672,7 @@ mxmlNewReal(

    Returns

    New node

    -

    mxmlNewText()

    +

    NOmxmlNewText()


    Description

    Create a new text fragment node. @@ -700,7 +701,7 @@ mxmlNewText(

    Returns

    New node

    -

    mxmlNewTextf()

    +

    NOmxmlNewTextf()


    Description

    Create a new formatted text fragment node. @@ -731,7 +732,7 @@ mxmlNewTextf(

    Returns

    New node

    -

    mxmlRemove()

    +

    NOmxmlRemove()


    Description

    Remove a node from its parent. @@ -753,7 +754,7 @@ mxmlRemove(

    Returns

    Nothing.

    -

    mxmlSaveAllocString()

    +

    NOmxmlSaveAllocString()


    Description

    Save an XML node tree to an allocated string. @@ -784,7 +785,7 @@ mxmlSaveAllocString(

    Returns

    Allocated string or NULL

    -

    mxmlSaveFd()

    +

    NOmxmlSaveFd()


    Description

    Save an XML tree to a file descriptor. @@ -811,7 +812,7 @@ mxmlSaveFd(

    Returns

    0 on success, -1 on error.

    -

    mxmlSaveFile()

    +

    NOmxmlSaveFile()


    Description

    Save an XML tree to a file. @@ -838,7 +839,7 @@ mxmlSaveFile(

    Returns

    0 on success, -1 on error.

    -

    mxmlSaveString()

    +

    NOmxmlSaveString()


    Description

    Save an XML node tree to a string. @@ -871,7 +872,7 @@ mxmlSaveString(

    Returns

    Size of string

    -

    mxmlSetCDATA()

    +

    NOmxmlSetCDATA()


    Description

    Set the element name of a CDATA node. @@ -894,7 +895,7 @@ mxmlSetCDATA(

    Returns

    0 on success, -1 on failure

    -

    mxmlSetCustom()

    +

    NOmxmlSetCustom()


    Description

    Set the data and destructor of a custom data node. @@ -917,7 +918,7 @@ mxmlSetCustom(

    Returns

    0 on success, -1 on failure

    -

    mxmlSetCustomHandlers()

    +

    NOmxmlSetCustomHandlers()


    Description

    Set the handling functions for custom data. @@ -944,7 +945,7 @@ mxmlSetCustomHandlers(

    Returns

    Nothing.

    -

    mxmlSetElement()

    +

    NOmxmlSetElement()


    Description

    Set the name of an element node. @@ -967,7 +968,7 @@ mxmlSetElement(

    Returns

    0 on success, -1 on failure

    -

    mxmlSetErrorCallback()

    +

    NOmxmlSetErrorCallback()


    Description

    Set the error message callback.

    @@ -981,7 +982,7 @@ mxmlSetErrorCallback(void);

    Returns

    Nothing.

    -

    mxmlSetInteger()

    +

    NOmxmlSetInteger()


    Description

    Set the value of an integer node. @@ -1004,7 +1005,7 @@ mxmlSetInteger(

    Returns

    0 on success, -1 on failure

    -

    mxmlSetOpaque()

    +

    NOmxmlSetOpaque()


    Description

    Set the value of an opaque node. @@ -1027,7 +1028,7 @@ mxmlSetOpaque(

    Returns

    0 on success, -1 on failure

    -

    mxmlSetReal()

    +

    NOmxmlSetReal()


    Description

    Set the value of a real number node. @@ -1050,7 +1051,7 @@ mxmlSetReal(

    Returns

    0 on success, -1 on failure

    -

    mxmlSetText()

    +

    NOmxmlSetText()


    Description

    Set the value of a text node. @@ -1075,7 +1076,7 @@ mxmlSetText(

    Returns

    0 on success, -1 on failure

    -

    mxmlSetTextf()

    +

    NOmxmlSetTextf()


    Description

    Set the value of a text node to a formatted string. @@ -1102,7 +1103,7 @@ mxmlSetTextf(

    Returns

    0 on success, -1 on failure

    -

    mxmlWalkNext()

    +

    NOmxmlWalkNext()


    Description

    Walk to the next logical node in the tree. @@ -1129,7 +1130,7 @@ mxmlWalkNext(

    Returns

    Next node or NULL

    -

    mxmlWalkPrev()

    +

    NOmxmlWalkPrev()


    Description

    Walk to the previous logical node in the tree. @@ -1166,7 +1167,7 @@ mxmlWalkPrev(

  • mxml_value_s
  • -

    mxml_attr_s

    +

    NOmxml_attr_s


    Description

    An XML element attribute value.

    @@ -1182,11 +1183,11 @@ struct mxml_attr_s

    - - + +
    NameDescription
    nameAttribute name
    valueAttribute value
    NOnameAttribute name
    NOvalueAttribute value

    -

    mxml_custom_s

    +

    NOmxml_custom_s


    Description

    An XML custom value.

    @@ -1201,10 +1202,10 @@ struct mxml_custom_s

    - +
    NameDescription
    dataPointer to (allocated) custom data
    NOdataPointer to (allocated) custom data

    -

    mxml_index_s

    +

    NOmxml_index_s


    Description

    An XML node index.

    @@ -1223,14 +1224,14 @@ struct mxml_index_s

    - - - - - + + + + +
    NameDescription
    alloc_nodesAllocated nodes in index
    attrAttribute used for indexing or NULL
    cur_nodeCurrent node
    nodesNode array
    num_nodesNumber of nodes in index
    NOalloc_nodesAllocated nodes in index
    NOattrAttribute used for indexing or NULL
    NOcur_nodeCurrent node
    NOnodesNode array
    NOnum_nodesNumber of nodes in index

    -

    mxml_node_s

    +

    NOmxml_node_s


    Description

    An XML node.

    @@ -1251,16 +1252,16 @@ struct mxml_node_s

    - - - - - - - + + + + + + +
    NameDescription
    childFirst child node
    last_childLast child node
    nextNext node under same parent
    parentParent node
    prevPrevious node under same parent
    typeNode type
    valueNode value
    NOchildFirst child node
    NOlast_childLast child node
    NOnextNext node under same parent
    NOparentParent node
    NOprevPrevious node under same parent
    NOtypeNode type
    NOvalueNode value

    -

    mxml_text_s

    +

    NOmxml_text_s


    Description

    An XML text value.

    @@ -1276,11 +1277,11 @@ struct mxml_text_s

    - - + +
    NameDescription
    stringFragment string
    whitespaceLeading whitespace?
    NOstringFragment string
    NOwhitespaceLeading whitespace?

    -

    mxml_value_s

    +

    NOmxml_value_s


    Description

    An XML element value.

    @@ -1297,9 +1298,9 @@ struct mxml_value_s

    - - - + + +
    NameDescription
    attrsAttributes
    nameName of element
    num_attrsNumber of attributes
    NOattrsAttributes
    NOnameName of element
    NOnum_attrsNumber of attributes

    Types

    @@ -1315,7 +1316,7 @@ struct mxml_value_s
  • mxml_value_t
  • -

    mxml_attr_t

    +

    NOmxml_attr_t


    Description

    An XML element attribute value.

    @@ -1324,7 +1325,7 @@ struct mxml_value_s typedef struct mxml_attr_s mxml_attr_t; -

    mxml_custom_load_cb_t

    +

    NOmxml_custom_load_cb_t


    Description

    Custom data load callback function

    @@ -1333,7 +1334,7 @@ typedef struct mxml_attr_s mxml_attr_t; typedef int (*mxml_custom_load_cb_t)(mxml_node_t *, const char *); -

    mxml_custom_save_cb_t

    +

    NOmxml_custom_save_cb_t


    Description

    Custom data save callback function

    @@ -1342,7 +1343,7 @@ typedef int (*mxml_custom_load_cb_t)(mxml_node_t *, c typedef char * (*mxml_custom_save_cb_t)(mxml_node_t *); -

    mxml_custom_t

    +

    NOmxml_custom_t


    Description

    An XML custom value.

    @@ -1351,7 +1352,7 @@ typedef char * (*mxml_custom_save_cb_t)(mxml_node_t * typedef struct mxml_custom_s mxml_custom_t; -

    mxml_element_t

    +

    NOmxml_element_t


    Description

    An XML element value.

    @@ -1360,7 +1361,7 @@ typedef struct mxml_custom_s mxml_custom_t; typedef struct mxml_value_s mxml_element_t; -

    mxml_index_t

    +

    NOmxml_index_t


    Description

    An XML node index.

    @@ -1369,7 +1370,7 @@ typedef struct mxml_value_s mxml_element_t; typedef struct mxml_index_s mxml_index_t; -

    mxml_node_t

    +

    NOmxml_node_t


    Description

    An XML node.

    @@ -1378,7 +1379,7 @@ typedef struct mxml_index_s mxml_index_t; typedef struct mxml_node_s mxml_node_t; -

    mxml_text_t

    +

    NOmxml_text_t


    Description

    An XML text value.

    @@ -1387,7 +1388,7 @@ typedef struct mxml_node_s mxml_node_t; typedef struct mxml_text_s mxml_text_t; -

    mxml_value_t

    +

    NOmxml_value_t


    Description

    An XML node value.

    @@ -1401,7 +1402,7 @@ typedef union mxml_value_u mxml_value_t;
  • mxml_value_u
  • -

    mxml_value_u

    +

    NOmxml_value_u


    Description

    An XML node value.

    @@ -1421,12 +1422,12 @@ union mxml_value_u

    - - - - - - + + + + + +
    NameDescription
    customCustom data
    elementElement
    integerInteger number
    opaqueOpaque string
    realReal number
    textText fragment
    NOcustomCustom data
    NOelementElement
    NOintegerInteger number
    NOopaqueOpaque string
    NOrealReal number
    NOtextText fragment

    diff --git a/mxmldoc.c b/mxmldoc.c index 84bb0fc..fa550c1 100644 --- a/mxmldoc.c +++ b/mxmldoc.c @@ -20,12 +20,14 @@ * * main() - Main entry for test program. * add_variable() - Add a variable or argument. + * get_comment_info() - Get info from comment. * new_documentation() - Create a new documentation tree. * safe_strcpy() - Copy a string allowing for overlapping strings. * scan_file() - Scan a source file. * sort_node() - Insert a node sorted into a tree. * update_comment() - Update a comment node. * usage() - Show program usage... + * write_description() - Write the description text. * write_documentation() - Write HTML documentation. * write_element() - Write an elements text nodes. * write_string() - Write a string, quoting XHTML special chars @@ -134,6 +136,7 @@ static mxml_node_t *add_variable(mxml_node_t *parent, const char *name, mxml_node_t *type); +static char *get_comment_info(mxml_node_t *description); static mxml_node_t *new_documentation(mxml_node_t **mxmldoc); static void safe_strcpy(char *dst, const char *src); static int scan_file(const char *filename, FILE *fp, @@ -142,6 +145,7 @@ static void sort_node(mxml_node_t *tree, mxml_node_t *func); static void update_comment(mxml_node_t *parent, mxml_node_t *comment); static void usage(const char *option); +static void write_description(mxml_node_t *description); static void write_documentation(const char *title, const char *intro, mxml_node_t *doc); @@ -466,6 +470,40 @@ add_variable(mxml_node_t *parent, /* I - Parent node */ } +/* + * 'get_comment_info()' - Get info from comment. + */ + +static char * /* O - Info from comment */ +get_comment_info( + mxml_node_t *description) /* I - Description node */ +{ + static char info[1024]; /* Info string */ + int infolen; /* Length of info string */ + mxml_node_t *current; /* Current text node in description */ + + + if (!description) + return ("NULL"); + + for (current = description->child; current; current = current->next) + if (!strcmp(current->value.text.string, "@deprecated@")) + return ("DEPRECATED"); + else if (!strcmp(current->value.text.string, "@since") && current->next) + { + current = current->next; + snprintf(info, sizeof(info), "%s", + current->value.text.string); + infolen = strlen(info); + strncpy(info + infolen - 1, "", sizeof(info) - infolen); + info[sizeof(info) - 1] = '\0'; + return (info); + } + + return ("NO"); +} + + /* * 'new_documentation()' - Create a new documentation tree. */ @@ -1958,6 +1996,41 @@ usage(const char *option) /* I - Unknown option */ } +/* + * 'write_description()' - Write the description text. + */ + +static void +write_description( + mxml_node_t *description) /* I - Description node */ +{ + mxml_node_t *current; /* Current text node in description */ + + + if (!description) + return; + + for (current = description->child; current; current = current->next) + if (!strcmp(current->value.text.string, "@deprecated@")) + continue; + else if (!strcmp(current->value.text.string, "@since") && current->next) + { + do + { + current = current->next; + } + while (current && !strchr(current->value.text.string, '@')); + } + else + { + if (current->value.text.whitespace) + putchar(' '); + + write_string(current->value.text.string); + } +} + + /* * 'write_documentation()' - Write HTML documentation. */ @@ -2004,6 +2077,7 @@ write_documentation( "\th1, h2, h3, p { font-family: sans-serif; text-align: justify; }\n" "\ttt, pre a:link, pre a:visited, tt a:link, tt a:visited { font-weight: bold; color: #7f0000; }\n" "\tpre { font-weight: bold; color: #7f0000; margin-left: 2em; }\n" + "\tspan.info { font-weight: bold; padding: 2; color: #ffffff; background: #000000; float: right; }\n" "\t-->\n" "\n" "\n", title); @@ -2074,18 +2148,18 @@ write_documentation( scut = mxmlFindElement(scut, doc, "class", NULL, NULL, MXML_NO_DESCEND)) { - cname = mxmlElementGetAttr(scut, "name"); - printf("\n" - "

    %s

    \n" - "
    \n", cname, cname); - + cname = mxmlElementGetAttr(scut, "name"); description = mxmlFindElement(scut, scut, "description", NULL, NULL, MXML_DESCEND_FIRST); + printf("\n" + "

    %s%s

    \n" + "
    \n", get_comment_info(description), cname, cname); + if (description) { fputs("

    Description

    \n" "

    ", stdout); - write_element(NULL, description); + write_description(description); puts("

    "); } @@ -2190,10 +2264,13 @@ write_documentation( arg = mxmlFindElement(arg, scut, "variable", NULL, NULL, MXML_NO_DESCEND)) { - printf("%s", mxmlElementGetAttr(arg, "name")); + description = mxmlFindElement(arg, arg, "description", NULL, + NULL, MXML_DESCEND_FIRST); - write_element(NULL, mxmlFindElement(arg, arg, "description", NULL, - NULL, MXML_DESCEND_FIRST)); + printf("%s%s", get_comment_info(description), + mxmlElementGetAttr(arg, "name")); + + write_description(description); puts(""); } @@ -2204,15 +2281,14 @@ write_documentation( function = mxmlFindElement(function, scut, "function", NULL, NULL, MXML_NO_DESCEND)) { - name = mxmlElementGetAttr(function, "name"); - - printf("%s()", - cname, name, name); - + name = mxmlElementGetAttr(function, "name"); description = mxmlFindElement(function, function, "description", NULL, NULL, MXML_DESCEND_FIRST); - if (description) - write_element(NULL, description); + + printf("%s%s()", + get_comment_info(description), cname, name, name); + + write_description(description); arg = mxmlFindElement(function, function, "returnvalue", NULL, NULL, MXML_DESCEND_FIRST); @@ -2259,18 +2335,18 @@ write_documentation( scut = mxmlFindElement(scut, doc, "enumeration", NULL, NULL, MXML_NO_DESCEND)) { - name = mxmlElementGetAttr(scut, "name"); - printf("\n" - "

    %s

    \n" - "
    \n", name, name); - + name = mxmlElementGetAttr(scut, "name"); description = mxmlFindElement(scut, scut, "description", NULL, NULL, MXML_DESCEND_FIRST); + printf("\n" + "

    %s%s

    \n" + "
    \n", get_comment_info(description), name, name); + if (description) { fputs("

    Description

    \n" "

    ", stdout); - write_element(NULL, description); + write_description(description); puts("

    "); } @@ -2285,10 +2361,12 @@ write_documentation( arg = mxmlFindElement(arg, scut, "constant", NULL, NULL, MXML_NO_DESCEND)) { - printf("%s", mxmlElementGetAttr(arg, "name")); + description = mxmlFindElement(arg, arg, "description", NULL, + NULL, MXML_DESCEND_FIRST); + printf("%s%s", get_comment_info(description), + mxmlElementGetAttr(arg, "name")); - write_element(doc, mxmlFindElement(arg, arg, "description", NULL, - NULL, MXML_DESCEND_FIRST)); + write_description(description); puts(""); } @@ -2325,18 +2403,18 @@ write_documentation( function = mxmlFindElement(function, doc, "function", NULL, NULL, MXML_NO_DESCEND)) { - name = mxmlElementGetAttr(function, "name"); - printf("\n" - "

    %s()

    \n" - "
    \n", name, name); - + name = mxmlElementGetAttr(function, "name"); description = mxmlFindElement(function, function, "description", NULL, NULL, MXML_DESCEND_FIRST); + printf("\n" + "

    %s%s()

    \n" + "
    \n", get_comment_info(description), name, name); + if (description) { fputs("

    Description

    \n" "

    ", stdout); - write_element(NULL, description); + write_description(description); puts("

    "); } @@ -2451,18 +2529,18 @@ write_documentation( scut = mxmlFindElement(scut, doc, "struct", NULL, NULL, MXML_NO_DESCEND)) { - cname = mxmlElementGetAttr(scut, "name"); - printf("\n" - "

    %s

    \n" - "
    \n", cname, cname); - + cname = mxmlElementGetAttr(scut, "name"); description = mxmlFindElement(scut, scut, "description", NULL, NULL, MXML_DESCEND_FIRST); + printf("\n" + "

    %s%s

    \n" + "
    \n", get_comment_info(description), cname, cname); + if (description) { fputs("

    Description

    \n" "

    ", stdout); - write_element(NULL, description); + write_description(description); puts("

    "); } @@ -2546,10 +2624,12 @@ write_documentation( arg = mxmlFindElement(arg, scut, "variable", NULL, NULL, MXML_NO_DESCEND)) { - printf("%s", mxmlElementGetAttr(arg, "name")); + description = mxmlFindElement(arg, arg, "description", NULL, + NULL, MXML_DESCEND_FIRST); + printf("%s%s", get_comment_info(description), + mxmlElementGetAttr(arg, "name")); - write_element(NULL, mxmlFindElement(arg, arg, "description", NULL, - NULL, MXML_DESCEND_FIRST)); + write_description(description); puts(""); } @@ -2560,15 +2640,14 @@ write_documentation( function = mxmlFindElement(function, scut, "function", NULL, NULL, MXML_NO_DESCEND)) { - name = mxmlElementGetAttr(function, "name"); - - printf("%s()", - cname, name, name); - + name = mxmlElementGetAttr(function, "name"); description = mxmlFindElement(function, function, "description", NULL, NULL, MXML_DESCEND_FIRST); - if (description) - write_element(NULL, description); + + printf("%s%s()", + get_comment_info(description), cname, name, name); + + write_description(description); arg = mxmlFindElement(function, function, "returnvalue", NULL, NULL, MXML_DESCEND_FIRST); @@ -2615,18 +2694,18 @@ write_documentation( scut = mxmlFindElement(scut, doc, "typedef", NULL, NULL, MXML_NO_DESCEND)) { - name = mxmlElementGetAttr(scut, "name"); - printf("\n" - "

    %s

    \n" - "
    \n", name, name); - + name = mxmlElementGetAttr(scut, "name"); description = mxmlFindElement(scut, scut, "description", NULL, NULL, MXML_DESCEND_FIRST); + printf("\n" + "

    %s%s

    \n" + "
    \n", get_comment_info(description), name, name); + if (description) { fputs("

    Description

    \n" "

    ", stdout); - write_element(NULL, description); + write_description(description); puts("

    "); } @@ -2737,18 +2816,18 @@ write_documentation( scut = mxmlFindElement(scut, doc, "union", NULL, NULL, MXML_NO_DESCEND)) { - name = mxmlElementGetAttr(scut, "name"); - printf("\n" - "

    %s

    \n" - "
    \n", name, name); - + name = mxmlElementGetAttr(scut, "name"); description = mxmlFindElement(scut, scut, "description", NULL, NULL, MXML_DESCEND_FIRST); + printf("\n" + "

    %s%s

    \n" + "
    \n", get_comment_info(description), name, name); + if (description) { fputs("

    Description

    \n" "

    ", stdout); - write_element(NULL, description); + write_description(description); puts("

    "); } @@ -2779,10 +2858,12 @@ write_documentation( arg = mxmlFindElement(arg, scut, "variable", NULL, NULL, MXML_NO_DESCEND)) { - printf("%s", mxmlElementGetAttr(arg, "name")); + description = mxmlFindElement(arg, arg, "description", NULL, + NULL, MXML_DESCEND_FIRST); + printf("%s%s", get_comment_info(description), + mxmlElementGetAttr(arg, "name")); - write_element(NULL, mxmlFindElement(arg, arg, "description", NULL, - NULL, MXML_DESCEND_FIRST)); + write_description(description); puts(""); } @@ -2819,18 +2900,18 @@ write_documentation( arg = mxmlFindElement(arg, doc, "variable", NULL, NULL, MXML_NO_DESCEND)) { - name = mxmlElementGetAttr(arg, "name"); - printf("\n" - "

    %s

    \n" - "
    ", name, name); - + name = mxmlElementGetAttr(arg, "name"); description = mxmlFindElement(arg, arg, "description", NULL, NULL, MXML_DESCEND_FIRST); + printf("\n" + "

    %s%s

    \n" + "
    ", get_comment_info(description), name, name); + if (description) { fputs("

    Description

    \n" "

    ", stdout); - write_element(NULL, description); + write_description(description); puts("

    "); } diff --git a/test/function.cxx b/test/function.cxx index 5a16722..01006b2 100644 --- a/test/function.cxx +++ b/test/function.cxx @@ -1,5 +1,7 @@ /* * 'foo_void_function()' - Do foo with bar. + * + * @deprecated@ */ void @@ -20,6 +22,8 @@ foo_void_function(int one, /* I - Integer */ /* * 'foo_float_function()' - Do foo with bar. + * + * @since 1.2@ */ float /* O - Real number */