aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authormartinw2000-06-09 14:07:38 +0000
committermartinw2000-06-09 14:07:38 +0000
commit8cee3ea989bfd17b42642f13d09d390da34ada7c (patch)
treeac5ff70561dbc701f692e134bf2051373adca1db
parentpredef.icl: StdDynamics has become StdDynamic (diff)
Added preprocessor directives, so that one and the same source can be
compiled with Clean 1.3 and Clean 2.0 git-svn-id: https://svn.cs.ru.nl/repos/clean-compiler/trunk@155 1f8540f1-abd5-4d5b-9d24-4c5ce8603e2d
-rw-r--r--frontend/_aconcat.dcl20
-rw-r--r--frontend/_aconcat.icl22
-rw-r--r--frontend/comparedefimp.icl32
-rw-r--r--frontend/convertcases.icl2
-rw-r--r--frontend/utilities.dcl4
5 files changed, 56 insertions, 24 deletions
diff --git a/frontend/_aconcat.dcl b/frontend/_aconcat.dcl
index 789a975..487f1f3 100644
--- a/frontend/_aconcat.dcl
+++ b/frontend/_aconcat.dcl
@@ -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
-
diff --git a/frontend/_aconcat.icl b/frontend/_aconcat.icl
index b0c4d95..67d7771 100644
--- a/frontend/_aconcat.icl
+++ b/frontend/_aconcat.icl
@@ -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
-
-
diff --git a/frontend/comparedefimp.icl b/frontend/comparedefimp.icl
index de0286a..27ecbca 100644
--- a/frontend/comparedefimp.icl
+++ b/frontend/comparedefimp.icl
@@ -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
diff --git a/frontend/convertcases.icl b/frontend/convertcases.icl
index e50d792..22ee76a 100644
--- a/frontend/convertcases.icl
+++ b/frontend/convertcases.icl
@@ -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
diff --git a/frontend/utilities.dcl b/frontend/utilities.dcl
index 66bdc2f..3ae0b5e 100644
--- a/frontend/utilities.dcl
+++ b/frontend/utilities.dcl
@@ -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