9. Knobs Runt Words
9.1. Runt Loader
All runt words are loaded with the function knobs_runt_loader
. It is loaded
at init time.
<<knobs_function_declarations>>=
static int knobs_runt_loader(monolith_d *m);
<<knobs_functions>>=
<<knobs_runt_functions>>
static int knobs_runt_loader(monolith_d *m)
{
<<knobs_runt_keywords>>
monolith_runt_mark_set(m);
return RUNT_OK;
}
<<knobs_runtime_init>>=
knobs_runt_loader(m);
9.2. Knobs Value
Here is a dummy word called "knobs".
<<knobs_runt_keywords>>=
monolith_runt_keyword(m, "knobsval", 8, rproc_knobs_val, m);
<<knobs_runt_functions>>=
static runt_int rproc_knobs_val(runt_vm *vm, runt_ptr p)
{
monolith_d *m;
runt_int rc;
int lane, x, y;
gf_patch *patch;
gf_node *node;
const char *name;
runt_stacklet *s;
runt_stacklet *out;
monolith_page *pg;
page_knobs_d *knobs;
m = runt_to_cptr(p);
rc = runt_ppop(vm, &s);
RUNT_ERROR_CHECK(rc);
name = runt_to_string(s->p);
rc = runt_ppop(vm, &s);
RUNT_ERROR_CHECK(rc);
y = s->f;
rc = runt_ppop(vm, &s);
RUNT_ERROR_CHECK(rc);
x = s->f;
rc = runt_ppop(vm, &s);
RUNT_ERROR_CHECK(rc);
lane = s->f;
rc = runt_ppush(vm, &out);
RUNT_ERROR_CHECK(rc);
rc = runt_monolith_lookup_page(vm,
m, name,
"knobs",
is_knobs, &pg);
RUNT_ERROR_CHECK(rc);
knobs = monolith_page_data_get(pg);
patch = monolith_graforge_get(m);
rc = gf_patch_new_node(patch, &node);
GF_RUNT_ERROR_CHECK(rc);
node_knobs_val(node, knobs, lane, x, y);
rgf_push_output(vm, node, out, 0);
return RUNT_OK;
}
prev | home | next