1
0
mirror of https://github.com/janet-lang/janet synced 2025-10-23 03:37:40 +00:00

Use one tag type true and false

We moved the literals true and false into one tag
type, so we an extra tag for raw pointer types
(light userdata). These can be used from the C API via
janet_wrap_pointer and janet_unwrap_pointer.
This commit is contained in:
Calvin Rose
2019-03-13 14:50:25 -04:00
parent 31e2415bbb
commit 95e54c66b6
12 changed files with 59 additions and 72 deletions

View File

@@ -95,16 +95,7 @@ DEFINE_GETTER(buffer, BUFFER, JanetBuffer *)
DEFINE_GETTER(fiber, FIBER, JanetFiber *)
DEFINE_GETTER(function, FUNCTION, JanetFunction *)
DEFINE_GETTER(cfunction, CFUNCTION, JanetCFunction)
int janet_getboolean(const Janet *argv, int32_t n) {
Janet x = argv[n];
if (janet_checktype(x, JANET_TRUE)) {
return 1;
} else if (!janet_checktype(x, JANET_FALSE)) {
janet_panicf("bad slot #%d, expected boolean, got %v", n, x);
}
return 0;
}
DEFINE_GETTER(boolean, BOOLEAN, int)
int32_t janet_getinteger(const Janet *argv, int32_t n) {
Janet x = argv[n];