diff options
author | Timothy Pearson <tpearson@raptorengineering.com> | 2019-05-11 15:12:49 -0500 |
---|---|---|
committer | Timothy Pearson <tpearson@raptorengineering.com> | 2019-05-11 15:12:49 -0500 |
commit | 9e80202352dd49bdd9e67b8b906d86f058431505 (patch) | |
tree | 5673c17aad6e3833da8c4ff21b5a11f666ec9fbe /src/roms/openbios/libopenbios/clib.fs | |
download | hqemu-master.zip hqemu-master.tar.gz |
Diffstat (limited to 'src/roms/openbios/libopenbios/clib.fs')
-rw-r--r-- | src/roms/openbios/libopenbios/clib.fs | 36 |
1 files changed, 36 insertions, 0 deletions
diff --git a/src/roms/openbios/libopenbios/clib.fs b/src/roms/openbios/libopenbios/clib.fs new file mode 100644 index 0000000..04dd0aa --- /dev/null +++ b/src/roms/openbios/libopenbios/clib.fs @@ -0,0 +1,36 @@ +\ tag: C helpers +\ +\ Misc C helpers +\ +\ Copyright (C) 2003, 2004 Samuel Rydh +\ +\ See the file "COPYING" for further information about +\ the copyright and warranty status of this work. +\ + +\ should perhaps be moved somewhere else +: set-property ( buf len propname propname-len phandle -- ) + >r 2swap encode-bytes 2swap r> encode-property +; + +\ install C function +: is-cfunc ( funcaddr word word-len -- ) + $create , does> @ call +; + +\ install a nameless C function +: is-noname-cfunc ( funcaddr -- xt ) + 0 0 is-cfunc last-xt +; + +\ is-xt-cfunc installs a function which does the following: +\ - xt is executes +\ - funcarg is pushed +\ - funcaddr is called + +: is-xt-cfunc ( xt|0 funcarg funcaddr word word-len -- ) + is-func-begin + rot ?dup if , then + swap ['] (lit) , , ['] (lit) , , ['] call , + is-func-end +; |