X-Git-Url: https://git.jsancho.org/?a=blobdiff_plain;f=src%2Freference-counted.cpp;h=1bdc8daf8737de65dc5791d363a18a6f68d29262;hb=41a6ad96e81a8d8153c54877c4c12f61100677a9;hp=85634d4560dce04011010fd2f103655a859f2201;hpb=2806f03eafc48ec9ef02a3dc2d74133eaf11ccc1;p=guile-irrlicht.git diff --git a/src/reference-counted.cpp b/src/reference-counted.cpp index 85634d4..1bdc8da 100644 --- a/src/reference-counted.cpp +++ b/src/reference-counted.cpp @@ -21,27 +21,20 @@ #include #include - -#include "device.h" +#include "gsubr.h" #include "reference-counted.h" -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); - } +using namespace irr; + +template +SCM +IReferenceCounted_drop (SCM obj) +{ + return scm_from_bool (((T) scm_to_pointer (obj))->drop ()); +} +void +init_reference_counted (void) +{ + DEFINE_GSUBR ("IrrlichtDevice_drop", 1, 0, 0, IReferenceCounted_drop); }