diff options
author | Alexandre Duret-Lutz <adl@gnu.org> | 2004-08-08 17:11:24 +0000 |
---|---|---|
committer | Alexandre Duret-Lutz <adl@gnu.org> | 2004-08-08 17:11:24 +0000 |
commit | 9c3d8bd4a06677c99a01ad7174a13c9646c16112 (patch) | |
tree | 7f166987e35d42d162ecf43942a586bc50583666 /lib/Automake/Variable.pm | |
parent | 851e3ef582e117919a5dcd78e0a21ad27ee00840 (diff) | |
download | automake-9c3d8bd4a06677c99a01ad7174a13c9646c16112.tar.gz |
* lib/Automake/Variable.pm (%_primary_dict): New hash.
(_new, variable_delete): Update %_primary_dict.
(variables): Accept an optional $suffix argument.
* automake.in (check_typos, am_primary_prefixes): Use that
optional argument to restrict the loops over the variables we are
interested in.
Diffstat (limited to 'lib/Automake/Variable.pm')
-rw-r--r-- | lib/Automake/Variable.pm | 35 |
1 files changed, 30 insertions, 5 deletions
diff --git a/lib/Automake/Variable.pm b/lib/Automake/Variable.pm index 30ffd26dc..c9455ce7c 100644 --- a/lib/Automake/Variable.pm +++ b/lib/Automake/Variable.pm @@ -295,17 +295,33 @@ sub hook ($$) $_hooks{$var} = $fun; } -=item C<variables> +=item C<variables ([$suffix])> Returns the list of all L<Automake::Variable> instances. (I.e., all -variables defined so far.) +variables defined so far.) If C<$suffix> is supplied, return only +the L<Automake::Variable> instances that ends with C<_$suffix>. =cut -use vars '%_variable_dict'; -sub variables () +use vars '%_variable_dict', '%_primary_dict'; +sub variables (;$) { - return values %_variable_dict; + my ($suffix) = @_; + if ($suffix) + { + if (exists $_primary_dict{$suffix}) + { + return values %{$_primary_dict{$suffix}}; + } + else + { + return (); + } + } + else + { + return values %_variable_dict; + } } =item C<Automake::Variable::reset> @@ -318,6 +334,7 @@ other internal data. sub reset () { %_variable_dict = (); + %_primary_dict = (); %_appendvar = (); @_var_order = (); %_gen_varname = (); @@ -420,6 +437,10 @@ sub _new ($$) my $self = Automake::Item::new ($class, $name); $self->{'scanned'} = 0; $_variable_dict{$name} = $self; + if ($name =~ /_([[:alnum:]]+)$/) + { + $_primary_dict{$1}{$name} = $self; + } return $self; } @@ -1012,6 +1033,10 @@ sub variable_delete ($@) delete $_variable_dict{$var}{'defs'}{$cond}; } } + if ($var =~ /_([[:alnum:]]+)$/) + { + delete $_primary_dict{$1}{$var}; + } } =item C<$str = variables_dump> |