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

currytools updated to CPM based management

parent 0adc2bf9
......@@ -6,29 +6,25 @@ cpm/src/CPM/ConfigPackage.curry
*.agdai
*_cache
browser/.cpm/packages/addtypes-0.0.1
browser/.cpm/packages/cass-0.0.1
browser/.cpm/packages/cass-analysis-0.0.4
browser/.cpm/packages/cass-2.0.0
browser/.cpm/packages/cass-analysis-2.0.0
browser/.cpm/packages/importusage-0.0.1
browser/.cpm/packages/showflatcurry-0.0.1
currycheck/.cpm/packages/rewriting-0.0.1
currypp/.cpm/packages/cass-0.0.1
currypp/.cpm/packages/cass-analysis-0.0.4
currypp/.cpm/packages/currycheck-1.0.1
currypp/.cpm/packages/rewriting-0.0.1
currycheck/.cpm/packages/rewriting-2.0.0
currypp/.cpm/packages/cass-2.0.0
currypp/.cpm/packages/cass-analysis-2.0.0
currypp/.cpm/packages/currycheck-2.0.0
currypp/.cpm/packages/rewriting-2.0.0
currypp/.cpm/packages/verify-0.0.2
optimize/.cpm/packages/cass-0.0.1
optimize/.cpm/packages/cass-analysis-0.0.4
optimize/.cpm/packages/cass-2.0.0
optimize/.cpm/packages/cass-analysis-2.0.0
# executables
browser/BrowserGUI
CASS/cass
CASS/cass_worker
cpm/src/CPM.Main
cpns/CPNSD
curry2js/Curry2JS
currypp/Main
currycheck/CurryCheck
currydoc/CurryDoc
optimize/BindingOpt
runcurry/RunCurry
www/Registry
......
......@@ -10,6 +10,7 @@ module CPM.AbstractCurry
, readAbstractCurryFromDeps
, transformAbstractCurryInDeps
, applyModuleRenames
, tcArgsOfType
) where
import Distribution (FrontendTarget (..), FrontendParams (..), defaultParams
......@@ -22,7 +23,7 @@ import AbstractCurry.Files (readAbstractCurryFile, writeAbstractCurryFile)
import AbstractCurry.Pretty (showCProg)
import AbstractCurry.Select (imports)
import AbstractCurry.Transform
import AbstractCurry.Types (CurryProg)
import AbstractCurry.Types
import System
import CPM.ErrorLogger
......@@ -114,7 +115,8 @@ transformAbstractCurryInDeps pkgDir deps transform modname destFile = do
--- @param prog - the program to modify
applyModuleRenames :: [(String, String)] -> CurryProg -> CurryProg
applyModuleRenames names prog =
updCProg maybeRename (map maybeRename) id id id (updQNamesInCProg rnm prog)
updCProg maybeRename (map maybeRename) id id id id id id
(updQNamesInCProg rnm prog)
where
maybeRename n = case lookup n names of
Just n' -> n'
......@@ -123,3 +125,20 @@ applyModuleRenames names prog =
Just mod' -> (mod', n)
Nothing -> mn
--- Checks whether a type expression is a type constructor application.
--- If this is the case, return the type constructor and the type arguments.
tcArgsOfType :: CTypeExpr -> Maybe (QName,[CTypeExpr])
tcArgsOfType texp =
maybe Nothing
(\tc -> Just (tc, targsOfApply texp))
(tconOfApply texp)
where
tconOfApply te = case te of CTApply (CTCons qn) _ -> Just qn
CTApply tc _ -> tconOfApply tc
_ -> Nothing
targsOfApply te = case te of
CTApply (CTCons _) ta -> [ta]
CTApply tc ta -> targsOfApply tc ++ [ta]
_ -> [] -- should not occur
......@@ -189,6 +189,7 @@ showDifferences diffs verA verB = pPrint $
--- A jump between two versions.
data VersionJump = Major | Minor | Patch | None
deriving Eq
--- Calculate the jump between two versions.
versionJump :: Version -> Version -> VersionJump
......@@ -209,8 +210,10 @@ showFuncDifference (Change a b) = "Change " ++ (showFuncDecl a) ++ " to " ++ (sh
--- Renders a function declaration to a string.
showFuncDecl :: CFuncDecl -> String
showFuncDecl (CFunc (_, n) _ _ t _) = n ++ " :: " ++ (pPrint $ ppCTypeExpr defaultOptions t)
showFuncDecl (CmtFunc _ (_, n) _ _ t _) = n ++ " :: " ++ (pPrint $ ppCTypeExpr defaultOptions t)
showFuncDecl (CFunc (_, n) _ _ t _) =
n ++ " :: " ++ (pPrint $ ppCQualTypeExpr defaultOptions t)
showFuncDecl (CmtFunc _ (_, n) _ _ t _) =
n ++ " :: " ++ (pPrint $ ppCQualTypeExpr defaultOptions t)
--- Renders a type difference to a string.
showTypeDifference :: Difference CTypeDecl -> String
......@@ -220,15 +223,18 @@ showTypeDifference (Change a b) = "Changed " ++ (showTypeDecl a) ++ " to " ++ (s
--- Renders a type declaration to a string.
showTypeDecl :: CTypeDecl -> String
showTypeDecl (CType (_, n) _ _ cs) = "data " ++ n ++ " (" ++ (show $ length cs) ++ " constructors)"
showTypeDecl (CTypeSyn (_, n) _ _ t) = "type " ++ n ++ " = " ++ (pPrint $ ppCTypeExpr defaultOptions t)
showTypeDecl (CNewType (_, n) _ _ _) = "newtype " ++ n
showTypeDecl (CType (_, n) _ _ cs _) =
"data " ++ n ++ " (" ++ (show $ length cs) ++ " constructors)"
showTypeDecl (CTypeSyn (_, n) _ _ t) =
"type " ++ n ++ " = " ++ (pPrint $ ppCTypeExpr defaultOptions t)
showTypeDecl (CNewType (_, n) _ _ _ _) = "newtype " ++ n
--- Renders an operator difference to a string.
showOpDifference :: Difference COpDecl -> String
showOpDifference (Addition f) = "Added " ++ (showOpDecl f)
showOpDifference (Removal f) = "Removed " ++ (showOpDecl f)
showOpDifference (Change a b) = "Changed " ++ (showOpDecl a) ++ " to " ++ (showOpDecl b)
showOpDifference (Addition f) = "Added " ++ showOpDecl f
showOpDifference (Removal f) = "Removed " ++ showOpDecl f
showOpDifference (Change a b) = "Changed " ++ showOpDecl a ++ " to " ++
showOpDecl b
--- Renders an operator declaration to a string.
showOpDecl :: COpDecl -> String
......@@ -262,12 +268,12 @@ funcIsPublic _ (CmtFunc _ _ _ Private _ _) = False
--- Is a type public?
typeIsPublic :: CurryProg -> CTypeDecl -> Bool
typeIsPublic _ (CType _ Public _ _) = True
typeIsPublic _ (CType _ Private _ _) = False
typeIsPublic _ (CType _ Public _ _ _) = True
typeIsPublic _ (CType _ Private _ _ _) = False
typeIsPublic _ (CTypeSyn _ Public _ _) = True
typeIsPublic _ (CTypeSyn _ Private _ _) = False
typeIsPublic _ (CNewType _ Public _ _) = True
typeIsPublic _ (CNewType _ Private _ _) = False
typeIsPublic _ (CNewType _ Public _ _ _) = True
typeIsPublic _ (CNewType _ Private _ _ _) = False
--- Creates a function that can compare elements in two versions of a module.
---
......@@ -299,17 +305,20 @@ funcEq (CmtFunc _ _ a1 v1 t1 _) (CmtFunc _ _ a2 v2 t2 _) = a1 == a2 && v1 == v2
funcEq (CFunc _ a1 v1 t1 _) (CmtFunc _ _ a2 v2 t2 _) = a1 == a2 && v1 == v2 && t1 == t2
funcEq (CmtFunc _ _ a1 v1 t1 _) (CFunc _ a2 v2 t2 _) = a1 == a2 && v1 == v2 && t1 == t2
--- Are two type declarations equal?
--- Are two type declarations equal? (We ignore `deriving` clauses)
typeEq :: CTypeDecl -> CTypeDecl -> Bool
typeEq (CType _ v1 tvs1 cs1) (CType _ v2 tvs2 cs2) = v1 == v2 && tvs1 == tvs2 && cs1 == cs2
typeEq (CTypeSyn _ v1 tvs1 e1) (CTypeSyn _ v2 tvs2 e2) = v1 == v2 && tvs1 == tvs2 && e1 == e2
typeEq (CNewType _ v1 tvs1 c1) (CNewType _ v2 tvs2 c2) = v1 == v2 && tvs1 == tvs2 && c1 == c2
typeEq (CType _ _ _ _) (CTypeSyn _ _ _ _) = False
typeEq (CType _ _ _ _) (CNewType _ _ _ _) = False
typeEq (CTypeSyn _ _ _ _) (CType _ _ _ _) = False
typeEq (CTypeSyn _ _ _ _) (CNewType _ _ _ _) = False
typeEq (CNewType _ _ _ _) (CType _ _ _ _) = False
typeEq (CNewType _ _ _ _) (CTypeSyn _ _ _ _) = False
typeEq (CType _ v1 tvs1 cs1 _) (CType _ v2 tvs2 cs2 _) =
v1 == v2 && tvs1 == tvs2 && cs1 == cs2
typeEq (CTypeSyn _ v1 tvs1 e1) (CTypeSyn _ v2 tvs2 e2) =
v1 == v2 && tvs1 == tvs2 && e1 == e2
typeEq (CNewType _ v1 tvs1 c1 _) (CNewType _ v2 tvs2 c2 _) =
v1 == v2 && tvs1 == tvs2 && c1 == c2
typeEq (CType _ _ _ _ _) (CTypeSyn _ _ _ _) = False
typeEq (CType _ _ _ _ _) (CNewType _ _ _ _ _) = False
typeEq (CTypeSyn _ _ _ _) (CType _ _ _ _ _) = False
typeEq (CTypeSyn _ _ _ _) (CNewType _ _ _ _ _) = False
typeEq (CNewType _ _ _ _ _) (CType _ _ _ _ _) = False
typeEq (CNewType _ _ _ _ _) (CTypeSyn _ _ _ _) = False
--- Are two operator declarations equal?
opEq :: COpDecl -> COpDecl -> Bool
......@@ -317,7 +326,7 @@ opEq (COp _ f1 a1) (COp _ f2 a2) = f1 == f2 && a1 == a2
--- Select all operator declarations from a CurryProg.
ops :: CurryProg -> [COpDecl]
ops (CurryProg _ _ _ _ os) = os
ops (CurryProg _ _ _ _ _ _ _ os) = os
--- Get the name of an operator declaration.
opName :: COpDecl -> QName
......
This diff is collapsed.
......@@ -23,6 +23,7 @@ data SourceLine = PragmaCmt String
| DataDef String
| FuncDef String
| OtherLine
deriving Eq
classifyLine :: String -> SourceLine
classifyLine line
......
......@@ -48,6 +48,7 @@ data LogLevel = Info
| Debug
| Error
| Critical
deriving Eq
--- The global value for the log level.
logLevel :: Global LogLevel
......
......@@ -72,6 +72,7 @@ type Disjunction = [Conjunction]
--- version constraint. Each inner list of version constraints is a conjunction,
--- the outer list is a disjunction.
data Dependency = Dependency String Disjunction
deriving (Eq,Show)
--- A version constraint.
--- @cons VExact - versions must match exactly
......@@ -87,11 +88,13 @@ data VersionConstraint = VExact Version
| VGte Version
| VLte Version
| VCompatible Version
deriving (Eq,Show)
--- Compiler compatibility constraint, takes the name of the compiler (kics2 or
--- pakcs), as well as a disjunctive normal form combination of version
--- constraints (see Dependency).
data CompilerCompatibility = CompilerCompatibility String Disjunction
deriving (Eq,Show)
--- A package id consisting of the package name and version.
data PackageId = PackageId String Version
......@@ -100,6 +103,7 @@ data PackageId = PackageId String Version
--- It consists of the name of the executable and the name of the main
--- module (which must contain an operation `main`).
data PackageExecutable = PackageExecutable String String
deriving (Eq,Show)
--- The specification of a single test suite for a package.
--- It consists of a directory, a list of modules, options (for CurryCheck),
......@@ -110,6 +114,7 @@ data PackageExecutable = PackageExecutable String String
--- by running CurryCheck on the given list of modules where the option
--- string is passed to CurryCheck.
data PackageTest = PackageTest String [String] String String
deriving (Eq,Show)
--- A source where the contents of a package can be acquired.
--- @cons Http - URL to a ZIP file
......@@ -120,6 +125,7 @@ data PackageTest = PackageTest String [String] String String
data PackageSource = Http String
| Git String (Maybe GitRevision)
| FileSource String
deriving (Eq,Show)
--- A Git revision.
--- @cons Tag - A tag which might contain the string `$version$` which will
......@@ -129,6 +135,7 @@ data PackageSource = Http String
data GitRevision = Tag String
| Ref String
| VersionAsTag
deriving (Eq,Show)
--- The data type for package specifications.
data Package = Package {
......@@ -154,6 +161,7 @@ data Package = Package {
, executableSpec :: Maybe PackageExecutable
, testSuite :: Maybe [PackageTest]
}
deriving (Eq,Show)
--- An empty package specification.
emptyPackage :: Package
......
......@@ -134,6 +134,7 @@ data ResolutionResult = ResolutionSuccess Package [Package]
--- dependency led to the current package version being chosen.
data Activation = InitialA Package
| ChildA Package Dependency Activation
deriving Eq
--- Each tree node is labeled with the current activation and all former
--- activations.
......@@ -150,6 +151,7 @@ type State = (Activation, [Activation])
data Conflict = SecondaryConflict Activation Activation
| PrimaryConflict Activation
| CompilerConflict Activation
deriving Eq
--- A state and a potential conflict.
type ConflictState = (State, Maybe Conflict)
......
{
"name": "boxes",
"version": "0.0.2",
"author": "Jonas Oberschweiber <jonas@oberschweiber.com>",
"category": [ "Printing" ],
"synopsis": "A pretty printer for boxes",
"dependencies": {},
"exportedModules": ["Boxes"],
"source": {
"git": "https://git.ps.informatik.uni-kiel.de/curry-packages/boxes.git",
"tag": "$version"
}
"name": "boxes",
"version": "2.0.0",
"author": "Jonas Oberschweiber <jonas@oberschweiber.com>",
"category": [ "Printing" ],
"synopsis": "A pretty printer for boxes",
"dependencies": {},
"compilerCompatibility": {
"pakcs": ">= 2.0.0",
"kics2": ">= 2.0.0"
},
"exportedModules": ["Boxes"],
"source": {
"git": "https://git.ps.informatik.uni-kiel.de/curry-packages/boxes.git",
"tag": "$version"
}
}
......@@ -113,7 +113,7 @@ vcat a bs = Box h w (Col $ map (alignHoriz a w) bs)
(h, w) = sumMax rows 0 cols bs
--- Calculate sum and maximum of a list.
sumMax :: (a -> Int) -> b -> (a -> b) -> [a] -> (Int, b)
sumMax :: Ord b => (a -> Int) -> b -> (a -> b) -> [a] -> (Int, b)
sumMax f defaultMax g as = foldr go (,) as 0 defaultMax
where
go a r n b = (r $! f a + n) $! g a `max` b
......
{
"name": "cass-analysis",
"version": "0.0.4",
"version": "2.0.0",
"author": "Michael Hanus <mh@informatik.uni-kiel.de>",
"synopsis": "Libraries with various compile-time analyses for Curry",
"category": [ "Analysis" ],
"dependencies": {
},
"compilerCompatibility": {
"pakcs": ">= 2.0.0",
"kics2": ">= 2.0.0"
},
"source": {
"git": "https://git.ps.informatik.uni-kiel.de/curry-packages/cass-analysis.git",
"tag": "$version"
......
......@@ -31,13 +31,8 @@ showDemand fmt (x:xs) =
-- Abstract demand domain.
data DemandDomain = Bot | Top
deriving Eq
instance Eq DemandDomain where
Bot == Bot = True
Top == Top = True
Bot == Top = False
Top == Bot = False
-- Least upper bound on abstract demand domain.
lub :: DemandDomain -> DemandDomain -> DemandDomain
lub Bot x = x
......
......@@ -25,11 +25,7 @@ import Analysis.ProgInfo
--- Definitely ground (G), maybe non-ground (A), or maybe non-ground
--- if i-th argument is non-ground (P [...,i,...]).
data Ground = G | A | P [Int]
instance Eq Ground where
G == x = case x of { G -> True ; _ -> False }
A == x = case x of { A -> True ; _ -> False }
P i == x = case x of { P j -> i==j ; _ -> False }
deriving Eq
-- Show groundness information as a string.
showGround :: AOutFormat -> Ground -> String
......@@ -122,9 +118,7 @@ groundApply (P ps) gargs =
--- due to a narrowing step (second argument), or if i-th argument
--- is non-ground (if i is a member of the third argument).
data NDEffect = NDEffect Bool Bool [Int]
instance Eq NDEffect where
NDEffect x1 y1 z1 == NDEffect x2 y2 z2 = x1==x2 && y1==y2 && z1==z2
deriving Eq
noEffect :: NDEffect
noEffect = NDEffect False False []
......
......@@ -13,12 +13,7 @@ import Maybe
-- datatype order: higher-order or first-order
data Order = HO | FO
instance Eq Order where
HO == HO = True
FO == FO = True
HO == FO = False
FO == HO = False
deriving Eq
-- Show higher-order information as a string.
showOrder :: AOutFormat -> Order -> String
......
......@@ -48,11 +48,7 @@ data Completeness =
Complete -- completely defined
| InComplete -- incompletely defined
| InCompleteOr -- incompletely defined in each branch of an "Or"
instance Eq Completeness where
Complete == x = case x of { Complete -> True ; _ -> False }
InComplete == x = case x of { InComplete -> True ; _ -> False }
InCompleteOr == x = case x of { InCompleteOr -> True ; _ -> False }
deriving Eq
--- A function is totally defined if it is pattern complete and depends
--- only on totally defined functions.
......
--- A simple program to show the usage of the API mode of CASS
--- to access the demanded values of the operation Rev.main:
--- to access the demanded values of the operation Rev.rev:
import AnalysisServer (analyzeGeneric)
import GenericProgInfo (lookupProgInfo)
import Demandedness (demandAnalysis)
import CASS.Server (analyzeGeneric)
import Analysis.ProgInfo (lookupProgInfo)
import Analysis.Demandedness (demandAnalysis)
demandedArgumentsOf :: String -> String -> IO [Int]
demandedArgumentsOf modname fname = do
deminfo <- analyzeGeneric demandAnalysis modname >>= return . either id error
return $ maybe [] id (lookupProgInfo (modname,fname) deminfo)
main = demandedArgumentsOf "Rev" "main"
main :: IO [Int]
main = demandedArgumentsOf "Rev" "rev"
{
"name": "cass",
"version": "0.0.1",
"version": "2.0.0",
"author": "Michael Hanus <mh@informatik.uni-kiel.de>",
"synopsis": "CASS: the Curry Analysis Server System",
"category": [ "Analysis" ],
"dependencies": {
"cass-analysis": ">= 0.0.1"
"cass-analysis": ">= 2.0.0"
},
"compilerCompatibility": {
"pakcs": ">= 2.0.0",
"kics2": ">= 2.0.0"
},
"configModule": "CASS.PackageConfig",
"executable": {
......
......@@ -5,7 +5,7 @@ import FilePath((</>))
--- Package version as a string.
packageVersion :: String
packageVersion = "0.0.1"
packageVersion = "2.0.0"
--- Package location.
packagePath :: String
......
{
"name": "det-parse",
"version": "0.0.1",
"synopsis": "Deterministic parser combinators",
"category": [ "Parsing" ],
"author": "Jonas Oberschweiber",
"source": {
"git": "https://git.ps.informatik.uni-kiel.de/curry-packages/det-parse.git",
"tag": "v0.0.1"
}
"name": "det-parse",
"version": "0.0.1",
"synopsis": "Deterministic parser combinators",
"category": [ "Parsing" ],
"author": "Jonas Oberschweiber",
"dependencies": {
},
"compilerCompatibility": {
"pakcs": ">= 1.14.0",
"kics2": ">= 0.5.0"
},
"source": {
"git": "https://git.ps.informatik.uni-kiel.de/curry-packages/det-parse.git",
"tag": "v0.0.1"
}
}
{
"name": "json",
"version": "0.0.3",
"author": "Jonas Oberschweiber",
"maintainer": "Michael Hanus <mh@informatik.uni-kiel.de>",
"synopsis": "A JSON library for Curry",
"name": "json",
"version": "2.0.0",
"author": "Jonas Oberschweiber <jonas@oberschweiber.com>",
"maintainer": "Michael Hanus <mh@informatik.uni-kiel.de>",
"synopsis": "A JSON library for Curry",
"category": [ "Data", "Web" ],
"dependencies": {
"det-parse": "= 0.0.1"
},
"dependencies": {
"det-parse": "= 0.0.1"
},
"compilerCompatibility": {
"pakcs": ">= 2.0.0",
"kics2": ">= 2.0.0"
},
"exportedModules": ["JSON.Data", "JSON.Parser", "JSON.Pretty"],
"source": {
"git": "https://git.ps.informatik.uni-kiel.de/curry-packages/json.git",
"tag": "$version"
}
"source": {
"git": "https://git.ps.informatik.uni-kiel.de/curry-packages/json.git",
"tag": "$version"
}
}
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