Skip to content

Commit cfff7a5

Browse files
Generate Copilot monitors
1 parent 90b1cc5 commit cfff7a5

File tree

2 files changed

+50
-0
lines changed

2 files changed

+50
-0
lines changed

.github/workflows/repo-ghc-8.6-cabal-2.4-ros.yml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -48,5 +48,7 @@ jobs:
4848
- name: Generate ROS app
4949
run: |
5050
ogma ros --app-target-dir demo --variable-db ogma-cli/examples/ros-copilot/vars-db --variable-file ogma-cli/examples/ros-copilot/variables --handlers-file ogma-cli/examples/ros-copilot/handlers
51+
cabal v1-exec -- runhaskell ogma-cli/examples/ros-copilot/ROS.hs
52+
find demo/
5153
cd demo/
5254
docker build .
Lines changed: 48 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,48 @@
1+
import Copilot.Compile.C99
2+
import Copilot.Language hiding (prop)
3+
import Copilot.Language.Prelude
4+
import Copilot.Library.LTL (next)
5+
import Copilot.Library.MTL hiding (since, alwaysBeen, trigger)
6+
import Copilot.Library.PTLTL (since, previous, alwaysBeen)
7+
import qualified Copilot.Library.PTLTL as PTLTL
8+
import qualified Copilot.Library.MTL as MTL
9+
import Language.Copilot (reify)
10+
import Prelude hiding ((&&), (||), (++), (<=), (>=), (<), (>), (==), (/=), not)
11+
12+
a :: Stream (Bool)
13+
a = extern "a" Nothing
14+
15+
-- | testCopilot
16+
-- @
17+
-- unimportant
18+
-- @
19+
propTestCopilot :: Stream Bool
20+
propTestCopilot = a
21+
22+
23+
-- | Clock that increases in one-unit steps.
24+
clock :: Stream Int64
25+
clock = [0] ++ (clock + 1)
26+
27+
28+
-- | First Time Point
29+
ftp :: Stream Bool
30+
ftp = [True] ++ false
31+
32+
33+
pre :: Stream Bool -> Stream Bool
34+
pre = ([False] ++)
35+
36+
tpre :: Stream Bool -> Stream Bool
37+
tpre = ([True] ++)
38+
39+
-- | Complete specification. Calls the C function void handler(); when
40+
-- the property is violated.
41+
spec :: Spec
42+
spec = do
43+
trigger "handlerTestCopilot" (not propTestCopilot) []
44+
45+
46+
main :: IO ()
47+
main = reify spec >>= compile "monitor"
48+

0 commit comments

Comments
 (0)