factor/native/factor.c

54 lines
810 B
C
Raw Normal View History

2004-07-16 02:26:21 -04:00
#include "factor.h"
2004-11-22 19:15:14 -05:00
void init_factor(char* image)
{
init_arena(DEFAULT_ARENA);
load_image(image);
init_stacks();
init_io();
init_signals();
2004-12-10 22:12:05 -05:00
2004-11-22 19:15:14 -05:00
init_compiler();
init_errors();
gc_time = 0;
#ifdef FACTOR_X86
userenv[CPU_ENV] = tag_object(from_c_string("x86"));
#else
userenv[CPU_ENV] = tag_object(from_c_string("unknown"));
#endif
#ifdef WIN32
userenv[OS_ENV] = tag_object(from_c_string("win32"));
#else
userenv[OS_ENV] = tag_object(from_c_string("unix"));
#endif
2004-11-22 19:15:14 -05:00
}
2004-07-16 02:26:21 -04:00
int main(int argc, char** argv)
{
CELL args;
2004-07-16 02:26:21 -04:00
if(argc == 1)
{
printf("Usage: factor <image file> [ parameters ... ]\n");
printf("\n");
return 1;
}
2004-11-22 19:15:14 -05:00
init_factor(argv[1]);
2004-08-13 01:38:15 -04:00
args = F;
while(--argc != 0)
{
args = cons(tag_object(from_c_string(argv[argc])),args);
}
userenv[ARGS_ENV] = args;
2004-07-16 02:26:21 -04:00
run();
return 0;
}