Fix more parsing bugs for void functions/methods.

This commit is contained in:
Michael Sweet 2017-06-08 10:27:10 -04:00
parent 888fd3f169
commit 1c135e96cc
3 changed files with 143 additions and 65 deletions

View File

@ -232,34 +232,58 @@ MXML_TEXT
.br
Text fragment
.SH FUNCTIONS
.SS mxmlAdd
.SS index_sort
Sort the nodes in the index...
.PP
.nf
void mxmlAdd (
void index_sort (
mxml_index_t *ind,
int left,
int right
);
.fi
.PP
This function implements the classic quicksort algorithm...
.SS mxmlAdd
Add a node to a tree.
.PP
.nf
void mxmlAdd (
mxml_node_t *parent,
int where,
mxml_node_t *child,
mxml_node_t *node
);
.fi
.PP
Adds the specified node to the parent. If the child argument is not
\fBNULL\fR, puts the new node before or after the specified child depending
on the value of the where argument. If the child argument is \fBNULL\fR,
puts the new node at the beginning of the child list (\fBMXML_ADD_BEFORE\fR)
or at the end of the child list (\fBMXML_ADD_AFTER\fR). The constant
\fBMXML_ADD_TO_PARENT\fR can be used to specify a \fBNULL\fR child pointer.
.SS mxmlDelete
Delete a node and all of its children.
.PP
.nf
void mxmlDelete (
void mxmlDelete (
mxml_node_t *node
);
.fi
.PP
If the specified node has a parent, this function first removes the
node from its parent using the \fImxmlRemove\fR function.
.SS mxmlElementDeleteAttr
Delete an attribute.
.PP
.nf
void mxmlElementDeleteAttr (
void mxmlElementDeleteAttr (
mxml_node_t *node,
const char *name
);
.fi
.PP
.SS mxmlElementGetAttr
Get an attribute.
.PP
@ -298,26 +322,38 @@ int mxmlElementGetAttrCount (
.PP
.SS mxmlElementSetAttr
Node
Set an attribute.
.PP
.nf
void mxmlElementSetAttr (
void mxmlElementSetAttr (
mxml_node_t *node,
const char *name,
const char *value
);
.fi
.PP
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.
.SS mxmlElementSetAttrf
Range check input...
Set an attribute with a formatted value.
.PP
.nf
void mxmlElementSetAttrf (
void mxmlElementSetAttrf (
mxml_node_t *node,
const char *name,
const char *format,
...
);
.fi
.PP
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.
.SS mxmlEntityAddCallback
Add a callback to convert entities to Unicode.
.PP
@ -348,10 +384,10 @@ int mxmlEntityGetValue (
The entity name can also be a numeric constant. -1 is returned if the
name is not known.
.SS mxmlEntityRemoveCallback
Global data
Remove a callback.
.PP
.nf
void mxmlEntityRemoveCallback (
void mxmlEntityRemoveCallback (
mxml_entity_cb_t cb
);
.fi
@ -472,7 +508,7 @@ has no children.
.SS mxmlGetNextSibling
Return the node type...
.PP
.nf
mxml_node_t * mxmlGetNextSibling (
@ -579,10 +615,10 @@ void * mxmlGetUserData (
.PP
.SS mxmlIndexDelete
Delete an index.
.PP
.nf
void mxmlIndexDelete (
void mxmlIndexDelete (
mxml_index_t *ind
);
.fi
@ -867,13 +903,16 @@ is deleted via \fImxmlDelete\fR.
.SS mxmlRemove
Create the node and set the text value...
Remove a node from its parent.
.PP
.nf
void mxmlRemove (
void mxmlRemove (
mxml_node_t *node
);
.fi
.PP
This function does not free memory used by the node - use \fImxmlDelete\fR
for that. This function does nothing if the node has no parent.
.SS mxmlRetain
Retain a node.
.PP
@ -1067,14 +1106,20 @@ The node is not changed if it (or its first child) is not a custom node.
.SS mxmlSetCustomHandlers
Read the XML data...
Set the handling functions for custom data.
.PP
.nf
void mxmlSetCustomHandlers (
void mxmlSetCustomHandlers (
mxml_custom_load_cb_t load,
mxml_custom_save_cb_t save
);
.fi
.PP
The load function accepts a node pointer and a data string and must
return 0 on success and non-zero on error.
.PP
The save function accepts a node pointer and must return a malloc'd
string on success and \fBNULL\fR on error.
.SS mxmlSetElement
Set the name of an element node.
.PP
@ -1087,10 +1132,10 @@ int mxmlSetElement (
.PP
The node is not changed if it is not an element node.
.SS mxmlSetErrorCallback
Global data
Set the error message callback.
.PP
.nf
void mxmlSetErrorCallback (
void mxmlSetErrorCallback (
mxml_error_cb_t cb
);
.fi
@ -1178,13 +1223,17 @@ int mxmlSetUserData (
.PP
.SS mxmlSetWrapMargin
Global data
Set the wrap margin when saving XML data.
.PP
.nf
void mxmlSetWrapMargin (
void mxmlSetWrapMargin (
int column
);
.fi
.PP
Wrapping is disabled when "column" is 0.
.SS mxmlWalkNext
Walk to the next logical node in the tree.
.PP
@ -1213,6 +1262,16 @@ mxml_node_t * mxmlWalkPrev (
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.
.SS mxml_free
Free the memory used by a node.
.PP
.nf
void mxml_free (
mxml_node_t *node
);
.fi
.PP
Note: Does not free child nodes, does not remove from parent.
.SH TYPES
.SS mxml_custom_destroy_cb_t
Custom data destructor

View File

@ -158,7 +158,7 @@ table.list td {
padding: 5px 2px 5px 10px;
text-align: left;
vertical-align: top;
width: 100%;
width: 80%;
}
h1.title {
}
@ -176,6 +176,7 @@ h3.title {
<h2 class="title">Contents</h2>
<ul class="contents">
<li><a href="#FUNCTIONS">Functions</a><ul class="subcontents">
<li><a href="#index_sort">index_sort</a></li>
<li><a href="#mxmlAdd">mxmlAdd</a></li>
<li><a href="#mxmlDelete">mxmlDelete</a></li>
<li><a href="#mxmlElementDeleteAttr">mxmlElementDeleteAttr</a></li>
@ -249,6 +250,7 @@ h3.title {
<li><a href="#mxmlSetWrapMargin">mxmlSetWrapMargin</a></li>
<li><a href="#mxmlWalkNext">mxmlWalkNext</a></li>
<li><a href="#mxmlWalkPrev">mxmlWalkPrev</a></li>
<li><a href="#mxml_free">mxml_free</a></li>
</ul></li>
<li><a href="#TYPES">Data Types</a><ul class="subcontents">
<li><a href="#mxml_custom_destroy_cb_t">mxml_custom_destroy_cb_t</a></li>
@ -272,8 +274,23 @@ h3.title {
</div>
<div class="body">
<h2 class="title"><a id="FUNCTIONS">Functions</a></h2>
<h3 class="function"><a id="index_sort">index_sort</a></h3>
<p class="description">Sort the nodes in the index...</p>
<p class="code">
void index_sort(<a href="#mxml_index_t">mxml_index_t</a> *ind, int left, int right);</p>
<h4 class="parameters">Parameters</h4>
<table class="list"><tbody>
<tr><th>ind</th>
<td class="description">Index to sort</td></tr>
<tr><th>left</th>
<td class="description">Left node in partition</td></tr>
<tr><th>right</th>
<td class="description">Right node in partition</td></tr>
</tbody></table>
<h4 class="discussion">Discussion</h4>
<p class="discussion">This function implements the classic quicksort algorithm...</p>
<h3 class="function"><a id="mxmlAdd">mxmlAdd</a></h3>
<p class="description"></p>
<p class="description">Add a node to a tree.</p>
<p class="code">
void mxmlAdd(<a href="#mxml_node_t">mxml_node_t</a> *parent, int where, <a href="#mxml_node_t">mxml_node_t</a> *child, <a href="#mxml_node_t">mxml_node_t</a> *node);</p>
<h4 class="parameters">Parameters</h4>
@ -287,8 +304,7 @@ void mxmlAdd(<a href="#mxml_node_t">mxml_node_t</a> *parent, int where, <a href=
<tr><th>node</th>
<td class="description">Node to add</td></tr>
</tbody></table>
<h4 class="returnvalue">Return Value</h4>
<p class="description">Add a node to a tree.</p>
<h4 class="discussion">Discussion</h4>
<p class="discussion">Adds the specified node to the parent. If the child argument is not
<code>NULL</code>, puts the new node before or after the specified child depending
on the value of the where argument. If the child argument is <code>NULL</code>,
@ -296,7 +312,7 @@ puts the new node at the beginning of the child list (<code>MXML_ADD_BEFORE</cod
or at the end of the child list (<code>MXML_ADD_AFTER</code>). The constant
<code>MXML_ADD_TO_PARENT</code> can be used to specify a <code>NULL</code> child pointer.</p>
<h3 class="function"><a id="mxmlDelete">mxmlDelete</a></h3>
<p class="description"></p>
<p class="description">Delete a node and all of its children.</p>
<p class="code">
void mxmlDelete(<a href="#mxml_node_t">mxml_node_t</a> *node);</p>
<h4 class="parameters">Parameters</h4>
@ -304,12 +320,11 @@ void mxmlDelete(<a href="#mxml_node_t">mxml_node_t</a> *node);</p>
<tr><th>node</th>
<td class="description">Node to delete</td></tr>
</tbody></table>
<h4 class="returnvalue">Return Value</h4>
<p class="description">Delete a node and all of its children.</p>
<h4 class="discussion">Discussion</h4>
<p class="discussion">If the specified node has a parent, this function first removes the
node from its parent using the <a href="#mxmlRemove"><code>mxmlRemove</code></a> function.</p>
<h3 class="function"><a id="mxmlElementDeleteAttr">mxmlElementDeleteAttr</a></h3>
<p class="description"></p>
<h3 class="function"><span class="info">&#160;Mini-XML 2.4&#160;</span><a id="mxmlElementDeleteAttr">mxmlElementDeleteAttr</a></h3>
<p class="description">Delete an attribute.</p>
<p class="code">
void mxmlElementDeleteAttr(<a href="#mxml_node_t">mxml_node_t</a> *node, const char *name);</p>
<h4 class="parameters">Parameters</h4>
@ -319,9 +334,6 @@ void mxmlElementDeleteAttr(<a href="#mxml_node_t">mxml_node_t</a> *node, const c
<tr><th>name</th>
<td class="description">Attribute name</td></tr>
</tbody></table>
<h4 class="returnvalue">Return Value</h4>
<p class="description">Delete an attribute.</p>
<p class="discussion"></p>
<h3 class="function"><a id="mxmlElementGetAttr">mxmlElementGetAttr</a></h3>
<p class="description">Get an attribute.</p>
<p class="code">
@ -370,7 +382,7 @@ int mxmlElementGetAttrCount(<a href="#mxml_node_t">mxml_node_t</a> *node);</p>
<h4 class="returnvalue">Return Value</h4>
<p class="description">Number of attributes</p>
<h3 class="function"><a id="mxmlElementSetAttr">mxmlElementSetAttr</a></h3>
<p class="description">Node</p>
<p class="description">Set an attribute.</p>
<p class="code">
void mxmlElementSetAttr(<a href="#mxml_node_t">mxml_node_t</a> *node, const char *name, const char *value);</p>
<h4 class="parameters">Parameters</h4>
@ -382,14 +394,13 @@ void mxmlElementSetAttr(<a href="#mxml_node_t">mxml_node_t</a> *node, const char
<tr><th>value</th>
<td class="description">Attribute value</td></tr>
</tbody></table>
<h4 class="returnvalue">Return Value</h4>
<p class="description">Set an attribute.</p>
<h4 class="discussion">Discussion</h4>
<p class="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.</p>
<h3 class="function"><a id="mxmlElementSetAttrf">mxmlElementSetAttrf</a></h3>
<p class="description">Range check input...</p>
<h3 class="function"><span class="info">&#160;Mini-XML 2.3&#160;</span><a id="mxmlElementSetAttrf">mxmlElementSetAttrf</a></h3>
<p class="description">Set an attribute with a formatted value.</p>
<p class="code">
void mxmlElementSetAttrf(<a href="#mxml_node_t">mxml_node_t</a> *node, const char *name, const char *format, ...);</p>
<h4 class="parameters">Parameters</h4>
@ -403,8 +414,7 @@ void mxmlElementSetAttrf(<a href="#mxml_node_t">mxml_node_t</a> *node, const cha
<tr><th>...</th>
<td class="description">Additional arguments as needed</td></tr>
</tbody></table>
<h4 class="returnvalue">Return Value</h4>
<p class="description">Set an attribute with a formatted value.</p>
<h4 class="discussion">Discussion</h4>
<p class="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
@ -450,7 +460,7 @@ int mxmlEntityGetValue(const char *name);</p>
<p class="discussion">The entity name can also be a numeric constant. -1 is returned if the
name is not known.</p>
<h3 class="function"><a id="mxmlEntityRemoveCallback">mxmlEntityRemoveCallback</a></h3>
<p class="description">Global data</p>
<p class="description">Remove a callback.</p>
<p class="code">
void mxmlEntityRemoveCallback(<a href="#mxml_entity_cb_t">mxml_entity_cb_t</a> cb);</p>
<h4 class="parameters">Parameters</h4>
@ -458,8 +468,6 @@ void mxmlEntityRemoveCallback(<a href="#mxml_entity_cb_t">mxml_entity_cb_t</a> c
<tr><th>cb</th>
<td class="description">Callback function to remove</td></tr>
</tbody></table>
<h4 class="returnvalue">Return Value</h4>
<p class="description">Remove a callback.</p>
<h3 class="function"><a id="mxmlFindElement">mxmlFindElement</a></h3>
<p class="description">Find the named element.</p>
<p class="code">
@ -607,7 +615,7 @@ has no children.
</p>
<h3 class="function"><a id="mxmlGetNextSibling">mxmlGetNextSibling</a></h3>
<p class="description">Return the node type...</p>
<p class="description"></p>
<p class="code">
<a href="#mxml_node_t">mxml_node_t</a> *mxmlGetNextSibling(<a href="#mxml_node_t">mxml_node_t</a> *node);</p>
<h4 class="parameters">Parameters</h4>
@ -743,7 +751,7 @@ void *mxmlGetUserData(<a href="#mxml_node_t">mxml_node_t</a> *node);</p>
<h4 class="returnvalue">Return Value</h4>
<p class="description">User data pointer</p>
<h3 class="function"><a id="mxmlIndexDelete">mxmlIndexDelete</a></h3>
<p class="description"></p>
<p class="description">Delete an index.</p>
<p class="code">
void mxmlIndexDelete(<a href="#mxml_index_t">mxml_index_t</a> *ind);</p>
<h4 class="parameters">Parameters</h4>
@ -751,8 +759,6 @@ void mxmlIndexDelete(<a href="#mxml_index_t">mxml_index_t</a> *ind);</p>
<tr><th>ind</th>
<td class="description">Index to delete</td></tr>
</tbody></table>
<h4 class="returnvalue">Return Value</h4>
<p class="description">Delete an index.</p>
<h3 class="function"><a id="mxmlIndexEnum">mxmlIndexEnum</a></h3>
<p class="description">Return the next node in the index.</p>
<p class="code">
@ -1113,7 +1119,7 @@ is deleted via <a href="#mxmlDelete"><code>mxmlDelete</code></a>.
</p>
<h3 class="function"><a id="mxmlRemove">mxmlRemove</a></h3>
<p class="description">Create the node and set the text value...</p>
<p class="description">Remove a node from its parent.</p>
<p class="code">
void mxmlRemove(<a href="#mxml_node_t">mxml_node_t</a> *node);</p>
<h4 class="parameters">Parameters</h4>
@ -1121,8 +1127,7 @@ void mxmlRemove(<a href="#mxml_node_t">mxml_node_t</a> *node);</p>
<tr><th>node</th>
<td class="description">Node to remove</td></tr>
</tbody></table>
<h4 class="returnvalue">Return Value</h4>
<p class="description">Remove a node from its parent.</p>
<h4 class="discussion">Discussion</h4>
<p class="discussion">This function does not free memory used by the node - use <a href="#mxmlDelete"><code>mxmlDelete</code></a>
for that. This function does nothing if the node has no parent.</p>
<h3 class="function"><span class="info">&#160;Mini-XML 2.3&#160;</span><a id="mxmlRetain">mxmlRetain</a></h3>
@ -1369,7 +1374,7 @@ int mxmlSetCustom(<a href="#mxml_node_t">mxml_node_t</a> *node, void *data, <a h
</p>
<h3 class="function"><a id="mxmlSetCustomHandlers">mxmlSetCustomHandlers</a></h3>
<p class="description">Read the XML data...</p>
<p class="description">Set the handling functions for custom data.</p>
<p class="code">
void mxmlSetCustomHandlers(<a href="#mxml_custom_load_cb_t">mxml_custom_load_cb_t</a> load, <a href="#mxml_custom_save_cb_t">mxml_custom_save_cb_t</a> save);</p>
<h4 class="parameters">Parameters</h4>
@ -1379,8 +1384,7 @@ void mxmlSetCustomHandlers(<a href="#mxml_custom_load_cb_t">mxml_custom_load_cb_
<tr><th>save</th>
<td class="description">Save function</td></tr>
</tbody></table>
<h4 class="returnvalue">Return Value</h4>
<p class="description">Set the handling functions for custom data.</p>
<h4 class="discussion">Discussion</h4>
<p class="discussion">The load function accepts a node pointer and a data string and must
return 0 on success and non-zero on error.<br>
<br>
@ -1402,7 +1406,7 @@ int mxmlSetElement(<a href="#mxml_node_t">mxml_node_t</a> *node, const char *nam
<h4 class="discussion">Discussion</h4>
<p class="discussion">The node is not changed if it is not an element node.</p>
<h3 class="function"><a id="mxmlSetErrorCallback">mxmlSetErrorCallback</a></h3>
<p class="description">Global data</p>
<p class="description">Set the error message callback.</p>
<p class="code">
void mxmlSetErrorCallback(<a href="#mxml_error_cb_t">mxml_error_cb_t</a> cb);</p>
<h4 class="parameters">Parameters</h4>
@ -1410,8 +1414,6 @@ void mxmlSetErrorCallback(<a href="#mxml_error_cb_t">mxml_error_cb_t</a> cb);</p
<tr><th>cb</th>
<td class="description">Error callback function</td></tr>
</tbody></table>
<h4 class="returnvalue">Return Value</h4>
<p class="description">Set the error message callback.</p>
<h3 class="function"><a id="mxmlSetInteger">mxmlSetInteger</a></h3>
<p class="description">Set the value of an integer node.</p>
<p class="code">
@ -1525,8 +1527,8 @@ int mxmlSetUserData(<a href="#mxml_node_t">mxml_node_t</a> *node, void *data);</
</tbody></table>
<h4 class="returnvalue">Return Value</h4>
<p class="description">0 on success, -1 on failure</p>
<h3 class="function"><a id="mxmlSetWrapMargin">mxmlSetWrapMargin</a></h3>
<p class="description">Global data</p>
<h3 class="function"><span class="info">&#160;Mini-XML 2.3&#160;</span><a id="mxmlSetWrapMargin">mxmlSetWrapMargin</a></h3>
<p class="description">Set the wrap margin when saving XML data.</p>
<p class="code">
void mxmlSetWrapMargin(int column);</p>
<h4 class="parameters">Parameters</h4>
@ -1534,8 +1536,7 @@ void mxmlSetWrapMargin(int column);</p>
<tr><th>column</th>
<td class="description">Column for wrapping, 0 to disable wrapping</td></tr>
</tbody></table>
<h4 class="returnvalue">Return Value</h4>
<p class="description">Set the wrap margin when saving XML data.</p>
<h4 class="discussion">Discussion</h4>
<p class="discussion">Wrapping is disabled when &quot;column&quot; is 0.
</p>
@ -1577,6 +1578,17 @@ the node's children.</p>
<p class="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.</p>
<h3 class="function"><a id="mxml_free">mxml_free</a></h3>
<p class="description">Free the memory used by a node.</p>
<p class="code">
void mxml_free(<a href="#mxml_node_t">mxml_node_t</a> *node);</p>
<h4 class="parameters">Parameters</h4>
<table class="list"><tbody>
<tr><th>node</th>
<td class="description">Node</td></tr>
</tbody></table>
<h4 class="discussion">Discussion</h4>
<p class="discussion">Note: Does not free child nodes, does not remove from parent.</p>
<h2 class="title"><a id="TYPES">Data Types</a></h2>
<h3 class="typedef"><a id="mxml_custom_destroy_cb_t">mxml_custom_destroy_cb_t</a></h3>
<p class="description">Custom data destructor</p>

View File

@ -2377,7 +2377,14 @@ scan_file(const char *filename, /* I - Filename */
structclass = NULL;
if (braces > 0)
{
braces --;
if (braces == 0)
{
while (comment->child)
mxmlDelete(comment->child);
}
}
else
{
mxmlDelete(comment);
@ -3269,7 +3276,7 @@ scan_file(const char *filename, /* I - Filename */
comment->last_child->value.text.string : "(null)");
#endif /* DEBUG */
if (type->last_child)
if (type->last_child && strcmp(type->last_child->value.text.string, "void"))
{
returnvalue = mxmlNewElement(function, "returnvalue");
@ -5599,7 +5606,7 @@ write_html_head(FILE *out, /* I - Output file */
" padding: 5px 2px 5px 10px;\n"
" text-align: left;\n"
" vertical-align: top;\n"
" width: 100%;\n"
" width: 80%;\n"
"}\n"
"h1.title {\n"
"}\n"