receiverevent.icl 1.2 KB
Newer Older
Peter Achten's avatar
Peter Achten committed
1
2
3
4
5
6
7
implementation module receiverevent


//	Clean Object I/O library, version 1.2


import	StdBool
8
import	deviceevents, iostate, /*MW11*/ clCrossCall_12 
Peter Achten's avatar
Peter Achten committed
9
10
11
12
13
14
15
from	StdPSt	import accPIO


/*	receiverEvent filters the appropriate events for the receiver device.
	These are only the message events (as long as receivers do not contain timers).
	receiverEvent assumes that it is not applied to an empty IOSt.
*/
16
receiverEvent :: !SchedulerEvent !(PSt .l) -> (!Bool,!Maybe DeviceEvent,!SchedulerEvent,!PSt .l)
Peter Achten's avatar
Peter Achten committed
17
18
19
20
21
22
23
24
25
26
receiverEvent schedulerEvent=:(ScheduleMsgEvent msgEvent) pState
	# (ioid,pState)	= accPIO IOStGetIOId pState
	  recloc		= case msgEvent of
		  				(QASyncMessage {qasmRecLoc}) -> qasmRecLoc
		  				(ASyncMessage  { asmRecLoc}) -> asmRecLoc
		  				(SyncMessage   {  smRecLoc}) -> smRecLoc
	| ioid==recloc.rlIOId && ReceiverDevice==recloc.rlDevice
		= (True, Just (ReceiverEvent msgEvent),schedulerEvent,pState)
	| otherwise
		= (False,Nothing,schedulerEvent,pState)
27
28
29
30
// MW11..
receiverEvent schedulerEvent=:(ScheduleOSEvent {ccMsg=CcWmINETEVENT,p1,p2,p3,p4} _) ioState
	= (True, Just (InternetEvent (p1,p2,p3,p4)), schedulerEvent, ioState)
// ..MW11
Peter Achten's avatar
Peter Achten committed
31
32
receiverEvent schedulerEvent pState
	= (False,Nothing,schedulerEvent,pState)