diff src/variables.cc @ 7752:40c428ea3408

initial implementation of dbup and dbdown
author John W. Eaton <jwe@octave.org>
date Sun, 04 May 2008 03:42:19 -0400
parents ec78d83a7fde
children e76a4a6e3c47
line wrap: on
line diff
--- a/src/variables.cc	Sat May 03 22:48:24 2008 -0400
+++ b/src/variables.cc	Sun May 04 03:42:19 2008 -0400
@@ -856,7 +856,7 @@
 octave_value
 get_global_value (const std::string& nm, bool silent)
 {
-  octave_value val = symbol_table::varval (nm, symbol_table::global_scope ());
+  octave_value val = symbol_table::global_varval (nm);
 
   if (val.is_undefined () && ! silent)
     error ("get_global_by_name: undefined symbol `%s'", nm.c_str ());
@@ -867,7 +867,7 @@
 void
 set_global_value (const std::string& nm, const octave_value& val)
 {
-  symbol_table::varref (nm, symbol_table::global_scope ()) = val;
+  symbol_table::global_varref (nm) = val;
 }
 
 // Variable values.
@@ -1671,9 +1671,6 @@
       pats[0] = "*";
     }
     
-  symbol_table::scope_id scope = global_only
-    ? symbol_table::global_scope () : symbol_table::current_scope ();
-
   symbol_info_list symbol_stats;
   std::list<std::string> symbol_names;
 
@@ -1718,8 +1715,9 @@
 	}
       else
 	{
-	  std::list<symbol_table::symbol_record> tmp
-	    = symbol_table::glob_variables (pats[j], scope);
+	  std::list<symbol_table::symbol_record> tmp = global_only
+	    ? symbol_table::glob_global_variables (pats[j])
+	    : symbol_table::glob_variables (pats[j]);
 
 	  for (std::list<symbol_table::symbol_record>::const_iterator p = tmp.begin ();
 	       p != tmp.end (); p++)
@@ -2080,13 +2078,19 @@
 		  bool exclusive = false)
 {
   if (idx == argc)
-    symbol_table::clear_variables(symbol_table::global_scope ());
+    {
+      string_vector gvars = symbol_table::global_variable_names ();
+
+      int gcount = gvars.length ();
+
+      for (int i = 0; i < gcount; i++)
+	symbol_table::clear_global (gvars[i]);
+    }
   else
     {
       if (exclusive)
 	{
-	  string_vector gvars
-	    = symbol_table::variable_names (symbol_table::global_scope ());
+	  string_vector gvars = symbol_table::global_variable_names ();
 
 	  int gcount = gvars.length ();