X-Git-Url: https://git.jsancho.org/?a=blobdiff_plain;f=src%2Freference-counted.cpp;h=f01287f22032606c9423f125e46f3a38c6a83c19;hb=c4d9e46f268b4f7f738dd77685c632991125cec9;hp=85634d4560dce04011010fd2f103655a859f2201;hpb=2806f03eafc48ec9ef02a3dc2d74133eaf11ccc1;p=guile-irrlicht.git diff --git a/src/reference-counted.cpp b/src/reference-counted.cpp index 85634d4..f01287f 100644 --- a/src/reference-counted.cpp +++ b/src/reference-counted.cpp @@ -21,27 +21,21 @@ #include #include - -#include "device.h" +#include "gsubr.h" #include "reference-counted.h" +#include "wrapped.h" + +using namespace irr; -extern "C" { - - void - init_reference_counted (void) - { - scm_c_define_gsubr ("drop!", 1, 0, 0, (scm_t_subr)irr_drop); - } - - SCM - irr_drop (SCM wrapped_obj) - { - bool result = 0; - if (device_p (wrapped_obj)) - { - result = unwrap_device (wrapped_obj)->drop (); - } - return scm_from_bool (result); - } +template +SCM +IReferenceCounted_drop (SCM obj) +{ + return scm_from_bool (((T) scm_to_irr_pointer (obj))->drop ()); +} +void +init_reference_counted (void) +{ + DEFINE_GSUBR ("IrrlichtDevice_drop", 1, 0, 0, IReferenceCounted_drop); }