From bug-octave-request at bevo dot che dot wisc dot edu Fri Apr 20 07:18:29 2001 Subject: Re: eval() tramples on __error_text__ From: Christoph Spiel To: bug-octave at bevo dot che dot wisc dot edu Date: Fri, 20 Apr 2001 14:19:14 +0200 Applied your patch. Now, '__error_text__' is defined in the catch-string of an eval(), but it does not get undefined outside of it. In fact, '__error_text__' cannot be redefined at all. See line :2>, where the error message should report 'b' to be undefined. octave:1> eval("clear a; a;", "et = __error_text__;"); et, __error_text__ et = `a' undefined near line 0 column 10 __error_text__ = `a' undefined near line 0 column 10 octave:2> try clear b; b; catch et = __error_text__; end_try_catch; et et = `a' undefined near line 0 column 10 For reasons beyond my imagination, the symbol '__error_text__' winds up in in 'curr_sym_tab', but bind_builtin_constant() accesses 'global_sym_tab'. Wiping out the definition of '__error_text__' in 'curr_sym_tab' as shown below, cures the persistence problem, but introduces the problem of an undefined '__error_text__' in try-catch again. void clear_global_error_variable (void *) { delete error_message_buffer; error_message_buffer = 0; bind_builtin_constant ("__error_text__", "", true); symbol_record *sym_rec = curr_sym_tab->lookup("__error_text__"); // cls cout << "### __error_text__ = <" << sym_rec->def().string_value() << ">\n"; sym_rec->define_builtin_const(""); } With the above clear_global_error_variable() I get the following output (debug stuff '###' deleted): octave:1> eval("clear a; a;", "et = __error_text__;"); et, __error_text__ et = `a' undefined near line 0 column 10 __error_text__ = octave:2> try clear b; b; catch et = __error_text__; end_try_catch; et et = :1> is OK, but :2> is wrong. -chris PS: I am writing test cases for try-catch and the two argument form of eval to augment the current test suite. I'll send it to you as soon as we have ironed out the __error_text__ problems. -- 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 -------------------------------------------------------------