reactor-uc 0.1
Loading...
Searching...
No Matches
macros_api.h
Go to the documentation of this file.
1#ifndef REACTOR_UC_MACROS_API_H
2#define REACTOR_UC_MACROS_API_H
3
4// Sets an output port, copies data and triggers all downstream reactions.
5#define lf_set(port, val) \
6 do { \
7 __typeof__(val) __val = (val); \
8 Port *_port = (Port *)(port); \
9 _port->set(_port, &__val); \
10 } while (0)
11
12// Sets an output port, copies data and triggers all downstream reactions.
13#define lf_set_array(port, array) \
14 do { \
15 Port *_port = (Port *)(port); \
16 _port->set(_port, array); \
17 } while (0)
18
22#define lf_get(trigger) (&(trigger)->value)
23
27#define lf_is_present(trigger) (((Trigger *)(trigger))->is_present)
28
29#define lf_schedule_with_val(action, offset, val) \
30 do { \
31 __typeof__(val) __val = (val); \
32 lf_ret_t ret = (action)->super.schedule(&(action)->super, (offset), (const void *)&__val); \
33 if (ret == LF_FATAL) { \
34 LF_ERR(TRIG, "Scheduling an value, that doesn't have value!"); \
35 Scheduler *sched = (action)->super.super.parent->env->scheduler; \
36 sched->do_shutdown(sched, sched->current_tag(sched)); \
37 throw("Tried to schedule a value onto an action without a type!"); \
38 } \
39 } while (0)
40
41#define lf_schedule_without_val(action, offset) \
42 do { \
43 (action)->super.schedule(&(action)->super, (offset), NULL); \
44 } while (0)
45
46#endif