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


C++ options_get_number函数代码示例

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


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

示例1: status_update_saved

/* Update status cache. */
void
status_update_saved(struct session *s)
{
	if (!options_get_number(s->options, "status"))
		s->statusat = -1;
	else if (options_get_number(s->options, "status-position") == 0)
		s->statusat = 0;
	else
		s->statusat = 1;
}
开发者ID:jaredmcneill,项目名称:netbsd-src,代码行数:11,代码来源:status.c

示例2: input_mouse

/* Translate mouse and output. */
void
input_mouse(struct window_pane *wp, struct session *s, struct mouse_event *m)
{
	char			 buf[40];
	size_t			 len;
	struct paste_buffer	*pb;

	if (wp->screen->mode & ALL_MOUSE_MODES) {
		/*
		 * Use the SGR (1006) extension only if the application
		 * requested it and the underlying terminal also sent the event
		 * in this format (this is because an old style mouse release
		 * event cannot be converted into the new SGR format, since the
		 * released button is unknown). Otherwise pretend that tmux
		 * doesn't speak this extension, and fall back to the UTF-8
		 * (1005) extension if the application requested, or to the
		 * legacy format.
		 */
		if (m->sgr && (wp->screen->mode & MODE_MOUSE_SGR)) {
			len = xsnprintf(buf, sizeof buf, "\033[<%d;%d;%d%c",
			    m->sgr_xb, m->x + 1, m->y + 1,
			    m->sgr_rel ? 'm' : 'M');
		} else if (wp->screen->mode & MODE_MOUSE_UTF8) {
			len = xsnprintf(buf, sizeof buf, "\033[M");
			len += utf8_split2(m->xb + 32, &buf[len]);
			len += utf8_split2(m->x + 33, &buf[len]);
			len += utf8_split2(m->y + 33, &buf[len]);
		} else {
			if (m->xb > 223 || m->x >= 222 || m->y > 222)
				return;
			len = xsnprintf(buf, sizeof buf, "\033[M");
			buf[len++] = m->xb + 32;
			buf[len++] = m->x + 33;
			buf[len++] = m->y + 33;
		}
		bufferevent_write(wp->event, buf, len);
		return;
	}

	if (m->button == 1 && (m->event & MOUSE_EVENT_CLICK) &&
	    options_get_number(&wp->window->options, "mode-mouse") == 1) {
		pb = paste_get_top(&global_buffers);
		if (pb != NULL) {
			paste_send_pane(pb, wp, "\r",
			    wp->screen->mode & MODE_BRACKETPASTE);
		}
	} else if ((m->xb & 3) != 1 &&
	    options_get_number(&wp->window->options, "mode-mouse") == 1) {
		if (window_pane_set_mode(wp, &window_copy_mode) == 0) {
			window_copy_init_from_pane(wp);
			if (wp->mode->mouse != NULL)
				wp->mode->mouse(wp, s, m);
		}
	}
}
开发者ID:goller,项目名称:tmate-slave,代码行数:56,代码来源:input-keys.c

示例3: window_copy_update_selection

int
window_copy_update_selection(struct window_pane *wp)
{
	struct window_copy_mode_data	*data = wp->modedata;
	struct screen			*s = &data->screen;
	struct options			*oo = &wp->window->options;
	struct grid_cell		 gc;
	u_int				 sx, sy, ty, cy;

	if (!s->sel.flag)
		return (0);

	/* Set colours. */
	memcpy(&gc, &grid_default_cell, sizeof gc);
	colour_set_fg(&gc, options_get_number(oo, "mode-fg"));
	colour_set_bg(&gc, options_get_number(oo, "mode-bg"));
	gc.attr |= options_get_number(oo, "mode-attr");

	/* Find top of screen. */
	ty = screen_hsize(&wp->base) - data->oy;

	/* Adjust the selection. */
	sx = data->selx;
	sy = data->sely;
	if (sy < ty) {					/* above screen */
		if (!data->rectflag)
			sx = 0;
		sy = 0;
	} else if (sy > ty + screen_size_y(s) - 1) {	/* below screen */
		if (!data->rectflag)
			sx = screen_size_x(s) - 1;
		sy = screen_size_y(s) - 1;
	} else
		sy -= ty;
	sy = screen_hsize(s) + sy;

	screen_set_selection(s,
	    sx, sy, data->cx, screen_hsize(s) + data->cy, data->rectflag, &gc);

	if (data->rectflag) {
		/*
		 * Can't rely on the caller to redraw the right lines for
		 * rectangle selection - find the highest line and the number
		 * of lines, and redraw just past that in both directions
		 */
		cy = data->cy;
		if (sy < cy)
			window_copy_redraw_lines(wp, sy, cy - sy + 1);
		else
			window_copy_redraw_lines(wp, cy, sy - cy + 1);
	}

	return (1);
}
开发者ID:ThomasAdam,项目名称:tmux-ARCHIVED,代码行数:54,代码来源:window-copy.c

