Mercurial > hg > octave-nkf
changeset 4926:e80587ad9503
[project @ 2004-08-02 23:48:40 by jwe]
author | jwe |
---|---|
date | Mon, 02 Aug 2004 23:48:40 +0000 |
parents | 90f51232d751 |
children | b7732e23965b |
files | src/ChangeLog src/oct-stream.cc |
diffstat | 2 files changed, 32 insertions(+), 2 deletions(-) [+] |
line wrap: on
line diff
--- a/src/ChangeLog +++ b/src/ChangeLog @@ -1,5 +1,8 @@ 2004-08-02 John W. Eaton <jwe@octave.org> + * oct-stream.cc (octave_scan): For %i format, recognize numbers + with leading 0x or 0X as hex and leading 0 as octal. + * OPERATORS/op-fcn-handle.cc: Delete. * Makefile.in (OP_XSRC): Delete it from the list. * pr-output.cc (octave_print_internal (std::ostream&, const
--- a/src/oct-stream.cc +++ b/src/oct-stream.cc @@ -1094,11 +1094,38 @@ switch (fmt.type) { case 'o': - is >> std::oct >> ref; + is >> std::oct >> ref >> std::dec; break; case 'x': - is >> std::hex >> ref; + is >> std::hex >> ref >> std::dec; + break; + + case 'i': + { + int c1 = is.get (); + + if (! is.eof ()) + { + if (c1 == '0') + { + int c2 = is.peek (); + + is.putback (c1); + + if (c2 == 'x' || c2 == 'X') + is >> std::hex >> ref >> std::dec; + else + is >> std::oct >> ref >> std::dec; + } + else + { + is.putback (c1); + + is >> ref; + } + } + } break; default: