[comp.lang.perl] Perl manual w/ revision codes

friedman@chekov.UU.NET (Barry Friedman) (08/14/90)

I have made a copy of the perl manual with revision code marks 
using 'diffmk'.  This highlights the amendments made between pl.18 and
28.  

If there is any interest I can post this to the net (approx 180k).
--
Barry Friedman                UUCP: ...!uunet!chekov!friedman
Emax Computer Systems Inc.  440 Laurier Ave. W., Ottawa, Ont. Canada K1R 5C4

merlyn@iwarp.intel.com (Randal Schwartz) (08/15/90)

In article <2559@bnr-fos.UUCP>, friedman@chekov (Barry Friedman) writes:
| I have made a copy of the perl manual with revision code marks 
| using 'diffmk'.  This highlights the amendments made between pl.18 and
| 28.  
| 
| If there is any interest I can post this to the net (approx 180k).

Shoot.  I can just post my diffmark and it's a bunch smaller.

Requires bezerkely style "diff -D"...

(this was written a while ago, some features might be done easier
using current Perl, but it still works... I just used it to do what
Barry said before he said it.)

==================================================
#!/local/usr/bin/perl
# original version by merlyn (Randal L. Schwartz @ Stonehenge)
# LastEditDate = "Wed Mar  7 10:43:14 1990"
# requires diff that understands -D

($myname = $0) =~ s!.*/!!; # save this very early

sub usage {
	die join("\n",@_) .
	"\nusage: $myname [-aA] [-cC] [-dD] old-file new-file >marked-file\n";
}

# defaults:
$marka = "+"; # lines that are added
$markc = "|"; # lines that are changed
$markd = "*"; # deletions (near where they were deleted)

while ($_ = shift) {
	$marka = $1, next if /^-a(.+)$/;
	$markc = $1, next if /^-c(.+)$/;
	$markd = $1, next if /^-d(.+)$/;
	&usage("unknown flag: $1") if /^(-.*)$/;
	unshift (@ARGV,$_), last;
}

&usage("missing old-file") unless $#ARGV > -1;

&usage("cannot read old-file '$old': $!") unless -r ($old = shift);

&usage("missing new-file") unless $#ARGV > -1;

&usage("cannot read new-file '$new': $!") unless -r ($new = shift);

&usage("extra args") if $#ARGV > -1;

$zzz = "___A_VERY_UNLIKELY_STRING___"; # separator string

open(I,"diff -D$zzz $old $new |") || die "cannot open diff: $!";

MAIN: while (<I>) {
	if (/^#ifdef $zzz/) {
		print ".mc $marka\n";
		print while ($_ = <I>) && !/^#endif $zzz/;
		print ".mc\n";
		last MAIN if eof;
		next MAIN;
	}
	if (/^#ifndef $zzz/) {
		while (<I>) {
			if (/^#else $zzz/) {
				print ".mc $markc\n";
				print while ($_ = <I>) && !/^#endif $zzz/;
				print ".mc\n";
				last MAIN if eof;
				next MAIN;
			}
			if (/^#endif $zzz/) {
				print ".mc $markd\n.mc\n";
				next MAIN;
			}
		}
	}
	print;
}

close(I);

exit 0;
==================================================

print "Just another Perl hacker",$]>0?" running the latest version":"",","
-- 
/=Randal L. Schwartz, Stonehenge Consulting Services (503)777-0095 ==========\
| on contract to Intel's iWarp project, Beaverton, Oregon, USA, Sol III      |
| merlyn@iwarp.intel.com ...!any-MX-mailer-like-uunet!iwarp.intel.com!merlyn |
\=Cute Quote: "Welcome to Portland, Oregon, home of the California Raisins!"=/