Merge branch 'master' of git://factorcode.org/git/factor
[factor/jcg.git] / vm / os-unix.h
blobd2f34b4bc4c26d50a1c419ce436619ac3c833d8e
1 #include <dirent.h>
2 #include <sys/mman.h>
3 #include <sys/types.h>
4 #include <sys/stat.h>
5 #include <unistd.h>
6 #include <sys/time.h>
7 #include <dlfcn.h>
8 #include <signal.h>
9 #include <pthread.h>
11 typedef char F_CHAR;
12 typedef char F_SYMBOL;
14 #define from_native_string from_char_string
15 #define unbox_native_string unbox_char_string
16 #define string_to_native_alien(string) string_to_char_alien(string,true)
17 #define unbox_symbol_string unbox_char_string
19 #define STRING_LITERAL(string) string
21 #define SSCANF sscanf
22 #define STRCMP strcmp
23 #define STRNCMP strncmp
24 #define STRDUP strdup
26 #define FIXNUM_FORMAT "%ld"
27 #define CELL_FORMAT "%lu"
28 #define CELL_HEX_FORMAT "%lx"
30 #ifdef FACTOR_64
31 #define CELL_HEX_PAD_FORMAT "%016lx"
32 #else
33 #define CELL_HEX_PAD_FORMAT "%08lx"
34 #endif
36 #define FIXNUM_FORMAT "%ld"
38 #define OPEN_READ(path) fopen(path,"rb")
39 #define OPEN_WRITE(path) fopen(path,"wb")
41 #define print_native_string(string) print_string(string)
43 void start_thread(void *(*start_routine)(void *));
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);
50 void unix_init_signals(void);
51 void signal_handler(int signal, siginfo_t* siginfo, void* uap);
52 void dump_stack_signal(int signal, siginfo_t* siginfo, void* uap);
54 s64 current_micros(void);
55 void sleep_micros(CELL usec);
57 void open_console(void);