From: Javier Sancho Date: Sun, 31 Mar 2019 09:29:33 +0000 (+0200) Subject: Register procedures X-Git-Url: https://git.jsancho.org/?a=commitdiff_plain;h=770a848889b174dd4a1dc6422c699cd5640fe318;p=dungeon-master.git Register procedures --- diff --git a/src/main.cpp b/src/main.cpp index 6c2e2a7..bb5a5f9 100644 --- a/src/main.cpp +++ b/src/main.cpp @@ -5,9 +5,16 @@ using namespace irr; using namespace core; using namespace video; +SCM register_generator(SCM name, SCM proc) { + printf ("Register: %s\n", scm_to_locale_string(name)); + scm_call_0(proc); + return SCM_UNSPECIFIED; +} + int main() { scm_init_guile(); + scm_c_define_gsubr("register-generator", 2, 0, 0, (scm_t_subr)register_generator); scm_primitive_load(scm_from_locale_string("plugins/default/main.scm")); IrrlichtDevice* device = diff --git a/src/plugins/default/main.scm b/src/plugins/default/main.scm index 82d3d9d..b95e41c 100644 --- a/src/plugins/default/main.scm +++ b/src/plugins/default/main.scm @@ -1,2 +1,5 @@ -(display "Hello world!") -(newline) +(define (hello-world) + (display "Hello World!") + (newline)) + +(register-generator "hello-world" hello-world)