From: Alexandre Duret-Lutz Date: Sun, 27 Jul 2003 21:25:17 +0000 (+0000) Subject: * lib/Automake/Variable.pm (@EXPORT): Remove variable_dump. X-Git-Tag: Release-1-7b~98 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=2056a8f32d0bd35757073039dd8dd4e4a1503f31;p=thirdparty%2Fautomake.git * lib/Automake/Variable.pm (@EXPORT): Remove variable_dump. (variable_dump): Replace by ... (dump): ... this method. (rdef, _check_ambiguous_condition): Adjust to use ->dump. (define, variables_dump): Adjust to use Automake::Variable::dump --- diff --git a/ChangeLog b/ChangeLog index 472346a56..31f3cb8cb 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,5 +1,11 @@ 2003-07-27 Alexandre Duret-Lutz + * lib/Automake/Variable.pm (@EXPORT): Remove variable_dump. + (variable_dump): Replace by ... + (dump): ... this method. + (rdef, _check_ambiguous_condition): Adjust to use ->dump. + (define, variables_dump): Adjust to use Automake::Variable::dump + * lib/am/compile.am (mostlyclean-compile): Do not erase core dumps. * automake.texi (Built sources example): Adjust example. diff --git a/lib/Automake/Variable.pm b/lib/Automake/Variable.pm index 6944cea9d..3e9cb4c16 100644 --- a/lib/Automake/Variable.pm +++ b/lib/Automake/Variable.pm @@ -36,7 +36,7 @@ use vars '@ISA', '@EXPORT', '@EXPORT_OK'; scan_variable_expansions check_variable_expansions condition_ambiguous_p variable_delete - variable_dump variables_dump + variables_dump set_seen require_variables require_variables_for_variable variable_value @@ -461,7 +461,7 @@ sub rdef ($$) my ($self, $cond) = @_; my $d = $self->def ($cond); prog_error ("undefined condition `" . $cond->human . "' for `" - . $self->name . "'\n" . variable_dump ($self->name)) + . $self->name . "'\n" . $self->dump) unless $d; return $d; } @@ -513,7 +513,7 @@ sub _check_ambiguous_condition ($$$) { msg 'syntax', $where, "$message ...", partial => 1; msg_var ('syntax', $var, "... `$var' previously defined here"); - verb (variable_dump ($var)); + verb ($self->dump); } } @@ -810,6 +810,34 @@ sub has_conditional_contents ($) } +=item C<$string = $var-Edump> + +=item C<$string = Automake::Variable::dump ($varname)> + +Return a string describing all we know about C<$var> (or C<$varname>). +For debugging. + +=cut + +sub dump ($) +{ + my ($self) = @_; + + my $v = ref $self ? $self : var $self; + + return "$self does not exist\n" + unless $v; + + my $text = $v->name . ": \n {\n"; + foreach my $vcond ($v->conditions->conds) + { + $text .= " " . $vcond->human . " => " . $v->rdef ($vcond)->dump; + } + $text .= " }\n"; + return $text; +} + + =back =head2 Utility functions @@ -1130,7 +1158,7 @@ sub define ($$$$$$$$) "... overrides Automake variable `$var' defined here"); } verb ("refusing to override the user definition of:\n" - . variable_dump ($var) + . Automake::Variable::dump $var ."with `" . $cond->human . "' => `$value'"); } else @@ -1196,39 +1224,6 @@ sub variable_delete ($@) } } -=item C<$str = variable_dump ($varname)> - -Return a string describing all we know about C<$varname>. -For debugging. - -=cut - -# &variable_dump ($VAR) -# --------------------- -sub variable_dump ($) -{ - my ($var) = @_; - my $text = ''; - - my $v = var $var; - - if (!$v) - { - $text = " $var does not exist\n"; - } - else - { - $text .= "$var: \n {\n"; - foreach my $vcond ($v->conditions->conds) - { - $text .= " " . $vcond->human . " => " . $v->rdef ($vcond)->dump; - } - $text .= " }\n"; - } - return $text; -} - - =item C<$str = variables_dump ($varname)> Return a string describing all we know about all variables. @@ -1241,9 +1236,9 @@ sub variables_dump () my ($var) = @_; my $text = "All variables:\n{\n"; - foreach my $var (sort (variables())) + foreach my $var (sort variables) { - $text .= variable_dump ($var); + $text .= Automake::Variable::dump $var; } $text .= "}\n"; return $text;