MessageTrans problems
Jonathan Coxhead
jonathan at doves.demon.co.uk
Mon Nov 5 19:09:55 GMT 2001
On 5 Nov 2001, at 18:10, Tony van der Hoff wrote:
> On 2 Nov 2001, in message <200111022149.VAA29735 at inputplus.demon.co.uk>,
> Ralph Corderoy <ralph at inputplus.demon.co.uk> wrote:
>
> >
> > Hi Jonathan,
> >
> > > > 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.
> >
> > I didn't appreciate this about OSLib's definitions. It makes it
> > awkward to generate the marshalling code from emulated SWI to riscose C
> > function as the function, if using OSLib's prototype, won't be able to
> > fully implement the SWI, i.e. the pointer to the token terminator in
> > r1.
> >
> > Any clever ideas anyone?
There are lots of cases of veneers mapping to the same SWI in OSLib, where
this gives better typechecking. A good example of this is the veneers for
Wimp_SendMessage, which have different types of arguments, but call the same
SWI (which works out the types itself by looking at various magic values in
structures, and the like). The usual convention is to add a short phrase to the
name of the SWI: wimp_send_message(), wimp_send_message_to_window(), in this
case.
The point is, you could add a veneer to MessageTrans_Lookup, say
meesagetrans_lookup_return_terminator() (and similarly for
MessageTrans_GSLookup), that did what you want, and use that instead. I can't
see any objections to having them in the official release---you'd just have to
send a patch to Tony.
/|
o o o (_|/
/|
(_/
More information about the oslib-user
mailing list