From bug-request at octave dot org Wed Dec 22 13:36:57 2004 Subject: RE: Possible Error in -ascii save/restore From: "John W. Eaton" To: "John W. Eaton" Cc: , Date: Wed, 22 Dec 2004 14:38:13 -0500 On 20-Dec-2004, I wrote: | I think Octave does this part already. The problem is the use of | ftell/fseek to reposition the file pointer in a text file. If we | can't assume that that will work, then we have to come up with a | different solution for reading these kinds of data files in Octave. I | think this problem only happens in a few places, so perhaps it will | not be too hard to fix. Please try the following patch. It seems to work correctly for me on a Linux system where the files are all "binary". I have not tested it on a Cygwin system on a textmode mounted filesystem, so it would be useful to know if this really solves the problem for you. Thanks, jwe Index: ChangeLog =================================================================== RCS file: /usr/local/cvsroot/octave/src/ChangeLog,v retrieving revision 1.1106.2.5 diff -u -r1.1106.2.5 ChangeLog --- ChangeLog 3 Dec 2004 18:14:07 -0000 1.1106.2.5 +++ ChangeLog 20 Dec 2004 19:22:08 -0000 at @ -1,3 +1,8 @@ +2004-12-20 John W. Eaton + + * pt-idx.cc (tree_index_expression::has_magic_end): Return true if + any argument list element has a magic end token. + 2004-12-03 John W. Eaton * version.h (OCTAVE_VERSION): Now 2.1.64. Index: pt-idx.cc =================================================================== RCS file: /usr/local/cvsroot/octave/src/pt-idx.cc,v retrieving revision 1.25 diff -u -r1.25 pt-idx.cc --- pt-idx.cc 16 Dec 2003 05:11:26 -0000 1.25 +++ pt-idx.cc 20 Dec 2004 19:22:09 -0000 at @ -110,6 +110,22 @@ } } +bool +tree_index_expression::has_magic_end (void) const +{ + for (std::list::const_iterator p = args.begin (); + p != args.end (); + p++) + { + tree_argument_list *elt = *p; + + if (elt && elt->has_magic_end ()) + return true; + } + + return false; +} + // This is useful for printing the name of the variable in an indexed // assignment. Index: pt-idx.h =================================================================== RCS file: /usr/local/cvsroot/octave/src/pt-idx.h,v retrieving revision 1.16 diff -u -r1.16 pt-idx.h --- pt-idx.h 3 Jan 2003 15:27:06 -0000 1.16 +++ pt-idx.h 20 Dec 2004 19:22:09 -0000 at @ -60,7 +60,7 @@ ~tree_index_expression (void); - bool has_magic_end (void) const { return false; } + bool has_magic_end (void) const; void append (tree_argument_list *lst = 0, char t = '('); ------------------------------------------------------------- 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 -------------------------------------------------------------