Changed the C++ arrays to use standard C-like arrays rather than std::vector as they used to

This commit is contained in:
Neil Brown 2007-10-04 00:19:38 +00:00
parent 79530aaf8b
commit 93610a5837
2 changed files with 10 additions and 14 deletions

View File

@ -647,10 +647,6 @@ cppgenProcCall ops n as
-- | Changed from CIF's untyped channels to C++CSP's typed (templated) channels, and changed the declaration type of an array to be a vector.
cppdeclareType :: GenOps -> A.Type -> CGen ()
cppdeclareType ops (A.Array ds t)
= do tell ["std::vector<"]
call genType ops t
tell ["/**/>/**/"]
cppdeclareType ops (A.Counted countType valueType)
= do tell ["std::vector<"]
case valueType of
@ -681,12 +677,12 @@ cppdeclareType ops t = call genType ops t
--but I will worry about that later
cppgenDeclaration :: GenOps -> A.Type -> A.Name -> CGen ()
cppgenDeclaration ops arrType@(A.Array ds t) n
= do call declareType ops arrType
= do call declareType ops t
tell [" "]
genName n
tell ["_actual("]
tell ["_actual["]
call genFlatArraySize ops ds
tell [");"]
tell ["];"]
call genType ops arrType
tell [" "]
genName n;

View File

@ -322,28 +322,28 @@ testDeclaration = TestList
,testBoth "genDeclaration 8" "Channel* foo;" "csp::Chanout<int> foo;" (tcall2 genDeclaration (A.Chan A.DirOutput (A.ChanAttributes True False) A.Int) foo)
--Arrays (of simple):
,testBoth "genDeclaration 100" "int foo[8];const int foo_sizes[]={8};" "std::vector<int> foo_actual(8);tockArrayView<int,1> foo(foo_actual,tockDims(8));"
,testBoth "genDeclaration 100" "int foo[8];const int foo_sizes[]={8};" "int foo_actual[8];tockArrayView<int,1> foo(foo_actual,tockDims(8));"
(tcall2 genDeclaration (A.Array [A.Dimension 8] A.Int) foo)
,testBoth "genDeclaration 101" "int foo[8*9];const int foo_sizes[]={8,9};" "std::vector<int> foo_actual(8*9);tockArrayView<int,2> foo(foo_actual,tockDims(8,9));"
,testBoth "genDeclaration 101" "int foo[8*9];const int foo_sizes[]={8,9};" "int foo_actual[8*9];tockArrayView<int,2> foo(foo_actual,tockDims(8,9));"
(tcall2 genDeclaration (A.Array [A.Dimension 8,A.Dimension 9] A.Int) foo)
,testBoth "genDeclaration 102" "int foo[8*9*10];const int foo_sizes[]={8,9,10};" "std::vector<int> foo_actual(8*9*10);tockArrayView<int,3> foo(foo_actual,tockDims(8,9,10));"
,testBoth "genDeclaration 102" "int foo[8*9*10];const int foo_sizes[]={8,9,10};" "int foo_actual[8*9*10];tockArrayView<int,3> foo(foo_actual,tockDims(8,9,10));"
(tcall2 genDeclaration (A.Array [A.Dimension 8,A.Dimension 9,A.Dimension 10] A.Int) foo)
--Arrays of channels and channel-ends:
,testBoth "genDeclaration 200" "Channel* foo[8];const int foo_sizes[]={8};"
"std::vector<csp::One2OneChannel<int>*> foo_actual(8);tockArrayView<csp::One2OneChannel<int>*,1> foo(foo_actual,tockDims(8));"
"csp::One2OneChannel<int>* foo_actual[8];tockArrayView<csp::One2OneChannel<int>*,1> foo(foo_actual,tockDims(8));"
(tcall2 genDeclaration (A.Array [A.Dimension 8] $ A.Chan A.DirUnknown (A.ChanAttributes False False) A.Int) foo)
,testBoth "genDeclaration 201" "Channel* foo[8*9];const int foo_sizes[]={8,9};"
"std::vector<csp::One2OneChannel<int>*> foo_actual(8*9);tockArrayView<csp::One2OneChannel<int>*,2> foo(foo_actual,tockDims(8,9));"
"csp::One2OneChannel<int>* foo_actual[8*9];tockArrayView<csp::One2OneChannel<int>*,2> foo(foo_actual,tockDims(8,9));"
(tcall2 genDeclaration (A.Array [A.Dimension 8, A.Dimension 9] $ A.Chan A.DirUnknown (A.ChanAttributes False False) A.Int) foo)
,testBoth "genDeclaration 202" "Channel* foo[8];const int foo_sizes[]={8};"
"std::vector<csp::Chanin<int>> foo_actual(8);tockArrayView<csp::Chanin<int>,1> foo(foo_actual,tockDims(8));"
"csp::Chanin<int> foo_actual[8];tockArrayView<csp::Chanin<int>,1> foo(foo_actual,tockDims(8));"
(tcall2 genDeclaration (A.Array [A.Dimension 8] $ A.Chan A.DirInput (A.ChanAttributes False False) A.Int) foo)
,testBoth "genDeclaration 203" "Channel* foo[8*9];const int foo_sizes[]={8,9};"
"std::vector<csp::Chanout<int>> foo_actual(8*9);tockArrayView<csp::Chanout<int>,2> foo(foo_actual,tockDims(8,9));"
"csp::Chanout<int> foo_actual[8*9];tockArrayView<csp::Chanout<int>,2> foo(foo_actual,tockDims(8,9));"
(tcall2 genDeclaration (A.Array [A.Dimension 8, A.Dimension 9] $ A.Chan A.DirOutput (A.ChanAttributes False False) A.Int) foo)
]