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

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

[Octave-bug-tracker] [bug #38003] textscan() "endofline" compatibility


From: Ben Abbott
Subject: [Octave-bug-tracker] [bug #38003] textscan() "endofline" compatibility
Date: Sun, 30 Dec 2012 22:13:07 +0000
User-agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10_7_5) AppleWebKit/536.26.17 (KHTML, like Gecko) Version/6.0.2 Safari/536.26.17

URL:
  <http://savannah.gnu.org/bugs/?38003>

                 Summary: textscan() "endofline" compatibility
                 Project: GNU Octave
            Submitted by: bpabbott
            Submitted on: Sun 30 Dec 2012 05:13:05 PM EST
                Category: Interpreter
                Severity: 3 - Normal
                Priority: 5 - Normal
              Item Group: Matlab Compatibility
                  Status: None
             Assigned to: None
         Originator Name: 
        Originator Email: 
             Open/Closed: Open
         Discussion Lock: Any
                 Release: dev
        Operating System: Any

    _______________________________________________________

Details:

While thinking about the textscan()/strread() bugs in the tracker, it occurred
to me that the Matlab variants may rely heavily on regexp.  To check I ran a
test on how Matlab's textscan() handles "endofline" characters.

It appears that Matlab's default value for "endofline" is '\r\n|\n\r|\r|\n'.


a = textscan (sprintf ('A\r\nB\n\rC\rD\nE'), '%s')
a = {5x1 cell}
a{:}
ans = 
    'A'
    'B'
    'C'
    'D'
    'E'


My tip is;


changeset:   15866:c1c6502fe52b
tag:         tip
user:        Rik <address@hidden>
date:        Sat Dec 29 08:15:04 2012 -0800
summary:     oct-rand.cc: Silence compiler warning about possible
uninitialized variable.


And with the tip above, the default branch gives me 


a = textscan (sprintf ('A\r\nB\n\rC\rD\nE'), '%s')
a = 
{
  [1,1] = 
  {
    [1,1] = A
    [2,1] = B
D   [3,1] = C
    [4,1] = E
  }
}


Which implies the Octave implementation does not recognize "\r" as an
"endofline" character.




    _______________________________________________________

Reply to this item at:

  <http://savannah.gnu.org/bugs/?38003>

_______________________________________________
  Message sent via/by Savannah
  http://savannah.gnu.org/




reply via email to

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