示例4: status_at_line

/* Get screen line of status line. -1 means off. */
int
status_at_line(struct client *c)
{
	struct session	*s = c->session;

	if (!options_get_number(&s->options, "status"))
		return (-1);

	if (options_get_number(&s->options, "status-position") == 0)
		return (0);
	return (c->tty.sy - 1);
}
开发者ID:dotpolice,项目名称:tmux,代码行数:13,代码来源:status.c

示例5: window_copy_init

struct screen *
window_copy_init(struct window_pane *wp)
{
	struct window_copy_mode_data	*data;
	struct screen			*s;
	struct screen_write_ctx	 	 ctx;
	u_int				 i;
	int				 keys;

	wp->modedata = data = xmalloc(sizeof *data);
	data->oy = 0;
	data->cx = wp->base.cx;
	data->cy = wp->base.cy;

	data->lastcx = 0;
	data->lastsx = 0;

	data->rectflag = 0;

	data->inputtype = WINDOW_COPY_OFF;
	data->inputprompt = NULL;
	data->inputstr = xstrdup("");
	data->numprefix = 0;

	data->searchtype = WINDOW_COPY_OFF;
	data->searchstr = NULL;

	wp->flags |= PANE_FREEZE;
	bufferevent_disable(wp->event, EV_READ|EV_WRITE);

	s = &data->screen;
	screen_init(s, screen_size_x(&wp->base), screen_size_y(&wp->base), 0);
	if (options_get_number(&wp->window->options, "mode-mouse"))
		s->mode |= MODE_MOUSE;

	keys = options_get_number(&wp->window->options, "mode-keys");
	if (keys == MODEKEY_EMACS)
		mode_key_init(&data->mdata, &mode_key_tree_emacs_copy);
	else
		mode_key_init(&data->mdata, &mode_key_tree_vi_copy);

	s->cx = data->cx;
	s->cy = data->cy;

	screen_write_start(&ctx, NULL, s);
	for (i = 0; i < screen_size_y(s); i++)
		window_copy_write_line(wp, &ctx, i);
	screen_write_cursormove(&ctx, data->cx, data->cy);
	screen_write_stop(&ctx);

	return (s);
}
开发者ID:ThomasAdam,项目名称:tmux-ARCHIVED,代码行数:52,代码来源:window-copy.c

示例6: cmd_send_keys_exec

enum cmd_retval
cmd_send_keys_exec(struct cmd *self, struct cmd_q *cmdq)
{
	struct args		*args = self->args;
	struct window_pane	*wp;
	struct session		*s;
	struct input_ctx	*ictx;
	const u_char		*str;
	int			 i, key;

	if (cmd_find_pane(cmdq, args_get(args, 't'), &s, &wp) == NULL)
		return (CMD_RETURN_ERROR);

	if (self->entry == &cmd_send_prefix_entry) {
		if (args_has(args, '2'))
			key = options_get_number(&s->options, "prefix2");
		else
			key = options_get_number(&s->options, "prefix");
		window_pane_key(wp, s, key);
		return (CMD_RETURN_NORMAL);
	}

	if (args_has(args, 'R')) {
		ictx = &wp->ictx;

		memcpy(&ictx->cell, &grid_default_cell, sizeof ictx->cell);
		memcpy(&ictx->old_cell, &ictx->cell, sizeof ictx->old_cell);
		ictx->old_cx = 0;
		ictx->old_cy = 0;

		if (wp->mode == NULL)
			screen_write_start(&ictx->ctx, wp, &wp->base);
		else
			screen_write_start(&ictx->ctx, NULL, &wp->base);
		screen_write_reset(&ictx->ctx);
		screen_write_stop(&ictx->ctx);
	}

	for (i = 0; i < args->argc; i++) {
		str = args->argv[i];

		if (!args_has(args, 'l') &&
		    (key = key_string_lookup_string(str)) != KEYC_NONE) {
			    window_pane_key(wp, s, key);
		} else {
			for (; *str != '\0'; str++)
			    window_pane_key(wp, s, *str);
		}
	}

	return (CMD_RETURN_NORMAL);
}
开发者ID:chjj,项目名称:tmux,代码行数:52,代码来源:cmd-send-keys.c

