Commit d848f827 authored by Michael Sweet's avatar Michael Sweet

Fix some more parsing issues with static functions.

parent 6689e9f8
......@@ -233,45 +233,33 @@ MXML_TEXT
Text fragment
.SH FUNCTIONS
.SS mxmlAdd
Add a node to a tree.
.PP
.nf
void mxmlAdd (
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.
Insert node after this child...
.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
......@@ -310,38 +298,26 @@ int mxmlElementGetAttrCount (
.PP
.SS mxmlElementSetAttr
Set an attribute.
Node
.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
Set an attribute with a formatted value.
Range check input...
.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
......@@ -372,10 +348,10 @@ int mxmlEntityGetValue (
The entity name can also be a numeric constant. -1 is returned if the
name is not known.
.SS mxmlEntityRemoveCallback
Remove a callback.
Global data
.PP
.nf
void mxmlEntityRemoveCallback (
void mxmlEntityRemoveCallback (
mxml_entity_cb_t cb
);
.fi
......@@ -603,10 +579,10 @@ void * mxmlGetUserData (
.PP
.SS mxmlIndexDelete
Delete an index.
.PP
.nf
void mxmlIndexDelete (
void mxmlIndexDelete (
mxml_index_t *ind
);
.fi
......@@ -891,16 +867,13 @@ is deleted via \fImxmlDelete\fR.
.SS mxmlRemove
Remove a node from its parent.
Create the node and set the text value...
.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
......@@ -1094,20 +1067,14 @@ The node is not changed if it (or its first child) is not a custom node.
.SS mxmlSetCustomHandlers
Set the handling functions for custom data.
Read the XML 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
......@@ -1120,10 +1087,10 @@ int mxmlSetElement (
.PP
The node is not changed if it is not an element node.
.SS mxmlSetErrorCallback
Set the error message callback.
Global data
.PP
.nf
void mxmlSetErrorCallback (
void mxmlSetErrorCallback (
mxml_error_cb_t cb
);
.fi
......@@ -1211,17 +1178,13 @@ int mxmlSetUserData (
.PP
.SS mxmlSetWrapMargin
Set the wrap margin when saving XML data.
Global 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
......
This diff is collapsed.
......@@ -2118,7 +2118,26 @@ scan_file(const char *filename, /* I - Filename */
if (function)
{
if (fstructclass)
mxml_node_t *temptype = mxmlFindElement(returnvalue, returnvalue, "type", NULL, NULL, MXML_DESCEND);
#ifdef DEBUG
fprintf(stderr, " returnvalue type=%p(%s)\n", temptype, temptype ? temptype->child->value.text.string : "null");
#endif /* DEBUG */
if (temptype && temptype->child &&
!strcmp(temptype->child->value.text.string, "static") &&
!strcmp(tree->value.element.name, "mxmldoc"))
{
/*
* Remove static functions...
*/
#ifdef DEBUG
fputs(" DELETING STATIC FUNCTION\n", stderr);
#endif /* DEBUG */
mxmlDelete(function);
}
else if (fstructclass)
{
sort_node(fstructclass, function);
fstructclass = NULL;
......@@ -2126,7 +2145,8 @@ scan_file(const char *filename, /* I - Filename */
else
sort_node(tree, function);
function = NULL;
function = NULL;
returnvalue = NULL;
}
else if (type && type->child &&
((!strcmp(type->child->value.text.string, "typedef") &&
......@@ -2411,7 +2431,27 @@ scan_file(const char *filename, /* I - Filename */
if (function)
{
if (!strcmp(tree->value.element.name, "class"))
mxml_node_t *temptype = mxmlFindElement(returnvalue, returnvalue, "type", NULL, NULL, MXML_DESCEND);
#ifdef DEBUG
fprintf(stderr, " returnvalue type=%p(%s)\n", temptype, temptype ? temptype->child->value.text.string : "null");
#endif /* DEBUG */
if (temptype && temptype->child &&
!strcmp(temptype->child->value.text.string, "static") &&
!strcmp(tree->value.element.name, "mxmldoc"))
{
/*
* Remove static functions...
*/
#ifdef DEBUG
fputs(" DELETING STATIC FUNCTION\n", stderr);
#endif /* DEBUG */
mxmlDelete(function);
}
else if (!strcmp(tree->value.element.name, "class"))
{
#ifdef DEBUG
fputs(" ADDING FUNCTION TO CLASS\n", stderr);
......@@ -2421,8 +2461,9 @@ scan_file(const char *filename, /* I - Filename */
else
mxmlDelete(function);
function = NULL;
variable = NULL;
function = NULL;
variable = NULL;
returnvalue = NULL;
}
if (type)
......@@ -3191,19 +3232,6 @@ scan_file(const char *filename, /* I - Filename */
break;
}
if (type->child &&
!strcmp(type->child->value.text.string, "static") &&
!strcmp(tree->value.element.name, "mxmldoc"))
{
/*
* Remove static functions...
*/
mxmlDelete(type);
type = NULL;
break;
}
function = mxmlNewElement(MXML_NO_PARENT, "function");
if ((bufptr = strchr(buffer, ':')) != NULL && bufptr[1] == ':')
{
......@@ -3239,8 +3267,7 @@ scan_file(const char *filename, /* I - Filename */
comment->last_child->value.text.string : "(null)");
#endif /* DEBUG */
if (type->last_child &&
strcmp(type->last_child->value.text.string, "void"))
if (type->last_child)
{
returnvalue = mxmlNewElement(function, "returnvalue");
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment