diff src/ov-usr-fcn.cc @ 11558:1e4dfc7a9487

use .argn. to store argument names for inputname function
author John W. Eaton <jwe@octave.org>
date Mon, 17 Jan 2011 13:59:35 -0500
parents e9d72a3caa46
children 12df7854fa7c
line wrap: on
line diff
--- a/src/ov-usr-fcn.cc	Mon Jan 17 13:36:59 2011 -0500
+++ b/src/ov-usr-fcn.cc	Mon Jan 17 13:59:35 2011 -0500
@@ -544,9 +544,18 @@
 {
   if (! arg_names.empty ())
     {
+      // It is better to save this in the hidden variable .argn. and
+      // then use that in the inputname function instead of using argn,
+      // which might be redefined in a function.  Keep the old argn name
+      // for backward compatibility of functions that use it directly.
+
       symbol_table::varref ("argn") = arg_names;
+      symbol_table::varref (".argn.") = Cell (arg_names);
+
+      symbol_table::mark_hidden (".argn.");
 
       symbol_table::mark_automatic ("argn");
+      symbol_table::mark_automatic (".argn.");
     }
 
   symbol_table::varref (".nargin.") = nargin;