]> sourceware.org Git - automake.git/commitdiff
* lib/Automake/DisjConditions.pm (_permutations_worker)
authorAlexandre Duret-Lutz <adl@gnu.org>
Sun, 2 Feb 2003 10:09:24 +0000 (10:09 +0000)
committerAlexandre Duret-Lutz <adl@gnu.org>
Sun, 2 Feb 2003 10:09:24 +0000 (10:09 +0000)
(permutations): Remove, so that people aren't tempted to use it.
* lib/Automake/tests/DisjConditions.pl (tests_permutations): Remove.

ChangeLog
lib/Automake/DisjConditions.pm
lib/Automake/tests/DisjConditions.pl

index 718f3eca76a2177f77a4f4aa7bad559b11d42e71..52480c754d2a02f80834b185ca59ec90150995f3 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,5 +1,9 @@
 2003-02-02  Alexandre Duret-Lutz  <adl@gnu.org>
 
+       * lib/Automake/DisjConditions.pm (_permutations_worker)
+       (permutations): Remove, so that people aren't tempted to use it.
+       * lib/Automake/tests/DisjConditions.pl (tests_permutations): Remove.
+
        * automake.in (variable_conditions_recursive): Remove.
        (variable_conditionally_defined): Rewrite using
        traverse_variable_recursively.
index 305dbc9ed993b2319df1985c76aee07a2058d176..48dca6eb2a28642f3443cfa712a5dae91aca826a 100644 (file)
@@ -61,10 +61,6 @@ Automake::DisjConditions - record a disjunction of Conditions
   #   "(COND1 and !COND2) or (!COND3)"
   my $str = $set->human;
 
-  # Build a new DisjConditions from the permuation of all
-  # Conditions appearing in $set.
-  my $perm = $set->permutations;
-
   # Invert a DisjConditions, i.e., create a new DisjConditions
   # that complements $set.
   my $inv = $set->invert;
@@ -293,86 +289,6 @@ sub human ($ )
 }
 
 
-sub _permutations_worker (@)
-{
-  my @conds = @_;
-  return () unless @conds;
-
-  my $cond = shift @conds;
-
-  # Ignore "TRUE" conditions, since they add nothing to permutations.
-  return &_permutations_worker (@conds) if $cond eq "TRUE";
-
-  (my $neg = $cond) =~ s/TRUE$/FALSE/;
-
-  # Recurse.
-  my @ret = ();
-  foreach my $c (&_permutations_worker (@conds))
-    {
-      push (@ret, $c->merge_conds ($cond));
-      push (@ret, $c->merge_conds ($neg));
-    }
-  if (! @ret)
-    {
-      push (@ret, new Automake::Condition $cond);
-      push (@ret, new Automake::Condition $neg);
-    }
-
-  return @ret;
-}
-
-=item C<$perm = $set-E<gt>permutations>
-
-Return a permutations of the conditions involved in a C<DisjConditions>.
-
-For instance consider this initial C<DisjConditions>.
-
-  my $set = new Automake::DisjConditions
-    (new Automake::Condition ("COND1_TRUE", "COND2_TRUE"),
-     new Automake::Condition ("COND3_FALSE", "COND2_TRUE"));
-
-Calling C<$set-E<gt>permutations> will return the following DisjConditions.
-
-  new Automake::DisjConditions
-    (new Automake::Condition ("COND1_TRUE", "COND2_TRUE", "COND3_TRUE"),
-     new Automake::Condition ("COND1_FALSE","COND2_TRUE", "COND3_TRUE"),
-     new Automake::Condition ("COND1_TRUE", "COND2_FALSE","COND3_TRUE"),
-     new Automake::Condition ("COND1_FALSE","COND2_FALSE","COND3_TRUE"),
-     new Automake::Condition ("COND1_TRUE", "COND2_TRUE", "COND3_FALSE"),
-     new Automake::Condition ("COND1_FALSE","COND2_TRUE", "COND3_FALSE"),
-     new Automake::Condition ("COND1_TRUE", "COND2_FALSE","COND3_FALSE"),
-     new Automake::Condition ("COND1_FALSE","COND2_FALSE","COND3_FALSE"));
-
-=cut
-
-sub permutations ($ )
-{
-  my ($self) = @_;
-
-  return $self->{'permutations'} if defined $self->{'permutations'};
-
-  my %atomic_conds = ();
-
-  for my $conditional ($self->conds)
-    {
-      for my $cond ($conditional->conds)
-       {
-         $cond =~ s/FALSE$/TRUE/;
-         $atomic_conds{$cond} = 1;
-       }
-    }
-
-  my @res = _permutations_worker (keys %atomic_conds);
-  # An empty permutation is TRUE, because we ignore TRUE conditions
-  # in the recursions.
-  @res = (TRUE) unless @res;
-  my $res = new Automake::DisjConditions @res;
-
-  $self->{'permutations'} = $res;
-
-  return $res;
-}
-
 =item C<$prod = $set1->multiply ($set2)>
 
 Multiply two conditional sets.
