Only in atom-0.0.2.1: ._log
Only in atom-0.0.2.1: .blink.hs.swp
Only in atom-0.0.2.1/Language/Atom: .Code.hs.swp
Only in atom-0.0.2.1/Language/Atom: .Example.hs.swp
diff -r atom-0.0.2/Language/Atom/Code.hs atom-0.0.2.1/Language/Atom/Code.hs
4a5
>   , AtomConfig(..)
15,16c16,22
< declareMemory :: UV -> String
< declareMemory (UV id name (Local init)) = cType (constType init) ++ " " ++ e id ++ " = " ++ c ++ ";  /* " ++ name ++ " */\n"
---
> data AtomConfig = AtomConfig {
>     cIncludes :: Maybe [String],
>     cTyper    :: Maybe (Type -> String)
> }
> 
> declareMemory :: AtomConfig -> UV -> String
> declareMemory cfg (UV id name (Local init)) = ct (constType init) ++ " " ++ e id ++ " = " ++ c ++ ";  /* " ++ name ++ " */\n"
30c36,37
< declareMemory (UV _ _ (External _)) = ""
---
>   ct = cType cfg
> declareMemory _ (UV _ _ (External _)) = ""
32,33c39,40
< declareUE :: String -> (UE, String) -> String
< declareUE d (ue, n) = case ue of
---
> declareUE :: AtomConfig -> String -> (UE, String) -> String
> declareUE cfg d (ue, n) = case ue of
35,41c42,50
<   UConst (CBool True ) -> d ++ "const " ++ cType (ueType ue) ++ " " ++ n ++ " = 1;\n"
<   UConst (CBool False) -> d ++ "const " ++ cType (ueType ue) ++ " " ++ n ++ " = 0;\n"
<   UConst c             -> d ++ "const " ++ cType (ueType ue) ++ " " ++ n ++ " = " ++ show c ++ ";\n"
<   _                    -> d ++             cType (ueType ue) ++ " " ++ n ++ ";\n"
< 
< cType :: Type -> String
< cType t = case t of
---
>   UConst (CBool True ) -> d ++ "const " ++ ct (ueType ue) ++ " " ++ n ++ " = 1;\n"
>   UConst (CBool False) -> d ++ "const " ++ ct (ueType ue) ++ " " ++ n ++ " = 0;\n"
>   UConst c             -> d ++ "const " ++ ct (ueType ue) ++ " " ++ n ++ " = " ++ show c ++ ";\n"
>   _                    -> d ++             ct (ueType ue) ++ " " ++ n ++ ";\n"
>   where ct = cType cfg
> 
> cType :: AtomConfig -> Type -> String
> cType (AtomConfig {cTyper = (Just f)}) t = f t
> cType _ t = case t of
54,55c63,64
< codeUE :: [(UE, String)] -> String -> (UE, String) -> String
< codeUE ues d (ue, n) = case ue of
---
> codeUE :: AtomConfig -> [(UE, String)] -> String -> (UE, String) -> String
> codeUE cfg ues d (ue, n) = case ue of
60a70
>   ct = cType cfg
64c74
<     UCast _ _            -> "(" ++ cType (ueType ue) ++ ") " ++ a
---
>     UCast _ _            -> "(" ++ ct (ueType ue) ++ ") " ++ a
89,90c99,100
< writeC :: Name -> [[[Rule]]] -> [UV] -> IO ()
< writeC name periods uvs = do
---
> writeC :: Name -> Maybe AtomConfig -> [[[Rule]]] -> [UV] -> IO ()
> writeC name mcfg periods uvs = do
93a104,107
>   cfg = case mcfg of
>             (Just x) -> x
>             Nothing  -> AtomConfig Nothing Nothing
>   ct = cType cfg
95,100c109,115
<     [ cType Word64 ++ " __clock = 0;"
<     , "const " ++ cType Word32 ++ " __coverage_len = " ++ show covLen ++ ";"
<     , cType Word32 ++ " __coverage[" ++ show covLen ++ "] = {" ++ drop 2 (concat $ replicate covLen ", 0") ++ "};"
<     , cType Word32 ++ " __coverage_index = 0;"
<     , concatMap declareMemory uvs
<     , concatMap (codeRule topo') $ concat $ concat periods
---
>     [ includes cfg
>     , ct Word64 ++ " __clock = 0;"
>     , "const " ++ ct Word32 ++ " __coverage_len = " ++ show covLen ++ ";"
>     , ct Word32 ++ " __coverage[" ++ show covLen ++ "] = {" ++ drop 2 (concat $ replicate covLen ", 0") ++ "};"
>     , ct Word32 ++ " __coverage_index = 0;"
>     , concatMap (declareMemory cfg) uvs
>     , concatMap (codeRule cfg topo') $ concat $ concat periods
106a122,126
>   includes (AtomConfig {cIncludes = Nothing}) = ""
>   includes (AtomConfig {cIncludes = (Just incs)})
>       = let mkInc f = "#include \"" ++ f ++ "\"\n"
>         in  concatMap mkInc incs
> 
120,121c140,141
< codeRule :: ([UE] -> [(UE, String)]) -> Rule -> String
< codeRule topo rule = 
---
> codeRule :: AtomConfig -> ([UE] -> [(UE, String)]) -> Rule -> String
> codeRule cfg topo rule = 
124,125c144,145
<   concatMap (declareUE  "  ") ues ++
<   concatMap (codeUE ues "  ") ues ++
---
>   concatMap (declareUE cfg "  ") ues ++
>   concatMap (codeUE cfg ues "  ") ues ++
diff -r atom-0.0.2/Language/Atom/Compile.hs atom-0.0.2.1/Language/Atom/Compile.hs
3a4
>   , AtomConfig(..)
18,19c19,20
< compile :: Name -> Atom () -> IO ()
< compile name atom = do
---
> compile :: Name -> Maybe AtomConfig -> Atom () -> IO ()
> compile name cfg atom = do
36c37
<           writeC name schedule uvs
---
>           writeC name cfg schedule uvs
diff -r atom-0.0.2/Language/Atom/Example.hs atom-0.0.2.1/Language/Atom/Example.hs
8a9,14
> cfg :: AtomConfig
> cfg = AtomConfig {
>     cIncludes = Just ["string.h"],
>     cTyper = Nothing
> }
> 
11c17
< compileExample = compile "example" example
---
> compileExample = compile "example" (Just cfg) example
diff -r atom-0.0.2/atom.cabal atom-0.0.2.1/atom.cabal
2c2
< Version:        0.0.2
---
> Version:        0.0.2.1

