Author: jasons
Date: Mon Aug 28 03:59:52 2006
New Revision: 437651
URL: http://svn.apache.org/viewvc?rev=437651&view=rev
Log:
fixed post{Module,Source}.pl to take --in and --out
preparing for DOM split
perl module now builds libxerces if it doesn't exist
Modified:
xerces/c/trunk/swig/perl/Makefile.PL
xerces/c/trunk/swig/scripts/postModule.pl
xerces/c/trunk/swig/scripts/postSource.pl
Modified: xerces/c/trunk/swig/perl/Makefile.PL
URL:
http://svn.apache.org/viewvc/xerces/c/trunk/swig/perl/Makefile.PL?rev=437651&r1=437650&r2=437651&view=diff
==============================================================================
--- xerces/c/trunk/swig/perl/Makefile.PL (original)
+++ xerces/c/trunk/swig/perl/Makefile.PL Mon Aug 28 03:59:52 2006
@@ -51,6 +51,12 @@
my $XERCESCROOT = abs_path('../..');
my $XERCES_INCLUDE = "$XERCESCROOT/src";
my $XERCES_LIB = "$XERCESCROOT/obj/.libs";
+unless (-d $XERCES_LIB) {
+ print STDERR "Building Xerces-C\n";
+ system("make -C $XERCESCROOT");
+ die "Error building Xerces-C\n$!"
+ if $?;
+}
my $LIBS = '-lpthread';
$INCLUDES = '-I. -IHandler';
@@ -219,14 +225,19 @@
my @header_files;
my @handler_headers;
my @interface_files;
+ my @dom_interface_files;
+ my @non_dom_interface_files;
chomp(@handler_headers = `$FIND $HANDLER_DIR -name "*.swig.hpp"`);
+ @OPTIMIZE = (OPTIMIZE => '-g');
sub Xerces_postamble {
chomp(my @import_files = `$FIND $HANDLER_DIR -name "*.i"`);
push(@header_files,@handler_headers,@import_files);
chomp(my @interface_files = `$FIND $INTERFACE_DIR -name "*.i"`);
@interface_files = grep {$_ !~ /shadow\.i/} @interface_files;
+ @dom_interface_files = grep {$_ =~ /dom/} @interface_files;
+ @non_dom_interface_files = grep {$_ !~ /dom/} @interface_files;
local $" = ' ';
my $OS_DEF;
my $CC_DEF;
@@ -258,15 +269,15 @@
mv Xerces.pm Xerces-tmp.pm
Xerces.pm: $SCRIPTS_DIR/postModule.pl Xerces-tmp.pm
- perl -I$SCRIPTS_DIR $SCRIPTS_DIR/postModule.pl
+ perl -I$SCRIPTS_DIR $SCRIPTS_DIR/postModule.pl --in=Xerces-tmp.pm
--out=Xerces.pm
Xerces.cpp: $SCRIPTS_DIR/postSource.pl Xerces-tmp.cpp
- perl -I$SCRIPTS_DIR $SCRIPTS_DIR/postSource.pl
+ perl -I$SCRIPTS_DIR $SCRIPTS_DIR/postSource.pl --in=Xerces-tmp.cpp
--out=Xerces.cpp
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 -I$SCRIPTS_DIR $SCRIPTS_DIR/postModule.pl
+ perl -I$SCRIPTS_DIR $SCRIPTS_DIR/postModule.pl --in=Xerces-tmp.pm
--out=Xerces.pm
cp -f Xerces.pm blib/lib/XML/Xerces.pm
$HANDLER_LIB:
Modified: xerces/c/trunk/swig/scripts/postModule.pl
URL:
http://svn.apache.org/viewvc/xerces/c/trunk/swig/scripts/postModule.pl?rev=437651&r1=437650&r2=437651&view=diff
==============================================================================
--- xerces/c/trunk/swig/scripts/postModule.pl (original)
+++ xerces/c/trunk/swig/scripts/postModule.pl Mon Aug 28 03:59:52 2006
@@ -1,16 +1,26 @@
#!/usr/bin/perl -w
-
-use lib '.';
use strict;
-use SWIG qw(remove_method skip_to_closing_brace fix_method);
+
use File::Temp qw/tempfile/;
use File::Copy;
+use Getopt::Long;
+
+my $USAGE = <<USAGE;
+USAGE: $0 --infile=name --outfile=name
+USAGE
+
+my %OPTIONS;
+my $rc = GetOptions(\%OPTIONS,
+ 'infile=s',
+ 'outfile=s',
+ );
+die $USAGE unless $rc;
-my $INFILE = "Xerces-tmp.pm";
-my $OUTFILE = "Xerces.pm";
+die $USAGE unless exists $OPTIONS{infile};
+die $USAGE unless exists $OPTIONS{outfile};
-open(FILE, $INFILE)
- or die "Couldn't open $INFILE for reading";
+open(FILE, $OPTIONS{infile})
+ or die "Couldn't open $OPTIONS{infile} for reading";
my ($temp_fh, $temp_filename) = tempfile();
@@ -41,61 +51,14 @@
my $CURR_CLASS = '';
while ($_ = <FILE>) {
-
- if (/^package/) {
- if (m/package\s+XML::Xerces::(\w+);/) {
- ($CURR_CLASS) = $1;
- }
- print $temp_fh $_;
- next;
- }
-
-# # for some reason (I don't want to figure out) SWIG puts a bunch of
-# # methods directly in the XML::Xerces namespace that don't belong there
-# # and are duplicated within their proper classes, so we delete them
-# if (/FUNCTION WRAPPERS/) {
-# while ($_ = <FILE>) {
-# next unless /\#\#\#\#\#\#\#\#\#\#\#\#\#/;
-# last;
-# }
-# }
-#
-# # we remove all the enums inherited through DOMNode
-# next if /^\*[_A-Z]+_NODE =/ && !/DOMNode/;
-#
-# # now we set these aliases correctly
-# s/\*XML::Xerces::/*XML::Xercesc::/;
-
- #######################################################################
- #
- # MUNGE MODULE for XMLCh support
- #
- # CHANGE "$args[0] = tied(%{$args[0]})"
- # TO "$args[0] = tied(%{$args[0]}) || $args[0]"
- # then we wrap it in a defined $args[0] to remove the irritating warning
-# if (m{\$args\[0\]\s+=\s+tied\(\%\{\$args\[0\]\}\)}) {
-# print $temp_fh <<'EOT';
-# if (defined $args[0]) {
-# $args[0] = tied(%{$args[0]}) || $args[0];
-# }
-# EOT
-# next;
-# }
-
-
- # CHANGE "return undef if (!defined($result))"
- # TO "return $result unless ref($result) =~ m[XML::Xerces]"
- # split on multiple lines to be readable, using s{}{}x
-# s{
-# return\s*undef\s*if\s*\(\!defined\(\$result\)\)
-# }{return \$result unless UNIVERSAL::isa(\$result,'XML::Xerces')}x;
-
print $temp_fh $_;
}
close(FILE);
close($temp_fh);
-copy($temp_filename, $OUTFILE);
+copy($temp_filename, $OPTIONS{outfile});
END {unlink($temp_filename)}
+
+exit(0);
Modified: xerces/c/trunk/swig/scripts/postSource.pl
URL:
http://svn.apache.org/viewvc/xerces/c/trunk/swig/scripts/postSource.pl?rev=437651&r1=437650&r2=437651&view=diff
==============================================================================
--- xerces/c/trunk/swig/scripts/postSource.pl (original)
+++ xerces/c/trunk/swig/scripts/postSource.pl Mon Aug 28 03:59:52 2006
@@ -1,20 +1,30 @@
-#!/usr/bin/perl
-use lib '.';
-use SWIG qw(remove_method skip_to_closing_brace fix_method);
+#!/usr/bin/perl -w
+use strict;
+
use File::Temp qw/tempfile/;
use File::Copy;
+use Getopt::Long;
-use strict;
+my $USAGE = <<USAGE;
+USAGE: $0 --infile=name --outfile=name
+USAGE
+
+my %OPTIONS;
+my $rc = GetOptions(\%OPTIONS,
+ 'infile=s',
+ 'outfile=s',
+ );
+die $USAGE unless $rc;
+
+die $USAGE unless exists $OPTIONS{infile};
+die $USAGE unless exists $OPTIONS{outfile};
###
### SWIG has now improved to the point that this file only installs the license
###
-my $INFILE = "Xerces-tmp.cpp";
-my $OUTFILE = "Xerces.cpp";
-
-open(FILE, $INFILE)
- or die "Couldn't open $INFILE for reading";
+open(FILE, $OPTIONS{infile})
+ or die "Couldn't open $OPTIONS{infile} for reading";
my ($temp_fh, $temp_filename) = tempfile();
@@ -43,15 +53,15 @@
print $temp_fh $LICENSE;
-FILE: while(<FILE>) {
+while(<FILE>) {
print $temp_fh $_;
}
close FILE;
close $temp_fh;
-copy($temp_filename, $OUTFILE)
- or die "Couldn't move $temp_filename to $OUTFILE: $!";
+copy($temp_filename, $OPTIONS{outfile})
+ or die "Couldn't move $temp_filename to $OPTIONS{outfile}: $!";
END {unlink($temp_filename)}
---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]