Improve performance of script validation commit
[jimtcl.git] / jim-win32compat.h
blobb772b6fc0e6186912c0b2c1f0cab9d489082d4b0
1 #ifndef JIM_WIN32COMPAT_H
2 #define JIM_WIN32COMPAT_H
4 /* Compatibility for Windows (mingw and msvc, not cygwin */
6 #ifdef __cplusplus
7 extern "C" {
8 #endif
10 /* Note that at this point we don't yet have access to jimautoconf.h */
11 #if defined(_WIN32) || defined(WIN32)
13 #define HAVE_DLOPEN
14 void *dlopen(const char *path, int mode);
15 int dlclose(void *handle);
16 void *dlsym(void *handle, const char *symbol);
17 char *dlerror(void);
19 /* MS CRT always uses three digits after 'e' */
20 #define JIM_SPRINTF_DOUBLE_NEEDS_FIX
22 #ifdef _MSC_VER
23 /* These are msvc vs gcc */
25 #if _MSC_VER >= 1000
26 #pragma warning(disable:4146)
27 #endif
29 #include <limits.h>
30 #define jim_wide _int64
31 #ifndef LLONG_MAX
32 #define LLONG_MAX 9223372036854775807I64
33 #endif
34 #ifndef LLONG_MIN
35 #define LLONG_MIN (-LLONG_MAX - 1I64)
36 #endif
37 #define JIM_WIDE_MIN LLONG_MIN
38 #define JIM_WIDE_MAX LLONG_MAX
39 #define JIM_WIDE_MODIFIER "I64d"
40 #define strcasecmp _stricmp
41 #define strtoull _strtoui64
42 #define snprintf _snprintf
44 #include <io.h>
46 struct timeval {
47 long tv_sec;
48 long tv_usec;
51 int gettimeofday(struct timeval *tv, void *unused);
53 #define HAVE_OPENDIR
54 struct dirent {
55 char *d_name;
58 typedef struct DIR {
59 long handle; /* -1 for failed rewind */
60 struct _finddata_t info;
61 struct dirent result; /* d_name null iff first time */
62 char *name; /* null-terminated char string */
63 } DIR;
65 DIR *opendir(const char *name);
66 int closedir(DIR *dir);
67 struct dirent *readdir(DIR *dir);
69 #elif defined(__MINGW32__)
71 #include <stdlib.h>
72 #define strtod __strtod
74 #endif
76 #endif /* WIN32 */
78 #ifdef __cplusplus
80 #endif
82 #endif