repositories
/
mTask.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
shares are working again, viewing at least
[mTask.git]
/
mTaskCode.icl
diff --git
a/mTaskCode.icl
b/mTaskCode.icl
index
3edd2ce
..
f1da0d8
100644
(file)
--- a/
mTaskCode.icl
+++ b/
mTaskCode.icl
@@
-1,7
+1,10
@@
implementation module mTaskCode
implementation module mTaskCode
+import Generics.gdynamic
+import Generics.gCons
+
import iTasks
import iTasks
-import
gdynamic, gCons,
GenEq, StdMisc, StdArray
+import GenEq, StdMisc, StdArray
import mTask
instance toCode MTask where toCode (MTask x) = "Task " + toCode x
import mTask
instance toCode MTask where toCode (MTask x) = "Task " + toCode x
@@
-74,6
+77,7
@@
instance sds Code where
in setCode Var +.+ c (type2string v + " " + name + " = " + toCode v +
";\n") +.+ setCode Setup +.+ unMain body}
con f = defCode f
in setCode Var +.+ c (type2string v + " " + name + " = " + toCode v +
";\n") +.+ setCode Setup +.+ unMain body}
con f = defCode f
+ pub _ = undef
defCode :: ((Code t p) -> In t (Main (Code u q))) -> Main (Code u r) | type t
defCode f =
defCode :: ((Code t p) -> In t (Main (Code u q))) -> Main (Code u r) | type t
defCode f =
@@
-352,23
+356,6
@@
instance analogIO Code where
instance noOp Code where noOp = C \rw c.c
:: Code a p = C ((ReadWrite (Code a Expr)) CODE -> CODE)
instance noOp Code where noOp = C \rw c.c
:: Code a p = C ((ReadWrite (Code a Expr)) CODE -> CODE)
-:: CODE =
- { fresh :: Int
- , freshMTask :: Int
- , funs :: [String]
- , ifuns :: Int
- , vars :: [String]
- , ivars :: Int
- , setup :: [String]
- , isetup :: Int
- , loop :: [String]
- , iloop :: Int
- , includes :: [String]
- , def :: Def
- , mode :: Mode
- , binds :: [String]
- }
-
unC :: (Code a p) -> ((ReadWrite (Code a Expr)) CODE -> CODE)
unC (C f) = f
unC :: (Code a p) -> ((ReadWrite (Code a Expr)) CODE -> CODE)
unC (C f) = f
@@
-376,10
+363,10
@@
unC (C f) = f
:: Mode = /*MainMode |*/ NoReturn | Return String | SubExp | Assign String
setMode :: Mode -> Code a p
:: Mode = /*MainMode |*/ NoReturn | Return String | SubExp | Assign String
setMode :: Mode -> Code a p
-setMode m = C \rw c.{
c & mode
= m}
+setMode m = C \rw c.{
CODE|c & mode`
= m}
getMode :: (Mode -> Code a p) -> Code a p
getMode :: (Mode -> Code a p) -> Code a p
-getMode f = C \rw c.unC (f c.mode) rw c
+getMode f = C \rw c.unC (f c.mode
`
) rw c
embed :: (Code a p) -> Code a p
embed e =
embed :: (Code a p) -> Code a p
embed e =
@@
-395,10
+382,10
@@
embed e =
(+.+) (C f) (C g) = C \rw c.g Rd (f Rd c)
fresh :: (Int -> (Code a p)) -> (Code a p)
(+.+) (C f) (C g) = C \rw c.g Rd (f Rd c)
fresh :: (Int -> (Code a p)) -> (Code a p)
-fresh f = C \rw c.unC (f c.fresh) rw {c & fresh = c.fresh + 1}
+fresh f = C \rw c.unC (f c.fresh) rw {
CODE |
c & fresh = c.fresh + 1}
freshMTask :: (Int -> (Code a p)) -> (Code a p)
freshMTask :: (Int -> (Code a p)) -> (Code a p)
-freshMTask f = C \rw c.unC (f c.freshMTask) rw {c & freshMTask = c.freshMTask + 1}
+freshMTask f = C \rw c.unC (f c.freshMTask) rw {
CODE |
c & freshMTask = c.freshMTask + 1}
setCode :: Def -> (Code a p)
setCode d = C \rw c.{c & def = d}
setCode :: Def -> (Code a p)
setCode d = C \rw c.{c & def = d}
@@
-608,7
+595,7
@@
newCode =
, iloop = 4
, includes = []
, def = Setup
, iloop = 4
, includes = []
, def = Setup
- , mode = NoReturn
+ , mode
`
= NoReturn
, binds = []
}
, binds = []
}