当前位置: 首页>>代码示例>>C++>>正文


C++ rb_ary_new3函数代码示例

本文整理汇总了C++中rb_ary_new3函数的典型用法代码示例。如果您正苦于以下问题:C++ rb_ary_new3函数的具体用法?C++ rb_ary_new3怎么用?C++ rb_ary_new3使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。


在下文中一共展示了rb_ary_new3函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。

示例1: frame_lines_i

static int
frame_lines_i(st_data_t key, st_data_t val, st_data_t arg)
{
    VALUE lines = (VALUE)arg;

    size_t weight = (size_t)val;
    size_t total = weight & (~(size_t)0 << (8*SIZEOF_SIZE_T/2));
    weight -= total;
    total = total >> (8*SIZEOF_SIZE_T/2);
    rb_hash_aset(lines, INT2FIX(key), rb_ary_new3(2, ULONG2NUM(total), ULONG2NUM(weight)));
    return ST_CONTINUE;
}
开发者ID:agrimm,项目名称:stackprof,代码行数:12,代码来源:stackprof.c

示例2: qos_parse

static VALUE
qos_parse(VALUE self)
{
    gdouble proportion;
    GstClockTimeDiff diff;
    GstClockTime timestamp;

    gst_event_parse_qos(RGST_EVENT(self), &proportion, &diff, &timestamp);

    return rb_ary_new3(3, DBL2NUM(proportion), LL2NUM(diff),
                       ULL2NUM(timestamp));
}
开发者ID:benolee,项目名称:ruby-gnome2,代码行数:12,代码来源:rbgst-event.c

示例3: rb_trap_exit

void
rb_trap_exit(void)
{
#ifndef MACOS_UNUSE_SIGNAL
    if (trap_list[0].cmd) {
	VALUE trap_exit = trap_list[0].cmd;

	trap_list[0].cmd = 0;
	rb_eval_cmd(trap_exit, rb_ary_new3(1, INT2FIX(0)), trap_list[0].safe);
    }
#endif
}
开发者ID:RWB01,项目名称:Code-Translator,代码行数:12,代码来源:signal.c

示例4: rbclt_behaviour_rotate_get_bounds

static VALUE
rbclt_behaviour_rotate_get_bounds (VALUE self)
{
  ClutterBehaviourRotate *brotate = CLUTTER_BEHAVIOUR_ROTATE (RVAL2GOBJ (self));
  gdouble angle_start, angle_end;

  clutter_behaviour_rotate_get_bounds (brotate,
                                       &angle_start,
                                       &angle_end);

  return rb_ary_new3 (2, rb_float_new (angle_start), rb_float_new (angle_end));
}
开发者ID:clutter-project,项目名称:rbclutter,代码行数:12,代码来源:rbcltbehaviourrotate.c

示例5: lazy_drop

static VALUE
lazy_drop(VALUE obj, VALUE n)
{
    long len = NUM2LONG(n);

    if (len < 0) {
	rb_raise(rb_eArgError, "attempt to drop negative size");
    }
    return lazy_set_method(rb_block_call(rb_cLazy, id_new, 1, &obj,
					 lazy_drop_func, n),
			   rb_ary_new3(1, n), lazy_drop_size);
}
开发者ID:Danylyuk,项目名称:first_app,代码行数:12,代码来源:enumerator.c

示例6: fnm_match_any_string

