From bug-octave-request at bevo dot che dot wisc dot edu Tue Jan 21 10:19:59 2003 Subject: looping over struct never stops From: "John W. Eaton" To: Etienne Grossmann Cc: bug-octave at bevo dot che dot wisc dot edu Date: Tue, 21 Jan 2003 10:19:23 -0600 On 21-Jan-2003, Etienne Grossmann wrote: | To: bug-octave at bevo dot che dot wisc dot edu | Cc: etienne | Subject: looping over struct never stops | | Bug report for Octave 2.1.43 configured for i686-pc-linux-gnu | | Description: | ----------- | | The "for [value, key] = my_struct" loop seems to be broken. | | Repeat-By: | --------- | | a = struct ("x",2); | for [v,k] = a, printf(" %s -> %f\n",k,v); end | | produces as many lines of | | x -> 2.000000 | x -> 2.000000 | x -> 2.000000 | x -> 2.000000 | x -> 2.000000 | ... | | as one likes. Please try the following patch. Thanks, jwe src/ChangeLog: 2003-01-21 John W. Eaton * pt-loop.cc (tree_complex_for_command::eval): Fix typo. Index: pt-loop.cc =================================================================== RCS file: /usr/local/cvsroot/octave/src/pt-loop.cc,v retrieving revision 1.21 diff -u -r1.21 pt-loop.cc --- pt-loop.cc 6 Dec 2002 21:29:18 -0000 1.21 +++ pt-loop.cc 21 Jan 2003 16:18:06 -0000 at @ -486,7 +486,7 @@ Octave_map tmp_val (rhs.map_value ()); - for (Octave_map::iterator q = tmp_val.begin (); q != tmp_val.end (); p++) + for (Octave_map::iterator q = tmp_val.begin (); q != tmp_val.end (); q++) { octave_value key = tmp_val.key (q); ------------------------------------------------------------- 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 -------------------------------------------------------------