| 
									
										
										
										
											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-04 05:50:24 -04:00
										 |  |  | #define cell_FORMAT "%lu"
 | 
					
						
							|  |  |  | #define cell_HEX_FORMAT "%lx"
 | 
					
						
							| 
									
										
										
										
											2009-05-02 05:04:19 -04:00
										 |  |  | 
 | 
					
						
							|  |  |  | #ifdef FACTOR_64
 | 
					
						
							| 
									
										
										
										
											2009-05-04 05:50:24 -04:00
										 |  |  | 	#define cell_HEX_PAD_FORMAT "%016lx"
 | 
					
						
							| 
									
										
										
										
											2009-05-02 05:04:19 -04:00
										 |  |  | #else
 | 
					
						
							| 
									
										
										
										
											2009-05-04 05:50:24 -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")
 | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | #define print_native_string(string) print_string(string)
 | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | void start_thread(void *(*start_routine)(void *)); | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2009-05-05 12:33:35 -04:00
										 |  |  | void init_ffi(); | 
					
						
							| 
									
										
										
										
											2009-05-04 05:50:24 -04:00
										 |  |  | void ffi_dlopen(dll *dll); | 
					
						
							|  |  |  | void *ffi_dlsym(dll *dll, symbol_char *symbol); | 
					
						
							|  |  |  | void ffi_dlclose(dll *dll); | 
					
						
							| 
									
										
										
										
											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-05-05 12:33:35 -04:00
										 |  |  | void open_console(); | 
					
						
							| 
									
										
										
										
											2009-05-04 02:46:13 -04:00
										 |  |  | 
 | 
					
						
							|  |  |  | } |