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

(PA) improved naming and removed comments

parent c953ba22
...@@ -19,38 +19,38 @@ from timertable import TimerTable ...@@ -19,38 +19,38 @@ from timertable import TimerTable
:: *IOSt l :: *IOSt l
:: *PSt l :: *PSt l
= { ls :: !l // The local (and private) data of the process = { ls :: !l // The local (and private) data of the process
, io :: !*IOSt l // The IOSt environment of the process , io :: !*IOSt l // The IOSt environment of the process
} }
:: *Locals :: *CProcesses // The 'context-free' processes administration
:== RR *LocalIO :== RR *CProcess // is a round-robin
:: *LocalIO :: *CProcess // The context-free process
= E. .l: = E. .l:
{ localState :: !Maybe l { localState :: !Maybe l // its local state
, localIOSt :: !*IOSt l , localIOSt :: !*IOSt l // its context-free IOSt
} }
:: RuntimeState :: RuntimeState
= Running // The process is running = Running // The process is running
| Blocked !SystemId // The process is blocked for the process with given id | Blocked !SystemId // The process is blocked for the process with given id
| Closed // The process is closed | Closed // The process is closed
:: GUIShare :: GUIShare
:== OSGUIShare :== OSGUIShare
:: ActivateRequests :== [OSActivateRequest] :: ActivateRequests :== [OSActivateRequest]
:: DoubleDownDist :== Int :: DoubleDownDist :== Int
:: InputTrack // Input being tracked: :: InputTrack // Input being tracked:
= { itWindow :: !OSWindowPtr // the parent window = { itWindow :: !OSWindowPtr // the parent window
, itControl :: !Int // zero if parent window, otherwise item nr of control (>0) , itControl :: !Int // zero if parent window, otherwise item nr of control (>0)
, itKind :: !InputTrackKind // the input kinds being tracked , itKind :: !InputTrackKind // the input kinds being tracked
} }
:: InputTrackKind // Input source kinds: :: InputTrackKind // Input source kinds:
= { itkMouse :: !Bool // mouse = { itkMouse :: !Bool // mouse
, itkKeyboard :: !Bool // keyboard , itkKeyboard :: !Bool // keyboard
} }
:: ClipboardState :: ClipboardState
= { cbsCount :: !Int // ScrapCount of last access = { cbsCount :: !Int // ScrapCount of last access
} }
...@@ -75,7 +75,7 @@ IOStGetOSTime :: !(IOSt .l) -> (!OSTime, !IOSt .l) ...@@ -75,7 +75,7 @@ IOStGetOSTime :: !(IOSt .l) -> (!OSTime, !IOSt .l)
IOStGetActivateRequests :: !(IOSt .l) -> (!ActivateRequests, !IOSt .l) IOStGetActivateRequests :: !(IOSt .l) -> (!ActivateRequests, !IOSt .l)
IOStGetEvents :: !(IOSt .l) -> (!*OSEvents, !IOSt .l) IOStGetEvents :: !(IOSt .l) -> (!*OSEvents, !IOSt .l)
IOStGetWorld :: !(IOSt .l) -> (!*World, !IOSt .l) IOStGetWorld :: !(IOSt .l) -> (!*World, !IOSt .l)
IOStGetLocals :: !(IOSt .l) -> (!Locals, !IOSt .l) IOStGetCProcesses :: !(IOSt .l) -> (!CProcesses, !IOSt .l)
IOStGetProcessStack :: !(IOSt .l) -> (!ProcessStack, !IOSt .l) IOStGetProcessStack :: !(IOSt .l) -> (!ProcessStack, !IOSt .l)
IOStGetDocumentInterface:: !(IOSt .l) -> (!DocumentInterface, !IOSt .l) IOStGetDocumentInterface:: !(IOSt .l) -> (!DocumentInterface, !IOSt .l)
IOStGetOSDInfo :: !(IOSt .l) -> (!OSDInfo, !IOSt .l) IOStGetOSDInfo :: !(IOSt .l) -> (!OSDInfo, !IOSt .l)
...@@ -104,7 +104,7 @@ IOStSetOSTime :: !OSTime !(IOSt .l) -> IOSt .l ...@@ -104,7 +104,7 @@ IOStSetOSTime :: !OSTime !(IOSt .l) -> IOSt .l
IOStSetActivateRequests :: !ActivateRequests !(IOSt .l) -> IOSt .l IOStSetActivateRequests :: !ActivateRequests !(IOSt .l) -> IOSt .l
IOStSetEvents :: !*OSEvents !(IOSt .l) -> IOSt .l IOStSetEvents :: !*OSEvents !(IOSt .l) -> IOSt .l
IOStSetWorld :: !*World !(IOSt .l) -> IOSt .l IOStSetWorld :: !*World !(IOSt .l) -> IOSt .l
IOStSetLocals :: !Locals !(IOSt .l) -> IOSt .l IOStSetCProcesses :: !CProcesses !(IOSt .l) -> IOSt .l
IOStSetProcessStack :: !ProcessStack !(IOSt .l) -> IOSt .l IOStSetProcessStack :: !ProcessStack !(IOSt .l) -> IOSt .l
SelectIOSt :: !(IOSt .l) -> IOSt .l SelectIOSt :: !(IOSt .l) -> IOSt .l
IOStSetOSDInfo :: !OSDInfo !(IOSt .l) -> IOSt .l IOStSetOSDInfo :: !OSDInfo !(IOSt .l) -> IOSt .l
...@@ -116,7 +116,7 @@ IOStSetClipboardState :: !ClipboardState !(IOSt .l) -> IOSt .l ...@@ -116,7 +116,7 @@ IOStSetClipboardState :: !ClipboardState !(IOSt .l) -> IOSt .l
IOStSetDeviceFunctions :: ![DeviceFunctions (PSt .l)] !(IOSt .l) -> IOSt .l IOStSetDeviceFunctions :: ![DeviceFunctions (PSt .l)] !(IOSt .l) -> IOSt .l
IOStSetRcvDisabled :: !Bool !(IOSt .l) -> IOSt .l /* MW11++*/ IOStSetRcvDisabled :: !Bool !(IOSt .l) -> IOSt .l /* MW11++*/
IOStSwapIO :: !(![*World],!Locals) !(IOSt .l) -> (!(![*World],!Locals),!IOSt .l) IOStSwapIO :: !(![*World],!CProcesses) !(IOSt .l) -> (!(![*World],!CProcesses),!IOSt .l)
IOStLastInteraction :: !(IOSt .l) -> (!Bool, !IOSt .l) IOStLastInteraction :: !(IOSt .l) -> (!Bool, !IOSt .l)
IOStHasDevice :: !Device !(IOSt .l) -> (!Bool, !IOSt .l) IOStHasDevice :: !Device !(IOSt .l) -> (!Bool, !IOSt .l)
......
...@@ -22,12 +22,12 @@ from roundrobin import RR, emptyRR, notodoRR ...@@ -22,12 +22,12 @@ from roundrobin import RR, emptyRR, notodoRR
, io :: !*IOSt l // The IOSt environment of the process , io :: !*IOSt l // The IOSt environment of the process
} }
:: *Locals :: *CProcesses // The 'context-free' processes administration
:== RR *LocalIO :== RR *CProcess // is a round-robin
:: *LocalIO :: *CProcess // The context-free process
= E. .l: = E. .l:
{ localState :: !Maybe l { localState :: !Maybe l // its local state
, localIOSt :: !*IOSt l , localIOSt :: !*IOSt l // its context-free IOSt
} }
:: *IOSt l :: *IOSt l
= { iounique :: !*IOUnique l = { iounique :: !*IOUnique l
...@@ -36,7 +36,7 @@ from roundrobin import RR, emptyRR, notodoRR ...@@ -36,7 +36,7 @@ from roundrobin import RR, emptyRR, notodoRR
:: *IOUnique l :: *IOUnique l
= { ioevents :: !*OSEvents // The event stream environment = { ioevents :: !*OSEvents // The event stream environment
, ioworld :: ![*World] // The world environment , ioworld :: ![*World] // The world environment
, iolocal :: *Locals // All other processes , ioprocesses :: *CProcesses // All other processes
, ioinit :: !IdFun (PSt l) // The initialisation functions of the process , ioinit :: !IdFun (PSt l) // The initialisation functions of the process
, iotoolbox :: !*OSToolbox // The Mac continuation value , iotoolbox :: !*OSToolbox // The Mac continuation value
} }
...@@ -148,7 +148,7 @@ emptyIOUnique initIO ...@@ -148,7 +148,7 @@ emptyIOUnique initIO
= ( wMetrics = ( wMetrics
, { ioevents = OSnewEvents , { ioevents = OSnewEvents
, ioworld = [] , ioworld = []
, iolocal = emptyRR , ioprocesses = emptyRR
, ioinit = initIO , ioinit = initIO
, iotoolbox = tb , iotoolbox = tb
} }
...@@ -306,13 +306,13 @@ IOStSetWorld :: !*World !(IOSt .l) -> IOSt .l ...@@ -306,13 +306,13 @@ IOStSetWorld :: !*World !(IOSt .l) -> IOSt .l
IOStSetWorld w ioState=:{iounique=unique=:{ioworld=ws}} = {ioState & iounique={unique & ioworld=[w:ws]}} IOStSetWorld w ioState=:{iounique=unique=:{ioworld=ws}} = {ioState & iounique={unique & ioworld=[w:ws]}}
// Access rules to Locals: // Access rules to CProcesses:
IOStGetLocals :: !(IOSt .l) -> (!Locals, !IOSt .l) IOStGetCProcesses :: !(IOSt .l) -> (!CProcesses, !IOSt .l)
IOStGetLocals ioState=:{iounique=unique=:{iolocal}} = (iolocal,{ioState & iounique={unique & iolocal=emptyRR}}) IOStGetCProcesses ioState=:{iounique=unique=:{ioprocesses}} = (ioprocesses,{ioState & iounique={unique & ioprocesses=emptyRR}})
IOStSetLocals :: !Locals !(IOSt .l) -> IOSt .l IOStSetCProcesses :: !CProcesses !(IOSt .l) -> IOSt .l
IOStSetLocals local ioState = {ioState & iounique={ioState.iounique & iolocal=local}} IOStSetCProcesses processes ioState = {ioState & iounique={ioState.iounique & ioprocesses=processes}}
// Access to the ProcessStack of the IOSt: // Access to the ProcessStack of the IOSt:
...@@ -350,9 +350,9 @@ IOStGetProcessKind ioState=:{ioshare} = (ioshare.iokind, ioState) ...@@ -350,9 +350,9 @@ IOStGetProcessKind ioState=:{ioshare} = (ioshare.iokind, ioState)
// Swapping of IOSt environments: // Swapping of IOSt environments:
IOStSwapIO :: !(![*World],!Locals) !(IOSt .l) -> (!(![*World],!Locals),!IOSt .l) IOStSwapIO :: !(![*World],!CProcesses) !(IOSt .l) -> (!(![*World],!CProcesses),!IOSt .l)
IOStSwapIO (world`,locals`) ioState=:{iounique=unique=:{ioworld,iolocal}} IOStSwapIO (world`,cprocesses`) ioState=:{iounique=unique=:{ioworld,ioprocesses}}
= ((ioworld,iolocal),{ioState & iounique={unique & ioworld=world`,iolocal=locals`}}) = ((ioworld,ioprocesses),{ioState & iounique={unique & ioworld=world`,ioprocesses=cprocesses`}})
// Access to the SystemId of the IOSt: // Access to the SystemId of the IOSt:
...@@ -441,9 +441,9 @@ IOStSetDeviceFunctions funcs ioState=:{ioshare} = {ioState & ioshare={ioshare & ...@@ -441,9 +441,9 @@ IOStSetDeviceFunctions funcs ioState=:{ioshare} = {ioState & ioshare={ioshare &
IOStLastInteraction :: !(IOSt .l) -> (!Bool,!IOSt .l) IOStLastInteraction :: !(IOSt .l) -> (!Bool,!IOSt .l)
IOStLastInteraction ioState IOStLastInteraction ioState
# (locals,ioState) = IOStGetLocals ioState # (processes,ioState) = IOStGetCProcesses ioState
(empty,locals) = notodoRR locals (empty,processes) = notodoRR processes
# ioState = IOStSetLocals locals ioState # ioState = IOStSetCProcesses processes ioState
= (not empty,ioState) = (not empty,ioState)
IOStHasDevice :: !Device !(IOSt .l) -> (!Bool,!IOSt .l) IOStHasDevice :: !Device !(IOSt .l) -> (!Bool,!IOSt .l)
......
...@@ -8,7 +8,7 @@ definition module scheduler ...@@ -8,7 +8,7 @@ definition module scheduler
import deviceevents, StdMaybe import deviceevents, StdMaybe
from StdString import String from StdString import String
from id import Id from id import Id
from iostate import PSt, IOSt, RR, Locals, LocalIO from iostate import PSt, IOSt, RR, CProcesses, CProcess
from receivertable import ReceiverTable, ReceiverTableEntry, RecLoc from receivertable import ReceiverTable, ReceiverTableEntry, RecLoc
from device import Device from device import Device
from processstack import ProcessStack, ProcessShowState, ShowFlag, ProcessKind, InteractiveProcess, VirtualProcess from processstack import ProcessStack, ProcessShowState, ShowFlag, ProcessKind, InteractiveProcess, VirtualProcess
...@@ -32,18 +32,11 @@ from StdProcessDef import ProcessInit, DocumentInterface, NDI, SDI, MDI ...@@ -32,18 +32,11 @@ from StdProcessDef import ProcessInit, DocumentInterface, NDI, SDI, MDI
= { envsEvents :: !*OSEvents = { envsEvents :: !*OSEvents
, envsWorld :: !*World , envsWorld :: !*World
} }
/*
:: *GContext p
= { groupPublic :: p
, groupLocals :: !*Locals p
}
*/
:: *Context :: *Context
= { cEnvs :: !*Environs // The global environments = { cEnvs :: !*Environs // The global environments
, cProcessStack :: ProcessStack // The global process stack , cProcessStack :: ProcessStack // The global process stack
, cMaxIONr :: SystemId // The global maximum system number , cMaxIONr :: SystemId // The global maximum system number
// , cGroups :: *Groups // All process groups , cProcesses :: *CProcesses // All processes
, cProcesses :: *Locals // All processes
, cModalProcess :: Maybe SystemId // The SystemId of the interactive process that has a modal window , cModalProcess :: Maybe SystemId // The SystemId of the interactive process that has a modal window
, cReceiverTable :: ReceiverTable // The global receiver-process table , cReceiverTable :: ReceiverTable // The global receiver-process table
, cTimerTable :: TimerTable // The table of all currently active timers , cTimerTable :: TimerTable // The table of all currently active timers
...@@ -149,11 +142,11 @@ accContext :: !.(St Context .x) !(PSt .l) -> (!.x, !PSt .l) ...@@ -149,11 +142,11 @@ accContext :: !.(St Context .x) !(PSt .l) -> (!.x, !PSt .l)
, !Maybe r // optional access information , !Maybe r // optional access information
) )
accessLocals :: !(St LocalIO (Result r)) !*Locals -> (!Result r,!*Locals) accessLocals :: !(St CProcess (Result r)) !*CProcesses -> (!Result r,!*CProcesses)
/* Let f::(IOSt .l .p) -> (Result r,IOSt .l .p) be an IOSt access function. /* Let f::(IOSt .l .p) -> (Result r,IOSt .l .p) be an IOSt access function.
To thread f through *Locals until fst(fst(f io)), define gLocals as follows: To thread f through *CProcesses until fst(fst(f io)), define gLocals as follows:
gLocals :: *(Locals .p) -> (Result r, *Locals .p) gLocals :: *CProcesses -> (Result r, *CProcesses)
gLocals locals = accessLocals f` locals gLocals locals = accessLocals f` locals
where f` localIO = (r,{localIO & localIOSt=ioState}) where f` localIO = (r,{localIO & localIOSt=ioState})
where (r,ioState) = f localIO.localIOSt where (r,ioState) = f localIO.localIOSt
......
...@@ -18,18 +18,11 @@ from StdProcessAttribute import isProcessKindAttribute ...@@ -18,18 +18,11 @@ from StdProcessAttribute import isProcessKindAttribute
= { envsEvents :: !*OSEvents = { envsEvents :: !*OSEvents
, envsWorld :: !*World , envsWorld :: !*World
} }
/*
:: *GContext p
= { groupPublic :: p
, groupLocals :: !*Locals p
}
*/
:: *Context :: *Context
= { cEnvs :: !*Environs // The global environments = { cEnvs :: !*Environs // The global environments
, cProcessStack :: ProcessStack // The global process stack , cProcessStack :: ProcessStack // The global process stack
, cMaxIONr :: SystemId // The global maximum system number , cMaxIONr :: SystemId // The global maximum system number
// , cGroups :: *Groups // All processes , cProcesses :: *CProcesses // All processes
, cProcesses :: *Locals // All processes
, cModalProcess :: Maybe SystemId // The SystemId of the interactive process that has a modal window , cModalProcess :: Maybe SystemId // The SystemId of the interactive process that has a modal window
, cReceiverTable :: ReceiverTable // The global receiver-process table , cReceiverTable :: ReceiverTable // The global receiver-process table
, cTimerTable :: TimerTable // The table of all currently active timers , cTimerTable :: TimerTable // The table of all currently active timers
...@@ -51,12 +44,8 @@ schedulerFatalError rule error ...@@ -51,12 +44,8 @@ schedulerFatalError rule error
ContextGetProcessStack :: !Context -> (!ProcessStack,!Context) ContextGetProcessStack :: !Context -> (!ProcessStack,!Context)
ContextGetProcessStack context=:{cProcessStack} ContextGetProcessStack context=:{cProcessStack}
= (cProcessStack,context) = (cProcessStack,context)
/*
ContextGetGroups :: !Context -> (!Groups,!Context) ContextGetProcesses :: !Context -> (!CProcesses,!Context)
ContextGetGroups context=:{cGroups}
= (cGroups,{context & cGroups=emptyRR})
*/
ContextGetProcesses :: !Context -> (!Locals,!Context)
ContextGetProcesses context=:{cProcesses} ContextGetProcesses context=:{cProcesses}
= (cProcesses,{context & cProcesses=emptyRR}) = (cProcesses,{context & cProcesses=emptyRR})
...@@ -78,22 +67,6 @@ ContextSetOSEvents (osEvents,context=:{cEnvs=envs}) ...@@ -78,22 +67,6 @@ ContextSetOSEvents (osEvents,context=:{cEnvs=envs})
= {context & cEnvs={envs & envsEvents=osEvents}} = {context & cEnvs={envs & envsEvents=osEvents}}
// On GContext:
/*
splitGContext :: !(GContext .p) -> (!LocalIO .p,!GContext .p)
splitGContext gContext=:{groupLocals=locals}
# (local,locals) = getcurrentRR locals
= (local,{gContext & groupLocals=locals})
adddoneLocal :: !(LocalIO .p) !(GContext .p) -> GContext .p
adddoneLocal localIO gContext=:{groupLocals}
= {gContext & groupLocals=adddoneRR localIO groupLocals}
GContextToGroupIO :: !(GContext .p) -> GroupIO
GContextToGroupIO {groupPublic,groupLocals}
= {groupState=groupPublic,groupIO=groupLocals}
*/
// On RuntimeState: // On RuntimeState:
rsIsBlocked :: !RuntimeState -> (!Bool,SystemId) rsIsBlocked :: !RuntimeState -> (!Bool,SystemId)
...@@ -117,7 +90,6 @@ initContext ioDefInit ioDefAbout local documentInterface ioKind world ...@@ -117,7 +90,6 @@ initContext ioDefInit ioDefAbout local documentInterface ioKind world
= ( { cEnvs = initEnvs = ( { cEnvs = initEnvs
, cProcessStack = ioStack , cProcessStack = ioStack
, cMaxIONr = InitSystemId , cMaxIONr = InitSystemId
// , cGroups = initGroups
, cProcesses = toRR [] [openLocalIO ioState local] , cProcesses = toRR [] [openLocalIO ioState local]
, cModalProcess = initModalId , cModalProcess = initModalId
, cReceiverTable = initialReceiverTable , cReceiverTable = initialReceiverTable
...@@ -134,8 +106,6 @@ where ...@@ -134,8 +106,6 @@ where
show = ioKind==InteractiveProcess show = ioKind==InteractiveProcess
ioStack = [{psId=InitSystemId,psShow=show,psKind=ioKind}] ioStack = [{psId=InitSystemId,psShow=show,psKind=ioKind}]
ioState = createNewIOSt [] ioDefInit ioDefAbout InitSystemId Nothing Nothing ShareGUI documentInterface ioKind ioState = createNewIOSt [] ioDefInit ioDefAbout InitSystemId Nothing Nothing ShareGUI documentInterface ioKind
// groupIO = openGroupIO ioState local public
// initGroups = toRR [] [groupIO]
initContext` :: !*World -> (!Context,!*OSToolbox) initContext` :: !*World -> (!Context,!*OSToolbox)
initContext` world initContext` world
...@@ -147,7 +117,6 @@ initContext` world ...@@ -147,7 +117,6 @@ initContext` world
= ( { cEnvs = initEnvs = ( { cEnvs = initEnvs
, cProcessStack = ioStack , cProcessStack = ioStack
, cMaxIONr = InitSystemId , cMaxIONr = InitSystemId
// , cGroups = initGroups
, cProcesses = toRR [] [] , cProcesses = toRR [] []
, cModalProcess = initModalId , cModalProcess = initModalId
, cReceiverTable = initialReceiverTable , cReceiverTable = initialReceiverTable
...@@ -162,7 +131,6 @@ initContext` world ...@@ -162,7 +131,6 @@ initContext` world
where where
initModalId = Nothing initModalId = Nothing
ioStack = [] ioStack = []
// initGroups = toRR [] []
createNewIOSt :: ![ProcessAttribute (PSt .l)] !(ProcessInit (PSt .l)) String !SystemId !(Maybe SystemId) createNewIOSt :: ![ProcessAttribute (PSt .l)] !(ProcessInit (PSt .l)) String !SystemId !(Maybe SystemId)
!(Maybe GUIShare) !Bool !DocumentInterface !ProcessKind !(Maybe GUIShare) !Bool !DocumentInterface !ProcessKind
...@@ -204,7 +172,7 @@ where ...@@ -204,7 +172,7 @@ where
= (not continue,context) = (not continue,context)
handleContextOSEvent :: !OSEvent !Context -> (![Int],!Context) handleContextOSEvent :: !OSEvent !Context -> (![Int],!Context)
handleContextOSEvent osEvent context=:{cProcessStack,/*cGroups,*/cProcesses,cReceiverTable,cTimerTable,cOSTime,cOSToolbox} handleContextOSEvent osEvent context=:{cProcessStack,cProcesses,cReceiverTable,cTimerTable,cOSTime,cOSToolbox}
// PA: shift the time in the timertable. // PA: shift the time in the timertable.
# (ostime,tb) = OSGetTime cOSToolbox # (ostime,tb) = OSGetTime cOSToolbox
timeshift = toInt (ostime-cOSTime) timeshift = toInt (ostime-cOSTime)
...@@ -212,9 +180,8 @@ handleContextOSEvent osEvent context=:{cProcessStack,/*cGroups,*/cProcesses,cRec ...@@ -212,9 +180,8 @@ handleContextOSEvent osEvent context=:{cProcessStack,/*cGroups,*/cProcesses,cRec
// PA: determine whether a TimerEvent or ASyncMessage can be generated // PA: determine whether a TimerEvent or ASyncMessage can be generated
(schedulerEvent,receivertable,timertable) (schedulerEvent,receivertable,timertable)
= toSchedulerEvent osEvent cReceiverTable timertable cOSTime = toSchedulerEvent osEvent cReceiverTable timertable cOSTime
//groups = resetRR cGroups
processes = resetRR cProcesses processes = resetRR cProcesses
# context = {context & /*cGroups=groups,*/cProcesses=processes,cReceiverTable=receivertable,cTimerTable=timertable,cOSTime=ostime,cOSToolbox=tb} # context = {context & cProcesses=processes,cReceiverTable=receivertable,cTimerTable=timertable,cOSTime=ostime,cOSToolbox=tb}
# (schedulerEvent,context) = handleEventForContext False schedulerEvent context # (schedulerEvent,context) = handleEventForContext False schedulerEvent context
replyToOS = case schedulerEvent of replyToOS = case schedulerEvent of
(ScheduleOSEvent _ reply) -> reply (ScheduleOSEvent _ reply) -> reply
...@@ -225,10 +192,9 @@ handleContextOSEvent osEvent context=:{cProcessStack,/*cGroups,*/cProcesses,cRec ...@@ -225,10 +192,9 @@ handleContextOSEvent osEvent context=:{cProcessStack,/*cGroups,*/cProcesses,cRec
| oldTopIO==newTopIO || not newTopIOVis | oldTopIO==newTopIO || not newTopIOVis
= (replyToOS,context) = (replyToOS,context)
| otherwise | otherwise
// # (groups,context) = ContextGetGroups context
# (processes,context) = ContextGetProcesses context # (processes,context) = ContextGetProcesses context
# (ioStack,/*groups*/processes) = activateTopOfGroups newTopIO ioStack (resetRR /*groups*/processes) # (ioStack,processes) = activateTopOfGroups newTopIO ioStack (resetRR processes)
= (replyToOS,{context & cProcessStack=ioStack,/*cGroups=groups*/cProcesses=processes}) = (replyToOS,{context & cProcessStack=ioStack,cProcesses=processes})
/* PA: new function: /* PA: new function:
...@@ -293,19 +259,19 @@ handleEventForContext eventDone schedulerEvent context=:{cProcesses=processes} ...@@ -293,19 +259,19 @@ handleEventForContext eventDone schedulerEvent context=:{cProcesses=processes}
= handleEventForLocalIO eventDone schedulerEvent process {context & cProcesses=processes} = handleEventForLocalIO eventDone schedulerEvent process {context & cProcesses=processes}
= handleEventForContext eventDone schedulerEvent {context & cProcesses=adddoneRR process context.cProcesses} = handleEventForContext eventDone schedulerEvent {context & cProcesses=adddoneRR process context.cProcesses}
where where
processQuitted :: !LocalIO -> (!Bool,!LocalIO) processQuitted :: !CProcess -> (!Bool,!CProcess)
processQuitted localIO processQuitted localIO
# (closed,ioState) = IOStClosed localIO.localIOSt # (closed,ioState) = IOStClosed localIO.localIOSt
= (closed,{localIO & localIOSt=ioState}) = (closed,{localIO & localIOSt=ioState})
processModal :: !LocalIO -> (!Bool,!LocalIO) processModal :: !CProcess -> (!Bool,!CProcess)
processModal localIO processModal localIO
# (optModal,ioState)= IOStGetIOIsModal localIO.localIOSt # (optModal,ioState)= IOStGetIOIsModal localIO.localIOSt
# (myId,ioState) = IOStGetIOId ioState # (myId,ioState) = IOStGetIOId ioState
= (isJust optModal && myId==fromJust optModal,{localIO & localIOSt=ioState}) = (isJust optModal && myId==fromJust optModal,{localIO & localIOSt=ioState})
handleEventForLocalIO :: !Bool !SchedulerEvent !LocalIO !Context handleEventForLocalIO :: !Bool !SchedulerEvent !CProcess !Context
-> (!Bool,!SchedulerEvent,!LocalIO,!Context) -> (!Bool,!SchedulerEvent,!CProcess,!Context)
handleEventForLocalIO eventDone schedulerEvent {localState=opt_local,localIOSt=ioState} context handleEventForLocalIO eventDone schedulerEvent {localState=opt_local,localIOSt=ioState} context
# (runtime,ioState) = IOStGetRuntimeState ioState # (runtime,ioState) = IOStGetRuntimeState ioState
| fst (rsIsBlocked runtime) | fst (rsIsBlocked runtime)
...@@ -343,7 +309,7 @@ where ...@@ -343,7 +309,7 @@ where
# ioState = IOStSetRuntimeState Closed ioState # ioState = IOStSetRuntimeState Closed ioState
= {pState & io=ioState} = {pState & io=ioState}
cSwitchIn :: !.l !Context !(IOSt .l) -> (!(![*World],!Locals),!PSt .l) cSwitchIn :: !.l !Context !(IOSt .l) -> (!(![*World],!CProcesses),!PSt .l)
cSwitchIn local {cEnvs={envsEvents,envsWorld},cProcessStack,cMaxIONr,cProcesses,cModalProcess,cReceiverTable,cTimerTable,cIdTable,cOSTime,cIdSeed} ioState cSwitchIn local {cEnvs={envsEvents,envsWorld},cProcessStack,cMaxIONr,cProcesses,cModalProcess,cReceiverTable,cTimerTable,cIdTable,cOSTime,cIdSeed} ioState
# ioState = IOStSetProcessStack cProcessStack ioState # ioState = IOStSetProcessStack cProcessStack ioState
# ioState = IOStSetEvents envsEvents ioState # ioState = IOStSetEvents envsEvents ioState
...@@ -358,7 +324,7 @@ cSwitchIn local {cEnvs={envsEvents,envsWorld},cProcessStack,cMaxIONr,cProcesses, ...@@ -358,7 +324,7 @@ cSwitchIn local {cEnvs={envsEvents,envsWorld},cProcessStack,cMaxIONr,cProcesses,
# pState = {ls=local,io=ioState} # pState = {ls=local,io=ioState}
= (ioContext,pState) = (ioContext,pState)
cSwitchOut :: !(![*World],!Locals) !(PSt .l) -> (!.l,!Context,!IOSt .l) cSwitchOut :: !(![*World],!CProcesses) !(PSt .l) -> (!.l,!Context,!IOSt .l)
cSwitchOut ioContext {ls,io} cSwitchOut ioContext {ls,io}
# (ostime, ioState) = IOStGetOSTime io # (ostime, ioState) = IOStGetOSTime io
# (tt, ioState) = IOStGetTimerTable ioState # (tt, ioState) = IOStGetTimerTable ioState
...@@ -449,10 +415,10 @@ addVirtualProcess ioDefInit ioDefAbout local pState ...@@ -449,10 +415,10 @@ addVirtualProcess ioDefInit ioDefAbout local pState
# (ioStack, ioState) = IOStGetProcessStack ioState # (ioStack, ioState) = IOStGetProcessStack ioState
ioStack = pushProcessShowState {psId=nr,psShow=False,psKind=VirtualProcess} ioStack ioStack = pushProcessShowState {psId=nr,psShow=False,psKind=VirtualProcess} ioStack
# ioState = IOStSetProcessStack ioStack ioState # ioState = IOStSetProcessStack ioStack ioState
# (processes,ioState) = IOStGetLocals ioState # (processes,ioState) = IOStGetCProcesses ioState
# newIOSt = createNewIOSt [] ioDefInit ioDefAbout nr (Just parentId) guishare ShareGUI NDI VirtualProcess # newIOSt = createNewIOSt [] ioDefInit ioDefAbout nr (Just parentId) guishare ShareGUI NDI VirtualProcess
# process = openLocalIO newIOSt local # process = openLocalIO newIOSt local
# ioState = IOStSetLocals (inserttodoRR process processes) ioState # ioState = IOStSetCProcesses (inserttodoRR process processes) ioState
= {pState & io=ioState} = {pState & io=ioState}
...@@ -467,15 +433,15 @@ addInteractiveProcess pAtts ioDefInit ioDefAbout local isSubProcess documentInte ...@@ -467,15 +433,15 @@ addInteractiveProcess pAtts ioDefInit ioDefAbout local isSubProcess documentInte
# (ioStack, ioState) = IOStGetProcessStack ioState # (ioStack, ioState) = IOStGetProcessStack ioState
ioStack = pushProcessShowState {psId=nr,psShow=True,psKind=InteractiveProcess} ioStack ioStack = pushProcessShowState {psId=nr,psShow=True,psKind=InteractiveProcess} ioStack
# ioState = IOStSetProcessStack ioStack ioState # ioState = IOStSetProcessStack ioStack ioState
# (processes,ioState) = IOStGetLocals ioState # (processes,ioState) = IOStGetCProcesses ioState
parent = if isSubProcess (Just parentId) Nothing parent = if isSubProcess (Just parentId) Nothing
pAtts = filter (isProcessKindAttribute documentInterface) pAtts pAtts = filter (isProcessKindAttribute documentInterface) pAtts
# newIOSt = createNewIOSt pAtts ioDefInit ioDefAbout nr parent guishare isSubProcess documentInterface InteractiveProcess # newIOSt = createNewIOSt pAtts ioDefInit ioDefAbout nr parent guishare isSubProcess documentInterface InteractiveProcess
# process = openLocalIO newIOSt local # process = openLocalIO newIOSt local
# ioState = IOStSetLocals (inserttodoRR process processes) ioState # ioState = IOStSetCProcesses (inserttodoRR process processes) ioState
= {pState & io=ioState} = {pState & io=ioState}
openLocalIO :: !(IOSt .l) !.l -> LocalIO openLocalIO :: !(IOSt .l) !.l -> CProcess
openLocalIO ioState local openLocalIO ioState local
= { localState = Just local = { localState = Just local
, localIOSt = ioState