adamdunkels | 64b41a6 | 2004-08-11 21:22:12 +0000 | [diff] [blame] | 1 | #ifndef __LC_H__ |
2 | #define __LC_H__ | ||||
3 | |||||
4 | typedef void * lc_t; | ||||
5 | |||||
adamdunkels | 08d532d | 2004-09-01 20:36:44 +0000 | [diff] [blame] | 6 | #define LC_CONCAT2(s1, s2) s1##s2 |
7 | #define LC_CONCAT(s1, s2) LC_CONCAT2(s1, s2) | ||||
adamdunkels | 64b41a6 | 2004-08-11 21:22:12 +0000 | [diff] [blame] | 8 | |
9 | #define LC_SET(s) \ | ||||
10 | do { \ | ||||
adamdunkels | 08d532d | 2004-09-01 20:36:44 +0000 | [diff] [blame] | 11 | LC_CONCAT(LC_LABEL, __LINE__): \ |
12 | (s) = &&LC_CONCAT(LC_LABEL, __LINE__); \ | ||||
adamdunkels | 64b41a6 | 2004-08-11 21:22:12 +0000 | [diff] [blame] | 13 | } while(0) |
14 | |||||
adamdunkels | 08d532d | 2004-09-01 20:36:44 +0000 | [diff] [blame] | 15 | #define LC_RESUME(s) \ |
16 | do { \ | ||||
17 | if(s != NULL) { \ | ||||
18 | goto *s; \ | ||||
19 | } \ | ||||
20 | } while(0) | ||||
adamdunkels | 64b41a6 | 2004-08-11 21:22:12 +0000 | [diff] [blame] | 21 | |
adamdunkels | 08d532d | 2004-09-01 20:36:44 +0000 | [diff] [blame] | 22 | #define LC_END(s) |
23 | |||||
24 | #define LC_INIT(s) s = NULL | ||||
adamdunkels | 64b41a6 | 2004-08-11 21:22:12 +0000 | [diff] [blame] | 25 | |
26 | #endif /* __LC_H__ */ |