Commit 4e7341a7 authored by Peter Achten's avatar Peter Achten
Browse files

(PA) improved module structure

parent 4d058d8c
definition module StdChannelEnv
// ********************************************************************************
// Clean Standard Object I/O library, version 1.2
//
// StdChannelEnv defines instances of ChannelEnv for PSt and IOSt.
// ********************************************************************************
import channelenv
import StdPStClass
from iostate import PSt, IOSt
instance ChannelEnv (PSt .l)
instance ChannelEnv (IOSt .l)
implementation module StdChannelEnv
import StdBool, StdFunc, StdList, StdMisc, StdTuple
import channelenv
import commondef, iostate, receiverid, StdPStClass, StdReceiver
/* PSt is also an environment instance of the class ChannelEnv */
instance ChannelEnv (PSt .l)
where
channelEnvKind env
= (PST, env)
mb_close_inet_receiver_without_id reallyDoIt id_pair pSt=:{io}
= { pSt & io = mb_close_inet_receiver_without_id True id_pair io }
/* IOSt is also an environment instance of the class ChannelEnv */
instance ChannelEnv (IOSt .l)
where
channelEnvKind env
= (IOST, env)
mb_close_inet_receiver_without_id False _ ioState
= ioState
mb_close_inet_receiver_without_id True id_pair ioState
#! (closed,ioState) = IOStClosed ioState
| closed
= ioState
# (found,receivers,ioState) = IOStGetDevice ReceiverDevice ioState
| not found // PA: guard added
= ioState
# rsHs = (ReceiverSystemStateGetReceiverHandles receivers).rReceivers
(found,rsH,rsHs) = Remove (inetReceiverStateIdentified1 id_pair) undef rsHs
# ioState = IOStSetDevice (ReceiverSystemState {rReceivers=rsHs}) ioState
| not found
= ioState
| otherwise
# id = rsH.rHandle.rId
(idtable,ioState) = IOStGetIdTable ioState
ioState = IOStSetIdTable (snd (removeIdFromIdTable id idtable)) ioState
ioState = unbindRId id ioState
ioState = IOStSetRcvDisabled True ioState // MW11++
connectedIds = rsH.rHandle.rConnected
ioState = seq (map closeReceiver connectedIds) ioState
inetInfo = rsH.rHandle.rInetInfo
(_,_,_,closeFun) = fromJust inetInfo
ioState = appIOToolbox closeFun ioState
= ioState
inetReceiverStateIdentified1 :: !(!EndpointRef`, !InetReceiverCategory`) !(ReceiverStateHandle .ps) -> Bool
inetReceiverStateIdentified1 x {rHandle} = inetReceiverIdentified x rHandle
...@@ -11,7 +11,7 @@ from StdOverloaded import ==, toString ...@@ -11,7 +11,7 @@ from StdOverloaded import ==, toString
from channelenv import ChannelEnv from channelenv import ChannelEnv
instance ChannelEnv World instance ChannelEnv World
// other instances are IOSt & PSt (see StdPSt) // other instances are IOSt & PSt (see StdChannelEnv)
///////////////////////////////// receive channels ///////////////////////////////// ///////////////////////////////// receive channels /////////////////////////////////
......
...@@ -3,10 +3,10 @@ implementation module StdEventTCP ...@@ -3,10 +3,10 @@ implementation module StdEventTCP
// Clean Standard Object I/O library, version 1.2 // Clean Standard Object I/O library, version 1.2
import StdEnv import StdEnv
import StdChannels, StdTCPDef, StdTCPChannels import StdChannelEnv, StdChannels, StdTCPDef, StdTCPChannels
import StdReceiver import StdReceiver
import StdPSt import StdPSt, StdPStClass
import tcp, ostcp, channelenv, tcp_bytestreams import tcp, ostcp, tcp_bytestreams
import commondef, receiverid, receiverdevice, receiverdefaccess, receiveraccess import commondef, receiverid, receiverdevice, receiverdefaccess, receiveraccess
//import intrface //import intrface
......
...@@ -3,7 +3,7 @@ implementation module StdStringChannels ...@@ -3,7 +3,7 @@ implementation module StdStringChannels
// Clean Standard Object I/O library, version 1.2 // Clean Standard Object I/O library, version 1.2
import StdEnv import StdEnv
import StdPSt import StdPSt, StdPStClass
import StdChannels, StdTCPDef, StdTCPChannels, StdReceiver, StdEventTCP import StdChannels, StdTCPDef, StdTCPChannels, StdReceiver, StdEventTCP
import receiverdefaccess import receiverdefaccess
......
definition module StdTCP definition module StdTCP
import StdChannels, import StdChannelEnv,
StdChannels,
StdTCPChannels, StdTCPChannels,
StdEventTCP, StdEventTCP,
StdStringChannels, StdStringChannels,
......
Supports Markdown
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