[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Octave-patch-tracker] [patch #8783] C++ implementation of textscan
From: |
Philip Nienhuis |
Subject: |
[Octave-patch-tracker] [patch #8783] C++ implementation of textscan |
Date: |
Sun, 15 Nov 2015 19:55:11 +0000 |
User-agent: |
Mozilla/5.0 (X11; Linux i686 on x86_64; rv:41.0) Gecko/20100101 Firefox/41.0 SeaMonkey/2.38 |
Follow-up Comment #6, patch #8783 (project octave):
Thanks for the new patch.
I was able to build Octave-dev with the patch and also cross-build it with
mxe-octave, but it needed a bit of attention:
1. To make a dist archive ("make all dist") amenable for cross-building with
mxe-octave, the file textscan.h must be included in the dist archive; all I
know is that it doesn't happen automatically and it must be referenced
somewhere. I just added it in libinterp/module.mk under
LIBINTERP_BUILT_DISTFILES but that may well be the wrong place (although it
worked).
2. textscan.cc invokes pow10() (from glibc I guess) but several other target
hosts do not implement pow10, notably mingw. I tried to include it using
gnulib but AFAIU that only supplies pow and powf. (I'm unfamiliar with gnulib,
I just tried along the ways shown by other gnulib additions in the core Octave
repo log.)
For the moment I used a kludge: simple replace pow10 by "10^"
3. I'd rather not drop textscan.m yet from the dev version until textscan()
works sufficiently reliably. My suggestion is to provisionally either:
- rename textscan() to xtextscan, or
- rename textscan.m to otextscan.m (and replace all occurrences in that
file).
Right, with that out of the way some tests.
- textscan() passes all 62 tests on Linux. On Mingw it cannot find the tests,
I need to do some more work there :-)
The examples from the TMW site
(http://nl.mathworks.com/help/matlab/ref/textscan.html) do not go that well.
The first two work fine, but all examples starting with reading "scan1.dat"
give different results than Matlab.
On Linux:
>> fid = fopen ("scan1.dat")
fid = 19
>> C = textscan(fid, '%s %s %f32 %d8 %u %f %f %s %f')
C =
{
[1,1] =
{
[1,1] = 09/12/2005
[2,1] = 10/12/2005
[3,1] = No
[4,1] = Level3
}
[1,2] =
{
[1,1] = Level1
[2,1] = Level2
[3,1] = 2.2-.5i
[4,1] = 34.90
}
[1,3] =
12.340
23.540
11.000
12.000
[1,4] =
45
60
0
127
[1,5] =
0
0
0
10
[1,6] =
Inf + 0i
0 - 1i
NaN + 0i
100 + 0i
[1,7] =
NaN
NaN
NaN
NaN
[1,8] =
{
[1,1] = Yes
[2,1] = nf
[3,1] = /12/2005
[4,1] = No
}
[1,9] =
5.10000 + 3.00000i
0.00100 + 0.00000i
NaN + 0.00000i
3.10000 + 0.10000i
}
>>
...and on Mingw (Windows) I got different results, yet again different with
CRLF EOLs rather than with LF EOLs.
Supposedly textscan() gets out of sync somewhere. Based on my experience with
strread.m/textscan.m I expect this to be a simple issue, as usual ;-)
It would be nice if textscan() can pass all examples on that Mathworks site.
In spite of all the above comments, I am very positive about this C++ textscan
version!
_______________________________________________________
Reply to this item at:
<http://savannah.gnu.org/patch/?8783>
_______________________________________________
Message sent via/by Savannah
http://savannah.gnu.org/
- [Octave-patch-tracker] [patch #8783] C++ implementation of textscan, Philip Nienhuis, 2015/11/01
- [Octave-patch-tracker] [patch #8783] C++ implementation of textscan, Philip Nienhuis, 2015/11/01
- [Octave-patch-tracker] [patch #8783] C++ implementation of textscan, Philip Nienhuis, 2015/11/03
- [Octave-patch-tracker] [patch #8783] C++ implementation of textscan, Lachlan Andrew, 2015/11/13
- [Octave-patch-tracker] [patch #8783] C++ implementation of textscan, Philip Nienhuis, 2015/11/14
- [Octave-patch-tracker] [patch #8783] C++ implementation of textscan,
Philip Nienhuis <=
- [Octave-patch-tracker] [patch #8783] C++ implementation of textscan, Lachlan Andrew, 2015/11/20
- [Octave-patch-tracker] [patch #8783] C++ implementation of textscan, Philip Nienhuis, 2015/11/21
- [Octave-patch-tracker] [patch #8783] C++ implementation of textscan, Lachlan Andrew, 2015/11/25
- [Octave-patch-tracker] [patch #8783] C++ implementation of textscan, Philip Nienhuis, 2015/11/27
- [Octave-patch-tracker] [patch #8783] C++ implementation of textscan, Philip Nienhuis, 2015/11/29
- [Octave-patch-tracker] [patch #8783] C++ implementation of textscan, Philip Nienhuis, 2015/11/29