[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: An IDL STRTOK??? Was: TextoIDL Broken and Gone?
A couple of historical notes on strtok and textoidl:
1. In the V5.3 beta distibution, there was an intrinsic routine STRSPLIT
to split a string into substrings. But this caused conflict with a
user procedure strsplit.pro in a widely-distributed large IDL package.
So RSI attempted to avoid this conflict by renaming the intrinsic
procedure STRTOK and making STRSPLIT a procedure that simply called
STRTOK (so that the user procedure strsplit.pro could be given
precedence in the !PATH if desired). Unfortunately, this now caused a
conflict with the procedure strtok.pro in the widely distributed
textoidl package.
2. There is a duplicate version of the textoidl package at
http://astro.uni-tuebingen.de/software/idl/textoidl/index.html
but this has the same strtok compatibility problem for V5.3 and later.
As Mirko mentioned, one simply has to rename strtok.pro and the calls to
strtok in Translate_Sub_Super.pro
Changing subjects, one recent change I've discovered going from V5.3 to
V5.4 that I'm not sure has been mentioned yet, is that one can no longer
read past the end of a file with ASSOC. Below is a simple test
program that tries to read 20 bytes from a 10 byte file. In V5.3 the
extra 10 bytes are padded with zeros, while in V5.4 there is an error.
I think I prefer the V5.4 behaviour so this is arguably a bug fix.
Still, I had to fix up some older code in order to get it to work under
V5.4.
--Wayne Landsman landsman@mpb.gsfc.nasa.gov
pro test
openw,lun,'test.dat',/get_lun
writeu,lun,bindgen(10) ;Write 10 bytes
close,lun & openr,lun,'test.dat' ;Close the file & open for
reading
a = assoc(lun,bytarr(20) ) ;Associate with a 20 byte array
print,a(0)
free_lun,lun
return
end
STIS>print,!VERSION
{ sparc sunos unix 5.3 Nov 11 1999}
STIS>test
0 1 2 3 4 5 6 7 8 9 0 0 0 0 0 0 0
0 0 0
IDL> print,!VERSION
{ sparc sunos unix 5.4 Sep 25 2000 32 64}
IDL> test
% End of file encountered. Unit: 113, File: test.dat
% Execution halted at: TEST 8
/stis0/data31/landsman/iraf/test.pro
% $MAIN$
Sent via Deja.com
http://www.deja.com/