* lib/Automake/Variable.pm (@EXPORT): Remove variable_dump.
authorAlexandre Duret-Lutz <adl@gnu.org>
Sun, 27 Jul 2003 21:25:17 +0000 (21:25 +0000)
committerAlexandre Duret-Lutz <adl@gnu.org>
Sun, 27 Jul 2003 21:25:17 +0000 (21:25 +0000)
(variable_dump): Replace by ...
(dump): ... this method.
(rdef, _check_ambiguous_condition): Adjust to use ->dump.
(define, variables_dump): Adjust to use Automake::Variable::dump

ChangeLog
lib/Automake/Variable.pm

index 472346a..31f3cb8 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,5 +1,11 @@
 2003-07-27  Alexandre Duret-Lutz  <adl@gnu.org>
 
+       * 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.
 
index 6944cea..3e9cb4c 100644 (file)
@@ -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-E<gt>dump>
+
+=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;