blob: 8415c65ebb3ab783d5223833e150380965cf4b50 [file] [log] [blame]
adamdunkels64b41a62004-08-11 21:22:12 +00001#ifndef __LC_H__
2#define __LC_H__
3
4typedef void * lc_t;
5
adamdunkels08d532d2004-09-01 20:36:44 +00006#define LC_CONCAT2(s1, s2) s1##s2
7#define LC_CONCAT(s1, s2) LC_CONCAT2(s1, s2)
adamdunkels64b41a62004-08-11 21:22:12 +00008
9#define LC_SET(s) \
10 do { \
adamdunkels08d532d2004-09-01 20:36:44 +000011 LC_CONCAT(LC_LABEL, __LINE__): \
12 (s) = &&LC_CONCAT(LC_LABEL, __LINE__); \
adamdunkels64b41a62004-08-11 21:22:12 +000013 } while(0)
14
adamdunkels08d532d2004-09-01 20:36:44 +000015#define LC_RESUME(s) \
16 do { \
17 if(s != NULL) { \
18 goto *s; \
19 } \
20 } while(0)
adamdunkels64b41a62004-08-11 21:22:12 +000021
adamdunkels08d532d2004-09-01 20:36:44 +000022#define LC_END(s)
23
24#define LC_INIT(s) s = NULL
adamdunkels64b41a62004-08-11 21:22:12 +000025
26#endif /* __LC_H__ */