From c1af49a809efe593317c2b836be115e24e7b8f18 Mon Sep 17 00:00:00 2001 From: David Monniaux Date: Wed, 19 Jun 2019 11:31:04 +0200 Subject: add arrow.h from LustreC --- .../lustrev4_lustrec_heater_control/arrow.h | 34 ++++++++++++++++++++++ 1 file changed, 34 insertions(+) create mode 100644 test/monniaux/lustrev4_lustrec_heater_control/arrow.h (limited to 'test/monniaux/lustrev4_lustrec_heater_control/arrow.h') diff --git a/test/monniaux/lustrev4_lustrec_heater_control/arrow.h b/test/monniaux/lustrev4_lustrec_heater_control/arrow.h new file mode 100644 index 00000000..802057da --- /dev/null +++ b/test/monniaux/lustrev4_lustrec_heater_control/arrow.h @@ -0,0 +1,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 -- cgit