diff options
author | Charles Bailey <bailey@newman.upenn.edu> | 1999-07-02 15:18:41 -0400 |
---|---|---|
committer | Gurusamy Sarathy <gsar@cpan.org> | 1999-07-07 17:45:52 +0000 |
commit | 1f47e8e2e6e01cf4845f0f3f0f0c7524761ffa80 (patch) | |
tree | d302430354d07e16ddf40f2a034ab55b14889d8b /lib | |
parent | cae6c631be0cfed1f388d3116e456beb58714d6e (diff) | |
download | perl-1f47e8e2e6e01cf4845f0f3f0f0c7524761ffa80.tar.gz |
applied new parts of suggested patch
Message-id: <01JD3M8W1VXS000S5G@mail.newman.upenn.edu>
Subject: [PATCH 5.005_57] Consolidated VMS patch
p4raw-id: //depot/perl@3650
Diffstat (limited to 'lib')
-rw-r--r-- | lib/ExtUtils/MM_VMS.pm | 52 | ||||
-rw-r--r-- | lib/File/Basename.pm | 2 | ||||
-rw-r--r-- | lib/File/Spec/VMS.pm | 68 |
3 files changed, 97 insertions, 25 deletions
diff --git a/lib/ExtUtils/MM_VMS.pm b/lib/ExtUtils/MM_VMS.pm index c77eebe50f..ba4c2cc0c4 100644 --- a/lib/ExtUtils/MM_VMS.pm +++ b/lib/ExtUtils/MM_VMS.pm @@ -14,7 +14,7 @@ use VMS::Filespec; use File::Basename; use vars qw($Revision); -$Revision = '5.52 (12-Sep-1998)'; +$Revision = '5.56 (27-Apr-1999)'; unshift @MM::ISA, 'ExtUtils::MM_VMS'; @@ -626,10 +626,13 @@ sub constants { my(@m,$def,$macro); if ($self->{DEFINE} ne '') { - my(@defs) = split(/\s+/,$self->{DEFINE}); - foreach $def (@defs) { + my(@terms) = split(/\s+/,$self->{DEFINE}); + my(@defs,@udefs); + foreach $def (@terms) { next unless $def; - if ($def =~ s/^-D//) { # If it was a Unix-style definition + my $targ = \@defs; + if ($def =~ s/^-([DU])//) { # If it was a Unix-style definition + if ($1 eq 'U') { $targ = \@udefs; } $def =~ s/='(.*)'$/=$1/; # then remove shell-protection '' $def =~ s/^'(.*)'$/$1/; # from entire term or argument } @@ -637,8 +640,11 @@ sub constants { $def =~ s/"/""/g; # Protect existing " from DCL $def = qq["$def"]; # and quote to prevent parsing of = } + push @$targ, $def; } - $self->{DEFINE} = join ',',@defs; + $self->{DEFINE} = ''; + if (@defs) { $self->{DEFINE} = '/Define=(' . join(',',@defs) . ')'; } + if (@udefs) { $self->{DEFINE} .= '/Undef=(' . join(',',@udefs) . ')'; } } if ($self->{OBJECT} =~ /\s/) { @@ -842,27 +848,25 @@ sub cflags { # Deal with $self->{DEFINE} here since some C compilers pay attention # to only one /Define clause on command line, so we have to # conflate the ones from $Config{'ccflags'} and $self->{DEFINE} - if ($quals =~ m:(.*)/define=\(?([^\(\/\)\s]+)\)?(.*)?:i) { - $quals = "$1/Define=($2," . ($self->{DEFINE} ? "$self->{DEFINE}," : '') . - "\$(DEFINE_VERSION),\$(XS_DEFINE_VERSION))$3"; - } - else { - $quals .= '/Define=(' . ($self->{DEFINE} ? "$self->{DEFINE}," : '') . - '$(DEFINE_VERSION),$(XS_DEFINE_VERSION))'; + # ($self->{DEFINE} has already been VMSified in constants() above) + if ($self->{DEFINE}) { $quals .= $self->{DEFINE}; } + for $type (qw(Def Undef)) { + my(@terms); + while ($quals =~ m:/${type}i?n?e?=([^/]+):ig) { + my $term = $1; + $term =~ s:^\((.+)\)$:$1:; + push @terms, $term; + } + if ($type eq 'Def') { + push @terms, qw[ $(DEFINE_VERSION) $(XS_DEFINE_VERSION) ]; + } + if (@terms) { + $quals =~ s:/${type}i?n?e?=[^/]+::ig; + $quals .= "/${type}ine=(" . join(',',@terms) . ')'; + } } $libperl or $libperl = $self->{LIBPERL_A} || "libperl.olb"; -# This whole section is commented out, since I don't think it's necessary (or applicable) -# if ($libperl =~ s/^$Config{'dbgprefix'}//) { $libperl =~ s/perl([^Dd]*)\./perld$1./; } -# if ($libperl =~ /libperl(\w+)\./i) { -# my($type) = uc $1; -# my(%map) = ( 'D' => 'DEBUGGING', 'E' => 'EMBED', 'M' => 'MULTIPLICITY', -# 'DE' => 'DEBUGGING,EMBED', 'DM' => 'DEBUGGING,MULTIPLICITY', -# 'EM' => 'EMBED,MULTIPLICITY', 'DEM' => 'DEBUGGING,EMBED,MULTIPLICITY' ); -# my($add) = join(',', grep { $quals !~ /\b$_\b/ } split(/,/,$map{$type})); -# $quals =~ s:/define=\(([^\)]+)\):/Define=($1,$add):i if $add; -# $self->{PERLTYPE} ||= $type; -# } # Likewise with $self->{INC} and /Include if ($self->{'INC'}) { @@ -873,7 +877,7 @@ sub cflags { } } $quals .= "$incstr)"; - $quals =~ s/\(,/\(/g; +# $quals =~ s/,,/,/g; $quals =~ s/\(,/(/g; $self->{CCFLAGS} = $quals; $self->{OPTIMIZE} ||= $flagoptstr || $Config{'optimize'}; diff --git a/lib/File/Basename.pm b/lib/File/Basename.pm index 191eff970a..d1c8666bbb 100644 --- a/lib/File/Basename.pm +++ b/lib/File/Basename.pm @@ -124,7 +124,7 @@ directory name to be F<.>). ## use strict; -# A bit of juggling to insure that C<use re 'taint';> awlays works, since +# A bit of juggling to insure that C<use re 'taint';> always works, since # File::Basename is used during the Perl build, when the re extension may # not be available. BEGIN { diff --git a/lib/File/Spec/VMS.pm b/lib/File/Spec/VMS.pm index 30440c2218..d13f5e68c2 100644 --- a/lib/File/Spec/VMS.pm +++ b/lib/File/Spec/VMS.pm @@ -22,6 +22,74 @@ See File::Spec::Unix for a documentation of the methods provided there. This package overrides the implementation of these methods, not the semantics. +=cut + +sub eliminate_macros { + my($self,$path) = @_; + return '' unless $path; + $self = {} unless ref $self; + my($npath) = unixify($path); + my($complex) = 0; + my($head,$macro,$tail); + + # perform m##g in scalar context so it acts as an iterator + while ($npath =~ m#(.*?)\$\((\S+?)\)(.*)#g) { + if ($self->{$2}) { + ($head,$macro,$tail) = ($1,$2,$3); + if (ref $self->{$macro}) { + if (ref $self->{$macro} eq 'ARRAY') { + $macro = join ' ', @{$self->{$macro}}; + } + else { + print "Note: can't expand macro \$($macro) containing ",ref($self->{$macro}), + "\n\t(using MMK-specific deferred substitutuon; MMS will break)\n"; + $macro = "\cB$macro\cB"; + $complex = 1; + } + } + else { ($macro = unixify($self->{$macro})) =~ s#/$##; } + $npath = "$head$macro$tail"; + } + } + if ($complex) { $npath =~ s#\cB(.*?)\cB#\${$1}#g; } + $npath; +} + +sub fixpath { + my($self,$path,$force_path) = @_; + return '' unless $path; + $self = bless {} unless ref $self; + my($fixedpath,$prefix,$name); + + if ($path =~ m#^\$\([^\)]+\)$# || $path =~ m#[/:>\]]#) { + if ($force_path or $path =~ /(?:DIR\)|\])$/) { + $fixedpath = vmspath($self->eliminate_macros($path)); + } + else { + $fixedpath = vmsify($self->eliminate_macros($path)); + } + } + elsif ((($prefix,$name) = ($path =~ m#^\$\(([^\)]+)\)(.+)#)) && $self->{$prefix}) { + my($vmspre) = $self->eliminate_macros("\$($prefix)"); + # is it a dir or just a name? + $vmspre = ($vmspre =~ m|/| or $prefix =~ /DIR$/) ? vmspath($vmspre) : ''; + $fixedpath = ($vmspre ? $vmspre : $self->{$prefix}) . $name; + $fixedpath = vmspath($fixedpath) if $force_path; + } + else { + $fixedpath = $path; + $fixedpath = vmspath($fixedpath) if $force_path; + } + # No hints, so we try to guess + if (!defined($force_path) and $fixedpath !~ /[:>(.\]]/) { + $fixedpath = vmspath($fixedpath) if -d $fixedpath; + } + # Trim off root dirname if it's had other dirs inserted in front of it. + $fixedpath =~ s/\.000000([\]>])/$1/; + $fixedpath; +} + + =head2 Methods always loaded =over |