From 885cf929af326cb6a1b6d4fd09a68f43ecd46339 Mon Sep 17 00:00:00 2001 From: Michael R Sweet Date: Thu, 4 Mar 2004 21:51:30 +0000 Subject: [PATCH] Update mxmldoc to produce HTMLDOC-friendly HTML files. --- CHANGES | 4 +- documentation.html | 650 ++++++++++++++++++++++----------------------- mxmldoc.c | 131 ++++----- 3 files changed, 396 insertions(+), 389 deletions(-) diff --git a/CHANGES b/CHANGES index 2211406..3f18fea 100644 --- a/CHANGES +++ b/CHANGES @@ -1,8 +1,10 @@ -README - 02/04/2004 +README - 03/04/2004 ------------------- CHANGES IN Mini-XML 1.3.1 + - Updated the mxmldoc output to be more compatible with + embedding in manuals produced with HTMLDOC. - The makefile incorrectly included a "/" separator between the destination path and install path. This caused problems when building and installing with diff --git a/documentation.html b/documentation.html index 2bca923..953d19e 100644 --- a/documentation.html +++ b/documentation.html @@ -1,5 +1,5 @@ - + Documentation -

Contents

+

Contents

-
-

Enumerations

+ +

Enumerations

-

mxml_type_e

+

mxml_type_e

The XML node type.

-

Values

-

- +

Values

+

NameDescription
+ @@ -34,39 +34,39 @@
NameDescription
MXML_ELEMENTXML element with attributes
MXML_INTEGERInteger value
MXML_REALReal value
MXML_TEXTText fragment

-
-

Functions

+ +

Functions

-

mxmlAdd()

+

mxmlAdd()

Add a node to a tree. Adds the specified node to the parent. If the child argument is not @@ -75,129 +75,129 @@ 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

+

Syntax

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

Arguments

-

- +

Arguments

+

NameDescription
+
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

+

Returns

Nothing.

-

mxmlDelete()

+

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

+

Syntax

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

Arguments

-

- +

Arguments

+

NameDescription
+
NameDescription
nodeNode to delete

-

Returns

+

Returns

Nothing.

-

mxmlElementGetAttr()

+

mxmlElementGetAttr()

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

-

Syntax

+

Syntax

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

Arguments

-

- +

Arguments

+

NameDescription
+
NameDescription
nodeElement node
nameName of attribute

-

Returns

+

Returns

Attribute value or NULL

-

mxmlElementSetAttr()

+

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

+

Syntax

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

Arguments

-

- +

Arguments

+

NameDescription
+
NameDescription
nodeElement node
nameName of attribute
valueAttribute value

-

Returns

+

Returns

Nothing.

-

mxmlEntityGetName()

+

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

+

Syntax

 const char *
 mxmlEntityGetName(
     int val);
 
-

Arguments

-

- +

Arguments

+

NameDescription
+
NameDescription
valCharacter value

-

Returns

+

Returns

Entity name or NULL

-

mxmlEntityGetValue()

+

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

+

Syntax

 int
 mxmlEntityGetValue(
     const char * name);
 
-

Arguments

-

- +

Arguments

+

NameDescription
+
NameDescription
nameEntity name

-

Returns

+

Returns

Character value or -1 on error

-

mxmlFindElement()

+

mxmlFindElement()

Find the named element. The search is constrained by the name, attribute name, and value; any @@ -208,20 +208,20 @@ 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

+

Syntax

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

Arguments

-

- +

Arguments

+

NameDescription
+ @@ -230,9 +230,9 @@ mxmlFindElement(
NameDescription
nodeCurrent node
topTop node
valueAttribute value, or NULL for any
descendDescend into tree - MXML_DESCEND, MXML_NO_DESCEND, or MXML_DESCEND_FIRST

-

Returns

+

Returns

Element node or NULL

-

mxmlLoadFile()

+

mxmlLoadFile()

Load a file into an XML node tree. The nodes in the specified file are added to the specified top node. @@ -245,25 +245,25 @@ 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

+

Syntax

-mxml_node_t *
+mxml_node_t *
 mxmlLoadFile(
-    mxml_node_t * top,
+    mxml_node_t * top,
     FILE * fp,
-    mxml_type_t (*cb)(mxml_node_t *node));
+    mxml_type_t (*cb)(mxml_node_t *node));
 
-

Arguments

-

- +

Arguments

+

NameDescription
+
NameDescription
topTop node
fpFile to read from
(*cb)(mxml_node_t *node)Callback function or MXML_NO_CALLBACK

-

Returns

+

Returns

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

-

mxmlLoadString()

+

mxmlLoadString()

Load a string into an XML node tree. The nodes in the specified string are added to the specified top node. @@ -276,114 +276,114 @@ 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

+

Syntax

-mxml_node_t *
+mxml_node_t *
 mxmlLoadString(
-    mxml_node_t * top,
+    mxml_node_t * top,
     const char * s,
-    mxml_type_t (*cb)(mxml_node_t *node));
+    mxml_type_t (*cb)(mxml_node_t *node));
 
