Mercurial > octave
view CITATION @ 31500:6bd338605fd3
Overhaul scanf functionality for correctness and Matlab compatibility (bug #63383, bug #62723)
Return correct third output (error message) and fourth output (position) in
many more cases. Functionality is still not correct in all situations and
new corner cases were discovered while coding. Add BIST tests for correct
behavior, some of which fail still.
* oct-stream.cc (BEGIN_C_CONVERSION, BEGIN_S_CONVERSION): After reading
characters, clear the failbit if the last character that was attempted to be
read was EOF. This is not a true failure.
* oct-stream.cc (BEGIN_CHAR_CLASS_CONVERSION): Move initialization of "width"
variable to be with its definition as int. When reading characters and the
read character is not in the character class, call putback(c) to place
the character back into the input stream (cause of misplaced position output).
After reading characters, clear the failbit if the last character that was
attempted to be read was EOF. This is not a true failure.
* oct-stream.cc (FINISH_CHARACTER_CONVERSION): Check for "width > 0", i.e.,
there were characters read, before updating outputs like conversion_count and
position.
* oct-stream.cc (base_stream::do_scanf): Remove test for "! eof" and just
check for failbit. If failbit is set then issue a warning about pattern
failing to match.
* lo-utils.cc (read_fp_value): If reading has failed (failbit set) then clear
eofbit which may have been set during the process. The calling routine will
use seek() to restore file position to point before attempted read so EOF
should no longer be set on stream.
* io.tst: Add many more BIST cases.
author | Rik <rik@octave.org> |
---|---|
date | Mon, 21 Nov 2022 13:11:26 -0800 |
parents | 2c037ce00450 |
children | 74aa32d5fd08 |
line wrap: on
line source
To cite GNU Octave in publications use: John W. Eaton, David Bateman, Søren Hauberg, Rik Wehbring (2022). GNU Octave version 7.3.0 manual: a high-level interactive language for numerical computations. URL https://www.gnu.org/software/octave/doc/v7.3.0/ A BibTeX entry for LaTeX users is: @manual{, title = {{GNU Octave} version 7.3.0 manual: a high-level interactive language for numerical computations}, author = {John W. Eaton and David Bateman and S{\o}ren Hauberg and Rik Wehbring}, year = {2022}, url = {https://www.gnu.org/software/octave/doc/v7.3.0/}, } We have invested a lot of time and effort in creating GNU Octave, please cite it when using it. See also 'citation pkgname' for citing Octave packages.