Merge pull request #7 from Tieske/master

updated request for https://github.com/mrjimenez/pupnp/pull/6
This commit is contained in:
Marcelo Roberto Jimenez 2012-11-13 13:17:19 -08:00
commit 6a9baf6058
18 changed files with 194 additions and 75 deletions

5
.gitignore vendored
View File

@ -109,4 +109,7 @@ docs/doxygen
/build/vc10/out.vc9.Win32/Debug
/build/vc10/out.vc10.Win32
/build/vc10/out.vc10.x64
/pthreads
/pthreads
/build/vc10/ipch
/build/vc10/IUpnpErrFile.txt
/build/vc10/IUpnpInfoFile.txt

View File

@ -2,6 +2,23 @@
Version 1.8.0
*******************************************************************************
2012-07-11 Thijs Schreijer <thijs(at)thijsschreijer.nl>
Changed param to const UpnpAcceptSubscriptionExt() for consistency
2012-06-07 Thijs Schreijer <thijs(at)thijsschreijer.nl>
updated ixmlDocument_createAttributeEx() and ixmlDocument_createAttribute()
to use parameter DOMString instead of char * (same but now consistent)
2012-05-06 Thijs Schreijer <thijs(at)thijsschreijer.nl>
Added script support (directive SCRIPTSUPPORT) for better support of
garbage collected script languages. The node element gets a custom tag
through ixmlNode_setCTag() and ixmlNode_getCTag(). And a callback upon
releasing the node resources can be set using ixmlSetBeforeFree()
See updated readme for usage.
2012-03-24 Fabrice Fontaine <fabrice.fontaine(at)orange.com>
SF Bug Tracker id 3510595 - UpnpDownloadXmlDoc : can't get the file

View File

@ -1029,7 +1029,7 @@ INCLUDE_FILE_PATTERNS =
# undefined via #undef or recursively expanded use the := operator
# instead of the = operator.
PREDEFINED = DEBUG UPNP_HAVE_TOOLS INCLUDE_DEVICE_APIS INCLUDE_CLIENT_APIS EXCLUDE_GENA=0 EXCLUDE_DOM=0
PREDEFINED = DEBUG UPNP_HAVE_TOOLS INCLUDE_DEVICE_APIS INCLUDE_CLIENT_APIS SCRIPTSUPPORT EXCLUDE_GENA=0 EXCLUDE_DOM=0
# If the MACRO_EXPANSION and EXPAND_ONLY_PREDEF tags are set to YES then
# this tag can be used to specify a list of macro names that should be expanded.

51
README
View File

@ -17,6 +17,7 @@ sections:
6. Product Release Notes
7. New Features
8. Support and Contact Information
9. IXML support for scriptinglanguages
1) Release Contents
@ -343,3 +344,53 @@ us know.
* Other brands, names, and trademarks are the property of their respective
owners.
9. IXML support for scriptinglanguages
-------------------------------------------
The treestructure of XML documents created by IXML is hard to maintain when
creating a binding for a scripting language. Even when many elements may
never be used on the script side, it requires copying the entire tree
structure once you start accessing elements several levels deep.
Hence scriptsupport was added. To enable it compile while SCRIPTSUPPORT has
been defined. This allows control using only a list instead of a tree-like
structure, and only nodes actually accessed need to be created instead of
all the nodes in the tree.
Here's how its supposed to work;
* The scriptsupport allows you to add a callback when a node is freed on
the C side, so appropriate action can be taken on the script side, see
function ixmlSetBeforeFree().
* Instead of recreating the tree structure, an intermediate object should
be created only for the nodes actually accessed. The object should be
containing a pointer to the node and a 'valid flag' which is initially
set to TRUE (the valid flag, can simply be the pointer to the node being
NULL or not). Before creating the intermediate object, the custom tag
'ctag' can be used to check whether one was already created.
* the node object gets an extra 'void* ctag' field, a custom tag to make a
cross reference to the script side intermediate object. It can be set
using ixmlNode_setCTag(), and read using ixmlNode_getCTag(). Whenever
a new intermediate object is created, the ctag of the coirresponding
node should be set to point to this intermediate object.
* The tree structure traversal is done on the C side (looking up parents,
children and siblings)
* Every intermediate object created should be kept in a list (preferably a
key-value list, where the key is the pointer to the node and the value is
the pointer to the intermediate object)
* when the callback is called, the node should be looked up in the list,
the flag set to false, the pointer to the C-side node be cleared and on
the C-side the ctag should be cleared.
* whenever the intermediate object is accessed and its flag is set to False,
an error should be thrown that the XML document has been closed.
Freeing resources can be done in 2 ways, C side by simply calling the free
node methods, or script side by the garbage collector of the scriptengine.
Scriptside steps;
* if the valid flag is set to False (XML document is closed), then the
intermediate object can be destroyed, no further action
* if the node has a parent, then the intermediate object can be destroyed
after the ctag on the corresponding node has been cleared. Nothing needs
to be freed on the C-side.
* if the node has no parent, then the node must be freed on the C side by
calling the corresponding free node methods. This will result in a chain
of callbacks closing the node and all underlying nodes.

