From 0d0850fffd23486bbade0d90d35185e0494977ca Mon Sep 17 00:00:00 2001 From: Michael Sweet Date: Mon, 24 Apr 2017 10:56:19 -0400 Subject: [PATCH] Fix bug where comments/descriptions were text fragments instead of opaque strings. --- doc/reference.html | 334 +++++++++++++++++++++++++++++++++++++++++++++ mxmldoc.c | 112 +++++++-------- 2 files changed, 381 insertions(+), 65 deletions(-) diff --git a/doc/reference.html b/doc/reference.html index 7321000..42fb5bd 100644 --- a/doc/reference.html +++ b/doc/reference.html @@ -278,6 +278,13 @@ void mxmlAdd (
node
Node to add
+

Discussion

+

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 +on the value of the where argument. If the child argument is NULL, +puts the new node at the beginning of the child list (MXML_ADD_BEFORE) +or at the end of the child list (MXML_ADD_AFTER). The constant +MXML_ADD_TO_PARENT can be used to specify a NULL child pointer.

mxmlDelete

Delete a node and all of its children.

@@ -289,6 +296,9 @@ void mxmlDelete (

node
Node to delete
+

Discussion

+

If the specified node has a parent, this function first removes the +node from its parent using the mxmlRemove function.

 Mini-XML 2.4 mxmlElementDeleteAttr

Delete an attribute.

@@ -319,6 +329,9 @@ const char *mxmlElementGetAttr (

Return Value

Attribute value or NULL

+

Discussion

+

This function returns NULL if the node is not an element or the +named attribute does not exist.

 Mini-XML 2.11 mxmlElementGetAttrByIndex

Get an element attribute by index.

@@ -338,6 +351,11 @@ const char *mxmlElementGetAttrByIndex (

Return Value

Attribute value

+

Discussion

+

The index ("idx") is 0-based. NULL is returned if the specified index +is out of range. + +

 Mini-XML 2.11 mxmlElementGetAttrCount

Get the number of element attributes.

@@ -368,6 +386,11 @@ void mxmlElementSetAttr (

value
Attribute value
+

Discussion

+

If the named attribute already exists, the value of the attribute +is replaced by the new string value. The string value is copied +into the element node. This function does nothing if the node is +not an element.

 Mini-XML 2.3 mxmlElementSetAttrf

Set an attribute with a formatted value.

@@ -388,6 +411,13 @@ void mxmlElementSetAttrf (

...
Additional arguments as needed
+

Discussion

+

If the named attribute already exists, the value of the attribute +is replaced by the new formatted string. The formatted string value is +copied into the element node. This function does nothing if the node +is not an element. + +

mxmlEntityAddCallback

Add a callback to convert entities to Unicode.

@@ -414,6 +444,8 @@ const char *mxmlEntityGetName (

Return Value

Entity name or NULL

+

Discussion

+

If val does not need to be represented by a named entity, NULL is returned.

mxmlEntityGetValue

Get the character corresponding to a named entity.

@@ -427,6 +459,9 @@ int mxmlEntityGetValue (

Return Value

Character value or -1 on error

+

Discussion

+

The entity name can also be a numeric constant. -1 is returned if the +name is not known.

mxmlEntityRemoveCallback

Remove a callback.

@@ -466,6 +501,15 @@ void mxmlEntityRemoveCallback (

Return Value

Element node or NULL

+

Discussion

+

The search is constrained by the name, attribute name, and value; any +NULL names or values are treated as wildcards, so different kinds of +searches can be implemented by looking for all elements of a given name +or all elements with a specific attribute. The descend argument determines +whether the search descends into child nodes; normally you will use +MXML_DESCEND_FIRST for the initial search and MXML_NO_DESCEND +to find additional direct descendents of the node. The top node argument +constrains the search to a particular node's children.

 Mini-XML 2.7 mxmlFindPath

Find a node with the given path.

@@ -482,6 +526,15 @@ void mxmlEntityRemoveCallback (

Return Value

Found node or NULL

+

Discussion

+

The "path" is a slash-separated list of element names. The name "*" is +considered a wildcard for one or more levels of elements. For example, +"foo/one/two", "bar/two/one", "*/one", and so forth.
+
+The first child node of the found node is returned if the given node has +children and the first child is a value node. + +

 Mini-XML 2.7 mxmlGetCDATA

Get the value for a CDATA node.

@@ -495,6 +548,10 @@ const char *mxmlGetCDATA (

Return Value

CDATA value or NULL

+

Discussion

+

NULL is returned if the node is not a CDATA element. + +

 Mini-XML 2.7 mxmlGetCustom

Get the value for a custom node.

@@ -508,6 +565,11 @@ const void *mxmlGetCustom (

Return Value

Custom value or NULL

+

Discussion

+

NULL is returned if the node (or its first child) is not a custom +value node. + +

 Mini-XML 2.7 mxmlGetElement

Get the name for an element node.

@@ -521,6 +583,10 @@ const char *mxmlGetElement (

Return Value

Element name or NULL

+

Discussion

+

NULL is returned if the node is not an element node. + +

 Mini-XML 2.7 mxmlGetFirstChild

Get the first child of an element node.

@@ -534,6 +600,11 @@ const char *mxmlGetElement (

Return Value

First child or NULL

+

Discussion

+

NULL is returned if the node is not an element node or if the node +has no children. + +

 Mini-XML 2.7 mxmlGetInteger

Get the integer value from the specified node or its first child.

@@ -548,6 +619,10 @@ int mxmlGetInteger (

Return Value

Integer value or 0

+

Discussion

+

0 is returned if the node (or its first child) is not an integer value node. + +

 Mini-XML 2.7 mxmlGetLastChild

Get the last child of an element node.

@@ -561,6 +636,11 @@ int mxmlGetInteger (

Return Value

Last child or NULL

+

Discussion

+

NULL is returned if the node is not an element node or if the node +has no children. + +

mxmlGetNextSibling

Return the node type...

@@ -590,6 +670,11 @@ const char *mxmlGetOpaque (

Return Value

Opaque string or NULL

+

Discussion

+

NULL is returned if the node (or its first child) is not an opaque +value node. + +

 Mini-XML 2.7 mxmlGetParent

Get the parent node.

@@ -603,6 +688,10 @@ const char *mxmlGetOpaque (

Return Value

Parent node or NULL

+

Discussion

+

NULL is returned for a root node. + +

 Mini-XML 2.7 mxmlGetPrevSibling

Get the previous node for the current parent.

@@ -616,6 +705,10 @@ const char *mxmlGetOpaque (

Return Value

Previous node or NULL

+

Discussion

+

NULL is returned if this is the first child for the current parent. + +

 Mini-XML 2.7 mxmlGetReal

Get the real value for a node or its first child.

@@ -629,6 +722,10 @@ double mxmlGetReal (

Return Value

Real value or 0.0

+

Discussion

+

0.0 is returned if the node (or its first child) is not a real value node. + +

 Mini-XML 2.7 mxmlGetRefCount

Get the current reference (use) count for a node.

@@ -642,6 +739,12 @@ int mxmlGetRefCount (

Return Value

Reference count

+

Discussion

+

The initial reference count of new nodes is 1. Use the mxmlRetain +and mxmlRelease functions to increment and decrement a node's +reference count. + +.

 Mini-XML 2.7 mxmlGetText

Get the text value for a node or its first child.

@@ -658,6 +761,11 @@ const char *mxmlGetText (

Return Value

Text string or NULL

+

Discussion

+

NULL is returned if the node (or its first child) is not a text node. +The "whitespace" argument can be NULL. + +

 Mini-XML 2.7 mxmlGetType

Get the node type.

@@ -671,6 +779,10 @@ const char *mxmlGetText (

Return Value

Type of node

+

Discussion

+

MXML_IGNORE is returned if "node" is NULL. + +

 Mini-XML 2.7 mxmlGetUserData

Get the user data pointer for a node.

@@ -708,6 +820,10 @@ void mxmlIndexDelete (

Return Value

Next node or NULL if there is none

+

Discussion

+

You should call mxmlIndexReset prior to using this function to get +the first node in the index. Nodes are returned in the sorted order of the +index.

mxmlIndexFind

Find the next matching node.

@@ -727,6 +843,11 @@ void mxmlIndexDelete (

Return Value

Node or NULL if none found

+

Discussion

+

You should call mxmlIndexReset prior to using this function for +the first time with a particular set of "element" and "value" +strings. Passing NULL for both "element" and "value" is equivalent +to calling mxmlIndexEnum.

 Mini-XML 2.7 mxmlIndexGetCount

Get the number of nodes in an index.

@@ -759,6 +880,12 @@ int mxmlIndexGetCount (

Return Value

New index

+

Discussion

+

The index will contain all nodes that contain the named element and/or +attribute. If both "element" and "attr" are NULL, then the index will +contain a sorted list of the elements in the node tree. Nodes are +sorted by element name and optionally by attribute value if the "attr" +argument is not NULL.

mxmlIndexReset

Reset the enumeration/find pointer in the index and return the first node in the index.

@@ -773,6 +900,9 @@ return the first node in the index.

Return Value

First node or NULL if there is none

+

Discussion

+

This function should be called prior to using mxmlIndexEnum or +mxmlIndexFind for the first time.

mxmlLoadFd

Load a file descriptor into an XML node tree.

@@ -792,6 +922,14 @@ return the first node in the index.

Return Value

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

+

Discussion

+

The nodes in the specified file are added to the specified top node. +If no top node is provided, the XML file MUST be well-formed with a +single parent node like <?xml> for the entire file. The callback +function returns the value type that should be used for child nodes. +The constants MXML_INTEGER_CALLBACK, MXML_OPAQUE_CALLBACK, +MXML_REAL_CALLBACK, and MXML_TEXT_CALLBACK are defined for +loading child (data) nodes of the specified type.

mxmlLoadFile

Load a file into an XML node tree.

@@ -811,6 +949,14 @@ return the first node in the index.

Return Value

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

+

Discussion

+

The nodes in the specified file are added to the specified top node. +If no top node is provided, the XML file MUST be well-formed with a +single parent node like <?xml> for the entire file. The callback +function returns the value type that should be used for child nodes. +The constants MXML_INTEGER_CALLBACK, MXML_OPAQUE_CALLBACK, +MXML_REAL_CALLBACK, and MXML_TEXT_CALLBACK are defined for +loading child (data) nodes of the specified type.

mxmlLoadString

Load a string into an XML node tree.

@@ -830,6 +976,14 @@ return the first node in the index.

Return Value

First node or NULL if the string has errors.

+

Discussion

+

The nodes in the specified string are added to the specified top node. +If no top node is provided, the XML string MUST be well-formed with a +single parent node like <?xml> for the entire string. The callback +function returns the value type that should be used for child nodes. +The constants MXML_INTEGER_CALLBACK, MXML_OPAQUE_CALLBACK, +MXML_REAL_CALLBACK, and MXML_TEXT_CALLBACK are defined for +loading child (data) nodes of the specified type.

 Mini-XML 2.3 mxmlNewCDATA

Create a new CDATA node.

@@ -846,6 +1000,14 @@ return the first node in the index.

Return Value

New node

+

Discussion

+

The new CDATA node is added to the end of the specified parent's child +list. The constant MXML_NO_PARENT can be used to specify that the new +CDATA node has no parent. The data string must be nul-terminated and +is copied into the new node. CDATA nodes currently use the +MXML_ELEMENT type. + +

 Mini-XML 2.1 mxmlNewCustom

Create a new custom data node.

@@ -865,6 +1027,13 @@ return the first node in the index.

Return Value

New node

+

Discussion

+

The new custom node is added to the end of the specified parent's child +list. The constant MXML_NO_PARENT can be used to specify that the new +element node has no parent. NULL can be passed when the data in the +node is not dynamically allocated or is separately managed. + +

mxmlNewElement

Create a new element node.

@@ -881,6 +1050,10 @@ return the first node in the index.

Return Value

New node

+

Discussion

+

The new element node is added to the end of the specified parent's child +list. The constant MXML_NO_PARENT can be used to specify that the new +element node has no parent.

mxmlNewInteger

Create a new integer node.

@@ -897,6 +1070,10 @@ return the first node in the index.

Return Value

New node

+

Discussion

+

The new integer node is added to the end of the specified parent's child +list. The constant MXML_NO_PARENT can be used to specify that the new +integer node has no parent.

mxmlNewOpaque

Create a new opaque string.

@@ -913,6 +1090,11 @@ return the first node in the index.

Return Value

New node

+

Discussion

+

The new opaque string node is added to the end of the specified parent's +child list. The constant MXML_NO_PARENT can be used to specify that +the new opaque string node has no parent. The opaque string must be nul- +terminated and is copied into the new node.

mxmlNewOpaquef

Create a new formatted opaque string node.

@@ -932,6 +1114,11 @@ return the first node in the index.

Return Value

New node

+

Discussion

+

The new opaque string node is added to the end of the specified parent's +child list. The constant MXML_NO_PARENT can be used to specify that +the new opaque string node has no parent. The format string must be +nul-terminated and is formatted into the new node.

mxmlNewReal

Create a new real number node.

@@ -948,6 +1135,10 @@ return the first node in the index.

Return Value

New node

+

Discussion

+

The new real number node is added to the end of the specified parent's +child list. The constant MXML_NO_PARENT can be used to specify that +the new real number node has no parent.

mxmlNewText

Create a new text fragment node.

@@ -967,6 +1158,12 @@ return the first node in the index.

Return Value

New node

+

Discussion

+

The new text node is added to the end of the specified parent's child +list. The constant MXML_NO_PARENT can be used to specify that the new +text node has no parent. The whitespace parameter is used to specify +whether leading whitespace is present before the node. The text +string must be nul-terminated and is copied into the new node.

mxmlNewTextf

Create a new formatted text fragment node.

@@ -989,6 +1186,12 @@ return the first node in the index.

Return Value

New node

+

Discussion

+

The new text node is added to the end of the specified parent's child +list. The constant MXML_NO_PARENT can be used to specify that the new +text node has no parent. The whitespace parameter is used to specify +whether leading whitespace is present before the node. The format +string must be nul-terminated and is formatted into the new node.

 Mini-XML 2.3 mxmlNewXML

Create a new XML document tree.

@@ -1002,6 +1205,11 @@ return the first node in the index.

Return Value

New ?xml node

+

Discussion

+

The "version" argument specifies the version number to put in the +?xml element node. If NULL, version "1.0" is assumed. + +

 Mini-XML 2.3 mxmlRelease

Release a node.

@@ -1015,6 +1223,11 @@ int mxmlRelease (

Return Value

New reference count

+

Discussion

+

When the reference count reaches zero, the node (and any children) +is deleted via mxmlDelete. + +

mxmlRemove

Remove a node from its parent.

@@ -1026,6 +1239,9 @@ void mxmlRemove (

node
Node to remove
+

Discussion

+

This function does not free memory used by the node - use mxmlDelete +for that. This function does nothing if the node has no parent.

 Mini-XML 2.3 mxmlRetain

Retain a node.

@@ -1065,6 +1281,20 @@ using a SAX callback.

Return Value

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

+

Discussion

+

The nodes in the specified file are added to the specified top node. +If no top node is provided, the XML file MUST be well-formed with a +single parent node like <?xml> for the entire file. The callback +function returns the value type that should be used for child nodes. +The constants MXML_INTEGER_CALLBACK, MXML_OPAQUE_CALLBACK, +MXML_REAL_CALLBACK, and MXML_TEXT_CALLBACK are defined for +loading child nodes of the specified type.
+
+The SAX callback must call mxmlRetain for any nodes that need to +be kept for later use. Otherwise, nodes are deleted when the parent +node is closed or after each data, comment, CDATA, or directive node. + +

 Mini-XML 2.3 mxmlSAXLoadFile

Load a file into an XML node tree using a SAX callback.

@@ -1091,6 +1321,20 @@ using a SAX callback.

Return Value

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

+

Discussion

+

The nodes in the specified file are added to the specified top node. +If no top node is provided, the XML file MUST be well-formed with a +single parent node like <?xml> for the entire file. The callback +function returns the value type that should be used for child nodes. +The constants MXML_INTEGER_CALLBACK, MXML_OPAQUE_CALLBACK, +MXML_REAL_CALLBACK, and MXML_TEXT_CALLBACK are defined for +loading child nodes of the specified type.
+
+The SAX callback must call mxmlRetain for any nodes that need to +be kept for later use. Otherwise, nodes are deleted when the parent +node is closed or after each data, comment, CDATA, or directive node. + +

 Mini-XML 2.3 mxmlSAXLoadString

Load a string into an XML node tree using a SAX callback.

@@ -1117,6 +1361,20 @@ using a SAX callback.

Return Value

First node or NULL if the string has errors.

+

Discussion

+

The nodes in the specified string are added to the specified top node. +If no top node is provided, the XML string MUST be well-formed with a +single parent node like <?xml> for the entire string. The callback +function returns the value type that should be used for child nodes. +The constants MXML_INTEGER_CALLBACK, MXML_OPAQUE_CALLBACK, +MXML_REAL_CALLBACK, and MXML_TEXT_CALLBACK are defined for +loading child nodes of the specified type.
+
+The SAX callback must call mxmlRetain for any nodes that need to +be kept for later use. Otherwise, nodes are deleted when the parent +node is closed or after each data, comment, CDATA, or directive node. + +

mxmlSaveAllocString

Save an XML tree to an allocated string.

@@ -1133,6 +1391,18 @@ char *mxmlSaveAllocString (

Return Value

Allocated string or NULL

+

Discussion

+

This function returns a pointer to a string containing the textual +representation of the XML node tree. The string should be freed +using the free() function when you are done with it. NULL is returned +if the node would produce an empty string or if the string cannot be +allocated.
+
+The callback argument specifies a function that returns a whitespace +string or NULL before and after each element. If MXML_NO_CALLBACK +is specified, whitespace will only be added before MXML_TEXT nodes +with leading whitespace and before attribute names inside opening +element tags.

mxmlSaveFd

Save an XML tree to a file descriptor.

@@ -1152,6 +1422,12 @@ int mxmlSaveFd (

Return Value

0 on success, -1 on error.

+

Discussion

+

The callback argument specifies a function that returns a whitespace +string or NULL before and after each element. If MXML_NO_CALLBACK +is specified, whitespace will only be added before MXML_TEXT nodes +with leading whitespace and before attribute names inside opening +element tags.

mxmlSaveFile

Save an XML tree to a file.

@@ -1171,6 +1447,12 @@ int mxmlSaveFile (

Return Value

0 on success, -1 on error.

+

Discussion

+

The callback argument specifies a function that returns a whitespace +string or NULL before and after each element. If MXML_NO_CALLBACK +is specified, whitespace will only be added before MXML_TEXT nodes +with leading whitespace and before attribute names inside opening +element tags.

mxmlSaveString

Save an XML node tree to a string.

@@ -1193,6 +1475,16 @@ int mxmlSaveString (

Return Value

Size of string

+

Discussion

+

This function returns the total number of bytes that would be +required for the string but only copies (bufsize - 1) characters +into the specified buffer.
+
+The callback argument specifies a function that returns a whitespace +string or NULL before and after each element. If MXML_NO_CALLBACK +is specified, whitespace will only be added before MXML_TEXT nodes +with leading whitespace and before attribute names inside opening +element tags.

 Mini-XML 2.3 mxmlSetCDATA

Set the element name of a CDATA node.

@@ -1209,6 +1501,10 @@ int mxmlSetCDATA (

Return Value

0 on success, -1 on failure

+

Discussion

+

The node is not changed if it (or its first child) is not a CDATA element node. + +

 Mini-XML 2.1 mxmlSetCustom

Set the data and destructor of a custom data node.

@@ -1228,6 +1524,10 @@ int mxmlSetCustom (

Return Value

0 on success, -1 on failure

+

Discussion

+

The node is not changed if it (or its first child) is not a custom node. + +

mxmlSetCustomHandlers

Set the handling functions for custom data.

@@ -1242,6 +1542,12 @@ void mxmlSetCustomHandlers (

save
Save function
+

Discussion

+

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.

mxmlSetElement

Set the name of an element node.

@@ -1258,6 +1564,8 @@ int mxmlSetElement (

Return Value

0 on success, -1 on failure

+

Discussion

+

The node is not changed if it is not an element node.

mxmlSetErrorCallback

Set the error message callback.

@@ -1285,6 +1593,8 @@ int mxmlSetInteger (

Return Value

0 on success, -1 on failure

+

Discussion

+

The node is not changed if it (or its first child) is not an integer node.

mxmlSetOpaque

Set the value of an opaque node.

@@ -1301,6 +1611,8 @@ int mxmlSetOpaque (

Return Value

0 on success, -1 on failure

+

Discussion

+

The node is not changed if it (or its first child) is not an opaque node.

 Mini-XML 2.11 mxmlSetOpaquef

Set the value of an opaque string node to a formatted string.

@@ -1320,6 +1632,10 @@ int mxmlSetOpaquef (

Return Value

0 on success, -1 on failure

+

Discussion

+

The node is not changed if it (or its first child) is not an opaque node. + +

mxmlSetReal

Set the value of a real number node.

@@ -1336,6 +1652,8 @@ int mxmlSetReal (

Return Value

0 on success, -1 on failure

+

Discussion

+

The node is not changed if it (or its first child) is not a real number node.

mxmlSetText

Set the value of a text node.

@@ -1355,6 +1673,8 @@ int mxmlSetText (

Return Value

0 on success, -1 on failure

+

Discussion

+

The node is not changed if it (or its first child) is not a text node.

mxmlSetTextf

Set the value of a text node to a formatted string.

@@ -1377,6 +1697,8 @@ int mxmlSetTextf (

Return Value

0 on success, -1 on failure

+

Discussion

+

The node is not changed if it (or its first child) is not a text node.

 Mini-XML 2.7 mxmlSetUserData

Set the user data pointer for a node.

@@ -1404,6 +1726,10 @@ void mxmlSetWrapMargin (

column
Column for wrapping, 0 to disable wrapping
+

Discussion

+

Wrapping is disabled when "column" is 0. + +

mxmlWalkNext

Walk to the next logical node in the tree.

@@ -1423,6 +1749,10 @@ void mxmlSetWrapMargin (

Return Value

Next node or NULL

+

Discussion

+

The descend argument controls whether the first child is considered +to be the next node. The top node argument constrains the walk to +the node's children.

mxmlWalkPrev

Walk to the previous logical node in the tree.

@@ -1442,6 +1772,10 @@ void mxmlSetWrapMargin (

Return Value

Previous node or NULL

+

Discussion

+

The descend argument controls whether the previous node's last child +is considered to be the previous node. The top node argument constrains +the walk to the node's children.

Data Types

mxml_custom_destroy_cb_t

Custom data destructor

diff --git a/mxmldoc.c b/mxmldoc.c index 575a534..639f262 100644 --- a/mxmldoc.c +++ b/mxmldoc.c @@ -2134,8 +2134,7 @@ scan_file(const char *filename, /* I - Filename */ * Copy comment for typedef as well as class/struct/union... */ - mxmlNewText(comment, 0, - comment->last_child->value.text.string); + mxmlNewOpaque(comment, comment->last_child->value.opaque); description = mxmlNewElement(typedefnode, "description"); #ifdef DEBUG fprintf(stderr, @@ -2219,8 +2218,7 @@ scan_file(const char *filename, /* I - Filename */ * Copy comment for typedef as well as class/struct/union... */ - mxmlNewText(comment, 0, - comment->last_child->value.text.string); + mxmlNewOpaque(comment, comment->last_child->value.opaque); description = mxmlNewElement(typedefnode, "description"); #ifdef DEBUG fprintf(stderr, @@ -2576,9 +2574,8 @@ scan_file(const char *filename, /* I - Filename */ " adding comment %p/%p to variable...\n", comment->last_child, comment->child); #endif /* DEBUG */ - mxmlNewText(comment, 0, buffer); - update_comment(variable, - mxmlNewText(description, 0, buffer)); + mxmlNewOpaque(comment, buffer); + update_comment(variable, mxmlNewOpaque(description, buffer)); } variable = NULL; @@ -2601,9 +2598,8 @@ scan_file(const char *filename, /* I - Filename */ " adding comment %p/%p to constant...\n", comment->last_child, comment->child); #endif /* DEBUG */ - mxmlNewText(comment, 0, buffer); - update_comment(constant, - mxmlNewText(description, 0, buffer)); + mxmlNewOpaque(comment, buffer); + update_comment(constant, mxmlNewOpaque(description, buffer)); } constant = NULL; @@ -2639,21 +2635,20 @@ scan_file(const char *filename, /* I - Filename */ comment->last_child, comment->child, mxmlElementGetAttr(typedefnode, "name")); #endif /* DEBUG */ - mxmlNewText(comment, 0, buffer); - update_comment(typedefnode, - mxmlNewText(description, 0, buffer)); + mxmlNewOpaque(comment, buffer); + update_comment(typedefnode, mxmlNewOpaque(description, buffer)); if (structclass) { description = mxmlNewElement(structclass, "description"); update_comment(structclass, - mxmlNewText(description, 0, buffer)); + mxmlNewOpaque(description, buffer)); } else if (enumeration) { description = mxmlNewElement(enumeration, "description"); update_comment(enumeration, - mxmlNewText(description, 0, buffer)); + mxmlNewOpaque(description, buffer)); } } @@ -2668,9 +2663,8 @@ scan_file(const char *filename, /* I - Filename */ fprintf(stderr, " adding comment %p/%p to parent...\n", comment->last_child, comment->child); #endif /* DEBUG */ - mxmlNewText(comment, 0, buffer); - update_comment(tree, - mxmlNewText(description, 0, buffer)); + mxmlNewOpaque(comment, buffer); + update_comment(tree, mxmlNewOpaque(description, buffer)); } else { @@ -2678,7 +2672,7 @@ scan_file(const char *filename, /* I - Filename */ fprintf(stderr, " before adding comment, child=%p, last_child=%p\n", comment->child, comment->last_child); #endif /* DEBUG */ - mxmlNewText(comment, 0, buffer); + mxmlNewOpaque(comment, buffer); #ifdef DEBUG fprintf(stderr, " after adding comment, child=%p, last_child=%p\n", comment->child, comment->last_child); @@ -2756,9 +2750,8 @@ scan_file(const char *filename, /* I - Filename */ fprintf(stderr, " adding comment %p/%p to variable...\n", comment->last_child, comment->child); #endif /* DEBUG */ - mxmlNewText(comment, 0, buffer); - update_comment(variable, - mxmlNewText(description, 0, buffer)); + mxmlNewOpaque(comment, buffer); + update_comment(variable, mxmlNewOpaque(description, buffer)); } variable = NULL; @@ -2780,9 +2773,8 @@ scan_file(const char *filename, /* I - Filename */ fprintf(stderr, " adding comment %p/%p to constant...\n", comment->last_child, comment->child); #endif /* DEBUG */ - mxmlNewText(comment, 0, buffer); - update_comment(constant, - mxmlNewText(description, 0, buffer)); + mxmlNewOpaque(comment, buffer); + update_comment(constant, mxmlNewOpaque(description, buffer)); } constant = NULL; @@ -2818,21 +2810,18 @@ scan_file(const char *filename, /* I - Filename */ comment->last_child, comment->child, mxmlElementGetAttr(typedefnode, "name")); #endif /* DEBUG */ - mxmlNewText(comment, 0, buffer); - update_comment(typedefnode, - mxmlNewText(description, 0, buffer)); + mxmlNewOpaque(comment, buffer); + update_comment(typedefnode, mxmlNewOpaque(description, buffer)); if (structclass) { description = mxmlNewElement(structclass, "description"); - update_comment(structclass, - mxmlNewText(description, 0, buffer)); + update_comment(structclass, mxmlNewOpaque(description, buffer)); } else if (enumeration) { description = mxmlNewElement(enumeration, "description"); - update_comment(enumeration, - mxmlNewText(description, 0, buffer)); + update_comment(enumeration, mxmlNewOpaque(description, buffer)); } } @@ -2847,12 +2836,11 @@ scan_file(const char *filename, /* I - Filename */ fprintf(stderr, " adding comment %p/%p to parent...\n", comment->last_child, comment->child); #endif /* DEBUG */ - mxmlNewText(comment, 0, buffer); - update_comment(tree, - mxmlNewText(description, 0, buffer)); + mxmlNewOpaque(comment, buffer); + update_comment(tree, mxmlNewOpaque(description, buffer)); } else - mxmlNewText(comment, 0, buffer); + mxmlNewOpaque(comment, buffer); #ifdef DEBUG fprintf(stderr, "C comment: <<<< %s >>>\n", buffer); @@ -2911,9 +2899,8 @@ scan_file(const char *filename, /* I - Filename */ fprintf(stderr, " adding comment %p/%p to variable...\n", comment->last_child, comment->child); #endif /* DEBUG */ - mxmlNewText(comment, 0, buffer); - update_comment(variable, - mxmlNewText(description, 0, buffer)); + mxmlNewOpaque(comment, buffer); + update_comment(variable, mxmlNewOpaque(description, buffer)); } variable = NULL; @@ -2935,9 +2922,8 @@ scan_file(const char *filename, /* I - Filename */ fprintf(stderr, " adding comment %p/%p to constant...\n", comment->last_child, comment->child); #endif /* DEBUG */ - mxmlNewText(comment, 0, buffer); - update_comment(constant, - mxmlNewText(description, 0, buffer)); + mxmlNewOpaque(comment, buffer); + update_comment(constant, mxmlNewOpaque(description, buffer)); } constant = NULL; @@ -2973,21 +2959,18 @@ scan_file(const char *filename, /* I - Filename */ comment->last_child, comment->child, mxmlElementGetAttr(typedefnode, "name")); #endif /* DEBUG */ - mxmlNewText(comment, 0, buffer); - update_comment(typedefnode, - mxmlNewText(description, 0, buffer)); + mxmlNewOpaque(comment, buffer); + update_comment(typedefnode, mxmlNewOpaque(description, buffer)); if (structclass) { description = mxmlNewElement(structclass, "description"); - update_comment(structclass, - mxmlNewText(description, 0, buffer)); + update_comment(structclass, mxmlNewOpaque(description, buffer)); } else if (enumeration) { description = mxmlNewElement(enumeration, "description"); - update_comment(enumeration, - mxmlNewText(description, 0, buffer)); + update_comment(enumeration, mxmlNewOpaque(description, buffer)); } } } @@ -3000,12 +2983,11 @@ scan_file(const char *filename, /* I - Filename */ fprintf(stderr, " adding comment %p/%p to parent...\n", comment->last_child, comment->child); #endif /* DEBUG */ - mxmlNewText(comment, 0, buffer); - update_comment(tree, - mxmlNewText(description, 0, buffer)); + mxmlNewOpaque(comment, buffer); + update_comment(tree, mxmlNewOpaque(description, buffer)); } else - mxmlNewText(comment, 0, buffer); + mxmlNewOpaque(comment, buffer); #ifdef DEBUG fprintf(stderr, "C++ comment: <<<< %s >>>\n", buffer); @@ -3508,7 +3490,7 @@ update_comment(mxml_node_t *parent, /* I - Parent node */ * Convert "\/" to "/"... */ - for (ptr = strstr(comment->value.text.string, "\\/"); + for (ptr = strstr(comment->value.opaque, "\\/"); ptr; ptr = strstr(ptr, "\\/")) safe_strcpy(ptr, ptr + 1); @@ -3517,7 +3499,7 @@ update_comment(mxml_node_t *parent, /* I - Parent node */ * Update the comment... */ - ptr = comment->value.text.string; + ptr = comment->value.opaque; if (*ptr == '\'') { @@ -3539,7 +3521,7 @@ update_comment(mxml_node_t *parent, /* I - Parent node */ while (isspace(*ptr & 255)) ptr ++; - safe_strcpy(comment->value.text.string, ptr); + safe_strcpy(comment->value.opaque, ptr); } } else if (!strncmp(ptr, "I ", 2) || !strncmp(ptr, "O ", 2) || @@ -3554,7 +3536,7 @@ update_comment(mxml_node_t *parent, /* I - Parent node */ *ptr++ = '\0'; if (!strcmp(parent->value.element.name, "argument")) - mxmlElementSetAttr(parent, "direction", comment->value.text.string); + mxmlElementSetAttr(parent, "direction", comment->value.opaque); while (isspace(*ptr & 255)) ptr ++; @@ -3565,27 +3547,27 @@ update_comment(mxml_node_t *parent, /* I - Parent node */ while (isspace(*ptr & 255)) ptr ++; - safe_strcpy(comment->value.text.string, ptr); + safe_strcpy(comment->value.opaque, ptr); } /* * Eliminate leading and trailing *'s... */ - for (ptr = comment->value.text.string; *ptr == '*'; ptr ++); + for (ptr = comment->value.opaque; *ptr == '*'; ptr ++); for (; isspace(*ptr & 255); ptr ++); - if (ptr > comment->value.text.string) - safe_strcpy(comment->value.text.string, ptr); + if (ptr > comment->value.opaque) + safe_strcpy(comment->value.opaque, ptr); - for (ptr = comment->value.text.string + strlen(comment->value.text.string) - 1; - ptr > comment->value.text.string && *ptr == '*'; + for (ptr = comment->value.opaque + strlen(comment->value.opaque) - 1; + ptr > comment->value.opaque && *ptr == '*'; ptr --) *ptr = '\0'; - for (; ptr > comment->value.text.string && isspace(*ptr & 255); ptr --) + for (; ptr > comment->value.opaque && isspace(*ptr & 255); ptr --) *ptr = '\0'; #ifdef DEBUG - fprintf(stderr, " updated comment = %s\n", comment->value.text.string); + fprintf(stderr, " updated comment = %s\n", comment->value.opaque); #endif /* DEBUG */ }