From bug-octave-request at bevo dot che dot wisc dot edu Wed Apr 18 03:07:13 2001 Subject: Re: Unidentified subject! From: Christoph Spiel To: bug-octave at bevo dot che dot wisc dot edu Date: Wed, 18 Apr 2001 09:18:23 +0200 On Tue, Apr 17, 2001 at 10:03:29PM -0500, John W. Eaton wrote: > On 17-Apr-2001, Christoph Spiel wrote: > > | To: bug-octave at bevo dot che dot wisc dot edu > | Cc: cspiel > | Subject: __error_text__ keeps value of first error > | > | Description: > | ----------- > | > | __error_text__ only stores the error message of the first error ever > | encountered. This behavior is independed whether > | 'try-catch-end_try_catch' or 'eval' is used, neither does it depend on > | whether the error has been triggered implicitely, e.g., 'clear a; a' > | or explicitely 'error("snafu")'. > > Please try the following patch. Applied the patch -- works perfectly! I have made the code a bit clearer by removing the local variable 'retval' in define_builtin_const() and define(). No change in functionality. See following cdiff. The only one -- as far as I can see -- to spoil our party is a user defining '__error_text__', which introduces the symbol as a local variable shadowing the "built-in constant" of the same name. But the problem of shadowing exists with all constants, not only with '__error_text__'. *** symtab.cc.orig Wed Apr 18 08:42:12 2001 --- symtab.cc Wed Apr 18 08:58:00 2001 *************** *** 235,267 **** bool symbol_record::define_builtin_const (const octave_value& v) { ! bool retval = false; ! ! if (! read_only_error ("redefine")) { ! replace_all_defs (new symbol_def (v, symbol_record::BUILTIN_CONSTANT)); ! retval = true; } - - return retval; } bool symbol_record::define (octave_function *f, unsigned int sym_type) { ! bool retval = false; ! ! if (! read_only_error ("redefine")) { octave_value tmp (f); replace_all_defs (new symbol_def (tmp, sym_type)); ! retval = true; } - - return retval; } void --- 235,263 ---- bool symbol_record::define_builtin_const (const octave_value& v) { ! if (read_only_error ("redefine")) ! return false; ! else { ! definition->define (v, symbol_record::BUILTIN_CONSTANT); ! return true; } } bool symbol_record::define (octave_function *f, unsigned int sym_type) { ! if (read_only_error ("redefine")) ! return false; ! else { octave_value tmp (f); replace_all_defs (new symbol_def (tmp, sym_type)); ! return true; } } void Thanks a lot! -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 -------------------------------------------------------------