diff --git a/GenerateC.hs b/GenerateC.hs index dc66bf9..ee7b568 100644 --- a/GenerateC.hs +++ b/GenerateC.hs @@ -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 \n"] ++ gds ++ w + let out = ["#include ",headerFileName,"\n"] ++ gds ++ w return $ concat out generateC :: A.Process -> PassM String -generateC = generate cgenOps +generateC = generate cgenOps "" cgenTLPChannel :: GenOps -> TLPChannel -> CGen () cgenTLPChannel _ TLPIn = tell ["in"] diff --git a/GenerateCPPCSP.hs b/GenerateCPPCSP.hs index 60d6066..8e6eb14 100644 --- a/GenerateCPPCSP.hs +++ b/GenerateCPPCSP.hs @@ -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 "" cppgenTopLevel :: GenOps -> A.Process -> CGen () cppgenTopLevel ops p - = do tell ["#include \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 in,out,err;"] --TODO add streamreader