Example #1
0
void init_xml_syntax_error()
{
  VALUE nokogiri = rb_define_module("Nokogiri");
  VALUE xml = rb_define_module_under(nokogiri, "XML");

  /*
   * The XML::SyntaxError is raised on parse errors
   */
  VALUE syntax_error_mommy = rb_define_class_under(nokogiri, "SyntaxError", rb_eStandardError);
  VALUE klass = rb_define_class_under(xml, "SyntaxError", syntax_error_mommy);
  cNokogiriXmlSyntaxError = klass;

}
Example #2
0
void init_drizzle_result()
{
  DrizzleResult = rb_define_module_under(DownpourModule, "Result");
  rb_define_method(DrizzleResult, "buffered?", is_buffered, 0);
  define_attr(column_count);
  define_attr(insert_id);
  define_attr(error_code);
  define_attr(affected_rows);
  define_attr(warning_count);
  define_attr(sqlstate);
  define_attr(info);
  define_attr(error);
}
Example #3
0
void
rbffi_Platform_Init(VALUE moduleFFI)
{
    PlatformModule = rb_define_module_under(moduleFFI, "Platform");
    rb_define_const(PlatformModule, "BYTE_ORDER", INT2FIX(BYTE_ORDER));
    rb_define_const(PlatformModule, "LITTLE_ENDIAN", INT2FIX(LITTLE_ENDIAN));
    rb_define_const(PlatformModule, "BIG_ENDIAN", INT2FIX(BIG_ENDIAN));
    rb_define_const(PlatformModule, "CPU", rb_str_new2(CPU));
#if defined(__linux__) || defined(__GNU__) || defined(__GLIBC__)
    rb_define_const(PlatformModule, "GNU_LIBC", rb_str_new2(LIBC_SO));
#endif
    export_primitive_types(PlatformModule);
}
Example #4
0
void Init_do_mysql() {
  data_objects_common_init();

  // Top Level Module that all the classes live under
  mMysql    = rb_define_module_under(mDO, "Mysql");
  mEncoding = rb_define_module_under(mMysql, "Encoding");

  cMysqlConnection = rb_define_class_under(mMysql, "Connection", cDO_Connection);
  rb_define_method(cMysqlConnection, "initialize", do_mysql_cConnection_initialize, 1);
  rb_define_method(cMysqlConnection, "using_socket?", data_objects_cConnection_is_using_socket, 0);
  rb_define_method(cMysqlConnection, "ssl_cipher", data_objects_cConnection_ssl_cipher, 0);
  rb_define_method(cMysqlConnection, "character_set", data_objects_cConnection_character_set , 0);
  rb_define_method(cMysqlConnection, "dispose", do_mysql_cConnection_dispose, 0);
  rb_define_method(cMysqlConnection, "quote_string", do_mysql_cConnection_quote_string, 1);
  rb_define_method(cMysqlConnection, "quote_date", data_objects_cConnection_quote_date, 1);
  rb_define_method(cMysqlConnection, "quote_time", data_objects_cConnection_quote_time, 1);
  rb_define_method(cMysqlConnection, "quote_datetime", data_objects_cConnection_quote_date_time, 1);

  cMysqlCommand = rb_define_class_under(mMysql, "Command", cDO_Command);
  rb_define_method(cMysqlCommand, "set_types", data_objects_cCommand_set_types, -1);
  rb_define_method(cMysqlCommand, "execute_non_query", do_mysql_cCommand_execute_non_query, -1);
  rb_define_method(cMysqlCommand, "execute_reader", do_mysql_cCommand_execute_reader, -1);

  // Non-Query result
  cMysqlResult = rb_define_class_under(mMysql, "Result", cDO_Result);

  // Query result
  cMysqlReader = rb_define_class_under(mMysql, "Reader", cDO_Reader);
  rb_define_method(cMysqlReader, "close", do_mysql_cReader_close, 0);
  rb_define_method(cMysqlReader, "next!", do_mysql_cReader_next, 0);
  rb_define_method(cMysqlReader, "values", data_objects_cReader_values, 0);
  rb_define_method(cMysqlReader, "fields", data_objects_cReader_fields, 0);
  rb_define_method(cMysqlReader, "field_count", data_objects_cReader_field_count, 0);

  rb_global_variable(&cMysqlResult);
  rb_global_variable(&cMysqlReader);

  data_objects_define_errors(mMysql, do_mysql_errors);
}
Example #5
0
void
Init_gtk_gdk_input(VALUE mGdk)
{
    VALUE RG_TARGET_NAMESPACE = rb_define_module_under(mGdk, "Input");

    RG_DEF_MODFUNC(add, 2);
    RG_DEF_MODFUNC(remove, 1);

    /* GdkInputCondition */
    G_DEF_CLASS(GDK_TYPE_INPUT_CONDITION, "Condition", RG_TARGET_NAMESPACE);
    G_DEF_CONSTANTS(RG_TARGET_NAMESPACE, GDK_TYPE_INPUT_CONDITION, "GDK_INPUT_");

}
Example #6
0
void Init_fresnel(VALUE module)
{
  VALUE mfresnel;
  mfresnel = rb_define_module_under(module, "Fresnel");
  rb_define_module_function(module, "fresnel_c", rb_fresnel_c, 1);
  rb_define_module_function(module, "fresnel_s", rb_fresnel_s, 1);
  rb_define_module_function(module, "fresnel_c1", rb_fresnel_c1, 1);
  rb_define_module_function(module, "fresnel_s1", rb_fresnel_s1, 1);
  rb_define_module_function(mfresnel, "c", rb_fresnel_c, 1);
  rb_define_module_function(mfresnel, "s", rb_fresnel_s, 1);
  rb_define_module_function(mfresnel, "c1", rb_fresnel_c1, 1);
  rb_define_module_function(mfresnel, "s1", rb_fresnel_s1, 1);
}
Example #7
0
static void Init_grpc_error_codes() {
  /* Constants representing the error codes of grpc_call_error in grpc.h */
  VALUE grpc_rb_mRpcErrors =
      rb_define_module_under(grpc_rb_mGrpcCore, "RpcErrors");
  rb_define_const(grpc_rb_mRpcErrors, "OK", UINT2NUM(GRPC_CALL_OK));
  rb_define_const(grpc_rb_mRpcErrors, "ERROR", UINT2NUM(GRPC_CALL_ERROR));
  rb_define_const(grpc_rb_mRpcErrors, "NOT_ON_SERVER",
                  UINT2NUM(GRPC_CALL_ERROR_NOT_ON_SERVER));
  rb_define_const(grpc_rb_mRpcErrors, "NOT_ON_CLIENT",
                  UINT2NUM(GRPC_CALL_ERROR_NOT_ON_CLIENT));
  rb_define_const(grpc_rb_mRpcErrors, "ALREADY_ACCEPTED",
                  UINT2NUM(GRPC_CALL_ERROR_ALREADY_ACCEPTED));
  rb_define_const(grpc_rb_mRpcErrors, "ALREADY_INVOKED",
                  UINT2NUM(GRPC_CALL_ERROR_ALREADY_INVOKED));
  rb_define_const(grpc_rb_mRpcErrors, "NOT_INVOKED",
                  UINT2NUM(GRPC_CALL_ERROR_NOT_INVOKED));
  rb_define_const(grpc_rb_mRpcErrors, "ALREADY_FINISHED",
                  UINT2NUM(GRPC_CALL_ERROR_ALREADY_FINISHED));
  rb_define_const(grpc_rb_mRpcErrors, "TOO_MANY_OPERATIONS",
                  UINT2NUM(GRPC_CALL_ERROR_TOO_MANY_OPERATIONS));
  rb_define_const(grpc_rb_mRpcErrors, "INVALID_FLAGS",
                  UINT2NUM(GRPC_CALL_ERROR_INVALID_FLAGS));

  /* Add the detail strings to a Hash */
  rb_error_code_details = rb_hash_new();
  rb_hash_aset(rb_error_code_details, UINT2NUM(GRPC_CALL_OK),
               rb_str_new2("ok"));
  rb_hash_aset(rb_error_code_details, UINT2NUM(GRPC_CALL_ERROR),
               rb_str_new2("unknown error"));
  rb_hash_aset(rb_error_code_details, UINT2NUM(GRPC_CALL_ERROR_NOT_ON_SERVER),
               rb_str_new2("not available on a server"));
  rb_hash_aset(rb_error_code_details, UINT2NUM(GRPC_CALL_ERROR_NOT_ON_CLIENT),
               rb_str_new2("not available on a client"));
  rb_hash_aset(rb_error_code_details,
               UINT2NUM(GRPC_CALL_ERROR_ALREADY_ACCEPTED),
               rb_str_new2("call is already accepted"));
  rb_hash_aset(rb_error_code_details, UINT2NUM(GRPC_CALL_ERROR_ALREADY_INVOKED),
               rb_str_new2("call is already invoked"));
  rb_hash_aset(rb_error_code_details, UINT2NUM(GRPC_CALL_ERROR_NOT_INVOKED),
               rb_str_new2("call is not yet invoked"));
  rb_hash_aset(rb_error_code_details,
               UINT2NUM(GRPC_CALL_ERROR_ALREADY_FINISHED),
               rb_str_new2("call is already finished"));
  rb_hash_aset(rb_error_code_details,
               UINT2NUM(GRPC_CALL_ERROR_TOO_MANY_OPERATIONS),
               rb_str_new2("outstanding read or write present"));
  rb_hash_aset(rb_error_code_details, UINT2NUM(GRPC_CALL_ERROR_INVALID_FLAGS),
               rb_str_new2("a bad flag was given"));
  rb_define_const(grpc_rb_mRpcErrors, "ErrorMessages", rb_error_code_details);
  rb_obj_freeze(rb_error_code_details);
}
Example #8
0
void MessagePack_Unpacker_module_init(VALUE mMessagePack)
{
    msgpack_unpacker_static_init();
    msgpack_unpacker_ext_registry_static_init();

    mTypeError = rb_define_module_under(mMessagePack, "TypeError");

    cMessagePack_Unpacker = rb_define_class_under(mMessagePack, "Unpacker", rb_cObject);

    eUnpackError = rb_define_class_under(mMessagePack, "UnpackError", rb_eStandardError);

    eMalformedFormatError = rb_define_class_under(mMessagePack, "MalformedFormatError", eUnpackError);

    eStackError = rb_define_class_under(mMessagePack, "StackError", eUnpackError);

    eUnexpectedTypeError = rb_define_class_under(mMessagePack, "UnexpectedTypeError", eUnpackError);
    rb_include_module(eUnexpectedTypeError, mTypeError);

    eUnknownExtTypeError = rb_define_class_under(mMessagePack, "UnknownExtTypeError", eUnpackError);

    rb_define_alloc_func(cMessagePack_Unpacker, MessagePack_Unpacker_alloc);

    rb_define_method(cMessagePack_Unpacker, "initialize", MessagePack_Unpacker_initialize, -1);
    rb_define_method(cMessagePack_Unpacker, "symbolize_keys?", Unpacker_symbolized_keys_p, 0);
    rb_define_method(cMessagePack_Unpacker, "allow_unknown_ext?", Unpacker_allow_unknown_ext_p, 0);
    rb_define_method(cMessagePack_Unpacker, "buffer", Unpacker_buffer, 0);
    rb_define_method(cMessagePack_Unpacker, "read", Unpacker_read, 0);
    rb_define_alias(cMessagePack_Unpacker, "unpack", "read");
    rb_define_method(cMessagePack_Unpacker, "skip", Unpacker_skip, 0);
    rb_define_method(cMessagePack_Unpacker, "skip_nil", Unpacker_skip_nil, 0);
    rb_define_method(cMessagePack_Unpacker, "read_array_header", Unpacker_read_array_header, 0);
    rb_define_method(cMessagePack_Unpacker, "read_map_header", Unpacker_read_map_header, 0);
    //rb_define_method(cMessagePack_Unpacker, "peek_next_type", Unpacker_peek_next_type, 0);  // TODO
    rb_define_method(cMessagePack_Unpacker, "feed", Unpacker_feed, 1);
    rb_define_method(cMessagePack_Unpacker, "each", Unpacker_each, 0);
    rb_define_method(cMessagePack_Unpacker, "feed_each", Unpacker_feed_each, 1);
    rb_define_method(cMessagePack_Unpacker, "reset", Unpacker_reset, 0);

    rb_define_private_method(cMessagePack_Unpacker, "registered_types_internal", Unpacker_registered_types_internal, 0);
    rb_define_method(cMessagePack_Unpacker, "register_type", Unpacker_register_type, -1);

    //s_unpacker_value = MessagePack_Unpacker_alloc(cMessagePack_Unpacker);
    //rb_gc_register_address(&s_unpacker_value);
    //Data_Get_Struct(s_unpacker_value, msgpack_unpacker_t, s_unpacker);
    /* prefer reference than copying */
    //msgpack_buffer_set_write_reference_threshold(UNPACKER_BUFFER_(s_unpacker), 0);

    /* MessagePack.unpack(x) */
    rb_define_module_function(mMessagePack, "load", MessagePack_load_module_method, -1);
    rb_define_module_function(mMessagePack, "unpack", MessagePack_unpack_module_method, -1);
}
Example #9
0
void
Init_glib_shell()
{
    VALUE mShell = rb_define_module_under(mGLib, "Shell");
    VALUE cShellError = G_DEF_ERROR2(G_SHELL_ERROR, "ShellError", mGLib, rb_eRuntimeError);

    rb_define_module_function(mShell, "parse", shell_parse, 1);
    rb_define_module_function(mShell, "quote", shell_quote, 1);
    rb_define_module_function(mShell, "unquote", shell_unquote, 1);

    rb_define_const(cShellError, "BAD_QUOTING", INT2FIX(G_SHELL_ERROR_BAD_QUOTING));
    rb_define_const(cShellError, "EMPTY_STRING", INT2FIX(G_SHELL_ERROR_EMPTY_STRING));
    rb_define_const(cShellError, "FAILED", INT2FIX(G_SHELL_ERROR_FAILED));
}
Example #10
0
void init_kgio_autopush(void)
{
	VALUE mKgio = rb_define_module("Kgio");
	VALUE tmp;

	rb_define_singleton_method(mKgio, "autopush?", s_get_autopush, 0);
	rb_define_singleton_method(mKgio, "autopush=", s_set_autopush, 1);

	tmp = rb_define_module_under(mKgio, "SocketMethods");
	rb_define_method(tmp, "kgio_autopush=", autopush_set, 1);
	rb_define_method(tmp, "kgio_autopush?", autopush_get, 0);

	id_autopush_state = rb_intern("@kgio_autopush_state");
}
Example #11
0
void
Init_krypt_hex(void)
{
#if 0
    mKrypt = rb_define_module("Krypt"); /* Let RDoc know */
#endif

    mKryptHex = rb_define_module_under(mKrypt, "Hex");

    eKryptHexError = rb_define_class_under(mKryptHex, "HexError", eKryptError);

    rb_define_module_function(mKryptHex, "decode", krypt_hex_module_decode, 1);
    rb_define_module_function(mKryptHex, "encode", krypt_hex_module_encode, 1);
}
void
Init_gobject_typeinterface()
{
    mMetaInterface = rb_define_module_under(mGLib, "MetaInterface");
    rb_define_method(mMetaInterface, "gtype", generic_s_gtype, 0);
    rb_define_method(mMetaInterface, "append_features", interface_s_append_features, 1);
#if GLIB_CHECK_VERSION(2,4,0)
    rb_define_method(mMetaInterface, "install_property", interface_s_install_property, 1);
    rb_define_method(mMetaInterface, "property", interface_s_property, 1);
    rb_define_method(mMetaInterface, "properties", interface_s_properties, -1);
#endif

    rbgobj_mInterface = G_DEF_INTERFACE(G_TYPE_INTERFACE, "Interface", mGLib);
}
Example #13
0
void
define_ruby_module()
{
  if(rb_module)
    return;
  /* 
   * opencv = rb_define_module("OpenCV");      
   *
   * note: this comment is used by rdoc.
   */
  VALUE opencv = rb_module_opencv();
  rb_module = rb_define_module_under(opencv, "GUI");
  rb_define_singleton_method(rb_module, "wait_key", RUBY_METHOD_FUNC(rb_wait_key), -1);
}
Example #14
0
void Init_gsl_deriv(VALUE module)
{
  VALUE mgsl_deriv;

  mgsl_deriv = rb_define_module_under(module, "Deriv");

  rb_define_method(cgsl_function, "deriv_central", rb_gsl_deriv_central, -1);
  rb_define_method(cgsl_function, "deriv_forward", rb_gsl_deriv_forward, -1);
  rb_define_method(cgsl_function, "deriv_backward", rb_gsl_deriv_backward, -1);

  rb_define_singleton_method(mgsl_deriv, "central", rb_gsl_deriv_central, -1);
  rb_define_singleton_method(mgsl_deriv, "forward", rb_gsl_deriv_forward, -1);
  rb_define_singleton_method(mgsl_deriv, "backward", rb_gsl_deriv_backward, -1);
}
Example #15
0
void init_xml_schema()
{
  VALUE nokogiri = rb_define_module("Nokogiri");
  VALUE xml = rb_define_module_under(nokogiri, "XML");
  VALUE klass = rb_define_class_under(xml, "Schema", rb_cObject);

  cNokogiriXmlSchema = klass;

  rb_define_singleton_method(klass, "read_memory", read_memory, 1);
  rb_define_singleton_method(klass, "from_document", from_document, 1);

  rb_define_private_method(klass, "validate_document", validate_document, 1);
  rb_define_private_method(klass, "validate_file",     validate_file, 1);
}
Example #16
0
void 
_init_constants(VALUE dtrace_dof)
{
  VALUE c = rb_define_module_under(dtrace_dof, "Constants");

  rb_define_const(c, "DOF_DOFHDR_SIZE",   INT2FIX(sizeof(dof_hdr_t)));
  rb_define_const(c, "DOF_SECHDR_SIZE",   INT2FIX(sizeof(dof_sec_t)));
  rb_define_const(c, "DOF_PROBE_SIZE",    INT2FIX(sizeof(dof_probe_t)));
  rb_define_const(c, "DOF_PRARGS_SIZE",   INT2FIX(sizeof(uint8_t)));
  rb_define_const(c, "DOF_PROFFS_SIZE",   INT2FIX(sizeof(uint32_t)));
  rb_define_const(c, "DOF_PRENOFFS_SIZE", INT2FIX(sizeof(uint32_t)));
  rb_define_const(c, "DOF_PROVIDER_SIZE", INT2FIX(sizeof(dof_provider_t)));

  rb_define_const(c, "DOF_SECT_NONE",      INT2FIX(DOF_SECT_NONE));
  rb_define_const(c, "DOF_SECT_COMMENTS",  INT2FIX(DOF_SECT_COMMENTS));
  rb_define_const(c, "DOF_SECT_SOURCE",    INT2FIX(DOF_SECT_SOURCE));
  rb_define_const(c, "DOF_SECT_ECBDESC",   INT2FIX(DOF_SECT_ECBDESC));
  rb_define_const(c, "DOF_SECT_PROBEDESC", INT2FIX(DOF_SECT_PROBEDESC));
  rb_define_const(c, "DOF_SECT_ACTDESC",   INT2FIX(DOF_SECT_ACTDESC));
  rb_define_const(c, "DOF_SECT_DIFOHDR",   INT2FIX(DOF_SECT_DIFOHDR));
  rb_define_const(c, "DOF_SECT_DIF",       INT2FIX(DOF_SECT_DIF));
  rb_define_const(c, "DOF_SECT_STRTAB",    INT2FIX(DOF_SECT_STRTAB));
  rb_define_const(c, "DOF_SECT_VARTAB",    INT2FIX(DOF_SECT_VARTAB));
  rb_define_const(c, "DOF_SECT_RELTAB",    INT2FIX(DOF_SECT_RELTAB));
  rb_define_const(c, "DOF_SECT_TYPTAB",    INT2FIX(DOF_SECT_TYPTAB));
  rb_define_const(c, "DOF_SECT_URELHDR",   INT2FIX(DOF_SECT_URELHDR));
  rb_define_const(c, "DOF_SECT_KRELHDR",   INT2FIX(DOF_SECT_KRELHDR));
  rb_define_const(c, "DOF_SECT_OPTDESC",   INT2FIX(DOF_SECT_OPTDESC));
  rb_define_const(c, "DOF_SECT_PROVIDER",  INT2FIX(DOF_SECT_PROVIDER));
  rb_define_const(c, "DOF_SECT_PROBES",    INT2FIX(DOF_SECT_PROBES));
  rb_define_const(c, "DOF_SECT_PRARGS",    INT2FIX(DOF_SECT_PRARGS));
  rb_define_const(c, "DOF_SECT_PROFFS",    INT2FIX(DOF_SECT_PROFFS));
  rb_define_const(c, "DOF_SECT_INTTAB",    INT2FIX(DOF_SECT_INTTAB));
  rb_define_const(c, "DOF_SECT_UTSNAME",   INT2FIX(DOF_SECT_UTSNAME));
  rb_define_const(c, "DOF_SECT_XLTAB",     INT2FIX(DOF_SECT_XLTAB));
  rb_define_const(c, "DOF_SECT_XLMEMBERS", INT2FIX(DOF_SECT_XLMEMBERS));
  rb_define_const(c, "DOF_SECT_XLIMPORT",  INT2FIX(DOF_SECT_XLIMPORT));
  rb_define_const(c, "DOF_SECT_XLEXPORT",  INT2FIX(DOF_SECT_XLEXPORT));
  rb_define_const(c, "DOF_SECT_PREXPORT",  INT2FIX(DOF_SECT_PREXPORT));
  rb_define_const(c, "DOF_SECT_PRENOFFS",  INT2FIX(DOF_SECT_PRENOFFS));

  rb_define_const(c, "DTRACE_STABILITY_INTERNAL",  INT2FIX(DTRACE_STABILITY_INTERNAL));
  rb_define_const(c, "DTRACE_STABILITY_PRIVATE",   INT2FIX(DTRACE_STABILITY_PRIVATE));
  rb_define_const(c, "DTRACE_STABILITY_OBSOLETE",  INT2FIX(DTRACE_STABILITY_OBSOLETE));
  rb_define_const(c, "DTRACE_STABILITY_EXTERNAL",  INT2FIX(DTRACE_STABILITY_EXTERNAL));
  rb_define_const(c, "DTRACE_STABILITY_UNSTABLE",  INT2FIX(DTRACE_STABILITY_UNSTABLE));
  rb_define_const(c, "DTRACE_STABILITY_EVOLVING",  INT2FIX(DTRACE_STABILITY_EVOLVING));
  rb_define_const(c, "DTRACE_STABILITY_STABLE",    INT2FIX(DTRACE_STABILITY_STABLE));
  rb_define_const(c, "DTRACE_STABILITY_STANDARD",  INT2FIX(DTRACE_STABILITY_STANDARD));
}
Example #17
0
void init_swf_font()
{
  VALUE kedama  = rb_define_module("Kedama");
  VALUE swf     = rb_define_module_under(kedama, "SWF");
  VALUE klass   = rb_define_class_under(swf, "Font", rb_cObject);

  rb_define_singleton_method(klass, "open", font_open, 1);
  rb_define_method(klass, "ascent", ascent, 0);
  rb_define_method(klass, "descent", descent, 0);
  rb_define_method(klass, "leading", leading, 0);
  rb_define_method(klass, "name", name, 0);
  rb_define_method(klass, "glyph_count", glyph_count, 0);
  rb_define_method(klass, "width_of", width_of, 1);
}
Example #18
0
void
rb_grn_init_request_timer (VALUE mGrn)
{
    rb_mGrnRequestTimer = rb_define_module_under(mGrn, "RequestTimer");

    rb_define_singleton_method(rb_mGrnRequestTimer, "register",
                               rb_grn_request_timer_s_register, -1);
    rb_define_singleton_method(rb_mGrnRequestTimer, "unregister",
                               rb_grn_request_timer_s_unregister, 1);
    rb_define_singleton_method(rb_mGrnRequestTimer, "default_timeout",
                               rb_grn_request_timer_s_get_default_timeout, 0);
    rb_define_singleton_method(rb_mGrnRequestTimer, "default_timeout=",
                               rb_grn_request_timer_s_set_default_timeout, 1);
}
Example #19
0
void
rb_grn_init_request_canceler (VALUE mGrn)
{
    rb_mGrnRequestCanceler = rb_define_module_under(mGrn, "RequestCanceler");

    rb_define_singleton_method(rb_mGrnRequestCanceler, "register",
                               rb_grn_request_canceler_s_register, -1);
    rb_define_singleton_method(rb_mGrnRequestCanceler, "unregister",
                               rb_grn_request_canceler_s_unregister, -1);
    rb_define_singleton_method(rb_mGrnRequestCanceler, "cancel",
                               rb_grn_request_canceler_s_cancel, 1);
    rb_define_singleton_method(rb_mGrnRequestCanceler, "cancel_all",
                               rb_grn_request_canceler_s_cancel_all, 0);
}
Example #20
0
void init_punycode(void)
{
#ifdef mIDN_RDOC_HACK
  mIDN = rb_define_module("IDN");
  eIDNError = rb_define_class_under(mIDN, "IDNError", rb_eStandardError);
#endif

  mPunycode = rb_define_module_under(mIDN, "Punycode");
  ePunycodeError = rb_define_class_under(mPunycode, "PunycodeError",
                                         eIDNError);

  rb_define_singleton_method(mPunycode, "encode", encode, 1);
  rb_define_singleton_method(mPunycode, "decode", decode, 1);
}
Example #21
0
void rgeo_init_geos_geometry(RGeo_Globals* globals)
{
  VALUE geos_geometry_methods;

  geos_geometry_methods = rb_define_module_under(globals->geos_module, "CAPIGeometryMethods");

  rb_define_method(geos_geometry_methods, "_set_factory", method_geometry_set_factory, 1);
  rb_define_method(geos_geometry_methods, "initialize_copy", method_geometry_initialize_copy, 1);
  rb_define_method(geos_geometry_methods, "_steal", method_geometry_steal, 1);
  rb_define_method(geos_geometry_methods, "initialized?", method_geometry_initialized_p, 0);
  rb_define_method(geos_geometry_methods, "factory", method_geometry_factory, 0);
  rb_define_method(geos_geometry_methods, "prepared?", method_geometry_prepared_p, 0);
  rb_define_method(geos_geometry_methods, "prepare!", method_geometry_prepare, 0);
  rb_define_method(geos_geometry_methods, "dimension", method_geometry_dimension, 0);
  rb_define_method(geos_geometry_methods, "geometry_type", method_geometry_geometry_type, 0);
  rb_define_method(geos_geometry_methods, "srid", method_geometry_srid, 0);
  rb_define_method(geos_geometry_methods, "envelope", method_geometry_envelope, 0);
  rb_define_method(geos_geometry_methods, "boundary", method_geometry_boundary, 0);
  rb_define_method(geos_geometry_methods, "_as_text", method_geometry_as_text, 0);
  rb_define_method(geos_geometry_methods, "as_binary", method_geometry_as_binary, 0);
  rb_define_method(geos_geometry_methods, "is_empty?", method_geometry_is_empty, 0);
  rb_define_method(geos_geometry_methods, "is_simple?", method_geometry_is_simple, 0);
  rb_define_method(geos_geometry_methods, "equals?", method_geometry_equals, 1);
  rb_define_method(geos_geometry_methods, "==", method_geometry_equals, 1);
  rb_define_method(geos_geometry_methods, "rep_equals?", method_geometry_eql, 1);
  rb_define_method(geos_geometry_methods, "eql?", method_geometry_eql, 1);
  rb_define_method(geos_geometry_methods, "disjoint?", method_geometry_disjoint, 1);
  rb_define_method(geos_geometry_methods, "intersects?", method_geometry_intersects, 1);
  rb_define_method(geos_geometry_methods, "touches?", method_geometry_touches, 1);
  rb_define_method(geos_geometry_methods, "crosses?", method_geometry_crosses, 1);
  rb_define_method(geos_geometry_methods, "within?", method_geometry_within, 1);
  rb_define_method(geos_geometry_methods, "contains?", method_geometry_contains, 1);
  rb_define_method(geos_geometry_methods, "overlaps?", method_geometry_overlaps, 1);
  rb_define_method(geos_geometry_methods, "relate?", method_geometry_relate, 2);
  rb_define_method(geos_geometry_methods, "distance", method_geometry_distance, 1);
  rb_define_method(geos_geometry_methods, "buffer", method_geometry_buffer, 1);
  rb_define_method(geos_geometry_methods, "buffer_with_style", method_geometry_buffer_with_style, 4);
  rb_define_method(geos_geometry_methods, "simplify", method_geometry_simplify, 1);
  rb_define_method(geos_geometry_methods, "convex_hull", method_geometry_convex_hull, 0);
  rb_define_method(geos_geometry_methods, "intersection", method_geometry_intersection, 1);
  rb_define_method(geos_geometry_methods, "*", method_geometry_intersection, 1);
  rb_define_method(geos_geometry_methods, "union", method_geometry_union, 1);
  rb_define_method(geos_geometry_methods, "+", method_geometry_union, 1);
  rb_define_method(geos_geometry_methods, "difference", method_geometry_difference, 1);
  rb_define_method(geos_geometry_methods, "-", method_geometry_difference, 1);
  rb_define_method(geos_geometry_methods, "sym_difference", method_geometry_sym_difference, 1);
  rb_define_method(geos_geometry_methods, "unary_union", method_geometry_unary_union, 0);

}
Example #22
0
void Init_rtype_legacy_native(void) {
	rb_mRtype = rb_define_module("Rtype");
	rb_mRtypeLegacy = rb_define_module_under(rb_mRtype, "Legacy");
	rb_mRtypeBehavior = rb_define_module_under(rb_mRtype, "Behavior");
	rb_cRtypeBehaviorBase = rb_define_class_under(rb_mRtypeBehavior, "Base", rb_cObject);
	rb_eRtypeArgumentTypeError = rb_define_class_under(rb_mRtype, "ArgumentTypeError", rb_eArgError);
	rb_eRtypeTypeSignatureError = rb_define_class_under(rb_mRtype, "TypeSignatureError", rb_eArgError);
	rb_eRtypeReturnTypeError = rb_define_class_under(rb_mRtype, "ReturnTypeError", rb_eStandardError);
	
	rb_define_const(rb_mRtypeLegacy, "NATIVE_EXT_VERSION", rb_str_new2(RTYPE_NATIVE_EXT_VERSION));

	id_to_s = rb_intern("to_s");
	id_keys = rb_intern("keys");
	id_eqeq = rb_intern("==");
	id_include = rb_intern("include?");
	id_valid = rb_intern("valid?");
	id_call = rb_intern("call");
	id_key = rb_intern("key?");

	rb_define_method(rb_mRtype, "valid?", rb_rtype_valid, 2);
	rb_define_method(rb_mRtype, "assert_arguments_type", rb_rtype_assert_arguments_type, 2);
	// rb_define_method(rb_mRtype, "assert_arguments_type_with_keywords", rb_rtype_assert_arguments_type_with_keywords, 4);
	rb_define_method(rb_mRtype, "assert_return_type", rb_rtype_assert_return_type, 2);
}
void
Init_iterative_with_two_matrix_rows_ext(void)
{
    VALUE StringMetric;
    VALUE Levenshtein;
    VALUE IterativeWithTwoMatrixRowsExt;

    StringMetric = rb_define_module("StringMetric");
    Levenshtein = rb_define_module_under(StringMetric, "Levenshtein");

    IterativeWithTwoMatrixRowsExt =
        rb_define_class_under(Levenshtein, "IterativeWithTwoMatrixRowsExt", rb_cObject);

    rb_define_singleton_method(IterativeWithTwoMatrixRowsExt, "distance_ext", distance_ext, 8);
}
void Init_miyako_layout()
{
    mSDL = rb_define_module("SDL");
    mMiyako = rb_define_module("Miyako");
    mScreen = rb_define_module_under(mMiyako, "Screen");
    mLayout = rb_define_module_under(mMiyako, "Layout");

    id_update = rb_intern("update");
    id_kakko  = rb_intern("[]");
    id_render = rb_intern("render");
    id_to_a   = rb_intern("to_a");

    zero = 0;
    nZero = INT2NUM(zero);
    one = 1;
    nOne = INT2NUM(one);

    rb_define_method(mLayout, "move", layout_move, 2);
    rb_define_method(mLayout, "move_to", layout_move_to, 2);
    rb_define_method(mLayout, "update_layout", layout_update_layout, 2);
    rb_define_method(mLayout, "snap", layout_snap, -1);
    rb_define_method(mLayout, "add_snap_child", layout_add_snap_child, 1);
    rb_define_method(mLayout, "delete_snap_child", layout_delete_snap_child, 1);
}
Example #25
0
void
Init_gtk_gdk_x11()
{
#ifdef GDK_WINDOWING_X11
    VALUE mX11 = rb_define_module_under(mGdk, "X11");

    rb_define_module_function(mX11, "xid_table_lookup", rbx11_xid_table_lookup, -1);
    rb_define_module_function(mX11, "net_wm_supports?", rbx11_net_wm_supports, 1);

    rb_define_module_function(mX11, "default_screen", rbx11_get_default_screen, 0);
    rb_define_module_function(mX11, "grab_server", rbx11_grab_server, 0);
                                                                                
    rb_define_module_function(mX11, "ungrab_server", rbx11_ungrab_server, 0);
#endif
}
Example #26
0
void rubysdl2_init_color(void) {
  VALUE cColor = rb_define_module_under(mSDL2, "Color");
  rb_define_singleton_method(cColor, "rgb", Color_s_rgb, 3);
  rb_define_singleton_method(cColor, "rgba", Color_s_rgba, 4);
  rb_define_singleton_method(cColor, "r", Color_s_r, 1);
  rb_define_singleton_method(cColor, "g", Color_s_g, 1);
  rb_define_singleton_method(cColor, "b", Color_s_b, 1);
  rb_define_singleton_method(cColor, "a", Color_s_a, 1);

  rb_define_const(cColor, "WHITE", UINT2NUM(0xFFFFFFFF));
  rb_define_const(cColor, "BLACK", UINT2NUM(0x000000FF));
  rb_define_const(cColor, "RED",   UINT2NUM(0xFF0000FF));
  rb_define_const(cColor, "GREEN",   UINT2NUM(0x00FF00FF));
  rb_define_const(cColor, "BLUE",   UINT2NUM(0x0000FFFF));
}
Example #27
0
void
Init_ossl_pkcs12()
{
    mPKCS12 = rb_define_module_under(mOSSL, "PKCS12");
    cPKCS12 = rb_define_class_under(mPKCS12, "PKCS12", rb_cObject);
    ePKCS12Error = rb_define_class_under(mPKCS12, "PKCS12Error", eOSSLError);
    rb_define_module_function(mPKCS12, "create", ossl_pkcs12_s_create, -1);

    rb_define_alloc_func(cPKCS12, ossl_pkcs12_s_allocate);
    rb_attr(cPKCS12, rb_intern("key"), 1, 0, Qfalse);
    rb_attr(cPKCS12, rb_intern("certificate"), 1, 0, Qfalse);
    rb_attr(cPKCS12, rb_intern("ca_certs"), 1, 0, Qfalse);
    rb_define_method(cPKCS12, "initialize", ossl_pkcs12_initialize, -1);
    rb_define_method(cPKCS12, "to_der", ossl_pkcs12_to_der, 0);
}
Example #28
0
static void Init_grpc_propagate_masks() {
  /* Constants representing call propagation masks in grpc.h */
  VALUE grpc_rb_mPropagateMasks = rb_define_module_under(
      grpc_rb_mGrpcCore, "PropagateMasks");
  rb_define_const(grpc_rb_mPropagateMasks, "DEADLINE",
                  UINT2NUM(GRPC_PROPAGATE_DEADLINE));
  rb_define_const(grpc_rb_mPropagateMasks, "CENSUS_STATS_CONTEXT",
                  UINT2NUM(GRPC_PROPAGATE_CENSUS_STATS_CONTEXT));
  rb_define_const(grpc_rb_mPropagateMasks, "CENSUS_TRACING_CONTEXT",
                  UINT2NUM(GRPC_PROPAGATE_CENSUS_TRACING_CONTEXT));
  rb_define_const(grpc_rb_mPropagateMasks, "CANCELLATION",
                  UINT2NUM(GRPC_PROPAGATE_CANCELLATION));
  rb_define_const(grpc_rb_mPropagateMasks, "DEFAULTS",
                  UINT2NUM(GRPC_PROPAGATE_DEFAULTS));
}
Example #29
0
static void Init_grpc_connectivity_states() {
  /* Constants representing call propagation masks in grpc.h */
  VALUE grpc_rb_mConnectivityStates = rb_define_module_under(
      grpc_rb_mGrpcCore, "ConnectivityStates");
  rb_define_const(grpc_rb_mConnectivityStates, "IDLE",
                  LONG2NUM(GRPC_CHANNEL_IDLE));
  rb_define_const(grpc_rb_mConnectivityStates, "CONNECTING",
                  LONG2NUM(GRPC_CHANNEL_CONNECTING));
  rb_define_const(grpc_rb_mConnectivityStates, "READY",
                  LONG2NUM(GRPC_CHANNEL_READY));
  rb_define_const(grpc_rb_mConnectivityStates, "TRANSIENT_FAILURE",
                  LONG2NUM(GRPC_CHANNEL_TRANSIENT_FAILURE));
  rb_define_const(grpc_rb_mConnectivityStates, "FATAL_FAILURE",
                  LONG2NUM(GRPC_CHANNEL_SHUTDOWN));
}
Example #30
0
void Init_swift_db_postgres_ext() {
    mSwift = rb_define_module("Swift");
    mDB    = rb_define_module_under(mSwift, "DB");

    eSwiftError           = rb_define_class_under(mSwift, "Error",           rb_eStandardError);
    eSwiftArgumentError   = rb_define_class_under(mSwift, "ArgumentError",   eSwiftError);
    eSwiftRuntimeError    = rb_define_class_under(mSwift, "RuntimeError",    eSwiftError);
    eSwiftConnectionError = rb_define_class_under(mSwift, "ConnectionError", eSwiftError);

    init_swift_db_postgres_adapter();
    init_swift_db_postgres_statement();
    init_swift_db_postgres_result();
    init_swift_datetime();
    init_swift_db_postgres_typecast();
}