]> git.saurik.com Git - cydia.git/blame_incremental - UICaboodle/UICaboodle.h
Mild organization and optimization.
[cydia.git] / UICaboodle / UICaboodle.h
... / ...
CommitLineData
1#define __STDC_LIMIT_MACROS
2#include <stdint.h>
3
4#include <objc/objc.h>
5
6#include <sys/time.h>
7#include <time.h>
8
9#define _forever \
10 for (;;)
11
12extern struct timeval _ltv;
13extern bool _itv;
14
15#define _trace() do { \
16 struct timeval _ctv; \
17 gettimeofday(&_ctv, NULL); \
18 if (!_itv) { \
19 _itv = true; \
20 _ltv = _ctv; \
21 } \
22 fprintf(stderr, "%lu.%.6u[%f]:_trace()@%s:%u[%s]\n", \
23 _ctv.tv_sec, _ctv.tv_usec, \
24 (_ctv.tv_sec - _ltv.tv_sec) + (_ctv.tv_usec - _ltv.tv_usec) / 1000000.0, \
25 __FILE__, __LINE__, __FUNCTION__\
26 ); \
27 _ltv = _ctv; \
28} while (false)
29
30#define _assert(test) do \
31 if (!(test)) { \
32 fprintf(stderr, "_assert(%d:%s)@%s:%u[%s]\n", errno, #test, __FILE__, __LINE__, __FUNCTION__); \
33 exit(-1); \
34 } \
35while (false)
36
37#define _not(type) ((type) ~ (type) 0)
38
39#define _transient
40
41#define _label__(x) _label ## x
42#define _label_(y) _label__(y)
43#define _label _label_(__LINE__)
44
45#define _packed \
46 __attribute__((packed))