From 4e582d8c3a9e1eef229b8506d59c622a07320f39 Mon Sep 17 00:00:00 2001 From: Neil Brown Date: Fri, 12 Sep 2008 21:05:11 +0000 Subject: [PATCH] Quickly added poison to the C++ backend --- backends/GenerateC.hs | 1 + backends/GenerateCBased.hs | 1 + backends/GenerateCPPCSP.hs | 6 ++++++ 3 files changed, 8 insertions(+) diff --git a/backends/GenerateC.hs b/backends/GenerateC.hs index e919b41..424abc7 100644 --- a/backends/GenerateC.hs +++ b/backends/GenerateC.hs @@ -1500,6 +1500,7 @@ cgenProcess p = case p of -- PROCESSOR does nothing special. A.Processor m e p -> call genProcess p A.Alt m b s -> call genAlt b s + A.InjectPoison m ch -> call genPoison m ch A.ProcCall m n as -> call genProcCall n as A.IntrinsicProcCall m s as -> call genIntrinsicProc m s as diff --git a/backends/GenerateCBased.hs b/backends/GenerateCBased.hs index 575e920..23c4bf5 100644 --- a/backends/GenerateCBased.hs +++ b/backends/GenerateCBased.hs @@ -152,6 +152,7 @@ data GenOps = GenOps { -- | Generates a loop that maps over every element in a (potentially multi-dimensional) array genOverArray :: Meta -> A.Variable -> (SubscripterFunction -> Maybe (CGen ())) -> CGen (), genPar :: A.ParMode -> A.Structured A.Process -> CGen (), + genPoison :: Meta -> A.Variable -> CGen (), genProcCall :: A.Name -> [A.Actual] -> CGen (), genProcess :: A.Process -> CGen (), genRecordTypeSpec :: A.Name -> Bool -> [(A.Name, A.Type)] -> CGen (), diff --git a/backends/GenerateCPPCSP.hs b/backends/GenerateCPPCSP.hs index b91b593..3c6b5da 100644 --- a/backends/GenerateCPPCSP.hs +++ b/backends/GenerateCPPCSP.hs @@ -74,6 +74,7 @@ cppgenOps = cgenOps { genOutputCase = cppgenOutputCase, genOutputItem = cppgenOutputItem, genPar = cppgenPar, + genPoison = cppgenPoison, genProcCall = cppgenProcCall, genReplicatorLoop = cppgenReplicatorLoop, genStop = cppgenStop, @@ -201,6 +202,11 @@ genCPPCSPChannelOutput var (A.Chan A.DirUnknown _ _) -> do call genVariable var tell ["->writer()"] _ -> call genMissing $ "genCPPCSPChannelOutput used on something which does not support output: " ++ show var + +cppgenPoison :: Meta -> A.Variable -> CGen () +cppgenPoison _m var + = do call genVariable var + tell ["->poison();"] --}}} -- | C++CSP2 returns the number of seconds since the epoch as the time