Commit b87ceaf7 authored by Peter Achten's avatar Peter Achten
Browse files

(PA) receiverhandle code --> receiveraccess

parent bab05b29
...@@ -16,3 +16,23 @@ newReceiverHandle2 :: !Id !SelectState ![Id] !(Receiver2Function m r *(.ls, ...@@ -16,3 +16,23 @@ newReceiverHandle2 :: !Id !SelectState ![Id] !(Receiver2Function m r *(.ls,
onewaytotriple :: !(ReceiverFunction m *(.ls,.pst)) m !*(.ls,.pst) -> *(.ls,[r],.pst) onewaytotriple :: !(ReceiverFunction m *(.ls,.pst)) m !*(.ls,.pst) -> *(.ls,[r],.pst)
twowaytotriple :: !(Receiver2Function m r *(.ls,.pst)) m !*(.ls,.pst) -> *(.ls,[r],.pst) twowaytotriple :: !(Receiver2Function m r *(.ls,.pst)) m !*(.ls,.pst) -> *(.ls,[r],.pst)
// Functions that have moved from receiverhandle:
receiverIdentified :: !Id !(ReceiverHandle .ls .pst) -> Bool
// MW11..
inetReceiverIdentified :: !(!EndpointRef`, !InetReceiverCategory`)
!(ReceiverHandle .ls .pst) -> Bool
inetReceiverIdentifiedWithId:: !(!Id, !InetReceiverCategory`)
!(ReceiverHandle .ls .pst) -> Bool
// .. MW11
receiverSetSelectState :: !SelectState !(ReceiverStateHandle .pst) -> ReceiverStateHandle .pst
receiverHandleSyncMessage :: !SyncMessage !(ReceiverHandle .ls .pst) *(.ls,.pst)
-> ([SemiDynamic],ReceiverHandle .ls .pst, *(.ls,.pst))
receiverAddASyncMessage :: !Id !SemiDynamic !(ReceiverHandle .ls .pst) -> ReceiverHandle .ls .pst
// MW11..
receiverApplyInetEvent :: !InetReceiverASMQType !(ReceiverHandle .ls .pst) *(.ls,.pst)
-> *(.ls,.pst)
getInetReceiverRId :: !(ReceiverHandle .ls .pst) -> (RId InetReceiverASMQType)
// ..MW11
...@@ -3,9 +3,9 @@ implementation module receiveraccess ...@@ -3,9 +3,9 @@ implementation module receiveraccess
// Clean Object I/O library, version 1.2 // Clean Object I/O library, version 1.2
import StdBool, StdInt, StdList
import id, receiverdefaccess, receiverhandle import id, receiverdefaccess, receiverhandle
import cast, semidynamic
// MW11 added connectedIds // MW11 added connectedIds
newReceiverStateHandle :: !Id .ls !SelectState ![Id] !(ReceiverFunction m *(.ls,.pst)) -> ReceiverStateHandle .pst newReceiverStateHandle :: !Id .ls !SelectState ![Id] !(ReceiverFunction m *(.ls,.pst)) -> ReceiverStateHandle .pst
...@@ -54,3 +54,66 @@ twowaytotriple :: !(Receiver2Function m r *(.ls,.pst)) m !*(.ls,.pst) -> *(.ls,[ ...@@ -54,3 +54,66 @@ twowaytotriple :: !(Receiver2Function m r *(.ls,.pst)) m !*(.ls,.pst) -> *(.ls,[
twowaytotriple f m (ls,pst) twowaytotriple f m (ls,pst)
# (r, (ls,pst)) = f m (ls,pst) # (r, (ls,pst)) = f m (ls,pst)
= (ls,[r],pst) = (ls,[r],pst)
// Functions that have moved from receiverhandle:
receiverIdentified :: !Id !(ReceiverHandle .ls .pst) -> Bool
receiverIdentified id {rId}
= id==rId
// MW11..
inetReceiverIdentified :: !(!EndpointRef`, !InetReceiverCategory`)
!(ReceiverHandle .ls .ps) -> Bool
inetReceiverIdentified _ {rInetInfo=Nothing}
= False
inetReceiverIdentified (epR1,type1) {rInetInfo=Just (epR2,type2,_,_)}
= epR1==epR2 && type1==type2
inetReceiverIdentifiedWithId :: !(!Id, !InetReceiverCategory`)
!(ReceiverHandle .ls .ps) -> Bool
inetReceiverIdentifiedWithId _ {rInetInfo=Nothing}
= False
inetReceiverIdentifiedWithId (id,category) {rId, rInetInfo=Just (_,rCategory,_,_)}
= id==rId && category==rCategory
// ..MW11
receiverSetSelectState :: !SelectState !(ReceiverStateHandle .pst) -> ReceiverStateHandle .pst
receiverSetSelectState select rsH=:{rHandle=rH}
= {rsH & rHandle={rH & rSelect=select}}
receiverHandleSyncMessage :: !SyncMessage !(ReceiverHandle .ls .pst) *(.ls,.pst) -> ([SemiDynamic],ReceiverHandle .ls .pst,*(.ls,.pst))
receiverHandleSyncMessage {smRecLoc={rlReceiverId},smMsg} rH=:{rFun} (ls,pst)
| not (receiverIdentified rlReceiverId rH)
= ([],rH,(ls,pst))
# maybe_content = getDynamic rlReceiverId smMsg
| isNothing maybe_content
= ([],rH,(ls,pst))
# (ls,resp,pst) = rFun (Cast (fromJust maybe_content)) (ls,pst)
| isEmpty resp
= ([],rH,(ls,pst))
| otherwise
= ([setDynamic rlReceiverId (hd resp) smMsg],rH,(ls,pst))
receiverAddASyncMessage :: !Id !SemiDynamic !(ReceiverHandle .ls .pst) -> ReceiverHandle .ls .pst
receiverAddASyncMessage id sd rH=:{rASMQ}
| receiverIdentified id rH
# maybe_content = getDynamic id sd
| isNothing maybe_content
= rH
// otherwise
= {rH & rASMQ=rASMQ++[Cast (fromJust maybe_content)]}
| otherwise
= rH
// MW11..
receiverApplyInetEvent :: !InetReceiverASMQType !(ReceiverHandle .ls .pst) *(.ls,.pst) -> *(.ls,.pst)
receiverApplyInetEvent eventInfo rH=:{rFun,rInetInfo=Just _} (ls,pst)
# (ls,_,pst) = rFun (Cast eventInfo) (ls,pst)
= (ls,pst)
getInetReceiverRId :: !(ReceiverHandle .ls .ps) -> RId InetReceiverASMQType
// converts an Id into an RId
getInetReceiverRId {rId}
= toRId (fromId rId)
// ..MW11
...@@ -6,7 +6,7 @@ implementation module receiverdevice ...@@ -6,7 +6,7 @@ implementation module receiverdevice
import StdBool, StdFunc, StdList, StdMisc, StdTuple import StdBool, StdFunc, StdList, StdMisc, StdTuple
import StdReceiver import StdReceiver
import devicefunctions, iostate, receiverevent, receiverid import devicefunctions, iostate, receiveraccess, receiverevent, receiverid
from commondef import FatalError, URemove, UCond from commondef import FatalError, URemove, UCond
from StdPSt import appPIO, accPIO from StdPSt import appPIO, accPIO
......
...@@ -39,20 +39,3 @@ from ostoolbox import OSToolbox // MW11++ ...@@ -39,20 +39,3 @@ from ostoolbox import OSToolbox // MW11++
:: EndpointRef` :== Int :: EndpointRef` :== Int
:: InetReceiverCategory` :== Int :: InetReceiverCategory` :== Int
// ..MW11 // ..MW11
receiverIdentified :: !Id !(ReceiverHandle .ls .pst) -> Bool
// MW11..
inetReceiverIdentified :: !(!EndpointRef`, !InetReceiverCategory`)
!(ReceiverHandle .ls .pst) -> Bool
inetReceiverIdentifiedWithId:: !(!Id, !InetReceiverCategory`)
!(ReceiverHandle .ls .pst) -> Bool
// .. MW11
receiverSetSelectState :: !SelectState !(ReceiverStateHandle .pst) -> ReceiverStateHandle .pst
receiverHandleSyncMessage :: !SyncMessage !(ReceiverHandle .ls .pst) *(.ls,.pst)
-> ([SemiDynamic],ReceiverHandle .ls .pst, *(.ls,.pst))
receiverAddASyncMessage :: !Id !SemiDynamic !(ReceiverHandle .ls .pst) -> ReceiverHandle .ls .pst
// MW11..
receiverApplyInetEvent :: !InetReceiverASMQType !(ReceiverHandle .ls .pst) *(.ls,.pst)
-> *(.ls,.pst)
getInetReceiverRId :: !(ReceiverHandle .ls .pst) -> (RId InetReceiverASMQType)
// ..MW11
...@@ -4,8 +4,8 @@ implementation module receiverhandle ...@@ -4,8 +4,8 @@ implementation module receiverhandle
// Clean Object I/O library, version 1.2 // Clean Object I/O library, version 1.2
import StdBool, StdInt, StdList //import StdBool, StdInt, StdList
import cast, receivermessage, semidynamic import receivermessage//, cast, semidynamic
from ostoolbox import OSToolbox // MW11++ from ostoolbox import OSToolbox // MW11++
...@@ -38,63 +38,3 @@ from ostoolbox import OSToolbox // MW11++ ...@@ -38,63 +38,3 @@ from ostoolbox import OSToolbox // MW11++
:: EndpointRef` :== Int :: EndpointRef` :== Int
:: InetReceiverCategory` :== Int :: InetReceiverCategory` :== Int
// ..MW11 // ..MW11
receiverIdentified :: !Id !(ReceiverHandle .ls .pst) -> Bool
receiverIdentified id {rId}
= id==rId
// MW11..
inetReceiverIdentified :: !(!EndpointRef`, !InetReceiverCategory`)
!(ReceiverHandle .ls .ps) -> Bool
inetReceiverIdentified _ {rInetInfo=Nothing}
= False
inetReceiverIdentified (epR1,type1) {rInetInfo=Just (epR2,type2,_,_)}
= epR1==epR2 && type1==type2
inetReceiverIdentifiedWithId :: !(!Id, !InetReceiverCategory`)
!(ReceiverHandle .ls .ps) -> Bool
inetReceiverIdentifiedWithId _ {rInetInfo=Nothing}
= False
inetReceiverIdentifiedWithId (id,category) {rId, rInetInfo=Just (_,rCategory,_,_)}
= id==rId && category==rCategory
// ..MW11
receiverSetSelectState :: !SelectState !(ReceiverStateHandle .pst) -> ReceiverStateHandle .pst
receiverSetSelectState select rsH=:{rHandle=rH}
= {rsH & rHandle={rH & rSelect=select}}
receiverHandleSyncMessage :: !SyncMessage !(ReceiverHandle .ls .pst) *(.ls,.pst) -> ([SemiDynamic],ReceiverHandle .ls .pst,*(.ls,.pst))
receiverHandleSyncMessage {smRecLoc={rlReceiverId},smMsg} rH=:{rFun} (ls,pst)
| not (receiverIdentified rlReceiverId rH)
= ([],rH,(ls,pst))
# maybe_content = getDynamic rlReceiverId smMsg
| isNothing maybe_content
= ([],rH,(ls,pst))
# (ls,resp,pst) = rFun (Cast (fromJust maybe_content)) (ls,pst)
| isEmpty resp
= ([],rH,(ls,pst))
| otherwise
= ([setDynamic rlReceiverId (hd resp) smMsg],rH,(ls,pst))
receiverAddASyncMessage :: !Id !SemiDynamic !(ReceiverHandle .ls .pst) -> ReceiverHandle .ls .pst
receiverAddASyncMessage id sd rH=:{rASMQ}
| receiverIdentified id rH
# maybe_content = getDynamic id sd
| isNothing maybe_content
= rH
// otherwise
= {rH & rASMQ=rASMQ++[Cast (fromJust maybe_content)]}
| otherwise
= rH
// MW11..
receiverApplyInetEvent :: !InetReceiverASMQType !(ReceiverHandle .ls .pst) *(.ls,.pst) -> *(.ls,.pst)
receiverApplyInetEvent eventInfo rH=:{rFun,rInetInfo=Just _} (ls,pst)
# (ls,_,pst) = rFun (Cast eventInfo) (ls,pst)
= (ls,pst)
getInetReceiverRId :: !(ReceiverHandle .ls .ps) -> (RId InetReceiverASMQType)
// converts an Id into an RId
getInetReceiverRId {rId}
= toRId (fromId rId)
// ..MW11
...@@ -6,7 +6,7 @@ implementation module timerdevice ...@@ -6,7 +6,7 @@ implementation module timerdevice
import StdInt, StdBool, StdFunc, StdEnum, StdList, StdTuple import StdInt, StdBool, StdFunc, StdEnum, StdList, StdTuple
from StdPSt import accPIO, appPIO from StdPSt import accPIO, appPIO
import commondef, devicefunctions, iostate, receiverhandle, timeraccess, timerdefaccess, timerevent import commondef, devicefunctions, iostate, receiveraccess, timeraccess, timerdefaccess, timerevent
timerdeviceFatalError :: String String -> .x timerdeviceFatalError :: String String -> .x
......
...@@ -6,7 +6,7 @@ implementation module windowdevice ...@@ -6,7 +6,7 @@ implementation module windowdevice
import StdBool, StdFunc, StdList, StdMisc, StdTuple import StdBool, StdFunc, StdList, StdMisc, StdTuple
import osevent, ospicture, osrgn, oswindow import osevent, ospicture, osrgn, oswindow
import commondef, controldraw, controllayout, controlrelayout, controlresize, iostate, processstack, receiverid, scheduler import commondef, controldraw, controllayout, controlrelayout, controlresize, iostate, processstack, receiveraccess, receiverid, scheduler
import StdControlAttribute, StdWindowAttribute, windowaccess, windowclipstate, windowdispose, windowdraw, windowevent, windowupdate import StdControlAttribute, StdWindowAttribute, windowaccess, windowclipstate, windowdispose, windowdraw, windowevent, windowupdate
from keyfocus import setNoFocusItem, setNewFocusItem from keyfocus import setNoFocusItem, setNewFocusItem
from StdPSt import accPIO from StdPSt import accPIO
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment