octave-maintainers
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

ISO C++ (partial) replacement for libio stream:scan


From: John W. Eaton
Subject: ISO C++ (partial) replacement for libio stream:scan
Date: Tue, 6 Feb 2001 22:42:41 -0600

On  4-Feb-2001, Mumit Khan <address@hidden> wrote:

| Forgot to include this in my 6-part patchset. 
| 
| First cut at a working sscanf/fscanf functionality in C++ library
| with libstdc++-v2/libio scan/form extension. The correct way to
| fix this problem of course is either (1) write a complete scan and
| form implementation based on libio, or (2) write a stream manipulator
| that translates print-style format to stream style (preferred). Octave
| makes (2) easy by pre-sorting all the format codes in advance.
| 
| Very rudimentary, partial implementation just so I could get some work
| done and run the tests. Now passes all the tests with newer compilers.
| 
| Patch against Octave CVS 2001-02-02.
| 
| Haven't tested anything other than trivial format specifiers, and haven't
| even considered character classes yet.
| 
| Regards,
| Mumit
| 
| Forgot to include this in my 6-part patchset. 
| 
| First cut at a working sscanf/fscanf functionality in C++ library
| with libstdc++-v2/libio scan/form extension. The correct way to
| fix this problem of course is either (1) write a complete scan and
| form implementation based on libio, or (2) write a stream manipulator
| that translates print-style format to stream style (preferred). Octave
| makes (2) easy by pre-sorting all the format codes in advance.
| 
| Very rudimentary, partial implementation just so I could get some work
| done and run the tests. Now passes all the tests with newer compilers.
| 
| Patch against Octave CVS 2001-02-02.
| 
| 2001-02-03  Mumit Khan  <address@hidden>
| 
|       * oct-stream.cc (octave_scan): Implement, and specialize for
|       char*. Delete the old template instantiations.
|       (BEGIN_S_CONVERSION): Use strings instead of ostrstreambuf.
|       (octave_base_stream::do_scanf): Pass correct parameter to
|       do_scan_conv.

I applied these patches.  I also added

  // XXX FIXME XXX -- this needs to be fixed to handle formats which
  // specify a maximum width.

above your new octave_scan function.  Anyone want to take a shot at
implementing it?  I have no idea how to make it work.

And, I used

  tmp = strsave (buf.c_str()); \

instead of

  tmp = new char[buf.length() + 1]; \
  strcpy (tmp, buf.c_str()); \


Thanks,

jwe



reply via email to

[Prev in Thread] Current Thread [Next in Thread]