From 1f856dd6077fa25c8236146cf15d95e759b96b5e Mon Sep 17 00:00:00 2001 From: Javier Sancho Date: Tue, 30 Apr 2019 17:11:11 +0200 Subject: [PATCH] Mods library --- src/mods.cpp | 27 +++++++++++++++++++++++++++ src/mods.h | 1 + 2 files changed, 28 insertions(+) create mode 100644 src/mods.cpp create mode 100644 src/mods.h diff --git a/src/mods.cpp b/src/mods.cpp new file mode 100644 index 0000000..a1dccfa --- /dev/null +++ b/src/mods.cpp @@ -0,0 +1,27 @@ +#include +#include "mods.h" + +SCM register_generator(SCM name, SCM proc) +{ + printf ("Register: %s\n", scm_to_locale_string(name)); + scm_call_1(proc, scm_from_int(-1)); + return SCM_UNSPECIFIED; +} + +void init_dungeon_master_module(void *unused) +{ + scm_c_define_gsubr("register-generator", 2, 0, 0, (scm_t_subr)register_generator); + scm_c_export("register-generator", NULL); +} + +void scm_init_dungeon_master_module() +{ + scm_c_define_module("dungeon-master", init_dungeon_master_module, NULL); +} + +void load_mods() +{ + scm_init_guile(); + scm_init_dungeon_master_module(); + scm_primitive_load(scm_from_locale_string("mods/default/main.scm")); +} diff --git a/src/mods.h b/src/mods.h new file mode 100644 index 0000000..aed4811 --- /dev/null +++ b/src/mods.h @@ -0,0 +1 @@ +void load_mods(); -- 2.39.5