//
// same as above, but reversed:
// >> require 'fnmatch'
// >> Globber.match_any_string('*hn', ['john', 'bill', 'bob'])
// => true
// >> Globber.match_any_string('*hn', ['jake', 'jim', 'sam'])
// => false
//
static VALUE fnm_match_any_string(VALUE self, VALUE args)
{
  // variable holders
  VALUE strings, pattern, flags, nargs;

  long len = RARRAY_LEN(args);

  // extract arguments
  if ( len > 3 || len < 2 ) {
    rb_raise(rb_eArgError, "Accepts either 2 or 3 arguments"); 
  } else if ( len == 2 ) {
    pattern = rb_ary_entry(args, 0);
    strings = rb_ary_entry(args, 1);
    flags   = INT2NUM(DEFAULT_FLAG);
  } else {
    pattern = rb_ary_entry(args, 0);
    strings = rb_ary_entry(args, 1);
    flags   = rb_ary_entry(args, 2);
  }


  // sanity
  check_type(pattern, T_STRING, "input pattern");
  check_type(flags  , T_FIXNUM, "module flags");
  check_type(strings, T_ARRAY , "string list");

  int s_len = RARRAY_LEN( strings );

  // these are the loop counter and the match tracker
  int i;
	VALUE match = Qfalse,	string;

  // get a VALUE ptr to the first element
  VALUE * s_arr = RARRAY_PTR( strings );

  // go through each element and try to match
  for ( i = 0 ; i < s_len ; ++i )
  {
		// the current string
    string = s_arr[i];
    
    // perform the actual matching
		match = fnm_match( self, rb_ary_new3(3, string, pattern, flags) );

    // fnmatch returns 0 if glob match was found
    if ( match == Qtrue ) {
      return Qtrue;
    }
	}

  return Qfalse;
}
开发者ID:shiloa,项目名称:globber,代码行数:60,代码来源:globber.c

示例7: signal_exec

static void
signal_exec(VALUE cmd, int sig)
{
    rb_proc_t *proc;
    VALUE signum = INT2FIX(sig);

    if (TYPE(cmd) == T_STRING) {
	rb_eval_cmd(cmd, rb_ary_new3(1, signum), trap_list[sig].safe);
	return;
    }
    GetProcPtr(cmd, proc);
    vm_invoke_proc(GET_THREAD(), proc, proc->block.self, 1, &signum, 0);
}
开发者ID:genki,项目名称:ruby,代码行数:13,代码来源:signal.c

示例8: oci8_server_release

VALUE oci8_server_release(VALUE self)
{
    oci8_handle_t *h;
    OraText buf[1024];
    ub4 version = 0;
    sword rv;

    Get_Handle(self, h); /* 0 */
    rv = OCIServerRelease(h->hp, h->errhp, buf, sizeof(buf), h->type, &version);
    if (rv != OCI_SUCCESS)
        oci8_raise(h->errhp, rv, NULL);
    return rb_ary_new3(2, INT2FIX(version), rb_str_new2(buf));
}
开发者ID:kevincolyar,项目名称:ruby_oracle_libs,代码行数:13,代码来源:server.c

示例9: rg_size

static VALUE
rg_size(VALUE self)
{
    int rows, columns;
    gboolean result;
    GError *error = NULL;

    result = vte_pty_get_size(_SELF(self), &rows, &columns, &error);
    if (error)
        RAISE_GERROR(error);

    return rb_ary_new3(2, INT2NUM(rows), INT2NUM(columns));
}
开发者ID:Vasfed,项目名称:ruby-gnome2,代码行数:13,代码来源:rbvtepty.c

示例10: cr_surface_get_fallback_resolution

static VALUE
cr_surface_get_fallback_resolution (VALUE self)
{
  double x_pixels_per_inch, y_pixels_per_inch;

  cairo_surface_get_fallback_resolution (_SELF,
                                         &x_pixels_per_inch,
                                         &y_pixels_per_inch);
  cr_surface_check_status (_SELF);
  return rb_ary_new3 (2,
                      rb_float_new (x_pixels_per_inch),
                      rb_float_new (y_pixels_per_inch));
}
开发者ID:exvayn,项目名称:cairo-1.8.1-i386,代码行数:13,代码来源:rb_cairo_surface.c

示例11: defined

#include "kgio.h"
#include "my_fileno.h"
static ID id_wait_rd, id_wait_wr;

#if defined(HAVE_RB_TIME_INTERVAL) && defined(HAVE_RB_WAIT_FOR_SINGLE_FD)
static int kgio_timedwait(VALUE self, VALUE timeout, int write_p)
{
	struct timeval tv = rb_time_interval(timeout);
	int events = write_p ? RB_WAITFD_OUT : RB_WAITFD_IN;

	return rb_wait_for_single_fd(my_fileno(self), events, &tv);
}
#else  /* ! (HAVE_RB_TIME_INTERVAL && HAVE_RB_WAIT_FOR_SINGLE_FD) */
static int kgio_timedwait(VALUE self, VALUE timeout, int write_p)
{
	VALUE argv[4];
	VALUE set = rb_ary_new3(1, self);

	argv[0] = write_p ? Qnil : set;
	argv[1] = write_p ? set : Qnil;
	argv[2] = Qnil;
	argv[3] = timeout;

	set = rb_funcall2(rb_cIO, rb_intern("select"), 4, argv);
	return NIL_P(set) ? 0 : 1;
}
开发者ID:7kaji,项目名称:try,代码行数:26,代码来源:wait.c

示例12: rg_get_dest_row_at_pos

static VALUE
rg_get_dest_row_at_pos(VALUE self, VALUE drag_x, VALUE drag_y)
{
    GtkTreePath* path;
    GtkTreeViewDropPosition pos;
    gboolean ret;

    ret = gtk_tree_view_get_dest_row_at_pos(_SELF(self), 
                                            NUM2INT(drag_x), NUM2INT(drag_y),
                                            &path, &pos);
    return ret ? rb_ary_new3(2, path ? GTKTREEPATH2RVAL(path) : Qnil, 
                             GENUM2RVAL(pos, GTK_TYPE_TREE_VIEW_DROP_POSITION)) : Qnil;
}
开发者ID:Vasfed,项目名称:ruby-gnome2,代码行数:13,代码来源:rbgtktreeview.c

示例13: rb_to_ary

/*
 * call-seq:
 *   to_ary -> [hu1, hu2, ... ,hu7]
 *
 * Return values by Array.
 */
VALUE
rb_to_ary(VALUE self)
{
  CvHuMoments *hu_moments = CVHUMOMENTS(self);
  return rb_ary_new3(7,
		     rb_float_new(hu_moments->hu1),
		     rb_float_new(hu_moments->hu2),
		     rb_float_new(hu_moments->hu3),
		     rb_float_new(hu_moments->hu4),
		     rb_float_new(hu_moments->hu5),
		     rb_float_new(hu_moments->hu6),
		     rb_float_new(hu_moments->hu7));
}
开发者ID:Wenackles,项目名称:ruby-opencv,代码行数:19,代码来源:cvhumoments.cpp

示例14: segment_parse

static VALUE
segment_parse(VALUE self)
{
    GstFormat format;
    gdouble rate;
    gint64 start_value, stop_value;

    gst_query_parse_segment(RVAL2GST_QUERY(self), &rate, &format,
                            &start_value, &stop_value);

    return rb_ary_new3(4, rb_dbl2big(rate), GST_FORMAT2RVAL(format),
                        LL2NUM(start_value), LL2NUM(stop_value));
}
开发者ID:Mazwak,项目名称:ruby-gnome2,代码行数:13,代码来源:rbgst-query.c

示例15: latency_parse

static VALUE
latency_parse(VALUE self)
{
    GstClockTime min_latency;
    GstClockTime max_latency;
    gboolean live;

    gst_query_parse_latency(RVAL2GST_QUERY(self), &live, &min_latency,
                            &max_latency);

    return rb_ary_new3(3, CBOOL2RVAL(live), ULL2NUM(min_latency),
                       ULL2NUM(max_latency));
}
开发者ID:Mazwak,项目名称:ruby-gnome2,代码行数:13,代码来源:rbgst-query.c


注:本文中的rb_ary_new3函数示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。