diff --git a/Makefile.in b/Makefile.in index 230737b..50853c2 100644 --- a/Makefile.in +++ b/Makefile.in @@ -3,7 +3,7 @@ # # Makefile for Mini-XML, a small XML-like file parsing library. # -# Copyright 2003-2007 by Michael Sweet. +# Copyright 2003-2008 by Michael Sweet. # # This program is free software; you can redistribute it and/or # modify it under the terms of the GNU Library General Public @@ -325,7 +325,7 @@ testmxml.o: mxml.h mxml.xml: mxmldoc-static mxml.h $(PUBLIBOBJS:.o=.c) $(RM) mxml.xml - ./mxmldoc-static mxml.xml mxml.h $(PUBLIBOBJS:.o=.c) >doc/reference.html + ./mxmldoc-static --intro doc/reference.intro mxml.xml mxml.h $(PUBLIBOBJS:.o=.c) >doc/reference.html valgrind: mxmldoc-static $(RM) valgrind.xml diff --git a/doc/mxml.book b/doc/mxml.book index 4bf22d7..59448ea 100644 --- a/doc/mxml.book +++ b/doc/mxml.book @@ -7,5 +7,5 @@ advanced.html mxmldoc.html license.html relnotes.html -refapp.html +reference.html schema.html diff --git a/doc/reference.html b/doc/reference.html index 6d7873f..27e20ce 100644 --- a/doc/reference.html +++ b/doc/reference.html @@ -4,131 +4,128 @@ Documentation -

Contents

- - -

Enumerations

- - -

mxml_sax_event_e

-

Description

-

SAX event type. -

Values

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

mxml_type_e

-

Description

-

The XML node type. -

Values

-
- - - - - - - - - -
NameDescription
MXML_CUSTOM  Mini-XML 2.1 Custom data -
MXML_ELEMENT XML element with attributes -
MXML_IGNORE  Mini-XML 2.3 Ignore/throw away node -
MXML_INTEGER Integer value -
MXML_OPAQUE Opaque string -
MXML_REAL Real value -
MXML_TEXT Text fragment -
+

CLibrary +Reference

+

Functions

-

mxmlAdd()

-

Description

+

mxmlAdd

Add a node to a tree.

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

Syntax

-

-void
-mxmlAdd( - mxml_node_t * parent, - int where, - mxml_node_t * child, - mxml_node_t * node); -

-

Arguments

-
- - - - - - -
NameDescription
parentParent node -
whereWhere to add, MXML_ADD_BEFORE or MXML_ADD_AFTER -
childChild node for where or MXML_ADD_TO_PARENT -
nodeNode to add -
-

Returns

-

Nothing.

- -

mxmlDelete()

-

Description

+

+

+void mxmlAdd (
+    mxml_node_t *parent,
+    int where,
+    mxml_node_t *child,
+    mxml_node_t *node
+);

+

Parameters

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

mxmlDelete

Delete a node and all of its children.

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

Syntax

-

-void
-mxmlDelete( - mxml_node_t * node); -

-

Arguments

-
- - - -
NameDescription
nodeNode to delete -
-

Returns

-

Nothing.

- -

 Mini-XML 2.4 mxmlElementDeleteAttr()

-

Description

+

+

+void mxmlDelete (
+    mxml_node_t *node
+);

+

Parameters

+
+ +
node
+
Node to delete +
+
+ +

 Mini-XML 2.4 mxmlElementDeleteAttr

Delete an attribute. -

Syntax

-

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

-

Arguments

-
- - - - -
NameDescription
nodeElement -
nameAttribute name -
-

Returns

-

Nothing.

- -

mxmlElementGetAttr()

-

Description

+

+

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

+

Parameters

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

mxmlElementGetAttr

Get an attribute.

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

Syntax

-

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

-

Arguments

-
- - - - -
NameDescription
nodeElement node -
nameName of attribute -
-

Returns

+

+

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

+

Parameters

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

Return Value

Attribute value or NULL

-

mxmlElementSetAttr()

-

Description

+

mxmlElementSetAttr

Set an attribute.

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

Syntax

-

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

-

Arguments

-
- - - - - -
NameDescription
nodeElement node -
nameName of attribute -
valueAttribute value -
-

Returns

-

Nothing.

- -

 Mini-XML 2.3 mxmlElementSetAttrf()

-

Description

+

+

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

+

Parameters

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

 Mini-XML 2.3 mxmlElementSetAttrf

Set an attribute with a formatted value.

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

Syntax

-

-void
-mxmlElementSetAttrf( - mxml_node_t * node, - const char * name, - const char * format, - ...); -

-

Arguments

-
- - - - - - -
NameDescription
nodeElement node -
nameName of attribute -
formatPrintf-style attribute value -
...Additional arguments as needed -
-

Returns

-

Nothing.

- -

mxmlEntityAddCallback()

-

Description

+

+

+void mxmlElementSetAttrf (
+    mxml_node_t *node,
+    const char *name,
+    const char *format,
+    ...
+);

+

Parameters

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

mxmlEntityAddCallback

Add a callback to convert entities to Unicode. -

Syntax

-

-int
-mxmlEntityAddCallback(void); -

-

Arguments

-

None.

-

Returns

+

+

+int mxmlEntityAddCallback (void);

+

Return Value

0 on success, -1 on failure

-

mxmlEntityGetName()

-

Description

+

mxmlEntityGetName

Get the name that corresponds to the character value.

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

Syntax

-

-const char *
-mxmlEntityGetName( - int val); -

-

Arguments

-
- - - -
NameDescription
valCharacter value -
-

Returns

+

+

+const char *mxmlEntityGetName (
+    int val
+);

+

Parameters

+
+ +
val
+
Character value +
+
+

Return Value

Entity name or NULL

-

mxmlEntityGetValue()

-

Description

+

mxmlEntityGetValue

Get the character corresponding to a named entity.

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

Syntax

-

-int
-mxmlEntityGetValue( - const char * name); -

-

Arguments

-
- - - -
NameDescription
nameEntity name -
-

Returns

+

+

+int mxmlEntityGetValue (
+    const char *name
+);

+

Parameters

+
+ +
name
+
Entity name +
+
+

Return Value

Character value or -1 on error

-

mxmlEntityRemoveCallback()

-

Description

+

mxmlEntityRemoveCallback

Remove a callback. -

Syntax

-

-void
-mxmlEntityRemoveCallback(void); -

-

Arguments

-

None.

-

Returns

-

Nothing.

- -

mxmlFindElement()

-

Description

+

+

+void mxmlEntityRemoveCallback (void);

+ +

mxmlFindElement

Find the named element.

The search is constrained by the name, attribute name, and value; any NULL names or values are treated as wildcards, so different kinds of @@ -371,159 +340,154 @@ whether the search descends into child nodes; normally you will use MXML_DESCEND_FIRST for the initial search and MXML_NO_DESCEND to find additional direct descendents of the node. The top node argument constrains the search to a particular node's children. -

Syntax

-

-mxml_node_t *
-mxmlFindElement( - mxml_node_t * node, - mxml_node_t * top, - const char * name, - const char * attr, - const char * value, - int descend); -

-

Arguments

-
- - - - - - - - -
NameDescription
nodeCurrent node -
topTop node -
nameElement name or NULL for any -
attrAttribute name, or NULL for none -
valueAttribute value, or NULL for any -
descendDescend into tree - MXML_DESCEND, MXML_NO_DESCEND, or MXML_DESCEND_FIRST -
-

Returns

+

+

+mxml_node_t *mxmlFindElement (
+    mxml_node_t *node,
+    mxml_node_t *top,
+    const char *name,
+    const char *attr,
+    const char *value,
+    int descend
+);

+

Parameters

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

Return Value

Element node or NULL

