mirror of
https://github.com/michaelrsweet/mxml.git
synced 2025-02-20 17:35:30 +00:00
More changes to documentation generator...
Cleanup library header file.
This commit is contained in:
parent
57847b02c1
commit
70040fe9d2
7
CHANGES
7
CHANGES
@ -1,11 +1,12 @@
|
||||
README - 06/05/2003
|
||||
README - 06/07/2003
|
||||
-------------------
|
||||
|
||||
|
||||
CHANGES IN Mini-XML 0.94
|
||||
|
||||
- The mxmldoc program now handles function arguments
|
||||
properly.
|
||||
- The mxmldoc program now handles function arguments,
|
||||
structures, unions, enumerations, classes, and
|
||||
typedefs properly. Finally some documentation...
|
||||
|
||||
|
||||
CHANGES IN Mini-XML 0.93
|
||||
|
@ -9,7 +9,36 @@
|
||||
--></style>
|
||||
</head>
|
||||
<body>
|
||||
<h1>Functions</h1>
|
||||
<h1>Contents</h1>
|
||||
<ul>
|
||||
<li><a href="#_classes">Classes</a></li>
|
||||
<li><a href="#_enumerations">Enumeration</a></li>
|
||||
<li><a href="#_functions">Functions</a></li>
|
||||
<li><a href="#_structures">Structures</a></li>
|
||||
<li><a href="#_types">Types</a></li>
|
||||
<li><a href="#_unions">Unions</a></li>
|
||||
</ul>
|
||||
<h1><a name="_classes">Classes</a></h1>
|
||||
<ul>
|
||||
</ul>
|
||||
<h1><a name="_enumerations">Enumerations</a></h1>
|
||||
<ul>
|
||||
<li><a href="#mxml_type_e"><tt>mxml_type_e</tt></a></li>
|
||||
</ul>
|
||||
<hr noshade/>
|
||||
<h2><a name="mxml_type_e">mxml_type_e</a></h2>
|
||||
<p>Node Type</p>
|
||||
<h3>Values</h3>
|
||||
<p class="table"><table align="center" border="1" width="80%">
|
||||
<thead><tr><th>Name</th><th>Description</th></tr></thead>
|
||||
<tbody>
|
||||
<tr><td><tt>MXML_ELEMENT</tt></td><td>XML element with attributes</td></tr>
|
||||
<tr><td><tt>MXML_INTEGER</tt></td><td>Integer value</td></tr>
|
||||
<tr><td><tt>MXML_OPAQUE</tt></td><td>Opaque string</td></tr>
|
||||
<tr><td><tt>MXML_REAL</tt></td><td>Real value</td></tr>
|
||||
<tr><td><tt>MXML_TEXT</tt></td><td>Text fragment</td></tr>
|
||||
</tbody></table></p>
|
||||
<h1><a name="_functions">Functions</a></h1>
|
||||
<ul>
|
||||
<li><a href="#mxmlAdd"><tt>mxmlAdd()</tt></a></li>
|
||||
<li><a href="#mxmlDelete"><tt>mxmlDelete()</tt></a></li>
|
||||
@ -29,7 +58,7 @@
|
||||
</ul>
|
||||
<hr noshade/>
|
||||
<h2><a name="mxmlAdd">mxmlAdd()</a></h2>
|
||||
<p>Add a node to a tree.</p>
|
||||
<p>Local functions...</p>
|
||||
<h3>Syntax</h3>
|
||||
<pre>
|
||||
void
|
||||
@ -136,7 +165,7 @@ mxmlFindElement(
|
||||
<p>Element node or NULL</p>
|
||||
<hr noshade/>
|
||||
<h2><a name="mxmlLoadFile">mxmlLoadFile()</a></h2>
|
||||
<p>Load a file into an XML node tree.</p>
|
||||
<p>mxml_node_t *Top nodeFILE *File to read frommxml_type_tCallback functionNew nodemxml_node_t *Create a new element node.mxml_node_t *Parent nodeconst char *Name of elementNew nodemxml_node_t *Create a new integer node.mxml_node_t *Parent nodeintInteger valueNew nodemxml_node_t *Create a new opaque string.mxml_node_t *Parent nodeconst char *Opaque stringNew nodemxml_node_t *Create a new real number node.mxml_node_t *Parent nodedoubleReal number valueNew nodemxml_node_t *Create a new text fragment node.mxml_node_t *Parent nodeintLeading whitespace?const char *StringRemove a node from its parent.mxml_node_t *Node to remove0 on success, -1 on errorintSave an XML tree to a file.mxml_node_t *Node to writeFILE *File to write tointWhitespace callbackNext node or NULLmxml_node_t *Walk to the next logical node in the tree.mxml_node_t *Current nodemxml_node_t *Top nodeintDescend into tree?Previous node or NULLmxml_node_t *Walk to the previous logical node in the tree.mxml_node_t *Current nodemxml_node_t *Top nodeintDescend into tree?Data types...char *Attribute namechar *Attribute valuestruct mxml_attr_sstruct mxml_value_smxml_node_t *First child nodemxml_node_t *Last child nodemxml_node_t *Next node under same parentmxml_node_t *Parent nodemxml_node_t *Previous node under same parentmxml_type_tNode typemxml_value_tNode valuechar *Fragment stringintLeading whitespace?struct mxml_text_sNode TypeXML element with attributesInteger valueOpaque stringReal valueText fragmentAttribute ValueElement ValueText ValueNode ValueNodeC++ support...Prototypes...C++ support...End of "$Id: documentation.html,v 1.3 2003/06/07 21:27:05 mike Exp $".enum mxml_type_emxml_attr_t *Attributeschar *Name of elementintNumber of attributesunion mxml_value_umxml_element_tElementintInteger numberchar *Opaque stringdoubleReal numbermxml_text_tText fragmentmxml_node_t *Current nodemxml_node_t *Parent nodeNode typeconst char *String to writeFile to write toint(*cb)(mxml_node_t *int) intWhere valueCurrent column</p>
|
||||
<h3>Syntax</h3>
|
||||
<pre>
|
||||
mxml_node_t *
|
||||
@ -154,7 +183,7 @@ mxmlLoadFile(
|
||||
<tr><td><tt>(*cb)(mxml_node_t *)</tt></td><td>Callback function</td></tr>
|
||||
</tbody></table></p>
|
||||
<h3>Returns</h3>
|
||||
<p>First node</p>
|
||||
<p>Local functions...</p>
|
||||
<hr noshade/>
|
||||
<h2><a name="mxmlNewElement">mxmlNewElement()</a></h2>
|
||||
<p>Create a new element node.</p>
|
||||
@ -332,5 +361,162 @@ mxmlWalkPrev(
|
||||
</tbody></table></p>
|
||||
<h3>Returns</h3>
|
||||
<p>Previous node or NULL</p>
|
||||
<h1><a name="_structures">Structures</a></h1>
|
||||
<ul>
|
||||
<li><a href="#mxml_attr_s"><tt>mxml_attr_s</tt></a></li>
|
||||
<li><a href="#mxml_node_s"><tt>mxml_node_s</tt></a></li>
|
||||
<li><a href="#mxml_text_s"><tt>mxml_text_s</tt></a></li>
|
||||
<li><a href="#mxml_value_s"><tt>mxml_value_s</tt></a></li>
|
||||
</ul>
|
||||
<hr noshade/>
|
||||
<h2><a name="mxml_attr_s">mxml_attr_s</a></h2>
|
||||
<p>Data types...</p>
|
||||
<h3>Definition</h3>
|
||||
<pre>
|
||||
struct mxml_attr_s
|
||||
{
|
||||
char * name;
|
||||
char * value;
|
||||
};
|
||||
</pre>
|
||||
<h3>Members</h3>
|
||||
<p class="table"><table align="center" border="1" width="80%">
|
||||
<thead><tr><th>Name</th><th>Description</th></tr></thead>
|
||||
<tbody>
|
||||
<tr><td><tt>name</tt></td><td>Attribute name</td></tr>
|
||||
<tr><td><tt>value</tt></td><td>Attribute value</td></tr>
|
||||
</tbody></table></p>
|
||||
<hr noshade/>
|
||||
<h2><a name="mxml_node_s">mxml_node_s</a></h2>
|
||||
<p>mxml_node_t *First child nodemxml_node_t *Last child nodemxml_node_t *Next node under same parentmxml_node_t *Parent nodemxml_node_t *Previous node under same parentmxml_type_tNode typemxml_value_tNode valuechar *Fragment stringintLeading whitespace?struct mxml_text_sNode TypeXML element with attributesInteger valueOpaque stringReal valueText fragmentAttribute ValueElement ValueText ValueNode ValueNodeC++ support...Prototypes...C++ support...End of "$Id: documentation.html,v 1.3 2003/06/07 21:27:05 mike Exp $".enum mxml_type_emxml_attr_t *Attributeschar *Name of elementintNumber of attributesunion mxml_value_umxml_element_tElementintInteger numberchar *Opaque stringdoubleReal numbermxml_text_tText fragmentmxml_node_t *Current nodemxml_node_t *Parent nodeNode typeconst char *String to writeFile to write toint(*cb)(mxml_node_t *int) intWhere valueCurrent column</p>
|
||||
<h3>Definition</h3>
|
||||
<pre>
|
||||
struct mxml_node_s
|
||||
{
|
||||
mxml_node_t * child;
|
||||
mxml_node_t * last_child;
|
||||
mxml_node_t * next;
|
||||
mxml_node_t * parent;
|
||||
mxml_node_t * prev;
|
||||
mxml_type_t type;
|
||||
mxml_value_t value;
|
||||
};
|
||||
</pre>
|
||||
<h3>Members</h3>
|
||||
<p class="table"><table align="center" border="1" width="80%">
|
||||
<thead><tr><th>Name</th><th>Description</th></tr></thead>
|
||||
<tbody>
|
||||
<tr><td><tt>child</tt></td><td>First child node</td></tr>
|
||||
<tr><td><tt>last_child</tt></td><td>Last child node</td></tr>
|
||||
<tr><td><tt>next</tt></td><td>Next node under same parent</td></tr>
|
||||
<tr><td><tt>parent</tt></td><td>Parent node</td></tr>
|
||||
<tr><td><tt>prev</tt></td><td>Previous node under same parent</td></tr>
|
||||
<tr><td><tt>type</tt></td><td>Node type</td></tr>
|
||||
<tr><td><tt>value</tt></td><td>Node value</td></tr>
|
||||
</tbody></table></p>
|
||||
<hr noshade/>
|
||||
<h2><a name="mxml_text_s">mxml_text_s</a></h2>
|
||||
<p>char *Fragment stringintLeading whitespace?struct mxml_text_sNode TypeXML element with attributesInteger valueOpaque stringReal valueText fragmentAttribute ValueElement ValueText ValueNode ValueNodeC++ support...Prototypes...C++ support...End of "$Id: documentation.html,v 1.3 2003/06/07 21:27:05 mike Exp $".enum mxml_type_emxml_attr_t *Attributeschar *Name of elementintNumber of attributesunion mxml_value_umxml_element_tElementintInteger numberchar *Opaque stringdoubleReal numbermxml_text_tText fragmentmxml_node_t *Current nodemxml_node_t *Parent nodeNode typeconst char *String to writeFile to write toint(*cb)(mxml_node_t *int) intWhere valueCurrent column</p>
|
||||
<h3>Definition</h3>
|
||||
<pre>
|
||||
struct mxml_text_s
|
||||
{
|
||||
char * string;
|
||||
int whitespace;
|
||||
};
|
||||
</pre>
|
||||
<h3>Members</h3>
|
||||
<p class="table"><table align="center" border="1" width="80%">
|
||||
<thead><tr><th>Name</th><th>Description</th></tr></thead>
|
||||
<tbody>
|
||||
<tr><td><tt>string</tt></td><td>Fragment string</td></tr>
|
||||
<tr><td><tt>whitespace</tt></td><td>Leading whitespace?</td></tr>
|
||||
</tbody></table></p>
|
||||
<hr noshade/>
|
||||
<h2><a name="mxml_value_s">mxml_value_s</a></h2>
|
||||
<p>mxml_attr_t *Attributeschar *Name of elementintNumber of attributesunion mxml_value_umxml_element_tElementintInteger numberchar *Opaque stringdoubleReal numbermxml_text_tText fragmentmxml_node_t *Current nodemxml_node_t *Parent nodeNode typeconst char *String to writeFile to write toint(*cb)(mxml_node_t *int) intWhere valueCurrent column</p>
|
||||
<h3>Definition</h3>
|
||||
<pre>
|
||||
struct mxml_value_s
|
||||
{
|
||||
mxml_attr_t * attrs;
|
||||
char * name;
|
||||
int num_attrs;
|
||||
};
|
||||
</pre>
|
||||
<h3>Members</h3>
|
||||
<p class="table"><table align="center" border="1" width="80%">
|
||||
<thead><tr><th>Name</th><th>Description</th></tr></thead>
|
||||
<tbody>
|
||||
<tr><td><tt>attrs</tt></td><td>Attributes</td></tr>
|
||||
<tr><td><tt>name</tt></td><td>Name of element</td></tr>
|
||||
<tr><td><tt>num_attrs</tt></td><td>Number of attributes</td></tr>
|
||||
</tbody></table></p>
|
||||
<h1><a name="_types">Types</a></h1>
|
||||
<ul>
|
||||
<li><a href="#mxml_attr_t"><tt>mxml_attr_t</tt></a></li>
|
||||
<li><a href="#mxml_element_t"><tt>mxml_element_t</tt></a></li>
|
||||
<li><a href="#mxml_text_t"><tt>mxml_text_t</tt></a></li>
|
||||
<li><a href="#mxml_type_t"><tt>mxml_type_t</tt></a></li>
|
||||
<li><a href="#mxml_value_t"><tt>mxml_value_t</tt></a></li>
|
||||
</ul>
|
||||
<hr noshade/>
|
||||
<h2><a name="mxml_attr_t">mxml_attr_t</a></h2>
|
||||
<h3>Definition</h3>
|
||||
<pre>
|
||||
typedef struct mxml_attr_s mxml_attr_t;
|
||||
</pre>
|
||||
<hr noshade/>
|
||||
<h2><a name="mxml_element_t">mxml_element_t</a></h2>
|
||||
<h3>Definition</h3>
|
||||
<pre>
|
||||
typedef struct mxml_value_s mxml_element_t;
|
||||
</pre>
|
||||
<hr noshade/>
|
||||
<h2><a name="mxml_text_t">mxml_text_t</a></h2>
|
||||
<h3>Definition</h3>
|
||||
<pre>
|
||||
typedef struct mxml_text_s mxml_text_t;
|
||||
</pre>
|
||||
<hr noshade/>
|
||||
<h2><a name="mxml_type_t">mxml_type_t</a></h2>
|
||||
<h3>Definition</h3>
|
||||
<pre>
|
||||
typedef enum mxml_type_e mxml_type_t;
|
||||
</pre>
|
||||
<hr noshade/>
|
||||
<h2><a name="mxml_value_t">mxml_value_t</a></h2>
|
||||
<h3>Definition</h3>
|
||||
<pre>
|
||||
typedef union mxml_value_u mxml_value_t;
|
||||
</pre>
|
||||
<h1><a name="_unions">Unions</a></h1>
|
||||
<ul>
|
||||
<li><a href="#mxml_value_u"><tt>mxml_value_u</tt></a></li>
|
||||
</ul>
|
||||
<hr noshade/>
|
||||
<h2><a name="mxml_value_u">mxml_value_u</a></h2>
|
||||
<p>mxml_element_tElementintInteger numberchar *Opaque stringdoubleReal numbermxml_text_tText fragmentmxml_node_t *Current nodemxml_node_t *Parent nodeNode typeconst char *String to writeFile to write toint(*cb)(mxml_node_t *int) intWhere valueCurrent column</p>
|
||||
<h3>Definition</h3>
|
||||
<pre>
|
||||
struct mxml_value_u
|
||||
{
|
||||
mxml_element_t element;
|
||||
int integer;
|
||||
char * opaque;
|
||||
double real;
|
||||
mxml_text_t text;
|
||||
};
|
||||
</pre>
|
||||
<h3>Members</h3>
|
||||
<p class="table"><table align="center" border="1" width="80%">
|
||||
<thead><tr><th>Name</th><th>Description</th></tr></thead>
|
||||
<tbody>
|
||||
<tr><td><tt>element</tt></td><td>Element</td></tr>
|
||||
<tr><td><tt>integer</tt></td><td>Integer number</td></tr>
|
||||
<tr><td><tt>opaque</tt></td><td>Opaque string</td></tr>
|
||||
<tr><td><tt>real</tt></td><td>Real number</td></tr>
|
||||
<tr><td><tt>text</tt></td><td>Text fragment</td></tr>
|
||||
</tbody></table></p>
|
||||
</body>
|
||||
</html>
|
||||
|
26
index.html
26
index.html
@ -3,10 +3,10 @@
|
||||
<head>
|
||||
<title>Mini-XML Home Page</title>
|
||||
<style><!--
|
||||
h1, h2, h3, p { font-family: sans-serif; text-align: justify; }
|
||||
body, h1, h2, h3, p { font-family: sans-serif; text-align: justify; }
|
||||
h1.title, p.title { font-family: sans-serif; text-align: center; }
|
||||
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; }
|
||||
pre { font-weight: bold; color: #7f0000; margin-left: 2em; text-align: left }
|
||||
--></style>
|
||||
</head>
|
||||
<body>
|
||||
@ -16,10 +16,11 @@ href="../index.html">Back to Home Page</a> ]</p>
|
||||
|
||||
<h1 class="title" align="center">Mini-XML Home Page</h1>
|
||||
|
||||
<p class="title" align="center">Current Release: v0.93 [ <a
|
||||
href="mxml-0.93.tar.gz">Download Source (.tar.gz 51k)</a> |
|
||||
<a href="CHANGES">View Change Log</a> |
|
||||
<a href="http://freshmeat.net/projects/mxml">Rate/Make Comments</A> ]</p>
|
||||
<p class="title" align="center">Current Release: v0.94<br/>
|
||||
[ <a href="mxml-0.94.tar.gz">Download Source (.tar.gz
|
||||
51k)</a> | <a href="CHANGES">Change Log</a> | <a
|
||||
href="documentation.html">Documentation</a> | <a
|
||||
href="http://freshmeat.net/projects/mxml">Rate/Make Comments</A> ]</p>
|
||||
|
||||
<h2>Introduction</h2>
|
||||
|
||||
@ -105,11 +106,14 @@ using Mini-XML.</p>
|
||||
<a href="mxml.h">#include <mxml.h></a>
|
||||
</pre>
|
||||
|
||||
<p>Nodes are defined by the <tt>mxml_node_t</tt> structure; the
|
||||
<tt>type</tt> member defines the node type (element, integer,
|
||||
opaque, real, or text) which determines which value you want to
|
||||
look at in the <tt>value</tt> union. New nodes can be created
|
||||
using the <a
|
||||
<p>Nodes are defined by the <a
|
||||
href="documentation.html#mxml_node_s"><tt>mxml_node_t</tt></a>
|
||||
structure; the <a
|
||||
href="documentation.html#mxml_type_e"><tt>type</tt></a> member
|
||||
defines the node type (element, integer, opaque, real, or text)
|
||||
which determines which value you want to look at in the <a
|
||||
href="documentation.html#mxml_value_u"><tt>value</tt></a>
|
||||
union. New nodes can be created using the <a
|
||||
href="documentation.html#mxmlNewElement"><tt>mxmlNewElement()</tt></a>,
|
||||
<a
|
||||
href="documentation.html#mxmlNewInteger"><tt>mxmlNewInteger()</tt></a>,
|
||||
|
56
mxml.h
56
mxml.h
@ -1,5 +1,5 @@
|
||||
/*
|
||||
* "$Id: mxml.h,v 1.7 2003/06/04 21:19:00 mike Exp $"
|
||||
* "$Id: mxml.h,v 1.8 2003/06/07 21:27:05 mike Exp $"
|
||||
*
|
||||
* Header file for mini-XML, a small XML-like file parsing library.
|
||||
*
|
||||
@ -62,7 +62,7 @@
|
||||
* Data types...
|
||||
*/
|
||||
|
||||
typedef enum /**** Node Type ****/
|
||||
typedef enum mxml_type_e /**** Node Type ****/
|
||||
{
|
||||
MXML_ELEMENT, /* XML element with attributes */
|
||||
MXML_INTEGER, /* Integer value */
|
||||
@ -71,41 +71,45 @@ typedef enum /**** Node Type ****/
|
||||
MXML_TEXT /* Text fragment */
|
||||
} mxml_type_t;
|
||||
|
||||
typedef struct /**** Attribute Value ****/
|
||||
typedef struct mxml_attr_s /**** Attribute Value ****/
|
||||
{
|
||||
char *name, /* Attribute name */
|
||||
*value; /* Attribute value */
|
||||
char *name; /* Attribute name */
|
||||
char *value; /* Attribute value */
|
||||
} mxml_attr_t;
|
||||
|
||||
typedef struct /**** Element Value ****/
|
||||
typedef struct mxml_value_s /**** Element Value ****/
|
||||
{
|
||||
char *name; /* Name of element */
|
||||
int num_attrs; /* Number of attributes */
|
||||
mxml_attr_t *attrs; /* Attributes */
|
||||
} mxml_element_t;
|
||||
|
||||
typedef struct mxml_node_str mxml_node_t;
|
||||
typedef struct mxml_text_s /**** Text Value ****/
|
||||
{
|
||||
int whitespace; /* Leading whitespace? */
|
||||
char *string; /* Fragment string */
|
||||
} mxml_text_t;
|
||||
|
||||
struct mxml_node_str /**** Node ****/
|
||||
typedef union mxml_value_u /**** Node Value ****/
|
||||
{
|
||||
mxml_element_t element; /* Element */
|
||||
int integer; /* Integer number */
|
||||
char *opaque; /* Opaque string */
|
||||
double real; /* Real number */
|
||||
mxml_text_t text; /* Text fragment */
|
||||
} mxml_value_t;
|
||||
|
||||
typedef struct mxml_node_s mxml_node_t;
|
||||
|
||||
struct mxml_node_s /**** Node ****/
|
||||
{
|
||||
mxml_type_t type; /* Node type */
|
||||
mxml_node_t *next, /* Next node under same parent */
|
||||
*prev, /* Previous node under same parent */
|
||||
*parent, /* Parent node */
|
||||
*child, /* First child node */
|
||||
*last_child; /* Last child node */
|
||||
union
|
||||
{
|
||||
mxml_element_t element; /* Element */
|
||||
int integer; /* Integer number */
|
||||
char *opaque; /* Opaque string */
|
||||
double real; /* Real number */
|
||||
struct
|
||||
{
|
||||
int whitespace; /* Leading whitespace? */
|
||||
char *string; /* Fragment string */
|
||||
} text; /* Text fragment */
|
||||
} value; /* Node value */
|
||||
mxml_node_t *next; /* Next node under same parent */
|
||||
mxml_node_t *prev; /* Previous node under same parent */
|
||||
mxml_node_t *parent; /* Parent node */
|
||||
mxml_node_t *child; /* First child node */
|
||||
mxml_node_t *last_child; /* Last child node */
|
||||
mxml_value_t value; /* Node value */
|
||||
};
|
||||
|
||||
|
||||
@ -158,5 +162,5 @@ extern mxml_node_t *mxmlWalkPrev(mxml_node_t *node, mxml_node_t *top,
|
||||
|
||||
|
||||
/*
|
||||
* End of "$Id: mxml.h,v 1.7 2003/06/04 21:19:00 mike Exp $".
|
||||
* End of "$Id: mxml.h,v 1.8 2003/06/07 21:27:05 mike Exp $".
|
||||
*/
|
||||
|
52
mxml.xml
52
mxml.xml
@ -1,6 +1,6 @@
|
||||
<?xml version="1.0"?>
|
||||
<variable name="fp"><type>FILE *</type><description>File to write to</description><description>Callback function</description></variable>
|
||||
<function name="mxmlAdd"><description>Add a node to a tree.</description><argument
|
||||
<function name="mxmlAdd"><description>Local functions...</description><argument
|
||||
name="parent" direction="I"><type>mxml_node_t *</type><description>Parent node</description></argument>
|
||||
<argument name="where" direction="I"><type>int</type><description>Where to add</description></argument>
|
||||
<argument name="child" direction="I"><type>mxml_node_t *</type><description>Child node for where</description></argument>
|
||||
@ -30,10 +30,9 @@ direction="I"><type>mxml_node_t *</type><description>Current node</description><
|
||||
<argument name="value" direction="I"><type>const char *</type><description>Attribute value, or NULL for any</description></argument>
|
||||
<argument name="descend" direction="I"><type>int</type><description>Descend into tree?</description></argument>
|
||||
</function>
|
||||
<function name="mxmlLoadFile"><returnvalue><description>First node</description><type>mxml_node_t
|
||||
<function name="mxmlLoadFile"><returnvalue><description>Local functions...</description><type>mxml_node_t
|
||||
*</type></returnvalue>
|
||||
<description>Load a file into an XML node tree.</description><argument
|
||||
name="top" direction="I"><type>mxml_node_t *</type><description>Top node</description></argument>
|
||||
<description/><argument name="top" direction="I"><type>mxml_node_t *</type><description>Top node</description></argument>
|
||||
<argument name="fp" direction="I"><type>FILE *</type><description>File to read from</description></argument>
|
||||
<argument name="(*cb)(mxml_node_t *)" direction="I"><type>mxml_type_t</type><description>Callback function</description></argument>
|
||||
</function>
|
||||
@ -91,11 +90,46 @@ name="node" direction="I"><type>mxml_node_t *</type><description>Current node</d
|
||||
<argument name="top" direction="I"><type>mxml_node_t *</type><description>Top node</description></argument>
|
||||
<argument name="descend" direction="I"><type>int</type><description>Descend into tree?</description></argument>
|
||||
</function>
|
||||
<variable name="mxml_attr_t"><type/></variable>
|
||||
<variable name="mxml_element_t"><type/></variable>
|
||||
<variable name="mxml_node_t"><type>typedef struct mxml_node_str</type></variable>
|
||||
<variable name="mxml_type_t"><type/></variable>
|
||||
<variable name="node"><type>mxml_node_t *</type><description>Current node</description></variable>
|
||||
<struct name="mxml_attr_s"><description>Data types...</description><variable
|
||||
name="name"><type>char *</type><description>Attribute name</description></variable>
|
||||
<variable name="value"><type>char *</type><description>Attribute value</description></variable>
|
||||
</struct>
|
||||
<typedef name="mxml_attr_t"><type>struct mxml_attr_s</type></typedef>
|
||||
<typedef name="mxml_element_t"><type>struct mxml_value_s</type></typedef>
|
||||
<struct name="mxml_node_s"><description/><variable name="child"><type>mxml_node_t
|
||||
*</type><description>First child node</description></variable>
|
||||
<variable name="last_child"><type>mxml_node_t *</type><description>Last child node</description></variable>
|
||||
<variable name="next"><type>mxml_node_t *</type><description>Next node under same parent</description></variable>
|
||||
<variable name="parent"><type>mxml_node_t *</type><description>Parent node</description></variable>
|
||||
<variable name="prev"><type>mxml_node_t *</type><description>Previous node under same parent</description></variable>
|
||||
<variable name="type"><type>mxml_type_t</type><description>Node type</description></variable>
|
||||
<variable name="value"><type>mxml_value_t</type><description>Node value</description></variable>
|
||||
</struct>
|
||||
<struct name="mxml_text_s"><description/><variable name="string"><type>char
|
||||
*</type><description>Fragment string</description></variable>
|
||||
<variable name="whitespace"><type>int</type><description>Leading whitespace?</description></variable>
|
||||
</struct>
|
||||
<typedef name="mxml_text_t"><type>struct mxml_text_s</type></typedef>
|
||||
<enumeration name="mxml_type_e"><description>Node Type</description><constant
|
||||
name="MXML_ELEMENT"><description>XML element with attributes</description></constant>
|
||||
<constant name="MXML_INTEGER"><description>Integer value</description></constant>
|
||||
<constant name="MXML_OPAQUE"><description>Opaque string</description></constant>
|
||||
<constant name="MXML_REAL"><description>Real value</description></constant>
|
||||
<constant name="MXML_TEXT"><description>Text fragment</description><description>Attribute Value</description><description>Element Value</description><description>Text Value</description><description>Node Value</description><description>Node</description><description>C++ support...</description><description>Prototypes...</description><description>C++ support...</description><description>End of "$Id: mxml.xml,v 1.3 2003/06/07 21:27:05 mike Exp $".</description></constant>
|
||||
</enumeration>
|
||||
<typedef name="mxml_type_t"><type>enum mxml_type_e</type></typedef>
|
||||
<struct name="mxml_value_s"><description/><variable name="attrs"><type>mxml_attr_t
|
||||
*</type><description>Attributes</description></variable>
|
||||
<variable name="name"><type>char *</type><description>Name of element</description></variable>
|
||||
<variable name="num_attrs"><type>int</type><description>Number of attributes</description></variable>
|
||||
</struct>
|
||||
<typedef name="mxml_value_t"><type>union mxml_value_u</type></typedef>
|
||||
<union name="mxml_value_u"><description/><variable name="element"><type>mxml_element_t</type><description>Element</description></variable>
|
||||
<variable name="integer"><type>int</type><description>Integer number</description></variable>
|
||||
<variable name="opaque"><type>char *</type><description>Opaque string</description></variable>
|
||||
<variable name="real"><type>double</type><description>Real number</description></variable>
|
||||
<variable name="text"><type>mxml_text_t</type><description>Text fragment</description></variable>
|
||||
</union><variable name="node"><type>mxml_node_t *</type><description>Current node</description></variable>
|
||||
<variable name="parent"><type>mxml_node_t *</type><description>Parent node</description><description>Node type</description></variable>
|
||||
<variable name="s"><type>const char *</type><description>String to write</description><description>File to write to</description></variable>
|
||||
<variable name="ws"><type>int(*cb)(mxml_node_t *int) int</type><description>Where value</description><description>Current column</description></variable>
|
||||
|
725
mxmldoc.c
725
mxmldoc.c
@ -1,5 +1,5 @@
|
||||
/*
|
||||
* "$Id: mxmldoc.c,v 1.9 2003/06/06 03:09:31 mike Exp $"
|
||||
* "$Id: mxmldoc.c,v 1.10 2003/06/07 21:27:05 mike Exp $"
|
||||
*
|
||||
* Documentation generator using mini-XML, a small XML-like file parsing
|
||||
* library.
|
||||
@ -320,13 +320,17 @@ scan_file(const char *filename, /* I - Filename */
|
||||
char buffer[16384], /* String buffer */
|
||||
*bufptr; /* Pointer into buffer */
|
||||
mxml_node_t *comment, /* <comment> node */
|
||||
*constant, /* <constant> node */
|
||||
*enumeration, /* <enumeration> node */
|
||||
*function, /* <function> node */
|
||||
*parent, /* <struct> or <class> node */
|
||||
*structclass, /* <struct> or <class> node */
|
||||
*typedefnode, /* <typedef> node */
|
||||
*variable, /* <variable> or <argument> node */
|
||||
*returnvalue, /* <returnvalue> node */
|
||||
*type, /* <type> node */
|
||||
*description; /* <description> node */
|
||||
#if DEBUG > 1
|
||||
mxml_node_t *temp; /* Temporary node */
|
||||
int oldstate, /* Previous state */
|
||||
oldch; /* Old character */
|
||||
static const char *states[] = /* State strings */
|
||||
@ -352,12 +356,15 @@ scan_file(const char *filename, /* I - Filename */
|
||||
bufptr = buffer;
|
||||
|
||||
comment = mxmlNewElement(MXML_NO_PARENT, "temp");
|
||||
parent = tree;
|
||||
constant = NULL;
|
||||
enumeration = NULL;
|
||||
function = NULL;
|
||||
variable = NULL;
|
||||
returnvalue = NULL;
|
||||
type = NULL;
|
||||
description = NULL;
|
||||
typedefnode = NULL;
|
||||
structclass = NULL;
|
||||
|
||||
/*
|
||||
* Read until end-of-file...
|
||||
@ -400,8 +407,131 @@ scan_file(const char *filename, /* I - Filename */
|
||||
break;
|
||||
|
||||
case '{' :
|
||||
#ifdef DEBUG
|
||||
fputs(" open brace...\n", stderr);
|
||||
#endif /* DEBUG */
|
||||
|
||||
if (function)
|
||||
sort_node(parent, function);
|
||||
sort_node(tree, function);
|
||||
else if (type && type->child &&
|
||||
((!strcmp(type->child->value.text.string, "typedef") &&
|
||||
type->child->next &&
|
||||
(!strcmp(type->child->next->value.text.string, "struct") ||
|
||||
!strcmp(type->child->next->value.text.string, "union") ||
|
||||
!strcmp(type->child->next->value.text.string, "class"))) ||
|
||||
!strcmp(type->child->value.text.string, "union") ||
|
||||
!strcmp(type->child->value.text.string, "struct") ||
|
||||
!strcmp(type->child->value.text.string, "class")))
|
||||
{
|
||||
/*
|
||||
* Start of a class or structure...
|
||||
*/
|
||||
|
||||
if (!strcmp(type->child->value.text.string, "typedef"))
|
||||
{
|
||||
#ifdef DEBUG
|
||||
fputs(" starting typedef...\n", stderr);
|
||||
#endif /* DEBUG */
|
||||
|
||||
typedefnode = mxmlNewElement(MXML_NO_PARENT, "typedef");
|
||||
mxmlDelete(type->child);
|
||||
}
|
||||
else
|
||||
typedefnode = NULL;
|
||||
|
||||
structclass = mxmlNewElement(MXML_NO_PARENT,
|
||||
type->child->value.text.string);
|
||||
|
||||
#ifdef DEBUG
|
||||
fprintf(stderr, "%c%s: <<< %s >>>\n",
|
||||
toupper(type->child->value.text.string[0]),
|
||||
type->child->value.text.string + 1,
|
||||
type->child->next ?
|
||||
type->child->next->value.text.string : "(noname)");
|
||||
#endif /* DEBUG */
|
||||
|
||||
if (type->child->next)
|
||||
{
|
||||
mxmlElementSetAttr(structclass, "name",
|
||||
type->child->next->value.text.string);
|
||||
sort_node(tree, structclass);
|
||||
}
|
||||
|
||||
if (typedefnode && type->child)
|
||||
type->child->value.text.whitespace = 0;
|
||||
else
|
||||
{
|
||||
mxmlDelete(type);
|
||||
type = NULL;
|
||||
}
|
||||
|
||||
description = mxmlNewElement(structclass, "description");
|
||||
update_comment(structclass, comment->last_child);
|
||||
mxmlAdd(description, MXML_ADD_AFTER, MXML_ADD_TO_PARENT,
|
||||
comment->last_child);
|
||||
|
||||
if (scan_file(filename, fp, structclass))
|
||||
return (-1);
|
||||
|
||||
#ifdef DEBUG
|
||||
fputs(" ended typedef...\n", stderr);
|
||||
#endif /* DEBUG */
|
||||
break;
|
||||
}
|
||||
else if (type && type->child && type->child->next &&
|
||||
(!strcmp(type->child->value.text.string, "enum") ||
|
||||
(!strcmp(type->child->value.text.string, "typedef") &&
|
||||
!strcmp(type->child->next->value.text.string, "enum"))))
|
||||
{
|
||||
/*
|
||||
* Enumeration type...
|
||||
*/
|
||||
|
||||
if (!strcmp(type->child->value.text.string, "typedef"))
|
||||
{
|
||||
#ifdef DEBUG
|
||||
fputs(" starting typedef...\n", stderr);
|
||||
#endif /* DEBUG */
|
||||
|
||||
typedefnode = mxmlNewElement(MXML_NO_PARENT, "typedef");
|
||||
mxmlDelete(type->child);
|
||||
}
|
||||
else
|
||||
typedefnode = NULL;
|
||||
|
||||
enumeration = mxmlNewElement(MXML_NO_PARENT, "enumeration");
|
||||
|
||||
#ifdef DEBUG
|
||||
fprintf(stderr, "Enumeration: <<< %s >>>\n",
|
||||
type->child->next ?
|
||||
type->child->next->value.text.string : "(noname)");
|
||||
#endif /* DEBUG */
|
||||
|
||||
if (type->child->next)
|
||||
{
|
||||
mxmlElementSetAttr(enumeration, "name",
|
||||
type->child->next->value.text.string);
|
||||
sort_node(tree, enumeration);
|
||||
}
|
||||
|
||||
if (typedefnode && type->child)
|
||||
type->child->value.text.whitespace = 0;
|
||||
else
|
||||
{
|
||||
mxmlDelete(type);
|
||||
type = NULL;
|
||||
}
|
||||
|
||||
description = mxmlNewElement(enumeration, "description");
|
||||
update_comment(enumeration, comment->last_child);
|
||||
mxmlAdd(description, MXML_ADD_AFTER, MXML_ADD_TO_PARENT,
|
||||
comment->last_child);
|
||||
}
|
||||
else if (type)
|
||||
{
|
||||
mxmlDelete(type);
|
||||
type = NULL;
|
||||
}
|
||||
|
||||
braces ++;
|
||||
function = NULL;
|
||||
@ -409,8 +539,16 @@ scan_file(const char *filename, /* I - Filename */
|
||||
break;
|
||||
|
||||
case '}' :
|
||||
#ifdef DEBUG
|
||||
fputs(" close brace...\n", stderr);
|
||||
#endif /* DEBUG */
|
||||
|
||||
enumeration = NULL;
|
||||
|
||||
if (braces > 0)
|
||||
braces --;
|
||||
else
|
||||
return (0);
|
||||
break;
|
||||
|
||||
case '(' :
|
||||
@ -446,10 +584,26 @@ scan_file(const char *filename, /* I - Filename */
|
||||
|
||||
case ';' :
|
||||
if (function)
|
||||
{
|
||||
mxmlDelete(function);
|
||||
function = NULL;
|
||||
}
|
||||
|
||||
function = NULL;
|
||||
variable = NULL;
|
||||
if (type)
|
||||
{
|
||||
mxmlDelete(type);
|
||||
type = NULL;
|
||||
}
|
||||
break;
|
||||
|
||||
case ':' :
|
||||
if (type)
|
||||
{
|
||||
#ifdef DEBUG
|
||||
fputs("Identifier: <<< : >>>\n", stderr);
|
||||
#endif /* DEBUG */
|
||||
mxmlNewText(type, 1, ":");
|
||||
}
|
||||
break;
|
||||
|
||||
case '*' :
|
||||
@ -503,6 +657,20 @@ scan_file(const char *filename, /* I - Filename */
|
||||
update_comment(variable,
|
||||
mxmlNewText(description, 0, buffer));
|
||||
}
|
||||
else if (constant)
|
||||
{
|
||||
description = mxmlNewElement(constant, "description");
|
||||
update_comment(constant,
|
||||
mxmlNewText(description, 0, buffer));
|
||||
}
|
||||
else if (strcmp(tree->value.element.name, "?xml") &&
|
||||
!mxmlFindElement(tree, tree, "description",
|
||||
NULL, NULL, MXML_DESCEND_FIRST))
|
||||
{
|
||||
description = mxmlNewElement(tree, "description");
|
||||
update_comment(tree,
|
||||
mxmlNewText(description, 0, buffer));
|
||||
}
|
||||
else
|
||||
mxmlNewText(comment, 0, buffer);
|
||||
|
||||
@ -546,6 +714,20 @@ scan_file(const char *filename, /* I - Filename */
|
||||
update_comment(variable,
|
||||
mxmlNewText(description, 0, buffer));
|
||||
}
|
||||
else if (constant)
|
||||
{
|
||||
description = mxmlNewElement(constant, "description");
|
||||
update_comment(constant,
|
||||
mxmlNewText(description, 0, buffer));
|
||||
}
|
||||
else if (strcmp(tree->value.element.name, "?xml") &&
|
||||
!mxmlFindElement(tree, tree, "description",
|
||||
NULL, NULL, MXML_DESCEND_FIRST))
|
||||
{
|
||||
description = mxmlNewElement(tree, "description");
|
||||
update_comment(tree,
|
||||
mxmlNewText(description, 0, buffer));
|
||||
}
|
||||
else
|
||||
mxmlNewText(comment, 0, buffer);
|
||||
|
||||
@ -581,6 +763,20 @@ scan_file(const char *filename, /* I - Filename */
|
||||
update_comment(variable,
|
||||
mxmlNewText(description, 0, buffer));
|
||||
}
|
||||
else if (constant)
|
||||
{
|
||||
description = mxmlNewElement(constant, "description");
|
||||
update_comment(constant,
|
||||
mxmlNewText(description, 0, buffer));
|
||||
}
|
||||
else if (strcmp(tree->value.element.name, "?xml") &&
|
||||
!mxmlFindElement(tree, tree, "description",
|
||||
NULL, NULL, MXML_DESCEND_FIRST))
|
||||
{
|
||||
description = mxmlNewElement(tree, "description");
|
||||
update_comment(tree,
|
||||
mxmlNewText(description, 0, buffer));
|
||||
}
|
||||
else
|
||||
mxmlNewText(comment, 0, buffer);
|
||||
|
||||
@ -609,7 +805,7 @@ scan_file(const char *filename, /* I - Filename */
|
||||
break;
|
||||
|
||||
case STATE_IDENTIFIER : /* Inside a keyword or identifier */
|
||||
if (isalnum(ch) || ch == '_' || ch == '[' || ch == ']')
|
||||
if (isalnum(ch) || ch == '_' || ch == '[' || ch == ']' || ch == ':')
|
||||
{
|
||||
if (bufptr < (buffer + sizeof(buffer) - 1))
|
||||
*bufptr++ = ch;
|
||||
@ -620,20 +816,16 @@ scan_file(const char *filename, /* I - Filename */
|
||||
*bufptr = '\0';
|
||||
state = STATE_NONE;
|
||||
|
||||
#ifdef DEBUG
|
||||
fprintf(stderr, "Identifier: <<< %s >>>\n", buffer);
|
||||
#endif /* DEBUG */
|
||||
|
||||
if (!braces)
|
||||
{
|
||||
if (!type)
|
||||
type = mxmlNewElement(MXML_NO_PARENT, "type");
|
||||
|
||||
#ifdef DEBUG
|
||||
fprintf(stderr, "function=%p (%s), ch='%c', parens=%d\n",
|
||||
fprintf(stderr, " function=%p (%s), type->child=%p, ch='%c', parens=%d\n",
|
||||
function,
|
||||
function ? mxmlElementGetAttr(function, "name") : "null",
|
||||
ch, parens);
|
||||
type->child, ch, parens);
|
||||
#endif /* DEBUG */
|
||||
|
||||
if (!function && ch == '(')
|
||||
@ -652,7 +844,7 @@ scan_file(const char *filename, /* I - Filename */
|
||||
|
||||
if (type->child &&
|
||||
!strcmp(type->child->value.text.string, "static") &&
|
||||
!strcmp(parent->value.element.name, "?xml"))
|
||||
!strcmp(tree->value.element.name, "?xml"))
|
||||
{
|
||||
/*
|
||||
* Remove static functions...
|
||||
@ -699,40 +891,94 @@ scan_file(const char *filename, /* I - Filename */
|
||||
type->last_child->value.text.string[0] != '*',
|
||||
buffer);
|
||||
|
||||
#ifdef DEBUG
|
||||
fprintf(stderr, "Argument: <<< %s >>>\n", buffer);
|
||||
#endif /* DEBUG */
|
||||
|
||||
variable = add_variable(function, "argument", type);
|
||||
type = NULL;
|
||||
}
|
||||
else if (!function && (ch == ';' || ch == ','))
|
||||
else if (type->child && !function && (ch == ';' || ch == ','))
|
||||
{
|
||||
/*
|
||||
* Variable definition...
|
||||
*/
|
||||
#ifdef DEBUG
|
||||
fprintf(stderr, " got semicolon, typedefnode=%p, structclass=%p\n",
|
||||
typedefnode, structclass);
|
||||
#endif /* DEBUG */
|
||||
|
||||
mxmlNewText(type, type->child != NULL &&
|
||||
type->last_child->value.text.string[0] != '(' &&
|
||||
type->last_child->value.text.string[0] != '*',
|
||||
buffer);
|
||||
if (typedefnode || structclass)
|
||||
{
|
||||
#ifdef DEBUG
|
||||
fprintf(stderr, "Typedef/struct/class: <<< %s >>>>\n", buffer);
|
||||
#endif /* DEBUG */
|
||||
|
||||
variable = add_variable(MXML_NO_PARENT, "variable", type);
|
||||
type = NULL;
|
||||
if (typedefnode)
|
||||
{
|
||||
mxmlElementSetAttr(typedefnode, "name", buffer);
|
||||
|
||||
sort_node(parent, variable);
|
||||
sort_node(tree, typedefnode);
|
||||
}
|
||||
|
||||
if (structclass && !mxmlElementGetAttr(structclass, "name"))
|
||||
{
|
||||
fprintf(stderr, "setting struct/class name to %s!\n",
|
||||
type->last_child->value.text.string);
|
||||
mxmlElementSetAttr(structclass, "name", buffer);
|
||||
|
||||
sort_node(tree, structclass);
|
||||
structclass = NULL;
|
||||
}
|
||||
|
||||
if (typedefnode)
|
||||
mxmlAdd(typedefnode, MXML_ADD_AFTER, MXML_ADD_TO_PARENT,
|
||||
type);
|
||||
else
|
||||
mxmlDelete(type);
|
||||
|
||||
type = NULL;
|
||||
typedefnode = NULL;
|
||||
}
|
||||
else
|
||||
{
|
||||
/*
|
||||
* Variable definition...
|
||||
*/
|
||||
|
||||
mxmlNewText(type, type->child != NULL &&
|
||||
type->last_child->value.text.string[0] != '(' &&
|
||||
type->last_child->value.text.string[0] != '*',
|
||||
buffer);
|
||||
|
||||
#ifdef DEBUG
|
||||
fprintf(stderr, "Variable: <<< %s >>>>\n", buffer);
|
||||
#endif /* DEBUG */
|
||||
|
||||
variable = add_variable(MXML_NO_PARENT, "variable", type);
|
||||
type = NULL;
|
||||
|
||||
sort_node(tree, variable);
|
||||
}
|
||||
}
|
||||
else if (ch == '{' && type->child &&
|
||||
(!strcmp(type->child->value.text.string, "class") ||
|
||||
!strcmp(type->child->value.text.string, "enum") ||
|
||||
!strcmp(type->child->value.text.string, "struct") ||
|
||||
!strcmp(type->child->value.text.string, "typedef")))
|
||||
{
|
||||
/* Handle structure/class/enum/typedef... */
|
||||
mxmlDelete(type);
|
||||
type = NULL;
|
||||
}
|
||||
else
|
||||
{
|
||||
#ifdef DEBUG
|
||||
fprintf(stderr, "Identifier: <<< %s >>>>\n", buffer);
|
||||
#endif /* DEBUG */
|
||||
|
||||
mxmlNewText(type, type->child != NULL &&
|
||||
type->last_child->value.text.string[0] != '(' &&
|
||||
type->last_child->value.text.string[0] != '*',
|
||||
buffer);
|
||||
}
|
||||
}
|
||||
else if (enumeration)
|
||||
{
|
||||
#ifdef DEBUG
|
||||
fprintf(stderr, "Constant: <<< %s >>>\n", buffer);
|
||||
#endif /* DEBUG */
|
||||
|
||||
constant = mxmlNewElement(MXML_NO_PARENT, "constant");
|
||||
mxmlElementSetAttr(constant, "name", buffer);
|
||||
sort_node(enumeration, constant);
|
||||
}
|
||||
else if (type)
|
||||
{
|
||||
@ -745,8 +991,17 @@ scan_file(const char *filename, /* I - Filename */
|
||||
|
||||
#if DEBUG > 1
|
||||
if (state != oldstate)
|
||||
fprintf(stderr, "changed states from %s to %s on receipt of character '%c'...\n",
|
||||
{
|
||||
fprintf(stderr, " changed states from %s to %s on receipt of character '%c'...\n",
|
||||
states[oldstate], states[state], oldch);
|
||||
if (type)
|
||||
{
|
||||
fputs(" type =", stderr);
|
||||
for (temp = type->child; temp; temp = temp->next)
|
||||
fprintf(stderr, " \"%s\"", temp->value.text.string);
|
||||
fputs("\n", stderr);
|
||||
}
|
||||
}
|
||||
#endif /* DEBUG > 1 */
|
||||
}
|
||||
|
||||
@ -886,6 +1141,22 @@ update_comment(mxml_node_t *parent, /* I - Parent node */
|
||||
|
||||
strcpy(comment->value.text.string, ptr);
|
||||
}
|
||||
|
||||
/*
|
||||
* Eliminate leading and trailing *'s...
|
||||
*/
|
||||
|
||||
for (ptr = comment->value.text.string; *ptr == '*'; ptr ++);
|
||||
for (; isspace(*ptr); ptr ++);
|
||||
if (ptr > comment->value.text.string)
|
||||
strcpy(comment->value.text.string, ptr);
|
||||
|
||||
for (ptr = comment->value.text.string + strlen(comment->value.text.string) - 1;
|
||||
ptr > comment->value.text.string && *ptr == '*';
|
||||
ptr --)
|
||||
*ptr = '\0';
|
||||
for (; ptr > comment->value.text.string && isspace(*ptr); ptr --)
|
||||
*ptr = '\0';
|
||||
}
|
||||
|
||||
|
||||
@ -896,15 +1167,18 @@ update_comment(mxml_node_t *parent, /* I - Parent node */
|
||||
static void
|
||||
write_documentation(mxml_node_t *doc) /* I - XML documentation */
|
||||
{
|
||||
mxml_node_t *node, /* Current node */
|
||||
*function, /* Current function */
|
||||
mxml_node_t *function, /* Current function */
|
||||
*scut, /* Struct/class/union/typedef */
|
||||
*arg, /* Current argument */
|
||||
*description, /* Description of function/var */
|
||||
*type; /* Type of returnvalue/var */
|
||||
*description; /* Description of function/var */
|
||||
const char *name; /* Name of function/type */
|
||||
char prefix; /* Prefix character */
|
||||
|
||||
|
||||
/*
|
||||
* Standard header...
|
||||
*/
|
||||
|
||||
puts("<!DOCTYPE html PUBLIC \"-//W3C//DTD XHTML 1.0 Strict//EN\" "
|
||||
"\"http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd\">");
|
||||
puts("<html xmlns=\"http://www.w3.org/1999/xhtml\" xml:lang=\"en\" lang=\"en\">");
|
||||
@ -918,7 +1192,165 @@ write_documentation(mxml_node_t *doc) /* I - XML documentation */
|
||||
puts("</head>");
|
||||
puts("<body>");
|
||||
|
||||
puts("<h1>Functions</h1>");
|
||||
|
||||
/*
|
||||
* Table of contents...
|
||||
*/
|
||||
|
||||
puts("<h1>Contents</h1>");
|
||||
puts("<ul>");
|
||||
puts("\t<li><a href=\"#_classes\">Classes</a></li>");
|
||||
puts("\t<li><a href=\"#_enumerations\">Enumeration</a></li>");
|
||||
puts("\t<li><a href=\"#_functions\">Functions</a></li>");
|
||||
puts("\t<li><a href=\"#_structures\">Structures</a></li>");
|
||||
puts("\t<li><a href=\"#_types\">Types</a></li>");
|
||||
puts("\t<li><a href=\"#_unions\">Unions</a></li>");
|
||||
puts("</ul>");
|
||||
|
||||
/*
|
||||
* List of classes...
|
||||
*/
|
||||
|
||||
puts("<h1><a name=\"_classes\">Classes</a></h1>");
|
||||
puts("<ul>");
|
||||
|
||||
for (scut = mxmlFindElement(doc, doc, "class", NULL, NULL,
|
||||
MXML_DESCEND_FIRST);
|
||||
scut;
|
||||
scut = mxmlFindElement(scut, doc, "class", NULL, NULL,
|
||||
MXML_NO_DESCEND))
|
||||
{
|
||||
name = mxmlElementGetAttr(scut, "name");
|
||||
printf("\t<li><a href=\"#%s\"><tt>%s</tt></a></li>\n", name, name);
|
||||
}
|
||||
|
||||
puts("</ul>");
|
||||
|
||||
for (scut = mxmlFindElement(doc, doc, "class", NULL, NULL,
|
||||
MXML_DESCEND_FIRST);
|
||||
scut;
|
||||
scut = mxmlFindElement(scut, doc, "class", NULL, NULL,
|
||||
MXML_NO_DESCEND))
|
||||
{
|
||||
name = mxmlElementGetAttr(scut, "name");
|
||||
puts("<hr noshade/>");
|
||||
printf("<h2><a name=\"%s\">%s</a></h2>\n", name, name);
|
||||
|
||||
description = mxmlFindElement(scut, scut, "description", NULL,
|
||||
NULL, MXML_DESCEND_FIRST);
|
||||
if (description)
|
||||
{
|
||||
fputs("<p>", stdout);
|
||||
write_element(description);
|
||||
puts("</p>");
|
||||
}
|
||||
|
||||
puts("<h3>Definition</h3>");
|
||||
puts("<pre>");
|
||||
|
||||
printf("struct %s\n{\n", name);
|
||||
for (arg = mxmlFindElement(scut, scut, "variable", NULL, NULL,
|
||||
MXML_DESCEND_FIRST);
|
||||
arg;
|
||||
arg = mxmlFindElement(arg, scut, "variable", NULL, NULL,
|
||||
MXML_NO_DESCEND))
|
||||
{
|
||||
printf(" ");
|
||||
write_element(mxmlFindElement(arg, arg, "type", NULL,
|
||||
NULL, MXML_DESCEND_FIRST));
|
||||
printf(" %s;\n", mxmlElementGetAttr(arg, "name"));
|
||||
}
|
||||
|
||||
puts("};\n</pre>");
|
||||
|
||||
puts("<h3>Members</h3>");
|
||||
|
||||
puts("<p class=\"table\"><table align=\"center\" border=\"1\" width=\"80%\">");
|
||||
puts("<thead><tr><th>Name</th><th>Description</th></tr></thead>");
|
||||
puts("<tbody>");
|
||||
|
||||
for (arg = mxmlFindElement(scut, scut, "variable", NULL, NULL,
|
||||
MXML_DESCEND_FIRST);
|
||||
arg;
|
||||
arg = mxmlFindElement(arg, scut, "variable", NULL, NULL,
|
||||
MXML_NO_DESCEND))
|
||||
{
|
||||
printf("<tr><td><tt>%s</tt></td><td>", mxmlElementGetAttr(arg, "name"));
|
||||
|
||||
write_element(mxmlFindElement(arg, arg, "description", NULL,
|
||||
NULL, MXML_DESCEND_FIRST));
|
||||
|
||||
puts("</td></tr>");
|
||||
}
|
||||
|
||||
puts("</tbody></table></p>");
|
||||
}
|
||||
|
||||
/*
|
||||
* List of enumerations...
|
||||
*/
|
||||
|
||||
puts("<h1><a name=\"_enumerations\">Enumerations</a></h1>");
|
||||
puts("<ul>");
|
||||
|
||||
for (scut = mxmlFindElement(doc, doc, "enumeration", NULL, NULL,
|
||||
MXML_DESCEND_FIRST);
|
||||
scut;
|
||||
scut = mxmlFindElement(scut, doc, "enumeration", NULL, NULL,
|
||||
MXML_NO_DESCEND))
|
||||
{
|
||||
name = mxmlElementGetAttr(scut, "name");
|
||||
printf("\t<li><a href=\"#%s\"><tt>%s</tt></a></li>\n", name, name);
|
||||
}
|
||||
|
||||
puts("</ul>");
|
||||
|
||||
for (scut = mxmlFindElement(doc, doc, "enumeration", NULL, NULL,
|
||||
MXML_DESCEND_FIRST);
|
||||
scut;
|
||||
scut = mxmlFindElement(scut, doc, "enumeration", NULL, NULL,
|
||||
MXML_NO_DESCEND))
|
||||
{
|
||||
name = mxmlElementGetAttr(scut, "name");
|
||||
puts("<hr noshade/>");
|
||||
printf("<h2><a name=\"%s\">%s</a></h2>\n", name, name);
|
||||
|
||||
description = mxmlFindElement(scut, scut, "description", NULL,
|
||||
NULL, MXML_DESCEND_FIRST);
|
||||
if (description)
|
||||
{
|
||||
fputs("<p>", stdout);
|
||||
write_element(description);
|
||||
puts("</p>");
|
||||
}
|
||||
|
||||
puts("<h3>Values</h3>");
|
||||
|
||||
puts("<p class=\"table\"><table align=\"center\" border=\"1\" width=\"80%\">");
|
||||
puts("<thead><tr><th>Name</th><th>Description</th></tr></thead>");
|
||||
puts("<tbody>");
|
||||
|
||||
for (arg = mxmlFindElement(scut, scut, "constant", NULL, NULL,
|
||||
MXML_DESCEND_FIRST);
|
||||
arg;
|
||||
arg = mxmlFindElement(arg, scut, "constant", NULL, NULL,
|
||||
MXML_NO_DESCEND))
|
||||
{
|
||||
printf("<tr><td><tt>%s</tt></td><td>", mxmlElementGetAttr(arg, "name"));
|
||||
|
||||
write_element(mxmlFindElement(arg, arg, "description", NULL,
|
||||
NULL, MXML_DESCEND_FIRST));
|
||||
|
||||
puts("</td></tr>");
|
||||
}
|
||||
|
||||
puts("</tbody></table></p>");
|
||||
}
|
||||
/*
|
||||
* List of functions...
|
||||
*/
|
||||
|
||||
puts("<h1><a name=\"_functions\">Functions</a></h1>");
|
||||
puts("<ul>");
|
||||
|
||||
for (function = mxmlFindElement(doc, doc, "function", NULL, NULL,
|
||||
@ -1025,6 +1457,215 @@ write_documentation(mxml_node_t *doc) /* I - XML documentation */
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
* List of structures...
|
||||
*/
|
||||
|
||||
puts("<h1><a name=\"_structures\">Structures</a></h1>");
|
||||
puts("<ul>");
|
||||
|
||||
for (scut = mxmlFindElement(doc, doc, "struct", NULL, NULL,
|
||||
MXML_DESCEND_FIRST);
|
||||
scut;
|
||||
scut = mxmlFindElement(scut, doc, "struct", NULL, NULL,
|
||||
MXML_NO_DESCEND))
|
||||
{
|
||||
name = mxmlElementGetAttr(scut, "name");
|
||||
printf("\t<li><a href=\"#%s\"><tt>%s</tt></a></li>\n", name, name);
|
||||
}
|
||||
|
||||
puts("</ul>");
|
||||
|
||||
for (scut = mxmlFindElement(doc, doc, "struct", NULL, NULL,
|
||||
MXML_DESCEND_FIRST);
|
||||
scut;
|
||||
scut = mxmlFindElement(scut, doc, "struct", NULL, NULL,
|
||||
MXML_NO_DESCEND))
|
||||
{
|
||||
name = mxmlElementGetAttr(scut, "name");
|
||||
puts("<hr noshade/>");
|
||||
printf("<h2><a name=\"%s\">%s</a></h2>\n", name, name);
|
||||
|
||||
description = mxmlFindElement(scut, scut, "description", NULL,
|
||||
NULL, MXML_DESCEND_FIRST);
|
||||
if (description)
|
||||
{
|
||||
fputs("<p>", stdout);
|
||||
write_element(description);
|
||||
puts("</p>");
|
||||
}
|
||||
|
||||
puts("<h3>Definition</h3>");
|
||||
puts("<pre>");
|
||||
|
||||
printf("struct %s\n{\n", name);
|
||||
for (arg = mxmlFindElement(scut, scut, "variable", NULL, NULL,
|
||||
MXML_DESCEND_FIRST);
|
||||
arg;
|
||||
arg = mxmlFindElement(arg, scut, "variable", NULL, NULL,
|
||||
MXML_NO_DESCEND))
|
||||
{
|
||||
printf(" ");
|
||||
write_element(mxmlFindElement(arg, arg, "type", NULL,
|
||||
NULL, MXML_DESCEND_FIRST));
|
||||
printf(" %s;\n", mxmlElementGetAttr(arg, "name"));
|
||||
}
|
||||
|
||||
puts("};\n</pre>");
|
||||
|
||||
puts("<h3>Members</h3>");
|
||||
|
||||
puts("<p class=\"table\"><table align=\"center\" border=\"1\" width=\"80%\">");
|
||||
puts("<thead><tr><th>Name</th><th>Description</th></tr></thead>");
|
||||
puts("<tbody>");
|
||||
|
||||
for (arg = mxmlFindElement(scut, scut, "variable", NULL, NULL,
|
||||
MXML_DESCEND_FIRST);
|
||||
arg;
|
||||
arg = mxmlFindElement(arg, scut, "variable", NULL, NULL,
|
||||
MXML_NO_DESCEND))
|
||||
{
|
||||
printf("<tr><td><tt>%s</tt></td><td>", mxmlElementGetAttr(arg, "name"));
|
||||
|
||||
write_element(mxmlFindElement(arg, arg, "description", NULL,
|
||||
NULL, MXML_DESCEND_FIRST));
|
||||
|
||||
puts("</td></tr>");
|
||||
}
|
||||
|
||||
puts("</tbody></table></p>");
|
||||
}
|
||||
|
||||
/*
|
||||
* List of types...
|
||||
*/
|
||||
|
||||
puts("<h1><a name=\"_types\">Types</a></h1>");
|
||||
puts("<ul>");
|
||||
|
||||
for (scut = mxmlFindElement(doc, doc, "typedef", NULL, NULL,
|
||||
MXML_DESCEND_FIRST);
|
||||
scut;
|
||||
scut = mxmlFindElement(scut, doc, "typedef", NULL, NULL,
|
||||
MXML_NO_DESCEND))
|
||||
{
|
||||
name = mxmlElementGetAttr(scut, "name");
|
||||
printf("\t<li><a href=\"#%s\"><tt>%s</tt></a></li>\n", name, name);
|
||||
}
|
||||
|
||||
puts("</ul>");
|
||||
|
||||
for (scut = mxmlFindElement(doc, doc, "typedef", NULL, NULL,
|
||||
MXML_DESCEND_FIRST);
|
||||
scut;
|
||||
scut = mxmlFindElement(scut, doc, "typedef", NULL, NULL,
|
||||
MXML_NO_DESCEND))
|
||||
{
|
||||
name = mxmlElementGetAttr(scut, "name");
|
||||
puts("<hr noshade/>");
|
||||
printf("<h2><a name=\"%s\">%s</a></h2>\n", name, name);
|
||||
|
||||
description = mxmlFindElement(scut, scut, "description", NULL,
|
||||
NULL, MXML_DESCEND_FIRST);
|
||||
if (description)
|
||||
{
|
||||
fputs("<p>", stdout);
|
||||
write_element(description);
|
||||
puts("</p>");
|
||||
}
|
||||
|
||||
puts("<h3>Definition</h3>");
|
||||
puts("<pre>");
|
||||
|
||||
printf("typedef ");
|
||||
write_element(mxmlFindElement(scut, scut, "type", NULL,
|
||||
NULL, MXML_DESCEND_FIRST));
|
||||
printf(" %s;\n</pre>\n", name);
|
||||
}
|
||||
|
||||
/*
|
||||
* List of unions...
|
||||
*/
|
||||
|
||||
puts("<h1><a name=\"_unions\">Unions</a></h1>");
|
||||
puts("<ul>");
|
||||
|
||||
for (scut = mxmlFindElement(doc, doc, "union", NULL, NULL,
|
||||
MXML_DESCEND_FIRST);
|
||||
scut;
|
||||
scut = mxmlFindElement(scut, doc, "union", NULL, NULL,
|
||||
MXML_NO_DESCEND))
|
||||
{
|
||||
name = mxmlElementGetAttr(scut, "name");
|
||||
printf("\t<li><a href=\"#%s\"><tt>%s</tt></a></li>\n", name, name);
|
||||
}
|
||||
|
||||
puts("</ul>");
|
||||
|
||||
for (scut = mxmlFindElement(doc, doc, "union", NULL, NULL,
|
||||
MXML_DESCEND_FIRST);
|
||||
scut;
|
||||
scut = mxmlFindElement(scut, doc, "union", NULL, NULL,
|
||||
MXML_NO_DESCEND))
|
||||
{
|
||||
name = mxmlElementGetAttr(scut, "name");
|
||||
puts("<hr noshade/>");
|
||||
printf("<h2><a name=\"%s\">%s</a></h2>\n", name, name);
|
||||
|
||||
description = mxmlFindElement(scut, scut, "description", NULL,
|
||||
NULL, MXML_DESCEND_FIRST);
|
||||
if (description)
|
||||
{
|
||||
fputs("<p>", stdout);
|
||||
write_element(description);
|
||||
puts("</p>");
|
||||
}
|
||||
|
||||
puts("<h3>Definition</h3>");
|
||||
puts("<pre>");
|
||||
|
||||
printf("struct %s\n{\n", name);
|
||||
for (arg = mxmlFindElement(scut, scut, "variable", NULL, NULL,
|
||||
MXML_DESCEND_FIRST);
|
||||
arg;
|
||||
arg = mxmlFindElement(arg, scut, "variable", NULL, NULL,
|
||||
MXML_NO_DESCEND))
|
||||
{
|
||||
printf(" ");
|
||||
write_element(mxmlFindElement(arg, arg, "type", NULL,
|
||||
NULL, MXML_DESCEND_FIRST));
|
||||
printf(" %s;\n", mxmlElementGetAttr(arg, "name"));
|
||||
}
|
||||
|
||||
puts("};\n</pre>");
|
||||
|
||||
puts("<h3>Members</h3>");
|
||||
|
||||
puts("<p class=\"table\"><table align=\"center\" border=\"1\" width=\"80%\">");
|
||||
puts("<thead><tr><th>Name</th><th>Description</th></tr></thead>");
|
||||
puts("<tbody>");
|
||||
|
||||
for (arg = mxmlFindElement(scut, scut, "variable", NULL, NULL,
|
||||
MXML_DESCEND_FIRST);
|
||||
arg;
|
||||
arg = mxmlFindElement(arg, scut, "variable", NULL, NULL,
|
||||
MXML_NO_DESCEND))
|
||||
{
|
||||
printf("<tr><td><tt>%s</tt></td><td>", mxmlElementGetAttr(arg, "name"));
|
||||
|
||||
write_element(mxmlFindElement(arg, arg, "description", NULL,
|
||||
NULL, MXML_DESCEND_FIRST));
|
||||
|
||||
puts("</td></tr>");
|
||||
}
|
||||
|
||||
puts("</tbody></table></p>");
|
||||
}
|
||||
|
||||
/*
|
||||
* Standard footer...
|
||||
*/
|
||||
|
||||
puts("</body>");
|
||||
puts("</html>");
|
||||
|
||||
@ -1138,5 +1779,5 @@ ws_cb(mxml_node_t *node, /* I - Element node */
|
||||
|
||||
|
||||
/*
|
||||
* End of "$Id: mxmldoc.c,v 1.9 2003/06/06 03:09:31 mike Exp $".
|
||||
* End of "$Id: mxmldoc.c,v 1.10 2003/06/07 21:27:05 mike Exp $".
|
||||
*/
|
||||
|
Loading…
Reference in New Issue
Block a user