forked from nasa/ogma
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
ogma-core: Use template expansion to generate standalone monitoring c…
…omponent. Refs nasa#189. The standlone backend uses a fixed template to generate the Copilot monitor. That template does not fit all use cases, so we are finding users heavily modifying the output (which is hard to keep up with when there are changes), and or not using ogma altogether for that reason. This commit modifies the ogma-core standalone command to use mustache to generate the Copilot monitor via a template and variable expansion. We introduce a new template that uses variables, and we modify the cabal file to include the new files as data files that are copied over during installation. To be able to generate the files, we need to introduce a target directory option for the standalone command.
- Loading branch information
1 parent
c4060bf
commit c984144
Showing
4 changed files
with
117 additions
and
115 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,40 @@ | ||
import Copilot.Compile.C99 | ||
import Copilot.Language hiding (prop) | ||
import Copilot.Language.Prelude | ||
import Copilot.Library.LTL (next) | ||
import Copilot.Library.MTL hiding (since, alwaysBeen, trigger) | ||
import Copilot.Library.PTLTL (since, previous, alwaysBeen) | ||
import qualified Copilot.Library.PTLTL as PTLTL | ||
import qualified Copilot.Library.MTL as MTL | ||
import Language.Copilot (reify) | ||
import Prelude hiding ((&&), (||), (++), (<=), (>=), (<), (>), (==), (/=), not) | ||
|
||
{{{externs}}} | ||
{{{internals}}} | ||
{{{reqs}}} | ||
|
||
-- | Clock that increases in one-unit steps. | ||
clock :: Stream Int64 | ||
clock = [0] ++ (clock + 1) | ||
|
||
-- | First Time Point | ||
ftp :: Stream Bool | ||
ftp = [True] ++ false | ||
|
||
pre :: Stream Bool -> Stream Bool | ||
pre = ([False] ++) | ||
|
||
tpre :: Stream Bool -> Stream Bool | ||
tpre = ([True] ++) | ||
|
||
notPreviousNot :: Stream Bool -> Stream Bool | ||
notPreviousNot = not . PTLTL.previous . not | ||
|
||
-- | Complete specification. Calls C handler functions when properties are | ||
-- violated. | ||
spec :: Spec | ||
spec = do | ||
{{{triggers}}} | ||
|
||
main :: IO () | ||
main = reify spec >>= compile "{{{specName}}}" |