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

C++ r_num_math函数代码示例

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

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



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

示例1: test_num

int test_num(RNum *num, const char *str, ut64 okvalue) {
	ut64 ret;
	printf("        %"PFMT64d" == ", okvalue);
 	ret = r_num_math(num, str);
	printf("%"PFMT64d"  \t; %s", ret, str);
	if (ret == okvalue) printf("\r ok\n");
	else printf("\rFAIL\n");
}
开发者ID:0xroot,项目名称:radare2,代码行数:8,代码来源:test.c


示例2: cmd_meta

static int cmd_meta(void *data, const char *input) {
	RCore *core = (RCore*)data;
	int i;
	RAnalFunction *f;

	switch (*input) {
	case 'j':
	case '*':
		r_meta_list (core->anal, R_META_TYPE_ANY, *input);
		break;
	case 'L':
		cmd_meta_lineinfo (core, input + 1);
		break;
	case 'C':
		cmd_meta_comment (core, input);
		break;
	case 'h': /* comment */
	case 's': /* string */
	case 'd': /* data */
	case 'm': /* magic */
	case 'f': /* formatted */
		cmd_meta_hsdmf (core, input);
		break;
	case '-':
		if (input[1]!='*') {
			i = r_num_math (core->num, input+((input[1]==' ')?2:1));
			r_meta_del (core->anal, R_META_TYPE_ANY, core->offset, i, "");
		} else r_meta_cleanup (core->anal, 0LL, UT64_MAX);
		break;
	case '\0':
	case '?':{
			const char* help_msg[] = {
				"Usage:", "C[-LCvsdfm?] [...]", " # Metadata management",
				"C*", "", "list meta info in r2 commands",
				"C-", " [len] [[@]addr]", "delete metadata at given address range",
				"CL", "[-][*] [file:line] [addr]", "show or add 'code line' information (bininfo)",
				"CC", "[-] [comment-text] [@addr]", "add/remove comment",
				"CC!", " [@addr]", "edit comment with $EDITOR",
				"CCa", "[-at]|[at] [text] [@addr]", "add/remove comment at given address",
				"CCu", " [comment-text] [@addr]", "add unique comment",
				"Cs", "[-] [size] [@addr]", "add string",
				"Ch", "[-] [size] [@addr]", "hide data",
				"Cd", "[-] [size] [@addr]", "hexdump data",
				"Cf", "[-] [sz] [fmt..] [@addr]", "format memory (see pf?)",
				"Cm", "[-] [sz] [fmt..] [@addr]", "magic parse (see pm?)",
				NULL};
			r_core_cmd_help (core, help_msg);
			}
		break;
	case 'F':
		f = r_anal_get_fcn_in (core->anal, core->offset,
			R_ANAL_FCN_TYPE_FCN|R_ANAL_FCN_TYPE_SYM);
		if (f) r_anal_str_to_fcn (core->anal, f, input+2);
		else eprintf ("Cannot find function here\n");
		break;
	}
	return R_TRUE;
}
开发者ID:AnwarMohamed,项目名称:radare2,代码行数:58,代码来源:cmd_meta.c


示例3: cmd_wf

static bool cmd_wf(RCore *core, const char *input) {
	ut8 *buf;
	int size;
	const char *arg = input + ((input[1] == ' ') ? 2 : 1);
	int wseek = r_config_get_i (core->config, "cfg.wseek");
	char *p, *a = r_str_chop (strdup (arg));
	// XXX: file names cannot contain spaces
	p = strchr (a, ' ');
	if (p) *p++ = 0;

	if (*arg =='?' || !*arg) {
		eprintf ("Usage: wf [file] ([size] ([offset]))\n");
	}
	if (!strcmp (arg, "-")) {
		char *out = r_core_editor (core, NULL, NULL);
		if (out) {
			r_io_write_at (core->io, core->offset,
				(ut8*)out, strlen (out));
			free (out);
		}
	}
	if ((buf = (ut8*) r_file_slurp (a, &size))) {
		int u_size = size;
		int u_offset = 0;
		u_size = r_num_math (core->num, p);
		if (u_size < 1) u_size = size;
		if (p) {
			*p++ = 0;
			u_offset = r_num_math (core->num, p);
			if (u_offset > size) {
				eprintf ("Invalid offset\n");
				free (buf);
				return false;
			}
		}
		r_io_use_desc (core->io, core->file->desc);
		r_io_write_at (core->io, core->offset, buf + u_offset, u_size);
		WSEEK (core, size);
		free (buf);
		r_core_block_read (core, 0);
	} else {
		eprintf ("Cannot open file '%s'\n", arg);
	}
	return true;
}
开发者ID:NaveenBoggarapu,项目名称:radare2,代码行数:45,代码来源:cmd_write.c


