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.
<<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.
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
void s9_load_grid(void);
s9_load_grid();
10.3.2. Sliders Page
void s9_load_sliders(void);
s9_load_sliders();
10.3.3. Step Page
void s9_load_step(void);
s9_load_step();
10.3.4. Line16 Page
void s9_load_line16(void);
s9_load_line16();
10.3.5. Foo Loader
void s9_load_foo(void);
s9_load_foo();
10.3.6. Knobs Page
void s9_load_knobs(void);
s9_load_knobs();
10.3.7. Seq16 Page
void s9_load_seq16(void);
s9_load_seq16();
10.3.8. Trig Page
void s9_load_trig(void);
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.
void s9_load_sqlar(void);
s9_load_sqlar();
10.4.2. Janet Loader
#ifdef USE_JANET
void s9_load_janet(void);
#endif
#ifdef USE_JANET
s9_load_janet();
#endif
10.4.3. SQLar wavread
void s9_load_sqlar_wavread(void);
s9_load_sqlar_wavread();
10.4.4. Graphics
void s9_load_gfx(void);
s9_load_gfx();
10.4.5. Gest
void s9_load_gest(void);
s9_load_gest();
10.4.6. Nodes
Nodes that were defined in scheme.
void monolith_nodes_scheme(void);
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.
{"monolith:foo", pp_foo, 0, 0, {CHR,___,___}},
static cell pp_foo(cell x)
{
printf("hello foo!\n");
return UNSPECIFIC;
}
prev | home | next