-

mxmlIndexDelete()

-

Description

+

mxmlIndexDelete

Delete an index. -

Syntax

-

-void
-mxmlIndexDelete( - mxml_index_t * ind); -

-

Arguments

-
- - - -
NameDescription
indIndex to delete -
-

Returns

-

Nothing.

- -

mxmlIndexEnum()

-

Description

+

+

+void mxmlIndexDelete (
+    mxml_index_t *ind
+);

+

Parameters

+
+ +
ind
+
Index to delete +
+
+ +

mxmlIndexEnum

Return the next node in the index.

Nodes are returned in the sorted order of the index. -

Syntax

-

-mxml_node_t *
-mxmlIndexEnum( - mxml_index_t * ind); -

-

Arguments

-
- - - -
NameDescription
indIndex to enumerate -
-

Returns

+

+

+mxml_node_t *mxmlIndexEnum (
+    mxml_index_t *ind
+);

+

Parameters

+
+ +
ind
+
Index to enumerate +
+
+

Return Value

Next node or NULL if there is none

-

mxmlIndexFind()

-

Description

+

mxmlIndexFind

Find the next matching node.

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

Syntax

-

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

-

Arguments

-
- - - - - -
NameDescription
indIndex to search -
elementElement name to find, if any -
valueAttribute value, if any -
-

Returns

+

+

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

+

Parameters

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

Return Value

Node or NULL if none found

-

mxmlIndexNew()

-

Description

+

mxmlIndexNew

Create a new index.

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

Syntax

-

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

-

Arguments

-
- - - - - -
NameDescription
nodeXML node tree -
elementElement to index or NULL for all -
attrAttribute to index or NULL for none -
-

Returns

+

+

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

+

Parameters

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

Return Value

New index

-

mxmlIndexReset()

-

Description

+

mxmlIndexReset

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

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

Syntax

-

-mxml_node_t *
-mxmlIndexReset( - mxml_index_t * ind); -

-

Arguments

-
- - - -
NameDescription
indIndex to reset -
-

Returns

+

+

+mxml_node_t *mxmlIndexReset (
+    mxml_index_t *ind
+);

+

Parameters

+
+ +
ind
+
Index to reset +
+
+

Return Value

First node or NULL if there is none

-

mxmlLoadFd()

-

Description

+

mxmlLoadFd

Load a file descriptor into an XML node tree.

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 @@ -534,30 +498,30 @@ MXML_ELEMENT or MXML_TEXT nodes.

The constants MXML_INTEGER_CALLBACK, MXML_OPAQUE_CALLBACK, MXML_REAL_CALLBACK, and MXML_TEXT_CALLBACK are defined for loading child nodes of the specified type. -

Syntax

-

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

-

Arguments

-
- - - - - -
NameDescription
topTop node -
fdFile descriptor to read from -
cbCallback function or MXML_NO_CALLBACK -
-

Returns

+

+

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

+

Parameters

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

Return Value

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

-

mxmlLoadFile()

-

Description

+

mxmlLoadFile

Load a file into an XML node tree.

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 @@ -568,30 +532,30 @@ MXML_ELEMENT or MXML_TEXT nodes.

The constants MXML_INTEGER_CALLBACK, MXML_OPAQUE_CALLBACK, MXML_REAL_CALLBACK, and MXML_TEXT_CALLBACK are defined for loading child nodes of the specified type. -

Syntax

-

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

-

Arguments

-
- - - - - -
NameDescription
topTop node -
fpFile to read from -
cbCallback function or MXML_NO_CALLBACK -
-

Returns

+

+

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

+

Parameters

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

Return Value

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

-

mxmlLoadString()

-

Description

+

mxmlLoadString

Load a string into an XML node tree.

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 @@ -602,30 +566,30 @@ MXML_ELEMENT or MXML_TEXT nodes.

The constants MXML_INTEGER_CALLBACK, MXML_OPAQUE_CALLBACK, MXML_REAL_CALLBACK, and MXML_TEXT_CALLBACK are defined for loading child nodes of the specified type. -

Syntax

-

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

-

Arguments

-
- - - - - -
NameDescription
topTop node -
sString to load -
cbCallback function or MXML_NO_CALLBACK -
-

Returns

+

+

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

+

Parameters

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

Return Value

First node or NULL if the string has errors.

-

 Mini-XML 2.3 mxmlNewCDATA()

-

Description

+

 Mini-XML 2.3 mxmlNewCDATA

Create a new CDATA node.

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 @@ -633,27 +597,26 @@ CDATA node has no parent. The data string must be nul-terminated and is copied into the new node. CDATA nodes use the MXML_ELEMENT type. -

Syntax

-

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

-

Arguments

-
- - - - -
NameDescription
parentParent node or MXML_NO_PARENT -
dataData string -
-

Returns

+

+

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

+

Parameters

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

Return Value

New node

-

 Mini-XML 2.1 mxmlNewCustom()

-

Description

+

 Mini-XML 2.1 mxmlNewCustom

Create a new custom data node.

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 @@ -661,282 +624,269 @@ element node has no parent. NULL can be passed when the data in the node is not dynamically allocated or is separately managed. -

Syntax

-

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

-

Arguments

-
- - - - - -
NameDescription
parentParent node or MXML_NO_PARENT -
dataPointer to data -
destroyFunction to destroy data -
-

Returns

+

+

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

+

Parameters

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

Return Value

New node

-

mxmlNewElement()

-

Description

+

mxmlNewElement

Create a new element node.

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

Syntax

-

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

-

Arguments

-
- - - - -
NameDescription
parentParent node or MXML_NO_PARENT -
nameName of element -
-

Returns

+

+

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

+

Parameters

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

Return Value

New node

-

mxmlNewInteger()

-

Description

+

mxmlNewInteger

Create a new integer node.

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

Syntax

-

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

-

Arguments

-
- - - - -
NameDescription
parentParent node or MXML_NO_PARENT -
integerInteger value -
-

Returns

+

+

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

+

Parameters

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

Return Value

New node

-

mxmlNewOpaque()

-

Description

+

mxmlNewOpaque

Create a new opaque string.

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

Syntax

-

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

-

Arguments

-
- - - - -
NameDescription
parentParent node or MXML_NO_PARENT -
opaqueOpaque string -
-

Returns

+

+

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

+

Parameters

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

Return Value

New node

-

mxmlNewReal()

-

Description

+

mxmlNewReal

Create a new real number node.

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

Syntax

-

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

-

Arguments

-
- - - - -
NameDescription
parentParent node or MXML_NO_PARENT -
realReal number value -
-

Returns

+

+

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

+

Parameters

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

Return Value

New node

-

mxmlNewText()

-

Description

+

mxmlNewText

Create a new text fragment node.

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

Syntax

-

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

-

Arguments

-
- - - - - -
NameDescription
parentParent node or MXML_NO_PARENT -
whitespace1 = leading whitespace, 0 = no whitespace -
stringString -
-

Returns

+

+

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

+

Parameters

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

Return Value

New node

-

mxmlNewTextf()

-

Description

+

mxmlNewTextf

Create a new formatted text fragment node.

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

Syntax

-

-mxml_node_t *
-mxmlNewTextf( - mxml_node_t * parent, - int whitespace, - const char * format, - ...); -

-

Arguments

-
- - - - - - -
NameDescription
parentParent node or MXML_NO_PARENT -
whitespace1 = leading whitespace, 0 = no whitespace -
formatPrintf-style frmat string -
...Additional args as needed -
-

Returns

+

+

+mxml_node_t *mxmlNewTextf (
+    mxml_node_t *parent,
+    int whitespace,
+    const char *format,
+    ...
+);

+

Parameters

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

Return Value

New node

-

 Mini-XML 2.3 mxmlNewXML()