示例7: any_status_at_zero

/* Is there any status (main or aux) at line zero? (1 True, 0 False) */
int
any_status_at_zero(struct client *c)
{
    struct session *s = c->session;

    if (options_get_number(s->options, "status") && 
         (options_get_number(s->options, "status-position")==0))
        return 1;
    if (options_get_number(s->options, "aux-status") && 
         (options_get_number(s->options, "aux-status-position")==0))
        return 1;
    return 0;
}
开发者ID:tonyfischetti,项目名称:tmux,代码行数:14,代码来源:status.c

示例8: window_clock_draw_screen

void
window_clock_draw_screen(struct window_pane *wp)
{
	struct window_clock_mode_data	*data = wp->modedata;
	struct screen_write_ctx	 	 ctx;
	int				 colour, style;

	colour = options_get_number(&wp->window->options, "clock-mode-colour");
	style = options_get_number(&wp->window->options, "clock-mode-style");

	screen_write_start(&ctx, NULL, &data->screen);
	clock_draw(&ctx, colour, style);
	screen_write_stop(&ctx);
}
开发者ID:dsturnbull,项目名称:tmux,代码行数:14,代码来源:window-clock.c

示例9: window_copy_init

struct screen *
window_copy_init(struct window_pane *wp)
{
	struct window_copy_mode_data	*data;
	struct screen			*s;
	int				 keys;

	wp->modedata = data = xmalloc(sizeof *data);
	data->oy = 0;
	data->cx = 0;
	data->cy = 0;

	data->lastcx = 0;
	data->lastsx = 0;

	data->backing_written = 0;

	data->rectflag = 0;

	data->inputtype = WINDOW_COPY_OFF;
	data->inputprompt = NULL;
	data->inputstr = xstrdup("");
	data->numprefix = 0;

	data->searchtype = WINDOW_COPY_OFF;
	data->searchstr = NULL;

	wp->flags |= PANE_FREEZE;
	if (wp->fd != -1)
		bufferevent_disable(wp->event, EV_READ|EV_WRITE);

	data->jumptype = WINDOW_COPY_OFF;
	data->jumpchar = '\0';

	s = &data->screen;
	screen_init(s, screen_size_x(&wp->base), screen_size_y(&wp->base), 0);
	if (options_get_number(&wp->window->options, "mode-mouse"))
		s->mode |= MODE_MOUSE_STANDARD;

	keys = options_get_number(&wp->window->options, "mode-keys");
	if (keys == MODEKEY_EMACS)
		mode_key_init(&data->mdata, &mode_key_tree_emacs_copy);
	else
		mode_key_init(&data->mdata, &mode_key_tree_vi_copy);

	data->backing = NULL;

	return (s);
}
开发者ID:ddollar,项目名称:tmux,代码行数:49,代码来源:window-copy.c

示例10: cmd_send_keys_exec

