1
0
mirror of https://github.com/janet-lang/janet synced 2024-12-23 23:10:26 +00:00
This commit is contained in:
Calvin Rose 2019-11-30 21:54:23 -05:00
parent 474aed8cfe
commit 8e31bda8f6

View File

@ -458,6 +458,10 @@ int main(int argc, const char **argv) {
fprintf(stderr, "invalid bytecode image - expected function."); fprintf(stderr, "invalid bytecode image - expected function.");
return 1; return 1;
} }
JanetFunction *jfunc = janet_unwrap_function(marsh_out);
/* Check arity */
janet_arity(argc, jfunc->def->min_arity, jfunc->def->max_arity);
/* Collect command line arguments */ /* Collect command line arguments */
JanetArray *args = janet_array(argc); JanetArray *args = janet_array(argc);
@ -475,7 +479,7 @@ int main(int argc, const char **argv) {
janet_gcunlock(handle); janet_gcunlock(handle);
/* Run everything */ /* Run everything */
JanetFiber *fiber = janet_fiber(janet_unwrap_function(marsh_out), 64, argc, argc ? args->data : NULL); JanetFiber *fiber = janet_fiber(jfunc, 64, argc, argc ? args->data : NULL);
fiber->env = temptab; fiber->env = temptab;
Janet out; Janet out;
JanetSignal result = janet_continue(fiber, janet_wrap_nil(), &out); JanetSignal result = janet_continue(fiber, janet_wrap_nil(), &out);