Added support for the new Wait process to the C and C++ backends
This commit is contained in:
parent
a65953ad89
commit
41d4923e9c
|
@ -153,6 +153,7 @@ data GenOps = GenOps {
|
||||||
genVariable' :: GenOps -> Bool -> A.Variable -> CGen (),
|
genVariable' :: GenOps -> Bool -> A.Variable -> CGen (),
|
||||||
genVariableAM :: GenOps -> A.Variable -> A.AbbrevMode -> CGen (),
|
genVariableAM :: GenOps -> A.Variable -> A.AbbrevMode -> CGen (),
|
||||||
genVariableUnchecked :: GenOps -> A.Variable -> CGen (),
|
genVariableUnchecked :: GenOps -> A.Variable -> CGen (),
|
||||||
|
genWait :: GenOps -> A.WaitMode -> A.Expression -> CGen (),
|
||||||
genWhile :: GenOps -> A.Expression -> A.Process -> CGen (),
|
genWhile :: GenOps -> A.Expression -> A.Process -> CGen (),
|
||||||
getScalarType :: GenOps -> A.Type -> Maybe String,
|
getScalarType :: GenOps -> A.Type -> Maybe String,
|
||||||
introduceSpec :: GenOps -> A.Specification -> CGen (),
|
introduceSpec :: GenOps -> A.Specification -> CGen (),
|
||||||
|
@ -243,6 +244,7 @@ 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
|
||||||
|
@ -1479,6 +1481,7 @@ cgenProcess ops p = case p of
|
||||||
A.Output m c ois -> call genOutput ops c ois
|
A.Output m c ois -> call genOutput ops c ois
|
||||||
A.OutputCase m c t ois -> call genOutputCase ops c t ois
|
A.OutputCase m c t ois -> call genOutputCase ops c t ois
|
||||||
A.GetTime m v -> call genGetTime ops m v
|
A.GetTime m v -> call genGetTime ops m v
|
||||||
|
A.Wait m wm e -> call genWait ops wm e
|
||||||
A.Skip m -> tell ["/* skip */\n"]
|
A.Skip m -> tell ["/* skip */\n"]
|
||||||
A.Stop m -> call genStop ops m "STOP process"
|
A.Stop m -> call genStop ops m "STOP process"
|
||||||
A.Main m -> tell ["/* main */\n"]
|
A.Main m -> tell ["/* main */\n"]
|
||||||
|
@ -1579,6 +1582,13 @@ cgenGetTime ops m v
|
||||||
call genVariable ops v
|
call genVariable ops v
|
||||||
tell [");\n"]
|
tell [");\n"]
|
||||||
|
|
||||||
|
cgenWait :: GenOps -> A.WaitMode -> A.Expression -> CGen ()
|
||||||
|
cgenWait ops A.WaitUntil e = call genTimerWait ops e
|
||||||
|
cgenWait ops A.WaitFor e
|
||||||
|
= do tell ["ProcAfter ("]
|
||||||
|
call genExpression ops e
|
||||||
|
tell [");\n"]
|
||||||
|
|
||||||
--}}}
|
--}}}
|
||||||
--{{{ output
|
--{{{ output
|
||||||
cgenOutput :: GenOps -> A.Variable -> [A.OutputItem] -> CGen ()
|
cgenOutput :: GenOps -> A.Variable -> [A.OutputItem] -> CGen ()
|
||||||
|
|
|
@ -130,6 +130,7 @@ cppgenOps = cgenOps {
|
||||||
genUnfoldedExpression = cppgenUnfoldedExpression,
|
genUnfoldedExpression = cppgenUnfoldedExpression,
|
||||||
genUnfoldedVariable = cppgenUnfoldedVariable,
|
genUnfoldedVariable = cppgenUnfoldedVariable,
|
||||||
genVariable' = cppgenVariable',
|
genVariable' = cppgenVariable',
|
||||||
|
genWait = cppgenWait,
|
||||||
getScalarType = cppgetScalarType,
|
getScalarType = cppgetScalarType,
|
||||||
introduceSpec = cppintroduceSpec,
|
introduceSpec = cppintroduceSpec,
|
||||||
removeSpec = cppremoveSpec
|
removeSpec = cppremoveSpec
|
||||||
|
@ -356,6 +357,12 @@ cppgenGetTime ops m v
|
||||||
call genVariable ops v
|
call genVariable ops v
|
||||||
tell [");"]
|
tell [");"]
|
||||||
|
|
||||||
|
cppgenWait :: GenOps -> A.WaitMode -> A.Expression -> CGen ()
|
||||||
|
cppgenWait ops wm e
|
||||||
|
= do tell [if wm == A.WaitFor then "csp::SleepFor" else "csp::SleepUntil", "("]
|
||||||
|
call genExpression ops 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)
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue
Block a user