-

Description

+

 Mini-XML 2.3 mxmlNewXML

Create a new XML document tree.

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

Syntax

-

-mxml_node_t *
-mxmlNewXML( - const char * version); -

-

Arguments

-
- - - -
NameDescription
versionVersion number to use -
-

Returns

+

+

+mxml_node_t *mxmlNewXML (
+    const char *version
+);

+

Parameters

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

Return Value

New ?xml node

-

 Mini-XML 2.3 mxmlRelease()

-

Description

+

 Mini-XML 2.3 mxmlRelease

Release a node.

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

Syntax

-

-int
-mxmlRelease( - mxml_node_t * node); -

-

Arguments

-
- - - -
NameDescription
nodeNode -
-

Returns

+

+

+int mxmlRelease (
+    mxml_node_t *node
+);

+

Parameters

+
+ +
node
+
Node +
+
+

Return Value

New reference count

-

mxmlRemove()

-

Description

+

mxmlRemove

Remove a node from its parent.

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

Syntax

-

-void
-mxmlRemove( - mxml_node_t * node); -

-

Arguments

-
- - - -
NameDescription
nodeNode to remove -
-

Returns

-

Nothing.

- -

 Mini-XML 2.3 mxmlRetain()

-

Description

+

+

+void mxmlRemove (
+    mxml_node_t *node
+);

+

Parameters

+
+ +
node
+
Node to remove +
+
+ +

 Mini-XML 2.3 mxmlRetain

Retain a node. -

Syntax

-

-int
-mxmlRetain( - mxml_node_t * node); -

-

Arguments

-
- - - -
NameDescription
nodeNode -
-

Returns

+

+

+int mxmlRetain (
+    mxml_node_t *node
+);

+

Parameters

+
+ +
node
+
Node +
+
+

Return Value

New reference count

-

 Mini-XML 2.3 mxmlSAXLoadFd()

-

Description

+

 Mini-XML 2.3 mxmlSAXLoadFd

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

The nodes in the specified file are added to the specified top node. @@ -953,36 +903,38 @@ be kept for later use. Otherwise, nodes are deleted when the parent node is closed or after each data, comment, CDATA, or directive node. -

Syntax

-

-mxml_node_t *
-mxmlSAXLoadFd( - mxml_node_t * top, - int fd, - mxml_load_cb_t cb, - mxml_sax_cb_t sax_cb, - void * sax_data); -

-

Arguments

-
- - - - - - - -
NameDescription
topTop node -
fdFile descriptor to read from -
cbCallback function or MXML_NO_CALLBACK -
sax_cbSAX callback or MXML_NO_CALLBACK -
sax_dataSAX user data -
-

Returns

+

+

+mxml_node_t *mxmlSAXLoadFd (
+    mxml_node_t *top,
+    int fd,
+    mxml_load_cb_t cb,
+    mxml_sax_cb_t sax_cb,
+    void *sax_data
+);

+

Parameters

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

Return Value

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

-

 Mini-XML 2.3 mxmlSAXLoadFile()

-

Description

+

 Mini-XML 2.3 mxmlSAXLoadFile

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

The nodes in the specified file are added to the specified top node. @@ -999,36 +951,38 @@ be kept for later use. Otherwise, nodes are deleted when the parent node is closed or after each data, comment, CDATA, or directive node. -

Syntax

-

-mxml_node_t *
-mxmlSAXLoadFile( - mxml_node_t * top, - FILE * fp, - mxml_load_cb_t cb, - mxml_sax_cb_t sax_cb, - void * sax_data); -

-

Arguments

-
- - - - - - - -
NameDescription
topTop node -
fpFile to read from -
cbCallback function or MXML_NO_CALLBACK -
sax_cbSAX callback or MXML_NO_CALLBACK -
sax_dataSAX user data -
-

Returns

+

+

+mxml_node_t *mxmlSAXLoadFile (
+    mxml_node_t *top,
+    FILE *fp,
+    mxml_load_cb_t cb,
+    mxml_sax_cb_t sax_cb,
+    void *sax_data
+);

+

Parameters

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

Return Value

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

-

 Mini-XML 2.3 mxmlSAXLoadString()

-

Description

+

 Mini-XML 2.3 mxmlSAXLoadString

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

The nodes in the specified string are added to the specified top node. @@ -1045,36 +999,38 @@ be kept for later use. Otherwise, nodes are deleted when the parent node is closed or after each data, comment, CDATA, or directive node. -

Syntax

-

-mxml_node_t *
-mxmlSAXLoadString( - mxml_node_t * top, - const char * s, - mxml_load_cb_t cb, - mxml_sax_cb_t sax_cb, - void * sax_data); -

-

Arguments

-
- - - - - - - -
NameDescription
topTop node -
sString to load -
cbCallback function or MXML_NO_CALLBACK -
sax_cbSAX callback or MXML_NO_CALLBACK -
sax_dataSAX user data -
-

Returns

+

+

+mxml_node_t *mxmlSAXLoadString (
+    mxml_node_t *top,
+    const char *s,
+    mxml_load_cb_t cb,
+    mxml_sax_cb_t sax_cb,
+    void *sax_data
+);

+

Parameters

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

Return Value

First node or NULL if the string has errors.

-

mxmlSaveAllocString()

-

Description

+

mxmlSaveAllocString

Save an XML node tree to an allocated string.

This function returns a pointer to a string containing the textual representation of the XML node tree. The string should be freed @@ -1086,87 +1042,86 @@ 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. -

Syntax

-

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

-

Arguments

-
- - - - -
NameDescription
nodeNode to write -
cbWhitespace callback or MXML_NO_CALLBACK -
-

Returns

+

+

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

+

Parameters

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

Return Value

Allocated string or NULL

-

mxmlSaveFd()

-

Description

+

mxmlSaveFd

Save an XML tree to a file descriptor.

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

Syntax

-

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

-

Arguments

-
- - - - - -
NameDescription
nodeNode to write -
fdFile descriptor to write to -
cbWhitespace callback or MXML_NO_CALLBACK -
-

Returns

+

+

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

+

Parameters

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

Return Value

0 on success, -1 on error.

-

mxmlSaveFile()

-

Description

+

mxmlSaveFile

Save an XML tree to a file.

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

Syntax

-

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

-

Arguments

-
- - - - - -
NameDescription
nodeNode to write -
fpFile to write to -
cbWhitespace callback or MXML_NO_CALLBACK -
-

Returns

+

+

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

+

Parameters

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

Return Value

0 on success, -1 on error.

-

mxmlSaveString()

-

Description

+

mxmlSaveString

Save an XML node tree to a string.

This function returns the total number of bytes that would be required for the string but only copies (bufsize - 1) characters @@ -1176,518 +1131,342 @@ 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. -

Syntax

-

-int
-mxmlSaveString( - mxml_node_t * node, - char * buffer, - int bufsize, - mxml_save_cb_t cb); -

-

Arguments

-
- - - - - - -
NameDescription
nodeNode to write -
bufferString buffer -
bufsizeSize of string buffer -
cbWhitespace callback or MXML_NO_CALLBACK -
-

Returns

+

+

+int mxmlSaveString (
+    mxml_node_t *node,
+    char *buffer,
+    int bufsize,
+    mxml_save_cb_t cb
+);

+

Parameters

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

Return Value

Size of string

-

 Mini-XML 2.3 mxmlSetCDATA()

-

Description

+

 Mini-XML 2.3 mxmlSetCDATA

Set the element name of a CDATA node.

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

Syntax

-

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

-

Arguments

-
- - - - -
NameDescription
nodeNode to set -
dataNew data string -
-

Returns

+

+

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

+

Parameters

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

Return Value

0 on success, -1 on failure

