BASICTrans_Error.

Tony van der Hoff tony at mk-net.demon.co.uk
Wed Nov 6 13:52:51 GMT 2002


On 4 Nov 2002, in message <200211042217.gA4MHIj27507 at blake.inputplus.co.uk>,
Ralph Corderoy <ralph at inputplus.co.uk> wrote:

> 
> Hi,
> 
> > I might be way off here, as I've currently no documentation to work from,
> > just experimentation, but it seems that OSLib's definition of
> > BASICTrans_Error thinks R1 is a reference to an OS_Error.
> > 
> >     SWI BASICTrans_Error = (NUMBER 0x42C81 "Copy translated error string
> > to
> >           buffer",
> >           ENTRY (R0 = .Int: error_no,
> >           R1 = .Ref OS_Error: error_buffer),
> >           EXIT (R0?, R1?, R2?, R3?));
> > 
> > BASICTrans seems to actually place a \0-terminated string at R1.  Can
> > someone confirm OSLib's definition seems wrong?
> 
> I've now read page 4-339 and it says the SWI puts a \0-terminated string at
> R1 so OSLib's definition is wrong.  My defmod's poor.  Is this the right
> definition?
> 
>     SWI BASICTrans_Error = (NUMBER 0x42C81 "Copy translated error string to
>           buffer",
>           ENTRY (R0 = .Int: error_no,
>           R1 = .Ref .String: error_buffer),
>           EXIT (R0?, R1?, R2?, R3?));
> 

It looks like you're right. I'll amend it soonest. Thanks.


> > As an aside, is it documented what BASICTrans does if R0 < 0 or R0 >
> > largest valid error number (112 for RO 3.11)?
> 
> It doesn't seem to be, and trying it doesn't result in the V-flag being
> set, just junk at R1?
> 
It's documented (4-339) that an error is generated ... if BasicTrans does not
perform the translation. I would expect that to mean that if R0 is out of
range, it would generate an error. From your experiments, evidently not...

-- 
Tony van der Hoff         | MailTo:tony at mk-net.demon.co.uk
                          | MailTo:avanderhoff at iee.org
Buckinghamshire, England  | http:www.mk-net.demon.co.uk



More information about the oslib-user mailing list