copilot-c99 2.1.1 → 2.1.2
raw patch · 4 files changed
+34/−35 lines, 4 filesdep +csvdep +vectordep −bytestring-csvdep ~basedep ~copilot-corePVP ok
version bump matches the API change (PVP)
Dependencies added: csv, vector
Dependencies removed: bytestring-csv
Dependency ranges changed: base, copilot-core
API changes (from Hackage documentation)
Files
- copilot-c99.cabal +7/−5
- src/Copilot/Compile/C99/Test/CheckSpec.hs +1/−2
- src/Copilot/Compile/C99/Test/Driver.hs +14/−15
- src/Copilot/Compile/C99/Test/ReadCSV.hs +12/−13
copilot-c99.cabal view
@@ -1,6 +1,6 @@ cabal-version : >= 1.10 name : copilot-c99-version : 2.1.1+version : 2.1.2 synopsis : A compiler for Copilot targeting C99. description : This package is a back-end from Copilot to the Atom DSL.@@ -39,17 +39,18 @@ ghc-prof-options : -auto-all -caf-all build-depends : atom >= 1.0.10- , base >= 4.0 && <= 5.0+ , base >= 4.3 && < 5 , bytestring- , bytestring-csv , containers >= 0.4- , copilot-core >= 0.2.4+ , copilot-core+ , csv , directory >= 1.1 , process >= 1.0 , pretty >= 1.0 , random >= 1.0 , text >= 0.6 , QuickCheck >= 2.4+ , vector exposed-modules : Copilot.Compile.C99.Test.CheckSpec , Copilot.Compile.C99.Test.Driver@@ -74,7 +75,7 @@ build-depends : atom >= 1.0.9 , base >= 4.3 , bytestring- , bytestring-csv+ , csv , containers >= 0.4 , copilot-core , directory >= 1.1@@ -83,6 +84,7 @@ , random >= 1.0 , text >= 0.6 , QuickCheck >= 2.4+ , vector other-modules : Copilot.Compile.C99 , Copilot.Compile.C99.C2A
src/Copilot/Compile/C99/Test/CheckSpec.hs view
@@ -18,7 +18,6 @@ import Copilot.Core.Type.Show (ShowType(..)) import Copilot.Core.Type.Read (readWithType) -import Data.ByteString (ByteString) import qualified Data.Map as M import Data.List (foldl') import qualified Data.ByteString.Char8 as B@@ -113,7 +112,7 @@ -------------------------------------------------------------------------------- -execute :: Int -> IO ByteString+execute :: Int -> IO B.ByteString execute _ = fmap B.pack (readProcess ("./" ++ c99DirName ++ "/" ++ outputFile) [] "")
src/Copilot/Compile/C99/Test/Driver.hs view
@@ -3,6 +3,7 @@ -------------------------------------------------------------------------------- {-# LANGUAGE GADTs #-}+{-# LANGUAGE Rank2Types #-} module Copilot.Compile.C99.Test.Driver ( driver@@ -226,21 +227,19 @@ -------------------------------------------------------------------------------- ppUType :: UType -> Doc-ppUType UType { uTypeType = t } = text $ typeSpec' t-- where-- typeSpec' Bool = "bool"- typeSpec' Int8 = "int8_t"- typeSpec' Int16 = "int16_t"- typeSpec' Int32 = "int32_t"- typeSpec' Int64 = "int64_t"- typeSpec' Word8 = "uint8_t"- typeSpec' Word16 = "uint16_t"- typeSpec' Word32 = "uint32_t"- typeSpec' Word64 = "uint64_t"- typeSpec' Float = "float"- typeSpec' Double = "double"+ppUType UType { uTypeType = t }+ = text $ case t of+ Bool -> "bool"+ Int8 -> "int8_t"+ Int16 -> "int16_t"+ Int32 -> "int32_t"+ Int64 -> "int64_t"+ Word8 -> "uint8_t"+ Word16 -> "uint16_t"+ Word32 -> "uint32_t"+ Word64 -> "uint64_t"+ Float -> "float"+ Double -> "double" --------------------------------------------------------------------------------
src/Copilot/Compile/C99/Test/ReadCSV.hs view
@@ -9,24 +9,22 @@ import Copilot.Compile.C99.Test.Iteration (Iteration (..)) import Prelude as P-import Data.ByteString (ByteString)+import qualified Data.Vector as V import qualified Data.ByteString.Char8 as B import qualified Data.Map as M-import Text.CSV.ByteString+import Text.CSV as C parseError :: a parseError = impossible "CSV parsing" "copilot-c99" -iterationsFromCSV :: ByteString -> [Iteration]-iterationsFromCSV = iterationsFromCSV' . handleMaybe . parseCSV--handleMaybe :: Maybe a -> a-handleMaybe (Just x) = x-handleMaybe Nothing = parseError+iterationsFromCSV :: B.ByteString -> [Iteration]+iterationsFromCSV bs =+ case C.parseCSV "csvParseErrors" (B.unpack bs) of+ Left err -> error (show err)+ Right res -> iterationsFromCSV' res -iterationsFromCSV' :: CSV -> [Iteration]+iterationsFromCSV' :: C.CSV -> [Iteration] iterationsFromCSV' = map Iteration . go M.empty- where go m [] = [m] go m (x:xs)@@ -38,11 +36,12 @@ go m' xs nextIteration :: Record -> Bool-nextIteration [x] = B.unpack x == "#"+nextIteration [x] = x == "#" nextIteration _ = False triggerName :: Record -> String-triggerName = B.unpack . head+triggerName = head triggerOutputs :: Record -> [Output]-triggerOutputs = fmap B.unpack . tail+triggerOutputs = tail+