From: Javier Sancho Date: Sun, 10 May 2020 08:29:22 +0000 (+0200) Subject: reference-counted X-Git-Url: https://git.jsancho.org/?a=commitdiff_plain;h=6c6597fcd2f8224cd019b4339037867c246b8a71;p=guile-irrlicht.git reference-counted --- diff --git a/src/reference-counted.cpp b/src/reference-counted.cpp index 1060df4..3e099d1 100644 --- a/src/reference-counted.cpp +++ b/src/reference-counted.cpp @@ -21,38 +21,28 @@ #include #include - -#include "device.h" #include "gsubr.h" #include "reference-counted.h" -#include "scene-node-animator.h" + + +using namespace irr; + + +template +SCM +IReferenceCounted_drop (SCM obj) +{ + return scm_from_bool (((T) scm_to_pointer (obj))->drop ()); +} + extern "C" { void init_reference_counted (void) { - DEFINE_GSUBR ("drop!", 1, 0, 0, irr_drop); - } - - SCM - irr_drop (SCM wrapped_obj) - { - bool result = 0; - if (device_p (wrapped_obj)) - { - result = unwrap_device (wrapped_obj)->drop (); - } - else if (scene_node_animator_p (wrapped_obj)) - { - result = unwrap_scene_node_animator (wrapped_obj)->drop (); - } - else - { - scm_error (scm_arg_type_key, NULL, "Object cannot be dropped: ~S", - scm_list_1 (wrapped_obj), scm_list_1 (wrapped_obj)); - } - return scm_from_bool (result); + DEFINE_GSUBR ("IReferenceCounted_drop_IrrlichtDevice", 1, 0, 0, + IReferenceCounted_drop); } } diff --git a/src/reference-counted.h b/src/reference-counted.h index f2a2613..13d8437 100644 --- a/src/reference-counted.h +++ b/src/reference-counted.h @@ -26,13 +26,8 @@ #include extern "C" { - void init_reference_counted (void); - - SCM - irr_drop (SCM wrapped_obj); - } #endif