1
0
mirror of https://github.com/janet-lang/janet synced 2025-11-07 11:03:04 +00:00

Refactor native module declarations. marshal can now

serialize entire environment.
This commit is contained in:
Calvin Rose
2018-08-26 14:35:01 -04:00
parent 45d0597294
commit 75c66ea6dd
20 changed files with 97 additions and 78 deletions

View File

@@ -152,11 +152,16 @@ static int cfun_append(DstArgs args) {
DST_RETURN_TUPLE(args, dst_tuple_end(n));
}
static const DstReg cfuns[] = {
{"tuple.slice", cfun_slice},
{"tuple.append", cfun_append},
{"tuple.prepend", cfun_prepend},
{NULL, NULL}
};
/* Load the tuple module */
int dst_lib_tuple(DstArgs args) {
DstTable *env = dst_env_arg(args);
dst_env_def(env, "tuple.slice", dst_wrap_cfunction(cfun_slice));
dst_env_def(env, "tuple.append", dst_wrap_cfunction(cfun_append));
dst_env_def(env, "tuple.prepend", dst_wrap_cfunction(cfun_prepend));
DstTable *env = dst_env(args);
dst_cfuns(env, NULL, cfuns);
return 0;
}