enum cmd_retval
cmd_send_keys_exec(struct cmd *self, struct cmd_q *cmdq)
{
	struct args		*args = self->args;
	struct mouse_event	*m = &cmdq->item->mouse;
	struct window_pane	*wp;
	struct session		*s;
	const char		*str;
	int			 i, key;

	if (args_has(args, 'M')) {
		wp = cmd_mouse_pane(m, &s, NULL);
		if (wp == NULL) {
			cmdq_error(cmdq, "no mouse target");
			return (CMD_RETURN_ERROR);
		}
		window_pane_key(wp, NULL, s, m->key, m);
		return (CMD_RETURN_NORMAL);
	}

	if (cmd_find_pane(cmdq, args_get(args, 't'), &s, &wp) == NULL)
		return (CMD_RETURN_ERROR);

	if (self->entry == &cmd_send_prefix_entry) {
		if (args_has(args, '2'))
			key = options_get_number(&s->options, "prefix2");
		else
			key = options_get_number(&s->options, "prefix");
		window_pane_key(wp, NULL, s, key, NULL);
		return (CMD_RETURN_NORMAL);
	}

	if (args_has(args, 'R'))
		input_reset(wp);

	for (i = 0; i < args->argc; i++) {
		str = args->argv[i];

		if (!args_has(args, 'l') &&
		    (key = key_string_lookup_string(str)) != KEYC_NONE) {
			window_pane_key(wp, NULL, s, key, NULL);
		} else {
			for (; *str != '\0'; str++)
				window_pane_key(wp, NULL, s, *str, NULL);
		}
	}

	return (CMD_RETURN_NORMAL);
}
开发者ID:ajinkya93,项目名称:netbsd-src,代码行数:49,代码来源:cmd-send-keys.c

示例11: window_copy_write_line

void
window_copy_write_line(
    struct window_pane *wp, struct screen_write_ctx *ctx, u_int py)
{
	struct window_copy_mode_data	*data = wp->modedata;
	struct screen			*s = &data->screen;
	struct options			*oo = &wp->window->options;
	struct grid_cell		 gc;
	char				 hdr[32];
	size_t	 			 last, xoff = 0, size = 0;

	memcpy(&gc, &grid_default_cell, sizeof gc);
	colour_set_fg(&gc, options_get_number(oo, "mode-fg"));
	colour_set_bg(&gc, options_get_number(oo, "mode-bg"));
	gc.attr |= options_get_number(oo, "mode-attr");

	last = screen_size_y(s) - 1;
	if (py == 0) {
		size = xsnprintf(hdr, sizeof hdr,
		    "[%u/%u]", data->oy, screen_hsize(data->backing));
		if (size > screen_size_x(s))
			size = screen_size_x(s);
		screen_write_cursormove(ctx, screen_size_x(s) - size, 0);
		screen_write_puts(ctx, &gc, "%s", hdr);
	} else if (py == last && data->inputtype != WINDOW_COPY_OFF) {
		if (data->inputtype == WINDOW_COPY_NUMERICPREFIX) {
			xoff = size = xsnprintf(hdr, sizeof hdr,
			    "Repeat: %u", data->numprefix);
		} else {
			xoff = size = xsnprintf(hdr, sizeof hdr,
			    "%s: %s", data->inputprompt, data->inputstr);
		}
		screen_write_cursormove(ctx, 0, last);
		screen_write_puts(ctx, &gc, "%s", hdr);
	} else
		size = 0;

	screen_write_cursormove(ctx, xoff, py);
	screen_write_copy(ctx, data->backing, xoff,
	    (screen_hsize(data->backing) - data->oy) + py,
	    screen_size_x(s) - size, 1);

	if (py == data->cy && data->cx == screen_size_x(s)) {
		memcpy(&gc, &grid_default_cell, sizeof gc);
		screen_write_cursormove(ctx, screen_size_x(s) - 1, py);
		screen_write_putc(ctx, &gc, '$');
	}
}
开发者ID:ddollar,项目名称:tmux,代码行数:48,代码来源:window-copy.c

示例12: cmd_set_option_flag

