Fixed the C++CSP backend by allowing it to override the tock_support.h header file with tock_support_cppcsp.h (the latter includes the former, but only after defining some preprocessor directives)
This commit is contained in:
parent
d065338efe
commit
9e8dd73149
|
@ -216,15 +216,15 @@ cgenOps = GenOps {
|
|||
--}}}
|
||||
|
||||
--{{{ top-level
|
||||
generate :: GenOps -> A.Process -> PassM String
|
||||
generate ops ast
|
||||
generate :: GenOps -> String -> A.Process -> PassM String
|
||||
generate ops headerFileName ast
|
||||
= do (a, w) <- runWriterT (call genTopLevel ops ast)
|
||||
gds <- getGeneratedDefs
|
||||
let out = ["#include <tock_support.h>\n"] ++ gds ++ w
|
||||
let out = ["#include ",headerFileName,"\n"] ++ gds ++ w
|
||||
return $ concat out
|
||||
|
||||
generateC :: A.Process -> PassM String
|
||||
generateC = generate cgenOps
|
||||
generateC = generate cgenOps "<tock_support.h>"
|
||||
|
||||
cgenTLPChannel :: GenOps -> TLPChannel -> CGen ()
|
||||
cgenTLPChannel _ TLPIn = tell ["in"]
|
||||
|
|
|
@ -131,12 +131,11 @@ In occam-pi I could possibly use the channel-ends properly, but in occam 2.1 I h
|
|||
|
||||
--{{{ top-level
|
||||
generateCPPCSP :: A.Process -> PassM String
|
||||
generateCPPCSP = generate cppgenOps
|
||||
generateCPPCSP = generate cppgenOps "<tock_support_cppcsp.h>"
|
||||
|
||||
cppgenTopLevel :: GenOps -> A.Process -> CGen ()
|
||||
cppgenTopLevel ops p
|
||||
= do tell ["#include <tock_support_cppcsp.h>\n"]
|
||||
call genProcess ops p
|
||||
= do call genProcess ops p
|
||||
(name, chans) <- tlpInterface
|
||||
tell ["int main (int argc, char** argv) { csp::Start_CPPCSP();"]
|
||||
tell ["csp::One2OneChannel<uint8_t> in,out,err;"] --TODO add streamreader
|
||||
|
|
Loading…
Reference in New Issue
Block a user