29#define INIT ev->expr[0]
30#define COND ev->expr[1]
31#define INC ev->expr[2]
45 if (
ev->arrayi ||
ev->arrayt) {
48 ev->i =
ev->arrayi[0];
50 ev->t =
ev->arrayt[0];
57 for (
int j = 0;
j <
ev->nexpr;
j++) {
74 event_error (
ev,
"events can only use a single initialisation");
92 (* INIT) (&
ev->i, &
ev->t,
ev);
98 (* INC) (&
ev->i, &
ev->t,
ev);
118 int n = 0, parent = -1;
177 if ((*
e->action) (
iter,
t,
e))
186 ev->i =
ev->arrayi[
ev->a++];
191 ev->t =
ev->arrayt[
ev->a++];
197 (* INC) (&
ev->i, &
ev->t,
ev);
198 if (
i0 == -1 &&
ev->i !=
i0)
272 (*
e->action) (0, 0,
e);
306 for (
int i = 0;
i <
n;
i++)
event init(i=0)
User initialisation happens here.
static _Attributes * _attribute
#define qcalloc(size, type)
define sysmalloc malloc define syscalloc calloc define sysrealloc realloc define sysfree free define systrdup strdup define line calloc(n, s) @ define prealloc(p
define sysmalloc malloc define syscalloc calloc define sysrealloc realloc define sysfree free define systrdup strdup define file
define sysmalloc malloc define syscalloc calloc define sysrealloc realloc define sysfree free define systrdup strdup define line line realloc(p, s) @ define pfree(p
*cs[i, 0, 0] a *[i -1, 0, 0] j
static void event_error(Event *ev, const char *s)
static void end_event_do(bool action)
static bool overload_event()
The interpreter overloads the function below to control (i.e.
static int event_cond(Event *ev, int i, double t)
int(* Expr)(int *, double *, Event *)
static int event_finished(Event *ev)
static void init_event(Event *ev)
static void _init_solver(void)
static int event_do(Event *ev, bool action)
void event(const char *name)
void event_register(Event event)
int(* action)(const int, const double, Event *)