MessageTrans problems

Jonathan Coxhead jonathan at doves.demon.co.uk
Mon Oct 29 23:39:31 GMT 2001


> I think there are a couple of problems with the MessageTrans veneers in
> OSLib.
>
> PRM 3-745
> MessageTrans_Lookup returns a pointer to the token terminator in r1
> messagetrans_lookup() doesn't return this.

   OSLib doesn't always return everything that the SWI does. Sometimes, a SWI 
returns the same information in different ways, or sometimes it returns 
redundant information to make it easier to use in different ways in assembler. 
This is one of those: if you have called

      result = messagetrans_lookup (cb, token, buffer, size,
          arg0, arg1, arg2, arg3, &used);

you can get the pointer to the token terminator as

      token + strlen (token)

(or maybe as token + strcspn (",);")) so there's no point returning it.

> PRM 3-755
> Messagetrans_GSLookup returns a pointer to the result string in r2
> messagetrans_gs_lookup() doesn't return this.

   That one certainly looks like a bug ... I wonder why the exit condition for 
GSLookup is different from the one for Lookup?

> PRM 3-751
> MessageTrans_EnumerateTokens preserves r2 as a string buffer pointer
> unless there is a problem, in which case r2 is returned as zero.
> messagetrans_enumerate_tokens uses an osbool* for this value; is this in
> line with OSLib's general rules?

   Absolutly---and C's, as well. OSLib uses "osbool" whenever there is a 0/non-
0 distinction, as there is here, and you can test it by writing 

      if (more) ...

just as you would with, say, islower() (in <ctype.h>).

> Thanks for all the work on OSLib :-)

   Thanks for the feedback!

        /|
 o o o (_|/
        /|
       (_/



More information about the oslib-user mailing list