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
b0ffc354
Commit
b0ffc354
authored
Nov 16, 2006
by
Rinus Plasmeijer
Browse files
*** empty log message ***
parent
27b466f4
Changes
8
Expand all
Hide whitespace changes
Inline
Side-by-side
libraries/Gerda/GenericDatabase.icl
View file @
b0ffc354
module
GenericDatabase
import
Gerda
,
StdEnv
import
Gerda
,
StdEnv
,
GenEq
//, MyDebug
::
R
=
{
naam
::
[
Char
],
leeftijd
::
Real
,
rec
::
Maybe
R
}
::
A
=
C
R
...
...
@@ -11,59 +11,40 @@ import Gerda, StdEnv
::
GRose
m
a
=
GRose
a
(
m
(
GRose
m
a
))
::
Test`
=
Constr`
Int
Start
world
#
(
g
,
world
)
=
openGerda
"Clean Data Structures"
world
// x = 42
// x = [[1]]
// x = (1, 3.1415927, 'a', [C2, C1, C3])
// x = [3, 5, 7]
// x = [C3, C1, C2, C1, C3, C2]
// x = [[[[[[[1]]]]]]]
// x = ["test"]
// x = ['aapnoot']
// x = [['aap'], ['noot']]
// x = Bin (Tip 'a') 42 (Tip 'b')
// x = Rose 1 [Rose 2 [], Rose 3 []]
// x = [[C1, C2], [C3, C2, C1]]
// r1 = {naam = ['aap'], leeftijd = 13.5, rec = Nothing}
// r2 = {naam = ['aap'], leeftijd = 13.5, rec = Just r1}
// x = array {r1, r2, r2, r1}
// x = ["Hello", "world"]
// x = Rose 1 [Rose 2 [], Rose 3 []]
// x = "a" +++ {'b' \\ _ <- [1..1000]}
// x = GRose (1, 'a', 0.5, "bud") [GRose (2, 'b', 0.75, "another bud") [], GRose (3, 'c', 0.875, "yet another bud") []]
// x = [1..10000]
// x = array {strictArray {1, 2, 3}, strictArray {1 .. 100}}
// x = Constr` 42
x
=
PAIR
Nothing
Nothing
g
=
writeGerda
"test`.1"
x
g
// g = writeGerda "test2" x2 g
(
y
,
g
)
=
readGerda
"test`.1"
g
// (y2, g) = readGerda "test2" g
/* = case y `typeOf` x of
Just x`
# g = writeGerda "test2" x` g
(z, g) = readGerda "test" g
-> (z `typeOf` x, closeGerda g world)*/
=
(
y
`
typeOf`
x
,
closeGerda
g
world
)
// x = gerdaObject 42
// g = writeGerda "test" x g
// (y, g) = readGerda "test" g
// f = case y of Just {gerdaWrite} -> gerdaWrite; _ -> const id
// h = case y of Just {gerdaRead} -> gerdaRead; _ -> (\g -> (undef, g))
// g = f 123 g
// (w, g) = h g
// (z, g) = readGerda "test" g
// = (y `typeOf` x, Just w `typeOf` x.gerdaValue, z `typeOf` x, closeGerda g world)
::
Test
=
E
.
a
:
{
value
::
a
,
write
::
a
*
Gerda
->
*
Gerda
,
read
::
*
Gerda
->
*(
a
,
*
Gerda
),
equal
::
a
a
->
Bool
}
test
::
a
->
Test
|
gerda
{|*|},
gEq
{|*|}
a
test
x
=
{
value
=
x
,
write
=
\
x
g
->
writeGerda
"test"
x
g
,
read
=
\
g
->
case
readGerda
"test"
g
of
(
Just
x
,
g
)
->
(
x
,
g
),
equal
=
(===)}
tests
=
flatten
(
repeatn
10
[
// test {gerdaKey = 1, gerdaValue = 2},
test
42
,
test
C1
,
test
(
Constr`
42
),
test
[
1
,
3
,
5
,
7
],
test
(
1
,
3.1415927
,
'a'
,
[
C3
,
C1
,
C2
,
C1
,
C3
,
C2
]),
test
[[[[[[[
1
]]]]]]],
test
"test"
,
test
(
"a"
+++
{
'b'
\\
_
<-
[
1
..
1000
]}),
test
[[
'aap'
],
[
'noot'
]],
test
(
Bin
(
Tip
'a'
)
42
(
Tip
'b'
)),
test
(
Rose
1
[
Rose
2
[],
Rose
3
[]]),
test
p1
,
test
p2
,
test
r2
,
test
(
strictArray
{
2
,
3
,
5
,
7
,
11
,
13
,
17
,
19
}),
test
(
array
{
r1
,
r2
,
r2
,
r1
}),
test
(
GRose
(
1
,
'a'
,
0.5
,
"bud"
)
[
GRose
(
2
,
'b'
,
0.75
,
"another bud"
)
[],
GRose
(
3
,
'c'
,
0.875
,
"yet another bud"
)
[]]),
test
{
gerdaUnique
=
21
}])
where
(
`
typeOf`
)
::
!(
Maybe
(
EITHER
Int
Int
))
(
PAIR
(
Maybe
Int
)
(
Maybe
Int
))
->
Maybe
(
EITHER
Int
Int
)
(
`
typeOf`
)
x
_
=
x
r1
=
{
naam
=
[
'noot'
],
leeftijd
=
41.2
,
rec
=
Nothing
}
r2
=
{
naam
=
[
'aap'
],
leeftijd
=
13.5
,
rec
=
Just
r1
}
x
::
Phantom
[
Int
]
x
=
Opera
p1
::
Phantom
Char
p1
=
Opera
x
2
::
Phantom
Char
x
2
=
Opera
p
2
::
Phantom
[
Int
]
p
2
=
Opera
array
::
!{
a
}
->
{
a
}
array
x
=
x
...
...
@@ -71,7 +52,36 @@ where
strictArray
::
!{!
a
}
->
{!
a
}
strictArray
x
=
x
derive
gerda
Tree
,
Rose
,
R
,
N
,
(,),
(,,),
(,,,),
GRose
,
Test`
,
Phantom
runTests
[{
value
,
write
,
read
,
equal
}:
ts
]
g
#
g
=
write
value
g
(
v
,
g
)
=
read
g
|
not
(
equal
v
value
)
=
abort
"TEST FAILED"
//<<- (value, v)
=
runTests
ts
g
runTests
_
g
=
g
Start
world
#
(
g
,
world
)
=
openGerda
"Clean Data Structures"
world
g
=
runTests
tests
g
x
=
gerdaObject
(
42
,
'a'
,
3.14
,
[
1
..
10
])
g
=
writeGerda
"test2"
x
g
(
y
,
g
)
=
readGerda
"test2"
g
w
=
case
y
of
Just
{
gerdaWrite
}
->
gerdaWrite
;
_
->
const
id
r
=
case
y
of
Just
{
gerdaRead
}
->
gerdaRead
;
_
->
(\
g
->
(
abort
"NO readGerda"
,
g
))
g
=
w
(
123
,
'b'
,
2.41
,
[])
g
(
u
,
g
)
=
r
g
g
=
w
(
789
,
'c'
,
1.61
,
[])
g
(
z
,
g
)
=
r
g
(
v
,
g
)
=
readGerda
"test2"
g
=
(
mapMaybe
(\{
gerdaObject
}
->
gerdaObject
)
y
`
typeOf`
x
.
gerdaObject
,
u
,
z
,
mapMaybe
(\{
gerdaObject
}
->
gerdaObject
)
v
`
typeOf`
x
.
gerdaObject
,
closeGerda
g
world
)
// = closeGerda g world
where
(
`
typeOf`
)
::
!(
Maybe
a
)
a
->
Maybe
a
(
`
typeOf`
)
x
_
=
x
derive
gerda
(,),
(,,),
(,,,),
Tree
,
Rose
,
R
,
N
,
GRose
,
Test`
,
Phantom
derive
gEq
GerdaPrimary
,
GerdaUnique
,
Binary252
,
Maybe
,
Tree
,
Rose
,
R
,
N
,
Test`
,
Phantom
gEq
{|
GRose
|}
eq_m
eq_a
(
GRose
x
xs
)
(
GRose
y
ys
)
=
eq_a
x
y
&&
eq_m
(
gEq
{|(*->*)->*->*|}
eq_m
eq_a
)
xs
ys
::
Phantom
a
=
Opera
...
...
libraries/Gerda/GenericDatabase.prj
View file @
b0ffc354
...
...
@@ -7,8 +7,8 @@ Global
CheckStacks: False
CheckIndexes: True
Application
HeapSize:
4194304
StackSize:
1048576
HeapSize:
8388608
StackSize:
2097152
ExtraMemory: 81920
IntialHeapSize: 204800
HeapSizeMultiplier: 4096
...
...
@@ -18,7 +18,7 @@ Global
MarkingCollector: False
StandardRuntimeEnv: True
Profile
Memory:
Tru
e
Memory:
Fals
e
MemoryMinimumHeapSize: 0
Time: True
Stack: False
...
...
@@ -38,6 +38,7 @@ Global
Paths
Path: {Project}
Path: {Application}\Libraries\StdLib
Path: {Application}\Libraries\Generics
Path: {Application}\Libraries\WrapDebug
Precompile:
Postlink:
...
...
@@ -61,13 +62,13 @@ MainModule
X: 10
Y: 10
SizeX: 622
SizeY:
490
IclOpen:
Tru
e
SizeY:
511
IclOpen:
Fals
e
LastModified: No 0 0 0 0 0 0
OtherModules
Module
Name: Ge
rda
Dir: {
Project}
Name: Ge
nEq
Dir: {
Application}\Libraries\Generics
Compiler
NeverMemoryProfile: False
NeverTimeProfile: False
...
...
@@ -76,27 +77,15 @@ OtherModules
ListAttributes: True
Warnings: True
Verbose: True
ReadableABC:
Tru
e
ReadableABC:
Fals
e
ReuseUniqueNodes: True
Fusion: False
Dcl
WindowPosition
X: 88
Y: 44
SizeX: 751
SizeY: 477
DclOpen: True
Icl
WindowPosition
X: 26
Y: 41
SizeX: 800
SizeY: 494
IclOpen: True
DclOpen: False
IclOpen: False
LastModified: No 0 0 0 0 0 0
Module
Name:
StdGeneric
Dir: {
Application}\Libraries\StdEnv
Name:
odbccp
Dir: {
Project}
Compiler
NeverMemoryProfile: False
NeverTimeProfile: False
...
...
@@ -108,6 +97,12 @@ OtherModules
ReadableABC: False
ReuseUniqueNodes: True
Fusion: False
Dcl
WindowPosition
X: 224
Y: 74
SizeX: 800
SizeY: 632
DclOpen: False
Icl
WindowPosition
...
...
@@ -117,9 +112,11 @@ OtherModules
SizeY: 640
IclOpen: False
LastModified: No 0 0 0 0 0 0
NeededLibraries
Library: odbccp_library
Module
Name:
StdInt
Dir: {
Application}\Libraries\StdEnv
Name:
odbc
Dir: {
Project}
Compiler
NeverMemoryProfile: False
NeverTimeProfile: False
...
...
@@ -131,11 +128,25 @@ OtherModules
ReadableABC: False
ReuseUniqueNodes: True
Fusion: False
Dcl
WindowPosition
X: 211
Y: 44
SizeX: 800
SizeY: 646
DclOpen: False
Icl
WindowPosition
X: 10
Y: 10
SizeX: 800
SizeY: 640
IclOpen: False
LastModified: No 0 0 0 0 0 0
NeededLibraries
Library: odbc_library
Module
Name: Std
Overloaded
Name: Std
Debug
Dir: {Application}\Libraries\StdEnv
Compiler
NeverMemoryProfile: False
...
...
@@ -158,7 +169,7 @@ OtherModules
IclOpen: False
LastModified: No 0 0 0 0 0 0
Module
Name: Std
M
is
c
Name: Std
CharL
is
t
Dir: {Application}\Libraries\StdEnv
Compiler
NeverMemoryProfile: False
...
...
@@ -175,7 +186,7 @@ OtherModules
IclOpen: False
LastModified: No 0 0 0 0 0 0
Module
Name: Std
Class
Name: Std
Tuple
Dir: {Application}\Libraries\StdEnv
Compiler
NeverMemoryProfile: False
...
...
@@ -198,25 +209,8 @@ OtherModules
IclOpen: False
LastModified: No 0 0 0 0 0 0
Module
Name: Std
Bool
Name: Std
OrdList
Dir: {Application}\Libraries\StdEnv
Compiler
NeverMemoryProfile: False
NeverTimeProfile: False
StrictnessAnalysis: True
ListTypes: StrictExportTypes
ListAttributes: True
Warnings: True
Verbose: True
ReadableABC: False
ReuseUniqueNodes: True
Fusion: False
DclOpen: False
IclOpen: False
LastModified: No 0 0 0 0 0 0
Module
Name: StdMaybe
Dir: {Application}\Libraries\StdLib
Compiler
NeverMemoryProfile: False
NeverTimeProfile: False
...
...
@@ -238,7 +232,7 @@ OtherModules
IclOpen: False
LastModified: No 0 0 0 0 0 0
Module
Name:
StdFunc
Name:
_SystemEnum
Dir: {Application}\Libraries\StdEnv
Compiler
NeverMemoryProfile: False
...
...
@@ -251,17 +245,11 @@ OtherModules
ReadableABC: False
ReuseUniqueNodes: True
Fusion: False
Dcl
WindowPosition
X: 10
Y: 10
SizeX: 800
SizeY: 640
DclOpen: False
IclOpen: False
LastModified: No 0 0 0 0 0 0
Module
Name: StdEn
v
Name: StdEn
um
Dir: {Application}\Libraries\StdEnv
Compiler
NeverMemoryProfile: False
...
...
@@ -278,7 +266,7 @@ OtherModules
IclOpen: False
LastModified: No 0 0 0 0 0 0
Module
Name: Std
Real
Name: Std
List
Dir: {Application}\Libraries\StdEnv
Compiler
NeverMemoryProfile: False
...
...
@@ -291,11 +279,17 @@ OtherModules
ReadableABC: False
ReuseUniqueNodes: True
Fusion: False
Dcl
WindowPosition
X: 10
Y: 10
SizeX: 800
SizeY: 640
DclOpen: False
IclOpen: False
LastModified: No 0 0 0 0 0 0
Module
Name: Std
Char
Name: Std
File
Dir: {Application}\Libraries\StdEnv
Compiler
NeverMemoryProfile: False
...
...
@@ -312,7 +306,7 @@ OtherModules
IclOpen: False
LastModified: No 0 0 0 0 0 0
Module
Name: Std
Array
Name: Std
String
Dir: {Application}\Libraries\StdEnv
Compiler
NeverMemoryProfile: False
...
...
@@ -364,7 +358,7 @@ OtherModules
IclOpen: False
LastModified: No 0 0 0 0 0 0
Module
Name: Std
String
Name: Std
Array
Dir: {Application}\Libraries\StdEnv
Compiler
NeverMemoryProfile: False
...
...
@@ -387,7 +381,7 @@ OtherModules
IclOpen: False
LastModified: No 0 0 0 0 0 0
Module
Name: Std
File
Name: Std
Char
Dir: {Application}\Libraries\StdEnv
Compiler
NeverMemoryProfile: False
...
...
@@ -404,7 +398,7 @@ OtherModules
IclOpen: False
LastModified: No 0 0 0 0 0 0
Module
Name: Std
List
Name: Std
Real
Dir: {Application}\Libraries\StdEnv
Compiler
NeverMemoryProfile: False
...
...
@@ -421,7 +415,7 @@ OtherModules
IclOpen: False
LastModified: No 0 0 0 0 0 0
Module
Name: StdEn
um
Name: StdEn
v
Dir: {Application}\Libraries\StdEnv
Compiler
NeverMemoryProfile: False
...
...
@@ -438,7 +432,7 @@ OtherModules
IclOpen: False
LastModified: No 0 0 0 0 0 0
Module
Name:
_SystemEnum
Name:
StdFunc
Dir: {Application}\Libraries\StdEnv
Compiler
NeverMemoryProfile: False
...
...
@@ -451,12 +445,18 @@ OtherModules
ReadableABC: False
ReuseUniqueNodes: True
Fusion: False
Dcl
WindowPosition
X: 10
Y: 10
SizeX: 800
SizeY: 640
DclOpen: False
IclOpen: False
LastModified: No 0 0 0 0 0 0
Module
Name: Std
OrdList
Dir: {Application}\Libraries\Std
Env
Name: Std
Maybe
Dir: {Application}\Libraries\Std
Lib
Compiler
NeverMemoryProfile: False
NeverTimeProfile: False
...
...
@@ -478,7 +478,7 @@ OtherModules
IclOpen: False
LastModified: No 0 0 0 0 0 0
Module
Name: Std
Tuple
Name: Std
Bool
Dir: {Application}\Libraries\StdEnv
Compiler
NeverMemoryProfile: False
...
...
@@ -495,7 +495,7 @@ OtherModules
IclOpen: False
LastModified: No 0 0 0 0 0 0
Module
Name: StdC
harList
Name: StdC
lass
Dir: {Application}\Libraries\StdEnv
Compiler
NeverMemoryProfile: False
...
...
@@ -508,11 +508,17 @@ OtherModules
ReadableABC: False
ReuseUniqueNodes: True
Fusion: False
Dcl
WindowPosition
X: 10
Y: 10
SizeX: 800
SizeY: 640
DclOpen: False
IclOpen: False
LastModified: No 0 0 0 0 0 0
Module
Name: Std
Debug
Name: Std
Misc
Dir: {Application}\Libraries\StdEnv
Compiler
NeverMemoryProfile: False
...
...
@@ -529,8 +535,8 @@ OtherModules
IclOpen: False
LastModified: No 0 0 0 0 0 0
Module
Name:
odbc
Dir: {
Project}
Name:
StdOverloaded
Dir: {
Application}\Libraries\StdEnv
Compiler
NeverMemoryProfile: False
NeverTimeProfile: False
...
...
@@ -544,10 +550,44 @@ OtherModules
Fusion: False
Dcl
WindowPosition
X:
21
1
Y:
44
X: 1
0
Y:
10
SizeX: 800
SizeY: 646
SizeY: 640
DclOpen: False
IclOpen: False
LastModified: No 0 0 0 0 0 0
Module
Name: StdInt
Dir: {Application}\Libraries\StdEnv
Compiler
NeverMemoryProfile: False
NeverTimeProfile: False
StrictnessAnalysis: True
ListTypes: StrictExportTypes
ListAttributes: True
Warnings: True
Verbose: True
ReadableABC: False
ReuseUniqueNodes: True
Fusion: False
DclOpen: False
IclOpen: False
LastModified: No 0 0 0 0 0 0
Module
Name: StdGeneric
Dir: {Application}\Libraries\StdEnv
Compiler
NeverMemoryProfile: False
NeverTimeProfile: False
StrictnessAnalysis: True
ListTypes: StrictExportTypes
ListAttributes: True
Warnings: True
Verbose: True
ReadableABC: False
ReuseUniqueNodes: True
Fusion: False
DclOpen: False
Icl
WindowPosition
...
...
@@ -557,10 +597,8 @@ OtherModules
SizeY: 640
IclOpen: False
LastModified: No 0 0 0 0 0 0
NeededLibraries
Library: odbc_library
Module
Name:
odbccp
Name:
Gerda
Dir: {Project}
Compiler
NeverMemoryProfile: False
...
...
@@ -570,85 +608,85 @@ OtherModules
ListAttributes: True
Warnings: True
Verbose: True
ReadableABC:
Fals
e
ReadableABC:
Tru
e
ReuseUniqueNodes: True
Fusion: False
Dcl
WindowPosition
X:
224
Y:
7
4
SizeX:
800
SizeY:
632
X:
88
Y:
4
4
SizeX:
751
SizeY:
477
DclOpen: False
Icl
WindowPosition
X:
10
Y:
10
SizeX: 8
00
SizeY:
64
0
X:
9
Y:
22
SizeX: 8
12
SizeY:
50
0
IclOpen: False
LastModified: No 0 0 0 0 0 0
NeededLibraries
Library: odbccp_library
Static
Mods
Path: {Project}\GenericDatabase.icl
Path: {Project}\Gerda.icl
Path: {Application}\Libraries\StdEnv\StdGeneric.icl
Path: {Application}\Libraries\StdEnv\StdInt.icl
Path: {Application}\Libraries\StdEnv\StdOverloaded.icl
Path: {Application}\Libraries\StdEnv\StdMisc.icl
Path: {Application}\Libraries\StdEnv\StdClass.icl
Path: {Application}\Libraries\StdEnv\StdBool.icl
Path: {Application}\Libraries\StdLib\StdMaybe.icl
Path: {Application}\Libraries\StdEnv\StdFunc.icl
Path: {Application}\Libraries\StdEnv\StdEnv.icl
Path: {Application}\Libraries\StdEnv\StdReal.icl
Path: {Application}\Libraries\StdEnv\StdChar.icl
Path: {Application}\Libraries\StdEnv\StdArray.icl
Path: {Application}\Libraries\StdEnv\_SystemArray.icl
Path: {Application}\Libraries\StdEnv\StdString.icl
Path: {Application}\Libraries\StdEnv\StdFile.icl
Path: {Application}\Libraries\StdEnv\StdList.icl
Path: {Application}\Libraries\StdEnv\StdEnum.icl
Path: {Application}\Libraries\StdEnv\_SystemEnum.icl
Path: {Application}\Libraries\StdEnv\StdOrdList.icl
Path: {Application}\Libraries\StdEnv\StdTuple.icl
Path: {Application}\Libraries\StdEnv\StdCharList.icl
Path: {Application}\Libraries\StdEnv\StdDebug.icl
Path: {Project}\odbc.icl
Path: {Application}\Libraries\Generics\GenEq.icl
Path: {Project}\odbccp.icl
Path: {Project}\odbc.icl
Path: {Application}\Libraries\StdEnv\StdDebug.icl
Path: {Application}\Libraries\StdEnv\StdCharList.icl
Path: {Application}\Libraries\StdEnv\StdTuple.icl
Path: {Application}\Libraries\StdEnv\StdOrdList.icl
Path: {Application}\Libraries\StdEnv\_SystemEnum.icl
Path: {Application}\Libraries\StdEnv\StdEnum.icl
Path: {Application}\Libraries\StdEnv\StdList.icl
Path: {Application}\Libraries\StdEnv\StdFile.icl
Path: {Application}\Libraries\StdEnv\StdString.icl
Path: {Application}\Libraries\StdEnv\_SystemArray.icl
Path: {Application}\Libraries\StdEnv\StdArray.icl
Path: {Application}\Libraries\StdEnv\StdChar.icl
Path: {Application}\Libraries\StdEnv\StdReal.icl
Path: {Application}\Libraries\StdEnv\StdEnv.icl
Path: {Application}\Libraries\StdEnv\StdFunc.icl
Path: {Application}\Libraries\StdLib\StdMaybe.icl
Path: {Application}\Libraries\StdEnv\StdBool.icl
Path: {Application}\Libraries\StdEnv\StdClass.icl
Path: {Application}\Libraries\StdEnv\StdMisc.icl
Path: {Application}\Libraries\StdEnv\StdOverloaded.icl
Path: {Application}\Libraries\StdEnv\StdInt.icl
Path: {Application}\Libraries\StdEnv\StdGeneric.icl
Path: {Project}\Gerda.icl
Objs
Path: {Application}\Libraries\StdEnv\Clean System Files\_startup0.o
Path: {Application}\Libraries\StdEnv\Clean System Files\_startup1Profile.o
Path: {Application}\Libraries\StdEnv\Clean System Files\_startup2.o
Path: {Application}\Libraries\StdEnv\Clean System Files\_system.o
Path: {Project}\Clean System Files\GenericDatabase.o
Path: {Project}\Clean System Files\Gerda.o