|
1
|
#ifndef JIM_WIN32COMPAT_H |
|
2
|
#define JIM_WIN32COMPAT_H |
|
3
|
|
|
4
|
/* Compatibility for Windows (mingw and msvc, not cygwin */ |
|
5
|
|
|
6
|
/* Note that at this point we don't yet have access to jimautoconf.h */ |
|
7
|
#if defined(_WIN32) || defined(WIN32) |
|
8
|
|
|
9
|
#define HAVE_DLOPEN |
|
10
|
void *dlopen(const char *path, int mode); |
|
11
|
int dlclose(void *handle); |
|
12
|
void *dlsym(void *handle, const char *symbol); |
|
13
|
char *dlerror(void); |
|
14
|
|
|
15
|
#ifdef _MSC_VER |
|
16
|
/* These are msvc vs gcc */ |
|
17
|
|
|
18
|
#if _MSC_VER >= 1000 |
|
19
|
#pragma warning(disable:4146) |
|
20
|
#endif |
|
21
|
|
|
22
|
#include <limits.h> |
|
23
|
#define jim_wide _int64 |
|
24
|
#ifndef LLONG_MAX |
|
25
|
#define LLONG_MAX 9223372036854775807I64 |
|
26
|
#endif |
|
27
|
#ifndef LLONG_MIN |
|
28
|
#define LLONG_MIN (-LLONG_MAX - 1I64) |
|
29
|
#endif |
|
30
|
#define JIM_WIDE_MIN LLONG_MIN |
|
31
|
#define JIM_WIDE_MAX LLONG_MAX |
|
32
|
#define JIM_WIDE_MODIFIER "I64d" |
|
33
|
#define strcasecmp _stricmp |
|
34
|
#define strtoull _strtoui64 |
|
35
|
#define snprintf _snprintf |
|
36
|
|
|
37
|
#include <io.h> |
|
38
|
|
|
39
|
#ifndef NO_TIMEVAL |
|
40
|
struct timeval { |
|
41
|
long tv_sec; |
|
42
|
long tv_usec; |
|
43
|
}; |
|
44
|
#endif |
|
45
|
|
|
46
|
int gettimeofday(struct timeval *tv, void *unused); |
|
47
|
|
|
48
|
#define HAVE_OPENDIR |
|
49
|
#ifndef NO_DIRENT |
|
50
|
struct dirent { |
|
51
|
char *d_name; |
|
52
|
}; |
|
53
|
|
|
54
|
typedef struct DIR { |
|
55
|
long handle; /* -1 for failed rewind */ |
|
56
|
struct _finddata_t info; |
|
57
|
struct dirent result; /* d_name null iff first time */ |
|
58
|
char *name; /* null-terminated char string */ |
|
59
|
} DIR; |
|
60
|
|
|
61
|
DIR *opendir(const char *name); |
|
62
|
int closedir(DIR *dir); |
|
63
|
struct dirent *readdir(DIR *dir); |
|
64
|
#endif |
|
65
|
#endif /* _MSC_VER */ |
|
66
|
|
|
67
|
#endif /* WIN32 */ |
|
68
|
|
|
69
|
#endif |
|
70
|
|