void _init_type_array() { rb_cTypeArray = rb_define_class("TypeArray", rb_cObject); rb_include_module(rb_cTypeArray, rb_mEnumerable); rb_type_array_intern_aget = rb_intern("[]"); rb_type_array_intern_aset = rb_intern("[]="); rb_type_array_intern_superclass = rb_intern("superclass"); rb_cInt8Array = rb_define_class("Int8Array", rb_cTypeArray); rb_cUInt8Array = rb_define_class("UInt8Array", rb_cTypeArray); rb_cInt16Array = rb_define_class("Int16Array", rb_cTypeArray); rb_cUInt16Array = rb_define_class("UInt16Array", rb_cTypeArray); rb_cInt32Array = rb_define_class("Int32Array", rb_cTypeArray); rb_cUInt32Array = rb_define_class("UInt32Array", rb_cTypeArray); rb_cFloat32Array = rb_define_class("Float32Array", rb_cTypeArray); rb_cFloat64Array = rb_define_class("Float64Array", rb_cTypeArray); rb_cStructArray = rb_define_class("StructArray", rb_cTypeArray); rb_define_const(rb_cInt8Array, "BYTES_PER_ELEMENT", ULONG2NUM(sizeof(signed char))); rb_define_const(rb_cUInt8Array, "BYTES_PER_ELEMENT", ULONG2NUM(sizeof(unsigned char))); rb_define_const(rb_cInt16Array, "BYTES_PER_ELEMENT", ULONG2NUM(sizeof(short))); rb_define_const(rb_cUInt16Array, "BYTES_PER_ELEMENT", ULONG2NUM(sizeof(unsigned short))); rb_define_const(rb_cInt32Array, "BYTES_PER_ELEMENT", ULONG2NUM(sizeof(int))); rb_define_const(rb_cUInt32Array, "BYTES_PER_ELEMENT", ULONG2NUM(sizeof(unsigned int))); rb_define_const(rb_cFloat32Array, "BYTES_PER_ELEMENT", ULONG2NUM(sizeof(float))); rb_define_const(rb_cFloat64Array, "BYTES_PER_ELEMENT", ULONG2NUM(sizeof(double))); rb_define_const(rb_cStructArray, "BYTES_PER_ELEMENT", INT2NUM(0)); rb_require("struct_type"); rb_cStructType = rb_const_get(rb_cObject, rb_intern("StructType")); rb_define_singleton_method(rb_cTypeArray, "new", rb_type_array_s_new, -1); rb_define_singleton_method(rb_cStructArray, "new", rb_struct_array_s_new, -1); rb_define_method(rb_cTypeArray, "byte_length", rb_type_array_byte_length, 0); rb_define_method(rb_cTypeArray, "length", rb_type_array_length, 0); rb_define_method(rb_cTypeArray, "buffer", rb_type_array_buffer, 0); rb_define_method(rb_cTypeArray, "byte_offset", rb_type_array_byte_offset, 0); rb_define_method(rb_cTypeArray, "to_s", rb_type_array_to_s, 0); rb_define_method(rb_cTypeArray, "[]=", rb_type_array_aset, 2); rb_define_method(rb_cTypeArray, "[]", rb_type_array_aget, 1); rb_define_method(rb_cTypeArray, "mul", rb_type_array_mul, -1); rb_define_method(rb_cTypeArray, "plus", rb_type_array_plus, -1); rb_define_method(rb_cTypeArray, "minus", rb_type_array_minus, -1); rb_define_method(rb_cTypeArray, "div", rb_type_array_div, -1); rb_define_method(rb_cTypeArray, "eql", rb_type_array_eql, 2); rb_define_method(rb_cTypeArray, "each", rb_type_array_each, 0); rb_define_method(rb_cStructArray, "struct_type", rb_type_array_struct_type, 0); rb_undef(rb_cStructArray, rb_intern("mul")); rb_undef(rb_cStructArray, rb_intern("plus")); rb_undef(rb_cStructArray, rb_intern("minus")); rb_undef(rb_cStructArray, rb_intern("div")); rb_undef(rb_cStructArray, rb_intern("eql")); }
/* =================== INIT LIB =====================*/ void init_curb_postfield() { VALUE sc; idCall = rb_intern("call"); cCurlPostField = rb_define_class_under(mCurl, "PostField", rb_cObject); /* Class methods */ rb_define_singleton_method(cCurlPostField, "content", ruby_curl_postfield_new_content, -1); rb_define_singleton_method(cCurlPostField, "file", ruby_curl_postfield_new_file, -1); sc = rb_singleton_class(cCurlPostField); rb_undef(sc, rb_intern("new")); rb_define_method(cCurlPostField, "name=", ruby_curl_postfield_name_set, 1); rb_define_method(cCurlPostField, "name", ruby_curl_postfield_name_get, 0); rb_define_method(cCurlPostField, "content=", ruby_curl_postfield_content_set, 1); rb_define_method(cCurlPostField, "content", ruby_curl_postfield_content_get, 0); rb_define_method(cCurlPostField, "content_type=", ruby_curl_postfield_content_type_set, 1); rb_define_method(cCurlPostField, "content_type", ruby_curl_postfield_content_type_get, 0); rb_define_method(cCurlPostField, "local_file=", ruby_curl_postfield_local_file_set, 1); rb_define_method(cCurlPostField, "local_file", ruby_curl_postfield_local_file_get, 0); rb_define_method(cCurlPostField, "remote_file=", ruby_curl_postfield_remote_file_set, 1); rb_define_method(cCurlPostField, "remote_file", ruby_curl_postfield_remote_file_get, 0); rb_define_method(cCurlPostField, "set_content_proc", ruby_curl_postfield_content_proc_set, -1); rb_define_method(cCurlPostField, "to_str", ruby_curl_postfield_to_str, 0); rb_define_alias(cCurlPostField, "to_s", "to_str"); }
static VALUE rb_mod_undef_method(VALUE mod, SEL sel, int argc, VALUE *argv) { for (int i = 0; i < argc; i++) { rb_undef(mod, rb_to_id(argv[i])); } return mod; }
static VALUE rb_mod_undef_method(int argc, VALUE *argv, VALUE mod) { int i; for (i = 0; i < argc; i++) { rb_undef(mod, rb_to_id(argv[i])); } return mod; }
static VALUE rb_mod_undef_method(int argc, VALUE *argv, VALUE mod) { int i; for (i = 0; i < argc; i++) { VALUE v = argv[i]; ID id = rb_check_id(&v); if (!id) { rb_method_name_error(mod, v); } rb_undef(mod, id); } return mod; }
static VALUE module_specs_rb_undef(VALUE self, VALUE cls, VALUE symbol_name) { rb_undef(cls, SYM2ID(symbol_name)); return Qnil; }
void rb_undef_method(VALUE module, const char *name) { rb_undef(module, rb_str_new_cstr(name)); }