Binary version of Expat XML reader added
authorJan Vrany <jan.vrany@fit.cvut.cz>
Sun, 26 Oct 2008 21:32:49 +0000
changeset 20 262e480300a4
parent 19 c0d9cfa8a86f
child 21 50b045a0c824
Binary version of Expat XML reader added
xmlreaderimpl/trunk/Make.proto
xmlreaderimpl/trunk/Make.spec
xmlreaderimpl/trunk/Makefile
xmlreaderimpl/trunk/XMLv2__ExpatXMLReader.so
xmlreaderimpl/trunk/XMLv2__ExpatXMLReader.st
xmlreaderimpl/trunk/bmake.bat
xmlreaderimpl/trunk/loadAll
xmlreaderimpl/trunk/makefile
xmlreaderimpl/trunk/nt.mak
xmlreaderimpl/trunk/stx_goodies_xmlsuite_xmlreaderimpl.st
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/xmlreaderimpl/trunk/Make.proto	Sun Oct 26 21:32:49 2008 +0000
@@ -0,0 +1,125 @@
+# $Header$
+#
+# --- Make.proto created by stmkmp at Sun Oct 26 20:52:03 CET 2008
+#
+# Warning: once you modify this file, do not rerun
+# stmkmp again - otherwise, your changes are lost.
+#
+# The Makefile as generated by this Make.proto supports the following targets:
+#    make         - compile all st-files to a classLib
+#    make install - install the classLib in /opt/smalltalk/...
+#    make clean   - clean all temp files
+#    make clobber - clean all
+
+#
+# position (of this package) in directory hierarchy:
+# (must point to ST/X top directory, for tools and includes)
+TOP=../../..
+
+
+# subdirectories where targets are to be made:
+SUBDIRS=
+
+
+# subdirectories where Makefiles are to be made:
+# (only define if different from SUBDIRS)
+# ALLSUBDIRS=
+
+
+# if your embedded C code requires any system includes, 
+# add the path(es) here:, 
+# ********** OPTIONAL: MODIFY the next lines ***
+# LOCALINCLUDES=-Ifoo -Ibar
+LOCALINCLUDES=
+
+
+# if you need any additional defines for embedded C code, 
+# add them here:, 
+# ********** OPTIONAL: MODIFY the next lines ***
+# LOCALDEFINES=-Dfoo -Dbar -DDEBUG
+LOCALDEFINES=
+
+
+#
+# The next 2 defines should be left as-is
+#  for a class-library package, you can uncomment the following:
+#  (it does not hurt much, if you leave it as is - but you may NOT
+#   uncomment it if object files are to be loaded individually later).
+# INITCODESEPFLAG=$(SEPINITCODE)
+#
+#  the following MAY ONLY be uncommented for classes/classLibs,
+#  which are ALWAYS statically included in the executable.
+#  (i.e. NEVER for those which are subject to dynamic loading).
+# COMMONSYMFLAG=$(COMMONSYMBOLS)
+#
+PACKAGE=$(MODULE):$(MODULE_DIR)
+STCLOCALOPT=-I. $(LOCALINCLUDES) $(STCLOCALOPTIMIZATIONS) $(STCWARNINGS) $(LOCALDEFINES) -H. '-P$(PACKAGE)' '-Z$(LIBNAME)' $(COMMONSYMFLAG) $(INITCODESEPFLAG)
+
+
+# ********** OPTIONAL: MODIFY the next line ***
+# additional C-libraries that should be pre-linked with the class-objects
+LD_OBJ_LIBS=-lexpat
+OTHERLIBS=-lexpat
+LOCAL_SHARED_LIBS=-lexpat
+
+
+# ********** OPTIONAL: MODIFY the next line ***
+# additional C targets or libraries should be added below
+LOCAL_EXTRA_TARGETS=
+
+all:: preMake classLibRule postMake
+
+
+# add more install actions here
+install::
+
+# add more install actions for aux-files (resources) here
+installAux::
+
+# add more preMake actions here
+preMake::
+
+# add more postMake actions here
+postMake:: cleanjunk
+
+cleanjunk::
+
+clean::
+	-rm -f *.o *.H
+
+clobber::
+	-rm -f *.so *.dll
+
+expat: XMLv2__ExpatXMLReader.$(SO)
+
+
+XMLv2__ExpatXMLReader.$(SO): XMLv2__ExpatXMLReader.$(O)
+        $(MAKE) $(SHAREDLIBRULE) LIB=XMLv2__ExpatXMLReader.$(SO) OBJS="XMLv2__ExpatXMLReader.$(O)" LOCAL_SHARED_LIBS="-lexpat"
+
+
+
+$(INSTALLBASE)::
+	@test -d $@ || mkdir $@
+
+$(INSTALLBASE)/packages:: $(INSTALLBASE)
+	@test -d $@ || mkdir $@
+
+$(INSTALLBASE)/packages/$(MODULE):: $(INSTALLBASE)/packages
+	@test -d $@ || mkdir $@
+
+
+$(INSTALLBASE)/packages/$(MODULE)/$(MODULE_DIR):: $(INSTALLBASE)/packages/$(MODULE)
+	@test -d $@ || mkdir $@
+
+# if other things are to be compiled,
+# add target definitions here,
+# and list them in LOCAL_EXTRA_TARGETS above.
+# (care for make syntax - TABS are required in the actions)
+# foo:  foo.o
+#         $(CC) -o foo foo.o
+
+# 'make depend' will add dependency info between
+# BEGIN...END below
+#
+# BEGINMAKEDEPEND --- do not remove this line; make depend needs it
+# ENDMAKEDEPEND --- do not remove this line
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/xmlreaderimpl/trunk/Make.spec	Sun Oct 26 21:32:49 2008 +0000
@@ -0,0 +1,67 @@
+# $Header$
+#
+# --- Make.spec created by stmkmp at Sun Oct 26 20:52:03 CET 2008
+#
+# This file contains specifications which are common to all platforms.
+#
+# Warning: once you modify this file, do not rerun
+# stmkmp again - otherwise, your changes are lost.
+#
+# This file contains definitions for Unix based platforms.
+#
+
+
+
+
+# module and directory-in-module;
+# these should correspond to the directory hierarchy
+# location (otherwise, ST/X will have a hard time to
+# find out the packages location from its packageID)
+MODULE=stx
+MODULE_DIR=goodies/xmlsuite/xmlreaderimpl
+PACKAGE=$(MODULE):$(MODULE_DIR)
+
+# the name of your classLibrary:
+LIBNAME=xmlreaderimpl
+
+
+# Argument(s) to the stc compiler.
+#  -H.         : create header files locally
+#                (if removed, they will be created as common
+#  -Pxxx       : defines the package
+#  -Zxxx       : a prefix for variables within the classLib
+#  -Dxxx       : defines passed to to CC for inline C-code
+#  -Ixxx       : include path passed to CC for inline C-code
+#  +optspace   : optimized for space
+#  +optspace2  : optimized more for space
+#  +optspace3  : optimized even more for space
+#  +optinline  : generate inline code for some ST constructs
+#  +inlineNew  : additionally inline new
+#  +inlineMath : additionally inline some floatPnt math stuff
+#
+# ********** OPTIONAL: MODIFY the next line(s) ***
+# STCLOCALOPTIMIZATIONS=+optinline +inlineNew
+# STCLOCALOPTIMIZATIONS=+optspace3
+STCLOCALOPTIMIZATIONS=+optspace3
+
+
+# Argument(s) to the stc compiler.
+#  -warn            : no warnings
+#  -warnNonStandard : no warnings about ST/X extensions
+#  -warnEOLComments : no warnings about EOL comment extension
+#  -warnPrivacy     : no warnings about privateClass extension
+#
+# ********** OPTIONAL: MODIFY the next line(s) ***
+# STCWARNINGS=-warn
+# STCWARNINGS=-warnNonStandard
+# STCWARNINGS=-warnEOLComments
+STCWARNINGS=
+
+OBJS= \
+    extensions.$(O) \
+    stx_goodies_xmlsuite_xmlreaderimpl.$(O) \
+    XMLv2__ExpatXMLReader.$(O) \
+    XMLv2__VWSAXBuilder.$(O) \
+    XMLv2__VWXMLReader.$(O) \
+    XMLv2__VWXMLReader__StreamWrapper.$(O) \
+    XMLv2__VWXMLReader__XMLParser.$(O)
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/xmlreaderimpl/trunk/Makefile	Sun Oct 26 21:32:49 2008 +0000
@@ -0,0 +1,21 @@
+#
+# DO NOT EDIT 
+#
+# make uses this file (Makefile) only, if there is no 
+# file named "makefile" in the directory.
+# Our only task is to generate makefile and call make again
+#
+
+
+.PHONY: run
+
+run: makefile
+	$(MAKE) -f makefile
+
+#only needed for the definition of $(TOP)
+include Make.proto
+
+makefile:
+	$(TOP)/rules/stmkmf	
+
+    
Binary file xmlreaderimpl/trunk/XMLv2__ExpatXMLReader.so has changed
--- a/xmlreaderimpl/trunk/XMLv2__ExpatXMLReader.st	Wed Oct 22 08:24:24 2008 +0000
+++ b/xmlreaderimpl/trunk/XMLv2__ExpatXMLReader.st	Sun Oct 26 21:32:49 2008 +0000
@@ -3,7 +3,7 @@
 "{ NameSpace: XMLv2 }"
 
 XMLReader subclass:#ExpatXMLReader
