Commit 0f8c61a7 authored by Michael Hanus 's avatar Michael Hanus
Browse files

Fixes for hierarchical lib names

parent 3ea6c340
currytools @ f522b1ba
Subproject commit 9e0a8b507f658fccdafecced5a31a969f0189ca7
Subproject commit f522b1ba9f5249a05e1a5e71cd03bfc07d09591f
lib-trunk @ 612a4baa
Subproject commit 30c7bcbc01c79cf44033f61858e5c5d5b8a4d738
Subproject commit 612a4baa4d005d9685bf303063e03c7020844d1c
......@@ -11,9 +11,11 @@
module Flat where
import Directory
import Char
import Directory
import Distribution
import FilePath ((<.>))
import Maybe (isNothing)
------------------------------------------------------------------------------
-- Definition of data types for representing FlatCurry programs:
......@@ -260,16 +262,27 @@ readFlatCurry progfile =
readFlatCurryWithParseOptions :: String -> FrontendParams -> IO Prog
readFlatCurryWithParseOptions progname options = do
existsCurry <- doesFileExist (progname++".curry")
existsLCurry <- doesFileExist (progname++".lcurry")
if existsCurry || existsLCurry
then callFrontendWithParams FCY options progname
else done
filename <- findFileInLoadPath (progname++".fcy")
mbmoddir <- lookupModuleSourceInLoadPath progname
>>= return . maybe Nothing (Just . fst)
unless (isNothing mbmoddir) $
callFrontendWithParams FCY options progname
filename <- findFileInLoadPath (flatCurryFileName progname)
readFlatCurryFile filename
--- Transforms a name of a Curry program (with or without suffix ".curry"
--- or ".lcurry") into the name of the file containing the
--- corresponding FlatCurry program.
flatCurryFileName :: String -> String
flatCurryFileName prog = inCurrySubdir (stripCurrySuffix prog) <.> "fcy"
--- Transforms a name of a Curry program (with or without suffix ".curry"
--- or ".lcurry") into the name of the file containing the
--- corresponding FlatCurry program.
flatCurryIntName :: String -> String
flatCurryIntName prog = inCurrySubdir (stripCurrySuffix prog) <.> "fint"
--- I/O action which reads a FlatCurry program from a file in ".fcy" format.
--- In contrast to <CODE>readFlatCurry</CODE>, this action does not parse
--- In contrast to `readFlatCurry`, this action does not parse
--- a source program. Thus, the argument must be the name of an existing
--- file (with suffix ".fcy") containing a FlatCurry program in ".fcy"
--- format and the result is a FlatCurry term representing this program.
......
......@@ -14,9 +14,9 @@ import Flat2Fcy
import XML
import List
import System
import FlatCurry.Files(flatCurryFileName)
-- Check arguments and call main function:
main :: IO ()
main = do
args <- getArgs
case args of
......@@ -25,6 +25,7 @@ main = do
["-fcy",mod] -> xml2fcyfile (stripCurrySuffix mod)
_ -> printArgError args
printArgError :: [String] -> IO ()
printArgError args = putStrLn $
"ERROR: Illegal arguments for curry2xml: " ++
concat (intersperse " " args) ++ "\n" ++
......
......@@ -11,9 +11,11 @@
module Flat where
import Directory
import Char
import Directory
import Distribution
import FilePath ((<.>))
import Maybe (isNothing)
------------------------------------------------------------------------------
-- Definition of data types for representing FlatCurry programs:
......@@ -259,16 +261,27 @@ readFlatCurry progfile =
readFlatCurryWithParseOptions :: String -> FrontendParams -> IO Prog
readFlatCurryWithParseOptions progname options = do
existsCurry <- doesFileExist (progname++".curry")
existsLCurry <- doesFileExist (progname++".lcurry")
if existsCurry || existsLCurry
then callFrontendWithParams FCY options progname
else done
filename <- findFileInLoadPath (progname++".fcy")
mbmoddir <- lookupModuleSourceInLoadPath progname
>>= return . maybe Nothing (Just . fst)
unless (isNothing mbmoddir) $
callFrontendWithParams FCY options progname
filename <- findFileInLoadPath (flatCurryFileName progname)
readFlatCurryFile filename
--- Transforms a name of a Curry program (with or without suffix ".curry"
--- or ".lcurry") into the name of the file containing the
--- corresponding FlatCurry program.
flatCurryFileName :: String -> String
flatCurryFileName prog = inCurrySubdir (stripCurrySuffix prog) <.> "fcy"
--- Transforms a name of a Curry program (with or without suffix ".curry"
--- or ".lcurry") into the name of the file containing the
--- corresponding FlatCurry program.
flatCurryIntName :: String -> String
flatCurryIntName prog = inCurrySubdir (stripCurrySuffix prog) <.> "fint"
--- I/O action which reads a FlatCurry program from a file in ".fcy" format.
--- In contrast to <CODE>readFlatCurry</CODE>, this action does not parse
--- In contrast to `readFlatCurry`, this action does not parse
--- a source program. Thus, the argument must be the name of an existing
--- file (with suffix ".fcy") containing a FlatCurry program in ".fcy"
--- format and the result is a FlatCurry term representing this program.
......
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