mercurial/util.h
branchstable
changeset 33572 857876ebaed4
parent 33202 c1994c986d77
parent 33571 9a944e908ecf
child 33573 9e0fea06ae2c
equal deleted inserted replaced
33202:c1994c986d77 33572:857876ebaed4
     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_ */