I hope I've ended up at the right place, this is my first time to sourceforge or similar places.
I found an inconsistency in the output of file_lines.pro, as compared to the output of file_lines in IDL. file_lines counts the number of lines in a file. The inconsistency occurs if the file doesn't have at the end of the last line. IDL would count that last line, GDL would not. This is because the current implementation relies on wc, which doesn't strictly speaking count lines, but newline chars.
I propose a work-around that consists in first running 'paste' on the file before piping it to wc and further. This may be inefficient on long files (haven't checked), but seems to work.
Please find attached a ZIP containing the old and new .pros and two self-explaining sample files with which the bug can be reproduced. IDL's file_lines counts two lines each, as does the new file_lines.pro; the old version counts one or two lines, respectively.
I'm using Scientific Linux 5.1, i686 arch, GDL 0.9.0pre6 as provided in the EPEL5 repo (the file_lines.pro from the current GDL version is identical), and IDL 6.4.
Hope that helps.
Keep up the good work!
Log in to post a comment.