2022-02-15 15:40:15 +01:00
|
|
|
# FFI
|
|
|
|
|
|
|
|
326 void io_ffi(NgaState *vm) {
|
|
|
|
327 switch (stack_pop(vm)) {
|
|
|
|
328 case 0: open_library(vm); break;
|
|
|
|
329 case 1: map_symbol(vm); break;
|
|
|
|
330 case 2: invoke(vm); break;
|
|
|
|
331 }
|
|
|
|
332 }
|
|
|
|
333
|
|
|
|
334 void query_ffi(NgaState *vm) {
|
|
|
|
335 stack_push(vm, 0);
|
|
|
|
336 stack_push(vm, 8100); /* device type 8100 */
|
|
|
|
337 }
|
|
|
|
338 #endif
|
|
|
|
|
|
|
|
~~~
|
|
|
|
:ffi:operation (n-?)
|
2023-12-11 00:32:03 +01:00
|
|
|
DEVICE:FFI io:scan-for
|
|
|
|
dup n:negative? [ drop 'Error:_FFI_device_not_found s:put nl ] if;
|
2022-02-15 15:40:15 +01:00
|
|
|
io:invoke ;
|
|
|
|
|
|
|
|
:ffi:open (s-n)
|
|
|
|
#0 ffi:operation ;
|
|
|
|
|
|
|
|
:ffi:map-sym (sn-n)
|
|
|
|
#1 ffi:operation ;
|
|
|
|
|
|
|
|
:ffi:invoke (n-)
|
|
|
|
#2 ffi:operation ;
|
|
|
|
|
2023-04-12 02:34:17 +02:00
|
|
|
'interface/ffi.retro
|
|
|
|
dup 'ffi:operation d:set-source
|
|
|
|
dup 'ffi:open d:set-source
|
|
|
|
dup 'ffi:map-sym d:set-source
|
|
|
|
dup 'ffi:invoke d:set-source
|
2022-02-15 15:40:15 +01:00
|
|
|
drop
|
|
|
|
~~~
|