Skip to content
GitLab
Menu
Projects
Groups
Snippets
/
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Menu
Open sidebar
curry
curry-tools
Commits
2f5e656b
Commit
2f5e656b
authored
Oct 26, 2015
by
Michael Hanus
Browse files
Soem refactoring
parent
3dbae13b
Changes
3
Hide whitespace changes
Inline
Side-by-side
browser/SourceProgGUI.curry
View file @
2f5e656b
...
...
@@ -9,31 +9,18 @@
--- <empty line> -> terminate GUI
--- q -> terminate GUI
---
--- @version
June
201
1
--- @version
October
201
5
------------------------------------------------------------------------
import IO
import GUI
import ReadNumeric
import FlatCurry.Show(showCurryId)
import List(isPrefixOf)
import Distribution(getLoadPathForFile)
import FileGoodies
import Distribution(lookupModuleSourceInLoadPath)
import System(getArgs)
import Char(isAlpha,isSpace)
import Maybe(isJust)
---------------------------------------------------------------------
-- add a directory name for a Curry source file by looking up the
-- current load path (CURRYPATH):
findSourceFileInLoadPath :: String -> IO (String)
findSourceFileInLoadPath modname = do
loadpath <- getLoadPathForFile modname
mbfname <- lookupFileInPath (baseName modname) [".lcurry",".curry"] loadpath
maybe (error $ "Curry file for module \""++modname++"\" not found!")
return
mbfname
-- find a function declaration in a program text:
findFunDeclInProgText :: String -> String -> Int
findFunDeclInProgText progtext fname =
...
...
@@ -84,11 +71,14 @@ sourceProgGUI cnt progdefs =
-- start the counter GUI:
startGUI :: String -> IO ()
startGUI prog = do
filename <- findSourceFileInLoadPath prog
contents <- readFile filename
runHandlesControlledGUI ("Module: "++filename)
(sourceProgGUI contents (splitProgDefs contents))
[stdin]
mbsrc <- lookupModuleSourceInLoadPath prog
case mbsrc of
Nothing -> error $ "Curry file for module \""++prog++"\" not found!"
Just (_,filename) -> do
contents <- readFile filename
runHandlesControlledGUI ("Module: "++filename)
(sourceProgGUI contents (splitProgDefs contents))
[stdin]
main :: IO ()
main = do
...
...
@@ -140,9 +130,3 @@ isCommentLine :: String -> Bool
isCommentLine l = take 2 (dropWhile isSpace l) == "--"
----------------------------------------------------------------------------
m :: String -> IO ()
m prog = do
filename <- findSourceFileInLoadPath prog
contents <- readFile filename
print $ splitProgDefs contents
createmakefile/CreateMakefile.curry
View file @
2f5e656b
...
...
@@ -51,7 +51,7 @@ showMake mainmod sourcefiles =
-- add a directory name for a Curry source file by looking up the
-- current load path (CURRYPATH):
findSourceFileInLoadPath modname = do
loadpath <- getLoadPathFor
Fi
le modname
loadpath <- getLoadPathFor
Modu
le modname
mbfname <- lookupFileInPath (baseName modname) [".lcurry",".curry"] loadpath
maybe (error ("Curry file for module \""++modname++"\" not found!"))
(return . dropLocal)
...
...
genint/GenInt.curry
View file @
2f5e656b
...
...
@@ -24,7 +24,7 @@ import System(getArgs,getEnviron,system)
import Directory
import FileGoodies
import Sort(mergeSort,leqString)
import Distribution(
getLoadPathForFile,
stripCurrySuffix,modNameToPath
import Distribution(stripCurrySuffix,modNameToPath
,lookupModuleSourceInLoadPath)
main = do
...
...
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment