[Top][All Lists]

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

RE: [Gm2] two versions of DeviceTablePtrValue

From: Breeden, Thomas (tmb)
Subject: RE: [Gm2] two versions of DeviceTablePtrValue
Date: Sat, 5 Jun 2010 10:04:35 -0400

Yes, the "CAST(IOLink.DeviceTablePtr, cid)" does not look so good.

Using "IOLink.DeviceTablePtrValue (cid, MyDid)" to get the pointer should not be
a problem in your custom stream implementation, since your module is the
one that does the "IOLink.AllocateDeviceId (MyDid)" on initialization, and knows
what the value of MyDid is.

However, I don't see how one could implement IOChan procedures without
using the CAST(), since something like IOChan's 
 PROCEDURE RawWrite(cid:ChanId; from:ADDRESS; locsToWrite:CARDINAL);
does not have the DeviceId associated with the passed ChanId.

If seems like it must assume that the ChanId is the DeviceTablePtr in order to 
find the
correct device callback routine:
    did := CAST(IOLink.DeviceTablePtr, cid);
    did^.doRawWrite(did, from, locsToWrite);

I suspect that Rick Sutcliffe would be the best person to explain the 



> From: gm2-bounces On Behalf Of Martin Kalbfuß address@hidden
> Sent: Saturday, June 05, 2010 7:30 AM
> To: GNU Modula-2
> Subject: Re: [Gm2] two versions of DeviceTablePtrValue
> I still wonder how to implement your own channel the right way. There's
> no ISO conform way. to obtain the did out of the cid, because
> DeviceTablePtrValue needs the did as parameter.
> To implement an open/close pair for your custom stream like
> OpenMyChannel(VAR cid : IOChan.ChanId);
> CloseMyCannel(VAR cid : IOChan.ChanId);
> you have to store the did externally in an array or something similar.
> Do you think that's the right way to do it?

> From: gm2-bounces On Behalf Of Martin Kalbfuß address@hidden
> Sent: Friday, June 04, 2010 6:32 PM
> To: GNU Modula-2
> Subject: RE: [Gm2] iso streams
> Many thanks,
> I wonder, that there's no default implementation of
> such a stream.
> I had a look at your code. I've seen, that you did a cast
 > p := SYSTEM.CAST(IOLink.DeviceTablePtr, cid);
> Is this standard conform? There is a function to get the table.

reply via email to

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