示例4: cmd_meta

static int cmd_meta(void *data, const char *input) {
	RCore *core = (RCore*)data;
	int i;
	char *t = 0;
	RAnalFunction *f;

	switch (*input) {
	case 'j':
	case '*':
		r_meta_list (core->anal, R_META_TYPE_ANY, *input);
		break;
	case 'L':
		cmd_meta_lineinfo (core, input + 1);
		break;
	case 'C':
		cmd_meta_comment (core, input);
		break;
	case 'h': /* comment */
	case 's': /* string */
	case 'd': /* data */
	case 'm': /* magic */
	case 'f': /* formatted */
		cmd_meta_hsdmf (core, input);
		break;
	case '-':
		if (input[1]!='*') {
			i = r_num_math (core->num, input+((input[1]==' ')?2:1));
			r_meta_del (core->anal, R_META_TYPE_ANY, core->offset, i, "");
		} else r_meta_cleanup (core->anal, 0LL, UT64_MAX);
		break;
	case '\0':
	case '?':
		r_cons_strcat (
			"|Usage: C[-LCvsdfm?] [...]\n"
		"| C*                              List meta info in r2 commands\n"
		"| C- [len] [@][ addr]             delete metadata at given address range\n"
		"| CL[-][*] [file:line] [addr]     show or add 'code line' information (bininfo)\n"
		"| CC[-] [comment-text]    add/remove comment. Use CC! to edit with $EDITOR\n"
		"| CCa[-at]|[at] [text]    add/remove comment at given address\n"
		"| Cs[-] [size] [[addr]]   add string\n"
		"| Ch[-] [size] [@addr]    hide data\n"
		"| Cd[-] [size]            hexdump data\n"
		"| Cf[-] [sz] [fmt..]      format memory (see pf?)\n"
		"| Cm[-] [sz] [fmt..]      magic parse (see pm?)\n");
		break;
	case 'F':
		f = r_anal_fcn_find (core->anal, core->offset,
			R_ANAL_FCN_TYPE_FCN|R_ANAL_FCN_TYPE_SYM);
		if (f) r_anal_str_to_fcn (core->anal, f, input+2);
		else eprintf ("Cannot find function here\n");
		break;
	}
	if (t)
		free (t);
	return R_TRUE;
}
开发者ID:michelangelo13,项目名称:radare2,代码行数:56,代码来源:cmd_meta.c


示例5: format_output

