glob patterns can contain [] too
[jimtcl.git] / jim-win32compat.h
blob717642c106461b8c842dbd130dcdd210eead5e2d
1 #ifndef JIM_WIN32COMPAT_H
2 #define JIM_WIN32COMPAT_H
4 /* Compatibility for Windows (mingw and msvc, not cygwin */
6 /* Note that at this point we don't yet have access to jimautoconf.h */
7 #if defined(_WIN32) || defined(WIN32)
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);
15 /* MS CRT always uses three digits after 'e' */
16 #define JIM_SPRINTF_DOUBLE_NEEDS_FIX
18 #ifdef _MSC_VER
19 /* These are msvc vs gcc */
21 #if _MSC_VER >= 1000
22 #pragma warning(disable:4146)
23 #endif
25 #include <limits.h>
26 #define jim_wide _int64
27 #ifndef LLONG_MAX
28 #define LLONG_MAX 9223372036854775807I64
29 #endif
30 #ifndef LLONG_MIN
31 #define LLONG_MIN (-LLONG_MAX - 1I64)
32 #endif
33 #define JIM_WIDE_MIN LLONG_MIN
34 #define JIM_WIDE_MAX LLONG_MAX
35 #define JIM_WIDE_MODIFIER "I64d"
36 #define strcasecmp _stricmp
37 #define strtoull _strtoui64
38 #define snprintf _snprintf
40 #include <io.h>
42 struct timeval {
43 long tv_sec;
44 long tv_usec;
47 int gettimeofday(struct timeval *tv, void *unused);
49 #define HAVE_OPENDIR
50 struct dirent {
51 char *d_name;
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;
61 DIR *opendir(const char *name);
62 int closedir(DIR *dir);
63 struct dirent *readdir(DIR *dir);
64 #endif /* _MSC_VER */
66 #endif /* WIN32 */
68 #endif