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-compiler-and-rts
compiler
Commits
ab18d547
Commit
ab18d547
authored
Jun 09, 2000
by
Martin Wierich
Browse files
Added preprocessor directives, so that one and the same source can be
compiled with Clean 1.3 and Clean 2.0
parent
3a4ab7e1
Changes
5
Show whitespace changes
Inline
Side-by-side
frontend/_aconcat.dcl
View file @
ab18d547
...
...
@@ -7,8 +7,12 @@ arrayConcat a1 a2
where
r2
={
r1
&
[
i
+
s1
]=
a2
.[
i
]
\\
i
<-[
0
..
s2
-1
]}
r1
={
r0
&
[
i
]=
a1
.[
i
]
\\
i
<-[
0
..
s1
-1
]}
// r0=_createArray (s1+s2) // 2.0
/*2.0
r0=_createArray (s1+s2)
0.2*/
//1.3
r0
=
_createArrayc
(
s1
+
s2
)
//3.1
s1
=
size
a1
s2
=
size
a2
...
...
@@ -17,20 +21,26 @@ arrayPlusList a l
where
r2
={
r1
&
[
i
+
s1
]=
e
\\
i
<-[
0
..
s2
-1
]
&
e
<-
l
}
r1
={
r0
&
[
i
]=
a
.[
i
]
\\
i
<-[
0
..
s1
-1
]}
// r0=_createArray (s1+s2) // 2.0
/*2.0
r0=_createArray (s1+s2)
0.2*/
//1.3
r0
=
_createArrayc
(
s1
+
s2
)
//3.1
s1
=
size
a
s2
=
length
l
arrayPlusRevList
a
l
:==
r2
where
r2
={
r1
&
[
sr
-
i
]=
e
\\
i
<-[
1
..
s2
]
&
e
<-
l
}
r1
={
r0
&
[
i
]=
a
.[
i
]
\\
i
<-[
0
..
s1
-1
]}
// r0=_createArray sr // 2.0
/*2.0
r0=_createArray sr // 2.0
0.2*/
//1.3
r0
=
_createArrayc
sr
//3.1
sr
=
s1
+
s2
s1
=
size
a
s2
=
length
l
frontend/_aconcat.icl
View file @
ab18d547
...
...
@@ -7,18 +7,26 @@ arrayConcat a1 a2
where
r2
={
r1
&
[
i
+
s1
]=
a2
.[
i
]
\\
i
<-[
0
..
s2
-1
]}
r1
={
r0
&
[
i
]=
a1
.[
i
]
\\
i
<-[
0
..
s1
-1
]}
// r0=_createArray (s1+s2) // 2.0
/*2.0
r0=_createArray (s1+s2)
0.2*/
//1.3
r0
=
_createArrayc
(
s1
+
s2
)
//3.1
s1
=
size
a1
s2
=
size
a2
arrayPlusList
a
l
:==
r2
where
r2
={
r1
&
[
i
+
s1
]=
e
\\
i
<-[
0
..
s2
-1
]
&
e
<-
l
}
r2
={
r1
&
[
i
+
s1
]=
e
\\
i
<-[
0
..
s2
-1
]
&
e
<-
l
}
r1
={
r0
&
[
i
]=
a
.[
i
]
\\
i
<-[
0
..
s1
-1
]}
// r0=_createArray (s1+s2) // 2.0
/*2.0
r0=_createArray (s1+s2)
0.2*/
//1.3
r0
=
_createArrayc
(
s1
+
s2
)
//3.1
s1
=
size
a
s2
=
length
l
...
...
@@ -27,10 +35,12 @@ arrayPlusRevList a l
where
r2
={
r1
&
[
sr
-
i
]=
e
\\
i
<-[
1
..
s2
]
&
e
<-
l
}
r1
={
r0
&
[
i
]=
a
.[
i
]
\\
i
<-[
0
..
s1
-1
]}
// r0=_createArray sr // 2.0
/*2.0
r0=_createArray sr // 2.0
0.2*/
//1.3
r0
=
_createArrayc
sr
//3.1
sr
=
s1
+
s2
s1
=
size
a
s2
=
length
l
frontend/comparedefimp.icl
View file @
ab18d547
...
...
@@ -154,10 +154,14 @@ compareDefImp untransformed dcl_modules icl_module heaps error_admin
compareWithConversions
conversions
dclDefs
iclDefs
tc_state
error_admin
=
iFoldSt
(
compareWithConversion
conversions
dclDefs
)
0
(
size
conversions
)
(
iclDefs
,
tc_state
,
error_admin
)
// type definition for 1.3 (should be added for 2.0)
compareWithConversion
::
!
w
:(
a
x
:
Int
)
!.(
b
c
)
!
Int
!(!
u
:(
d
c
),
!*
TypesCorrespondState
,
!*
ErrorAdmin
)
->
(!
v
:(
d
c
),
!.
TypesCorrespondState
,
!.
ErrorAdmin
)
|
Array
.
b
&
getIdentPos
,
select_u
,
t_corresponds
,
uselect_u
c
&
Array
.
d
&
Array
.
a
,
[
u
<=
v
,
w
<=
x
];
compareWithConversion
::
!{#
Int
}
!(
b
c
)
!
Int
!(!
u
:(
b
c
),
!*
TypesCorrespondState
,
!*
ErrorAdmin
)
->
(!
v
:(
b
c
),
!.
TypesCorrespondState
,
!.
ErrorAdmin
)
//1.3
|
Array
.
b
&
getIdentPos
,
select_u
,
t_corresponds
,
uselect_u
c
,
[
u
<=
v
]
//3.1
/*2.0
| Array b c & t_corresponds, getIdentPos c, [u <= v]
0.2*/
compareWithConversion
conversions
dclDefs
dclIndex
(
iclDefs
,
tc_state
,
error_admin
)
#
(
iclDef
,
iclDefs
)
=
iclDefs
![
conversions
.[
dclIndex
]]
(
corresponds
,
tc_state
)
=
t_corresponds
dclDefs
.[
dclIndex
]
iclDef
tc_state
...
...
@@ -169,10 +173,8 @@ compareFunctionTypesWithConversions conversions dcl_fun_types icl_functions tc_s
=
iFoldSt
(
compareTwoFunctionTypes
conversions
dcl_fun_types
)
0
(
size
conversions
)
(
icl_functions
,
tc_state
,
error_admin
)
// type definition for 1.3 (should be added for 2.0)
compareTwoFunctionTypes
::
!
w
:(
a
x
:
Int
)
!.(
b
FunType
)
!.
Int
!(!
u
:(
c
FunDef
),!*
TypesCorrespondState
,!*
ErrorAdmin
)
->
(!
v
:(
c
FunDef
),!.
TypesCorrespondState
,!.
ErrorAdmin
)
|
Array
.
b
&
Array
.
c
&
Array
.
a
,
[
u
<=
v
,
w
<=
x
];
compareTwoFunctionTypes
::
!{#
Int
}
!{#
FunType
}
!
Int
!*(!
u
:{#
FunDef
},!*
TypesCorrespondState
,!*
ErrorAdmin
)
->
(!
v
:{#
FunDef
},!.
TypesCorrespondState
,!.
ErrorAdmin
)
,
[
u
<=
v
]
compareTwoFunctionTypes
conversions
dcl_fun_types
dclIndex
(
icl_functions
,
tc_state
,
error_admin
)
#
(
fun_def
=:{
fun_type
},
icl_functions
)
=
icl_functions
![
conversions
.[
dclIndex
]]
=
case
fun_type
of
...
...
@@ -335,9 +337,12 @@ instance t_corresponds [a] | t_corresponds a where
=
return
False
// instance t_corresponds {# a} | t_corresponds a & Array {#} a // 2.0
/*2.0
instance t_corresponds {# a} | t_corresponds a & Array {#} a
0.2*/
//1.3
instance
t_corresponds
{#
a
}
|
ArrayElem
,
t_corresponds
a
//3.1
where
t_corresponds
dclArray
iclArray
#
size_dclArray
=
size
dclArray
...
...
@@ -345,7 +350,12 @@ where
=
return
False
=
loop
(
size_dclArray
-1
)
dclArray
iclArray
where
// loop :: !Int !{# a} !{# a} -> *TypesCorrespondMonad | t_corresponds a & Array {#} a // 2.0
/*2.0
loop :: !Int !{# a} !{# a} -> *TypesCorrespondMonad | t_corresponds a & Array {#} a // 2.0
0.2*/
//1.3
loop
::
!
Int
!{#
a
}
!{#
a
}
->
*
TypesCorrespondMonad
|
t_corresponds
,
select_u
a
//3.1
loop
i
dclArray
iclArray
|
i
<
0
=
return
True
...
...
frontend/convertcases.icl
View file @
ab18d547
...
...
@@ -1417,7 +1417,7 @@ where
mark_local_let_var_of_pattern_expr
depth
{
cv_variable
,
cv_count
}
var_heap
#
(
VI_LetExpression
lei
,
var_heap
)
=
readPtr
cv_variable
var_heap
|
depth
==
lei
.
lei_depth
=
var_heap
<:=
(
cv_variable
,
VI_LetExpression
{
lei
&
lei_count
=
cv_count
,
lei_status
=
LES_Untouched
})
=
(
var_heap
<:=
(
cv_variable
,
VI_LetExpression
{
lei
&
lei_count
=
cv_count
,
lei_status
=
LES_Untouched
})
)
==>
(
"mark_local_let_var_of_pattern_expr "
,
lei
.
lei_var
.
fv_name
,
cv_variable
,
(
lei
.
lei_var
.
fv_info_ptr
,
cv_count
,
depth
))
=
var_heap
...
...
frontend/utilities.dcl
View file @
ab18d547
...
...
@@ -9,7 +9,9 @@ import _aconcat
For Strings
*/
from
StdString
import
String
// 1.3
//1.3
from
StdString
import
String
//3.1
stringToCharList
::
!
String
->
[
Char
]
charListToString
::
![
Char
]
->
String
...
...
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