void rb_define_object_special_methods(VALUE klass) { RCLASS_SET_VERSION(*(VALUE *)klass, (RCLASS_VERSION(*(VALUE *)klass) | RCLASS_HAS_ROBJECT_ALLOC)); rb_objc_define_method(*(VALUE *)klass, "new", rb_class_new_instance_imp, -1); rb_objc_define_method(klass, "dup", rb_obj_dup, 0); rb_objc_define_private_method(klass, "initialize", rb_objc_init, -1); rb_objc_define_private_method(klass, "initialize_copy", rb_obj_init_copy, 1); rb_objc_define_method(klass, "hash", rb_obj_id, 0); // To make sure singleton classes will be filtered. rb_objc_define_method(*(VALUE *)klass, "superclass", rb_obj_superclass, 0); rb_objc_define_method(klass, "class", rb_obj_class, 0); rb_objc_install_method(*(Class *)klass, selAllocWithZone, (IMP)rb_obj_imp_allocWithZone); rb_objc_install_method((Class)klass, selIsEqual, (IMP)rb_obj_imp_isEqual); rb_objc_install_method((Class)klass, selInit, (IMP)rb_obj_imp_init); rb_objc_install_method((Class)klass, selDescription, (IMP)rb_obj_imp_description); // Create -copyWithZone:, since the method doesn't exist yet we need to // find the type encoding somewhere, here we check Symbol since it's // created very early. Method m = class_getInstanceMethod((Class)rb_cSymbol, selCopyWithZone); assert(m != NULL); class_replaceMethod((Class)klass, selCopyWithZone, (IMP)rb_obj_imp_copyWithZone, method_getTypeEncoding(m)); }
void Init_vm_eval(void) { rb_objc_define_module_function(rb_mKernel, "catch", rb_f_catch, -1); rb_objc_define_module_function(rb_mKernel, "throw", rb_f_throw, -1); rb_objc_define_module_function(rb_mKernel, "loop", rb_f_loop, 0); rb_objc_define_method(rb_cNSObject, "instance_eval", rb_obj_instance_eval_imp, -3); rb_objc_define_method(rb_cNSObject, "instance_exec", rb_obj_instance_exec, -1); rb_objc_define_private_method(rb_cNSObject, "method_missing", rb_method_missing, -1); rb_objc_define_method(rb_cNSObject, "__send__", rb_f_send, -1); rb_objc_define_method(rb_cBasicObject, "instance_eval", rb_obj_instance_eval_imp, -3); rb_objc_define_method(rb_cBasicObject, "instance_exec", rb_obj_instance_exec, -1); rb_objc_define_private_method(rb_cBasicObject, "method_missing", rb_method_missing, -1); rb_objc_define_method(rb_cBasicObject, "__send__", rb_f_send, -1); rb_objc_define_method(rb_mKernel, "send", rb_f_send, -1); rb_objc_define_method(rb_mKernel, "public_send", rb_f_public_send, -1); rb_objc_define_method(rb_cModule, "module_exec", rb_mod_module_exec, -1); rb_objc_define_method(rb_cModule, "class_exec", rb_mod_module_exec, -1); rb_objc_define_module_function(rb_mKernel, "caller", rb_f_caller, -1); }
void rb_objc_define_module_function(VALUE module, const char *name, void *imp, const int arity) { rb_objc_define_private_method(module, name, imp, arity); rb_objc_define_method(*(VALUE *)module, name, imp, arity); }
/* * INIT */ void Init_ossl_digest() { rb_require("digest"); #if 0 /* let rdoc know about mOSSL */ mOSSL = rb_define_module("OpenSSL"); #endif cDigest = rb_define_class_under(mOSSL, "Digest", rb_path2class("Digest::Class")); eDigestError = rb_define_class_under(cDigest, "DigestError", eOSSLError); rb_objc_define_method(*(VALUE *)cDigest, "alloc", ossl_digest_alloc, 0); rb_objc_define_method(cDigest, "initialize", ossl_digest_initialize, -1); rb_define_copy_func(cDigest, ossl_digest_copy); rb_objc_define_method(cDigest, "reset", ossl_digest_reset, 0); rb_objc_define_method(cDigest, "update", ossl_digest_update, 1); rb_define_alias(cDigest, "<<", "update"); rb_objc_define_private_method(cDigest, "finish", ossl_digest_finish, -1); rb_objc_define_method(cDigest, "digest_length", ossl_digest_size, 0); rb_objc_define_method(cDigest, "block_length", ossl_digest_block_length, 0); rb_objc_define_method(cDigest, "name", ossl_digest_name, 0); }
void Init_eval(void) { rb_define_virtual_variable("$@", errat_getter, errat_setter); rb_define_virtual_variable("$!", errinfo_getter, 0); rb_objc_define_module_function(rb_mKernel, "eval", rb_f_eval, -1); rb_objc_define_module_function(rb_mKernel, "iterator?", rb_f_block_given_p, 0); rb_objc_define_module_function(rb_mKernel, "block_given?", rb_f_block_given_p, 0); rb_objc_define_module_function(rb_mKernel, "fail", rb_f_raise, -1); rb_objc_define_module_function(rb_mKernel, "raise", rb_f_raise, -1); rb_objc_define_module_function(rb_mKernel, "global_variables", rb_f_global_variables, 0); /* in variable.c */ rb_objc_define_module_function(rb_mKernel, "local_variables", rb_f_local_variables, 0); rb_objc_define_method(rb_mKernel, "__method__", rb_f_method_name, 0); rb_objc_define_method(rb_mKernel, "__callee__", rb_f_method_name, 0); rb_objc_define_private_method(rb_cModule, "append_features", rb_mod_append_features, 1); rb_objc_define_private_method(rb_cModule, "extend_object", rb_mod_extend_object, 1); rb_objc_define_private_method(rb_cModule, "include", rb_mod_include, -1); rb_objc_define_method(rb_cModule, "module_eval", rb_mod_module_eval, -1); rb_objc_define_method(rb_cModule, "class_eval", rb_mod_module_eval, -1); rb_undef_method(rb_cClass, "module_function"); Init_vm_eval(); Init_eval_method(); rb_objc_define_method(*(VALUE *)rb_cModule, "nesting", rb_mod_nesting, -3); rb_objc_define_method(*(VALUE *)rb_cModule, "constants", rb_mod_s_constants, -1); VALUE cTopLevel = *(VALUE *)rb_vm_top_self(); rb_objc_define_method(cTopLevel, "include", top_include, -1); rb_objc_define_method(rb_mKernel, "extend", rb_obj_extend, -1); rb_objc_define_module_function(rb_mKernel, "trace_var", rb_f_trace_var, -1); /* in variable.c */ rb_objc_define_module_function(rb_mKernel, "untrace_var", rb_f_untrace_var, -1); /* in variable.c */ rb_define_virtual_variable("$SAFE", safe_getter, safe_setter); exception_error = rb_exc_new2(rb_eFatal, "exception reentered"); //rb_ivar_set(exception_error, idThrowState, INT2FIX(TAG_FATAL)); GC_RETAIN(exception_error); }
void Init_eval_method(void) { rb_objc_define_method(rb_mKernel, "respond_to?", obj_respond_to, -1); rb_objc_define_method(rb_mKernel, "respond_to_missing?", obj_respond_to_missing, 2); selRespondToDefault = sel_registerName("respond_to_missing?:"); basic_respond_to_imp = class_getMethodImplementation((Class)rb_mKernel, selRespondTo); rb_objc_define_private_method(rb_cModule, "remove_method", rb_mod_remove_method, -1); rb_objc_define_private_method(rb_cModule, "undef_method", rb_mod_undef_method, -1); rb_objc_define_private_method(rb_cModule, "alias_method", rb_mod_alias_method, 2); rb_objc_define_private_method(rb_cModule, "public", rb_mod_public, -1); rb_objc_define_private_method(rb_cModule, "protected", rb_mod_protected, -1); rb_objc_define_private_method(rb_cModule, "private", rb_mod_private, -1); rb_objc_define_private_method(rb_cModule, "module_function", rb_mod_modfunc, -1); rb_objc_define_method(rb_cModule, "method_defined?", rb_mod_method_defined, 1); rb_objc_define_method(rb_cModule, "public_method_defined?", rb_mod_public_method_defined, 1); rb_objc_define_method(rb_cModule, "private_method_defined?", rb_mod_private_method_defined, 1); rb_objc_define_method(rb_cModule, "protected_method_defined?", rb_mod_protected_method_defined, 1); rb_objc_define_method(rb_cModule, "public_class_method", rb_mod_public_method, -1); rb_objc_define_method(rb_cModule, "private_class_method", rb_mod_private_method, -1); VALUE cTopLevel = *(VALUE *)rb_vm_top_self(); rb_objc_define_method(cTopLevel, "public", top_public, -1); rb_objc_define_method(cTopLevel, "private", top_private, -1); object_id = rb_intern("object_id"); __send__ = rb_intern("__send__"); eqq = rb_intern("==="); each = rb_intern("each"); aref = rb_intern("[]"); aset = rb_intern("[]="); match = rb_intern("=~"); missing = rb_intern("method_missing"); added = rb_intern("method_added"); singleton_added = rb_intern("singleton_method_added"); removed = rb_intern("method_removed"); singleton_removed = rb_intern("singleton_method_removed"); undefined = rb_intern("method_undefined"); singleton_undefined = rb_intern("singleton_method_undefined"); }
void Init_ossl_ssl() { int i; VALUE ary; #if 0 /* let rdoc know about mOSSL */ mOSSL = rb_define_module("OpenSSL"); #endif ID_callback_state = rb_intern("@callback_state"); ossl_ssl_ex_vcb_idx = SSL_get_ex_new_index(0,(void *)"ossl_ssl_ex_vcb_idx",0,0,0); ossl_ssl_ex_store_p = SSL_get_ex_new_index(0,(void *)"ossl_ssl_ex_store_p",0,0,0); ossl_ssl_ex_ptr_idx = SSL_get_ex_new_index(0,(void *)"ossl_ssl_ex_ptr_idx",0,0,0); ossl_ssl_ex_client_cert_cb_idx = SSL_get_ex_new_index(0,(void *)"ossl_ssl_ex_client_cert_cb_idx",0,0,0); ossl_ssl_ex_tmp_dh_callback_idx = SSL_get_ex_new_index(0,(void *)"ossl_ssl_ex_tmp_dh_callback_idx",0,0,0); mSSL = rb_define_module_under(mOSSL, "SSL"); eSSLError = rb_define_class_under(mSSL, "SSLError", eOSSLError); Init_ossl_ssl_session(); /* class SSLContext * * The following attributes are available but don't show up in rdoc. * All attributes must be set before calling SSLSocket.new(io, ctx). * * ssl_version, cert, key, client_ca, ca_file, ca_path, timeout, * * verify_mode, verify_depth client_cert_cb, tmp_dh_callback, * * session_id_context, session_add_cb, session_new_cb, session_remove_cb */ cSSLContext = rb_define_class_under(mSSL, "SSLContext", rb_cObject); rb_objc_define_method(*(VALUE *)cSSLContext, "alloc", ossl_sslctx_s_alloc, 0); for(i = 0; i < numberof(ossl_sslctx_attrs); i++) rb_attr(cSSLContext, rb_intern(ossl_sslctx_attrs[i]), 1, 1, Qfalse); rb_define_alias(cSSLContext, "ssl_timeout", "timeout"); rb_define_alias(cSSLContext, "ssl_timeout=", "timeout="); rb_objc_define_method(cSSLContext, "initialize", ossl_sslctx_initialize, -1); rb_objc_define_method(cSSLContext, "ssl_version=", ossl_sslctx_set_ssl_version, 1); rb_objc_define_method(cSSLContext, "ciphers", ossl_sslctx_get_ciphers, 0); rb_objc_define_method(cSSLContext, "ciphers=", ossl_sslctx_set_ciphers, 1); rb_objc_define_method(cSSLContext, "setup", ossl_sslctx_setup, 0); rb_define_const(cSSLContext, "SESSION_CACHE_OFF", LONG2FIX(SSL_SESS_CACHE_OFF)); rb_define_const(cSSLContext, "SESSION_CACHE_CLIENT", LONG2FIX(SSL_SESS_CACHE_CLIENT)); /* doesn't actually do anything in 0.9.8e */ rb_define_const(cSSLContext, "SESSION_CACHE_SERVER", LONG2FIX(SSL_SESS_CACHE_SERVER)); rb_define_const(cSSLContext, "SESSION_CACHE_BOTH", LONG2FIX(SSL_SESS_CACHE_BOTH)); /* no different than CACHE_SERVER in 0.9.8e */ rb_define_const(cSSLContext, "SESSION_CACHE_NO_AUTO_CLEAR", LONG2FIX(SSL_SESS_CACHE_NO_AUTO_CLEAR)); rb_define_const(cSSLContext, "SESSION_CACHE_NO_INTERNAL_LOOKUP", LONG2FIX(SSL_SESS_CACHE_NO_INTERNAL_LOOKUP)); rb_define_const(cSSLContext, "SESSION_CACHE_NO_INTERNAL_STORE", LONG2FIX(SSL_SESS_CACHE_NO_INTERNAL_STORE)); rb_define_const(cSSLContext, "SESSION_CACHE_NO_INTERNAL", LONG2FIX(SSL_SESS_CACHE_NO_INTERNAL)); rb_objc_define_method(cSSLContext, "session_add", ossl_sslctx_session_add, 1); rb_objc_define_method(cSSLContext, "session_remove", ossl_sslctx_session_remove, 1); rb_objc_define_method(cSSLContext, "session_cache_mode", ossl_sslctx_get_session_cache_mode, 0); rb_objc_define_method(cSSLContext, "session_cache_mode=", ossl_sslctx_set_session_cache_mode, 1); rb_objc_define_method(cSSLContext, "session_cache_size", ossl_sslctx_get_session_cache_size, 0); rb_objc_define_method(cSSLContext, "session_cache_size=", ossl_sslctx_set_session_cache_size, 1); rb_objc_define_method(cSSLContext, "session_cache_stats", ossl_sslctx_get_session_cache_stats, 0); rb_objc_define_method(cSSLContext, "flush_sessions", ossl_sslctx_flush_sessions, -1); ary = rb_ary_new2(numberof(ossl_ssl_method_tab)); for (i = 0; i < numberof(ossl_ssl_method_tab); i++) { rb_ary_push(ary, ID2SYM(rb_intern(ossl_ssl_method_tab[i].name))); } rb_obj_freeze(ary); /* holds a list of available SSL/TLS methods */ rb_define_const(cSSLContext, "METHODS", ary); /* class SSLSocket * * The following attributes are available but don't show up in rdoc. * * io, context, sync_close * */ cSSLSocket = rb_define_class_under(mSSL, "SSLSocket", rb_cObject); rb_objc_define_method(*(VALUE *)cSSLSocket, "alloc", ossl_ssl_s_alloc, 0); for(i = 0; i < numberof(ossl_ssl_attr_readers); i++) rb_attr(cSSLSocket, rb_intern(ossl_ssl_attr_readers[i]), 1, 0, Qfalse); for(i = 0; i < numberof(ossl_ssl_attrs); i++) rb_attr(cSSLSocket, rb_intern(ossl_ssl_attrs[i]), 1, 1, Qfalse); rb_define_alias(cSSLSocket, "to_io", "io"); rb_objc_define_method(cSSLSocket, "initialize", ossl_ssl_initialize, -1); rb_objc_define_method(cSSLSocket, "connect", ossl_ssl_connect, 0); rb_objc_define_method(cSSLSocket, "connect_nonblock", ossl_ssl_connect_nonblock, 0); rb_objc_define_method(cSSLSocket, "accept", ossl_ssl_accept, 0); rb_objc_define_method(cSSLSocket, "accept_nonblock", ossl_ssl_accept_nonblock, 0); rb_objc_define_method(cSSLSocket, "sysread", ossl_ssl_read, -1); rb_objc_define_private_method(cSSLSocket, "sysread_nonblock", ossl_ssl_read_nonblock, -1); rb_objc_define_method(cSSLSocket, "syswrite", ossl_ssl_write, 1); rb_objc_define_private_method(cSSLSocket, "syswrite_nonblock", ossl_ssl_write_nonblock, 1); rb_objc_define_method(cSSLSocket, "sysclose", ossl_ssl_close, 0); rb_objc_define_method(cSSLSocket, "cert", ossl_ssl_get_cert, 0); rb_objc_define_method(cSSLSocket, "peer_cert", ossl_ssl_get_peer_cert, 0); rb_objc_define_method(cSSLSocket, "peer_cert_chain", ossl_ssl_get_peer_cert_chain, 0); rb_objc_define_method(cSSLSocket, "cipher", ossl_ssl_get_cipher, 0); rb_objc_define_method(cSSLSocket, "state", ossl_ssl_get_state, 0); rb_objc_define_method(cSSLSocket, "pending", ossl_ssl_pending, 0); rb_objc_define_method(cSSLSocket, "session_reused?", ossl_ssl_session_reused, 0); rb_objc_define_method(cSSLSocket, "session=", ossl_ssl_set_session, 1); rb_objc_define_method(cSSLSocket, "verify_result", ossl_ssl_get_verify_result, 0); #define ossl_ssl_def_const(x) rb_define_const(mSSL, #x, INT2NUM(SSL_##x)) ossl_ssl_def_const(VERIFY_NONE); ossl_ssl_def_const(VERIFY_PEER); ossl_ssl_def_const(VERIFY_FAIL_IF_NO_PEER_CERT); ossl_ssl_def_const(VERIFY_CLIENT_ONCE); /* Introduce constants included in OP_ALL. These constants are mostly for * unset some bits in OP_ALL such as; * ctx.options = OP_ALL & ~OP_DONT_INSERT_EMPTY_FRAGMENTS */ ossl_ssl_def_const(OP_MICROSOFT_SESS_ID_BUG); ossl_ssl_def_const(OP_NETSCAPE_CHALLENGE_BUG); ossl_ssl_def_const(OP_NETSCAPE_REUSE_CIPHER_CHANGE_BUG); ossl_ssl_def_const(OP_SSLREF2_REUSE_CERT_TYPE_BUG); ossl_ssl_def_const(OP_MICROSOFT_BIG_SSLV3_BUFFER); ossl_ssl_def_const(OP_MSIE_SSLV2_RSA_PADDING); ossl_ssl_def_const(OP_SSLEAY_080_CLIENT_DH_BUG); ossl_ssl_def_const(OP_TLS_D5_BUG); ossl_ssl_def_const(OP_TLS_BLOCK_PADDING_BUG); ossl_ssl_def_const(OP_DONT_INSERT_EMPTY_FRAGMENTS); ossl_ssl_def_const(OP_ALL); #if defined(SSL_OP_NO_SESSION_RESUMPTION_ON_RENEGOTIATION) ossl_ssl_def_const(OP_NO_SESSION_RESUMPTION_ON_RENEGOTIATION); #endif #if defined(SSL_OP_SINGLE_ECDH_USE) ossl_ssl_def_const(OP_SINGLE_ECDH_USE); #endif ossl_ssl_def_const(OP_SINGLE_DH_USE); ossl_ssl_def_const(OP_EPHEMERAL_RSA); #if defined(SSL_OP_CIPHER_SERVER_PREFERENCE) ossl_ssl_def_const(OP_CIPHER_SERVER_PREFERENCE); #endif ossl_ssl_def_const(OP_TLS_ROLLBACK_BUG); ossl_ssl_def_const(OP_NO_SSLv2); ossl_ssl_def_const(OP_NO_SSLv3); ossl_ssl_def_const(OP_NO_TLSv1); #if defined(SSL_OP_NO_TICKET) ossl_ssl_def_const(OP_NO_TICKET); #endif ossl_ssl_def_const(OP_PKCS1_CHECK_1); ossl_ssl_def_const(OP_PKCS1_CHECK_2); ossl_ssl_def_const(OP_NETSCAPE_CA_DN_BUG); ossl_ssl_def_const(OP_NETSCAPE_DEMO_CIPHER_CHANGE_BUG); ossl_lock_init(); }
void Init_Proc(void) { /* Proc */ rb_cProc = rb_define_class("Proc", rb_cObject); rb_undef_alloc_func(rb_cProc); rb_objc_define_method(*(VALUE *)rb_cProc, "new", rb_proc_s_new, -1); rb_objc_define_method(rb_cProc, "call", proc_call, -1); rb_objc_define_method(rb_cProc, "[]", proc_call, -1); rb_objc_define_method(rb_cProc, "===", proc_call, -1); rb_objc_define_method(rb_cProc, "yield", proc_call, -1); rb_objc_define_method(rb_cProc, "to_proc", proc_to_proc, 0); rb_objc_define_method(rb_cProc, "arity", proc_arity, 0); rb_objc_define_method(rb_cProc, "clone", proc_clone, 0); rb_objc_define_method(rb_cProc, "dup", proc_dup, 0); rb_objc_define_method(rb_cProc, "==", proc_eq, 1); rb_objc_define_method(rb_cProc, "eql?", proc_eq, 1); rb_objc_define_method(rb_cProc, "hash", proc_hash, 0); rb_objc_define_method(rb_cProc, "to_s", proc_to_s, 0); rb_objc_define_method(rb_cProc, "lambda?", proc_lambda_p, 0); rb_objc_define_method(rb_cProc, "binding", proc_binding, 0); rb_objc_define_method(rb_cProc, "curry", proc_curry, -1); /* Exceptions */ rb_eLocalJumpError = rb_define_class("LocalJumpError", rb_eStandardError); rb_objc_define_method(rb_eLocalJumpError, "exit_value", localjump_xvalue, 0); rb_objc_define_method(rb_eLocalJumpError, "reason", localjump_reason, 0); rb_eSysStackError = rb_define_class("SystemStackError", rb_eException); sysstack_error = rb_exc_new2(rb_eSysStackError, "stack level too deep"); OBJ_TAINT(sysstack_error); GC_RETAIN(sysstack_error); /* utility functions */ rb_objc_define_module_function(rb_mKernel, "proc", rb_block_proc_imp, 0); rb_objc_define_module_function(rb_mKernel, "lambda", proc_lambda, 0); /* Method */ rb_cMethod = rb_define_class("Method", rb_cObject); rb_undef_alloc_func(rb_cMethod); rb_undef_method(CLASS_OF(rb_cMethod), "new"); rb_objc_define_method(rb_cMethod, "==", method_eq, 1); rb_objc_define_method(rb_cMethod, "eql?", method_eq, 1); rb_objc_define_method(rb_cMethod, "hash", method_hash, 0); rb_objc_define_method(rb_cMethod, "clone", method_clone, 0); rb_objc_define_method(rb_cMethod, "call", rb_method_call, -1); rb_objc_define_method(rb_cMethod, "[]", rb_method_call, -1); rb_objc_define_method(rb_cMethod, "arity", method_arity_m, 0); rb_objc_define_method(rb_cMethod, "inspect", method_inspect, 0); rb_objc_define_method(rb_cMethod, "to_s", method_inspect, 0); rb_objc_define_method(rb_cMethod, "to_proc", method_proc, 0); rb_objc_define_method(rb_cMethod, "receiver", method_receiver, 0); rb_objc_define_method(rb_cMethod, "name", method_name, 0); rb_objc_define_method(rb_cMethod, "owner", method_owner, 0); rb_objc_define_method(rb_cMethod, "unbind", method_unbind, 0); rb_objc_define_method(rb_mKernel, "method", rb_obj_method, 1); rb_objc_define_method(rb_mKernel, "public_method", rb_obj_public_method, 1); /* UnboundMethod */ rb_cUnboundMethod = rb_define_class("UnboundMethod", rb_cObject); rb_undef_alloc_func(rb_cUnboundMethod); rb_undef_method(CLASS_OF(rb_cUnboundMethod), "new"); rb_objc_define_method(rb_cUnboundMethod, "==", method_eq, 1); rb_objc_define_method(rb_cUnboundMethod, "eql?", method_eq, 1); rb_objc_define_method(rb_cUnboundMethod, "hash", method_hash, 0); rb_objc_define_method(rb_cUnboundMethod, "clone", method_clone, 0); rb_objc_define_method(rb_cUnboundMethod, "arity", method_arity_m, 0); rb_objc_define_method(rb_cUnboundMethod, "inspect", method_inspect, 0); rb_objc_define_method(rb_cUnboundMethod, "to_s", method_inspect, 0); rb_objc_define_method(rb_cUnboundMethod, "name", method_name, 0); rb_objc_define_method(rb_cUnboundMethod, "owner", method_owner, 0); rb_objc_define_method(rb_cUnboundMethod, "bind", umethod_bind, 1); /* Module#*_method */ rb_objc_define_method(rb_cModule, "instance_method", rb_mod_instance_method, 1); rb_objc_define_method(rb_cModule, "public_instance_method", rb_mod_public_instance_method, 1); rb_objc_define_private_method(rb_cModule, "define_method", rb_mod_define_method, -1); /* Kernel */ rb_objc_define_method(rb_mKernel, "define_singleton_method", rb_obj_define_method, -1); }