Commit 06f617c9 authored by Michael Hanus 's avatar Michael Hanus
Browse files

Code improvements in CASS

parent e1cbfea5
......@@ -186,6 +186,8 @@ analyzeMain analysis modname handles load = do
if null modulesToDo
then return Nothing
else do
debugMessage 1
("Number of modules to be analyzed: " ++ show (length modulesToDo))
prepareCombinedAnalysis analysis modname (map fst modulesToDo) handles
numworkers <- numberOfWorkers
if numworkers>0
......
......@@ -93,19 +93,22 @@ getDependencyList :: [String] -> [(String,[String])]
-> IO [(String,[String])]
getDependencyList [] moddeps = return moddeps
getDependencyList (mname:mods) moddeps =
let (newmoddeps,imps,processed) = checkAndReorder mname [] moddeps
in if not processed
then do --debugMessage 3 ("Getting imports of "++ mname)
--debugMessage 3 ("Still to do: "++ show mods)
imports <- getImports mname
let newimports = filter (`notElem` mods) imports
getDependencyList (mods++newimports) ((mname,imports):moddeps)
else getDependencyList (mods++imps) newmoddeps
checkAndReorder _ _ [] = ([], [], False)
checkAndReorder key1 list1 ((key2,value):rest)
| key1==key2 = ((key2,value):reverse list1++rest, value, True)
| otherwise = checkAndReorder key1 ((key2,value):list1) rest
maybe (do --debugMessage 3 ("Getting imports of "++ mname)
--debugMessage 3 ("Still to do: "++ show mods)
imports <- getImports mname
getDependencyList (addNewMods mods imports)
((mname,imports):moddeps))
(\ (newmoddeps,imps) ->
getDependencyList (addNewMods mods imps) newmoddeps)
(lookupAndReorder mname [] moddeps)
-- add new modules if they are not already there:
addNewMods oldmods newmods = oldmods ++ filter (`notElem` oldmods) newmods
lookupAndReorder _ _ [] = Nothing
lookupAndReorder mname list1 ((amod,amodimports):rest)
| mname==amod = Just ((amod,amodimports):reverse list1++rest, amodimports)
| otherwise = lookupAndReorder mname ((amod,amodimports):list1) rest
-- get timestamp of analysis file
getAnaFileTime :: String -> String -> IO (String,Maybe ClockTime)
......
......@@ -13,7 +13,7 @@ REPL = $(ROOT)/bin/$(CURRYSYSTEM)
CLEANCURRY = $(ROOT)/bin/cleancurry
INSTALLBIN = $(ROOT)/bin/cass
# Source modules of currydoc:
# Source modules of CASS:
DEPS = Analysis.curry AnalysisCollection.curry AnalysisDependencies.curry \
AnalysisServer.curry AnalysisWorker.curry Configuration.curry \
CurryFiles.curry FlatCurryDependency.curry GenericProgInfo.curry \
......
......@@ -11,28 +11,47 @@ CURRYTOOLS=$(ROOT)/currytools
CASS=$(CURRYTOOLS)/CASS
ANADIR=$(CURRYTOOLS)/analysis
.PHONY: all
all: BrowserGUI SourceProgGUI
# binaries
REPL = $(ROOT)/bin/$(CURRYSYSTEM)
CLEANCURRY = $(ROOT)/bin/cleancurry
INSTALLBIN = $(ROOT)/bin/currybrowse
# source modules of the Curry Browser:
DEPS = BrowserGUI.curry ShowFlatCurry.curry Imports.curry \
AnalysisTypes.curry BrowserAnalysis.curry ShowGraph.curry \
$(CASS)/AnalysisServer.curry $(CASS)/AnalysisCollection.curry \
$(CURRYTOOLS)/addtypes/AddTypes.curry \
$(CURRYTOOLS)/importcalls/ImportCalls.curry \
$(LIB)/GUI.curry $(LIB)/IOExts.curry $(LIB)/System.curry \
$(META)/FlatCurry.curry $(META)/FlatCurryShow.curry \
analysis/*.curry $(ANADIR)/*.curry
LOADPATH = analysis:$(CASS):$(ANADIR):$(CURRYTOOLS)/importcalls:$(CURRYTOOLS)/addtypes
.PHONY: install
install: BrowserGUI SourceProgGUI
$(MAKE) uninstall
ln -s $(CURDIR)/BrowserGUI $(INSTALLBIN)
.PHONY: uninstall
uninstall:
rm -f $(INSTALLBIN)
# generate executable for Curry Browser:
BrowserGUI: BrowserGUI.curry ShowFlatCurry.curry Imports.curry \
AnalysisTypes.curry BrowserAnalysis.curry ShowGraph.curry \
$(CASS)/AnalysisServer.curry $(CASS)/AnalysisCollection.curry \
$(CURRYTOOLS)/addtypes/AddTypes.curry \
$(CURRYTOOLS)/importcalls/ImportCalls.curry \
$(LIB)/GUI.curry $(LIB)/IOExts.curry $(LIB)/System.curry \
$(META)/FlatCurry.curry $(META)/FlatCurryShow.curry \
analysis/*.curry $(ANADIR)/*.curry
$(ROOT)/bin/$(CURRYSYSTEM) $(REPL_OPTS) \
:set path analysis:$(CASS):$(ANADIR):$(CURRYTOOLS)/importcalls:$(CURRYTOOLS)/addtypes \
BrowserGUI: $(DEPS)
$(REPL) $(REPL_OPTS) \
:set path $(LOADPATH) \
:l BrowserGUI :eval "patchReadmeVersion" :save :q
(cd $(ROOT)/bin ; rm -f currybrowse ; \
ln -s ../currytools/browser/BrowserGUI currybrowse)
# load the Curry Browser program into the Curry system:
.PHONY: load
load: $(DEPS)
$(REPL) $(REPL_OPTS) :set path $(LOADPATH) :l BrowserGUI
SourceProgGUI: SourceProgGUI.curry $(LIB)/GUI.curry
$(ROOT)/bin/$(CURRYSYSTEM) $(REPL_OPTS) :l SourceProgGUI :save :q
.PHONY: clean
clean:
$(ROOT)/bin/cleancurry
rm -f BrowserGUI SourceProgGUI $(ROOT)/bin/currybrowse
clean: uninstall
$(CLEANCURRY) -r
rm -f BrowserGUI SourceProgGUI
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