View File

@ -1,3 +1,4 @@
*.suo
*.user
*.user
*.sdf

View File

@ -1,4 +1,4 @@
<?xml version="1.0" encoding="utf-8"?>
<?xml version="1.0" encoding="utf-8"?>
<Project DefaultTargets="Build" ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<ItemGroup Label="ProjectConfigurations">
<ProjectConfiguration Include="Debug Lib|Win32">
@ -158,7 +158,7 @@
<ClCompile>
<Optimization>Disabled</Optimization>
<AdditionalIncludeDirectories>..\..\ixml\inc;..\..\ixml\src\inc;..\inc;..\..\upnp\inc;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
<PreprocessorDefinitions>DEBUG;WIN32;_USRDLL;LIBUPNP_EXPORTS;UPNP_USE_MSVCPP;_CRT_NONSTDC_NO_WARNINGS;_CRT_NONSTDC_NO_DEPRECATE;_CRT_SECURE_NO_WARNINGS;_CRT_SECURE_NO_DEPRECATE;_SECURE_SCL;_SCL_SECURE_NO_WARNINGS;_SCL_SECURE_NO_DEPRECATE;_AFX_SECURE_NO_WARNINGS;_AFX_SECURE_NO_DEPRECATE;_SECURE_ATL;_ATL_NO_COM_SUPPORT;_ATL_SECURE_NO_WARNINGS;_ATL_SECURE_NO_DEPRECATE;%(PreprocessorDefinitions)</PreprocessorDefinitions>
<PreprocessorDefinitions>DEBUG;WIN32;_USRDLL;LIBUPNP_EXPORTS;UPNP_USE_MSVCPP;SCRIPTSUPPORT;_CRT_NONSTDC_NO_WARNINGS;_CRT_NONSTDC_NO_DEPRECATE;_CRT_SECURE_NO_WARNINGS;_CRT_SECURE_NO_DEPRECATE;_SECURE_SCL;_SCL_SECURE_NO_WARNINGS;_SCL_SECURE_NO_DEPRECATE;_AFX_SECURE_NO_WARNINGS;_AFX_SECURE_NO_DEPRECATE;_SECURE_ATL;_ATL_NO_COM_SUPPORT;_ATL_SECURE_NO_WARNINGS;_ATL_SECURE_NO_DEPRECATE;%(PreprocessorDefinitions)</PreprocessorDefinitions>
<MinimalRebuild>true</MinimalRebuild>
<BasicRuntimeChecks>EnableFastChecks</BasicRuntimeChecks>
<RuntimeLibrary>MultiThreadedDebugDLL</RuntimeLibrary>
@ -206,7 +206,7 @@
<InlineFunctionExpansion>Default</InlineFunctionExpansion>
<IntrinsicFunctions>true</IntrinsicFunctions>
<AdditionalIncludeDirectories>..\..\ixml\inc;..\..\ixml\src\inc;..\inc;..\..\upnp\inc;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
<PreprocessorDefinitions>WIN32;NDEBUG;_WINDOWS;_USRDLL;LIBUPNP_EXPORTS;UPNP_USE_MSVCPP;_CRT_NONSTDC_NO_WARNINGS;_CRT_NONSTDC_NO_DEPRECATE;_CRT_SECURE_NO_WARNINGS;_CRT_SECURE_NO_DEPRECATE;_SECURE_SCL;_SCL_SECURE_NO_WARNINGS;_SCL_SECURE_NO_DEPRECATE;_AFX_SECURE_NO_WARNINGS;_AFX_SECURE_NO_DEPRECATE;_SECURE_ATL;_ATL_NO_COM_SUPPORT;_ATL_SECURE_NO_WARNINGS;_ATL_SECURE_NO_DEPRECATE;%(PreprocessorDefinitions)</PreprocessorDefinitions>
<PreprocessorDefinitions>WIN32;NDEBUG;_WINDOWS;_USRDLL;LIBUPNP_EXPORTS;UPNP_USE_MSVCPP;SCRIPTSUPPORT;_CRT_NONSTDC_NO_WARNINGS;_CRT_NONSTDC_NO_DEPRECATE;_CRT_SECURE_NO_WARNINGS;_CRT_SECURE_NO_DEPRECATE;_SECURE_SCL;_SCL_SECURE_NO_WARNINGS;_SCL_SECURE_NO_DEPRECATE;_AFX_SECURE_NO_WARNINGS;_AFX_SECURE_NO_DEPRECATE;_SECURE_ATL;_ATL_NO_COM_SUPPORT;_ATL_SECURE_NO_WARNINGS;_ATL_SECURE_NO_DEPRECATE;%(PreprocessorDefinitions)</PreprocessorDefinitions>
<StringPooling>true</StringPooling>
<RuntimeLibrary>MultiThreadedDLL</RuntimeLibrary>
<FunctionLevelLinking>true</FunctionLevelLinking>

View File

@ -292,7 +292,7 @@
<ClCompile>
<Optimization>Disabled</Optimization>
<AdditionalIncludeDirectories>..\inc;..\msvc;..\..\upnp\inc;..\..\upnp\src\inc;..\..\ixml\inc;..\..\ixml\src\inc;..\..\threadutil\inc;..\..\pthreads;..\..\pthreads\include;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
<PreprocessorDefinitions>DEBUG;WIN32;_USRDLL;LIBUPNP_EXPORTS;UPNP_USE_MSVCPP;_CRT_NONSTDC_NO_WARNINGS;_CRT_NONSTDC_NO_DEPRECATE;_CRT_SECURE_NO_WARNINGS;_CRT_SECURE_NO_DEPRECATE;_SECURE_SCL;_SCL_SECURE_NO_WARNINGS;_SCL_SECURE_NO_DEPRECATE;_AFX_SECURE_NO_WARNINGS;_AFX_SECURE_NO_DEPRECATE;_SECURE_ATL;_ATL_NO_COM_SUPPORT;_ATL_SECURE_NO_WARNINGS;_ATL_SECURE_NO_DEPRECATE;%(PreprocessorDefinitions)</PreprocessorDefinitions>
<PreprocessorDefinitions>DEBUG;WIN32;_USRDLL;LIBUPNP_EXPORTS;UPNP_USE_MSVCPP;SCRIPTSUPPORT;_CRT_NONSTDC_NO_WARNINGS;_CRT_NONSTDC_NO_DEPRECATE;_CRT_SECURE_NO_WARNINGS;_CRT_SECURE_NO_DEPRECATE;_SECURE_SCL;_SCL_SECURE_NO_WARNINGS;_SCL_SECURE_NO_DEPRECATE;_AFX_SECURE_NO_WARNINGS;_AFX_SECURE_NO_DEPRECATE;_SECURE_ATL;_ATL_NO_COM_SUPPORT;_ATL_SECURE_NO_WARNINGS;_ATL_SECURE_NO_DEPRECATE;%(PreprocessorDefinitions)</PreprocessorDefinitions>
<MinimalRebuild>true</MinimalRebuild>
<BasicRuntimeChecks>EnableFastChecks</BasicRuntimeChecks>
<RuntimeLibrary>MultiThreadedDebugDLL</RuntimeLibrary>
@ -300,7 +300,6 @@
</PrecompiledHeaderOutputFile>
<AssemblerListingLocation>$(IntDir)</AssemblerListingLocation>
<ObjectFileName>$(IntDir)</ObjectFileName>
<ProgramDataBaseFileName>$(IntDir)$(ProjectName).pdb</ProgramDataBaseFileName>
<BrowseInformation>
</BrowseInformation>
<WarningLevel>Level3</WarningLevel>
@ -318,7 +317,6 @@
<SuppressStartupBanner>true</SuppressStartupBanner>
<AdditionalLibraryDirectories>..\..\pthreads\;..\..\pthreads\lib;$(OutDir)..\lib\ixml;$(OutDir)..\lib\threadutil;%(AdditionalLibraryDirectories)</AdditionalLibraryDirectories>
<GenerateDebugInformation>true</GenerateDebugInformation>
<ProgramDatabaseFile>$(OutDir)$(ProjectName).pdb</ProgramDatabaseFile>
<SubSystem>Windows</SubSystem>
<RandomizedBaseAddress>false</RandomizedBaseAddress>
<DataExecutionPrevention>
@ -574,31 +572,20 @@
<ItemGroup>
<ClCompile Include="..\..\upnp\src\api\ActionComplete.c" />
<ClCompile Include="..\..\upnp\src\api\ActionRequest.c" />
<ClCompile Include="..\..\ixml\src\attr.c" />
<ClCompile Include="..\..\upnp\src\genlib\client_table\client_table.c" />
<ClCompile Include="..\..\upnp\src\genlib\client_table\ClientSubscription.c" />
<ClCompile Include="..\..\upnp\src\api\Discovery.c" />
<ClCompile Include="..\..\ixml\src\document.c" />
<ClCompile Include="..\..\ixml\src\element.c" />
<ClCompile Include="..\..\upnp\src\api\Event.c" />
<ClCompile Include="..\..\upnp\src\api\EventSubscribe.c" />
<ClCompile Include="..\..\upnp\src\api\FileInfo.c" />
<ClCompile Include="..\..\threadutil\src\FreeList.c" />
<ClCompile Include="..\..\upnp\src\gena\gena_callback2.c" />
<ClCompile Include="..\..\upnp\src\gena\gena_ctrlpt.c" />
<ClCompile Include="..\..\upnp\src\gena\gena_device.c" />
<ClCompile Include="..\..\upnp\src\genlib\net\http\httpparser.c" />
<ClCompile Include="..\..\upnp\src\genlib\net\http\httpreadwrite.c" />
<ClCompile Include="..\..\ixml\src\ixml.c" />
<ClCompile Include="..\..\ixml\src\ixmlmembuf.c" />
<ClCompile Include="..\..\ixml\src\ixmlparser.c" />
<ClCompile Include="..\..\threadutil\src\LinkedList.c" />
<ClCompile Include="..\..\upnp\src\uuid\md5.c" />
<ClCompile Include="..\..\upnp\src\genlib\util\membuffer.c" />
<ClCompile Include="..\..\upnp\src\genlib\miniserver\miniserver.c" />
<ClCompile Include="..\..\ixml\src\namedNodeMap.c" />
<ClCompile Include="..\..\ixml\src\node.c" />
<ClCompile Include="..\..\ixml\src\nodeList.c" />
<ClCompile Include="..\..\upnp\src\genlib\net\http\parsetools.c" />
<ClCompile Include="..\..\upnp\src\genlib\service_table\service_table.c" />
<ClCompile Include="..\..\upnp\src\soap\soap_common.c" />
@ -615,8 +602,6 @@
<ClCompile Include="..\..\upnp\src\genlib\util\strintmap.c" />
<ClCompile Include="..\..\upnp\src\api\SubscriptionRequest.c" />
<ClCompile Include="..\..\upnp\src\uuid\sysdep.c" />
<ClCompile Include="..\..\threadutil\src\ThreadPool.c" />
<ClCompile Include="..\..\threadutil\src\TimerThread.c" />
<ClCompile Include="..\..\upnp\src\genlib\util\upnp_timeout.c" />
<ClCompile Include="..\..\upnp\src\api\upnpapi.c" />
<ClCompile Include="..\..\upnp\src\api\upnpdebug.c" />

