From help-octave-request at bevo dot che dot wisc dot edu Wed Feb 12 23:52:25 2003 Subject: Re: Bizarre Error From: "John W. Eaton" To: pand9613 at mail dot usyd dot edu dot au Cc: Miquel dot Cabanas at uab dot es, help-octave@bevo.che.wisc.edu Date: Wed, 12 Feb 2003 23:51:58 -0600 On 13-Feb-2003, pand9613 at mail dot usyd dot edu dot au wrote: | Since you used the variable "a" in your testfile.dat and then run | the code, a is reassigned to [1,2;3,4] and hence does not initiate a | second running of the while loop. (since the value of "a" is the | condition). Try a different variable name and let me know the | results. I see. Please try the following patch. Thanks, jwe src/ChangeLog 2003-02-12 John W. Eaton * error.cc (reset_error_handler): New function. * toplev.cc (main_loop): Use it here. * lex.l (reset_parser): Don't set error_state and warning_state here. * parse.y (eval_string): Reset parser before calling yyparse. Index: src/error.cc =================================================================== RCS file: /usr/local/cvsroot/octave/src/error.cc,v retrieving revision 1.89 diff -u -r1.89 error.cc --- src/error.cc 20 Dec 2002 22:43:54 -0000 1.89 +++ src/error.cc 13 Feb 2003 05:51:14 -0000 at @ -103,6 +103,15 @@ // The message buffer. static OSSTREAM *error_message_buffer = 0; +void +reset_error_handler (void) +{ + error_state = 0; + warning_state = 0; + buffer_error_messages = false; + discard_error_messages = false; +} + // Warning messages are never buffered. static void Index: src/error.h =================================================================== RCS file: /usr/local/cvsroot/octave/src/error.h,v retrieving revision 1.30 diff -u -r1.30 error.h --- src/error.h 17 Aug 2002 19:38:33 -0000 1.30 +++ src/error.h 13 Feb 2003 05:51:14 -0000 at @ -29,6 +29,8 @@ panic ("impossible state reached in file `%s' at line %d", \ __FILE__, __LINE__) +extern void reset_error_handler (void); + extern void message (const char *name, const char *fmt, ...); extern void usage (const char *fmt, ...); extern void warning (const char *fmt, ...); Index: src/lex.l =================================================================== RCS file: /usr/local/cvsroot/octave/src/lex.l,v retrieving revision 1.199 diff -u -r1.199 lex.l --- src/lex.l 3 Jan 2003 05:30:34 -0000 1.199 +++ src/lex.l 13 Feb 2003 05:51:15 -0000 at @ -842,8 +842,7 @@ { // Start off on the right foot. BEGIN 0; - error_state = 0; - warning_state = 0; + parser_end_of_input = false; end_tokens_expected = 0; Index: src/parse.y =================================================================== RCS file: /usr/local/cvsroot/octave/src/parse.y,v retrieving revision 1.202 diff -u -r1.202 parse.y --- src/parse.y 11 Jan 2003 20:22:09 -0000 1.202 +++ src/parse.y 13 Feb 2003 05:51:16 -0000 at @ -3595,6 +3595,8 @@ do { + reset_parser (); + parse_status = yyparse (); tree_statement_list *command = global_command; Index: src/toplev.cc =================================================================== RCS file: /usr/local/cvsroot/octave/src/toplev.cc,v retrieving revision 1.137 diff -u -r1.137 toplev.cc --- src/toplev.cc 31 Dec 2002 19:43:07 -0000 1.137 +++ src/toplev.cc 13 Feb 2003 05:51:16 -0000 at @ -142,6 +142,8 @@ { curr_sym_tab = top_level_sym_tab; + reset_error_handler (); + reset_parser (); retval = yyparse (); ------------------------------------------------------------- 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 -------------------------------------------------------------