From debdef4f4f66880b6e34eb7914da346bc9a5af89 Mon Sep 17 00:00:00 2001 From: Neil Brown Date: Wed, 8 Apr 2009 19:14:29 +0000 Subject: [PATCH] Fixed the generation of directed channels for the C++ backend --- backends/GenerateC.hs | 5 +++-- backends/GenerateCPPCSP.hs | 2 +- 2 files changed, 4 insertions(+), 3 deletions(-) diff --git a/backends/GenerateC.hs b/backends/GenerateC.hs index 3cb4031..fe878e6 100644 --- a/backends/GenerateC.hs +++ b/backends/GenerateC.hs @@ -709,11 +709,12 @@ cgenVariableWithAM checkValid v am fct , Pointer $ innerCT) _ -> inner v inner wholeV@(A.DirectedVariable m dir v) - = do (cg, _) <- inner v + = do (cg, ctInner) <- inner v + let cg' = dressUp m (cg, ctInner) (stripPointers ctInner) t <- astTypeOf v wholeT <- astTypeOf wholeV ct <- call getCType m wholeT A.Original - return (call genDirectedVariable m t cg dir, ct) + return (call genDirectedVariable m t cg' dir, ct) inner (A.VariableSizes m (A.Variable _ n)) = do t <- astTypeOf n f <- fget getScalarType diff --git a/backends/GenerateCPPCSP.hs b/backends/GenerateCPPCSP.hs index cd8290a..295034a 100644 --- a/backends/GenerateCPPCSP.hs +++ b/backends/GenerateCPPCSP.hs @@ -886,7 +886,7 @@ cppgenDirectedVariable :: Meta -> A.Type -> CGen () -> A.Direction -> CGen () cppgenDirectedVariable m t v dir = case t of A.ChanEnd {} -> v - A.Chan {} -> tell ["(("] >> v >> tell [")->",if dir == A.DirInput + A.Chan {} -> tell ["(("] >> v >> tell [").",if dir == A.DirInput then "reader" else "writer","())"] A.Array _ (A.ChanEnd {}) -> v A.Array _ (A.Chan {}) -> dieP m "Should have pulled up directed arrays"