octave-bug-tracker
[Top][All Lists]
Advanced

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

[Octave-bug-tracker] [bug #54661] textscan() continues from next line if


From: Dan Sebald
Subject: [Octave-bug-tracker] [bug #54661] textscan() continues from next line if line ends with delimiter
Date: Sat, 15 Sep 2018 15:49:02 -0400 (EDT)
User-agent: Mozilla/5.0 (X11; Ubuntu; Linux x86_64; rv:61.0) Gecko/20100101 Firefox/61.0

Follow-up Comment #3, bug #54661 (project octave):

@Philip: It appears you worked on this a bit in the past, so I'll toss some
observations your way.  Looking through the code, the following caught my
attention:

libinterp/corefcn/oct-stream.cc


    if (multiple_delims_as_one)           // bug #44750?
      skip_delim (is);


But the question mark bug report

https://savannah.gnu.org/bugs/?44750

is closed as fixed.  I don't see the above comment added as part of the bug
report either, so how it got in there, I don't know.  Not that important
(there should be an easy way of searching for this in thg but I can't find
one), but the point is that the bug solved in strread.m

http://hg.savannah.gnu.org/hgweb/octave/rev/f68c3a62e42c

seems to be very similar.  Perhaps it's the same issue here.  But clearly it
doesn't have to do with that multiple_delims_as_one parameter because that
feature seems to work correctly.

I've printed out the c1 character coming back from skip_whitespace() for
O.P.'s example:


octave:2> values = textscan(f_in, '%f %f %f %f', 'Delimiter',',');
skip_whitespace: 44  [1] (my manual addition)
skip_whitespace: 44  [2]
skip_whitespace: 44  [3]
skip_whitespace: 10  [4]
skip_whitespace: 44  [5]
skip_whitespace: 44  [6]
skip_whitespace: 44  [7]
skip_whitespace: 10  [8]
skip_whitespace: 44  [9]
skip_whitespace: 44  [10]
skip_whitespace: 44  [11]
                            (Why isn't a 10 or some other
                             character appearing here?)
skip_whitespace: 44  [12]
skip_whitespace: 44  [13]
skip_whitespace: 44  [14]
skip_whitespace: 10  [15]
skip_whitespace: -1


It looks like this code isn't being run for that empty field at end of line


  // Skip delimiters -- multiple if MultipleDelimsAsOne specified.
  int
  textscan::skip_delim (delimited_stream& is)
  {
    int c1 = skip_whitespace (is, true);  // 'true': stop once EOL is read
std::cerr << "skip_whitespace: " << c1 << "\n";


    _______________________________________________________

Reply to this item at:

  <https://savannah.gnu.org/bugs/?54661>

_______________________________________________
  Message sent via Savannah
  https://savannah.gnu.org/




reply via email to

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