From http://www.jwz.org/xscreensaver/xscreensaver-5.30.tar.gz
[xscreensaver] / hacks / check-configs.pl
index 165af0891d25615082b53f564a2b39be40f55974..c7cb8e8401624d7fd0d9667907b68d1efecb5ae9 100755 (executable)
@@ -1,5 +1,5 @@
 #!/usr/bin/perl -w
-# Copyright © 2008-2012 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
@@ -19,7 +19,7 @@ use diagnostics;
 use strict;
 
 my $progname = $0; $progname =~ s@.*/@@g;
-my $version = q{ $Revision: 1.5 $ }; $version =~ s/^[^\d]+([\d.]+).*/$1/;
+my ($version) = ('$Revision: 1.9 $' =~ m/\s(\d[.\d]+)\s/s);
 
 my $verbose = 0;
 
@@ -30,13 +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:
@@ -56,18 +63,18 @@ sub parse_src($) {
 
   $file = "glx/$file" unless (-f $file);
   my $body = '';
-  local *IN;
-  open (IN, "<$file") || error ("$file: $!");
-  while (<IN>) { $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;
+  $body =~ s/(THREAD|ANALOGTV)_(DEFAULTS|OPTIONS)//gs;
 
   print STDERR "$progname: $file: defaults:\n" if ($verbose > 2);
   my %res_to_val;
@@ -120,12 +127,15 @@ 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 || $analogtv_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)) {
@@ -191,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*\"([^\"]+)\"/);