diff src/mex.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 ba8fcc115fee
children 3e4c9b69069d
line wrap: on
line diff
--- a/src/mex.cc	Sat May 03 22:48:24 2008 -0400
+++ b/src/mex.cc	Sun May 04 03:42:19 2008 -0400
@@ -3262,18 +3262,23 @@
 
   // FIXME -- should this be in variables.cc?
 
-  symbol_table::scope_id scope = -1;
+  octave_value val;
 
   if (! strcmp (space, "global"))
-    scope = symbol_table::global_scope ();
-  else if (! strcmp (space, "caller"))
-    scope = symbol_table::current_caller_scope ();
-  else if (! strcmp (space, "base"))
-    scope = symbol_table::top_scope ();
+    val = get_global_value (name);
   else
-    mexErrMsgTxt ("mexGetVariable: symbol table does not exist");
-
-  octave_value val = symbol_table::varval (name, scope);
+    {
+      symbol_table::scope_id scope = -1;
+
+      if (! strcmp (space, "caller"))
+	scope = symbol_table::current_caller_scope ();
+      else if (! strcmp (space, "base"))
+	scope = symbol_table::top_scope ();
+      else
+	mexErrMsgTxt ("mexGetVariable: symbol table does not exist");
+
+      val = symbol_table::varval (name, scope);
+    }
 
   if (val.is_defined ())
     {
@@ -3314,9 +3319,7 @@
 
       symbol_table::scope_id scope = -1;
 
-      if (! strcmp (space, "global"))
-	scope = symbol_table::global_scope ();
-      else if (! strcmp (space, "caller"))
+      if (! strcmp (space, "caller"))
 	scope = symbol_table::current_caller_scope ();
       else if (! strcmp (space, "base"))
 	scope = symbol_table::top_scope ();