1
0
mirror of https://github.com/janet-lang/janet synced 2025-10-31 23:53:02 +00:00

Make stacktrace part of public API.

This commit is contained in:
Calvin Rose
2018-09-09 21:20:33 -04:00
parent 56c3b8aa94
commit 1ba3aeb3cd
3 changed files with 29 additions and 6 deletions

View File

@@ -139,6 +139,18 @@ Janet janet_dictionary_get(const JanetKV *data, int32_t cap, Janet key) {
return janet_wrap_nil();
}
/* Iterate through a struct or dictionary generically */
const JanetKV *janet_dictionary_next(const JanetKV *kvs, int32_t cap, const JanetKV *kv) {
const JanetKV *end = kvs + cap;
kv = (kv == NULL) ? kvs : kv + 1;
while (kv < end) {
if (!janet_checktype(kv->key, JANET_NIL))
return kv;
kv++;
}
return NULL;
}
/* Compare a janet string with a cstring. more efficient than loading
* c string as a janet string. */
int janet_cstrcmp(const uint8_t *str, const char *other) {