1
0
mirror of https://github.com/janet-lang/janet synced 2025-10-17 08:47:39 +00:00

Add function versions of macro API bindings.

This should help address #81. Also hide janet_exit
and janet_assert, as they are really meant for internal usage.
I have not verified that this yet actually works with Rust's
bindgen.
This commit is contained in:
Calvin Rose
2019-04-27 15:45:28 -04:00
parent 73b81e0253
commit f10028d41a
12 changed files with 216 additions and 64 deletions

View File

@@ -292,6 +292,10 @@ void janet_fiber_popframe(JanetFiber *fiber) {
fiber->frame = frame->prevframe;
}
JanetFiberStatus janet_fiber_status(JanetFiber *f) {
return ((f)->flags & JANET_FIBER_STATUS_MASK) >> JANET_FIBER_STATUS_OFFSET;
}
/* CFuns */
static Janet cfun_fiber_getenv(int32_t argc, Janet *argv) {
@@ -369,8 +373,7 @@ static Janet cfun_fiber_new(int32_t argc, Janet *argv) {
static Janet cfun_fiber_status(int32_t argc, Janet *argv) {
janet_fixarity(argc, 1);
JanetFiber *fiber = janet_getfiber(argv, 0);
uint32_t s = (fiber->flags & JANET_FIBER_STATUS_MASK) >>
JANET_FIBER_STATUS_OFFSET;
uint32_t s = janet_fiber_status(fiber);
return janet_ckeywordv(janet_status_names[s]);
}