Path: utzoo!attcan!uunet!comp.vuw.ac.nz!massey.ac.nz!SLovatt From: SLovatt@massey.ac.nz (S.J. Lovatt) Newsgroups: comp.lang.modula2 Subject: JPI TopSpeed FIO.WrBin bug affects only re-directed I/O. Apologies. Summary: JPI FIO.WrBin 'bug' only affects re-directed I/O Keywords: JPI TopSpeed Modula-2 Message-ID: <845@massey.ac.nz> Date: 11 Jul 90 22:39:03 GMT Organization: Massey University, Palmerston North, New Zealand Lines: 143 X-Reader: NETNEWS/PC Version 2.1 I received this by E-mail, but the answer bears on my previous posting, so I'm posting the reply: > From: Tom Almy > > Let's figure out what is going on. I received my copy in June, but the > files are dated April. Several samples: > > r_fio.mod 28287 4-17-90 > r_core.a 84096 4-14-90 > library (.lib) files are 4-26-90 > ts.exe is 4/24/90 > ts .dll files are 4/26/90 > > and there is no "b" on my version number that I could find. > > So are your files earlier, later, or (horrors!) the same? > > Tom Almy > toma@tekgvs.labs.tek.com > Standard Disclaimers Apply I checked my files, and they have the same dates as yours. Much puzzled, I re-ran my tests, and a couple more. When I found the bug, I was writing filter programs, which used re-directed standard input and output. Therefore, all of my tests used re-directed I/O. Recalling your comment about having used FIO.WrBin directly, I ran another two tests - this time using ordinary file I/O. The results are given below (I used a printer re-direction utility to direct Ctrl/PrtSc into a file, and thus captured exactly what I did). BTW, the dump program is flawless - I've been using it for over a year without any problems, and it was written in TS M2 Version 1 Rel 1.15. My conclusions are as follows: 1) There is a bug, and it only shows up when using re-directed I/O. 2) That bug can be fixed by using CLB._write instead of CLB.write. 3) I mucked up my testing by not testing enough cases, and therefore assumed that the error was more general than it is. Sorry if I caused anybody any inconvenience. It is a lesson that I will remember for the future. Maybe I should read comp.software.eng more carefully. I also checked R_CORE.A I found two write routines, one _write, and one __write. The __write routine has a C prototype included as a comment as follows: int _write (int handle, void *buffer, int num) I did not go into R_CORE.A deeply enough to work out the differences between the two, but apparently the effect on WrLn is one of them. In FIO, my comment about CLB procedures often having leading underscores holds true, but it was not as accurate as it ought to have been for the case of CLB.write. In the original module as supplied, CLB.write is called in FlsBuf, WrBin and WrChar. CLB._write is called in Truncate only. Thanks to Tom Almy for helping to clear this up. Regarding the version no. 1.04b. Since the file dates are the same as version 1.04, perhaps the 'b' is for 'British' (as in Commonwealth, of which New Zealand is a part), or perhaps it indicates an export version. The only other TS M2 user in N.Z. (that I know of) also has version 1.04b, and a recent posting from South Africa also mentioned that he had version 1.04b. Summary of test procedure follows: --------------------------------------------------------------------- Results with modified FIO.WrBin (which uses CLB._write): For the program as follows: MODULE TestWrLn; FROM FIO IMPORT StandardOutput,WrLn; BEGIN WrLn (StandardOutput); END TestWrLn. ... the result was: C:\M2\2>testwrln >test.out C:\M2\2>dump test.out 0: 0D 0A -- -- -- -- -- -- -- -- -- -- -- -- -- -- ..-------------- C:\M2\2> ... and for the program as follows: MODULE TestWr2; FROM FIO IMPORT StandardOutput,WrLn,File,Create,Close; VAR outfile : File; BEGIN outfile := Create ('test2.out'); WrLn (outfile); Close (outfile); END TestWr2. ... the result was: C:\M2\2>testwr2 C:\M2\2>dump test2.out 0: 0D 0A -- -- -- -- -- -- -- -- -- -- -- -- -- -- ..-------------- C:\M2\2> ... all the above as expected. Results with original FIO.WrBin (which uses CLB.write): C:\M2\2>testwr2 C:\M2\2>dump test2.out 0: 0D 0A -- -- -- -- -- -- -- -- -- -- -- -- -- -- ..-------------- C:\M2\2>testwrln >test.out C:\M2\2>dump test.out 0: 0D 0D 0A -- -- -- -- -- -- -- -- -- -- -- -- -- ...------------- C:\M2\2> ... so the problem turns up in the test cases which I used but not in others. Again, sorry if I caused anybody any inconvenience. - Simon -- Simon Lovatt | S.J.Lovatt@massey.ac.nz | Dept of Biotechnology | | Massey University, N.Z. | |