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