X-Git-Url: http://git.hungrycats.org/cgi-bin/gitweb.cgi?p=xscreensaver;a=blobdiff_plain;f=hacks%2Fcheck-configs.pl;h=94c8fd4fa2e5adfc89a51c06707dba166296d476;hp=28beb6f245c33e9ff8639f33bba3b93ad4df4760;hb=019de959b265701cd0c3fccbb61f2b69f06bf9ee;hpb=c1b9b55ad8d59dc05ef55e316aebf5863e7dfa56 diff --git a/hacks/check-configs.pl b/hacks/check-configs.pl index 28beb6f2..94c8fd4f 100755 --- a/hacks/check-configs.pl +++ b/hacks/check-configs.pl @@ -1,5 +1,5 @@ #!/usr/bin/perl -w -# Copyright © 2008 Jamie Zawinski +# Copyright © 2008-2013 Jamie Zawinski # # Permission to use, copy, modify, distribute, and sell this software and its # documentation for any purpose is hereby granted without fee, provided that @@ -19,7 +19,7 @@ use diagnostics; use strict; my $progname = $0; $progname =~ s@.*/@@g; -my $version = q{ $Revision: 1.2 $ }; $version =~ s/^[^\d]+([\d.]+).*/$1/; +my $version = q{ $Revision: 1.7 $ }; $version =~ s/^[^\d]+([\d.]+).*/$1/; my $verbose = 0; @@ -32,6 +32,12 @@ $xlockmore_default_opts .= "{\"-wireframe\", \".wireframe\", XrmoptionNoArg, \"true\"},\n" . "{\"-3d\", \".use3d\", XrmoptionNoArg, \"true\"},\n"; +my $analogtv_default_opts = ''; +foreach (qw(color tint brightness contrast)) { + $analogtv_default_opts .= "{\"-tv-$_\", \".TV$_\", XrmoptionSepArg, 0},\n"; +} + + # Returns two tables: # - A table of the default resource values. @@ -46,6 +52,7 @@ sub parse_src($) { $file = 'sproingiewrap.c' if ($file eq 'sproingies.c'); $file = 'b_lockglue.c' if ($file eq 'bubble3d.c'); $file = 'polyhedra-gl.c' if ($file eq 'polyhedra.c'); + $file = 'companion.c' if ($file eq 'companioncube.c'); $file = "glx/$file" unless (-f $file); my $body = ''; @@ -55,12 +62,13 @@ sub parse_src($) { close IN; $file =~ s@^.*/@@; + my $xlockmore_p = 0; + my $analogtv_p = ($body =~ m/ANALOGTV_DEFAULTS/); + $body =~ s@/\*.*?\*/@@gs; $body =~ s@^#\s*(if|ifdef|ifndef|elif|else|endif).*$@@gm; $body =~ s/ANALOGTV_(DEFAULTS|OPTIONS)//gs; - my $xlockmore_p = 0; - print STDERR "$progname: $file: defaults:\n" if ($verbose > 2); my %res_to_val; if ($body =~ m/_defaults\s*\[\]\s*=\s*{(.*?)}\s*;/s) { @@ -112,12 +120,16 @@ sub parse_src($) { print STDERR "$progname: $file: switches to resources:\n" if ($verbose > 2); my %switch_to_res; - $switch_to_res{-fps} = 'doFPS: true'; + $switch_to_res{-fps} = 'doFPS: true'; + $switch_to_res{-fg} = 'foreground: %'; + $switch_to_res{-bg} = 'background: %'; my ($ign, $opts) = ($body =~ m/(_options|\bopts)\s*\[\]\s*=\s*{(.*?)}\s*;/s); - if ($xlockmore_p || $opts) { + if ($xlockmore_p || $analogtv_p || $opts) { $opts = '' unless $opts; $opts .= ",\n$xlockmore_default_opts" if ($xlockmore_p); + $opts .= ",\n$analogtv_default_opts" if ($analogtv_p); + foreach (split (/,\s*\n/, $opts)) { s/^\s*//s; s/\s*$//s; @@ -181,7 +193,7 @@ sub parse_xml($$) { error ("$progname: $file: unparsable: $_") unless $type; next if ($type =~ m@^/@); - if ($type =~ m/^([hv]group|\?xml|command|string|file|_description|xscreensaver-(image|text))/s) { + if ($type =~ m/^([hv]group|\?xml|command|string|file|_description|xscreensaver-(image|text|updater))/s) { } elsif ($type eq 'screensaver') { my ($name) = ($args =~ m/\b_label\s*=\s*\"([^\"]+)\"/); @@ -265,7 +277,7 @@ sub check_config($) { my ($saver) = @_; # kludge - return 0 if ($saver =~ m/(-helper|hypertorus|polytopes)$/); + return 0 if ($saver =~ m/(-helper)$/); my ($src_opts, $switchmap) = parse_src ($saver); my (@xml_opts) = parse_xml ($saver, $switchmap); @@ -276,7 +288,10 @@ sub check_config($) { error ("$saver: unparsable xml claim: $_") unless $compare; my $sval = $src_opts->{$res}; - if (!defined($sval)) { + if ($res =~ m/^TV/) { + print STDERR "$progname: $saver: OK: skipping \"$res\"\n" + if ($verbose > 1); + } elsif (!defined($sval)) { print STDERR "$progname: $saver: $res: not in source\n"; } elsif ($compare eq '!=' ? $sval eq $xval