You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@xerces.apache.org by ja...@apache.org on 2006/02/20 11:42:46 UTC
svn commit: r379076 [1/3] - in /xerces/c/trunk/swig: ./ interfaces/
interfaces/Perl/ perl/ perl/Handler/ perl/docs/ perl/hints/ perl/interface/
perl/samples/ perl/scripts/ perl/t/ scripts/
Author: jasons
Date: Mon Feb 20 02:42:41 2006
New Revision: 379076
URL: http://svn.apache.org/viewcvs?rev=379076&view=rev
Log:
initial merge of Xerces-P
Added:
xerces/c/trunk/swig/
xerces/c/trunk/swig/interfaces/
- copied from r357987, xerces/xerces-p/trunk/interface/
xerces/c/trunk/swig/interfaces/DOM.i
- copied, changed from r374831, xerces/xerces-p/trunk/interface/DOM.i
xerces/c/trunk/swig/interfaces/Perl/
- copied from r374831, xerces/xerces-p/trunk/interface/Perl/
xerces/c/trunk/swig/interfaces/Perl/Xerces-extra.pm
- copied unchanged from r357987, xerces/xerces-p/trunk/Xerces-extra.pm
xerces/c/trunk/swig/interfaces/SAX.i
- copied unchanged from r374831, xerces/xerces-p/trunk/interface/SAX.i
xerces/c/trunk/swig/interfaces/SAX2.i
- copied unchanged from r374831, xerces/xerces-p/trunk/interface/SAX2.i
xerces/c/trunk/swig/interfaces/Xerces.i
- copied, changed from r365289, xerces/xerces-p/trunk/Xerces.i
xerces/c/trunk/swig/interfaces/callback.i
- copied unchanged from r374831, xerces/xerces-p/trunk/interface/callback.i
xerces/c/trunk/swig/interfaces/defines.i
- copied, changed from r374831, xerces/xerces-p/trunk/interface/defines.i
xerces/c/trunk/swig/interfaces/grammars.i
- copied unchanged from r374831, xerces/xerces-p/trunk/interface/grammars.i
xerces/c/trunk/swig/interfaces/ignore.i
- copied, changed from r374831, xerces/xerces-p/trunk/interface/ignore.i
xerces/c/trunk/swig/interfaces/input-source.i
- copied unchanged from r374831, xerces/xerces-p/trunk/interface/input-source.i
xerces/c/trunk/swig/interfaces/parsers.i
- copied unchanged from r374831, xerces/xerces-p/trunk/interface/parsers.i
xerces/c/trunk/swig/interfaces/typemaps-general.i
- copied, changed from r374831, xerces/xerces-p/trunk/interface/typemaps-general.i
xerces/c/trunk/swig/interfaces/typemaps.i
- copied, changed from r374831, xerces/xerces-p/trunk/interface/typemaps.i
xerces/c/trunk/swig/interfaces/util.i
- copied unchanged from r374831, xerces/xerces-p/trunk/interface/util.i
xerces/c/trunk/swig/perl/
- copied from r357987, xerces/xerces-p/trunk/
xerces/c/trunk/swig/perl/.cvsignore
- copied unchanged from r374831, xerces/xerces-p/trunk/.cvsignore
xerces/c/trunk/swig/perl/ANNOUNCE
- copied unchanged from r374831, xerces/xerces-p/trunk/ANNOUNCE
xerces/c/trunk/swig/perl/ChangeLog
- copied unchanged from r374831, xerces/xerces-p/trunk/ChangeLog
xerces/c/trunk/swig/perl/Changes
- copied unchanged from r374831, xerces/xerces-p/trunk/Changes
xerces/c/trunk/swig/perl/FAQ
- copied unchanged from r374831, xerces/xerces-p/trunk/FAQ
xerces/c/trunk/swig/perl/Handler/
- copied from r374831, xerces/xerces-p/trunk/Handler/
xerces/c/trunk/swig/perl/INSTALL
- copied unchanged from r374831, xerces/xerces-p/trunk/INSTALL
xerces/c/trunk/swig/perl/LICENSE
- copied unchanged from r374831, xerces/xerces-p/trunk/LICENSE
xerces/c/trunk/swig/perl/MANIFEST
- copied, changed from r374831, xerces/xerces-p/trunk/MANIFEST
xerces/c/trunk/swig/perl/MANIFEST.SKIP
- copied unchanged from r374831, xerces/xerces-p/trunk/MANIFEST.SKIP
xerces/c/trunk/swig/perl/META.yml
- copied unchanged from r374831, xerces/xerces-p/trunk/META.yml
xerces/c/trunk/swig/perl/Makefile.PL
- copied, changed from r374831, xerces/xerces-p/trunk/Makefile.PL
xerces/c/trunk/swig/perl/README
- copied unchanged from r374831, xerces/xerces-p/trunk/README
xerces/c/trunk/swig/perl/TODO
- copied unchanged from r374831, xerces/xerces-p/trunk/TODO
xerces/c/trunk/swig/perl/Xerces.cpp
- copied, changed from r374831, xerces/xerces-p/trunk/Xerces.cpp
xerces/c/trunk/swig/perl/Xerces.pm
- copied, changed from r374831, xerces/xerces-p/trunk/Xerces.pm
xerces/c/trunk/swig/perl/docs/
- copied from r374831, xerces/xerces-p/trunk/docs/
xerces/c/trunk/swig/perl/hints/
- copied from r374831, xerces/xerces-p/trunk/hints/
xerces/c/trunk/swig/perl/samples/
- copied from r374831, xerces/xerces-p/trunk/samples/
xerces/c/trunk/swig/perl/scripts/
- copied from r374831, xerces/xerces-p/trunk/scripts/
xerces/c/trunk/swig/perl/t/
- copied from r374831, xerces/xerces-p/trunk/t/
xerces/c/trunk/swig/perl/xerces-headers.txt
- copied unchanged from r374831, xerces/xerces-p/trunk/xerces-headers.txt
xerces/c/trunk/swig/scripts/
xerces/c/trunk/swig/scripts/SWIG.pm
- copied unchanged from r357987, xerces/xerces-p/trunk/SWIG.pm
xerces/c/trunk/swig/scripts/postModule.pl
- copied unchanged from r357987, xerces/xerces-p/trunk/postModule.pl
xerces/c/trunk/swig/scripts/postSource.pl
- copied unchanged from r357987, xerces/xerces-p/trunk/postSource.pl
Removed:
xerces/c/trunk/swig/perl/SWIG.pm
xerces/c/trunk/swig/perl/Xerces-extra.pm
xerces/c/trunk/swig/perl/Xerces.i
xerces/c/trunk/swig/perl/interface/
xerces/c/trunk/swig/perl/postModule.pl
xerces/c/trunk/swig/perl/postSource.pl
Modified:
xerces/c/trunk/swig/interfaces/Perl/errors.i
xerces/c/trunk/swig/interfaces/Perl/shadow.i
xerces/c/trunk/swig/perl/samples/SAX2Count.pl
xerces/c/trunk/swig/perl/t/DOMBuilder.t
xerces/c/trunk/swig/perl/t/DOMElement.t
xerces/c/trunk/swig/perl/t/DOMWriter.t
xerces/c/trunk/swig/perl/t/SAX2XMLReader.t
xerces/c/trunk/swig/perl/t/TestUtils.pm
Copied: xerces/c/trunk/swig/interfaces/DOM.i (from r374831, xerces/xerces-p/trunk/interface/DOM.i)
URL: http://svn.apache.org/viewcvs/xerces/c/trunk/swig/interfaces/DOM.i?p2=xerces/c/trunk/swig/interfaces/DOM.i&p1=xerces/xerces-p/trunk/interface/DOM.i&r1=374831&r2=379076&rev=379076&view=diff
==============================================================================
--- xerces/xerces-p/trunk/interface/DOM.i (original)
+++ xerces/c/trunk/swig/interfaces/DOM.i Mon Feb 20 02:42:41 2006
@@ -80,8 +80,6 @@
%include "xercesc/dom/DOMTreeWalker.hpp"
%include "xercesc/dom/DOMDocumentTraversal.hpp"
-%ignore XERCES_CPP_NAMESPACE::DOMImplementation::loadDOMExceptionMsg;
-
/*
* Introduced in DOM Level 3
*/
@@ -91,23 +89,26 @@
%include "xercesc/dom/DOMImplementationRegistry.hpp"
%include "xercesc/dom/DOMErrorHandler.hpp"
-%include "xercesc/dom/DOMEntityResolver.hpp"
%include "xercesc/dom/DOMDocument.hpp"
%include "xercesc/dom/DOMLocator.hpp"
-// DOMBuiler
-%include "xercesc/dom/DOMInputSource.hpp"
+%include "xercesc/dom/DOMLSResourceResolver.hpp"
+
+// DOMLSParser
+%include "xercesc/dom/DOMLSInput.hpp"
%include "xercesc/framework/Wrapper4InputSource.hpp"
-%include "xercesc/framework/Wrapper4DOMInputSource.hpp"
-%include "xercesc/dom/DOMBuilder.hpp"
+%include "xercesc/framework/Wrapper4DOMLSInput.hpp"
+%import "xercesc/dom/DOMLSParserFilter.hpp"
+%include "xercesc/dom/DOMLSParser.hpp"
// DOMWriter
%import "xercesc/framework/XMLFormatter.hpp"
%include "xercesc/framework/StdOutFormatTarget.hpp"
%include "xercesc/framework/LocalFileFormatTarget.hpp"
%include "xercesc/framework/MemBufFormatTarget.hpp"
-%include "xercesc/dom/DOMWriter.hpp"
-%include "xercesc/dom/DOMWriterFilter.hpp"
+
+%include "xercesc/dom/DOMLSSerializer.hpp"
+%include "xercesc/dom/DOMLSSerializerFilter.hpp"
%extend XERCES_CPP_NAMESPACE::DOMNode {
bool operator==(const DOMNode *other) {
Modified: xerces/c/trunk/swig/interfaces/Perl/errors.i
URL: http://svn.apache.org/viewcvs/xerces/c/trunk/swig/interfaces/Perl/errors.i?rev=379076&r1=374831&r2=379076&view=diff
==============================================================================
--- xerces/c/trunk/swig/interfaces/Perl/errors.i (original)
+++ xerces/c/trunk/swig/interfaces/Perl/errors.i Mon Feb 20 02:42:41 2006
@@ -17,6 +17,16 @@
}
}
+SWIGRUNTIMEINLINE void
+SWIG_Perl_NullRef(const char *type, const char *argname, const char *symname)
+{
+ if (type) {
+ SWIG_Perl_SetErrorf("null reference of type: '%s' was received as argumnent: %s of %s",type,argname,symname);
+ } else {
+ SWIG_Perl_SetErrorf("null reference was received");
+ }
+}
+
SWIGRUNTIME void
SWIG_Perl_TypeError(const char *type, int argnum, const char *symname)
{
Modified: xerces/c/trunk/swig/interfaces/Perl/shadow.i
URL: http://svn.apache.org/viewcvs/xerces/c/trunk/swig/interfaces/Perl/shadow.i?rev=379076&r1=374831&r2=379076&view=diff
==============================================================================
--- xerces/c/trunk/swig/interfaces/Perl/shadow.i (original)
+++ xerces/c/trunk/swig/interfaces/Perl/shadow.i Mon Feb 20 02:42:41 2006
@@ -40,7 +40,7 @@
SET_ERRORHANDLER(Parser)
SET_ERRORHANDLER(SAX2XMLReader)
SET_ERRORHANDLER(SAXParser)
-SET_ERRORHANDLER(DOMBuilder)
+SET_ERRORHANDLER(DOMLSParser)
SET_ERRORHANDLER(DOMWriter)
SET_ERRORHANDLER(XercesDOMParser)
@@ -61,7 +61,7 @@
SET_ENTITYRESOLVER(Parser)
SET_ENTITYRESOLVER(SAX2XMLReader)
SET_ENTITYRESOLVER(SAXParser)
-SET_ENTITYRESOLVER(DOMBuilder)
+SET_ENTITYRESOLVER(DOMLSParser)
SET_ENTITYRESOLVER(XercesDOMParser)
// Define a macro to rewrite all methods that return a list of DOMNodes
Copied: xerces/c/trunk/swig/interfaces/Xerces.i (from r365289, xerces/xerces-p/trunk/Xerces.i)
URL: http://svn.apache.org/viewcvs/xerces/c/trunk/swig/interfaces/Xerces.i?p2=xerces/c/trunk/swig/interfaces/Xerces.i&p1=xerces/xerces-p/trunk/Xerces.i&r1=365289&r2=379076&rev=379076&view=diff
==============================================================================
--- xerces/xerces-p/trunk/Xerces.i (original)
+++ xerces/c/trunk/swig/interfaces/Xerces.i Mon Feb 20 02:42:41 2006
@@ -29,17 +29,17 @@
%module "XML::Xerces"
#endif
-%include "interface/defines.i"
+%include "defines.i"
-%include "interface/typemaps.i"
+%include "typemaps.i"
/*
* Import the language specific macros
*/
#ifdef SWIGPERL
-%include "interface/Perl/callback.i"
-%include "interface/Perl/shadow.i"
+%include "Perl/callback.i"
+%include "Perl/shadow.i"
#endif
/*****************************/
@@ -48,17 +48,9 @@
/* */
/*****************************/
-#ifdef XML_LINUX
-%import "xercesc/util/Platforms/Linux/LinuxDefs.hpp"
-#endif
-
-#ifdef XML_MACOSX
-%import "xercesc/util/Platforms/MacOS/MacOSDefs.hpp"
-#endif
-
-#ifdef XML_GCC
-%import "xercesc/util/Compilers/GCCDefs.hpp"
-#endif
+// we seem to need these defs loaded before parsing XercesDefs.hpp
+// as of Xerces-3.0
+%import "xercesc/util/Xerces_autoconf_config.hpp" // for XMLSize_t and namespaces
%import "xercesc/util/XercesDefs.hpp"
@@ -113,7 +105,7 @@
* All %ignore directives
*/
-%include "interface/ignore.i"
+%include "ignore.i"
/*
* Operator support
@@ -128,50 +120,50 @@
* Utility Classes
*/
-%include "interface/util.i"
+%include "util.i"
/*
* XML Schema Grammar support (DTD and W3C XML Schema)
*/
-%include "interface/grammars.i"
+%include "grammars.i"
/*
* InputSource
*/
-%include "interface/input-source.i"
+%include "input-source.i"
/*
* DOM
*/
-%include "interface/DOM.i"
+%include "DOM.i"
/*
* SAX1
*/
-%include "interface/SAX.i"
+%include "SAX.i"
/*
* SAX2
*/
-%include "interface/SAX2.i"
+%include "SAX2.i"
/*
* Parsers
*/
-%include "interface/parsers.i"
+%include "parsers.i"
/*
* Callbacks - this needs to be at the very end
* so that SWIG can wrap the superclass methods properly
*/
-%include "interface/callback.i"
+%include "callback.i"
/*
* Include extra verbatim C code in the initialization function
@@ -192,14 +184,17 @@
}
#ifdef SWIGPERL
+
/*
* Include extra verbatim Perl code
*/
-%pragma(perl5) include="Xerces-extra.pm"
+%pragma(perl5) include="../interfaces/Perl/Xerces-extra.pm"
/*
* Include extra verbatim Perl code immediately after Module header
*/
+
%pragma(perl5) code="package XML::Xerces;
use vars qw($VERSION @EXPORT);"
-#endif
\ No newline at end of file
+
+#endif
Copied: xerces/c/trunk/swig/interfaces/defines.i (from r374831, xerces/xerces-p/trunk/interface/defines.i)
URL: http://svn.apache.org/viewcvs/xerces/c/trunk/swig/interfaces/defines.i?p2=xerces/c/trunk/swig/interfaces/defines.i&p1=xerces/xerces-p/trunk/interface/defines.i&r1=374831&r2=379076&rev=379076&view=diff
==============================================================================
--- xerces/xerces-p/trunk/interface/defines.i (original)
+++ xerces/c/trunk/swig/interfaces/defines.i Mon Feb 20 02:42:41 2006
@@ -66,7 +66,7 @@
#include "xercesc/framework/LocalFileFormatTarget.hpp"
#include "xercesc/framework/StdOutFormatTarget.hpp"
#include "xercesc/framework/Wrapper4InputSource.hpp"
-#include "xercesc/framework/Wrapper4DOMInputSource.hpp"
+#include "xercesc/framework/Wrapper4DOMLSInput.hpp"
#include "xercesc/framework/psvi/PSVIHandler.hpp"
// for resolving XMLExceptions
@@ -109,9 +109,9 @@
*/
#ifdef SWIGPERL
-%include "interface/Perl/defines.i"
-%include "interface/Perl/transcode.i"
-%include "interface/Perl/errors.i"
+%include "Perl/defines.i"
+%include "Perl/transcode.i"
+%include "Perl/errors.i"
#endif
Copied: xerces/c/trunk/swig/interfaces/ignore.i (from r374831, xerces/xerces-p/trunk/interface/ignore.i)
URL: http://svn.apache.org/viewcvs/xerces/c/trunk/swig/interfaces/ignore.i?p2=xerces/c/trunk/swig/interfaces/ignore.i&p1=xerces/xerces-p/trunk/interface/ignore.i&r1=374831&r2=379076&rev=379076&view=diff
==============================================================================
--- xerces/xerces-p/trunk/interface/ignore.i (original)
+++ xerces/c/trunk/swig/interfaces/ignore.i Mon Feb 20 02:42:41 2006
@@ -55,7 +55,7 @@
%ignore PerlErrorCallbackHandler::fatalError(const SAXParseException&);
// ignore the char* versions of ALL constructors
-%ignore XERCES_CPP_NAMESPACE::DOMBuilder::parseURI(const char *const );
+%ignore XERCES_CPP_NAMESPACE::DOMLSParser::parseURI(const char *const );
%ignore MemBufInputSource(const XMLByte* const, const unsigned int, const char* const,
const bool foo=false,
MemoryManager* const foo=XMLPlatformUtils::fgMemoryManager);
@@ -125,7 +125,7 @@
// *after* the memory manager. So we just ignore the method that doesn't
// include the memory manager - since our typemap defaults that argument
// they are redundant
-%ignore createDOMBuilder(short const,const XMLCh* const);
+%ignore createDOMLSParser(short const,const XMLCh* const);
%ignore SAXParser(XMLValidator* const);
%ignore createXMLReader();
@@ -215,8 +215,11 @@
, const bool fromIntSubset = false
, const bool specialChar = false);
+%ignore XERCES_CPP_NAMESPACE::DOMImplementation::loadDOMExceptionMsg;
+
/*
- * Perl won't need to create exceptions
+ * Perl won't need to create exceptions -- FIXME -- not true
+ * callbacks should be able to call exceptions
*/
%ignore DOMException();
@@ -296,20 +299,6 @@
%ignore XERCES_CPP_NAMESPACE::SchemaAttDef::SchemaAttDef;
%ignore XERCES_CPP_NAMESPACE::DTDAttDefList::DTDAttDefList;
%ignore XERCES_CPP_NAMESPACE::SchemaAttDefList::SchemaAttDefList;
-
-// desperate attempt to get this working
-// FIXME
-%ignore SchemaAttDefList
- (
- RefHash2KeysTableOf<SchemaAttDef>* const listToUse,
- MemoryManager* const manager = XMLPlatformUtils::fgMemoryManager
- );
-
-%ignore DTDAttDefList
- (
- RefHashTableOf<DTDAttDef>* const listToUse,
- MemoryManager* const manager = XMLPlatformUtils::fgMemoryManager
- );
/*
* methods not needed by the public Parser interfaces
Copied: xerces/c/trunk/swig/interfaces/typemaps-general.i (from r374831, xerces/xerces-p/trunk/interface/typemaps-general.i)
URL: http://svn.apache.org/viewcvs/xerces/c/trunk/swig/interfaces/typemaps-general.i?p2=xerces/c/trunk/swig/interfaces/typemaps-general.i&p1=xerces/xerces-p/trunk/interface/typemaps-general.i&r1=374831&r2=379076&rev=379076&view=diff
==============================================================================
--- xerces/xerces-p/trunk/interface/typemaps-general.i (original)
+++ xerces/c/trunk/swig/interfaces/typemaps-general.i Mon Feb 20 02:42:41 2006
@@ -18,7 +18,7 @@
* Scripting languages are not going to change the default memory manager
* so we always default this argument
*/
-%typemap(in,numinputs=0) XERCES_CPP_NAMESPACE::MemoryManager* const manager "$1 = XERCES_CPP_NAMESPACE::XMLPlatformUtils::fgMemoryManager;"
+// %typemap(default,numinputs=0) XERCES_CPP_NAMESPACE::MemoryManager* const manager "$1 = XERCES_CPP_NAMESPACE::XMLPlatformUtils::fgMemoryManager;"
/*
* MemBufInputSource::MemBufInputSource()
@@ -39,6 +39,38 @@
%typemap(in,numinputs=0) const bool adoptFlag "$1 = true;" // for Wrapper4InputSource
// and Wrapper4DOMInputSource
%typemap(in,numinputs=0) const bool adoptBuffer "$1 = true;" // for MemBufInputSource
+
+// SAX2XMLReader::setProperty() should refuse the option to set the
+// security manager
+%extend XERCES_CPP_NAMESPACE::SAX2XMLReader {
+%typemap(check) (const XMLCh* const name, void* value) {
+ if (XMLString::compareIStringASCII($1, XMLUni::fgXercesSecurityManager) == 0) {
+ makeSAXNotSupportedException(SAXNotSupportedException("Setting security manageer not supported"));
+ goto fail;
+ }
+}
+
+/*
+ * Enable conversion of void* => XMLCh* in setProperty()
+ *
+ * The in typemap converts the void* to an XMLCh*
+ *
+ * The freearg typemap deletes the transcoded string
+ *
+ */
+%typemap(in) (void* value) {
+ // now check the value
+ if ($input == &PL_sv_undef) {
+ SWIG_Perl_NullRef("perl-string",$argnum,"$symname");
+ goto fail;
+ } else {
+ // we convert *everything* into a string that isn't undef
+ $1 = Perl2XMLString($input);
+ }
+}
+%typemap(freearg) void * %{
+ delete[] $1;
+%}
/*
* Dynamic Casts
Copied: xerces/c/trunk/swig/interfaces/typemaps.i (from r374831, xerces/xerces-p/trunk/interface/typemaps.i)
URL: http://svn.apache.org/viewcvs/xerces/c/trunk/swig/interfaces/typemaps.i?p2=xerces/c/trunk/swig/interfaces/typemaps.i&p1=xerces/xerces-p/trunk/interface/typemaps.i&r1=374831&r2=379076&rev=379076&view=diff
==============================================================================
--- xerces/xerces-p/trunk/interface/typemaps.i (original)
+++ xerces/c/trunk/swig/interfaces/typemaps.i Mon Feb 20 02:42:41 2006
@@ -23,6 +23,9 @@
%include typemaps-general.i
#ifdef SWIGPERL
-%include "interface/Perl/typemaps.i"
-%include "interface/Perl/typemaps-xmlch.i"
-#endif
\ No newline at end of file
+%include "Perl/typemaps.i"
+%include "Perl/typemaps-xmlch.i"
+#endif
+
+// this is new for Xerces-3
+%apply size_t { ssize_t };
\ No newline at end of file
Copied: xerces/c/trunk/swig/perl/MANIFEST (from r374831, xerces/xerces-p/trunk/MANIFEST)
URL: http://svn.apache.org/viewcvs/xerces/c/trunk/swig/perl/MANIFEST?p2=xerces/c/trunk/swig/perl/MANIFEST&p1=xerces/xerces-p/trunk/MANIFEST&r1=374831&r2=379076&rev=379076&view=diff
==============================================================================
--- xerces/xerces-p/trunk/MANIFEST (original)
+++ xerces/c/trunk/swig/perl/MANIFEST Mon Feb 20 02:42:41 2006
@@ -132,36 +132,7 @@
# These are only useful for developers and those wishing to regenerate
# Xerces.cpp and Xerces.pm
-Xerces-extra.pm
-Xerces.i
-SWIG.pm
Handler/PerlCallbackHandler.swig.hpp
-postModule.pl
-postSource.pl
-
-
-# scripting language independent SWIG files
-interface/DOM.i
-interface/defines.i
-interface/typemaps-general.i
-interface/typemaps.i
-interface/callback.i
-interface/grammars.i
-interface/ignore.i
-interface/input-source.i
-interface/parsers.i
-interface/SAX.i
-interface/SAX2.i
-interface/util.i
-
-# scripting language specific SWIG files
-interface/Perl/shadow.i
-interface/Perl/typemaps.i
-interface/Perl/transcode.i
-interface/Perl/defines.i
-interface/Perl/callback.i
-interface/Perl/typemaps-xmlch.i
-interface/Perl/errors.i
# scripts for testing XML::Xerces
scripts/memtest-light.pl
Copied: xerces/c/trunk/swig/perl/Makefile.PL (from r374831, xerces/xerces-p/trunk/Makefile.PL)
URL: http://svn.apache.org/viewcvs/xerces/c/trunk/swig/perl/Makefile.PL?p2=xerces/c/trunk/swig/perl/Makefile.PL&p1=xerces/xerces-p/trunk/Makefile.PL&r1=374831&r2=379076&rev=379076&view=diff
==============================================================================
--- xerces/xerces-p/trunk/Makefile.PL (original)
+++ xerces/c/trunk/swig/perl/Makefile.PL Mon Feb 20 02:42:41 2006
@@ -15,19 +15,17 @@
#
use ExtUtils::MakeMaker;
-use Env qw(XERCES_LIB
- XERCES_CONFIG
- XERCES_INCLUDE
- XERCESCROOT
+use Env qw(XERCES_CONFIG
XERCES_DEVEL
SWIG);
use strict;
use vars qw($INCLUDES $CXX $CFLAGS @LDFLAGS @OPTIMIZE);
use File::Basename;
+use Cwd qw(abs_path);
# We need to know which version of libxerces we are to use.
# As of Xerces-C 1.5.1, minor version numbers are used
-my $XERCES_MAJOR_VERSION = '2.7';
+my $XERCES_MAJOR_VERSION = '3.0';
my $XERCES_MINOR_VERSION = '0';
my $XERCES_LIB_VERSION = "$XERCES_MAJOR_VERSION.$XERCES_MINOR_VERSION";
my $XERCES_PERL_VERSION = $XERCES_LIB_VERSION . '-0';
@@ -50,126 +48,73 @@
ERROR
}
-
-if (defined $XERCES_LIB || defined $XERCES_INCLUDE) {
- # this is the default, so do nothing
-} elsif (defined $XERCESCROOT) {
- # they are instructing us to use the build directories
- $XERCES_INCLUDE = "$XERCESCROOT/include";
- $XERCES_LIB = "$XERCESCROOT/lib";
-}
-
+my $XERCESCROOT = abs_path('../..');
+my $XERCES_INCLUDE = "$XERCESCROOT/src";
+my $XERCES_LIB = "$XERCESCROOT/obj/.libs";
my $LIBS = '-lpthread';
-$INCLUDES = '-I. -IHandler';
-if (defined $XERCES_LIB) {
- print STDERR "Using XERCES_LIB = $XERCES_LIB\n";
- $LIBS .= " -L$XERCES_LIB ";
-}
-if (defined $XERCES_INCLUDE) {
- print STDERR "Using XERCES_INCLUDE = $XERCES_INCLUDE\n";
- $INCLUDES .= " -I$XERCES_INCLUDE";
-}
+$INCLUDES = '-I. -IHandler';
-if (!defined $XERCES_LIB && !defined $XERCES_INCLUDE) {
- print STDERR <<EOW;
+print STDERR "Using XERCES_LIB = $XERCES_LIB\n";
+$LIBS .= " -L$XERCES_LIB ";
- WARNING
+print STDERR "Using XERCES_INCLUDE = $XERCES_INCLUDE\n";
+$INCLUDES .= " -I$XERCES_INCLUDE -I$XERCESCROOT";
-You have not defined any of the following environment variables:
- XERCESCROOT
- XERCES_LIB
- XERCES_INCLUDE
-
-These instruct me how to locate the Xerces header files, and the
-Xerces dynamic library. If they are installed in a standard system
-directory, I will located them without those variables.
-
-However, if they have been installed in a non-standard location
-(e.g. '/usr/include/xerces'), then I will need help. See the README
-for more info.
-
-Proceeding ...
-EOW
-}
my $config_file = 'config.status';
my $CXXFLAGS;
my $LDFLAGS;
-if (defined $XERCES_CONFIG) {
- unless (-f $XERCES_CONFIG) {
- print STDERR <<EOW;
+my $XERCES_CONFIG = "$XERCESCROOT/$config_file";
- WARNING
-
-You have defined the XERCES_CONFIG variable, but it does not seem to
-point to the $config_file file that was used to build your Xerces-C
-library. Without that file, I may not be able to properly build the
-C++ glue files that come with Xerces.pm.
-
-Proceeding anyway ...
-EOW
- }
-} elsif (defined $XERCESCROOT) {
- $XERCES_CONFIG = "$XERCESCROOT/src/xercesc/$config_file";
- unless (-f $XERCES_CONFIG) {
- print STDERR <<EOW;
+unless (-f $XERCES_CONFIG) {
+ print STDERR <<EOW;
WARNING
-You have defined the XERCESCROOT variable, but the file:
+I am looking for the Xerces-C compilation config file. This should
+have been located at:
- XERCESCROOT/src/xercesc/$config_file
+ $XERCES_CONFIG
- does not seem to point to the $config_file file that was used to
- build your Xerces-C library. Without that file, I may not be able to
- properly build the C++ glue files that come with Xerces.pm.
+but this does not seem to point to the $config_file file that was used
+to build your Xerces-C library. Without that file, I may not be able
+to properly build the C++ glue files that come with Xerces.pm.
Proceeding anyway ...
EOW
- }
-} else {
- print STDERR <<EOW;
-
- WARNING
-
-You have not defined any of the following environment variables:
- XERCESCROOT
- XERCES_CONFIG
-
-Without these I cannot find the $config_file file that was used to
-build your Xerces-C library. Without that file, I may not be able to properly
-build the C++ glue files that come with Xerces.pm.
-Proceeding anyway ...
-EOW
}
if (-f $XERCES_CONFIG) {
print STDERR "using XERCES_CONFIG: $XERCES_CONFIG\n";
open(CONF,$XERCES_CONFIG)
or die "Couldn't open $XERCES_CONFIG for reading";
+ my $sep;
while (<CONF>) {
if (/\@CXXFLAGS\@/) {
- my ($flags) = /%([^%]*)%g$/;
+ my ($sep, $flags) = /^s(.)\@CXXFLAGS\@\1([^\1]*)\1;/;
my @flags = split /\s+/, $flags;
my @new_flags;
foreach my $flag (@flags) {
if ($flag =~ /^(-(g|O).?)$/) {
- @OPTIMIZE = (OPTIMIZE => $1);
+ push(@OPTIMIZE, $1);
next;
} elsif ($flag =~ /^-DPROJ_/) {
next;
}
push(@new_flags,$flag);
}
+ if (scalar @OPTIMIZE) {
+ @OPTIMIZE = (OPTIMIZE => join(" ", @OPTIMIZE));
+ }
($CXXFLAGS) = join(' ',@new_flags);
} elsif (/\@LDFLAGS\@/) {
- ($LDFLAGS) = /%([^%]*)%g$/;
+ ($sep, $LDFLAGS) = /^s(.)\@LDFLAGS\@\1([^\1]*)\1;/;
@LDFLAGS = ('LDFLAGS' => $LDFLAGS)
if $LDFLAGS !~ /^\s*$/;
} elsif (/\@CXX\@/) {
- ($CXX) = /%([^%]*)%g$/
+ ($sep, $CXX) = /^s(.)\@CXX\@\1([^\1]*)\1;/
}
}
print STDERR <<EOM;
@@ -177,6 +122,7 @@
Found CXX = $CXX
Found CXXFLAGS = $CXXFLAGS
Found LDFLAGS = $LDFLAGS
+Found OPTIMIZE = @OPTIMIZE
EOM
}
@@ -218,9 +164,12 @@
EOE
+# give some nice feedback for the user
+print STDERR "Located Xerces-C version: $XERCES_VERSION\n";
+
# this substitution will yield '1_4' from '1.4' to be used by 'LIBS'
# $XERCES_LIB_VERSION =~ s/\./_/g;
-my $LIBXERCES = "-lxerces-c";
+my $LIBXERCES = "-lxerces";
if ($^O eq 'cygwin') {
$LIBXERCES .= "$major$minor.dll";
} elsif ($^O eq 'MSWin32') {
@@ -228,30 +177,20 @@
}
$LIBS .= " $LIBXERCES";
-# now we ensure that libxerces is in the library path
-# if not we die()
-print STDERR "Checking to see if libxerces is in your library path...";
-my $lib = 1;
-#($lib) = MM->new->ExtUtils::Liblist::ext($LIBS);
-
-die <<EOE unless $lib;
+my $libxerces_name = "libxerces-$major.$minor.so";
+my $libxerces_path = "$XERCES_LIB/$libxerces_name";
+die <<EOE unless -f $libxerces_path;
!!!WHOA!!!
-I couldn\'t find $LIBXERCES anywhere in your library path. Begging to
-differ with perl, this is most assuredly *NOT* harmless. This is a
-critical error that will prevent you from running Xerces.pm.
+I couldn\'t find the xerces library at:
-Check your settings of \$XERCES_INCLUDE and \$XERCES_LIB, and rerun
-'perl Makefile.PL'
+ $libxerces_path
EOE
-print STDERR "Success!!\n";
-
-# give some nice feedback for the user
-print STDERR "Using Xerces-C version: $XERCES_VERSION\n";
+print STDERR "Successfully located $libxerces_name!!\n";
my $HANDLER_LIB = '$(INST_ARCHLIB)/auto/Handler/Handler$(LIB_EXT)';
@@ -268,6 +207,9 @@
my @MACRO;
$CFLAGS .= '-D_REENTRANT';
+my $HANDLER_DIR = 'Handler';
+my $INTERFACE_DIR = '../interfaces';
+my $SCRIPTS_DIR = '../scripts';
# we only consider using SWIG if we are a Xerces Developer
if ($XERCES_DEVEL) {
# replace this with the path to your Unix compatible find application
@@ -277,14 +219,14 @@
my @header_files;
my @handler_headers;
my @interface_files;
- chomp(@handler_headers = `$FIND Handler -name "*.swig.hpp"`);
+ chomp(@handler_headers = `$FIND $HANDLER_DIR -name "*.swig.hpp"`);
sub Xerces_postamble {
- chomp(my @import_files = `$FIND Handler -name "*.i"`);
+ chomp(my @import_files = `$FIND $HANDLER_DIR -name "*.i"`);
push(@header_files,@handler_headers,@import_files);
- chomp(my @interface_files = `$FIND interface -name "*.i"`);
- @interface_files = grep {$_ ne 'interface/Perl/shadow.i'} @interface_files;
+ chomp(my @interface_files = `$FIND $INTERFACE_DIR -name "*.i"`);
+ @interface_files = grep {$_ !~ /shadow\.i/} @interface_files;
local $" = ' ';
my $OS_DEF;
my $CC_DEF;
@@ -311,20 +253,20 @@
### We no longer need to munge the C++ code thanks to SWIG improvements
# perl postSource.pl Xerces.cpp
my $retval = <<TERMINUS;
-Xerces-tmp.pm: postModule.pl interface/Perl/shadow.i
- \$(SWIG) $SWIG_ARGS -o Xerces-tmp.cpp Xerces.i
+Xerces-tmp.pm: $SCRIPTS_DIR/postModule.pl $INTERFACE_DIR/Perl/shadow.i
+ \$(SWIG) $SWIG_ARGS -o Xerces-tmp.cpp $INTERFACE_DIR/Xerces.i
mv Xerces.pm Xerces-tmp.pm
-Xerces.pm: postModule.pl Xerces-tmp.pm
- perl postModule.pl
+Xerces.pm: $SCRIPTS_DIR/postModule.pl Xerces-tmp.pm
+ perl -I$SCRIPTS_DIR $SCRIPTS_DIR/postModule.pl
-Xerces.cpp: postSource.pl Xerces-tmp.cpp
- perl postSource.pl
+Xerces.cpp: $SCRIPTS_DIR/postSource.pl Xerces-tmp.cpp
+ perl -I$SCRIPTS_DIR $SCRIPTS_DIR/postSource.pl
-Xerces-tmp.cpp: Xerces.i @interface_files @header_files Xerces-extra.pm
- \$(SWIG) $SWIG_ARGS -o Xerces-tmp.cpp Xerces.i
+Xerces-tmp.cpp: $INTERFACE_DIR/Xerces.i @interface_files @header_files $INTERFACE_DIR/Perl/Xerces-extra.pm
+ \$(SWIG) $SWIG_ARGS -o Xerces-tmp.cpp $INTERFACE_DIR/Xerces.i
mv Xerces.pm Xerces-tmp.pm
- perl postModule.pl
+ perl -I$SCRIPTS_DIR $SCRIPTS_DIR/postModule.pl
cp -f Xerces.pm blib/lib/XML/Xerces.pm
$HANDLER_LIB:
@@ -353,7 +295,7 @@
# see the hints/ directory for architecture specific stuff!
WriteMakefile(
'NAME' => 'XML::Xerces',
- 'AUTHOR' => 'The Xerces-P developers: xerces-p-dev@xml.apache.org',
+ 'AUTHOR' => 'The Xerces-P developers: p-dev@xerces.apache.org',
'ABSTRACT' => 'Perl Interface for Xerces XML API',
'CC' => $CXX,
'CCFLAGS' => $CFLAGS,
---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@xerces.apache.org
For additional commands, e-mail: commits-help@xerces.apache.org