/* * Set a callback watching for objects being destroyed. Usage: * * # Watch for all objects being destroyed * * world.watch_destroy { |obj| ... } * * # Watch all objects of a particular class * * world.watch_new('classname') { |obj| ... } * * Returns a Callback object representing the callback. */ static VALUE world_watch_destroy(int argc, VALUE *argv, VALUE self) { IrmoWorld *world = unwrap_world(self); VALUE proc = BLOCK_PROC(); IrmoCallback *callback; char *classname = NULL; if (argc >= 1) classname = STR2CSTR(argv[0]); if (argc >= 2) rb_raise(rb_eNameError, "too many arguments to method"); callback = irmo_world_watch_destroy(world, classname, (IrmoObjCallback) rb_irmo_obj_callback, (void *) proc); return wrap_callback(callback, proc); }