aboutsummaryrefslogtreecommitdiffstats
path: root/test/monniaux/lustrev4_lustrec_heater_control/arrow.h
blob: 802057dac7df8167ed2f6a4040a6edbf8bd5a34f (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34

#ifndef _ARROW
#define _ARROW

struct _arrow_mem {struct _arrow_reg {_Bool _first; } _reg; };

extern struct _arrow_mem *_arrow_alloc ();

extern void _arrow_dealloc (struct _arrow_mem *);

#define _arrow_DECLARE(attr, inst)\
  attr struct _arrow_mem inst;
  
#define _arrow_LINK(inst) do {\
  ;\
} while (0)

#define _arrow_ALLOC(attr, inst)\
  _arrow_DECLARE(attr, inst);\
  _arrow_LINK(inst)

#define _arrow_init(self) {}

#define _arrow_clear(self) {}

#define _arrow_step(x,y,output,self) ((self)->_reg._first?((self)->_reg._first=0,(*output = x)):(*output = y))

#define _arrow_reset(self) {(self)->_reg._first = 1;}

/* Step macro for specialized arrows of the form: (true -> false) */

#define _once_step(output,self) { *output = (self)->_reg._first; if ((self)->_reg._first) { (self)->_reg._first=0; }; }

#endif