6 #define CTX egg->context
9 return x[0] ==
'.' || ((
x[0] ==
'*' ||
x[0] ==
'&') &&
x[1] ==
'.');
13 return c ==
' ' ||
c ==
'\t' ||
c ==
'\n' ||
c ==
'\r';
51 for (o =
s; *o; o++) {
92 char *
str, *ptr = strchr(
env,
':');
116 ptr = strchr(
str,
':');
144 for (
i = 0;
i <
len;
i++) {
150 char *tmp_ptr =
NULL;
176 egg->
lang.
pushargs = !((!strcmp(
s,
"goto")) || (!strcmp(
s,
"break")));
186 #define FRAME_FMT ".LC%d_%d_frame%d"
187 #define FRAME_END_FMT ".LC%d_%d_end_frame%d"
189 #define FRAME_FMT "__%d_%d_frame%d"
190 #define FRAME_END_FMT "__%d_%d_end_frame%d"
194 static char *get_frame_label(
int type) {
195 static char label[128];
196 int nf = egg->lang.nfunctions;
197 int nb = egg->lang.nbrackets;
203 }
else if (
type == 2) {
212 static char *get_end_frame_label(
RzEgg *egg) {
213 static char label[128];
224 char *
p = (
char *)
str;
300 op_ret =
get_op(&next_pos);
301 if (op_ret >
level) {
350 char *ptr, *
p =
str + strlen(
str);
376 }
else if (*
p ==
',' && !inside) {
388 eprintf(
"does not set name or content for alias\n");
393 eprintf(
"global-buffer-overflow in aliases\n");
412 eprintf(
"does not set name or arg for syscall\n");
416 eprintf(
"global-buffer-overflow in syscalls\n");
447 if (strchr(ptr,
'"')) {
448 ptr = strchr(ptr,
'"') + 1;
449 if ((
p = strchr(ptr,
'"'))) {
452 eprintf(
"loss back quote in include directory\n");
456 eprintf(
"wrong include syntax\n");
466 p = strchr(
str,
',');
490 e->comment(egg,
"encode %s string (%s) (%s)",
495 for (
i = 0;
str[
i];
i++) {
497 if (
str[
i] ==
'\\') {
498 switch (
str[
i + 1]) {
514 eprintf(
"%s:%d Error string format\n",
524 memmove(
str +
i + 1,
str +
i + dotrim + 1,
525 strlen(
str +
i + dotrim + 1) + 1);
533 j = (
len -
len %
e->size) +
e->size;
549 if ((q = strchr(
str,
':'))) {
556 if (*
str ==
'*' || *
str ==
'&') {
564 if (!strncmp(
str + 1,
"ret", 3)) {
565 strcpy(
out,
e->retvar);
566 }
else if (!strncmp(
str + 1,
"fix", 3)) {
570 }
else if (!strncmp(
str + 1,
"var", 3)) {
574 }
else if (!strncmp(
str + 1,
"rarg", 4)) {
579 }
else if (!strncmp(
str + 1,
"arg", 3)) {
582 e->get_var(egg, 1,
out, 4);
585 e->get_var(egg, 2,
out,
idx + 4);
601 }
else if (!strncmp(
str + 1,
"reg", 3)) {
610 eprintf(
"Something is really wrong\n");
614 }
else if (*
str ==
'"' || *
str ==
'\'') {
615 int mustfilter = *
str ==
'"';
620 eprintf(
"WARNING: No room in the static stackframe! (%d must be %d)\n",
639 ptr = strchr(
str,
'=');
655 ptr = strchr(
str,
'@');
659 if (strstr(ptr,
"env")) {
664 }
else if (strstr(ptr,
"fastcall")) {
666 }
else if (strstr(ptr,
"syscall")) {
679 }
else if (strstr(ptr,
"include")) {
685 }
else if (strstr(ptr,
"alias")) {
693 }
else if (strstr(ptr,
"data")) {
698 }
else if (strstr(ptr,
"naked")) {
707 }
else if (strstr(ptr,
"inline")) {
726 if (!strcmp(
str,
"goto")) {
730 e->call(egg,
str, 0);
738 static void shownested(
void) {
758 for (
i = 1;
i < 10;
i++) {
768 if (
CTX > 31 ||
CTX < 0) {
803 if (delta < 0 && context > 0) {
804 eprintf (
"close bracket foo!!!\n");
810 if (!strcmp (cn,
"while")) {
811 emit->while_end (egg, get_frame_label (
context - 1));
912 for (
i = 1;
i <= j;
i++) {
1022 eprintf(
"Invalid number of arguments for goto()\n");
1049 e->call(egg,
str, 1);
1051 if (!strcmp(
str,
"while")) {
1054 eprintf(
"ERROR: Unsupported while syntax\n");
1058 e->while_end(egg, var);
1064 rcc_printf (
" pop %%eax\n");
1065 rcc_printf (
" cmp $0, %%eax\n");
1070 rcc_printf (
" jnz %s\n", get_frame_label (1));
1072 rcc_printf (
" jnz %s\n", get_frame_label (0));
1082 e->comment(egg,
"set syscall args");
1085 e->comment(egg,
"syscall");
1094 for (q =
s; *q; q++) {
1099 eprintf(
"Cannot get @syscall payload\n");
1111 e->comment(egg,
"inline");
1122 e->comment(egg,
"call in egg->lang.mode %d", egg->
lang.
mode);
1123 e->call(egg,
str, 0);
1153 e->get_result(egg,
buf);
1165 eq = strchr(ptr,
'=');
1168 *
buf = *
eq =
'\x00';
1169 e->mathop(egg,
'=', vs,
'$',
"0",
e->regs(egg, 1));
1185 eprintf(
"not support for *ptr in egg->lang.dstvar\n");
1192 e->mathop(egg,
'=', vs,
type,
e->regs(egg, 1),
p);
1223 if (!strcmp(ptr,
"break")) {
1227 e->mathop(egg,
'=', vs,
'$', ptr,
NULL);
1237 char *ptr,
str[64], *tmp_ptr =
NULL;
1288 if (
c ==
'/' && egg->
lang.
oc ==
'*') {
1293 }
else if (
c ==
'*' && egg->
lang.
oc ==
'/') {
1299 "%s:%d Nesting of expressions not yet supported\n",
1330 if (
CTX > 31 ||
CTX < 0) {
1331 eprintf(
"Sinking before overflow\n");
1361 e->jmp(egg, tmp_ptr, 0);
1385 for (
i = 0;
i < 32;
i++) {
1408 if (egg->
lang.
oc ==
'\n') {
1413 if (egg->
lang.
oc ==
'/') {
1434 if (
c !=
'\t' &&
c !=
' ') {
const lzma_allocator const uint8_t size_t uint8_t * out
static static fork const void static count static fd const char const char static newpath const char static path const char path
RZ_API void rz_egg_printf(RzEgg *egg, const char *fmt,...)
static void rcc_next(RzEgg *egg)
static void rcc_reset_callname(RzEgg *egg)
static const char * find_alias(RzEgg *egg, const char *str)
RZ_API void rz_egg_lang_include_path(RzEgg *egg, const char *path)
static void rcc_pushstr(RzEgg *egg, char *str, int filter)
static int parsedatachar(RzEgg *egg, char c)
RZ_API void rz_egg_lang_init(RzEgg *egg)
static char * find_include(const char *prefix, const char *file)
RZ_API char * rz_egg_mkvar(RzEgg *egg, char *out, const char *_str, int delta)
static int is_var(char *x)
static void rcc_fun(RzEgg *egg, const char *str)
RZ_API int rz_egg_lang_parsechar(RzEgg *egg, char c)
static void rcc_context(RzEgg *egg, int delta)
static void rcc_internal_mathop(RzEgg *egg, const char *ptr, char *ep, char op)
static void rcc_mathop(RzEgg *egg, char **pos, int level)
static const char * skipspaces(const char *s)
static void rcc_set_callname(RzEgg *egg, const char *s)
static void rcc_element(RzEgg *egg, char *str)
RZ_API void rz_egg_lang_include_init(RzEgg *egg)
static void rcc_pusharg(RzEgg *egg, char *str)
static char * trim(char *s)
RZ_API void rz_egg_lang_free(RzEgg *egg)
static int get_op(char **pos)
static int is_space(char c)
static int parseinlinechar(RzEgg *egg, char c)
static void set_nested(RzEgg *egg, const char *s)
unsigned short prefix[65536]
RZ_API void Ht_() free(HtName_(Ht) *ht)
RZ_API const KEY_TYPE bool * found
void * malloc(size_t size)
static static fork const void static count static fd const char const char static newpath char char char static envp time_t static t const char static mode static whence const char static dir time_t static t unsigned static seconds const char struct utimbuf static buf static inc static sig const char static mode static oldfd struct tms static buf static getgid static geteuid const char static filename static arg static mask struct ustat static ubuf static getppid static setsid static egid sigset_t static set struct timeval struct timezone static tz fd_set fd_set fd_set struct timeval static timeout const char char static bufsiz const char static swapflags void static offset const char static length static mode static who const char struct statfs static buf unsigned unsigned num
return strdup("=SP r13\n" "=LR r14\n" "=PC r15\n" "=A0 r0\n" "=A1 r1\n" "=A2 r2\n" "=A3 r3\n" "=ZF zf\n" "=SF nf\n" "=OF vf\n" "=CF cf\n" "=SN or0\n" "gpr lr .32 56 0\n" "gpr pc .32 60 0\n" "gpr cpsr .32 64 0 ____tfiae_________________qvczn\n" "gpr or0 .32 68 0\n" "gpr tf .1 64.5 0 thumb\n" "gpr ef .1 64.9 0 endian\n" "gpr jf .1 64.24 0 java\n" "gpr qf .1 64.27 0 sticky_overflow\n" "gpr vf .1 64.28 0 overflow\n" "gpr cf .1 64.29 0 carry\n" "gpr zf .1 64.30 0 zero\n" "gpr nf .1 64.31 0 negative\n" "gpr itc .4 64.10 0 if_then_count\n" "gpr gef .4 64.16 0 great_or_equal\n" "gpr r0 .32 0 0\n" "gpr r1 .32 4 0\n" "gpr r2 .32 8 0\n" "gpr r3 .32 12 0\n" "gpr r4 .32 16 0\n" "gpr r5 .32 20 0\n" "gpr r6 .32 24 0\n" "gpr r7 .32 28 0\n" "gpr r8 .32 32 0\n" "gpr r9 .32 36 0\n" "gpr r10 .32 40 0\n" "gpr r11 .32 44 0\n" "gpr r12 .32 48 0\n" "gpr r13 .32 52 0\n" "gpr r14 .32 56 0\n" "gpr r15 .32 60 0\n" "gpr r16 .32 64 0\n" "gpr r17 .32 68 0\n")
#define RZ_EGG_INCDIR_PATH
#define RZ_EGG_INCDIR_ENV
RZ_API bool rz_file_exists(const char *str)
RZ_API RZ_OWN char * rz_file_slurp(const char *str, RZ_NULLABLE size_t *usz)
RZ_API int rz_hex_pair2bin(const char *arg)
RZ_API ut64 rz_num_math(RzNum *num, const char *str)
RZ_API RZ_OWN char * rz_path_prefix(RZ_NULLABLE const char *path)
Return path prefixed by the Rizin install prefix.
RZ_API char * rz_str_appendf(char *ptr, const char *fmt,...) RZ_PRINTF_CHECK(2
RZ_API char * rz_str_newf(const char *fmt,...) RZ_PRINTF_CHECK(1
RZ_API char * rz_sys_getenv(const char *key)
Get the value of an environment variable named key or NULL if none exists.
RZ_API int rz_sys_setenv(const char *key, const char *value)
Set an environment variable in the calling process.
void(* comment)(RzEgg *egg, const char *fmt,...)
struct rz_egg_lang_t::@276 syscalls[256]
struct rz_egg_lang_t::@277 aliases[256]
struct rz_egg_lang_t::@275 inlines[256]
char * ifelse_table[32][32]
char * nested_callname[32]
struct rz_egg_emit_t * remit