equal
deleted
inserted
replaced
1 /* |
|
2 util.h - utility functions for interfacing with the various python APIs. |
|
3 |
|
4 This software may be used and distributed according to the terms of |
|
5 the GNU General Public License, incorporated herein by reference. |
|
6 */ |
|
7 |
|
8 #ifndef _HG_UTIL_H_ |
|
9 #define _HG_UTIL_H_ |
|
10 |
|
11 #include "compat.h" |
|
12 |
|
13 #if PY_MAJOR_VERSION >= 3 |
|
14 #define IS_PY3K |
|
15 #endif |
|
16 |
|
17 typedef struct { |
|
18 PyObject_HEAD |
|
19 char state; |
|
20 int mode; |
|
21 int size; |
|
22 int mtime; |
|
23 } dirstateTupleObject; |
|
24 |
|
25 extern PyTypeObject dirstateTupleType; |
|
26 #define dirstate_tuple_check(op) (Py_TYPE(op) == &dirstateTupleType) |
|
27 |
|
28 /* This should be kept in sync with normcasespecs in encoding.py. */ |
|
29 enum normcase_spec { |
|
30 NORMCASE_LOWER = -1, |
|
31 NORMCASE_UPPER = 1, |
|
32 NORMCASE_OTHER = 0 |
|
33 }; |
|
34 |
|
35 #define MIN(a, b) (((a)<(b))?(a):(b)) |
|
36 /* VC9 doesn't include bool and lacks stdbool.h based on my searching */ |
|
37 #if defined(_MSC_VER) || __STDC_VERSION__ < 199901L |
|
38 #define true 1 |
|
39 #define false 0 |
|
40 typedef unsigned char bool; |
|
41 #else |
|
42 #include <stdbool.h> |
|
43 #endif |
|
44 |
|
45 #endif /* _HG_UTIL_H_ */ |
|