Go back to generating Time variables for timers.

This is for two reasons: first, the C++CSP backend still needs them, and
second, the way I'd done the removal wasn't correct; since you can have arrays
of them, abbreviate them, etc., they need to be stripped out by an earlier
pass so that other passes don't try to operate upon them.
This commit is contained in:
Adam Sampson 2008-03-09 11:57:43 +00:00
parent 35538cda36
commit f8d4efa0e9
2 changed files with 7 additions and 2 deletions

View File

@ -279,7 +279,7 @@ cgetScalarType A.Int32 = Just "int32_t"
cgetScalarType A.Int64 = Just "int64_t"
cgetScalarType A.Real32 = Just "float"
cgetScalarType A.Real64 = Just "double"
cgetScalarType A.Timer = Just "Time" -- Not used in the C backend.
cgetScalarType A.Timer = Just "Time"
cgetScalarType A.Time = Just "Time"
cgetScalarType _ = Nothing
@ -1090,7 +1090,6 @@ cgenDeclaration (A.Array ds t) n True
call genArrayStoreName n
call genFlatArraySize ds
tell [";"]
cgenDeclaration A.Timer _ _ = return ()
cgenDeclaration t n _
= do call genType t
tell [" "]

View File

@ -462,6 +462,12 @@ testDeclaration = TestList
--Records of arrays of int (the sizes are set by declareInit):
,testBothSameS "genDeclaration 400" "REC foo;" (tcall3 genDeclaration (A.Record $ simpleName "REC") foo False) (stateR $ A.Array [A.Dimension 8] A.Int)
--Timers:
,testBoth "genDeclaration 500" "Time foo;" "csp::Time foo;"
(tcall3 genDeclaration A.Timer foo False)
,testBoth "genDeclaration 501" "Time foo[20];" "csp::Time foo[20];"
(tcall3 genDeclaration (A.Array [A.Dimension 20] A.Timer) foo False)
]
where
stateR t = defRecord "REC" "bar" t