reactor-c
C Runtime for Lingua Franca
Loading...
Searching...
No Matches
set.h
Go to the documentation of this file.
1
40#ifndef CTARGET_SET
41#define CTARGET_SET
42
45
46// NOTE: According to the "Swallowing the Semicolon" section on this page:
47// https://gcc.gnu.org/onlinedocs/gcc-3.0.1/cpp_3.html
48// the following macros should use an odd do-while construct to avoid
49// problems with if ... else statements that do not use braces around the
50// two branches.
51
75#define lf_set(out, val) _LF_SET(out, val)
76#define SET(out, val) \
77do { \
78 _Pragma ("Warning \"'SET' is deprecated. Use 'lf_set' instead.\""); \
79 _LF_SET(out, val); \
80} while (0)
81
95#define SET_ARRAY(out, val, elem_size, length) \
96do { \
97 _Pragma ("Warning \"'SET_ARRAY' is deprecated.\""); \
98 lf_set_array(out, val, length); \
99} while (0)
100
115#define SET_NEW(out) \
116do { \
117 _Pragma ("Warning \"'SET_NEW' is deprecated.\""); \
118 _LF_SET_NEW(out); \
119} while (0)
120
134#define SET_NEW_ARRAY(out, len) \
135do { \
136 _Pragma ("Warning \"'SET_NEW_ARRAY' is deprecated.\""); \
137 _LF_SET_NEW_ARRAY(out, len); \
138} while (0)
139
149#define SET_PRESENT(out) \
150do { \
151 _Pragma ("Warning \"'SET_PRESENT' is deprecated.\""); \
152 _lf_set_present((lf_port_base_t*)out); \
153} while (0)
154
164#define lf_set_token(out, newtoken) _LF_SET_TOKEN(out, newtoken)
165#define SET_TOKEN(out, newtoken) \
166do { \
167 _Pragma ("Warning \"'SET_TOKEN' is deprecated. Use 'lf_set_token' instead.\""); \
168 _LF_SET_TOKEN(out, newtoken); \
169} while (0)
170
181#define lf_set_destructor(out, dtor) _LF_SET_DESTRUCTOR(out, dtor)
182
192#define lf_set_copy_constructor(out, cpy_ctor) _LF_SET_COPY_CONSTRUCTOR(out, cpy_ctor)
193
196
204#ifdef MODAL_REACTORS
205#define lf_set_mode(mode) _LF_SET_MODE(mode)
206#define SET_MODE(mode) \
207do { \
208 _Pragma ("Warning \"'SET_MODE' is deprecated. Use 'lf_set_mode' instead.\""); \
209 _LF_SET_MODE(mode); \
210} while (0)
211#endif // MODAL_REACTORS
212
213#endif // CTARGET_SET
214
215// For simplicity and backward compatability, dont require the environment-pointer when calling the timing API.
216// As long as this is done from the context of a reaction, `self` is in scope and is a pointer to the self-struct
217// of the current reactor.
218#define lf_tag() lf_tag(self->base.environment)
219#define get_current_tag() get_current_tag(self->base.environment)
220#define get_microstep() get_microstep(self->base.environment)
221#define lf_time_logical() lf_time_logical(self->base.environment)
222#define lf_time_logical_elapsed() lf_time_logical_elapsed(self->base.environment)
223#define get_elapsed_logical_time() get_elapsed_logical_time(self->base.environment)
224#define get_logical_time() get_logical_time(self->base.environment)