Commit 322cc2bf authored by Rinus Plasmeijer's avatar Rinus Plasmeijer
Browse files

*** empty log message ***

parent 6f6f8b6d
......@@ -22,25 +22,25 @@ loginhandling hst
# (mbloginState,loginBody,hst) = loginPage loginStates.value hst // set up a login page
= case mbloginState of
Nothing = (loginBody,hst) // show login page if not yet logged in
Just loginState = doMemberPage loginState loginStates.value hst // show member page if logged in
Just loginState = doConfPortal loginState loginStates.value hst // show member page if logged in
// iData defs
doMemberPage :: (LoginState State) (LoginStates State) *HSt -> ([BodyTag],*HSt)
doMemberPage (login,state) states hst
# (navButtons,hst) = if (isRoot state) rootNavigation memberNavigation hst // setup proper set of navigation buttons
# (currPage,hst) = currPageStore state.initialPage navButtons.value hst // determine current page to display
# (states,navBody,hst) = doNavigation (login,state) states currPage.value hst // and show the corresponding page
# (_,hst) = LoginStatesStore (\_.states) hst // store new states in global database
doConfPortal :: (LoginState State) (LoginStates State) *HSt -> ([BodyTag],*HSt)
doConfPortal (login,state) states hst
# (navButtons,hst) = navigationButtons state.role hst // setup proper set of navigation buttons
# (currPage,hst) = currPageStore (homePage state.role) navButtons.value hst // determine current page to display
# (states,navBody,hst) = showCurrPage (login,state) states currPage.value hst // and show the corresponding page
# (_,hst) = LoginStatesStore (\_.states) hst // store the new resulting state in global database
= ( [ BodyTag navButtons.form
, Br
, Hr []
, BodyTag navBody
] , hst)
where
rootNavigation hst = ListFuncBut (Init, sFormId "rootNavigation" mbuttons) hst
navigationButtons role hst = ListFuncBut (Init, sFormId "navigation" (navButtons role)) hst
where
mbuttons =
navButtons ConfManager =
[ (LButton defpixel "RootHome", \_.RootHomePage)
, (LButton defpixel "ChangePsswrd", \_.ChangePassword)
, (LButton defpixel "ChangeInfo", \_.ChangeInfo)
......@@ -49,23 +49,20 @@ where
, (LButton defpixel "AssignConflict", \_.AssignConflict)
, (LButton defpixel "ModStates", \_.ModifyStates)
]
memberNavigation hst = ListFuncBut (Init, sFormId "memberNavigation" mbuttons) hst
where
mbuttons =
navButtons Referee =
[ (LButton defpixel "Home", \_.MemberHomePage)
, (LButton defpixel "ChangePsswrd", \_.ChangePassword)
, (LButton defpixel "ChangeInfo", \_.ChangeInfo)
, (LButton defpixel "ListPapers", \_.ListPapers)
]
doNavigation :: (LoginState State) (LoginStates State) CurrPage *HSt -> (LoginStates State,[BodyTag],*HSt)
doNavigation loginState=:(login,state) states currPage hst
showCurrPage :: (LoginState State) (LoginStates State) CurrPage *HSt -> (LoginStates State,[BodyTag],*HSt)
showCurrPage loginState=:(login,state) states currPage hst
# (papers,hst) = papersStore [initPaper (toString i) \\ i <- [0..3]] id hst
# (states,body,hst)
= case currPage of
RootHomePage -> states <~ rootHomePage hst
ModifyStates -> modifyStatesPage loginState states hst
ModifyStates -> modifyStatesPage (mkLogin "" "",initialRefereeState) states hst
AssignPapers -> assignPapersPage states papers.value hst
AssignConflict -> assignConflictsPage states papers.value hst
......@@ -103,8 +100,8 @@ changePasswrdPage loginState=:(login,state) states hst
# (mblogin,body,hst) = changePasswordPage login hst
= case mblogin of
Nothing -> (states, body, hst)
Just nlogin -> doNavigation (nlogin,state)
(changePassword loginState nlogin.password states) state.initialPage hst
Just nlogin -> showCurrPage (nlogin,state)
(changePassword loginState nlogin.password states) (homePage state.role) hst
// small utility stuf
......
Version: 1.4
Global
Built: True
Built: False
Target: Web Applications
Exec: {Project}\ConfManager.exe
CodeGen
......@@ -61,11 +61,11 @@ MainModule
DclOpen: False
Icl
WindowPosition
X: 10
Y: 10
SizeX: 884
SizeY: 614
IclOpen: False
X: 0
Y: 657
SizeX: 0
SizeY: 0
IclOpen: True
LastModified: No 0 0 0 0 0 0
OtherModules
Module
......@@ -4186,8 +4186,8 @@ OtherModules
WindowPosition
X: 66
Y: 40
SizeX: 820
SizeY: 450
SizeX: 996
SizeY: 538
IclOpen: False
LastModified: No 0 0 0 0 0 0
Module
......@@ -4268,10 +4268,10 @@ OtherModules
DclOpen: False
Icl
WindowPosition
X: 69
Y: 33
SizeX: 799
SizeY: 538
X: 269
Y: 0
SizeX: 925
SizeY: 587
IclOpen: False
LastModified: No 0 0 0 0 0 0
Module
......@@ -4321,14 +4321,14 @@ OtherModules
Y: 132
SizeX: 928
SizeY: 358
DclOpen: False
DclOpen: True
Icl
WindowPosition
X: 17
Y: 0
X: 206
Y: 37
SizeX: 882
SizeY: 574
IclOpen: False
IclOpen: True
LastModified: No 0 0 0 0 0 0
Module
Name: confIData
......@@ -4354,8 +4354,8 @@ OtherModules
WindowPosition
X: 69
Y: 34
SizeX: 796
SizeY: 410
SizeX: 955
SizeY: 527
IclOpen: False
LastModified: No 0 0 0 0 0 0
Static
......@@ -4518,7 +4518,12 @@ Static
Path: {Application}\Libraries\StdEnv\Clean System Files\_startup2.o
Path: {Application}\Libraries\StdEnv\Clean System Files\_system.o
Path: {Project}\Clean System Files\ConfManager.o
Path: {Project}\Clean System Files\loginAdminIData.o
Path: {Application}\Libraries\GEC\GEC Implementation\Clean System Files\StdArrow.o
Path: {Application}\Libraries\htmlGEC\Clean System Files\htmlArrow.o
Path: {Application}\Libraries\htmlGEC\Clean System Files\htmlFormlib.o
Path: {Application}\Libraries\StdLib\Clean System Files\StdListExtensions.o
Path: {Application}\Libraries\StdLib\Clean System Files\StdLib.o
Path: {Application}\Libraries\htmlGEC\Clean System Files\httpUtil.o
Path: {Application}\Libraries\Tcp\Clean System Files\StdStringChannels.o
Path: {Application}\Libraries\Tcp\Clean System Files\StdEventTCP.o
......@@ -4604,13 +4609,40 @@ Static
Path: {Application}\Libraries\Tcp\Clean System Files\tcp.o
Path: {Application}\Libraries\Tcp\Clean System Files\StdChannels.o
Path: {Application}\Libraries\Tcp\Clean System Files\StdTCP.o
Path: {Application}\Libraries\htmlGEC\Clean System Files\httpServer.o
Path: {Application}\Libraries\StdLib\Clean System Files\StdArrayExtensions.o
Path: {Application}\Libraries\Dynamics\general\Clean System Files\md5.o
Path: {Application}\Libraries\Dynamics\implementation\Clean System Files\DynID.o
Path: {Application}\Libraries\Dynamics\implementation\windows\Clean System Files\memory.o
Path: {Application}\Libraries\Dynamics\implementation\windows\Clean System Files\memory_mapped_files.o
Path: {Application}\Libraries\Dynamics\implementation\Clean System Files\StdDynamicVersion.o
Path: {Application}\Libraries\Dynamics\implementation\windows\Clean System Files\shared_buffer.o
Path: {Application}\Libraries\Dynamics\implementation\windows\Clean System Files\DynamicLinkerInterface.o
Path: {Application}\Libraries\Dynamics\general\Clean System Files\BitSet.o
Path: {Application}\Libraries\Dynamics\implementation\Clean System Files\StdDynamicLowLevelInterface.o
Path: {Application}\Libraries\Dynamics\implementation\Clean System Files\DynamicUtilities.o
Path: {Application}\Libraries\Dynamics\general\Clean System Files\EnDecode.o
Path: {Application}\Libraries\Dynamics\general\Clean System Files\DefaultElem.o
Path: {Application}\Libraries\Dynamics\implementation\Clean System Files\StdDynamicTypes.o
Path: {Application}\Libraries\Dynamics\implementation\windows\Clean System Files\DynamicGraphConversion.o
Path: {Application}\Libraries\Dynamics\extension\Clean System Files\StdDynamic.o
Path: {Application}\Libraries\htmlGEC\graph_copy\Clean System Files\dynamic_string.o
Path: {Application}\Libraries\StdLib\Clean System Files\StdLibMisc.o
Path: {Application}\Libraries\Directory\Clean System Files\Directory.o
Path: {Application}\Libraries\htmlGEC\Clean System Files\htmlTrivial.o
Path: {Application}\Libraries\htmlGEC\Clean System Files\EncodeDecode.o
Path: {Application}\Libraries\htmlGEC\Clean System Files\iDataState.o
Path: {Application}\Libraries\Generics\Clean System Files\GenParse.o
Path: {Application}\Libraries\Generics\Clean System Files\GenPrint.o
Path: {Application}\Libraries\StdLib\Clean System Files\StdMaybe.o
Path: {Application}\Libraries\htmlGEC\Clean System Files\htmlFormData.o
Path: {Application}\Libraries\htmlGEC\Clean System Files\htmlStylelib.o
Path: {Application}\Libraries\ArgEnvWindows\Clean System Files\ArgEnv.o
Path: {Application}\Libraries\StdEnv\Clean System Files\StdGeneric.o
Path: {Application}\Libraries\htmlGEC\Clean System Files\PrintUtil.o
Path: {Application}\Libraries\htmlGEC\Clean System Files\htmlStyleDef.o
Path: {Application}\Libraries\htmlGEC\Clean System Files\htmlDataDef.o
Path: {Application}\Libraries\htmlGEC\Clean System Files\htmlHandler.o
Path: {Application}\Libraries\htmlGEC\Clean System Files\StdHtml.o
Path: {Application}\Libraries\StdEnv\Clean System Files\StdFunc.o
Path: {Application}\Libraries\StdEnv\Clean System Files\StdCharList.o
......@@ -4633,42 +4665,10 @@ Static
Path: {Application}\Libraries\StdEnv\Clean System Files\StdOverloaded.o
Path: {Application}\Libraries\Dynamics\implementation\windows\Clean System Files\_SystemDynamic.o
Path: {Application}\Libraries\Dynamics\extension\Clean System Files\StdCleanTypes.o
Path: {Application}\Libraries\htmlGEC\Clean System Files\htmlHandler.o
Path: {Application}\Libraries\htmlGEC\Clean System Files\htmlStyleDef.o
Path: {Application}\Libraries\StdEnv\Clean System Files\StdGeneric.o
Path: {Application}\Libraries\ArgEnvWindows\Clean System Files\ArgEnv.o
Path: {Application}\Libraries\htmlGEC\Clean System Files\htmlStylelib.o
Path: {Application}\Libraries\StdLib\Clean System Files\StdMaybe.o
Path: {Application}\Libraries\Generics\Clean System Files\GenPrint.o
Path: {Application}\Libraries\Generics\Clean System Files\GenParse.o
Path: {Application}\Libraries\htmlGEC\Clean System Files\iDataState.o
Path: {Application}\Libraries\htmlGEC\Clean System Files\htmlTrivial.o
Path: {Application}\Libraries\Dynamics\extension\Clean System Files\StdDynamic.o
Path: {Application}\Libraries\Dynamics\implementation\windows\Clean System Files\DynamicGraphConversion.o
Path: {Application}\Libraries\Dynamics\implementation\Clean System Files\StdDynamicTypes.o
Path: {Application}\Libraries\Dynamics\general\Clean System Files\DefaultElem.o
Path: {Application}\Libraries\Dynamics\general\Clean System Files\EnDecode.o
Path: {Application}\Libraries\Dynamics\implementation\Clean System Files\DynamicUtilities.o
Path: {Application}\Libraries\Dynamics\implementation\Clean System Files\StdDynamicLowLevelInterface.o
Path: {Application}\Libraries\Dynamics\general\Clean System Files\BitSet.o
Path: {Application}\Libraries\Dynamics\implementation\windows\Clean System Files\DynamicLinkerInterface.o
Path: {Application}\Libraries\Dynamics\implementation\windows\Clean System Files\shared_buffer.o
Path: {Application}\Libraries\Dynamics\implementation\Clean System Files\StdDynamicVersion.o
Path: {Application}\Libraries\Dynamics\implementation\windows\Clean System Files\memory_mapped_files.o
Path: {Application}\Libraries\Dynamics\implementation\windows\Clean System Files\memory.o
Path: {Application}\Libraries\Dynamics\implementation\Clean System Files\DynID.o
Path: {Application}\Libraries\Dynamics\general\Clean System Files\md5.o
Path: {Application}\Libraries\StdLib\Clean System Files\StdArrayExtensions.o
Path: {Application}\Libraries\htmlGEC\Clean System Files\httpServer.o
Path: {Application}\Libraries\StdLib\Clean System Files\StdLib.o
Path: {Application}\Libraries\StdLib\Clean System Files\StdListExtensions.o
Path: {Application}\Libraries\htmlGEC\Clean System Files\htmlFormlib.o
Path: {Application}\Libraries\GEC\GEC Implementation\Clean System Files\StdArrow.o
Path: {Project}\Clean System Files\loginAdminIData.o
Path: {Project}\Clean System Files\loginAdmin.o
Path: {Project}\Clean System Files\confIData.o
Path: {Project}\Clean System Files\stateHandlingIData.o
Path: {Project}\Clean System Files\stateHandling.o
Path: {Project}\Clean System Files\confIData.o
Path: {Application}\Libraries\ArgEnvWindows\Clean System Files\ArgEnvC.obj
Path: {Application}\Libraries\ObjectIO\OS Windows\Clean System Files\cCrossCallFileSelectors_121.obj
Path: {Application}\Libraries\ObjectIO\OS Windows\Clean System Files\cCrossCallFont_121.obj
......
......@@ -18,10 +18,10 @@ derive gUpd []
LoginStatesStore :: !((LoginStates State) -> (LoginStates State)) *HSt -> (!Form (LoginStates State),!*HSt) // login administration database
LoginStatesStore upd hst = mkStoreForm (Init,pFormId "loginDatabase" initState) upd hst
LoginStatesStore upd hst = mkStoreForm (Init,pFormId "cf_loginDatabase" initRootLogin) upd hst
currPageStore :: !CurrPage !(CurrPage -> CurrPage) *HSt -> (!Form CurrPage,!*HSt) // current page to display
currPageStore currpage cbf hst = mkStoreForm (Init, sFormId "currPage" currpage) cbf hst
currPageStore currpage cbf hst = mkStoreForm (Init, sFormId "cf_currPage" currpage) cbf hst
papersStore :: !Papers !(Papers -> Papers) *HSt -> (!Form Papers,!*HSt) // papers to referee
papersStore papers cbf hst = mkStoreForm (Init, pFormId "papersDatabase" papers) cbf hst
papersStore papers cbf hst = mkStoreForm (Init, pFormId "cf_papersDatabase" papers) cbf hst
......@@ -15,8 +15,8 @@ loginForm (init,login) hst = mkEditForm (init,sFormId "login" login) hst
// a temperal login form used for changing passwords
loginNForm :: !String !*HSt -> (Form String,!*HSt)
loginNForm fid hst = mkEditForm (Init, nFormId fid "") hst
passwordForm :: !String !*HSt -> (Form String,!*HSt)
passwordForm fid hst = mkEditForm (Init, nFormId fid "") hst
// a login page
......@@ -36,9 +36,9 @@ loginPage loginDatabase hst
changePasswordPage :: !Login !*HSt -> (!Maybe Login,![BodyTag],!*HSt)
changePasswordPage login hst
# (oldpasswrd,hst) = loginNForm "oldpasswrd" hst
# (newpasswrd1,hst) = loginNForm "newpasswrd1" hst
# (newpasswrd2,hst) = loginNForm "newpasswrd2" hst
# (oldpasswrd,hst) = passwordForm "oldpasswrd" hst
# (newpasswrd1,hst) = passwordForm "newpasswrd1" hst
# (newpasswrd2,hst) = passwordForm "newpasswrd2" hst
| oldpasswrd.value <> login.password || newpasswrd1.value <> newpasswrd2.value || newpasswrd1.value == ""
= (Nothing, changePasswrdBody oldpasswrd newpasswrd1 newpasswrd2, hst)
# (_,hst) = loginForm (Set,mkLogin login.loginName newpasswrd1.value) hst
......@@ -62,21 +62,24 @@ where
[]
]
loginStateForm state hst = mkEditForm (Init, nFormId "la_state" (mkLogin "" "",state)) hst
addButton fun hst = simpleButton "Add" fun hst
allStates init states hst = vertlistForm (init, nFormId "la_states" states) hst
modifyStatesPage :: !(LoginState state) !(LoginStates state) !*HSt -> (!LoginStates state,![BodyTag],!*HSt)
| gForm{|*|}, gUpd{|*|}, gPrint{|*|}, gParse{|*|}, TC state
modifyStatesPage (login,state) states hst
# (nstate,hst) = mkEditForm (Init,nFormId "hliststateelem" (login,state)) hst
# (nstatebut,hst) = FuncBut (Init, sFormId "addstate" (LButton defpixel "AddLogin",id)) hst
# (hlistform,hst) = vertlistForm (Init, nFormId "hliststate" states) hst
# states = if nstatebut.changed (addLogin nstate.value states) hlistform.value
# (hlistform,hst) = vertlistForm (Set,nFormId "hliststate" states) hst
= ( states
# (nstate,hst) = loginStateForm state hst
# (addstate,hst) = addButton (\states -> addLogin nstate.value states) hst
# (ostates,hst) = allStates Init states hst
# (nstates,hst) = allStates Set (addstate.value ostates.value) hst
= ( nstates.value
, [ BodyTag nstate.form
, Br
, BodyTag nstatebut.form
, BodyTag addstate.form
, Br
, Hr []
, Br
, BodyTag hlistform.form
, BodyTag nstates.form
]
, hst)
......@@ -2,12 +2,15 @@ definition module stateHandling
import loginAdmin
:: State = { initialPage :: CurrPage // determines initial page when logged in
:: State = { role :: Role // determines initial page when logged in
, person :: Person
, papersref :: [(PaperNr, Maybe Report)]
, conflict :: [PaperNr]
}
:: Role = ConfManager
| Referee
:: CurrPage = RootHomePage // root pages
| AssignPapers
| AssignConflict
......@@ -58,11 +61,15 @@ import loginAdmin
, pdf :: String
}
initState :: (LoginStates State)
initPerson :: Person
initPaper :: String -> Paper
isRoot :: State -> Bool
initRootLogin :: (LoginStates State)
initialRootState :: State
initialRefereeState :: State
initPerson :: Person
initPaper :: String -> Paper
isManager :: State -> Bool
homePage :: Role -> CurrPage
findReports :: Int [State] -> [(Person,Maybe Report)]
......
......@@ -6,14 +6,25 @@ import loginAdmin
// state stored in login administration
initState :: (LoginStates State)
initState = [(mkLogin "root" "secret",initialRootState)]
initialRootState = { initialPage = RootHomePage
, person = initPerson
, papersref = []
, conflict = []
initRootLogin :: (LoginStates State)
initRootLogin = [(mkLogin "root" "secret",initialRootState)]
initialRootState :: State
initialRootState = { role = ConfManager
, person = initPerson
, papersref = []
, conflict = []
}
initialRefereeState :: State
initialRefereeState = { role = Referee
, person = initPerson
, papersref = []
, conflict = []
}
initPerson :: Person
initPerson = { firstName = ""
, lastName = ""
......@@ -28,11 +39,15 @@ initPaper s = { title = "paper " +++ s
, pdf = "download pdf here"
}
isRoot :: State -> Bool
isRoot state = case state.initialPage of
RootHomePage -> True
isManager :: State -> Bool
isManager state = case state.role of
ConfManager -> True
_ -> False
homePage :: Role -> CurrPage
homePage ConfManager = RootHomePage
homePage Referee = MemberHomePage
findReports :: Int [State] -> [(Person,Maybe Report)]
findReports papernr states
= [ (state.person,report) \\ state <- states
......
......@@ -4,10 +4,14 @@ import StdHtml
import stateHandling
import loginAdminIData, confIData
derive gForm CurrPage, State, Person, Paper, Report, Recommendation, Familiarity, Maybe
derive gUpd CurrPage, State, Person, Paper, Report, Recommendation, Familiarity, Maybe
derive gPrint CurrPage, State, Person, Paper, Report, Recommendation, Familiarity, Maybe
derive gParse CurrPage, State, Person, Paper, Report, Recommendation, Familiarity, Maybe
derive gForm CurrPage, Role, State, Person, Paper, Report, Recommendation, Familiarity, Maybe
derive gUpd CurrPage, Role, State, Person, Paper, Report, Recommendation, Familiarity, Maybe
derive gPrint CurrPage, Role, State, Person, Paper, Report, Recommendation, Familiarity, Maybe
derive gParse CurrPage, Role, State, Person, Paper, Report, Recommendation, Familiarity, Maybe
// forms
showPapersPage :: !(LoginState State) !(InIDataId Papers) [State] !*HSt -> (![BodyTag],!*HSt)
showPapersPage (login,state) (init,formid) states hst
......
......@@ -11,6 +11,89 @@ import StdEnv, StdHtml, Random
Start :: *World -> *World
Start world = doHtmlServer numberGuessingGame world
:: State = { count :: !Int
, guess :: !Int
, high :: ![(Int,String)]
}
derive gUpd State
derive gForm State
derive gParse State
derive gPrint State
derive gForm []
derive gUpd []
// Form initializer functions:
nameForm = mkEditForm (Init, nFormId "name" "") // The form in which the player can enter his/her name
guessForm = mkEditForm (Init, nFormId "guess" (low-1)) // The form in which the player enters guesses
stateForm f = mkStoreForm (Init, pFormId "state" (newGame nullRandomSeed Nothing [])) f // The store form that keeps track of the state of the application
highForm high = vertlistForm (Set, ndFormId "display" high) // The form that displays the high-score list
low = 1
up = 10
newGame seed mbname high = {count=1, guess=nextNumber seed, high = insert mbname high}
where
insert Nothing list = list
insert (Just namecount) list = [namecount:list]
nextNumber seed = let (new,_) = random seed in low + (new mod (up-low))
adjustState newname newguess seed name guess state
| newname = newGame seed Nothing state.high
| newguess
| guess == state.guess = newGame seed (Just (state.count,name)) state.high
| otherwise = {state & count = state.count + 1}
= state
numberGuessingGame :: *HSt -> (Html, *HSt)
numberGuessingGame hst
# (ostate, hst) = stateForm id hst // get state
# (name, hst) = nameForm hst // get name
# (guess, hst) = guessForm hst // get new quess
# (randomSeed,hst) = accWorldHSt getNewRandomSeed hst // create random number seed
# (nstate, hst) = stateForm // adjust state
(\st -> adjustState name.changed guess.changed randomSeed name.value guess.value st) hst
= mkHtml "Number Guessing Game"
( [ Txt ("Type in your name and guess a number between "<$ low <$ " and " <$ up <$ ".")
, Br, Br
, name.form
<||> guess.form
, Br
] ++
(if guess.changed
(if (guess.value == ostate.value.guess)
[ Txt ("Congratulations " <$ name.value <$ ".")
, Br
, Txt ("You have guessed the number in " <$ ostate.value.count <$ " turn" <$ if (ostate.value.count>1) "s." ".")
, Br, Br
, Txt "Here follows the list of fame: "
, Br, Br
, BodyTag (toHtmlForm (highForm (sort nstate.value.high)))
, Br, Br
, Txt ("Just type in a new number if you want to guess again...")
]
[ Txt ("Sorry, " <$ name.value <$ ", your guess number " <$ ostate.value.count <$ " was wrong.")
, Br, Br
, Txt ("The number to guess is "<$if (guess.value < ostate.value.guess) "larger." "smaller.")
]
)
[])
) hst
instance mod Int where mod a b = a - (a/b)*b
/* old code
/** This module implements the number guessing game.
The program randomly selects a number between given bounds.
The player tries to guess the selected number.
The number of guesses are stored in a high-score file.
These can be displayed on request.
*/
bounds = (low,up)
low = 1
up = 10
......@@ -78,3 +161,5 @@ guessButtonForm = ListFuncBut (Init, nFormId "guessbutton" [(LButton defpixel
newButtonForm = ListFuncBut (Init, nFormId "newbutton" [(LButton defpixel "New Game", nextRandom)]) // Button to start new game
instance mod Int where mod a b = a - (a/b)*b
*/
definition module htmlEncodeDecode
// maintains the state of forms
// internally (in a tree containing the state of all forms),
// and externally, either in a html form or in files on disk.
// provides the encoding and decoding of information between browser and myprogram.exe via myprogram.php
// (c) 2005 - MJP
import StdMaybe
import GenParse, GenPrint
import htmlDataDef, htmlFormData
// Maintaining the internal state of all forms
:: Triplet :== (String,Int,UpdValue)
:: *FormStates // collection of all states of all forms
:: UpdValue // the updates that can take place
= UpdI Int // new integer value
| UpdR Real // new real value
| UpdB Bool // new boolean value
| UpdC String // choose indicated constructor
| UpdS String // new piece of text
emptyFormStates :: *FormStates