jim-intereactive: reduce permissions on saved history file
[jimtcl.git] / jim-win32compat.h
blob2ef8d853ea0da576c58d070b453bb62e3140577f
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 /* MinGW MS CRT always uses three digits after 'e' */
20 #if defined(__MINGW32__)
21 #define JIM_SPRINTF_DOUBLE_NEEDS_FIX
22 #endif
24 /* MinGW does not have group/owner permissions */
25 #define S_IRWXG 0
26 #define S_IRWXO 0
28 #ifdef _MSC_VER
29 /* These are msvc vs gcc */
31 #if _MSC_VER >= 1000
32 #pragma warning(disable:4146)
33 #endif
35 #include <limits.h>
36 #define jim_wide _int64
37 #ifndef LLONG_MAX
38 #define LLONG_MAX 9223372036854775807I64
39 #endif
40 #ifndef LLONG_MIN
41 #define LLONG_MIN (-LLONG_MAX - 1I64)
42 #endif
43 #define JIM_WIDE_MIN LLONG_MIN
44 #define JIM_WIDE_MAX LLONG_MAX
45 #define JIM_WIDE_MODIFIER "I64d"
46 #define strcasecmp _stricmp
47 #define strtoull _strtoui64
48 #define snprintf _snprintf
50 #include <io.h>
52 struct timeval {
53 long tv_sec;
54 long tv_usec;
57 int gettimeofday(struct timeval *tv, void *unused);
59 #define HAVE_OPENDIR
60 struct dirent {
61 char *d_name;
64 typedef struct DIR {
65 long handle; /* -1 for failed rewind */
66 struct _finddata_t info;
67 struct dirent result; /* d_name null iff first time */
68 char *name; /* null-terminated char string */
69 } DIR;
71 DIR *opendir(const char *name);
72 int closedir(DIR *dir);
73 struct dirent *readdir(DIR *dir);
75 #elif defined(__MINGW32__)
77 #include <stdlib.h>
78 #define strtod __strtod
80 #endif
82 #endif /* WIN32 */
84 #ifdef __cplusplus
86 #endif
88 #endif