From d73f2f509c6986a9d85fecff00bdfb560e3225eb Mon Sep 17 00:00:00 2001 From: Neil Brown Date: Thu, 28 Feb 2008 15:32:26 +0000 Subject: [PATCH] Added some template types to one of the uses of tockArrayView to please the C++ compiler, and adjusted the tests accordingly --- backends/GenerateCPPCSP.hs | 6 ++++-- backends/GenerateCTest.hs | 4 ++-- 2 files changed, 6 insertions(+), 4 deletions(-) diff --git a/backends/GenerateCPPCSP.hs b/backends/GenerateCPPCSP.hs index c38218e..bb64005 100644 --- a/backends/GenerateCPPCSP.hs +++ b/backends/GenerateCPPCSP.hs @@ -610,9 +610,11 @@ cppdeclareInit m rt@(A.Record _) var _ where initField :: A.Type -> A.Variable -> CGen () -- An array as a record field; we must initialise the sizes. - initField t@(A.Array ds _) v + initField t@(A.Array ds ts) v = do call genVariableUnchecked v - tell ["=tockArrayView("] + tell ["=tockArrayView<"] + call genType ts + tell [",",show (length ds),">("] call genVariableUnchecked v tell ["_actual,tockDims("] infixComma [tell [show n] | (A.Dimension n) <- ds] diff --git a/backends/GenerateCTest.hs b/backends/GenerateCTest.hs index 7e568b0..5af95af 100644 --- a/backends/GenerateCTest.hs +++ b/backends/GenerateCTest.hs @@ -503,9 +503,9 @@ testDeclareInitFree = TestLabel "testDeclareInitFree" $ TestList -- Plain records: ,testAllR 100 ("","") ("","") A.Int id -- Records containing an array: - ,testAllR 101 ("(&foo)->bar_sizes[0]=4;(&foo)->bar_sizes[1]=5;","") ("(&foo)->bar=tockArrayView((&foo)->bar_actual,tockDims(4,5));","") (A.Array [A.Dimension 4,A.Dimension 5] A.Int) id + ,testAllR 101 ("(&foo)->bar_sizes[0]=4;(&foo)->bar_sizes[1]=5;","") ("(&foo)->bar=tockArrayView((&foo)->bar_actual,tockDims(4,5));","") (A.Array [A.Dimension 4,A.Dimension 5] A.Int) id -- Arrays of records containing an array: - ,testAllRA 200 ("^(&foo[0])->bar_sizes[0]=4;(&foo[0])->bar_sizes[1]=5;^","") ("^(&foo[0].access())->bar=tockArrayView((&foo[0].access())->bar_actual,tockDims(4,5));^","") (A.Array [A.Dimension 4,A.Dimension 5] A.Int) id + ,testAllRA 200 ("^(&foo[0])->bar_sizes[0]=4;(&foo[0])->bar_sizes[1]=5;^","") ("^(&foo[0].access())->bar=tockArrayView((&foo[0].access())->bar_actual,tockDims(4,5));^","") (A.Array [A.Dimension 4,A.Dimension 5] A.Int) id -- Mobile versions ,testAllSame 1003 ("","") $ A.Mobile $ A.Array [A.Dimension 4] A.Int