From 3c890fa2380d76d8f59a8a7616d7964940fa0241 Mon Sep 17 00:00:00 2001 From: Michael R Sweet Date: Sun, 27 Jan 2008 23:54:03 +0000 Subject: [PATCH] Scan intro file for headings, add to table-of-contents. Consistently use classes for all headings. Always use
for the body of the docs. Cleanup stylesheet to avoid stylesheet conflicts. --- doc/reference.html | 1116 ++++++++++++++++++++++---------------------- mxmldoc.c | 280 +++++++++-- 2 files changed, 800 insertions(+), 596 deletions(-) diff --git a/doc/reference.html b/doc/reference.html index ce992ef..bd87c17 100644 --- a/doc/reference.html +++ b/doc/reference.html @@ -7,34 +7,56 @@ body, p, h1, h2, h3, h4 { font-family: lucida grande, geneva, helvetica, arial, sans-serif; } -h1 { +div.body h1 { font-size: 250%; font-weight: bold; + margin: 0; } -h2 { +div.body h2 { font-size: 250%; - margin-top: 2.5em; + margin-top: 1.5em; } -h3 { +div.body h3 { font-size: 150%; margin-bottom: 0.5em; - margin-top: 2em; + margin-top: 1.5em; } -h4 { +div.body h4 { font-size: 110%; margin-bottom: 0.5em; - margin-top: 2em; + margin-top: 1.5em; } -h5 { +div.body h5 { font-size: 100%; margin-bottom: 0.5em; - margin-top: 2em; + margin-top: 1.5em; +} +div.contents { + background: #e8e8e8; + border: solid thin black; + padding: 10px; +} +div.contents h1 { + font-size: 110%; +} +div.contents h2 { + font-size: 100%; +} +div.contents ul.contents { + font-size: 80%; +} +.availability { } .class { } +.constants { +} +.description { + margin-top: 0.5em; +} .discussion { } -.enum { +.enumeration { } .function { margin-bottom: 0; @@ -53,9 +75,6 @@ h5 { } .variable { } -p.summary { - margin-top: 0.5em; -} code, p.code, pre, ul.code li { font-family: monaco, courier, monospace; font-size: 90%; @@ -76,7 +95,7 @@ h3 span.info, h4 span.info { float: right; font-size: 100%; } -ul.code, ul.contents { +ul.code, ul.contents, ul.subcontents { list-style-type: none; margin: 0; padding-left: 0; @@ -87,17 +106,17 @@ ul.code li { ul.contents > li { margin-top: 1em; } -ul.contents li ul.code { +ul.contents li ul.code, ul.contents li ul.subcontents { padding-left: 2em; } -dl { +div.body dl { margin-top: 0; } -dt { +div.body dt { font-style: italic; margin-top: 0; } -dd { +div.body dd { margin-bottom: 0.5em; } h1.title, h2.title, h3.title { @@ -106,6 +125,7 @@ h1.title, h2.title, h3.title { --> +

CLibrary Reference

@@ -113,98 +133,98 @@ Reference

Contents

Functions

mxmlAdd

-

Add a node to a tree.

+

Add a node to a tree.

void mxmlAdd (
    mxml_node_t *parent,
@@ -212,18 +232,18 @@ void mxmlAdd (
    mxml_node_t *child,
    mxml_node_t *node
);

-

Parameters

+

Parameters

parent
-
Parent node
+
Parent node
where
-
Where to add, MXML_ADD_BEFORE or MXML_ADD_AFTER
+
Where to add, MXML_ADD_BEFORE or MXML_ADD_AFTER
child
-
Child node for where or MXML_ADD_TO_PARENT
+
Child node for where or MXML_ADD_TO_PARENT
node
-
Node to add
+
Node to add
-

Discussion

+

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, @@ -231,76 +251,76 @@ 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.

+

Delete a node and all of its children.

void mxmlDelete (
    mxml_node_t *node
);

-

Parameters

+

Parameters

node
-
Node to delete
+
Node to delete
-

Discussion

+

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.

+

Delete an attribute.

void mxmlElementDeleteAttr (
    mxml_node_t *node,
    const char *name
);

-

Parameters

+

Parameters

node
-
Element
+
Element
name
-
Attribute name
+
Attribute name

mxmlElementGetAttr

-

Get an attribute.

+

Get an attribute.

const char *mxmlElementGetAttr (
    mxml_node_t *node,
    const char *name
);

-

Parameters

+

Parameters

node
-
Element node
+
Element node
name
-
Name of attribute
+
Name of attribute
-

Return Value

-

Attribute value or NULL

-

Discussion

+

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.

mxmlElementSetAttr

-

Set an attribute.

+

Set an attribute.

void mxmlElementSetAttr (
    mxml_node_t *node,
    const char *name,
    const char *value
);

-

Parameters

+

Parameters

node
-
Element node
+
Element node
name
-
Name of attribute
+
Name of attribute
value
-
Attribute value
+
Attribute value
-

Discussion

+

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.

+

Set an attribute with a formatted value.

void mxmlElementSetAttrf (
    mxml_node_t *node,
@@ -308,18 +328,18 @@ void mxmlElementSetAttrf (
    const char *format,
    ...
);

-

Parameters

+

Parameters

node
-
Element node
+
Element node
name
-
Name of attribute
+
Name of attribute
format
-
Printf-style attribute value
+
Printf-style attribute value
...
-
Additional arguments as needed
+
Additional arguments as needed
-

Discussion

+

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 @@ -327,48 +347,48 @@ is not an element.

mxmlEntityAddCallback

-

Add a callback to convert entities to Unicode.

+

Add a callback to convert entities to Unicode.

int mxmlEntityAddCallback (void);

-

Return Value

-

0 on success, -1 on failure

+

Return Value

+

0 on success, -1 on failure

mxmlEntityGetName

-

Get the name that corresponds to the character value.

+

Get the name that corresponds to the character value.

const char *mxmlEntityGetName (
    int val
);

-

Parameters

+

Parameters

val
-
Character value
+
Character value
-

Return Value

-

Entity name or NULL

-

Discussion

+

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.

+

Get the character corresponding to a named entity.

int mxmlEntityGetValue (
    const char *name
);

-

Parameters

+

Parameters

name
-
Entity name
+
Entity name
-

Return Value

-

Character value or -1 on error

-

Discussion

+

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.

+

Remove a callback.

void mxmlEntityRemoveCallback (void);

mxmlFindElement

-

Find the named element.

+

Find the named element.

mxml_node_t *mxmlFindElement (
    mxml_node_t *node,
@@ -378,24 +398,24 @@ void mxmlEntityRemoveCallback (void);

    const char *value,
    int descend
);

-

Parameters

+

Parameters

node
-
Current node
+
Current node
top
-
Top node
+
Top node
name
-
Element name or NULL for any
+
Element name or NULL for any
attr
-
Attribute name, or NULL for none
+
Attribute name, or NULL for none
value
-
Attribute value, or NULL for any
+
Attribute value, or NULL for any
descend
-
Descend into tree - MXML_DESCEND, MXML_NO_DESCEND, or MXML_DESCEND_FIRST
+
Descend into tree - MXML_DESCEND, MXML_NO_DESCEND, or MXML_DESCEND_FIRST
-

Return Value

-

Element node or NULL

-

Discussion

+

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 @@ -405,117 +425,117 @@ 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.

mxmlIndexDelete

-

Delete an index.

+

Delete an index.

void mxmlIndexDelete (
    mxml_index_t *ind
);

-

Parameters

+

Parameters

ind
-
Index to delete
+
Index to delete

mxmlIndexEnum

-

Return the next node in the index.

+

Return the next node in the index.

mxml_node_t *mxmlIndexEnum (
    mxml_index_t *ind
);

-

Parameters

+

Parameters

ind
-
Index to enumerate
+
Index to enumerate
-

Return Value

-

Next node or NULL if there is none

-

Discussion

+

Return Value

+

Next node or NULL if there is none

+

Discussion

Nodes are returned in the sorted order of the index.

mxmlIndexFind

-

Find the next matching node.

+

Find the next matching node.

mxml_node_t *mxmlIndexFind (
    mxml_index_t *ind,
    const char *element,
    const char *value
);

-

Parameters

+

Parameters

ind
-
Index to search
+
Index to search
element
-
Element name to find, if any
+
Element name to find, if any
value
-
Attribute value, if any
+
Attribute value, if any
-

Return Value

-

Node or NULL if none found

-

Discussion

+

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().

mxmlIndexNew

-

Create a new index.

+

Create a new index.

mxml_index_t *mxmlIndexNew (
    mxml_node_t *node,
    const char *element,
    const char *attr
);

-

Parameters

+

Parameters

node
-
XML node tree
+
XML node tree
element
-
Element to index or NULL for all
+
Element to index or NULL for all
attr
-
Attribute to index or NULL for none
+
Attribute to index or NULL for none
-

Return Value

-

New index

-

Discussion

+

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 +

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

mxml_node_t *mxmlIndexReset (
    mxml_index_t *ind
);

-

Parameters

+

Parameters

ind
-
Index to reset
+
Index to reset
-

Return Value

-

First node or NULL if there is none

-

Discussion

+

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.

+

Load a file descriptor into an XML node tree.

mxml_node_t *mxmlLoadFd (
    mxml_node_t *top,
    int fd,
    mxml_load_cb_t cb
);

-

Parameters

+

Parameters

top
-
Top node
+
Top node
fd
-
File descriptor to read from
+
File descriptor to read from
cb
-
Callback function or MXML_NO_CALLBACK
+
Callback function or MXML_NO_CALLBACK
-

Return Value

-

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

-

Discussion

+

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 @@ -527,25 +547,25 @@ 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.

mxmlLoadFile

-

Load a file into an XML node tree.

+

Load a file into an XML node tree.

mxml_node_t *mxmlLoadFile (
    mxml_node_t *top,
    FILE *fp,
    mxml_load_cb_t cb
);

-

Parameters

+

Parameters

top
-
Top node
+
Top node
fp
-
File to read from
+
File to read from
cb
-
Callback function or MXML_NO_CALLBACK
+
Callback function or MXML_NO_CALLBACK
-

Return Value

-

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

-

Discussion

+

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 @@ -557,25 +577,25 @@ 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.

mxmlLoadString

-

Load a string into an XML node tree.

+

Load a string into an XML node tree.

mxml_node_t *mxmlLoadString (
    mxml_node_t *top,
    const char *s,
    mxml_load_cb_t cb
);

-

Parameters

+

Parameters

top
-
Top node
+
Top node
s
-
String to load
+
String to load
cb
-
Callback function or MXML_NO_CALLBACK
+
Callback function or MXML_NO_CALLBACK
-

Return Value

-

First node or NULL if the string has errors.

-

Discussion

+

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 @@ -587,22 +607,22 @@ 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.

 Mini-XML 2.3 mxmlNewCDATA

-

Create a new CDATA node.

+

Create a new CDATA node.

mxml_node_t *mxmlNewCDATA (
    mxml_node_t *parent,
    const char *data
);

-

Parameters

+

Parameters

parent
-
Parent node or MXML_NO_PARENT
+
Parent node or MXML_NO_PARENT
data
-
Data string
+
Data string
-

Return Value

-

New node

-

Discussion

+

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 @@ -610,25 +630,25 @@ is copied into the new node. CDATA nodes use the MXML_ELEMENT type.

 Mini-XML 2.1 mxmlNewCustom

-

Create a new custom data node.

+

Create a new custom data node.

mxml_node_t *mxmlNewCustom (
    mxml_node_t *parent,
    void *data,
    mxml_custom_destroy_cb_t destroy
);

-

Parameters

+

Parameters

parent
-
Parent node or MXML_NO_PARENT
+
Parent node or MXML_NO_PARENT
data
-
Pointer to data
+
Pointer to data
destroy
-
Function to destroy data
+
Function to destroy data
-

Return Value

-

New node

-

Discussion

+

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 @@ -636,113 +656,113 @@ node is not dynamically allocated or is separately managed.

mxmlNewElement

-

Create a new element node.

+

Create a new element node.

mxml_node_t *mxmlNewElement (
    mxml_node_t *parent,
    const char *name
);

-

Parameters

+

Parameters

parent
-
Parent node or MXML_NO_PARENT
+
Parent node or MXML_NO_PARENT
name
-
Name of element
+
Name of element
-

Return Value

-

New node

-

Discussion

+

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.

+

Create a new integer node.

mxml_node_t *mxmlNewInteger (
    mxml_node_t *parent,
    int integer
);

-

Parameters

+

Parameters

parent
-
Parent node or MXML_NO_PARENT
+
Parent node or MXML_NO_PARENT
integer
-
Integer value
+
Integer value
-

Return Value

-

New node

-

Discussion

+

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.

+

Create a new opaque string.

mxml_node_t *mxmlNewOpaque (
    mxml_node_t *parent,
    const char *opaque
);

-

Parameters

+

Parameters

parent
-
Parent node or MXML_NO_PARENT
+
Parent node or MXML_NO_PARENT
opaque
-
Opaque string
+
Opaque string
-

Return Value

-

New node

-

Discussion

+

Return Value

+

New node

+

Discussion

The new opaque 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 node has no parent. The opaque string must be nul-terminated and is copied into the new node.

mxmlNewReal

-

Create a new real number node.

+

Create a new real number node.

mxml_node_t *mxmlNewReal (
    mxml_node_t *parent,
    double real
);

-

Parameters

+

Parameters

parent
-
Parent node or MXML_NO_PARENT
+
Parent node or MXML_NO_PARENT
real
-
Real number value
+
Real number value
-

Return Value

-

New node

-

Discussion

+

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.

+

Create a new text fragment node.

mxml_node_t *mxmlNewText (
    mxml_node_t *parent,
    int whitespace,
    const char *string
);

-

Parameters

+

Parameters

parent
-
Parent node or MXML_NO_PARENT
+
Parent node or MXML_NO_PARENT
whitespace
-
1 = leading whitespace, 0 = no whitespace
+
1 = leading whitespace, 0 = no whitespace
string
-
String
+
String
-

Return Value

-

New node

-

Discussion

+

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.

+

Create a new formatted text fragment node.

mxml_node_t *mxmlNewTextf (
    mxml_node_t *parent,
@@ -750,90 +770,90 @@ string must be nul-terminated and is copied into the new node.

    const char *format,
    ...
);

-

Parameters

+

Parameters

parent
-
Parent node or MXML_NO_PARENT
+
Parent node or MXML_NO_PARENT
whitespace
-
1 = leading whitespace, 0 = no whitespace
+
1 = leading whitespace, 0 = no whitespace
format
-
Printf-style frmat string
+
Printf-style frmat string
...
-
Additional args as needed
+
Additional args as needed
-

Return Value

-

New node

-

Discussion

+

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.

+

Create a new XML document tree.

mxml_node_t *mxmlNewXML (
    const char *version
);

-

Parameters

+

Parameters

version
-
Version number to use
+
Version number to use
-

Return Value

-

New ?xml node

-

Discussion

+

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.

+

Release a node.

int mxmlRelease (
    mxml_node_t *node
);

-

Parameters

+

Parameters

node
-
Node
+
Node
-

Return Value

-

New reference count

-

Discussion

+

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.

+

Remove a node from its parent.

void mxmlRemove (
    mxml_node_t *node
);

-

Parameters

+

Parameters

node
-
Node to remove
+
Node to remove
-

Discussion

+

Discussion

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.

+

Retain a node.

int mxmlRetain (
    mxml_node_t *node
);

-

Parameters

+

Parameters

node
-
Node
+
Node
-

Return Value

-

New reference count

+

Return Value

+

New reference count

 Mini-XML 2.3 mxmlSAXLoadFd

-

Load a file descriptor into an XML node tree +

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

mxml_node_t *mxmlSAXLoadFd (
@@ -843,22 +863,22 @@ using a SAX callback.

    mxml_sax_cb_t sax_cb,
    void *sax_data
);

-

Parameters

+

Parameters

top
-
Top node
+
Top node
fd
-
File descriptor to read from
+
File descriptor to read from
cb
-
Callback function or MXML_NO_CALLBACK
+
Callback function or MXML_NO_CALLBACK
sax_cb
-
SAX callback or MXML_NO_CALLBACK
+
SAX callback or MXML_NO_CALLBACK
sax_data
-
SAX user data
+
SAX user data
-

Return Value

-

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

-

Discussion

+

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 @@ -876,7 +896,7 @@ 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 +

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

mxml_node_t *mxmlSAXLoadFile (
@@ -886,22 +906,22 @@ using a SAX callback.

    mxml_sax_cb_t sax_cb,
    void *sax_data
);

-

Parameters

+

Parameters

top
-
Top node
+
Top node
fp
-
File to read from
+
File to read from
cb
-
Callback function or MXML_NO_CALLBACK
+
Callback function or MXML_NO_CALLBACK
sax_cb
-
SAX callback or MXML_NO_CALLBACK
+
SAX callback or MXML_NO_CALLBACK
sax_data
-
SAX user data
+
SAX user data
-

Return Value

-

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

-

Discussion

+

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 @@ -919,7 +939,7 @@ 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 +

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

mxml_node_t *mxmlSAXLoadString (
@@ -929,22 +949,22 @@ using a SAX callback.

    mxml_sax_cb_t sax_cb,
    void *sax_data
);

-

Parameters

+

Parameters

top
-
Top node
+
Top node
s
-
String to load
+
String to load
cb
-
Callback function or MXML_NO_CALLBACK
+
Callback function or MXML_NO_CALLBACK
sax_cb
-
SAX callback or MXML_NO_CALLBACK
+
SAX callback or MXML_NO_CALLBACK
sax_data
-
SAX user data
+
SAX user data
-

Return Value

-

First node or NULL if the string has errors.

-

Discussion

+

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 @@ -962,22 +982,22 @@ node is closed or after each data, comment, CDATA, or directive node.

mxmlSaveAllocString

-

Save an XML node tree to an allocated string.

+

Save an XML node tree to an allocated string.

char *mxmlSaveAllocString (
    mxml_node_t *node,
    mxml_save_cb_t cb
);

-

Parameters

+

Parameters

node
-
Node to write
+
Node to write
cb
-
Whitespace callback or MXML_NO_CALLBACK
+
Whitespace callback or MXML_NO_CALLBACK
-

Return Value

-

Allocated string or NULL

-

Discussion

+

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 @@ -990,57 +1010,57 @@ 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.

+

Save an XML tree to a file descriptor.

int mxmlSaveFd (
    mxml_node_t *node,
    int fd,
    mxml_save_cb_t cb
);

-

Parameters

+

Parameters

node
-
Node to write
+
Node to write
fd
-
File descriptor to write to
+
File descriptor to write to
cb
-
Whitespace callback or MXML_NO_CALLBACK
+
Whitespace callback or MXML_NO_CALLBACK
-

Return Value

-

0 on success, -1 on error.

-

Discussion

+

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.

+

Save an XML tree to a file.

int mxmlSaveFile (
    mxml_node_t *node,
    FILE *fp,
    mxml_save_cb_t cb
);

-

Parameters

+

Parameters

node
-
Node to write
+
Node to write
fp
-
File to write to
+
File to write to
cb
-
Whitespace callback or MXML_NO_CALLBACK
+
Whitespace callback or MXML_NO_CALLBACK
-

Return Value

-

0 on success, -1 on error.

-

Discussion

+

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.

+

Save an XML node tree to a string.

int mxmlSaveString (
    mxml_node_t *node,
@@ -1048,20 +1068,20 @@ int mxmlSaveString (
    int bufsize,
    mxml_save_cb_t cb
);

-

Parameters

+

Parameters

node
-
Node to write
+
Node to write
buffer
-
String buffer
+
String buffer
bufsize
-
Size of string buffer
+
Size of string buffer
cb
-
Whitespace callback or MXML_NO_CALLBACK
+
Whitespace callback or MXML_NO_CALLBACK
-

Return Value

-

Size of string

-

Discussion

+

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.
@@ -1072,174 +1092,174 @@ 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.

+

Set the element name of a CDATA node.

int mxmlSetCDATA (
    mxml_node_t *node,
    const char *data
);

-

Parameters

+

Parameters

node
-
Node to set
+
Node to set
data
-
New data string
+
New data string
-

Return Value

-

0 on success, -1 on failure

-

Discussion

+

Return Value

+

0 on success, -1 on failure

+

Discussion

The node is not changed if it is not a CDATA element node.

 Mini-XML 2.1 mxmlSetCustom

-

Set the data and destructor of a custom data node.

+

Set the data and destructor of a custom data node.

int mxmlSetCustom (
    mxml_node_t *node,
    void *data,
    mxml_custom_destroy_cb_t destroy
);

-

Parameters

+

Parameters

node
-
Node to set
+
Node to set
data
-
New data pointer
+
New data pointer
destroy
-
New destructor function
+
New destructor function
-

Return Value

-

0 on success, -1 on failure

-

Discussion

+

Return Value

+

0 on success, -1 on failure

+

Discussion

The node is not changed if it is not a custom node.

mxmlSetCustomHandlers

-

Set the handling functions for custom data.

+

Set the handling functions for custom data.

void mxmlSetCustomHandlers (
    mxml_custom_load_cb_t load,
    mxml_custom_save_cb_t save
);

-

Parameters

+

Parameters

load
-
Load function
+
Load function
save
-
Save function
+
Save function
-

Discussion

+

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.

+

Set the name of an element node.

int mxmlSetElement (
    mxml_node_t *node,
    const char *name
);

-

Parameters

+

Parameters

node
-
Node to set
+
Node to set
name
-
New name string
+
New name string
-

Return Value

-

0 on success, -1 on failure

-

Discussion

+

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.

+

Set the error message callback.

void mxmlSetErrorCallback (
    mxml_error_cb_t cb
);

-

Parameters

+

Parameters

cb
-
Error callback function
+
Error callback function

mxmlSetInteger

-

Set the value of an integer node.

+

Set the value of an integer node.

int mxmlSetInteger (
    mxml_node_t *node,
    int integer
);

-

Parameters

+

Parameters

node
-
Node to set
+
Node to set
integer
-
Integer value
+
Integer value
-

Return Value

-

0 on success, -1 on failure

-

Discussion

+

Return Value

+

0 on success, -1 on failure

+

Discussion

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

mxmlSetOpaque

-

Set the value of an opaque node.

+

Set the value of an opaque node.

int mxmlSetOpaque (
    mxml_node_t *node,
    const char *opaque
);

-

Parameters

+

Parameters

node
-
Node to set
+
Node to set
opaque
-
Opaque string
+
Opaque string
-

Return Value

-

0 on success, -1 on failure

-

Discussion

+

Return Value

+

0 on success, -1 on failure

+

Discussion

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

mxmlSetReal

-

Set the value of a real number node.

+

Set the value of a real number node.

int mxmlSetReal (
    mxml_node_t *node,
    double real
);

-

Parameters

+

Parameters

node
-
Node to set
+
Node to set
real
-
Real number value
+
Real number value
-

Return Value

-

0 on success, -1 on failure

-

Discussion

+

Return Value

+

0 on success, -1 on failure

+

Discussion

The node is not changed if it is not a real number node.

mxmlSetText

-

Set the value of a text node.

+

Set the value of a text node.

int mxmlSetText (
    mxml_node_t *node,
    int whitespace,
    const char *string
);

-

Parameters

+

Parameters

node
-
Node to set
+
Node to set
whitespace
-
1 = leading whitespace, 0 = no whitespace
+
1 = leading whitespace, 0 = no whitespace
string
-
String
+
String
-

Return Value

-

0 on success, -1 on failure

-

Discussion

+

Return Value

+

0 on success, -1 on failure

+

Discussion

The node is not changed if it is not a text node.

mxmlSetTextf

-

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

+

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

int mxmlSetTextf (
    mxml_node_t *node,
@@ -1247,218 +1267,203 @@ int mxmlSetTextf (
    const char *format,
    ...
);

-

Parameters

+

Parameters

node
-
Node to set
+
Node to set
whitespace
-
1 = leading whitespace, 0 = no whitespace
+
1 = leading whitespace, 0 = no whitespace
format
-
Printf-style format string
+
Printf-style format string
...
-
Additional arguments as needed
+
Additional arguments as needed
-

Return Value

-

0 on success, -1 on failure

-

Discussion

+

Return Value

+

0 on success, -1 on failure

+

Discussion

The node is not changed if it is not a text node.

 Mini-XML 2.3 mxmlSetWrapMargin

-

Set the the wrap margin when saving XML data.

+

Set the the wrap margin when saving XML data.

void mxmlSetWrapMargin (
    int column
);

-

Parameters

+

Parameters

column
-
Column for wrapping
+
Column for wrapping
-

Discussion

+

Discussion

Wrapping is disabled when "column" is <= 0.

mxmlWalkNext

-

Walk to the next logical node in the tree.

+

Walk to the next logical node in the tree.

mxml_node_t *mxmlWalkNext (
    mxml_node_t *node,
    mxml_node_t *top,
    int descend
);

-

Parameters

+

Parameters

node
-
Current node
+
Current node
top
-
Top node
+
Top node
descend
-
Descend into tree - MXML_DESCEND, MXML_NO_DESCEND, or MXML_DESCEND_FIRST
+
Descend into tree - MXML_DESCEND, MXML_NO_DESCEND, or MXML_DESCEND_FIRST
-

Return Value

-

Next node or NULL

-

Discussion

+

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.

+

Walk to the previous logical node in the tree.

mxml_node_t *mxmlWalkPrev (
    mxml_node_t *node,
    mxml_node_t *top,
    int descend
);

-

Parameters

+

Parameters

node
-
Current node
+
Current node
top
-
Top node
+
Top node
descend
-
Descend into tree - MXML_DESCEND, MXML_NO_DESCEND, or MXML_DESCEND_FIRST
+
Descend into tree - MXML_DESCEND, MXML_NO_DESCEND, or MXML_DESCEND_FIRST
-

Return Value

-

Previous node or NULL

-

Discussion

+

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_attr_t

-

An XML element attribute value.

+

mxml_attr_t

+

An XML element attribute value.

typedef struct mxml_attr_s mxml_attr_t;

- -

mxml_custom_destroy_cb_t

-

Custom data destructor

+

mxml_custom_destroy_cb_t

+

Custom data destructor

typedef void (*mxml_custom_destroy_cb_t)(void *);

- -

mxml_custom_load_cb_t

-

Custom data load callback function

+

mxml_custom_load_cb_t

+

Custom data load callback function

typedef int (*mxml_custom_load_cb_t)(mxml_node_t *, const char *);

- -

mxml_custom_save_cb_t

-

Custom data save callback function

+

mxml_custom_save_cb_t

+

Custom data save callback function

typedef char *(*mxml_custom_save_cb_t)(mxml_node_t *);

- -

 Mini-XML 2.1 mxml_custom_t

-

An XML custom value.

+

 Mini-XML 2.1 mxml_custom_t

+

An XML custom value.

typedef struct mxml_custom_s mxml_custom_t;

- -

mxml_element_t

-

An XML element value.

+

mxml_element_t

+

An XML element value.

typedef struct mxml_element_s mxml_element_t;

- -

mxml_error_cb_t

-

Error callback function

+

mxml_error_cb_t

+

Error callback function

typedef void (*mxml_error_cb_t)(const char *);

- -

mxml_index_t

-

An XML node index.

+

mxml_index_t

+

An XML node index.

typedef struct mxml_index_s mxml_index_t;

- -

mxml_load_cb_t

-

Load callback function

+

mxml_load_cb_t

+

Load callback function

typedef mxml_type_t (*mxml_load_cb_t)(mxml_node_t *);

- -

mxml_node_t

-

An XML node.

+

mxml_node_t

+

An XML node.

typedef struct mxml_node_s mxml_node_t;

- -

mxml_save_cb_t

-

Save callback function

+

mxml_save_cb_t

+

Save callback function

typedef const char *(*mxml_save_cb_t)(mxml_node_t *, int);

- -

mxml_sax_cb_t

-

SAX callback function

+

mxml_sax_cb_t

+

SAX callback function

typedef void (*mxml_sax_cb_t)(mxml_node_t *, mxml_sax_event_t, void *);

- -

mxml_sax_event_t

-

SAX event type.

+

mxml_sax_event_t

+

SAX event type.

typedef enum mxml_sax_event_e mxml_sax_event_t;

- -

mxml_text_t

-

An XML text value.

+

mxml_text_t

+

An XML text value.

typedef struct mxml_text_s mxml_text_t;

- -

mxml_value_t

-

An XML node value.

+

mxml_value_t

+

An XML node value.

typedef union mxml_value_u mxml_value_t;

Structures

-

mxml_attr_s

-

An XML element attribute value.

+

mxml_attr_s

+

An XML element attribute value.

struct mxml_attr_s {
    char *name;
    char *value;
};

-

Members

+

Members

name
-
Attribute name
+
Attribute name
value
-
Attribute value
+
Attribute value
-

 Mini-XML 2.1 mxml_custom_s

-

An XML custom value.

+

 Mini-XML 2.1 mxml_custom_s

+

An XML custom value.

struct mxml_custom_s {
    void *data;
    mxml_custom_destroy_cb_t destroy;
};

-

Members

+

Members

data
-
Pointer to (allocated) custom data
+
Pointer to (allocated) custom data
destroy
-
Pointer to destructor function
+
Pointer to destructor function
-

mxml_element_s

-

An XML element value.

+

mxml_element_s

+

An XML element value.

struct mxml_element_s {
    mxml_attr_t *attrs;
    char *name;
    int num_attrs;
};

-

Members

+

Members

attrs
-
Attributes
+
Attributes
name
-
Name of element
+
Name of element
num_attrs
-
Number of attributes
+
Number of attributes
-

mxml_index_s

-

An XML node index.

+

mxml_index_s

+

An XML node index.

struct mxml_index_s {
    int alloc_nodes;
    char *attr;
@@ -1466,21 +1471,21 @@ typedef union mxml_value_u mxml_value_t;     mxml_node_t **nodes;
    int num_nodes;
};

-

Members

+

Members

alloc_nodes
-
Allocated nodes in index
+
Allocated nodes in index
attr
-
Attribute used for indexing or NULL
+
Attribute used for indexing or NULL
cur_node
-
Current node
+
Current node
nodes
-
Node array
+
Node array
num_nodes
-
Number of nodes in index
+
Number of nodes in index
-

mxml_node_s

-

An XML node.

+

mxml_node_s

+

An XML node.

struct mxml_node_s {
    struct mxml_node_s *child;
    struct mxml_node_s *last_child;
@@ -1492,43 +1497,43 @@ typedef union mxml_value_u mxml_value_t;     void *user_data;
    mxml_value_t value;
};

-

Members

+

Members

child
-
First child node
+
First child node
last_child
-
Last child node
+
Last child node
next
-
Next node under same parent
+
Next node under same parent
parent
-
Parent node
+
Parent node
prev
-
Previous node under same parent
+
Previous node under same parent
ref_count
-
Use count
+
Use count
type
-
Node type
+
Node type
user_data
-
User data
+
User data
value
-
Node value
+
Node value
-

mxml_text_s

-

An XML text value.

+

mxml_text_s

+

An XML text value.

struct mxml_text_s {
    char *string;
    int whitespace;
};

-

Members

+

Members

string
-
Fragment string
+
Fragment string
whitespace
-
Leading whitespace?
+
Leading whitespace?

Unions

-

mxml_value_u

-

An XML node value.

+

mxml_value_u

+

An XML node value.

union mxml_value_u {
    mxml_custom_t custom;
    mxml_element_t element;
@@ -1537,57 +1542,58 @@ typedef union mxml_value_u mxml_value_t;     double real;
    mxml_text_t text;
};

-

Members

+

Members

custom  Mini-XML 2.1 
-
Custom data
+
Custom data
element
-
Element
+
Element
integer
-
Integer number
+
Integer number
opaque
-
Opaque string
+
Opaque string
real
-
Real number
+
Real number
text
-
Text fragment
+
Text fragment

Constants

-

mxml_sax_event_e

-

SAX event type.

-

Constants

+

mxml_sax_event_e

+

SAX event type.

+

Constants

MXML_SAX_CDATA
-
CDATA node
+
CDATA node
MXML_SAX_COMMENT
-
Comment node
+
Comment node
MXML_SAX_DATA
-
Data node
+
Data node
MXML_SAX_DIRECTIVE
-
Processing directive node
+
Processing directive node
MXML_SAX_ELEMENT_CLOSE
-
Element closed
+
Element closed
MXML_SAX_ELEMENT_OPEN
-
Element opened
+
Element opened
-

mxml_type_e

-

The XML node type.

-

Constants

+

mxml_type_e

+

The XML node type.

+

Constants

MXML_CUSTOM  Mini-XML 2.1 
-
Custom data
+
Custom data
MXML_ELEMENT
-
XML element with attributes
+
XML element with attributes
MXML_IGNORE  Mini-XML 2.3 
-
Ignore/throw away node
+
Ignore/throw away node
MXML_INTEGER
-
Integer value
+
Integer value
MXML_OPAQUE
-
Opaque string
+
Opaque string
MXML_REAL
-
Real value
+
Real value
MXML_TEXT
-
Text fragment
+
Text fragment
+
diff --git a/mxmldoc.c b/mxmldoc.c index fc2df46..a94be07 100644 --- a/mxmldoc.c +++ b/mxmldoc.c @@ -2507,7 +2507,7 @@ write_description( if (element && *element) fprintf(out, "<%s class=\"%s\">", element, - summary ? "summary" : "discussion"); + summary ? "description" : "discussion"); for (col = 0; *ptr; ptr ++) { @@ -2777,7 +2777,7 @@ write_function(FILE *out, /* I - Output file */ { fprintf(out, "
\n);

\n" - "Parameters\n" + "Parameters\n" "
\n", level + 1, level + 1); for (arg = mxmlFindElement(function, function, "argument", NULL, NULL, @@ -2803,7 +2803,8 @@ write_function(FILE *out, /* I - Output file */ if (arg) { - fprintf(out, "Return Value\n", level + 1, level + 1); + fprintf(out, "Return Value\n", level + 1, + level + 1); adesc = mxmlFindElement(arg, arg, "description", NULL, NULL, MXML_DESCEND_FIRST); @@ -2823,7 +2824,8 @@ write_function(FILE *out, /* I - Output file */ if (node) { - fprintf(out, "Discussion\n", level + 1, level + 1); + fprintf(out, "Discussion\n", level + 1, + level + 1); write_description(out, description, "p", 0); } } @@ -2914,7 +2916,8 @@ write_html(const char *section, /* I - Section */ snprintf(filename, sizeof(filename), "%s-body.html", basename); fputs("
\n", out); - fprintf(out, "

", filename); + fprintf(out, "

", + filename); write_string(out, title, OUTPUT_HTML); fputs("

\n", out); @@ -2947,8 +2950,7 @@ write_html(const char *section, /* I - Section */ write_html_head(out, section, title, cssfile); - if (framefile) - fputs("
\n", out); + fputs("
\n", out); /* * Header... @@ -2968,7 +2970,7 @@ write_html(const char *section, /* I - Section */ * Use standard header... */ - fputs("

", out); + fputs("

", out); write_string(out, title, OUTPUT_HTML); fputs("

\n", out); } @@ -3032,9 +3034,7 @@ write_html(const char *section, /* I - Section */ name = mxmlElementGetAttr(scut, "name"); description = mxmlFindElement(scut, scut, "description", NULL, NULL, MXML_DESCEND_FIRST); - fprintf(out, - "\n" - "

%s%s

\n", + fprintf(out, "

%s%s

\n", get_comment_info(description), name, name); if (description) @@ -3136,7 +3136,8 @@ write_html(const char *section, /* I - Section */ if ((scut = find_public(doc, doc, "struct")) != NULL) { - fputs("

Structures

\n", out); + fputs("

Structures

\n", + out); while (scut) { @@ -3168,14 +3169,15 @@ write_html(const char *section, /* I - Section */ if ((arg = find_public(doc, doc, "variable")) != NULL) { - fputs("

Variables

\n", out); + fputs("

Variables

\n", + out); while (arg) { name = mxmlElementGetAttr(arg, "name"); description = mxmlFindElement(arg, arg, "description", NULL, NULL, MXML_DESCEND_FIRST); - fprintf(out, "

%s%s

\n", + fprintf(out, "

%s%s

\n", get_comment_info(description), name, name); if (description) @@ -3201,20 +3203,21 @@ write_html(const char *section, /* I - Section */ if ((scut = find_public(doc, doc, "enumeration")) != NULL) { - fputs("

Constants

\n", out); + fputs("

Constants

\n", + out); while (scut) { name = mxmlElementGetAttr(scut, "name"); description = mxmlFindElement(scut, scut, "description", NULL, NULL, MXML_DESCEND_FIRST); - fprintf(out, "

%s%s

\n", + fprintf(out, "

%s%s

\n", get_comment_info(description), name, name); if (description) write_description(out, description, "p", 1); - fputs("

Constants

\n" + fputs("

Constants

\n" "
\n", out); for (arg = mxmlFindElement(scut, scut, "constant", NULL, NULL, @@ -3251,10 +3254,8 @@ write_html(const char *section, /* I - Section */ write_file(out, footerfile); } - if (framefile) - fputs("
\n", out); - - fputs("\n" + fputs("
\n" + "\n" "\n", out); } @@ -3304,26 +3305,26 @@ write_html_head(FILE *out, /* I - Output file */ fputs("body, p, h1, h2, h3, h4 {\n" " font-family: lucida grande, geneva, helvetica, arial, sans-serif;\n" "}\n" - "h1 {\n" + "div.body h1 {\n" " font-size: 250%;\n" " font-weight: bold;\n" " margin: 0;\n" "}\n" - "h2 {\n" + "div.body h2 {\n" " font-size: 250%;\n" " margin-top: 1.5em;\n" "}\n" - "h3 {\n" + "div.body h3 {\n" " font-size: 150%;\n" " margin-bottom: 0.5em;\n" " margin-top: 1.5em;\n" "}\n" - "h4 {\n" + "div.body h4 {\n" " font-size: 110%;\n" " margin-bottom: 0.5em;\n" " margin-top: 1.5em;\n" "}\n" - "h5 {\n" + "div.body h5 {\n" " font-size: 100%;\n" " margin-bottom: 0.5em;\n" " margin-top: 1.5em;\n" @@ -3342,11 +3343,18 @@ write_html_head(FILE *out, /* I - Output file */ "div.contents ul.contents {\n" " font-size: 80%;\n" "}\n" + ".availability {\n" + "}\n" ".class {\n" "}\n" + ".constants {\n" + "}\n" + ".description {\n" + " margin-top: 0.5em;\n" + "}\n" ".discussion {\n" "}\n" - ".enum {\n" + ".enumeration {\n" "}\n" ".function {\n" " margin-bottom: 0;\n" @@ -3365,9 +3373,6 @@ write_html_head(FILE *out, /* I - Output file */ "}\n" ".variable {\n" "}\n" - "p.summary {\n" - " margin-top: 0.5em;\n" - "}\n" "code, p.code, pre, ul.code li {\n" " font-family: monaco, courier, monospace;\n" " font-size: 90%;\n" @@ -3388,7 +3393,7 @@ write_html_head(FILE *out, /* I - Output file */ " float: right;\n" " font-size: 100%;\n" "}\n" - "ul.code, ul.contents {\n" + "ul.code, ul.contents, ul.subcontents {\n" " list-style-type: none;\n" " margin: 0;\n" " padding-left: 0;\n" @@ -3399,17 +3404,17 @@ write_html_head(FILE *out, /* I - Output file */ "ul.contents > li {\n" " margin-top: 1em;\n" "}\n" - "ul.contents li ul.code {\n" + "ul.contents li ul.code, ul.contents li ul.subcontents {\n" " padding-left: 2em;\n" "}\n" - "dl {\n" + "div.body dl {\n" " margin-top: 0;\n" "}\n" - "dt {\n" + "div.body dt {\n" " font-style: italic;\n" " margin-top: 0;\n" "}\n" - "dd {\n" + "div.body dd {\n" " margin-bottom: 0.5em;\n" "}\n" "h1.title, h2.title, h3.title {\n" @@ -3967,8 +3972,9 @@ write_scu(FILE *out, /* I - Output file */ description = mxmlFindElement(scut, scut, "description", NULL, NULL, MXML_DESCEND_FIRST); - fprintf(out, "

%s%s

\n", - get_comment_info(description), cname, cname); + fprintf(out, "

%s%s

\n", + scut->value.element.name, get_comment_info(description), cname, + cname); if (description) write_description(out, description, "p", 1); @@ -4070,7 +4076,7 @@ write_scu(FILE *out, /* I - Output file */ } fputs("};

\n" - "

Members

\n" + "

Members

\n" "
\n", out); for (arg = mxmlFindElement(scut, scut, "variable", NULL, NULL, @@ -4187,10 +4193,7 @@ write_toc(FILE *out, /* I - Output file */ const char *introfile, /* I - Introduction file */ const char *target) /* I - Target name */ { -#if 0 FILE *fp; /* Intro file */ - char line[8192]; /* Line from file */ -#endif /* 0 */ mxml_node_t *function, /* Current function */ *scut, /* Struct/class/union/typedef */ *arg, /* Current argument */ @@ -4199,14 +4202,181 @@ write_toc(FILE *out, /* I - Output file */ *targetattr; /* Target attribute, if any */ + /* + * If target is set, it is the frame file that contains the body. + * Otherwise, we are creating a single-file... + */ + if (target) targetattr = " target=\"body\""; else targetattr = ""; + /* + * The table-of-contents is a nested unordered list. Start by + * reading any intro file to see if there are any headings there. + */ + fputs("

Contents

\n" "
    \n", out); + if (introfile && (fp = fopen(introfile, "r")) != NULL) + { + char line[8192], /* Line from file */ + *ptr, /* Pointer in line */ + *end, /* End of line */ + *anchor, /* Anchor name */ + quote, /* Quote character for value */ + level = '2', /* Current heading level */ + newlevel; /* New heading level */ + int inelement; /* In an element? */ + + + while (fgets(line, sizeof(line), fp)) + { + /* + * See if this line has a heading... + */ + + if ((ptr = strstr(line, "') + inelement = 0; + + *ptr++ = '\0'; + } + + /* + * Write text until we see ""... + */ + + if (newlevel < level) + fputs("\n" + "
\n", out); + else if (newlevel > level) + fputs("\n", out); + + fclose(fp); + } + + /* + * Next the classes... + */ + if ((scut = find_public(doc, doc, "class")) != NULL) { fprintf(out, "
  • Classes" @@ -4230,6 +4400,10 @@ write_toc(FILE *out, /* I - Output file */ fputs("
  • \n", out); } + /* + * Functions... + */ + if ((function = find_public(doc, doc, "function")) != NULL) { fprintf(out, "
  • Functions" @@ -4252,6 +4426,10 @@ write_toc(FILE *out, /* I - Output file */ fputs("\n", out); } + /* + * Data types... + */ + if ((scut = find_public(doc, doc, "typedef")) != NULL) { fprintf(out, "
  • Data Types" @@ -4274,6 +4452,10 @@ write_toc(FILE *out, /* I - Output file */ fputs("
  • \n", out); } + /* + * Structures... + */ + if ((scut = find_public(doc, doc, "struct")) != NULL) { fprintf(out, "
  • Structures" @@ -4296,6 +4478,10 @@ write_toc(FILE *out, /* I - Output file */ fputs("
  • \n", out); } + /* + * Unions... + */ + if ((scut = find_public(doc, doc, "union")) != NULL) { fprintf(out, "
  • Unions
      \n", @@ -4318,6 +4504,10 @@ write_toc(FILE *out, /* I - Output file */ fputs("
  • \n", out); } + /* + * Globals variables... + */ + if ((arg = find_public(doc, doc, "variable")) != NULL) { fprintf(out, "
  • Variables" @@ -4340,6 +4530,10 @@ write_toc(FILE *out, /* I - Output file */ fputs("
  • \n", out); } + /* + * Enumerations/constants... + */ + if ((scut = find_public(doc, doc, "enumeration")) != NULL) { fprintf(out, "
  • Constants" @@ -4362,6 +4556,10 @@ write_toc(FILE *out, /* I - Output file */ fputs("
  • \n", out); } + /* + * That's it! + */ + fputs("\n", out); }