Skip to content
GitLab
Projects
Groups
Snippets
/
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
clean-compiler-and-rts
stdenv
Commits
92c564f0
Commit
92c564f0
authored
Dec 03, 1999
by
Martin Wierich
Browse files
moving IOSt and PSt instances from StdTCPChannels to StdEventTCP
parent
7d3a3323
Changes
6
Hide whitespace changes
Inline
Side-by-side
ObjectIO/Tcp Examples/downloadHTTP/downloadHTTP.icl
View file @
92c564f0
...
...
@@ -7,7 +7,7 @@ module downloadHTTP
// The program has been written in Clean 1.3.2 and uses the Clean Standard Object I/O library 1.2
//
// **************************************************************************************************
import
StdIO
import
StdEnv
,
StdTCP
,
StdMaybe
from
StdSystem
import
ticksPerSecond
...
...
ObjectIO/Tcp/StdChannels.dcl
View file @
92c564f0
...
...
@@ -9,10 +9,8 @@ definition module StdChannels
from
StdMaybe
import
Maybe
from
StdOverloaded
import
==,
toString
from
channelenv
import
ChannelEnv
from
iostate
import
PSt
,
IOSt
import
StdPStClass
instance
ChannelEnv
World
,
(
PSt
.
l
),
(
IOSt
.
l
)
instance
ChannelEnv
World
///////////////////////////////// receive channels /////////////////////////////////
...
...
ObjectIO/Tcp/StdChannels.icl
View file @
92c564f0
...
...
@@ -16,52 +16,6 @@ instance ChannelEnv World
mb_close_inet_receiver_without_id
_
_
world
=
world
/* 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
///////////////////////////////// receive channels /////////////////////////////////
class
Receive
ch
...
...
ObjectIO/Tcp/StdEventTCP.dcl
View file @
92c564f0
...
...
@@ -12,6 +12,9 @@ from StdReceiver import Receivers, ReceiverType
from
StdPSt
import
PSt
,
IOSt
from
StdIOCommon
import
ErrorReport
from
tcp_bytestreams
import
TCP_SCharStream_
from
StdPStClass
import
FileEnv
,
Files
,
TimeEnv
,
Date
,
Tick
,
Time
instance
ChannelEnv
(
PSt
.
l
),
(
IOSt
.
l
)
instance
Receivers
TCP_ListenerReceiver
instance
Receivers
TCP_Receiver
...
...
ObjectIO/Tcp/StdEventTCP.icl
View file @
92c564f0
...
...
@@ -10,6 +10,52 @@ import tcp, ostcp, tcp_bytestreams
import
commondef
,
receiverid
,
receiverdevice
,
receiverdefaccess
,
receiveraccess
//import intrface
/* 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
openSendNotifier
::
.
ls
!(
SendNotifier
*(*
ch
.
a
)
.
ls
(
PSt
.
l
))
!(
PSt
.
l
)
->
(!
ErrorReport
,!*(*
ch
.
a
),!
PSt
.
l
)
...
...
ObjectIO/Tcp/ostcp.icl
View file @
92c564f0
...
...
@@ -4,6 +4,7 @@ import StdEnv, StdMaybe
import
StdTCPDef
import
StdChannels
import
tcp
,
channelenv
,
ostick
import
code
from
"cTCP.obj"
,
library
"wsock_library"
os_eom
::
!
EndpointRef
!*
env
->
(!
Bool
,
!*
env
)
...
...
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment