这篇教程C++ rb_hash_aref函数代码示例写得很实用,希望能帮到您。
本文整理汇总了C++中rb_hash_aref函数的典型用法代码示例。如果您正苦于以下问题:C++ rb_hash_aref函数的具体用法?C++ rb_hash_aref怎么用?C++ rb_hash_aref使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。 在下文中一共展示了rb_hash_aref函数的30个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C++代码示例。 示例1: event_callbackstatic void event_callback (struct em_event* e){ const unsigned long a1 = e->a1; int a2 = e->a2; const char *a3 = e->a3; const unsigned long a4 = e->a4; if (a2 == EM_CONNECTION_READ) { VALUE t = rb_ivar_get (EmModule, Intern_at_conns); VALUE q = rb_hash_aref (t, ULONG2NUM (a1)); if (q == Qnil) rb_raise (EM_eConnectionNotBound, "received %d bytes of data for unknown signature: %lu", a4, a1); rb_funcall (q, Intern_receive_data, 1, rb_str_new (a3, a4)); } else if (a2 == EM_CONNECTION_NOTIFY_READABLE) { VALUE t = rb_ivar_get (EmModule, Intern_at_conns); VALUE q = rb_hash_aref (t, ULONG2NUM (a1)); if (q == Qnil) rb_raise (EM_eConnectionNotBound, "unknown connection: %lu", a1); rb_funcall (q, Intern_notify_readable, 0); } else if (a2 == EM_CONNECTION_NOTIFY_WRITABLE) { VALUE t = rb_ivar_get (EmModule, Intern_at_conns); VALUE q = rb_hash_aref (t, ULONG2NUM (a1)); if (q == Qnil) rb_raise (EM_eConnectionNotBound, "unknown connection: %lu", a1); rb_funcall (q, Intern_notify_writable, 0); } else if (a2 == EM_LOOPBREAK_SIGNAL) { rb_funcall (EmModule, Intern_run_deferred_callbacks, 0); } else if (a2 == EM_TIMER_FIRED) { VALUE t = rb_ivar_get (EmModule, Intern_at_timers); VALUE q = rb_funcall (t, Intern_delete, 1, ULONG2NUM (a4)); if (q == Qnil) { rb_raise (EM_eUnknownTimerFired, "no such timer: %lu", a4); } else if (q == Qfalse) { /* Timer Canceled */ } else { rb_funcall (q, Intern_call, 0); } } #ifdef WITH_SSL else if (a2 == EM_SSL_HANDSHAKE_COMPLETED) { VALUE t = rb_ivar_get (EmModule, Intern_at_conns); VALUE q = rb_hash_aref (t, ULONG2NUM (a1)); if (q == Qnil) rb_raise (EM_eConnectionNotBound, "unknown connection: %lu", a1); rb_funcall (q, Intern_ssl_handshake_completed, 0); } else if (a2 == EM_SSL_VERIFY) { VALUE t = rb_ivar_get (EmModule, Intern_at_conns); VALUE q = rb_hash_aref (t, ULONG2NUM (a1)); if (q == Qnil) rb_raise (EM_eConnectionNotBound, "unknown connection: %lu", a1); VALUE r = rb_funcall (q, Intern_ssl_verify_peer, 1, rb_str_new(a3, a4)); if (RTEST(r)) evma_accept_ssl_peer (a1); } #endif else if (a2 == EM_PROXY_TARGET_UNBOUND) { VALUE t = rb_ivar_get (EmModule, Intern_at_conns); VALUE q = rb_hash_aref (t, ULONG2NUM (a1)); if (q == Qnil) rb_raise (EM_eConnectionNotBound, "unknown connection: %lu", a1); rb_funcall (q, Intern_proxy_target_unbound, 0); } else rb_funcall (EmModule, Intern_event_callback, 3, ULONG2NUM(a1), INT2FIX(a2), a3 ? rb_str_new(a3,a4) : ULONG2NUM(a4));}
开发者ID:bernd,项目名称:eventmachine,代码行数:70,
示例2: make_graphcommandvoid make_graphcommand(char *command, VALUE hash){ VALUE val; if (TYPE(hash) == T_STRING) { sprintf(command, "graph -T X -g 3 %s", STR2CSTR(hash)); return; } strcpy(command, "graph"); if (TYPE(hash) != T_HASH) rb_raise(rb_eTypeError, "wrong argument type %s (Hash expected)", rb_class2name(CLASS_OF(hash))); if ((val = rb_hash_aref(hash, rb_str_new2("T"))) != Qnil) sprintf(command, "%s -T %s", command, STR2CSTR(val)); else sprintf(command, "%s -T X", command); val = rb_hash_aref(hash, rb_str_new2("C")); if (val == Qtrue) sprintf(command, "%s -C", command); if ((val = rb_hash_aref(hash, rb_str_new2("g"))) != Qnil) sprintf(command, "%s -g %d", command, (int) FIX2INT(val)); else sprintf(command, "%s -g 3", command); if ((val = rb_hash_aref(hash, rb_str_new2("B"))) == Qtrue) sprintf(command, "%s -B", command); if ((val = rb_hash_aref(hash, rb_str_new2("E"))) != Qnil) sprintf(command, "%s -E %s", command, STR2CSTR(val)); if ((val = rb_hash_aref(hash, rb_str_new2("f"))) != Qnil) sprintf(command, "%s -f %f", command, NUM2DBL(val)); if ((val = rb_hash_aref(hash, rb_str_new2("F"))) != Qnil) sprintf(command, "%s -F %s", command, STR2CSTR(val)); if ((val = rb_hash_aref(hash, rb_str_new2("h"))) != Qnil) sprintf(command, "%s -h %f", command, NUM2DBL(val)); if ((val = rb_hash_aref(hash, rb_str_new2("k"))) != Qnil) sprintf(command, "%s -k %f", command, NUM2DBL(val)); if ((val = rb_hash_aref(hash, rb_str_new2("K"))) != Qnil) sprintf(command, "%s -K %d", command, (int) FIX2INT(val)); if ((val = rb_hash_aref(hash, rb_str_new2("l"))) != Qnil) { if (str_tail_grep(STR2CSTR(val), "xy") || str_tail_grep(STR2CSTR(val), "x/y")) sprintf(command, "%s -l x -l y", command); else sprintf(command, "%s -l %s", command, STR2CSTR(val)); } if ((val = rb_hash_aref(hash, rb_str_new2("L"))) != Qnil) sprintf(command, "%s -L /"%s/"", command, STR2CSTR(val)); if ((val = rb_hash_aref(hash, rb_str_new2("N"))) != Qnil) sprintf(command, "%s -N %s", command, STR2CSTR(val)); if ((val = rb_hash_aref(hash, rb_str_new2("r"))) != Qnil) sprintf(command, "%s -r %f", command, NUM2DBL(val)); if ((val = rb_hash_aref(hash, rb_str_new2("R"))) != Qnil) sprintf(command, "%s -R %s", command, STR2CSTR(val)); if ((val = rb_hash_aref(hash, rb_str_new2("s"))) == Qtrue) sprintf(command, "%s -s", command); if ((val = rb_hash_aref(hash, rb_str_new2("t"))) == Qtrue) sprintf(command, "%s -t", command); if ((val = rb_hash_aref(hash, rb_str_new2("u"))) != Qnil) sprintf(command, "%s -u %f", command, NUM2DBL(val)); if ((val = rb_hash_aref(hash, rb_str_new2("w"))) != Qnil) sprintf(command, "%s -w %f", command, NUM2DBL(val)); if ((val = rb_hash_aref(hash, rb_str_new2("x"))) != Qnil) sprintf(command, "%s -x %s", command, STR2CSTR(val)); if ((val = rb_hash_aref(hash, rb_str_new2("X"))) != Qnil) sprintf(command, "%s -X /"%s/"", command, STR2CSTR(val)); if ((val = rb_hash_aref(hash, rb_str_new2("y"))) != Qnil) sprintf(command, "%s -y %s", command, STR2CSTR(val)); if ((val = rb_hash_aref(hash, rb_str_new2("Y"))) != Qnil) sprintf(command, "%s -Y /"%s/"", command, STR2CSTR(val)); if ((val = rb_hash_aref(hash, rb_str_new2("bg-color"))) != Qnil) sprintf(command, "%s --bg-color %s", command, STR2CSTR(val)); if ((val = rb_hash_aref(hash, rb_str_new2("bitmap-size"))) != Qnil) sprintf(command, "%s --bitmap-size %s", command, STR2CSTR(val)); if ((val = rb_hash_aref(hash, rb_str_new2("frame-color"))) != Qnil) sprintf(command, "%s --frame-color %s", command, STR2CSTR(val)); if ((val = rb_hash_aref(hash, rb_str_new2("frame-line-width"))) != Qnil) sprintf(command, "%s --frame-line-width %f", command, NUM2DBL(val)); if ((val = rb_hash_aref(hash, rb_str_new2("max-line-length"))) != Qnil) sprintf(command, "%s --max-line-length %f", command, NUM2DBL(val)); if ((val = rb_hash_aref(hash, rb_str_new2("page-size"))) != Qnil) sprintf(command, "%s --page-size %s", command, STR2CSTR(val)); if ((val = rb_hash_aref(hash, rb_str_new2("pen-colors"))) != Qnil) sprintf(command, "%s --pen-colors %s", command, STR2CSTR(val)); if ((val = rb_hash_aref(hash, rb_str_new2("rotation"))) != Qnil) sprintf(command, "%s --rotation %f", command, NUM2DBL(val)); if ((val = rb_hash_aref(hash, rb_str_new2("title-font-name"))) != Qnil) sprintf(command, "%s --title-font-name %s", command, STR2CSTR(val)); if ((val = rb_hash_aref(hash, rb_str_new2("title-font-size"))) != Qnil) sprintf(command, "%s --title-font-size %f", command, NUM2DBL(val)); if ((val = rb_hash_aref(hash, rb_str_new2("toggle-rotate-y-label"))) == Qtrue) sprintf(command, "%s --toggle-rotate-y-label", command); if ((val = rb_hash_aref(hash, rb_str_new2("m"))) != Qnil) sprintf(command, "%s -m %d", command, (int) FIX2INT(val)); if ((val = rb_hash_aref(hash, rb_str_new2("S"))) != Qnil) sprintf(command, "%s -S %d", command, (int) FIX2INT(val));//.........这里部分代码省略.........
开发者ID:Zenexer,项目名称:rb-gsl,代码行数:101,
示例3: param_hash_arefstatic VALUE param_hash_aref(VALUE self, VALUE key) { if (TYPE(key) == T_SYMBOL) { key = rb_sym_to_s(key); } return rb_hash_aref(self, key);}
开发者ID:fsword,项目名称:nyara,代码行数:6,
示例4: am_bootstrap_lift/** * call-seq: * Amalgalite::Requires::Bootstrap.lift( 'dbfile' => "lib.db", 'table_name' => "bootload", 'rowid_column' => "id", 'filename_column' => "filename", 'content_column' => "contents" ) * * *WARNING* *WARNING* *WARNING* *WARNING* *WARNING* *WARNING* *WARNING* * * This is a boostrap mechanism to eval all the code in a particular column in a * specially formatted table in an sqlite database. It should only be used for * a specific purpose, mainly loading the Amalgalite ruby code directly from an * sqlite table. * * Amalgalite::Requires adds in the ability to _require_ code that is in an * sqlite database. Since Amalgalite::Requires is itself ruby code, if * Amalgalite::Requires was in an sqlite database, it could not _require_ * itself. Therefore this method is made available. It is a pure C extension * method that directly calls the sqlite3 C functions directly and uses the ruby * C api to eval the data in the table. * * This method attaches to an sqlite3 database (filename) and then does: * * SELECT filename_column_name, content_column_name * FROM table_name * ORDER BY rowid_column_name * * For each row returned it does an _eval_ on the code in the * *content_column_name* and then updates _$LOADED_FEATURES_ directly with the value from * *filename_column_name*. * * The database to be opened by _lift_ *must* be an sqlite3 UTF-8 database. * */VALUE am_bootstrap_lift( VALUE self, VALUE args ){ sqlite3* db = NULL; sqlite3_stmt* stmt = NULL; int rc; int last_row_good; char raise_msg[BUFSIZ]; VALUE am_db_c = rb_const_get( cARB, rb_intern("DEFAULT_DB") ); VALUE am_tbl_c = rb_const_get( cARB, rb_intern("DEFAULT_BOOTSTRAP_TABLE") ); VALUE am_pk_c = rb_const_get( cARB, rb_intern("DEFAULT_ROWID_COLUMN") ); VALUE am_fname_c = rb_const_get( cARB, rb_intern("DEFAULT_FILENAME_COLUMN") ); VALUE am_content_c = rb_const_get( cARB, rb_intern("DEFAULT_CONTENTS_COLUMN") ); char* dbfile = NULL; char* tbl_name = NULL; char* pk_col = NULL; char* fname_col = NULL; char* content_col = NULL; char sql[BUFSIZ]; const char* sql_tail = NULL; int sql_bytes = 0; const unsigned char* result_text = NULL; int result_length = 0; VALUE require_name = Qnil; /* ruby string of the file name for use in eval */ VALUE eval_this_code = Qnil; /* ruby string of the code to eval from the db */ VALUE toplevel_binding = rb_const_get( rb_cObject, rb_intern("TOPLEVEL_BINDING") ) ; VALUE tmp = Qnil; ID eval_id = rb_intern("eval"); if ( Qnil == args ) { args = rb_hash_new(); } else { args = rb_ary_shift( args ); } Check_Type( args, T_HASH ); /* get the arguments */ dbfile = ( Qnil == (tmp = rb_hash_aref( args, rb_str_new2( "dbfile" ) ) ) ) ? StringValuePtr( am_db_c ) : StringValuePtr( tmp ); tbl_name = ( Qnil == (tmp = rb_hash_aref( args, rb_str_new2( "table_name" ) ) ) ) ? StringValuePtr( am_tbl_c ) : StringValuePtr( tmp ); pk_col = ( Qnil == (tmp = rb_hash_aref( args, rb_str_new2( "rowid_column" ) ) ) ) ? StringValuePtr( am_pk_c ) : StringValuePtr( tmp ); fname_col = ( Qnil == (tmp = rb_hash_aref( args, rb_str_new2( "filename_column" ) ) ) ) ? StringValuePtr( am_fname_c ) : StringValuePtr( tmp ); content_col = ( Qnil == (tmp = rb_hash_aref( args, rb_str_new2( "contents_column" ) ) ) ) ? StringValuePtr( am_content_c ) : StringValuePtr( tmp ); /* open the database */ rc = sqlite3_open_v2( dbfile , &db, SQLITE_OPEN_READONLY, NULL); if ( SQLITE_OK != rc ) { memset( raise_msg, 0, BUFSIZ ); snprintf(raise_msg, BUFSIZ, "Failure to open database %s for bootload: [SQLITE_ERROR %d] : %s", dbfile, rc, sqlite3_errmsg( db ) ); am_bootstrap_cleanup_and_raise( raise_msg, db, stmt ); } /* prepare the db query */ memset( sql, 0, BUFSIZ ); sql_bytes = snprintf( sql, BUFSIZ, "SELECT %s, %s FROM %s ORDER BY %s", fname_col, content_col, tbl_name, pk_col ); rc = sqlite3_prepare_v2( db, sql, sql_bytes, &stmt, &sql_tail ) ; if ( SQLITE_OK != rc) { memset( raise_msg, 0, BUFSIZ ); snprintf( raise_msg, BUFSIZ, "Failure to prepare bootload select statement table = '%s', rowid col = '%s', filename col ='%s', contents col = '%s' : [SQLITE_ERROR %d] %s/n", tbl_name, pk_col, fname_col, content_col, rc, sqlite3_errmsg( db )); am_bootstrap_cleanup_and_raise( raise_msg, db, stmt );//.........这里部分代码省略.........
开发者ID:JEG2,项目名称:amalgalite,代码行数:101,
示例5: do_postgres_full_connect//.........这里部分代码省略......... const char *search_path = data_objects_get_uri_option(r_query, "search_path"); db = PQsetdbLogin( host, port, NULL, NULL, database, user, password ); if (PQstatus(db) == CONNECTION_BAD) { rb_raise(eDO_ConnectionError, "%s", PQerrorMessage(db)); } PGresult *result; if (search_path) { char *search_path_query; if (!(search_path_query = calloc(256, sizeof(char)))) { rb_memerror(); } snprintf(search_path_query, 256, "set search_path to %s;", search_path); r_query = rb_str_new2(search_path_query); result = do_postgres_cCommand_execute(Qnil, self, db, r_query); if (PQresultStatus(result) != PGRES_COMMAND_OK) { free(search_path_query); do_postgres_raise_error(self, result, r_query); } free(search_path_query); } const char *backslash_off = "SET backslash_quote = off"; const char *standard_strings_on = "SET standard_conforming_strings = on"; const char *warning_messages = "SET client_min_messages = warning"; const char *date_format = "SET datestyle = ISO"; VALUE r_options; r_options = rb_str_new2(backslash_off); result = do_postgres_cCommand_execute(Qnil, self, db, r_options); if (PQresultStatus(result) != PGRES_COMMAND_OK) { rb_warn("%s", PQresultErrorMessage(result)); } r_options = rb_str_new2(standard_strings_on); result = do_postgres_cCommand_execute(Qnil, self, db, r_options); if (PQresultStatus(result) != PGRES_COMMAND_OK) { rb_warn("%s", PQresultErrorMessage(result)); } r_options = rb_str_new2(warning_messages); result = do_postgres_cCommand_execute(Qnil, self, db, r_options); if (PQresultStatus(result) != PGRES_COMMAND_OK) { rb_warn("%s", PQresultErrorMessage(result)); } r_options = rb_str_new2(date_format); result = do_postgres_cCommand_execute(Qnil, self, db, r_options); if (PQresultStatus(result) != PGRES_COMMAND_OK) { rb_warn("%s", PQresultErrorMessage(result)); } VALUE encoding = rb_iv_get(self, "@encoding");#ifdef HAVE_PQSETCLIENTENCODING VALUE pg_encoding = rb_hash_aref(data_objects_const_get(mDO_PostgresEncoding, "MAP"), encoding); if (pg_encoding != Qnil) { if (PQsetClientEncoding(db, rb_str_ptr_readonly(pg_encoding))) { rb_raise(eDO_ConnectionError, "Couldn't set encoding: %s", rb_str_ptr_readonly(encoding)); } else {#ifdef HAVE_RUBY_ENCODING_H rb_iv_set(self, "@encoding_id", INT2FIX(rb_enc_find_index(rb_str_ptr_readonly(encoding))));#endif rb_iv_set(self, "@pg_encoding", pg_encoding); } } else { rb_warn("Encoding %s is not a known Ruby encoding for PostgreSQL/n", rb_str_ptr_readonly(encoding)); rb_iv_set(self, "@encoding", rb_str_new2("UTF-8"));#ifdef HAVE_RUBY_ENCODING_H rb_iv_set(self, "@encoding_id", INT2FIX(rb_enc_find_index("UTF-8")));#endif rb_iv_set(self, "@pg_encoding", rb_str_new2("UTF8")); }#endif rb_iv_set(self, "@connection", Data_Wrap_Struct(rb_cObject, 0, 0, db));}
开发者ID:CompendiumSoftware,项目名称:do,代码行数:101,
示例6: rho_ruby_hash_arefVALUE rho_ruby_hash_aref(VALUE hash, const char* key){ return rb_hash_aref( hash, rb_str_new2(key));}
开发者ID:ariejan,项目名称:rhodes,代码行数:4,
示例7: cState_configure/* * call-seq: configure(opts) * * Configure this State instance with the Hash _opts_, and return * itself. */static VALUE cState_configure(VALUE self, VALUE opts){ VALUE tmp; GET_STATE(self); tmp = rb_check_convert_type(opts, T_HASH, "Hash", "to_hash"); if (NIL_P(tmp)) tmp = rb_convert_type(opts, T_HASH, "Hash", "to_h"); opts = tmp; tmp = rb_hash_aref(opts, ID2SYM(i_indent)); if (RTEST(tmp)) { unsigned long len; Check_Type(tmp, T_STRING); len = RSTRING_LEN(tmp); state->indent = fstrndup(RSTRING_PTR(tmp), len + 1); state->indent_len = len; } tmp = rb_hash_aref(opts, ID2SYM(i_space)); if (RTEST(tmp)) { unsigned long len; Check_Type(tmp, T_STRING); len = RSTRING_LEN(tmp); state->space = fstrndup(RSTRING_PTR(tmp), len + 1); state->space_len = len; } tmp = rb_hash_aref(opts, ID2SYM(i_space_before)); if (RTEST(tmp)) { unsigned long len; Check_Type(tmp, T_STRING); len = RSTRING_LEN(tmp); state->space_before = fstrndup(RSTRING_PTR(tmp), len + 1); state->space_before_len = len; } tmp = rb_hash_aref(opts, ID2SYM(i_array_nl)); if (RTEST(tmp)) { unsigned long len; Check_Type(tmp, T_STRING); len = RSTRING_LEN(tmp); state->array_nl = fstrndup(RSTRING_PTR(tmp), len + 1); state->array_nl_len = len; } tmp = rb_hash_aref(opts, ID2SYM(i_object_nl)); if (RTEST(tmp)) { unsigned long len; Check_Type(tmp, T_STRING); len = RSTRING_LEN(tmp); state->object_nl = fstrndup(RSTRING_PTR(tmp), len + 1); state->object_nl_len = len; } tmp = ID2SYM(i_max_nesting); state->max_nesting = 100; if (option_given_p(opts, tmp)) { VALUE max_nesting = rb_hash_aref(opts, tmp); if (RTEST(max_nesting)) { Check_Type(max_nesting, T_FIXNUM); state->max_nesting = FIX2LONG(max_nesting); } else { state->max_nesting = 0; } } tmp = ID2SYM(i_depth); state->depth = 0; if (option_given_p(opts, tmp)) { VALUE depth = rb_hash_aref(opts, tmp); if (RTEST(depth)) { Check_Type(depth, T_FIXNUM); state->depth = FIX2LONG(depth); } else { state->depth = 0; } } tmp = ID2SYM(i_buffer_initial_length); if (option_given_p(opts, tmp)) { VALUE buffer_initial_length = rb_hash_aref(opts, tmp); if (RTEST(buffer_initial_length)) { long initial_length; Check_Type(buffer_initial_length, T_FIXNUM); initial_length = FIX2LONG(buffer_initial_length); if (initial_length > 0) state->buffer_initial_length = initial_length; } } tmp = rb_hash_aref(opts, ID2SYM(i_allow_nan)); state->allow_nan = RTEST(tmp); tmp = rb_hash_aref(opts, ID2SYM(i_ascii_only)); state->ascii_only = RTEST(tmp); tmp = rb_hash_aref(opts, ID2SYM(i_quirks_mode)); state->quirks_mode = RTEST(tmp); return self;}
开发者ID:brightbox,项目名称:deb-ruby2.3,代码行数:93,
示例8: draw/* call-seq: draw(hash = nil) { ... } Three keys are checked in the given hash : ":buffer" which is the buffer on which manipulation are done (by default, the actual buffer is taken), ":painter", which tell us to yield a +Joyau::Painter+ instead of a +Joyau::Buffer+ when true (false by default), and ":auto_update" which tell us whether we should update the buffer (true by default). It is mandatory to give a block to this function. Examples: Joyau.draw(:buffer => a_buffer, :painter => true) Joyau.draw(:auto_update => false) Joyau.draw(:painter => true) Joyau.draw(:buffer => a_buffer)*/VALUE Joyau_draw(int argc, VALUE *argv, VALUE self) { static bool can_draw = false; VALUE hash, block; rb_scan_args(argc, argv, "01&", &hash, &block); OSL_IMAGE *oldBuffer = oslGetDrawBuffer(); Buffer *buffer = NULL; VALUE rbPainter = Qnil; bool painter = false; bool auto_update = true; bool ruby_buf = false; bool could_draw = can_draw; if (!NIL_P(hash)) { if (TYPE(hash) != T_HASH) rb_raise(rb_eTypeError, "Hash expected for Joyau::draw."); VALUE rbBuffer = rb_hash_aref(hash, ID2SYM(rb_intern("buffer"))); if (rb_obj_is_kind_of(rbBuffer, getClass("Buffer")) == Qfalse) { if (rbBuffer != Qnil) rb_raise(rb_eTypeError, ":buffer should be a Buffer (or nil)."); } else { buffer = getPtr<Buffer>(rbBuffer); ruby_buf = true; } if (!buffer) buffer = new Buffer(oldBuffer); if (rb_hash_aref(hash, ID2SYM(rb_intern("painter"))) == Qtrue) { painter = true; Painter painter(buffer); rbPainter = createObject(getClass("Painter"), painter); } if (rb_hash_aref(hash, ID2SYM(rb_intern("auto_update"))) == Qfalse) auto_update = false; } else { if (!buffer) buffer = new Buffer(oldBuffer); } if (buffer->isScreen() && !can_draw) { can_draw = true; Graphics_startDraw(Qnil); } if (!NIL_P(block)) { buffer->setActual(); if (painter) rb_yield(rbPainter); else { VALUE rbBuffer = createObject(getClass("Buffer"), *buffer, true); rb_yield(rbBuffer); } if (buffer->isScreen() && !could_draw) { can_draw = false; Graphics_endDraw(Qnil); } if (auto_update && buffer->isScreen()) Graphics_sync(Qnil); } else rb_raise(rb_eArgError, "Block expected."); if (!ruby_buf) // We do not delete the buffer if it comes from Ruby. delete buffer; oslSetDrawBuffer(oldBuffer); return Qnil;}
开发者ID:Epictetus,项目名称:Joyau,代码行数:95,
示例9: rb_git_commit_amend/* * call-seq: * commit.amend(data = {}) -> oid * * Amend a commit object, with the given +data+ * arguments, passed as a +Hash+: * * - +:message+: a string with the full text for the commit's message * - +:committer+ (optional): a hash with the signature for the committer, * defaults to the signature from the configuration * - +:author+ (optional): a hash with the signature for the author, * defaults to the signature from the configuration * - +:tree+: the tree for this amended commit, represented as a <tt>Rugged::Tree</tt> * instance or an OID +String+. * - +:update_ref+ (optional): a +String+ with the name of a reference in the * repository which should be updated to point to this amended commit (e.g. "HEAD") * * When the amended commit is successfully written to disk, its +oid+ will be * returned as a hex +String+. * * author = {:email=>"[email C++ rb_hash_aset函数代码示例 C++ rb_gv_get函数代码示例
|