From 474d6da1b46aff1e1036c4dcf76079fd5dd3313d Mon Sep 17 00:00:00 2001 From: Michael R Sweet Date: Thu, 19 Mar 2009 05:38:52 +0000 Subject: [PATCH] Fix mxmlEntityAddCallback and mxmlEntityRemoveCallback docos (STR #91) --- CHANGES | 2 +- doc/reference.html | 24 ++++++++++++++++++++++-- mxml-entity.c | 8 ++++---- mxml.h | 9 ++++++--- mxml.xml | 12 ++++++++++++ 5 files changed, 45 insertions(+), 10 deletions(-) diff --git a/CHANGES b/CHANGES index a4d27f7..b48185c 100644 --- a/CHANGES +++ b/CHANGES @@ -3,7 +3,7 @@ CHANGES - 2009-03-18 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 (STR #89) - The mxmldoc program now supports generating Xcode documentation diff --git a/doc/reference.html b/doc/reference.html index c96667c..60b6eec 100644 --- a/doc/reference.html +++ b/doc/reference.html @@ -207,6 +207,7 @@ using a SAX callback.">mxmlSAXLoadString
  • mxml_custom_save_cb_t
  • mxml_custom_t
  • mxml_element_t
  • +
  • mxml_entity_cb_t
  • mxml_error_cb_t
  • mxml_index_t
  • mxml_load_cb_t
  • @@ -360,7 +361,14 @@ is not an element.

    mxmlEntityAddCallback

    Add a callback to convert entities to Unicode.

    -int mxmlEntityAddCallback (void);

    +int mxmlEntityAddCallback (
    +    mxml_entity_cb_t cb
    +);

    +

    Parameters

    +
    +
    cb
    +
    Callback function to add
    +

    Return Value

    0 on success, -1 on failure

    mxmlEntityGetName

    @@ -397,7 +405,14 @@ name is not known.

    mxmlEntityRemoveCallback

    Remove a callback.

    -void mxmlEntityRemoveCallback (void);

    +void mxmlEntityRemoveCallback (
    +    mxml_entity_cb_t cb
    +);

    +

    Parameters

    +
    +
    cb
    +
    Callback function to remove
    +

    mxmlFindElement

    Find the named element.

    @@ -1385,6 +1400,11 @@ typedef struct mxml_custom_s mxml_custom_t;

    typedef struct mxml_element_s mxml_element_t;

    +

    mxml_entity_cb_t

    +

    Entity callback function

    +

    +typedef int (*mxml_entity_cb_t)(const char *); +

    mxml_error_cb_t

    Error callback function

    diff --git a/mxml-entity.c b/mxml-entity.c index 4416627..d7a9cb9 100644 --- a/mxml-entity.c +++ b/mxml-entity.c @@ -4,7 +4,7 @@ * Character entity support code 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 * modify it under the terms of the GNU Library General Public @@ -41,7 +41,7 @@ int /* O - 0 on success, -1 on failure */ 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(); /* Global data */ @@ -121,8 +121,8 @@ mxmlEntityGetValue(const char *name) /* I - Entity name */ */ void -mxmlEntityRemoveCallback(int (*cb)(const char *name)) - /* I - Callback function to remove */ +mxmlEntityRemoveCallback( + mxml_entity_cb_t cb) /* I - Callback function to remove */ { int i; /* Looping var */ _mxml_global_t *global = _mxml_global(); diff --git a/mxml.h b/mxml.h index 9efd0a2..2133cf9 100644 --- a/mxml.h +++ b/mxml.h @@ -3,7 +3,7 @@ * * 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 * 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 *); /**** 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 *); /**** Load callback function ****/ @@ -197,10 +200,10 @@ extern void mxmlElementSetAttrf(mxml_node_t *node, const char *name, __attribute__ ((__format__ (__printf__, 3, 4))) # 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 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, const char *name, const char *attr, const char *value, int descend); diff --git a/mxml.xml b/mxml.xml index 4f474da..a17bbb1 100644 --- a/mxml.xml +++ b/mxml.xml @@ -118,6 +118,10 @@ is not an element. 0 on success, -1 on failure Add a callback to convert entities to Unicode. + + mxml_entity_cb_t + Callback function to add + @@ -148,6 +152,10 @@ name is not known. Remove a callback. + + mxml_entity_cb_t + Callback function to remove + @@ -1138,6 +1146,10 @@ the walk to the node's children. struct mxml_element_s An XML element value. + + int(*)(const char *) + Entity callback function + void(*)(const char *) Error callback function