copilot-c99 3.5 → 3.6
raw patch · 6 files changed
+21/−7 lines, 6 filesdep ~copilot-corePVP ok
version bump matches the API change (PVP)
Dependency ranges changed: copilot-core
API changes (from Hackage documentation)
+ Copilot.Compile.C99: [cSettingsOutputDirectory] :: CSettings -> FilePath
+ Copilot.Compile.C99.Compile: [cSettingsOutputDirectory] :: CSettings -> FilePath
+ Copilot.Compile.C99.Settings: [cSettingsOutputDirectory] :: CSettings -> FilePath
- Copilot.Compile.C99: CSettings :: String -> CSettings
+ Copilot.Compile.C99: CSettings :: String -> FilePath -> CSettings
- Copilot.Compile.C99.Compile: CSettings :: String -> CSettings
+ Copilot.Compile.C99.Compile: CSettings :: String -> FilePath -> CSettings
- Copilot.Compile.C99.Settings: CSettings :: String -> CSettings
+ Copilot.Compile.C99.Settings: CSettings :: String -> FilePath -> CSettings
Files
- CHANGELOG +6/−0
- README.md +2/−2
- copilot-c99.cabal +2/−2
- src/Copilot/Compile/C99/Compile/Internal.hs +6/−2
- src/Copilot/Compile/C99/Settings/Internal.hs +2/−1
- src/Copilot/Compile/C99/Translate.hs +3/−0
CHANGELOG view
@@ -1,3 +1,9 @@+2021-11-07+ * Version bump (3.6). (#264)+ * Introduce new ops atan2, ceiling, floor. (#246)+ * Allow customizing output directory. (#255)+ * Fix outdated/broken links. (#252)+ 2021-08-19 * Version bump (3.5). (#247) * Update travis domain in README. (#222)
README.md view
@@ -1,4 +1,4 @@-[](https://travis-ci.com/Copilot-Language/copilot-core)+[](https://app.travis-ci.com/github/Copilot-Language/copilot) # Copilot: a stream DSL Copilot-c99 implements a C99 backend for Copilot, producing high quality code@@ -30,4 +30,4 @@ ## License Copilot is distributed under the BSD-3-Clause license, which can be found-[here](https://raw.githubusercontent.com/Copilot-Language/copilot-c99/master/LICENSE).+[here](https://raw.githubusercontent.com/Copilot-Language/copilot/master/copilot-c99/LICENSE).
copilot-c99.cabal view
@@ -1,6 +1,6 @@ cabal-version : >= 1.10 name : copilot-c99-version : 3.5+version : 3.6 synopsis : A compiler for Copilot targeting C99. description : This package is a back-end from Copilot to C.@@ -48,7 +48,7 @@ , mtl >= 2.2 && < 2.3 , pretty >= 1.1 && < 1.2 - , copilot-core >= 3.5 && < 3.6+ , copilot-core >= 3.6 && < 3.7 , language-c99 >= 0.1.1 && < 0.2 , language-c99-util >= 0.1.1 && < 0.2 , language-c99-simple >= 0.1.1 && < 0.2
src/Copilot/Compile/C99/Compile/Internal.hs view
@@ -7,6 +7,8 @@ import Text.PrettyPrint (render) import Data.List (nub) import Data.Maybe (catMaybes)+import System.Directory (createDirectoryIfMissing)+import System.FilePath ((</>)) import Language.C99.Pretty (pretty) import qualified Language.C99.Simple as C@@ -41,8 +43,10 @@ , "" ] - writeFile (prefix ++ ".c") $ cmacros ++ cfile- writeFile (prefix ++ ".h") hfile+ let dir = cSettingsOutputDirectory cSettings+ createDirectoryIfMissing True dir+ writeFile (dir </> prefix ++ ".c") $ cmacros ++ cfile+ writeFile (dir </> prefix ++ ".h") hfile -- | Compile a specification to a .h and a .c file. --
src/Copilot/Compile/C99/Settings/Internal.hs view
@@ -4,8 +4,9 @@ -- | Settings used to customize the code generated. data CSettings = CSettings { cSettingsStepFunctionName :: String+ , cSettingsOutputDirectory :: FilePath } -- | Default settings with a step function called @step@. mkDefaultCSettings :: CSettings-mkDefaultCSettings = CSettings "step"+mkDefaultCSettings = CSettings "step" "."
src/Copilot/Compile/C99/Translate.hs view
@@ -74,6 +74,8 @@ Asinh _ -> funcall "asinh" [e] Atanh _ -> funcall "atanh" [e] Acosh _ -> funcall "acosh" [e]+ Ceiling _ -> funcall "ceil" [e]+ Floor _ -> funcall "floor" [e] BwNot _ -> (C..~) e Cast _ ty -> C.Cast (transtypename ty) e GetField (Struct _) _ f -> C.Dot e (accessorname f)@@ -92,6 +94,7 @@ Fdiv _ -> e1 C../ e2 Pow _ -> funcall "pow" [e1, e2] Logb _ -> funcall "log" [e2] C../ funcall "log" [e1]+ Atan2 _ -> funcall "atan2" [e1, e2] Eq _ -> e1 C..== e2 Ne _ -> e1 C..!= e2 Le _ -> e1 C..<= e2