本文整理汇总了C++中rb_ary_new3函数的典型用法代码示例。如果您正苦于以下问题:C++ rb_ary_new3函数的具体用法?C++ rb_ary_new3怎么用?C++ rb_ary_new3使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了rb_ary_new3函数的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的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, ×tamp);
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
示例16: seeking_parse
static VALUE
seeking_parse(VALUE self)
{
GstFormat format;
gboolean seekable;
gint64 segment_start, segment_end;
gst_query_parse_seeking(RVAL2GST_QUERY(self), &format, &seekable,
&segment_start, &segment_end);
return rb_ary_new3(4, GST_FORMAT2RVAL(format), CBOOL2RVAL(seekable),
LL2NUM(segment_start), LL2NUM(segment_end));
}
开发者ID:Mazwak,项目名称:ruby-gnome2,代码行数:13,代码来源:rbgst-query.c
示例17: rbhtp_r_string_table
static VALUE rbhtp_r_string_table( table_t* table )
{
if ( table == NULL ) return Qnil;
bstr k, v;
VALUE r = rb_ary_new();
table_iterator_reset( table );
while ( ( k = table_iterator_next( table, &v ) ) != NULL ) {
rb_ary_push( r, rb_ary_new3( 2,
BSTR_TO_RSTR( k ), BSTR_TO_RSTR( v ) ) );
}
return r;
}
开发者ID:aburan28,项目名称:ironbee,代码行数:13,代码来源:HTP.c
示例18: Init_rsvg2
void
Init_rsvg2(void)
{
VALUE RG_TARGET_NAMESPACE = rb_define_module("RSVG");
#if LIBRSVG_CHECK_VERSION(2, 9, 0)
rsvg_init();
atexit(rsvg_term);
#endif
G_DEF_ERROR(RSVG_ERROR, "Error", RG_TARGET_NAMESPACE, rb_eRuntimeError, RSVG_TYPE_ERROR);
rb_define_const(RG_TARGET_NAMESPACE, "BINDING_VERSION",
rb_ary_new3(3,
INT2FIX(RBRSVG_MAJOR_VERSION),
INT2FIX(RBRSVG_MINOR_VERSION),
INT2FIX(RBRSVG_MICRO_VERSION)));
rb_define_const(RG_TARGET_NAMESPACE, "BUILD_VERSION",
rb_ary_new3(3,
INT2FIX(LIBRSVG_MAJOR_VERSION),
INT2FIX(LIBRSVG_MINOR_VERSION),
INT2FIX(LIBRSVG_MICRO_VERSION)));
RG_DEF_SMETHOD(set_default_dpi, 1);
RG_DEF_SMETHOD(set_default_dpi_x_y, 2);
/* Convenience API */
RG_DEF_SMETHOD(pixbuf_from_file, 1);
RG_DEF_SMETHOD(pixbuf_from_file_at_zoom, 3);
RG_DEF_SMETHOD(pixbuf_from_file_at_size, 3);
RG_DEF_SMETHOD(pixbuf_from_file_at_max_size, 3);
RG_DEF_SMETHOD(pixbuf_from_file_at_zoom_with_max, 5);
RG_DEF_SMETHOD_P(cairo_available, 0);
Init_rsvg_handle(RG_TARGET_NAMESPACE);
Init_rsvg_dimensiondata(RG_TARGET_NAMESPACE);
}
开发者ID:Vasfed,项目名称:ruby-gnome2,代码行数:39,代码来源:rbrsvg.c
示例19: path_split
/*
* Returns the #dirname and the #basename in an Array.
*
* See File.split.
*/
static VALUE
path_split(VALUE self)
{
VALUE str = get_strpath(self);
VALUE ary, dirname, basename;
ary = rb_funcall(rb_cFile, rb_intern("split"), 1, str);
ary = rb_check_array_type(ary);
dirname = rb_ary_entry(ary, 0);
basename = rb_ary_entry(ary, 1);
dirname = rb_class_new_instance(1, &dirname, rb_obj_class(self));
basename = rb_class_new_instance(1, &basename, rb_obj_class(self));
return rb_ary_new3(2, dirname, basename);
}
开发者ID:gferguson-gd,项目名称:ruby,代码行数:18,代码来源:pathname.c
示例20: r_mpfi_vector_each_element_with_index
/* Evaluate block with each element and its index. */
static VALUE r_mpfi_vector_each_element_with_index (VALUE self) {
MPFIMatrix *ptr_self;
VALUE ret;
int i;
RETURN_ENUMERATOR(self, 0, NULL);
r_mpfi_get_matrix_struct(ptr_self, self);
ret = Qnil;
for (i = 0; i < ptr_self->size; i++) {
volatile VALUE el = r_mpfi_make_new_fi_obj(ptr_self->data + i);
ret = rb_yield(rb_ary_new3(2, el, INT2NUM(i)));
}
return ret;
}
开发者ID:ytaka,项目名称:ruby-mpfi,代码行数:14,代码来源:ruby_mpfi_matrix.c
注:本文中的rb_ary_new3函数示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论