Commit db727167 authored by Michael Hanus 's avatar Michael Hanus
Browse files

CASS: printing of analysis results made slightly prettier

parent 22ea5f18
......@@ -5,10 +5,10 @@
--- to use the analysis system in another Curry program.
---
--- @author Heiko Hoffmann, Michael Hanus
--- @version August 2014
--- @version May 2015
--------------------------------------------------------------------------
module AnalysisServer(main, initializeAnalysisSystem,
module AnalysisServer(main, initializeAnalysisSystem, analyzeModuleAsText,
analyzeModuleForBrowser, analyzeFunctionForBrowser,
analyzeGeneric, analyzePublic, analyzeInterface)
where
......@@ -67,8 +67,7 @@ processArgs enforce args = case args of
processArgs enforce rargs
[ananame,mname] ->
if ananame `elem` registeredAnalysisNames
then analyzeModule ananame (stripSuffix mname) enforce AText >>=
putStrLn . formatResult mname "Text" Nothing True
then analyzeModuleAsText ananame (stripSuffix mname) enforce >>= putStrLn
else showError
_ -> showError
where
......@@ -116,6 +115,17 @@ mainServer mbport = do
serverLoop socket1 []
--- Run the analysis system and show the analysis results in standard textual
--- representation.
--- The third argument is a flag indicating whether the
--- (re-)analysis should be enforced.
--- Note that, before its first use, the analysis system must be initialized
--- by 'initializeAnalysisSystem'.
analyzeModuleAsText :: String -> String -> Bool -> IO String
analyzeModuleAsText ananame mname enforce =
analyzeModule ananame (stripSuffix mname) enforce AText >>=
return . formatResult mname "Text" Nothing True
--- Run the analysis system to show the analysis results in the BrowserGUI.
--- Note that, before its first use, the analysis system must be initialized
--- by 'initializeAnalysisSystem'.
......
......@@ -11,7 +11,7 @@ module LoadAnalysis where
import Directory
import Distribution(stripCurrySuffix)
import FilePath
import System(system,getArgs,getEnviron)
import System(system)
import GenericProgInfo
import Configuration(debugMessage,getWithPrelude)
import IO
......
......@@ -3,13 +3,13 @@
--- anlysis server.
---
--- @author Heiko Hoffmann, Michael Hanus
--- @version March 2013
--- @version May 2015
--------------------------------------------------------------------
module ServerFormats(serverFormats,formatResult) where
import GenericProgInfo
import FlatCurry(QName)
import FlatCurry(QName,showQNameInModule)
import XML
--------------------------------------------------------------------
......@@ -40,10 +40,10 @@ formatResult moduleName outForm (Just name) _ (Left pinfo) =
"Text" -> value
"XML" -> showXmlDoc (xml "result" [xtxt value])
-- Format a complete module:
formatResult _ outForm Nothing public (Left pinfo) =
formatResult moduleName outForm Nothing public (Left pinfo) =
case outForm of
"CurryTerm" -> show entities
"Text" -> formatAsText entities
"Text" -> formatAsText moduleName entities
"XML" -> let (pubxml,privxml) = progInfo2XML pinfo
in showXmlDoc
(xml "results"
......@@ -53,7 +53,8 @@ formatResult _ outForm Nothing public (Left pinfo) =
in if public then pubents else pubents++privents
-- Format a list of analysis results as a string (lines of analysis results).
formatAsText :: [(QName,String)] -> String
formatAsText = unlines . map (\ ((mname,name),r) -> mname++"."++name++" "++r)
formatAsText :: String -> [(QName,String)] -> String
formatAsText moduleName =
unlines . map (\ (qf,r) -> showQNameInModule moduleName qf ++ " : " ++ r)
--------------------------------------------------------------------
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment