| |
|
| #include <ffi.h> |
#include <ffi.h> |
| |
|
| void ** clist; |
void ** gforth_clist; |
| void * ritem; |
void * gforth_ritem; |
| |
|
| void gforth_callback(ffi_cif * cif, void * resp, void ** args, void * ip) |
void gforth_callback(ffi_cif * cif, void * resp, void ** args, void * ip) |
| { |
{ |
| Float *fp = gforth_FP; |
Float *fp = gforth_FP; |
| Address lp = gforth_LP; |
Address lp = gforth_LP; |
| |
|
| clist = args; |
gforth_clist = args; |
| ritem = resp; |
gforth_ritem = resp; |
| |
|
| engine((Xt *)ip, sp, rp, fp, lp); |
gforth_engine((Xt *)ip, sp, rp, fp, lp); |
| |
|
| /* restore global variables */ |
/* restore global variables */ |
| gforth_RP = rp; |
gforth_RP = rp; |
| #endif /* !defined(GFORTH_DEBUGGING) */ |
#endif /* !defined(GFORTH_DEBUGGING) */ |
| /* fprintf(stderr, "rp=$%x\n",rp0);*/ |
/* fprintf(stderr, "rp=$%x\n",rp0);*/ |
| |
|
| return((int)(Cell)engine(image_header->throw_entry, signal_data_stack+15, |
return((int)(Cell)gforth_engine(image_header->throw_entry, signal_data_stack+15, |
| rp0, signal_fp_stack, 0)); |
rp0, signal_fp_stack, 0)); |
| } |
} |
| #endif |
#endif |
| |
|
| return((int)(Cell)engine(ip0,sp0,rp0,fp0,lp0)); |
return((int)(Cell)gforth_engine(ip0,sp0,rp0,fp0,lp0)); |
| } |
} |
| |
|
| #ifndef INCLUDE_IMAGE |
#ifndef INCLUDE_IMAGE |
| #ifndef NO_DYNAMIC |
#ifndef NO_DYNAMIC |
| if (no_dynamic) |
if (no_dynamic) |
| return; |
return; |
| symbols2=engine2(0,0,0,0,0); |
symbols2=gforth_engine2(0,0,0,0,0); |
| #if NO_IP |
#if NO_IP |
| symbols3=engine3(0,0,0,0,0); |
symbols3=gforth_engine3(0,0,0,0,0); |
| #else |
#else |
| symbols3=symbols1; |
symbols3=symbols1; |
| #endif |
#endif |
| #endif |
#endif |
| ; |
; |
| |
|
| vm_prims = engine(0,0,0,0,0); |
vm_prims = gforth_engine(0,0,0,0,0); |
| check_prims(vm_prims); |
check_prims(vm_prims); |
| prepare_super_table(); |
prepare_super_table(); |
| #ifndef DOUBLY_INDIRECT |
#ifndef DOUBLY_INDIRECT |
| set_stack_sizes((ImageHeader *)image); |
set_stack_sizes((ImageHeader *)image); |
| if(((ImageHeader *)image)->base != image) |
if(((ImageHeader *)image)->base != image) |
| gforth_relocate(image, reloc_bits, ((ImageHeader *)image)->image_size, |
gforth_relocate(image, reloc_bits, ((ImageHeader *)image)->image_size, |
| (Label*)engine(0, 0, 0, 0, 0)); |
(Label*)gforth_engine(0, 0, 0, 0, 0)); |
| alloc_stacks((ImageHeader *)image); |
alloc_stacks((ImageHeader *)image); |
| #else |
#else |
| image_file = open_image_file(imagename, path); |
image_file = open_image_file(imagename, path); |