packages feed

copilot-c99 3.16.1 → 3.17

raw patch · 6 files changed

+26/−22 lines, 6 filesdep ~copilot-corePVP ok

version bump matches the API change (PVP)

Dependency ranges changed: copilot-core

API changes (from Hackage documentation)

Files

CHANGELOG view
@@ -1,3 +1,7 @@+2023-11-07+        * Version bump (3.17). (#466)+        * Replace uses of deprecated functions. (#457)+ 2023-09-07         * Version bump (3.16.1). (#455)         * Clean code. (#453)
copilot-c99.cabal view
@@ -1,6 +1,6 @@ cabal-version             : >= 1.10 name                      : copilot-c99-version                   : 3.16.1+version                   : 3.17 synopsis                  : A compiler for Copilot targeting C99. description               :   This package is a back-end from Copilot to C.@@ -45,9 +45,9 @@                           , mtl                 >= 2.2 && < 2.4                           , pretty              >= 1.1 && < 1.2 -                          , copilot-core        >= 3.16.1 && < 3.17-                          , language-c99        >= 0.2.0  && < 0.3-                          , language-c99-simple >= 0.2.2  && < 0.3+                          , copilot-core        >= 3.17  && < 3.18+                          , language-c99        >= 0.2.0 && < 0.3+                          , language-c99-simple >= 0.2.2 && < 0.3    exposed-modules         : Copilot.Compile.C99 
src/Copilot/Compile/C99/CodeGen.hs view
@@ -33,7 +33,7 @@  -- Internal imports: Copilot import Copilot.Core ( Expr (..), Id, Stream (..), Struct (..), Trigger (..),-                      Type (..), UExpr (..), Value (..), fieldname, tysize )+                      Type (..), UExpr (..), Value (..), fieldName, typeSize )  -- Internal imports import Copilot.Compile.C99.Error    ( impossible )@@ -67,17 +67,17 @@ mkStructDecln :: Struct a => Type a -> C.Decln mkStructDecln (Struct x) = C.TypeDecln struct   where-    struct = C.TypeSpec $ C.StructDecln (Just $ typename x) fields+    struct = C.TypeSpec $ C.StructDecln (Just $ typeName x) fields     fields = NonEmpty.fromList $ map mkField (toValues x)      mkField :: Value a -> C.FieldDecln-    mkField (Value ty field) = C.FieldDecln (transType ty) (fieldname field)+    mkField (Value ty field) = C.FieldDecln (transType ty) (fieldName field)  -- | Write a forward struct declaration. mkStructForwDecln :: Struct a => Type a -> C.Decln mkStructForwDecln (Struct x) = C.TypeDecln struct   where-    struct = C.TypeSpec $ C.Struct (typename x)+    struct = C.TypeSpec $ C.Struct (typeName x)  -- * Ring buffers @@ -134,7 +134,7 @@      -- Copy expression to output argument     stmts = [ C.Expr $ memcpy (C.Ident nameArg) cExpr size ]-    size  = C.LitInt (fromIntegral $ tysize ty)+    size  = C.LitInt (fromIntegral $ typeSize ty)               C..* C.SizeOfType (C.TypeName $ tyElemName ty)  mkGenFunArray _name _nameArg _expr _ty =@@ -180,7 +180,7 @@               where                 dest = C.Index buffVar indexVar                 size = C.LitInt-                           (fromIntegral $ tysize ty)+                           (fromIntegral $ typeSize ty)                            C..* C.SizeOfType (C.TypeName (tyElemName ty))             _       -> C.Expr $                            C.Index buffVar indexVar C..= C.Ident tmpVar@@ -203,7 +203,7 @@         where           exVar  = C.Ident cpyName           locVar = C.Ident name-          size   = C.LitInt (fromIntegral $ tysize ty)+          size   = C.LitInt (fromIntegral $ typeSize ty)                      C..* C.SizeOfType (C.TypeName (tyElemName ty))        _       -> C.Ident cpyName C..= C.Ident name
src/Copilot/Compile/C99/Expr.hs view
@@ -14,7 +14,7 @@  -- Internal imports: Copilot import Copilot.Core ( Expr (..), Field (..), Op1 (..), Op2 (..), Op3 (..),-                      Type (..), Value (..), accessorname, arrayelems,+                      Type (..), Value (..), accessorName, arrayElems,                       toValues )  -- Internal imports@@ -96,7 +96,7 @@     Floor    ty   -> funCall (specializeMathFunName ty "floor") [e]     BwNot    _    -> (C..~) e     Cast     _ ty -> C.Cast (transTypeName ty) e-    GetField (Struct _)  _ f -> C.Dot e (accessorname f)+    GetField (Struct _)  _ f -> C.Dot e (accessorName f)  -- | Translates a Copilot binary operator and its arguments into a C99 -- expression.@@ -239,7 +239,7 @@   Float     -> explicitTy ty . C.LitFloat   Double    -> explicitTy ty . C.LitDouble   Struct _  -> C.InitVal (transTypeName ty) . constStruct . toValues-  Array ty' -> C.InitVal (transTypeName ty) . constArray ty' . arrayelems+  Array ty' -> C.InitVal (transTypeName ty) . constArray ty' . arrayElems  -- | Transform a Copilot Core literal, based on its value and type, into a C99 -- initializer.@@ -265,7 +265,7 @@   -- whole expression as an array of two int32_t's (as opposed to a nested   -- array). This can either lead to compile-time errors (if you're lucky) or   -- incorrect runtime semantics (if you're unlucky).-  Array ty' -> C.InitList $ constArray ty' $ arrayelems val+  Array ty' -> C.InitList $ constArray ty' $ arrayElems val    -- We use InitArray to initialize a struct because the syntax used for   -- initializing arrays and structs is compatible. For instance, {1, 2} works
src/Copilot/Compile/C99/Type.hs view
@@ -12,7 +12,7 @@ import qualified Language.C99.Simple as C  -- Internal imports: Copilot-import Copilot.Core ( Type (..), tylength, typename )+import Copilot.Core ( Type (..), typeLength, typeName )  -- | Translate a Copilot type to a C99 type. transType :: Type a -> C.Type@@ -30,8 +30,8 @@   Double    -> C.TypeSpec C.Double   Array ty' -> C.Array (transType ty') len     where-      len = Just $ C.LitInt $ fromIntegral $ tylength ty-  Struct s  -> C.TypeSpec $ C.Struct (typename s)+      len = Just $ C.LitInt $ fromIntegral $ typeLength ty+  Struct s  -> C.TypeSpec $ C.Struct (typeName s)  -- | Translate a Copilot type to a valid (local) variable declaration C99 type. --
tests/Test/Copilot/Compile/C99.hs view
@@ -279,7 +279,7 @@                         , [Array n t] -> [Word32] -> [t]                         ) arbitraryArrayIx = return-  (Op2 (Index typeOf), zipWith (\x y -> arrayelems x !! fromIntegral y))+  (Op2 (Index typeOf), zipWith (\x y -> arrayElems x !! fromIntegral y))  -- | Generator of functions on Floating point numbers. arbitraryOpFloat :: (Floating t, Typed t) => Gen (Fun t t, [t] -> [t])@@ -860,7 +860,7 @@ varDeclC Float        v = "float " ++ v varDeclC Double       v = "double " ++ v varDeclC t@(Array tE) v =-  typeC tE ++ " " ++ v ++ "[" ++ show (tylength t) ++ "]"+  typeC tE ++ " " ++ v ++ "[" ++ show (typeLength t) ++ "]" varDeclC _            _ = error   "copilot-c99 (test): Input variables of type struct are not yet supported." @@ -877,7 +877,7 @@ sizeC Word64       = "sizeof(uint64_t)" sizeC Float        = "sizeof(float)" sizeC Double       = "sizeof(double)"-sizeC t@(Array tE) = show (tylength t) ++ "* sizeof(" ++ typeC tE ++ ")"+sizeC t@(Array tE) = show (typeLength t) ++ "* sizeof(" ++ typeC tE ++ ")" sizeC _            = error   "copilot-c99 (test): Input variables of type struct are not yet supported." @@ -920,7 +920,7 @@   cshow False = "false"  instance CShow t => CShow (Array n t) where-  cshow a = intercalate "," $ map cshow $ arrayelems a+  cshow a = intercalate "," $ map cshow $ arrayElems a  -- | Read a value of a given type in C. class ReadableFromC a where