View File

@ -17,9 +17,6 @@
<ClCompile Include="..\..\upnp\src\api\ActionRequest.c">
<Filter>sources</Filter>
</ClCompile>
<ClCompile Include="..\..\ixml\src\attr.c">
<Filter>sources</Filter>
</ClCompile>
<ClCompile Include="..\..\upnp\src\genlib\client_table\client_table.c">
<Filter>sources</Filter>
</ClCompile>
@ -29,12 +26,6 @@
<ClCompile Include="..\..\upnp\src\api\Discovery.c">
<Filter>sources</Filter>
</ClCompile>
<ClCompile Include="..\..\ixml\src\document.c">
<Filter>sources</Filter>
</ClCompile>
<ClCompile Include="..\..\ixml\src\element.c">
<Filter>sources</Filter>
</ClCompile>
<ClCompile Include="..\..\upnp\src\api\Event.c">
<Filter>sources</Filter>
</ClCompile>
@ -44,9 +35,6 @@
<ClCompile Include="..\..\upnp\src\api\FileInfo.c">
<Filter>sources</Filter>
</ClCompile>
<ClCompile Include="..\..\threadutil\src\FreeList.c">
<Filter>sources</Filter>
</ClCompile>
<ClCompile Include="..\..\upnp\src\gena\gena_callback2.c">
<Filter>sources</Filter>
</ClCompile>
@ -62,18 +50,6 @@
<ClCompile Include="..\..\upnp\src\genlib\net\http\httpreadwrite.c">
<Filter>sources</Filter>
</ClCompile>
<ClCompile Include="..\..\ixml\src\ixml.c">
<Filter>sources</Filter>
</ClCompile>
<ClCompile Include="..\..\ixml\src\ixmlmembuf.c">
<Filter>sources</Filter>
</ClCompile>
<ClCompile Include="..\..\ixml\src\ixmlparser.c">
<Filter>sources</Filter>
</ClCompile>
<ClCompile Include="..\..\threadutil\src\LinkedList.c">
<Filter>sources</Filter>
</ClCompile>
<ClCompile Include="..\..\upnp\src\uuid\md5.c">
<Filter>sources</Filter>
</ClCompile>
@ -83,15 +59,6 @@
<ClCompile Include="..\..\upnp\src\genlib\miniserver\miniserver.c">
<Filter>sources</Filter>
</ClCompile>
<ClCompile Include="..\..\ixml\src\namedNodeMap.c">
<Filter>sources</Filter>
</ClCompile>
<ClCompile Include="..\..\ixml\src\node.c">
<Filter>sources</Filter>
</ClCompile>
<ClCompile Include="..\..\ixml\src\nodeList.c">
<Filter>sources</Filter>
</ClCompile>
<ClCompile Include="..\..\upnp\src\genlib\net\http\parsetools.c">
<Filter>sources</Filter>
</ClCompile>
@ -140,12 +107,6 @@
<ClCompile Include="..\..\upnp\src\uuid\sysdep.c">
<Filter>sources</Filter>
</ClCompile>
<ClCompile Include="..\..\threadutil\src\ThreadPool.c">
<Filter>sources</Filter>
</ClCompile>
<ClCompile Include="..\..\threadutil\src\TimerThread.c">
<Filter>sources</Filter>
</ClCompile>
<ClCompile Include="..\..\upnp\src\genlib\util\upnp_timeout.c">
<Filter>sources</Filter>
</ClCompile>

