Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Check if ltlsynt is available on path in tslsynth #57

Closed
wants to merge 2 commits into from
Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
16 changes: 15 additions & 1 deletion src/tools/tslsynth/Main.hs
Original file line number Diff line number Diff line change
Expand Up @@ -17,14 +17,17 @@ where
-----------------------------------------------------------------------------

import Config (Configuration (..), parseArguments)
import Control.Monad (unless)
import Data.List (isPrefixOf)
import Data.Maybe (fromJust)
import Data.Maybe (fromJust, isJust)
import EncodingUtils (initEncoding)
import FileUtils (loadTSL, tryReadContent)
import Hanoi (parse)
import qualified Syfco as S
import System.Directory (findExecutable)
import System.Exit
import System.FilePath.Posix (takeBaseName)
import System.IO (hPutStrLn, stderr)
import System.Process (readProcessWithExitCode)
import TSL (implementHoa, preprocess, toTLSF)

Expand All @@ -38,6 +41,12 @@ main = do
Configuration {input, codeTarget, writeHoa} <- parseArguments
let fileBasename = takeBaseName $ fromJust input

-- check if ltlsynt is available on path
ltlsyntAvailable <- isLtlsyntAvailable
unless ltlsyntAvailable $ do
hPutStrLn stderr "'ltlsynt' is not found."
exitFailure

-- tslmt2tsl
content <- tryReadContent input
case preprocess (content ++ "\n") of
Expand Down Expand Up @@ -96,6 +105,11 @@ callLtlsynt tlsfContents = do
>> return "UNREALIZABLE"
else return stdout

isLtlsyntAvailable :: IO Bool
isLtlsyntAvailable = do
m <- findExecutable "ltlsynt"
return $ isJust m

prFormulae ::
S.Configuration -> S.Specification -> String
prFormulae c s = case S.apply c s of
Expand Down
Loading