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 :: String -> A.Type -> CGen ()
|
||||||
cgenTypeSymbol s t
|
cgenTypeSymbol s t
|
||||||
= do f <- fget getScalarType
|
= do f <- fget getScalarType
|
||||||
case f t of
|
case (t, f t) of
|
||||||
Just ct -> tell ["occam_", s, "_", ct]
|
(A.Time, _) -> tell ["occam_", s, "_time"]
|
||||||
Nothing -> call genMissingC $ formatCode "genTypeSymbol %" t
|
(_, Just ct) -> tell ["occam_", s, "_", ct]
|
||||||
|
(_, Nothing) -> call genMissingC $ formatCode "genTypeSymbol %" t
|
||||||
|
|
||||||
cgenIntrinsicFunction :: Meta -> String -> [A.Expression] -> CGen ()
|
cgenIntrinsicFunction :: Meta -> String -> [A.Expression] -> CGen ()
|
||||||
cgenIntrinsicFunction m s es
|
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:
|
// Time intrinsics for Rain:
|
||||||
|
|
||||||
inline double occam_toSeconds(const csp::Time& val, const char*)
|
inline double occam_toSeconds(const csp::Time& val, const char*)
|
||||||
|
|
Loading…
Reference in New Issue
Block a user