View File

@ -163,7 +163,6 @@
<BasicRuntimeChecks>EnableFastChecks</BasicRuntimeChecks>
<RuntimeLibrary>MultiThreadedDebugDLL</RuntimeLibrary>
<AssemblerListingLocation>$(IntDir)</AssemblerListingLocation>
<ProgramDataBaseFileName>$(IntDir)$(ProjectName).pdb</ProgramDataBaseFileName>
<WarningLevel>Level3</WarningLevel>
<DebugInformationFormat>ProgramDatabase</DebugInformationFormat>
<CompileAs>CompileAsC</CompileAs>
@ -172,7 +171,6 @@
<AdditionalDependencies>pthreadVC2.lib;ixml.lib;threadutil.lib;libupnp.lib;%(AdditionalDependencies)</AdditionalDependencies>
<AdditionalLibraryDirectories>..\..\pthreads\;..\..\pthreads\lib;$(OutDir)..\lib\libupnp;$(OutDir)..\lib\threadutil;$(OutDir)..\lib\ixml;$(OutDir)..\bin;%(AdditionalLibraryDirectories)</AdditionalLibraryDirectories>
<GenerateDebugInformation>true</GenerateDebugInformation>
<ProgramDatabaseFile>$(OutDir)$(ProjectName).pdb</ProgramDatabaseFile>
<SubSystem>Console</SubSystem>
<TargetMachine>MachineX86</TargetMachine>
</Link>

View File