static int format_output (char mode, const char *s) {
	ut64 n = r_num_math (num, s);
	const char *str = (char*) &n;
	char strbits[65];

	if (flags & 2) {
		/* swap endian */
		ut32 n2 = (n>>32)? 8:4;
		r_mem_copyendian ((ut8*) str, (ut8*) str, n2, 0);
	}
开发者ID:bigos,项目名称:radare2,代码行数:10,代码来源:rax2.c


示例6: r_reg_set_bvalue

R_API ut64 r_reg_set_bvalue(RReg *reg, RRegItem *item, const char *str) {
	ut64 num;
	if (!item->flags)
		return UT64_MAX;
	num = r_str_bits_from_string (str, item->flags);
	if (num == UT64_MAX) 
		r_reg_set_value (reg, item, r_num_math (NULL, str));
	else r_reg_set_value (reg, item, num);
	return num;
}
开发者ID:commiebstrd,项目名称:radare2,代码行数:10,代码来源:value.c


示例7: rax

static int rax(const char *str) {
	ut64 n;
	if (*str=='q')
		return 0;
 	n = r_num_math(NULL, str);
	if (str[0]=='0'&&str[1]=='x')
		printf("%"PFMT64d"\n", n);
	else printf("0x%"PFMT64x"\n", n);
	return 1;
}
开发者ID:pixilla,项目名称:radare2,代码行数:10,代码来源:rax2.c


示例8: r_reg_set_bvalue

R_API ut64 r_reg_set_bvalue(RReg *reg, RRegItem *item, const char *str) {
	ut64 num = UT64_MAX;
	if (item && item->flags && str) {
		num = r_str_bits_from_string (str, item->flags);
		if (num == UT64_MAX) {
			num = r_num_math (NULL, str);
		}
		r_reg_set_value (reg, item, num);
	}
	return num;
}
开发者ID:PankajKataria,项目名称:radare2,代码行数:11,代码来源:value.c


示例9: __open

static RIODesc* __open(RIO* io, const char* pathname, int rw, int mode) {
	RIONull* null;
	if (__plugin_open (io, pathname,0)) {
		if (!strncmp (pathname, "null://", 7) && strlen (pathname + 7)) {
			null = R_NEW0 (RIONull);
			null->size = r_num_math (NULL, pathname + 7) + 1;         //???
			null->offset = 0LL;
			return r_io_desc_new (io, &r_io_plugin_null, pathname, rw, mode, null);
		}
	}
	return NULL;
}
开发者ID:aronsky,项目名称:radare2,代码行数:12,代码来源:io_null.c


示例10: r_core_yank_file_ex

R_API int r_core_yank_file_ex (RCore *core, const char *input) {
	ut64 len = 0, adv = 0, addr = 0;
	int res = R_FALSE;

	if (!input) return res;

	// get the number of bytes to yank
	adv = consume_chars (input, ' ');
	len = r_num_math (core->num, input+adv);
	if (len == 0) {
		eprintf ("ERROR: Number of bytes read must be > 0\n");
		return res;
	}
	// get the addr/offset from in the file we want to read
	adv += find_next_char (input+adv, ' ');
	if (adv == 0) {
		eprintf ("ERROR: Address must be specified\n");
		return res;
	}
	adv++;

	IFDBG eprintf ("Handling the input: %s\n", input+adv);
	// XXX - bug, will fail if address needs to be computed and has spaces
	addr = r_num_math (core->num, input+adv);

	adv += find_next_char (input+adv, ' ');
	if (adv == 0) {
		eprintf ("ERROR: File must be specified\n");
		return res;
	}
	adv++;

	IFDBG eprintf ("Filename: %s\n", input+adv);
	// grab the current file descriptor, so we can reset core and io state
	// after our io op is done
	return perform_mapped_file_yank (core, addr, len, input+adv);
}
开发者ID:t35t12345,项目名称:radare2,代码行数:37,代码来源:yank.c


示例11: r_core_yank_to

R_API int r_core_yank_to(RCore *core, const char *_arg) {
	ut64 src = core->offset;
	ut64 len = 0;
	ut64 pos = -1;
	char *str, *arg;
	ut8 *buf;

	while (*_arg==' ') _arg++;
	arg = strdup (_arg);
	str = strchr (arg, ' ');
	if (str) {
		str[0]='\0';
		len = r_num_math (core->num, arg);
		pos = r_num_math (core->num, str+1);
		str[0]=' ';
	}
	if ((str == NULL) || (pos == -1) || (len == 0)) {
		eprintf ("Usage: yt [len] [dst-addr]\n");
		free (arg);
		return 1;
	}
#if 0
	if (!config_get("file.write")) {
		eprintf("You are not in read-write mode.\n");
		return 1;
	}
#endif
	buf = (ut8*)malloc (len);
	r_core_read_at (core, src, buf, len);
	r_core_write_at (core, pos, buf, len);
	free (buf);

	core->offset = src;
	r_core_block_read (core, 0);
	free (arg);
	return 0;
}
开发者ID:0xroot,项目名称:radare2,代码行数:37,代码来源:yank.c


示例12: meta_inrange_get

R_API RAnalMetaItem *r_meta_find_in(RAnal *a, ut64 at, int type, int where) {
	char *res = meta_inrange_get (a, at, 1);
	if (!res) {
		return NULL;
	}
	RList *list = r_str_split_list (res, ",");
	RListIter *iter;
	const char *meta;
	r_list_foreach (list, iter, meta) {
		ut64 mia = r_num_math (NULL, meta);
		RAnalMetaItem *mi = r_meta_find (a, mia, type, where);
		if (mi && (at >= mi->from && at < mi->to)) {
			free (res);
			return mi;
		}
	}
开发者ID:skuater,项目名称:radare2,代码行数:16,代码来源:meta.c


示例13: sdb_fmt

R_API char *r_type_get_struct_memb(Sdb *TDB, const char *type, int offset) {
	int i, typesize = 0;
	char *res = NULL;

	if (offset < 0) {
		return NULL;
	}
	char* query = sdb_fmt ("struct.%s", type);
	char *members = sdb_get (TDB, query, 0);
	if (!members) {
		//eprintf ("%s is not a struct\n", type);
		return NULL;
	}
	int nargs = r_str_split (members, ',');
	for (i = 0; i < nargs ; i++) {
		const char *name = r_str_word_get0 (members, i);
		if (!name) {
			break;
		}
		query = sdb_fmt ("struct.%s.%s", type, name);
		char *subtype = sdb_get (TDB, query, 0);
		if (!subtype) {
			break;
		}
		int len = r_str_split (subtype, ',');
		if (len < 3) {
			free (subtype);
			break;
		}
		int val = r_num_math (NULL, r_str_word_get0 (subtype, len - 1));
		int arrsz = val ? val : 1;
		if ((typesize / 8) == offset) {
			res = r_str_newf ("%s.%s", type, name);
			free (subtype);
			break;
		}
		typesize += r_type_get_bitsize (TDB, subtype) * arrsz;
		free (subtype);
	}
	free (members);
	return res;
}
开发者ID:skuater,项目名称:radare2,代码行数:42,代码来源:ctype.c


示例14: r_core_rtr_remove

R_API void r_core_rtr_remove(RCore *core, const char *input) {
	int fd, i;

	if (input[0] >= '0' && input[0] <= '9') {
		fd = r_num_math (core->num, input);
		for (i = 0; i < RTR_MAX_HOSTS; i++)
			if (rtr_host[i].fd->fd == fd) {
				r_socket_free (rtr_host[i].fd);
				rtr_host[i].fd = NULL;
				if (rtr_n == i)
					for (rtr_n = 0; !rtr_host[rtr_n].fd && rtr_n < RTR_MAX_HOSTS; rtr_n++);
				break;
		}
	} else {
		for (i = 0; i < RTR_MAX_HOSTS; i++)
			if (rtr_host[i].fd)
				r_socket_free (rtr_host[i].fd);
		memset (rtr_host, '\0', RTR_MAX_HOSTS * sizeof(RCoreRtrHost));
		rtr_n = 0;
	}
}
开发者ID:moon2l,项目名称:radare2,代码行数:21,代码来源:rtr.c


示例15: sdb_fmt

R_API RAnalVar *get_link_var(RAnal *anal, ut64 faddr, RAnalVar *var) {
	const char *var_local = sdb_fmt ("var.0x%"PFMT64x".%d.%d.%s",
			faddr, 1, var->delta, "reads");
	const char *xss = sdb_const_get (anal->sdb_fcns, var_local, 0);
	ut64 addr = r_num_math (NULL, xss);
	char *inst_key = r_str_newf ("inst.0x%"PFMT64x".lvar", addr);
	char *var_def = sdb_get (anal->sdb_fcns, inst_key, 0);

	if (!var_def) {
		free (inst_key);
		return NULL;
	}
	struct VarUsedType vut;
	RAnalVar *res = NULL;
	if (sdb_fmt_tobin (var_def, SDB_VARUSED_FMT, &vut) == 4) {
		res = r_anal_var_get (anal, vut.fcn_addr, vut.type[0], vut.scope, vut.delta);
		sdb_fmt_free (&vut, SDB_VARUSED_FMT);
	}
	free (inst_key);
	free (var_def);
	return res;
}
开发者ID:montekki,项目名称:radare2,代码行数:22,代码来源:op.c


示例16: R_NEW0

static RIODesc *__open(RIO *io, const char *pathname, int rw, int mode) {
	if (__check (io, pathname, 0)) {
		RIOMalloc *mal = R_NEW0 (RIOMalloc);
		if (!mal) return NULL;
		rw = 7; // RWX
		mal->fd = -2; /* causes r_io_desc_new() to set the correct fd */
		if (!strncmp (pathname, "hex://", 6)) {
			mal->size = strlen (pathname);
			mal->buf = malloc (mal->size + 1);
			if (!mal->buf) {
				free (mal);
				return NULL;
			}
			mal->offset = 0;
			memset (mal->buf, 0, mal->size);
			mal->size = r_hex_str2bin (pathname + 6, mal->buf);
			if ((int)mal->size < 1) {
				R_FREE (mal->buf);
			}
		} else {
			mal->size = r_num_math (NULL, pathname + 9);
			if (((int)mal->size) <= 0) {
				free (mal);
				eprintf ("Cannot allocate (%s) 0 bytes\n", pathname + 9);
				return NULL;
			}
			mal->offset = 0;
			mal->buf = calloc (1, mal->size + 1);
		}
		if (mal->buf) {
			RETURN_IO_DESC_NEW (&r_io_plugin_malloc,
				mal->fd, pathname, rw, mode, mal);
		}
		eprintf ("Cannot allocate (%s) %d bytes\n", pathname + 9, mal->size);
		free (mal);
	}
	return NULL;
}
开发者ID:EliaGeretto,项目名称:radare2,代码行数:38,代码来源:io_malloc.c


示例17: filter

static int filter(RParse *p, RFlag *f, char *data, char *str, int len) {
	char *ptr = data, *ptr2;
	//RListIter *iter;
	RFlagItem *flag;
	ut64 off;

	ptr2 = NULL;
	while ((ptr = strstr (ptr, "0x"))) {
		for (ptr2 = ptr; *ptr2 && !isx86separator (*ptr2); ptr2++);
		off = r_num_math (NULL, ptr);
		if (!off) {
			ptr = ptr2;
			continue;
		}
		flag = r_flag_get_i (f, off);
		if (flag && strchr (flag->name, '.')) {
		// XXX. tooslow but correct
		//r_list_foreach (f->flags, iter, flag) { if (flag->offset == off && strchr (flag->name, '.')) {
				if (p->notin_flagspace != -1) {
					if (p->flagspace == flag->space)
						continue;
				} else
				if (p->flagspace != -1 && \
					(p->flagspace != flag->space)) {
					continue;
				}
				*ptr = 0;
				snprintf (str, len, "%s%s%s", data, flag->name,
					ptr2!=ptr? ptr2: "");
				return R_TRUE;
			}
		//}
		ptr = ptr2;
	}
	strncpy (str, data, len);
	return R_FALSE;
}
开发者ID:0xroot,项目名称:radare2,代码行数:37,代码来源:parse_x86_pseudo.c


示例18: exprmatchreg

static int exprmatchreg (RDebug *dbg, const char *regname, const char *expr) {
	int ret = 0;
	char *p;
	char *s = strdup (expr);
	if (!s) {
		return 0;
	}
	if (!strcmp (regname, s)) {
		ret = 1;
	} else {
#define CURVAL 0){}r_str_trim_head_tail (s);if (!strcmp(regname,s) && regval
		ut64 regval = r_debug_reg_get_err (dbg, regname, NULL, NULL);
		if (exprtoken (dbg, s, ">=", &p)) {
			if (CURVAL >= r_num_math (dbg->num, p))
				ret = 1;
		} else if (exprtoken (dbg, s, "<=", &p)) {
			if (CURVAL <= r_num_math (dbg->num, p))
				ret = 1;
		} else if (exprtoken (dbg, s, "==", &p)) {
			if (CURVAL <= r_num_math (dbg->num, p))
				ret = 1;
		} else if (exprtoken (dbg, s, "<", &p)) {
			if (CURVAL < r_num_math (dbg->num, p))
				ret = 1;
		} else if (exprtoken (dbg, s, ">", &p)) {
			if (CURVAL > r_num_math (dbg->num, p))
				ret = 1;
		} else if (exprtoken (dbg, s, " ", &p)) {
			r_str_trim_head_tail (s);
			if (!strcmp (regname, s)) {
				ut64 num = r_num_math (dbg->num, p);
				ret = exprmatch (dbg, num, s);
			}
		} else {
			if (!strcmp (regname, s)) {
				ret = 1;
			}
		}
	}
	free (s);
	return ret;
}
开发者ID:agatti,项目名称:radare2,代码行数:42,代码来源:esil.c


示例19: num_callback

static ut64 num_callback(RNum *userptr, const char *str, int *ok) {
	RCore *core = (RCore *)userptr; // XXX ?
	RAnalFunction *fcn;
	char *ptr, *bptr, *out;
	RFlagItem *flag;
	RIOSection *s;
	RAnalOp op;
	ut64 ret = 0;

	if (ok) *ok = R_FALSE;
	switch (*str) {
	case '[':
{
		ut64 n = 0LL;
		int refsz = (core->assembler->bits & R_SYS_BITS_64)? 8: 4;
		const char *p = NULL;
		if (strlen (str)>5)
			p = strchr (str+5, ':');
		// TODO: honor LE
		if (p) {
			refsz = atoi (str+1);
			str = p;
		}
		// push state
		{
			if (str[0] && str[1]) {
				const char *q;
				char *o = strdup (str+1);
				if (o) {
					q = r_num_calc_index (core->num, NULL);
					if (q) {
						if (r_str_replace_char (o, ']', 0)>0) {
							n = r_num_math (core->num, o);
							r_num_calc_index (core->num, q);
						}
					}
					free (o);
				}
			}
		}
		// pop state
		if (ok) *ok = 1;
		ut32 num = 0;
		switch (refsz) {
		case 8:
		case 4:
		case 2:
		case 1:
			(void)r_io_read_at (core->io, n, (ut8*)&num, refsz);
			r_mem_copyendian ((ut8*)&num, (ut8*)&num, refsz, !core->assembler->big_endian);
			return num;
		default:
			eprintf ("Invalid reference size: %d (%s)\n", refsz, str);
			return 0LL;
		}
}
		break;
	case '$':
		if (ok) *ok = 1;
		// TODO: group analop-dependant vars after a char, so i can filter
		r_anal_op (core->anal, &op, core->offset,
			core->block, core->blocksize);
		switch (str[1]) {
		case '.': // can use pc, sp, a0, a1, ...
			return r_debug_reg_get (core->dbg, str+2);
		case 'k':
			if (str[2]!='{') {
				eprintf ("Expected '{' after 'k'.\n");
				break;
			}
			bptr = strdup (str+3);
			ptr = strchr (bptr, '}');
			if (ptr == NULL) {
				// invalid json
				free (bptr);
				break;
			}
			*ptr = '\0';
			ret = 0LL;
			out = sdb_querys (core->sdb, NULL, 0, bptr);
			if (out && *out) {
				if (strstr (out, "$k{")) {
					eprintf ("Recursivity is not permitted here\n");
				} else {
					ret = r_num_math (core->num, out);
				}
			}
			free (bptr);
			free (out);
			return ret;
			break;
		case '{':
			bptr = strdup (str+2);
			ptr = strchr (bptr, '}');
			if (ptr != NULL) {
				ut64 ret;
				ptr[0] = '\0';
				ret = r_config_get_i (core->config, bptr);
				free (bptr);
				return ret;
//.........这里部分代码省略.........
开发者ID:0x2F,项目名称:radare2,代码行数:101,代码来源:core.c


示例20: cmd_type

static int cmd_type(void *data, const char *input) {
	RCore *core = (RCore*)data;

	switch (input[0]) {
	// t [typename] - show given type in C syntax
	case 's':
	{
		char *q, *p, *o, *e;
		p = o = strdup (input+1);
		for (;;) {
			q = strchr (p, ' ');
			if (q) *q = 0;
			if (!*p) {
				p++;
				continue;
			}
			e = strchr (p, '=');
			if (e) {
				*e = 0;
				r_anal_type_set (core->anal, core->offset,
					p, r_num_math (core->num, e+1));
			} else eprintf ("TODO: implement get\n");
			if (!q) break;
			p = q+1;
		}
		free (o);
	}
		break;
	case ' ':
	{
		char *fmt = r_anal_type_format (core->anal, input +1);
		if (fmt) {
			r_cons_printf ("pf %s\n", fmt);
			free (fmt);
		} else eprintf ("Cannot find '%s' type\n", input+1);
	}
		break;
#if 0
	// t* - list all types in 'pf' syntax
	case '*':
		r_anal_type_list (core->anal, R_ANAL_TYPE_ANY, 1);
		break;
#endif
	case 0:
		// TODO: use r_cons here
		//sdb_list (core->anal->sdb_types);
		sdb_foreach (core->anal->sdb_types, sdbforcb, core);
		break;
	case 'o':
		if (input[1] == ' ') {
			const char *filename = input + 2;
			if (!strcmp (filename, "-")) {
				char *out, *tmp;
				tmp = r_core_editor (core, "");
				if (tmp) {
					out = r_parse_c_string (tmp);
					if (out) {
						r_cons_strcat (out);
						sdb_query_lines (core->anal->sdb_types, out);
						free (out);
					}
					free (tmp);
				}
			} else {
				char *out = r_parse_c_file (filename);
				if (out) {
					r_cons_strcat (out);
					sdb_query_lines (core->anal->sdb_types, out);
					free (out);
				}
				//r_anal_type_loadfile (core->anal, filename);
			}
		}
		break;
	// td - parse string with cparse engine and load types from it
	case 'd':
		if (input[1] == '?') {
			const char * help_message[] = {
				"Usage:", "td[...]", "",
				"td", "[string]", "Load types from string",
				NULL
			 };

			r_core_cmd_help(core, help_message);
		} else
		if (input[1] == '-') {
			const char *arg = strchr (input+1, ' ');
			if (arg) arg++; else arg = input+2;
			r_anal_type_del (core->anal, arg);
		} else
		if (input[1] == ' ') {
			char tmp[256];
			snprintf (tmp, sizeof (tmp), "%s;", input+2);
			//const char *string = input + 2;
			//r_anal_str_to_type (core->anal, string);
			char *out = r_parse_c_string (tmp);
			if (out) {
				r_cons_strcat (out);
				sdb_query_lines (core->anal->sdb_types, out);
				free (out);
//.........这里部分代码省略.........
开发者ID:cooolie,项目名称:radare2,代码行数:101,代码来源:cmd_type.c



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


鲜花

握手

雷人

路过

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

请发表评论

全部评论

专题导读
上一篇:
C++ r_reg_get函数代码示例发布时间:2022-05-30
下一篇:
C++ r_num_get函数代码示例发布时间: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