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

CPM updated

parent 40a2ced2
......@@ -1225,7 +1225,7 @@ are used:
"author": "YOUR NAME <YOUR EMAIL ADDRESS>",
"maintainer": "ANOTHER NAME <ANOTHER EMAIL ADDRESS>",
"synopsis": "A ONE-LINE SUMMARY ABOUT THE PACKAGE",
"synopsis": "A MORE DEATILED SUMMARY ABOUT THE PACKAGE",
"description": "A MORE DETAILED SUMMARY ABOUT THE PACKAGE",
"category": [ "Category1", "Category2" ],
"license": "BSD-3-Clause",
"licenseFile": "LICENSE",
......
......@@ -131,13 +131,13 @@ createBaseTemp :: IO (ErrorLogger String)
createBaseTemp = getTemporaryDirectory >>=
\tmpDir ->
let
tmp = tmpDir </> "cpm" </> "bdiff"
tmp = tmpDir </> "CPM" </> "bdiff"
in recreateDirectory tmp >> succeedIO tmp
--- Get temporary directory for the behavior diff.
getBaseTemp :: IO (ErrorLogger String)
getBaseTemp = getTemporaryDirectory >>=
\tmpDir -> succeedIO $ tmpDir </> "cpm" </> "bdiff"
\tmpDir -> succeedIO $ tmpDir </> "CPM" </> "bdiff"
--- This message is printed before CurryCheck is executed.
infoText :: String
......@@ -511,7 +511,7 @@ addModuleDir dir mod p (ACYCache ps) = case lookup mod ps of
--- Generate a translator function for a type expression. Expects a CTCons.
---
--- @param cfg current cpm configuration
--- @param cfg current CPM configuration
--- @param repo package repository
--- @param gc the global package cache
--- @param info information about the current comparison
......@@ -747,7 +747,7 @@ replace' o n (x:xs) | x == o = n : replace' o n xs
--- module versions and find the functions that have not changed between
--- versions.
---
--- @param cfg the cpm configuration
--- @param cfg the CPM configuration
--- @param repo the current repository
--- @param gc the global package cache
--- @param dirA the directory of the A version of the package
......@@ -1165,7 +1165,7 @@ isPublic (CmtFunc _ _ _ Private _ _) = False
--- comparison by copying them to the temporary directory and building renamed
--- versions.
---
--- @param cfg the cpm configuration
--- @param cfg the CPM configuration
--- @param repo the package repository
--- @param gc the global package cache
--- @param nameA the name of the first package
......@@ -1191,7 +1191,7 @@ preparePackages cfg repo gc nameA verA nameB verB =
--- cache. Copies them to a temporary directory and builds renamed versions of
--- the packages and all dependencies.
---
--- @param cfg the cpm configuration
--- @param cfg the CPM configuration
--- @param repo the package repository
--- @param gc the global package cache
--- @param dirA the directory for the first package
......@@ -1212,7 +1212,7 @@ preparePackageAndDir cfg repo gc dirA nameB verB = GC.tryFindPackage gc nameB ve
--- package files to a temporary directory and creates renamed version of the
--- packages and their dependencies.
---
--- @param cfg the cpm configuration
--- @param cfg the CPM configuration
--- @param repo the package repository
--- @param gc the global package cache
--- @param dirA the directory containing the first package
......@@ -1263,7 +1263,7 @@ versionPrefix pkg = "V_" ++ (showVersion' $ version pkg)
--- another copy of the package with all its modules and the modules of its
--- dependencies prefixed with the given string.
---
--- @param cfg the cpm configuration
--- @param cfg the CPM configuration
--- @param repo the package repository
--- @param gc the global package cache
--- @param pkgDir the package directory to copy from
......
......@@ -47,13 +47,13 @@ cpmBanner :: String
cpmBanner = unlines [bannerLine,bannerText,bannerLine]
where
bannerText =
"Curry Package Manager <curry-language.org/tools/cpm> (version of 19/09/2017)"
"Curry Package Manager <curry-language.org/tools/cpm> (version of 20/10/2017)"
bannerLine = take (length bannerText) (repeat '-')
main :: IO ()
main = do
args <- getArgs
parseResult <- return $ parse (intercalate " " args) optionParser "cpm"
parseResult <- return $ parse (intercalate " " args) optionParser "cypm"
case parseResult of
Left err -> do putStrLn cpmBanner
putStrLn err
......@@ -61,7 +61,7 @@ main = do
exitWith 1
Right r -> case applyParse r of
Left err -> do putStrLn cpmBanner
--printUsage "cpm" 80 optionParser
--printUsage "cypm" 80 optionParser
putStrLn err
exitWith 1
Right opts -> runWithArgs opts
......@@ -72,7 +72,7 @@ runWithArgs opts = do
missingExecutables <- checkExecutables
unless (null missingExecutables) $ do
putStrLn $ "The following programs could not be found on the PATH " ++
"(they are required for cpm to work):\n" ++
"(they are required for CPM to work):\n" ++
intercalate ", " missingExecutables
exitWith 1
config <- readConfigurationWithDefault (optDefConfig opts) >>= \c ->
......@@ -489,7 +489,7 @@ optionParser = optParser
arg (\s a -> Right $ a { optCommand = PkgInfo (infoOpts a)
{ infoPackage = Just s } })
( metavar "PACKAGE"
<> help ("The package name. If no name is specified, cpm tries " ++
<> help ("The package name. If no name is specified, CPM tries " ++
"to read a package specification in the current directory.")
<> optional)
<.> arg (\s a -> readVersion' s >.> \v -> a
......@@ -497,7 +497,7 @@ optionParser = optParser
{ infoVersion = Just v } })
( metavar "VERSION"
<> help ("The package version. If no version is specified, " ++
"cpm uses the latest version of the specified package.")
"CPM uses the latest version of the specified package.")
<> optional )
<.> flag (\a -> Right $ a { optCommand = PkgInfo (infoOpts a)
{ infoAll = True } })
......@@ -552,7 +552,7 @@ optionParser = optParser
a { optCommand = Diff (diffOpts a) { diffVersion = Just v } })
( metavar "VERSION"
<> help ("The other package version. If no version is specified, " ++
"cpm diffs against the latest repository version.")
"CPM diffs against the latest repository version.")
<> optional )
<.> option (\s a -> Right $ a { optCommand = Diff (diffOpts a)
{ diffModules = Just $ splitOn "," s } })
......@@ -936,10 +936,10 @@ showVersionIfCompatible cfg p =
in if isCompatibleToCompiler cfg p then s else '(' : s ++ ")"
cpmInfo :: String
cpmInfo = "Use 'cpm info PACKAGE' for more information about a package."
cpmInfo = "Use 'cypm info PACKAGE' for more information about a package."
cpmUpdate :: String
cpmUpdate = "Use 'cpm update' to download the newest package index."
cpmUpdate = "Use 'cypm update' to download the newest package index."
--- Search in all (compiler-compatible) packages in the given repository.
......@@ -1371,12 +1371,12 @@ newPackage (NewOptions pname) = do
, "- add further fields (e.g., 'description')"
, "- review field 'license' (and adapt file 'LICENSE')"
, ""
, "Then run 'cpm install' to install all dependencies and"
, "Then run 'cypm install' to install all dependencies and"
, "put your program code in directory 'src'"
, "(where you find a template file 'Main.curry')"
, ""
, "Run the main program with:"
, "> cpm curry :load Main :eval main :quit"
, "> cypm curry :load Main :eval main :quit"
]
---------------------------------------------------------------------------
......
......@@ -148,7 +148,7 @@ installLocalDependencies cfg repo gc dir =
copyDependencies cfg gc pkgSpec (resolvedPackages result) dir |>
succeedIO (pkgSpec, resolvedPackages result)
--- Links a directory into the local package cache. Used for `cpm link`.
--- Links a directory into the local package cache. Used for `cypm link`.
linkToLocalCache :: String -> String -> IO (ErrorLogger ())
linkToLocalCache src pkgDir = do
dirExists <- doesDirectoryExist src
......@@ -196,7 +196,7 @@ resolveAndCopyDependenciesForPackage cfg repo gc dir pkgSpec =
missingDeps = GC.missingPackages gc deps
failMsg = "Missing dependencies "
++ (intercalate "," $ map packageId missingDeps)
++ "\nUse `cpm install` to install missing dependencies."
++ "\nUse `cypm install` to install missing dependencies."
in if length missingDeps > 0
then failIO failMsg
else copyDependencies cfg gc pkgSpec deps dir |>= \_ ->
......
......@@ -60,20 +60,24 @@ daFuncRule _ (External _) = [] -- nothing known about other externals
daFuncRule calledFuncs (Rule args rhs) =
map fst
(filter ((==Bot) . snd)
(map (\botarg -> (botarg,absEvalExpr rhs [botarg])) args))
(map (\botarg -> (botarg, absEvalExpr rhs [botarg]))
args))
where
-- abstract evaluation of an expression w.r.t. variables assumed to be Bot
absEvalExpr (Var i) bvs = if i `elem` bvs then Bot else Top
absEvalExpr (Lit _) _ = Top
absEvalExpr (Comb ct g es) bvs =
if ct == FuncCall
then maybe (error $ "Abstract value of " ++ show g ++ " not found!")
(\gdas -> let curargs = map (\ (i,e) -> (i,absEvalExpr e bvs))
(zip [1..] es)
cdas = gdas \\
(map fst (filter ((/=Bot) . snd) curargs))
in if null cdas then Top else Bot)
(lookup g calledFuncs)
then
if g == (prelude,"failed")
then Bot -- Prelude.failed never returns a value
else maybe (error $ "Abstract value of " ++ show g ++ " not found!")
(\gdas -> let curargs = map (\ (i,e) -> (i,absEvalExpr e bvs))
(zip [1..] es)
cdas = gdas \\
map fst (filter ((/=Bot) . snd) curargs)
in if null cdas then Top else Bot)
(lookup g calledFuncs)
else Top
absEvalExpr (Free _ e) bvs = absEvalExpr e bvs
absEvalExpr (Let bs e) bvs = absEvalExpr e (absEvalBindings bs bvs)
......
......@@ -60,20 +60,24 @@ daFuncRule _ (External _) = [] -- nothing known about other externals
daFuncRule calledFuncs (Rule args rhs) =
map fst
(filter ((==Bot) . snd)
(map (\botarg -> (botarg,absEvalExpr rhs [botarg])) args))
(map (\botarg -> (botarg, absEvalExpr rhs [botarg]))
args))
where
-- abstract evaluation of an expression w.r.t. variables assumed to be Bot
absEvalExpr (Var i) bvs = if i `elem` bvs then Bot else Top
absEvalExpr (Lit _) _ = Top
absEvalExpr (Comb ct g es) bvs =
if ct == FuncCall
then maybe (error $ "Abstract value of " ++ show g ++ " not found!")
(\gdas -> let curargs = map (\ (i,e) -> (i,absEvalExpr e bvs))
(zip [1..] es)
cdas = gdas \\
(map fst (filter ((/=Bot) . snd) curargs))
in if null cdas then Top else Bot)
(lookup g calledFuncs)
then
if g == (prelude,"failed")
then Bot -- Prelude.failed never returns a value
else maybe (error $ "Abstract value of " ++ show g ++ " not found!")
(\gdas -> let curargs = map (\ (i,e) -> (i,absEvalExpr e bvs))
(zip [1..] es)
cdas = gdas \\
map fst (filter ((/=Bot) . snd) curargs)
in if null cdas then Top else Bot)
(lookup g calledFuncs)
else Top
absEvalExpr (Free _ e) bvs = absEvalExpr e bvs
absEvalExpr (Let bs e) bvs = absEvalExpr e (absEvalBindings bs bvs)
......
......@@ -60,20 +60,24 @@ daFuncRule _ (External _) = [] -- nothing known about other externals
daFuncRule calledFuncs (Rule args rhs) =
map fst
(filter ((==Bot) . snd)
(map (\botarg -> (botarg,absEvalExpr rhs [botarg])) args))
(map (\botarg -> (botarg, absEvalExpr rhs [botarg]))
args))
where
-- abstract evaluation of an expression w.r.t. variables assumed to be Bot
absEvalExpr (Var i) bvs = if i `elem` bvs then Bot else Top
absEvalExpr (Lit _) _ = Top
absEvalExpr (Comb ct g es) bvs =
if ct == FuncCall
then maybe (error $ "Abstract value of " ++ show g ++ " not found!")
(\gdas -> let curargs = map (\ (i,e) -> (i,absEvalExpr e bvs))
(zip [1..] es)
cdas = gdas \\
(map fst (filter ((/=Bot) . snd) curargs))
in if null cdas then Top else Bot)
(lookup g calledFuncs)
then
if g == (prelude,"failed")
then Bot -- Prelude.failed never returns a value
else maybe (error $ "Abstract value of " ++ show g ++ " not found!")
(\gdas -> let curargs = map (\ (i,e) -> (i,absEvalExpr e bvs))
(zip [1..] es)
cdas = gdas \\
map fst (filter ((/=Bot) . snd) curargs)
in if null cdas then Top else Bot)
(lookup g calledFuncs)
else Top
absEvalExpr (Free _ e) bvs = absEvalExpr e bvs
absEvalExpr (Let bs e) bvs = absEvalExpr e (absEvalBindings bs bvs)
......
Supports Markdown
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