8. Sliders Runt Words

8.1. Runt Loader

All runt words are loaded with the function sliders_runt_loader. It is loaded at init time.

<<sliders_function_declarations>>=
static int sliders_runt_loader(monolith_d *m);
<<sliders_functions>>=
<<sliders_runt_functions>>
static int sliders_runt_loader(monolith_d *m)
{
<<sliders_runt_keywords>>
    monolith_runt_mark_set(m);
    return RUNT_OK;
}
<<sliders_runtime_init>>=
sliders_runt_loader(m);

8.2. Sliderval Word

The sliderval word is a wrapper around the sliderval node.

<<sliders_runt_keywords>>=
monolith_runt_keyword(m, "sliderval", 9, rproc_sliderval, m);
<<sliders_runt_functions>>=
static runt_int rproc_sliderval(runt_vm *vm, runt_ptr p)
{
    monolith_d *m;
    runt_int rc;
    rgf_param pos;
    const char *name;
    runt_stacklet *s;
    runt_stacklet *out;
    monolith_page *pg;
    gf_patch *patch;
    gf_node *node;

    m = runt_to_cptr(p);
    rc = runt_ppop(vm, &s);
    RUNT_ERROR_CHECK(rc);

    name = runt_to_string(s->p);

    rc = rgf_get_param(vm, &pos);
    RUNT_ERROR_CHECK(rc);

    rc = runt_ppush(vm, &out);
    RUNT_ERROR_CHECK(rc);

    rc = runt_monolith_lookup_page(vm, m, name,
                                   "sliders",
                                   is_sliders, &pg);
    RUNT_ERROR_CHECK(rc);

    patch = monolith_graforge_get(m);

    rc = gf_patch_new_node(patch, &node);
    GF_RUNT_ERROR_CHECK(rc);

    node_sliderval(node, pg);

    rgf_set_param(vm, node, &pos, 0);
    rgf_push_output(vm, node, out, 1);

    return RUNT_OK;
}

8.3. Slidergate Word

<<sliders_runt_keywords>>=
monolith_runt_keyword(m, "slidergate", 10, rproc_slidergate, m);
<<sliders_runt_functions>>=
static runt_int rproc_slidergate(runt_vm *vm, runt_ptr p)
{
    monolith_d *m;
    runt_int rc;
    const char *name;
    runt_stacklet *s;
    runt_stacklet *out;
    monolith_page *pg;
    gf_patch *patch;
    gf_node *node;

    m = runt_to_cptr(p);

    rc = runt_ppop(vm, &s);
    RUNT_ERROR_CHECK(rc);
    name = runt_to_string(s->p);

    rc = runt_ppush(vm, &out);
    RUNT_ERROR_CHECK(rc);

    rc = runt_monolith_lookup_page(vm, m, name,
                                   "sliders",
                                   is_sliders, &pg);
    RUNT_ERROR_CHECK(rc);

    patch = monolith_graforge_get(m);

    rc = gf_patch_new_node(patch, &node);
    GF_RUNT_ERROR_CHECK(rc);

    node_slidergate(node, pg);

    rgf_push_output(vm, node, out, 0);

    return RUNT_OK;
}



prev | home | next