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

(PA) public state component removed from PSt/IOSt

parent 86e750ec
......@@ -25,8 +25,8 @@ import bounceDraw
}
:: NoState // NoState is a simple singleton type constructor
= NoState
:: *Bounce x
:== PSt Local x // Synonym for PSt
:: *Bounce
:== PSt Local // Synonym for PSt
// Create the initial interactive process:
......@@ -43,9 +43,9 @@ Start world
, bounce wIdA tIdA rIdA rIdB "Bounce A" LeftTop leftBarrelSetUp
] world
bounce :: Id Id (RId Message) (RId Message) Title ItemLoc (Barrel,[Ball]) -> ProcessGroup Process
bounce :: Id Id (RId Message) (RId Message) Title ItemLoc (Barrel,[Ball]) -> Process
bounce wId tId me you name itemLoc (barrel,balls)
= ProcessGroup 0 (Process SDI initLocal initIO [ProcessClose quit])
= Process SDI initLocal initIO [ProcessClose quit]
where
barrelDomain = barrel.bDomain
barrelSize = rectangleSize barrelDomain
......@@ -97,7 +97,7 @@ where
:+: MenuItem "Quit" [MenuFunction (noLS quit),MenuShortKey 'q']
) []
quit :: (Bounce .x) -> Bounce .x
quit :: Bounce -> Bounce
quit bounce=:{ls={talkTo}}
= closeProcess (snd (syncSend talkTo QuitBounce bounce))
......@@ -107,7 +107,7 @@ where
, TimerFunction (noLS1 (bounceBalls splitWalls))
]
where
bounceBalls :: !(![SingleWall],![SingleWall]) NrOfIntervals (Bounce .x) -> Bounce .x
bounceBalls :: !(![SingleWall],![SingleWall]) NrOfIntervals Bounce -> Bounce
bounceBalls splitWalls _ bounce=:{ls=local=:{talkTo,balls,barrel},io}
# (windowSize,io) = getWindowViewSize wId io
scale = scaleSize windowSize barrelSize
......@@ -128,10 +128,10 @@ where
(ins,outs) = splitBallsInBarrel domain ballsMoved
// receiver defines the receiver that will receive new balls and termination requests.
receiver :: *Receiver Message .ls (Bounce .x)
receiver :: *Receiver Message .ls Bounce
receiver = Receiver me (noLS1 (receive splitWalls)) []
where
receive :: !(![SingleWall],![SingleWall]) !Message !(Bounce .x) -> Bounce .x
receive :: !(![SingleWall],![SingleWall]) !Message !Bounce -> Bounce
receive (horizontal,vertical) (BallsArrive newBalls) bounce=:{ls}
#! newBalls = map correctBall newBalls
= {bounce & ls={ls & balls=newBalls++ls.balls}}
......@@ -149,7 +149,7 @@ where
= closeProcess bounce
// bounceHelp opens a dialog that tells something about this application.
bounceHelp :: (Bounce .x) -> Bounce .x
bounceHelp :: Bounce -> Bounce
bounceHelp bounce
# (okId, bounce) = accPIO openId bounce
# ((error,_),bounce)= openModalDialog undef (dDef okId) bounce
......@@ -168,7 +168,7 @@ where
]
center = (Center,NoOffset)
close :: (Bounce .x) -> Bounce .x
close :: Bounce -> Bounce
close bounce
# (Just id,bounce) = accPIO getActiveWindow bounce
# bounce = closeWindow id bounce
......
......@@ -19,7 +19,6 @@ Start world
# (ids,world) = openIds 3 world // Create 3 Id values
= startIO NDI // Evaluate an interactive process with:
NoState // no local process state
NoState // no public process state
(initialise ids) // the initialisation action
[] // only default attributes
world
......
......@@ -24,9 +24,9 @@ noFilesSelected
Start :: *World -> *World
Start world
= startIO NDI noFilesSelected 0 initIO [] world
= startIO NDI noFilesSelected initIO [] world
initIO :: (PSt Local .p) -> PSt Local .p
initIO :: (PSt Local) -> PSt Local
initIO pst
# (showid,pst) = accPIO openId pst
# (_,pst) = openDialog undef (dialog showid) pst
......@@ -48,7 +48,7 @@ where
]
) []
where
compare :: (PSt Local .p) -> PSt Local .p
compare :: (PSt Local) -> PSt Local
compare pst
# (maybeFirstFile,pst) = selectInputFile pst
| isNothing maybeFirstFile
......@@ -60,12 +60,12 @@ where
# pst = {pst & ls={name1=fromJust maybeFirstFile,name2=fromJust maybeSecondFile}}
= showdifference pst
again :: (PSt Local .p) -> PSt Local .p
again :: (PSt Local) -> PSt Local
again pst=:{ls={name1,name2}}
| name1=="" || name2=="" = compare pst
| otherwise = showdifference pst
showdifference :: (PSt Local .p) -> PSt Local .p
showdifference :: (PSt Local) -> PSt Local
showdifference pst=:{ls={name1,name2}}
# pst = closeWindow showid pst
# (files,pst) = accFiles (openfilepair (name1,name2)) pst
......
......@@ -14,7 +14,7 @@ import StdEnv, StdIO
Start :: *World -> *World
Start world
= startIO NDI NoState NoState initIO [] world
= startIO NDI NoState initIO [] world
initIO pst
# (dialogid, pst) = accPIO openId pst
......@@ -49,7 +49,7 @@ where
displayheight = 1
init = 0
upd :: Int (Int,PSt .l .p) -> (Int,PSt .l .p)
upd :: Int (Int,PSt .l) -> (Int,PSt .l)
upd dx (count,pst)
# count = count+dx
= (count,appPIO (setControlTexts [(displayId,toString count)]) pst)
= (count,appPIO (setControlText displayId (toString count)) pst)
......@@ -11,7 +11,7 @@ definition module Help
from StdString import String
from StdPSt import PSt, IOSt
showAbout :: String String (PSt .l .p) -> PSt .l .p
showAbout :: String String (PSt .l) -> PSt .l
/* showAbout opens a window:
- it has the title of the application name (argument 1),
- it displays the about information of the application (found in the helpfile, argument 2),
......@@ -20,7 +20,7 @@ showAbout :: String String (PSt .l .p) -> PSt .l .p
*/
showHelp :: String (PSt .l .p) -> PSt .l .p
showHelp :: String (PSt .l) -> PSt .l
/* showHelp opens a SDI process that displays the help information found in the helpfile
(argument 1).
*/
......@@ -53,7 +53,7 @@ fopen2 fileName mode files
- it has an Ok button that closes this window,
- it has a Help button that displays the help information (see showHelp).
*/
showAbout :: String String (PSt .l .p) -> PSt .l .p
showAbout :: String String (PSt .l) -> PSt .l
showAbout appname helpfile pState
# (okId, pState) = accPIO openId pState
# (fonts,pState) = accPIO (accScreenPicture infoFonts) pState
......@@ -74,7 +74,7 @@ showAbout appname helpfile pState
/* showHelp opens a SDI process that displays the help information found in the helpfile.
*/
showHelp :: String (PSt .l .p) -> PSt .l .p
showHelp :: String (PSt .l) -> PSt .l
showHelp helpfile pState
# (fonts,pState) = accPIO (accScreenPicture infoFonts) pState
# ((size,text),pState) = readInfo Help fonts HelpBegin HelpEnd helpfile pState
......@@ -87,7 +87,7 @@ showHelp helpfile pState
, WindowClose (noLS closeProcess)
, WindowViewDomain {zero & corner2={x=size.w,y=size.h}}
]
= openProcesses (ProcessGroup NoState (Process SDI NoState (snd o openWindow undef window) [ProcessClose closeProcess])) pState
= openProcesses (Process SDI NoState (snd o openWindow undef window) [ProcessClose closeProcess]) pState
where
hscroll curViewFrame {sliderThumb} move
= case move of
......@@ -133,7 +133,7 @@ where
// Determine the line height and leading of a given font:
getFontHeightAndAscent :: Fonts (PSt .l .p) -> (((Int,Int),(Int,Int)),PSt .l .p)
getFontHeightAndAscent :: Fonts (PSt .l) -> (((Int,Int),(Int,Int)),PSt .l)
getFontHeightAndAscent fonts pState
# ((normal,large),pState) = accPIO (accScreenPicture (getmetrics fonts)) pState
= (((fontLineHeight normal,normal.fAscent), (fontLineHeight large,large.fAscent)),pState)
......@@ -147,7 +147,7 @@ where
// Reading and pre-processing of the file containing the about- and help-info. */
readInfo :: Bool Fonts String String String (PSt .l .p) -> ((Size,[InfoLine]),PSt .l .p)
readInfo :: Bool Fonts String String String (PSt .l) -> ((Size,[InfoLine]),PSt .l)
readInfo help fonts begin end filename pState
# (metrics, pState) = getFontHeightAndAscent fonts pState
# ((succes,file),pState) = accFiles (fopen2 (applicationpath filename) FReadText) pState
......@@ -166,14 +166,14 @@ readInfo help fonts begin end filename pState
where
errpref = "The help file \'"+++filename+++"\' "
processInfoStrings :: Fonts ((Int,Int),(Int,Int)) [String] (PSt .l .p) -> (InfoDef,PSt .l .p)
processInfoStrings :: Fonts ((Int,Int),(Int,Int)) [String] (PSt .l) -> (InfoDef,PSt .l)
processInfoStrings fonts ((normalHeight,normalAscent),(largeHeight,largeAscent)) lines pState
# ((size,lines),pState) = addFontToInfoLines fonts (normalHeight,largeHeight) 0 (Margin+largeAscent) lines pState
width = Margin+size.w+Margin
# (lines,pState) = seqList (map (centerInfoLine fonts.normal width) lines) pState
= (({w=width,h=size.h+Margin-largeAscent},lines),pState)
where
addFontToInfoLines :: Fonts Heights Int Int [String] (PSt .l .p) -> (InfoDef,PSt .l .p)
addFontToInfoLines :: Fonts Heights Int Int [String] (PSt .l) -> (InfoDef,PSt .l)
addFontToInfoLines fonts heights maxx maxy [line:rest] pState
# ((font,wid,hgt,line),pState) = parseInfoLine fonts heights line pState
# ((size,rest), pState) = addFontToInfoLines fonts heights (max maxx wid) (maxy+hgt) rest pState
......@@ -183,7 +183,7 @@ where
If line == '\{L,b,B,c,C,d,D}'+++line1 then a special font is used, otherwise the default font is used.
parseInfoLine also calculates the width and height of the line.
*/
parseInfoLine :: Fonts Heights String (PSt .l .p) -> ((InfoFontDef,Int,Int,String),PSt .l .p)
parseInfoLine :: Fonts Heights String (PSt .l) -> ((InfoFontDef,Int,Int,String),PSt .l)
parseInfoLine fonts=:{normal,large,bold,large_bold} heights=:(nhgt,lhgt) line pState
# linelen = size line
| linelen<2 || line.[0]<>'\\'
......@@ -205,7 +205,7 @@ where
addFontToInfoLines _ _ maxx maxy _ pState
= (({w=maxx,h=maxy},[]),pState)
centerInfoLine :: Font Int InfoLine (PSt .l .p) -> (InfoLine,PSt .l .p)
centerInfoLine :: Font Int InfoLine (PSt .l) -> (InfoLine,PSt .l)
centerInfoLine nft maxx info=:(inft=:NoFont centered,x,y,line) pState
| not centered
= (info,pState)
......
......@@ -20,17 +20,17 @@ from StdId import Id
, score :: !Int
}
readHiScores :: !String !*Files -> (!(!*File,!HiScores),!*Files)
readHiScores :: !String !*Files -> (!(!*File,!HiScores),!*Files)
// Reads high score file from disk.
writeHiScores :: !*File !HiScores !*Files -> *Files
writeHiScores :: !*File !HiScores !*Files -> *Files
// Writes high scores to disk.
itsAHighScore :: !Int !Int !HiScores -> Bool
itsAHighScore :: !Int !Int !HiScores -> Bool
// Determines whether, given the number of high scores, a given score is actually a new high score.
addScore :: !Int !HiScore !HiScores -> HiScores
addScore :: !Int !HiScore !HiScores -> HiScores
// Add, given the number of high scores, a HiScore to the current list of high scores.
showHiScores :: String !HiScores !(PSt .l .p) -> PSt .l .p
showHiScores :: String !HiScores !(PSt .l) -> PSt .l
// Display current high scores to user in a modal dialog with given Id.
......@@ -91,7 +91,7 @@ where
// Display high scores in a modal dialog to the user:
showHiScores :: String !HiScores !(PSt .l .p) -> PSt .l .p
showHiScores :: String !HiScores !(PSt .l) -> PSt .l
showHiScores header highs pState=:{io}
# (okId,io) = openId io
# (wId, io) = openId io
......
......@@ -40,13 +40,13 @@ instance Controls ListBoxControl
openListBoxId :: !*env -> (!ListBoxId,!*env) | Ids env
getListBoxSelection :: !ListBoxId !(PSt .l .p) -> (!(!Bool,![(String,!Index)]),!PSt .l .p)
setListBoxSelection :: !ListBoxId ![Index] !(PSt .l .p) -> PSt .l .p
getListBoxItems :: !ListBoxId !(PSt .l .p) -> (!(!Bool,![String]),!PSt .l .p)
openListBoxItems :: !ListBoxId !Index ![String] !(PSt .l .p) -> PSt .l .p
closeListBoxItems :: !ListBoxId ![Index] !(PSt .l .p) -> PSt .l .p
showListBoxControl :: !ListBoxId !(IOSt .l .p) -> IOSt .l .p
hideListBoxControl :: !ListBoxId !(IOSt .l .p) -> IOSt .l .p
enableListBoxControl :: !ListBoxId !(IOSt .l .p) -> IOSt .l .p
disableListBoxControl :: !ListBoxId !(IOSt .l .p) -> IOSt .l .p
getListBoxSelection :: !ListBoxId !(PSt .l) -> (!(!Bool,![(String,!Index)]),!PSt .l)
setListBoxSelection :: !ListBoxId ![Index] !(PSt .l) -> PSt .l
getListBoxItems :: !ListBoxId !(PSt .l) -> (!(!Bool,![String]),!PSt .l)
openListBoxItems :: !ListBoxId !Index ![String] !(PSt .l) -> PSt .l
closeListBoxItems :: !ListBoxId ![Index] !(PSt .l) -> PSt .l
showListBoxControl :: !ListBoxId !(IOSt .l) -> IOSt .l
hideListBoxControl :: !ListBoxId !(IOSt .l) -> IOSt .l
enableListBoxControl :: !ListBoxId !(IOSt .l) -> IOSt .l
disableListBoxControl :: !ListBoxId !(IOSt .l) -> IOSt .l
......@@ -87,7 +87,7 @@ where
isListBoxControlAttribute _ = False
instance Controls ListBoxControl where
controlToHandles :: !(ListBoxControl .ls (PSt .l .p)) (PSt .l .p) -> ([ControlState .ls (PSt .l .p)],PSt .l .p)
controlToHandles :: !(ListBoxControl .ls (PSt .l)) (PSt .l) -> ([ControlState .ls (PSt .l)],PSt .l)
controlToHandles {listboxState=listboxState=:{items,size,listboxId,fontInfo},listboxAtts} pst
= controlToHandles imp pst
where
......@@ -198,7 +198,7 @@ instance Controls ListBoxControl where
mouseFilter _ = False
// The mouse either sets, adds, or removes items to the selection:
mouse :: (IdFun *(.x,PSt .l .p)) MouseState *(*(ListBoxState,.x),PSt .l .p) -> *(*(ListBoxState,.x),PSt .l .p)
mouse :: (IdFun *(.x,PSt .l)) MouseState *(*(ListBoxState,.x),PSt .l) -> *(*(ListBoxState,.x),PSt .l)
mouse f (MouseDown pos {shiftDown} _) ((listboxState,ls),pState)
# listboxState = {listboxState & selection=okSelection}
# newLook = customlook listboxState
......@@ -220,7 +220,7 @@ instance Controls ListBoxControl where
// The receiver function:
receiver :: MessageIn *(*(ListBoxState,.x),PSt .l .p) -> (MessageOut,*(*(ListBoxState,.x),PSt .l .p))
receiver :: MessageIn *(*(ListBoxState,.x),PSt .l) -> (MessageOut,*(*(ListBoxState,.x),PSt .l))
// Return the current selection:
receiver InGetSelection ((listboxState=:{items,selection},ls),pState)
......@@ -290,7 +290,7 @@ openListBoxId env
// The functions below take care of the proper communication with the receiver that
// belongs to the listbox control.
getListBoxSelection :: !ListBoxId !(PSt .l .p) -> (!(!Bool,![(String,!Index)]),!PSt .l .p)
getListBoxSelection :: !ListBoxId !(PSt .l) -> (!(!Bool,![(String,!Index)]),!PSt .l)
getListBoxSelection {r2Id} pState
# ((_,maybe_out),pState) = syncSend2 r2Id InGetSelection pState
| isNothing maybe_out
......@@ -301,11 +301,11 @@ getListBoxSelection {r2Id} pState
| otherwise
= (result,pState)
setListBoxSelection :: !ListBoxId ![Index] !(PSt .l .p) -> PSt .l .p
setListBoxSelection :: !ListBoxId ![Index] !(PSt .l) -> PSt .l
setListBoxSelection {r2Id} selection pState
= snd (syncSend2 r2Id (InSetSelection selection) pState)
getListBoxItems :: !ListBoxId !(PSt .l .p) -> (!(!Bool,![String]),!PSt .l .p)
getListBoxItems :: !ListBoxId !(PSt .l) -> (!(!Bool,![String]),!PSt .l)
getListBoxItems {r2Id} pState
# ((_,maybe_out),pState) = syncSend2 r2Id InGetItems pState
| isNothing maybe_out
......@@ -316,24 +316,24 @@ getListBoxItems {r2Id} pState
| otherwise
= (result,pState)
openListBoxItems :: !ListBoxId !Index ![String] !(PSt .l .p) -> PSt .l .p
openListBoxItems :: !ListBoxId !Index ![String] !(PSt .l) -> PSt .l
openListBoxItems {r2Id} index items pState
= snd (syncSend2 r2Id (InOpenItems index items) pState)
closeListBoxItems :: !ListBoxId ![Index] !(PSt .l .p) -> PSt .l .p
closeListBoxItems :: !ListBoxId ![Index] !(PSt .l) -> PSt .l
closeListBoxItems {r2Id} items pState
= snd (syncSend2 r2Id (InCloseItems items) pState)
showListBoxControl :: !ListBoxId !(IOSt .l .p) -> IOSt .l .p
showListBoxControl :: !ListBoxId !(IOSt .l) -> IOSt .l
showListBoxControl {outerCompoundId} ioState = showControls [outerCompoundId] ioState
hideListBoxControl :: !ListBoxId !(IOSt .l .p) -> IOSt .l .p
hideListBoxControl :: !ListBoxId !(IOSt .l) -> IOSt .l
hideListBoxControl {outerCompoundId} ioState = hideControls [outerCompoundId] ioState
enableListBoxControl :: !ListBoxId !(IOSt .l .p) -> IOSt .l .p
enableListBoxControl :: !ListBoxId !(IOSt .l) -> IOSt .l
enableListBoxControl {outerCompoundId} ioState = enableControls [outerCompoundId] ioState
disableListBoxControl :: !ListBoxId !(IOSt .l .p) -> IOSt .l .p
disableListBoxControl :: !ListBoxId !(IOSt .l) -> IOSt .l
disableListBoxControl {outerCompoundId} ioState = disableControls [outerCompoundId] ioState
......
......@@ -17,6 +17,6 @@ import StdWindow
instance Dialogs Notice
openNotice :: !(Notice .ls (PSt .l .p)) !(PSt .l .p) -> PSt .l .p
openNotice :: !(Notice .ls (PSt .l)) !(PSt .l) -> PSt .l
/* openNotice can be used to create a Notice without having to bother about the ErrorReport result.
*/
......@@ -23,17 +23,17 @@ import StdEnv, StdIO
/* Notices are defined as a new instance of the Dialogs type constructor class.
*/
instance Dialogs Notice where
openDialog :: .ls !(Notice .ls (PSt .l .p)) !(PSt .l .p) -> (!ErrorReport,!PSt .l .p)
openDialog ls notice ps
# (wId, ps) = accPIO openId ps
# (okId,ps) = accPIO openId ps
= openDialog ls (noticeToDialog wId okId notice) ps
openDialog :: .ls !(Notice .ls (PSt .l)) !(PSt .l) -> (!ErrorReport,!PSt .l)
openDialog ls notice pst
# (wId, pst) = accPIO openId pst
# (okId,pst) = accPIO openId pst
= openDialog ls (noticeToDialog wId okId notice) pst
openModalDialog :: .ls !(Notice .ls (PSt .l .p)) !(PSt .l .p) -> (!(!ErrorReport,!Maybe .ls),!PSt .l .p)
openModalDialog ls notice ps
# (wId,ps) = accPIO openId ps
# (okId,ps) = accPIO openId ps
= openModalDialog ls (noticeToDialog wId okId notice) ps
openModalDialog :: .ls !(Notice .ls (PSt .l)) !(PSt .l) -> (!(!ErrorReport,!Maybe .ls),!PSt .l)
openModalDialog ls notice pst
# (wId,pst) = accPIO openId pst
# (okId,pst) = accPIO openId pst
= openModalDialog ls (noticeToDialog wId okId notice) pst
getDialogType :: (Notice .ls .pst) -> WindowType
getDialogType notice
......@@ -41,17 +41,17 @@ instance Dialogs Notice where
/* A specialised version that ignores the error report.
*/
openNotice :: !(Notice .ls (PSt .l .p)) !(PSt .l .p) -> PSt .l .p
openNotice notice ps
= snd (openModalDialog undef notice ps)
openNotice :: !(Notice .ls (PSt .l)) !(PSt .l) -> PSt .l
openNotice notice pst
= snd (openModalDialog undef notice pst)
/* noticeToDialog converts a Notice expression into a Dialog expression.
*/
noticeToDialog :: Id Id (Notice .ls (PSt .l .p))
noticeToDialog :: Id Id (Notice .ls (PSt .l))
-> Dialog (:+: (CompoundControl (ListLS TextControl))
(:+: ButtonControl
(ListLS ButtonControl)
)) .ls (PSt .l .p)
)) .ls (PSt .l)
noticeToDialog wId okId (Notice texts (NoticeButton text f) buttons)
= Dialog ""
( CompoundControl
......
......@@ -46,7 +46,6 @@ startHanoi :: ([Id],*World) -> *World
startHanoi ([runID,haltID,contID,timerID,windowID:_],world)
= startIO SDI
(initTowers 0) // The initial local process state
NoState // The initial public process state
initialise // The initialisation action
[ProcessClose closeProcess] // Only default process attributes
world
......@@ -107,7 +106,7 @@ where
]
// The function for the Run command.
run :: Int (PSt Towers .p) -> PSt Towers .p
run :: Int (PSt Towers) -> PSt Towers
run nr_disks hanoi=:{io}
# io = disableMenuElements [runID,contID] io
# io = enableMenuElements [haltID] io
......@@ -118,7 +117,7 @@ where
towers = initTowers nr_disks
// The function for the Halt command.
halt :: (PSt Towers .p) -> PSt Towers .p
halt :: (PSt Towers) -> PSt Towers
halt hanoi=:{io}
# io = enableMenuElements [runID,contID] io
# io = disableMenuElements [haltID] io
......@@ -126,7 +125,7 @@ where
= {hanoi & io=io}
// The function for the Continue command.
continue :: (PSt Towers .p) -> PSt Towers .p
continue :: (PSt Towers) -> PSt Towers
continue hanoi=:{io}
# io = disableMenuElements [runID,contID] io
# io = enableMenuElements [haltID] io
......@@ -134,13 +133,13 @@ where
= {hanoi & io=io}
// Set the speed of a (possibly running) Hanoi simulation.
setSpeed :: Int (PSt Towers .p) -> PSt Towers .p
setSpeed :: Int (PSt Towers) -> PSt Towers
setSpeed speed hanoi=:{io}
# io = setTimerInterval timerID speed io
= {hanoi & io=io}
// The timer function: take a move from the list of all moves and show it in the window.
stepHanoi :: NrOfIntervals (PSt Towers .p) -> PSt Towers .p
stepHanoi :: NrOfIntervals (PSt Towers) -> PSt Towers
stepHanoi _ hanoi=:{ls={moves=[]},io}
# io = enableMenuElements [runID] io
# io = disableMenuElements [haltID] io
......
......@@ -12,6 +12,6 @@ import StdEnv, StdIO
Start :: *World -> *World
Start world
= startIO NDI 0 0 (snd o openDialog undef hello) [] world
= startIO NDI 0 (snd o openDialog undef hello) [] world
where
hello = Dialog "" (TextControl "Hello world!" []) [WindowClose (noLS closeProcess)]
......@@ -29,7 +29,6 @@ Start world
startLife :: ([Id],*World) -> *World
startLife ([eraseID,playID,haltID,stepID,windowID,timerID],world)
= startIO SDI initialLife
NoState
initialise
[ProcessClose closeProcess]
world
......@@ -121,7 +120,7 @@ where
) []
// play starts the computation of successive generations given the current set of life cells.
play :: (PSt Life .p) -> PSt Life .p
play :: (PSt Life) -> PSt Life
play life
= appListPIO
[ disableWindowMouse windowID
......@@ -131,7 +130,7 @@ where
] life
// halt stops the computation of successive generations, but does not change the current generation.
halt :: (PSt Life .p) -> PSt Life .p
halt :: (PSt Life) -> PSt Life
halt life
= appListPIO
[ enableWindowMouse windowID
......@@ -141,7 +140,7 @@ where
] life
// step calculates the next generation and displays it.
step :: (PSt Life .p) -> PSt Life .p
step :: (PSt Life) -> PSt Life
step life=:{ls=state=:{gen,size},io}
# state = {state & gen=next}
# io = appWindowPicture windowID render io
......@@ -152,14 +151,14 @@ where
render = drawCells (drawCell size) next o (drawCells (eraseCell size) died)
// erase sets the current generation to empty and clears the window.
erase :: (PSt Life .p) -> PSt Life .p
erase :: (PSt Life) -> PSt Life
erase life=:{ls=state,io}
# state = {state & gen=makeGeneration}
# io = setWindowLook windowID True (True,look state) io
= {life & ls=state, io=io}
// newsize changes the size in which life cells are rendered and redraws the window.
newsize :: Int (PSt Life .p) -> PSt Life .<