Added the helper functions for adding and subtracting Times in C++CSP
This commit is contained in:
parent
cc6dce5ead
commit
fc4cac736b
|
@ -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
|
||||
|
|
|
@ -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*)
|
||||
|
|
Loading…
Reference in New Issue
Block a user