Added some template types to one of the uses of tockArrayView to please the C++ compiler, and adjusted the tests accordingly

This commit is contained in:
Neil Brown 2008-02-28 15:32:26 +00:00
parent 8f2575819b
commit d73f2f509c
2 changed files with 6 additions and 4 deletions

View File

@ -610,9 +610,11 @@ cppdeclareInit m rt@(A.Record _) var _
where where
initField :: A.Type -> A.Variable -> CGen () initField :: A.Type -> A.Variable -> CGen ()
-- An array as a record field; we must initialise the sizes. -- 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 = do call genVariableUnchecked v
tell ["=tockArrayView("] tell ["=tockArrayView<"]
call genType ts
tell [",",show (length ds),">("]
call genVariableUnchecked v call genVariableUnchecked v
tell ["_actual,tockDims("] tell ["_actual,tockDims("]
infixComma [tell [show n] | (A.Dimension n) <- ds] infixComma [tell [show n] | (A.Dimension n) <- ds]

View File

@ -503,9 +503,9 @@ testDeclareInitFree = TestLabel "testDeclareInitFree" $ TestList
-- Plain records: -- Plain records:
,testAllR 100 ("","") ("","") A.Int id ,testAllR 100 ("","") ("","") A.Int id
-- Records containing an array: -- 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<int,2>((&foo)->bar_actual,tockDims(4,5));","") (A.Array [A.Dimension 4,A.Dimension 5] A.Int) id
-- Arrays of records containing an array: -- 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<int,2>((&foo[0].access())->bar_actual,tockDims(4,5));^","") (A.Array [A.Dimension 4,A.Dimension 5] A.Int) id
-- Mobile versions -- Mobile versions
,testAllSame 1003 ("","") $ A.Mobile $ A.Array [A.Dimension 4] A.Int ,testAllSame 1003 ("","") $ A.Mobile $ A.Array [A.Dimension 4] A.Int