Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

Testing sampling functions...

  • Loading branch information...
commit ccfa18526d87c8a935a58744580ca1761cfd267d 1 parent 58f6686
@leepike authored
Showing with 32 additions and 0 deletions.
  1. +32 −0 Examples/ExtFuns.hs
View
32 Examples/ExtFuns.hs
@@ -0,0 +1,32 @@
+--------------------------------------------------------------------------------
+-- Copyright © 2011 National Institute of Aerospace / Galois, Inc.
+--------------------------------------------------------------------------------
+
+-- | Example in sampling external functions.
+
+{-# LANGUAGE RebindableSyntax #-}
+
+module Main where
+
+import Language.Copilot
+import qualified Copilot.Compile.C99 as C
+--------------------------------------------------------------------------------
+
+nats :: Stream Word16
+nats = [0] ++ nats + 1
+
+sample0 :: Stream Word16
+sample0 = externFun "func0" [funArg $ externW8 "x", funArg nats]
+
+sample1 :: Stream Bool
+sample1 = externFun "func1" []
+
+spec :: Spec
+spec =
+ trigger "trigger" true [ arg sample0, arg sample1 ]
+
+main :: IO ()
+main =
+ reify spec >>= C.compile C.defaultParams
+
+--------------------------------------------------------------------------------
Please sign in to comment.
Something went wrong with that request. Please try again.