10. Scheme

Monolith controlled via a Scheme REPL. It uses a dialect of scheme called Scheme 9 From Extended Space, or S9fES. It has been modified a little bit to be easier to extend. Scheme code runs outside the DSP Kernel, but not inside of it to avoid any glitches caused the garbage collector

10.1. Scheme Loader

The loader function will load all the native functions for monolith. This function gets passed into the function s9_main_with_loader, which is used to instantiate the scheme CLI and REPL.

<<loader>>=
<<page_loaders_funcdefs>>
<<aux_loaders_funcdefs>>
static void loader()
{
    add_primitives("monolith", Monolith_primitives);
<<page_loaders>>
<<aux_loaders>>
}

10.2. Scheme Primitives Table

Primitives scheme functions are stored in a global table, declared below.

<<primitive_table>>=
static S9_PRIM Monolith_primitives[] = {
<<primitive_entries>>
{NULL}
};

10.3. Scheme Page Loader

All scheme functions for pages get loaded at runtime.

10.3.1. Grid Page

<<page_loaders_funcdefs>>=
void s9_load_grid(void);
<<page_loaders>>=
s9_load_grid();

10.3.2. Sliders Page

<<page_loaders_funcdefs>>=
void s9_load_sliders(void);
<<page_loaders>>=
s9_load_sliders();

10.3.3. Step Page

<<page_loaders_funcdefs>>=
void s9_load_step(void);
<<page_loaders>>=
s9_load_step();

10.3.4. Line16 Page

<<page_loaders_funcdefs>>=
void s9_load_line16(void);
<<page_loaders>>=
s9_load_line16();

10.3.5. Foo Loader

<<page_loaders_funcdefs>>=
void s9_load_foo(void);
<<page_loaders>>=
s9_load_foo();

10.3.6. Knobs Page

<<page_loaders_funcdefs>>=
void s9_load_knobs(void);
<<page_loaders>>=
s9_load_knobs();

10.3.7. Seq16 Page

<<page_loaders_funcdefs>>=
void s9_load_seq16(void);
<<page_loaders>>=
s9_load_seq16();

10.3.8. Trig Page

<<page_loaders_funcdefs>>=
void s9_load_trig(void);
<<page_loaders>>=
s9_load_trig();

10.4. Scheme Aux loader

Scheme functions that aren't bound to a particular page are loaded are considered to be auxiliary functions, and are called by appending them to the aux_loader section.

10.4.1. SQLar Loader

These are the scheme bindings for loading SQLar data.

<<aux_loaders_funcdefs>>=
void s9_load_sqlar(void);
<<aux_loaders>>=
s9_load_sqlar();

10.4.2. Janet Loader

<<aux_loaders_funcdefs>>=
#ifdef USE_JANET
void s9_load_janet(void);
#endif
<<aux_loaders>>=
#ifdef USE_JANET
s9_load_janet();
#endif

10.4.3. SQLar wavread

<<aux_loaders_funcdefs>>=
void s9_load_sqlar_wavread(void);
<<aux_loaders>>=
s9_load_sqlar_wavread();

10.4.4. Graphics

<<aux_loaders_funcdefs>>=
void s9_load_gfx(void);
<<aux_loaders>>=
s9_load_gfx();

10.4.5. Gest

<<aux_loaders_funcdefs>>=
void s9_load_gest(void);
<<aux_loaders>>=
s9_load_gest();

10.4.6. Nodes

Nodes that were defined in scheme.

<<aux_loaders_funcdefs>>=
void monolith_nodes_scheme(void);
<<aux_loaders>>=
monolith_nodes_scheme();

10.5. Scheme Sample Foo Function

The "foo" function is a placeholder function that displays a message. We use this to get the ball rolling, and to set up the framework.

<<primitive_entries>>=
{"monolith:foo", pp_foo, 0, 0, {CHR,___,___}},
<<scheme_functions>>=
static cell pp_foo(cell x)
{
    printf("hello foo!\n");
    return UNSPECIFIC;
}



prev | home | next