X-Git-Url: http://git.hungrycats.org/cgi-bin/gitweb.cgi?a=blobdiff_plain;f=hacks%2Fcheck-configs.pl;h=c7cb8e8401624d7fd0d9667907b68d1efecb5ae9;hb=6afd6db0ae9396cd7ff897ade597cd5483f49b0e;hp=9d06bd2f2b48661dc7300a436c5d25e2eb7154c9;hpb=3243731044b944673630b55e16674c191b026f84;p=xscreensaver diff --git a/hacks/check-configs.pl b/hacks/check-configs.pl index 9d06bd2f..c7cb8e84 100755 --- a/hacks/check-configs.pl +++ b/hacks/check-configs.pl @@ -1,5 +1,5 @@ #!/usr/bin/perl -w -# Copyright © 2008, 2009 Jamie Zawinski +# Copyright © 2008-2014 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.3 $ }; $version =~ s/^[^\d]+([\d.]+).*/$1/; +my ($version) = ('$Revision: 1.9 $' =~ m/\s(\d[.\d]+)\s/s); my $verbose = 0; @@ -30,7 +30,20 @@ foreach (qw(count cycles delay ncolors size font)) { } $xlockmore_default_opts .= "{\"-wireframe\", \".wireframe\", XrmoptionNoArg, \"true\"},\n" . - "{\"-3d\", \".use3d\", XrmoptionNoArg, \"true\"},\n"; + "{\"-3d\", \".use3d\", XrmoptionNoArg, \"true\"},\n" . + "{\"-no-3d\", \".use3d\", XrmoptionNoArg, \"false\"},\n"; + +my $thread_default_opts = + "{\"-threads\", \".useThreads\", XrmoptionNoArg, \"True\"},\n" . + "{\"-no-threads\", \".useThreads\", XrmoptionNoArg, \"False\"},\n"; + +my $analogtv_default_opts = ''; +foreach (qw(color tint brightness contrast)) { + $analogtv_default_opts .= "{\"-tv-$_\", \".TV$_\", XrmoptionSepArg, 0},\n"; +} + +$analogtv_default_opts .= $thread_default_opts; + # Returns two tables: @@ -46,20 +59,22 @@ 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 = ''; - local *IN; - open (IN, "<$file") || error ("$file: $!"); - while () { $body .= $_; } - close IN; + open (my $in, '<', $file) || error ("$file: $!"); + while (<$in>) { $body .= $_; } + close $in; $file =~ s@^.*/@@; + my $xlockmore_p = 0; + my $thread_p = ($body =~ m/THREAD_DEFAULTS/); + 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; + $body =~ s/(THREAD|ANALOGTV)_(DEFAULTS|OPTIONS)//gs; print STDERR "$progname: $file: defaults:\n" if ($verbose > 2); my %res_to_val; @@ -112,12 +127,17 @@ 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 || $thread_p || $analogtv_p || $opts) { $opts = '' unless $opts; $opts .= ",\n$xlockmore_default_opts" if ($xlockmore_p); + $opts .= ",\n$thread_default_opts" if ($thread_p); + $opts .= ",\n$analogtv_default_opts" if ($analogtv_p); + foreach (split (/,\s*\n/, $opts)) { s/^\s*//s; s/\s*$//s; @@ -181,7 +201,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*\"([^\"]+)\"/); @@ -276,7 +296,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