本文整理汇总了C++中RVAL2TERM函数的典型用法代码示例。如果您正苦于以下问题:C++ RVAL2TERM函数的具体用法?C++ RVAL2TERM怎么用?C++ RVAL2TERM使用的例子?那么, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了RVAL2TERM函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: term_get_text
static VALUE
term_get_text(int argc, VALUE *argv, VALUE self)
{
VALUE get_attrs, include_trailing_spaces, proc, rb_text;
GArray *attrs = NULL;
char *text;
rb_scan_args(argc, argv, "02&", &get_attrs,
&include_trailing_spaces, &proc);
if (get_attrs != Qfalse)
attrs = g_array_new(FALSE, TRUE, sizeof(VteCharAttributes));
if (RVAL2CBOOL(include_trailing_spaces)) {
text = vte_terminal_get_text_include_trailing_spaces(
RVAL2TERM(self), term_is_selected_cb, (gpointer)proc, attrs);
} else {
text = vte_terminal_get_text(RVAL2TERM(self), term_is_selected_cb,
(gpointer)proc, attrs);
}
rb_text = CSTR2RVAL(text);
free(text);
if (attrs) {
VALUE rb_attrs;
rb_attrs = attrary2rval(attrs);
g_array_free(attrs, TRUE);
return rb_ary_new3(2, rb_text, rb_attrs);
} else {
return rb_text;
}
}
示例2: term_set_background_image
static VALUE
term_set_background_image(VALUE self, VALUE image_or_path)
{
if (RVAL2CBOOL(rb_obj_is_kind_of(image_or_path, rb_cString))) {
vte_terminal_set_background_image_file(RVAL2TERM(self),
RVAL2CSTR(image_or_path));
} else {
vte_terminal_set_background_image(RVAL2TERM(self),
RVAL2GOBJ(image_or_path));
}
return Qnil;
}
示例3: term_set_cursor_blinks
static VALUE
term_set_cursor_blinks(VALUE self, VALUE blink)
{
#if VTE_CHECK_VERSION(0, 18, 0)
VteTerminalCursorBlinkMode mode;
mode = RVAL2CBOOL(blink) ? VTE_CURSOR_BLINK_ON : VTE_CURSOR_BLINK_OFF;
vte_terminal_set_cursor_blink_mode(RVAL2TERM(self), mode);
#else
vte_terminal_set_cursor_blinks(RVAL2TERM(self), RVAL2CBOOL(blink));
#endif
return Qnil;
}
示例4: rg_match_set_cursor
static VALUE
rg_match_set_cursor(VALUE self, VALUE tag, VALUE cursor)
{
if (NIL_P(cursor) || RVAL2GTYPE(cursor) == GDK_TYPE_CURSOR) {
vte_terminal_match_set_cursor(RVAL2TERM(self), NUM2INT(tag), RVAL2GOBJ(cursor));
} else if (RVAL2GTYPE(cursor) == GDK_TYPE_CURSOR_TYPE) {
vte_terminal_match_set_cursor_type(RVAL2TERM(self), NUM2INT(tag), RVAL2CT(cursor));
#if VTE_CHECK_VERSION(0, 17, 1)
} else {
vte_terminal_match_set_cursor_name(_SELF(self), NUM2INT(tag), RVAL2CSTR(cursor));
#endif
}
return self;
}
示例5: term_set_background_saturation
static VALUE
term_set_background_saturation(VALUE self, VALUE saturation)
{
vte_terminal_set_background_saturation(RVAL2TERM(self),
NUM2DBL(saturation));
return Qnil;
}
示例6: term_set_colors
static VALUE
term_set_colors(VALUE self, VALUE foreground, VALUE background,
VALUE rb_palette)
{
glong i, len;
GdkColor *palette;
len = RARRAY_LEN(rb_palette);
if (!(len == 0 || len == 8 || len == 16 || len == 24)) {
char *inspect;
inspect = RVAL2CSTR(rb_palette);
rb_raise(rb_eArgError, "palette size must be 0, 8, 16 or 24: %s",
inspect);
}
palette = ALLOCA_N(GdkColor, len);
for (i = 0; i < len; i++) {
GdkColor *color;
color = RVAL2COLOR(RARRAY_PTR(rb_palette)[i]);
palette[i] = *color;
}
vte_terminal_set_colors(RVAL2TERM(self), RVAL2COLOR(foreground),
RVAL2COLOR(background), palette, len);
return Qnil;
}
示例7: term_set_color_cursor
static VALUE
term_set_color_cursor(VALUE self, VALUE cursor)
{
vte_terminal_set_color_cursor(RVAL2TERM(self),
NIL_P(cursor) ? NULL : RVAL2COLOR(cursor));
return Qnil;
}
示例8: term_match_set_cursor_type
static VALUE
term_match_set_cursor_type(VALUE self, VALUE tag, VALUE cursor_type)
{
vte_terminal_match_set_cursor_type(RVAL2TERM(self), NUM2INT(tag),
RVAL2CT(cursor_type));
return Qnil;
}
示例9: term_fork_command
static VALUE
term_fork_command(int argc, VALUE *argv, VALUE self)
{
VALUE rb_command, rb_command_argv, rb_envv, rb_directory;
VALUE lastlog, utmp, wtmp;
char *command;
char **command_argv;
char **envv;
char *directory;
pid_t pid;
rb_scan_args(argc, argv, "07", &rb_command, &rb_command_argv,
&rb_envv, &rb_directory, &lastlog, &utmp, &wtmp);
command = NIL_P(rb_command) ? NULL : RVAL2CSTR(rb_command);
command_argv = rval2cstrary(rb_command_argv);
envv = rval2cstrary(rb_envv);
directory = NIL_P(rb_directory) ? NULL : RVAL2CSTR(rb_directory);
pid = vte_terminal_fork_command(RVAL2TERM(self), command,
command_argv, envv, directory,
NIL_P(lastlog) ? TRUE : RVAL2CBOOL(lastlog),
NIL_P(utmp) ? TRUE : RVAL2CBOOL(utmp),
NIL_P(wtmp) ? TRUE : RVAL2CBOOL(wtmp));
free_cstrary(command_argv);
free_cstrary(envv);
return INT2NUM(pid);
}
示例10: term_set_background_transparent
static VALUE
term_set_background_transparent(VALUE self, VALUE transparent)
{
vte_terminal_set_background_transparent(RVAL2TERM(self),
RVAL2CBOOL(transparent));
return Qnil;
}
示例11: term_reset
static VALUE
term_reset(VALUE self, VALUE full, VALUE clear_history)
{
vte_terminal_reset(RVAL2TERM(self), RVAL2CBOOL(full),
RVAL2CBOOL(clear_history));
return Qnil;
}
示例12: term_set_font
static VALUE
term_set_font(int argc, VALUE *argv, VALUE self)
{
VALUE font_desc_or_name, rb_antialias;
VteTerminalAntiAlias antialias = VTE_ANTI_ALIAS_USE_DEFAULT;
VteTerminal *term;
rb_scan_args(argc, argv, "11", &font_desc_or_name, &rb_antialias);
term = RVAL2TERM(self);
if (!NIL_P(rb_antialias))
antialias = RVAL2AA(rb_antialias);
if (rb_obj_is_kind_of(font_desc_or_name, rb_cString)) {
char *name;
name = RVAL2CSTR(font_desc_or_name);
if (NIL_P(rb_antialias))
vte_terminal_set_font_from_string(term, name);
else
vte_terminal_set_font_from_string_full(term, name, antialias);
} else {
PangoFontDescription *font_desc;
font_desc = RVAL2PFD(font_desc_or_name);
if (NIL_P(rb_antialias))
vte_terminal_set_font(term, font_desc);
else
vte_terminal_set_font_full(term, font_desc, antialias);
}
return Qnil;
}
示例13: term_get_font
static VALUE
term_get_font(VALUE self)
{
PangoFontDescription *font_desc;
font_desc = (PangoFontDescription *)vte_terminal_get_font(RVAL2TERM(self));
return PFD2RVAL(font_desc);
}
示例14: term_get_text_range
static VALUE
term_get_text_range(int argc, VALUE *argv, VALUE self)
{
VALUE start_row, start_col, end_row, end_col, get_attrs, proc, rb_text;
GArray *attrs = NULL;
char *text;
rb_scan_args(argc, argv, "41&", &start_row, &start_col,
&end_row, &end_col, &get_attrs, &proc);
if (get_attrs != Qfalse)
attrs = g_array_new(FALSE, TRUE, sizeof(VteCharAttributes));
text = vte_terminal_get_text_range(RVAL2TERM(self),
NUM2LONG(start_row),
NUM2LONG(start_col),
NUM2LONG(end_row),
NUM2LONG(end_col),
term_is_selected_cb,
(gpointer)proc,
attrs);
rb_text = CSTR2RVAL(text);
free(text);
if (attrs) {
VALUE rb_attrs;
rb_attrs = attrary2rval(attrs);
g_array_free(attrs, TRUE);
return rb_ary_new3(2, rb_text, rb_attrs);
} else {
return rb_text;
}
}
示例15: term_get_cursor_position
static VALUE
term_get_cursor_position(VALUE self)
{
glong column, row;
vte_terminal_get_cursor_position(RVAL2TERM(self), &column, &row);
return rb_ary_new3(2, LONG2NUM(column), LONG2NUM(row));
}