@ -158,6 +158,13 @@ typedef struct _IXML_Document *Docptr;
typedef struct _IXML_Node *Nodeptr;
#ifdef SCRIPTSUPPORT
/*!
* \brief Signature for GC support method, called before a node is freed.
*/
typedef void (*IXML_BeforeFreeNode_t) (Nodeptr obj);
#endif
/*!
* \brief Data structure common to all types of nodes.
@ -178,6 +185,9 @@ typedef struct _IXML_Node
Nodeptr nextSibling;
Nodeptr firstAttr;
Docptr ownerDocument;
#ifdef SCRIPTSUPPORT
void* ctag; // custom tag
#endif
} IXML_Node;
@ -263,6 +273,8 @@ extern "C" {
* The \b Node interface forms the primary datatype for all other DOM
* objects. Every other interface is derived from this interface, inheriting
* its functionality. For more information, refer to DOM2-Core page 34.
* (Note: within the IXML library the NamedNodeMap and NodeList interfaces are
* the only interfaces that are not DOM objects and hence do not inherit from Node)
*
* @{
*/
@ -314,7 +326,8 @@ EXPORT_SPEC int ixmlNode_setNodeValue(
/*!
* \brief Retrieves the type of a \b Node.
* \brief Retrieves the type of a \b Node. Note that not all possible
* return values are actually implemented.
*
* \return An enum IXML_NODE_TYPE representing the type of the \b Node.
*/
@ -625,9 +638,29 @@ EXPORT_SPEC BOOL ixmlNode_hasAttributes(
* \brief Frees a \b Node and all \b Nodes in its subtree.
*/
EXPORT_SPEC void ixmlNode_free(
/*! [in] The \b Node tree to free. */
/*! [in] The \b Node tree to free. Before it is freed, the handler
* set by \b ixmlSetBeforeFree will be called, the order will be
* top-down.
*/
IXML_Node *nodeptr);
#ifdef SCRIPTSUPPORT
/*!
* \brief Sets the custom tag for the node.
*/
EXPORT_SPEC void ixmlNode_setCTag(
/*! [in] The \b Node to which to attach the tag. */
IXML_Node *nodeptr,
/*! [in] The \b tag to attach. */
void *ctag);
/*!
* \brief Gets the custom tag for the node.
*/
EXPORT_SPEC void* ixmlNode_getCTag(
/*! [in] The \b Node from which to get the tag. */
IXML_Node *nodeptr);
#endif
/* @} Interface Node */
@ -871,7 +904,7 @@ EXPORT_SPEC IXML_Attr *ixmlDocument_createAttribute(
/*! [in] The owner \b Document of the new node. */
IXML_Document *doc,
/*! [in] The name of the new attribute. */
const char *name);
const DOMString name);
/*!
@ -892,7 +925,7 @@ EXPORT_SPEC int ixmlDocument_createAttributeEx(
/*! [in] The owner \b Document of the new node. */
IXML_Document *doc,
/*! [in] The name of the new attribute. */
const char *name,
const DOMString name,
/*! [out] A pointer to a \b Attr where the new object will be stored. */
IXML_Attr **attrNode);
@ -1737,6 +1770,18 @@ EXPORT_SPEC void ixmlRelaxParser(
*/
char errorChar);
#ifdef SCRIPTSUPPORT
/*!
* \brief Sets the handler to call before a node is freed.
*/
EXPORT_SPEC void ixmlSetBeforeFree(
/*! [in] If \b hndlr is set to a function, it will be called before any
* node is freed, with the node as its parameter. This allows scripting
* languages to do their garbage collection, without maintaining their
* own tree structure.
*/
IXML_BeforeFreeNode_t hndlr);
#endif
/*!
* \brief Parses an XML text buffer converting it into an IXML DOM representation.

View File

@ -281,7 +281,7 @@ IXML_Node *ixmlDocument_createTextNode(
int ixmlDocument_createAttributeEx(
IXML_Document *doc,
const char *name,
const DOMString name,
IXML_Attr **rtAttr)
{
IXML_Attr *attrNode = NULL;
@ -322,7 +322,7 @@ ErrorHandler:
IXML_Attr *ixmlDocument_createAttribute(
IXML_Document *doc,
const char *name)
const DOMString name)
{
IXML_Attr *attrNode = NULL;

View File

@ -120,6 +120,25 @@ void Parser_setErrorChar(
/*! [in] The character to become the error character. */
char c);
#ifdef SCRIPTSUPPORT
/*!
* \brief Sets the handler to call before a node is freed.
*
* If \b hndlr is set to a function, it will be called before any
* node is freed, with the node as its parameter. This allows scripting
* languages to do their garbage collection, without maintaining their
* own tree structure.
*/
void Parser_setBeforeFree(
/*! [in] The handler callback to call before each node to be freed. */
IXML_BeforeFreeNode_t hndlr);
/*!
* \brief Gets the handler to call before a node is freed.
*/
IXML_BeforeFreeNode_t Parser_getBeforeFree();
#endif
/*!
* \brief Fees a node contents.

View File

@ -417,6 +417,13 @@ void ixmlRelaxParser(char errorChar)
Parser_setErrorChar(errorChar);
}
#ifdef SCRIPTSUPPORT
void ixmlSetBeforeFree(IXML_BeforeFreeNode_t hndlr)
{
Parser_setBeforeFree(hndlr);
}
#endif
int ixmlParseBufferEx(const char *buffer, IXML_Document **retDoc)
{

View File

@ -55,6 +55,9 @@
static char g_error_char = '\0';
#ifdef SCRIPTSUPPORT
static IXML_BeforeFreeNode_t Before_Free_callback;
#endif
static const char LESSTHAN = '<';
@ -2498,6 +2501,17 @@ void Parser_setErrorChar(char c)
g_error_char = c;
}
#ifdef SCRIPTSUPPORT
void Parser_setBeforeFree(IXML_BeforeFreeNode_t hndlr)
{
Before_Free_callback = hndlr;
}
IXML_BeforeFreeNode_t Parser_getBeforeFree()
{
return Before_Free_callback;
}
#endif
/*!
* \brief Initializes a xml parser.

View File

@ -107,6 +107,10 @@ static void ixmlNode_freeSingleNode(
void ixmlNode_free(IXML_Node *nodeptr)
{
if (nodeptr != NULL) {
#ifdef SCRIPTSUPPORT
IXML_BeforeFreeNode_t hndlr = Parser_getBeforeFree();
if (hndlr != NULL) hndlr(nodeptr);
#endif
ixmlNode_free(nodeptr->firstChild);
ixmlNode_free(nodeptr->nextSibling);
ixmlNode_free(nodeptr->firstAttr);
@ -1380,3 +1384,17 @@ ErrorHandler:
return IXML_INSUFFICIENT_MEMORY;
}
#ifdef SCRIPTSUPPORT
void ixmlNode_setCTag(IXML_Node *nodeptr, void *ctag)
{
if (nodeptr != NULL) nodeptr->ctag = ctag;
}
void* ixmlNode_getCTag(IXML_Node *nodeptr)
{
if (nodeptr != NULL)
return nodeptr->ctag;
else
return NULL;
}
#endif

View File

@ -1492,7 +1492,7 @@ EXPORT_SPEC int UpnpAcceptSubscriptionExt(
* Plug and Play Device Architecture specification. */
IXML_Document *PropSet,
/*! [in] The subscription ID of the newly registered control point. */
Upnp_SID SubsId);
const Upnp_SID SubsId);
/*!
* \brief Sends out an event change notification to all control points

View File

@ -2522,7 +2522,7 @@ int UpnpAcceptSubscriptionExt(
const char *DevID_const,
const char *ServName_const,
IXML_Document *PropSet,
Upnp_SID SubsId)
const Upnp_SID SubsId)
{
int ret = 0;
int line = 0;

View File

@ -41,14 +41,14 @@ typedef struct _uuid_upnp {
/*!
* \brief Generate a UUID.
*/
int uuid_create(
EXPORT_SPEC int uuid_create(
/*! . */
uuid_upnp * id);
/*!
* \brief Out will be xxxx-xx-xx-xx-xxxxxx format.
*/
void uuid_unpack(
EXPORT_SPEC void uuid_unpack(
/*! . */
uuid_upnp * u,
/*! . */
@ -57,7 +57,7 @@ void uuid_unpack(
/*!
* \brief Create a UUID using a "name" from a "name space"
*/
void uuid_create_from_name(
EXPORT_SPEC void uuid_create_from_name(
/*! Resulting UUID. */
uuid_upnp * uid,
/*! UUID to serve as context, so identical names from different name
@ -78,7 +78,7 @@ void uuid_create_from_name(
*
* \note Lexical ordering is not temporal ordering!
*/
int uuid_compare(
EXPORT_SPEC int uuid_compare(
/*! . */
uuid_upnp * u1,
/*! . */