Artifact 92768be85948e737ca27184912c4fc748b0d6cb2f6ec1e94101004a416163ffd:
- File clib/tbl.c — part of check-in [42ea2c7296] at 2019-07-19 11:34:42 on branch trunk — add mkpw (user: lexi, size: 440) [annotate] [blame] [check-ins using]
/* [ʞ] tbl.c
* ~ lexi hale <lexi@hale.su>
* ? simple table-scanning function to make
* parsing easier */
struct tblrow { tbl_word_type val; const char* str; };
tbl_error_type tblget(size_t stacksz, const struct tblrow* haystack, const char* needle, tbl_word_type* val) {
for (size_t i = 0; i<stacksz; ++i) {
if (strcmp(haystack[i].str, needle) == ok) {
*val = haystack[i].val;
return tbl_ok;
}
}
return tbl_error;
}