]>
Commit | Line | Data |
---|---|---|
1 | #include <objc/objc.h> | |
2 | ||
3 | #include <sys/time.h> | |
4 | #include <time.h> | |
5 | ||
6 | #define _forever \ | |
7 | for (;;) | |
8 | ||
9 | #define _trace() do { \ | |
10 | struct timeval _tv; \ | |
11 | gettimeofday(&_tv, NULL); \ | |
12 | fprintf(stderr, "%lu.%.6u:_trace()@%s:%u[%s]\n", _tv.tv_sec, _tv.tv_usec, __FILE__, __LINE__, __FUNCTION__); \ | |
13 | } while (false) | |
14 | ||
15 | #define _assert(test) do \ | |
16 | if (!(test)) { \ | |
17 | fprintf(stderr, "_assert(%d:%s)@%s:%u[%s]\n", errno, #test, __FILE__, __LINE__, __FUNCTION__); \ | |
18 | exit(-1); \ | |
19 | } \ | |
20 | while (false) | |
21 | ||
22 | #define _not(type) ((type) ~ (type) 0) | |
23 | ||
24 | #define _transient | |
25 | ||
26 | #define _label__(x) _label ## x | |
27 | #define _label_(y) _label__(y) | |
28 | #define _label _label_(__LINE__) | |
29 | ||
30 | #define _packed \ | |
31 | __attribute__((packed)) |