4. eval

4.1. In C

<<function_declarations>>=
void monolith_janet_eval(monolith_d *m, const char *str);
<<functions>>=
void monolith_janet_eval(monolith_d *m, const char *str)
{
    JanetTable *env;
    env = monolith_janet_env(m);
    if (env == NULL) {
        fprintf(stderr, "Janet is not initialized yet.\n");
        return;
    }
    janet_dostring(env, str, NULL, NULL);
}

4.2. In Scheme

<<janet_scheme_entries>>=
{"monolith:janet-eval", pp_janet_eval, 1, 1, {STR,___,___}},
<<janet_scheme_functions>>=
static cell pp_janet_eval(cell x)
{
    monolith_janet_eval(monolith_data_get(),
                        string(car(x)));
    return UNSPECIFIC;
}



prev | home | next