• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    公众号

C++ r_cons_flush函数代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

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



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

示例1: run_commands

static bool run_commands(RList *cmds, RList *files, bool quiet) {
	RListIter *iter;
	const char *cmdn;
	const char *file;
	int ret;
	/* -i */
	r_list_foreach (files, iter, file) {
		if (!r_file_exists (file)) {
			eprintf ("Script '%s' not found.\n", file);
			return false;
		}
		ret = r_core_run_script (&r, file);
		if (ret == -2) {
			eprintf ("Cannot open '%s'\n", file);
		}
		if (ret < 0 || (ret == 0 && quiet)) {
			r_cons_flush ();
			return false;
		}
	}
	/* -c */
	r_list_foreach (cmds, iter, cmdn) {
		r_core_cmd0 (&r, cmdn);
		r_cons_flush ();
	}
开发者ID:P4N74,项目名称:radare2,代码行数:25,代码来源:radare2.c


示例2: r_core_visual_seek_animation

R_API void r_core_visual_seek_animation (RCore *core, ut64 addr) {
	if (r_config_get_i (core->config, "scr.feedback")<1)
		return;
#if 0
	int i, ns = 90000;
	const char *scmd = (addr > core->offset)? "so": "s-4";
	for (i=0;i<5;i++) {
		r_core_cmd0 (core, scmd);
		r_core_visual_refresh (core);
		r_cons_flush();
		r_sys_usleep (ns);
		ns -= 1000;
	}
	r_core_seek (core, addr, 1);
#else
	if (core->offset == addr)
		return;
	r_cons_gotoxy (1, 2);
	if (addr>core->offset) {
		r_cons_printf (".----.\n");
		r_cons_printf ("| \\/ |\n");
		r_cons_printf ("'----'\n");
	} else {
		r_cons_printf (".----.\n");
		r_cons_printf ("| /\\ |\n");
		r_cons_printf ("'----'\n");
	}
	r_cons_flush();
	r_sys_usleep (90000);
#endif
	r_core_seek (core, addr, 1);
}
开发者ID:xuwenbo,项目名称:radare2,代码行数:32,代码来源:visual.c


示例3: r_core_visual_hud

static int r_core_visual_hud(RCore *core) {
    const char *f = R2_LIBDIR"/radare2/"R2_VERSION"/hud/main";
    char *homehud = r_str_home (R2_HOMEDIR"/hud");
    char *res = NULL;
    char *p = 0;

    showcursor (core, R_TRUE);
    if (homehud)
        res = r_cons_hud_file (homehud);
    if (!res) {
        if (r_file_exists (f))
            res = r_cons_hud_file (f);
        else r_cons_message ("Cannot find hud file");
    }
    r_cons_clear ();
    if (res) {
        p = strchr (res, '\t');
        core->printidx = 1;
        r_cons_printf ("%s\n", res);
        r_cons_flush ();
        if (p) r_core_cmd0 (core, p+1);
        free (res);
    }
    showcursor (core, R_FALSE);
    r_cons_flush ();
    free (homehud);
    return (int)(size_t)p;
}
开发者ID:revskills,项目名称:radare2,代码行数:28,代码来源:visual.c


示例4: r_core_visual_hud

R_API int r_core_visual_hud(RCore *core) {
	const char *c = r_config_get (core->config, "hud.path");
	const char *f = R2_LIBDIR"/radare2/"R2_VERSION"/hud/main";
	char *homehud = r_str_home (R2_HOMEDIR"/hud");
	char *res = NULL;
	char *p = 0;

	showcursor (core, true);
	if (c && *c && r_file_exists (c))
		res = r_cons_hud_file (c);
	if (!res && homehud)
		res = r_cons_hud_file (homehud);
	if (!res && r_file_exists (f))
		res = r_cons_hud_file (f);
	if (!res)
		r_cons_message ("Cannot find hud file");

	r_cons_clear ();
	if (res) {
		p = strchr (res, '\t');
		r_cons_printf ("%s\n", res);
		r_cons_flush ();
		if (p) r_core_cmd0 (core, p+1);
		free (res);
	}
	showcursor (core, false);
	r_cons_flush ();
	free (homehud);
	return (int)(size_t)p;
}
开发者ID:xuwenbo,项目名称:radare2,代码行数:30,代码来源:visual.c


示例5: r_core_visual_prompt

R_API int r_core_visual_prompt (RCore *core) {
	char buf[1024];
	int ret;
#if __UNIX__
	r_line_set_prompt (Color_RESET":> ");
#else
	r_line_set_prompt (":> ");
#endif
	showcursor (core, true);
	r_cons_fgets (buf, sizeof (buf), 0, NULL);
	if (!strcmp (buf, "q")) {
		ret = false;
	} else if (*buf) {
		r_line_hist_add (buf);
		r_core_cmd (core, buf, 0);
		r_cons_flush ();
		ret = true;
	} else {
		ret = false;
		//r_cons_any_key (NULL);
		r_cons_clear00 ();
		showcursor (core, false);
	}
	return ret;
}
开发者ID:xuwenbo,项目名称:radare2,代码行数:25,代码来源:visual.c


示例6: visual_repeat_thread

static int visual_repeat_thread(RThread *th) {
	RCore *core = th->user;
	int i = 0;
	for (;;) {
		if (core->cons->breaked)
			break;
		r_core_visual_refresh (core);
		r_cons_flush ();
		r_cons_gotoxy (0, 0);
		r_cons_printf ("[@%d] ", i++);
		r_cons_flush ();
		r_sys_sleep (1);
	}
	r_th_kill (th, 1);
	return 0;
}
开发者ID:xuwenbo,项目名称:radare2,代码行数:16,代码来源:visual.c


示例7: r_core_visual_prompt

R_API int r_core_visual_prompt (RCore *core) {
    char buf[1024];
    int ret;
    ut64 oseek = core->offset;
#if __UNIX__
    r_line_set_prompt (Color_RESET":> ");
#else
    r_line_set_prompt (":> ");
#endif
    showcursor (core, R_TRUE);
    r_cons_fgets (buf, sizeof (buf), 0, NULL);
    if (*buf) {
        r_line_hist_add (buf);
        r_core_cmd (core, buf, 0);
        r_cons_flush ();
        ret = R_TRUE;
    } else {
        ret = R_FALSE;
        //r_cons_any_key ();
        r_cons_clear00 ();
        showcursor (core, R_FALSE);
    }
    if (curset) r_core_seek (core, oseek, 1);
    return ret;
}
开发者ID:revskills,项目名称:radare2,代码行数:25,代码来源:visual.c


示例8: main

int main() {
	int i,j ,k;
	//char *str = "\x1b[38;5;231mpop\x1b[0m";
         //char *str ="\x1b]4;%d;rgb:30/20/24pop\x1b[0m";
         char *str ="\x1b\\pop\x1b[0m";
i=j=k =0;

	r_cons_new ();
//	r_cons_rgb_init ();
	printf ("3 == %d\n", r_str_ansi_len (str));
	for (i=0;i<255;i+=40) {
	for (j=0;j<255;j+=40) { for (k=0;k<255;k+=40) {
		r_cons_rgb (i, j, k, 0);
		r_cons_rgb (i, j, k, 1);
		r_cons_print ("__");
		r_cons_reset_colors ();

		r_cons_rgb (i, j, k, 0);
//		r_cons_rgb (155, 200, 200, 1);
		r_cons_printf (" RGB %d %d %d", i, j, k);
		r_cons_reset_colors ();
		r_cons_newline ();
	}
}}
	r_cons_flush ();

	return 0;
}
开发者ID:AmesianX,项目名称:radare2,代码行数:28,代码来源:test-rgb.c


示例9: showcursor

static void showcursor(RCore *core, int x) {
    if (core && core->vmode) {
        r_cons_show_cursor (x);
        r_cons_enable_mouse (!!!x);
    } else r_cons_enable_mouse (R_FALSE);
    r_cons_flush ();
}
开发者ID:revskills,项目名称:radare2,代码行数:7,代码来源:visual.c


示例10: r_core_rtr_session

R_API void r_core_rtr_session(RCore *core, const char *input) {
	char prompt[32], buf[4096];
	int fd;

	if (input[0] >= '0' && input[0] <= '9') {
		fd = r_num_math (core->num, input);
		//for (rtr_n = 0; rtr_host[rtr_n].fd->fd != fd && rtr_n < RTR_MAX_HOSTS; rtr_n++);
	}

	for (;;) {
		if (rtr_host[rtr_n].fd)
			snprintf (prompt, sizeof (prompt),
				"fd:%d> ", rtr_host[rtr_n].fd->fd);
		free (r_line_singleton ()->prompt);
		r_line_singleton ()->prompt = strdup (prompt);
		if ((r_cons_fgets (buf, sizeof (buf), 0, NULL))) {
			if (*buf == 'q')
				break;
			else if (*buf == 'V') {
				eprintf ("Visual mode not supported\n");
				continue;
			}
			r_core_rtr_cmd (core, buf);
			r_cons_flush ();
		}
	}
}
开发者ID:moon2l,项目名称:radare2,代码行数:27,代码来源:rtr.c


示例11: readline_callback

static int readline_callback(void *_a, const char *str) {
	RCoreVisualAsm *a = _a;
	int xlen;
	r_cons_clear00 ();
	r_cons_printf ("Write your favourite %s-%d opcode...\n\n",
		r_config_get (a->core->config, "asm.arch"),
		r_config_get_i (a->core->config, "asm.bits"));
	if (*str == '?') {
		r_cons_printf ("0> ?\n\n"
			"Visual assembler help:\n\n"
			"  assemble input while typing using asm.arch, asm.bits and cfg.bigendian\n"
			"  press enter to quit (prompt if there are bytes to be written)\n"
			"  this assembler supports various directives like .hex ...\n"
			);
	} else {
		r_asm_code_free (a->acode);
		a->acode = r_asm_massemble (a->core->assembler, str);
		r_cons_printf ("%d> %s\n", a->acode? a->acode->len: 0, str);
		if (a->acode && a->acode->len)
			r_cons_printf ("* %s\n\n", a->acode->buf_hex);
		else r_cons_printf ("\n\n");
		if (a->acode) {
			xlen = strlen (a->acode->buf_hex);
			strcpy (a->codebuf, a->blockbuf);
			memcpy (a->codebuf, a->acode->buf_hex, xlen);
		}
		r_core_cmdf (a->core, "pd [email protected]:%s @0x%"PFMT64x, a->codebuf, a->off);
	}
	r_cons_flush ();
	return 1;
}
开发者ID:BatchDrake,项目名称:radare2,代码行数:31,代码来源:vasm.c


示例12: strdup

// Below this line are the r_io_zip plugin APIs
static RIODesc *r_io_zip_open(RIO *io, const char *file, int rw, int mode) {
	RIODesc *result = NULL;
	RIOZipFileObj *zipFileObj = NULL;

	char *zip_uri = NULL, *zip_filename = NULL, *filename_in_zipfile = NULL;
	if (!r_io_zip_plugin_open (io, file)) {
		return result;
	}

	zip_uri = strdup(file);
	// 1) Tokenize to the '//' and find the base file directory ('/')
	zip_filename = strstr(zip_uri, "//");
	if (zip_filename && zip_filename[2]) {
		if (zip_filename[0] && zip_filename[0] == '/' &&
			zip_filename[1] && zip_filename[1] == '/' ) {
			*zip_filename++ = 0;	
		}
		*zip_filename++ = 0;

		filename_in_zipfile = strstr(zip_filename, "//");
		if (filename_in_zipfile && filename_in_zipfile[2]) {
			// null terminating uri to filename here.
			*filename_in_zipfile++ = 0;
			*filename_in_zipfile++ = 0;
		}
	}

	if (!zip_filename) {// && !filename_in_zipfile) {
		if (zip_uri)
			free(zip_uri);
		eprintf("usage: zip:///path/to/archive//filepath\n");
		eprintf("Archive was not found.\n");

		return result;
	}

	// Failed to find the file name the archive.
	if (!filename_in_zipfile) {
		RList *files = NULL;
		RListIter *iter, *iter_tmp;
		char *name;
		//eprintf("usage: zip:///path/to/archive//filepath\n");
		eprintf("\nFiles in archive\n\n");
		files = r_io_zip_get_files(zip_filename, 0, mode, rw );

		if (files) {
			int i = 0;
			r_list_foreach_safe(files, iter, iter_tmp, name) {
				// XXX - io->printf does not flush
				// io->printf("%s\n", name);
				r_cons_printf("%s\n", name);
				r_cons_flush ();
				free (name);
				r_list_delete (files, iter);
			}
			r_list_free (files);
		}
开发者ID:jdukes,项目名称:radare2,代码行数:58,代码来源:io_zip.c


示例13: visual_help

static void visual_help() {
	r_cons_clear00 ();
	r_cons_less_str (
	"Visual mode help:\n"
	" ?        show this help or manpage in cursor mode\n"
	" &        rotate asm.bits between supported 8, 16, 32, 64\n"
	" %        in cursor mode finds matching pair, otherwise toggle autoblocksz\n"
	" @        set cmd.vprompt to run commands before the visual prompt\n"
	" !        enter into the visual panels mode\n"
	" _        enter the hud\n"
	" =        set cmd.vprompt (top row)\n"
	" |        set cmd.cprompt (right column)\n"
	" .        seek to program counter\n"
	" /        in cursor mode search in current block\n"
	" :cmd     run radare command\n"
	" ;[-]cmt  add/remove comment\n"
	" /*+-[]   change block size, [] = resize hex.cols\n"
	" >||<     seek aligned to block size\n"
	" a/A      (a)ssemble code, visual (A)ssembler\n"
	" b        toggle breakpoint\n"
	" c/C      toggle (c)ursor and (C)olors\n"
	" d[f?]    define function, data, code, ..\n"
	" D        enter visual diff mode (set diff.from/to)\n"
	" e        edit eval configuration variables\n"
	" f/F      set/unset or browse flags. f- to unset, F to browse, ..\n"
	" gG       go seek to begin and end of file (0-$s)\n"
	" hjkl     move around (or HJKL) (left-down-up-right)\n"
	" i        insert hex or string (in hexdump) use tab to toggle\n"
	" mK/'K    mark/go to Key (any key)\n"
	" M        walk the mounted filesystems\n"
	" n/N      seek next/prev function/flag/hit (scr.nkey)\n"
	" o        go/seek to given offset\n"
	" O        toggle asm.esil\n"
	" p/P      rotate print modes (hex, disasm, debug, words, buf)\n"
	" q        back to radare shell\n"
	" r        browse anal info and comments\n"
	" R        randomize color palette (ecr)\n"
	" sS       step / step over\n"
	" T        enter textlog chat console (TT)\n"
	" uU       undo/redo seek\n"
	" v        visual code analysis menu\n"
	" V        (V)iew graph using cmd.graph (agv?)\n"
	" wW       seek cursor to next/prev word\n"
	" xX       show xrefs/refs of current function from/to data/code\n"
	" yY       copy and paste selection\n"
	" z        fold/unfold comments in disassembly\n"
	" Z        toggle zoom mode\n"
	" Enter    follow address of jump/call\n"
	"Function Keys: (See 'e key.'), defaults to:\n"
	"  F2      toggle breakpoint\n"
	"  F7      single step\n"
	"  F8      step over\n"
	"  F9      continue\n"
	);
	r_cons_flush ();
	r_cons_clear00 ();
}
开发者ID:xuwenbo,项目名称:radare2,代码行数:57,代码来源:visual.c


示例14: printpage

static void printpage (const char *line, int *index, int from, int to) {
	int i;
	r_cons_clear00 ();
	for (i=from; i<to; i++) {
// TODO: chop column width, clear lines
		r_cons_printf ("%s\n", line+index[i]);
	}
	r_cons_flush ();
}
开发者ID:17twenty,项目名称:radare2,代码行数:9,代码来源:less.c


示例15: r_cons_any_key

R_API int r_cons_any_key(const char *msg) {
	if (msg && *msg) {
		r_cons_printf ("\n-- %s --\n", msg);
	} else {
		r_cons_print ("\n--press any key--\n");
	}
	r_cons_flush ();
	return r_cons_readchar ();
	//r_cons_strcat ("\x1b[2J\x1b[0;0H"); // wtf?
}
开发者ID:xarkes,项目名称:radare2,代码行数:10,代码来源:input.c


示例16: r_core_project_save

R_API int r_core_project_save(RCore *core, const char *file) {
	int fd, tmp, ret = R_TRUE;
	char *prj;

	if (file == NULL || *file == '\0')
		return R_FALSE;

	prj = r_core_project_file (file);
	r_core_project_init ();
	fd = r_sandbox_open (prj, O_BINARY|O_RDWR|O_CREAT, 0644);
	if (fd != -1) {
		int fdold = r_cons_singleton ()->fdout;
		r_cons_singleton ()->fdout = fd;
		r_cons_singleton ()->is_interactive = R_FALSE;
		r_str_write (fd, "# r2 rdb project file\n");
		//--
		r_str_write (fd, "# flags\n");
		tmp = core->flags->space_idx;
		core->flags->space_idx = -1;
		r_flag_list (core->flags, R_TRUE);
		core->flags->space_idx = tmp;
		r_cons_flush ();
		//--
		r_str_write (fd, "# eval\n");
		// TODO: r_str_writef (fd, "e asm.arch=%s", r_config_get ("asm.arch"));
		r_config_list (core->config, NULL, R_TRUE);
		r_cons_flush ();
		r_str_write (fd, "# sections\n");
		r_io_section_list (core->io, core->offset, 1);
		r_cons_flush ();
		r_str_write (fd, "# meta\n");
		r_meta_list (core->anal->meta, R_META_TYPE_ANY, 1);
		r_cons_flush ();
		r_core_cmd (core, "ar*", 0);
		r_cons_flush ();
		r_core_cmd (core, "af*", 0);
		r_cons_flush ();
		r_core_cmd (core, "ah*", 0);
		r_cons_flush ();
		r_str_write (fd, "# seek\n");
		r_str_writef (fd, "s 0x%08"PFMT64x, core->offset);
		r_cons_flush ();
		close (fd);
		r_cons_singleton ()->fdout = fdold;
		r_cons_singleton ()->is_interactive = R_TRUE;
	} else {
		eprintf ("Cannot open '%s' for writing\n", prj);
		ret = R_FALSE;
	}
	free (prj);
	return ret;
}
开发者ID:0xroot,项目名称:radare2,代码行数:52,代码来源:project.c


示例17: r_core_visual_show_char

R_API void r_core_visual_show_char (RCore *core, char ch) {
	if (r_config_get_i (core->config, "scr.feedback")<2)
		return;
	if (!IS_PRINTABLE (ch))
		return;
	r_cons_gotoxy (1, 2);
	r_cons_printf (".---.\n");
	r_cons_printf ("| %c |\n", ch);
	r_cons_printf ("'---'\n");
	r_cons_flush ();
	r_sys_sleep (1);
}
开发者ID:xuwenbo,项目名称:radare2,代码行数:12,代码来源:visual.c


示例18: r_cons_2048

R_API void r_cons_2048() {
	int ch;
	r_cons_set_raw (1);
	twok_init ();
	twok_add ();
	twok_add ();
	while (twok_fin()) {
		r_cons_clear00();
		r_cons_printf ("[r2048] score: %d   moves: %d\n",
			score, moves);
		r_cons_flush ();
		twok_print();
		ch = r_cons_readchar ();
		ch = r_cons_arrow_to_hjkl (ch);
		switch(ch){
		case 'h':
			twok_move(1,1);
			break;
		case 'j':
			twok_move(0,0);
			break;
		case 'k':
			twok_move(0,1);
			break;
		case 'l':
			twok_move(1,0);
			break;
		}
		if (ch<1||ch =='q') break;
	}
	r_cons_clear00();
	r_cons_printf ("[r2048] score: %d\n", score );
	r_cons_flush ();
	twok_print();
	r_cons_printf ("\n  [r2048.score] %d\n", score );
	do {
		ch = r_cons_any_key ("Press 'q' to quit.");
	} while (ch != 'q' && ch >= 1);
	r_cons_set_raw (0);
}
开发者ID:8500616886,项目名称:radare2,代码行数:40,代码来源:2048.c


示例19: r_cons_fgets

// XXX no control for max length here?!?!
R_API int r_cons_fgets(char *buf, int len, int argc, const char **argv) {
#define RETURN(x) { ret=x; goto beach; }
	RCons *cons = r_cons_singleton ();
	int ret = 0, color = cons->pal.input && *cons->pal.input;
	if (cons->echo) {
		r_cons_set_raw (0);
		r_cons_show_cursor (1);
	}
#if 0
	int mouse = r_cons_enable_mouse (false);
	r_cons_enable_mouse (false);
	r_cons_flush ();
#endif
	if (cons->user_fgets) {
		RETURN (cons->user_fgets (buf, len));
	}
	printf ("%s", cons->line->prompt);
	fflush (stdout);
	*buf = '\0';
	fflush (cons->fdin);
	if (color) {
		const char *p = cons->pal.input;
		int len = p? strlen (p): 0;
		if (len>0)
			fwrite (p, len, 1, stdout);
		fflush (stdout);
	}
	if (!fgets (buf, len, cons->fdin)) {
		if (color) {
			printf (Color_RESET);
			fflush (stdout);
		}
		RETURN (-1);
	}
	if (feof (cons->fdin)) {
		if (color) {
			printf (Color_RESET);
		}
		RETURN (-2);
	}
	buf[strlen (buf)-1] = '\0';
	if (color) printf (Color_RESET);
	ret = strlen (buf);
beach:
#if __UNIX__
	if (errno == EINTR) {
		ret = 0;
	}
#endif
	//r_cons_enable_mouse (mouse);
	return ret;
}
开发者ID:xarkes,项目名称:radare2,代码行数:53,代码来源:input.c


示例20: showcursor

static void showcursor(RCore *core, int x) {
	if (core && core->vmode) {
		r_cons_show_cursor (x);
		if (x) {
			// TODO: cache this
			int wheel = r_config_get_i (core->config, "scr.wheel");
			if (wheel) r_cons_enable_mouse (true);
			else r_cons_enable_mouse (false);
		} else {
			r_cons_enable_mouse (false);
		}
	} else r_cons_enable_mouse (false);
	r_cons_flush ();
}
开发者ID:xuwenbo,项目名称:radare2,代码行数:14,代码来源:visual.c



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


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
C++ r_cons_gotoxy函数代码示例发布时间:2022-05-30
下一篇:
C++ r_config_get_i函数代码示例发布时间:2022-05-30
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap