Skip to content
GitLab
Menu
Projects
Groups
Snippets
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
clean-and-itasks
clean-libraries
Commits
2891b6c5
Commit
2891b6c5
authored
Nov 21, 2006
by
Rinus Plasmeijer
Browse files
*** empty log message ***
parent
c0b30020
Changes
5
Expand all
Hide whitespace changes
Inline
Side-by-side
libraries/htmlGEC/EncodeDecode.icl
View file @
2891b6c5
...
...
@@ -3,10 +3,11 @@ implementation module EncodeDecode
// encoding and decoding of information
// (c) 2005 MJP
import
StdArray
,
StdInt
,
StdList
,
Std
String
,
ArgEnv
,
StdMaybe
,
Directory
import
StdArray
,
StdBool
,
StdInt
,
StdList
,
Std
OrdList
,
StdString
,
StdTuple
,
ArgEnv
,
StdMaybe
,
Directory
import
htmlTrivial
,
htmlFormData
import
GenPrint
,
GenParse
import
dynamic_string
import
EstherBackend
// Serializing Html states...
...
...
@@ -124,22 +125,36 @@ traceHtmlInput :: !ServerKind !(Maybe String) -> BodyTag
traceHtmlInput
serverkind
args
=:(
Just
string
)
=
BodyTag
[
Br
,
B
[]
"State values received from client when application started:"
,
Br
,
STable
[]
[
[
B
[]
"Triplet:"
,
Txt
triplet
]
,[
B
[]
"Update:"
,
Txt
update
]
,[
B
[]
"Update:"
,
Txt
update
s
]
,[
B
[]
"Id:"
,
B
[]
"Lifespan:"
,
B
[]
"Format:"
,
B
[]
"Value:"
]
:
[
[
Txt
id
,
Txt
(
showl
life
),
Txt
(
showf
storage
),
Txt
(
shows
storage
state
)]
\\
(
id
,
life
,
storage
,
state
)
<-
htmlState
]
]
,
Br
,
Txt
string
//
, Txt string
]
where
(
htmlState
,
triplet
,
update
)
=
DecodeHtmlStatesAndUpdate
serverkind
args
(
htmlState
,
triplet
,
update
s
)
=
DecodeHtmlStatesAndUpdate
serverkind
args
showl
life
=
toString
life
showf
storage
=
case
storage
of
PlainString
->
"String"
;
_
->
"S_Dynamic"
shows
PlainString
s
=
s
shows
_
d
=
d
// "cannot show dynamic value"
shows
StaticDynamic
d
=
toStr
(
string_to_dynamic`
d
)
// "cannot show dynamic value"
toStr
dyn
=
ShowValueDynamic
dyn
<+++
" :: "
<+++
ShowTypeDynamic
dyn
string_to_dynamic`
::
{#
Char
}
->
Dynamic
// just to make a unique copy as requested by string_to_dynamic
string_to_dynamic`
s
=
string_to_dynamic
{
s`
\\
s`
<-:
s
}
strip
s
=
{
ns
\\
ns
<-:
s
|
ns
>=
'\020'
&&
ns
<=
'\0200'
}
ShowValueDynamic
::
Dynamic
->
String
ShowValueDynamic
d
=
strip
(
foldr
(+++)
""
(
fst
(
toStringDynamic
d
))
+++
" "
)
ShowTypeDynamic
::
Dynamic
->
String
ShowTypeDynamic
d
=
strip
(
snd
(
toStringDynamic
d
)
+++
" "
)
// global names setting depending on kind of server used
...
...
libraries/htmlGEC/Examples/Simple Examples/balanceTree.prj
View file @
2891b6c5
This diff is collapsed.
Click to expand it.
libraries/htmlGEC/httpServer.icl
View file @
2891b6c5
...
...
@@ -5,7 +5,7 @@ import StdEnv,StdTCP
from
httpUtil
import
unlines
,
cSplit
,
endWith
,
splitAfter
,
wordsWith
,
unwords
,
readFile
DEBUGSERVER
:==
Tru
e
:==
Fals
e
(<<?)
file
s
=
case
DEBUGSERVER
of
...
...
@@ -28,7 +28,9 @@ getArgValue a arguments
StartServer
::
Int
[(
String
,(
String
String
Arguments
*
World
->
([
String
],
String
,*
World
)))]
*
World
->
*
World
StartServer
poortNr
linktofunctionlist
world
// open console voor debuggen:
#
(
console
,
world
)
=
stdio
world
#
(
console
,
world
)
=
stdio
world
#
console
=
fwrites
"Open your favorite browser and surf to http://localhost/clean
\n
"
console
//luister op de opgegeven poort:
#
(
listen
,
world
)
=
listenOnPort
poortNr
world
...
...
libraries/htmlGEC/iDataState.dcl
View file @
2891b6c5
...
...
@@ -46,7 +46,7 @@ callClean :: Script // script that takes care of sending the required
// tracing all states ...
traceStates
::
!*
FormStates
->
!
(
BodyTag
,!*
FormStates
)
traceStates
::
!*
FormStates
->
(
BodyTag
,!*
FormStates
)
// fstate handling used for testing only
...
...
libraries/htmlGEC/iDataState.icl
View file @
2891b6c5
...
...
@@ -7,6 +7,9 @@ import StdArray, StdList, StdOrdList, StdString, StdTuple, ArgEnv, StdMaybe, Dir
import
htmlDataDef
,
htmlTrivial
,
htmlFormData
,
EncodeDecode
import
GenPrint
,
GenParse
import
dynamic_string
import
EstherBackend
//import Debug // TEMP
derive
gParse
UpdValue
,
(,,)
derive
gPrint
UpdValue
,
(,,)
...
...
@@ -77,7 +80,7 @@ findState formid formstates=:{fstates,server} world
#
(
bool
,
ma
,
fstates
,
world
)
=
findState`
formid
fstates
world
=
(
bool
,
ma
,{
formstates
&
fstates
=
fstates
},
world
)
where
findState`
::
!(
FormId
a
)
*
FStates
*
NWorld
->
(
Bool
,
Maybe
a
,*
FStates
,*
NWorld
)|
iDataSerAndDeSerialize
a
findState`
::
!(
FormId
a
)
*
FStates
*
NWorld
->
(
Bool
,
Maybe
a
,*
FStates
,*
NWorld
)|
gPrint
{|*|},
gerda
{|*|},
TC
,
gParse
{|*|}
a
//
iDataSerAndDeSerialize a
findState`
formid
formstate
=:(
Node_
left
(
fid
,
info
)
right
)
world
|
formid
.
id
==
fid
=
case
info
of
(
OldState
state
)
=
(
True
,
fetchFState
state
,
formstate
,
world
)
...
...
@@ -140,6 +143,8 @@ where
_
=
case
string_to_dynamic`
string
of
dyn
=:(
dynval
::
a
^)
=
(
True
,
Just
dynval
,
Node_
Leaf_
(
id
,
OldState
{
format
=
StatDyn
dyn
,
life
=
Persistent
})
Leaf_
,
world
)
else
=
(
False
,
Nothing
,
Leaf_
,
world
)
// with
// mydebug s dyn = ["\n" <+++ s <+++ ShowValueDynamic dyn <+++ " :: " <+++ ShowTypeDynamic dyn]
findState`
{
id
,
lifespan
=
PersistentRO
,
storage
=
StaticDynamic
}
Leaf_
world
#
(
string
,
world
)
=
readState
(
MyDir
server
)
id
world
...
...
@@ -309,9 +314,7 @@ where
// trace States
import
EstherBackend
traceStates
::
!*
FormStates
->
!(
BodyTag
,!*
FormStates
)
traceStates
::
!*
FormStates
->
(
BodyTag
,!*
FormStates
)
traceStates
formstates
=:{
fstates
}
#
(
bodytags
,
fstates
)
=
traceStates`
fstates
=
(
BodyTag
[
Br
,
B
[]
"State values when application ended:"
,
Br
,
...
...
@@ -333,13 +336,13 @@ where
toStr
(
StatDyn
dyn
)
=
[
Txt
"S_Dynamic"
,
Txt
(
ShowValueDynamic
dyn
<+++
" :: "
<+++
ShowTypeDynamic
dyn
)]
toStr
(
DBStr
str
_)
=
[
Txt
"Database"
,
Txt
str
]
strip
s
=
{
ns
\\
ns
<-:
s
|
ns
>=
'\020'
&&
ns
<=
'\0200'
}
ShowValueDynamic
::
Dynamic
->
String
ShowValueDynamic
d
=
strip
(
foldr
(+++)
""
(
fst
(
toStringDynamic
d
))
+++
" "
)
ShowTypeDynamic
::
Dynamic
->
String
ShowTypeDynamic
d
=
strip
(
snd
(
toStringDynamic
d
)
+++
" "
)
strip
s
=
{
ns
\\
ns
<-:
s
|
ns
>=
'\020'
&&
ns
<=
'\0200'
}
ShowValueDynamic
::
Dynamic
->
String
ShowValueDynamic
d
=
strip
(
foldr
(+++)
""
(
fst
(
toStringDynamic
d
))
+++
" "
)
ShowTypeDynamic
::
Dynamic
->
String
ShowTypeDynamic
d
=
strip
(
snd
(
toStringDynamic
d
)
+++
" "
)
// debugging code
print_graph
::
!
a
->
Bool
;
...
...
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new file
.
Attach a 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