-

Arguments

-

- +

Arguments

+

NameDescription
+
NameDescription
topTop node
sString to load
(*cb)(mxml_node_t *node)Callback function or MXML_NO_CALLBACK

-

Returns

+

Returns

First node or NULL if the string has errors.

-

mxmlNewElement()

+

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

+

Syntax

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

Arguments

-

- +

Arguments

+

NameDescription
+
NameDescription
parentParent node or MXML_NO_PARENT
nameName of element

-

Returns

+

Returns

New node

-

mxmlNewInteger()

+

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

+

Syntax

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

Arguments

-

- +

Arguments

+

NameDescription
+
NameDescription
parentParent node or MXML_NO_PARENT
integerInteger value

-

Returns

+

Returns

New node

-

mxmlNewOpaque()

+

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

+

Syntax

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

Arguments

-

- +

Arguments

+

NameDescription
+
NameDescription
parentParent node or MXML_NO_PARENT
opaqueOpaque string

-

Returns

+

Returns

New node

-

mxmlNewReal()

+

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

+

Syntax

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

Arguments

-

- +

Arguments

+

NameDescription
+
NameDescription
parentParent node or MXML_NO_PARENT
realReal number value

-

Returns

+

Returns

New node

-

mxmlNewText()

+

mxmlNewText()

Create a new text fragment node. The new text node is added to the end of the specified parent's child @@ -391,25 +391,25 @@ 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

+

Syntax

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

Arguments

-

- +

Arguments

+

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

-

Returns

+

Returns

New node

-

mxmlNewTextf()

+

mxmlNewTextf()

Create a new formatted text fragment node. The new text node is added to the end of the specified parent's child @@ -417,46 +417,46 @@ 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

+

Syntax

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

Arguments

-

- +

Arguments

+

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

-

Returns

+

Returns

New node

-

mxmlRemove()

+

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

+

Syntax

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

Arguments

-

- +

Arguments

+

NameDescription
+
NameDescription
nodeNode to remove

-

Returns

+

Returns

Nothing.

-

mxmlSaveAllocString()

+

mxmlSaveAllocString()

Save an XML node tree to an allocated string. This function returns a pointer to a string containing the textual @@ -464,23 +464,23 @@ representation of the XML node tree. The string should be freed using the free() function when you are done with it. NULL is returned if the node would produce an empty string or if the string cannot be allocated.

-

Syntax

+

Syntax

 char *
 mxmlSaveAllocString(
-    mxml_node_t * node,
+    mxml_node_t * node,
     int (*cb)(mxml_node_t *node, int ws));
 
-

Arguments

-

- +

Arguments

+

NameDescription
+
NameDescription
nodeNode to write
(*cb)(mxml_node_t *node, int ws)Whitespace callback or MXML_NO_CALLBACK

-

Returns

+

Returns

Allocated string or NULL

-

mxmlSaveFile()

+

mxmlSaveFile()

Save an XML tree to a file. The callback argument specifies a function that returns a whitespace @@ -488,251 +488,251 @@ character or nul (0) 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

+

Syntax

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

Arguments

-

- +

Arguments

+

NameDescription
+
NameDescription
nodeNode to write
fpFile to write to
(*cb)(mxml_node_t *node, int ws)Whitespace callback or MXML_NO_CALLBACK

-

Returns

+

Returns

0 on success, -1 on error.

-

mxmlSaveString()

+

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 into the specified buffer.

-

Syntax

+

Syntax

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

Arguments

-

- +

Arguments

+

NameDescription
+
NameDescription
nodeNode to write
bufferString buffer
bufsizeSize of string buffer
(*cb)(mxml_node_t *node, int ws)Whitespace callback or MXML_NO_CALLBACK

-

Returns

+

Returns

Size of string

-

mxmlSetElement()

+

mxmlSetElement()

Set the name of an element node. The node is not changed if it is not an element node.

-

Syntax

+

Syntax

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

Arguments

-

- +

Arguments

+

NameDescription
+
NameDescription
nodeNode to set
nameNew name string

-

Returns

+

Returns

0 on success, -1 on failure

-

mxmlSetErrorCallback()

+

mxmlSetErrorCallback()

Set the error message callback.

-

Syntax

+

Syntax

 void
 mxmlSetErrorCallback(
     void (*cb)(const char *));
 
-

Arguments

-

- +

Arguments

+

NameDescription
+
NameDescription
(*cb)(const char *)Error callback function

-

Returns

+

Returns

Nothing.

-

mxmlSetInteger()

+

mxmlSetInteger()

Set the value of an integer node. The node is not changed if it is not an integer node.

-

Syntax

+

Syntax

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

Arguments

-

- +

Arguments

+

NameDescription
+
NameDescription
nodeNode to set
integerInteger value

-

Returns

+

Returns

0 on success, -1 on failure

-

mxmlSetOpaque()

+

mxmlSetOpaque()

Set the value of an opaque node. The node is not changed if it is not an opaque node.

-

Syntax

+

