本文整理汇总了C++中rb_include_module函数的典型用法代码示例。如果您正苦于以下问题:C++ rb_include_module函数的具体用法?C++ rb_include_module怎么用?C++ rb_include_module使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了rb_include_module函数的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C++代码示例。
示例1: init_kgio_connect
void init_kgio_connect(void)
{
VALUE mKgio = rb_define_module("Kgio");
VALUE cSocket = rb_const_get(rb_cObject, rb_intern("Socket"));
VALUE mSocketMethods = rb_const_get(mKgio, rb_intern("SocketMethods"));
VALUE cKgio_Socket, cTCPSocket, cUNIXSocket;
/*
* Document-class: Kgio::Socket
*
* A generic socket class with Kgio::SocketMethods included.
* This is returned by all Kgio methods that accept(2) a connected
* stream socket.
*/
cKgio_Socket = rb_define_class_under(mKgio, "Socket", cSocket);
rb_include_module(cKgio_Socket, mSocketMethods);
rb_define_singleton_method(cKgio_Socket, "new", kgio_new, -1);
rb_define_singleton_method(cKgio_Socket, "connect", kgio_connect, 1);
rb_define_singleton_method(cKgio_Socket, "start", kgio_start, 1);
#if defined(MSG_FASTOPEN) && defined(KGIO_HAVE_THREAD_CALL_WITHOUT_GVL)
rb_define_method(cKgio_Socket, "kgio_fastopen", fastopen, 2);
#endif
/*
* Document-class: Kgio::TCPSocket
*
* Kgio::TCPSocket should be used in place of the plain TCPSocket
* when kgio_* methods are needed.
*/
cTCPSocket = rb_const_get(rb_cObject, rb_intern("TCPSocket"));
cTCPSocket = rb_define_class_under(mKgio, "TCPSocket", cTCPSocket);
rb_include_module(cTCPSocket, mSocketMethods);
rb_define_singleton_method(cTCPSocket, "new", kgio_tcp_connect, 2);
rb_define_singleton_method(cTCPSocket, "start", kgio_tcp_start, 2);
/*
* Document-class: Kgio::UNIXSocket
*
* Kgio::UNIXSocket should be used in place of the plain UNIXSocket
* when kgio_* methods are needed.
*/
cUNIXSocket = rb_const_get(rb_cObject, rb_intern("UNIXSocket"));
cUNIXSocket = rb_define_class_under(mKgio, "UNIXSocket", cUNIXSocket);
rb_include_module(cUNIXSocket, mSocketMethods);
rb_define_singleton_method(cUNIXSocket, "new", kgio_unix_connect, 1);
rb_define_singleton_method(cUNIXSocket, "start", kgio_unix_start, 1);
init_sock_for_fd();
}
开发者ID:LegalHackers,项目名称:takemyphotodown,代码行数:47,代码来源:connect.c
示例2: init_pg_result
void
init_pg_result()
{
rb_cPGresult = rb_define_class_under( rb_mPG, "Result", rb_cObject );
rb_include_module(rb_cPGresult, rb_mEnumerable);
rb_include_module(rb_cPGresult, rb_mPGconstants);
/****** PG::Result INSTANCE METHODS: libpq ******/
rb_define_method(rb_cPGresult, "result_status", pgresult_result_status, 0);
rb_define_method(rb_cPGresult, "res_status", pgresult_res_status, 1);
rb_define_method(rb_cPGresult, "error_message", pgresult_error_message, 0);
rb_define_alias( rb_cPGresult, "result_error_message", "error_message");
rb_define_method(rb_cPGresult, "error_field", pgresult_error_field, 1);
rb_define_alias( rb_cPGresult, "result_error_field", "error_field" );
rb_define_method(rb_cPGresult, "clear", pg_result_clear, 0);
rb_define_method(rb_cPGresult, "check", pg_result_check, 0);
rb_define_alias (rb_cPGresult, "check_result", "check");
rb_define_method(rb_cPGresult, "ntuples", pgresult_ntuples, 0);
rb_define_alias(rb_cPGresult, "num_tuples", "ntuples");
rb_define_method(rb_cPGresult, "nfields", pgresult_nfields, 0);
rb_define_alias(rb_cPGresult, "num_fields", "nfields");
rb_define_method(rb_cPGresult, "fname", pgresult_fname, 1);
rb_define_method(rb_cPGresult, "fnumber", pgresult_fnumber, 1);
rb_define_method(rb_cPGresult, "ftable", pgresult_ftable, 1);
rb_define_method(rb_cPGresult, "ftablecol", pgresult_ftablecol, 1);
rb_define_method(rb_cPGresult, "fformat", pgresult_fformat, 1);
rb_define_method(rb_cPGresult, "ftype", pgresult_ftype, 1);
rb_define_method(rb_cPGresult, "fmod", pgresult_fmod, 1);
rb_define_method(rb_cPGresult, "fsize", pgresult_fsize, 1);
rb_define_method(rb_cPGresult, "getvalue", pgresult_getvalue, 2);
rb_define_method(rb_cPGresult, "getisnull", pgresult_getisnull, 2);
rb_define_method(rb_cPGresult, "getlength", pgresult_getlength, 2);
rb_define_method(rb_cPGresult, "nparams", pgresult_nparams, 0);
rb_define_method(rb_cPGresult, "paramtype", pgresult_paramtype, 1);
rb_define_method(rb_cPGresult, "cmd_status", pgresult_cmd_status, 0);
rb_define_method(rb_cPGresult, "cmd_tuples", pgresult_cmd_tuples, 0);
rb_define_alias(rb_cPGresult, "cmdtuples", "cmd_tuples");
rb_define_method(rb_cPGresult, "oid_value", pgresult_oid_value, 0);
/****** PG::Result INSTANCE METHODS: other ******/
rb_define_method(rb_cPGresult, "[]", pgresult_aref, 1);
rb_define_method(rb_cPGresult, "each", pgresult_each, 0);
rb_define_method(rb_cPGresult, "fields", pgresult_fields, 0);
rb_define_method(rb_cPGresult, "values", pgresult_values, 0);
rb_define_method(rb_cPGresult, "column_values", pgresult_column_values, 1);
rb_define_method(rb_cPGresult, "field_values", pgresult_field_values, 1);
}
开发者ID:danielcode,项目名称:ruby-pg,代码行数:47,代码来源:pg_result.c
示例3: rb_grn_init_patricia_trie_cursor
void
rb_grn_init_patricia_trie_cursor (VALUE mGrn)
{
rb_cGrnPatriciaTrieCursor =
rb_define_class_under(mGrn, "PatriciaTrieCursor", rb_cGrnTableCursor);
rb_include_module(rb_cGrnPatriciaTrieCursor, rb_mGrnTableCursorKeySupport);
}
开发者ID:cosmo0920,项目名称:rroonga,代码行数:8,代码来源:rb-grn-patricia-trie-cursor.c
示例4: Init_do_sqlite3_ext
void Init_do_sqlite3_ext() {
rb_require("bigdecimal");
rb_require("date");
// Get references classes needed for Date/Time parsing
rb_cDate = CONST_GET(rb_mKernel, "Date");
rb_cDateTime = CONST_GET(rb_mKernel, "DateTime");
rb_cTime = CONST_GET(rb_mKernel, "Time");
rb_cBigDecimal = CONST_GET(rb_mKernel, "BigDecimal");
rb_funcall(rb_mKernel, rb_intern("require"), 1, rb_str_new2("data_objects"));
#ifdef RUBY_LESS_THAN_186
ID_NEW_DATE = rb_intern("new0");
#else
ID_NEW_DATE = rb_intern("new!");
#endif
ID_RATIONAL = rb_intern("Rational");
ID_LOGGER = rb_intern("logger");
ID_DEBUG = rb_intern("debug");
ID_LEVEL = rb_intern("level");
// Get references to the DataObjects module and its classes
mDO = CONST_GET(rb_mKernel, "DataObjects");
cDO_Quoting = CONST_GET(mDO, "Quoting");
cDO_Connection = CONST_GET(mDO, "Connection");
cDO_Command = CONST_GET(mDO, "Command");
cDO_Result = CONST_GET(mDO, "Result");
cDO_Reader = CONST_GET(mDO, "Reader");
// Initialize the DataObjects::Sqlite3 module, and define its classes
mSqlite3 = rb_define_module_under(mDO, "Sqlite3");
eSqlite3Error = rb_define_class("Sqlite3Error", rb_eStandardError);
cConnection = SQLITE3_CLASS("Connection", cDO_Connection);
rb_define_method(cConnection, "initialize", cConnection_initialize, 1);
rb_define_method(cConnection, "dispose", cConnection_dispose, 0);
cCommand = SQLITE3_CLASS("Command", cDO_Command);
rb_include_module(cCommand, cDO_Quoting);
rb_define_method(cCommand, "set_types", cCommand_set_types, 1);
rb_define_method(cCommand, "execute_non_query", cCommand_execute_non_query, -1);
rb_define_method(cCommand, "execute_reader", cCommand_execute_reader, -1);
rb_define_method(cCommand, "quote_boolean", cCommand_quote_boolean, 1);
rb_define_method(cCommand, "quote_string", cCommand_quote_string, 1);
cResult = SQLITE3_CLASS("Result", cDO_Result);
cReader = SQLITE3_CLASS("Reader", cDO_Reader);
rb_define_method(cReader, "close", cReader_close, 0);
rb_define_method(cReader, "next!", cReader_next, 0);
rb_define_method(cReader, "values", cReader_values, 0);
rb_define_method(cReader, "fields", cReader_fields, 0);
rb_define_method(cReader, "field_count", cReader_field_count, 0);
rb_define_method(cReader, "row_count", cReader_row_count, 0);
}
开发者ID:Bluejade,项目名称:rots_consumer,代码行数:58,代码来源:do_sqlite3_ext.c
示例5: init_kgio_tryopen
void init_kgio_tryopen(void)
{
VALUE mKgio = rb_define_module("Kgio");
VALUE mPipeMethods = rb_const_get(mKgio, rb_intern("PipeMethods"));
VALUE cFile;
VALUE tmp;
VALUE *ptr;
long len;
id_path = rb_intern("path");
id_for_fd = rb_intern("for_fd");
id_to_path = rb_intern("to_path");
/*
* Document-class: Kgio::File
*
* This subclass of the core File class adds the "tryopen" singleton
* method for opening files. A single "tryopen" and check for the
* return value may be used to avoid unnecessary stat(2) syscalls
* or File.open exceptions when checking for the existence of a file
* and opening it.
*/
cFile = rb_define_class_under(mKgio, "File", rb_cFile);
rb_define_singleton_method(cFile, "tryopen", s_tryopen, -1);
rb_include_module(cFile, mPipeMethods);
if (!rb_funcall(cFile, rb_intern("method_defined?"), 1,
ID2SYM(id_to_path)))
rb_define_alias(cFile, "to_path", "path");
errno2sym = st_init_numtable();
tmp = rb_funcall(rb_mErrno, rb_intern("constants"), 0);
ptr = RARRAY_PTR(tmp);
len = RARRAY_LEN(tmp);
for (; --len >= 0; ptr++) {
VALUE error;
ID const_id;
switch (TYPE(*ptr)) {
case T_SYMBOL: const_id = SYM2ID(*ptr); break;
case T_STRING: const_id = rb_intern(RSTRING_PTR(*ptr)); break;
default: rb_bug("constant not a symbol or string");
}
error = rb_const_get(rb_mErrno, const_id);
if ((TYPE(error) != T_CLASS) ||
!rb_const_defined(error, rb_intern("Errno")))
continue;
error = rb_const_get(error, rb_intern("Errno"));
switch (TYPE(error)) {
case T_FIXNUM:
case T_BIGNUM:
st_insert(errno2sym, (st_data_t)NUM2INT(error),
ID2SYM(const_id));
}
}
}
开发者ID:HeapsOfRam,项目名称:Starter,代码行数:58,代码来源:tryopen.c
示例6: init_ruby_class
void
init_ruby_class()
{
#if 0
// For documentation using YARD
VALUE opencv = rb_define_module("OpenCV");
VALUE cvseq = rb_define_class_under(opencv, "CvSeq");
VALUE curve = rb_define_module_under(opencv, "Curve");
VALUE pointset = rb_define_module_under(opencv, "PointSet");
#endif
if (rb_klass)
return;
VALUE opencv = rb_module_opencv();
VALUE cvseq = cCvSeq::rb_class();
VALUE curve = mCurve::rb_module();
VALUE pointset = mPointSet::rb_module();
rb_klass = rb_define_class_under(opencv, "CvContour", cvseq);
rb_include_module(rb_klass, curve);
rb_include_module(rb_klass, pointset);
rb_define_alloc_func(rb_klass, rb_allocate);
VALUE approx_option = rb_hash_new();
rb_define_const(rb_klass, "APPROX_OPTION", approx_option);
rb_hash_aset(approx_option, ID2SYM(rb_intern("method")), INT2FIX(CV_POLY_APPROX_DP));
rb_hash_aset(approx_option, ID2SYM(rb_intern("accuracy")), rb_float_new(1.0));
rb_hash_aset(approx_option, ID2SYM(rb_intern("recursive")), Qfalse);
rb_define_method(rb_klass, "initialize", RUBY_METHOD_FUNC(rb_initialize), -1);
rb_define_method(rb_klass, "rect", RUBY_METHOD_FUNC(rb_rect), 0);
rb_define_method(rb_klass, "color", RUBY_METHOD_FUNC(rb_color), 0);
rb_define_method(rb_klass, "color=", RUBY_METHOD_FUNC(rb_set_color), 1);
rb_define_method(rb_klass, "reserved", RUBY_METHOD_FUNC(rb_reserved), 0);
rb_define_method(rb_klass, "approx_poly", RUBY_METHOD_FUNC(rb_approx_poly), -1);
rb_define_alias(rb_klass, "approx", "approx_poly");
rb_define_method(rb_klass, "bounding_rect", RUBY_METHOD_FUNC(rb_bounding_rect), 0);
rb_define_method(rb_klass, "create_tree", RUBY_METHOD_FUNC(rb_create_tree), -1);
rb_define_method(rb_klass, "in?", RUBY_METHOD_FUNC(rb_in_q), 1);
rb_define_method(rb_klass, "measure_distance", RUBY_METHOD_FUNC(rb_measure_distance), 1);
rb_define_method(rb_klass, "point_polygon_test", RUBY_METHOD_FUNC(rb_point_polygon_test), 2);
rb_define_method(rb_klass, "match_shapes", RUBY_METHOD_FUNC(rb_match_shapes), -1);
}
开发者ID:amalc,项目名称:ruby-opencv,代码行数:45,代码来源:cvcontour.cpp
示例7: Init_Result
void
Init_Result (VALUE mXmms)
{
cResult = rb_define_class_under (mXmms, "Result", rb_cObject);
/* ugh, we have to define the "new" method,
* so we can remove it again :(
*/
rb_define_singleton_method (cResult, "new", NULL, 0);
rb_undef_method (rb_singleton_class (cResult), "new");
rb_define_method (cResult, "notifier", c_notifier_set, 0);
rb_define_method (cResult, "wait", c_wait, 0);
rb_define_method (cResult, "value", c_value_get, 0);
rb_define_method (cResult, "error?", c_is_error, 0);
rb_define_method (cResult, "error", c_get_error, 0);
cBroadcastResult = rb_define_class_under (mXmms,
"BroadcastResult",
cResult);
rb_define_method (cBroadcastResult, "disconnect", c_disconnect, 0);
cSignalResult = rb_define_class_under (mXmms, "SignalResult",
cResult);
rb_define_method (cSignalResult, "disconnect", c_disconnect, 0);
eResultError = rb_define_class_under (cResult, "ResultError",
rb_eStandardError);
eValueError = rb_define_class_under (cResult, "ValueError",
eResultError);
cDict = rb_define_class_under (mXmms, "Dict", rb_cObject);
#ifdef HAVE_RB_PROTECT_INSPECT
rb_define_method (cDict, "inspect", c_dict_inspect, 0);
#endif /* HAVE_RB_PROTECT_INSPECT */
rb_define_method (cDict, "size", c_dict_size, 0);
rb_define_method (cDict, "empty?", c_dict_empty, 0);
rb_define_method (cDict, "[]", c_dict_aref, 1);
rb_define_method (cDict, "has_key?", c_dict_has_key, 1);
rb_define_method (cDict, "each", c_dict_each, 0);
rb_define_method (cDict, "each_key", c_dict_each_key, 0);
rb_define_method (cDict, "each_value", c_dict_each_value, 0);
rb_define_alias (cDict, "length", "size");
rb_define_alias (cDict, "include?", "has_key?");
rb_define_alias (cDict, "key?", "has_key?");
rb_define_alias (cDict, "member?", "has_key?");
rb_define_alias (cDict, "each_pair", "each");
rb_include_module (cDict, rb_mEnumerable);
cRawDict = rb_define_class_under (mXmms, "RawDict", cDict);
rb_define_method (cRawDict, "to_propdict", c_raw_dict_to_propdict, -1);
}
开发者ID:vdust,项目名称:xmms2-devel,代码行数:57,代码来源:rb_result.c
示例8: rb_grn_init_double_array_trie_cursor
void
rb_grn_init_double_array_trie_cursor (VALUE mGrn)
{
rb_cGrnDoubleArrayTrieCursor =
rb_define_class_under(mGrn, "DoubleArrayTrieCursor", rb_cGrnTableCursor);
rb_include_module(rb_cGrnDoubleArrayTrieCursor,
rb_mGrnTableCursorKeySupport);
}
开发者ID:keitahaga,项目名称:rroonga,代码行数:9,代码来源:rb-grn-double-array-trie-cursor.c
示例9: Init_ct_move
VALUE
Init_ct_move(void)
{
cCtMove = rb_define_class("CtMove", rb_cObject);
rb_include_module(cCtMove, rb_mComparable);
rb_define_method(cCtMove, "inspect", ct_move_inspect_rb, 0);
rb_define_method(cCtMove, "<=>", ct_move_compare_rb, 1);
return cCtMove;
}
开发者ID:steveortiz,项目名称:chess_toolkit,代码行数:9,代码来源:ct_move_rb.c
示例10: _init_type_array
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"));
}
开发者ID:methodmissing,项目名称:type_array,代码行数:56,代码来源:type_array.c
示例11: init_erlix_pid
void init_erlix_pid(VALUE erlix){
erlix_cErlixPid=rb_define_class_under(erlix,"Pid",rb_cObject);
rb_define_alloc_func(erlix_cErlixPid,erlix_pid_alloc);
rb_define_method(erlix_cErlixPid,"initialize",erlix_pid_init,1);
rb_define_method(erlix_cErlixPid,"inspect",erlix_pid_inspect,0);
rb_define_method(erlix_cErlixPid,"etype",erlix_pid_etype,0);
rb_include_module(erlix_cErlixPid,erlix_mErlixTerm);
}
开发者ID:KDr2,项目名称:erlix,代码行数:10,代码来源:erlix_pid.c
示例12: evilr_inherit
/* call-seq:
* inherit(*classes) -> self
*
* Make copies of all given +classes+ as modules, and includes
* those modules in the receiver. Raises +TypeError+ if any of the
* +classes+ is not a Class or is not compatible with the receiver. */
static VALUE evilr_inherit(int argc, VALUE* argv, VALUE klass) {
int i;
for(i = 0; i < argc; i++) {
evilr__check_compatible_classes(klass, argv[i]);
rb_include_module(klass, evilr_to_module(argv[i]));
}
return klass;
}
开发者ID:jeremyevans,项目名称:evilr,代码行数:16,代码来源:evilr.c
示例13: rb_grn_init_table_key_support
void
rb_grn_init_table_key_support (VALUE mGrn)
{
rb_mGrnTableKeySupport = rb_define_module_under(rb_cGrnTable, "KeySupport");
rb_include_module(rb_mGrnTableKeySupport, rb_mGrnEncodingSupport);
rb_define_method(rb_mGrnTableKeySupport, "inspect",
rb_grn_table_key_support_inspect, 0);
rb_define_method(rb_mGrnTableKeySupport, "add",
rb_grn_table_key_support_add, -1);
rb_define_method(rb_mGrnTableKeySupport, "id",
rb_grn_table_key_support_get_id, -1);
rb_define_method(rb_mGrnTableKeySupport, "key",
rb_grn_table_key_support_get_key, 1);
rb_define_method(rb_mGrnTableKeySupport, "has_key?",
rb_grn_table_key_support_has_key, 1);
rb_define_method(rb_mGrnTableKeySupport, "delete",
rb_grn_table_key_support_delete, -1);
rb_define_method(rb_mGrnTableKeySupport, "[]",
rb_grn_table_key_support_array_reference, 1);
rb_define_method(rb_mGrnTableKeySupport, "[]=",
rb_grn_table_key_support_array_set, 2);
rb_define_method(rb_mGrnTableKeySupport, "column_value",
rb_grn_table_key_support_get_column_value, -1);
rb_define_method(rb_mGrnTableKeySupport, "set_column_value",
rb_grn_table_key_support_set_column_value, -1);
rb_define_method(rb_mGrnTableKeySupport, "value",
rb_grn_table_key_support_get_value, -1);
rb_define_method(rb_mGrnTableKeySupport, "set_value",
rb_grn_table_key_support_set_value, -1);
rb_define_method(rb_mGrnTableKeySupport, "default_tokenizer",
rb_grn_table_key_support_get_default_tokenizer, 0);
rb_define_method(rb_mGrnTableKeySupport, "default_tokenizer=",
rb_grn_table_key_support_set_default_tokenizer, 1);
rb_define_method(rb_mGrnTableKeySupport, "normalizer",
rb_grn_table_key_support_get_normalizer, 0);
rb_define_method(rb_mGrnTableKeySupport, "normalizer=",
rb_grn_table_key_support_set_normalizer, 1);
rb_define_method(rb_mGrnTableKeySupport, "normalize_key?",
rb_grn_table_key_support_normalize_key_p, 0);
rb_define_method(rb_mGrnTableKeySupport, "support_key?",
rb_grn_table_key_support_support_key_p, 0);
rb_define_method(rb_mGrnTableKeySupport, "tokenize",
rb_grn_table_key_support_tokenize, -1);
}
开发者ID:rutice,项目名称:rroonga,代码行数:55,代码来源:rb-grn-table-key-support.c
示例14: init_erlix_atom
void init_erlix_atom(){
erlix_cErlixAtom=rb_define_class("ErlixAtom",rb_cObject);
rb_define_alloc_func(erlix_cErlixAtom,erlix_atom_alloc);
rb_define_method(erlix_cErlixAtom,"initialize",erlix_atom_init,1);
rb_define_method(erlix_cErlixAtom,"size",erlix_atom_size,0);
rb_define_method(erlix_cErlixAtom,"etype",erlix_atom_etype,0);
rb_define_method(erlix_cErlixAtom,"inspect",erlix_atom_inspect,0);
rb_include_module(erlix_cErlixAtom,erlix_mErlixTerm);
}
开发者ID:jasonjackson,项目名称:erlix,代码行数:11,代码来源:erlix_atom.c
示例15: rb_grn_init_index_cursor
void
rb_grn_init_index_cursor (VALUE mGrn)
{
rb_cGrnIndexCursor =
rb_define_class_under(mGrn, "IndexCursor", rb_cGrnObject);
rb_define_alloc_func(rb_cGrnIndexCursor, rb_grn_object_alloc);
rb_include_module(rb_cGrnIndexCursor, rb_mEnumerable);
rb_define_method(rb_cGrnIndexCursor, "next", rb_grn_index_cursor_next, 0);
rb_define_method(rb_cGrnIndexCursor, "each", rb_grn_index_cursor_each, 0);
}
开发者ID:snoozer05,项目名称:rroonga,代码行数:11,代码来源:rb-grn-index-cursor.c
示例16: asteroid_s_run
static VALUE asteroid_s_run(VALUE Self, VALUE Host, VALUE Port, VALUE Module){
char *host = StringValuePtr(Host);
int port = FIX2INT(Port);
epoll_fd = asteroid_poll_create(1024);
if(epoll_fd == -1) runtime_error();
struct sockaddr_in addr;
addr.sin_family = AF_INET;
addr.sin_port = htons(port);
addr.sin_addr.s_addr = inet_addr(host);
int s = socket(PF_INET, SOCK_STREAM, IPPROTO_TCP), c, one = 1;
if(s == -1) runtime_error();
fcntl(s, F_SETFL, fcntl(s, F_GETFL, 0) | O_NONBLOCK);
setsockopt(s, SOL_SOCKET, SO_REUSEADDR, &one, sizeof(one));
nosigpipe(s);
if(bind(s, (struct sockaddr*)&addr, sizeof(addr)) != 0) runtime_error();
if(listen(s, MAX_CONNECTION) != 0) runtime_error();
if(rb_block_given_p()) rb_yield(Qnil);
VALUE Class = rb_define_class_under(Asteroid, "Server", rb_cObject);
rb_define_method(Class, "send_data",
asteroid_server_send_data, 1);
rb_define_method(Class, "write_and_close",
asteroid_server_write_and_close, 0);
rb_include_module(Class, Module);
// Mac OS X, Fedora needs explicit rb_thread_schedule call.
for(running = 1; running; rb_thread_schedule()){
socklen_t len = sizeof(addr);
while((c = accept(s, (struct sockaddr*)&addr, &len)) != -1){
printf("A New client connected here\n");
fcntl(c, F_SETFL, fcntl(c, F_GETFL, 0) | O_NONBLOCK);
asteroid_poll_event_t event;
memset(&event, 0, sizeof(event));
if(asteroid_poll_add(epoll_fd, &event, c) == -1) runtime_error();
// instantiate server class which responds to client.
VALUE Server = rb_class_new_instance(0, NULL, Class);
rb_iv_set(Server, "@fd", rb_fix_new(c));
rb_hash_aset(clients, rb_fix_new(c), Server);
if(rb_respond_to(Server, rb_intern("post_init"))){
rb_funcall(Server, rb_intern("post_init"), 0);
}
}
if(dispatch() != 0) asteroid_s_stop(Asteroid);
// You must call them to give a chance for ruby to handle system events.
// CHECK_INTS;
}
rb_iterate(rb_each, clients, close_socket_proc, Qnil);
rb_funcall(clients, rb_intern("clear"), 0);
close(s);
close(epoll_fd);
return Qnil;
}
开发者ID:Govannon,项目名称:packet,代码行数:54,代码来源:asteroid.c
示例17: Init_switch
void
Init_switch() {
cSwitch = rb_define_class_under( mTrema, "Switch", rb_cObject );
rb_include_module( cSwitch, mLogger );
rb_define_method( cSwitch, "run!", switch_run, 0 );
rb_define_method( cSwitch, "send_message", switch_send_message, 1 );
rb_define_private_method( cSwitch, "start_chibach", switch_start_chibach, 0 );
rb_require( "trema/switch" );
}
开发者ID:TeruU,项目名称:trema,代码行数:11,代码来源:switch.c
示例18: Init_rpmmi
void
Init_rpmmi(void)
{
rpmmiClass = rb_define_class("Mi", rb_cObject);
if (_debug)
fprintf(stderr, "==> %s() rpmmiClass 0x%lx\n", __FUNCTION__, rpmmiClass);
rb_include_module(rpmmiClass, rb_mEnumerable);
rb_define_singleton_method(rpmmiClass, "new", rpmmi_new, -1);
initProperties(rpmmiClass);
initMethods(rpmmiClass);
}
开发者ID:avokhmin,项目名称:RPM5,代码行数:11,代码来源:rpmmi-rb.c
示例19: init_erlix_uint
void init_erlix_uint(VALUE erlix){
erlix_cErlixUInt=rb_define_class_under(erlix,"UInt",rb_cObject);
rb_define_alloc_func(erlix_cErlixUInt,erlix_uint_alloc);
rb_define_method(erlix_cErlixUInt,"initialize",erlix_uint_init,1);
rb_define_method(erlix_cErlixUInt,"to_i",erlix_uint_to_fix,0);
rb_define_method(erlix_cErlixUInt,"inspect",erlix_uint_inspect,0);
rb_define_method(erlix_cErlixUInt,"etype",erlix_uint_etype,0);
rb_include_module(erlix_cErlixUInt,erlix_mErlixTerm);
}
开发者ID:KDr2,项目名称:erlix,代码行数:11,代码来源:erlix_uint.c
示例20: Init_acts_as_foo
void Init_acts_as_foo() {
ActsAsFoo = rb_define_module("ActsAsFoo");
rb_define_method(ActsAsFoo, "foo?", rb_ActsAsFoo_foo_q, 0);
rb_define_singleton_method(ActsAsFoo, "included", rb_ActsAsFoo_included, 1);
ActsAsFoo_ClassMethods = rb_define_module_under(ActsAsFoo, "ClassMethods");
rb_define_method(ActsAsFoo_ClassMethods, "foo?", rb_ActsAsFoo_foo_q, 0);
rb_include_module(Bar, ActsAsFoo);
// call ActsAsFoo.included(Bar) manually since rb_include_module doesn't
rb_funcall(ActsAsFoo, rb_intern("included"), 1, Bar);
}
开发者ID:mtodd,项目名称:ruby-c,代码行数:12,代码来源:classes_and_modules_sample.c
注:本文中的rb_include_module函数示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论