2003-01-19 Alexandre Duret-Lutz <adl@gnu.org>
+ Rename more files to accomodate 8+3 file systems, and adjust the
+ vocabulary at the same time: AM_CONDITIONAL defines "conditionals",
+ and we call "condition" a conjunction of "conditionals".
+ * lib/am/Conditional.pm: Rename to lib/am/Condition.pm.
+ * lib/am/tests/Conditional.pl: Rename to lib/am/tests/Condition.pl.
+ * lib/am/ConditionalSet.pm: Rename to lib/am/DisjConditions.pm.
+ * lib/am/tests/ConditionalSet.pl: Rename to
+ lib/am/tests/DisjConditions.pl
+ * lib/am/Conditional.pm (condition_negate): Rename to ...
+ * lib/am/Condition.pm (conditional_negate): ... this.
+ * automake.in: Adjust references to Condition and DisjConditions.
+ (check_ambiguous_conditional, conditional_ambiguous_p): Rename to ...
+ (check_ambiguous_condition, condition_ambiguous_p): ... these.
+
* tests/README: New file.
* automake.texi (Conditional Programs): Show a sample Makefile.am.
use Automake::Channels;
use Automake::ChannelDefs;
use Automake::Location;
-use Automake::Conditional qw/TRUE FALSE/;
-use Automake::ConditionalSet;
+use Automake::Condition qw/TRUE FALSE/;
+use Automake::DisjConditions;
use File::Basename;
use Tie::RefHash;
use Carp;
use constant TARGET_AUTOMAKE => 0; # Target defined by Automake.
use constant TARGET_USER => 1; # Target defined in the user's Makefile.am.
-# This is the conditional stack.
+# This is the conditional stack, updated on if/else/endif, and
+# used to build Condition objects.
my @cond_stack;
# This holds the set of included files.
# are the values of the variable for condition COND1 and COND2.
my %subobjvar = ();
-# This hash records helper variables used to implement '+=' in conditionals.
+# This hash records helper variables used to implement conditional '+='.
# Keys have the form "VAR:CONDITIONS". The value associated to a key is
# the named of the helper variable used to append to VAR in CONDITIONS.
my %appendvar = ();
# make can't handle backslashes for continuing comments on
# the following line.
define_pretty_variable ('DEP_FILES',
- new Automake::Conditional ('AMDEP_TRUE'),
+ new Automake::Condition ('AMDEP_TRUE'),
INTERNAL, @deplist);
# Generate each `include' individually. Irix 6 make will
my $dname = $derived;
if (variable_defined ($derived . '_SHORTNAME'))
{
- # FIXME: should use the same conditional as
+ # FIXME: should use the same Condition as
# the _SOURCES variable. But this is really
# silly overkill -- nobody should have
# conditional shortnames.
if ($xname ne '')
{
my $depvar = $xname . '_DEPENDENCIES';
- if ((conditional_ambiguous_p ($depvar, $cond,
+ if ((condition_ambiguous_p ($depvar, $cond,
variable_conditions ($depvar)))[0] ne '')
{
# Note that we've examined this.
# relented.
if (variable_defined ('EXTRA_DIST'))
{
- # FIXME: This should be fixed to work with conditionals. That
+ # FIXME: This should be fixed to work with conditions. That
# will require only making the entries in %dist_dirs under the
# appropriate condition. This is meaningful if the nature of
# the distribution should depend upon the configure options
################################################################
-## ------------------------------ ##
-## Handling the condition stack. ##
-## ------------------------------ ##
+## -------------------------------- ##
+## Handling the conditional stack. ##
+## -------------------------------- ##
# $STRING
my ($negate, $cond) = @_;
$cond = "${cond}_TRUE"
unless $cond =~ /^TRUE|FALSE$/;
- $cond = Automake::Conditional::condition_negate ($cond)
+ $cond = Automake::Condition::conditional_negate ($cond)
if $negate;
return $cond;
}
push (@cond_stack, make_conditional_string ($negate, $cond));
- return new Automake::Conditional (@cond_stack);
+ return new Automake::Condition (@cond_stack);
}
}
$cond_stack[$#cond_stack] =
- Automake::Conditional::condition_negate ($cond_stack[$#cond_stack]);
+ Automake::Condition::conditional_negate ($cond_stack[$#cond_stack]);
# If $COND is given, check against it.
if (defined $cond)
if $cond_stack[$#cond_stack] ne $cond;
}
- return new Automake::Conditional (@cond_stack);
+ return new Automake::Condition (@cond_stack);
}
pop @cond_stack;
- return new Automake::Conditional (@cond_stack);
+ return new Automake::Condition (@cond_stack);
}
## ------------------------ ##
-# check_ambiguous_conditional ($VAR, $COND, $WHERE)
+# check_ambiguous_condition ($VAR, $COND, $WHERE)
# -------------------------------------------------
# Check for an ambiguous conditional. This is called when a variable
# is being defined conditionally. If we already know about a
# definition that is true under the same conditions, then we have an
# ambiguity.
-sub check_ambiguous_conditional ($$$)
+sub check_ambiguous_condition ($$$)
{
my ($var, $cond, $where) = @_;
my ($message, $ambig_cond) =
- conditional_ambiguous_p ($var, $cond, variable_conditions ($var));
+ condition_ambiguous_p ($var, $cond, variable_conditions ($var));
if ($message)
{
msg 'syntax', $where, "$message ...", partial => 1;
}
# $STRING, $AMBIG_COND
-# conditional_ambiguous_p ($WHAT, $COND, $CONDSET)
+# condition_ambiguous_p ($WHAT, $COND, $CONDSET)
# ----------------------------------------------
-# Check for an ambiguous conditional. Return an error message and
+# Check for an ambiguous condition. Return an error message and
# the other condition involved if we have one, two empty strings otherwise.
# WHAT: the thing being defined
-# COND: the Conditional under which it is being defined
-# CONDSET: the ConditionalSet under which it had already been defined
-sub conditional_ambiguous_p ($$$)
+# COND: the Condition under which it is being defined
+# CONDSET: the DisjConditions under which it had already been defined
+sub condition_ambiguous_p ($$$)
{
my ($var, $cond, $condset) = @_;
# C = mumble
#
# we should have (we display result as conditional strings in this
-# illustration, but we really return ConditionalSet objects):
+# illustration, but we really return DisjConditions objects):
# variable_not_always_defined_in_cond ('A', 'COND1_TRUE COND2_TRUE')
# => ()
# variable_not_always_defined_in_cond ('A', 'COND1_TRUE')
# There must be no previous value unless the user is redefining
# an Automake variable or an AC_SUBST variable for an existing
# condition.
- check_ambiguous_conditional ($var, $cond, $where)
+ check_ambiguous_condition ($var, $cond, $where)
unless (exists $var_owner{$var}{$cond}
&& (($var_owner{$var}{$cond} == VAR_AUTOMAKE
&& $owner != VAR_AUTOMAKE)
# &variable_conditions_recursive ($VAR)
# -------------------------------------
-# Return the set of conditions for which a variable is defined.
+# Return the set of conditions (as a DisjConditions)
+# for which a variable is defined.
# If the variable is not defined conditionally, and is not defined in
# terms of any variables which are defined conditionally, then this
# Now we want to return all permutations of the subvariable
# conditions.
- return (new Automake::ConditionalSet @new_conds)->permutations;
+ return (new Automake::DisjConditions @new_conds)->permutations;
}
{
my ($var) = @_;
my @conds = keys %{$var_value{$var}};
- return new Automake::ConditionalSet @conds;
+ return new Automake::DisjConditions @conds;
}
{
my ($target) = @_;
my @conds = keys %{$targets{$target}};
- return new Automake::ConditionalSet @conds;
+ return new Automake::DisjConditions @conds;
}
# $BOOLEAN
}
else
{
- push (@new_conds, Automake::Conditional::reduce (@subvar_conds));
+ push (@new_conds, Automake::Condition::reduce (@subvar_conds));
}
}
foreach my $this_cond (@this_conds)
{
my @perms =
- (new Automake::ConditionalSet $this_cond)->permutations->conds;
+ (new Automake::DisjConditions $this_cond)->permutations->conds;
foreach my $perm (@perms)
{
my $ok = 1;
# "TRUE" condition will be returned.
# $PARENT is the variable in which the variable is used: this is used
# only for error messages.
-# Returns the list of conditions.
# For example, if A is defined as "foo $(B) bar", and B is defined as
# "baz", this will return ("foo", "$(B)", "bar")
sub variable_value_as_list
# recursively follow $(...) and ${...} inclusions. It preserves @...@
# substitutions. If COND is 'all', then all values under all
# conditions should be returned; if COND is a particular condition
-# (all conditions are surrounded by @...@) then only the value for
-# that condition should be returned; otherwise, warn if VAR is
-# conditionally defined. If PARENT is specified, it is the name of
-# the including variable; this is only used for error reports.
-# If $LOC_WANTED is set, return a list of [$location, @values] instead
-# of a list of @values.
+# then only the value for that condition should be returned;
+# otherwise, warn if VAR is conditionally defined. If PARENT is
+# specified, it is the name of the including variable; this is only
+# used for error reports. If $LOC_WANTED is set, return a list of
+# [$location, @values] instead of a list of @values.
sub variable_value_as_list_recursive_worker ($$$$)
{
my ($var, $cond, $parent, $loc_wanted) = @_;
# &define_pretty_variable ($VAR, $COND, $WHERE, @VALUE)
# -----------------------------------------------------
# Like define_variable, but the value is a list, and the variable may
-# be defined conditionally. The second argument is the conditional
+# be defined conditionally. The second argument is the Condition
# under which the value should be defined; this should be the empty
# string to define the variable unconditionally. The third argument
# is a list holding the values to use for the variable. The value is
# Define a new rule. $TARGET is the rule name. $SOURCE
# is the filename the rule comes from. $OWNER is the
# owner of the rule (TARGET_AUTOMAKE or TARGET_USER).
-# $COND is the condition string under which the rule is defined.
-# $WHERE is the location where the rule is defined.
-# Returns a (possibly empty) list of conditions where the rule
+# $COND is the Condition under which the rule is defined.
+# $WHERE is the Location where the rule is defined.
+# Returns a (possibly empty) list of Conditions where the rule
# should be defined.
sub rule_define ($$$$$)
{
# "... `$target' previously defined here");
}
# Return so we don't redefine the rule in our tables,
- # don't check for ambiguous conditional, etc. The rule
+ # don't check for ambiguous condition, etc. The rule
# will be output anyway beauce &read_am_file ignore the
# return code.
return ();
# Check ambiguous conditional definitions.
my ($message, $ambig_cond) =
- conditional_ambiguous_p ($target, $cond, target_conditions ($target));
+ condition_ambiguous_p ($target, $cond, target_conditions ($target));
if ($message) # We have an ambiguty.
{
if ($owner == TARGET_USER)
else
{
# FIXME: for Automake rules, we can't diagnose ambiguities yet.
- # The point is that Automake doesn't propagate conditionals
+ # The point is that Automake doesn't propagate conditions
# everywhere. For instance &handle_PROGRAMS doesn't care if
# bin_PROGRAMS was defined conditionally or not.
# On the following input
# in condition TRUE (which conflicts with COND1). Fixing
# this in &handle_PROGRAMS and siblings seems hard: you'd
# have to explain &file_contents what to do with a
- # conditional. So for now we do our best *here*. If `foo:'
+ # condition. So for now we do our best *here*. If `foo:'
# was already defined in condition COND1 and we want to define
# it in condition TRUE, then define it only in condition !COND1.
# (See cond14.test and cond15.test for some test cases.)
# sure it is the same on exit. This lets us conditonally include
# other files.
my @saved_cond_stack = @cond_stack;
- my $cond = new Automake::Conditional (@cond_stack);
+ my $cond = new Automake::Condition (@cond_stack);
my $last_var_name = '';
my $last_var_type = '';
{
if ($prev_state == IN_RULE_DEF)
{
- my $cond = new Automake::Conditional @cond_stack;
+ my $cond = new Automake::Condition @cond_stack;
$output_trailer .= $cond->subst_string;
$output_trailer .= $_;
}
check_variable_expansions ($_, $where);
$output_trailer .= $comment . $spacing;
- my $cond = new Automake::Conditional @cond_stack;
+ my $cond = new Automake::Condition @cond_stack;
$output_trailer .= $cond->subst_string;
$output_trailer .= $_;
$comment = $spacing = '';
$prev_state = IN_RULE_DEF;
check_variable_expansions ($_, $where);
$output_trailer .= $comment . $spacing;
- my $cond = new Automake::Conditional @cond_stack;
+ my $cond = new Automake::Condition @cond_stack;
$output_trailer .= $cond->subst_string;
$output_trailer .= $_;
$comment = $spacing = '';
# sure it is the same on exit. This lets us conditonally include
# other files.
my @saved_cond_stack = @cond_stack;
- my $cond = new Automake::Conditional (@cond_stack);
+ my $cond = new Automake::Condition (@cond_stack);
foreach (make_paragraphs ($file, %transform))
{
# in %dependencies and $targets will have two rules).
# FIXME: 2. The logic here is not able to output a
- # multi-paragraph rule several time (e.g. for each conditional
+ # multi-paragraph rule several time (e.g. for each condition
# it is defined for) because it only knows the first paragraph.
# FIXME: 3. We are not robust to people defining a subset
-# Copyright (C) 1997, 2001, 2002 Free Software Foundation, Inc.
+# Copyright (C) 1997, 2001, 2002, 2003 Free Software Foundation, Inc.
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
# 02111-1307, USA.
-package Automake::Conditional;
+package Automake::Condition;
use strict;
use Carp;
=head1 NAME
-Automake::Conditional - record a conjunction of conditions
+Automake::Condition - record a conjunction of conditionals
=head1 SYNOPSIS
- use Automake::Conditional;
+ use Automake::Condition;
- # Create a conditional to represent "COND1 and not COND2".
- my $cond = new Automake::Conditional "COND1_TRUE", "COND2_FALSE";
- # Create a conditional to represent "not COND3".
- my $other = new Automake::Conditional "COND3_FALSE";
+ # Create a condition to represent "COND1 and not COND2".
+ my $cond = new Automake::Condition "COND1_TRUE", "COND2_FALSE";
+ # Create a condition to represent "not COND3".
+ my $other = new Automake::Condition "COND3_FALSE";
- # Create a conditional to represent
+ # Create a condition to represent
# "COND1 and not COND2 and not COND3".
my $both = $cond->merge ($other);
- # Likewise, but using a list of atomic conditional strings
+ # Likewise, but using a list of conditional strings
my $both2 = $cond->merge_conds ("COND3_FALSE");
# Strip from $both any subconditions which are in $other.
# Is $cond always false? (Not in this example)
if ($cond->false) { ... }
- # Return the list of conditions as a string:
+ # Return the list of conditionals as a string:
# "COND1_TRUE COND2_FALSE"
my $str = $cond->string;
- # Return the list of conditions as a human readable string:
+ # Return the list of conditionals as a human readable string:
# "COND1 and !COND2"
my $str = $cond->human;
- # Return the list of conditions as a AC_SUBST-style string:
+ # Return the list of conditionals as a AC_SUBST-style string:
# "@COND1_TRUE@@COND2_FALSE@"
my $subst = $cond->subst_string;
# (Not in this example)
if ($cond->implies_any ($other, $both)) { ... }
- # Remove superfluous conditions.
+ # Remove superfluous conditionals.
# (Returns @cons = ($both) in this example, because
# $other and $cond are implied by $both.)
- @conds = Automake::Conditional::reduce ($other, $both, $cond);
+ @conds = Automake::Condition::reduce ($other, $both, $cond);
- # Invert a Conditional. This returns a list of Conditionals.
+ # Invert a Condition. This returns a list of Conditions.
@conds = $both->not;
=head1 DESCRIPTION
-A C<Conditional> is a conjunction of atomic conditions. In Automake they
-are used to represent the conditions into which Makefile variables and
-Makefile rules are defined.
+A C<Condition> is a conjunction of conditionals (i.e., atomic conditions
+defined in F<configure.ac> by C<AM_CONDITIONAL>. In Automake they
+are used to represent the conditions into which F<Makefile> variables and
+F<Makefile> rules are defined.
If the variable C<VAR> is defined as
endif
endif
-then it will be associated a C<Conditional> created with
+then it will be associated a C<Condition> created with
the following statement.
- new Automake::Conditional "COND1_TRUE", "COND2_TRUE";
+ new Automake::Condition "COND1_TRUE", "COND2_TRUE";
-Remember that a C<Conditional> is a I<conjunction> of conditions, so
-the above C<Conditional> means C<VAR> is defined when C<COND1> is true
+Remember that a C<Condition> is a I<conjunction> of conditionals, so
+the above C<Condition> means C<VAR> is defined when C<COND1>
B<and> C<COND2> are true. There is no way to express disjunctions
-(i.e., I<or>s) with this class (see L<ConditionalSet>).
+(i.e., I<or>s) with this class (but see L<DisjConditions>).
-Another point worth to mention is that each C<Conditional> object is
-unique with respect to its conditions. Two C<Conditional> objects
-created for the same set of conditions will have the same adress.
-This makes it easy to compare C<Conditional>s, just compare the
+Another point worth to mention is that each C<Condition> object is
+unique with respect to its conditionals. Two C<Condition> objects
+created for the same set of conditionals will have the same adress.
+This makes it easy to compare C<Condition>s, just compare the
references.
- my $c1 = new Automake::Conditional "COND1_TRUE", "COND2_TRUE";
- my $c2 = new Automake::Conditional "COND1_TRUE", "COND2_TRUE";
+ my $c1 = new Automake::Condition "COND1_TRUE", "COND2_TRUE";
+ my $c2 = new Automake::Condition "COND1_TRUE", "COND2_TRUE";
$c1 == $c2; # True!
=head2 Methods
=over 4
-=item C<$cond = new Automake::Conditional [@conds]>
+=item C<$cond = new Automake::Condition [@conds]>
-Return a C<Conditional> objects for the conjunctions of conditions
+Return a C<Condition> objects for the conjunctions of conditionals
listed in C<@conds> as strings.
An item in C<@conds> should be either C<"FALSE">, C<"TRUE">, or have
the form C<"NAME_FALSE"> or C<"NAME_TRUE"> where C<NAME> can be
anything (in practice C<NAME> should be the name of a conditional
declared in F<configure.ac> with C<AM_CONDITIONAL>, but it's not
-C<Automake::Conditional>'s responsability to ensure this).
+C<Automake::Condition>'s responsability to ensure this).
An empty C<@conds> means C<"TRUE">.
As explained previously, the reference (object) returned is unique
with respect to C<@conds>. For this purpose, duplicate elements are
ignored, and C<@conds> is rewriten as C<("FALSE")> if it contains
-C<"FALSE"> or two contradictory conditions (such as C<"NAME_FALSE">
+C<"FALSE"> or two contradictory conditionals (such as C<"NAME_FALSE">
and C<"NAME_TRUE">.)
Therefore the following two statements create the same object (they
-both create the C<"FALSE"> conditional).
+both create the C<"FALSE"> condition).
- my $c3 = new Automake::Conditional "COND1_TRUE", "COND1_FALSE";
- my $c4 = new Automake::Conditional "COND2_TRUE", "FALSE";
+ my $c3 = new Automake::Condition "COND1_TRUE", "COND1_FALSE";
+ my $c4 = new Automake::Condition "COND2_TRUE", "FALSE";
$c3 == $c4; # True!
$c3 == FALSE; # True!
=cut
-# Keys in this hash are conditionnal strings. Values are the
+# Keys in this hash are conditional strings. Values are the
# associated object conditions. This is used by `new' to reuse
-# Conditional objects with identical conditions.
-use vars '%_conditional_singletons';
+# Condition objects with identical conditionals.
+use vars '%_condition_singletons';
# Do NOT reset this hash here. It's already empty by default,
-# and any reset would otherwise occur AFTER the `TRUE' and `FALSE'
+# and any setting would otherwise occur AFTER the `TRUE' and `FALSE'
# constants definitions.
-# %_conditional_singletons = ();
+# %_condition_singletons = ();
sub new ($;@)
{
next if $cond eq 'TRUE';
# Catch some common programming errors:
- # - A conditional passed to new
+ # - A Condition passed to new
confess "`$cond' is a reference, expected a string" if ref $cond;
- # - A conditional passed as a string to new
- confess "`$cond' doesn't look like a condition" if $cond =~ /::/;
+ # - A Condition passed as a string to new
+ confess "`$cond' does not look like a condition" if $cond =~ /::/;
# Detect cases when @conds can be simplified to FALSE.
if (($cond eq 'FALSE' && $#conds > 0)
}
my $key = $self->string;
- if (exists $_conditional_singletons{$key})
+ if (exists $_condition_singletons{$key})
{
- return $_conditional_singletons{$key};
+ return $_condition_singletons{$key};
}
- $_conditional_singletons{$key} = $self;
+ $_condition_singletons{$key} = $self;
return $self;
}
sub merge ($$)
{
my ($self, $other) = @_;
- new Automake::Conditional $self->conds, $other->conds;
+ new Automake::Condition $self->conds, $other->conds;
}
=item C<$newcond = $cond-E<gt>merge_conds (@conds)>
Return a new condition which is the conjunction of C<$cond> and
-C<@conds>, where C<@conds> is a list of atomic condition strings, as
+C<@conds>, where C<@conds> is a list of conditional strings, as
passed to C<new>.
=cut
sub merge_conds ($@)
{
my ($self, @conds) = @_;
- new Automake::Conditional $self->conds, @conds;
+ new Automake::Condition $self->conds, @conds;
}
=item C<$newcond = $cond-E<gt>strip ($minuscond)>
-Return a new condition which has all the subconditions of C<$cond>
+Return a new condition which has all the conditionals of C<$cond>
except those of C<$minuscond>. This is the opposite of C<merge>.
=cut
{
push @res, $cond unless $minus->has ($cond);
}
- return new Automake::Conditional @res;
+ return new Automake::Condition @res;
}
=item C<@list = $cond-E<gt>conds>
-Return the set of conditions defining C<$cond>, as strings. Note that
+Return the set of conditionals defining C<$cond>, as strings. Note that
this might not be exactly the list passed to C<new> (or a
concatenation of such lists if C<merge> was used), because of the
cleanup mentioned in C<new>'s description.
=item C<$cond-E<gt>string>
-Build a string which denotes the conditional.
+Build a string which denotes the condition.
For instance using the C<$cond> definition from L<SYNOPSYS>,
C<$cond-E<gt>string> will return C<"COND1_TRUE COND2_FALSE">.
=item C<$cond-E<gt>human>
-Build a human readable string which denotes the conditional.
+Build a human readable string which denotes the condition.
For instance using the C<$cond> definition from L<SYNOPSYS>,
C<$cond-E<gt>string> will return C<"COND1 and !COND2">.
=item C<$cond-E<gt>not>
-Return a negation of @<$cond> as a list of C<Conditional>s.
-This list should be used to construct a C<ConditionalSet>
-(we cannot return a C<ConditionalSet> from C<Automake::Conditional>,
+Return a negation of @<$cond> as a list of C<Condition>s.
+This list should be used to construct a C<DisjConditions>
+(we cannot return a C<DisjConditions> from C<Automake::Condition>,
because that would make these two packages interdependent).
=cut
my @res;
for my $cond ($self->conds)
{
- push @res, new Automake::Conditional &condition_negate ($cond);
+ push @res, new Automake::Condition &conditional_negate ($cond);
}
$self->{'not'} = [@res];
return @res;
=cut
-use constant TRUE => new Automake::Conditional "TRUE";
-use constant FALSE => new Automake::Conditional "FALSE";
+use constant TRUE => new Automake::Condition "TRUE";
+use constant FALSE => new Automake::Condition "FALSE";
=item C<reduce (@conds)>
-Filter a list of conditionals so that only the exclusive ones are
+Filter a list of conditions so that only the exclusive ones are
retained. For example, if both C<COND1_TRUE COND2_TRUE> and
C<COND1_TRUE> are in the list, discard the latter.
If the input list is empty, return C<(TRUE)>.
return @ret;
}
-=item C<condition_negate ($condstr)>
+=item C<conditional_negate ($condstr)>
-Negate a condition string.
+Negate a conditional string.
=cut
-sub condition_negate ($)
+sub conditional_negate ($)
{
my ($cond) = @_;
=head1 SEE ALSO
-L<Automake::ConditionalSet>.
+L<Automake::DisjConditions>.
=head1 HISTORY
C<AM_CONDITIONAL>s and supporting code were added to Automake 1.1o by
Ian Lance Taylor <ian@cygnus.org> in 1997. Since then it has been
improved by Tom Tromey <tromey@redhat.com>, Richard Boulton
-<richard@tartarus.org>, Raja R Harinath <harinath@cs.umn.edu>, and
-Akim Demaille <akim@epita.fr>. Alexandre Duret-Lutz <adl@gnu.org>
-extracted the code out of Automake to create this package in 2002.
+<richard@tartarus.org>, Raja R Harinath <harinath@cs.umn.edu>,
+Akim Demaille <akim@epita.fr>, and Alexandre Duret-Lutz <adl@gnu.org>.
=cut
-package Automake::ConditionalSet;
+# Copyright (C) 1997, 2001, 2002, 2003 Free Software Foundation, Inc.
+
+# This program is free software; you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as published by
+# the Free Software Foundation; either version 2, or (at your option)
+# any later version.
+
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+# GNU General Public License for more details.
+
+# You should have received a copy of the GNU General Public License
+# along with this program; if not, write to the Free Software
+# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
+# 02111-1307, USA.
+
+package Automake::DisjConditions;
use Carp;
use strict;
-use Automake::Conditional qw/TRUE FALSE/;
+use Automake::Condition qw/TRUE FALSE/;
=head1 NAME
-Automake::ConditionalSet - record a disjunction of conditions
+Automake::DisjConditions - record a disjunction of Conditions
=head1 SYNOPSIS
- use Automake::Conditional;
- use Automake::ConditionalSet;
+ use Automake::Condition;
+ use Automake::DisjConditions;
- # Create a conditional to represent "COND1 and not COND2".
- my $cond = new Automake::Conditional "COND1_TRUE", "COND2_FALSE";
- # Create a conditional to represent "not COND3".
- my $other = new Automake::Conditional "COND3_FALSE";
+ # Create a Condition to represent "COND1 and not COND2".
+ my $cond = new Automake::Condition "COND1_TRUE", "COND2_FALSE";
+ # Create a Condition to represent "not COND3".
+ my $other = new Automake::Condition "COND3_FALSE";
- # Create a ConditionalSet to represent
+ # Create a DisjConditions to represent
# "(COND1 and not COND2) or (not COND3)"
- my $set = new Automake::ConditionalSet $cond, $other;
+ my $set = new Automake::DisjConditions $cond, $other;
- # Return the list of Conditionals involved in $set.
+ # Return the list of Conditions involved in $set.
my @conds = $set->conds;
- # Return one of the Conditional involved in $set.
+ # Return one of the Condition involved in $set.
my $cond = $set->one_cond;
# Return true iff $set is always true (i.e. its subconditions
# only false conditions).
if ($set->false) { ... }
- # Return a string representing the ConditionalSet.
+ # Return a string representing the DisjConditions.
# "COND1_TRUE COND2_FALSE | COND3_FALSE"
my $str = $set->string;
- # Return a human readable string representing the ConditionalSet.
+ # Return a human readable string representing the DisjConditions.
# "(COND1 and !COND2) or (!COND3)"
my $str = $set->human;
- # Build a new ConditionalSet from the permuation of all
- # subconditions appearing in $set.
+ # Build a new DisjConditions from the permuation of all
+ # Conditions appearing in $set.
my $perm = $set->permutations;
- # Invert a ConditionalSet, i.e., create a new ConditionalSet
+ # Invert a DisjConditions, i.e., create a new DisjConditions
# that complements $set.
my $inv = $set->invert;
- # Multiply two ConditionalSets.
+ # Multiply two DisjConditions.
my $prod = $set1->multiply ($set2)
- # Return the subconditions of a ConditionalSet with respect to
- # a Conditional. See the description for a real example.
+ # Return the subconditions of a DisjConditions with respect to
+ # a Condition. See the description for a real example.
my $subconds = $set->sub_conditions ($cond)
=head1 DESCRIPTION
-A C<ConditionalSet> is a disjunction of atomic conditions. In
-Automake they are used to represent the conditions into which Makefile
+A C<DisjConditions> is a disjunction of C<Condition>s. In Automake
+they are used to represent the conditions into which Makefile
variables and Makefile rules are defined.
If the variable C<VAR> is defined as
endif
endif
-then it will be associated a C<ConditionalSet> created with
+then it will be associated a C<DisjConditions> created with
the following statement.
- new Automake::ConditionalSet
- (new Automake::Conditional ("COND1_TRUE", "COND2_TRUE"),
- new Automake::Conditional ("COND3_FALSE", "COND4_TRUE"));
+ new Automake::DisjConditions
+ (new Automake::Condition ("COND1_TRUE", "COND2_TRUE"),
+ new Automake::Condition ("COND3_FALSE", "COND4_TRUE"));
-As you can see, a C<ConditionalSet> is made from a list of
-C<Conditional>s. Since C<ConditionalSet> is a disjunction, and
-C<Conditional> is a conjunction, the above can be read as
+As you can see, a C<DisjConditions> is made from a list of
+C<Condition>s. Since C<DisjConditions> is a disjunction, and
+C<Condition> is a conjunction, the above can be read as
follows.
(COND1 and COND2) or ((not COND3) and COND4)
-Like C<Conditional> objects, a C<ConditionalSet> object is unisque
-with respect to its conditions. Two C<ConditionalSet> objects created
+That's indeed the condition into which C<VAR> has a value.
+
+Like C<Condition> objects, a C<DisjConditions> object is unique
+with respect to its conditions. Two C<DisjConditions> objects created
for the same set of conditions will have the same adress. This makes
-it easy to compare C<ConditionalSet>s: just compare the references.
+it easy to compare C<DisjConditions>s: just compare the references.
=head2 Methods
=over 4
-=item C<$set = new Automake::ConditionalSet [@conds]>
+=item C<$set = new Automake::DisjConditions [@conds]>
-Create a C<ConditionalSet> object from the list of C<Conditional>
+Create a C<DisjConditions> object from the list of C<Condition>
objects passed in arguments.
-If the C<@conds> list is empty, the C<ConditionalSet> is assumed to be
+If the C<@conds> list is empty, the C<DisjConditions> is assumed to be
false.
As explained previously, the reference (object) returned is unique
=cut
-# Keys in this hash are ConditionalSet strings. Values are the
-# associated object ConditionalSet. This is used by `new' to reuse
-# ConditionalSet objects with identical conditions.
-use vars '%_conditional_set_singletons';
+# Keys in this hash are DisjConditions strings. Values are the
+# associated object DisjConditions. This is used by `new' to reuse
+# DisjConditions objects with identical conditions.
+use vars '%_disjcondition_singletons';
sub new ($;@)
{
for my $cond (@conds)
{
confess "`$cond' isn't a reference" unless ref $cond;
- confess "`$cond' isn't an Automake::Conditional"
- unless $cond->isa ("Automake::Conditional");
+ confess "`$cond' isn't an Automake::Condition"
+ unless $cond->isa ("Automake::Condition");
# This is a disjunction of conditions, so we drop
# false conditions. We'll always treat an "empty"
- # ConditionalSet as false for this reason.
+ # DisjConditions as false for this reason.
next if $cond->false;
# Store conditions as keys AND as values, because blessed
}
my $key = $self->string;
- if (exists $_conditional_set_singletons{$key})
+ if (exists $_disjcondition_singletons{$key})
{
- return $_conditional_set_singletons{$key};
+ return $_disjcondition_singletons{$key};
}
- $_conditional_set_singletons{$key} = $self;
+ $_disjcondition_singletons{$key} = $self;
return $self;
}
=item C<@conds = $set-E<gt>conds>
-Return the list of C<Conditional> objects involved in C<$set>.
+Return the list of C<Condition> objects involved in C<$set>.
=cut
=item C<$cond = $set-E<gt>one_cond>
-Return one C<Conditional> object involved in C<$set>.
+Return one C<Condition> object involved in C<$set>.
=cut
=item C<$et = $set-E<gt>false>
-Return 1 iff the C<ConditionalSet> object is always false (i.e., if it
-is empty, or if it contains only false C<Conditional>s). Return 0
+Return 1 iff the C<DisjConditions> object is always false (i.e., if it
+is empty, or if it contains only false C<Condition>s). Return 0
otherwise.
=cut
=item C<$et = $set-E<gt>true>
-Return 1 iff the C<ConditionalSet> object is always true (i.e. covers all
+Return 1 iff the C<DisjConditions> object is always true (i.e. covers all
conditions). Return 0 otherwise.
=cut
=item C<$str = $set-E<gt>string>
-Build a string which denotes the C<ConditionalSet>.
+Build a string which denotes the C<DisjConditions>.
=cut
=item C<$cond-E<gt>human>
-Build a human readable string which denotes the C<ConditionalSet>.
+Build a human readable string which denotes the C<DisjConditions>.
=cut
}
if (! @ret)
{
- push (@ret, new Automake::Conditional $cond);
- push (@ret, new Automake::Conditional $neg);
+ 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 subconditions involved in a C<ConditionalSet>.
+Return a permutations of the conditions involved in a C<DisjConditions>.
-For instance consider this initial C<ConditionalSet>.
+For instance consider this initial C<DisjConditions>.
- my $set = new Automake::ConditionalSet
- (new Automake::Conditional ("COND1_TRUE", "COND2_TRUE"),
- new Automake::Conditional ("COND3_FALSE", "COND2_TRUE"));
+ 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 Conditional set.
+Calling C<$set-E<gt>permutations> will return the following DisjConditions.
- new Automake::ConditionalSet
- (new Automake::Conditional ("COND1_TRUE", "COND2_TRUE", "COND3_TRUE"),
- new Automake::Conditional ("COND1_FALSE","COND2_TRUE", "COND3_TRUE"),
- new Automake::Conditional ("COND1_TRUE", "COND2_FALSE","COND3_TRUE"),
- new Automake::Conditional ("COND1_FALSE","COND2_FALSE","COND3_TRUE"),
- new Automake::Conditional ("COND1_TRUE", "COND2_TRUE", "COND3_FALSE"),
- new Automake::Conditional ("COND1_FALSE","COND2_TRUE", "COND3_FALSE"),
- new Automake::Conditional ("COND1_TRUE", "COND2_FALSE","COND3_FALSE"),
- new Automake::Conditional ("COND1_FALSE","COND2_FALSE","COND3_FALSE"));
+ 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
# An empty permutation is TRUE, because we ignore TRUE conditions
# in the recursions.
@res = (TRUE) unless @res;
- my $res = new Automake::ConditionalSet @res;
+ my $res = new Automake::DisjConditions @res;
$self->{'permutations'} = $res;
Multiply two conditional sets.
- my $set1 = new Automake::ConditionalSet
- (new Automake::Conditional ("A_TRUE"),
- new Automake::Conditional ("B_TRUE"));
- my $set2 = new Automake::ConditionalSet
- (new Automake::Conditional ("C_FALSE"),
- new Automake::Conditional ("D_FALSE"));
+ my $set1 = new Automake::DisjConditions
+ (new Automake::Condition ("A_TRUE"),
+ new Automake::Condition ("B_TRUE"));
+ my $set2 = new Automake::DisjConditions
+ (new Automake::Condition ("C_FALSE"),
+ new Automake::Condition ("D_FALSE"));
C<$set1-E<gt>multiply ($set2)> will return
- new Automake::ConditionalSet
- (new Automake::Conditional ("A_TRUE", "C_FALSE"),
- new Automake::Conditional ("B_TRUE", "C_FALSE"),;
- new Automake::Conditional ("A_TRUE", "D_FALSE"),
- new Automake::Conditional ("B_TRUE", "D_FALSE"));
+ new Automake::DisjConditions
+ (new Automake::Condition ("A_TRUE", "C_FALSE"),
+ new Automake::Condition ("B_TRUE", "C_FALSE"),;
+ new Automake::Condition ("A_TRUE", "D_FALSE"),
+ new Automake::Condition ("B_TRUE", "D_FALSE"));
-The argument can also be a C<Conditional>.
+The argument can also be a C<Condition>.
=cut
-# Same as multiply() but take a list of Conditonal as second argument.
+# Same as multiply() but take a list of Conditonals as second argument.
# We use this in invert().
sub _multiply ($@)
{
push @res, $selfcond->merge ($setcond);
}
}
- return new Automake::ConditionalSet @res;
+ return new Automake::DisjConditions @res;
}
sub multiply ($$)
{
my ($self, $set) = @_;
- return $self->_multiply ($set) if $set->isa('Automake::Conditional');
+ return $self->_multiply ($set) if $set->isa('Automake::Condition');
return $self->_multiply ($set->conds);
}
=item C<$inv = $set-E<gt>invert>
-Invert a C<ConditionalSet>. Return a C<ConditionalSet> which is true
+Invert a C<DisjConditions>. Return a C<DisjConditions> which is true
when C<$set> is false, and vice-versa.
- my $set = new Automake::ConditionalSet
- (new Automake::Conditional ("A_TRUE", "B_TRUE"),
- new Automake::Conditional ("A_FALSE", "B_FALSE"));
+ my $set = new Automake::DisjConditions
+ (new Automake::Condition ("A_TRUE", "B_TRUE"),
+ new Automake::Condition ("A_FALSE", "B_FALSE"));
-Calling C<$set-E<gt>invert> will return the following C<ConditionalSet>.
+Calling C<$set-E<gt>invert> will return the following C<DisjConditions>.
- new Automake::ConditionalSet
- (new Automake::Conditional ("A_TRUE", "B_FALSE"),
- new Automake::Conditional ("A_FALSE", "B_TRUE"));
+ new Automake::DisjConditions
+ (new Automake::Condition ("A_TRUE", "B_FALSE"),
+ new Automake::Condition ("A_FALSE", "B_TRUE"));
=cut
return $self->{'invert'} if defined $self->{'invert'};
- # The invert of an empty ConditionalSet is TRUE.
- my $res = new Automake::ConditionalSet TRUE;
+ # The invert of an empty DisjConditions is TRUE.
+ my $res = new Automake::DisjConditions TRUE;
# !((a.b)+(c.d)+(e.f))
# = (!a+!b).(!c+!d).(!e+!f)
=item C<$simp = $set->simplify>
-Find prime implicants and return a simplified C<ConditionalSet>.
+Find prime implicants and return a simplified C<DisjConditions>.
=cut
{
my ($self) = @_;
- # If we know this ConditionalSet is always true, we have nothing to do.
+ # If we know this DisjConditions is always true, we have nothing to do.
# Use the cached value if true if available. Never call true()
# as this would call invert() which can be slow.
- return new Automake::ConditionalSet TRUE
+ return new Automake::DisjConditions TRUE
if $self->{'hash'}{&TRUE} || $self->{'true'};
my $nvars = 0;
my @conds = $and_conds->conds;
for my $cond (@conds)
{
- # Which variable is this condition about?
+ # Which variable is this conditional about?
confess "can't parse `$cond'"
unless $cond =~ /^(.*_)(FALSE|TRUE)$/;
}
}
- # Finally merge bit strings back into a Automake::ConditionalSet.
+ # Finally merge bit strings back into a Automake::DisjConditions.
# If level 0 has been filled, we've found `TRUE'. No need to translate
# anything.
- return new Automake::ConditionalSet TRUE if $#{$subcubes[0]} >= 0;
+ return new Automake::DisjConditions TRUE if $#{$subcubes[0]} >= 0;
# Otherwise, translate uncombined terms in other levels.
++$rank;
}
- push @or_conds, new Automake::Conditional @and_conds if @and_conds;
+ push @or_conds, new Automake::Condition @and_conds if @and_conds;
}
}
- return new Automake::ConditionalSet @or_conds;
+ return new Automake::DisjConditions @or_conds;
}
sub simplify ($)
For instance, consider:
- my $a = new Automake::ConditionalSet
- (new Automake::Conditional ("A_TRUE", "B_TRUE"),
- new Automake::Conditional ("A_TRUE", "C_FALSE"),
- new Automake::Conditional ("A_TRUE", "B_FALSE", "C_TRUE"),
- new Automake::Conditional ("A_FALSE"));
- my $b = new Automake::ConditionalSet
- (new Automake::Conditional ("A_TRUE", "B_FALSE"));
+ my $a = new Automake::DisjConditions
+ (new Automake::Condition ("A_TRUE", "B_TRUE"),
+ new Automake::Condition ("A_TRUE", "C_FALSE"),
+ new Automake::Condition ("A_TRUE", "B_FALSE", "C_TRUE"),
+ new Automake::Condition ("A_FALSE"));
+ my $b = new Automake::DisjConditions
+ (new Automake::Condition ("A_TRUE", "B_FALSE"));
Calling C<$a-E<gt>sub_conditions ($b)> will return the following
-C<ConditionalSet>.
+C<DisjConditions>.
- new Automake::ConditionalSet
- (new Automake::Conditional ("C_FALSE"), # From A_TRUE C_FALSE
- new Automake::Conditional ("C_TRUE")); # From A_TRUE B_FALSE C_TRUE"
+ new Automake::DisjConditions
+ (new Automake::Condition ("C_FALSE"), # From A_TRUE C_FALSE
+ new Automake::Condition ("C_TRUE")); # From A_TRUE B_FALSE C_TRUE"
=cut
{
my ($self, $subcond) = @_;
- # Make $subcond blindingly apparent in the ConditionalSet.
+ # Make $subcond blindingly apparent in the DisjConditions.
# For instance `$a->_multiply($b)' (from the POD example) is:
- # new Automake::ConditionalSet
- # (new Automake::Conditional ("FALSE"),
- # new Automake::Conditional ("A_TRUE", "B_FALSE", "C_FALSE"),
- # new Automake::Conditional ("A_TRUE", "B_FALSE", "C_TRUE"),
- # new Automake::Conditional ("FALSE"));
+ # new Automake::DisjConditions
+ # (new Automake::Condition ("FALSE"),
+ # new Automake::Condition ("A_TRUE", "B_FALSE", "C_FALSE"),
+ # new Automake::Condition ("A_TRUE", "B_FALSE", "C_TRUE"),
+ # new Automake::Condition ("FALSE"));
my $prod = $self->_multiply ($subcond);
- # Now, strip $subcond from the remaining (i.e., non-false) Conditionals.
+ # Now, strip $subcond from the remaining (i.e., non-false) Conditions.
my @res;
foreach my $c ($prod->conds)
{
push @res, $c->strip ($subcond) unless $c->false;
}
- return new Automake::ConditionalSet @res;
+ return new Automake::DisjConditions @res;
}
=head1 SEE ALSO
-L<Automake::Conditional>.
+L<Automake::Condition>.
=head1 HISTORY
Ian Lance Taylor <ian@cygnus.org> in 1997. Since then it has been
improved by Tom Tromey <tromey@redhat.com>, Richard Boulton
<richard@tartarus.org>, Raja R Harinath <harinath@cs.umn.edu>, Akim
-Demaille <akim@epita.fr>, and Pavel Roskin <proski@gnu.org>.
-Alexandre Duret-Lutz <adl@gnu.org> extracted the code out of Automake
-to create this package in 2002.
+Demaille <akim@epita.fr>, Pavel Roskin <proski@gnu.org>, and
+Alexandre Duret-Lutz <adl@gnu.org>.
=cut
## Process this file with automake to create Makefile.in
+## Copyright (C) 2001, 2002, 2003 Free Software Foundation, Inc.
+
+## This program is free software; you can redistribute it and/or modify
+## it under the terms of the GNU General Public License as published by
+## the Free Software Foundation; either version 2, or (at your option)
+## any later version.
+
+## This program is distributed in the hope that it will be useful,
+## but WITHOUT ANY WARRANTY; without even the implied warranty of
+## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+## GNU General Public License for more details.
+
+## You should have received a copy of the GNU General Public License
+## along with this program; if not, write to the Free Software
+## Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
+## 02111-1307, USA.
+
SUBDIRS = tests
perllibdir = $(pkgvdatadir)/Automake
dist_perllib_DATA = \
ChannelDefs.pm \
Channels.pm \
- Conditional.pm \
- ConditionalSet.pm \
+ Condition.pm \
+ DisjConditions.pm \
General.pm \
Location.pm \
Struct.pm \
dist_perllib_DATA = \
ChannelDefs.pm \
Channels.pm \
- Conditional.pm \
- ConditionalSet.pm \
+ Condition.pm \
+ DisjConditions.pm \
General.pm \
Location.pm \
Struct.pm \
-# Copyright (C) 2001, 2002 Free Software Foundation, Inc.
+# Copyright (C) 2001, 2002, 2003 Free Software Foundation, Inc.
#
# This file is part of GNU Automake.
#
# the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
# Boston, MA 02111-1307, USA.
-use Automake::Conditional qw/TRUE FALSE/;
+use Automake::Condition qw/TRUE FALSE/;
sub test_basics ()
{
for (@tests)
{
- my $a = new Automake::Conditional @{$_->[0]};
+ my $a = new Automake::Condition @{$_->[0]};
return 1 if $_->[1] != $a->true;
return 1 if $_->[1] != ($a == TRUE);
return 1 if $_->[2] != $a->false;
my $failed = 0;
my @tests = (# [When,
- # [Implied-Conditionals],
- # [Not-Implied-Conditionals]]
+ # [Implied-Conditions],
+ # [Not-Implied-Conditions]]
[['TRUE'],
[['TRUE']],
[['A_TRUE'], ['A_TRUE', 'B_FALSE'], ['FALSE']]],
for my $t (@tests)
{
- my $a = new Automake::Conditional @{$t->[0]};
+ my $a = new Automake::Condition @{$t->[0]};
for my $u (@{$t->[1]})
{
- my $b = new Automake::Conditional @$u;
+ my $b = new Automake::Condition @$u;
if (! $b->true_when ($a))
{
print "`" . $b->string .
}
for my $u (@{$t->[2]})
{
- my $b = new Automake::Conditional @$u;
+ my $b = new Automake::Condition @$u;
if ($b->true_when ($a))
{
print "`" . $b->string .
[["BAR FOO", "BAR", "TRUE"], ["BAR FOO"]],
# Check that reduction happens even when there are
- # two conditionals to remove.
+ # two conditions to remove.
[["FOO", "FOO BAR", "BAR"], ["FOO BAR"]],
[["FOO", "FOO BAR", "BAZ", "FOO BAZ"], ["FOO BAR", "FOO BAZ"]],
[["FOO", "FOO BAR", "BAZ", "FOO BAZ", "FOO BAZ BAR"],
# Duplicated condionals should be removed
[["FOO", "BAR", "BAR"], ["BAR,FOO"]],
- # Equivalent conditionals in different forms should be
+ # Equivalent conditions in different forms should be
# reduced: which one is left is unfortunately order
# dependent.
[["BAR FOO", "FOO BAR"], ["FOO BAR"]],
foreach (@tests)
{
my ($inref, $outref) = @$_;
- my @inconds = map { new Automake::Conditional $_ } @$inref;
- my @outconds = map { (new Automake::Conditional $_)->string } @$outref;
+ my @inconds = map { new Automake::Condition $_ } @$inref;
+ my @outconds = map { (new Automake::Condition $_)->string } @$outref;
my @res =
- map { $_->string } (Automake::Conditional::reduce (@inconds));
+ map { $_->string } (Automake::Condition::reduce (@inconds));
my $result = join (",", sort @res);
my $exresult = join (",", @outconds);
-# Copyright (C) 2001, 2002 Free Software Foundation, Inc.
+# Copyright (C) 2001, 2002, 2003 Free Software Foundation, Inc.
#
# This file is part of GNU Automake.
#
# the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
# Boston, MA 02111-1307, USA.
-use Automake::Conditional qw/TRUE FALSE/;
-use Automake::ConditionalSet;
+use Automake::Condition qw/TRUE FALSE/;
+use Automake::DisjConditions;
sub test_basics ()
{
- my $cond = new Automake::Conditional "COND1_TRUE", "COND2_FALSE";
- my $other = new Automake::Conditional "COND3_FALSE";
- my $set1 = new Automake::ConditionalSet $cond, $other;
- my $set2 = new Automake::ConditionalSet $other, $cond;
+ my $cond = new Automake::Condition "COND1_TRUE", "COND2_FALSE";
+ my $other = new Automake::Condition "COND3_FALSE";
+ my $set1 = new Automake::DisjConditions $cond, $other;
+ my $set2 = new Automake::DisjConditions $other, $cond;
return 1 unless $set1 == $set2;
return 1 if $set1->false;
return 1 if $set1->true;
- return 1 unless (new Automake::ConditionalSet)->false;
- return 1 if (new Automake::ConditionalSet)->true;
+ return 1 unless (new Automake::DisjConditions)->false;
+ return 1 if (new Automake::DisjConditions)->true;
}
sub build_set (@)
my @set = ();
for my $cond (@conds)
{
- push @set, new Automake::Conditional @$cond;
+ push @set, new Automake::Condition @$cond;
}
- return new Automake::ConditionalSet @set;
+ return new Automake::DisjConditions @set;
}
sub test_permutations ()
# Also exercize invert() while we are at it.
- # FIXME: Don't run invert() with too much conditionals, this is too slow.
+ # FIXME: Don't run invert() with too much conditions, this is too slow.
next if $#{$t->[0][0]} > 8;
my $inv1 = $set->invert->simplify;
for my $t (@tests)
{
my $t1 = build_set @{$t->[0]};
- my $t2 = new Automake::Conditional @{$t->[1]};
+ my $t2 = new Automake::Condition @{$t->[1]};
my $t3 = build_set @{$t->[2]};
# Make sure simplify() yields the expected result.
## Process this file with automake to create Makefile.in
-## Copyright (C) 2002 Free Software Foundation, Inc.
+## Copyright (C) 2002, 2003 Free Software Foundation, Inc.
## This program is free software; you can redistribute it and/or modify
## it under the terms of the GNU General Public License as published by
TESTS_ENVIRONMENT = $(PERL) -Mstrict -I $(top_srcdir)/lib -w
TESTS = \
-Conditional.pl \
-ConditionalSet.pl
+Condition.pl \
+DisjConditions.pl
EXTRA_DIST = $(TESTS)
TESTS_ENVIRONMENT = $(PERL) -Mstrict -I $(top_srcdir)/lib -w
TESTS = \
-Conditional.pl \
-ConditionalSet.pl
+Condition.pl \
+DisjConditions.pl
EXTRA_DIST = $(TESTS)