-
Notifications
You must be signed in to change notification settings - Fork 0
/
xguile.c
42 lines (33 loc) · 956 Bytes
/
xguile.c
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
/*
*/
#include <limits.h>
#include <stdlib.h>
#include <libguile.h>
SCM zcm_c_pointer_to_bytevector(void *pointer, size_t size) {
SCM ptr, len, mem;
ptr = scm_from_pointer(pointer, NULL);
len = scm_from_size_t(size);
mem = scm_pointer_to_bytevector(ptr, len, SCM_UNDEFINED, SCM_UNDEFINED);
return mem;
}
extern char _binary_dummy1_go_start[];
extern char _binary_dummy1_go_end[];
static void kont(void *closure, int argc, char **argv) {
char *ptr, *end;
size_t siz;
SCM mem, res;
SCM load_thunk, mod_init;
ptr = _binary_dummy1_go_start;
end = _binary_dummy1_go_end;
siz = end - ptr;
mem = zcm_c_pointer_to_bytevector (ptr, siz);
load_thunk = scm_c_public_ref("system vm loader", "load-thunk-from-memory");
mod_init = scm_call_1(load_thunk, mem);
res = scm_call_0(mod_init);
scm_shell(argc, argv);
}
int main(int argc, char **argv) {
scm_boot_guile (argc, argv, kont, 0);
return 0;
}
/* --- last line --- */