gm2
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [Gm2] gm2 iso library bug?


From: Gaius Mulley
Subject: Re: [Gm2] gm2 iso library bug?
Date: Sat, 19 Nov 2011 16:13:58 +0000
User-agent: Gnus/5.13 (Gnus v5.13) Emacs/23.2 (gnu/linux)

Gaius Mulley <address@hidden> writes:

> Steve Giess <address@hidden> writes:
>
>> Dear Gaius,
>>
>> I encountered what I think is a bug when using the procedure Open from the 
>> iso
>> library StreamFile. I found that Open worked correctly when the named input
>> file existed. However when the file did not exist then an Abort trap was 
>> raised
>> instead what I was expecting, namely:  that the procedure would return 'a 
>> file
>> not found' result. 
>>
>> Here are the relevant programme, gm2 commands and screen output fragments:
>>
>>
>> FROM StreamFile IMPORT ChanId, Open, read, Close, OpenResults;
>>
>>  PROCEDURE Getstardata;
>>
>>      VAR
>>
>>       infile: ChanId;
>>       res : OpenResults;
>>       BEGIN
>>        Open(infile, "stardat.dat", read, res);
>>
>>          IF res <> opened THEN WriteString ("Error opening my file");
>>
>>          END;
>>          ......
>>
>>       gm2 -flibs=iso,pim -g -c nbody1s-iso.mod
>>       gm2 -flibs=iso,pim -g -L/usr/X11R6/lib nbody1s-iso.mod -lX11
>>
>>
>> fred-freds-power-mac-g4-agp-graphics:~/my_modula/nbody fred$ ./a.out
>> Error opening my fileEXCEPTIONS.mod:57:3:IOChan: ChanId specified is invalid 
>> in
>> RAISE
>> Abort trap
>> fred-freds-power-mac-g4-agp-graphics:~/my_modula/nbody fred$
>>n
>>
>>
>> This result was found using my G4 ppc 'Tiger' implementation. I also tried it
>> on my Fedora i686, 32 bit implementation and got the same error message.
>>
>>
>> Your thoughts please?
>
> Hi Steve,
>
> thanks for the report - yes at first glance it looks like a bug - I'll
> investigate..
>
> thanks,
> Gaius

Hi Steve,

this appears to work on my machine, here is my full code:


$ gm2 -flibs=iso,pim badopen.mod
$ ./a.out 
Error opening my file
$ 


MODULE badopen ;

FROM StreamFile IMPORT ChanId, Open, read, Close, OpenResults;
FROM STextIO IMPORT WriteString, WriteLn ;

PROCEDURE Getstardata;
VAR
   infile: ChanId;
   res : OpenResults;
BEGIN
   Open(infile, "stardat.dat", read, res);
   
   IF res <> opened
   THEN WriteString ("Error opening my file"); WriteLn
   END;
END Getstardata ;

BEGIN
   Getstardata
END badopen.

regards,
Gaius



reply via email to

[Prev in Thread] Current Thread [Next in Thread]