-

 Mini-XML 2.1 mxmlSetCustom()

-

Description

+

 Mini-XML 2.1 mxmlSetCustom

Set the data and destructor of a custom data node.

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

Syntax

-

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

-

Arguments

-
- - - - - -
NameDescription
nodeNode to set -
dataNew data pointer -
destroyNew destructor function -
-

Returns

+

+

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

+

Parameters

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

Return Value

0 on success, -1 on failure

-

mxmlSetCustomHandlers()

-

Description

+

mxmlSetCustomHandlers

Set the handling functions for custom data.

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

Syntax

-

-void
-mxmlSetCustomHandlers( - mxml_custom_load_cb_t load, - mxml_custom_save_cb_t save); -

-

Arguments

-
- - - - -
NameDescription
loadLoad function -
saveSave function -
-

Returns

-

Nothing.

- -

mxmlSetElement()

-

Description

+

+

+void mxmlSetCustomHandlers (
+    mxml_custom_load_cb_t load,
+    mxml_custom_save_cb_t save
+);

+

Parameters

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

mxmlSetElement

Set the name of an element node.

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

Syntax

-

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

-

Arguments

-
- - - - -
NameDescription
nodeNode to set -
nameNew name string -
-

Returns

+

+

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

+

Parameters

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

Return Value

0 on success, -1 on failure

-

mxmlSetErrorCallback()

-

Description

+

mxmlSetErrorCallback

Set the error message callback. -

Syntax

-

-void
-mxmlSetErrorCallback( - mxml_error_cb_t cb); -

-

Arguments

-
- - - -
NameDescription
cbError callback function -
-

Returns

-

Nothing.

- -

mxmlSetInteger()

-

Description

+

+

+void mxmlSetErrorCallback (
+    mxml_error_cb_t cb
+);

+

Parameters

+
+ +
cb
+
Error callback function +
+
+ +

mxmlSetInteger

Set the value of an integer node.

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

Syntax

-

-int
-mxmlSetInteger( - mxml_node_t * node, - int integer); -

-

Arguments

-
- - - - -
NameDescription
nodeNode to set -
integerInteger value -
-

Returns

+

+

+int mxmlSetInteger (
+    mxml_node_t *node,
+    int integer
+);

+

Parameters

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

Return Value

0 on success, -1 on failure

-

mxmlSetOpaque()

-

Description

+

mxmlSetOpaque

Set the value of an opaque node.

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

Syntax

-

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

-

Arguments

-
- - - - -
NameDescription
nodeNode to set -
opaqueOpaque string -
-

Returns

+

+

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

+

Parameters

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

Return Value

0 on success, -1 on failure

-

mxmlSetReal()

-

Description

+

mxmlSetReal

Set the value of a real number node.

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

Syntax

-

-int
-mxmlSetReal( - mxml_node_t * node, - double real); -

-

Arguments

-
- - - - -
NameDescription
nodeNode to set -
realReal number value -
-

Returns

+

+

+int mxmlSetReal (
+    mxml_node_t *node,
+    double real
+);

+

Parameters

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

Return Value

0 on success, -1 on failure

-

mxmlSetText()

-

Description

+

mxmlSetText

Set the value of a text node.

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

Syntax

-

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

-

Arguments

-
- - - - - -
NameDescription
nodeNode to set -
whitespace1 = leading whitespace, 0 = no whitespace -
stringString -
-

Returns

+

+

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

+

Parameters

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

Return Value

0 on success, -1 on failure

-

mxmlSetTextf()

-

Description

+

mxmlSetTextf

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

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

Syntax

-

-int
-mxmlSetTextf( - mxml_node_t * node, - int whitespace, - const char * format, - ...); -

-

Arguments

-
- - - - - - -
NameDescription
nodeNode to set -
whitespace1 = leading whitespace, 0 = no whitespace -
formatPrintf-style format string -
...Additional arguments as needed -
-

Returns

+

+

+int mxmlSetTextf (
+    mxml_node_t *node,
+    int whitespace,
+    const char *format,
+    ...
+);

+

Parameters

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

Return Value

0 on success, -1 on failure

-

 Mini-XML 2.3 mxmlSetWrapMargin()

-

Description

+

 Mini-XML 2.3 mxmlSetWrapMargin

Set the the wrap margin when saving XML data.

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

Syntax

-

-void
-mxmlSetWrapMargin( - int column); -

-

Arguments

-
- - - -
NameDescription
columnColumn for wrapping -
-

Returns

-

Nothing.

- -

mxmlWalkNext()

-

Description

+

+

+void mxmlSetWrapMargin (
+    int column
+);

+

Parameters

+
+ +
column
+
Column for wrapping +
+
+ +

mxmlWalkNext

Walk to the next logical node in the tree.

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

Syntax

-

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

-

Arguments

-
- - - - - -
NameDescription
nodeCurrent node -
topTop node -
descendDescend into tree - MXML_DESCEND, MXML_NO_DESCEND, or MXML_DESCEND_FIRST -
-

Returns

+

+

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

+

Parameters

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

Return Value

Next node or NULL

-

mxmlWalkPrev()

-

Description

+

mxmlWalkPrev

Walk to the previous logical node in the tree.

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

Syntax

-

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

-

Arguments

-
- - - - - -
NameDescription
nodeCurrent node -
topTop node -
descendDescend into tree - MXML_DESCEND, MXML_NO_DESCEND, or MXML_DESCEND_FIRST -
-

Returns

+

+

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

+

Parameters

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

Return Value

Previous node or NULL

-

Structures

- - -

mxml_attr_s

-

Description

-

An XML element attribute value. -

Definition

-

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

-

Members

-
- - - - -
NameDescription
name Attribute name -
value Attribute value -
- -

 Mini-XML 2.1 mxml_custom_s

-

Description

-

An XML custom value. -

Definition

-

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

-

Members

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

mxml_element_s

-

Description

-

An XML element value. -

Definition

-

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

-

Members

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

mxml_index_s

-

Description

-

An XML node index. -

Definition

-

-struct mxml_index_s
-{
-  int alloc_nodes;
-  char * attr;
-  int cur_node;
-  mxml_node_t ** nodes;
-  int num_nodes;
-};

-

Members

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

mxml_node_s

-

Description

-

An XML node. -

Definition

-

-struct mxml_node_s
-{
-  struct mxml_node_s * child;
-  struct mxml_node_s * last_child;
-  struct mxml_node_s * next;
-  struct mxml_node_s * parent;
-  struct mxml_node_s * prev;
-  int ref_count;
-  mxml_type_t type;
-  void * user_data;
-  mxml_value_t value;
-};

-

Members

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

mxml_text_s

-

Description

-

An XML text value. -

Definition

-

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

-

Members

-
- - - - -
NameDescription
string Fragment string -
whitespace Leading whitespace? -
- -

Types

+

Data Types

-

mxml_attr_t

-

Description

+

mxml_attr_t

An XML element attribute value. -

Definition

-

+

+

typedef struct mxml_attr_s mxml_attr_t; -

+

-

mxml_custom_destroy_cb_t

-

Description

+

mxml_custom_destroy_cb_t

Custom data destructor -

Definition

-

+

+

typedef void (*mxml_custom_destroy_cb_t)(void *); -

+

-

mxml_custom_load_cb_t

-

Description

+

mxml_custom_load_cb_t

Custom data load callback function -

Definition

-

+

+

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

+

-

mxml_custom_save_cb_t

-

Description

+

mxml_custom_save_cb_t

Custom data save callback function -

Definition

-

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

+

+

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

-

 Mini-XML 2.1 mxml_custom_t

-

Description

+

 Mini-XML 2.1 mxml_custom_t

An XML custom value. -

Definition

-

+

+

typedef struct mxml_custom_s mxml_custom_t; -