-	instanceVariableNames:'parser'
+	instanceVariableNames:'parser inCDataSection'
 	classVariableNames:''
 	poolDictionaries:''
 	category:'XML Suite-SAX2-XMLReaders'
@@ -22,10 +22,11 @@
 
 #define CHUNK_SIZE 8192
 
-
-#define EXPAT_DEBUG(args) printf("ExpatXMLReader [debug]") ; printf args
-
-#define EXPAT_DEBUG(args)
+#ifdef DEBUG
+# define EXPAT_DEBUG(args) printf("ExpatXMLReader [debug]") ; printf args
+#else
+# define EXPAT_DEBUG(args)
+#endif
 
 #define EXPAT_DEBUG_ENTER EXPAT_DEBUG((" Entering %s\n",__PRETTY_FUNCTION__))
 #define EXPAT_DEBUG_LEAVE EXPAT_DEBUG((" Leaving  %s\n",__PRETTY_FUNCTION__))
@@ -42,7 +43,7 @@
 
 
 static void XMLCALL
-startElement(OBJ** readerPointer, char* nameStr, char** attributes) {
+startElement(void* readerPointer, const XML_Char* nameStr, const XML_Char** attributes) {
     OBJ reader;
     OBJ attArray = nil;
     OBJ attName,attValue;
@@ -68,51 +69,51 @@
         __UNPROTECT__(attArray); /* unprotect  */
     }
     __PROTECT__(attArray);
-    char* name = __MKSTRING(nameStr);
+    OBJ name = __MKSTRING(nameStr);
     __UNPROTECT__(attArray);
-    reader = **readerPointer;
+    reader = **(OBJ**)readerPointer;
     EXPAT_DEBUG((" Reader is at %x, sending #expatStartElement:attributes:\n",reader));
     __SSEND2(reader, @symbol(expatStartElement:attributes:),0, name, attArray);
     EXPAT_DEBUG_LEAVE;
 }
 
 static void XMLCALL
