reactor-c
C Runtime for Lingua Franca
Loading...
Searching...
No Matches
lf_flexpret_support.h
Go to the documentation of this file.
1/* FlexPRET API support for the C target of Lingua Franca. */
2
3
33#ifndef LF_FLEXPRET_SUPPORT_H
34#define LF_FLEXPRET_SUPPORT_H
35
36#include <flexpret/flexpret.h>
37
51#include <inttypes.h> // Needed to define PRId64 and PRIu32
52#define PRINTF_TIME "%" PRId64
53#define PRINTF_MICROSTEP "%" PRIu32
54
55// For convenience, the following string can be inserted in a printf
56// format for printing both time and microstep as follows:
57// printf("Tag is " PRINTF_TAG "\n", time_value, microstep);
58#define PRINTF_TAG "(%" PRId64 ", %" PRIu32 ")"
59
60#if !defined(LF_SINGLE_THREADED)
61typedef fp_lock_t lf_mutex_t;
62typedef fp_thread_t lf_thread_t;
63typedef fp_cond_t lf_cond_t;
64#endif
65
66// This will filter out some unecessary calls to standard library functions
67// and save code space
68#define NO_CLI
69#define MINIMAL_STDLIB
70
89#include <stdio.h>
90
91// Likewise, fprintf is used to print to `stderr`, but FlexPRET has no `stderr`
92// We instead redirect its output to normal printf
93// Note: Most compilers do not support passing this on the command line, so CMake
94// will drop it if you try... But that would be the better option.
95#define fprintf(stream, fmt, ...) printf(fmt, ##__VA_ARGS__)
96#define vfprintf(fp, fmt, args) vprintf(fmt, args)
97
98#endif // LF_FLEXPRET_SUPPORT_H
fp_cond_t lf_cond_t
Definition lf_flexpret_support.h:63
fp_thread_t lf_thread_t
Definition lf_flexpret_support.h:62
fp_lock_t lf_mutex_t
Definition lf_flexpret_support.h:61