Removed the handling of the old Rain Wait/GetTime items from the backends
This commit is contained in:
parent
eb50c010b2
commit
2d0d6463d5
|
@ -147,7 +147,6 @@ cgenOps = GenOps {
|
||||||
genVariableAM = cgenVariableAM,
|
genVariableAM = cgenVariableAM,
|
||||||
genVariableUnchecked = cgenVariableUnchecked,
|
genVariableUnchecked = cgenVariableUnchecked,
|
||||||
genWhile = cgenWhile,
|
genWhile = cgenWhile,
|
||||||
genWait = cgenWait,
|
|
||||||
getScalarType = cgetScalarType,
|
getScalarType = cgetScalarType,
|
||||||
introduceSpec = cintroduceSpec,
|
introduceSpec = cintroduceSpec,
|
||||||
removeSpec = cremoveSpec
|
removeSpec = cremoveSpec
|
||||||
|
@ -1455,8 +1454,6 @@ cgenProcess p = case p of
|
||||||
A.Input m c im -> call genInput c im
|
A.Input m c im -> call genInput c im
|
||||||
A.Output m c ois -> call genOutput c ois
|
A.Output m c ois -> call genOutput c ois
|
||||||
A.OutputCase m c t ois -> call genOutputCase c t 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.Skip m -> tell ["/* skip */\n"]
|
||||||
A.Stop m -> call genStop m "STOP process"
|
A.Stop m -> call genStop m "STOP process"
|
||||||
A.Seq _ s -> call genSeq s
|
A.Seq _ s -> call genSeq s
|
||||||
|
@ -1516,13 +1513,6 @@ cgenGetTime v
|
||||||
= do call genVariable v
|
= do call genVariable v
|
||||||
tell [" = TimerRead(wptr);"]
|
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
|
--{{{ output
|
||||||
cgenOutput :: A.Variable -> [A.OutputItem] -> CGen ()
|
cgenOutput :: A.Variable -> [A.OutputItem] -> CGen ()
|
||||||
|
@ -1677,7 +1667,6 @@ cgenAlt isPri s
|
||||||
= case a of
|
= case a of
|
||||||
A.Alternative _ _ (A.InputTimerRead _ _) _ -> True
|
A.Alternative _ _ (A.InputTimerRead _ _) _ -> True
|
||||||
A.Alternative _ _ (A.InputTimerAfter _ _) _ -> True
|
A.Alternative _ _ (A.InputTimerAfter _ _) _ -> True
|
||||||
A.AlternativeWait _ _ _ _ -> True
|
|
||||||
_ -> False
|
_ -> False
|
||||||
containsTimers (A.Several _ ss) = or $ map containsTimers ss
|
containsTimers (A.Several _ ss) = or $ map containsTimers ss
|
||||||
|
|
||||||
|
@ -1689,11 +1678,6 @@ cgenAlt isPri s
|
||||||
A.Alternative _ c im _ -> doIn c im
|
A.Alternative _ c im _ -> doIn c im
|
||||||
A.AlternativeCond _ e c im _ -> withIf e $ doIn c im
|
A.AlternativeCond _ e c im _ -> withIf e $ doIn c im
|
||||||
A.AlternativeSkip _ e _ -> withIf e $ tell ["AltEnableSkip (wptr,", id, "++);\n"]
|
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
|
doIn c im
|
||||||
= do case im of
|
= do case im of
|
||||||
|
@ -1715,10 +1699,7 @@ cgenAlt isPri s
|
||||||
A.Alternative _ c im _ -> doIn c im
|
A.Alternative _ c im _ -> doIn c im
|
||||||
A.AlternativeCond _ e c im _ -> withIf e $ doIn c im
|
A.AlternativeCond _ e c im _ -> withIf e $ doIn c im
|
||||||
A.AlternativeSkip _ e _ -> withIf e $ tell ["AltDisableSkip (wptr,", id, "++);\n"]
|
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
|
doIn c im
|
||||||
= do case im of
|
= do case im of
|
||||||
A.InputTimerRead _ _ -> call genMissing "timer read in ALT"
|
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.Alternative _ c im p -> doIn c im p
|
||||||
A.AlternativeCond _ e c im p -> withIf e $ 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.AlternativeSkip _ e p -> withIf e $ doCheck (call genProcess p)
|
||||||
A.AlternativeWait _ _ _ p -> doCheck (call genProcess p)
|
|
||||||
|
|
||||||
doIn c im p
|
doIn c im p
|
||||||
= do case im of
|
= do case im of
|
||||||
|
|
|
@ -180,8 +180,6 @@ data GenOps = GenOps {
|
||||||
genVariableAM :: A.Variable -> A.AbbrevMode -> CGen (),
|
genVariableAM :: A.Variable -> A.AbbrevMode -> CGen (),
|
||||||
-- | Generates a variable, with no indexing checks anywhere
|
-- | Generates a variable, with no indexing checks anywhere
|
||||||
genVariableUnchecked :: A.Variable -> CGen (),
|
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.
|
-- | Generates a while loop with the given condition and body.
|
||||||
genWhile :: A.Expression -> A.Process -> CGen (),
|
genWhile :: A.Expression -> A.Process -> CGen (),
|
||||||
getScalarType :: A.Type -> Maybe String,
|
getScalarType :: A.Type -> Maybe String,
|
||||||
|
|
|
@ -82,7 +82,6 @@ cppgenOps = cgenOps {
|
||||||
genType = cppgenType,
|
genType = cppgenType,
|
||||||
genUnfoldedExpression = cppgenUnfoldedExpression,
|
genUnfoldedExpression = cppgenUnfoldedExpression,
|
||||||
genUnfoldedVariable = cppgenUnfoldedVariable,
|
genUnfoldedVariable = cppgenUnfoldedVariable,
|
||||||
genWait = cppgenWait,
|
|
||||||
getScalarType = cppgetScalarType,
|
getScalarType = cppgetScalarType,
|
||||||
introduceSpec = cppintroduceSpec,
|
introduceSpec = cppintroduceSpec,
|
||||||
removeSpec = cppremoveSpec
|
removeSpec = cppremoveSpec
|
||||||
|
@ -225,12 +224,6 @@ cppgenGetTime v
|
||||||
call genVariable v
|
call genVariable v
|
||||||
tell [");"]
|
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)
|
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.Alternative _ c im _ -> doIn c im
|
||||||
A.AlternativeCond _ e c im _ -> withIf e $ 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.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
|
doIn c im
|
||||||
= do case im of
|
= do case im of
|
||||||
|
@ -463,7 +452,6 @@ cppgenAlt _ s
|
||||||
A.Alternative _ c im p -> doIn c im p
|
A.Alternative _ c im p -> doIn c im p
|
||||||
A.AlternativeCond _ e c im p -> withIf e $ 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.AlternativeSkip _ e p -> withIf e $ doCheck (call genProcess p)
|
||||||
A.AlternativeWait _ _ _ p -> doCheck (call genProcess p)
|
|
||||||
|
|
||||||
doIn c im p
|
doIn c im p
|
||||||
= do case im of
|
= do case im of
|
||||||
|
|
|
@ -889,22 +889,6 @@ testCase = TestList
|
||||||
over :: Override
|
over :: Override
|
||||||
over = local $ \ops -> ops {genExpression = override1 dollar, genProcess = override1 at, genStop = override2 caret, genSpec = override2 hash}
|
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 :: Test
|
||||||
testIf = TestList
|
testIf = TestList
|
||||||
[
|
[
|
||||||
|
@ -1165,7 +1149,6 @@ tests = TestLabel "GenerateCTest" $ TestList
|
||||||
,testDeclareInitFree
|
,testDeclareInitFree
|
||||||
,testGenType
|
,testGenType
|
||||||
,testGenVariable
|
,testGenVariable
|
||||||
,testGetTime
|
|
||||||
,testIf
|
,testIf
|
||||||
,testInput
|
,testInput
|
||||||
,testMobile
|
,testMobile
|
||||||
|
@ -1176,6 +1159,5 @@ tests = TestLabel "GenerateCTest" $ TestList
|
||||||
,testRetypeSizes
|
,testRetypeSizes
|
||||||
,testSpec
|
,testSpec
|
||||||
,testStop
|
,testStop
|
||||||
,testWait
|
|
||||||
,testWhile
|
,testWhile
|
||||||
]
|
]
|
||||||
|
|
Loading…
Reference in New Issue
Block a user