diff --git a/backends/GenerateC.hs b/backends/GenerateC.hs index 85b4bb5..eef4513 100644 --- a/backends/GenerateC.hs +++ b/backends/GenerateC.hs @@ -133,6 +133,7 @@ cgenOps = GenOps { genReplicatorLoop = cgenReplicatorLoop, genReschedule = cgenReschedule, genRetypeSizes = cgenRetypeSizes, + genSetAff = cgenSetAff, genSetPri = cgenSetPri, genSeq = cgenSeq, genSpec = cgenSpec, @@ -2182,6 +2183,7 @@ cgenIntrinsicProc :: Meta -> String -> [A.Actual] -> CGen () cgenIntrinsicProc m "ASSERT" [A.ActualExpression e] = call genAssert m e cgenIntrinsicProc _ "RESCHEDULE" [] = call genReschedule cgenIntrinsicProc m "CAUSEERROR" [] = call genStop m "CAUSEERROR" +cgenIntrinsicProc m "SETAFF" [A.ActualExpression e] = call genSetAff m e cgenIntrinsicProc m "SETPRI" [A.ActualExpression e] = call genSetPri m e cgenIntrinsicProc m s as = case lookup s intrinsicProcs of Just amtns -> do tell ["occam_", [if c == '.' then '_' else c | c <- s], "(wptr,"] @@ -2206,6 +2208,11 @@ cgenAssert m e call genStop m "assertion failed" tell ["}\n"] +cgenSetAff :: Meta -> A.Expression -> CGen () +cgenSetAff _ e = do tell ["SetAffinity(wptr,"] + call genExpression e + tell [");"] + cgenSetPri :: Meta -> A.Expression -> CGen () cgenSetPri _ e = do tell ["SetPriority(wptr,"] call genExpression e diff --git a/backends/GenerateCBased.hs b/backends/GenerateCBased.hs index 6d187f5..3000b4f 100644 --- a/backends/GenerateCBased.hs +++ b/backends/GenerateCBased.hs @@ -196,6 +196,7 @@ data GenOps = GenOps { genReplicatorLoop :: A.Name -> A.Replicator -> CGen (), genReschedule :: CGen(), genRetypeSizes :: Meta -> A.Type -> A.Name -> A.Type -> A.Variable -> CGen (), + genSetAff :: Meta -> A.Expression -> CGen (), genSetPri :: Meta -> A.Expression -> CGen (), genSeq :: A.Structured A.Process -> CGen (), genSpec :: forall b. Level -> A.Specification -> CGen b -> CGen b, diff --git a/common/Intrinsics.hs b/common/Intrinsics.hs index bc11a37..e7590f3 100644 --- a/common/Intrinsics.hs +++ b/common/Intrinsics.hs @@ -131,6 +131,7 @@ intrinsicProcs = [ ("ASSERT", [(A.ValAbbrev, A.Bool, "value")]) , ("CAUSEERROR", []) , ("RESCHEDULE", []) + , ("SETAFF", [(A.ValAbbrev, A.Int, "aff")]) , ("SETPRI", [(A.ValAbbrev, A.Int, "pri")]) ] ++ concat [ (zip ["INT" ++ suffix ++ "TOSTRING", "HEX" ++ suffix ++ "TOSTRING"] $ repeat