Change 33617 by [EMAIL PROTECTED] on 2008/03/31 19:23:09 Integrate: [ 33260] I've been maintaining Net::Ping for a while now. [ 33295] Make sure we only find the macro we were looking for, not something that only starts with the same string. [ 33303] Jerry D. Hedden now maintains Thread::Semaphore on CPAN [ 33352] Subject: [patch] Porting/expand-macros.pl gets 'indent'ing From: Jim Cromie <[EMAIL PROTECTED]> Message-ID: <[EMAIL PROTECTED]> Date: Thu, 07 Feb 2008 17:03:22 -0700 [ 33353] Take advantage of the fact that we can use indent as a stdin/stdout filter to reduce its workload (and ours) by only sending it the 3 or so lines that we are interested in printing, not the preceding bucket loads. [ 33456] Subject: checkAUTHORS.pl update for me From: Michael G Schwern <[EMAIL PROTECTED]> Date: Sun, 09 Mar 2008 00:35:48 +0100 Message-ID: <[EMAIL PROTECTED]>
Affected files ... ... //depot/maint-5.10/perl/Porting/Maintainers.pl#6 integrate ... //depot/maint-5.10/perl/Porting/checkAUTHORS.pl#2 integrate ... //depot/maint-5.10/perl/Porting/expand-macro.pl#2 integrate Differences ... ==== //depot/maint-5.10/perl/Porting/Maintainers.pl#6 (text) ==== Index: perl/Porting/Maintainers.pl --- perl/Porting/Maintainers.pl#5~33524~ 2008-03-14 02:37:22.000000000 -0700 +++ perl/Porting/Maintainers.pl 2008-03-31 12:23:09.000000000 -0700 @@ -17,7 +17,6 @@ 'arandal' => 'Allison Randal <[EMAIL PROTECTED]>', 'audreyt' => 'Audrey Tang <[EMAIL PROTECTED]>', 'avar' => 'Ævar Arnfjörð Bjarmason <[EMAIL PROTECTED]>', - 'bbb' => 'Rob Brown <[EMAIL PROTECTED]>', 'craig' => 'Craig Berry <[EMAIL PROTECTED]>', 'dankogai' => 'Dan Kogai <[EMAIL PROTECTED]>', 'dconway' => 'Damian Conway <[EMAIL PROTECTED]>', @@ -70,6 +69,7 @@ 'sburke' => 'Sean Burke <[EMAIL PROTECTED]>', 'mschwern' => 'Michael Schwern <[EMAIL PROTECTED]>', 'smccam' => 'Stephen McCamant <[EMAIL PROTECTED]>', + 'smpeters' => 'Steve Peters <[EMAIL PROTECTED]>', 'smueller' => 'Steffen Mueller <[EMAIL PROTECTED]>', 'tels' => 'Tels <[EMAIL PROTECTED]>', 'tomhughes' => 'Tom Hughes <[EMAIL PROTECTED]>', @@ -618,7 +618,7 @@ 'Net::Ping' => { - 'MAINTAINER' => 'bbb', + 'MAINTAINER' => 'smpeters', 'FILES' => q[lib/Net/Ping.pm lib/Net/Ping], 'CPAN' => 1, }, ==== //depot/maint-5.10/perl/Porting/checkAUTHORS.pl#2 (text) ==== Index: perl/Porting/checkAUTHORS.pl --- perl/Porting/checkAUTHORS.pl#1~32694~ 2007-12-22 01:23:09.000000000 -0800 +++ perl/Porting/checkAUTHORS.pl 2008-03-31 12:23:09.000000000 -0700 @@ -436,6 +436,9 @@ schubiger\100cpan.org steven\100accognoscere.org + sts\100accognoscere.org schwern\100pobox.com schwern\100gmail.com ++ schwern\100athens.arena-i.com ++ schwern\100blackrider.aocn.com ++ schwern\100ool-18b93024.dyn.optonline.net sebastien\100aperghis.net maddingue\100free.fr + saper\100cpan.org simon\100simon-cozens.org simon\100pembro4.pmb.ox.ac.uk ==== //depot/maint-5.10/perl/Porting/expand-macro.pl#2 (text) ==== Index: perl/Porting/expand-macro.pl --- perl/Porting/expand-macro.pl#1~33117~ 2008-01-29 15:38:53.000000000 -0800 +++ perl/Porting/expand-macro.pl 2008-03-31 12:23:09.000000000 -0700 @@ -1,16 +1,37 @@ #!perl -w use strict; +use Getopt::Std; + use vars qw($trysource $tryout $sentinel); $trysource = "try.c"; $tryout = "try.i"; +getopts('fF:ekvI:', \my %opt) or usage(); + +sub usage { + die<<EO_HELP; [EMAIL PROTECTED]; +usage: $0 [options] <macro-name> [headers] +options: + -f use 'indent' to format output + -F <tool> use <tool> to format output (instead of -f) + -e erase try.[ic] instead of failing when theyre present (errdetect) + -k keep them after generating (for handy inspection) + -v verbose + -I <indent-opts> passed into indent +EO_HELP +} + my $macro = shift; -die "$0 macro [headers]" unless defined $macro; +usage "missing <macro-name>" unless defined $macro; $sentinel = "$macro expands to"; +usage "-f and -F <tool> are exclusive\n" if $opt{f} and $opt{F}; + foreach($trysource, $tryout) { + unlink $_ if $opt{e}; die "You already have a $_" if -e $_; } @@ -23,16 +44,20 @@ my $args = ''; +my $found_macro; while (<>) { - next unless /^#\s*define\s+$macro/; + next unless /^#\s*define\s+$macro\b/; my ($def_args) = /^#\s*define\s+$macro\(([^)]*)\)/; if (defined $def_args) { my @args = split ',', $def_args; + print "# macro: $macro args: @args in $_\n" if $opt{v}; my $argname = "A0"; $args = '(' . join (', ', map {$argname++} [EMAIL PROTECTED]) . ')'; } + $found_macro++; last; } +die "$macro not found\n" unless $found_macro; open my $out, '>', $trysource or die "Can't open $trysource: $!"; @@ -45,14 +70,38 @@ close $out or die "Can't close $trysource: $!"; +print "doing: make $tryout\n" if $opt{v}; system "make $tryout" and die; +# if user wants 'indent' formatting .. +my $out_fh; + +if ($opt{f} || $opt{F}) { + # a: indent is a well behaved filter when given 0 arguments, reading from + # stdin and writing to stdout + # b: all our braces should be balanced, indented back to column 0, in the + # headers, hence everything before our #line directive can be ignored + # + # We can take advantage of this to reduce the work to indent. + + my $indent_command = $opt{f} ? 'indent' : $opt{F}; + + if (defined $opt{I}) { + $indent_command .= " $opt{I}"; + } + open $out_fh, '|-', $indent_command or die $?; +} else { + $out_fh = \*STDOUT; +} + open my $fh, '<', $tryout or die "Can't open $tryout: $!"; while (<$fh>) { - print if /$sentinel/o .. 1; + print $out_fh $_ if /$sentinel/o .. 1; } -foreach($trysource, $tryout) { - die "Can't unlink $_" unless unlink $_; +unless ($opt{k}) { + foreach($trysource, $tryout) { + die "Can't unlink $_" unless unlink $_; + } } End of Patch.