Added the helper functions for adding and subtracting Times in C++CSP

This commit is contained in:
Neil Brown 2008-03-23 13:29:22 +00:00
parent cc6dce5ead
commit fc4cac736b
2 changed files with 16 additions and 3 deletions

View File

@ -896,9 +896,10 @@ cgenSizeSuffix dim = tell ["_sizes[", dim, "]"]
cgenTypeSymbol :: String -> A.Type -> CGen ()
cgenTypeSymbol s t
= do f <- fget getScalarType
case f t of
Just ct -> tell ["occam_", s, "_", ct]
Nothing -> call genMissingC $ formatCode "genTypeSymbol %" t
case (t, f t) of
(A.Time, _) -> tell ["occam_", s, "_time"]
(_, Just ct) -> tell ["occam_", s, "_", ct]
(_, Nothing) -> call genMissingC $ formatCode "genTypeSymbol %" t
cgenIntrinsicFunction :: Meta -> String -> [A.Expression] -> CGen ()
cgenIntrinsicFunction m s es

View File

@ -296,6 +296,18 @@ public:
};
// Time addition and subtraction:
inline csp::Time occam_plus_time (const csp::Time& a, const csp::Time& b, const char *)
{
return a + b;
}
inline csp::Time occam_minus_time (const csp::Time& a, const csp::Time& b, const char *)
{
return a - b;
}
// Time intrinsics for Rain:
inline double occam_toSeconds(const csp::Time& val, const char*)