From bug-octave-request at bevo dot che dot wisc dot edu Thu Apr 19 10:07:11 2001 Subject: eval() tramples on __error_text__ From: Christoph Spiel To: bug-octave at bevo dot che dot wisc dot edu Date: Thu, 19 Apr 2001 17:00:48 +0200 Hiya! After John provided such a magnificent fix for setting __error_text__ in a catch block, I have looked at the behavior of the catch-string in eval(). While try clear a; a; catch e=__error_text__; end_try_catch; e now works, eval("clear a; a;", "e=__error_text__"); e does not: octave:1> try clear a; a; catch e=__error_text__; end_try_catch; e e = `a' undefined near line 1 column 14 octave:2> eval("clear a; a;", "e=__error_text__;"); e e = octave:3> I cannot sully a fix yet, but after adding the following three lines to "parse.y", *** parse.y.orig Wed Apr 18 20:31:12 2001 --- parse.y Thu Apr 19 16:48:27 2001 *************** *** 3529,3534 **** --- 3529,3539 ---- buffer_error_messages = false; bind_global_error_variable (); + + symbol_record *sym_rec = global_sym_tab->lookup("__error_text__"); + std::string error_text(sym_rec->def().string_value()); + bind_builtin_constant("error_text", error_text, true); + unwind_protect::add (clear_global_error_variable, 0); eval_string (args(1), 0, parse_status, nargout); the trouble spot reduces to either (1) clearing '__error_text__' too early (Where? Definitely not by the clear_global_error_variable pushed to the current frame.) or (2) not transferring it into the namespace in which 'eval_string(args(1), ...)' lives, because 'error_text' happily reports the last error: octave:1> eval("clear a; a;", "e = __error_text__; f = error_text;"); e, f e = f = `a' undefined near line 0 column 10 octave:2> -chris -- Christoph L. Spiel Hammersmith Consulting, web: www.hammersmith-consulting.com Phone: +49-8022-662908, fax: +49-8022-662909 ------------------------------------------------------------- Octave is freely available under the terms of the GNU GPL. Octave's home on the web: http://www.octave.org How to fund new projects: http://www.octave.org/funding.html Subscription information: http://www.octave.org/archive.html -------------------------------------------------------------