index 6d76e66a15b4254e9b2817a41dd29efd9ca5a812..b5147ebcac206c4b5a945b8af8262679cedaf9e3 100644 (file)
@@ -44,61 +44,6 @@ sub build_set (@)
   return new Automake::DisjConditions @set;
 }
 
-sub test_permutations ()
-{
-  my @tests = ([[["FALSE"]],
-               [["TRUE"]]],
-
-              [[["TRUE"]],
-               [["TRUE"]]],
-
-              [[["COND1_TRUE", "COND2_TRUE"],
-                ["COND3_FALSE", "COND2_TRUE"]],
-               [["COND1_FALSE","COND2_FALSE","COND3_FALSE"],
-                ["COND1_TRUE", "COND2_FALSE","COND3_FALSE"],
-                ["COND1_FALSE","COND2_TRUE", "COND3_FALSE"],
-                ["COND1_TRUE", "COND2_TRUE", "COND3_FALSE"],
-                ["COND1_FALSE","COND2_FALSE","COND3_TRUE"],
-                ["COND1_TRUE", "COND2_FALSE","COND3_TRUE"],
-                ["COND1_FALSE","COND2_TRUE", "COND3_TRUE"],
-                ["COND1_TRUE", "COND2_TRUE", "COND3_TRUE"]]],
-
-              [[["COND1_TRUE", "COND2_TRUE"],
-                ["TRUE"]],
-               [["COND1_TRUE", "COND2_TRUE"],
-                ["COND1_FALSE", "COND2_TRUE"],
-                ["COND1_FALSE", "COND2_FALSE"],
-                ["COND1_TRUE", "COND2_FALSE"]]],
-
-              [[["COND1_TRUE", "COND2_TRUE"],
-                ["FALSE"]],
-               [["COND1_TRUE", "COND2_TRUE"],
-                ["COND1_FALSE", "COND2_TRUE"],
-                ["COND1_FALSE", "COND2_FALSE"],
-                ["COND1_TRUE", "COND2_FALSE"]]],
-
-              [[["COND1_TRUE"],
-                ["COND2_FALSE"]],
-               [["COND1_TRUE", "COND2_TRUE"],
-                ["COND1_FALSE", "COND2_TRUE"],
-                ["COND1_FALSE", "COND2_FALSE"],
-                ["COND1_TRUE", "COND2_FALSE"]]]
-              );
-
-  for my $t (@tests)
-    {
-      my $set = build_set @{$t->[0]};
-      my $res = build_set @{$t->[1]};
-      my $per = $set->permutations;
-      if ($per != $res)
-       {
-         print " (P) " . $per->string . ' != ' . $res->string . "\n";
-         return 1;
-       }
-    }
-  return 0;
-}
-
 sub test_invert ()
 {
   my @tests = ([[["FALSE"]],
@@ -302,7 +247,7 @@ sub test_simplify ()
 
       # Also exercize invert() while we are at it.
 
-      # FIXME: Don't run invert() with too much conditions, this is too slow.
+      # FIXME: Can't run invert() with too much conditions, this is too slow.
       next if $#{$t->[0][0]} > 8;
 
       my $inv1 = $set->invert->simplify;
@@ -381,7 +326,6 @@ sub test_sub_conditions ()
 }
 
 exit (test_basics
-      || test_permutations
       || test_invert
       || test_simplify
       || test_sub_conditions);
This page took 0.034832 seconds and 5 git commands to generate.