Project

General

Profile

Statistics
| Branch: | Tag: | Revision:

lustrec / include / arrow.hpp @ 52c5ba00

History | View | Annotate | Download (807 Bytes)

1

    
2
#ifndef _ARROW_CPP
3
#define _ARROW_CPP
4

    
5
#include <stdlib.h>
6

    
7
struct _arrow_mem {
8
        struct _arrow_reg {
9
                bool _first;
10
        } _reg; 
11
};
12

    
13
extern struct _arrow_mem *_arrow_alloc ();
14

    
15
#define _arrow_DECLARE(attr, inst)\
16
  attr struct _arrow_mem inst;
17
  
18
#define _arrow_LINK(inst) do {\
19
  ;\
20
} while (0)
21

    
22
#define _arrow_ALLOC(attr, inst)\
23
  _arrow_DECLARE(attr, inst);\
24
  _arrow_LINK(inst)
25

    
26
#define _arrow_init(self) {}
27

    
28
#define _arrow_clear(self) {}
29

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

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

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

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

    
38
#endif