[Expat-checkins] CVS: expat/lib Makefile.in,1.2,1.3 expat.h,1.2,1.3 xmlparse.c,1.2,1.3
Clark Cooper
coopercc@users.sourceforge.net
Sat, 23 Sep 2000 20:43:40 -0700
Update of /cvsroot/expat/expat/lib
In directory slayer.i.sourceforge.net:/tmp/cvs-serv26511/lib
Modified Files:
Makefile.in expat.h xmlparse.c
Log Message:
Added dynamic malloc substitution. Added libtool versioning.
Index: Makefile.in
===================================================================
RCS file: /cvsroot/expat/expat/lib/Makefile.in,v
retrieving revision 1.2
retrieving revision 1.3
diff -C2 -r1.2 -r1.3
*** Makefile.in 2000/09/21 21:20:18 1.2
--- Makefile.in 2000/09/24 03:43:37 1.3
***************
*** 81,93 ****
CONFIG_CLEAN_FILES =
! DEFS = @DEFS@ -I. -I$(srcdir) -I..
CPPFLAGS = @CPPFLAGS@
LDFLAGS = @LDFLAGS@
LIBS = @LIBS@
CFLAGS = @CFLAGS@
COMPILE = $(CC) $(DEFS) $(INCLUDES) $(CPPFLAGS) $(CFLAGS)
LTCOMPILE = $(LIBTOOL) --mode=compile $(CC) $(DEFS) $(INCLUDES) $(CPPFLAGS) $(CFLAGS)
CCLD = $(CC)
! LINK = $(LIBTOOL) --mode=link $(CCLD) $(CFLAGS) $(LDFLAGS) -o $@
DIST_COMMON = Makefile.in
--- 81,98 ----
CONFIG_CLEAN_FILES =
! DEFS = @DEFS@ -I$(srcdir) -I..
CPPFLAGS = @CPPFLAGS@
LDFLAGS = @LDFLAGS@
LIBS = @LIBS@
CFLAGS = @CFLAGS@
+
+ LIBREVISION = @LIBREVISION@
+ LIBCURRENT = @LIBCURRENT@
+ LIBAGE = @LIBAGE@
+
COMPILE = $(CC) $(DEFS) $(INCLUDES) $(CPPFLAGS) $(CFLAGS)
LTCOMPILE = $(LIBTOOL) --mode=compile $(CC) $(DEFS) $(INCLUDES) $(CPPFLAGS) $(CFLAGS)
CCLD = $(CC)
! LINK = $(LIBTOOL) --mode=link $(CCLD) -version-info $(LIBCURRENT):$(LIBREVISION):$(LIBAGE) $(CFLAGS) $(LDFLAGS) -o $@
DIST_COMMON = Makefile.in
***************
*** 170,178 ****
done
! xmlparse.o: xmlparse.c expat.h xmlrole.h xmltok.h $(top_builddir)/config.h
! xmlrole.o: xmlrole.c ascii.h xmldef.h xmlrole.h $(top_builddir)/config.h
! xmltok.o: xmltok.c xmltok_impl.c xmltok_ns.c \
ascii.h asciitab.h iasciitab.h latin1tab.h nametab.h utf8tab.h \
xmldef.h xmltok.h xmltok_impl.h $(top_builddir)/config.h
--- 175,186 ----
done
! xmlparse.o \
! xmlparse.lo: xmlparse.c expat.h xmlrole.h xmltok.h $(top_builddir)/config.h
! xmlrole.o \
! xmlrole.lo: xmlrole.c ascii.h xmldef.h xmlrole.h $(top_builddir)/config.h
! xmltok.o \
! xmltok.lo: xmltok.c xmltok_impl.c xmltok_ns.c \
ascii.h asciitab.h iasciitab.h latin1tab.h nametab.h utf8tab.h \
xmldef.h xmltok.h xmltok_impl.h $(top_builddir)/config.h
Index: expat.h
===================================================================
RCS file: /cvsroot/expat/expat/lib/expat.h,v
retrieving revision 1.2
retrieving revision 1.3
diff -C2 -r1.2 -r1.3
*** expat.h 2000/09/21 21:20:18 1.2
--- expat.h 2000/09/24 03:43:37 1.3
***************
*** 7,52 ****
#define XmlParse_INCLUDED 1
#ifdef __cplusplus
extern "C" {
#endif
- #ifndef XMLPARSEAPI
- #define XMLPARSEAPI /* as nothing */
- #endif
-
typedef void *XML_Parser;
- #ifdef XML_UNICODE_WCHAR_T
-
- /* XML_UNICODE_WCHAR_T will work only if sizeof(wchar_t) == 2 and wchar_t
- uses Unicode. */
- /* Information is UTF-16 encoded as wchar_ts */
-
- #ifndef XML_UNICODE
- #define XML_UNICODE
- #endif
-
- #include <stddef.h>
- typedef wchar_t XML_Char;
- typedef wchar_t XML_LChar;
-
- #else /* not XML_UNICODE_WCHAR_T */
-
- #ifdef XML_UNICODE
-
- /* Information is UTF-16 encoded as unsigned shorts */
- typedef unsigned short XML_Char;
- typedef char XML_LChar;
-
- #else /* not XML_UNICODE */
-
/* Information is UTF-8 encoded. */
typedef char XML_Char;
typedef char XML_LChar;
- #endif /* not XML_UNICODE */
-
- #endif /* not XML_UNICODE_WCHAR_T */
-
enum XML_Content_Type {
XML_CTYPE_EMPTY = 1,
--- 7,22 ----
#define XmlParse_INCLUDED 1
+ #include <stdlib.h>
+
#ifdef __cplusplus
extern "C" {
#endif
typedef void *XML_Parser;
/* Information is UTF-8 encoded. */
typedef char XML_Char;
typedef char XML_LChar;
enum XML_Content_Type {
XML_CTYPE_EMPTY = 1,
***************
*** 96,100 ****
/* This is called for an element declaration. See above for
description of the model argument. It's the caller's responsibility
! to free model when finished with it by calling XML_ContentFree.
*/
--- 66,70 ----
/* This is called for an element declaration. See above for
description of the model argument. It's the caller's responsibility
! to free model when finished with it.
*/
***************
*** 103,114 ****
XML_Content *model);
! void XMLPARSEAPI
XML_SetElementDeclHandler(XML_Parser parser,
XML_ElementDeclHandler eldecl);
-
- void XMLPARSEAPI
- XML_ContentFree(XML_Content *content);
-
/*
The Attlist declaration handler is called for *each* attribute. So
--- 73,80 ----
XML_Content *model);
! void
XML_SetElementDeclHandler(XML_Parser parser,
XML_ElementDeclHandler eldecl);
/*
The Attlist declaration handler is called for *each* attribute. So
***************
*** 128,132 ****
int isrequired);
! void XMLPARSEAPI
XML_SetAttlistDeclHandler(XML_Parser parser,
XML_AttlistDeclHandler attdecl);
--- 94,98 ----
int isrequired);
! void
XML_SetAttlistDeclHandler(XML_Parser parser,
XML_AttlistDeclHandler attdecl);
***************
*** 145,160 ****
const XML_Char *encoding,
int standalone);
-
-
! void XMLPARSEAPI
XML_SetXmlDeclHandler(XML_Parser parser,
XML_XmlDeclHandler xmldecl);
/* Constructs a new parser; encoding is the encoding specified by the external
protocol or null if there is none specified. */
! XML_Parser XMLPARSEAPI
XML_ParserCreate(const XML_Char *encoding);
--- 111,130 ----
const XML_Char *encoding,
int standalone);
! void
XML_SetXmlDeclHandler(XML_Parser parser,
XML_XmlDeclHandler xmldecl);
+ typedef struct {
+ void *(*malloc_fcn)(size_t size);
+ void *(*realloc_fcn)(void *ptr, size_t size);
+ void (*free_fcn)(void *ptr);
+ } XML_Memory_Handling_Suite;
+
/* Constructs a new parser; encoding is the encoding specified by the external
protocol or null if there is none specified. */
! XML_Parser
XML_ParserCreate(const XML_Char *encoding);
***************
*** 169,176 ****
passed through without expansion. */
! XML_Parser XMLPARSEAPI
XML_ParserCreateNS(const XML_Char *encoding, XML_Char namespaceSeparator);
/* atts is array of name/value pairs, terminated by 0;
names and values are 0 terminated. */
--- 139,161 ----
passed through without expansion. */
! XML_Parser
XML_ParserCreateNS(const XML_Char *encoding, XML_Char namespaceSeparator);
+ /* Constructs a new parser using the memory management suit referred to
+ by memsuite. If memsuite is NULL, then use the standard library memory
+ suite. If namespaceSeparator is non-NULL it creates a parser with
+ namespace processing as described above. The character pointed at
+ will serve as the namespace separator.
+
+ All further memory operations used for the created parser will come from
+ the given suite.
+ */
+
+ XML_Parser
+ XML_ParserCreate_MM(const XML_Char *encoding,
+ const XML_Memory_Handling_Suite *memsuite,
+ const XML_Char *namespaceSeparator);
+
/* atts is array of name/value pairs, terminated by 0;
names and values are 0 terminated. */
***************
*** 256,260 ****
const XML_Char *notationName);
! void XMLPARSEAPI
XML_SetEntityDeclHandler(XML_Parser parser,
XML_EntityDeclHandler handler);
--- 241,245 ----
const XML_Char *notationName);
! void
XML_SetEntityDeclHandler(XML_Parser parser,
XML_EntityDeclHandler handler);
***************
*** 399,434 ****
XML_Encoding *info);
! void XMLPARSEAPI
XML_SetElementHandler(XML_Parser parser,
XML_StartElementHandler start,
XML_EndElementHandler end);
! void XMLPARSEAPI
XML_SetStartElementHandler(XML_Parser parser, XML_StartElementHandler);
! void XMLPARSEAPI
XML_SetEndElementHandler(XML_Parser parser, XML_EndElementHandler);
! void XMLPARSEAPI
XML_SetCharacterDataHandler(XML_Parser parser,
XML_CharacterDataHandler handler);
! void XMLPARSEAPI
XML_SetProcessingInstructionHandler(XML_Parser parser,
XML_ProcessingInstructionHandler handler);
! void XMLPARSEAPI
XML_SetCommentHandler(XML_Parser parser,
XML_CommentHandler handler);
! void XMLPARSEAPI
XML_SetCdataSectionHandler(XML_Parser parser,
XML_StartCdataSectionHandler start,
XML_EndCdataSectionHandler end);
! void XMLPARSEAPI
XML_SetStartCdataSectionHandler(XML_Parser parser,
XML_StartCdataSectionHandler start);
! void XMLPARSEAPI
XML_SetEndCdataSectionHandler(XML_Parser parser,
XML_EndCdataSectionHandler end);
--- 384,419 ----
XML_Encoding *info);
! void
XML_SetElementHandler(XML_Parser parser,
XML_StartElementHandler start,
XML_EndElementHandler end);
! void
XML_SetStartElementHandler(XML_Parser parser, XML_StartElementHandler);
! void
XML_SetEndElementHandler(XML_Parser parser, XML_EndElementHandler);
! void
XML_SetCharacterDataHandler(XML_Parser parser,
XML_CharacterDataHandler handler);
! void
XML_SetProcessingInstructionHandler(XML_Parser parser,
XML_ProcessingInstructionHandler handler);
! void
XML_SetCommentHandler(XML_Parser parser,
XML_CommentHandler handler);
! void
XML_SetCdataSectionHandler(XML_Parser parser,
XML_StartCdataSectionHandler start,
XML_EndCdataSectionHandler end);
! void
XML_SetStartCdataSectionHandler(XML_Parser parser,
XML_StartCdataSectionHandler start);
! void
XML_SetEndCdataSectionHandler(XML_Parser parser,
XML_EndCdataSectionHandler end);
***************
*** 437,441 ****
The entity reference will be passed to the default handler. */
! void XMLPARSEAPI
XML_SetDefaultHandler(XML_Parser parser,
XML_DefaultHandler handler);
--- 422,426 ----
The entity reference will be passed to the default handler. */
! void
XML_SetDefaultHandler(XML_Parser parser,
XML_DefaultHandler handler);
***************
*** 444,490 ****
The entity reference will not be passed to the default handler. */
! void XMLPARSEAPI
XML_SetDefaultHandlerExpand(XML_Parser parser,
XML_DefaultHandler handler);
! void XMLPARSEAPI
XML_SetDoctypeDeclHandler(XML_Parser parser,
XML_StartDoctypeDeclHandler start,
XML_EndDoctypeDeclHandler end);
! void XMLPARSEAPI
XML_SetStartDoctypeDeclHandler(XML_Parser parser,
XML_StartDoctypeDeclHandler start);
! void XMLPARSEAPI
XML_SetEndDoctypeDeclHandler(XML_Parser parser,
XML_EndDoctypeDeclHandler end);
! void XMLPARSEAPI
XML_SetUnparsedEntityDeclHandler(XML_Parser parser,
XML_UnparsedEntityDeclHandler handler);
! void XMLPARSEAPI
XML_SetNotationDeclHandler(XML_Parser parser,
XML_NotationDeclHandler handler);
! void XMLPARSEAPI
XML_SetNamespaceDeclHandler(XML_Parser parser,
XML_StartNamespaceDeclHandler start,
XML_EndNamespaceDeclHandler end);
! void XMLPARSEAPI
XML_SetStartNamespaceDeclHandler(XML_Parser parser,
XML_StartNamespaceDeclHandler start);
! void XMLPARSEAPI
XML_SetEndNamespaceDeclHandler(XML_Parser parser,
XML_EndNamespaceDeclHandler end);
! void XMLPARSEAPI
XML_SetNotStandaloneHandler(XML_Parser parser,
XML_NotStandaloneHandler handler);
! void XMLPARSEAPI
XML_SetExternalEntityRefHandler(XML_Parser parser,
XML_ExternalEntityRefHandler handler);
--- 429,475 ----
The entity reference will not be passed to the default handler. */
! void
XML_SetDefaultHandlerExpand(XML_Parser parser,
XML_DefaultHandler handler);
! void
XML_SetDoctypeDeclHandler(XML_Parser parser,
XML_StartDoctypeDeclHandler start,
XML_EndDoctypeDeclHandler end);
! void
XML_SetStartDoctypeDeclHandler(XML_Parser parser,
XML_StartDoctypeDeclHandler start);
! void
XML_SetEndDoctypeDeclHandler(XML_Parser parser,
XML_EndDoctypeDeclHandler end);
! void
XML_SetUnparsedEntityDeclHandler(XML_Parser parser,
XML_UnparsedEntityDeclHandler handler);
! void
XML_SetNotationDeclHandler(XML_Parser parser,
XML_NotationDeclHandler handler);
! void
XML_SetNamespaceDeclHandler(XML_Parser parser,
XML_StartNamespaceDeclHandler start,
XML_EndNamespaceDeclHandler end);
! void
XML_SetStartNamespaceDeclHandler(XML_Parser parser,
XML_StartNamespaceDeclHandler start);
! void
XML_SetEndNamespaceDeclHandler(XML_Parser parser,
XML_EndNamespaceDeclHandler end);
! void
XML_SetNotStandaloneHandler(XML_Parser parser,
XML_NotStandaloneHandler handler);
! void
XML_SetExternalEntityRefHandler(XML_Parser parser,
XML_ExternalEntityRefHandler handler);
***************
*** 493,500 ****
as the first argument to the external entity ref handler instead
of the parser object. */
! void XMLPARSEAPI
XML_SetExternalEntityRefHandlerArg(XML_Parser, void *arg);
! void XMLPARSEAPI
XML_SetUnknownEncodingHandler(XML_Parser parser,
XML_UnknownEncodingHandler handler,
--- 478,485 ----
as the first argument to the external entity ref handler instead
of the parser object. */
! void
XML_SetExternalEntityRefHandlerArg(XML_Parser, void *arg);
! void
XML_SetUnknownEncodingHandler(XML_Parser parser,
XML_UnknownEncodingHandler handler,
***************
*** 504,511 ****
processing instruction or character data. It causes the corresponding
markup to be passed to the default handler. */
! void XMLPARSEAPI XML_DefaultCurrent(XML_Parser parser);
/* This value is passed as the userData argument to callbacks. */
! void XMLPARSEAPI
XML_SetUserData(XML_Parser parser, void *userData);
--- 489,496 ----
processing instruction or character data. It causes the corresponding
markup to be passed to the default handler. */
! void XML_DefaultCurrent(XML_Parser parser);
/* This value is passed as the userData argument to callbacks. */
! void
XML_SetUserData(XML_Parser parser, void *userData);
***************
*** 517,521 ****
or XML_ParseBuffer. */
! int XMLPARSEAPI
XML_SetEncoding(XML_Parser parser, const XML_Char *encoding);
--- 502,506 ----
or XML_ParseBuffer. */
! int
XML_SetEncoding(XML_Parser parser, const XML_Char *encoding);
***************
*** 524,528 ****
The userData will still be accessible using XML_GetUserData. */
! void XMLPARSEAPI
XML_UseParserAsHandlerArg(XML_Parser parser);
--- 509,513 ----
The userData will still be accessible using XML_GetUserData. */
! void
XML_UseParserAsHandlerArg(XML_Parser parser);
***************
*** 534,541 ****
Returns zero if out of memory, non-zero otherwise. */
! int XMLPARSEAPI
XML_SetBase(XML_Parser parser, const XML_Char *base);
! const XML_Char XMLPARSEAPI *
XML_GetBase(XML_Parser parser);
--- 519,526 ----
Returns zero if out of memory, non-zero otherwise. */
! int
XML_SetBase(XML_Parser parser, const XML_Char *base);
! const XML_Char *
XML_GetBase(XML_Parser parser);
***************
*** 546,550 ****
XML_StartElementHandler. */
! int XMLPARSEAPI XML_GetSpecifiedAttributeCount(XML_Parser parser);
/* Returns the index of the ID attribute passed in the last call to
--- 531,535 ----
XML_StartElementHandler. */
! int XML_GetSpecifiedAttributeCount(XML_Parser parser);
/* Returns the index of the ID attribute passed in the last call to
***************
*** 552,567 ****
attribute/value pair counts as 2; thus this correspondds to an index
into the atts array passed to the XML_StartElementHandler. */
! int XMLPARSEAPI XML_GetIdAttributeIndex(XML_Parser parser);
/* Parses some input. Returns 0 if a fatal error is detected.
The last call to XML_Parse must have isFinal true;
len may be zero for this call (or any other). */
! int XMLPARSEAPI
XML_Parse(XML_Parser parser, const char *s, int len, int isFinal);
! void XMLPARSEAPI *
XML_GetBuffer(XML_Parser parser, int len);
! int XMLPARSEAPI
XML_ParseBuffer(XML_Parser parser, int len, int isFinal);
--- 537,552 ----
attribute/value pair counts as 2; thus this correspondds to an index
into the atts array passed to the XML_StartElementHandler. */
! int XML_GetIdAttributeIndex(XML_Parser parser);
/* Parses some input. Returns 0 if a fatal error is detected.
The last call to XML_Parse must have isFinal true;
len may be zero for this call (or any other). */
! int
XML_Parse(XML_Parser parser, const char *s, int len, int isFinal);
! void *
XML_GetBuffer(XML_Parser parser, int len);
! int
XML_ParseBuffer(XML_Parser parser, int len, int isFinal);
***************
*** 579,583 ****
The handlers and userData are initialized from the parser argument.
Returns 0 if out of memory. Otherwise returns a new XML_Parser object. */
! XML_Parser XMLPARSEAPI
XML_ExternalEntityParserCreate(XML_Parser parser,
const XML_Char *context,
--- 564,568 ----
The handlers and userData are initialized from the parser argument.
Returns 0 if out of memory. Otherwise returns a new XML_Parser object. */
! XML_Parser
XML_ExternalEntityParserCreate(XML_Parser parser,
const XML_Char *context,
***************
*** 609,613 ****
entities is requested; otherwise it will return non-zero. */
! int XMLPARSEAPI
XML_SetParamEntityParsing(XML_Parser parser,
enum XML_ParamEntityParsing parsing);
--- 594,598 ----
entities is requested; otherwise it will return non-zero. */
! int
XML_SetParamEntityParsing(XML_Parser parser,
enum XML_ParamEntityParsing parsing);
***************
*** 642,646 ****
returns information about the error. */
! enum XML_Error XMLPARSEAPI XML_GetErrorCode(XML_Parser parser);
/* These functions return information about the current parse location.
--- 627,631 ----
returns information about the error. */
! enum XML_Error XML_GetErrorCode(XML_Parser parser);
/* These functions return information about the current parse location.
***************
*** 652,663 ****
of the sequence of characters that generated the event. */
! int XMLPARSEAPI XML_GetCurrentLineNumber(XML_Parser parser);
! int XMLPARSEAPI XML_GetCurrentColumnNumber(XML_Parser parser);
! long XMLPARSEAPI XML_GetCurrentByteIndex(XML_Parser parser);
/* Return the number of bytes in the current event.
Returns 0 if the event is in an internal entity. */
! int XMLPARSEAPI XML_GetCurrentByteCount(XML_Parser parser);
/* If XML_CONTEXT_BYTES is defined, returns the input buffer, sets
--- 637,648 ----
of the sequence of characters that generated the event. */
! int XML_GetCurrentLineNumber(XML_Parser parser);
! int XML_GetCurrentColumnNumber(XML_Parser parser);
! long XML_GetCurrentByteIndex(XML_Parser parser);
/* Return the number of bytes in the current event.
Returns 0 if the event is in an internal entity. */
! int XML_GetCurrentByteCount(XML_Parser parser);
/* If XML_CONTEXT_BYTES is defined, returns the input buffer, sets
***************
*** 670,674 ****
the handler that makes the call. */
! const char XMLPARSEAPI * XML_GetInputContext(XML_Parser parser,
int *offset,
int *size);
--- 655,659 ----
the handler that makes the call. */
! const char * XML_GetInputContext(XML_Parser parser,
int *offset,
int *size);
***************
*** 680,688 ****
/* Frees memory used by the parser. */
! void XMLPARSEAPI
XML_ParserFree(XML_Parser parser);
/* Returns a string describing the error. */
! const XML_LChar XMLPARSEAPI *XML_ErrorString(int code);
#ifdef __cplusplus
--- 665,673 ----
/* Frees memory used by the parser. */
! void
XML_ParserFree(XML_Parser parser);
/* Returns a string describing the error. */
! const XML_LChar *XML_ErrorString(int code);
#ifdef __cplusplus
Index: xmlparse.c
===================================================================
RCS file: /cvsroot/expat/expat/lib/xmlparse.c,v
retrieving revision 1.2
retrieving revision 1.3
diff -C2 -r1.2 -r1.3
*** xmlparse.c 2000/09/21 21:20:18 1.2
--- xmlparse.c 2000/09/24 03:43:37 1.3
***************
*** 60,63 ****
--- 60,64 ----
size_t used;
size_t usedLim;
+ XML_Memory_Handling_Suite *mem;
} HASH_TABLE;
***************
*** 140,143 ****
--- 141,145 ----
XML_Char *ptr;
[...1074 lines suppressed...]
dtd.scaffSize * sizeof(CONTENT_SCAFFOLD));
}
else {
dtd.scaffSize = 32;
! dtd.scaffold = (CONTENT_SCAFFOLD *) MALLOC(dtd.scaffSize * sizeof(CONTENT_SCAFFOLD));
}
if (! dtd.scaffold)
***************
*** 4457,4461 ****
int allocsize = dtd.scaffCount * sizeof(XML_Content) + dtd.contentStringLen;
! ret = malloc(allocsize);
if (! ret)
return 0;
--- 4530,4534 ----
int allocsize = dtd.scaffCount * sizeof(XML_Content) + dtd.contentStringLen;
! ret = MALLOC(allocsize);
if (! ret)
return 0;