patchGNU Octave - Patches: patch #7817, strread.m: bit width and %[] and...


patch #7817: strread.m: bit width and %[] and %q format conversion specifiers (bug #33875)

Submitted by:  Philip Nienhuis <philipnienhuis>
Submitted on:  Fri 13 Jul 2012 09:32:47 AM UTC  
Votes:  100  
Category: NonePriority: 5 - Normal
Status: Wont DoPrivacy: Public
Assigned to: NoneOpen/Closed: Closed

Add a New Comment(Rich Markup)

You are not logged in

Please log in, so followups can be emailed to you.


(Jump to the original submission Jump to the original submission)

Wed 24 Feb 2016 09:30:48 PM UTC, comment #7:

In patch #8783 a binary textscan is developed that has all missing format specifiers.

Closing as "Won't do"

Philip Nienhuis <philipnienhuis>
Project Member
Tue 03 Nov 2015 02:41:16 PM UTC, comment #6:

The bit width format conversion specifiers worked for me. Thank you.

Sun 01 Nov 2015 06:51:37 PM UTC, comment #5:

Here's an update of strread.m patch for bit width, %[]/%^[] and even %q format specifiers, + a fully patched strread.m.

As there now is a C++ version of textscan in sight (see patch #8783) I doubt whether this will ever (need to be) be applied. But who knows.
I just upload these files for reference.

(file #35358, file #35359)

Philip Nienhuis <philipnienhuis>
Project Member
Tue 09 Sep 2014 09:19:20 PM UTC, comment #4:

Maybe we'd first need to inquire if there's any chance that this patch will ever be applied - I'll cc Rik.

I'm in favor as the bit width fmt conv. specifiers look quite robust and harmless (once validatio is in place), the patch isn't extremely invasive and it doesn't break backward compatibility.

As to the %[] and %q format conv specifiers: I doubt if I would make them public - their usefulness suffers from restrictions that could be quite unclear to most users.

Philip Nienhuis <philipnienhuis>
Project Member
Sun 07 Sep 2014 06:49:59 PM UTC, comment #3:

Would it help to improve the patch with input validation? Or is it better for you when you implement all improvements on your own?

Matthias Hofmann <borim7>
Sat 23 Aug 2014 07:57:33 PM UTC, comment #2:

Thanks for your interest and patch!

Lately I was thinking about wiping the dust of my patches and applying them somehow. I was thinking more of the %[] and %q stuff as I need those a bit more, but once there the bit width ones are fairly easy to apply simultaneously.
I think the reason that the bit width specifiers weren't implemented yet is that the required casts can be applied to strread's (or textscan's / textread's) results afterward.

Anyway I think a bit more input (data) validation is required (think of overflow, e.g. trying to read 70000 with an int8 specifier or a negative number with a uint<x>). Plus, some more tests are needed. I might look into it this fall.

I have some more patches for strread.m lying around (a.o., one for multi-character delimiters); I'll see if I can combine (merge) them somehow.

Philip Nienhuis <philipnienhuis>
Project Member
Fri 22 Aug 2014 08:24:09 PM UTC, comment #1:

I wonder that the bitwidth patch was never applied. The bit width modifiers are working nice and I hope it will applied soon.
To speed the things up I merged the patch into the current head version of strread.m

(file #31935)

Matthias Hofmann <borim7>
Fri 13 Jul 2012 09:32:47 AM UTC, original submission:

(Re-posted from bug tracker where I accidentally put it initially)_

A while ago I've implemented bit width format conversion specifiers (%d8, %u64, etc) to strread.m; as strread.m currently is the work horse for textscan.m, they now also work in textscan.m
AFAICS these changes seem to work fairly reliably. Patch including some tests attached.

I've also implemented %[] (and %[], %[^..], %[^..]) plus %q specifiers in strread.m (so these will work in textscan, too), but these changes don't work so very reliably. That is, they do, as long as whitespace and/or delimiters are not contained in words matching the %q and %[]-like specifiers. In the tests you can see that in columns matching %[] or %q specifiers the same number of whitespace/delimiters must be present on each line, otherwise strread.m quickly loses track.
For my own (simple) purposes it worked OK up till now, but that's no guarantee.

As advised by Rik I won't develop these patches any further (in principle that is as I may need further fixes myself).
I contribute them here just for in case other people want to have a try.
For convenience I've also attached patched strread.m versions in a tarball ( md5sum: 5294a30679a2f6c633f110792da611b7 )

Philip Nienhuis <philipnienhuis>
Project Member


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

Attach File(s):

Attached Files
file #35358:  strread.m added by philipnienhuis (58KiB - text/x-objective-c)
file #35359:  strread_bitwidth_sqbrackets.patch.2 added by philipnienhuis (31KiB - application/octet-stream)
file #31935:  strread_bitwidth_2014.patch added by borim7 (6KiB - application/x-download)
file #26192:  strread_bitwidth.patch added by philipnienhuis (9KiB - application/x-download)
file #26193:  strread_bitwidth_regexp.patch added by philipnienhuis (29KiB - application/x-download)


Depends on the following items: None found

Items that depend on this one: None found


Carbon-Copy List
  • -unavailable- added by ederag (Voted in favor of this item)
  • -unavailable- added by philipnienhuis
  • -unavailable- added by borim7 (Updated the item)
  • -unavailable- added by borim7
  • -unavailable- added by philipnienhuis (Submitted the item)

    Do you think this task is very important?
    If so, you can click here to add your encouragement to it.
    This task has 100 encouragements so far.

    Only logged-in users can vote.


    Please enter the title of George Orwell's famous dystopian book (it's a date):



    Follow 11 latest changes.

    Date Changed By Updated Field Previous Value => Replaced By
    Wed 24 Feb 2016 09:30:48 PM UTCphilipnienhuisStatusNone=>Wont Do
    Sun 01 Nov 2015 06:51:37 PM UTCphilipnienhuisAttached File-=>Added strread.m, #35358
      Attached File-=>Added strread_bitwidth_sqbrackets.patch.2, #35359
    Sat 21 Mar 2015 10:26:23 AM UTCederagCarbon-Copy-=>Added ederag
    Tue 09 Sep 2014 09:19:20 PM UTCphilipnienhuisCarbon-Copy-=>Added rik5
    Fri 22 Aug 2014 08:24:09 PM UTCborim7Attached File-=>Added strread_bitwidth_2014.patch, #31935
    Fri 22 Aug 2014 04:37:51 PM UTCborim7Carbon-Copy-=>Added borim7
    Fri 13 Jul 2012 09:32:47 AM UTCphilipnienhuisAttached File-=>Added strread_bitwidth.patch, #26192
      Attached File-=>Added strread_bitwidth_regexp.patch, #26193
      Attached File-=>Added strread_bitwidth_regexp.tar.gz, #26194

    Back to the top

    Powered by Savane 3.1-cleanup1