Add tests for miscellaneous validation performed during hint elaboration
[hiphop-php.git] / hphp / neo / neo_misc.h
blob58f77c2ec31443a49440427261e7ec7e3c7d5a43
1 /*
2 * Copyright 2001-2004 Brandon Long
3 * All Rights Reserved.
5 * ClearSilver Templating System
7 * This code is made available under the terms of the ClearSilver License.
8 * http://www.clearsilver.net/license.hdf
12 #ifndef incl_HPHP_NEO_MISC_H_
13 #define incl_HPHP_NEO_MISC_H_ 1
15 #include <stdlib.h>
16 #include <time.h>
17 #include <limits.h>
19 /* In case they didn't start from ClearSilver.h. */
20 #ifndef incl_HPHP_CS_CONFIG_H_
21 #include "hphp/neo/cs_config.h"
22 #endif
24 /* Fix Up for systems that don't define these standard things */
25 #ifndef __BEGIN_DECLS
26 #ifdef __cplusplus
27 #define __BEGIN_DECLS extern "C" {
28 #define __END_DECLS }
29 #else
30 #define __BEGIN_DECLS
31 #define __END_DECLS
32 #endif
33 #endif
35 #define PATH_BUF_SIZE 512
37 #ifdef _MSC_VER
38 #include <sys/stat.h>
39 #define S_IXUSR 0
40 #define S_IWUSR _S_IWRITE
41 #define S_IRUSR _S_IREAD
42 #endif
44 #ifndef S_IXGRP
45 #define S_IXGRP S_IXUSR
46 #endif
47 #ifndef S_IWGRP
48 #define S_IWGRP S_IWUSR
49 #endif
50 #ifndef S_IRGRP
51 #define S_IRGRP S_IRUSR
52 #endif
53 #ifndef S_IXOTH
54 #define S_IXOTH S_IXUSR
55 #endif
56 #ifndef S_IWOTH
57 #define S_IWOTH S_IWUSR
58 #endif
59 #ifndef S_IROTH
60 #define S_IROTH S_IRUSR
61 #endif
63 /* Format string checking for compilers that support it (GCC style) */
65 #ifndef ATTRIBUTE_PRINTF
66 #if __GNUC__ > 2 || __GNUC__ == 2 && __GNUC_MINOR__ > 6
67 #define ATTRIBUTE_PRINTF(a1,a2) __attribute__((__format__ (__printf__, a1, a2)))
68 #else
69 #define ATTRIBUTE_PRINTF(a1,a2)
70 #endif
71 #endif
74 __BEGIN_DECLS
76 #include <stdarg.h>
77 #include <sys/types.h>
79 typedef unsigned int UINT32;
80 typedef unsigned short int UINT16;
81 typedef short int INT16;
82 typedef unsigned char UINT8;
83 /* This was conflicting with a cygwin header definition */
84 #ifdef _MSC_VER
85 typedef signed char INT8;
86 #else
87 typedef char INT8;
88 #endif
90 #ifndef MIN
91 #define MIN(x,y) (((x) < (y)) ? (x) : (y))
92 #endif
94 void ne_vwarn (const char *fmt, va_list ap)
95 ATTRIBUTE_PRINTF(1,0);
96 void ne_warn (const char *fmt, ...)
97 ATTRIBUTE_PRINTF(1,2);
98 UINT32 ne_crc (UINT8 *data, UINT32 bytes);
100 __END_DECLS
102 #endif /* incl_HPHP_NEO_MISC_H_ */