Hets2mmt.hs revision 459edd48aac90524e3c97c25a2a042c399052b6b
934473566cf3a8e4044ed10e408b4c44079684b1Christian Maeder a.jakubauskas@jacobs-university.de
b10d6cef708b7a659f2d3b367e8e0db0d03ae3f5Till Mossakowskiimport Framework.Analysis(addLogic2LogicList)
7ff59aa438d7a210789cad2c2c745bc9967eff82Till Mossakowskistaloneclass :: String
7ff59aa438d7a210789cad2c2c745bc9967eff82Till Mossakowskicalljar :: FilePath -> IO (String, Maybe String)
7ff59aa438d7a210789cad2c2c745bc9967eff82Till Mossakowskicalljar fileName = do
7ff59aa438d7a210789cad2c2c745bc9967eff82Till Mossakowski (_, Just hout, maybeErr, _) <- createProcess (
b10d6cef708b7a659f2d3b367e8e0db0d03ae3f5Till Mossakowski proc "java" ["-cp",
1d581e55c7ec020a445684310394c3a5fc056e96Christian Maeder staloneclass,
b10d6cef708b7a659f2d3b367e8e0db0d03ae3f5Till Mossakowski { std_out = CreatePipe }
b10d6cef708b7a659f2d3b367e8e0db0d03ae3f5Till Mossakowski cont <- hGetContents hout
b10d6cef708b7a659f2d3b367e8e0db0d03ae3f5Till Mossakowski case maybeErr of
b10d6cef708b7a659f2d3b367e8e0db0d03ae3f5Till Mossakowski (Just hErr) -> do
b10d6cef708b7a659f2d3b367e8e0db0d03ae3f5Till Mossakowski err <- hGetContents hErr
ebe4d5a8e51f6009d6e7ca465f5963ce46a07fd2Christian Maeder return (cont, Just err)
aa4679922a8363b4e494079f53aaf4f64554aae0Christian Maeder Nothing -> return (cont, Nothing)
6a00a2b0961b1553d4f5106d655f6f90bb6c1777Christian MaedercallMMT :: FilePath -> IO [Diagnosis]
c7e03d0708369f944b6f235057b39142a21599f2Mihai CodescucallMMT fp = do
342beb91d58bcf41178240c37d0f6c0c4f83c53eMihai Codescu (out, maybeErr) <- calljar fp
aa4679922a8363b4e494079f53aaf4f64554aae0Christian Maeder case maybeErr of
b10d6cef708b7a659f2d3b367e8e0db0d03ae3f5Till Mossakowski (Just err) -> return [Diag Warning out nullRange,
2add146602f6eb47058b67142bd91ae40a32fd66Christian Maeder Diag Error err nullRange]
2add146602f6eb47058b67142bd91ae40a32fd66Christian Maeder Nothing -> return [Diag Warning out nullRange]
934473566cf3a8e4044ed10e408b4c44079684b1Christian MaedermmtRes :: FilePath -> IO (Result (LibName, LibEnv))
b10d6cef708b7a659f2d3b367e8e0db0d03ae3f5Till MossakowskimmtRes fname = do
cf7e0d6750e408ddb47545d6b8349a70cf0b47afChristian Maeder libDir <- getEnvDef "HETS_LIB" ""
556f473448dfcceee22afaa89ed7a364489cdbbbChristian Maeder putStr $ "HETS_LIB at " ++ libDir
556f473448dfcceee22afaa89ed7a364489cdbbbChristian Maeder putStr $ "calling MMT on " ++ libDir ++ fname
cf7e0d6750e408ddb47545d6b8349a70cf0b47afChristian Maeder dgs <- callMMT (libDir </> fname)
96f0ef61a405144ff30a9d77963881dc32113750Klaus Luettich putStr $ show dgs
f2d72b2254513ef810b0951f0b13a62c2921cb4dTill Mossakowski addLogic2LogicList $ dropExtension fname
18a4d5cb6828f080db9c5f9551785c5151027271Christian Maeder return (emptyRes (dropExtension fname) dgs)
6d9f68d2b5fafea0b5e0fc59a1d557174e032c02Christian MaederemptyRes :: String -> [Diagnosis] -> Result (LibName, LibEnv)
b565cd55a13dbccc4e66c344316da525c961e4caTill MossakowskiemptyRes lname = (`Result` Just (emptyLibName lname, emptyLibEnv))