-endElement(OBJ** readerPointer, char* nameStr) {
+endElement(void* readerPointer, const XML_Char* nameStr) {
     OBJ reader;
     OBJ name;
     EXPAT_DEBUG_ENTER;
     name = __MKSTRING(nameStr);    
-    reader = **readerPointer;
+    reader = **(OBJ**)readerPointer;
     __SSEND1(reader, @symbol(expatEndElement:),0, name);
     EXPAT_DEBUG_LEAVE;
 }
 
 static void XMLCALL
-startNSPrefixMapping(OBJ** readerPointer, char* prefixStr, char* uriStr) {
-    OBJ reader = **readerPointer;
+startNSPrefixMapping(void* readerPointer, const XML_Char* prefixStr, const XML_Char* uriStr) {
+    OBJ reader = **(OBJ**)readerPointer;
     OBJ prefix;
     OBJ uri;
     EXPAT_DEBUG_ENTER;
     prefix = __MKSTRING(prefixStr);
     uri = __MKSTRING(uriStr);
-    reader = **readerPointer;   
+    reader = **(OBJ**)readerPointer;   
     __SSEND2(reader, @symbol(expatStartPrefix:mappingTo:),0, uri, prefix);
     EXPAT_DEBUG_LEAVE;
 }
 
 static void XMLCALL
-endNSPrefixMapping(OBJ** readerPointer, char* prefixStr) {
+endNSPrefixMapping(void* readerPointer, const XML_Char* prefixStr) {
     OBJ reader;
     OBJ prefix;
     EXPAT_DEBUG_ENTER;
     prefix = __MKSTRING(prefixStr);
-    reader = **readerPointer;   
+    reader = **(OBJ**)readerPointer;   
     __SSEND1(reader, @symbol(expatEndPrefixMapping:),0, prefix);
     EXPAT_DEBUG_LEAVE;
 }
 
 static void XMLCALL
-xmlProlog(OBJ** readerPointer, char* verStr, char* encStr, int standInt) {
+xmlProlog(void* readerPointer, const XML_Char* verStr, const XML_Char* encStr, int standInt) {
     OBJ reader;
     OBJ version;
     OBJ encoding;
@@ -130,7 +131,7 @@
     }
     standalone = __MKINT(standInt);
 
-    reader = **readerPointer;   
+    reader = **(OBJ**)readerPointer;   
     __SSEND3(reader, @symbol(expatPrologVersion:encoding:standalone:),
             0, version, encoding, standalone);
     EXPAT_DEBUG_LEAVE;
@@ -140,28 +141,28 @@
 
 
 static void XMLCALL
-characters(OBJ** readerPointer, char* charStr, int charLen) {
-    OBJ reader = **readerPointer;
+characters(void* readerPointer, const XML_Char* charStr, int charLen) {
+    OBJ reader = **(OBJ**)readerPointer;
     OBJ chars;
     EXPAT_DEBUG_ENTER;
     chars = __MKSTRING_L(charStr,charLen);
-    reader = **readerPointer;   
+    reader = **(OBJ**)readerPointer;   
     __SSEND1(reader, @symbol(expatCharacters:),0, chars);
     EXPAT_DEBUG_LEAVE;
 }
 
 static void XMLCALL
-startCDataSection(OBJ** readerPointer) {
+startCDataSection(void* readerPointer) {
         EXPAT_DEBUG_ENTER;
-        OBJ reader = **readerPointer;
+        OBJ reader = **(OBJ**)readerPointer;
         __SSEND1(reader, @symbol(expatInCDataSection:),0,true);
         EXPAT_DEBUG_LEAVE;
 }
 
 static void XMLCALL
-endCDataSection(OBJ** readerPointer) {
+endCDataSection(void* readerPointer) {
         EXPAT_DEBUG_ENTER;
-        OBJ reader = **readerPointer;
+        OBJ reader = **(OBJ**)readerPointer;
         __SSEND1(reader, @symbol(expatInCDataSection:),0,false);
         EXPAT_DEBUG_LEAVE;
 }
@@ -182,25 +183,25 @@
 }
 
 static void XMLCALL
-processingInstruction(OBJ** readerPointer, char* targetStr, char* dataStr) {
+processingInstruction(void* readerPointer, const XML_Char* targetStr, const XML_Char* dataStr) {
     OBJ reader;
     OBJ target;
     OBJ data;
     EXPAT_DEBUG_ENTER;
     target = __MKSTRING(targetStr);
     data = __MKSTRING(dataStr);
-    reader = **readerPointer;
+    reader = **(OBJ**)readerPointer;
     __SSEND2(reader, @symbol(expatPI:data:),0, target,data);
     EXPAT_DEBUG_LEAVE;
 }
 
 static void XMLCALL
-comment(OBJ** readerPointer, char* commentStr) {
+comment(void* readerPointer, const XML_Char* commentStr) {
     OBJ reader;
     OBJ comment;
     EXPAT_DEBUG_ENTER;
     comment = __MKSTRING(commentStr);
-    reader = **readerPointer;
+    reader = **(OBJ**)readerPointer;
     __SSEND1(reader, @symbol(expatComment:),0, comment);
     EXPAT_DEBUG_LEAVE;
 }
@@ -261,7 +262,7 @@
 
     ^self primitiveGetCurrentLineNumber
 
-    "Created: / 19-05-2005 / 09:43:37 / masca"
+   "Created: / 19-05-2005 / 09:43:37 / masca"
 ! !
 
 !ExpatXMLReader methodsFor:'expat events'!
@@ -456,7 +457,7 @@
         __INST(parser) = parserAddress;
         __STORE(self, parserAddress);
 
-        /* return */
+
         RETURN(self)
     }
 %}.
@@ -582,13 +583,13 @@
     | a |
     a := expandedName tokensBasedOn:$|.
 
-    ^(a size = 1) ifTrue:[
-        NodeName new
+    (a size = 1) ifTrue:[
+        ^NodeName new
             prefix:ownerNodeName prefix;
             ns:ownerNodeName ns;
             localName:a first
     ] ifFalse:[
-        NodeName new
+        ^NodeName new
             prefix:a third;
             ns:a first;
             localName:a second.
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/xmlreaderimpl/trunk/bmake.bat	Sun Oct 26 21:32:49 2008 +0000
@@ -0,0 +1,1 @@
+make.exe -N -f nt.mak %1 %2
--- a/xmlreaderimpl/trunk/loadAll	Wed Oct 22 08:24:24 2008 +0000
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,63 +0,0 @@
-"/
-"/ $Header: /opt/data/cvs/stx/goodies/xmlsuite/xmlreaderimpl/loadAll,v 1.7 2006-05-21 08:13:49 vranyj1 Exp $
-"/
-"/ loadAll-file to fileIn code for: stx:goodies/xmlsuite/xmlreaderimpl
-"/
-"/ Automatically generated by the browsers generate-loadAll function.
-"/ DO NOT MODIFY THIS fILE;
-"/
-"/
-"/ Prerequisites:
-"/
-"/ Smalltalk loadPackage:'module:directory'.
-"/ Smalltalk loadPackage:'....'.
-!
-'Executing preLoad script if any...' infoPrintCR.
-Smalltalk fileIn:'preLoad.st'.
-!
-"{ package:'stx:goodies/xmlsuite/xmlreaderimpl' }"
-!
-
-|files|
-
-'loading package stx:goodies/xmlsuite/xmlreaderimpl...' infoPrintCR.
-
-files := #(
-  'XMLv2__CincomDOMXMLReader.st'
-  'XMLv2__DOM3XMLReader.st'
-  'XMLv2__ExpatXMLReader.st'
-  'XMLv2__VWSAXBuilder.st'
-  'XMLv2__VWXMLReader.st'
-  'extensions.st'
-
-) asOrderedCollection.
-
-"/ see if there is a classLibrary
-(Smalltalk fileInClassLibrary:'goodies/xmlsuite/xmlreaderimpl') ifTrue:[
-    |handle loaded|
-
-    handle := ObjectFileLoader loadedObjectHandles 
-                    detect:[:h | h package = 'stx:goodies/xmlsuite/xmlreaderimpl'] ifNone:nil.
-    handle ifNotNil:[
-        loaded := Set new:(handle classes size).
-        handle classes do:[:c| c isMeta ifFalse:[loaded add:c classFilename]].
-        files := files asOrderedCollection select:[:f| (loaded includes:f) not].
-    ].
-].
-
-"/ load files which are not in the classLibrary (all if there is none)
-files size > 0 ifTrue:[
-  files do:[:f |
-    '.' infoPrint.
-    f asFilename exists ifTrue:[
-        Smalltalk fileIn:f.
-    ] ifFalse:[
-        Smalltalk fileIn:('source/' , f)
-    ]
-  ].
-  ' ' infoPrintCR.
-].
-' done (stx:goodies/xmlsuite/xmlreaderimpl).' infoPrintCR.
-'Executing postLoad script if any...' infoPrintCR.
-Smalltalk fileIn:'postLoad.st'.
-!
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/xmlreaderimpl/trunk/makefile	Sun Oct 26 21:32:49 2008 +0000
@@ -0,0 +1,18 @@
+#
+# DO NOT EDIT 
+# automagically generated from Make.proto (by make mf)
+#
+include ../../../rules/stdHeader
+include ../../../configurations/COMMON/defines
+include ../../../configurations/vendorConf
+include ../../../configurations/myConf
+include ../../../rules/stdHeader2
+include Make.spec
+include Make.proto
+
+BASE_CONF=linux-elf/opt-cs-oc
+BASE_CONF_VENDOR=linux-elf
+CONF_PACKS=
+CONF_TOOLS=
+
+include ../../../rules/stdRules
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/xmlreaderimpl/trunk/nt.mak	Sun Oct 26 21:32:49 2008 +0000
@@ -0,0 +1,24 @@
+# $Header$
+#
+# --- nt.mak created by stmkmp at Sun Oct 26 20:52:03 CET 2008
+#
+# This file contains make rules for the win32 platform (using borland-bcc).
+#
+# Warning: once you modify this file, do not rerun
+# stmkmp again - otherwise, your changes are lost.
+#
+TOP=..\..\..\
+
+!INCLUDE $(TOP)\rules\stdHeader_nt
+
+!INCLUDE Make.spec
+
+PACKAGE=$(MODULE):$(MODULE_DIR)
+STCLOCALOPT=-I. $(LOCALINCLUDES) -H. $(STCLOCALOPTIMIZATIONS) $(STCWARNINGS) $(LOCALDEFINES) '-P$(PACKAGE)' '-Z$(LIBNAME)' $(COMMONSYMFLAG) $(INITCODESEPFLAG)
+
+ALL::  $(LIBJPEG) $(LIBDIR)\$(LIBNAME).lib $(BINDIR)\$(LIBNAME).dll
+
+!INCLUDE $(TOP)\rules\stdRules_nt
+
+# BEGINMAKEDEPEND --- do not remove this line; make depend needs it
+# ENDMAKEDEPEND --- do not remove this line
--- a/xmlreaderimpl/trunk/stx_goodies_xmlsuite_xmlreaderimpl.st	Wed Oct 22 08:24:24 2008 +0000
+++ b/xmlreaderimpl/trunk/stx_goodies_xmlsuite_xmlreaderimpl.st	Sun Oct 26 21:32:49 2008 +0000
@@ -33,7 +33,7 @@
 classNamesAndAttributes
     ^ #(
         "<className> or (<className> attributes...) in load order"
-        #'XMLv2::ExpatXMLReader'
+        (#'XMLv2::ExpatXMLReader' autoload)
         #'XMLv2::VWSAXBuilder'
         #'XMLv2::VWXMLReader'
         #'stx_goodies_xmlsuite_xmlreaderimpl'