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

CASS: public operation analyzePublic added

parent 390e207c
......@@ -5,7 +5,7 @@
--- registered in the top part of this module.
---
--- @author Heiko Hoffmann, Michael Hanus
--- @version May 2013
--- @version August 2014
--------------------------------------------------------------------
module AnalysisCollection(
......
......@@ -5,12 +5,13 @@
--- to use the analysis system in another Curry program.
---
--- @author Heiko Hoffmann, Michael Hanus
--- @version May 2013
--- @version August 2014
--------------------------------------------------------------------------
module AnalysisServer(main, initializeAnalysisSystem,
analyzeModuleForBrowser, analyzeFunctionForBrowser,
analyzeGeneric, analyzeInterface) where
analyzeGeneric, analyzePublic, analyzeInterface)
where
import ReadNumeric(readNat)
import Char(isSpace)
......@@ -169,15 +170,25 @@ analyzeGeneric analysis moduleName = do
else
analyzeMain analysis moduleName [] True
--- Start the analysis system with a given analysis to compute properties
--- of a module interface.
--- The analysis must be a registered one if workers are used.
--- If it is a combined analysis, the base analysis must be also
--- a registered one.
analyzePublic :: Analysis a -> String -> IO (Either (ProgInfo a) String)
analyzePublic analysis moduleName =
analyzeGeneric analysis moduleName
>>= return . either (Left . publicProgInfo) Right
--- Start the analysis system with a given analysis to compute properties
--- of a module interface.
--- The analysis must be a registered one if workers are used.
--- If it is a combined analysis, the base analysis must be also
--- a registered one.
analyzeInterface :: Analysis a -> String -> IO (Either [(QName,a)] String)
analyzeInterface analysis moduleName = do
analyzeInterface analysis moduleName =
analyzeGeneric analysis moduleName
>>= return . either (Left . publicListFromProgInfo) Right
>>= return . either (Left . publicListFromProgInfo) Right
--------------------------------------------------------------------------
-- start a number of workers at server start
......
......@@ -16,6 +16,7 @@ import XML
--- The first component are public declarations, the second the private ones.
data ProgInfo a = ProgInfo (FM QName a) (FM QName a)
--- The empty program information.
emptyProgInfo:: ProgInfo a
emptyProgInfo = ProgInfo (emptyFM (<)) (emptyFM (<))
......@@ -39,6 +40,8 @@ lists2ProgInfo (xs,ys) = ProgInfo (listToFM (<) xs) (listToFM (<) ys)
publicListFromProgInfo:: ProgInfo a -> [(QName,a)]
publicListFromProgInfo (ProgInfo fm1 _) = fmToList fm1
--- Transforms a program information into a pair of lists
--- containing the information about public and private entities.
progInfo2Lists :: ProgInfo a -> ([(QName,a)],[(QName,a)])
progInfo2Lists (ProgInfo map1 map2)= (fmToList map1,fmToList map2)
......@@ -56,6 +59,8 @@ mapProgInfo:: (a->b) -> ProgInfo a -> ProgInfo b
mapProgInfo func (ProgInfo map1 map2) =
ProgInfo (mapFM (\_ b->func b) map1) (mapFM (\_ b->func b) map2)
--- Transforms a program information into a program information
--- about interface entities only.
publicProgInfo :: ProgInfo a -> ProgInfo a
publicProgInfo (ProgInfo pub _) = ProgInfo pub (emptyFM (<))
......
......@@ -12,7 +12,7 @@
--- @version August 2014
-----------------------------------------------------------------------------
module RequiredValues(AType(..),showAType,AFType(..),showAFType,
module RequiredValues(AType(..),showAType,AFType(..),showAFType,lubAType,
reqValueAnalysis)
where
......
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