[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
bug#14441: [PATCH 2/8] Automake::Rule: expose suffix rules as a function
From: |
Stefano Lattarini |
Subject: |
bug#14441: [PATCH 2/8] Automake::Rule: expose suffix rules as a function, not a scalar |
Date: |
Tue, 28 May 2013 11:45:34 +0200 |
This is just a preparatory refactoring in view of future patches.
No semantic change is intended.
* lib/Automake/Rule.pm ($suffix_rules): Turn from a package-level
variable to a lexical variable.
(suffix_rule): New function, expose the details of $suffix_rules
that are actually required by code outside thus modules --- and
only those details, no more.
(@EXPORT): Adjust.
* automake.in (derive_suffix): Likewise.
Signed-off-by: Stefano Lattarini <address@hidden>
---
automake.in | 9 ++++-----
lib/Automake/Rule.pm | 20 +++++++++++++++++---
2 files changed, 21 insertions(+), 8 deletions(-)
diff --git a/automake.in b/automake.in
index ef2cf6d..7829875 100644
--- a/automake.in
+++ b/automake.in
@@ -5990,12 +5990,11 @@ sub derive_suffix ($$)
{
my ($source_ext, $obj) = @_;
- while (! $extension_map{$source_ext}
- && $source_ext ne $obj
- && exists $suffix_rules->{$source_ext}
- && exists $suffix_rules->{$source_ext}{$obj})
+ while (!$extension_map{$source_ext} && $source_ext ne $obj)
{
- $source_ext = $suffix_rules->{$source_ext}{$obj}[0];
+ my $new_source_ext = suffix_rule ($source_ext, $obj);
+ last if not defined $new_source_ext;
+ $source_ext = $new_source_ext;
}
return $source_ext;
diff --git a/lib/Automake/Rule.pm b/lib/Automake/Rule.pm
index 47f3a9d..5f6f3a2 100644
--- a/lib/Automake/Rule.pm
+++ b/lib/Automake/Rule.pm
@@ -29,8 +29,8 @@ use Automake::DisjConditions;
require Exporter;
use vars '@ISA', '@EXPORT', '@EXPORT_OK';
@ISA = qw/Automake::Item Exporter/;
address@hidden = qw (reset register_suffix_rule suffix_rules_count
- suffixes rules $suffix_rules $KNOWN_EXTENSIONS_PATTERN
address@hidden = qw (reset register_suffix_rule suffix_rules_count suffix_rule
+ suffixes rules $KNOWN_EXTENSIONS_PATTERN
depend %dependencies %actions register_action
accept_extensions
reject_rule msg_rule msg_cond_rule err_rule err_cond_rule
@@ -154,7 +154,7 @@ C<register_suffix_rule> function.
=cut
-use vars '$suffix_rules';
+my $suffix_rules;
=item C<$KNOWN_EXTENSIONS_PATTERN>
@@ -384,6 +384,20 @@ sub reset()
%actions = ();
}
+=item C<suffix_rule ($ext, $obj)>
+
+XXX
+
+=cut
+
+sub suffix_rule ($$)
+{
+ my ($source_ext, $obj) = @_;
+ return undef unless (exists $suffix_rules->{$source_ext} and
+ exists $suffix_rules->{$source_ext}{$obj});
+ return $suffix_rules->{$source_ext}{$obj}[0];
+}
+
=item C<register_suffix_rule ($where, $src, $dest)>
Register a suffix rule defined on C<$where> that transforms
--
1.8.3.rc3.8.g5e49f30
- bug#14441: bug in new file extensions, Felix Salfelder, 2013/05/22
- bug#14441: bug in new file extensions, Stefano Lattarini, 2013/05/28
- bug#14441: [PATCH 0/8] Fix automake bug#14441, and related minor refactorings, Stefano Lattarini, 2013/05/28
- bug#14441: [PATCH 3/8] suffix rules: better distinction between builtin and user-derived, Stefano Lattarini, 2013/05/28
- bug#14441: [PATCH 1/8] tests: expose automake bug#14441, Stefano Lattarini, 2013/05/28
- bug#14441: [PATCH 2/8] Automake::Rule: expose suffix rules as a function, not a scalar,
Stefano Lattarini <=
- bug#14441: [PATCH 4/8] Automake::Rule: make private variables lexically scoped, Stefano Lattarini, 2013/05/28
- bug#14441: [PATCH 6/8] Automake::Rule: rename: suffix_rule() -> next_in_suffix_chain(), Stefano Lattarini, 2013/05/28
- bug#14441: [PATCH 5/8] Automake::Rule: adjust comments and POD according to previous changes, Stefano Lattarini, 2013/05/28
- bug#14441: [PATCH 8/8] NEWS: document fix for bug#14441, Stefano Lattarini, 2013/05/28
- bug#14441: [PATCH 7/8] Automake::Rule: consistently prepend underscore to private variables, Stefano Lattarini, 2013/05/28
- bug#14441: [PATCH 0/8] Fix automake bug#14441, and related minor refactorings, Stefano Lattarini, 2013/05/29
- Message not available