]> gitweb.factorcode.org Git - factor.git/blob - vmpp/os-windows.hpp
9e00a6afa7fe47b73075e083b632fa7b9e91c333
[factor.git] / vmpp / os-windows.hpp
1 #include <ctype.h>
2
3 #ifndef wcslen
4   /* for cygwin */
5   #include <wchar.h>
6 #endif
7
8 typedef wchar_t F_CHAR;
9
10 #define from_native_string from_u16_string
11 #define unbox_native_string unbox_u16_string
12 #define string_to_native_alien(string) string_to_u16_alien(string,true)
13
14 #define STRING_LITERAL(string) L##string
15
16 #define MAX_UNICODE_PATH 32768
17 #define DLLEXPORT extern "C" __declspec(dllexport)
18 #define SSCANF swscanf
19 #define STRCMP wcscmp
20 #define STRNCMP wcsncmp
21 #define STRDUP _wcsdup
22 #define MIN(a,b) ((a)>(b)?(b):(a))
23 #define FSEEK fseek
24
25 #ifdef WIN64
26         #define CELL_FORMAT "%Iu"
27         #define CELL_HEX_FORMAT "%Ix"
28         #define CELL_HEX_PAD_FORMAT "%016Ix"
29         #define FIXNUM_FORMAT "%Id"
30 #else
31         #define CELL_FORMAT "%lu"
32         #define CELL_HEX_FORMAT "%lx"
33         #define CELL_HEX_PAD_FORMAT "%08lx"
34         #define FIXNUM_FORMAT "%ld"
35 #endif
36
37 #define OPEN_READ(path) _wfopen(path,L"rb")
38 #define OPEN_WRITE(path) _wfopen(path,L"wb")
39
40 #define print_native_string(string) wprintf(L"%s",string)
41
42 /* Difference between Jan 1 00:00:00 1601 and Jan 1 00:00:00 1970 */
43 #define EPOCH_OFFSET 0x019db1ded53e8000LL
44
45 void init_ffi(void);
46 void ffi_dlopen(F_DLL *dll);
47 void *ffi_dlsym(F_DLL *dll, F_SYMBOL *symbol);
48 void ffi_dlclose(F_DLL *dll);
49
50 void sleep_micros(u64 msec);
51
52 INLINE void init_signals(void) {}
53 INLINE void early_init(void) {}
54 const F_CHAR *vm_executable_path(void);
55 const F_CHAR *default_image_path(void);
56 long getpagesize (void);
57
58 s64 current_micros(void);
59