2009-05-13 02:08:16 -04:00
|
|
|
#include <unistd.h>
|
|
|
|
#include <sys/param.h>
|
2009-05-02 05:04:19 -04:00
|
|
|
#include <dirent.h>
|
|
|
|
#include <sys/mman.h>
|
|
|
|
#include <sys/types.h>
|
|
|
|
#include <sys/stat.h>
|
|
|
|
#include <unistd.h>
|
|
|
|
#include <sys/time.h>
|
|
|
|
#include <dlfcn.h>
|
|
|
|
#include <signal.h>
|
|
|
|
#include <pthread.h>
|
|
|
|
|
2009-05-04 02:46:13 -04:00
|
|
|
namespace factor
|
|
|
|
{
|
|
|
|
|
2009-05-04 05:50:24 -04:00
|
|
|
typedef char vm_char;
|
|
|
|
typedef char symbol_char;
|
2009-05-02 05:04:19 -04:00
|
|
|
|
|
|
|
#define STRING_LITERAL(string) string
|
|
|
|
|
|
|
|
#define SSCANF sscanf
|
|
|
|
#define STRCMP strcmp
|
|
|
|
#define STRNCMP strncmp
|
|
|
|
#define STRDUP strdup
|
|
|
|
|
|
|
|
#define FSEEK fseeko
|
|
|
|
|
|
|
|
#define FIXNUM_FORMAT "%ld"
|
2009-05-13 02:08:16 -04:00
|
|
|
#define CELL_FORMAT "%lu"
|
|
|
|
#define CELL_HEX_FORMAT "%lx"
|
2009-05-02 05:04:19 -04:00
|
|
|
|
|
|
|
#ifdef FACTOR_64
|
2009-05-13 02:08:16 -04:00
|
|
|
#define CELL_HEX_PAD_FORMAT "%016lx"
|
2009-05-02 05:04:19 -04:00
|
|
|
#else
|
2009-05-13 02:08:16 -04:00
|
|
|
#define CELL_HEX_PAD_FORMAT "%08lx"
|
2009-05-02 05:04:19 -04:00
|
|
|
#endif
|
|
|
|
|
|
|
|
#define FIXNUM_FORMAT "%ld"
|
|
|
|
|
|
|
|
#define OPEN_READ(path) fopen(path,"rb")
|
|
|
|
#define OPEN_WRITE(path) fopen(path,"wb")
|
|
|
|
|
2009-08-24 15:10:56 -04:00
|
|
|
#define print_native_string(string) print_string(string)
|
2009-05-02 05:04:19 -04:00
|
|
|
|
2009-08-25 03:55:18 -04:00
|
|
|
typedef pthread_t THREADHANDLE;
|
2009-05-02 05:04:19 -04:00
|
|
|
|
2009-08-25 03:55:18 -04:00
|
|
|
THREADHANDLE start_thread(void *(*start_routine)(void *),void *args);
|
2009-10-02 13:00:01 -04:00
|
|
|
inline static THREADHANDLE thread_id() { return pthread_self(); }
|
2009-05-02 05:04:19 -04:00
|
|
|
|
2009-05-05 12:33:35 -04:00
|
|
|
void unix_init_signals();
|
2009-05-02 05:04:19 -04:00
|
|
|
void signal_handler(int signal, siginfo_t* siginfo, void* uap);
|
|
|
|
void dump_stack_signal(int signal, siginfo_t* siginfo, void* uap);
|
|
|
|
|
2009-05-05 12:33:35 -04:00
|
|
|
s64 current_micros();
|
2009-05-04 05:50:24 -04:00
|
|
|
void sleep_micros(cell usec);
|
2009-05-02 05:04:19 -04:00
|
|
|
|
2009-08-28 16:46:47 -04:00
|
|
|
void init_platform_globals();
|
2009-09-23 14:05:46 -04:00
|
|
|
struct factor_vm;
|
|
|
|
void register_vm_with_thread(factor_vm *vm);
|
|
|
|
factor_vm *tls_vm();
|
2009-05-05 12:33:35 -04:00
|
|
|
void open_console();
|
2009-05-04 02:46:13 -04:00
|
|
|
}
|