]> gitweb.factorcode.org Git - factor.git/blob - vm/os-windows.h
Merge branch 'master' into experimental
[factor.git] / vm / os-windows.h
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 __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
24 #ifdef WIN64
25         #define CELL_FORMAT "%Iu"
26         #define CELL_HEX_FORMAT "%Ix"
27         #define CELL_HEX_PAD_FORMAT "%016Ix"
28         #define FIXNUM_FORMAT "%Id"
29 #else
30         #define CELL_FORMAT "%lu"
31         #define CELL_HEX_FORMAT "%lx"
32         #define CELL_HEX_PAD_FORMAT "%08lx"
33         #define FIXNUM_FORMAT "%ld"
34 #endif
35
36 #define OPEN_READ(path) _wfopen(path,L"rb")
37 #define OPEN_WRITE(path) _wfopen(path,L"wb")
38
39 #define print_native_string(string) wprintf(L"%s",string)
40
41 /* Difference between Jan 1 00:00:00 1601 and Jan 1 00:00:00 1970 */
42 #define EPOCH_OFFSET 0x019db1ded53e8000LL
43
44 F_STRING *get_error_message(void);
45 DLLEXPORT F_CHAR *error_message(DWORD id);
46 void windows_error(void);
47
48 void init_ffi(void);
49 void ffi_dlopen(F_DLL *dll);
50 void *ffi_dlsym(F_DLL *dll, F_SYMBOL *symbol);
51 void ffi_dlclose(F_DLL *dll);
52
53 void sleep_micros(u64 msec);
54
55 INLINE void init_signals(void) {}
56 INLINE void early_init(void) {}
57 const F_CHAR *vm_executable_path(void);
58 const F_CHAR *default_image_path(void);
59 long getpagesize (void);
60
61 s64 current_micros(void);
62