void
cmd_set_option_flag(struct cmd_ctx *ctx, struct options *oo,
    const struct set_option_entry *entry, char *value)
{
	struct options_entry	*o;
	int			 flag;

	if (value == NULL || *value == '\0')
		flag = !options_get_number(oo, entry->name);
	else {
		if ((value[0] == '1' && value[1] == '\0') ||
		    strcasecmp(value, "on") == 0 ||
		    strcasecmp(value, "yes") == 0)
			flag = 1;
		else if ((value[0] == '0' && value[1] == '\0') ||
		    strcasecmp(value, "off") == 0 ||
		    strcasecmp(value, "no") == 0)
			flag = 0;
		else {
			ctx->error(ctx, "bad value: %s", value);
			return;
		}
	}

	o = options_set_number(oo, entry->name, flag);
	ctx->info(ctx,
	    "set option: %s -> %s", o->name, cmd_set_option_print(entry, o));
}
开发者ID:ThomasAdam,项目名称:tmux-ARCHIVED,代码行数:28,代码来源:cmd-set-option.c

示例13: input_mouse

/* Translate mouse and output. */
void
input_mouse(struct window_pane *wp, struct mouse_event *m)
{
	char	buf[10];
	size_t	len;

	if (wp->screen->mode & ALL_MOUSE_MODES) {
		if (wp->screen->mode & MODE_MOUSE_UTF8) {
			len = xsnprintf(buf, sizeof buf, "\033[M");
			len += utf8_split2(m->b + 32, &buf[len]);
			len += utf8_split2(m->x + 33, &buf[len]);
			len += utf8_split2(m->y + 33, &buf[len]);
		} else {
			if (m->b > 223 || m->x >= 222 || m->y > 222)
				return;
			len = xsnprintf(buf, sizeof buf, "\033[M");
			buf[len++] = m->b + 32;
			buf[len++] = m->x + 33;
			buf[len++] = m->y + 33;
		}
		bufferevent_write(wp->event, buf, len);
	} else if ((m->b & MOUSE_BUTTON) != MOUSE_2) {
		if (options_get_number(&wp->window->options, "mode-mouse") &&
		    window_pane_set_mode(wp, &window_copy_mode) == 0) {
			window_copy_init_from_pane(wp);
			if (wp->mode->mouse != NULL)
				wp->mode->mouse(wp, NULL, m);
		}
	}
}
开发者ID:taksatou,项目名称:tmux,代码行数:31,代码来源:input-keys.c

示例14: cmd_set_option_flag

/* Set a flag option. */
struct options_entry *
cmd_set_option_flag(struct cmd *self, struct cmd_ctx *ctx,
    const struct options_table_entry *oe, struct options *oo)
{
	struct cmd_target_data	*data = self->data;
	int			 flag;

	if (data->arg2 == NULL || *data->arg2 == '\0')
		flag = !options_get_number(oo, oe->name);
	else {
		if ((data->arg2[0] == '1' && data->arg2[1] == '\0') ||
		    strcasecmp(data->arg2, "on") == 0 ||
		    strcasecmp(data->arg2, "yes") == 0)
			flag = 1;
		else if ((data->arg2[0] == '0' && data->arg2[1] == '\0') ||
		    strcasecmp(data->arg2, "off") == 0 ||
		    strcasecmp(data->arg2, "no") == 0)
			flag = 0;
		else {
			ctx->error(ctx, "bad value: %s", data->arg2);
			return (NULL);
		}
	}

	return (options_set_number(oo, oe->name, flag));
}
开发者ID:ddollar,项目名称:tmux,代码行数:27,代码来源:cmd-set-option.c

示例15: cmd_set_option_flag

/* Set a flag option. */
struct options_entry *
cmd_set_option_flag(unused struct cmd *self, struct cmd_q *cmdq,
    const struct options_table_entry *oe, struct options *oo, const char *value)
{
	int	flag;

	if (value == NULL || *value == '\0')
		flag = !options_get_number(oo, oe->name);
	else {
		if ((value[0] == '1' && value[1] == '\0') ||
		    strcasecmp(value, "on") == 0 ||
		    strcasecmp(value, "yes") == 0)
			flag = 1;
		else if ((value[0] == '0' && value[1] == '\0') ||
		    strcasecmp(value, "off") == 0 ||
		    strcasecmp(value, "no") == 0)
			flag = 0;
		else {
			cmdq_error(cmdq, "bad value: %s", value);
			return (NULL);
		}
	}

	return (options_set_number(oo, oe->name, flag));
}
开发者ID:FauxFaux,项目名称:tmux,代码行数:26,代码来源:cmd-set-option.c


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