Syntax

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

Arguments

-

- +

Arguments

+

NameDescription
+
NameDescription
nodeNode to set
opaqueOpaque string

-

Returns

+

Returns

0 on success, -1 on failure

-

mxmlSetReal()

+

mxmlSetReal()

Set the value of a real number node. The node is not changed if it is not a real number node.

-

Syntax

+

Syntax

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

Arguments

-

- +

Arguments

+

NameDescription
+
NameDescription
nodeNode to set
realReal number value

-

Returns

+

Returns

0 on success, -1 on failure

-

mxmlSetText()

+

mxmlSetText()

Set the value of a text node. The node is not changed if it is not a text node.

-

Syntax

+

Syntax

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

Arguments

-

- +

Arguments

+

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

-

Returns

+

Returns

0 on success, -1 on failure

-

mxmlSetTextf()

+

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

+

Syntax

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

Arguments

-

- +

Arguments

+

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

-

Returns

+

Returns

0 on success, -1 on failure

-

mxmlWalkNext()

+

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

+

Syntax

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

Arguments

-

- +

Arguments

+

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

-

Returns

+

Returns

Next node or NULL

-

mxmlWalkPrev()

+

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

+

Syntax

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

Arguments

-

- +

Arguments

+

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

-

Returns

+

Returns

Previous node or NULL

-
-

Structures

+ +

Structures

-

mxml_attr_s

+

mxml_attr_s

An XML element attribute value.

-

Definition

+

Definition

 struct mxml_attr_s
 {
@@ -740,31 +740,31 @@ struct mxml_attr_s
   char * value;
 };
 
-

Members

-

- +

Members

+

NameDescription
+
NameDescription
nameAttribute name
valueAttribute value

-

mxml_node_s

+

mxml_node_s

An XML node.

-

Definition

+

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;
-  mxml_type_t type;
-  mxml_value_t value;
+  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;
+  mxml_type_t type;
+  mxml_value_t value;
 };
 
-

Members

-

- +

Members

+

NameDescription
+ @@ -774,9 +774,9 @@ struct mxml_node_s
NameDescription
childFirst child node
last_childLast child node
typeNode type
valueNode value

-

mxml_text_s

+

mxml_text_s

An XML text value.

-

Definition

+

Definition

 struct mxml_text_s
 {
@@ -784,99 +784,99 @@ struct mxml_text_s
   int whitespace;
 };
 
-

Members

-

- +

Members

+

NameDescription
+
NameDescription
stringFragment string
whitespaceLeading whitespace?

-

mxml_value_s

+

mxml_value_s

An XML element value.

-

Definition

+

Definition

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

Members

-

- +

Members

+

NameDescription
+
NameDescription
attrsAttributes
nameName of element
num_attrsNumber of attributes

-
-

Types

+ +

Types

-

mxml_attr_t

+

mxml_attr_t

An XML element attribute value.

-

Definition

+

Definition

-typedef struct mxml_attr_s mxml_attr_t;
+typedef struct mxml_attr_s mxml_attr_t;
 
-

mxml_element_t

+

mxml_element_t

An XML element value.

-

Definition

+

Definition

-typedef struct mxml_value_s mxml_element_t;
+typedef struct mxml_value_s mxml_element_t;
 
-

mxml_node_t

+

mxml_node_t

An XML node.

-

Definition

+

Definition

-typedef struct mxml_node_s mxml_node_t;
+typedef struct mxml_node_s mxml_node_t;
 
-

mxml_text_t

+

mxml_text_t

An XML text value.

-

Definition

+

Definition

-typedef struct mxml_text_s mxml_text_t;
+typedef struct mxml_text_s mxml_text_t;
 
-

mxml_type_t

+

mxml_type_t

The XML node type.

-

Definition

+

Definition

-typedef enum mxml_type_e mxml_type_t;
+typedef enum mxml_type_e mxml_type_t;
 
-

mxml_value_t

+

mxml_value_t

An XML node value.

-

Definition

+

Definition

-typedef union mxml_value_u mxml_value_t;
+typedef union mxml_value_u mxml_value_t;
 
-
-

Unions

+ +

Unions

-

mxml_value_u

+

mxml_value_u

An XML node value.

-

Definition

+

Definition

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

Members

-

- +

Members

+

NameDescription
+ diff --git a/mxmldoc.c b/mxmldoc.c index c3784d8..6f59934 100644 --- a/mxmldoc.c +++ b/mxmldoc.c @@ -1,5 +1,5 @@ /* - * "$Id: mxmldoc.c,v 1.23 2003/12/19 02:56:11 mike Exp $" + * "$Id: mxmldoc.c,v 1.24 2004/03/04 21:51:30 mike Exp $" * * Documentation generator using mini-XML, a small XML-like file parsing * library. @@ -1497,7 +1497,7 @@ write_documentation(mxml_node_t *doc) /* I - XML documentation */ puts(""); - puts(""); + puts(""); puts(""); puts("\tDocumentation"); puts("\t
NameDescription
elementElement
integerInteger number