[Date Prev][Date Next] [Thread Prev][Thread Next]
[Thread Index]
[Date Index]
[Author Index]
Re: [xml] patch: custom I/O BufferCreateFilename handlers
- From: "Rob Richards" <rrichards ctindustries net>
- To: <veillard redhat com>
- Cc: xml gnome org
- Subject: Re: [xml] patch: custom I/O BufferCreateFilename handlers
- Date: Mon, 7 Jun 2004 15:54:30 -0400
From: Daniel Veillard
> Well your previous patch is in CVS, so a patch again CVS will be fine
:-)
Here's the latest against CVS.
Quick summary of changes:
moved xmlParserInputBufferCreateFilenameDefault and
xmlOutputBufferCreateFilenameDefault to xmlIO files
- allows these to be used on a per thread basis (otherwise needed to
move to top of globals file due to all the def/undef statements)
if not previously set, setting the defaults will return the default
functionality rather than NULL
Rob
Index: globals.c
===================================================================
RCS file: /cvs/gnome/gnome-xml/globals.c,v
retrieving revision 1.39
diff -c -r1.39 globals.c
*** a/globals.c 3 Jun 2004 02:11:24 -0000 1.39
--- b/globals.c 7 Jun 2004 19:29:28 -0000
***************
*** 650,672 ****
return(old);
}
- /**
- * xmlParserInputBufferCreateFilename:
- * @func: function pointer to the new ParserInputBufferCreateFilenameFunc
- *
- * Registers a callback for URI input file handling
- *
- * Returns the old value of the registration function
- */
- xmlParserInputBufferCreateFilenameFunc
- xmlParserInputBufferCreateFilenameDefault(xmlParserInputBufferCreateFilenameFunc func)
- {
- xmlParserInputBufferCreateFilenameFunc old = xmlParserInputBufferCreateFilenameValue;
-
- xmlParserInputBufferCreateFilenameValue = func;
- return(old);
- }
-
xmlParserInputBufferCreateFilenameFunc
xmlThrDefParserInputBufferCreateFilenameDefault(xmlParserInputBufferCreateFilenameFunc func)
{
--- 650,655 ----
***************
*** 674,703 ****
xmlMutexLock(xmlThrDefMutex);
old = xmlParserInputBufferCreateFilenameValueThrDef;
!
xmlParserInputBufferCreateFilenameValueThrDef = func;
xmlMutexUnlock(xmlThrDefMutex);
return(old);
}
- /**
- * xmlOutputBufferCreateFilename:
- * @func: function pointer to the new OutputBufferCreateFilenameFunc
- *
- * Registers a callback for URI output file handling
- *
- * Returns the old value of the registration function
- */
- xmlOutputBufferCreateFilenameFunc
- xmlOutputBufferCreateFilenameDefault(xmlOutputBufferCreateFilenameFunc func)
- {
- xmlOutputBufferCreateFilenameFunc old = xmlOutputBufferCreateFilenameValue;
-
- xmlOutputBufferCreateFilenameValue = func;
- return(old);
- }
-
xmlOutputBufferCreateFilenameFunc
xmlThrDefOutputBufferCreateFilenameDefault(xmlOutputBufferCreateFilenameFunc func)
{
--- 657,672 ----
xmlMutexLock(xmlThrDefMutex);
old = xmlParserInputBufferCreateFilenameValueThrDef;
! if (old == NULL) {
! old = __xmlParserInputBufferCreateFilename;
! }
!
xmlParserInputBufferCreateFilenameValueThrDef = func;
xmlMutexUnlock(xmlThrDefMutex);
return(old);
}
xmlOutputBufferCreateFilenameFunc
xmlThrDefOutputBufferCreateFilenameDefault(xmlOutputBufferCreateFilenameFunc func)
{
***************
*** 705,711 ****
xmlMutexLock(xmlThrDefMutex);
old = xmlOutputBufferCreateFilenameValueThrDef;
!
xmlOutputBufferCreateFilenameValueThrDef = func;
xmlMutexUnlock(xmlThrDefMutex);
--- 674,684 ----
xmlMutexLock(xmlThrDefMutex);
old = xmlOutputBufferCreateFilenameValueThrDef;
! #ifdef LIBXML_OUTPUT_ENABLED
! if (old == NULL) {
! old = __xmlOutputBufferCreateFilename;
! }
! #endif
xmlOutputBufferCreateFilenameValueThrDef = func;
xmlMutexUnlock(xmlThrDefMutex);
***************
*** 1071,1074 ****
else
return (&xmlGetGlobalState()->xmlOutputBufferCreateFilenameValue);
}
-
--- 1044,1046 ----
Index: xmlIO.c
===================================================================
RCS file: /cvs/gnome/gnome-xml/xmlIO.c,v
retrieving revision 1.145
diff -c -r1.145 xmlIO.c
*** a/xmlIO.c 2 Jun 2004 16:18:40 -0000 1.145
--- b/xmlIO.c 7 Jun 2004 19:29:30 -0000
***************
*** 2125,2131 ****
}
#endif /* LIBXML_OUTPUT_ENABLED */
! static xmlParserInputBufferPtr
__xmlParserInputBufferCreateFilename(const char *URI, xmlCharEncoding enc) {
xmlParserInputBufferPtr ret;
int i = 0;
--- 2125,2131 ----
}
#endif /* LIBXML_OUTPUT_ENABLED */
! xmlParserInputBufferPtr
__xmlParserInputBufferCreateFilename(const char *URI, xmlCharEncoding enc) {
xmlParserInputBufferPtr ret;
int i = 0;
***************
*** 2205,2211 ****
}
#ifdef LIBXML_OUTPUT_ENABLED
! static xmlOutputBufferPtr
__xmlOutputBufferCreateFilename(const char *URI,
xmlCharEncodingHandlerPtr encoder,
int compression ATTRIBUTE_UNUSED) {
--- 2205,2211 ----
}
#ifdef LIBXML_OUTPUT_ENABLED
! xmlOutputBufferPtr
__xmlOutputBufferCreateFilename(const char *URI,
xmlCharEncodingHandlerPtr encoder,
int compression ATTRIBUTE_UNUSED) {
***************
*** 2599,2604 ****
--- 2599,2645 ----
#endif /* LIBXML_OUTPUT_ENABLED */
/**
+ * xmlParserInputBufferCreateFilenameDefault:
+ * @func: function pointer to the new ParserInputBufferCreateFilenameFunc
+ *
+ * Registers a callback for URI input file handling
+ *
+ * Returns the old value of the registration function
+ */
+ xmlParserInputBufferCreateFilenameFunc
+ xmlParserInputBufferCreateFilenameDefault(xmlParserInputBufferCreateFilenameFunc func)
+ {
+ xmlParserInputBufferCreateFilenameFunc old = xmlParserInputBufferCreateFilenameValue;
+ if (old == NULL) {
+ old = __xmlParserInputBufferCreateFilename;
+ }
+
+ xmlParserInputBufferCreateFilenameValue = func;
+ return(old);
+ }
+
+ /**
+ * xmlOutputBufferCreateFilenameDefault:
+ * @func: function pointer to the new OutputBufferCreateFilenameFunc
+ *
+ * Registers a callback for URI output file handling
+ *
+ * Returns the old value of the registration function
+ */
+ xmlOutputBufferCreateFilenameFunc
+ xmlOutputBufferCreateFilenameDefault(xmlOutputBufferCreateFilenameFunc func)
+ {
+ xmlOutputBufferCreateFilenameFunc old = xmlOutputBufferCreateFilenameValue;
+ #ifdef LIBXML_OUTPUT_ENABLED
+ if (old == NULL) {
+ old = __xmlOutputBufferCreateFilename;
+ }
+ #endif
+ xmlOutputBufferCreateFilenameValue = func;
+ return(old);
+ }
+
+ /**
* xmlParserInputBufferPush:
* @in: a buffered parser input
* @len: the size in bytes of the array.
Index: include/libxml/globals.h
===================================================================
RCS file: /cvs/gnome/gnome-xml/include/libxml/globals.h,v
retrieving revision 1.22
diff -c -r1.22 globals.h
*** a/include/libxml/globals.h 2 Jun 2004 16:18:40 -0000 1.22
--- b/include/libxml/globals.h 7 Jun 2004 19:29:30 -0000
***************
*** 69,77 ****
typedef void (*xmlRegisterNodeFunc) (xmlNodePtr node);
typedef void (*xmlDeregisterNodeFunc) (xmlNodePtr node);
- typedef xmlParserInputBufferPtr (*xmlParserInputBufferCreateFilenameFunc) (const char *URI, xmlCharEncoding enc);
- typedef xmlOutputBufferPtr (*xmlOutputBufferCreateFilenameFunc) (const char *URI, xmlCharEncodingHandlerPtr encoder, int compression);
-
typedef struct _xmlGlobalState xmlGlobalState;
typedef xmlGlobalState *xmlGlobalStatePtr;
struct _xmlGlobalState
--- 69,74 ----
***************
*** 139,149 ****
XMLPUBFUN xmlDeregisterNodeFunc XMLCALL xmlDeregisterNodeDefault(xmlDeregisterNodeFunc func);
XMLPUBFUN xmlDeregisterNodeFunc XMLCALL xmlThrDefDeregisterNodeDefault(xmlDeregisterNodeFunc func);
! XMLPUBFUN xmlParserInputBufferCreateFilenameFunc XMLCALL xmlParserInputBufferCreateFilenameDefault(xmlParserInputBufferCreateFilenameFunc func);
! XMLPUBFUN xmlParserInputBufferCreateFilenameFunc XMLCALL xmlThrDefParserInputBufferCreateFilenameDefault(xmlParserInputBufferCreateFilenameFunc func);
!
! XMLPUBFUN xmlOutputBufferCreateFilenameFunc XMLCALL xmlOutputBufferCreateFilenameDefault(xmlOutputBufferCreateFilenameFunc func);
! XMLPUBFUN xmlOutputBufferCreateFilenameFunc XMLCALL xmlThrDefOutputBufferCreateFilenameDefault(xmlOutputBufferCreateFilenameFunc func);
/** DOC_DISABLE */
/*
--- 136,145 ----
XMLPUBFUN xmlDeregisterNodeFunc XMLCALL xmlDeregisterNodeDefault(xmlDeregisterNodeFunc func);
XMLPUBFUN xmlDeregisterNodeFunc XMLCALL xmlThrDefDeregisterNodeDefault(xmlDeregisterNodeFunc func);
! XMLPUBFUN xmlOutputBufferCreateFilenameFunc XMLCALL
! xmlThrDefOutputBufferCreateFilenameDefault(xmlOutputBufferCreateFilenameFunc func);
! XMLPUBFUN xmlParserInputBufferCreateFilenameFunc XMLCALL
! xmlThrDefParserInputBufferCreateFilenameDefault(xmlParserInputBufferCreateFilenameFunc func);
/** DOC_DISABLE */
/*
Index: include/libxml/xmlIO.h
===================================================================
RCS file: /cvs/gnome/gnome-xml/include/libxml/xmlIO.h,v
retrieving revision 1.53
diff -c -r1.53 xmlIO.h
*** a/include/libxml/xmlIO.h 14 May 2004 03:25:14 -0000 1.53
--- b/include/libxml/xmlIO.h 7 Jun 2004 19:29:30 -0000
***************
*** 62,67 ****
--- 62,70 ----
*/
typedef int (*xmlInputCloseCallback) (void * context);
+ typedef xmlParserInputBufferPtr (*xmlParserInputBufferCreateFilenameFunc) (const char *URI, xmlCharEncoding enc);
+ typedef xmlOutputBufferPtr (*xmlOutputBufferCreateFilenameFunc) (const char *URI, xmlCharEncodingHandlerPtr encoder, int compression);
+
#ifdef LIBXML_OUTPUT_ENABLED
/*
* Those are the functions and datatypes for the library output
***************
*** 206,211 ****
--- 209,224 ----
xmlInputOpenCallback openFunc,
xmlInputReadCallback readFunc,
xmlInputCloseCallback closeFunc);
+
+ XMLPUBFUN xmlParserInputBufferCreateFilenameFunc XMLCALL
+ xmlParserInputBufferCreateFilenameDefault (xmlParserInputBufferCreateFilenameFunc func);
+ XMLPUBFUN xmlOutputBufferCreateFilenameFunc XMLCALL
+ xmlOutputBufferCreateFilenameDefault (xmlOutputBufferCreateFilenameFunc func);
+
+ xmlParserInputBufferPtr
+ __xmlParserInputBufferCreateFilename(const char *URI,
+ xmlCharEncoding enc);
+
#ifdef LIBXML_OUTPUT_ENABLED
/*
* Interfaces for output
***************
*** 258,263 ****
--- 271,281 ----
xmlOutputOpenCallback openFunc,
xmlOutputWriteCallback writeFunc,
xmlOutputCloseCallback closeFunc);
+
+ xmlOutputBufferPtr
+ __xmlOutputBufferCreateFilename(const char *URI,
+ xmlCharEncodingHandlerPtr encoder,
+ int compression);
#endif /* LIBXML_OUTPUT_ENABLED */
/* This function only exists if HTTP support built into the library */
[Date Prev][Date Next] [Thread Prev][Thread Next]
[Thread Index]
[Date Index]
[Author Index]