Hi folks!
I reported a bug in GPC some months ago:
http://www.gnu-pascal.de/crystal/gpc/en/mail11285.html
Basically, GPC fails to report eof = true after a reset when a file is empty. In the Replies, Waldek Hebisch provided a patch:
http://www.gnu-pascal.de/crystal/gpc/en/mail11309.html
Recently someone in Hong Kong was working with my programs and the bug was still there. I think she has the most recent version of GPC, so the patch apparently has not been implemented.
I had to make a rather horrible kludge to get around this. Basically I have a function, emptyfile, to replace eof. If it counts less than 2 characters in a file, that file is deemed 'empty'. In my cases this will work because the relevant files have more than two characters if they are not empty, but of course it will not work in general!
Does anyone know the status of this patch? Will it be put into GPC? If not, why not?
Thanks!
Tom
Dr. Thomas D. Schneider National Institutes of Health National Cancer Institute Center for Cancer Research Nanobiology Program Molecular Information Theory Group Frederick, Maryland 21702-1201 toms@ncifcrf.gov permanent email: toms@alum.mit.edu (use only if first address fails) http://www.ccrnp.ncifcrf.gov/~toms/
Tom Schneider wrote:
I reported a bug in GPC some months ago:
http://www.gnu-pascal.de/crystal/gpc/en/mail11285.html
Basically, GPC fails to report eof = true after a reset when a file is empty. In the Replies, Waldek Hebisch provided a patch:
http://www.gnu-pascal.de/crystal/gpc/en/mail11309.html
Recently someone in Hong Kong was working with my programs and the bug was still there. I think she has the most recent version of GPC,
Does she? Perhaps she has 20041218?
so the patch apparently has not been implemented.
I had to make a rather horrible kludge to get around this. Basically I have a function, emptyfile, to replace eof. If it counts less than 2 characters in a file, that file is deemed 'empty'. In my cases this will work because the relevant files have more than two characters if they are not empty, but of course it will not work in general!
Does anyone know the status of this patch? Will it be put into GPC? If not, why not?
It has been included:
@item 20050130: in standard Pascal modes, @samp{EOF} is false on an empty file (tom7.pas)
tom7.pas:
{$classic-pascal}
program gpcbug2005jan27({namebook, namelist, } output); (* Dr. Thomas D. Schneider National Cancer Institute Laboratory of Experimental and Computational Biology Molecular Information Theory Group Frederick, Maryland 21702-1201 toms@ncifcrf.gov permanent email: toms@alum.mit.edu (use only if first address fails) http://www.lecb.ncifcrf.gov/~toms/
modified by Maurice Lombardi and Frank Heckenbach *) const version = 1.00; (* of gpcbug2005jan27.p 2005 jan 27 *)
var namebook{, namelist}: text;
begin rewrite(namebook); {close(namebook);}
reset(namebook); if eof(namebook) then writeln(output,'OK') else writeln(output,'NOT eof of namebook');
{ rewrite(namelist); close(namelist);
reset(namelist); if eof(namelist) then writeln(output,'eof of namelist') else writeln(output,'NOT eof of namelist'); } end.
Frank