comparison lib/swig/swigwin-2.0.11/CCache/ccache.h @ 1899:b3009adc0e2f

Adding swig, gitignore, hgignore
author Nomad
date Mon, 21 Oct 2013 10:42:27 +0200
parents
children
comparison
equal deleted inserted replaced
1867:eb580660bbbb 1899:b3009adc0e2f
1 #include "ccache_swig_config.h"
2
3 #define CCACHE_VERSION SWIG_VERSION
4
5 #ifndef _WIN32
6 #include "config.h"
7 #else
8 #include <sys/locking.h>
9 #define PACKAGE_NAME "ccache-swig.exe"
10 #endif
11
12 #include <stdio.h>
13 #include <unistd.h>
14 #include <stdlib.h>
15 #include <errno.h>
16 #include <sys/stat.h>
17 #include <sys/types.h>
18
19 #ifndef _WIN32
20 #include <sys/wait.h>
21 #include <sys/mman.h>
22 #else
23 #define _WIN32_WINNT 0x0500
24 #include <windows.h>
25 #include <shlobj.h>
26 #endif
27
28 #include <sys/file.h>
29 #include <fcntl.h>
30 #include <time.h>
31 #include <string.h>
32 #include <ctype.h>
33 #include <utime.h>
34 #include <stdarg.h>
35 #include <dirent.h>
36 #include <limits.h>
37 #ifdef HAVE_PWD_H
38 #include <pwd.h>
39 #endif
40 #ifdef HAVE_SYS_TIME_H
41 #include <sys/time.h>
42 #endif
43
44 #ifdef ENABLE_ZLIB
45 #include <zlib.h>
46 #endif
47
48 #define STATUS_NOTFOUND 3
49 #define STATUS_FATAL 4
50 #define STATUS_NOCACHE 5
51
52 #define MYNAME PACKAGE_NAME
53
54 #define LIMIT_MULTIPLE 0.8
55
56 /* default maximum cache size */
57 #ifndef DEFAULT_MAXSIZE
58 #define DEFAULT_MAXSIZE (1000*1000)
59 #endif
60
61 /* file copy mode */
62 #ifdef ENABLE_ZLIB
63 #define COPY_UNCOMPRESSED 0
64 #define COPY_FROM_CACHE 1
65 #define COPY_TO_CACHE 2
66 #endif
67
68 enum stats {
69 STATS_NONE=0,
70 STATS_STDOUT,
71 STATS_STATUS,
72 STATS_ERROR,
73 STATS_TOCACHE,
74 STATS_PREPROCESSOR,
75 STATS_COMPILER,
76 STATS_MISSING,
77 STATS_CACHED,
78 STATS_ARGS,
79 STATS_LINK,
80 STATS_NUMFILES,
81 STATS_TOTALSIZE,
82 STATS_MAXFILES,
83 STATS_MAXSIZE,
84 STATS_NOTC,
85 STATS_DEVICE,
86 STATS_NOINPUT,
87 STATS_ENVIRONMMENT,
88 STATS_MULTIPLE,
89 STATS_CONFTEST,
90 STATS_UNSUPPORTED,
91 STATS_OUTSTDOUT,
92
93 STATS_END
94 };
95
96 typedef unsigned uint32;
97
98 #include "mdfour.h"
99
100 void hash_start(void);
101 void hash_string(const char *s);
102 void hash_int(int x);
103 void hash_file(const char *fname);
104 char *hash_result(void);
105 void hash_buffer(const char *s, int len);
106
107 void cc_log(const char *format, ...);
108 void fatal(const char *msg);
109
110 void copy_fd(int fd_in, int fd_out);
111 int safe_rename(const char* oldpath, const char* newpath);
112 int move_file(const char *src, const char *dest);
113 int test_if_compressed(const char *filename);
114
115 int commit_to_cache(const char *src, const char *dest, int hardlink);
116 int retrieve_from_cache(const char *src, const char *dest, int hardlink);
117
118 int create_dir(const char *dir);
119 int create_cachedirtag(const char *dir);
120 void x_asprintf(char **ptr, const char *format, ...);
121 char *x_strdup(const char *s);
122 void *x_realloc(void *ptr, size_t size);
123 void *x_malloc(size_t size);
124 void traverse(const char *dir, void (*fn)(const char *, struct stat *));
125 char *str_basename(const char *s);
126 char *dirname(char *s);
127 int lock_fd(int fd);
128 size_t file_size(struct stat *st);
129 int safe_open(const char *fname);
130 char *x_realpath(const char *path);
131 char *gnu_getcwd(void);
132 int create_empty_file(const char *fname);
133 const char *get_home_directory(void);
134 int x_utimes(const char *filename);
135 #ifdef _WIN32
136 void perror_win32(LPTSTR pszFunction);
137 #endif
138
139 void stats_update(enum stats stat);
140 void stats_zero(void);
141 void stats_summary(void);
142 void stats_tocache(size_t size, size_t numfiles);
143 void stats_read(const char *stats_file, unsigned counters[STATS_END]);
144 int stats_set_limits(long maxfiles, long maxsize);
145 size_t value_units(const char *s);
146 void display_size(unsigned v);
147 void stats_set_sizes(const char *dir, size_t num_files, size_t total_size);
148
149 int unify_hash(const char *fname);
150
151 #ifndef HAVE_VASPRINTF
152 int vasprintf(char **, const char *, va_list );
153 #endif
154 #ifndef HAVE_ASPRINTF
155 int asprintf(char **ptr, const char *format, ...);
156 #endif
157
158 #ifndef HAVE_SNPRINTF
159 int snprintf(char *,size_t ,const char *, ...);
160 #endif
161
162 void cleanup_dir(const char *dir, size_t maxfiles, size_t maxsize, size_t minfiles);
163 void cleanup_all(const char *dir);
164 void wipe_all(const char *dir);
165
166 #ifdef _WIN32
167 char *argvtos(char **argv);
168 #endif
169 int execute(char **argv,
170 const char *path_stdout,
171 const char *path_stderr);
172 char *find_executable(const char *name, const char *exclude_name);
173 void display_execute_args(char **argv);
174
175 typedef struct {
176 char **argv;
177 int argc;
178 } ARGS;
179
180
181 ARGS *args_init(int , char **);
182 void args_add(ARGS *args, const char *s);
183 void args_add_prefix(ARGS *args, const char *s);
184 void args_pop(ARGS *args, int n);
185 void args_strip(ARGS *args, const char *prefix);
186 void args_remove_first(ARGS *args);
187
188 extern int ccache_verbose;
189
190 #if HAVE_COMPAR_FN_T
191 #define COMPAR_FN_T __compar_fn_t
192 #else
193 typedef int (*COMPAR_FN_T)(const void *, const void *);
194 #endif
195
196 /* work with silly DOS binary open */
197 #ifndef O_BINARY
198 #define O_BINARY 0
199 #endif
200
201 /* mkstemp() on some versions of cygwin don't handle binary files, so
202 override */
203 /* Seems okay in Cygwin 1.7.0
204 #ifdef __CYGWIN__
205 #undef HAVE_MKSTEMP
206 #endif
207 */