Fix mxmlEntityAddCallback and mxmlEntityRemoveCallback docos (STR #91)

This commit is contained in:
Michael R Sweet 2009-03-19 05:38:52 +00:00
parent 4d81aff146
commit 474d6da1b4
5 changed files with 45 additions and 10 deletions

View File

@ -3,7 +3,7 @@ CHANGES - 2009-03-18
CHANGES IN Mini-XML 2.6 CHANGES IN Mini-XML 2.6
- Documentation fixes (STR #92) - Documentation fixes (STR #91, STR #92)
- The XML parser now rejects UTF-8 XML files that start with a BOM - The XML parser now rejects UTF-8 XML files that start with a BOM
(STR #89) (STR #89)
- The mxmldoc program now supports generating Xcode documentation - The mxmldoc program now supports generating Xcode documentation

View File

@ -207,6 +207,7 @@ using a SAX callback.">mxmlSAXLoadString</a></li>
<li><a href="#mxml_custom_save_cb_t" title="Custom data save callback function">mxml_custom_save_cb_t</a></li> <li><a href="#mxml_custom_save_cb_t" title="Custom data save callback function">mxml_custom_save_cb_t</a></li>
<li><a href="#mxml_custom_t" title="An XML custom value. ">mxml_custom_t</a></li> <li><a href="#mxml_custom_t" title="An XML custom value. ">mxml_custom_t</a></li>
<li><a href="#mxml_element_t" title="An XML element value.">mxml_element_t</a></li> <li><a href="#mxml_element_t" title="An XML element value.">mxml_element_t</a></li>
<li><a href="#mxml_entity_cb_t" title="Entity callback function">mxml_entity_cb_t</a></li>
<li><a href="#mxml_error_cb_t" title="Error callback function">mxml_error_cb_t</a></li> <li><a href="#mxml_error_cb_t" title="Error callback function">mxml_error_cb_t</a></li>
<li><a href="#mxml_index_t" title="An XML node index.">mxml_index_t</a></li> <li><a href="#mxml_index_t" title="An XML node index.">mxml_index_t</a></li>
<li><a href="#mxml_load_cb_t" title="Load callback function">mxml_load_cb_t</a></li> <li><a href="#mxml_load_cb_t" title="Load callback function">mxml_load_cb_t</a></li>
@ -360,7 +361,14 @@ is not an element.
<h3 class="function"><a name="mxmlEntityAddCallback">mxmlEntityAddCallback</a></h3> <h3 class="function"><a name="mxmlEntityAddCallback">mxmlEntityAddCallback</a></h3>
<p class="description">Add a callback to convert entities to Unicode.</p> <p class="description">Add a callback to convert entities to Unicode.</p>
<p class="code"> <p class="code">
int mxmlEntityAddCallback (void);</p> int mxmlEntityAddCallback (<br>
&nbsp;&nbsp;&nbsp;&nbsp;<a href="#mxml_entity_cb_t">mxml_entity_cb_t</a> cb<br>
);</p>
<h4 class="parameters">Parameters</h4>
<dl>
<dt>cb</dt>
<dd class="description">Callback function to add</dd>
</dl>
<h4 class="returnvalue">Return Value</h4> <h4 class="returnvalue">Return Value</h4>
<p class="description">0 on success, -1 on failure</p> <p class="description">0 on success, -1 on failure</p>
<h3 class="function"><a name="mxmlEntityGetName">mxmlEntityGetName</a></h3> <h3 class="function"><a name="mxmlEntityGetName">mxmlEntityGetName</a></h3>
@ -397,7 +405,14 @@ name is not known.</p>
<h3 class="function"><a name="mxmlEntityRemoveCallback">mxmlEntityRemoveCallback</a></h3> <h3 class="function"><a name="mxmlEntityRemoveCallback">mxmlEntityRemoveCallback</a></h3>
<p class="description">Remove a callback.</p> <p class="description">Remove a callback.</p>
<p class="code"> <p class="code">
void mxmlEntityRemoveCallback (void);</p> void mxmlEntityRemoveCallback (<br>
&nbsp;&nbsp;&nbsp;&nbsp;<a href="#mxml_entity_cb_t">mxml_entity_cb_t</a> cb<br>
);</p>
<h4 class="parameters">Parameters</h4>
<dl>
<dt>cb</dt>
<dd class="description">Callback function to remove</dd>
</dl>
<h3 class="function"><a name="mxmlFindElement">mxmlFindElement</a></h3> <h3 class="function"><a name="mxmlFindElement">mxmlFindElement</a></h3>
<p class="description">Find the named element.</p> <p class="description">Find the named element.</p>
<p class="code"> <p class="code">
@ -1385,6 +1400,11 @@ typedef struct <a href="#mxml_custom_s">mxml_custom_s</a> mxml_custom_t;
<p class="code"> <p class="code">
typedef struct <a href="#mxml_element_s">mxml_element_s</a> mxml_element_t; typedef struct <a href="#mxml_element_s">mxml_element_s</a> mxml_element_t;
</p> </p>
<h3 class="typedef"><a name="mxml_entity_cb_t">mxml_entity_cb_t</a></h3>
<p class="description">Entity callback function</p>
<p class="code">
typedef int (*mxml_entity_cb_t)(const char *);
</p>
<h3 class="typedef"><a name="mxml_error_cb_t">mxml_error_cb_t</a></h3> <h3 class="typedef"><a name="mxml_error_cb_t">mxml_error_cb_t</a></h3>
<p class="description">Error callback function</p> <p class="description">Error callback function</p>
<p class="code"> <p class="code">

View File

@ -4,7 +4,7 @@
* Character entity support code for Mini-XML, a small XML-like * Character entity support code for Mini-XML, a small XML-like
* file parsing library. * file parsing library.
* *
* Copyright 2003-2007 by Michael Sweet. * Copyright 2003-2009 by Michael Sweet.
* *
* This program is free software; you can redistribute it and/or * This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU Library General Public * modify it under the terms of the GNU Library General Public
@ -41,7 +41,7 @@
int /* O - 0 on success, -1 on failure */ int /* O - 0 on success, -1 on failure */
mxmlEntityAddCallback( mxmlEntityAddCallback(
int (*cb)(const char *name)) /* I - Callback function to add */ mxml_entity_cb_t cb) /* I - Callback function to add */
{ {
_mxml_global_t *global = _mxml_global(); _mxml_global_t *global = _mxml_global();
/* Global data */ /* Global data */
@ -121,8 +121,8 @@ mxmlEntityGetValue(const char *name) /* I - Entity name */
*/ */
void void
mxmlEntityRemoveCallback(int (*cb)(const char *name)) mxmlEntityRemoveCallback(
/* I - Callback function to remove */ mxml_entity_cb_t cb) /* I - Callback function to remove */
{ {
int i; /* Looping var */ int i; /* Looping var */
_mxml_global_t *global = _mxml_global(); _mxml_global_t *global = _mxml_global();

9
mxml.h
View File

@ -3,7 +3,7 @@
* *
* Header file for Mini-XML, a small XML-like file parsing library. * Header file for Mini-XML, a small XML-like file parsing library.
* *
* Copyright 2003-2007 by Michael Sweet. * Copyright 2003-2009 by Michael Sweet.
* *
* This program is free software; you can redistribute it and/or * This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU Library General Public * modify it under the terms of the GNU Library General Public
@ -161,6 +161,9 @@ typedef int (*mxml_custom_load_cb_t)(mxml_node_t *, const char *);
typedef char *(*mxml_custom_save_cb_t)(mxml_node_t *); typedef char *(*mxml_custom_save_cb_t)(mxml_node_t *);
/**** Custom data save callback function ****/ /**** Custom data save callback function ****/
typedef int (*mxml_entity_cb_t)(const char *);
/**** Entity callback function */
typedef mxml_type_t (*mxml_load_cb_t)(mxml_node_t *); typedef mxml_type_t (*mxml_load_cb_t)(mxml_node_t *);
/**** Load callback function ****/ /**** Load callback function ****/
@ -197,10 +200,10 @@ extern void mxmlElementSetAttrf(mxml_node_t *node, const char *name,
__attribute__ ((__format__ (__printf__, 3, 4))) __attribute__ ((__format__ (__printf__, 3, 4)))
# endif /* __GNUC__ */ # endif /* __GNUC__ */
; ;
extern int mxmlEntityAddCallback(int (*cb)(const char *name)); extern int mxmlEntityAddCallback(mxml_entity_cb_t cb);
extern const char *mxmlEntityGetName(int val); extern const char *mxmlEntityGetName(int val);
extern int mxmlEntityGetValue(const char *name); extern int mxmlEntityGetValue(const char *name);
extern void mxmlEntityRemoveCallback(int (*cb)(const char *name)); extern void mxmlEntityRemoveCallback(mxml_entity_cb_t cb);
extern mxml_node_t *mxmlFindElement(mxml_node_t *node, mxml_node_t *top, extern mxml_node_t *mxmlFindElement(mxml_node_t *node, mxml_node_t *top,
const char *name, const char *attr, const char *name, const char *attr,
const char *value, int descend); const char *value, int descend);

View File

@ -118,6 +118,10 @@ is not an element.
<description>0 on success, -1 on failure</description> <description>0 on success, -1 on failure</description>
</returnvalue> </returnvalue>
<description>Add a callback to convert entities to Unicode.</description> <description>Add a callback to convert entities to Unicode.</description>
<argument name="cb" direction="I">
<type>mxml_entity_cb_t</type>
<description>Callback function to add</description>
</argument>
</function> </function>
<function name="mxmlEntityGetName"> <function name="mxmlEntityGetName">
<returnvalue> <returnvalue>
@ -148,6 +152,10 @@ name is not known.</description>
</function> </function>
<function name="mxmlEntityRemoveCallback"> <function name="mxmlEntityRemoveCallback">
<description>Remove a callback.</description> <description>Remove a callback.</description>
<argument name="cb" direction="I">
<type>mxml_entity_cb_t</type>
<description>Callback function to remove</description>
</argument>
</function> </function>
<function name="mxmlFindElement"> <function name="mxmlFindElement">
<returnvalue> <returnvalue>
@ -1138,6 +1146,10 @@ the walk to the node's children.</description>
<type>struct mxml_element_s</type> <type>struct mxml_element_s</type>
<description>An XML element value.</description> <description>An XML element value.</description>
</typedef> </typedef>
<typedef name="mxml_entity_cb_t">
<type>int(*)(const char *)</type>
<description>Entity callback function</description>
</typedef>
<typedef name="mxml_error_cb_t"> <typedef name="mxml_error_cb_t">
<type>void(*)(const char *)</type> <type>void(*)(const char *)</type>
<description>Error callback function</description> <description>Error callback function</description>