bugGNU Octave - Bugs: bug #33875, textscan: missing format...

 
 

bug #33875: textscan: missing format conversion specifiers

Submitter:  Philip Nienhuis <philipnienhuis>
Submitted:  Thu 28 Jul 2011 06:17:08 AM UTC
   
 
Category:  Interpreter Severity:  2 - Minor
Priority:  5 - Normal Item Group:  Matlab Compatibility
Status:  Fixed Assigned to:  None
Originator Name:  Philip Nienhuis Open/Closed:  * Closed
Release:  * dev Operating System:  * Any
Fixed Release:  None Planned Release:  None
* Mandatory Fields

Add a New Comment Rich Markup
   

Sat 19 Mar 2016 10:29:50 PM UTC, comment #4: 

As of https://savannah.gnu.org/patch/index.php?8783 we now have a binary textscan featuring all those missing format specifiers, and more.

Closingreport

Philip Nienhuis <philipnienhuis>
Group Member
Mon 09 Jul 2012 08:26:11 PM UTC, comment #3: 
Philip Nienhuis <philipnienhuis>
Group Member
Mon 25 Jun 2012 08:44:50 PM UTC, comment #2: 

Error msg for this and other ML-compatible but unsupported specifiers in this changeset:
  http://hg.savannah.gnu.org/hgweb/octave/rev/d5aee269b770
(which refers to strread.m, as that does the hard work for textscan) - see also bug #36464.

I've got %[]-like and %q format specifiers working but I'll probably post the relevant cset-to-be-made to the patch tracker. I agree with Rik's advice that strread.m's current setup is too fragile for a reliable implementation.

Bit width (%d8, %u64, ...) specifiers also work here but a separate patch for those is in the making; it may also end up on the patch tracker only.

Status -> postponed, Release -> dev

Philip Nienhuis <philipnienhuis>
Group Member
Mon 28 May 2012 09:01:14 PM UTC, comment #1: 

Patch attached for
- %[..], %*[..], %[^..] and %*[^..] specifiers;
- %u8 %u16 %u32 %u64 %d8 %d16 %d32 %d64 %f32 %f64 specifiers.

I'll have a look at %q %*q support later in June.

See also bug #36464
Not-yet-pushed fixes for bugs #36356, #36392, #36398 are included.

(file #25948)

Philip Nienhuis <philipnienhuis>
Group Member
Thu 28 Jul 2011 06:17:08 AM UTC, original submission:  

(known issue, entered in bug tracker so we don't forget after bugs #31380, #33680, #33536, #32720, #31778 and maybe a few others have been fixed lately)

%d8 %d16 %d32 %d64
%f32 %f64
%u8 %u16 %u32 %u64   (unsigned integers)

ML reads integers by default as 32bit, floats as 64bit. Provisionally Octave reads all these values as doubles.
Workaround:
Type casting -if needed- can be done on textscan's output.
Precision digits trailing the format specifier (e.g., "32", "64") have to be removed from the input format string as Octave will treat them as literals.

%n
These are read by Octave as if %f was specified (doubles)

%q        (read string between double quotes)
%c        (read single character including delimiters)
%[...]    (patter matching)
%[^...]           ''
There is no workaround for these.
To some extent %c can be replaced by %1s
In simple cases %q might be replaced by clever use of " literals.

Some background:
Octave processes text files by (in principle) reading them completely and then processing the read text string by parsing it into data columns according to the layout of the format string. Reading then proceeds by transforming the columns into the desired format (class).
Any format conversion specifier for which it isn't known in advance where the actual data field limits (~delimiters) appear on a line (which may be different for each line in the file) will break Octave's column parsing scheme.
This applies to %q, %c and especially  %[..], %[^..]

Philip Nienhuis <philipnienhuis>
Group Member

 

(Note: upload size limit is set to 16384 kB, after insertion of the required escape characters.)

Attach Files:
   
   
Comment:
   

Attached Files
file #25948:  textscan_strread_33875.patch added by philipnienhuis (35KiB - application/x-download)

 

Depends on the following items: None found

Items that depend on this one: None found

 

Carbon-Copy List
  • -email is unavailable- added by philipnienhuis (Submitted the item)
  •  

    There are 0 votes so far. Votes easily highlight which items people would like to see resolved in priority, independently of the priority of the item set by tracker managers.

    Only group members can vote.

     

    Follow 7 latest changes.

    Date Changed by Updated Field Previous Value => Replaced by
    2016-03-19 philipnienhuis StatusPostponed Fixed
        Open/ClosedOpen Closed
    2012-07-09 philipnienhuis Severity3 - Normal 2 - Minor
    2012-06-25 philipnienhuis StatusPatch Submitted Postponed
        Release3.4.2 dev
    2012-05-28 philipnienhuis Attached File- Added textscan_strread_33875.patch, #25948
        StatusNone Patch Submitted

    Back to the top

    Powered by Savane 3.13-758e.
    Corresponding source code