lustrec / include / arrow.h @ f044d0b0
History | View | Annotate | Download (711 Bytes)
1 | c6acbdaa | xthirioux | |
---|---|---|---|
2 | #ifndef _ARROW
|
||
3 | #define _ARROW
|
||
4 | |||
5 | struct _arrow_mem {struct _arrow_reg {_Bool _first; } _reg; }; |
||
6 | |||
7 | 9bdfc99f | xthirioux | extern struct _arrow_mem *_arrow_alloc (); |
8 | c6acbdaa | xthirioux | |
9 | 9bdfc99f | xthirioux | #define _arrow_DECLARE(attr, inst)\
|
10 | attr struct _arrow_mem inst;
|
||
11 | c6acbdaa | xthirioux | |
12 | #define _arrow_LINK(inst) do {\ |
||
13 | ;\ |
||
14 | } while (0) |
||
15 | |||
16 | 9bdfc99f | xthirioux | #define _arrow_ALLOC(attr, inst)\
|
17 | _arrow_DECLARE(attr, inst);\ |
||
18 | _arrow_LINK(inst) |
||
19 | |||
20 | c6acbdaa | xthirioux | #define _arrow_step(x,y,output,self) ((self)->_reg._first?((self)->_reg._first=0,(*output = x)):(*output = y)) |
21 | |||
22 | #define _arrow_reset(self) {(self)->_reg._first = 1;} |
||
23 | |||
24 | 14ebde97 | xthirioux | /* Step macro for specialized arrows of the form: (true -> false) */
|
25 | |||
26 | #define _once_step(output,self) { *output = (self)->_reg._first; if ((self)->_reg._first) { (self)->_reg._first=0; }; } |
||
27 | |||
28 | c6acbdaa | xthirioux | #endif |