diff -r -C2 domc-0.7.0/Makefile domc/Makefile *** domc-0.7.0/Makefile 2003-03-22 17:08:50.000000000 -0700 --- domc/Makefile 2004-07-29 17:05:29.000000000 -0600 *************** *** 1,6 **** ! prefix = /usr/local ! includedir = $(prefix)/include ! libdir = $(prefix)/lib ! mandir = $(prefix)/man CC = gcc LIBNAME = domc --- 1,7 ---- ! _EXTRA = -I../libmba/src/ -L../libmba/ ! prefix = ./ ! includedir = $(prefix) ! libdir = $(prefix) ! mandir = $(prefix) CC = gcc LIBNAME = domc *************** *** 12,16 **** DISTRO = $(LIBNAME)-$(MINVERSION) RPM_OPT_FLAGS = -O2 ! CFLAGS = -Wall -W -DMSGNO $(RPM_OPT_FLAGS) -I$(includedir) -L$(libdir) #CFLAGS = -Wall -W -DMSGNO -I$(includedir) -L$(libdir) $(RPM_OPT_FLAGS) -ansi -pedantic -Wbad-function-cast -Wcast-align -Wcast-qual -Wchar-subscripts -Winline -Wmissing-prototypes -Wnested-externs -Wpointer-arith -Wredundant-decls -Wshadow -Wstrict-prototypes -Wwrite-strings -Wtraditional -Wconversion -Waggregate-return -Wno-parentheses OBJS = src/expatls.o src/events.o src/node.o src/nodelist.o src/namednodemap.o src/dom.o src/timestamp.o src/wcwidth.o --- 13,17 ---- DISTRO = $(LIBNAME)-$(MINVERSION) RPM_OPT_FLAGS = -O2 ! CFLAGS = -Wall -W -DMSGNO $(RPM_OPT_FLAGS) $(_EXTRA) -I$(includedir) -L$(libdir) #CFLAGS = -Wall -W -DMSGNO -I$(includedir) -L$(libdir) $(RPM_OPT_FLAGS) -ansi -pedantic -Wbad-function-cast -Wcast-align -Wcast-qual -Wchar-subscripts -Winline -Wmissing-prototypes -Wnested-externs -Wpointer-arith -Wredundant-decls -Wshadow -Wstrict-prototypes -Wwrite-strings -Wtraditional -Wconversion -Waggregate-return -Wno-parentheses OBJS = src/expatls.o src/events.o src/node.o src/nodelist.o src/namednodemap.o src/dom.o src/timestamp.o src/wcwidth.o *************** *** 20,24 **** $(SONAME): $(OBJS) ! $(CC) -shared $(OBJS) -L$(libdir) -lmba -lexpat -Wl,-h,$(SOVERSION) -o $(SONAME) .c.a: --- 21,25 ---- $(SONAME): $(OBJS) ! $(CC) -shared $(OBJS) $(_EXTRA) -L$(libdir) -lmba -Wl,-h,$(SOVERSION) -o $(SONAME) .c.a: *************** *** 48,51 **** clean: rm -f $(OBJS) $(ARNAME) $(SONAME) $(includedir)/domc.h $(libdir)/$(ARNAME) $(libdir)/$(SONAME) $(libdir)/$(SOVERSION) $(libdir)/lib$(LIBNAME).so $(DISTRO).zip ! cd $(mandir)/man3 && rm -f $(MAN) --- 49,52 ---- clean: rm -f $(OBJS) $(ARNAME) $(SONAME) $(includedir)/domc.h $(libdir)/$(ARNAME) $(libdir)/$(SONAME) $(libdir)/$(SOVERSION) $(libdir)/lib$(LIBNAME).so $(DISTRO).zip ! # cd $(mandir)/man3 && rm -f $(MAN) diff -r -C2 domc-0.7.0/Makefile.msvc domc/Makefile.msvc *** domc-0.7.0/Makefile.msvc 2003-03-22 16:44:29.000000000 -0700 --- domc/Makefile.msvc 2004-07-29 19:55:06.000000000 -0600 *************** *** 1,15 **** !include ! LIBMBA=..\libmba-0.5.0 ! EXPAT=..\Expat-1.95.5 # For i18n support in domc the encdec library is required. # Specify were the encdec library is below, change HAVE_ENCDEC to 1 # in src\defines.h and add /LIBPATH:$(ENCDEC) encdec.lib to the # .dll link command. ! ENCDEC=..\encdec-0.3.7 OBJS=src\expatls.obj src\events.obj src\timestamp.obj src\dom.obj src\node.obj src\namednodemap.obj src\nodelist.obj src\wcwidth.obj ! domc.dll: $(OBJS) ! $(link) /INCREMENTAL:NO /NOLOGO /LIBPATH:$(EXPAT)\Libs /LIBPATH:$(LIBMBA) /LIBPATH:$(ENCDEC) libexpat.lib libmba.lib encdec.lib /DEF:domc.def /OUT:domc.dll -entry:_DllMainCRTStartup@12 -dll $(OBJS) domc.lib: $(OBJS) --- 1,19 ---- !include ! LIBMBA=..\libmba ! # EXPAT=..\Expat-1.95.5 # For i18n support in domc the encdec library is required. # Specify were the encdec library is below, change HAVE_ENCDEC to 1 # in src\defines.h and add /LIBPATH:$(ENCDEC) encdec.lib to the # .dll link command. ! # ENCDEC=..\encdec-0.3.7 OBJS=src\expatls.obj src\events.obj src\timestamp.obj src\dom.obj src\node.obj src\namednodemap.obj src\nodelist.obj src\wcwidth.obj + # Debug flags + cflags=$(cflags) /MLd /GZ /Gm /ZI /Od /D_DEBUG ! all: domc.lib ! ! # domc.dll: $(OBJS) ! # $(link) $(lflags) /INCREMENTAL:NO /NOLOGO /LIBPATH:$(LIBMBA) libmba.lib /DEF:domc.def /OUT:domc.dll -entry:_DllMainCRTStartup@12 -dll $(OBJS) domc.lib: $(OBJS) *************** *** 17,21 **** .c.obj: ! $(cc) $(cflags) /I$(EXPAT)\Source\lib /I$(ENCDEC)\src /I$(LIBMBA)\src /Fo$@ $*.c clean: --- 21,25 ---- .c.obj: ! $(cc) $(cflags) /I$(LIBMBA)\src /Fo$@ $*.c clean: diff -r -C2 domc-0.7.0/src/defines.h domc/src/defines.h *** domc-0.7.0/src/defines.h 2003-03-22 16:35:36.000000000 -0700 --- domc/src/defines.h 2004-07-29 17:05:29.000000000 -0600 *************** *** 22,26 **** #define HAVE_STRDUP 1 #define HAVE_STRNLEN 0 ! #define HAVE_EXPAT 195 #define HAVE_MBSTATE 0 #define HAVE_WCWIDTH 0 --- 22,26 ---- #define HAVE_STRDUP 1 #define HAVE_STRNLEN 0 ! #define HAVE_EXPAT 0 #define HAVE_MBSTATE 0 #define HAVE_WCWIDTH 0 *************** *** 36,40 **** #define HAVE_STRDUP 1 #define HAVE_STRNLEN 1 ! #define HAVE_EXPAT 195 #define HAVE_MBSTATE 1 #define HAVE_WCWIDTH 1 --- 36,40 ---- #define HAVE_STRDUP 1 #define HAVE_STRNLEN 1 ! #define HAVE_EXPAT 0 #define HAVE_MBSTATE 1 #define HAVE_WCWIDTH 1 diff -r -C2 domc-0.7.0/src/dom.c domc/src/dom.c *** domc-0.7.0/src/dom.c 2003-03-21 01:50:28.000000000 -0700 --- domc/src/dom.c 2004-07-29 19:38:46.000000000 -0600 *************** *** 183,188 **** { DOM_Document *doc; ! namespaceURI = NULL; qualifiedName = NULL; msgno_add_codes(dom_codes); --- 183,189 ---- { DOM_Document *doc; + DOM_Element *el; ! namespaceURI = NULL; msgno_add_codes(dom_codes); *************** *** 197,200 **** --- 198,210 ---- } + if (qualifiedName && *qualifiedName) { + if ((el = DOM_Document_createElement(doc, qualifiedName)) == NULL) { + AMSG(""); + DOM_Document_destroyNode(doc, doc); + return NULL; + } + DOM_Node_appendChild(doc, el); + } + return doc; } *************** *** 281,293 **** attr = DOM_NamedNodeMap_removeNamedItem(element->attributes, name); ! DOM_MutationEvent_initMutationEvent(&evt, "DOMAttrModified", 1, 0, ! attr, attr->nodeValue, NULL, attr->nodeName, DOM_MUTATION_EVENT_REMOVAL); ! DOM_EventTarget_dispatchEvent(element, &evt); ! updateCommonParent(element->parentNode); ! if (attr) { ! DOM_Document_destroyNode(attr->ownerDocument, attr); } } --- 291,307 ---- attr = DOM_NamedNodeMap_removeNamedItem(element->attributes, name); + + /* removeAttribute doesn't throw exceptions on NOT_FOUND_ERR */ + if (DOM_Exception == DOM_NOT_FOUND_ERR) + DOM_Exception = 0; ! if (attr) { ! DOM_MutationEvent_initMutationEvent(&evt, "DOMAttrModified", 1, 0, ! attr, attr->nodeValue, NULL, attr->nodeName, DOM_MUTATION_EVENT_REMOVAL); ! DOM_EventTarget_dispatchEvent(element, &evt); ! updateCommonParent(element->parentNode); ! DOM_Document_destroyNode(attr->ownerDocument, attr); } } diff -r -C2 domc-0.7.0/src/domc.h domc/src/domc.h *** domc-0.7.0/src/domc.h 2003-03-22 16:46:46.000000000 -0700 --- domc/src/domc.h 2004-07-29 17:05:29.000000000 -0600 *************** *** 186,189 **** --- 186,191 ---- } ProcessingInstruction; } u; + unsigned int rtfxRefCount; /* Reference counting added for RTFX */ + void* userData; /* User data added for RTFX */ }; *************** *** 213,216 **** --- 215,220 ---- unsigned short filter; struct DOM_NodeList *list; /* Used for entities and notations */ + /* Reference counting added for RTFX */ + unsigned int rtfxRefCount; }; *************** *** 287,293 **** */ int DOM_DocumentLS_load(DOM_DocumentLS *this, const char *uri); - int DOM_DocumentLS_save(DOM_DocumentLS *this, const char *uri, const DOM_Node *node); int DOM_DocumentLS_fread(DOM_DocumentLS *this, FILE *stream); int DOM_DocumentLS_fwrite(const DOM_DocumentLS *this, FILE *stream); --- 291,299 ---- */ + #if HAVE_EXPAT > 0 int DOM_DocumentLS_load(DOM_DocumentLS *this, const char *uri); int DOM_DocumentLS_fread(DOM_DocumentLS *this, FILE *stream); + #endif /* HAVE_EXPAT */ + int DOM_DocumentLS_save(DOM_DocumentLS *this, const char *uri, const DOM_Node *node); int DOM_DocumentLS_fwrite(const DOM_DocumentLS *this, FILE *stream); diff -r -C2 domc-0.7.0/src/expatls.c domc/src/expatls.c *** domc-0.7.0/src/expatls.c 2003-03-21 02:20:24.000000000 -0700 --- domc/src/expatls.c 2004-08-02 16:58:41.000000000 -0600 *************** *** 128,131 **** --- 128,133 ---- } + #if HAVE_EXPAT > 0 + static void xmldecl_fn(void *userData, const XML_Char *version, const XML_Char *encoding, int standalone) *************** *** 708,711 **** --- 710,753 ---- } + #endif /* HAVE_EXPAT */ + + static void + fputds_encoded(const DOM_String *s, FILE *stream) + { + size_t l; + + while (*s) { + l = strcspn(s, "<>&\"'"); + if (l > 0) { + fwrite((void*)s, 1, sizeof(DOM_String) * l, stream); + s += l; + } + switch (*s) { + case '\0': + break; + case '<': + fputs("<", stream); + break; + case '>': + fputs(">", stream); + break; + case '&': + fputs("'", stream); + break; + case '"': + fputs(""", stream); + break; + case '\'': + fputs("&squot;", stream); + break; + default: + AMSG(""); + break; + }; + if(*s) + ++s; + } + } + int DOM_DocumentLS_fwrite(const DOM_DocumentLS *node, FILE *stream) *************** *** 732,736 **** fputds(e->node->nodeName, stream); fputs("=\"", stream); ! fputds(e->node->nodeValue, stream); fputc('"', stream); } --- 774,778 ---- fputds(e->node->nodeName, stream); fputs("=\"", stream); ! fputds_encoded(e->node->nodeValue, stream); fputc('"', stream); } *************** *** 753,757 **** break; case DOM_TEXT_NODE: ! fputds(node->nodeValue, stream); break; case DOM_CDATA_SECTION_NODE: --- 795,799 ---- break; case DOM_TEXT_NODE: ! fputds_encoded(node->nodeValue, stream); break; case DOM_CDATA_SECTION_NODE: *************** *** 761,803 **** case DOM_NOTATION_NODE: fputs(" nodeName, stream); if (node->u.Entity.publicId) { fputs(" PUBLIC \"", stream); ! fputs(node->u.Entity.publicId, stream); fputs("\" \"", stream); ! fputs(node->u.Entity.systemId, stream); fputc('"', stream); } else if (node->u.Entity.systemId) { fputs(" SYSTEM \"", stream); ! fputs(node->u.Entity.systemId, stream); fputc('"', stream); } ! fputs(">"NL, stream); break; case DOM_ENTITY_NODE: fputs(" nodeName, stream); if (node->nodeValue) { fputc('"', stream); ! fputs(node->nodeValue, stream); fputc('"', stream); } else { if (node->u.Entity.publicId) { fputs(" PUBLIC \"", stream); ! fputs(node->u.Entity.publicId, stream); fputs("\" \"", stream); ! fputs(node->u.Entity.systemId, stream); fputc('"', stream); } else if (node->u.Entity.systemId) { fputs(" SYSTEM \"", stream); ! fputs(node->u.Entity.systemId, stream); fputc('"', stream); } if (node->u.Entity.notationName) { fputs(" NDATA ", stream); ! fputs(node->u.Entity.notationName, stream); } } ! fputs(">"NL, stream); break; case DOM_PROCESSING_INSTRUCTION_NODE: --- 803,845 ---- case DOM_NOTATION_NODE: fputs(" nodeName, stream); if (node->u.Entity.publicId) { fputs(" PUBLIC \"", stream); ! fputds(node->u.Entity.publicId, stream); fputs("\" \"", stream); ! fputds(node->u.Entity.systemId, stream); fputc('"', stream); } else if (node->u.Entity.systemId) { fputs(" SYSTEM \"", stream); ! fputds(node->u.Entity.systemId, stream); fputc('"', stream); } ! fputs(">", stream); break; case DOM_ENTITY_NODE: fputs(" nodeName, stream); if (node->nodeValue) { fputc('"', stream); ! fputds(node->nodeValue, stream); fputc('"', stream); } else { if (node->u.Entity.publicId) { fputs(" PUBLIC \"", stream); ! fputds(node->u.Entity.publicId, stream); fputs("\" \"", stream); ! fputds(node->u.Entity.systemId, stream); fputc('"', stream); } else if (node->u.Entity.systemId) { fputs(" SYSTEM \"", stream); ! fputds(node->u.Entity.systemId, stream); fputc('"', stream); } if (node->u.Entity.notationName) { fputs(" NDATA ", stream); ! fputds(node->u.Entity.notationName, stream); } } ! fputs(">", stream); break; case DOM_PROCESSING_INSTRUCTION_NODE: *************** *** 805,823 **** fputds(node->u.ProcessingInstruction.target, stream); fputc(' ', stream); ! fputds(node->u.ProcessingInstruction.data, stream); fputs("?>", stream); break; case DOM_COMMENT_NODE: fputs("", stream); break; case DOM_DOCUMENT_NODE: fputs("u.Document.version) { ! fputs(" version=\"", stream); ! fputs(node->u.Document.version, stream); ! fputc('\"', stream); ! } #ifdef CODESET fputs(" encoding=\"", stream); --- 847,863 ---- fputds(node->u.ProcessingInstruction.target, stream); fputc(' ', stream); ! fputds_encoded(node->u.ProcessingInstruction.data, stream); fputs("?>", stream); break; case DOM_COMMENT_NODE: fputs("", stream); break; case DOM_DOCUMENT_NODE: fputs("u.Document.version ? node->u.Document.version : "1.0", stream); ! fputc('\"', stream); #ifdef CODESET fputs(" encoding=\"", stream); *************** *** 825,834 **** fputc('\"', stream); #endif ! if (node->u.Document.standalone == 0) { ! printf(" standalone=\"no\""); ! } else if (node->u.Document.standalone == 1) { ! printf(" standalone=\"yes\""); } ! fputs("?>"NL NL, stream); for (c = node->firstChild; c != NULL; c = c->nextSibling) { if (DOM_DocumentLS_fwrite(c, stream) == -1) { --- 865,872 ---- fputc('\"', stream); #endif ! if (node->u.Document.standalone != 0) { ! fputs(" standalone=\"yes\"", stream); } ! fputs("?>"NL, stream); for (c = node->firstChild; c != NULL; c = c->nextSibling) { if (DOM_DocumentLS_fwrite(c, stream) == -1) {