Commit 69c6b6a0 authored by Peter Achten's avatar Peter Achten

(PA) verified that every IOStGetDevice is balanced with

IOStSetDevice (including dOpen/dClose DeviceFunctions).
parent 8122c610
......@@ -106,7 +106,7 @@ getWindow windowId ioState
# windows = WindowSystemStateGetWindowHandles wDevice
(found,wsH,windows) = getWindowHandlesWindow (toWID windowId) windows
| not found
= (Nothing,ioState)
= (Nothing,IOStSetDevice (WindowSystemState windows) ioState)
| otherwise
# (tb,ioState) = getIOToolbox ioState
# (wsH`,wsH,tb) = retrieveWindowHandle` wsH tb
......@@ -137,7 +137,7 @@ setWindow windowId f ioState
# windows = WindowSystemStateGetWindowHandles wDevice
(found,wsH,windows) = getWindowHandlesWindow (toWID windowId) windows
| not found
= ioState
= IOStSetDevice (WindowSystemState windows) ioState
| otherwise
# (wMetrics,ioState) = IOStGetOSWindowMetrics ioState
# (tb,ioState) = getIOToolbox ioState
......
......@@ -233,10 +233,11 @@ where
# (found,wDevice,ioState) = IOStGetDevice WindowDevice ioState
| not found
= (False,ioState)
# windows = WindowSystemStateGetWindowHandles wDevice
(modalWIDS,windows) = getWindowHandlesActiveModalDialog windows
# ioState = IOStSetDevice (WindowSystemState windows) ioState
= (isJust modalWIDS,ioState)
| otherwise
# windows = WindowSystemStateGetWindowHandles wDevice
(modalWIDS,windows) = getWindowHandlesActiveModalDialog windows
# ioState = IOStSetDevice (WindowSystemState windows) ioState
= (isJust modalWIDS,ioState)
enablemenusystem :: !DocumentInterface !OSMenuBar !(MenuHandles .pst) !*OSToolbox -> (!MenuHandles .pst,!*OSToolbox)
enablemenusystem di osMenuBar menus=:{mEnabled,mMenus} tb
......
......@@ -7,7 +7,7 @@ implementation module StdReceiver
import StdInt, StdBool, StdList, StdTuple, StdOverloaded, StdFunc
import commondef, id, receiveraccess, receiverdefaccess, receiverdevice, receiverid, scheduler
from StdPSt import accPIO, appPIO, St
//import tracetypes, StdDebug
StdReceiverFatalError :: String String -> .x
StdReceiverFatalError rule error
......@@ -161,9 +161,10 @@ getReceivers ioState
# (found,rDevice,ioState) = IOStGetDevice ReceiverDevice ioState
| not found
= ([],ioState)
# (idstypes,rsHs) = getreceivers (ReceiverSystemStateGetReceiverHandles rDevice).rReceivers
# ioState = IOStSetDevice (ReceiverSystemState {rReceivers=rsHs}) ioState
= (idstypes,ioState)
| otherwise
# (idstypes,rsHs) = getreceivers (ReceiverSystemStateGetReceiverHandles rDevice).rReceivers
# ioState = IOStSetDevice (ReceiverSystemState {rReceivers=rsHs}) ioState
= (idstypes,ioState)
where
getreceivers :: ![ReceiverStateHandle .pst] -> ([(Id,ReceiverType)],![ReceiverStateHandle .pst])
getreceivers [rsH:rsHs]
......
......@@ -992,7 +992,6 @@ getWindowLook id ioState
= (Nothing,IOStSetDevice (WindowSystemState (setWindowHandlesWindow wsH windows)) ioState)
| otherwise
# (windowInfo,wsH) = getWindowStateHandleWindowInfo wsH
// {lookFun,lookSysUpdate} = (fromJust windowInfo).windowLook Mike: fromJust changed into getWindowInfoWindowData
{lookFun,lookSysUpdate} = (getWindowInfoWindowData windowInfo).windowLook
= (Just (lookSysUpdate,lookFun),IOStSetDevice (WindowSystemState (setWindowHandlesWindow wsH windows)) ioState)
......@@ -1379,7 +1378,6 @@ getWindowViewDomain id ioState
= (Nothing,IOStSetDevice (WindowSystemState (setWindowHandlesWindow wsH windows)) ioState)
| otherwise
# (wInfo,wsH) = getWindowStateHandleWindowInfo wsH
// domain = RectToRectangle (fromJust wInfo).windowDomain Mike: fromJust changed into getWindowInfoWindowData
domain = RectToRectangle (getWindowInfoWindowData wInfo).windowDomain
= (Just domain,IOStSetDevice (WindowSystemState (setWindowHandlesWindow wsH windows)) ioState)
......
......@@ -124,10 +124,9 @@ IOStHasDevice :: !Device !(IOSt .l) -> (!Bool, !IOSt .l)
IOStGetDevices :: !(IOSt .l) -> (![Device],!IOSt .l)
IOStGetDevice :: !Device !(IOSt .l) -> (!Bool,DeviceSystemState (PSt .l),!IOSt .l)
// IOStGetDevice retrieves the indicated device and returns True if found. If not found the device is undefined!
IOStRemoveDevice :: !Device !(IOSt .l) -> IOSt .l
// IOStGetDevice removes the indicated device and returns True if found. If not found the device is undefined!
IOStSetDevice :: !(DeviceSystemState (PSt .l)) !(IOSt .l) -> IOSt .l
// IOStSetDevice stores the indicated device.
getIOToolbox :: !(IOSt .l) -> (!*OSToolbox, !IOSt .l)
setIOToolbox :: !*OSToolbox !(IOSt .l) -> IOSt .l
appIOToolbox :: !.(IdFun *OSToolbox) !(IOSt .l) -> IOSt .l
......
......@@ -15,6 +15,11 @@ from ossystem import OSWindowMetrics, OSDefaultWindowMetrics
from ostoolbox import OSNewToolbox, OSDummyToolbox
from ostypes import OSWindowPtr, OSNoWindowPtr
from roundrobin import RR, emptyRR, notodoRR
import StdDebug
iostateFatalError :: String String -> .x
iostateFatalError function error
= FatalError function "iostate" error
:: *PSt l
......@@ -516,19 +521,6 @@ where
devicesGetDevice d []
= (False,undef,[])
IOStRemoveDevice :: !Device !(IOSt .l) -> IOSt .l
IOStRemoveDevice d ioState=:{iounique=iounique=:{iodevices=ds}}
# ds = devicesRemoveDevice d ds
= {ioState & iounique={iounique & iodevices=ds}}
where
devicesRemoveDevice :: !Device !*[DeviceSystemState .pst] -> *[DeviceSystemState .pst]
devicesRemoveDevice d [dState:dStates]
# (d`,dState) = toDevice dState
| d`==d = dStates
| otherwise = [dState:devicesRemoveDevice d dStates]
devicesRemoveDevice _ []
= []
IOStSetDevice :: !(DeviceSystemState (PSt .l)) !(IOSt .l) -> IOSt .l
IOStSetDevice d ioState=:{iounique=iounique=:{iodevices=ds}}
#! (device,d) = toDevice d
......@@ -540,7 +532,7 @@ where
devicesSetDevice p device dState2 [dState1:dStates]
# (device1,dState1) = toDevice dState1
| device1==device
= [dState2:dStates]
= iostateFatalError "IOStSetDevice" (toString device+++" already present") //[dState2:dStates]
| p>priorityDevice device1
= [dState2,dState1:dStates]
| otherwise
......
......@@ -84,7 +84,6 @@ menuClose pState=:{io=ioState}
(_,(rt,it)) = StateMap (disposeIds ioid) mHs (rt,it)
# ioState = IOStSetIdTable it ioState
# ioState = IOStSetReceiverTable rt ioState
# ioState = IOStRemoveDevice MenuDevice ioState // PA: This is actually redundant, since IOStGetDevice already removed it
# ioState = IOStRemoveDeviceFunctions MenuDevice ioState
= {pState & io=ioState}
where
......
......@@ -61,8 +61,8 @@ where
processClose :: !(PSt .l) -> PSt .l
processClose pState=:{io=ioState}
# ioState = IOStRemoveDevice ProcessDevice ioState
# ioState = IOStRemoveDeviceFunctions ProcessDevice ioState
# (_,_,ioState) = IOStGetDevice ProcessDevice ioState
# ioState = IOStRemoveDeviceFunctions ProcessDevice ioState
= {pState & io=ioState}
processIO :: !DeviceEvent !(PSt .l) -> (!DeviceEvent,!PSt .l)
......
......@@ -38,10 +38,8 @@ receiverOpen pState=:{io=ioState}
receiverClose :: !(PSt .l) -> PSt .l
receiverClose pState=:{io=ioState}
// MW11...
# ioState = callReceiverCloseFunctions ioState
ioState = IOStSetRcvDisabled True ioState
// ... MW11
# ioState = IOStSetRcvDisabled True ioState
# (found,rDevice,ioState) = IOStGetDevice ReceiverDevice ioState
| not found
= {pState & io=ioState}
......@@ -51,10 +49,8 @@ receiverClose pState=:{io=ioState}
# (idtable,ioState) = IOStGetIdTable ioState
# ioState = IOStSetIdTable (snd (removeIdsFromIdTable rIds idtable)) ioState
# ioState = unbindRIds rIds ioState
# ioState = IOStRemoveDevice ReceiverDevice ioState // PA: this is redundant, because IOStGetDevice already removed it
# ioState = IOStRemoveDeviceFunctions ReceiverDevice ioState
= {pState & io=ioState}
// MW11..
where
callReceiverCloseFunctions :: !(IOSt .l) -> (IOSt .l)
callReceiverCloseFunctions ioState
......@@ -65,20 +61,13 @@ where
# rHs = (ReceiverSystemStateGetReceiverHandles rDevice).rReceivers
# (funcs,rHs) = AccessList getCloseFunc rHs
# ioState = IOStSetDevice (ReceiverSystemState {rReceivers=rHs}) ioState
// PA = seq (map callCloseFunc rHs) ioState
= StrictSeq funcs ioState
where
callCloseFunc {rHandle={rInetInfo=Nothing, rConnected}} ioState
= seq (map closeReceiver rConnected) ioState
callCloseFunc {rHandle={rInetInfo=Just (_,_,_,closeFun), rConnected}} ioState
= appIOToolbox closeFun (seq (map closeReceiver rConnected) ioState)
getCloseFunc :: !(ReceiverStateHandle (PSt .l)) -> (!IdFun (IOSt .l),!ReceiverStateHandle (PSt .l))
getCloseFunc rsH=:{rHandle={rInetInfo=Nothing, rConnected}}
= (StrictSeq (map closeReceiver rConnected),rsH)
getCloseFunc rsH=:{rHandle={rInetInfo=Just (_,_,_,closeFun),rConnected}}
= (appIOToolbox closeFun o StrictSeq (map closeReceiver rConnected),rsH)
// .. MW11
/* The receiver handles three cases of message events (for the time being timers are not included in receivers):
- QASyncMessage:
......
......@@ -12,7 +12,7 @@ import commondef, devicefunctions, iostate, processstack, roundrobin, timertable
from StdProcessDef import ProcessInit
from StdPSt import accPIO, appPIO
from StdProcessAttribute import isProcessKindAttribute
//import StdDebug,tracetypes
:: *Environs
= { envsEvents :: !*OSEvents
......@@ -424,6 +424,7 @@ handleOneEventForDevices :: !SchedulerEvent !(PSt .l) -> (!Bool,!SchedulerEvent,
handleOneEventForDevices schedulerEvent pState
# (deviceFunctions,pState) = accPIO IOStGetDeviceFunctions pState
ioFunctions = [(df.dEvent,df.dDoIO) \\ df<-deviceFunctions]
// # pState = trace_n ("handleOneEventForDevices (handling device functions): "+++listToString deviceFunctions) pState
= handleEventForDevices ioFunctions False schedulerEvent pState
......
......@@ -49,7 +49,6 @@ timerClose pState=:{io=ioState}
# ioState = IOStSetReceiverTable rt ioState
# ioState = IOStSetTimerTable tt ioState
# ioState = IOStSetIdTable idtable ioState
# ioState = IOStRemoveDevice TimerDevice ioState // PA: this is redundant, because IOStGetDevice already removed it
# ioState = IOStRemoveDeviceFunctions TimerDevice ioState
= {pState & io=ioState}
where
......
......@@ -277,7 +277,6 @@ where
= (deviceEvent,pState2)
with
(_,_,windows1) = removeWindowHandlesWindow wid windows // Remove the placeholder from windows
// windows2 = addWindowHandlesWindow 0 wsH1 windows1 // Place the change window in front of all windows
windows2 = addWindowHandlesActiveWindow wsH1 windows1 // Place the change window in front of all (modal/modeless) windows
ioState1 = IOStSetDevice (WindowSystemState windows2) ioState
pState1 = {pState & io=ioState1}
......
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