+

-

mxml_element_t

-

Description

+

mxml_element_t

An XML element value. -

Definition

-

+

+

typedef struct mxml_element_s mxml_element_t; -

+

-

mxml_error_cb_t

-

Description

+

mxml_error_cb_t

Error callback function -

Definition

-

+

+

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

+

-

mxml_index_t

-

Description

+

mxml_index_t

An XML node index. -

Definition

-

+

+

typedef struct mxml_index_s mxml_index_t; -

+

-

mxml_load_cb_t

-

Description

+

mxml_load_cb_t

Load callback function -

Definition

-

+

+

typedef mxml_type_t (*mxml_load_cb_t)(mxml_node_t *); -

+

-

mxml_node_t

-

Description

+

mxml_node_t

An XML node. -

Definition

-

+

+

typedef struct mxml_node_s mxml_node_t; -

+

-

mxml_save_cb_t

-

Description

+

mxml_save_cb_t

Save callback function -

Definition

-

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

+

+

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

-

mxml_sax_cb_t

-

Description

+

mxml_sax_cb_t

SAX callback function -

Definition

-

+

+

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

+

-

mxml_sax_event_t

-

Description

+

mxml_sax_event_t

SAX event type. -

Definition

-

+

+

typedef enum mxml_sax_event_e mxml_sax_event_t; -

+

-

mxml_text_t

-

Description

+

mxml_text_t

An XML text value. -

Definition

-

+

+

typedef struct mxml_text_s mxml_text_t; -

+

-

mxml_value_t

-

Description

+

mxml_value_t

An XML node value. -

Definition

-

+

+

typedef union mxml_value_u mxml_value_t; -

+

+ +

Structures

+ + +

mxml_attr_s

+

An XML element attribute value. +

+

Definition

+

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

+

Members

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

 Mini-XML 2.1 mxml_custom_s

+

An XML custom value. +

+

Definition

+

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

+

Members

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

mxml_element_s

+

An XML element value. +

+

Definition

+

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

+

Members

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

mxml_index_s

+

An XML node index. +

+

Definition

+

struct mxml_index_s {
+    int alloc_nodes;
+    char *attr;
+    int cur_node;
+    mxml_node_t **nodes;
+    int num_nodes;
+};

+

Members

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

mxml_node_s

+

An XML node. +

+

Definition

+

struct mxml_node_s {
+    struct mxml_node_s *child;
+    struct mxml_node_s *last_child;
+    struct mxml_node_s *next;
+    struct mxml_node_s *parent;
+    struct mxml_node_s *prev;
+    int ref_count;
+    mxml_type_t type;
+    void *user_data;
+    mxml_value_t value;
+};

+

Members

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

mxml_text_s

+

An XML text value. +

+

Definition

+

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

+

Members

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

Unions

-

mxml_value_u

-

Description

+

mxml_value_u

An XML node value. -

Definition

-

-union mxml_value_u
-{
-  mxml_custom_t custom;
-  mxml_element_t element;
-  int integer;
-  char * opaque;
-  double real;
-  mxml_text_t text;
-};

+

+

union mxml_value_u {
+    mxml_custom_t custom;
+    mxml_element_t element;
+    int integer;
+    char *opaque;
+    double real;
+    mxml_text_t text;
+};

Members

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

Constants

+ + +

mxml_sax_event_e

+

SAX event type. +

+

Constants

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

mxml_type_e

+

The XML node type. +

+

Constants

+
+
MXML_CUSTOM  Mini-XML 2.1 
+
Custom data +
+
MXML_ELEMENT
+
XML element with attributes +
+
MXML_IGNORE  Mini-XML 2.3 
+
Ignore/throw away node +
+
MXML_INTEGER
+
Integer value +
+
MXML_OPAQUE
+
Opaque string +
+
MXML_REAL
+
Real value +
+
MXML_TEXT
+
Text fragment +
+
diff --git a/doc/refapp.html b/doc/reference.intro similarity index 69% rename from doc/refapp.html rename to doc/reference.intro index 111e99d..eee4a4c 100644 --- a/doc/refapp.html +++ b/doc/reference.intro @@ -1,11 +1,4 @@ - - -

CLibrary Reference

- - - - diff --git a/mxmldoc.c b/mxmldoc.c index 9eef34f..a2ac905 100644 --- a/mxmldoc.c +++ b/mxmldoc.c @@ -2401,6 +2401,10 @@ write_element(mxml_node_t *doc, /* I - Document tree */ else write_string(node->value.text.string, mode); } + + if (!strcmp(element->value.element.name, "type") && + element->last_child->value.text.string[0] != '*') + putchar(' '); } @@ -2454,16 +2458,65 @@ write_html( printf("\t\n", section); puts("\t\n" - "\t\n" + "\t\n" "\n" ""); @@ -2482,28 +2535,30 @@ write_html( fclose(fp); } + else + { + /* + * Table of contents... + */ - /* - * Table of contents... - */ - - puts("

Contents

"); - puts(""); + puts("

Contents

"); + puts(""); + } /* * List of classes... @@ -2535,22 +2590,20 @@ write_html( description = mxmlFindElement(scut, scut, "description", NULL, NULL, MXML_DESCEND_FIRST); printf("\n" - "

%s%s

\n", + "

%s%s

\n", get_comment_info(description), cname, cname); if (description) { - fputs("

Description

\n" - "

", stdout); + fputs("

", stdout); write_description(description, OUTPUT_HTML); + puts("

"); } - printf("

Definition

\n" - "

\n" - "class %s", cname); + printf("

class %s", cname); if ((parent = mxmlElementGetAttr(scut, "parent")) != NULL) printf(" %s", parent); - puts("
\n{"); + puts(" {
"); for (i = 0; i < 3; i ++) { @@ -2572,7 +2625,7 @@ write_html( write_element(doc, mxmlFindElement(arg, arg, "type", NULL, NULL, MXML_DESCEND_FIRST), OUTPUT_HTML); - printf(" %s;
\n", mxmlElementGetAttr(arg, "name")); + printf("%s;
\n", mxmlElementGetAttr(arg, "name")); } for (function = mxmlFindElement(scut, scut, "function", "scope", @@ -2595,12 +2648,9 @@ write_html( NULL, MXML_DESCEND_FIRST); if (arg) - { write_element(doc, mxmlFindElement(arg, arg, "type", NULL, NULL, MXML_DESCEND_FIRST), OUTPUT_HTML); - putchar(' '); - } else if (strcmp(cname, name) && strcmp(cname, name + 1)) fputs("void ", stdout); @@ -2620,10 +2670,8 @@ write_html( putchar(' '); if (type->child) - { write_element(doc, type, OUTPUT_HTML); - putchar(' '); - } + fputs(mxmlElementGetAttr(arg, "name"), stdout); if ((defval = mxmlElementGetAttr(arg, "default")) != NULL) printf(" %s", defval); @@ -2636,12 +2684,9 @@ write_html( } } - puts("};

\n" + puts("};

\n" "

Members

\n" - "
\n" - "\n" - ""); + "
"); for (arg = mxmlFindElement(scut, scut, "variable", NULL, NULL, MXML_DESCEND_FIRST); @@ -2652,14 +2697,18 @@ write_html( description = mxmlFindElement(arg, arg, "description", NULL, NULL, MXML_DESCEND_FIRST); - printf("
"); + puts(""); } + puts("\n" + "

Methods

\n" + "
"); + for (function = mxmlFindElement(scut, scut, "function", NULL, NULL, MXML_DESCEND_FIRST); function; @@ -2670,7 +2719,7 @@ write_html( description = mxmlFindElement(function, function, "description", NULL, NULL, MXML_DESCEND_FIRST); - printf("
"); - } - - puts("
NameDescription
%s %s", + printf("
%s %s
\n
", mxmlElementGetAttr(arg, "name"), get_comment_info(description)); write_description(description, OUTPUT_HTML); - puts("
%s() %s", + printf("
%s %s
\n
", cname, name, name, get_comment_info(description)); write_description(description, OUTPUT_HTML); @@ -2680,82 +2729,16 @@ write_html( if (arg) { - fputs("\nReturns: ", stdout); + puts("
\nReturn Value
"); write_element(NULL, mxmlFindElement(arg, arg, "description", NULL, NULL, MXML_DESCEND_FIRST), OUTPUT_HTML); } - puts("
"); - } - } - - /* - * List of enumerations... - */ - - if (find_public(doc, doc, "enumeration")) - { - puts("\n" - "

Enumerations

\n" - ""); - - for (scut = find_public(doc, doc, "enumeration"); - scut; - scut = find_public(scut, doc, "enumeration")) - { - name = mxmlElementGetAttr(scut, "name"); - description = mxmlFindElement(scut, scut, "description", NULL, - NULL, MXML_DESCEND_FIRST); - printf("\n" - "

%s%s

\n", - get_comment_info(description), name, name); - - if (description) - { - fputs("

Description

\n" - "

", stdout); - write_description(description, OUTPUT_HTML); + puts(""); } - puts("

Values

\n" - "
\n" - "\n" - ""); - - for (arg = mxmlFindElement(scut, scut, "constant", NULL, NULL, - MXML_DESCEND_FIRST); - arg; - arg = mxmlFindElement(arg, scut, "constant", NULL, NULL, - MXML_NO_DESCEND)) - { - description = mxmlFindElement(arg, arg, "description", NULL, - NULL, MXML_DESCEND_FIRST); - printf(""); - } - - puts("
NameDescription
%s %s", - mxmlElementGetAttr(arg, "name"), get_comment_info(description)); - - write_description(description, OUTPUT_HTML); - - puts("
"); + puts(""); } } @@ -2774,7 +2757,7 @@ write_html( function = find_public(function, doc, "function")) { name = mxmlElementGetAttr(function, "name"); - printf("\t
  • %s() %s
  • \n", name, name, + printf("\t
  • %s %s
  • \n", name, name, get_comment_info(mxmlFindElement(function, function, "description", NULL, NULL, MXML_DESCEND_FIRST))); } @@ -2789,18 +2772,17 @@ write_html( description = mxmlFindElement(function, function, "description", NULL, NULL, MXML_DESCEND_FIRST); printf("\n" - "

    %s%s()

    \n", + "

    %s%s

    \n", get_comment_info(description), name, name); if (description) { - fputs("

    Description

    \n" - "

    ", stdout); + fputs("

    ", stdout); write_description(description, OUTPUT_HTML); + puts("

    "); } - puts("

    Syntax

    \n" - "

    "); + puts("

    "); arg = mxmlFindElement(function, function, "returnvalue", NULL, NULL, MXML_DESCEND_FIRST); @@ -2810,9 +2792,9 @@ write_html( NULL, MXML_DESCEND_FIRST), OUTPUT_HTML); else - fputs("void", stdout); + fputs("void ", stdout); - printf("
    \n%s", name); + printf("%s ", name); for (arg = mxmlFindElement(function, function, "argument", NULL, NULL, MXML_DESCEND_FIRST), prefix = '('; arg; @@ -2822,32 +2804,24 @@ write_html( type = mxmlFindElement(arg, arg, "type", NULL, NULL, MXML_DESCEND_FIRST); - printf("%c\n ", prefix); + printf("%c
    \n    ", prefix); if (type->child) - { write_element(doc, type, OUTPUT_HTML); - putchar(' '); - } + fputs(mxmlElementGetAttr(arg, "name"), stdout); if ((defval = mxmlElementGetAttr(arg, "default")) != NULL) printf(" %s", defval); } if (prefix == '(') - puts("(void);\n

    "); + puts("(void);

    "); else - puts(");\n

    "); + { + puts("
    \n);

    "); - puts("

    Arguments

    "); + puts("

    Parameters

    "); - if (prefix == '(') - puts("

    None.

    "); - else - { - puts("
    \n" - "\n" - ""); + puts("
    \n"); for (arg = mxmlFindElement(function, function, "argument", NULL, NULL, MXML_DESCEND_FIRST); @@ -2855,27 +2829,24 @@ write_html( arg = mxmlFindElement(arg, function, "argument", NULL, NULL, MXML_NO_DESCEND)) { - printf("
    "); + puts(""); } - puts("
    NameDescription
    %s", mxmlElementGetAttr(arg, "name")); + printf("
    %s
    \n
    ", mxmlElementGetAttr(arg, "name")); write_description(mxmlFindElement(arg, arg, "description", NULL, NULL, MXML_DESCEND_FIRST), OUTPUT_HTML); - puts("
    "); + puts(""); } - puts("

    Returns

    "); - arg = mxmlFindElement(function, function, "returnvalue", NULL, NULL, MXML_DESCEND_FIRST); - if (!arg) - puts("

    Nothing.

    "); - else + if (arg) { + puts("

    Return Value

    "); fputs("

    ", stdout); write_element(NULL, mxmlFindElement(arg, arg, "description", NULL, NULL, MXML_DESCEND_FIRST), @@ -2885,6 +2856,134 @@ write_html( } } + /* + * List of types... + */ + + if (find_public(doc, doc, "typedef")) + { + puts("\n" + "

    Data Types

    \n" + ""); + + for (scut = find_public(doc, doc, "typedef"); + scut; + scut = find_public(scut, doc, "typedef")) + { + name = mxmlElementGetAttr(scut, "name"); + description = mxmlFindElement(scut, scut, "description", NULL, + NULL, MXML_DESCEND_FIRST); + printf("\n" + "

    %s%s

    \n", + get_comment_info(description), name, name); + + if (description) + { + fputs("

    ", stdout); + write_description(description, OUTPUT_HTML); + puts("

    "); + } + + fputs("

    \n" + "typedef ", stdout); + + type = mxmlFindElement(scut, scut, "type", NULL, NULL, + MXML_DESCEND_FIRST); + + for (type = type->child; type; type = type->next) + if (!strcmp(type->value.text.string, "(")) + break; + else + { + if (type->value.text.whitespace) + putchar(' '); + + if (mxmlFindElement(doc, doc, "class", "name", + type->value.text.string, MXML_DESCEND) || + mxmlFindElement(doc, doc, "enumeration", "name", + type->value.text.string, MXML_DESCEND) || + mxmlFindElement(doc, doc, "struct", "name", + type->value.text.string, MXML_DESCEND) || + mxmlFindElement(doc, doc, "typedef", "name", + type->value.text.string, MXML_DESCEND) || + mxmlFindElement(doc, doc, "union", "name", + type->value.text.string, MXML_DESCEND)) + { + printf(""); + write_string(type->value.text.string, OUTPUT_HTML); + printf(""); + } + else + write_string(type->value.text.string, OUTPUT_HTML); + } + + if (type) + { + /* + * Output function type... + */ + + if (type->prev && type->prev->value.text.string[0] != '*') + putchar(' '); + + printf("(*%s", name); + + for (type = type->next->next; type; type = type->next) + { + if (type->value.text.whitespace) + putchar(' '); + + if (mxmlFindElement(doc, doc, "class", "name", + type->value.text.string, MXML_DESCEND) || + mxmlFindElement(doc, doc, "enumeration", "name", + type->value.text.string, MXML_DESCEND) || + mxmlFindElement(doc, doc, "struct", "name", + type->value.text.string, MXML_DESCEND) || + mxmlFindElement(doc, doc, "typedef", "name", + type->value.text.string, MXML_DESCEND) || + mxmlFindElement(doc, doc, "union", "name", + type->value.text.string, MXML_DESCEND)) + { + printf(""); + write_string(type->value.text.string, OUTPUT_HTML); + printf(""); + } + else + write_string(type->value.text.string, OUTPUT_HTML); + } + + puts(";"); + } + else + { + type = mxmlFindElement(scut, scut, "type", NULL, NULL, + MXML_DESCEND_FIRST); + if (type->last_child->value.text.string[0] != '*') + putchar(' '); + + printf("%s;\n", name); + } + + puts("

    "); + } + } + /* * List of structures... */ @@ -2915,30 +3014,29 @@ write_html( description = mxmlFindElement(scut, scut, "description", NULL, NULL, MXML_DESCEND_FIRST); printf("\n" - "

    %s%s

    \n", + "

    %s%s

    \n", get_comment_info(description), cname, cname); if (description) { - fputs("

    Description

    \n" - "

    ", stdout); + fputs("

    ", stdout); write_description(description, OUTPUT_HTML); + puts("

    "); } printf("

    Definition

    \n" - "

    \n" - "struct %s
    \n{
    \n", cname); + "

    struct %s {
    \n", cname); for (arg = mxmlFindElement(scut, scut, "variable", NULL, NULL, MXML_DESCEND_FIRST); arg; arg = mxmlFindElement(arg, scut, "variable", NULL, NULL, MXML_NO_DESCEND)) { - printf("  "); + fputs("    ", stdout); write_element(doc, mxmlFindElement(arg, arg, "type", NULL, NULL, MXML_DESCEND_FIRST), OUTPUT_HTML); - printf(" %s;
    \n", mxmlElementGetAttr(arg, "name")); + printf("%s;
    \n", mxmlElementGetAttr(arg, "name")); } for (function = mxmlFindElement(scut, scut, "function", NULL, NULL, @@ -2949,18 +3047,15 @@ write_html( { name = mxmlElementGetAttr(function, "name"); - printf("  "); + fputs("    ", stdout); arg = mxmlFindElement(function, function, "returnvalue", NULL, NULL, MXML_DESCEND_FIRST); if (arg) - { write_element(doc, mxmlFindElement(arg, arg, "type", NULL, NULL, MXML_DESCEND_FIRST), OUTPUT_HTML); - putchar(' '); - } else if (strcmp(cname, name) && strcmp(cname, name + 1)) fputs("void ", stdout); @@ -2980,10 +3075,8 @@ write_html( putchar(' '); if (type->child) - { write_element(doc, type, OUTPUT_HTML); - putchar(' '); - } + fputs(mxmlElementGetAttr(arg, "name"), stdout); if ((defval = mxmlElementGetAttr(arg, "default")) != NULL) printf(" %s", defval); @@ -2995,12 +3088,9 @@ write_html( puts(");
    "); } - puts("};

    \n" + puts("};

    \n" "

    Members

    \n" - "
    \n" - "\n" - ""); + "
    "); for (arg = mxmlFindElement(scut, scut, "variable", NULL, NULL, MXML_DESCEND_FIRST); @@ -3010,163 +3100,50 @@ write_html( { description = mxmlFindElement(arg, arg, "description", NULL, NULL, MXML_DESCEND_FIRST); - printf("
    "); + puts(""); } - for (function = mxmlFindElement(scut, scut, "function", NULL, NULL, - MXML_DESCEND_FIRST); - function; - function = mxmlFindElement(function, scut, "function", NULL, NULL, - MXML_NO_DESCEND)) - { - name = mxmlElementGetAttr(function, "name"); - description = mxmlFindElement(function, function, "description", NULL, - NULL, MXML_DESCEND_FIRST); - - printf(""); - } - - puts("
    NameDescription
    %s %s", + printf("
    %s %s
    \n
    ", mxmlElementGetAttr(arg, "name"), get_comment_info(description)); write_description(description, OUTPUT_HTML); - puts("
    %s() %s", - cname, name, name, get_comment_info(description)); - - write_description(description, OUTPUT_HTML); - - arg = mxmlFindElement(function, function, "returnvalue", NULL, - NULL, MXML_DESCEND_FIRST); - - if (arg) - { - fputs("\nReturns: ", stdout); - write_element(NULL, mxmlFindElement(arg, arg, "description", NULL, - NULL, MXML_DESCEND_FIRST), - OUTPUT_HTML); - } - - puts("
    "); - } - } - - /* - * List of types... - */ - - if (find_public(doc, doc, "typedef")) - { - puts("\n" - "

    Types

    \n" - ""); - - for (scut = find_public(doc, doc, "typedef"); - scut; - scut = find_public(scut, doc, "typedef")) - { - name = mxmlElementGetAttr(scut, "name"); - description = mxmlFindElement(scut, scut, "description", NULL, - NULL, MXML_DESCEND_FIRST); - printf("\n" - "

    %s%s

    \n", - get_comment_info(description), name, name); - - if (description) + if ((function = mxmlFindElement(scut, scut, "function", NULL, NULL, + MXML_DESCEND_FIRST)) != NULL) { - fputs("

    Description

    \n" - "

    ", stdout); - write_description(description, OUTPUT_HTML); - } + puts("\n" + "

    Methods

    \n" + "
    "); - fputs("

    Definition

    \n" - "

    \n" - "typedef ", stdout); - - type = mxmlFindElement(scut, scut, "type", NULL, NULL, - MXML_DESCEND_FIRST); - - for (type = type->child; type; type = type->next) - if (!strcmp(type->value.text.string, "(")) - break; - else + for (;function; + function = mxmlFindElement(function, scut, "function", NULL, NULL, + MXML_NO_DESCEND)) { - if (type->value.text.whitespace) - putchar(' '); - - if (mxmlFindElement(doc, doc, "class", "name", - type->value.text.string, MXML_DESCEND) || - mxmlFindElement(doc, doc, "enumeration", "name", - type->value.text.string, MXML_DESCEND) || - mxmlFindElement(doc, doc, "struct", "name", - type->value.text.string, MXML_DESCEND) || - mxmlFindElement(doc, doc, "typedef", "name", - type->value.text.string, MXML_DESCEND) || - mxmlFindElement(doc, doc, "union", "name", - type->value.text.string, MXML_DESCEND)) - { - printf(""); - write_string(type->value.text.string, OUTPUT_HTML); - printf(""); - } - else - write_string(type->value.text.string, OUTPUT_HTML); - } + name = mxmlElementGetAttr(function, "name"); + description = mxmlFindElement(function, function, "description", NULL, + NULL, MXML_DESCEND_FIRST); - if (type) - { - /* - * Output function type... - */ + printf("

    %s %s
    \n
    ", + cname, name, name, get_comment_info(description)); - printf(" (*%s", name); + write_description(description, OUTPUT_HTML); - for (type = type->next->next; type; type = type->next) - { - if (type->value.text.whitespace) - putchar(' '); + arg = mxmlFindElement(function, function, "returnvalue", NULL, + NULL, MXML_DESCEND_FIRST); - if (mxmlFindElement(doc, doc, "class", "name", - type->value.text.string, MXML_DESCEND) || - mxmlFindElement(doc, doc, "enumeration", "name", - type->value.text.string, MXML_DESCEND) || - mxmlFindElement(doc, doc, "struct", "name", - type->value.text.string, MXML_DESCEND) || - mxmlFindElement(doc, doc, "typedef", "name", - type->value.text.string, MXML_DESCEND) || - mxmlFindElement(doc, doc, "union", "name", - type->value.text.string, MXML_DESCEND)) + if (arg) { - printf(""); - write_string(type->value.text.string, OUTPUT_HTML); - printf(""); + puts("
    \nReturn Value
    "); + write_element(NULL, mxmlFindElement(arg, arg, "description", NULL, + NULL, MXML_DESCEND_FIRST), + OUTPUT_HTML); } - else - write_string(type->value.text.string, OUTPUT_HTML); - } - puts(";"); + puts("
    "); + } } - else - printf(" %s;\n", name); - puts("

    "); + puts("
    "); } } @@ -3200,38 +3177,33 @@ write_html( description = mxmlFindElement(scut, scut, "description", NULL, NULL, MXML_DESCEND_FIRST); printf("\n" - "

    %s%s

    \n", + "

    %s%s

    \n", get_comment_info(description), name, name); if (description) { - fputs("

    Description

    \n" - "

    ", stdout); + fputs("

    ", stdout); write_description(description, OUTPUT_HTML); + puts("

    "); } - printf("

    Definition

    \n" - "

    \n" - "union %s
    \n{
    \n", name); + printf("

    union %s {
    \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("  "); + fputs("    ", stdout); write_element(doc, mxmlFindElement(arg, arg, "type", NULL, NULL, MXML_DESCEND_FIRST), OUTPUT_HTML); - printf(" %s;
    \n", mxmlElementGetAttr(arg, "name")); + printf("%s;
    \n", mxmlElementGetAttr(arg, "name")); } - puts("};

    \n" + puts("};

    \n" "

    Members

    \n" - "
    \n" - "\n" - ""); + "
    "); for (arg = mxmlFindElement(scut, scut, "variable", NULL, NULL, MXML_DESCEND_FIRST); @@ -3241,15 +3213,15 @@ write_html( { description = mxmlFindElement(arg, arg, "description", NULL, NULL, MXML_DESCEND_FIRST); - printf("
    "); + puts(""); } - puts("
    NameDescription
    %s %s", + printf("
    %s %s
    \n
    ", mxmlElementGetAttr(arg, "name"), get_comment_info(description)); write_description(description, OUTPUT_HTML); - puts("
    "); + puts(""); } } @@ -3283,26 +3255,88 @@ write_html( description = mxmlFindElement(arg, arg, "description", NULL, NULL, MXML_DESCEND_FIRST); printf("\n" - "

    %s%s

    \n", + "

    %s%s

    \n", get_comment_info(description), name, name); if (description) { - fputs("

    Description

    \n" - "

    ", stdout); + fputs("

    ", stdout); write_description(description, OUTPUT_HTML); + puts("

    "); } - puts("

    Definition

    \n" - "

    "); + fputs("

    ", stdout); write_element(doc, mxmlFindElement(arg, arg, "type", NULL, NULL, MXML_DESCEND_FIRST), OUTPUT_HTML); - printf(" %s", mxmlElementGetAttr(arg, "name")); + fputs(mxmlElementGetAttr(arg, "name"), stdout); if ((defval = mxmlElementGetAttr(arg, "default")) != NULL) printf(" %s", defval); - puts(";

    "); + puts(";

    "); + } + } + + /* + * List of enumerations... + */ + + if (find_public(doc, doc, "enumeration")) + { + puts("\n" + "

    Constants

    \n" + ""); + + for (scut = find_public(doc, doc, "enumeration"); + scut; + scut = find_public(scut, doc, "enumeration")) + { + name = mxmlElementGetAttr(scut, "name"); + description = mxmlFindElement(scut, scut, "description", NULL, + NULL, MXML_DESCEND_FIRST); + printf("\n" + "

    %s%s

    \n", + get_comment_info(description), name, name); + + if (description) + { + fputs("

    ", stdout); + write_description(description, OUTPUT_HTML); + puts("

    "); + } + + puts("

    Constants

    \n" + "
    "); + + for (arg = mxmlFindElement(scut, scut, "constant", NULL, NULL, + MXML_DESCEND_FIRST); + arg; + arg = mxmlFindElement(arg, scut, "constant", NULL, NULL, + MXML_NO_DESCEND)) + { + description = mxmlFindElement(arg, arg, "description", NULL, + NULL, MXML_DESCEND_FIRST); + printf("
    %s %s
    \n
    ", + mxmlElementGetAttr(arg, "name"), get_comment_info(description)); + + write_description(description, OUTPUT_HTML); + + puts("
    "); + } + + puts("
    "); } } @@ -3423,7 +3457,7 @@ write_man( write_element(doc, mxmlFindElement(arg, arg, "type", NULL, NULL, MXML_DESCEND_FIRST), OUTPUT_MAN); - printf(" %s;\n", mxmlElementGetAttr(arg, "name")); + printf("%s;\n", mxmlElementGetAttr(arg, "name")); } for (function = mxmlFindElement(scut, scut, "function", "scope", @@ -3446,12 +3480,9 @@ write_man( NULL, MXML_DESCEND_FIRST); if (arg) - { write_element(doc, mxmlFindElement(arg, arg, "type", NULL, NULL, MXML_DESCEND_FIRST), OUTPUT_MAN); - putchar(' '); - } else if (strcmp(cname, name) && strcmp(cname, name + 1)) fputs("void ", stdout); @@ -3471,10 +3502,7 @@ write_man( putchar(' '); if (type->child) - { write_element(doc, type, OUTPUT_MAN); - putchar(' '); - } fputs(mxmlElementGetAttr(arg, "name"), stdout); if ((defval = mxmlElementGetAttr(arg, "default")) != NULL) printf(" %s", defval); @@ -3571,10 +3599,7 @@ write_man( printf("%c\n ", prefix); if (type->child) - { write_element(doc, type, OUTPUT_MAN); - putchar(' '); - } fputs(mxmlElementGetAttr(arg, "name"), stdout); if ((defval = mxmlElementGetAttr(arg, "default")) != NULL) printf(" %s", defval); @@ -3621,7 +3646,7 @@ write_man( write_element(doc, mxmlFindElement(arg, arg, "type", NULL, NULL, MXML_DESCEND_FIRST), OUTPUT_MAN); - printf(" %s;\n", mxmlElementGetAttr(arg, "name")); + printf("%s;\n", mxmlElementGetAttr(arg, "name")); } for (function = mxmlFindElement(scut, scut, "function", NULL, NULL, @@ -3638,12 +3663,9 @@ write_man( NULL, MXML_DESCEND_FIRST); if (arg) - { write_element(doc, mxmlFindElement(arg, arg, "type", NULL, NULL, MXML_DESCEND_FIRST), OUTPUT_MAN); - putchar(' '); - } else if (strcmp(cname, name) && strcmp(cname, name + 1)) fputs("void ", stdout); @@ -3663,10 +3685,7 @@ write_man( putchar(' '); if (type->child) - { write_element(doc, type, OUTPUT_MAN); - putchar(' '); - } fputs(mxmlElementGetAttr(arg, "name"), stdout); if ((defval = mxmlElementGetAttr(arg, "default")) != NULL) printf(" %s", defval); @@ -3776,7 +3795,7 @@ write_man( write_element(doc, mxmlFindElement(arg, arg, "type", NULL, NULL, MXML_DESCEND_FIRST), OUTPUT_MAN); - printf(" %s;\n", mxmlElementGetAttr(arg, "name")); + printf("%s;\n", mxmlElementGetAttr(arg, "name")); } puts("};\n.fi\n.PP"); @@ -3808,7 +3827,7 @@ write_man( write_element(doc, mxmlFindElement(arg, arg, "type", NULL, NULL, MXML_DESCEND_FIRST), OUTPUT_MAN); - printf(" %s", mxmlElementGetAttr(arg, "name")); + fputs(mxmlElementGetAttr(arg, "name"), stdout); if ((defval = mxmlElementGetAttr(arg, "default")) != NULL) printf(" %s", defval); puts(";\n.fi\n.PP");