Removed the handling of the old Rain Wait/GetTime items from the backends

This commit is contained in:
Neil Brown 2008-03-24 15:08:05 +00:00
parent eb50c010b2
commit 2d0d6463d5
4 changed files with 1 additions and 53 deletions

View File

@ -147,7 +147,6 @@ cgenOps = GenOps {
genVariableAM = cgenVariableAM,
genVariableUnchecked = cgenVariableUnchecked,
genWhile = cgenWhile,
genWait = cgenWait,
getScalarType = cgetScalarType,
introduceSpec = cintroduceSpec,
removeSpec = cremoveSpec
@ -1455,8 +1454,6 @@ cgenProcess p = case p of
A.Input m c im -> call genInput c im
A.Output m c ois -> call genOutput c ois
A.OutputCase m c t ois -> call genOutputCase c t ois
A.GetTime m v -> call genGetTime v
A.Wait m wm e -> call genWait wm e
A.Skip m -> tell ["/* skip */\n"]
A.Stop m -> call genStop m "STOP process"
A.Seq _ s -> call genSeq s
@ -1516,13 +1513,6 @@ cgenGetTime v
= do call genVariable v
tell [" = TimerRead(wptr);"]
cgenWait :: A.WaitMode -> A.Expression -> CGen ()
cgenWait A.WaitUntil e = call genTimerWait e
cgenWait A.WaitFor e
= do tell ["TimerDelay(wptr,"]
call genExpression e
tell [");"]
--}}}
--{{{ output
cgenOutput :: A.Variable -> [A.OutputItem] -> CGen ()
@ -1677,7 +1667,6 @@ cgenAlt isPri s
= case a of
A.Alternative _ _ (A.InputTimerRead _ _) _ -> True
A.Alternative _ _ (A.InputTimerAfter _ _) _ -> True
A.AlternativeWait _ _ _ _ -> True
_ -> False
containsTimers (A.Several _ ss) = or $ map containsTimers ss
@ -1689,11 +1678,6 @@ cgenAlt isPri s
A.Alternative _ c im _ -> doIn c im
A.AlternativeCond _ e c im _ -> withIf e $ doIn c im
A.AlternativeSkip _ e _ -> withIf e $ tell ["AltEnableSkip (wptr,", id, "++);\n"]
--transformWaitFor should have removed all A.WaitFor guards (transforming them into A.WaitUntil):
A.AlternativeWait _ A.WaitUntil e _ ->
do tell ["AltEnableTimer (wptr,", id, "++,"]
call genExpression e
tell [" );\n"]
doIn c im
= do case im of
@ -1715,10 +1699,7 @@ cgenAlt isPri s
A.Alternative _ c im _ -> doIn c im
A.AlternativeCond _ e c im _ -> withIf e $ doIn c im
A.AlternativeSkip _ e _ -> withIf e $ tell ["AltDisableSkip (wptr,", id, "++);\n"]
A.AlternativeWait _ A.WaitUntil e _ ->
do tell ["AltDisableTimer (wptr,", id, "++, "]
call genExpression e
tell [");\n"]
doIn c im
= do case im of
A.InputTimerRead _ _ -> call genMissing "timer read in ALT"
@ -1739,7 +1720,6 @@ cgenAlt isPri s
A.Alternative _ c im p -> doIn c im p
A.AlternativeCond _ e c im p -> withIf e $ doIn c im p
A.AlternativeSkip _ e p -> withIf e $ doCheck (call genProcess p)
A.AlternativeWait _ _ _ p -> doCheck (call genProcess p)
doIn c im p
= do case im of

View File

@ -180,8 +180,6 @@ data GenOps = GenOps {
genVariableAM :: A.Variable -> A.AbbrevMode -> CGen (),
-- | Generates a variable, with no indexing checks anywhere
genVariableUnchecked :: A.Variable -> CGen (),
-- | Performs a wait for\/until (depending on the 'A.WaitMode') a specified time
genWait :: A.WaitMode -> A.Expression -> CGen (),
-- | Generates a while loop with the given condition and body.
genWhile :: A.Expression -> A.Process -> CGen (),
getScalarType :: A.Type -> Maybe String,

View File

@ -82,7 +82,6 @@ cppgenOps = cgenOps {
genType = cppgenType,
genUnfoldedExpression = cppgenUnfoldedExpression,
genUnfoldedVariable = cppgenUnfoldedVariable,
genWait = cppgenWait,
getScalarType = cppgetScalarType,
introduceSpec = cppintroduceSpec,
removeSpec = cppremoveSpec
@ -225,12 +224,6 @@ cppgenGetTime v
call genVariable v
tell [");"]
cppgenWait :: A.WaitMode -> A.Expression -> CGen ()
cppgenWait wm e
= do tell [if wm == A.WaitFor then "csp::SleepFor" else "csp::SleepUntil", "("]
call genExpression e
tell [");"]
{-|
Gets a csp::Time to wait with, given a 32-bit microsecond value (returns the temp variable we have put it in)
@ -437,10 +430,6 @@ cppgenAlt _ s
A.Alternative _ c im _ -> doIn c im
A.AlternativeCond _ e c im _ -> withIf e $ doIn c im
A.AlternativeSkip _ e _ -> withIf e $ tell [guardList, " . push_back( new csp::SkipGuard() );\n"]
A.AlternativeWait _ wm e _ ->
do tell [guardList, " . push_back( new ", if wm == A.WaitUntil then "csp::TimeoutGuard (" else "csp::RelTimeoutGuard("]
call genExpression e
tell ["));"]
doIn c im
= do case im of
@ -463,7 +452,6 @@ cppgenAlt _ s
A.Alternative _ c im p -> doIn c im p
A.AlternativeCond _ e c im p -> withIf e $ doIn c im p
A.AlternativeSkip _ e p -> withIf e $ doCheck (call genProcess p)
A.AlternativeWait _ _ _ p -> doCheck (call genProcess p)
doIn c im p
= do case im of

View File

@ -889,22 +889,6 @@ testCase = TestList
over :: Override
over = local $ \ops -> ops {genExpression = override1 dollar, genProcess = override1 at, genStop = override2 caret, genSpec = override2 hash}
testGetTime :: Test
testGetTime = testBoth "testGetTime 0" "@ = TimerRead(wptr);" "csp::CurrentTime(&@);" (over (tcall genGetTime undefined))
where
over :: Override
over = local $ \ops -> ops {genVariable = override1 at}
testWait :: Test
testWait = TestList
[
testBoth "testWait 0" "TimerWait(wptr,$);" "csp::SleepUntil($);" (over (tcall2 genWait A.WaitUntil undefined))
,testBoth "testWait 1" "TimerDelay(wptr,$);" "csp::SleepFor($);" (over (tcall2 genWait A.WaitFor undefined))
]
where
over :: Override
over = local $ \ops -> ops {genExpression = override1 dollar}
testIf :: Test
testIf = TestList
[
@ -1165,7 +1149,6 @@ tests = TestLabel "GenerateCTest" $ TestList
,testDeclareInitFree
,testGenType
,testGenVariable
,testGetTime
,testIf
,testInput
,testMobile
@ -1176,6 +1159,5 @@ tests = TestLabel "GenerateCTest" $ TestList
,testRetypeSizes
,testSpec
,testStop
,testWait
,testWhile
]