]> git.jsancho.org Git - dungeon-master.git/commitdiff
Register procedures
authorJavier Sancho <jsf@jsancho.org>
Sun, 31 Mar 2019 09:29:33 +0000 (11:29 +0200)
committerJavier Sancho <jsf@jsancho.org>
Sun, 31 Mar 2019 09:29:33 +0000 (11:29 +0200)
src/main.cpp
src/plugins/default/main.scm

index 6c2e2a756dc856903df78a4bf80b0e0e3cb6decc..bb5a5f96f707dd19e8cccc676bb69603210382fe 100644 (file)
@@ -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 =
index 82d3d9d53418f7de40cd253f83806f63d82e1565..b95e41cfed616e8c252795cbcfc896ad51f48c55 100644 (file)
@@ -1,2 +1,5 @@
-(display "Hello world!")
-(newline)
+(define (hello-world)
+  (display "Hello World!")
+  (newline))
+
+(register-generator "hello-world" hello-world)