2019-08-17 17:09:43 -04:00
|
|
|
#include <sys/types.h>
|
|
|
|
|
2019-08-09 12:00:17 -04:00
|
|
|
#include <assert.h>
|
2019-08-13 11:28:19 -04:00
|
|
|
#include <math.h>
|
2019-08-09 12:00:17 -04:00
|
|
|
#include <setjmp.h>
|
|
|
|
#include <stdarg.h>
|
2019-08-09 16:25:20 -04:00
|
|
|
#include <stdint.h>
|
2019-08-09 13:14:42 -04:00
|
|
|
#include <stdio.h>
|
2010-05-02 14:17:47 -04:00
|
|
|
#include <stdlib.h>
|
|
|
|
#include <string.h>
|
2019-08-09 12:00:17 -04:00
|
|
|
|
2019-08-26 15:12:15 -04:00
|
|
|
#include "scheme.h"
|
2010-05-02 14:17:47 -04:00
|
|
|
|
2019-08-25 15:39:35 -04:00
|
|
|
extern void write_defaults_indent(struct ios *f, value_t v);
|
|
|
|
|
2010-05-02 14:17:47 -04:00
|
|
|
static value_t argv_list(int argc, char *argv[])
|
|
|
|
{
|
|
|
|
int i;
|
2019-08-09 07:02:02 -04:00
|
|
|
value_t lst = FL_NIL, temp;
|
2010-05-02 14:17:47 -04:00
|
|
|
fl_gc_handle(&lst);
|
|
|
|
fl_gc_handle(&temp);
|
2019-08-09 07:02:02 -04:00
|
|
|
for (i = argc - 1; i >= 0; i--) {
|
2010-05-02 14:17:47 -04:00
|
|
|
temp = cvalue_static_cstring(argv[i]);
|
|
|
|
lst = fl_cons(temp, lst);
|
|
|
|
}
|
|
|
|
fl_free_gc_handles(2);
|
|
|
|
return lst;
|
|
|
|
}
|
|
|
|
|
|
|
|
int main(int argc, char *argv[])
|
|
|
|
{
|
2019-08-09 07:02:02 -04:00
|
|
|
fl_init(512 * 1024);
|
|
|
|
{
|
2019-08-21 15:08:21 -04:00
|
|
|
FL_TRY_EXTERN
|
|
|
|
{
|
|
|
|
if (fl_load_boot_image())
|
|
|
|
return 1;
|
2010-05-02 14:17:47 -04:00
|
|
|
|
2019-08-21 15:08:21 -04:00
|
|
|
(void)fl_applyn(1, symbol_value(symbol("__start")),
|
|
|
|
argv_list(argc, argv));
|
|
|
|
}
|
|
|
|
FL_CATCH_EXTERN
|
|
|
|
{
|
|
|
|
ios_puts("fatal error:\n", ios_stderr);
|
2019-08-25 15:39:35 -04:00
|
|
|
write_defaults_indent(ios_stderr, fl_lasterror);
|
2019-08-21 15:08:21 -04:00
|
|
|
ios_putc('\n', ios_stderr);
|
|
|
|
return 1;
|
|
|
|
}
|
2010-05-02 14:17:47 -04:00
|
|
|
}
|
|
|
|
return 0;
|
|
|
|
}
|