projects
/
xscreensaver
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
From http://www.jwz.org/xscreensaver/xscreensaver-5.34.tar.gz
[xscreensaver]
/
hacks
/
munge-ad.pl
diff --git
a/hacks/munge-ad.pl
b/hacks/munge-ad.pl
index 12f923dce3b5969b4a37f5fde14f08f40a64ef05..7504d2ce6b39d8904707e92f74e958cb0ba3ec41 100755
(executable)
--- a/
hacks/munge-ad.pl
+++ b/
hacks/munge-ad.pl
@@
-1,5
+1,5
@@
#!/usr/bin/perl -w
#!/usr/bin/perl -w
-# Copyright
© 2008
Jamie Zawinski <jwz@jwz.org>
+# Copyright
© 2008-2014
Jamie Zawinski <jwz@jwz.org>
#
# Permission to use, copy, modify, distribute, and sell this software and its
# documentation for any purpose is hereby granted without fee, provided that
#
# Permission to use, copy, modify, distribute, and sell this software and its
# documentation for any purpose is hereby granted without fee, provided that
@@
-18,41
+18,29
@@
use diagnostics;
use strict;
my $progname = $0; $progname =~ s@.*/@@g;
use strict;
my $progname = $0; $progname =~ s@.*/@@g;
-my
$version = q{ $Revision: 1.3 $ }; $version =~ s/^[^\d]+([\d.]+).*/$1/
;
+my
($version) = ('$Revision: 1.10 $' =~ m/\s(\d[.\d]+)\s/s)
;
my $verbose = 0;
# 1 means disabled: marked with "-" by default in the .ad file.
my $verbose = 0;
# 1 means disabled: marked with "-" by default in the .ad file.
-# 2 means retired: not mentioned in .ad at all.
+# 2 means retired: not mentioned in .ad at all
(parsed from Makefile)
.
#
my %disable = (
#
my %disable = (
- 'abstractile' => 1,
- 'ant' => 1,
'antinspect' => 1,
'antmaze' => 1,
'antspotlight' => 1,
'braid' => 1,
'antinspect' => 1,
'antmaze' => 1,
'antspotlight' => 1,
'braid' => 1,
- 'critical' => 1,
'crystal' => 1,
'demon' => 1,
'dnalogo' => 1,
'fadeplot' => 1,
'glblur' => 1,
'crystal' => 1,
'demon' => 1,
'dnalogo' => 1,
'fadeplot' => 1,
'glblur' => 1,
- 'glforestfire' => 1,
- 'glplanet' => 1,
'glslideshow' => 1,
'glslideshow' => 1,
- 'hyperball' => 1,
- 'hypercube' => 1,
'jigglypuff' => 1,
'jigglypuff' => 1,
- 'juggle' => 1,
'kaleidescope' => 1,
'kaleidescope' => 1,
- 'laser' => 1,
'lcdscrub' => 1,
'lcdscrub' => 1,
- 'lightning' => 1,
- 'lisa' => 1,
- 'lissie' => 1,
- 'lmorph' => 1,
'loop' => 1,
'loop' => 1,
+ 'mismunch' => 2,
'nerverot' => 1,
'noseguy' => 1,
'polyominoes' => 1,
'nerverot' => 1,
'noseguy' => 1,
'polyominoes' => 1,
@@
-60,33
+48,29
@@
my %disable = (
'pyro' => 1,
'rdbomb' => 2, # alternate name
'rocks' => 1,
'pyro' => 1,
'rdbomb' => 2, # alternate name
'rocks' => 1,
- 'rotor' => 1,
'sballs' => 1,
'sierpinski' => 1,
'sballs' => 1,
'sierpinski' => 1,
- 'sphere' => 1,
- 'spiral' => 1,
'thornbird' => 1,
'vidwhacker' => 1,
'thornbird' => 1,
'vidwhacker' => 1,
- 'vines' => 1,
'webcollage' => 1,
'webcollage' => 1,
- 'worm' => 1,
- 'xsublim' => 2,
);
# Parse the RETIRED_EXES variable from the Makefiles to populate %disable.
);
# Parse the RETIRED_EXES variable from the Makefiles to populate %disable.
+# Duplicated in ../OSX/build-fntable.pl.
#
sub parse_makefiles() {
foreach my $mf ( "Makefile.in", "glx/Makefile.in" ) {
#
sub parse_makefiles() {
foreach my $mf ( "Makefile.in", "glx/Makefile.in" ) {
- my $body = '';
- local *IN;
- open (IN, "<$mf") || error ("$mf: $!");
- while (<IN>) { $body .= $_; }
- close IN;
+ open (my $in, '<', $mf) || error ("$mf: $!");
+ local $/ = undef; # read entire file
+ my $body = <$in>;
+ close $in;
$body =~ s/\\\n//gs;
$body =~ s/\\\n//gs;
- my ($var) = ($body =~ m/^RETIRED_EXES\s*=\s*(.*)$/mi);
+ my ($var) = ($body =~ m/^RETIRED_EXES\s*=\s*(.*)$/mi);
+ my ($var2) = ($body =~ m/^RETIRED_GL_EXES\s*=\s*(.*)$/mi);
error ("no RETIRED_EXES in $mf") unless $var;
error ("no RETIRED_EXES in $mf") unless $var;
+ $var .= " $var2" if $var2;
foreach my $hack (split (/\s+/, $var)) {
$disable{$hack} = 2;
}
foreach my $hack (split (/\s+/, $var)) {
$disable{$hack} = 2;
}
@@
-99,11
+83,10
@@
sub munge_ad($) {
parse_makefiles();
parse_makefiles();
- my $body = '';
- local *IN;
- open (IN, "<$file") || error ("$file: $!");
- while (<IN>) { $body .= $_; }
- close IN;
+ open (my $in, '<', $file) || error ("$file: $!");
+ local $/ = undef; # read entire file
+ my $body = <$in>;
+ close $in;
my $obody = $body;
my ($top, $mid, $bot) = ($body =~ m/^(.*?\n)(\*hacks\..*?\n)(\n.*)$/s);
my $obody = $body;
my ($top, $mid, $bot) = ($body =~ m/^(.*?\n)(\*hacks\..*?\n)(\n.*)$/s);
@@
-119,11
+102,11
@@
sub munge_ad($) {
$dir =~ s@/[^/]*$@@s;
my @counts = (0,0,0,0,0,0,0,0,0,0);
foreach my $xml (sort (glob ("$dir/../hacks/config/*.xml"))) {
$dir =~ s@/[^/]*$@@s;
my @counts = (0,0,0,0,0,0,0,0,0,0);
foreach my $xml (sort (glob ("$dir/../hacks/config/*.xml"))) {
-
my $b = ''
;
- open (IN, "<$xml") || error ("$xml: $!");
- while (<IN>) { $b .= $_; }
- close
IN
;
- my ($name) = ($b =~ m@<screensaver[^<>]*\b_label=\"([^<>\"]+)\"
>
@s);
+
open (my $in, '<', $xml) || error ("$xml: $!")
;
+ local $/ = undef; # read entire file
+ my $b = <$in>;
+ close
$in
;
+ my ($name) = ($b =~ m@<screensaver[^<>]*\b_label=\"([^<>\"]+)\"@s);
error ("$xml: no name") unless $name;
my $name2 = lc($name);
error ("$xml: no name") unless $name;
my $name2 = lc($name);
@@
-167,6
+150,7
@@
sub munge_ad($) {
my $glep = ($hack eq 'extrusion');
if (-f "$hack.c" || -f "$hack") { $glp = 0; }
elsif (-f "glx/$hack.c") { $glp = 1; }
my $glep = ($hack eq 'extrusion');
if (-f "$hack.c" || -f "$hack") { $glp = 0; }
elsif (-f "glx/$hack.c") { $glp = 1; }
+ elsif ($hack eq 'companioncube') { $glp = 1; } # kludge
elsif ($dis != 2) { error ("is $hack X or GL?"); }
$counts[($disable{$hack} || 0)]++;
elsif ($dis != 2) { error ("is $hack X or GL?"); }
$counts[($disable{$hack} || 0)]++;
@@
-213,10
+197,9
@@
sub munge_ad($) {
# Write file if changed.
#
if ($body ne $obody) {
# Write file if changed.
#
if ($body ne $obody) {
- local *OUT;
- open (OUT, ">$file") || error ("$file: $!");
- print OUT $body;
- close OUT;
+ open (my $out, '>', $file) || error ("$file: $!");
+ print $out $body;
+ close $out;
print STDERR "$progname: wrote $file\n";
} elsif ($verbose) {
print STDERR "$progname: $file unchanged\n";
print STDERR "$progname: wrote $file\n";
} elsif ($verbose) {
print STDERR "$progname: $file unchanged\n";