Skip to content
Browse files

Updated examples to use 'arg' rather than 'funArg'.

  • Loading branch information...
1 parent 1a8c1f4 commit 93db1ef35e24c1b18661e67ead6a881db0505d18 @leepike leepike committed Jan 31, 2012
Showing with 23 additions and 19 deletions.
  1. +3 −2 .gitignore
  2. +3 −3 Examples/BadExtVars.hs
  3. +17 −14 Examples/ExtFuns.hs
View
5 .gitignore
@@ -1,2 +1,3 @@
-dist/
-*~
+dist
+cabal-dev
+copilot-profiling
View
6 Examples/BadExtVars.hs
@@ -71,9 +71,9 @@ interp2 = interpret 10 spec2
-- Not Ok---different number of args.
func0 :: Stream Bool
-func0 = externFun "func0" [funArg x] (Just $ x < 4)
+func0 = externFun "func0" [arg x] (Just $ x < 4)
func1 :: Stream Bool
-func1 = externFun "func0" [funArg x, funArg y] (Just $ (cast x + y) > 10)
+func1 = externFun "func0" [arg x, arg y] (Just $ (cast x + y) > 10)
spec3 :: Spec
spec3 = trigger "trigger" true [ arg func0
@@ -85,7 +85,7 @@ interp3 :: IO ()
interp3 = interpret 10 spec3
func2 :: Stream Bool
-func2 = externFun "func0" [funArg y] (Just $ y > 4)
+func2 = externFun "func0" [arg y] (Just $ y > 4)
-- Should fail: func0 and func2 say that "func0" have different typed arguments.
spec4 :: Spec
View
31 Examples/ExtFuns.hs
@@ -9,34 +9,34 @@
module ExtFuns ( extFuns ) where
import Language.Copilot
---import qualified Copilot.Compile.C99 as C
+import qualified Copilot.Compile.C99 as C
+import qualified Copilot.Compile.SBV as S
--------------------------------------------------------------------------------
nats :: Stream Word16
-nats = [0] ++ nats + 1
+nats = [0,1] ++ nats + 1
---------------------------------------------------------------------------------
--- Function func0 and it's environment for interpreting
+-- Function func0 and it's environment for interpreting
func0 :: Stream Word16
-func0 = externFun "func0" [ funArg x, funArg nats ]
+func0 = externFun "func0" [ arg x, arg nats ]
(Just $ cast x + nats)
where x = externW8 "x" (Just [0..])
-
----------------------------------------------------------------------------------
--- Function func0 with another set of args and it's environment for interpreting
-
--- func2 :: Stream Word16
--- func2 = externFun "func0" [ funArg $ constW8 3, funArg $ constW16 4 ]
--- (Just $ constW16 4 + 1)
---------------------------------------------------------------------------------
----------------------------------------------------------------------------------
-- Function func1 and it's environment for interpreting
func1 :: Stream Bool
func1 = externFun "func1" [] (Just $ [False] ++ not func1)
+
+---------------------------------------------------------------------------------
+
+-- Function func0 with another set of args and it's environment for interpreting
+func2 :: Stream Word16
+func2 = externFun "func0" [ arg $ constW8 3, arg $ constW16 4 ]
+ (Just $ cast (constW8 3) + constW16 4)
---------------------------------------------------------------------------------
@@ -46,11 +46,14 @@ a = func0 + func0
spec :: Spec
spec = trigger "trigger" true [ arg func0
, arg func1
+ , arg func2
, arg a ]
extFuns :: IO ()
extFuns = do
--- reify spec >>= C.compile C.defaultParams
- interpret 10 spec
+ interpret 10 spec
+ reify spec >>= C.compile C.defaultParams
+ reify spec >>= S.compile S.defaultParams
+
--------------------------------------------------------------------------------

0 comments on commit 93db1ef

Please sign in to comment.
Something went wrong with that request. Please try again.